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.
 
 
 

2296 lines
75 KiB

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