...

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

Documentation: google.golang.org/api/consumersurveys/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 consumersurveys provides access to the Consumer Surveys API.
     8  //
     9  // # Creating a client
    10  //
    11  // Usage example:
    12  //
    13  //	import "google.golang.org/api/consumersurveys/v2"
    14  //	...
    15  //	ctx := context.Background()
    16  //	consumersurveysService, err := consumersurveys.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  //	consumersurveysService, err := consumersurveys.NewService(ctx, option.WithScopes(consumersurveys.UserinfoEmailScope))
    27  //
    28  // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
    29  //
    30  //	consumersurveysService, err := consumersurveys.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  //	consumersurveysService, err := consumersurveys.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 consumersurveys // import "google.golang.org/api/consumersurveys/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 = "consumersurveys:v2"
    75  const apiName = "consumersurveys"
    76  const apiVersion = "v2"
    77  const basePath = "https://www.googleapis.com/consumersurveys/v2/"
    78  
    79  // OAuth2 scopes used by this API.
    80  const (
    81  	// View and edit your surveys and results
    82  	ConsumersurveysScope = "https://www.googleapis.com/auth/consumersurveys"
    83  
    84  	// View the results for your surveys
    85  	ConsumersurveysReadonlyScope = "https://www.googleapis.com/auth/consumersurveys.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/consumersurveys",
    95  		"https://www.googleapis.com/auth/consumersurveys.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.Mobileapppanels = NewMobileapppanelsService(s)
   125  	s.Results = NewResultsService(s)
   126  	s.Surveys = NewSurveysService(s)
   127  	return s, nil
   128  }
   129  
   130  type Service struct {
   131  	client    *http.Client
   132  	BasePath  string // API endpoint base URL
   133  	UserAgent string // optional additional User-Agent fragment
   134  
   135  	Mobileapppanels *MobileapppanelsService
   136  
   137  	Results *ResultsService
   138  
   139  	Surveys *SurveysService
   140  }
   141  
   142  func (s *Service) userAgent() string {
   143  	if s.UserAgent == "" {
   144  		return googleapi.UserAgent
   145  	}
   146  	return googleapi.UserAgent + " " + s.UserAgent
   147  }
   148  
   149  func NewMobileapppanelsService(s *Service) *MobileapppanelsService {
   150  	rs := &MobileapppanelsService{s: s}
   151  	return rs
   152  }
   153  
   154  type MobileapppanelsService struct {
   155  	s *Service
   156  }
   157  
   158  func NewResultsService(s *Service) *ResultsService {
   159  	rs := &ResultsService{s: s}
   160  	return rs
   161  }
   162  
   163  type ResultsService struct {
   164  	s *Service
   165  }
   166  
   167  func NewSurveysService(s *Service) *SurveysService {
   168  	rs := &SurveysService{s: s}
   169  	return rs
   170  }
   171  
   172  type SurveysService struct {
   173  	s *Service
   174  }
   175  
   176  type FieldMask struct {
   177  	Fields []*FieldMask `json:"fields,omitempty"`
   178  
   179  	Id int64 `json:"id,omitempty"`
   180  
   181  	// ForceSendFields is a list of field names (e.g. "Fields") to
   182  	// unconditionally include in API requests. By default, fields with
   183  	// empty values are omitted from API requests. However, any non-pointer,
   184  	// non-interface field appearing in ForceSendFields will be sent to the
   185  	// server regardless of whether the field is empty or not. This may be
   186  	// used to include empty fields in Patch requests.
   187  	ForceSendFields []string `json:"-"`
   188  
   189  	// NullFields is a list of field names (e.g. "Fields") to include in API
   190  	// requests with the JSON null value. By default, fields with empty
   191  	// values are omitted from API requests. However, any field with an
   192  	// empty value appearing in NullFields will be sent to the server as
   193  	// null. It is an error if a field in this list has a non-empty value.
   194  	// This may be used to include null fields in Patch requests.
   195  	NullFields []string `json:"-"`
   196  }
   197  
   198  func (s *FieldMask) MarshalJSON() ([]byte, error) {
   199  	type NoMethod FieldMask
   200  	raw := NoMethod(*s)
   201  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   202  }
   203  
   204  type MobileAppPanel struct {
   205  	Country string `json:"country,omitempty"`
   206  
   207  	IsPublicPanel bool `json:"isPublicPanel,omitempty"`
   208  
   209  	Language string `json:"language,omitempty"`
   210  
   211  	MobileAppPanelId string `json:"mobileAppPanelId,omitempty"`
   212  
   213  	Name string `json:"name,omitempty"`
   214  
   215  	Owners []string `json:"owners,omitempty"`
   216  
   217  	// ServerResponse contains the HTTP response code and headers from the
   218  	// server.
   219  	googleapi.ServerResponse `json:"-"`
   220  
   221  	// ForceSendFields is a list of field names (e.g. "Country") to
   222  	// unconditionally include in API requests. By default, fields with
   223  	// empty values are omitted from API requests. However, any non-pointer,
   224  	// non-interface field appearing in ForceSendFields will be sent to the
   225  	// server regardless of whether the field is empty or not. This may be
   226  	// used to include empty fields in Patch requests.
   227  	ForceSendFields []string `json:"-"`
   228  
   229  	// NullFields is a list of field names (e.g. "Country") to include in
   230  	// API requests with the JSON null value. By default, fields with empty
   231  	// values are omitted from API requests. However, any field with an
   232  	// empty value appearing in NullFields will be sent to the server as
   233  	// null. It is an error if a field in this list has a non-empty value.
   234  	// This may be used to include null fields in Patch requests.
   235  	NullFields []string `json:"-"`
   236  }
   237  
   238  func (s *MobileAppPanel) MarshalJSON() ([]byte, error) {
   239  	type NoMethod MobileAppPanel
   240  	raw := NoMethod(*s)
   241  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   242  }
   243  
   244  type MobileAppPanelsListResponse struct {
   245  	PageInfo *PageInfo `json:"pageInfo,omitempty"`
   246  
   247  	// RequestId: Unique request ID used for logging and debugging. Please
   248  	// include in any error reporting or troubleshooting requests.
   249  	RequestId string `json:"requestId,omitempty"`
   250  
   251  	// Resources: An individual predefined panel of Opinion Rewards mobile
   252  	// users.
   253  	Resources []*MobileAppPanel `json:"resources,omitempty"`
   254  
   255  	TokenPagination *TokenPagination `json:"tokenPagination,omitempty"`
   256  
   257  	// ServerResponse contains the HTTP response code and headers from the
   258  	// server.
   259  	googleapi.ServerResponse `json:"-"`
   260  
   261  	// ForceSendFields is a list of field names (e.g. "PageInfo") to
   262  	// unconditionally include in API requests. By default, fields with
   263  	// empty values are omitted from API requests. However, any non-pointer,
   264  	// non-interface field appearing in ForceSendFields will be sent to the
   265  	// server regardless of whether the field is empty or not. This may be
   266  	// used to include empty fields in Patch requests.
   267  	ForceSendFields []string `json:"-"`
   268  
   269  	// NullFields is a list of field names (e.g. "PageInfo") to include in
   270  	// API requests with the JSON null value. By default, fields with empty
   271  	// values are omitted from API requests. However, any field with an
   272  	// empty value appearing in NullFields will be sent to the server as
   273  	// null. It is an error if a field in this list has a non-empty value.
   274  	// This may be used to include null fields in Patch requests.
   275  	NullFields []string `json:"-"`
   276  }
   277  
   278  func (s *MobileAppPanelsListResponse) MarshalJSON() ([]byte, error) {
   279  	type NoMethod MobileAppPanelsListResponse
   280  	raw := NoMethod(*s)
   281  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   282  }
   283  
   284  type PageInfo struct {
   285  	ResultPerPage int64 `json:"resultPerPage,omitempty"`
   286  
   287  	StartIndex int64 `json:"startIndex,omitempty"`
   288  
   289  	TotalResults int64 `json:"totalResults,omitempty"`
   290  
   291  	// ForceSendFields is a list of field names (e.g. "ResultPerPage") to
   292  	// unconditionally include in API requests. By default, fields with
   293  	// empty values are omitted from API requests. However, any non-pointer,
   294  	// non-interface field appearing in ForceSendFields will be sent to the
   295  	// server regardless of whether the field is empty or not. This may be
   296  	// used to include empty fields in Patch requests.
   297  	ForceSendFields []string `json:"-"`
   298  
   299  	// NullFields is a list of field names (e.g. "ResultPerPage") to include
   300  	// in API requests with the JSON null value. By default, fields with
   301  	// empty values are omitted from API requests. However, any field with
   302  	// an empty value appearing in NullFields will be sent to the server as
   303  	// null. It is an error if a field in this list has a non-empty value.
   304  	// This may be used to include null fields in Patch requests.
   305  	NullFields []string `json:"-"`
   306  }
   307  
   308  func (s *PageInfo) MarshalJSON() ([]byte, error) {
   309  	type NoMethod PageInfo
   310  	raw := NoMethod(*s)
   311  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   312  }
   313  
   314  type ResultsGetRequest struct {
   315  	ResultMask *ResultsMask `json:"resultMask,omitempty"`
   316  
   317  	// ForceSendFields is a list of field names (e.g. "ResultMask") to
   318  	// unconditionally include in API requests. By default, fields with
   319  	// empty values are omitted from API requests. However, any non-pointer,
   320  	// non-interface field appearing in ForceSendFields will be sent to the
   321  	// server regardless of whether the field is empty or not. This may be
   322  	// used to include empty fields in Patch requests.
   323  	ForceSendFields []string `json:"-"`
   324  
   325  	// NullFields is a list of field names (e.g. "ResultMask") to include in
   326  	// API requests with the JSON null value. By default, fields with empty
   327  	// values are omitted from API requests. However, any field with an
   328  	// empty value appearing in NullFields will be sent to the server as
   329  	// null. It is an error if a field in this list has a non-empty value.
   330  	// This may be used to include null fields in Patch requests.
   331  	NullFields []string `json:"-"`
   332  }
   333  
   334  func (s *ResultsGetRequest) MarshalJSON() ([]byte, error) {
   335  	type NoMethod ResultsGetRequest
   336  	raw := NoMethod(*s)
   337  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   338  }
   339  
   340  type ResultsMask struct {
   341  	Fields []*FieldMask `json:"fields,omitempty"`
   342  
   343  	Projection string `json:"projection,omitempty"`
   344  
   345  	// ForceSendFields is a list of field names (e.g. "Fields") to
   346  	// unconditionally include in API requests. By default, fields with
   347  	// empty values are omitted from API requests. However, any non-pointer,
   348  	// non-interface field appearing in ForceSendFields will be sent to the
   349  	// server regardless of whether the field is empty or not. This may be
   350  	// used to include empty fields in Patch requests.
   351  	ForceSendFields []string `json:"-"`
   352  
   353  	// NullFields is a list of field names (e.g. "Fields") to include in API
   354  	// requests with the JSON null value. By default, fields with empty
   355  	// values are omitted from API requests. However, any field with an
   356  	// empty value appearing in NullFields will be sent to the server as
   357  	// null. It is an error if a field in this list has a non-empty value.
   358  	// This may be used to include null fields in Patch requests.
   359  	NullFields []string `json:"-"`
   360  }
   361  
   362  func (s *ResultsMask) MarshalJSON() ([]byte, error) {
   363  	type NoMethod ResultsMask
   364  	raw := NoMethod(*s)
   365  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   366  }
   367  
   368  type Survey struct {
   369  	Audience *SurveyAudience `json:"audience,omitempty"`
   370  
   371  	Cost *SurveyCost `json:"cost,omitempty"`
   372  
   373  	CustomerData string `json:"customerData,omitempty"`
   374  
   375  	Description string `json:"description,omitempty"`
   376  
   377  	Owners []string `json:"owners,omitempty"`
   378  
   379  	Questions []*SurveyQuestion `json:"questions,omitempty"`
   380  
   381  	RejectionReason *SurveyRejection `json:"rejectionReason,omitempty"`
   382  
   383  	State string `json:"state,omitempty"`
   384  
   385  	SurveyUrlId string `json:"surveyUrlId,omitempty"`
   386  
   387  	Title string `json:"title,omitempty"`
   388  
   389  	WantedResponseCount int64 `json:"wantedResponseCount,omitempty"`
   390  
   391  	// ServerResponse contains the HTTP response code and headers from the
   392  	// server.
   393  	googleapi.ServerResponse `json:"-"`
   394  
   395  	// ForceSendFields is a list of field names (e.g. "Audience") to
   396  	// unconditionally include in API requests. By default, fields with
   397  	// empty values are omitted from API requests. However, any non-pointer,
   398  	// non-interface field appearing in ForceSendFields will be sent to the
   399  	// server regardless of whether the field is empty or not. This may be
   400  	// used to include empty fields in Patch requests.
   401  	ForceSendFields []string `json:"-"`
   402  
   403  	// NullFields is a list of field names (e.g. "Audience") to include in
   404  	// API requests with the JSON null value. By default, fields with empty
   405  	// values are omitted from API requests. However, any field with an
   406  	// empty value appearing in NullFields will be sent to the server as
   407  	// null. It is an error if a field in this list has a non-empty value.
   408  	// This may be used to include null fields in Patch requests.
   409  	NullFields []string `json:"-"`
   410  }
   411  
   412  func (s *Survey) MarshalJSON() ([]byte, error) {
   413  	type NoMethod Survey
   414  	raw := NoMethod(*s)
   415  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   416  }
   417  
   418  type SurveyAudience struct {
   419  	Ages []string `json:"ages,omitempty"`
   420  
   421  	Country string `json:"country,omitempty"`
   422  
   423  	CountrySubdivision string `json:"countrySubdivision,omitempty"`
   424  
   425  	Gender string `json:"gender,omitempty"`
   426  
   427  	Languages []string `json:"languages,omitempty"`
   428  
   429  	MobileAppPanelId string `json:"mobileAppPanelId,omitempty"`
   430  
   431  	PopulationSource string `json:"populationSource,omitempty"`
   432  
   433  	// ForceSendFields is a list of field names (e.g. "Ages") to
   434  	// unconditionally include in API requests. By default, fields with
   435  	// empty values are omitted from API requests. However, any non-pointer,
   436  	// non-interface field appearing in ForceSendFields will be sent to the
   437  	// server regardless of whether the field is empty or not. This may be
   438  	// used to include empty fields in Patch requests.
   439  	ForceSendFields []string `json:"-"`
   440  
   441  	// NullFields is a list of field names (e.g. "Ages") to include in API
   442  	// requests with the JSON null value. By default, fields with empty
   443  	// values are omitted from API requests. However, any field with an
   444  	// empty value appearing in NullFields will be sent to the server as
   445  	// null. It is an error if a field in this list has a non-empty value.
   446  	// This may be used to include null fields in Patch requests.
   447  	NullFields []string `json:"-"`
   448  }
   449  
   450  func (s *SurveyAudience) MarshalJSON() ([]byte, error) {
   451  	type NoMethod SurveyAudience
   452  	raw := NoMethod(*s)
   453  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   454  }
   455  
   456  type SurveyCost struct {
   457  	CostPerResponseNanos int64 `json:"costPerResponseNanos,omitempty,string"`
   458  
   459  	CurrencyCode string `json:"currencyCode,omitempty"`
   460  
   461  	MaxCostPerResponseNanos int64 `json:"maxCostPerResponseNanos,omitempty,string"`
   462  
   463  	Nanos int64 `json:"nanos,omitempty,string"`
   464  
   465  	// ForceSendFields is a list of field names (e.g.
   466  	// "CostPerResponseNanos") to unconditionally include in API requests.
   467  	// By default, fields with empty values are omitted from API requests.
   468  	// However, any non-pointer, non-interface field appearing in
   469  	// ForceSendFields will be sent to the server regardless of whether the
   470  	// field is empty or not. This may be used to include empty fields in
   471  	// Patch requests.
   472  	ForceSendFields []string `json:"-"`
   473  
   474  	// NullFields is a list of field names (e.g. "CostPerResponseNanos") to
   475  	// include in API requests with the JSON null value. By default, fields
   476  	// with empty values are omitted from API requests. However, any field
   477  	// with an empty value appearing in NullFields will be sent to the
   478  	// server as null. It is an error if a field in this list has a
   479  	// non-empty value. This may be used to include null fields in Patch
   480  	// requests.
   481  	NullFields []string `json:"-"`
   482  }
   483  
   484  func (s *SurveyCost) MarshalJSON() ([]byte, error) {
   485  	type NoMethod SurveyCost
   486  	raw := NoMethod(*s)
   487  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   488  }
   489  
   490  type SurveyQuestion struct {
   491  	AnswerOrder string `json:"answerOrder,omitempty"`
   492  
   493  	Answers []string `json:"answers,omitempty"`
   494  
   495  	HasOther bool `json:"hasOther,omitempty"`
   496  
   497  	HighValueLabel string `json:"highValueLabel,omitempty"`
   498  
   499  	Images []*SurveyQuestionImage `json:"images,omitempty"`
   500  
   501  	LastAnswerPositionPinned bool `json:"lastAnswerPositionPinned,omitempty"`
   502  
   503  	LowValueLabel string `json:"lowValueLabel,omitempty"`
   504  
   505  	MustPickSuggestion bool `json:"mustPickSuggestion,omitempty"`
   506  
   507  	NumStars string `json:"numStars,omitempty"`
   508  
   509  	OpenTextPlaceholder string `json:"openTextPlaceholder,omitempty"`
   510  
   511  	OpenTextSuggestions []string `json:"openTextSuggestions,omitempty"`
   512  
   513  	Question string `json:"question,omitempty"`
   514  
   515  	SentimentText string `json:"sentimentText,omitempty"`
   516  
   517  	SingleLineResponse bool `json:"singleLineResponse,omitempty"`
   518  
   519  	ThresholdAnswers []string `json:"thresholdAnswers,omitempty"`
   520  
   521  	Type string `json:"type,omitempty"`
   522  
   523  	UnitOfMeasurementLabel string `json:"unitOfMeasurementLabel,omitempty"`
   524  
   525  	VideoId string `json:"videoId,omitempty"`
   526  
   527  	// ForceSendFields is a list of field names (e.g. "AnswerOrder") to
   528  	// unconditionally include in API requests. By default, fields with
   529  	// empty values are omitted from API requests. However, any non-pointer,
   530  	// non-interface field appearing in ForceSendFields will be sent to the
   531  	// server regardless of whether the field is empty or not. This may be
   532  	// used to include empty fields in Patch requests.
   533  	ForceSendFields []string `json:"-"`
   534  
   535  	// NullFields is a list of field names (e.g. "AnswerOrder") to include
   536  	// in API requests with the JSON null value. By default, fields with
   537  	// empty values are omitted from API requests. However, any field with
   538  	// an empty value appearing in NullFields will be sent to the server as
   539  	// null. It is an error if a field in this list has a non-empty value.
   540  	// This may be used to include null fields in Patch requests.
   541  	NullFields []string `json:"-"`
   542  }
   543  
   544  func (s *SurveyQuestion) MarshalJSON() ([]byte, error) {
   545  	type NoMethod SurveyQuestion
   546  	raw := NoMethod(*s)
   547  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   548  }
   549  
   550  type SurveyQuestionImage struct {
   551  	AltText string `json:"altText,omitempty"`
   552  
   553  	Data string `json:"data,omitempty"`
   554  
   555  	Url string `json:"url,omitempty"`
   556  
   557  	// ForceSendFields is a list of field names (e.g. "AltText") to
   558  	// unconditionally include in API requests. By default, fields with
   559  	// empty values are omitted from API requests. However, any non-pointer,
   560  	// non-interface field appearing in ForceSendFields will be sent to the
   561  	// server regardless of whether the field is empty or not. This may be
   562  	// used to include empty fields in Patch requests.
   563  	ForceSendFields []string `json:"-"`
   564  
   565  	// NullFields is a list of field names (e.g. "AltText") to include in
   566  	// API requests with the JSON null value. By default, fields with empty
   567  	// values are omitted from API requests. However, any field with an
   568  	// empty value appearing in NullFields will be sent to the server as
   569  	// null. It is an error if a field in this list has a non-empty value.
   570  	// This may be used to include null fields in Patch requests.
   571  	NullFields []string `json:"-"`
   572  }
   573  
   574  func (s *SurveyQuestionImage) MarshalJSON() ([]byte, error) {
   575  	type NoMethod SurveyQuestionImage
   576  	raw := NoMethod(*s)
   577  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   578  }
   579  
   580  type SurveyRejection struct {
   581  	Explanation string `json:"explanation,omitempty"`
   582  
   583  	Type string `json:"type,omitempty"`
   584  
   585  	// ForceSendFields is a list of field names (e.g. "Explanation") to
   586  	// unconditionally include in API requests. By default, fields with
   587  	// empty values are omitted from API requests. However, any non-pointer,
   588  	// non-interface field appearing in ForceSendFields will be sent to the
   589  	// server regardless of whether the field is empty or not. This may be
   590  	// used to include empty fields in Patch requests.
   591  	ForceSendFields []string `json:"-"`
   592  
   593  	// NullFields is a list of field names (e.g. "Explanation") to include
   594  	// in API requests with the JSON null value. By default, fields with
   595  	// empty values are omitted from API requests. However, any field with
   596  	// an empty value appearing in NullFields will be sent to the server as
   597  	// null. It is an error if a field in this list has a non-empty value.
   598  	// This may be used to include null fields in Patch requests.
   599  	NullFields []string `json:"-"`
   600  }
   601  
   602  func (s *SurveyRejection) MarshalJSON() ([]byte, error) {
   603  	type NoMethod SurveyRejection
   604  	raw := NoMethod(*s)
   605  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   606  }
   607  
   608  type SurveyResults struct {
   609  	Status string `json:"status,omitempty"`
   610  
   611  	SurveyUrlId string `json:"surveyUrlId,omitempty"`
   612  
   613  	// ServerResponse contains the HTTP response code and headers from the
   614  	// server.
   615  	googleapi.ServerResponse `json:"-"`
   616  
   617  	// ForceSendFields is a list of field names (e.g. "Status") to
   618  	// unconditionally include in API requests. By default, fields with
   619  	// empty values are omitted from API requests. However, any non-pointer,
   620  	// non-interface field appearing in ForceSendFields will be sent to the
   621  	// server regardless of whether the field is empty or not. This may be
   622  	// used to include empty fields in Patch requests.
   623  	ForceSendFields []string `json:"-"`
   624  
   625  	// NullFields is a list of field names (e.g. "Status") to include in API
   626  	// requests with the JSON null value. By default, fields with empty
   627  	// values are omitted from API requests. However, any field with an
   628  	// empty value appearing in NullFields will be sent to the server as
   629  	// null. It is an error if a field in this list has a non-empty value.
   630  	// This may be used to include null fields in Patch requests.
   631  	NullFields []string `json:"-"`
   632  }
   633  
   634  func (s *SurveyResults) MarshalJSON() ([]byte, error) {
   635  	type NoMethod SurveyResults
   636  	raw := NoMethod(*s)
   637  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   638  }
   639  
   640  type SurveysDeleteResponse struct {
   641  	// RequestId: Unique request ID used for logging and debugging. Please
   642  	// include in any error reporting or troubleshooting requests.
   643  	RequestId string `json:"requestId,omitempty"`
   644  
   645  	// ServerResponse contains the HTTP response code and headers from the
   646  	// server.
   647  	googleapi.ServerResponse `json:"-"`
   648  
   649  	// ForceSendFields is a list of field names (e.g. "RequestId") to
   650  	// unconditionally include in API requests. By default, fields with
   651  	// empty values are omitted from API requests. However, any non-pointer,
   652  	// non-interface field appearing in ForceSendFields will be sent to the
   653  	// server regardless of whether the field is empty or not. This may be
   654  	// used to include empty fields in Patch requests.
   655  	ForceSendFields []string `json:"-"`
   656  
   657  	// NullFields is a list of field names (e.g. "RequestId") to include in
   658  	// API requests with the JSON null value. By default, fields with empty
   659  	// values are omitted from API requests. However, any field with an
   660  	// empty value appearing in NullFields will be sent to the server as
   661  	// null. It is an error if a field in this list has a non-empty value.
   662  	// This may be used to include null fields in Patch requests.
   663  	NullFields []string `json:"-"`
   664  }
   665  
   666  func (s *SurveysDeleteResponse) MarshalJSON() ([]byte, error) {
   667  	type NoMethod SurveysDeleteResponse
   668  	raw := NoMethod(*s)
   669  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   670  }
   671  
   672  type SurveysListResponse struct {
   673  	PageInfo *PageInfo `json:"pageInfo,omitempty"`
   674  
   675  	// RequestId: Unique request ID used for logging and debugging. Please
   676  	// include in any error reporting or troubleshooting requests.
   677  	RequestId string `json:"requestId,omitempty"`
   678  
   679  	// Resources: An individual survey resource.
   680  	Resources []*Survey `json:"resources,omitempty"`
   681  
   682  	TokenPagination *TokenPagination `json:"tokenPagination,omitempty"`
   683  
   684  	// ServerResponse contains the HTTP response code and headers from the
   685  	// server.
   686  	googleapi.ServerResponse `json:"-"`
   687  
   688  	// ForceSendFields is a list of field names (e.g. "PageInfo") to
   689  	// unconditionally include in API requests. By default, fields with
   690  	// empty values are omitted from API requests. However, any non-pointer,
   691  	// non-interface field appearing in ForceSendFields will be sent to the
   692  	// server regardless of whether the field is empty or not. This may be
   693  	// used to include empty fields in Patch requests.
   694  	ForceSendFields []string `json:"-"`
   695  
   696  	// NullFields is a list of field names (e.g. "PageInfo") to include in
   697  	// API requests with the JSON null value. By default, fields with empty
   698  	// values are omitted from API requests. However, any field with an
   699  	// empty value appearing in NullFields will be sent to the server as
   700  	// null. It is an error if a field in this list has a non-empty value.
   701  	// This may be used to include null fields in Patch requests.
   702  	NullFields []string `json:"-"`
   703  }
   704  
   705  func (s *SurveysListResponse) MarshalJSON() ([]byte, error) {
   706  	type NoMethod SurveysListResponse
   707  	raw := NoMethod(*s)
   708  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   709  }
   710  
   711  type SurveysStartRequest struct {
   712  	// MaxCostPerResponseNanos: Threshold to start a survey automically if
   713  	// the quoted prices is less than or equal to this value. See
   714  	// Survey.Cost for more details.
   715  	MaxCostPerResponseNanos int64 `json:"maxCostPerResponseNanos,omitempty,string"`
   716  
   717  	// ForceSendFields is a list of field names (e.g.
   718  	// "MaxCostPerResponseNanos") to unconditionally include in API
   719  	// requests. By default, fields with empty values are omitted from API
   720  	// requests. However, any non-pointer, non-interface field appearing in
   721  	// ForceSendFields will be sent to the server regardless of whether the
   722  	// field is empty or not. This may be used to include empty fields in
   723  	// Patch requests.
   724  	ForceSendFields []string `json:"-"`
   725  
   726  	// NullFields is a list of field names (e.g. "MaxCostPerResponseNanos")
   727  	// to include in API requests with the JSON null value. By default,
   728  	// fields with empty values are omitted from API requests. However, any
   729  	// field with an empty value appearing in NullFields will be sent to the
   730  	// server as null. It is an error if a field in this list has a
   731  	// non-empty value. This may be used to include null fields in Patch
   732  	// requests.
   733  	NullFields []string `json:"-"`
   734  }
   735  
   736  func (s *SurveysStartRequest) MarshalJSON() ([]byte, error) {
   737  	type NoMethod SurveysStartRequest
   738  	raw := NoMethod(*s)
   739  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   740  }
   741  
   742  type SurveysStartResponse struct {
   743  	// RequestId: Unique request ID used for logging and debugging. Please
   744  	// include in any error reporting or troubleshooting requests.
   745  	RequestId string `json:"requestId,omitempty"`
   746  
   747  	// ServerResponse contains the HTTP response code and headers from the
   748  	// server.
   749  	googleapi.ServerResponse `json:"-"`
   750  
   751  	// ForceSendFields is a list of field names (e.g. "RequestId") to
   752  	// unconditionally include in API requests. By default, fields with
   753  	// empty values are omitted from API requests. However, any non-pointer,
   754  	// non-interface field appearing in ForceSendFields will be sent to the
   755  	// server regardless of whether the field is empty or not. This may be
   756  	// used to include empty fields in Patch requests.
   757  	ForceSendFields []string `json:"-"`
   758  
   759  	// NullFields is a list of field names (e.g. "RequestId") to include in
   760  	// API requests with the JSON null value. By default, fields with empty
   761  	// values are omitted from API requests. However, any field with an
   762  	// empty value appearing in NullFields will be sent to the server as
   763  	// null. It is an error if a field in this list has a non-empty value.
   764  	// This may be used to include null fields in Patch requests.
   765  	NullFields []string `json:"-"`
   766  }
   767  
   768  func (s *SurveysStartResponse) MarshalJSON() ([]byte, error) {
   769  	type NoMethod SurveysStartResponse
   770  	raw := NoMethod(*s)
   771  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   772  }
   773  
   774  type SurveysStopResponse struct {
   775  	// RequestId: Unique request ID used for logging and debugging. Please
   776  	// include in any error reporting or troubleshooting requests.
   777  	RequestId string `json:"requestId,omitempty"`
   778  
   779  	// ServerResponse contains the HTTP response code and headers from the
   780  	// server.
   781  	googleapi.ServerResponse `json:"-"`
   782  
   783  	// ForceSendFields is a list of field names (e.g. "RequestId") to
   784  	// unconditionally include in API requests. By default, fields with
   785  	// empty values are omitted from API requests. However, any non-pointer,
   786  	// non-interface field appearing in ForceSendFields will be sent to the
   787  	// server regardless of whether the field is empty or not. This may be
   788  	// used to include empty fields in Patch requests.
   789  	ForceSendFields []string `json:"-"`
   790  
   791  	// NullFields is a list of field names (e.g. "RequestId") to include in
   792  	// API requests with the JSON null value. By default, fields with empty
   793  	// values are omitted from API requests. However, any field with an
   794  	// empty value appearing in NullFields will be sent to the server as
   795  	// null. It is an error if a field in this list has a non-empty value.
   796  	// This may be used to include null fields in Patch requests.
   797  	NullFields []string `json:"-"`
   798  }
   799  
   800  func (s *SurveysStopResponse) MarshalJSON() ([]byte, error) {
   801  	type NoMethod SurveysStopResponse
   802  	raw := NoMethod(*s)
   803  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   804  }
   805  
   806  type TokenPagination struct {
   807  	NextPageToken string `json:"nextPageToken,omitempty"`
   808  
   809  	PreviousPageToken string `json:"previousPageToken,omitempty"`
   810  
   811  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   812  	// unconditionally include in API requests. By default, fields with
   813  	// empty values are omitted from API requests. However, any non-pointer,
   814  	// non-interface field appearing in ForceSendFields will be sent to the
   815  	// server regardless of whether the field is empty or not. This may be
   816  	// used to include empty fields in Patch requests.
   817  	ForceSendFields []string `json:"-"`
   818  
   819  	// NullFields is a list of field names (e.g. "NextPageToken") to include
   820  	// in API requests with the JSON null value. By default, fields with
   821  	// empty values are omitted from API requests. However, any field with
   822  	// an empty value appearing in NullFields will be sent to the server as
   823  	// null. It is an error if a field in this list has a non-empty value.
   824  	// This may be used to include null fields in Patch requests.
   825  	NullFields []string `json:"-"`
   826  }
   827  
   828  func (s *TokenPagination) MarshalJSON() ([]byte, error) {
   829  	type NoMethod TokenPagination
   830  	raw := NoMethod(*s)
   831  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   832  }
   833  
   834  // method id "consumersurveys.mobileapppanels.get":
   835  
   836  type MobileapppanelsGetCall struct {
   837  	s            *Service
   838  	panelId      string
   839  	urlParams_   gensupport.URLParams
   840  	ifNoneMatch_ string
   841  	ctx_         context.Context
   842  	header_      http.Header
   843  }
   844  
   845  // Get: Retrieves a MobileAppPanel that is available to the
   846  // authenticated user.
   847  func (r *MobileapppanelsService) Get(panelId string) *MobileapppanelsGetCall {
   848  	c := &MobileapppanelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   849  	c.panelId = panelId
   850  	return c
   851  }
   852  
   853  // Fields allows partial responses to be retrieved. See
   854  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
   855  // for more information.
   856  func (c *MobileapppanelsGetCall) Fields(s ...googleapi.Field) *MobileapppanelsGetCall {
   857  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   858  	return c
   859  }
   860  
   861  // IfNoneMatch sets the optional parameter which makes the operation
   862  // fail if the object's ETag matches the given value. This is useful for
   863  // getting updates only after the object has changed since the last
   864  // request. Use googleapi.IsNotModified to check whether the response
   865  // error from Do is the result of In-None-Match.
   866  func (c *MobileapppanelsGetCall) IfNoneMatch(entityTag string) *MobileapppanelsGetCall {
   867  	c.ifNoneMatch_ = entityTag
   868  	return c
   869  }
   870  
   871  // Context sets the context to be used in this call's Do method. Any
   872  // pending HTTP request will be aborted if the provided context is
   873  // canceled.
   874  func (c *MobileapppanelsGetCall) Context(ctx context.Context) *MobileapppanelsGetCall {
   875  	c.ctx_ = ctx
   876  	return c
   877  }
   878  
   879  // Header returns an http.Header that can be modified by the caller to
   880  // add HTTP headers to the request.
   881  func (c *MobileapppanelsGetCall) Header() http.Header {
   882  	if c.header_ == nil {
   883  		c.header_ = make(http.Header)
   884  	}
   885  	return c.header_
   886  }
   887  
   888  func (c *MobileapppanelsGetCall) doRequest(alt string) (*http.Response, error) {
   889  	reqHeaders := make(http.Header)
   890  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
   891  	for k, v := range c.header_ {
   892  		reqHeaders[k] = v
   893  	}
   894  	reqHeaders.Set("User-Agent", c.s.userAgent())
   895  	if c.ifNoneMatch_ != "" {
   896  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   897  	}
   898  	var body io.Reader = nil
   899  	c.urlParams_.Set("alt", alt)
   900  	c.urlParams_.Set("prettyPrint", "false")
   901  	urls := googleapi.ResolveRelative(c.s.BasePath, "mobileAppPanels/{panelId}")
   902  	urls += "?" + c.urlParams_.Encode()
   903  	req, err := http.NewRequest("GET", urls, body)
   904  	if err != nil {
   905  		return nil, err
   906  	}
   907  	req.Header = reqHeaders
   908  	googleapi.Expand(req.URL, map[string]string{
   909  		"panelId": c.panelId,
   910  	})
   911  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   912  }
   913  
   914  // Do executes the "consumersurveys.mobileapppanels.get" call.
   915  // Exactly one of *MobileAppPanel or error will be non-nil. Any non-2xx
   916  // status code is an error. Response headers are in either
   917  // *MobileAppPanel.ServerResponse.Header or (if a response was returned
   918  // at all) in error.(*googleapi.Error).Header. Use
   919  // googleapi.IsNotModified to check whether the returned error was
   920  // because http.StatusNotModified was returned.
   921  func (c *MobileapppanelsGetCall) Do(opts ...googleapi.CallOption) (*MobileAppPanel, error) {
   922  	gensupport.SetOptions(c.urlParams_, opts...)
   923  	res, err := c.doRequest("json")
   924  	if res != nil && res.StatusCode == http.StatusNotModified {
   925  		if res.Body != nil {
   926  			res.Body.Close()
   927  		}
   928  		return nil, &googleapi.Error{
   929  			Code:   res.StatusCode,
   930  			Header: res.Header,
   931  		}
   932  	}
   933  	if err != nil {
   934  		return nil, err
   935  	}
   936  	defer googleapi.CloseBody(res)
   937  	if err := googleapi.CheckResponse(res); err != nil {
   938  		return nil, err
   939  	}
   940  	ret := &MobileAppPanel{
   941  		ServerResponse: googleapi.ServerResponse{
   942  			Header:         res.Header,
   943  			HTTPStatusCode: res.StatusCode,
   944  		},
   945  	}
   946  	target := &ret
   947  	if err := gensupport.DecodeResponse(target, res); err != nil {
   948  		return nil, err
   949  	}
   950  	return ret, nil
   951  	// {
   952  	//   "description": "Retrieves a MobileAppPanel that is available to the authenticated user.",
   953  	//   "httpMethod": "GET",
   954  	//   "id": "consumersurveys.mobileapppanels.get",
   955  	//   "parameterOrder": [
   956  	//     "panelId"
   957  	//   ],
   958  	//   "parameters": {
   959  	//     "panelId": {
   960  	//       "description": "External URL ID for the panel.",
   961  	//       "location": "path",
   962  	//       "required": true,
   963  	//       "type": "string"
   964  	//     }
   965  	//   },
   966  	//   "path": "mobileAppPanels/{panelId}",
   967  	//   "response": {
   968  	//     "$ref": "MobileAppPanel"
   969  	//   },
   970  	//   "scopes": [
   971  	//     "https://www.googleapis.com/auth/consumersurveys",
   972  	//     "https://www.googleapis.com/auth/consumersurveys.readonly",
   973  	//     "https://www.googleapis.com/auth/userinfo.email"
   974  	//   ]
   975  	// }
   976  
   977  }
   978  
   979  // method id "consumersurveys.mobileapppanels.list":
   980  
   981  type MobileapppanelsListCall struct {
   982  	s            *Service
   983  	urlParams_   gensupport.URLParams
   984  	ifNoneMatch_ string
   985  	ctx_         context.Context
   986  	header_      http.Header
   987  }
   988  
   989  // List: Lists the MobileAppPanels available to the authenticated user.
   990  func (r *MobileapppanelsService) List() *MobileapppanelsListCall {
   991  	c := &MobileapppanelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   992  	return c
   993  }
   994  
   995  // MaxResults sets the optional parameter "maxResults":
   996  func (c *MobileapppanelsListCall) MaxResults(maxResults int64) *MobileapppanelsListCall {
   997  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
   998  	return c
   999  }
  1000  
  1001  // StartIndex sets the optional parameter "startIndex":
  1002  func (c *MobileapppanelsListCall) StartIndex(startIndex int64) *MobileapppanelsListCall {
  1003  	c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  1004  	return c
  1005  }
  1006  
  1007  // Token sets the optional parameter "token":
  1008  func (c *MobileapppanelsListCall) Token(token string) *MobileapppanelsListCall {
  1009  	c.urlParams_.Set("token", token)
  1010  	return c
  1011  }
  1012  
  1013  // Fields allows partial responses to be retrieved. See
  1014  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1015  // for more information.
  1016  func (c *MobileapppanelsListCall) Fields(s ...googleapi.Field) *MobileapppanelsListCall {
  1017  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1018  	return c
  1019  }
  1020  
  1021  // IfNoneMatch sets the optional parameter which makes the operation
  1022  // fail if the object's ETag matches the given value. This is useful for
  1023  // getting updates only after the object has changed since the last
  1024  // request. Use googleapi.IsNotModified to check whether the response
  1025  // error from Do is the result of In-None-Match.
  1026  func (c *MobileapppanelsListCall) IfNoneMatch(entityTag string) *MobileapppanelsListCall {
  1027  	c.ifNoneMatch_ = entityTag
  1028  	return c
  1029  }
  1030  
  1031  // Context sets the context to be used in this call's Do method. Any
  1032  // pending HTTP request will be aborted if the provided context is
  1033  // canceled.
  1034  func (c *MobileapppanelsListCall) Context(ctx context.Context) *MobileapppanelsListCall {
  1035  	c.ctx_ = ctx
  1036  	return c
  1037  }
  1038  
  1039  // Header returns an http.Header that can be modified by the caller to
  1040  // add HTTP headers to the request.
  1041  func (c *MobileapppanelsListCall) Header() http.Header {
  1042  	if c.header_ == nil {
  1043  		c.header_ = make(http.Header)
  1044  	}
  1045  	return c.header_
  1046  }
  1047  
  1048  func (c *MobileapppanelsListCall) doRequest(alt string) (*http.Response, error) {
  1049  	reqHeaders := make(http.Header)
  1050  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1051  	for k, v := range c.header_ {
  1052  		reqHeaders[k] = v
  1053  	}
  1054  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1055  	if c.ifNoneMatch_ != "" {
  1056  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1057  	}
  1058  	var body io.Reader = nil
  1059  	c.urlParams_.Set("alt", alt)
  1060  	c.urlParams_.Set("prettyPrint", "false")
  1061  	urls := googleapi.ResolveRelative(c.s.BasePath, "mobileAppPanels")
  1062  	urls += "?" + c.urlParams_.Encode()
  1063  	req, err := http.NewRequest("GET", urls, body)
  1064  	if err != nil {
  1065  		return nil, err
  1066  	}
  1067  	req.Header = reqHeaders
  1068  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1069  }
  1070  
  1071  // Do executes the "consumersurveys.mobileapppanels.list" call.
  1072  // Exactly one of *MobileAppPanelsListResponse or error will be non-nil.
  1073  // Any non-2xx status code is an error. Response headers are in either
  1074  // *MobileAppPanelsListResponse.ServerResponse.Header or (if a response
  1075  // was returned at all) in error.(*googleapi.Error).Header. Use
  1076  // googleapi.IsNotModified to check whether the returned error was
  1077  // because http.StatusNotModified was returned.
  1078  func (c *MobileapppanelsListCall) Do(opts ...googleapi.CallOption) (*MobileAppPanelsListResponse, error) {
  1079  	gensupport.SetOptions(c.urlParams_, opts...)
  1080  	res, err := c.doRequest("json")
  1081  	if res != nil && res.StatusCode == http.StatusNotModified {
  1082  		if res.Body != nil {
  1083  			res.Body.Close()
  1084  		}
  1085  		return nil, &googleapi.Error{
  1086  			Code:   res.StatusCode,
  1087  			Header: res.Header,
  1088  		}
  1089  	}
  1090  	if err != nil {
  1091  		return nil, err
  1092  	}
  1093  	defer googleapi.CloseBody(res)
  1094  	if err := googleapi.CheckResponse(res); err != nil {
  1095  		return nil, err
  1096  	}
  1097  	ret := &MobileAppPanelsListResponse{
  1098  		ServerResponse: googleapi.ServerResponse{
  1099  			Header:         res.Header,
  1100  			HTTPStatusCode: res.StatusCode,
  1101  		},
  1102  	}
  1103  	target := &ret
  1104  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1105  		return nil, err
  1106  	}
  1107  	return ret, nil
  1108  	// {
  1109  	//   "description": "Lists the MobileAppPanels available to the authenticated user.",
  1110  	//   "httpMethod": "GET",
  1111  	//   "id": "consumersurveys.mobileapppanels.list",
  1112  	//   "parameters": {
  1113  	//     "maxResults": {
  1114  	//       "format": "uint32",
  1115  	//       "location": "query",
  1116  	//       "type": "integer"
  1117  	//     },
  1118  	//     "startIndex": {
  1119  	//       "format": "uint32",
  1120  	//       "location": "query",
  1121  	//       "type": "integer"
  1122  	//     },
  1123  	//     "token": {
  1124  	//       "location": "query",
  1125  	//       "type": "string"
  1126  	//     }
  1127  	//   },
  1128  	//   "path": "mobileAppPanels",
  1129  	//   "response": {
  1130  	//     "$ref": "MobileAppPanelsListResponse"
  1131  	//   },
  1132  	//   "scopes": [
  1133  	//     "https://www.googleapis.com/auth/consumersurveys",
  1134  	//     "https://www.googleapis.com/auth/consumersurveys.readonly",
  1135  	//     "https://www.googleapis.com/auth/userinfo.email"
  1136  	//   ]
  1137  	// }
  1138  
  1139  }
  1140  
  1141  // method id "consumersurveys.mobileapppanels.update":
  1142  
  1143  type MobileapppanelsUpdateCall struct {
  1144  	s              *Service
  1145  	panelId        string
  1146  	mobileapppanel *MobileAppPanel
  1147  	urlParams_     gensupport.URLParams
  1148  	ctx_           context.Context
  1149  	header_        http.Header
  1150  }
  1151  
  1152  // Update: Updates a MobileAppPanel. Currently the only property that
  1153  // can be updated is the owners property.
  1154  func (r *MobileapppanelsService) Update(panelId string, mobileapppanel *MobileAppPanel) *MobileapppanelsUpdateCall {
  1155  	c := &MobileapppanelsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1156  	c.panelId = panelId
  1157  	c.mobileapppanel = mobileapppanel
  1158  	return c
  1159  }
  1160  
  1161  // Fields allows partial responses to be retrieved. See
  1162  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1163  // for more information.
  1164  func (c *MobileapppanelsUpdateCall) Fields(s ...googleapi.Field) *MobileapppanelsUpdateCall {
  1165  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1166  	return c
  1167  }
  1168  
  1169  // Context sets the context to be used in this call's Do method. Any
  1170  // pending HTTP request will be aborted if the provided context is
  1171  // canceled.
  1172  func (c *MobileapppanelsUpdateCall) Context(ctx context.Context) *MobileapppanelsUpdateCall {
  1173  	c.ctx_ = ctx
  1174  	return c
  1175  }
  1176  
  1177  // Header returns an http.Header that can be modified by the caller to
  1178  // add HTTP headers to the request.
  1179  func (c *MobileapppanelsUpdateCall) Header() http.Header {
  1180  	if c.header_ == nil {
  1181  		c.header_ = make(http.Header)
  1182  	}
  1183  	return c.header_
  1184  }
  1185  
  1186  func (c *MobileapppanelsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1187  	reqHeaders := make(http.Header)
  1188  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1189  	for k, v := range c.header_ {
  1190  		reqHeaders[k] = v
  1191  	}
  1192  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1193  	var body io.Reader = nil
  1194  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.mobileapppanel)
  1195  	if err != nil {
  1196  		return nil, err
  1197  	}
  1198  	reqHeaders.Set("Content-Type", "application/json")
  1199  	c.urlParams_.Set("alt", alt)
  1200  	c.urlParams_.Set("prettyPrint", "false")
  1201  	urls := googleapi.ResolveRelative(c.s.BasePath, "mobileAppPanels/{panelId}")
  1202  	urls += "?" + c.urlParams_.Encode()
  1203  	req, err := http.NewRequest("PUT", urls, body)
  1204  	if err != nil {
  1205  		return nil, err
  1206  	}
  1207  	req.Header = reqHeaders
  1208  	googleapi.Expand(req.URL, map[string]string{
  1209  		"panelId": c.panelId,
  1210  	})
  1211  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1212  }
  1213  
  1214  // Do executes the "consumersurveys.mobileapppanels.update" call.
  1215  // Exactly one of *MobileAppPanel or error will be non-nil. Any non-2xx
  1216  // status code is an error. Response headers are in either
  1217  // *MobileAppPanel.ServerResponse.Header or (if a response was returned
  1218  // at all) in error.(*googleapi.Error).Header. Use
  1219  // googleapi.IsNotModified to check whether the returned error was
  1220  // because http.StatusNotModified was returned.
  1221  func (c *MobileapppanelsUpdateCall) Do(opts ...googleapi.CallOption) (*MobileAppPanel, error) {
  1222  	gensupport.SetOptions(c.urlParams_, opts...)
  1223  	res, err := c.doRequest("json")
  1224  	if res != nil && res.StatusCode == http.StatusNotModified {
  1225  		if res.Body != nil {
  1226  			res.Body.Close()
  1227  		}
  1228  		return nil, &googleapi.Error{
  1229  			Code:   res.StatusCode,
  1230  			Header: res.Header,
  1231  		}
  1232  	}
  1233  	if err != nil {
  1234  		return nil, err
  1235  	}
  1236  	defer googleapi.CloseBody(res)
  1237  	if err := googleapi.CheckResponse(res); err != nil {
  1238  		return nil, err
  1239  	}
  1240  	ret := &MobileAppPanel{
  1241  		ServerResponse: googleapi.ServerResponse{
  1242  			Header:         res.Header,
  1243  			HTTPStatusCode: res.StatusCode,
  1244  		},
  1245  	}
  1246  	target := &ret
  1247  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1248  		return nil, err
  1249  	}
  1250  	return ret, nil
  1251  	// {
  1252  	//   "description": "Updates a MobileAppPanel. Currently the only property that can be updated is the owners property.",
  1253  	//   "httpMethod": "PUT",
  1254  	//   "id": "consumersurveys.mobileapppanels.update",
  1255  	//   "parameterOrder": [
  1256  	//     "panelId"
  1257  	//   ],
  1258  	//   "parameters": {
  1259  	//     "panelId": {
  1260  	//       "description": "External URL ID for the panel.",
  1261  	//       "location": "path",
  1262  	//       "required": true,
  1263  	//       "type": "string"
  1264  	//     }
  1265  	//   },
  1266  	//   "path": "mobileAppPanels/{panelId}",
  1267  	//   "request": {
  1268  	//     "$ref": "MobileAppPanel"
  1269  	//   },
  1270  	//   "response": {
  1271  	//     "$ref": "MobileAppPanel"
  1272  	//   },
  1273  	//   "scopes": [
  1274  	//     "https://www.googleapis.com/auth/consumersurveys",
  1275  	//     "https://www.googleapis.com/auth/userinfo.email"
  1276  	//   ]
  1277  	// }
  1278  
  1279  }
  1280  
  1281  // method id "consumersurveys.results.get":
  1282  
  1283  type ResultsGetCall struct {
  1284  	s                 *Service
  1285  	surveyUrlId       string
  1286  	resultsgetrequest *ResultsGetRequest
  1287  	urlParams_        gensupport.URLParams
  1288  	ifNoneMatch_      string
  1289  	ctx_              context.Context
  1290  	header_           http.Header
  1291  }
  1292  
  1293  // Get: Retrieves any survey results that have been produced so far.
  1294  // Results are formatted as an Excel file. You must add "?alt=media" to
  1295  // the URL as an argument to get results.
  1296  func (r *ResultsService) Get(surveyUrlId string, resultsgetrequest *ResultsGetRequest) *ResultsGetCall {
  1297  	c := &ResultsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1298  	c.surveyUrlId = surveyUrlId
  1299  	c.resultsgetrequest = resultsgetrequest
  1300  	return c
  1301  }
  1302  
  1303  // Fields allows partial responses to be retrieved. See
  1304  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1305  // for more information.
  1306  func (c *ResultsGetCall) Fields(s ...googleapi.Field) *ResultsGetCall {
  1307  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1308  	return c
  1309  }
  1310  
  1311  // IfNoneMatch sets the optional parameter which makes the operation
  1312  // fail if the object's ETag matches the given value. This is useful for
  1313  // getting updates only after the object has changed since the last
  1314  // request. Use googleapi.IsNotModified to check whether the response
  1315  // error from Do is the result of In-None-Match.
  1316  func (c *ResultsGetCall) IfNoneMatch(entityTag string) *ResultsGetCall {
  1317  	c.ifNoneMatch_ = entityTag
  1318  	return c
  1319  }
  1320  
  1321  // Context sets the context to be used in this call's Do and Download
  1322  // methods. Any pending HTTP request will be aborted if the provided
  1323  // context is canceled.
  1324  func (c *ResultsGetCall) Context(ctx context.Context) *ResultsGetCall {
  1325  	c.ctx_ = ctx
  1326  	return c
  1327  }
  1328  
  1329  // Header returns an http.Header that can be modified by the caller to
  1330  // add HTTP headers to the request.
  1331  func (c *ResultsGetCall) Header() http.Header {
  1332  	if c.header_ == nil {
  1333  		c.header_ = make(http.Header)
  1334  	}
  1335  	return c.header_
  1336  }
  1337  
  1338  func (c *ResultsGetCall) doRequest(alt string) (*http.Response, error) {
  1339  	reqHeaders := make(http.Header)
  1340  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1341  	for k, v := range c.header_ {
  1342  		reqHeaders[k] = v
  1343  	}
  1344  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1345  	if c.ifNoneMatch_ != "" {
  1346  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1347  	}
  1348  	var body io.Reader = nil
  1349  	c.urlParams_.Set("alt", alt)
  1350  	c.urlParams_.Set("prettyPrint", "false")
  1351  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys/{surveyUrlId}/results")
  1352  	urls += "?" + c.urlParams_.Encode()
  1353  	req, err := http.NewRequest("GET", urls, body)
  1354  	if err != nil {
  1355  		return nil, err
  1356  	}
  1357  	req.Header = reqHeaders
  1358  	googleapi.Expand(req.URL, map[string]string{
  1359  		"surveyUrlId": c.surveyUrlId,
  1360  	})
  1361  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1362  }
  1363  
  1364  // Download fetches the API endpoint's "media" value, instead of the normal
  1365  // API response value. If the returned error is nil, the Response is guaranteed to
  1366  // have a 2xx status code. Callers must close the Response.Body as usual.
  1367  func (c *ResultsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  1368  	gensupport.SetOptions(c.urlParams_, opts...)
  1369  	res, err := c.doRequest("media")
  1370  	if err != nil {
  1371  		return nil, err
  1372  	}
  1373  	if err := googleapi.CheckMediaResponse(res); err != nil {
  1374  		res.Body.Close()
  1375  		return nil, err
  1376  	}
  1377  	return res, nil
  1378  }
  1379  
  1380  // Do executes the "consumersurveys.results.get" call.
  1381  // Exactly one of *SurveyResults or error will be non-nil. Any non-2xx
  1382  // status code is an error. Response headers are in either
  1383  // *SurveyResults.ServerResponse.Header or (if a response was returned
  1384  // at all) in error.(*googleapi.Error).Header. Use
  1385  // googleapi.IsNotModified to check whether the returned error was
  1386  // because http.StatusNotModified was returned.
  1387  func (c *ResultsGetCall) Do(opts ...googleapi.CallOption) (*SurveyResults, error) {
  1388  	gensupport.SetOptions(c.urlParams_, opts...)
  1389  	res, err := c.doRequest("json")
  1390  	if res != nil && res.StatusCode == http.StatusNotModified {
  1391  		if res.Body != nil {
  1392  			res.Body.Close()
  1393  		}
  1394  		return nil, &googleapi.Error{
  1395  			Code:   res.StatusCode,
  1396  			Header: res.Header,
  1397  		}
  1398  	}
  1399  	if err != nil {
  1400  		return nil, err
  1401  	}
  1402  	defer googleapi.CloseBody(res)
  1403  	if err := googleapi.CheckResponse(res); err != nil {
  1404  		return nil, err
  1405  	}
  1406  	ret := &SurveyResults{
  1407  		ServerResponse: googleapi.ServerResponse{
  1408  			Header:         res.Header,
  1409  			HTTPStatusCode: res.StatusCode,
  1410  		},
  1411  	}
  1412  	target := &ret
  1413  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1414  		return nil, err
  1415  	}
  1416  	return ret, nil
  1417  	// {
  1418  	//   "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.",
  1419  	//   "httpMethod": "GET",
  1420  	//   "id": "consumersurveys.results.get",
  1421  	//   "parameterOrder": [
  1422  	//     "surveyUrlId"
  1423  	//   ],
  1424  	//   "parameters": {
  1425  	//     "surveyUrlId": {
  1426  	//       "description": "External URL ID for the survey.",
  1427  	//       "location": "path",
  1428  	//       "required": true,
  1429  	//       "type": "string"
  1430  	//     }
  1431  	//   },
  1432  	//   "path": "surveys/{surveyUrlId}/results",
  1433  	//   "request": {
  1434  	//     "$ref": "ResultsGetRequest"
  1435  	//   },
  1436  	//   "response": {
  1437  	//     "$ref": "SurveyResults"
  1438  	//   },
  1439  	//   "scopes": [
  1440  	//     "https://www.googleapis.com/auth/consumersurveys",
  1441  	//     "https://www.googleapis.com/auth/consumersurveys.readonly",
  1442  	//     "https://www.googleapis.com/auth/userinfo.email"
  1443  	//   ],
  1444  	//   "supportsMediaDownload": true
  1445  	// }
  1446  
  1447  }
  1448  
  1449  // method id "consumersurveys.surveys.delete":
  1450  
  1451  type SurveysDeleteCall struct {
  1452  	s           *Service
  1453  	surveyUrlId string
  1454  	urlParams_  gensupport.URLParams
  1455  	ctx_        context.Context
  1456  	header_     http.Header
  1457  }
  1458  
  1459  // Delete: Removes a survey from view in all user GET requests.
  1460  func (r *SurveysService) Delete(surveyUrlId string) *SurveysDeleteCall {
  1461  	c := &SurveysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1462  	c.surveyUrlId = surveyUrlId
  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 *SurveysDeleteCall) Fields(s ...googleapi.Field) *SurveysDeleteCall {
  1470  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1471  	return c
  1472  }
  1473  
  1474  // Context sets the context to be used in this call's Do method. Any
  1475  // pending HTTP request will be aborted if the provided context is
  1476  // canceled.
  1477  func (c *SurveysDeleteCall) Context(ctx context.Context) *SurveysDeleteCall {
  1478  	c.ctx_ = ctx
  1479  	return c
  1480  }
  1481  
  1482  // Header returns an http.Header that can be modified by the caller to
  1483  // add HTTP headers to the request.
  1484  func (c *SurveysDeleteCall) Header() http.Header {
  1485  	if c.header_ == nil {
  1486  		c.header_ = make(http.Header)
  1487  	}
  1488  	return c.header_
  1489  }
  1490  
  1491  func (c *SurveysDeleteCall) doRequest(alt string) (*http.Response, error) {
  1492  	reqHeaders := make(http.Header)
  1493  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1494  	for k, v := range c.header_ {
  1495  		reqHeaders[k] = v
  1496  	}
  1497  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1498  	var body io.Reader = nil
  1499  	c.urlParams_.Set("alt", alt)
  1500  	c.urlParams_.Set("prettyPrint", "false")
  1501  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys/{surveyUrlId}")
  1502  	urls += "?" + c.urlParams_.Encode()
  1503  	req, err := http.NewRequest("DELETE", urls, body)
  1504  	if err != nil {
  1505  		return nil, err
  1506  	}
  1507  	req.Header = reqHeaders
  1508  	googleapi.Expand(req.URL, map[string]string{
  1509  		"surveyUrlId": c.surveyUrlId,
  1510  	})
  1511  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1512  }
  1513  
  1514  // Do executes the "consumersurveys.surveys.delete" call.
  1515  // Exactly one of *SurveysDeleteResponse or error will be non-nil. Any
  1516  // non-2xx status code is an error. Response headers are in either
  1517  // *SurveysDeleteResponse.ServerResponse.Header or (if a response was
  1518  // returned at all) in error.(*googleapi.Error).Header. Use
  1519  // googleapi.IsNotModified to check whether the returned error was
  1520  // because http.StatusNotModified was returned.
  1521  func (c *SurveysDeleteCall) Do(opts ...googleapi.CallOption) (*SurveysDeleteResponse, error) {
  1522  	gensupport.SetOptions(c.urlParams_, opts...)
  1523  	res, err := c.doRequest("json")
  1524  	if res != nil && res.StatusCode == http.StatusNotModified {
  1525  		if res.Body != nil {
  1526  			res.Body.Close()
  1527  		}
  1528  		return nil, &googleapi.Error{
  1529  			Code:   res.StatusCode,
  1530  			Header: res.Header,
  1531  		}
  1532  	}
  1533  	if err != nil {
  1534  		return nil, err
  1535  	}
  1536  	defer googleapi.CloseBody(res)
  1537  	if err := googleapi.CheckResponse(res); err != nil {
  1538  		return nil, err
  1539  	}
  1540  	ret := &SurveysDeleteResponse{
  1541  		ServerResponse: googleapi.ServerResponse{
  1542  			Header:         res.Header,
  1543  			HTTPStatusCode: res.StatusCode,
  1544  		},
  1545  	}
  1546  	target := &ret
  1547  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1548  		return nil, err
  1549  	}
  1550  	return ret, nil
  1551  	// {
  1552  	//   "description": "Removes a survey from view in all user GET requests.",
  1553  	//   "httpMethod": "DELETE",
  1554  	//   "id": "consumersurveys.surveys.delete",
  1555  	//   "parameterOrder": [
  1556  	//     "surveyUrlId"
  1557  	//   ],
  1558  	//   "parameters": {
  1559  	//     "surveyUrlId": {
  1560  	//       "description": "External URL ID for the survey.",
  1561  	//       "location": "path",
  1562  	//       "required": true,
  1563  	//       "type": "string"
  1564  	//     }
  1565  	//   },
  1566  	//   "path": "surveys/{surveyUrlId}",
  1567  	//   "response": {
  1568  	//     "$ref": "SurveysDeleteResponse"
  1569  	//   },
  1570  	//   "scopes": [
  1571  	//     "https://www.googleapis.com/auth/consumersurveys",
  1572  	//     "https://www.googleapis.com/auth/userinfo.email"
  1573  	//   ]
  1574  	// }
  1575  
  1576  }
  1577  
  1578  // method id "consumersurveys.surveys.get":
  1579  
  1580  type SurveysGetCall struct {
  1581  	s            *Service
  1582  	surveyUrlId  string
  1583  	urlParams_   gensupport.URLParams
  1584  	ifNoneMatch_ string
  1585  	ctx_         context.Context
  1586  	header_      http.Header
  1587  }
  1588  
  1589  // Get: Retrieves information about the specified survey.
  1590  func (r *SurveysService) Get(surveyUrlId string) *SurveysGetCall {
  1591  	c := &SurveysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1592  	c.surveyUrlId = surveyUrlId
  1593  	return c
  1594  }
  1595  
  1596  // Fields allows partial responses to be retrieved. See
  1597  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1598  // for more information.
  1599  func (c *SurveysGetCall) Fields(s ...googleapi.Field) *SurveysGetCall {
  1600  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1601  	return c
  1602  }
  1603  
  1604  // IfNoneMatch sets the optional parameter which makes the operation
  1605  // fail if the object's ETag matches the given value. This is useful for
  1606  // getting updates only after the object has changed since the last
  1607  // request. Use googleapi.IsNotModified to check whether the response
  1608  // error from Do is the result of In-None-Match.
  1609  func (c *SurveysGetCall) IfNoneMatch(entityTag string) *SurveysGetCall {
  1610  	c.ifNoneMatch_ = entityTag
  1611  	return c
  1612  }
  1613  
  1614  // Context sets the context to be used in this call's Do method. Any
  1615  // pending HTTP request will be aborted if the provided context is
  1616  // canceled.
  1617  func (c *SurveysGetCall) Context(ctx context.Context) *SurveysGetCall {
  1618  	c.ctx_ = ctx
  1619  	return c
  1620  }
  1621  
  1622  // Header returns an http.Header that can be modified by the caller to
  1623  // add HTTP headers to the request.
  1624  func (c *SurveysGetCall) Header() http.Header {
  1625  	if c.header_ == nil {
  1626  		c.header_ = make(http.Header)
  1627  	}
  1628  	return c.header_
  1629  }
  1630  
  1631  func (c *SurveysGetCall) doRequest(alt string) (*http.Response, error) {
  1632  	reqHeaders := make(http.Header)
  1633  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1634  	for k, v := range c.header_ {
  1635  		reqHeaders[k] = v
  1636  	}
  1637  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1638  	if c.ifNoneMatch_ != "" {
  1639  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1640  	}
  1641  	var body io.Reader = nil
  1642  	c.urlParams_.Set("alt", alt)
  1643  	c.urlParams_.Set("prettyPrint", "false")
  1644  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys/{surveyUrlId}")
  1645  	urls += "?" + c.urlParams_.Encode()
  1646  	req, err := http.NewRequest("GET", urls, body)
  1647  	if err != nil {
  1648  		return nil, err
  1649  	}
  1650  	req.Header = reqHeaders
  1651  	googleapi.Expand(req.URL, map[string]string{
  1652  		"surveyUrlId": c.surveyUrlId,
  1653  	})
  1654  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1655  }
  1656  
  1657  // Do executes the "consumersurveys.surveys.get" call.
  1658  // Exactly one of *Survey or error will be non-nil. Any non-2xx status
  1659  // code is an error. Response headers are in either
  1660  // *Survey.ServerResponse.Header or (if a response was returned at all)
  1661  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1662  // check whether the returned error was because http.StatusNotModified
  1663  // was returned.
  1664  func (c *SurveysGetCall) Do(opts ...googleapi.CallOption) (*Survey, error) {
  1665  	gensupport.SetOptions(c.urlParams_, opts...)
  1666  	res, err := c.doRequest("json")
  1667  	if res != nil && res.StatusCode == http.StatusNotModified {
  1668  		if res.Body != nil {
  1669  			res.Body.Close()
  1670  		}
  1671  		return nil, &googleapi.Error{
  1672  			Code:   res.StatusCode,
  1673  			Header: res.Header,
  1674  		}
  1675  	}
  1676  	if err != nil {
  1677  		return nil, err
  1678  	}
  1679  	defer googleapi.CloseBody(res)
  1680  	if err := googleapi.CheckResponse(res); err != nil {
  1681  		return nil, err
  1682  	}
  1683  	ret := &Survey{
  1684  		ServerResponse: googleapi.ServerResponse{
  1685  			Header:         res.Header,
  1686  			HTTPStatusCode: res.StatusCode,
  1687  		},
  1688  	}
  1689  	target := &ret
  1690  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1691  		return nil, err
  1692  	}
  1693  	return ret, nil
  1694  	// {
  1695  	//   "description": "Retrieves information about the specified survey.",
  1696  	//   "httpMethod": "GET",
  1697  	//   "id": "consumersurveys.surveys.get",
  1698  	//   "parameterOrder": [
  1699  	//     "surveyUrlId"
  1700  	//   ],
  1701  	//   "parameters": {
  1702  	//     "surveyUrlId": {
  1703  	//       "description": "External URL ID for the survey.",
  1704  	//       "location": "path",
  1705  	//       "required": true,
  1706  	//       "type": "string"
  1707  	//     }
  1708  	//   },
  1709  	//   "path": "surveys/{surveyUrlId}",
  1710  	//   "response": {
  1711  	//     "$ref": "Survey"
  1712  	//   },
  1713  	//   "scopes": [
  1714  	//     "https://www.googleapis.com/auth/consumersurveys",
  1715  	//     "https://www.googleapis.com/auth/consumersurveys.readonly",
  1716  	//     "https://www.googleapis.com/auth/userinfo.email"
  1717  	//   ]
  1718  	// }
  1719  
  1720  }
  1721  
  1722  // method id "consumersurveys.surveys.insert":
  1723  
  1724  type SurveysInsertCall struct {
  1725  	s          *Service
  1726  	survey     *Survey
  1727  	urlParams_ gensupport.URLParams
  1728  	ctx_       context.Context
  1729  	header_    http.Header
  1730  }
  1731  
  1732  // Insert: Creates a survey.
  1733  func (r *SurveysService) Insert(survey *Survey) *SurveysInsertCall {
  1734  	c := &SurveysInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1735  	c.survey = survey
  1736  	return c
  1737  }
  1738  
  1739  // Fields allows partial responses to be retrieved. See
  1740  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1741  // for more information.
  1742  func (c *SurveysInsertCall) Fields(s ...googleapi.Field) *SurveysInsertCall {
  1743  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1744  	return c
  1745  }
  1746  
  1747  // Context sets the context to be used in this call's Do method. Any
  1748  // pending HTTP request will be aborted if the provided context is
  1749  // canceled.
  1750  func (c *SurveysInsertCall) Context(ctx context.Context) *SurveysInsertCall {
  1751  	c.ctx_ = ctx
  1752  	return c
  1753  }
  1754  
  1755  // Header returns an http.Header that can be modified by the caller to
  1756  // add HTTP headers to the request.
  1757  func (c *SurveysInsertCall) Header() http.Header {
  1758  	if c.header_ == nil {
  1759  		c.header_ = make(http.Header)
  1760  	}
  1761  	return c.header_
  1762  }
  1763  
  1764  func (c *SurveysInsertCall) doRequest(alt string) (*http.Response, error) {
  1765  	reqHeaders := make(http.Header)
  1766  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1767  	for k, v := range c.header_ {
  1768  		reqHeaders[k] = v
  1769  	}
  1770  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1771  	var body io.Reader = nil
  1772  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.survey)
  1773  	if err != nil {
  1774  		return nil, err
  1775  	}
  1776  	reqHeaders.Set("Content-Type", "application/json")
  1777  	c.urlParams_.Set("alt", alt)
  1778  	c.urlParams_.Set("prettyPrint", "false")
  1779  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys")
  1780  	urls += "?" + c.urlParams_.Encode()
  1781  	req, err := http.NewRequest("POST", urls, body)
  1782  	if err != nil {
  1783  		return nil, err
  1784  	}
  1785  	req.Header = reqHeaders
  1786  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1787  }
  1788  
  1789  // Do executes the "consumersurveys.surveys.insert" call.
  1790  // Exactly one of *Survey or error will be non-nil. Any non-2xx status
  1791  // code is an error. Response headers are in either
  1792  // *Survey.ServerResponse.Header or (if a response was returned at all)
  1793  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1794  // check whether the returned error was because http.StatusNotModified
  1795  // was returned.
  1796  func (c *SurveysInsertCall) Do(opts ...googleapi.CallOption) (*Survey, error) {
  1797  	gensupport.SetOptions(c.urlParams_, opts...)
  1798  	res, err := c.doRequest("json")
  1799  	if res != nil && res.StatusCode == http.StatusNotModified {
  1800  		if res.Body != nil {
  1801  			res.Body.Close()
  1802  		}
  1803  		return nil, &googleapi.Error{
  1804  			Code:   res.StatusCode,
  1805  			Header: res.Header,
  1806  		}
  1807  	}
  1808  	if err != nil {
  1809  		return nil, err
  1810  	}
  1811  	defer googleapi.CloseBody(res)
  1812  	if err := googleapi.CheckResponse(res); err != nil {
  1813  		return nil, err
  1814  	}
  1815  	ret := &Survey{
  1816  		ServerResponse: googleapi.ServerResponse{
  1817  			Header:         res.Header,
  1818  			HTTPStatusCode: res.StatusCode,
  1819  		},
  1820  	}
  1821  	target := &ret
  1822  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1823  		return nil, err
  1824  	}
  1825  	return ret, nil
  1826  	// {
  1827  	//   "description": "Creates a survey.",
  1828  	//   "httpMethod": "POST",
  1829  	//   "id": "consumersurveys.surveys.insert",
  1830  	//   "path": "surveys",
  1831  	//   "request": {
  1832  	//     "$ref": "Survey"
  1833  	//   },
  1834  	//   "response": {
  1835  	//     "$ref": "Survey"
  1836  	//   },
  1837  	//   "scopes": [
  1838  	//     "https://www.googleapis.com/auth/consumersurveys",
  1839  	//     "https://www.googleapis.com/auth/userinfo.email"
  1840  	//   ]
  1841  	// }
  1842  
  1843  }
  1844  
  1845  // method id "consumersurveys.surveys.list":
  1846  
  1847  type SurveysListCall struct {
  1848  	s            *Service
  1849  	urlParams_   gensupport.URLParams
  1850  	ifNoneMatch_ string
  1851  	ctx_         context.Context
  1852  	header_      http.Header
  1853  }
  1854  
  1855  // List: Lists the surveys owned by the authenticated user.
  1856  func (r *SurveysService) List() *SurveysListCall {
  1857  	c := &SurveysListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1858  	return c
  1859  }
  1860  
  1861  // MaxResults sets the optional parameter "maxResults":
  1862  func (c *SurveysListCall) MaxResults(maxResults int64) *SurveysListCall {
  1863  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1864  	return c
  1865  }
  1866  
  1867  // StartIndex sets the optional parameter "startIndex":
  1868  func (c *SurveysListCall) StartIndex(startIndex int64) *SurveysListCall {
  1869  	c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  1870  	return c
  1871  }
  1872  
  1873  // Token sets the optional parameter "token":
  1874  func (c *SurveysListCall) Token(token string) *SurveysListCall {
  1875  	c.urlParams_.Set("token", token)
  1876  	return c
  1877  }
  1878  
  1879  // Fields allows partial responses to be retrieved. See
  1880  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1881  // for more information.
  1882  func (c *SurveysListCall) Fields(s ...googleapi.Field) *SurveysListCall {
  1883  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1884  	return c
  1885  }
  1886  
  1887  // IfNoneMatch sets the optional parameter which makes the operation
  1888  // fail if the object's ETag matches the given value. This is useful for
  1889  // getting updates only after the object has changed since the last
  1890  // request. Use googleapi.IsNotModified to check whether the response
  1891  // error from Do is the result of In-None-Match.
  1892  func (c *SurveysListCall) IfNoneMatch(entityTag string) *SurveysListCall {
  1893  	c.ifNoneMatch_ = entityTag
  1894  	return c
  1895  }
  1896  
  1897  // Context sets the context to be used in this call's Do method. Any
  1898  // pending HTTP request will be aborted if the provided context is
  1899  // canceled.
  1900  func (c *SurveysListCall) Context(ctx context.Context) *SurveysListCall {
  1901  	c.ctx_ = ctx
  1902  	return c
  1903  }
  1904  
  1905  // Header returns an http.Header that can be modified by the caller to
  1906  // add HTTP headers to the request.
  1907  func (c *SurveysListCall) Header() http.Header {
  1908  	if c.header_ == nil {
  1909  		c.header_ = make(http.Header)
  1910  	}
  1911  	return c.header_
  1912  }
  1913  
  1914  func (c *SurveysListCall) doRequest(alt string) (*http.Response, error) {
  1915  	reqHeaders := make(http.Header)
  1916  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1917  	for k, v := range c.header_ {
  1918  		reqHeaders[k] = v
  1919  	}
  1920  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1921  	if c.ifNoneMatch_ != "" {
  1922  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1923  	}
  1924  	var body io.Reader = nil
  1925  	c.urlParams_.Set("alt", alt)
  1926  	c.urlParams_.Set("prettyPrint", "false")
  1927  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys")
  1928  	urls += "?" + c.urlParams_.Encode()
  1929  	req, err := http.NewRequest("GET", urls, body)
  1930  	if err != nil {
  1931  		return nil, err
  1932  	}
  1933  	req.Header = reqHeaders
  1934  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1935  }
  1936  
  1937  // Do executes the "consumersurveys.surveys.list" call.
  1938  // Exactly one of *SurveysListResponse or error will be non-nil. Any
  1939  // non-2xx status code is an error. Response headers are in either
  1940  // *SurveysListResponse.ServerResponse.Header or (if a response was
  1941  // returned at all) in error.(*googleapi.Error).Header. Use
  1942  // googleapi.IsNotModified to check whether the returned error was
  1943  // because http.StatusNotModified was returned.
  1944  func (c *SurveysListCall) Do(opts ...googleapi.CallOption) (*SurveysListResponse, error) {
  1945  	gensupport.SetOptions(c.urlParams_, opts...)
  1946  	res, err := c.doRequest("json")
  1947  	if res != nil && res.StatusCode == http.StatusNotModified {
  1948  		if res.Body != nil {
  1949  			res.Body.Close()
  1950  		}
  1951  		return nil, &googleapi.Error{
  1952  			Code:   res.StatusCode,
  1953  			Header: res.Header,
  1954  		}
  1955  	}
  1956  	if err != nil {
  1957  		return nil, err
  1958  	}
  1959  	defer googleapi.CloseBody(res)
  1960  	if err := googleapi.CheckResponse(res); err != nil {
  1961  		return nil, err
  1962  	}
  1963  	ret := &SurveysListResponse{
  1964  		ServerResponse: googleapi.ServerResponse{
  1965  			Header:         res.Header,
  1966  			HTTPStatusCode: res.StatusCode,
  1967  		},
  1968  	}
  1969  	target := &ret
  1970  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1971  		return nil, err
  1972  	}
  1973  	return ret, nil
  1974  	// {
  1975  	//   "description": "Lists the surveys owned by the authenticated user.",
  1976  	//   "httpMethod": "GET",
  1977  	//   "id": "consumersurveys.surveys.list",
  1978  	//   "parameters": {
  1979  	//     "maxResults": {
  1980  	//       "format": "uint32",
  1981  	//       "location": "query",
  1982  	//       "type": "integer"
  1983  	//     },
  1984  	//     "startIndex": {
  1985  	//       "format": "uint32",
  1986  	//       "location": "query",
  1987  	//       "type": "integer"
  1988  	//     },
  1989  	//     "token": {
  1990  	//       "location": "query",
  1991  	//       "type": "string"
  1992  	//     }
  1993  	//   },
  1994  	//   "path": "surveys",
  1995  	//   "response": {
  1996  	//     "$ref": "SurveysListResponse"
  1997  	//   },
  1998  	//   "scopes": [
  1999  	//     "https://www.googleapis.com/auth/consumersurveys",
  2000  	//     "https://www.googleapis.com/auth/consumersurveys.readonly",
  2001  	//     "https://www.googleapis.com/auth/userinfo.email"
  2002  	//   ]
  2003  	// }
  2004  
  2005  }
  2006  
  2007  // method id "consumersurveys.surveys.start":
  2008  
  2009  type SurveysStartCall struct {
  2010  	s                   *Service
  2011  	resourceId          string
  2012  	surveysstartrequest *SurveysStartRequest
  2013  	urlParams_          gensupport.URLParams
  2014  	ctx_                context.Context
  2015  	header_             http.Header
  2016  }
  2017  
  2018  // Start: Begins running a survey.
  2019  func (r *SurveysService) Start(resourceId string, surveysstartrequest *SurveysStartRequest) *SurveysStartCall {
  2020  	c := &SurveysStartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2021  	c.resourceId = resourceId
  2022  	c.surveysstartrequest = surveysstartrequest
  2023  	return c
  2024  }
  2025  
  2026  // Fields allows partial responses to be retrieved. See
  2027  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2028  // for more information.
  2029  func (c *SurveysStartCall) Fields(s ...googleapi.Field) *SurveysStartCall {
  2030  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2031  	return c
  2032  }
  2033  
  2034  // Context sets the context to be used in this call's Do method. Any
  2035  // pending HTTP request will be aborted if the provided context is
  2036  // canceled.
  2037  func (c *SurveysStartCall) Context(ctx context.Context) *SurveysStartCall {
  2038  	c.ctx_ = ctx
  2039  	return c
  2040  }
  2041  
  2042  // Header returns an http.Header that can be modified by the caller to
  2043  // add HTTP headers to the request.
  2044  func (c *SurveysStartCall) Header() http.Header {
  2045  	if c.header_ == nil {
  2046  		c.header_ = make(http.Header)
  2047  	}
  2048  	return c.header_
  2049  }
  2050  
  2051  func (c *SurveysStartCall) doRequest(alt string) (*http.Response, error) {
  2052  	reqHeaders := make(http.Header)
  2053  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  2054  	for k, v := range c.header_ {
  2055  		reqHeaders[k] = v
  2056  	}
  2057  	reqHeaders.Set("User-Agent", c.s.userAgent())
  2058  	var body io.Reader = nil
  2059  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.surveysstartrequest)
  2060  	if err != nil {
  2061  		return nil, err
  2062  	}
  2063  	reqHeaders.Set("Content-Type", "application/json")
  2064  	c.urlParams_.Set("alt", alt)
  2065  	c.urlParams_.Set("prettyPrint", "false")
  2066  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys/{resourceId}/start")
  2067  	urls += "?" + c.urlParams_.Encode()
  2068  	req, err := http.NewRequest("POST", urls, body)
  2069  	if err != nil {
  2070  		return nil, err
  2071  	}
  2072  	req.Header = reqHeaders
  2073  	googleapi.Expand(req.URL, map[string]string{
  2074  		"resourceId": c.resourceId,
  2075  	})
  2076  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2077  }
  2078  
  2079  // Do executes the "consumersurveys.surveys.start" call.
  2080  // Exactly one of *SurveysStartResponse or error will be non-nil. Any
  2081  // non-2xx status code is an error. Response headers are in either
  2082  // *SurveysStartResponse.ServerResponse.Header or (if a response was
  2083  // returned at all) in error.(*googleapi.Error).Header. Use
  2084  // googleapi.IsNotModified to check whether the returned error was
  2085  // because http.StatusNotModified was returned.
  2086  func (c *SurveysStartCall) Do(opts ...googleapi.CallOption) (*SurveysStartResponse, error) {
  2087  	gensupport.SetOptions(c.urlParams_, opts...)
  2088  	res, err := c.doRequest("json")
  2089  	if res != nil && res.StatusCode == http.StatusNotModified {
  2090  		if res.Body != nil {
  2091  			res.Body.Close()
  2092  		}
  2093  		return nil, &googleapi.Error{
  2094  			Code:   res.StatusCode,
  2095  			Header: res.Header,
  2096  		}
  2097  	}
  2098  	if err != nil {
  2099  		return nil, err
  2100  	}
  2101  	defer googleapi.CloseBody(res)
  2102  	if err := googleapi.CheckResponse(res); err != nil {
  2103  		return nil, err
  2104  	}
  2105  	ret := &SurveysStartResponse{
  2106  		ServerResponse: googleapi.ServerResponse{
  2107  			Header:         res.Header,
  2108  			HTTPStatusCode: res.StatusCode,
  2109  		},
  2110  	}
  2111  	target := &ret
  2112  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2113  		return nil, err
  2114  	}
  2115  	return ret, nil
  2116  	// {
  2117  	//   "description": "Begins running a survey.",
  2118  	//   "httpMethod": "POST",
  2119  	//   "id": "consumersurveys.surveys.start",
  2120  	//   "parameterOrder": [
  2121  	//     "resourceId"
  2122  	//   ],
  2123  	//   "parameters": {
  2124  	//     "resourceId": {
  2125  	//       "location": "path",
  2126  	//       "required": true,
  2127  	//       "type": "string"
  2128  	//     }
  2129  	//   },
  2130  	//   "path": "surveys/{resourceId}/start",
  2131  	//   "request": {
  2132  	//     "$ref": "SurveysStartRequest"
  2133  	//   },
  2134  	//   "response": {
  2135  	//     "$ref": "SurveysStartResponse"
  2136  	//   },
  2137  	//   "scopes": [
  2138  	//     "https://www.googleapis.com/auth/consumersurveys",
  2139  	//     "https://www.googleapis.com/auth/userinfo.email"
  2140  	//   ]
  2141  	// }
  2142  
  2143  }
  2144  
  2145  // method id "consumersurveys.surveys.stop":
  2146  
  2147  type SurveysStopCall struct {
  2148  	s          *Service
  2149  	resourceId string
  2150  	urlParams_ gensupport.URLParams
  2151  	ctx_       context.Context
  2152  	header_    http.Header
  2153  }
  2154  
  2155  // Stop: Stops a running survey.
  2156  func (r *SurveysService) Stop(resourceId string) *SurveysStopCall {
  2157  	c := &SurveysStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2158  	c.resourceId = resourceId
  2159  	return c
  2160  }
  2161  
  2162  // Fields allows partial responses to be retrieved. See
  2163  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2164  // for more information.
  2165  func (c *SurveysStopCall) Fields(s ...googleapi.Field) *SurveysStopCall {
  2166  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2167  	return c
  2168  }
  2169  
  2170  // Context sets the context to be used in this call's Do method. Any
  2171  // pending HTTP request will be aborted if the provided context is
  2172  // canceled.
  2173  func (c *SurveysStopCall) Context(ctx context.Context) *SurveysStopCall {
  2174  	c.ctx_ = ctx
  2175  	return c
  2176  }
  2177  
  2178  // Header returns an http.Header that can be modified by the caller to
  2179  // add HTTP headers to the request.
  2180  func (c *SurveysStopCall) Header() http.Header {
  2181  	if c.header_ == nil {
  2182  		c.header_ = make(http.Header)
  2183  	}
  2184  	return c.header_
  2185  }
  2186  
  2187  func (c *SurveysStopCall) doRequest(alt string) (*http.Response, error) {
  2188  	reqHeaders := make(http.Header)
  2189  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  2190  	for k, v := range c.header_ {
  2191  		reqHeaders[k] = v
  2192  	}
  2193  	reqHeaders.Set("User-Agent", c.s.userAgent())
  2194  	var body io.Reader = nil
  2195  	c.urlParams_.Set("alt", alt)
  2196  	c.urlParams_.Set("prettyPrint", "false")
  2197  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys/{resourceId}/stop")
  2198  	urls += "?" + c.urlParams_.Encode()
  2199  	req, err := http.NewRequest("POST", urls, body)
  2200  	if err != nil {
  2201  		return nil, err
  2202  	}
  2203  	req.Header = reqHeaders
  2204  	googleapi.Expand(req.URL, map[string]string{
  2205  		"resourceId": c.resourceId,
  2206  	})
  2207  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2208  }
  2209  
  2210  // Do executes the "consumersurveys.surveys.stop" call.
  2211  // Exactly one of *SurveysStopResponse or error will be non-nil. Any
  2212  // non-2xx status code is an error. Response headers are in either
  2213  // *SurveysStopResponse.ServerResponse.Header or (if a response was
  2214  // returned at all) in error.(*googleapi.Error).Header. Use
  2215  // googleapi.IsNotModified to check whether the returned error was
  2216  // because http.StatusNotModified was returned.
  2217  func (c *SurveysStopCall) Do(opts ...googleapi.CallOption) (*SurveysStopResponse, error) {
  2218  	gensupport.SetOptions(c.urlParams_, opts...)
  2219  	res, err := c.doRequest("json")
  2220  	if res != nil && res.StatusCode == http.StatusNotModified {
  2221  		if res.Body != nil {
  2222  			res.Body.Close()
  2223  		}
  2224  		return nil, &googleapi.Error{
  2225  			Code:   res.StatusCode,
  2226  			Header: res.Header,
  2227  		}
  2228  	}
  2229  	if err != nil {
  2230  		return nil, err
  2231  	}
  2232  	defer googleapi.CloseBody(res)
  2233  	if err := googleapi.CheckResponse(res); err != nil {
  2234  		return nil, err
  2235  	}
  2236  	ret := &SurveysStopResponse{
  2237  		ServerResponse: googleapi.ServerResponse{
  2238  			Header:         res.Header,
  2239  			HTTPStatusCode: res.StatusCode,
  2240  		},
  2241  	}
  2242  	target := &ret
  2243  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2244  		return nil, err
  2245  	}
  2246  	return ret, nil
  2247  	// {
  2248  	//   "description": "Stops a running survey.",
  2249  	//   "httpMethod": "POST",
  2250  	//   "id": "consumersurveys.surveys.stop",
  2251  	//   "parameterOrder": [
  2252  	//     "resourceId"
  2253  	//   ],
  2254  	//   "parameters": {
  2255  	//     "resourceId": {
  2256  	//       "location": "path",
  2257  	//       "required": true,
  2258  	//       "type": "string"
  2259  	//     }
  2260  	//   },
  2261  	//   "path": "surveys/{resourceId}/stop",
  2262  	//   "response": {
  2263  	//     "$ref": "SurveysStopResponse"
  2264  	//   },
  2265  	//   "scopes": [
  2266  	//     "https://www.googleapis.com/auth/consumersurveys",
  2267  	//     "https://www.googleapis.com/auth/userinfo.email"
  2268  	//   ]
  2269  	// }
  2270  
  2271  }
  2272  
  2273  // method id "consumersurveys.surveys.update":
  2274  
  2275  type SurveysUpdateCall struct {
  2276  	s           *Service
  2277  	surveyUrlId string
  2278  	survey      *Survey
  2279  	urlParams_  gensupport.URLParams
  2280  	ctx_        context.Context
  2281  	header_     http.Header
  2282  }
  2283  
  2284  // Update: Updates a survey. Currently the only property that can be
  2285  // updated is the owners property.
  2286  func (r *SurveysService) Update(surveyUrlId string, survey *Survey) *SurveysUpdateCall {
  2287  	c := &SurveysUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2288  	c.surveyUrlId = surveyUrlId
  2289  	c.survey = survey
  2290  	return c
  2291  }
  2292  
  2293  // Fields allows partial responses to be retrieved. See
  2294  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2295  // for more information.
  2296  func (c *SurveysUpdateCall) Fields(s ...googleapi.Field) *SurveysUpdateCall {
  2297  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2298  	return c
  2299  }
  2300  
  2301  // Context sets the context to be used in this call's Do method. Any
  2302  // pending HTTP request will be aborted if the provided context is
  2303  // canceled.
  2304  func (c *SurveysUpdateCall) Context(ctx context.Context) *SurveysUpdateCall {
  2305  	c.ctx_ = ctx
  2306  	return c
  2307  }
  2308  
  2309  // Header returns an http.Header that can be modified by the caller to
  2310  // add HTTP headers to the request.
  2311  func (c *SurveysUpdateCall) Header() http.Header {
  2312  	if c.header_ == nil {
  2313  		c.header_ = make(http.Header)
  2314  	}
  2315  	return c.header_
  2316  }
  2317  
  2318  func (c *SurveysUpdateCall) doRequest(alt string) (*http.Response, error) {
  2319  	reqHeaders := make(http.Header)
  2320  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  2321  	for k, v := range c.header_ {
  2322  		reqHeaders[k] = v
  2323  	}
  2324  	reqHeaders.Set("User-Agent", c.s.userAgent())
  2325  	var body io.Reader = nil
  2326  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.survey)
  2327  	if err != nil {
  2328  		return nil, err
  2329  	}
  2330  	reqHeaders.Set("Content-Type", "application/json")
  2331  	c.urlParams_.Set("alt", alt)
  2332  	c.urlParams_.Set("prettyPrint", "false")
  2333  	urls := googleapi.ResolveRelative(c.s.BasePath, "surveys/{surveyUrlId}")
  2334  	urls += "?" + c.urlParams_.Encode()
  2335  	req, err := http.NewRequest("PUT", urls, body)
  2336  	if err != nil {
  2337  		return nil, err
  2338  	}
  2339  	req.Header = reqHeaders
  2340  	googleapi.Expand(req.URL, map[string]string{
  2341  		"surveyUrlId": c.surveyUrlId,
  2342  	})
  2343  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2344  }
  2345  
  2346  // Do executes the "consumersurveys.surveys.update" call.
  2347  // Exactly one of *Survey or error will be non-nil. Any non-2xx status
  2348  // code is an error. Response headers are in either
  2349  // *Survey.ServerResponse.Header or (if a response was returned at all)
  2350  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2351  // check whether the returned error was because http.StatusNotModified
  2352  // was returned.
  2353  func (c *SurveysUpdateCall) Do(opts ...googleapi.CallOption) (*Survey, error) {
  2354  	gensupport.SetOptions(c.urlParams_, opts...)
  2355  	res, err := c.doRequest("json")
  2356  	if res != nil && res.StatusCode == http.StatusNotModified {
  2357  		if res.Body != nil {
  2358  			res.Body.Close()
  2359  		}
  2360  		return nil, &googleapi.Error{
  2361  			Code:   res.StatusCode,
  2362  			Header: res.Header,
  2363  		}
  2364  	}
  2365  	if err != nil {
  2366  		return nil, err
  2367  	}
  2368  	defer googleapi.CloseBody(res)
  2369  	if err := googleapi.CheckResponse(res); err != nil {
  2370  		return nil, err
  2371  	}
  2372  	ret := &Survey{
  2373  		ServerResponse: googleapi.ServerResponse{
  2374  			Header:         res.Header,
  2375  			HTTPStatusCode: res.StatusCode,
  2376  		},
  2377  	}
  2378  	target := &ret
  2379  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2380  		return nil, err
  2381  	}
  2382  	return ret, nil
  2383  	// {
  2384  	//   "description": "Updates a survey. Currently the only property that can be updated is the owners property.",
  2385  	//   "httpMethod": "PUT",
  2386  	//   "id": "consumersurveys.surveys.update",
  2387  	//   "parameterOrder": [
  2388  	//     "surveyUrlId"
  2389  	//   ],
  2390  	//   "parameters": {
  2391  	//     "surveyUrlId": {
  2392  	//       "description": "External URL ID for the survey.",
  2393  	//       "location": "path",
  2394  	//       "required": true,
  2395  	//       "type": "string"
  2396  	//     }
  2397  	//   },
  2398  	//   "path": "surveys/{surveyUrlId}",
  2399  	//   "request": {
  2400  	//     "$ref": "Survey"
  2401  	//   },
  2402  	//   "response": {
  2403  	//     "$ref": "Survey"
  2404  	//   },
  2405  	//   "scopes": [
  2406  	//     "https://www.googleapis.com/auth/consumersurveys",
  2407  	//     "https://www.googleapis.com/auth/userinfo.email"
  2408  	//   ]
  2409  	// }
  2410  
  2411  }
  2412  

View as plain text