...

Source file src/google.golang.org/api/surveys/v2/surveys-gen.go

Documentation: google.golang.org/api/surveys/v2

     1  // Copyright 2020 Google LLC.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Code generated file. DO NOT EDIT.
     6  
     7  // Package surveys provides access to the Surveys API.
     8  //
     9  // # Creating a client
    10  //
    11  // Usage example:
    12  //
    13  //	import "google.golang.org/api/surveys/v2"
    14  //	...
    15  //	ctx := context.Background()
    16  //	surveysService, err := surveys.NewService(ctx)
    17  //
    18  // In this example, Google Application Default Credentials are used for authentication.
    19  //
    20  // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    21  //
    22  // # Other authentication options
    23  //
    24  // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
    25  //
    26  //	surveysService, err := surveys.NewService(ctx, option.WithScopes(surveys.UserinfoEmailScope))
    27  //
    28  // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
    29  //
    30  //	surveysService, err := surveys.NewService(ctx, option.WithAPIKey("AIza..."))
    31  //
    32  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
    33  //
    34  //	config := &oauth2.Config{...}
    35  //	// ...
    36  //	token, err := config.Exchange(ctx, ...)
    37  //	surveysService, err := surveys.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    38  //
    39  // See https://godoc.org/google.golang.org/api/option/ for details on options.
    40  package surveys // import "google.golang.org/api/surveys/v2"
    41  
    42  import (
    43  	"bytes"
    44  	"context"
    45  	"encoding/json"
    46  	"errors"
    47  	"fmt"
    48  	"io"
    49  	"net/http"
    50  	"net/url"
    51  	"strconv"
    52  	"strings"
    53  
    54  	googleapi "google.golang.org/api/googleapi"
    55  	gensupport "google.golang.org/api/internal/gensupport"
    56  	option "google.golang.org/api/option"
    57  	htransport "google.golang.org/api/transport/http"
    58  )
    59  
    60  // Always reference these packages, just in case the auto-generated code
    61  // below doesn't.
    62  var _ = bytes.NewBuffer
    63  var _ = strconv.Itoa
    64  var _ = fmt.Sprintf
    65  var _ = json.NewDecoder
    66  var _ = io.Copy
    67  var _ = url.Parse
    68  var _ = gensupport.MarshalJSON
    69  var _ = googleapi.Version
    70  var _ = errors.New
    71  var _ = strings.Replace
    72  var _ = context.Canceled
    73  
    74  const apiId = "surveys:v2"
    75  const apiName = "surveys"
    76  const apiVersion = "v2"
    77  const basePath = "https://www.googleapis.com/surveys/v2/"
    78  
    79  // OAuth2 scopes used by this API.
    80  const (
    81  	// View and manage your surveys and results
    82  	SurveysScope = "https://www.googleapis.com/auth/surveys"
    83  
    84  	// View your surveys and survey results
    85  	SurveysReadonlyScope = "https://www.googleapis.com/auth/surveys.readonly"
    86  
    87  	// View your email address
    88  	UserinfoEmailScope = "https://www.googleapis.com/auth/userinfo.email"
    89  )
    90  
    91  // NewService creates a new Service.
    92  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
    93  	scopesOption := option.WithScopes(
    94  		"https://www.googleapis.com/auth/surveys",
    95  		"https://www.googleapis.com/auth/surveys.readonly",
    96  		"https://www.googleapis.com/auth/userinfo.email",
    97  	)
    98  	// NOTE: prepend, so we don't override user-specified scopes.
    99  	opts = append([]option.ClientOption{scopesOption}, opts...)
   100  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   101  	if err != nil {
   102  		return nil, err
   103  	}
   104  	s, err := New(client)
   105  	if err != nil {
   106  		return nil, err
   107  	}
   108  	if endpoint != "" {
   109  		s.BasePath = endpoint
   110  	}
   111  	return s, nil
   112  }
   113  
   114  // New creates a new Service. It uses the provided http.Client for requests.
   115  //
   116  // Deprecated: please use NewService instead.
   117  // To provide a custom HTTP client, use option.WithHTTPClient.
   118  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   119  func New(client *http.Client) (*Service, error) {
   120  	if client == nil {
   121  		return nil, errors.New("client is nil")
   122  	}
   123  	s := &Service{client: client, BasePath: basePath}
   124  	s.Results = NewResultsService(s)
   125  	s.Surveys = NewSurveysService(s)
   126  	return s, nil
   127  }
   128  
   129  type Service struct {
   130  	client    *http.Client
   131  	BasePath  string // API endpoint base URL
   132  	UserAgent string // optional additional User-Agent fragment
   133  
   134  	Results *ResultsService
   135  
   136  	Surveys *SurveysService
   137  }
   138  
   139  func (s *Service) userAgent() string {
   140  	if s.UserAgent == "" {
   141  		return googleapi.UserAgent
   142  	}
   143  	return googleapi.UserAgent + " " + s.UserAgent
   144  }
   145  
   146  func NewResultsService(s *Service) *ResultsService {
   147  	rs := &ResultsService{s: s}
   148  	return rs
   149  }
   150  
   151  type ResultsService struct {
   152  	s *Service
   153  }
   154  
   155  func NewSurveysService(s *Service) *SurveysService {
   156  	rs := &SurveysService{s: s}
   157  	return rs
   158  }
   159  
   160  type SurveysService struct {
   161  	s *Service
   162  }
   163  
   164  type FieldMask struct {
   165  	Fields []*FieldMask `json:"fields,omitempty"`
   166  
   167  	Id int64 `json:"id,omitempty"`
   168  
   169  	// ForceSendFields is a list of field names (e.g. "Fields") to
   170  	// unconditionally include in API requests. By default, fields with
   171  	// empty values are omitted from API requests. However, any non-pointer,
   172  	// non-interface field appearing in ForceSendFields will be sent to the
   173  	// server regardless of whether the field is empty or not. This may be
   174  	// used to include empty fields in Patch requests.
   175  	ForceSendFields []string `json:"-"`
   176  
   177  	// NullFields is a list of field names (e.g. "Fields") to include in API
   178  	// requests with the JSON null value. By default, fields with empty
   179  	// values are omitted from API requests. However, any field with an
   180  	// empty value appearing in NullFields will be sent to the server as
   181  	// null. It is an error if a field in this list has a non-empty value.
   182  	// This may be used to include null fields in Patch requests.
   183  	NullFields []string `json:"-"`
   184  }
   185  
   186  func (s *FieldMask) MarshalJSON() ([]byte, error) {
   187  	type NoMethod FieldMask
   188  	raw := NoMethod(*s)
   189  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   190  }
   191  
   192  type PageInfo struct {
   193  	ResultPerPage int64 `json:"resultPerPage,omitempty"`
   194  
   195  	StartIndex int64 `json:"startIndex,omitempty"`
   196  
   197  	TotalResults int64 `json:"totalResults,omitempty"`
   198  
   199  	// ForceSendFields is a list of field names (e.g. "ResultPerPage") to
   200  	// unconditionally include in API requests. By default, fields with
   201  	// empty values are omitted from API requests. However, any non-pointer,
   202  	// non-interface field appearing in ForceSendFields will be sent to the
   203  	// server regardless of whether the field is empty or not. This may be
   204  	// used to include empty fields in Patch requests.
   205  	ForceSendFields []string `json:"-"`
   206  
   207  	// NullFields is a list of field names (e.g. "ResultPerPage") to include
   208  	// in API requests with the JSON null value. By default, fields with
   209  	// empty values are omitted from API requests. However, any field with
   210  	// an empty value appearing in NullFields will be sent to the server as
   211  	// null. It is an error if a field in this list has a non-empty value.
   212  	// This may be used to include null fields in Patch requests.
   213  	NullFields []string `json:"-"`
   214  }
   215  
   216  func (s *PageInfo) MarshalJSON() ([]byte, error) {
   217  	type NoMethod PageInfo
   218  	raw := NoMethod(*s)
   219  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   220  }
   221  
   222  type ResultsGetRequest struct {
   223  	ResultMask *ResultsMask `json:"resultMask,omitempty"`
   224  
   225  	// ForceSendFields is a list of field names (e.g. "ResultMask") to
   226  	// unconditionally include in API requests. By default, fields with
   227  	// empty values are omitted from API requests. However, any non-pointer,
   228  	// non-interface field appearing in ForceSendFields will be sent to the
   229  	// server regardless of whether the field is empty or not. This may be
   230  	// used to include empty fields in Patch requests.
   231  	ForceSendFields []string `json:"-"`
   232  
   233  	// NullFields is a list of field names (e.g. "ResultMask") to include in
   234  	// API requests with the JSON null value. By default, fields with empty
   235  	// values are omitted from API requests. However, any field with an
   236  	// empty value appearing in NullFields will be sent to the server as
   237  	// null. It is an error if a field in this list has a non-empty value.
   238  	// This may be used to include null fields in Patch requests.
   239  	NullFields []string `json:"-"`
   240  }
   241  
   242  func (s *ResultsGetRequest) MarshalJSON() ([]byte, error) {
   243  	type NoMethod ResultsGetRequest
   244  	raw := NoMethod(*s)
   245  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   246  }
   247  
   248  type ResultsMask struct {
   249  	Fields []*FieldMask `json:"fields,omitempty"`
   250  
   251  	Projection string `json:"projection,omitempty"`
   252  
   253  	// ForceSendFields is a list of field names (e.g. "Fields") to
   254  	// unconditionally include in API requests. By default, fields with
   255  	// empty values are omitted from API requests. However, any non-pointer,
   256  	// non-interface field appearing in ForceSendFields will be sent to the
   257  	// server regardless of whether the field is empty or not. This may be
   258  	// used to include empty fields in Patch requests.
   259  	ForceSendFields []string `json:"-"`
   260  
   261  	// NullFields is a list of field names (e.g. "Fields") to include in API
   262  	// requests with the JSON null value. By default, fields with empty
   263  	// values are omitted from API requests. However, any field with an
   264  	// empty value appearing in NullFields will be sent to the server as
   265  	// null. It is an error if a field in this list has a non-empty value.
   266  	// This may be used to include null fields in Patch requests.
   267  	NullFields []string `json:"-"`
   268  }
   269  
   270  func (s *ResultsMask) MarshalJSON() ([]byte, error) {
   271  	type NoMethod ResultsMask
   272  	raw := NoMethod(*s)
   273  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   274  }
   275  
   276  // Survey: Representation of an individual survey object.
   277  type Survey struct {
   278  	// Audience: Targeting-criteria message containing demographic
   279  	// information
   280  	Audience *SurveyAudience `json:"audience,omitempty"`
   281  
   282  	// Cost: Cost to run the survey and collect the necessary number of
   283  	// responses.
   284  	Cost *SurveyCost `json:"cost,omitempty"`
   285  
   286  	// CustomerData: Additional information to store on behalf of the API
   287  	// consumer and associate with this question. This binary blob is
   288  	// treated as opaque. This field is limited to 64K bytes.
   289  	CustomerData string `json:"customerData,omitempty"`
   290  
   291  	// Description: Text description of the survey.
   292  	Description string `json:"description,omitempty"`
   293  
   294  	// Owners: List of email addresses for survey owners. Must contain at
   295  	// least the address of the user making the API call.
   296  	Owners []string `json:"owners,omitempty"`
   297  
   298  	// Questions: List of questions defining the survey.
   299  	Questions []*SurveyQuestion `json:"questions,omitempty"`
   300  
   301  	// RejectionReason: Reason for the survey being rejected. Only present
   302  	// if the survey state is rejected.
   303  	RejectionReason *SurveyRejection `json:"rejectionReason,omitempty"`
   304  
   305  	// State: State that the survey is in.
   306  	State string `json:"state,omitempty"`
   307  
   308  	// SurveyUrlId: Unique survey ID, that is viewable in the URL of the
   309  	// Survey Creator UI
   310  	SurveyUrlId string `json:"surveyUrlId,omitempty"`
   311  
   312  	// Title: Optional name that will be given to the survey.
   313  	Title string `json:"title,omitempty"`
   314  
   315  	// WantedResponseCount: Number of responses desired for the survey.
   316  	WantedResponseCount int64 `json:"wantedResponseCount,omitempty"`
   317  
   318  	// ServerResponse contains the HTTP response code and headers from the
   319  	// server.
   320  	googleapi.ServerResponse `json:"-"`
   321  
   322  	// ForceSendFields is a list of field names (e.g. "Audience") to
   323  	// unconditionally include in API requests. By default, fields with
   324  	// empty values are omitted from API requests. However, any non-pointer,
   325  	// non-interface field appearing in ForceSendFields will be sent to the
   326  	// server regardless of whether the field is empty or not. This may be
   327  	// used to include empty fields in Patch requests.
   328  	ForceSendFields []string `json:"-"`
   329  
   330  	// NullFields is a list of field names (e.g. "Audience") to include in
   331  	// API requests with the JSON null value. By default, fields with empty
   332  	// values are omitted from API requests. However, any field with an
   333  	// empty value appearing in NullFields will be sent to the server as
   334  	// null. It is an error if a field in this list has a non-empty value.
   335  	// This may be used to include null fields in Patch requests.
   336  	NullFields []string `json:"-"`
   337  }
   338  
   339  func (s *Survey) MarshalJSON() ([]byte, error) {
   340  	type NoMethod Survey
   341  	raw := NoMethod(*s)
   342  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   343  }
   344  
   345  // SurveyAudience: Specifications for the target audience of a survey
   346  // run through the API.
   347  type SurveyAudience struct {
   348  	// Ages: Optional list of age buckets to target. Supported age buckets
   349  	// are: ['18-24', '25-34', '35-44', '45-54', '55-64', '65+']
   350  	Ages []string `json:"ages,omitempty"`
   351  
   352  	// Country: Required country code that surveys should be targeted to.
   353  	// Accepts standard ISO 3166-1 2 character language codes. For instance,
   354  	// 'US' for the United States, and 'GB' for the United Kingdom.
   355  	Country string `json:"country,omitempty"`
   356  
   357  	// CountrySubdivision: Country subdivision (states/provinces/etc) that
   358  	// surveys should be targeted to. For all countries except GB,
   359  	// ISO-3166-2 subdivision code is required (eg. 'US-OH' for Ohio, United
   360  	// States). For GB, NUTS 1 statistical region codes for the United
   361  	// Kingdom is required (eg. 'UK-UKC' for North East England).
   362  	CountrySubdivision string `json:"countrySubdivision,omitempty"`
   363  
   364  	// Gender: Optional gender to target.
   365  	Gender string `json:"gender,omitempty"`
   366  
   367  	// Languages: Language code that surveys should be targeted to. For
   368  	// instance, 'en-US'. Surveys may target bilingual users by specifying a
   369  	// list of language codes (for example, 'de' and 'en-US'). In that case,
   370  	// all languages will be used for targeting users but the survey content
   371  	// (which is displayed) must match the first language listed. Accepts
   372  	// standard BCP47 language codes. See specification.
   373  	Languages []string `json:"languages,omitempty"`
   374  
   375  	// PopulationSource: Online population source where the respondents are
   376  	// sampled from.
   377  	PopulationSource string `json:"populationSource,omitempty"`
   378  
   379  	// ForceSendFields is a list of field names (e.g. "Ages") to
   380  	// unconditionally include in API requests. By default, fields with
   381  	// empty values are omitted from API requests. However, any non-pointer,
   382  	// non-interface field appearing in ForceSendFields will be sent to the
   383  	// server regardless of whether the field is empty or not. This may be
   384  	// used to include empty fields in Patch requests.
   385  	ForceSendFields []string `json:"-"`
   386  
   387  	// NullFields is a list of field names (e.g. "Ages") to include in API
   388  	// requests with the JSON null value. By default, fields with empty
   389  	// values are omitted from API requests. However, any field with an
   390  	// empty value appearing in NullFields will be sent to the server as
   391  	// null. It is an error if a field in this list has a non-empty value.
   392  	// This may be used to include null fields in Patch requests.
   393  	NullFields []string `json:"-"`
   394  }
   395  
   396  func (s *SurveyAudience) MarshalJSON() ([]byte, error) {
   397  	type NoMethod SurveyAudience
   398  	raw := NoMethod(*s)
   399  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   400  }
   401  
   402  // SurveyCost: Message defining the cost to run a given survey through
   403  // API.
   404  type SurveyCost struct {
   405  	// CostPerResponseNanos: Cost per survey response in nano units of the
   406  	// given currency. To get the total cost for a survey, multiply this
   407  	// value by wanted_response_count.
   408  	CostPerResponseNanos int64 `json:"costPerResponseNanos,omitempty,string"`
   409  
   410  	// CurrencyCode: Currency code that the cost is given in.
   411  	CurrencyCode string `json:"currencyCode,omitempty"`
   412  
   413  	// MaxCostPerResponseNanos: *Deprecated* Threshold to start a survey
   414  	// automatically if the quoted price is at most this value. When a
   415  	// survey has a Screener (threshold) question, it must go through an
   416  	// incidence pricing test to determine the final cost per response.
   417  	// Typically you will have to make a followup call to start the survey
   418  	// giving the final computed cost per response. If the survey has no
   419  	// threshold_answers, setting this property will return an error. By
   420  	// specifying this property, you indicate the max price per response you
   421  	// are willing to pay in advance of the incidence test. If the price
   422  	// turns out to be lower than the specified value, the survey will begin
   423  	// immediately and you will be charged at the rate determined by the
   424  	// incidence pricing test. If the price turns out to be greater than the
   425  	// specified value the survey will not be started and you will instead
   426  	// be notified what price was determined by the incidence test. At that
   427  	// point, you must raise the value of this property to be greater than
   428  	// or equal to that cost before attempting to start the survey again.
   429  	// This will immediately start the survey as long the incidence test was
   430  	// run within the last 21 days. This will no longer be available after
   431  	// June 2018.
   432  	MaxCostPerResponseNanos int64 `json:"maxCostPerResponseNanos,omitempty,string"`
   433  
   434  	// Nanos: Cost of survey in nano units of the given currency. DEPRECATED
   435  	// in favor of cost_per_response_nanos
   436  	Nanos int64 `json:"nanos,omitempty,string"`
   437  
   438  	// ForceSendFields is a list of field names (e.g.
   439  	// "CostPerResponseNanos") to unconditionally include in API requests.
   440  	// By default, fields with empty values are omitted from API requests.
   441  	// However, any non-pointer, non-interface field appearing in
   442  	// ForceSendFields will be sent to the server regardless of whether the
   443  	// field is empty or not. This may be used to include empty fields in
   444  	// Patch requests.
   445  	ForceSendFields []string `json:"-"`
   446  
   447  	// NullFields is a list of field names (e.g. "CostPerResponseNanos") to
   448  	// include in API requests with the JSON null value. By default, fields
   449  	// with empty values are omitted from API requests. However, any field
   450  	// with an empty value appearing in NullFields will be sent to the
   451  	// server as null. It is an error if a field in this list has a
   452  	// non-empty value. This may be used to include null fields in Patch
   453  	// requests.
   454  	NullFields []string `json:"-"`
   455  }
   456  
   457  func (s *SurveyCost) MarshalJSON() ([]byte, error) {
   458  	type NoMethod SurveyCost
   459  	raw := NoMethod(*s)
   460  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   461  }
   462  
   463  // SurveyQuestion: Message defining the question specifications.
   464  type SurveyQuestion struct {
   465  	// AnswerOrder: The randomization option for multiple choice and
   466  	// multi-select questions. If not specified, this option defaults to
   467  	// randomize.
   468  	AnswerOrder string `json:"answerOrder,omitempty"`
   469  
   470  	// Answers: Required list of answer options for a question.
   471  	Answers []string `json:"answers,omitempty"`
   472  
   473  	// HasOther: Option to allow open-ended text box for Single Answer and
   474  	// Multiple Answer question types. This can be used with SINGLE_ANSWER,
   475  	// SINGLE_ANSWER_WITH_IMAGE, MULTIPLE_ANSWERS, and
   476  	// MULTIPLE_ANSWERS_WITH_IMAGE question types.
   477  	HasOther bool `json:"hasOther,omitempty"`
   478  
   479  	// HighValueLabel: For rating questions, the text for the higher end of
   480  	// the scale, such as 'Best'. For numeric questions, a string
   481  	// representing a floating-point that is the maximum allowed number for
   482  	// a response.
   483  	HighValueLabel string `json:"highValueLabel,omitempty"`
   484  
   485  	Images []*SurveyQuestionImage `json:"images,omitempty"`
   486  
   487  	// LastAnswerPositionPinned: Currently only support pinning an answer
   488  	// option to the last position.
   489  	LastAnswerPositionPinned bool `json:"lastAnswerPositionPinned,omitempty"`
   490  
   491  	// LowValueLabel: For rating questions, the text for the lower end of
   492  	// the scale, such as 'Worst'. For numeric questions, a string
   493  	// representing a floating-point that is the minimum allowed number for
   494  	// a response.
   495  	LowValueLabel string `json:"lowValueLabel,omitempty"`
   496  
   497  	// MustPickSuggestion: Option to force the user to pick one of the open
   498  	// text suggestions. This requires that suggestions are provided for
   499  	// this question.
   500  	MustPickSuggestion bool `json:"mustPickSuggestion,omitempty"`
   501  
   502  	// NumStars: Number of stars to use for ratings questions.
   503  	NumStars string `json:"numStars,omitempty"`
   504  
   505  	// OpenTextPlaceholder: Placeholder text for an open text question.
   506  	OpenTextPlaceholder string `json:"openTextPlaceholder,omitempty"`
   507  
   508  	// OpenTextSuggestions: A list of suggested answers for open text
   509  	// question auto-complete. This is only valid if single_line_response is
   510  	// true.
   511  	OpenTextSuggestions []string `json:"openTextSuggestions,omitempty"`
   512  
   513  	// Question: Required question text shown to the respondent.
   514  	Question string `json:"question,omitempty"`
   515  
   516  	// SentimentText: Used by the Rating Scale with Text question type. This
   517  	// text goes along with the question field that is presented to the
   518  	// respondent, and is the actual text that the respondent is asked to
   519  	// rate.
   520  	SentimentText string `json:"sentimentText,omitempty"`
   521  
   522  	// SingleLineResponse: Option to allow multiple line open text responses
   523  	// instead of a single line response. Note that we don't show
   524  	// auto-complete suggestions with multiple line responses.
   525  	SingleLineResponse bool `json:"singleLineResponse,omitempty"`
   526  
   527  	// ThresholdAnswers: The threshold/screener answer options, which will
   528  	// screen a user into the rest of the survey. These will be a subset of
   529  	// the answer option strings.
   530  	ThresholdAnswers []string `json:"thresholdAnswers,omitempty"`
   531  
   532  	// Type: Required field defining the question type. For details about
   533  	// configuring different type of questions, consult the question
   534  	// configuration guide.
   535  	Type string `json:"type,omitempty"`
   536  
   537  	// UnitOfMeasurementLabel: Optional unit of measurement for display (for
   538  	// example: hours, people, miles).
   539  	UnitOfMeasurementLabel string `json:"unitOfMeasurementLabel,omitempty"`
   540  
   541  	// VideoId: The YouTube video ID to be show in video questions.
   542  	VideoId string `json:"videoId,omitempty"`
   543  
   544  	// ForceSendFields is a list of field names (e.g. "AnswerOrder") to
   545  	// unconditionally include in API requests. By default, fields with
   546  	// empty values are omitted from API requests. However, any non-pointer,
   547  	// non-interface field appearing in ForceSendFields will be sent to the
   548  	// server regardless of whether the field is empty or not. This may be
   549  	// used to include empty fields in Patch requests.
   550  	ForceSendFields []string `json:"-"`
   551  
   552  	// NullFields is a list of field names (e.g. "AnswerOrder") to include
   553  	// in API requests with the JSON null value. By default, fields with
   554  	// empty values are omitted from API requests. However, any field with
   555  	// an empty value appearing in NullFields will be sent to the server as
   556  	// null. It is an error if a field in this list has a non-empty value.
   557  	// This may be used to include null fields in Patch requests.
   558  	NullFields []string `json:"-"`
   559  }
   560  
   561  func (s *SurveyQuestion) MarshalJSON() ([]byte, error) {
   562  	type NoMethod SurveyQuestion
   563  	raw := NoMethod(*s)
   564  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   565  }
   566  
   567  // SurveyQuestionImage: Container object for image data and alt_text.
   568  type SurveyQuestionImage struct {
   569  	// AltText: The alt text property used in image tags is required for all
   570  	// images.
   571  	AltText string `json:"altText,omitempty"`
   572  
   573  	// Data: Inline jpeg, gif, tiff, bmp, or png image raw bytes for an
   574  	// image question types.
   575  	Data string `json:"data,omitempty"`
   576  
   577  	// Url: The read-only URL for the hosted images.
   578  	Url string `json:"url,omitempty"`
   579  
   580  	// ForceSendFields is a list of field names (e.g. "AltText") to
   581  	// unconditionally include in API requests. By default, fields with
   582  	// empty values are omitted from API requests. However, any non-pointer,
   583  	// non-interface field appearing in ForceSendFields will be sent to the
   584  	// server regardless of whether the field is empty or not. This may be
   585  	// used to include empty fields in Patch requests.
   586  	ForceSendFields []string `json:"-"`
   587  
   588  	// NullFields is a list of field names (e.g. "AltText") to include in
   589  	// API requests with the JSON null value. By default, fields with empty
   590  	// values are omitted from API requests. However, any field with an
   591  	// empty value appearing in NullFields will be sent to the server as
   592  	// null. It is an error if a field in this list has a non-empty value.
   593  	// This may be used to include null fields in Patch requests.
   594  	NullFields []string `json:"-"`
   595  }
   596  
   597  func (s *SurveyQuestionImage) MarshalJSON() ([]byte, error) {
   598  	type NoMethod SurveyQuestionImage
   599  	raw := NoMethod(*s)
   600  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   601  }
   602  
   603  // SurveyRejection: Message representing why the survey was rejected
   604  // from review, if it was.
   605  type SurveyRejection struct {
   606  	// Explanation: A human-readable explanation of what was wrong with the
   607  	// survey.
   608  	Explanation string `json:"explanation,omitempty"`
   609  
   610  	// Type: Which category of rejection this was. See the  Google Surveys
   611  	// Help Center for additional details on each category.
   612  	Type string `json:"type,omitempty"`
   613  
   614  	// ForceSendFields is a list of field names (e.g. "Explanation") to
   615  	// unconditionally include in API requests. By default, fields with
   616  	// empty values are omitted from API requests. However, any non-pointer,
   617  	// non-interface field appearing in ForceSendFields will be sent to the
   618  	// server regardless of whether the field is empty or not. This may be
   619  	// used to include empty fields in Patch requests.
   620  	ForceSendFields []string `json:"-"`
   621  
   622  	// NullFields is a list of field names (e.g. "Explanation") to include
   623  	// in API requests with the JSON null value. By default, fields with
   624  	// empty values are omitted from API requests. However, any field with
   625  	// an empty value appearing in NullFields will be sent to the server as
   626  	// null. It is an error if a field in this list has a non-empty value.
   627  	// This may be used to include null fields in Patch requests.
   628  	NullFields []string `json:"-"`
   629  }
   630  
   631  func (s *SurveyRejection) MarshalJSON() ([]byte, error) {
   632  	type NoMethod SurveyRejection
   633  	raw := NoMethod(*s)
   634  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   635  }
   636  
   637  // SurveyResults: Reference to the current results for a given survey.
   638  type SurveyResults struct {
   639  	// Status: Human readable string describing the status of the request.
   640  	Status string `json:"status,omitempty"`
   641  
   642  	// SurveyUrlId: External survey ID as viewable by survey owners in the
   643  	// editor view.
   644  	SurveyUrlId string `json:"surveyUrlId,omitempty"`
   645  
   646  	// ServerResponse contains the HTTP response code and headers from the
   647  	// server.
   648  	googleapi.ServerResponse `json:"-"`
   649  
   650  	// ForceSendFields is a list of field names (e.g. "Status") to
   651  	// unconditionally include in API requests. By default, fields with
   652  	// empty values are omitted from API requests. However, any non-pointer,
   653  	// non-interface field appearing in ForceSendFields will be sent to the
   654  	// server regardless of whether the field is empty or not. This may be
   655  	// used to include empty fields in Patch requests.
   656  	ForceSendFields []string `json:"-"`
   657  
   658  	// NullFields is a list of field names (e.g. "Status") to include in API
   659  	// requests with the JSON null value. By default, fields with empty
   660  	// values are omitted from API requests. However, any field with an
   661  	// empty value appearing in NullFields will be sent to the server as
   662  	// null. It is an error if a field in this list has a non-empty value.
   663  	// This may be used to include null fields in Patch requests.
   664  	NullFields []string `json:"-"`
   665  }
   666  
   667  func (s *SurveyResults) MarshalJSON() ([]byte, error) {
   668  	type NoMethod SurveyResults
   669  	raw := NoMethod(*s)
   670  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   671  }
   672  
   673  type SurveysDeleteResponse struct {
   674  	// RequestId: Unique request ID used for logging and debugging. Please
   675  	// include in any error reporting or troubleshooting requests.
   676  	RequestId string `json:"requestId,omitempty"`
   677  
   678  	// ServerResponse contains the HTTP response code and headers from the
   679  	// server.
   680  	googleapi.ServerResponse `json:"-"`
   681  
   682  	// ForceSendFields is a list of field names (e.g. "RequestId") to
   683  	// unconditionally include in API requests. By default, fields with
   684  	// empty values are omitted from API requests. However, any non-pointer,
   685  	// non-interface field appearing in ForceSendFields will be sent to the
   686  	// server regardless of whether the field is empty or not. This may be
   687  	// used to include empty fields in Patch requests.
   688  	ForceSendFields []string `json:"-"`
   689  
   690  	// NullFields is a list of field names (e.g. "RequestId") to include in
   691  	// API requests with the JSON null value. By default, fields with empty
   692  	// values are omitted from API requests. However, any field with an
   693  	// empty value appearing in NullFields will be sent to the server as
   694  	// null. It is an error if a field in this list has a non-empty value.
   695  	// This may be used to include null fields in Patch requests.
   696  	NullFields []string `json:"-"`
   697  }
   698  
   699  func (s *SurveysDeleteResponse) MarshalJSON() ([]byte, error) {
   700  	type NoMethod SurveysDeleteResponse
   701  	raw := NoMethod(*s)
   702  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   703  }
   704  
   705  type SurveysListResponse struct {
   706  	PageInfo *PageInfo `json:"pageInfo,omitempty"`
   707  
   708  	// RequestId: Unique request ID used for logging and debugging. Please
   709  	// include in any error reporting or troubleshooting requests.
   710  	RequestId string `json:"requestId,omitempty"`
   711  
   712  	// Resources: An individual survey resource.
   713  	Resources []*Survey `json:"resources,omitempty"`
   714  
   715  	TokenPagination *TokenPagination `json:"tokenPagination,omitempty"`
   716  
   717  	// ServerResponse contains the HTTP response code and headers from the
   718  	// server.
   719  	googleapi.ServerResponse `json:"-"`
   720  
   721  	// ForceSendFields is a list of field names (e.g. "PageInfo") to
   722  	// unconditionally include in API requests. By default, fields with
   723  	// empty values are omitted from API requests. However, any non-pointer,
   724  	// non-interface field appearing in ForceSendFields will be sent to the
   725  	// server regardless of whether the field is empty or not. This may be
   726  	// used to include empty fields in Patch requests.
   727  	ForceSendFields []string `json:"-"`
   728  
   729  	// NullFields is a list of field names (e.g. "PageInfo") to include in
   730  	// API requests with the JSON null value. By default, fields with empty
   731  	// values are omitted from API requests. However, any field with an
   732  	// empty value appearing in NullFields will be sent to the server as
   733  	// null. It is an error if a field in this list has a non-empty value.
   734  	// This may be used to include null fields in Patch requests.
   735  	NullFields []string `json:"-"`
   736  }
   737  
   738  func (s *SurveysListResponse) MarshalJSON() ([]byte, error) {
   739  	type NoMethod SurveysListResponse
   740  	raw := NoMethod(*s)
   741  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   742  }
   743  
   744  type SurveysStartRequest struct {
   745  	// MaxCostPerResponseNanos: *Deprecated* Threshold to start a survey
   746  	// automatically if the quoted prices is less than or equal to this
   747  	// value. See Survey.Cost for more details. This will no longer be
   748  	// available after June 2018.
   749  	MaxCostPerResponseNanos int64 `json:"maxCostPerResponseNanos,omitempty,string"`
   750  
   751  	// ForceSendFields is a list of field names (e.g.
   752  	// "MaxCostPerResponseNanos") to unconditionally include in API
   753  	// requests. By default, fields with empty values are omitted from API
   754  	// requests. However, any non-pointer, non-interface field appearing in
   755  	// ForceSendFields will be sent to the server regardless of whether the
   756  	// field is empty or not. This may be used to include empty fields in
   757  	// Patch requests.
   758  	ForceSendFields []string `json:"-"`
   759  
   760  	// NullFields is a list of field names (e.g. "MaxCostPerResponseNanos")
   761  	// to include in API requests with the JSON null value. By default,
   762  	// fields with empty values are omitted from API requests. However, any
   763  	// field with an empty value appearing in NullFields will be sent to the
   764  	// server as null. It is an error if a field in this list has a
   765  	// non-empty value. This may be used to include null fields in Patch
   766  	// requests.
   767  	NullFields []string `json:"-"`
   768  }
   769  
   770  func (s *SurveysStartRequest) MarshalJSON() ([]byte, error) {
   771  	type NoMethod SurveysStartRequest
   772  	raw := NoMethod(*s)
   773  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   774  }
   775  
   776  type SurveysStartResponse struct {
   777  	// RequestId: Unique request ID used for logging and debugging. Please
   778  	// include in any error reporting or troubleshooting requests.
   779  	RequestId string `json:"requestId,omitempty"`
   780  
   781  	// ServerResponse contains the HTTP response code and headers from the
   782  	// server.
   783  	googleapi.ServerResponse `json:"-"`
   784  
   785  	// ForceSendFields is a list of field names (e.g. "RequestId") to
   786  	// unconditionally include in API requests. By default, fields with
   787  	// empty values are omitted from API requests. However, any non-pointer,
   788  	// non-interface field appearing in ForceSendFields will be sent to the
   789  	// server regardless of whether the field is empty or not. This may be
   790  	// used to include empty fields in Patch requests.
   791  	ForceSendFields []string `json:"-"`
   792  
   793  	// NullFields is a list of field names (e.g. "RequestId") to include in
   794  	// API requests with the JSON null value. By default, fields with empty
   795  	// values are omitted from API requests. However, any field with an
   796  	// empty value appearing in NullFields will be sent to the server as
   797  	// null. It is an error if a field in this list has a non-empty value.
   798  	// This may be used to include null fields in Patch requests.
   799  	NullFields []string `json:"-"`
   800  }
   801  
   802  func (s *SurveysStartResponse) MarshalJSON() ([]byte, error) {
   803  	type NoMethod SurveysStartResponse
   804  	raw := NoMethod(*s)
   805  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   806  }
   807  
   808  type SurveysStopResponse struct {
   809  	// RequestId: Unique request ID used for logging and debugging. Please
   810  	// include in any error reporting or troubleshooting requests.
   811  	RequestId string `json:"requestId,omitempty"`
   812  
   813  	// ServerResponse contains the HTTP response code and headers from the
   814  	// server.
   815  	googleapi.ServerResponse `json:"-"`
   816  
   817  	// ForceSendFields is a list of field names (e.g. "RequestId") to
   818  	// unconditionally include in API requests. By default, fields with
   819  	// empty values are omitted from API requests. However, any non-pointer,
   820  	// non-interface field appearing in ForceSendFields will be sent to the
   821  	// server regardless of whether the field is empty or not. This may be
   822  	// used to include empty fields in Patch requests.
   823  	ForceSendFields []string `json:"-"`
   824  
   825  	// NullFields is a list of field names (e.g. "RequestId") to include in
   826  	// API requests with the JSON null value. By default, fields with empty
   827  	// values are omitted from API requests. However, any field with an
   828  	// empty value appearing in NullFields will be sent to the server as
   829  	// null. It is an error if a field in this list has a non-empty value.
   830  	// This may be used to include null fields in Patch requests.
   831  	NullFields []string `json:"-"`
   832  }
   833  
   834  func (s *SurveysStopResponse) MarshalJSON() ([]byte, error) {
   835  	type NoMethod SurveysStopResponse
   836  	raw := NoMethod(*s)
   837  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   838  }
   839  
   840  type TokenPagination struct {
   841  	NextPageToken string `json:"nextPageToken,omitempty"`
   842  
   843  	PreviousPageToken string `json:"previousPageToken,omitempty"`
   844  
   845  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   846  	// unconditionally include in API requests. By default, fields with
   847  	// empty values are omitted from API requests. However, any non-pointer,
   848  	// non-interface field appearing in ForceSendFields will be sent to the
   849  	// server regardless of whether the field is empty or not. This may be
   850  	// used to include empty fields in Patch requests.
   851  	ForceSendFields []string `json:"-"`
   852  
   853  	// NullFields is a list of field names (e.g. "NextPageToken") to include
   854  	// in API requests with the JSON null value. By default, fields with
   855  	// empty values are omitted from API requests. However, any field with
   856  	// an empty value appearing in NullFields will be sent to the server as
   857  	// null. It is an error if a field in this list has a non-empty value.
   858  	// This may be used to include null fields in Patch requests.
   859  	NullFields []string `json:"-"`
   860  }
   861  
   862  func (s *TokenPagination) MarshalJSON() ([]byte, error) {
   863  	type NoMethod TokenPagination
   864  	raw := NoMethod(*s)
   865  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   866  }
   867  
   868  // method id "surveys.results.get":
   869  
   870  type ResultsGetCall struct {
   871  	s                 *Service
   872  	surveyUrlId       string
   873  	resultsgetrequest *ResultsGetRequest
   874  	urlParams_        gensupport.URLParams
   875  	ifNoneMatch_      string
   876  	ctx_              context.Context
   877  	header_           http.Header
   878  }
   879  
   880  // Get: Retrieves any survey results that have been produced so far.
   881  // Results are formatted as an Excel file. You must add "?alt=media" to
   882  // the URL as an argument to get results.
   883  func (r *ResultsService) Get(surveyUrlId string, resultsgetrequest *ResultsGetRequest) *ResultsGetCall {
   884  	c := &ResultsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   885  	c.surveyUrlId = surveyUrlId
   886  	c.resultsgetrequest = resultsgetrequest
   887  	return c
   888  }
   889  
   890  // Fields allows partial responses to be retrieved. See
   891  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
   892  // for more information.
   893  func (c *ResultsGetCall) Fields(s ...googleapi.Field) *ResultsGetCall {
   894  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   895  	return c
   896  }
   897  
   898  // IfNoneMatch sets the optional parameter which makes the operation
   899  // fail if the object's ETag matches the given value. This is useful for
   900  // getting updates only after the object has changed since the last
   901  // request. Use googleapi.IsNotModified to check whether the response
   902  // error from Do is the result of In-None-Match.
   903  func (c *ResultsGetCall) IfNoneMatch(entityTag string) *ResultsGetCall {
   904  	c.ifNoneMatch_ = entityTag
   905  	return c
   906  }
   907  
   908  // Context sets the context to be used in this call's Do and Download
   909  // methods. Any pending HTTP request will be aborted if the provided
   910  // context is canceled.
   911  func (c *ResultsGetCall) Context(ctx context.Context) *ResultsGetCall {
   912  	c.ctx_ = ctx
   913  	return c
   914  }
   915  
   916  // Header returns an http.Header that can be modified by the caller to
   917  // add HTTP headers to the request.
   918  func (c *ResultsGetCall) Header() http.Header {
   919  	if c.header_ == nil {
   920  		c.header_ = make(http.Header)
   921  	}
   922  	return c.header_
   923  }
   924  
   925  func (c *ResultsGetCall) doRequest(alt string) (*http.Response, error) {
   926  	reqHeaders := make(http.Header)
   927  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
   928  	for k, v := range c.header_ {
   929  		reqHeaders[k] = v
   930  	}
   931  	reqHeaders.Set("User-Agent", c.s.userAgent())
   932  	if c.ifNoneMatch_ != "" {
   933  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   934  	}
   935  	var body io.Reader = nil
   936  	c.urlParams_.Set("alt", alt)
   937  	c.urlParams_.Set("prettyPrint", "false")
   938  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys/{surveyUrlId}/results")
   939  	urls += "?" + c.urlParams_.Encode()
   940  	req, err := http.NewRequest("GET", urls, body)
   941  	if err != nil {
   942  		return nil, err
   943  	}
   944  	req.Header = reqHeaders
   945  	googleapi.Expand(req.URL, map[string]string{
   946  		"surveyUrlId": c.surveyUrlId,
   947  	})
   948  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   949  }
   950  
   951  // Download fetches the API endpoint's "media" value, instead of the normal
   952  // API response value. If the returned error is nil, the Response is guaranteed to
   953  // have a 2xx status code. Callers must close the Response.Body as usual.
   954  func (c *ResultsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
   955  	gensupport.SetOptions(c.urlParams_, opts...)
   956  	res, err := c.doRequest("media")
   957  	if err != nil {
   958  		return nil, err
   959  	}
   960  	if err := googleapi.CheckMediaResponse(res); err != nil {
   961  		res.Body.Close()
   962  		return nil, err
   963  	}
   964  	return res, nil
   965  }
   966  
   967  // Do executes the "surveys.results.get" call.
   968  // Exactly one of *SurveyResults or error will be non-nil. Any non-2xx
   969  // status code is an error. Response headers are in either
   970  // *SurveyResults.ServerResponse.Header or (if a response was returned
   971  // at all) in error.(*googleapi.Error).Header. Use
   972  // googleapi.IsNotModified to check whether the returned error was
   973  // because http.StatusNotModified was returned.
   974  func (c *ResultsGetCall) Do(opts ...googleapi.CallOption) (*SurveyResults, error) {
   975  	gensupport.SetOptions(c.urlParams_, opts...)
   976  	res, err := c.doRequest("json")
   977  	if res != nil && res.StatusCode == http.StatusNotModified {
   978  		if res.Body != nil {
   979  			res.Body.Close()
   980  		}
   981  		return nil, &googleapi.Error{
   982  			Code:   res.StatusCode,
   983  			Header: res.Header,
   984  		}
   985  	}
   986  	if err != nil {
   987  		return nil, err
   988  	}
   989  	defer googleapi.CloseBody(res)
   990  	if err := googleapi.CheckResponse(res); err != nil {
   991  		return nil, err
   992  	}
   993  	ret := &SurveyResults{
   994  		ServerResponse: googleapi.ServerResponse{
   995  			Header:         res.Header,
   996  			HTTPStatusCode: res.StatusCode,
   997  		},
   998  	}
   999  	target := &ret
  1000  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1001  		return nil, err
  1002  	}
  1003  	return ret, nil
  1004  	// {
  1005  	//   "description": "Retrieves any survey results that have been produced so far. Results are formatted as an Excel file. You must add \"?alt=media\" to the URL as an argument to get results.",
  1006  	//   "httpMethod": "GET",
  1007  	//   "id": "surveys.results.get",
  1008  	//   "parameterOrder": [
  1009  	//     "surveyUrlId"
  1010  	//   ],
  1011  	//   "parameters": {
  1012  	//     "surveyUrlId": {
  1013  	//       "description": "External URL ID for the survey.",
  1014  	//       "location": "path",
  1015  	//       "required": true,
  1016  	//       "type": "string"
  1017  	//     }
  1018  	//   },
  1019  	//   "path": "surveys/{surveyUrlId}/results",
  1020  	//   "request": {
  1021  	//     "$ref": "ResultsGetRequest"
  1022  	//   },
  1023  	//   "response": {
  1024  	//     "$ref": "SurveyResults"
  1025  	//   },
  1026  	//   "scopes": [
  1027  	//     "https://www.googleapis.com/auth/surveys",
  1028  	//     "https://www.googleapis.com/auth/surveys.readonly",
  1029  	//     "https://www.googleapis.com/auth/userinfo.email"
  1030  	//   ],
  1031  	//   "supportsMediaDownload": true
  1032  	// }
  1033  
  1034  }
  1035  
  1036  // method id "surveys.surveys.delete":
  1037  
  1038  type SurveysDeleteCall struct {
  1039  	s           *Service
  1040  	surveyUrlId string
  1041  	urlParams_  gensupport.URLParams
  1042  	ctx_        context.Context
  1043  	header_     http.Header
  1044  }
  1045  
  1046  // Delete: Removes a survey from view in all user GET requests.
  1047  func (r *SurveysService) Delete(surveyUrlId string) *SurveysDeleteCall {
  1048  	c := &SurveysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1049  	c.surveyUrlId = surveyUrlId
  1050  	return c
  1051  }
  1052  
  1053  // Fields allows partial responses to be retrieved. See
  1054  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1055  // for more information.
  1056  func (c *SurveysDeleteCall) Fields(s ...googleapi.Field) *SurveysDeleteCall {
  1057  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1058  	return c
  1059  }
  1060  
  1061  // Context sets the context to be used in this call's Do method. Any
  1062  // pending HTTP request will be aborted if the provided context is
  1063  // canceled.
  1064  func (c *SurveysDeleteCall) Context(ctx context.Context) *SurveysDeleteCall {
  1065  	c.ctx_ = ctx
  1066  	return c
  1067  }
  1068  
  1069  // Header returns an http.Header that can be modified by the caller to
  1070  // add HTTP headers to the request.
  1071  func (c *SurveysDeleteCall) Header() http.Header {
  1072  	if c.header_ == nil {
  1073  		c.header_ = make(http.Header)
  1074  	}
  1075  	return c.header_
  1076  }
  1077  
  1078  func (c *SurveysDeleteCall) doRequest(alt string) (*http.Response, error) {
  1079  	reqHeaders := make(http.Header)
  1080  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1081  	for k, v := range c.header_ {
  1082  		reqHeaders[k] = v
  1083  	}
  1084  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1085  	var body io.Reader = nil
  1086  	c.urlParams_.Set("alt", alt)
  1087  	c.urlParams_.Set("prettyPrint", "false")
  1088  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys/{surveyUrlId}")
  1089  	urls += "?" + c.urlParams_.Encode()
  1090  	req, err := http.NewRequest("DELETE", urls, body)
  1091  	if err != nil {
  1092  		return nil, err
  1093  	}
  1094  	req.Header = reqHeaders
  1095  	googleapi.Expand(req.URL, map[string]string{
  1096  		"surveyUrlId": c.surveyUrlId,
  1097  	})
  1098  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1099  }
  1100  
  1101  // Do executes the "surveys.surveys.delete" call.
  1102  // Exactly one of *SurveysDeleteResponse or error will be non-nil. Any
  1103  // non-2xx status code is an error. Response headers are in either
  1104  // *SurveysDeleteResponse.ServerResponse.Header or (if a response was
  1105  // returned at all) in error.(*googleapi.Error).Header. Use
  1106  // googleapi.IsNotModified to check whether the returned error was
  1107  // because http.StatusNotModified was returned.
  1108  func (c *SurveysDeleteCall) Do(opts ...googleapi.CallOption) (*SurveysDeleteResponse, error) {
  1109  	gensupport.SetOptions(c.urlParams_, opts...)
  1110  	res, err := c.doRequest("json")
  1111  	if res != nil && res.StatusCode == http.StatusNotModified {
  1112  		if res.Body != nil {
  1113  			res.Body.Close()
  1114  		}
  1115  		return nil, &googleapi.Error{
  1116  			Code:   res.StatusCode,
  1117  			Header: res.Header,
  1118  		}
  1119  	}
  1120  	if err != nil {
  1121  		return nil, err
  1122  	}
  1123  	defer googleapi.CloseBody(res)
  1124  	if err := googleapi.CheckResponse(res); err != nil {
  1125  		return nil, err
  1126  	}
  1127  	ret := &SurveysDeleteResponse{
  1128  		ServerResponse: googleapi.ServerResponse{
  1129  			Header:         res.Header,
  1130  			HTTPStatusCode: res.StatusCode,
  1131  		},
  1132  	}
  1133  	target := &ret
  1134  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1135  		return nil, err
  1136  	}
  1137  	return ret, nil
  1138  	// {
  1139  	//   "description": "Removes a survey from view in all user GET requests.",
  1140  	//   "httpMethod": "DELETE",
  1141  	//   "id": "surveys.surveys.delete",
  1142  	//   "parameterOrder": [
  1143  	//     "surveyUrlId"
  1144  	//   ],
  1145  	//   "parameters": {
  1146  	//     "surveyUrlId": {
  1147  	//       "description": "External URL ID for the survey.",
  1148  	//       "location": "path",
  1149  	//       "required": true,
  1150  	//       "type": "string"
  1151  	//     }
  1152  	//   },
  1153  	//   "path": "surveys/{surveyUrlId}",
  1154  	//   "response": {
  1155  	//     "$ref": "SurveysDeleteResponse"
  1156  	//   },
  1157  	//   "scopes": [
  1158  	//     "https://www.googleapis.com/auth/surveys",
  1159  	//     "https://www.googleapis.com/auth/userinfo.email"
  1160  	//   ]
  1161  	// }
  1162  
  1163  }
  1164  
  1165  // method id "surveys.surveys.get":
  1166  
  1167  type SurveysGetCall struct {
  1168  	s            *Service
  1169  	surveyUrlId  string
  1170  	urlParams_   gensupport.URLParams
  1171  	ifNoneMatch_ string
  1172  	ctx_         context.Context
  1173  	header_      http.Header
  1174  }
  1175  
  1176  // Get: Retrieves information about the specified survey.
  1177  func (r *SurveysService) Get(surveyUrlId string) *SurveysGetCall {
  1178  	c := &SurveysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1179  	c.surveyUrlId = surveyUrlId
  1180  	return c
  1181  }
  1182  
  1183  // Fields allows partial responses to be retrieved. See
  1184  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1185  // for more information.
  1186  func (c *SurveysGetCall) Fields(s ...googleapi.Field) *SurveysGetCall {
  1187  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1188  	return c
  1189  }
  1190  
  1191  // IfNoneMatch sets the optional parameter which makes the operation
  1192  // fail if the object's ETag matches the given value. This is useful for
  1193  // getting updates only after the object has changed since the last
  1194  // request. Use googleapi.IsNotModified to check whether the response
  1195  // error from Do is the result of In-None-Match.
  1196  func (c *SurveysGetCall) IfNoneMatch(entityTag string) *SurveysGetCall {
  1197  	c.ifNoneMatch_ = entityTag
  1198  	return c
  1199  }
  1200  
  1201  // Context sets the context to be used in this call's Do method. Any
  1202  // pending HTTP request will be aborted if the provided context is
  1203  // canceled.
  1204  func (c *SurveysGetCall) Context(ctx context.Context) *SurveysGetCall {
  1205  	c.ctx_ = ctx
  1206  	return c
  1207  }
  1208  
  1209  // Header returns an http.Header that can be modified by the caller to
  1210  // add HTTP headers to the request.
  1211  func (c *SurveysGetCall) Header() http.Header {
  1212  	if c.header_ == nil {
  1213  		c.header_ = make(http.Header)
  1214  	}
  1215  	return c.header_
  1216  }
  1217  
  1218  func (c *SurveysGetCall) doRequest(alt string) (*http.Response, error) {
  1219  	reqHeaders := make(http.Header)
  1220  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1221  	for k, v := range c.header_ {
  1222  		reqHeaders[k] = v
  1223  	}
  1224  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1225  	if c.ifNoneMatch_ != "" {
  1226  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1227  	}
  1228  	var body io.Reader = nil
  1229  	c.urlParams_.Set("alt", alt)
  1230  	c.urlParams_.Set("prettyPrint", "false")
  1231  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys/{surveyUrlId}")
  1232  	urls += "?" + c.urlParams_.Encode()
  1233  	req, err := http.NewRequest("GET", urls, body)
  1234  	if err != nil {
  1235  		return nil, err
  1236  	}
  1237  	req.Header = reqHeaders
  1238  	googleapi.Expand(req.URL, map[string]string{
  1239  		"surveyUrlId": c.surveyUrlId,
  1240  	})
  1241  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1242  }
  1243  
  1244  // Do executes the "surveys.surveys.get" call.
  1245  // Exactly one of *Survey or error will be non-nil. Any non-2xx status
  1246  // code is an error. Response headers are in either
  1247  // *Survey.ServerResponse.Header or (if a response was returned at all)
  1248  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1249  // check whether the returned error was because http.StatusNotModified
  1250  // was returned.
  1251  func (c *SurveysGetCall) Do(opts ...googleapi.CallOption) (*Survey, error) {
  1252  	gensupport.SetOptions(c.urlParams_, opts...)
  1253  	res, err := c.doRequest("json")
  1254  	if res != nil && res.StatusCode == http.StatusNotModified {
  1255  		if res.Body != nil {
  1256  			res.Body.Close()
  1257  		}
  1258  		return nil, &googleapi.Error{
  1259  			Code:   res.StatusCode,
  1260  			Header: res.Header,
  1261  		}
  1262  	}
  1263  	if err != nil {
  1264  		return nil, err
  1265  	}
  1266  	defer googleapi.CloseBody(res)
  1267  	if err := googleapi.CheckResponse(res); err != nil {
  1268  		return nil, err
  1269  	}
  1270  	ret := &Survey{
  1271  		ServerResponse: googleapi.ServerResponse{
  1272  			Header:         res.Header,
  1273  			HTTPStatusCode: res.StatusCode,
  1274  		},
  1275  	}
  1276  	target := &ret
  1277  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1278  		return nil, err
  1279  	}
  1280  	return ret, nil
  1281  	// {
  1282  	//   "description": "Retrieves information about the specified survey.",
  1283  	//   "httpMethod": "GET",
  1284  	//   "id": "surveys.surveys.get",
  1285  	//   "parameterOrder": [
  1286  	//     "surveyUrlId"
  1287  	//   ],
  1288  	//   "parameters": {
  1289  	//     "surveyUrlId": {
  1290  	//       "description": "External URL ID for the survey.",
  1291  	//       "location": "path",
  1292  	//       "required": true,
  1293  	//       "type": "string"
  1294  	//     }
  1295  	//   },
  1296  	//   "path": "surveys/{surveyUrlId}",
  1297  	//   "response": {
  1298  	//     "$ref": "Survey"
  1299  	//   },
  1300  	//   "scopes": [
  1301  	//     "https://www.googleapis.com/auth/surveys",
  1302  	//     "https://www.googleapis.com/auth/surveys.readonly",
  1303  	//     "https://www.googleapis.com/auth/userinfo.email"
  1304  	//   ]
  1305  	// }
  1306  
  1307  }
  1308  
  1309  // method id "surveys.surveys.insert":
  1310  
  1311  type SurveysInsertCall struct {
  1312  	s          *Service
  1313  	survey     *Survey
  1314  	urlParams_ gensupport.URLParams
  1315  	ctx_       context.Context
  1316  	header_    http.Header
  1317  }
  1318  
  1319  // Insert: Creates a survey.
  1320  func (r *SurveysService) Insert(survey *Survey) *SurveysInsertCall {
  1321  	c := &SurveysInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1322  	c.survey = survey
  1323  	return c
  1324  }
  1325  
  1326  // Fields allows partial responses to be retrieved. See
  1327  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1328  // for more information.
  1329  func (c *SurveysInsertCall) Fields(s ...googleapi.Field) *SurveysInsertCall {
  1330  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1331  	return c
  1332  }
  1333  
  1334  // Context sets the context to be used in this call's Do method. Any
  1335  // pending HTTP request will be aborted if the provided context is
  1336  // canceled.
  1337  func (c *SurveysInsertCall) Context(ctx context.Context) *SurveysInsertCall {
  1338  	c.ctx_ = ctx
  1339  	return c
  1340  }
  1341  
  1342  // Header returns an http.Header that can be modified by the caller to
  1343  // add HTTP headers to the request.
  1344  func (c *SurveysInsertCall) Header() http.Header {
  1345  	if c.header_ == nil {
  1346  		c.header_ = make(http.Header)
  1347  	}
  1348  	return c.header_
  1349  }
  1350  
  1351  func (c *SurveysInsertCall) doRequest(alt string) (*http.Response, error) {
  1352  	reqHeaders := make(http.Header)
  1353  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1354  	for k, v := range c.header_ {
  1355  		reqHeaders[k] = v
  1356  	}
  1357  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1358  	var body io.Reader = nil
  1359  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.survey)
  1360  	if err != nil {
  1361  		return nil, err
  1362  	}
  1363  	reqHeaders.Set("Content-Type", "application/json")
  1364  	c.urlParams_.Set("alt", alt)
  1365  	c.urlParams_.Set("prettyPrint", "false")
  1366  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys")
  1367  	urls += "?" + c.urlParams_.Encode()
  1368  	req, err := http.NewRequest("POST", urls, body)
  1369  	if err != nil {
  1370  		return nil, err
  1371  	}
  1372  	req.Header = reqHeaders
  1373  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1374  }
  1375  
  1376  // Do executes the "surveys.surveys.insert" call.
  1377  // Exactly one of *Survey or error will be non-nil. Any non-2xx status
  1378  // code is an error. Response headers are in either
  1379  // *Survey.ServerResponse.Header or (if a response was returned at all)
  1380  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1381  // check whether the returned error was because http.StatusNotModified
  1382  // was returned.
  1383  func (c *SurveysInsertCall) Do(opts ...googleapi.CallOption) (*Survey, error) {
  1384  	gensupport.SetOptions(c.urlParams_, opts...)
  1385  	res, err := c.doRequest("json")
  1386  	if res != nil && res.StatusCode == http.StatusNotModified {
  1387  		if res.Body != nil {
  1388  			res.Body.Close()
  1389  		}
  1390  		return nil, &googleapi.Error{
  1391  			Code:   res.StatusCode,
  1392  			Header: res.Header,
  1393  		}
  1394  	}
  1395  	if err != nil {
  1396  		return nil, err
  1397  	}
  1398  	defer googleapi.CloseBody(res)
  1399  	if err := googleapi.CheckResponse(res); err != nil {
  1400  		return nil, err
  1401  	}
  1402  	ret := &Survey{
  1403  		ServerResponse: googleapi.ServerResponse{
  1404  			Header:         res.Header,
  1405  			HTTPStatusCode: res.StatusCode,
  1406  		},
  1407  	}
  1408  	target := &ret
  1409  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1410  		return nil, err
  1411  	}
  1412  	return ret, nil
  1413  	// {
  1414  	//   "description": "Creates a survey.",
  1415  	//   "httpMethod": "POST",
  1416  	//   "id": "surveys.surveys.insert",
  1417  	//   "path": "surveys",
  1418  	//   "request": {
  1419  	//     "$ref": "Survey"
  1420  	//   },
  1421  	//   "response": {
  1422  	//     "$ref": "Survey"
  1423  	//   },
  1424  	//   "scopes": [
  1425  	//     "https://www.googleapis.com/auth/surveys",
  1426  	//     "https://www.googleapis.com/auth/userinfo.email"
  1427  	//   ]
  1428  	// }
  1429  
  1430  }
  1431  
  1432  // method id "surveys.surveys.list":
  1433  
  1434  type SurveysListCall struct {
  1435  	s            *Service
  1436  	urlParams_   gensupport.URLParams
  1437  	ifNoneMatch_ string
  1438  	ctx_         context.Context
  1439  	header_      http.Header
  1440  }
  1441  
  1442  // List: Lists the surveys owned by the authenticated user.
  1443  func (r *SurveysService) List() *SurveysListCall {
  1444  	c := &SurveysListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1445  	return c
  1446  }
  1447  
  1448  // MaxResults sets the optional parameter "maxResults":
  1449  func (c *SurveysListCall) MaxResults(maxResults int64) *SurveysListCall {
  1450  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1451  	return c
  1452  }
  1453  
  1454  // StartIndex sets the optional parameter "startIndex":
  1455  func (c *SurveysListCall) StartIndex(startIndex int64) *SurveysListCall {
  1456  	c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  1457  	return c
  1458  }
  1459  
  1460  // Token sets the optional parameter "token":
  1461  func (c *SurveysListCall) Token(token string) *SurveysListCall {
  1462  	c.urlParams_.Set("token", token)
  1463  	return c
  1464  }
  1465  
  1466  // Fields allows partial responses to be retrieved. See
  1467  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1468  // for more information.
  1469  func (c *SurveysListCall) Fields(s ...googleapi.Field) *SurveysListCall {
  1470  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1471  	return c
  1472  }
  1473  
  1474  // IfNoneMatch sets the optional parameter which makes the operation
  1475  // fail if the object's ETag matches the given value. This is useful for
  1476  // getting updates only after the object has changed since the last
  1477  // request. Use googleapi.IsNotModified to check whether the response
  1478  // error from Do is the result of In-None-Match.
  1479  func (c *SurveysListCall) IfNoneMatch(entityTag string) *SurveysListCall {
  1480  	c.ifNoneMatch_ = entityTag
  1481  	return c
  1482  }
  1483  
  1484  // Context sets the context to be used in this call's Do method. Any
  1485  // pending HTTP request will be aborted if the provided context is
  1486  // canceled.
  1487  func (c *SurveysListCall) Context(ctx context.Context) *SurveysListCall {
  1488  	c.ctx_ = ctx
  1489  	return c
  1490  }
  1491  
  1492  // Header returns an http.Header that can be modified by the caller to
  1493  // add HTTP headers to the request.
  1494  func (c *SurveysListCall) Header() http.Header {
  1495  	if c.header_ == nil {
  1496  		c.header_ = make(http.Header)
  1497  	}
  1498  	return c.header_
  1499  }
  1500  
  1501  func (c *SurveysListCall) doRequest(alt string) (*http.Response, error) {
  1502  	reqHeaders := make(http.Header)
  1503  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1504  	for k, v := range c.header_ {
  1505  		reqHeaders[k] = v
  1506  	}
  1507  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1508  	if c.ifNoneMatch_ != "" {
  1509  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1510  	}
  1511  	var body io.Reader = nil
  1512  	c.urlParams_.Set("alt", alt)
  1513  	c.urlParams_.Set("prettyPrint", "false")
  1514  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys")
  1515  	urls += "?" + c.urlParams_.Encode()
  1516  	req, err := http.NewRequest("GET", urls, body)
  1517  	if err != nil {
  1518  		return nil, err
  1519  	}
  1520  	req.Header = reqHeaders
  1521  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1522  }
  1523  
  1524  // Do executes the "surveys.surveys.list" call.
  1525  // Exactly one of *SurveysListResponse or error will be non-nil. Any
  1526  // non-2xx status code is an error. Response headers are in either
  1527  // *SurveysListResponse.ServerResponse.Header or (if a response was
  1528  // returned at all) in error.(*googleapi.Error).Header. Use
  1529  // googleapi.IsNotModified to check whether the returned error was
  1530  // because http.StatusNotModified was returned.
  1531  func (c *SurveysListCall) Do(opts ...googleapi.CallOption) (*SurveysListResponse, error) {
  1532  	gensupport.SetOptions(c.urlParams_, opts...)
  1533  	res, err := c.doRequest("json")
  1534  	if res != nil && res.StatusCode == http.StatusNotModified {
  1535  		if res.Body != nil {
  1536  			res.Body.Close()
  1537  		}
  1538  		return nil, &googleapi.Error{
  1539  			Code:   res.StatusCode,
  1540  			Header: res.Header,
  1541  		}
  1542  	}
  1543  	if err != nil {
  1544  		return nil, err
  1545  	}
  1546  	defer googleapi.CloseBody(res)
  1547  	if err := googleapi.CheckResponse(res); err != nil {
  1548  		return nil, err
  1549  	}
  1550  	ret := &SurveysListResponse{
  1551  		ServerResponse: googleapi.ServerResponse{
  1552  			Header:         res.Header,
  1553  			HTTPStatusCode: res.StatusCode,
  1554  		},
  1555  	}
  1556  	target := &ret
  1557  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1558  		return nil, err
  1559  	}
  1560  	return ret, nil
  1561  	// {
  1562  	//   "description": "Lists the surveys owned by the authenticated user.",
  1563  	//   "httpMethod": "GET",
  1564  	//   "id": "surveys.surveys.list",
  1565  	//   "parameters": {
  1566  	//     "maxResults": {
  1567  	//       "format": "uint32",
  1568  	//       "location": "query",
  1569  	//       "type": "integer"
  1570  	//     },
  1571  	//     "startIndex": {
  1572  	//       "format": "uint32",
  1573  	//       "location": "query",
  1574  	//       "type": "integer"
  1575  	//     },
  1576  	//     "token": {
  1577  	//       "location": "query",
  1578  	//       "type": "string"
  1579  	//     }
  1580  	//   },
  1581  	//   "path": "surveys",
  1582  	//   "response": {
  1583  	//     "$ref": "SurveysListResponse"
  1584  	//   },
  1585  	//   "scopes": [
  1586  	//     "https://www.googleapis.com/auth/surveys",
  1587  	//     "https://www.googleapis.com/auth/surveys.readonly",
  1588  	//     "https://www.googleapis.com/auth/userinfo.email"
  1589  	//   ]
  1590  	// }
  1591  
  1592  }
  1593  
  1594  // method id "surveys.surveys.start":
  1595  
  1596  type SurveysStartCall struct {
  1597  	s                   *Service
  1598  	resourceId          string
  1599  	surveysstartrequest *SurveysStartRequest
  1600  	urlParams_          gensupport.URLParams
  1601  	ctx_                context.Context
  1602  	header_             http.Header
  1603  }
  1604  
  1605  // Start: Begins running a survey.
  1606  func (r *SurveysService) Start(resourceId string, surveysstartrequest *SurveysStartRequest) *SurveysStartCall {
  1607  	c := &SurveysStartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1608  	c.resourceId = resourceId
  1609  	c.surveysstartrequest = surveysstartrequest
  1610  	return c
  1611  }
  1612  
  1613  // Fields allows partial responses to be retrieved. See
  1614  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1615  // for more information.
  1616  func (c *SurveysStartCall) Fields(s ...googleapi.Field) *SurveysStartCall {
  1617  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1618  	return c
  1619  }
  1620  
  1621  // Context sets the context to be used in this call's Do method. Any
  1622  // pending HTTP request will be aborted if the provided context is
  1623  // canceled.
  1624  func (c *SurveysStartCall) Context(ctx context.Context) *SurveysStartCall {
  1625  	c.ctx_ = ctx
  1626  	return c
  1627  }
  1628  
  1629  // Header returns an http.Header that can be modified by the caller to
  1630  // add HTTP headers to the request.
  1631  func (c *SurveysStartCall) Header() http.Header {
  1632  	if c.header_ == nil {
  1633  		c.header_ = make(http.Header)
  1634  	}
  1635  	return c.header_
  1636  }
  1637  
  1638  func (c *SurveysStartCall) doRequest(alt string) (*http.Response, error) {
  1639  	reqHeaders := make(http.Header)
  1640  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1641  	for k, v := range c.header_ {
  1642  		reqHeaders[k] = v
  1643  	}
  1644  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1645  	var body io.Reader = nil
  1646  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.surveysstartrequest)
  1647  	if err != nil {
  1648  		return nil, err
  1649  	}
  1650  	reqHeaders.Set("Content-Type", "application/json")
  1651  	c.urlParams_.Set("alt", alt)
  1652  	c.urlParams_.Set("prettyPrint", "false")
  1653  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys/{resourceId}/start")
  1654  	urls += "?" + c.urlParams_.Encode()
  1655  	req, err := http.NewRequest("POST", urls, body)
  1656  	if err != nil {
  1657  		return nil, err
  1658  	}
  1659  	req.Header = reqHeaders
  1660  	googleapi.Expand(req.URL, map[string]string{
  1661  		"resourceId": c.resourceId,
  1662  	})
  1663  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1664  }
  1665  
  1666  // Do executes the "surveys.surveys.start" call.
  1667  // Exactly one of *SurveysStartResponse or error will be non-nil. Any
  1668  // non-2xx status code is an error. Response headers are in either
  1669  // *SurveysStartResponse.ServerResponse.Header or (if a response was
  1670  // returned at all) in error.(*googleapi.Error).Header. Use
  1671  // googleapi.IsNotModified to check whether the returned error was
  1672  // because http.StatusNotModified was returned.
  1673  func (c *SurveysStartCall) Do(opts ...googleapi.CallOption) (*SurveysStartResponse, error) {
  1674  	gensupport.SetOptions(c.urlParams_, opts...)
  1675  	res, err := c.doRequest("json")
  1676  	if res != nil && res.StatusCode == http.StatusNotModified {
  1677  		if res.Body != nil {
  1678  			res.Body.Close()
  1679  		}
  1680  		return nil, &googleapi.Error{
  1681  			Code:   res.StatusCode,
  1682  			Header: res.Header,
  1683  		}
  1684  	}
  1685  	if err != nil {
  1686  		return nil, err
  1687  	}
  1688  	defer googleapi.CloseBody(res)
  1689  	if err := googleapi.CheckResponse(res); err != nil {
  1690  		return nil, err
  1691  	}
  1692  	ret := &SurveysStartResponse{
  1693  		ServerResponse: googleapi.ServerResponse{
  1694  			Header:         res.Header,
  1695  			HTTPStatusCode: res.StatusCode,
  1696  		},
  1697  	}
  1698  	target := &ret
  1699  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1700  		return nil, err
  1701  	}
  1702  	return ret, nil
  1703  	// {
  1704  	//   "description": "Begins running a survey.",
  1705  	//   "httpMethod": "POST",
  1706  	//   "id": "surveys.surveys.start",
  1707  	//   "parameterOrder": [
  1708  	//     "resourceId"
  1709  	//   ],
  1710  	//   "parameters": {
  1711  	//     "resourceId": {
  1712  	//       "location": "path",
  1713  	//       "required": true,
  1714  	//       "type": "string"
  1715  	//     }
  1716  	//   },
  1717  	//   "path": "surveys/{resourceId}/start",
  1718  	//   "request": {
  1719  	//     "$ref": "SurveysStartRequest"
  1720  	//   },
  1721  	//   "response": {
  1722  	//     "$ref": "SurveysStartResponse"
  1723  	//   },
  1724  	//   "scopes": [
  1725  	//     "https://www.googleapis.com/auth/surveys",
  1726  	//     "https://www.googleapis.com/auth/userinfo.email"
  1727  	//   ]
  1728  	// }
  1729  
  1730  }
  1731  
  1732  // method id "surveys.surveys.stop":
  1733  
  1734  type SurveysStopCall struct {
  1735  	s          *Service
  1736  	resourceId string
  1737  	urlParams_ gensupport.URLParams
  1738  	ctx_       context.Context
  1739  	header_    http.Header
  1740  }
  1741  
  1742  // Stop: Stops a running survey.
  1743  func (r *SurveysService) Stop(resourceId string) *SurveysStopCall {
  1744  	c := &SurveysStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1745  	c.resourceId = resourceId
  1746  	return c
  1747  }
  1748  
  1749  // Fields allows partial responses to be retrieved. See
  1750  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1751  // for more information.
  1752  func (c *SurveysStopCall) Fields(s ...googleapi.Field) *SurveysStopCall {
  1753  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1754  	return c
  1755  }
  1756  
  1757  // Context sets the context to be used in this call's Do method. Any
  1758  // pending HTTP request will be aborted if the provided context is
  1759  // canceled.
  1760  func (c *SurveysStopCall) Context(ctx context.Context) *SurveysStopCall {
  1761  	c.ctx_ = ctx
  1762  	return c
  1763  }
  1764  
  1765  // Header returns an http.Header that can be modified by the caller to
  1766  // add HTTP headers to the request.
  1767  func (c *SurveysStopCall) Header() http.Header {
  1768  	if c.header_ == nil {
  1769  		c.header_ = make(http.Header)
  1770  	}
  1771  	return c.header_
  1772  }
  1773  
  1774  func (c *SurveysStopCall) doRequest(alt string) (*http.Response, error) {
  1775  	reqHeaders := make(http.Header)
  1776  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1777  	for k, v := range c.header_ {
  1778  		reqHeaders[k] = v
  1779  	}
  1780  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1781  	var body io.Reader = nil
  1782  	c.urlParams_.Set("alt", alt)
  1783  	c.urlParams_.Set("prettyPrint", "false")
  1784  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys/{resourceId}/stop")
  1785  	urls += "?" + c.urlParams_.Encode()
  1786  	req, err := http.NewRequest("POST", urls, body)
  1787  	if err != nil {
  1788  		return nil, err
  1789  	}
  1790  	req.Header = reqHeaders
  1791  	googleapi.Expand(req.URL, map[string]string{
  1792  		"resourceId": c.resourceId,
  1793  	})
  1794  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1795  }
  1796  
  1797  // Do executes the "surveys.surveys.stop" call.
  1798  // Exactly one of *SurveysStopResponse or error will be non-nil. Any
  1799  // non-2xx status code is an error. Response headers are in either
  1800  // *SurveysStopResponse.ServerResponse.Header or (if a response was
  1801  // returned at all) in error.(*googleapi.Error).Header. Use
  1802  // googleapi.IsNotModified to check whether the returned error was
  1803  // because http.StatusNotModified was returned.
  1804  func (c *SurveysStopCall) Do(opts ...googleapi.CallOption) (*SurveysStopResponse, error) {
  1805  	gensupport.SetOptions(c.urlParams_, opts...)
  1806  	res, err := c.doRequest("json")
  1807  	if res != nil && res.StatusCode == http.StatusNotModified {
  1808  		if res.Body != nil {
  1809  			res.Body.Close()
  1810  		}
  1811  		return nil, &googleapi.Error{
  1812  			Code:   res.StatusCode,
  1813  			Header: res.Header,
  1814  		}
  1815  	}
  1816  	if err != nil {
  1817  		return nil, err
  1818  	}
  1819  	defer googleapi.CloseBody(res)
  1820  	if err := googleapi.CheckResponse(res); err != nil {
  1821  		return nil, err
  1822  	}
  1823  	ret := &SurveysStopResponse{
  1824  		ServerResponse: googleapi.ServerResponse{
  1825  			Header:         res.Header,
  1826  			HTTPStatusCode: res.StatusCode,
  1827  		},
  1828  	}
  1829  	target := &ret
  1830  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1831  		return nil, err
  1832  	}
  1833  	return ret, nil
  1834  	// {
  1835  	//   "description": "Stops a running survey.",
  1836  	//   "httpMethod": "POST",
  1837  	//   "id": "surveys.surveys.stop",
  1838  	//   "parameterOrder": [
  1839  	//     "resourceId"
  1840  	//   ],
  1841  	//   "parameters": {
  1842  	//     "resourceId": {
  1843  	//       "location": "path",
  1844  	//       "required": true,
  1845  	//       "type": "string"
  1846  	//     }
  1847  	//   },
  1848  	//   "path": "surveys/{resourceId}/stop",
  1849  	//   "response": {
  1850  	//     "$ref": "SurveysStopResponse"
  1851  	//   },
  1852  	//   "scopes": [
  1853  	//     "https://www.googleapis.com/auth/surveys",
  1854  	//     "https://www.googleapis.com/auth/userinfo.email"
  1855  	//   ]
  1856  	// }
  1857  
  1858  }
  1859  
  1860  // method id "surveys.surveys.update":
  1861  
  1862  type SurveysUpdateCall struct {
  1863  	s           *Service
  1864  	surveyUrlId string
  1865  	survey      *Survey
  1866  	urlParams_  gensupport.URLParams
  1867  	ctx_        context.Context
  1868  	header_     http.Header
  1869  }
  1870  
  1871  // Update: Updates a survey. Currently the only property that can be
  1872  // updated is the owners property.
  1873  func (r *SurveysService) Update(surveyUrlId string, survey *Survey) *SurveysUpdateCall {
  1874  	c := &SurveysUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1875  	c.surveyUrlId = surveyUrlId
  1876  	c.survey = survey
  1877  	return c
  1878  }
  1879  
  1880  // Fields allows partial responses to be retrieved. See
  1881  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1882  // for more information.
  1883  func (c *SurveysUpdateCall) Fields(s ...googleapi.Field) *SurveysUpdateCall {
  1884  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1885  	return c
  1886  }
  1887  
  1888  // Context sets the context to be used in this call's Do method. Any
  1889  // pending HTTP request will be aborted if the provided context is
  1890  // canceled.
  1891  func (c *SurveysUpdateCall) Context(ctx context.Context) *SurveysUpdateCall {
  1892  	c.ctx_ = ctx
  1893  	return c
  1894  }
  1895  
  1896  // Header returns an http.Header that can be modified by the caller to
  1897  // add HTTP headers to the request.
  1898  func (c *SurveysUpdateCall) Header() http.Header {
  1899  	if c.header_ == nil {
  1900  		c.header_ = make(http.Header)
  1901  	}
  1902  	return c.header_
  1903  }
  1904  
  1905  func (c *SurveysUpdateCall) doRequest(alt string) (*http.Response, error) {
  1906  	reqHeaders := make(http.Header)
  1907  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1908  	for k, v := range c.header_ {
  1909  		reqHeaders[k] = v
  1910  	}
  1911  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1912  	var body io.Reader = nil
  1913  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.survey)
  1914  	if err != nil {
  1915  		return nil, err
  1916  	}
  1917  	reqHeaders.Set("Content-Type", "application/json")
  1918  	c.urlParams_.Set("alt", alt)
  1919  	c.urlParams_.Set("prettyPrint", "false")
  1920  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys/{surveyUrlId}")
  1921  	urls += "?" + c.urlParams_.Encode()
  1922  	req, err := http.NewRequest("PUT", urls, body)
  1923  	if err != nil {
  1924  		return nil, err
  1925  	}
  1926  	req.Header = reqHeaders
  1927  	googleapi.Expand(req.URL, map[string]string{
  1928  		"surveyUrlId": c.surveyUrlId,
  1929  	})
  1930  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1931  }
  1932  
  1933  // Do executes the "surveys.surveys.update" call.
  1934  // Exactly one of *Survey or error will be non-nil. Any non-2xx status
  1935  // code is an error. Response headers are in either
  1936  // *Survey.ServerResponse.Header or (if a response was returned at all)
  1937  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1938  // check whether the returned error was because http.StatusNotModified
  1939  // was returned.
  1940  func (c *SurveysUpdateCall) Do(opts ...googleapi.CallOption) (*Survey, error) {
  1941  	gensupport.SetOptions(c.urlParams_, opts...)
  1942  	res, err := c.doRequest("json")
  1943  	if res != nil && res.StatusCode == http.StatusNotModified {
  1944  		if res.Body != nil {
  1945  			res.Body.Close()
  1946  		}
  1947  		return nil, &googleapi.Error{
  1948  			Code:   res.StatusCode,
  1949  			Header: res.Header,
  1950  		}
  1951  	}
  1952  	if err != nil {
  1953  		return nil, err
  1954  	}
  1955  	defer googleapi.CloseBody(res)
  1956  	if err := googleapi.CheckResponse(res); err != nil {
  1957  		return nil, err
  1958  	}
  1959  	ret := &Survey{
  1960  		ServerResponse: googleapi.ServerResponse{
  1961  			Header:         res.Header,
  1962  			HTTPStatusCode: res.StatusCode,
  1963  		},
  1964  	}
  1965  	target := &ret
  1966  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1967  		return nil, err
  1968  	}
  1969  	return ret, nil
  1970  	// {
  1971  	//   "description": "Updates a survey. Currently the only property that can be updated is the owners property.",
  1972  	//   "httpMethod": "PUT",
  1973  	//   "id": "surveys.surveys.update",
  1974  	//   "parameterOrder": [
  1975  	//     "surveyUrlId"
  1976  	//   ],
  1977  	//   "parameters": {
  1978  	//     "surveyUrlId": {
  1979  	//       "description": "External URL ID for the survey.",
  1980  	//       "location": "path",
  1981  	//       "required": true,
  1982  	//       "type": "string"
  1983  	//     }
  1984  	//   },
  1985  	//   "path": "surveys/{surveyUrlId}",
  1986  	//   "request": {
  1987  	//     "$ref": "Survey"
  1988  	//   },
  1989  	//   "response": {
  1990  	//     "$ref": "Survey"
  1991  	//   },
  1992  	//   "scopes": [
  1993  	//     "https://www.googleapis.com/auth/surveys",
  1994  	//     "https://www.googleapis.com/auth/userinfo.email"
  1995  	//   ]
  1996  	// }
  1997  
  1998  }
  1999  

View as plain text