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.
 
 
 

2301 lines
75 KiB

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