You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1991 line
68 KiB

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