// NewTakeResponseBodyAsStreamArgs initializes TakeResponseBodyAsStreamArgs with the required arguments.
481240
func NewTakeResponseBodyAsStreamArgs(requestID RequestID) *TakeResponseBodyAsStreamArgs {
	args := new(TakeResponseBodyAsStreamArgs)
	args.RequestID = requestID
	return args
}
1281567
func newStreamResponseBodyReader(body io.Reader) *streamResponseBodyReader {
	return &streamResponseBodyReader{reader: bufio.NewReader(body)}
}
146563
func methodResponses(api *API, userResponses map[int]*Response, corsEnabled bool) *gocf.APIGatewayMethodMethodResponseList {

	var responses gocf.APIGatewayMethodMethodResponseList
	for eachHTTPStatusCode, eachResponse := range userResponses {
		methodResponseParams := eachResponse.Parameters
		if corsEnabled {
			for eachString, eachBool := range corsMethodResponseParams(api) {
				methodResponseParams[eachString] = eachBool
			}
		}
		// Then transform them all to strings because internet
		methodResponseStringParams := make(map[string]string, len(methodResponseParams))
		for eachKey, eachBool := range methodResponseParams {
			methodResponseStringParams[eachKey] = fmt.Sprintf("%t", eachBool)
		}
		methodResponse := gocf.APIGatewayMethodMethodResponse{
			StatusCode: gocf.String(strconv.Itoa(eachHTTPStatusCode)),
		}
		if len(methodResponseStringParams) != 0 {
			methodResponse.ResponseParameters = methodResponseStringParams
		}
		responses = append(responses, methodResponse)
	}
	return &responses
}
837964
func (h *HTTPBin) ResponseHeaders(w http.ResponseWriter, r *http.Request) {
	args := r.URL.Query()
	for k, vs := range args {
		for _, v := range vs {
			w.Header().Add(http.CanonicalHeaderKey(k), v)
		}
	}
	body, _ := json.Marshal(args)
	if contentType := w.Header().Get("Content-Type"); contentType == "" {
		w.Header().Set("Content-Type", jsonContentType)
	}
	w.Write(body)
}
1139024
func NewTwilioClientCustomHTTP(accountSid, authToken string, HTTPClient *http.Client) *Twilio {
	if HTTPClient == nil {
		HTTPClient = defaultClient
	}

	return &Twilio{
		AccountSid: accountSid,
		AuthToken:  authToken,
		BaseUrl:    baseURL,
		VideoUrl:   videoURL,
		HTTPClient: HTTPClient,
	}
}
475590
func (r *Request) setBodyString(body string) error {
	return r.setBodyReader(strings.NewReader(body))
}
150964
func (msg *Message) SetBody(contentType, body string) {
	msg.parts = []part{
		part{
			contentType: contentType,
			body:        bytes.NewBufferString(body),
		},
	}
}
454235
func NewSearchInResponseBodyArgs(requestID RequestID, query string) *SearchInResponseBodyArgs {
	args := new(SearchInResponseBodyArgs)
	args.RequestID = requestID
	args.Query = query
	return args
}
55922
func (c *ChatPostMessageCall) ValidateArgs() error {
	if len(c.channel) <= 0 {
		return errors.New(`required field channel not initialized`)
	}
	return nil
}
835700
func newTokenInjector(meta *metadata.Client, acc string) func(*http.Request) error {
	if acc == "" {
		acc = "default"
	}
	acc = url.PathEscape(acc)
	return func(req *http.Request) error {
		aud := fmt.Sprintf("%s://%s", req.URL.Scheme, req.URL.Host)
		aud = url.QueryEscape(aud)
		// TODO(smut): Cache the token and reuse if not yet expired.
		// Currently the only user of this package only makes one
		// request per boot so caching isn't too important yet.
		tok, err := meta.Get(fmt.Sprintf(tokMetadata, acc, aud))
		if err != nil {
			return err
		}
		req.Header.Set(vmtoken.Header, tok)
		return nil
	}
}
715064
func (d *domainClient) GetResponseBodyForInterception(ctx context.Context, args *GetResponseBodyForInterceptionArgs) (reply *GetResponseBodyForInterceptionReply, err error) {
	reply = new(GetResponseBodyForInterceptionReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "Network.getResponseBodyForInterception", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "Network.getResponseBodyForInterception", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "Network", Op: "GetResponseBodyForInterception", Err: err}
	}
	return
}
490427
func NewResponseWithBodyAndStatus(body *Body, c int, s string) *http.Response {
	resp := NewResponse()
	resp.Body = body
	resp.ContentLength = body.Length()
	resp.Status = s
	resp.StatusCode = c
	return resp
}
997586
func NewRequestBodyOrReference(in interface{}, context *compiler.Context) (*RequestBodyOrReference, error) {
	errors := make([]error, 0)
	x := &RequestBodyOrReference{}
	matched := false
	// RequestBody request_body = 1;
	{
		m, ok := compiler.UnpackMap(in)
		if ok {
			// errors might be ok here, they mean we just don't have the right subtype
			t, matchingError := NewRequestBody(m, compiler.NewContext("requestBody", context))
			if matchingError == nil {
				x.Oneof = &RequestBodyOrReference_RequestBody{RequestBody: t}
				matched = true
			} else {
				errors = append(errors, matchingError)
			}
		}
	}
	// Reference reference = 2;
	{
		m, ok := compiler.UnpackMap(in)
		if ok {
			// errors might be ok here, they mean we just don't have the right subtype
			t, matchingError := NewReference(m, compiler.NewContext("reference", context))
			if matchingError == nil {
				x.Oneof = &RequestBodyOrReference_Reference{Reference: t}
				matched = true
			} else {
				errors = append(errors, matchingError)
			}
		}
	}
	if matched {
		// since the oneof matched one of its possibilities, discard any matching errors
		errors = make([]error, 0)
	}
	return x, compiler.NewErrorGroupOrNil(errors)
}
597613
func (inv *Investigate) LogHTTPResponseBody(respBody io.ReadCloser) {
	if inv.verbose {
		bytes, err := ioutil.ReadAll(respBody)
		if err != nil {
			inv.Logf("error reading response body: %v", err)
		}
		inv.Logf("response body:\n%s", bytes)
	}
}
946593
func NewThumbnailArg(Path string) *ThumbnailArg {
	s := new(ThumbnailArg)
	s.Path = Path
	s.Format = &ThumbnailFormat{Tagged: dropbox.Tagged{"jpeg"}}
	s.Size = &ThumbnailSize{Tagged: dropbox.Tagged{"w64h64"}}
	s.Mode = &ThumbnailMode{Tagged: dropbox.Tagged{"strict"}}
	return s
}
954081
func NewTarStreamer(r io.Reader, excludes []ExcludeFunc, keywords []Keyword) Streamer {
	pR, pW := io.Pipe()
	ts := &tarStream{
		pipeReader: pR,
		pipeWriter: pW,
		creator:    dhCreator{DH: &DirectoryHierarchy{}},
		teeReader:  io.TeeReader(r, pW),
		tarReader:  tar.NewReader(pR),
		keywords:   keywords,
		hardlinks:  map[string][]string{},
		excludes:   excludes,
	}

	go ts.readHeaders()
	return ts
}
148262
func (s *PutMappingService) BodyString(mapping string) *PutMappingService {
	s.bodyString = mapping
	return s
}