Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

1898 lignes
65 KiB

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