// NewQuestion creates a new question
7388
func NewQuestion(key string, text string) *Question {
	return &Question{
		Key:        key,
		Text:       text,
		AnswerKind: reflect.String,
	}
}
1083213
func NewRequest(q string) *Request {
	req := &Request{
		q:      q,
		Header: make(map[string][]string),
	}
	return req
}
271589
func (c *Client) NewRequest(operation *request.Operation, params interface{}, data interface{}) *request.Request {
	return request.New(c.Config, c.ClientInfo, c.Handlers, c.Retryer, operation, params, data)
}
967815
func newResponse(w http.ResponseWriter, context Context) *Response {
	return &Response{ResponseWriter: w, context: context}
}
638636
func NewRequest(query string) (*Request, error) {
	req := &Request{Query: query}
	if err := req.Prepare(); err != nil {
		return nil, err
	}
	return req, nil
}
507933
func NewRequest(a *assert.Assertion, client *http.Client, method, path string) *Request {
	if client == nil {
		client = http.DefaultClient
	}

	return &Request{
		assertion: a,
		client:    client,
		method:    method,
		path:      path,
	}
}
736657
func NewMockQuery(ctrl *gomock.Controller) *MockQuery {
	mock := &MockQuery{ctrl: ctrl}
	mock.recorder = &MockQueryMockRecorder{mock}
	return mock
}
425662
func (c *Conversation) SMPQuestion() (string, bool) {
	if c.smp.question == nil {
		return "", false
	}
	return *c.smp.question, true
}
440658
func newResponse(r *http.Response) *Response {
	response := &Response{Response: r}
	response.Status = r.Status
	response.StatusCode = r.StatusCode
	return response
}
1316832
func (c *Client) NewRequest(method, pathquery string, payload interface{}) (*http.Request, error) {
	url := *c.BaseURL

	pq := strings.SplitN(pathquery, "?", 2)
	url.Path = url.Path + fmt.Sprintf("%s/%s", apiVersion, pq[0])
	if len(pq) == 2 {
		url.RawQuery = pq[1]
	}

	body := new(bytes.Buffer)
	if payload != nil {
		err := json.NewEncoder(body).Encode(payload)
		if err != nil {
			return nil, err
		}
	}

	req, err := http.NewRequest(method, url.String(), body)
	if err != nil {
		return nil, err
	}

	req.Header.Set("Content-Type", "application/json")
	req.Header.Add("Accept", "application/json")
	req.Header.Add("User-Agent", c.UserAgent)

	return req, nil
}
8821
func NewInterview() *Interview {
	return &Interview{
		PromptTerminator: ": ",
		RequiredMessage:  "You must provide an answer to this question.",
		InvalidMessage:   "Your answer is not valid.",
		ShowOutput:       showOutput,
		ShowError:        showError,
		ReadAnswer:       readAnswer,
	}
}
644376
func (c *Client) NewRequest(method, urlStr string, body interface{}, apiVersion string) (req *APIRequest, err error) {
	var rel *url.URL
	var buf io.ReadWriter
	req = &APIRequest{}

	// I'm not sure how to get this method to return an error intentionally for testing. For testing purposes, I've
	// added a switch so that the error handling in dependent methods can be tested.
	if os.Getenv("GOCD_RAISE_ERROR_NEW_REQUEST") == "yes" {
		return req, errors.New("Mock Testing Error")
	}

	// Some calls
	if strings.HasPrefix(urlStr, "/") {
		urlStr = urlStr[1:]
	} else {
		urlStr = "api/" + urlStr
	}
	if rel, err = url.Parse(urlStr); err != nil {
		return req, err
	}

	u := c.params.BuildPath(rel)

	if body != nil {
		buf = new(bytes.Buffer)

		enc := json.NewEncoder(buf)
		enc.SetIndent("", "  ")
		err := enc.Encode(body)

		if err != nil {
			return nil, err
		}
		bdy, _ := ioutil.ReadAll(buf)
		req.Body = string(bdy)

		buf = new(bytes.Buffer)
		enc = json.NewEncoder(buf)
		enc.SetIndent("", "  ")
		enc.Encode(body)
	}

	if req.HTTP, err = http.NewRequest(method, u.String(), buf); err != nil {
		return req, err
	}

	if body != nil {
		req.HTTP.Header.Set("Content-Type", "application/json")
	}
	if apiVersion != "" {
		req.HTTP.Header.Set("Accept", apiVersion)
	}
	req.HTTP.Header.Set("User-Agent", c.params.UserAgent)

	if c.cookie == "" {
		if c.params.Username != "" && c.params.Password != "" {
			req.HTTP.SetBasicAuth(c.params.Username, c.params.Password)
		}
	} else {
		req.HTTP.Header.Set("Cookie", c.cookie)
	}

	return
}
106504
func NewMockArticle(ctrl *gomock.Controller) *MockArticle {
	mock := &MockArticle{ctrl: ctrl}
	mock.recorder = &MockArticleMockRecorder{mock}
	return mock
}
407069
func NewComment(pos position, cs string, comment string) *Comment {
	return &Comment{
		pos: pos,

		cs:      cs,
		comment: comment,
	}
}
116372
func NewResponse(body []byte, headers http.Header) *Response {
	return &Response{body: body, Headers: headers}
}
1303201
func NewRequest(method, path string) (*http.Request, error) {
	req, err := http.NewRequest(method, path, nil)

	return req, err
}
667995
func NewQuery(feed *Feed, time uint64, hint lookup.Epoch) *Query {
	return &Query{
		TimeLimit: time,
		Feed:      *feed,
		Hint:      hint,
	}
}