// Response to a SoftLayer survey's questions.
345364
func (r Survey) TakeSurvey(responses []datatypes.Survey_Response) (resp bool, err error) {
	params := []interface{}{
		responses,
	}
	err = r.Session.DoRequest("SoftLayer_Survey", "takeSurvey", params, &r.Options, &resp)
	return
}
1252788
func (bot *BotAPI) AnswerInlineQuery(config InlineConfig) (APIResponse, error) {
	v := url.Values{}

	v.Add("inline_query_id", config.InlineQueryID)
	v.Add("cache_time", strconv.Itoa(config.CacheTime))
	v.Add("is_personal", strconv.FormatBool(config.IsPersonal))
	v.Add("next_offset", config.NextOffset)
	data, err := json.Marshal(config.Results)
	if err != nil {
		return APIResponse{}, err
	}
	v.Add("results", string(data))
	v.Add("switch_pm_text", config.SwitchPMText)
	v.Add("switch_pm_parameter", config.SwitchPMParameter)

	bot.debugLog("answerInlineQuery", v, nil)

	return bot.MakeRequest("answerInlineQuery", v)
}
41263
func (auth *v2Auth) Response(resp *http.Response) error {
	auth.Auth = new(v2AuthResponse)
	err := readJson(resp, auth.Auth)
	// If successfully read Auth then no need to toggle useApiKey any more
	if err == nil {
		auth.useApiKeyOk = true
	}
	return err
}
938345
func (m *Method) inheritResponses(parent map[HTTPCode]Response, dicts map[string]interface{},
	apiDef *APIDefinition) {
	if len(m.Responses) == 0 { // allocate if needed
		m.Responses = map[HTTPCode]Response{}
	}
	for code, rParent := range parent {
		resp, ok := m.Responses[code]
		if !ok {
			if optionalTraitProperty(fmt.Sprintf("%v", code)) { // don't inherit optional property if not exist
				continue
			}
			resp = Response{HTTPCode: code}
		}
		resp.inherit(rParent, dicts, m.resourceTypeName, apiDef)
		m.Responses[code] = resp
	}

}
110413
func (parser *StandardResultParser) ParseResponse(response *SolrResponse, sr *SolrResult) (err error) {
	if resp, ok := response.Response["response"].(map[string]interface{}); ok {
		ParseDocResponse(resp, sr.Results)
	} else if grouped, ok := response.Response["grouped"].(map[string]interface{}); ok {
		sr.Grouped = grouped
	} else {
		err = fmt.Errorf(`Standard parser can only parse solr response with response object,
					ie response.response and response.response.docs. Or grouped response
					Please use other parser or implement your own parser`)
	}

	return err
}
1086158
func (p *Prompt) Ask(q *prompt.Question) (prompt.Response, error) {
	term, err := cp.NewTerminal()
	if err != nil {
		return prompt.RespCancel, err
	}

	if len(q.Error) > 0 {
		fmt.Fprintf(term.Out, "%s\n\n", q.Error)
	}

	switch q.Type {
	default:
		panic("Unknown question type")
	case prompt.TypeSelectMultiple:
		return prompt.RespCancel, fmt.Errorf("Selecting multiple isn't currently supported")
	case prompt.TypeSelectOne:
		return getSingle(term, q)
	}
}
1027950
func (wc *WebhookContext) Response(code int, s string) {
	wc.gin.String(code, s)
}
373138
func (t traceV2) Response(resp *http.Response) (err error) {
	var respTrace []byte
	// For errors we make sure to dump response body as well.
	if resp.StatusCode != http.StatusOK &&
		resp.StatusCode != http.StatusPartialContent &&
		resp.StatusCode != http.StatusNoContent {
		respTrace, err = httputil.DumpResponse(resp, true)
	} else {
		respTrace, err = httputil.DumpResponse(resp, false)
	}
	if err == nil {
		console.Debug(string(respTrace))
	}

	if globalInsecure && resp.TLS != nil {
		dumpTLSCertificates(resp.TLS)
	}

	return err
}
1307361
func (m *asfMessage) response(data interface{}) error {
	return binary.Read(bytes.NewBuffer(m.Data), binary.BigEndian, data)
}
493914
func response(ctx context.Context, url string, obj ResponseParser) error {
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		return err
	}
	req = req.WithContext(ctx)

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		return err
	}

	defer resp.Body.Close()
	data, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return err
	}

	body := strings.Trim(string(data), " []")
	if body == "" {
		return nil
	}
	if err := json.Unmarshal([]byte(body), obj); err != nil {
		Logger.Printf("payload: %s\n", body)
		return err
	}

	return nil
}
1181944
func (r User_Customer_OpenIdConnect) GetSurveys() (resp []datatypes.Survey, err error) {
	err = r.Session.DoRequest("SoftLayer_User_Customer_OpenIdConnect", "getSurveys", nil, &r.Options, &resp)
	return
}
363213
func Responses() chan Response {
	oneResp.Do(func() {
		if transitionResponses == nil {
			txResponses := dc.TxResponses()
			transitionResponses = make(chan Response, cap(txResponses))
			go func() {
				for txResp := range txResponses {
					resp := Response{}
					resp.Response = txResp
					transitionResponses <- resp
				}
				close(transitionResponses)
			}()
		}
	})
	return transitionResponses
}
693989
func (d *Document) Poll(ctx context.Context, pause time.Duration) APIResponse {
	// store upload duration. Will be overwritten otherwise
	uploadDuration := d.Timing.Upload

	start := time.Now()
	defer func() { d.Timing.Processing = time.Since(start) }()

	type CombinedResponse struct {
		doc  *Document
		resp APIResponse
	}

	docProgress := make(chan CombinedResponse, 1)

	go func(ctx context.Context) {
		for {
			select {
			case <-ctx.Done():
				return
			default:
				doc, getResponse := d.client.Get(ctx, d.Links.Document, d.Owner)
				docResponse := CombinedResponse{doc, getResponse}

				// we need to keep polling until we hit an error or finish processing
				if getResponse.Error != nil || (doc.Progress == "COMPLETED" || doc.Progress == "ERROR") {
					docProgress <- docResponse
					return
				}

				// be a (potentially) good neighbour
				time.Sleep(pause)
			}
		}
	}(ctx)

	select {
	case answer := <-docProgress:
		if answer.doc == nil || answer.resp.Error != nil {
			return answer.resp
		}

		// replace ourself with the polled document
		*d = *answer.doc

		// restore upload duration
		d.Timing.Upload = uploadDuration

		return apiResponse("polling completed", d.ID, answer.resp.HttpResponse, nil)
	case <-ctx.Done():
		return apiResponse("polling aborted", d.ID, nil, ctx.Err())
	}
}
517587
func searchResponses(ctx context.Context, resC chan<- *pb.SearchBuildsResponse, client pb.BuildsClient, req *pb.SearchBuildsRequest) error {
	req = proto.Clone(req).(*pb.SearchBuildsRequest)

	// Ensure next_page_token and build id are requested.
	if len(req.GetFields().GetPaths()) > 0 {
		req.Fields.Paths = append(req.Fields.Paths, "next_page_token", "builds.*.id")
	}

	// Page through results.
	for {
		res, err := client.SearchBuilds(ctx, req)
		if err != nil {
			return err
		}

		select {
		case resC <- res:
		case <-ctx.Done():
			return ctx.Err()
		}

		if res.NextPageToken == "" || len(res.Builds) == 0 {
			return nil
		}

		// Next page...
		req.PageToken = res.NextPageToken
	}
}
543304
func (g *Gatherer) gatherResponses(responses []ReadResponse, tags map[string]string, acc telegraf.Accumulator) {
	series := make(map[string][]point, 0)

	for _, metric := range g.metrics {
		points, ok := series[metric.Name]
		if !ok {
			points = make([]point, 0)
		}

		responsePoints, responseErrors := g.generatePoints(metric, responses)

		for _, responsePoint := range responsePoints {
			points = append(points, responsePoint)
		}

		for _, err := range responseErrors {
			acc.AddError(err)
		}

		series[metric.Name] = points
	}

	for measurement, points := range series {
		for _, point := range compactPoints(points) {
			acc.AddFields(measurement,
				point.Fields, mergeTags(point.Tags, tags))
		}
	}
}
251492
func (c *Context) AnswerInlineQueryWithResultsAndPM(res []interface{}, cacheTime int, isPersonal bool, nextOffset string, PMText string, PMParameter string) error {
	bot := c.Bot()
	_, err := bot.API.AnswerInlineQuery(tg.InlineConfig{IsPersonal: true, InlineQueryID: c.InlineQuery.ID, Results: res, NextOffset: nextOffset, SwitchPMText: PMText, SwitchPMParameter: PMParameter})
	n := time.Now()
	c.inlineQueryAnsweredAt = &n
	return err
}
1227648
func (r Survey) GetType() (resp datatypes.Survey_Type, err error) {
	err = r.Session.DoRequest("SoftLayer_Survey", "getType", nil, &r.Options, &resp)
	return
}