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.
 
 
 

7756 lines
258 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 adsense provides access to the AdSense Management API.
  6. //
  7. // See https://developers.google.com/adsense/management/
  8. //
  9. // Usage example:
  10. //
  11. // import "google.golang.org/api/adsense/v1.3"
  12. // ...
  13. // adsenseService, err := adsense.New(oauthHttpClient)
  14. package adsense // import "google.golang.org/api/adsense/v1.3"
  15. import (
  16. "bytes"
  17. "context"
  18. "encoding/json"
  19. "errors"
  20. "fmt"
  21. "io"
  22. "net/http"
  23. "net/url"
  24. "strconv"
  25. "strings"
  26. gensupport "google.golang.org/api/gensupport"
  27. googleapi "google.golang.org/api/googleapi"
  28. )
  29. // Always reference these packages, just in case the auto-generated code
  30. // below doesn't.
  31. var _ = bytes.NewBuffer
  32. var _ = strconv.Itoa
  33. var _ = fmt.Sprintf
  34. var _ = json.NewDecoder
  35. var _ = io.Copy
  36. var _ = url.Parse
  37. var _ = gensupport.MarshalJSON
  38. var _ = googleapi.Version
  39. var _ = errors.New
  40. var _ = strings.Replace
  41. var _ = context.Canceled
  42. const apiId = "adsense:v1.3"
  43. const apiName = "adsense"
  44. const apiVersion = "v1.3"
  45. const basePath = "https://www.googleapis.com/adsense/v1.3/"
  46. // OAuth2 scopes used by this API.
  47. const (
  48. // View and manage your AdSense data
  49. AdsenseScope = "https://www.googleapis.com/auth/adsense"
  50. // View your AdSense data
  51. AdsenseReadonlyScope = "https://www.googleapis.com/auth/adsense.readonly"
  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.Accounts = NewAccountsService(s)
  59. s.Adclients = NewAdclientsService(s)
  60. s.Adunits = NewAdunitsService(s)
  61. s.Alerts = NewAlertsService(s)
  62. s.Customchannels = NewCustomchannelsService(s)
  63. s.Metadata = NewMetadataService(s)
  64. s.Reports = NewReportsService(s)
  65. s.Savedadstyles = NewSavedadstylesService(s)
  66. s.Urlchannels = NewUrlchannelsService(s)
  67. return s, nil
  68. }
  69. type Service struct {
  70. client *http.Client
  71. BasePath string // API endpoint base URL
  72. UserAgent string // optional additional User-Agent fragment
  73. Accounts *AccountsService
  74. Adclients *AdclientsService
  75. Adunits *AdunitsService
  76. Alerts *AlertsService
  77. Customchannels *CustomchannelsService
  78. Metadata *MetadataService
  79. Reports *ReportsService
  80. Savedadstyles *SavedadstylesService
  81. Urlchannels *UrlchannelsService
  82. }
  83. func (s *Service) userAgent() string {
  84. if s.UserAgent == "" {
  85. return googleapi.UserAgent
  86. }
  87. return googleapi.UserAgent + " " + s.UserAgent
  88. }
  89. func NewAccountsService(s *Service) *AccountsService {
  90. rs := &AccountsService{s: s}
  91. rs.Adclients = NewAccountsAdclientsService(s)
  92. rs.Adunits = NewAccountsAdunitsService(s)
  93. rs.Alerts = NewAccountsAlertsService(s)
  94. rs.Customchannels = NewAccountsCustomchannelsService(s)
  95. rs.Reports = NewAccountsReportsService(s)
  96. rs.Savedadstyles = NewAccountsSavedadstylesService(s)
  97. rs.Urlchannels = NewAccountsUrlchannelsService(s)
  98. return rs
  99. }
  100. type AccountsService struct {
  101. s *Service
  102. Adclients *AccountsAdclientsService
  103. Adunits *AccountsAdunitsService
  104. Alerts *AccountsAlertsService
  105. Customchannels *AccountsCustomchannelsService
  106. Reports *AccountsReportsService
  107. Savedadstyles *AccountsSavedadstylesService
  108. Urlchannels *AccountsUrlchannelsService
  109. }
  110. func NewAccountsAdclientsService(s *Service) *AccountsAdclientsService {
  111. rs := &AccountsAdclientsService{s: s}
  112. return rs
  113. }
  114. type AccountsAdclientsService struct {
  115. s *Service
  116. }
  117. func NewAccountsAdunitsService(s *Service) *AccountsAdunitsService {
  118. rs := &AccountsAdunitsService{s: s}
  119. rs.Customchannels = NewAccountsAdunitsCustomchannelsService(s)
  120. return rs
  121. }
  122. type AccountsAdunitsService struct {
  123. s *Service
  124. Customchannels *AccountsAdunitsCustomchannelsService
  125. }
  126. func NewAccountsAdunitsCustomchannelsService(s *Service) *AccountsAdunitsCustomchannelsService {
  127. rs := &AccountsAdunitsCustomchannelsService{s: s}
  128. return rs
  129. }
  130. type AccountsAdunitsCustomchannelsService struct {
  131. s *Service
  132. }
  133. func NewAccountsAlertsService(s *Service) *AccountsAlertsService {
  134. rs := &AccountsAlertsService{s: s}
  135. return rs
  136. }
  137. type AccountsAlertsService struct {
  138. s *Service
  139. }
  140. func NewAccountsCustomchannelsService(s *Service) *AccountsCustomchannelsService {
  141. rs := &AccountsCustomchannelsService{s: s}
  142. rs.Adunits = NewAccountsCustomchannelsAdunitsService(s)
  143. return rs
  144. }
  145. type AccountsCustomchannelsService struct {
  146. s *Service
  147. Adunits *AccountsCustomchannelsAdunitsService
  148. }
  149. func NewAccountsCustomchannelsAdunitsService(s *Service) *AccountsCustomchannelsAdunitsService {
  150. rs := &AccountsCustomchannelsAdunitsService{s: s}
  151. return rs
  152. }
  153. type AccountsCustomchannelsAdunitsService struct {
  154. s *Service
  155. }
  156. func NewAccountsReportsService(s *Service) *AccountsReportsService {
  157. rs := &AccountsReportsService{s: s}
  158. rs.Saved = NewAccountsReportsSavedService(s)
  159. return rs
  160. }
  161. type AccountsReportsService struct {
  162. s *Service
  163. Saved *AccountsReportsSavedService
  164. }
  165. func NewAccountsReportsSavedService(s *Service) *AccountsReportsSavedService {
  166. rs := &AccountsReportsSavedService{s: s}
  167. return rs
  168. }
  169. type AccountsReportsSavedService struct {
  170. s *Service
  171. }
  172. func NewAccountsSavedadstylesService(s *Service) *AccountsSavedadstylesService {
  173. rs := &AccountsSavedadstylesService{s: s}
  174. return rs
  175. }
  176. type AccountsSavedadstylesService struct {
  177. s *Service
  178. }
  179. func NewAccountsUrlchannelsService(s *Service) *AccountsUrlchannelsService {
  180. rs := &AccountsUrlchannelsService{s: s}
  181. return rs
  182. }
  183. type AccountsUrlchannelsService struct {
  184. s *Service
  185. }
  186. func NewAdclientsService(s *Service) *AdclientsService {
  187. rs := &AdclientsService{s: s}
  188. return rs
  189. }
  190. type AdclientsService struct {
  191. s *Service
  192. }
  193. func NewAdunitsService(s *Service) *AdunitsService {
  194. rs := &AdunitsService{s: s}
  195. rs.Customchannels = NewAdunitsCustomchannelsService(s)
  196. return rs
  197. }
  198. type AdunitsService struct {
  199. s *Service
  200. Customchannels *AdunitsCustomchannelsService
  201. }
  202. func NewAdunitsCustomchannelsService(s *Service) *AdunitsCustomchannelsService {
  203. rs := &AdunitsCustomchannelsService{s: s}
  204. return rs
  205. }
  206. type AdunitsCustomchannelsService struct {
  207. s *Service
  208. }
  209. func NewAlertsService(s *Service) *AlertsService {
  210. rs := &AlertsService{s: s}
  211. return rs
  212. }
  213. type AlertsService struct {
  214. s *Service
  215. }
  216. func NewCustomchannelsService(s *Service) *CustomchannelsService {
  217. rs := &CustomchannelsService{s: s}
  218. rs.Adunits = NewCustomchannelsAdunitsService(s)
  219. return rs
  220. }
  221. type CustomchannelsService struct {
  222. s *Service
  223. Adunits *CustomchannelsAdunitsService
  224. }
  225. func NewCustomchannelsAdunitsService(s *Service) *CustomchannelsAdunitsService {
  226. rs := &CustomchannelsAdunitsService{s: s}
  227. return rs
  228. }
  229. type CustomchannelsAdunitsService struct {
  230. s *Service
  231. }
  232. func NewMetadataService(s *Service) *MetadataService {
  233. rs := &MetadataService{s: s}
  234. rs.Dimensions = NewMetadataDimensionsService(s)
  235. rs.Metrics = NewMetadataMetricsService(s)
  236. return rs
  237. }
  238. type MetadataService struct {
  239. s *Service
  240. Dimensions *MetadataDimensionsService
  241. Metrics *MetadataMetricsService
  242. }
  243. func NewMetadataDimensionsService(s *Service) *MetadataDimensionsService {
  244. rs := &MetadataDimensionsService{s: s}
  245. return rs
  246. }
  247. type MetadataDimensionsService struct {
  248. s *Service
  249. }
  250. func NewMetadataMetricsService(s *Service) *MetadataMetricsService {
  251. rs := &MetadataMetricsService{s: s}
  252. return rs
  253. }
  254. type MetadataMetricsService struct {
  255. s *Service
  256. }
  257. func NewReportsService(s *Service) *ReportsService {
  258. rs := &ReportsService{s: s}
  259. rs.Saved = NewReportsSavedService(s)
  260. return rs
  261. }
  262. type ReportsService struct {
  263. s *Service
  264. Saved *ReportsSavedService
  265. }
  266. func NewReportsSavedService(s *Service) *ReportsSavedService {
  267. rs := &ReportsSavedService{s: s}
  268. return rs
  269. }
  270. type ReportsSavedService struct {
  271. s *Service
  272. }
  273. func NewSavedadstylesService(s *Service) *SavedadstylesService {
  274. rs := &SavedadstylesService{s: s}
  275. return rs
  276. }
  277. type SavedadstylesService struct {
  278. s *Service
  279. }
  280. func NewUrlchannelsService(s *Service) *UrlchannelsService {
  281. rs := &UrlchannelsService{s: s}
  282. return rs
  283. }
  284. type UrlchannelsService struct {
  285. s *Service
  286. }
  287. type Account struct {
  288. // Id: Unique identifier of this account.
  289. Id string `json:"id,omitempty"`
  290. // Kind: Kind of resource this is, in this case adsense#account.
  291. Kind string `json:"kind,omitempty"`
  292. // Name: Name of this account.
  293. Name string `json:"name,omitempty"`
  294. // Premium: Whether this account is premium.
  295. Premium bool `json:"premium,omitempty"`
  296. // SubAccounts: Sub accounts of the this account.
  297. SubAccounts []*Account `json:"subAccounts,omitempty"`
  298. // ServerResponse contains the HTTP response code and headers from the
  299. // server.
  300. googleapi.ServerResponse `json:"-"`
  301. // ForceSendFields is a list of field names (e.g. "Id") to
  302. // unconditionally include in API requests. By default, fields with
  303. // empty values are omitted from API requests. However, any non-pointer,
  304. // non-interface field appearing in ForceSendFields will be sent to the
  305. // server regardless of whether the field is empty or not. This may be
  306. // used to include empty fields in Patch requests.
  307. ForceSendFields []string `json:"-"`
  308. // NullFields is a list of field names (e.g. "Id") to include in API
  309. // requests with the JSON null value. By default, fields with empty
  310. // values are omitted from API requests. However, any field with an
  311. // empty value appearing in NullFields will be sent to the server as
  312. // null. It is an error if a field in this list has a non-empty value.
  313. // This may be used to include null fields in Patch requests.
  314. NullFields []string `json:"-"`
  315. }
  316. func (s *Account) MarshalJSON() ([]byte, error) {
  317. type NoMethod Account
  318. raw := NoMethod(*s)
  319. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  320. }
  321. type Accounts struct {
  322. // Etag: ETag of this response for caching purposes.
  323. Etag string `json:"etag,omitempty"`
  324. // Items: The accounts returned in this list response.
  325. Items []*Account `json:"items,omitempty"`
  326. // Kind: Kind of list this is, in this case adsense#accounts.
  327. Kind string `json:"kind,omitempty"`
  328. // NextPageToken: Continuation token used to page through accounts. To
  329. // retrieve the next page of results, set the next request's "pageToken"
  330. // value to this.
  331. NextPageToken string `json:"nextPageToken,omitempty"`
  332. // ServerResponse contains the HTTP response code and headers from the
  333. // server.
  334. googleapi.ServerResponse `json:"-"`
  335. // ForceSendFields is a list of field names (e.g. "Etag") to
  336. // unconditionally include in API requests. By default, fields with
  337. // empty values are omitted from API requests. However, any non-pointer,
  338. // non-interface field appearing in ForceSendFields will be sent to the
  339. // server regardless of whether the field is empty or not. This may be
  340. // used to include empty fields in Patch requests.
  341. ForceSendFields []string `json:"-"`
  342. // NullFields is a list of field names (e.g. "Etag") to include in API
  343. // requests with the JSON null value. By default, fields with empty
  344. // values are omitted from API requests. However, any field with an
  345. // empty value appearing in NullFields will be sent to the server as
  346. // null. It is an error if a field in this list has a non-empty value.
  347. // This may be used to include null fields in Patch requests.
  348. NullFields []string `json:"-"`
  349. }
  350. func (s *Accounts) MarshalJSON() ([]byte, error) {
  351. type NoMethod Accounts
  352. raw := NoMethod(*s)
  353. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  354. }
  355. type AdClient struct {
  356. // ArcOptIn: Whether this ad client is opted in to ARC.
  357. ArcOptIn bool `json:"arcOptIn,omitempty"`
  358. // Id: Unique identifier of this ad client.
  359. Id string `json:"id,omitempty"`
  360. // Kind: Kind of resource this is, in this case adsense#adClient.
  361. Kind string `json:"kind,omitempty"`
  362. // ProductCode: This ad client's product code, which corresponds to the
  363. // PRODUCT_CODE report dimension.
  364. ProductCode string `json:"productCode,omitempty"`
  365. // SupportsReporting: Whether this ad client supports being reported on.
  366. SupportsReporting bool `json:"supportsReporting,omitempty"`
  367. // ForceSendFields is a list of field names (e.g. "ArcOptIn") to
  368. // unconditionally include in API requests. By default, fields with
  369. // empty values are omitted from API requests. However, any non-pointer,
  370. // non-interface field appearing in ForceSendFields will be sent to the
  371. // server regardless of whether the field is empty or not. This may be
  372. // used to include empty fields in Patch requests.
  373. ForceSendFields []string `json:"-"`
  374. // NullFields is a list of field names (e.g. "ArcOptIn") to include in
  375. // API requests with the JSON null value. By default, fields with empty
  376. // values are omitted from API requests. However, any field with an
  377. // empty value appearing in NullFields will be sent to the server as
  378. // null. It is an error if a field in this list has a non-empty value.
  379. // This may be used to include null fields in Patch requests.
  380. NullFields []string `json:"-"`
  381. }
  382. func (s *AdClient) MarshalJSON() ([]byte, error) {
  383. type NoMethod AdClient
  384. raw := NoMethod(*s)
  385. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  386. }
  387. type AdClients struct {
  388. // Etag: ETag of this response for caching purposes.
  389. Etag string `json:"etag,omitempty"`
  390. // Items: The ad clients returned in this list response.
  391. Items []*AdClient `json:"items,omitempty"`
  392. // Kind: Kind of list this is, in this case adsense#adClients.
  393. Kind string `json:"kind,omitempty"`
  394. // NextPageToken: Continuation token used to page through ad clients. To
  395. // retrieve the next page of results, set the next request's "pageToken"
  396. // value to this.
  397. NextPageToken string `json:"nextPageToken,omitempty"`
  398. // ServerResponse contains the HTTP response code and headers from the
  399. // server.
  400. googleapi.ServerResponse `json:"-"`
  401. // ForceSendFields is a list of field names (e.g. "Etag") to
  402. // unconditionally include in API requests. By default, fields with
  403. // empty values are omitted from API requests. However, any non-pointer,
  404. // non-interface field appearing in ForceSendFields will be sent to the
  405. // server regardless of whether the field is empty or not. This may be
  406. // used to include empty fields in Patch requests.
  407. ForceSendFields []string `json:"-"`
  408. // NullFields is a list of field names (e.g. "Etag") to include in API
  409. // requests with the JSON null value. By default, fields with empty
  410. // values are omitted from API requests. However, any field with an
  411. // empty value appearing in NullFields will be sent to the server as
  412. // null. It is an error if a field in this list has a non-empty value.
  413. // This may be used to include null fields in Patch requests.
  414. NullFields []string `json:"-"`
  415. }
  416. func (s *AdClients) MarshalJSON() ([]byte, error) {
  417. type NoMethod AdClients
  418. raw := NoMethod(*s)
  419. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  420. }
  421. type AdCode struct {
  422. // AdCode: The ad code snippet.
  423. AdCode string `json:"adCode,omitempty"`
  424. // Kind: Kind this is, in this case adsense#adCode.
  425. Kind string `json:"kind,omitempty"`
  426. // ServerResponse contains the HTTP response code and headers from the
  427. // server.
  428. googleapi.ServerResponse `json:"-"`
  429. // ForceSendFields is a list of field names (e.g. "AdCode") to
  430. // unconditionally include in API requests. By default, fields with
  431. // empty values are omitted from API requests. However, any non-pointer,
  432. // non-interface field appearing in ForceSendFields will be sent to the
  433. // server regardless of whether the field is empty or not. This may be
  434. // used to include empty fields in Patch requests.
  435. ForceSendFields []string `json:"-"`
  436. // NullFields is a list of field names (e.g. "AdCode") to include in API
  437. // requests with the JSON null value. By default, fields with empty
  438. // values are omitted from API requests. However, any field with an
  439. // empty value appearing in NullFields will be sent to the server as
  440. // null. It is an error if a field in this list has a non-empty value.
  441. // This may be used to include null fields in Patch requests.
  442. NullFields []string `json:"-"`
  443. }
  444. func (s *AdCode) MarshalJSON() ([]byte, error) {
  445. type NoMethod AdCode
  446. raw := NoMethod(*s)
  447. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  448. }
  449. type AdStyle struct {
  450. // Colors: The colors which are included in the style. These are
  451. // represented as six hexadecimal characters, similar to HTML color
  452. // codes, but without the leading hash.
  453. Colors *AdStyleColors `json:"colors,omitempty"`
  454. // Corners: The style of the corners in the ad (deprecated: never
  455. // populated, ignored).
  456. Corners string `json:"corners,omitempty"`
  457. // Font: The font which is included in the style.
  458. Font *AdStyleFont `json:"font,omitempty"`
  459. // Kind: Kind this is, in this case adsense#adStyle.
  460. Kind string `json:"kind,omitempty"`
  461. // ForceSendFields is a list of field names (e.g. "Colors") 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. "Colors") to include in API
  469. // 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 *AdStyle) MarshalJSON() ([]byte, error) {
  477. type NoMethod AdStyle
  478. raw := NoMethod(*s)
  479. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  480. }
  481. // AdStyleColors: The colors which are included in the style. These are
  482. // represented as six hexadecimal characters, similar to HTML color
  483. // codes, but without the leading hash.
  484. type AdStyleColors struct {
  485. // Background: The color of the ad background.
  486. Background string `json:"background,omitempty"`
  487. // Border: The color of the ad border.
  488. Border string `json:"border,omitempty"`
  489. // Text: The color of the ad text.
  490. Text string `json:"text,omitempty"`
  491. // Title: The color of the ad title.
  492. Title string `json:"title,omitempty"`
  493. // Url: The color of the ad url.
  494. Url string `json:"url,omitempty"`
  495. // ForceSendFields is a list of field names (e.g. "Background") to
  496. // unconditionally include in API requests. By default, fields with
  497. // empty values are omitted from API requests. However, any non-pointer,
  498. // non-interface field appearing in ForceSendFields will be sent to the
  499. // server regardless of whether the field is empty or not. This may be
  500. // used to include empty fields in Patch requests.
  501. ForceSendFields []string `json:"-"`
  502. // NullFields is a list of field names (e.g. "Background") to include in
  503. // API requests with the JSON null value. By default, fields with empty
  504. // values are omitted from API requests. However, any field with an
  505. // empty value appearing in NullFields will be sent to the server as
  506. // null. It is an error if a field in this list has a non-empty value.
  507. // This may be used to include null fields in Patch requests.
  508. NullFields []string `json:"-"`
  509. }
  510. func (s *AdStyleColors) MarshalJSON() ([]byte, error) {
  511. type NoMethod AdStyleColors
  512. raw := NoMethod(*s)
  513. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  514. }
  515. // AdStyleFont: The font which is included in the style.
  516. type AdStyleFont struct {
  517. // Family: The family of the font.
  518. Family string `json:"family,omitempty"`
  519. // Size: The size of the font.
  520. Size string `json:"size,omitempty"`
  521. // ForceSendFields is a list of field names (e.g. "Family") to
  522. // unconditionally include in API requests. By default, fields with
  523. // empty values are omitted from API requests. However, any non-pointer,
  524. // non-interface field appearing in ForceSendFields will be sent to the
  525. // server regardless of whether the field is empty or not. This may be
  526. // used to include empty fields in Patch requests.
  527. ForceSendFields []string `json:"-"`
  528. // NullFields is a list of field names (e.g. "Family") to include in API
  529. // requests with the JSON null value. By default, fields with empty
  530. // values are omitted from API requests. However, any field with an
  531. // empty value appearing in NullFields will be sent to the server as
  532. // null. It is an error if a field in this list has a non-empty value.
  533. // This may be used to include null fields in Patch requests.
  534. NullFields []string `json:"-"`
  535. }
  536. func (s *AdStyleFont) MarshalJSON() ([]byte, error) {
  537. type NoMethod AdStyleFont
  538. raw := NoMethod(*s)
  539. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  540. }
  541. type AdUnit struct {
  542. // Code: Identity code of this ad unit, not necessarily unique across ad
  543. // clients.
  544. Code string `json:"code,omitempty"`
  545. // ContentAdsSettings: Settings specific to content ads (AFC) and
  546. // highend mobile content ads (AFMC - deprecated).
  547. ContentAdsSettings *AdUnitContentAdsSettings `json:"contentAdsSettings,omitempty"`
  548. // CustomStyle: Custom style information specific to this ad unit.
  549. CustomStyle *AdStyle `json:"customStyle,omitempty"`
  550. // FeedAdsSettings: Settings specific to feed ads (AFF) - deprecated.
  551. FeedAdsSettings *AdUnitFeedAdsSettings `json:"feedAdsSettings,omitempty"`
  552. // Id: Unique identifier of this ad unit. This should be considered an
  553. // opaque identifier; it is not safe to rely on it being in any
  554. // particular format.
  555. Id string `json:"id,omitempty"`
  556. // Kind: Kind of resource this is, in this case adsense#adUnit.
  557. Kind string `json:"kind,omitempty"`
  558. // MobileContentAdsSettings: Settings specific to WAP mobile content ads
  559. // (AFMC) - deprecated.
  560. MobileContentAdsSettings *AdUnitMobileContentAdsSettings `json:"mobileContentAdsSettings,omitempty"`
  561. // Name: Name of this ad unit.
  562. Name string `json:"name,omitempty"`
  563. // SavedStyleId: ID of the saved ad style which holds this ad unit's
  564. // style information.
  565. SavedStyleId string `json:"savedStyleId,omitempty"`
  566. // Status: Status of this ad unit. Possible values are:
  567. // NEW: Indicates that the ad unit was created within the last seven
  568. // days and does not yet have any activity associated with it.
  569. //
  570. // ACTIVE: Indicates that there has been activity on this ad unit in the
  571. // last seven days.
  572. //
  573. // INACTIVE: Indicates that there has been no activity on this ad unit
  574. // in the last seven days.
  575. Status string `json:"status,omitempty"`
  576. // ServerResponse contains the HTTP response code and headers from the
  577. // server.
  578. googleapi.ServerResponse `json:"-"`
  579. // ForceSendFields is a list of field names (e.g. "Code") to
  580. // unconditionally include in API requests. By default, fields with
  581. // empty values are omitted from API requests. However, any non-pointer,
  582. // non-interface field appearing in ForceSendFields will be sent to the
  583. // server regardless of whether the field is empty or not. This may be
  584. // used to include empty fields in Patch requests.
  585. ForceSendFields []string `json:"-"`
  586. // NullFields is a list of field names (e.g. "Code") to include in API
  587. // requests with the JSON null value. By default, fields with empty
  588. // values are omitted from API requests. However, any field with an
  589. // empty value appearing in NullFields will be sent to the server as
  590. // null. It is an error if a field in this list has a non-empty value.
  591. // This may be used to include null fields in Patch requests.
  592. NullFields []string `json:"-"`
  593. }
  594. func (s *AdUnit) MarshalJSON() ([]byte, error) {
  595. type NoMethod AdUnit
  596. raw := NoMethod(*s)
  597. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  598. }
  599. // AdUnitContentAdsSettings: Settings specific to content ads (AFC) and
  600. // highend mobile content ads (AFMC - deprecated).
  601. type AdUnitContentAdsSettings struct {
  602. // BackupOption: The backup option to be used in instances where no ad
  603. // is available.
  604. BackupOption *AdUnitContentAdsSettingsBackupOption `json:"backupOption,omitempty"`
  605. // Size: Size of this ad unit.
  606. Size string `json:"size,omitempty"`
  607. // Type: Type of this ad unit.
  608. Type string `json:"type,omitempty"`
  609. // ForceSendFields is a list of field names (e.g. "BackupOption") to
  610. // unconditionally include in API requests. By default, fields with
  611. // empty values are omitted from API requests. However, any non-pointer,
  612. // non-interface field appearing in ForceSendFields will be sent to the
  613. // server regardless of whether the field is empty or not. This may be
  614. // used to include empty fields in Patch requests.
  615. ForceSendFields []string `json:"-"`
  616. // NullFields is a list of field names (e.g. "BackupOption") to include
  617. // in API requests with the JSON null value. By default, fields with
  618. // empty values are omitted from API requests. However, any field with
  619. // an empty value appearing in NullFields will be sent to the server as
  620. // null. It is an error if a field in this list has a non-empty value.
  621. // This may be used to include null fields in Patch requests.
  622. NullFields []string `json:"-"`
  623. }
  624. func (s *AdUnitContentAdsSettings) MarshalJSON() ([]byte, error) {
  625. type NoMethod AdUnitContentAdsSettings
  626. raw := NoMethod(*s)
  627. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  628. }
  629. // AdUnitContentAdsSettingsBackupOption: The backup option to be used in
  630. // instances where no ad is available.
  631. type AdUnitContentAdsSettingsBackupOption struct {
  632. // Color: Color to use when type is set to COLOR.
  633. Color string `json:"color,omitempty"`
  634. // Type: Type of the backup option. Possible values are BLANK, COLOR and
  635. // URL.
  636. Type string `json:"type,omitempty"`
  637. // Url: URL to use when type is set to URL.
  638. Url string `json:"url,omitempty"`
  639. // ForceSendFields is a list of field names (e.g. "Color") to
  640. // unconditionally include in API requests. By default, fields with
  641. // empty values are omitted from API requests. However, any non-pointer,
  642. // non-interface field appearing in ForceSendFields will be sent to the
  643. // server regardless of whether the field is empty or not. This may be
  644. // used to include empty fields in Patch requests.
  645. ForceSendFields []string `json:"-"`
  646. // NullFields is a list of field names (e.g. "Color") to include in API
  647. // requests with the JSON null value. By default, fields with empty
  648. // values are omitted from API requests. However, any field with an
  649. // empty value appearing in NullFields will be sent to the server as
  650. // null. It is an error if a field in this list has a non-empty value.
  651. // This may be used to include null fields in Patch requests.
  652. NullFields []string `json:"-"`
  653. }
  654. func (s *AdUnitContentAdsSettingsBackupOption) MarshalJSON() ([]byte, error) {
  655. type NoMethod AdUnitContentAdsSettingsBackupOption
  656. raw := NoMethod(*s)
  657. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  658. }
  659. // AdUnitFeedAdsSettings: Settings specific to feed ads (AFF) -
  660. // deprecated.
  661. type AdUnitFeedAdsSettings struct {
  662. // AdPosition: The position of the ads relative to the feed entries.
  663. AdPosition string `json:"adPosition,omitempty"`
  664. // Frequency: The frequency at which ads should appear in the feed (i.e.
  665. // every N entries).
  666. Frequency int64 `json:"frequency,omitempty"`
  667. // MinimumWordCount: The minimum length an entry should be in order to
  668. // have attached ads.
  669. MinimumWordCount int64 `json:"minimumWordCount,omitempty"`
  670. // Type: The type of ads which should appear.
  671. Type string `json:"type,omitempty"`
  672. // ForceSendFields is a list of field names (e.g. "AdPosition") to
  673. // unconditionally include in API requests. By default, fields with
  674. // empty values are omitted from API requests. However, any non-pointer,
  675. // non-interface field appearing in ForceSendFields will be sent to the
  676. // server regardless of whether the field is empty or not. This may be
  677. // used to include empty fields in Patch requests.
  678. ForceSendFields []string `json:"-"`
  679. // NullFields is a list of field names (e.g. "AdPosition") to include in
  680. // API requests with the JSON null value. By default, fields with empty
  681. // values are omitted from API requests. However, any field with an
  682. // empty value appearing in NullFields will be sent to the server as
  683. // null. It is an error if a field in this list has a non-empty value.
  684. // This may be used to include null fields in Patch requests.
  685. NullFields []string `json:"-"`
  686. }
  687. func (s *AdUnitFeedAdsSettings) MarshalJSON() ([]byte, error) {
  688. type NoMethod AdUnitFeedAdsSettings
  689. raw := NoMethod(*s)
  690. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  691. }
  692. // AdUnitMobileContentAdsSettings: Settings specific to WAP mobile
  693. // content ads (AFMC) - deprecated.
  694. type AdUnitMobileContentAdsSettings struct {
  695. // MarkupLanguage: The markup language to use for this ad unit.
  696. MarkupLanguage string `json:"markupLanguage,omitempty"`
  697. // ScriptingLanguage: The scripting language to use for this ad unit.
  698. ScriptingLanguage string `json:"scriptingLanguage,omitempty"`
  699. // Size: Size of this ad unit.
  700. Size string `json:"size,omitempty"`
  701. // Type: Type of this ad unit.
  702. Type string `json:"type,omitempty"`
  703. // ForceSendFields is a list of field names (e.g. "MarkupLanguage") to
  704. // unconditionally include in API requests. By default, fields with
  705. // empty values are omitted from API requests. However, any non-pointer,
  706. // non-interface field appearing in ForceSendFields will be sent to the
  707. // server regardless of whether the field is empty or not. This may be
  708. // used to include empty fields in Patch requests.
  709. ForceSendFields []string `json:"-"`
  710. // NullFields is a list of field names (e.g. "MarkupLanguage") to
  711. // include in API requests with the JSON null value. By default, fields
  712. // with empty values are omitted from API requests. However, any field
  713. // with an empty value appearing in NullFields will be sent to the
  714. // server as null. It is an error if a field in this list has a
  715. // non-empty value. This may be used to include null fields in Patch
  716. // requests.
  717. NullFields []string `json:"-"`
  718. }
  719. func (s *AdUnitMobileContentAdsSettings) MarshalJSON() ([]byte, error) {
  720. type NoMethod AdUnitMobileContentAdsSettings
  721. raw := NoMethod(*s)
  722. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  723. }
  724. type AdUnits struct {
  725. // Etag: ETag of this response for caching purposes.
  726. Etag string `json:"etag,omitempty"`
  727. // Items: The ad units returned in this list response.
  728. Items []*AdUnit `json:"items,omitempty"`
  729. // Kind: Kind of list this is, in this case adsense#adUnits.
  730. Kind string `json:"kind,omitempty"`
  731. // NextPageToken: Continuation token used to page through ad units. To
  732. // retrieve the next page of results, set the next request's "pageToken"
  733. // value to this.
  734. NextPageToken string `json:"nextPageToken,omitempty"`
  735. // ServerResponse contains the HTTP response code and headers from the
  736. // server.
  737. googleapi.ServerResponse `json:"-"`
  738. // ForceSendFields is a list of field names (e.g. "Etag") to
  739. // unconditionally include in API requests. By default, fields with
  740. // empty values are omitted from API requests. However, any non-pointer,
  741. // non-interface field appearing in ForceSendFields will be sent to the
  742. // server regardless of whether the field is empty or not. This may be
  743. // used to include empty fields in Patch requests.
  744. ForceSendFields []string `json:"-"`
  745. // NullFields is a list of field names (e.g. "Etag") to include in API
  746. // requests with the JSON null value. By default, fields with empty
  747. // values are omitted from API requests. However, any field with an
  748. // empty value appearing in NullFields will be sent to the server as
  749. // null. It is an error if a field in this list has a non-empty value.
  750. // This may be used to include null fields in Patch requests.
  751. NullFields []string `json:"-"`
  752. }
  753. func (s *AdUnits) MarshalJSON() ([]byte, error) {
  754. type NoMethod AdUnits
  755. raw := NoMethod(*s)
  756. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  757. }
  758. type AdsenseReportsGenerateResponse struct {
  759. // Averages: The averages of the report. This is the same length as any
  760. // other row in the report; cells corresponding to dimension columns are
  761. // empty.
  762. Averages []string `json:"averages,omitempty"`
  763. // Headers: The header information of the columns requested in the
  764. // report. This is a list of headers; one for each dimension in the
  765. // request, followed by one for each metric in the request.
  766. Headers []*AdsenseReportsGenerateResponseHeaders `json:"headers,omitempty"`
  767. // Kind: Kind this is, in this case adsense#report.
  768. Kind string `json:"kind,omitempty"`
  769. // Rows: The output rows of the report. Each row is a list of cells; one
  770. // for each dimension in the request, followed by one for each metric in
  771. // the request. The dimension cells contain strings, and the metric
  772. // cells contain numbers.
  773. Rows [][]string `json:"rows,omitempty"`
  774. // TotalMatchedRows: The total number of rows matched by the report
  775. // request. Fewer rows may be returned in the response due to being
  776. // limited by the row count requested or the report row limit.
  777. TotalMatchedRows int64 `json:"totalMatchedRows,omitempty,string"`
  778. // Totals: The totals of the report. This is the same length as any
  779. // other row in the report; cells corresponding to dimension columns are
  780. // empty.
  781. Totals []string `json:"totals,omitempty"`
  782. // Warnings: Any warnings associated with generation of the report.
  783. Warnings []string `json:"warnings,omitempty"`
  784. // ServerResponse contains the HTTP response code and headers from the
  785. // server.
  786. googleapi.ServerResponse `json:"-"`
  787. // ForceSendFields is a list of field names (e.g. "Averages") to
  788. // unconditionally include in API requests. By default, fields with
  789. // empty values are omitted from API requests. However, any non-pointer,
  790. // non-interface field appearing in ForceSendFields will be sent to the
  791. // server regardless of whether the field is empty or not. This may be
  792. // used to include empty fields in Patch requests.
  793. ForceSendFields []string `json:"-"`
  794. // NullFields is a list of field names (e.g. "Averages") to include in
  795. // API requests with the JSON null value. By default, fields with empty
  796. // values are omitted from API requests. However, any field with an
  797. // empty value appearing in NullFields will be sent to the server as
  798. // null. It is an error if a field in this list has a non-empty value.
  799. // This may be used to include null fields in Patch requests.
  800. NullFields []string `json:"-"`
  801. }
  802. func (s *AdsenseReportsGenerateResponse) MarshalJSON() ([]byte, error) {
  803. type NoMethod AdsenseReportsGenerateResponse
  804. raw := NoMethod(*s)
  805. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  806. }
  807. type AdsenseReportsGenerateResponseHeaders struct {
  808. // Currency: The currency of this column. Only present if the header
  809. // type is METRIC_CURRENCY.
  810. Currency string `json:"currency,omitempty"`
  811. // Name: The name of the header.
  812. Name string `json:"name,omitempty"`
  813. // Type: The type of the header; one of DIMENSION, METRIC_TALLY,
  814. // METRIC_RATIO, or METRIC_CURRENCY.
  815. Type string `json:"type,omitempty"`
  816. // ForceSendFields is a list of field names (e.g. "Currency") to
  817. // unconditionally include in API requests. By default, fields with
  818. // empty values are omitted from API requests. However, any non-pointer,
  819. // non-interface field appearing in ForceSendFields will be sent to the
  820. // server regardless of whether the field is empty or not. This may be
  821. // used to include empty fields in Patch requests.
  822. ForceSendFields []string `json:"-"`
  823. // NullFields is a list of field names (e.g. "Currency") to include in
  824. // API requests with the JSON null value. By default, fields with empty
  825. // values are omitted from API requests. However, any field with an
  826. // empty value appearing in NullFields will be sent to the server as
  827. // null. It is an error if a field in this list has a non-empty value.
  828. // This may be used to include null fields in Patch requests.
  829. NullFields []string `json:"-"`
  830. }
  831. func (s *AdsenseReportsGenerateResponseHeaders) MarshalJSON() ([]byte, error) {
  832. type NoMethod AdsenseReportsGenerateResponseHeaders
  833. raw := NoMethod(*s)
  834. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  835. }
  836. type Alert struct {
  837. // Id: Unique identifier of this alert. This should be considered an
  838. // opaque identifier; it is not safe to rely on it being in any
  839. // particular format.
  840. Id string `json:"id,omitempty"`
  841. // Kind: Kind of resource this is, in this case adsense#alert.
  842. Kind string `json:"kind,omitempty"`
  843. // Message: The localized alert message.
  844. Message string `json:"message,omitempty"`
  845. // Severity: Severity of this alert. Possible values: INFO, WARNING,
  846. // SEVERE.
  847. Severity string `json:"severity,omitempty"`
  848. // Type: Type of this alert. Possible values: SELF_HOLD,
  849. // MIGRATED_TO_BILLING3, ADDRESS_PIN_VERIFICATION,
  850. // PHONE_PIN_VERIFICATION, CORPORATE_ENTITY, GRAYLISTED_PUBLISHER,
  851. // API_HOLD.
  852. Type string `json:"type,omitempty"`
  853. // ForceSendFields is a list of field names (e.g. "Id") to
  854. // unconditionally include in API requests. By default, fields with
  855. // empty values are omitted from API requests. However, any non-pointer,
  856. // non-interface field appearing in ForceSendFields will be sent to the
  857. // server regardless of whether the field is empty or not. This may be
  858. // used to include empty fields in Patch requests.
  859. ForceSendFields []string `json:"-"`
  860. // NullFields is a list of field names (e.g. "Id") to include in API
  861. // requests with the JSON null value. By default, fields with empty
  862. // values are omitted from API requests. However, any field with an
  863. // empty value appearing in NullFields will be sent to the server as
  864. // null. It is an error if a field in this list has a non-empty value.
  865. // This may be used to include null fields in Patch requests.
  866. NullFields []string `json:"-"`
  867. }
  868. func (s *Alert) MarshalJSON() ([]byte, error) {
  869. type NoMethod Alert
  870. raw := NoMethod(*s)
  871. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  872. }
  873. type Alerts struct {
  874. // Items: The alerts returned in this list response.
  875. Items []*Alert `json:"items,omitempty"`
  876. // Kind: Kind of list this is, in this case adsense#alerts.
  877. Kind string `json:"kind,omitempty"`
  878. // ServerResponse contains the HTTP response code and headers from the
  879. // server.
  880. googleapi.ServerResponse `json:"-"`
  881. // ForceSendFields is a list of field names (e.g. "Items") to
  882. // unconditionally include in API requests. By default, fields with
  883. // empty values are omitted from API requests. However, any non-pointer,
  884. // non-interface field appearing in ForceSendFields will be sent to the
  885. // server regardless of whether the field is empty or not. This may be
  886. // used to include empty fields in Patch requests.
  887. ForceSendFields []string `json:"-"`
  888. // NullFields is a list of field names (e.g. "Items") to include in API
  889. // requests with the JSON null value. By default, fields with empty
  890. // values are omitted from API requests. However, any field with an
  891. // empty value appearing in NullFields will be sent to the server as
  892. // null. It is an error if a field in this list has a non-empty value.
  893. // This may be used to include null fields in Patch requests.
  894. NullFields []string `json:"-"`
  895. }
  896. func (s *Alerts) MarshalJSON() ([]byte, error) {
  897. type NoMethod Alerts
  898. raw := NoMethod(*s)
  899. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  900. }
  901. type CustomChannel struct {
  902. // Code: Code of this custom channel, not necessarily unique across ad
  903. // clients.
  904. Code string `json:"code,omitempty"`
  905. // Id: Unique identifier of this custom channel. This should be
  906. // considered an opaque identifier; it is not safe to rely on it being
  907. // in any particular format.
  908. Id string `json:"id,omitempty"`
  909. // Kind: Kind of resource this is, in this case adsense#customChannel.
  910. Kind string `json:"kind,omitempty"`
  911. // Name: Name of this custom channel.
  912. Name string `json:"name,omitempty"`
  913. // TargetingInfo: The targeting information of this custom channel, if
  914. // activated.
  915. TargetingInfo *CustomChannelTargetingInfo `json:"targetingInfo,omitempty"`
  916. // ServerResponse contains the HTTP response code and headers from the
  917. // server.
  918. googleapi.ServerResponse `json:"-"`
  919. // ForceSendFields is a list of field names (e.g. "Code") to
  920. // unconditionally include in API requests. By default, fields with
  921. // empty values are omitted from API requests. However, any non-pointer,
  922. // non-interface field appearing in ForceSendFields will be sent to the
  923. // server regardless of whether the field is empty or not. This may be
  924. // used to include empty fields in Patch requests.
  925. ForceSendFields []string `json:"-"`
  926. // NullFields is a list of field names (e.g. "Code") to include in API
  927. // requests with the JSON null value. By default, fields with empty
  928. // values are omitted from API requests. However, any field with an
  929. // empty value appearing in NullFields will be sent to the server as
  930. // null. It is an error if a field in this list has a non-empty value.
  931. // This may be used to include null fields in Patch requests.
  932. NullFields []string `json:"-"`
  933. }
  934. func (s *CustomChannel) MarshalJSON() ([]byte, error) {
  935. type NoMethod CustomChannel
  936. raw := NoMethod(*s)
  937. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  938. }
  939. // CustomChannelTargetingInfo: The targeting information of this custom
  940. // channel, if activated.
  941. type CustomChannelTargetingInfo struct {
  942. // AdsAppearOn: The name used to describe this channel externally.
  943. AdsAppearOn string `json:"adsAppearOn,omitempty"`
  944. // Description: The external description of the channel.
  945. Description string `json:"description,omitempty"`
  946. // Location: The locations in which ads appear. (Only valid for content
  947. // and mobile content ads (deprecated)). Acceptable values for content
  948. // ads are: TOP_LEFT, TOP_CENTER, TOP_RIGHT, MIDDLE_LEFT, MIDDLE_CENTER,
  949. // MIDDLE_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT,
  950. // MULTIPLE_LOCATIONS. Acceptable values for mobile content ads
  951. // (deprecated) are: TOP, MIDDLE, BOTTOM, MULTIPLE_LOCATIONS.
  952. Location string `json:"location,omitempty"`
  953. // SiteLanguage: The language of the sites ads will be displayed on.
  954. SiteLanguage string `json:"siteLanguage,omitempty"`
  955. // ForceSendFields is a list of field names (e.g. "AdsAppearOn") to
  956. // unconditionally include in API requests. By default, fields with
  957. // empty values are omitted from API requests. However, any non-pointer,
  958. // non-interface field appearing in ForceSendFields will be sent to the
  959. // server regardless of whether the field is empty or not. This may be
  960. // used to include empty fields in Patch requests.
  961. ForceSendFields []string `json:"-"`
  962. // NullFields is a list of field names (e.g. "AdsAppearOn") to include
  963. // in API requests with the JSON null value. By default, fields with
  964. // empty values are omitted from API requests. However, any field with
  965. // an empty value appearing in NullFields will be sent to the server as
  966. // null. It is an error if a field in this list has a non-empty value.
  967. // This may be used to include null fields in Patch requests.
  968. NullFields []string `json:"-"`
  969. }
  970. func (s *CustomChannelTargetingInfo) MarshalJSON() ([]byte, error) {
  971. type NoMethod CustomChannelTargetingInfo
  972. raw := NoMethod(*s)
  973. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  974. }
  975. type CustomChannels struct {
  976. // Etag: ETag of this response for caching purposes.
  977. Etag string `json:"etag,omitempty"`
  978. // Items: The custom channels returned in this list response.
  979. Items []*CustomChannel `json:"items,omitempty"`
  980. // Kind: Kind of list this is, in this case adsense#customChannels.
  981. Kind string `json:"kind,omitempty"`
  982. // NextPageToken: Continuation token used to page through custom
  983. // channels. To retrieve the next page of results, set the next
  984. // request's "pageToken" value to this.
  985. NextPageToken string `json:"nextPageToken,omitempty"`
  986. // ServerResponse contains the HTTP response code and headers from the
  987. // server.
  988. googleapi.ServerResponse `json:"-"`
  989. // ForceSendFields is a list of field names (e.g. "Etag") to
  990. // unconditionally include in API requests. By default, fields with
  991. // empty values are omitted from API requests. However, any non-pointer,
  992. // non-interface field appearing in ForceSendFields will be sent to the
  993. // server regardless of whether the field is empty or not. This may be
  994. // used to include empty fields in Patch requests.
  995. ForceSendFields []string `json:"-"`
  996. // NullFields is a list of field names (e.g. "Etag") to include in API
  997. // requests with the JSON null value. By default, fields with empty
  998. // values are omitted from API requests. However, any field with an
  999. // empty value appearing in NullFields will be sent to the server as
  1000. // null. It is an error if a field in this list has a non-empty value.
  1001. // This may be used to include null fields in Patch requests.
  1002. NullFields []string `json:"-"`
  1003. }
  1004. func (s *CustomChannels) MarshalJSON() ([]byte, error) {
  1005. type NoMethod CustomChannels
  1006. raw := NoMethod(*s)
  1007. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1008. }
  1009. type Metadata struct {
  1010. Items []*ReportingMetadataEntry `json:"items,omitempty"`
  1011. // Kind: Kind of list this is, in this case adsense#metadata.
  1012. Kind string `json:"kind,omitempty"`
  1013. // ServerResponse contains the HTTP response code and headers from the
  1014. // server.
  1015. googleapi.ServerResponse `json:"-"`
  1016. // ForceSendFields is a list of field names (e.g. "Items") to
  1017. // unconditionally include in API requests. By default, fields with
  1018. // empty values are omitted from API requests. However, any non-pointer,
  1019. // non-interface field appearing in ForceSendFields will be sent to the
  1020. // server regardless of whether the field is empty or not. This may be
  1021. // used to include empty fields in Patch requests.
  1022. ForceSendFields []string `json:"-"`
  1023. // NullFields is a list of field names (e.g. "Items") to include in API
  1024. // requests with the JSON null value. By default, fields with empty
  1025. // values are omitted from API requests. However, any field with an
  1026. // empty value appearing in NullFields will be sent to the server as
  1027. // null. It is an error if a field in this list has a non-empty value.
  1028. // This may be used to include null fields in Patch requests.
  1029. NullFields []string `json:"-"`
  1030. }
  1031. func (s *Metadata) MarshalJSON() ([]byte, error) {
  1032. type NoMethod Metadata
  1033. raw := NoMethod(*s)
  1034. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1035. }
  1036. type ReportingMetadataEntry struct {
  1037. // CompatibleDimensions: For metrics this is a list of dimension IDs
  1038. // which the metric is compatible with, for dimensions it is a list of
  1039. // compatibility groups the dimension belongs to.
  1040. CompatibleDimensions []string `json:"compatibleDimensions,omitempty"`
  1041. // CompatibleMetrics: The names of the metrics the dimension or metric
  1042. // this reporting metadata entry describes is compatible with.
  1043. CompatibleMetrics []string `json:"compatibleMetrics,omitempty"`
  1044. // Id: Unique identifier of this reporting metadata entry, corresponding
  1045. // to the name of the appropriate dimension or metric.
  1046. Id string `json:"id,omitempty"`
  1047. // Kind: Kind of resource this is, in this case
  1048. // adsense#reportingMetadataEntry.
  1049. Kind string `json:"kind,omitempty"`
  1050. // RequiredDimensions: The names of the dimensions which the dimension
  1051. // or metric this reporting metadata entry describes requires to also be
  1052. // present in order for the report to be valid. Omitting these will not
  1053. // cause an error or warning, but may result in data which cannot be
  1054. // correctly interpreted.
  1055. RequiredDimensions []string `json:"requiredDimensions,omitempty"`
  1056. // RequiredMetrics: The names of the metrics which the dimension or
  1057. // metric this reporting metadata entry describes requires to also be
  1058. // present in order for the report to be valid. Omitting these will not
  1059. // cause an error or warning, but may result in data which cannot be
  1060. // correctly interpreted.
  1061. RequiredMetrics []string `json:"requiredMetrics,omitempty"`
  1062. // SupportedProducts: The codes of the projects supported by the
  1063. // dimension or metric this reporting metadata entry describes.
  1064. SupportedProducts []string `json:"supportedProducts,omitempty"`
  1065. // ForceSendFields is a list of field names (e.g.
  1066. // "CompatibleDimensions") to unconditionally include in API requests.
  1067. // By default, fields with empty values are omitted from API requests.
  1068. // However, any non-pointer, non-interface field appearing in
  1069. // ForceSendFields will be sent to the server regardless of whether the
  1070. // field is empty or not. This may be used to include empty fields in
  1071. // Patch requests.
  1072. ForceSendFields []string `json:"-"`
  1073. // NullFields is a list of field names (e.g. "CompatibleDimensions") to
  1074. // include in API requests with the JSON null value. By default, fields
  1075. // with empty values are omitted from API requests. However, any field
  1076. // with an empty value appearing in NullFields will be sent to the
  1077. // server as null. It is an error if a field in this list has a
  1078. // non-empty value. This may be used to include null fields in Patch
  1079. // requests.
  1080. NullFields []string `json:"-"`
  1081. }
  1082. func (s *ReportingMetadataEntry) MarshalJSON() ([]byte, error) {
  1083. type NoMethod ReportingMetadataEntry
  1084. raw := NoMethod(*s)
  1085. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1086. }
  1087. type SavedAdStyle struct {
  1088. // AdStyle: The AdStyle itself.
  1089. AdStyle *AdStyle `json:"adStyle,omitempty"`
  1090. // Id: Unique identifier of this saved ad style. This should be
  1091. // considered an opaque identifier; it is not safe to rely on it being
  1092. // in any particular format.
  1093. Id string `json:"id,omitempty"`
  1094. // Kind: Kind of resource this is, in this case adsense#savedAdStyle.
  1095. Kind string `json:"kind,omitempty"`
  1096. // Name: The user selected name of this SavedAdStyle.
  1097. Name string `json:"name,omitempty"`
  1098. // ServerResponse contains the HTTP response code and headers from the
  1099. // server.
  1100. googleapi.ServerResponse `json:"-"`
  1101. // ForceSendFields is a list of field names (e.g. "AdStyle") to
  1102. // unconditionally include in API requests. By default, fields with
  1103. // empty values are omitted from API requests. However, any non-pointer,
  1104. // non-interface field appearing in ForceSendFields will be sent to the
  1105. // server regardless of whether the field is empty or not. This may be
  1106. // used to include empty fields in Patch requests.
  1107. ForceSendFields []string `json:"-"`
  1108. // NullFields is a list of field names (e.g. "AdStyle") to include in
  1109. // API requests with the JSON null value. By default, fields with empty
  1110. // values are omitted from API requests. However, any field with an
  1111. // empty value appearing in NullFields will be sent to the server as
  1112. // null. It is an error if a field in this list has a non-empty value.
  1113. // This may be used to include null fields in Patch requests.
  1114. NullFields []string `json:"-"`
  1115. }
  1116. func (s *SavedAdStyle) MarshalJSON() ([]byte, error) {
  1117. type NoMethod SavedAdStyle
  1118. raw := NoMethod(*s)
  1119. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1120. }
  1121. type SavedAdStyles struct {
  1122. // Etag: ETag of this response for caching purposes.
  1123. Etag string `json:"etag,omitempty"`
  1124. // Items: The saved ad styles returned in this list response.
  1125. Items []*SavedAdStyle `json:"items,omitempty"`
  1126. // Kind: Kind of list this is, in this case adsense#savedAdStyles.
  1127. Kind string `json:"kind,omitempty"`
  1128. // NextPageToken: Continuation token used to page through ad units. To
  1129. // retrieve the next page of results, set the next request's "pageToken"
  1130. // value to this.
  1131. NextPageToken string `json:"nextPageToken,omitempty"`
  1132. // ServerResponse contains the HTTP response code and headers from the
  1133. // server.
  1134. googleapi.ServerResponse `json:"-"`
  1135. // ForceSendFields is a list of field names (e.g. "Etag") to
  1136. // unconditionally include in API requests. By default, fields with
  1137. // empty values are omitted from API requests. However, any non-pointer,
  1138. // non-interface field appearing in ForceSendFields will be sent to the
  1139. // server regardless of whether the field is empty or not. This may be
  1140. // used to include empty fields in Patch requests.
  1141. ForceSendFields []string `json:"-"`
  1142. // NullFields is a list of field names (e.g. "Etag") to include in API
  1143. // requests with the JSON null value. By default, fields with empty
  1144. // values are omitted from API requests. However, any field with an
  1145. // empty value appearing in NullFields will be sent to the server as
  1146. // null. It is an error if a field in this list has a non-empty value.
  1147. // This may be used to include null fields in Patch requests.
  1148. NullFields []string `json:"-"`
  1149. }
  1150. func (s *SavedAdStyles) MarshalJSON() ([]byte, error) {
  1151. type NoMethod SavedAdStyles
  1152. raw := NoMethod(*s)
  1153. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1154. }
  1155. type SavedReport struct {
  1156. // Id: Unique identifier of this saved report.
  1157. Id string `json:"id,omitempty"`
  1158. // Kind: Kind of resource this is, in this case adsense#savedReport.
  1159. Kind string `json:"kind,omitempty"`
  1160. // Name: This saved report's name.
  1161. Name string `json:"name,omitempty"`
  1162. // ForceSendFields is a list of field names (e.g. "Id") to
  1163. // unconditionally include in API requests. By default, fields with
  1164. // empty values are omitted from API requests. However, any non-pointer,
  1165. // non-interface field appearing in ForceSendFields will be sent to the
  1166. // server regardless of whether the field is empty or not. This may be
  1167. // used to include empty fields in Patch requests.
  1168. ForceSendFields []string `json:"-"`
  1169. // NullFields is a list of field names (e.g. "Id") to include in API
  1170. // requests with the JSON null value. By default, fields with empty
  1171. // values are omitted from API requests. However, any field with an
  1172. // empty value appearing in NullFields will be sent to the server as
  1173. // null. It is an error if a field in this list has a non-empty value.
  1174. // This may be used to include null fields in Patch requests.
  1175. NullFields []string `json:"-"`
  1176. }
  1177. func (s *SavedReport) MarshalJSON() ([]byte, error) {
  1178. type NoMethod SavedReport
  1179. raw := NoMethod(*s)
  1180. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1181. }
  1182. type SavedReports struct {
  1183. // Etag: ETag of this response for caching purposes.
  1184. Etag string `json:"etag,omitempty"`
  1185. // Items: The saved reports returned in this list response.
  1186. Items []*SavedReport `json:"items,omitempty"`
  1187. // Kind: Kind of list this is, in this case adsense#savedReports.
  1188. Kind string `json:"kind,omitempty"`
  1189. // NextPageToken: Continuation token used to page through saved reports.
  1190. // To retrieve the next page of results, set the next request's
  1191. // "pageToken" value to this.
  1192. NextPageToken string `json:"nextPageToken,omitempty"`
  1193. // ServerResponse contains the HTTP response code and headers from the
  1194. // server.
  1195. googleapi.ServerResponse `json:"-"`
  1196. // ForceSendFields is a list of field names (e.g. "Etag") to
  1197. // unconditionally include in API requests. By default, fields with
  1198. // empty values are omitted from API requests. However, any non-pointer,
  1199. // non-interface field appearing in ForceSendFields will be sent to the
  1200. // server regardless of whether the field is empty or not. This may be
  1201. // used to include empty fields in Patch requests.
  1202. ForceSendFields []string `json:"-"`
  1203. // NullFields is a list of field names (e.g. "Etag") to include in API
  1204. // requests with the JSON null value. By default, fields with empty
  1205. // values are omitted from API requests. However, any field with an
  1206. // empty value appearing in NullFields will be sent to the server as
  1207. // null. It is an error if a field in this list has a non-empty value.
  1208. // This may be used to include null fields in Patch requests.
  1209. NullFields []string `json:"-"`
  1210. }
  1211. func (s *SavedReports) MarshalJSON() ([]byte, error) {
  1212. type NoMethod SavedReports
  1213. raw := NoMethod(*s)
  1214. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1215. }
  1216. type UrlChannel struct {
  1217. // Id: Unique identifier of this URL channel. This should be considered
  1218. // an opaque identifier; it is not safe to rely on it being in any
  1219. // particular format.
  1220. Id string `json:"id,omitempty"`
  1221. // Kind: Kind of resource this is, in this case adsense#urlChannel.
  1222. Kind string `json:"kind,omitempty"`
  1223. // UrlPattern: URL Pattern of this URL channel. Does not include
  1224. // "http://" or "https://". Example: www.example.com/home
  1225. UrlPattern string `json:"urlPattern,omitempty"`
  1226. // ForceSendFields is a list of field names (e.g. "Id") to
  1227. // unconditionally include in API requests. By default, fields with
  1228. // empty values are omitted from API requests. However, any non-pointer,
  1229. // non-interface field appearing in ForceSendFields will be sent to the
  1230. // server regardless of whether the field is empty or not. This may be
  1231. // used to include empty fields in Patch requests.
  1232. ForceSendFields []string `json:"-"`
  1233. // NullFields is a list of field names (e.g. "Id") to include in API
  1234. // requests with the JSON null value. By default, fields with empty
  1235. // values are omitted from API requests. However, any field with an
  1236. // empty value appearing in NullFields will be sent to the server as
  1237. // null. It is an error if a field in this list has a non-empty value.
  1238. // This may be used to include null fields in Patch requests.
  1239. NullFields []string `json:"-"`
  1240. }
  1241. func (s *UrlChannel) MarshalJSON() ([]byte, error) {
  1242. type NoMethod UrlChannel
  1243. raw := NoMethod(*s)
  1244. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1245. }
  1246. type UrlChannels struct {
  1247. // Etag: ETag of this response for caching purposes.
  1248. Etag string `json:"etag,omitempty"`
  1249. // Items: The URL channels returned in this list response.
  1250. Items []*UrlChannel `json:"items,omitempty"`
  1251. // Kind: Kind of list this is, in this case adsense#urlChannels.
  1252. Kind string `json:"kind,omitempty"`
  1253. // NextPageToken: Continuation token used to page through URL channels.
  1254. // To retrieve the next page of results, set the next request's
  1255. // "pageToken" value to this.
  1256. NextPageToken string `json:"nextPageToken,omitempty"`
  1257. // ServerResponse contains the HTTP response code and headers from the
  1258. // server.
  1259. googleapi.ServerResponse `json:"-"`
  1260. // ForceSendFields is a list of field names (e.g. "Etag") to
  1261. // unconditionally include in API requests. By default, fields with
  1262. // empty values are omitted from API requests. However, any non-pointer,
  1263. // non-interface field appearing in ForceSendFields will be sent to the
  1264. // server regardless of whether the field is empty or not. This may be
  1265. // used to include empty fields in Patch requests.
  1266. ForceSendFields []string `json:"-"`
  1267. // NullFields is a list of field names (e.g. "Etag") to include in API
  1268. // requests with the JSON null value. By default, fields with empty
  1269. // values are omitted from API requests. However, any field with an
  1270. // empty value appearing in NullFields will be sent to the server as
  1271. // null. It is an error if a field in this list has a non-empty value.
  1272. // This may be used to include null fields in Patch requests.
  1273. NullFields []string `json:"-"`
  1274. }
  1275. func (s *UrlChannels) MarshalJSON() ([]byte, error) {
  1276. type NoMethod UrlChannels
  1277. raw := NoMethod(*s)
  1278. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1279. }
  1280. // method id "adsense.accounts.get":
  1281. type AccountsGetCall struct {
  1282. s *Service
  1283. accountId string
  1284. urlParams_ gensupport.URLParams
  1285. ifNoneMatch_ string
  1286. ctx_ context.Context
  1287. header_ http.Header
  1288. }
  1289. // Get: Get information about the selected AdSense account.
  1290. func (r *AccountsService) Get(accountId string) *AccountsGetCall {
  1291. c := &AccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1292. c.accountId = accountId
  1293. return c
  1294. }
  1295. // Tree sets the optional parameter "tree": Whether the tree of sub
  1296. // accounts should be returned.
  1297. func (c *AccountsGetCall) Tree(tree bool) *AccountsGetCall {
  1298. c.urlParams_.Set("tree", fmt.Sprint(tree))
  1299. return c
  1300. }
  1301. // Fields allows partial responses to be retrieved. See
  1302. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1303. // for more information.
  1304. func (c *AccountsGetCall) Fields(s ...googleapi.Field) *AccountsGetCall {
  1305. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1306. return c
  1307. }
  1308. // IfNoneMatch sets the optional parameter which makes the operation
  1309. // fail if the object's ETag matches the given value. This is useful for
  1310. // getting updates only after the object has changed since the last
  1311. // request. Use googleapi.IsNotModified to check whether the response
  1312. // error from Do is the result of In-None-Match.
  1313. func (c *AccountsGetCall) IfNoneMatch(entityTag string) *AccountsGetCall {
  1314. c.ifNoneMatch_ = entityTag
  1315. return c
  1316. }
  1317. // Context sets the context to be used in this call's Do method. Any
  1318. // pending HTTP request will be aborted if the provided context is
  1319. // canceled.
  1320. func (c *AccountsGetCall) Context(ctx context.Context) *AccountsGetCall {
  1321. c.ctx_ = ctx
  1322. return c
  1323. }
  1324. // Header returns an http.Header that can be modified by the caller to
  1325. // add HTTP headers to the request.
  1326. func (c *AccountsGetCall) Header() http.Header {
  1327. if c.header_ == nil {
  1328. c.header_ = make(http.Header)
  1329. }
  1330. return c.header_
  1331. }
  1332. func (c *AccountsGetCall) doRequest(alt string) (*http.Response, error) {
  1333. reqHeaders := make(http.Header)
  1334. for k, v := range c.header_ {
  1335. reqHeaders[k] = v
  1336. }
  1337. reqHeaders.Set("User-Agent", c.s.userAgent())
  1338. if c.ifNoneMatch_ != "" {
  1339. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1340. }
  1341. var body io.Reader = nil
  1342. c.urlParams_.Set("alt", alt)
  1343. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}")
  1344. urls += "?" + c.urlParams_.Encode()
  1345. req, _ := http.NewRequest("GET", urls, body)
  1346. req.Header = reqHeaders
  1347. googleapi.Expand(req.URL, map[string]string{
  1348. "accountId": c.accountId,
  1349. })
  1350. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1351. }
  1352. // Do executes the "adsense.accounts.get" call.
  1353. // Exactly one of *Account or error will be non-nil. Any non-2xx status
  1354. // code is an error. Response headers are in either
  1355. // *Account.ServerResponse.Header or (if a response was returned at all)
  1356. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1357. // check whether the returned error was because http.StatusNotModified
  1358. // was returned.
  1359. func (c *AccountsGetCall) Do(opts ...googleapi.CallOption) (*Account, error) {
  1360. gensupport.SetOptions(c.urlParams_, opts...)
  1361. res, err := c.doRequest("json")
  1362. if res != nil && res.StatusCode == http.StatusNotModified {
  1363. if res.Body != nil {
  1364. res.Body.Close()
  1365. }
  1366. return nil, &googleapi.Error{
  1367. Code: res.StatusCode,
  1368. Header: res.Header,
  1369. }
  1370. }
  1371. if err != nil {
  1372. return nil, err
  1373. }
  1374. defer googleapi.CloseBody(res)
  1375. if err := googleapi.CheckResponse(res); err != nil {
  1376. return nil, err
  1377. }
  1378. ret := &Account{
  1379. ServerResponse: googleapi.ServerResponse{
  1380. Header: res.Header,
  1381. HTTPStatusCode: res.StatusCode,
  1382. },
  1383. }
  1384. target := &ret
  1385. if err := gensupport.DecodeResponse(target, res); err != nil {
  1386. return nil, err
  1387. }
  1388. return ret, nil
  1389. // {
  1390. // "description": "Get information about the selected AdSense account.",
  1391. // "httpMethod": "GET",
  1392. // "id": "adsense.accounts.get",
  1393. // "parameterOrder": [
  1394. // "accountId"
  1395. // ],
  1396. // "parameters": {
  1397. // "accountId": {
  1398. // "description": "Account to get information about.",
  1399. // "location": "path",
  1400. // "required": true,
  1401. // "type": "string"
  1402. // },
  1403. // "tree": {
  1404. // "description": "Whether the tree of sub accounts should be returned.",
  1405. // "location": "query",
  1406. // "type": "boolean"
  1407. // }
  1408. // },
  1409. // "path": "accounts/{accountId}",
  1410. // "response": {
  1411. // "$ref": "Account"
  1412. // },
  1413. // "scopes": [
  1414. // "https://www.googleapis.com/auth/adsense",
  1415. // "https://www.googleapis.com/auth/adsense.readonly"
  1416. // ]
  1417. // }
  1418. }
  1419. // method id "adsense.accounts.list":
  1420. type AccountsListCall struct {
  1421. s *Service
  1422. urlParams_ gensupport.URLParams
  1423. ifNoneMatch_ string
  1424. ctx_ context.Context
  1425. header_ http.Header
  1426. }
  1427. // List: List all accounts available to this AdSense account.
  1428. func (r *AccountsService) List() *AccountsListCall {
  1429. c := &AccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1430. return c
  1431. }
  1432. // MaxResults sets the optional parameter "maxResults": The maximum
  1433. // number of accounts to include in the response, used for paging.
  1434. func (c *AccountsListCall) MaxResults(maxResults int64) *AccountsListCall {
  1435. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1436. return c
  1437. }
  1438. // PageToken sets the optional parameter "pageToken": A continuation
  1439. // token, used to page through accounts. To retrieve the next page, set
  1440. // this parameter to the value of "nextPageToken" from the previous
  1441. // response.
  1442. func (c *AccountsListCall) PageToken(pageToken string) *AccountsListCall {
  1443. c.urlParams_.Set("pageToken", pageToken)
  1444. return c
  1445. }
  1446. // Fields allows partial responses to be retrieved. See
  1447. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1448. // for more information.
  1449. func (c *AccountsListCall) Fields(s ...googleapi.Field) *AccountsListCall {
  1450. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1451. return c
  1452. }
  1453. // IfNoneMatch sets the optional parameter which makes the operation
  1454. // fail if the object's ETag matches the given value. This is useful for
  1455. // getting updates only after the object has changed since the last
  1456. // request. Use googleapi.IsNotModified to check whether the response
  1457. // error from Do is the result of In-None-Match.
  1458. func (c *AccountsListCall) IfNoneMatch(entityTag string) *AccountsListCall {
  1459. c.ifNoneMatch_ = entityTag
  1460. return c
  1461. }
  1462. // Context sets the context to be used in this call's Do method. Any
  1463. // pending HTTP request will be aborted if the provided context is
  1464. // canceled.
  1465. func (c *AccountsListCall) Context(ctx context.Context) *AccountsListCall {
  1466. c.ctx_ = ctx
  1467. return c
  1468. }
  1469. // Header returns an http.Header that can be modified by the caller to
  1470. // add HTTP headers to the request.
  1471. func (c *AccountsListCall) Header() http.Header {
  1472. if c.header_ == nil {
  1473. c.header_ = make(http.Header)
  1474. }
  1475. return c.header_
  1476. }
  1477. func (c *AccountsListCall) doRequest(alt string) (*http.Response, error) {
  1478. reqHeaders := make(http.Header)
  1479. for k, v := range c.header_ {
  1480. reqHeaders[k] = v
  1481. }
  1482. reqHeaders.Set("User-Agent", c.s.userAgent())
  1483. if c.ifNoneMatch_ != "" {
  1484. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1485. }
  1486. var body io.Reader = nil
  1487. c.urlParams_.Set("alt", alt)
  1488. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts")
  1489. urls += "?" + c.urlParams_.Encode()
  1490. req, _ := http.NewRequest("GET", urls, body)
  1491. req.Header = reqHeaders
  1492. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1493. }
  1494. // Do executes the "adsense.accounts.list" call.
  1495. // Exactly one of *Accounts or error will be non-nil. Any non-2xx status
  1496. // code is an error. Response headers are in either
  1497. // *Accounts.ServerResponse.Header or (if a response was returned at
  1498. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1499. // to check whether the returned error was because
  1500. // http.StatusNotModified was returned.
  1501. func (c *AccountsListCall) Do(opts ...googleapi.CallOption) (*Accounts, error) {
  1502. gensupport.SetOptions(c.urlParams_, opts...)
  1503. res, err := c.doRequest("json")
  1504. if res != nil && res.StatusCode == http.StatusNotModified {
  1505. if res.Body != nil {
  1506. res.Body.Close()
  1507. }
  1508. return nil, &googleapi.Error{
  1509. Code: res.StatusCode,
  1510. Header: res.Header,
  1511. }
  1512. }
  1513. if err != nil {
  1514. return nil, err
  1515. }
  1516. defer googleapi.CloseBody(res)
  1517. if err := googleapi.CheckResponse(res); err != nil {
  1518. return nil, err
  1519. }
  1520. ret := &Accounts{
  1521. ServerResponse: googleapi.ServerResponse{
  1522. Header: res.Header,
  1523. HTTPStatusCode: res.StatusCode,
  1524. },
  1525. }
  1526. target := &ret
  1527. if err := gensupport.DecodeResponse(target, res); err != nil {
  1528. return nil, err
  1529. }
  1530. return ret, nil
  1531. // {
  1532. // "description": "List all accounts available to this AdSense account.",
  1533. // "httpMethod": "GET",
  1534. // "id": "adsense.accounts.list",
  1535. // "parameters": {
  1536. // "maxResults": {
  1537. // "description": "The maximum number of accounts to include in the response, used for paging.",
  1538. // "format": "int32",
  1539. // "location": "query",
  1540. // "maximum": "10000",
  1541. // "minimum": "0",
  1542. // "type": "integer"
  1543. // },
  1544. // "pageToken": {
  1545. // "description": "A continuation token, used to page through accounts. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  1546. // "location": "query",
  1547. // "type": "string"
  1548. // }
  1549. // },
  1550. // "path": "accounts",
  1551. // "response": {
  1552. // "$ref": "Accounts"
  1553. // },
  1554. // "scopes": [
  1555. // "https://www.googleapis.com/auth/adsense",
  1556. // "https://www.googleapis.com/auth/adsense.readonly"
  1557. // ]
  1558. // }
  1559. }
  1560. // Pages invokes f for each page of results.
  1561. // A non-nil error returned from f will halt the iteration.
  1562. // The provided context supersedes any context provided to the Context method.
  1563. func (c *AccountsListCall) Pages(ctx context.Context, f func(*Accounts) error) error {
  1564. c.ctx_ = ctx
  1565. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1566. for {
  1567. x, err := c.Do()
  1568. if err != nil {
  1569. return err
  1570. }
  1571. if err := f(x); err != nil {
  1572. return err
  1573. }
  1574. if x.NextPageToken == "" {
  1575. return nil
  1576. }
  1577. c.PageToken(x.NextPageToken)
  1578. }
  1579. }
  1580. // method id "adsense.accounts.adclients.list":
  1581. type AccountsAdclientsListCall struct {
  1582. s *Service
  1583. accountId string
  1584. urlParams_ gensupport.URLParams
  1585. ifNoneMatch_ string
  1586. ctx_ context.Context
  1587. header_ http.Header
  1588. }
  1589. // List: List all ad clients in the specified account.
  1590. func (r *AccountsAdclientsService) List(accountId string) *AccountsAdclientsListCall {
  1591. c := &AccountsAdclientsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1592. c.accountId = accountId
  1593. return c
  1594. }
  1595. // MaxResults sets the optional parameter "maxResults": The maximum
  1596. // number of ad clients to include in the response, used for paging.
  1597. func (c *AccountsAdclientsListCall) MaxResults(maxResults int64) *AccountsAdclientsListCall {
  1598. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1599. return c
  1600. }
  1601. // PageToken sets the optional parameter "pageToken": A continuation
  1602. // token, used to page through ad clients. To retrieve the next page,
  1603. // set this parameter to the value of "nextPageToken" from the previous
  1604. // response.
  1605. func (c *AccountsAdclientsListCall) PageToken(pageToken string) *AccountsAdclientsListCall {
  1606. c.urlParams_.Set("pageToken", pageToken)
  1607. return c
  1608. }
  1609. // Fields allows partial responses to be retrieved. See
  1610. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1611. // for more information.
  1612. func (c *AccountsAdclientsListCall) Fields(s ...googleapi.Field) *AccountsAdclientsListCall {
  1613. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1614. return c
  1615. }
  1616. // IfNoneMatch sets the optional parameter which makes the operation
  1617. // fail if the object's ETag matches the given value. This is useful for
  1618. // getting updates only after the object has changed since the last
  1619. // request. Use googleapi.IsNotModified to check whether the response
  1620. // error from Do is the result of In-None-Match.
  1621. func (c *AccountsAdclientsListCall) IfNoneMatch(entityTag string) *AccountsAdclientsListCall {
  1622. c.ifNoneMatch_ = entityTag
  1623. return c
  1624. }
  1625. // Context sets the context to be used in this call's Do method. Any
  1626. // pending HTTP request will be aborted if the provided context is
  1627. // canceled.
  1628. func (c *AccountsAdclientsListCall) Context(ctx context.Context) *AccountsAdclientsListCall {
  1629. c.ctx_ = ctx
  1630. return c
  1631. }
  1632. // Header returns an http.Header that can be modified by the caller to
  1633. // add HTTP headers to the request.
  1634. func (c *AccountsAdclientsListCall) Header() http.Header {
  1635. if c.header_ == nil {
  1636. c.header_ = make(http.Header)
  1637. }
  1638. return c.header_
  1639. }
  1640. func (c *AccountsAdclientsListCall) doRequest(alt string) (*http.Response, error) {
  1641. reqHeaders := make(http.Header)
  1642. for k, v := range c.header_ {
  1643. reqHeaders[k] = v
  1644. }
  1645. reqHeaders.Set("User-Agent", c.s.userAgent())
  1646. if c.ifNoneMatch_ != "" {
  1647. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1648. }
  1649. var body io.Reader = nil
  1650. c.urlParams_.Set("alt", alt)
  1651. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients")
  1652. urls += "?" + c.urlParams_.Encode()
  1653. req, _ := http.NewRequest("GET", urls, body)
  1654. req.Header = reqHeaders
  1655. googleapi.Expand(req.URL, map[string]string{
  1656. "accountId": c.accountId,
  1657. })
  1658. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1659. }
  1660. // Do executes the "adsense.accounts.adclients.list" call.
  1661. // Exactly one of *AdClients or error will be non-nil. Any non-2xx
  1662. // status code is an error. Response headers are in either
  1663. // *AdClients.ServerResponse.Header or (if a response was returned at
  1664. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1665. // to check whether the returned error was because
  1666. // http.StatusNotModified was returned.
  1667. func (c *AccountsAdclientsListCall) Do(opts ...googleapi.CallOption) (*AdClients, error) {
  1668. gensupport.SetOptions(c.urlParams_, opts...)
  1669. res, err := c.doRequest("json")
  1670. if res != nil && res.StatusCode == http.StatusNotModified {
  1671. if res.Body != nil {
  1672. res.Body.Close()
  1673. }
  1674. return nil, &googleapi.Error{
  1675. Code: res.StatusCode,
  1676. Header: res.Header,
  1677. }
  1678. }
  1679. if err != nil {
  1680. return nil, err
  1681. }
  1682. defer googleapi.CloseBody(res)
  1683. if err := googleapi.CheckResponse(res); err != nil {
  1684. return nil, err
  1685. }
  1686. ret := &AdClients{
  1687. ServerResponse: googleapi.ServerResponse{
  1688. Header: res.Header,
  1689. HTTPStatusCode: res.StatusCode,
  1690. },
  1691. }
  1692. target := &ret
  1693. if err := gensupport.DecodeResponse(target, res); err != nil {
  1694. return nil, err
  1695. }
  1696. return ret, nil
  1697. // {
  1698. // "description": "List all ad clients in the specified account.",
  1699. // "httpMethod": "GET",
  1700. // "id": "adsense.accounts.adclients.list",
  1701. // "parameterOrder": [
  1702. // "accountId"
  1703. // ],
  1704. // "parameters": {
  1705. // "accountId": {
  1706. // "description": "Account for which to list ad clients.",
  1707. // "location": "path",
  1708. // "required": true,
  1709. // "type": "string"
  1710. // },
  1711. // "maxResults": {
  1712. // "description": "The maximum number of ad clients to include in the response, used for paging.",
  1713. // "format": "int32",
  1714. // "location": "query",
  1715. // "maximum": "10000",
  1716. // "minimum": "0",
  1717. // "type": "integer"
  1718. // },
  1719. // "pageToken": {
  1720. // "description": "A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  1721. // "location": "query",
  1722. // "type": "string"
  1723. // }
  1724. // },
  1725. // "path": "accounts/{accountId}/adclients",
  1726. // "response": {
  1727. // "$ref": "AdClients"
  1728. // },
  1729. // "scopes": [
  1730. // "https://www.googleapis.com/auth/adsense",
  1731. // "https://www.googleapis.com/auth/adsense.readonly"
  1732. // ]
  1733. // }
  1734. }
  1735. // Pages invokes f for each page of results.
  1736. // A non-nil error returned from f will halt the iteration.
  1737. // The provided context supersedes any context provided to the Context method.
  1738. func (c *AccountsAdclientsListCall) Pages(ctx context.Context, f func(*AdClients) error) error {
  1739. c.ctx_ = ctx
  1740. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1741. for {
  1742. x, err := c.Do()
  1743. if err != nil {
  1744. return err
  1745. }
  1746. if err := f(x); err != nil {
  1747. return err
  1748. }
  1749. if x.NextPageToken == "" {
  1750. return nil
  1751. }
  1752. c.PageToken(x.NextPageToken)
  1753. }
  1754. }
  1755. // method id "adsense.accounts.adunits.get":
  1756. type AccountsAdunitsGetCall struct {
  1757. s *Service
  1758. accountId string
  1759. adClientId string
  1760. adUnitId string
  1761. urlParams_ gensupport.URLParams
  1762. ifNoneMatch_ string
  1763. ctx_ context.Context
  1764. header_ http.Header
  1765. }
  1766. // Get: Gets the specified ad unit in the specified ad client for the
  1767. // specified account.
  1768. func (r *AccountsAdunitsService) Get(accountId string, adClientId string, adUnitId string) *AccountsAdunitsGetCall {
  1769. c := &AccountsAdunitsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1770. c.accountId = accountId
  1771. c.adClientId = adClientId
  1772. c.adUnitId = adUnitId
  1773. return c
  1774. }
  1775. // Fields allows partial responses to be retrieved. See
  1776. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1777. // for more information.
  1778. func (c *AccountsAdunitsGetCall) Fields(s ...googleapi.Field) *AccountsAdunitsGetCall {
  1779. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1780. return c
  1781. }
  1782. // IfNoneMatch sets the optional parameter which makes the operation
  1783. // fail if the object's ETag matches the given value. This is useful for
  1784. // getting updates only after the object has changed since the last
  1785. // request. Use googleapi.IsNotModified to check whether the response
  1786. // error from Do is the result of In-None-Match.
  1787. func (c *AccountsAdunitsGetCall) IfNoneMatch(entityTag string) *AccountsAdunitsGetCall {
  1788. c.ifNoneMatch_ = entityTag
  1789. return c
  1790. }
  1791. // Context sets the context to be used in this call's Do method. Any
  1792. // pending HTTP request will be aborted if the provided context is
  1793. // canceled.
  1794. func (c *AccountsAdunitsGetCall) Context(ctx context.Context) *AccountsAdunitsGetCall {
  1795. c.ctx_ = ctx
  1796. return c
  1797. }
  1798. // Header returns an http.Header that can be modified by the caller to
  1799. // add HTTP headers to the request.
  1800. func (c *AccountsAdunitsGetCall) Header() http.Header {
  1801. if c.header_ == nil {
  1802. c.header_ = make(http.Header)
  1803. }
  1804. return c.header_
  1805. }
  1806. func (c *AccountsAdunitsGetCall) doRequest(alt string) (*http.Response, error) {
  1807. reqHeaders := make(http.Header)
  1808. for k, v := range c.header_ {
  1809. reqHeaders[k] = v
  1810. }
  1811. reqHeaders.Set("User-Agent", c.s.userAgent())
  1812. if c.ifNoneMatch_ != "" {
  1813. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1814. }
  1815. var body io.Reader = nil
  1816. c.urlParams_.Set("alt", alt)
  1817. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}")
  1818. urls += "?" + c.urlParams_.Encode()
  1819. req, _ := http.NewRequest("GET", urls, body)
  1820. req.Header = reqHeaders
  1821. googleapi.Expand(req.URL, map[string]string{
  1822. "accountId": c.accountId,
  1823. "adClientId": c.adClientId,
  1824. "adUnitId": c.adUnitId,
  1825. })
  1826. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1827. }
  1828. // Do executes the "adsense.accounts.adunits.get" call.
  1829. // Exactly one of *AdUnit or error will be non-nil. Any non-2xx status
  1830. // code is an error. Response headers are in either
  1831. // *AdUnit.ServerResponse.Header or (if a response was returned at all)
  1832. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1833. // check whether the returned error was because http.StatusNotModified
  1834. // was returned.
  1835. func (c *AccountsAdunitsGetCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  1836. gensupport.SetOptions(c.urlParams_, opts...)
  1837. res, err := c.doRequest("json")
  1838. if res != nil && res.StatusCode == http.StatusNotModified {
  1839. if res.Body != nil {
  1840. res.Body.Close()
  1841. }
  1842. return nil, &googleapi.Error{
  1843. Code: res.StatusCode,
  1844. Header: res.Header,
  1845. }
  1846. }
  1847. if err != nil {
  1848. return nil, err
  1849. }
  1850. defer googleapi.CloseBody(res)
  1851. if err := googleapi.CheckResponse(res); err != nil {
  1852. return nil, err
  1853. }
  1854. ret := &AdUnit{
  1855. ServerResponse: googleapi.ServerResponse{
  1856. Header: res.Header,
  1857. HTTPStatusCode: res.StatusCode,
  1858. },
  1859. }
  1860. target := &ret
  1861. if err := gensupport.DecodeResponse(target, res); err != nil {
  1862. return nil, err
  1863. }
  1864. return ret, nil
  1865. // {
  1866. // "description": "Gets the specified ad unit in the specified ad client for the specified account.",
  1867. // "httpMethod": "GET",
  1868. // "id": "adsense.accounts.adunits.get",
  1869. // "parameterOrder": [
  1870. // "accountId",
  1871. // "adClientId",
  1872. // "adUnitId"
  1873. // ],
  1874. // "parameters": {
  1875. // "accountId": {
  1876. // "description": "Account to which the ad client belongs.",
  1877. // "location": "path",
  1878. // "required": true,
  1879. // "type": "string"
  1880. // },
  1881. // "adClientId": {
  1882. // "description": "Ad client for which to get the ad unit.",
  1883. // "location": "path",
  1884. // "required": true,
  1885. // "type": "string"
  1886. // },
  1887. // "adUnitId": {
  1888. // "description": "Ad unit to retrieve.",
  1889. // "location": "path",
  1890. // "required": true,
  1891. // "type": "string"
  1892. // }
  1893. // },
  1894. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}",
  1895. // "response": {
  1896. // "$ref": "AdUnit"
  1897. // },
  1898. // "scopes": [
  1899. // "https://www.googleapis.com/auth/adsense",
  1900. // "https://www.googleapis.com/auth/adsense.readonly"
  1901. // ]
  1902. // }
  1903. }
  1904. // method id "adsense.accounts.adunits.getAdCode":
  1905. type AccountsAdunitsGetAdCodeCall struct {
  1906. s *Service
  1907. accountId string
  1908. adClientId string
  1909. adUnitId string
  1910. urlParams_ gensupport.URLParams
  1911. ifNoneMatch_ string
  1912. ctx_ context.Context
  1913. header_ http.Header
  1914. }
  1915. // GetAdCode: Get ad code for the specified ad unit.
  1916. func (r *AccountsAdunitsService) GetAdCode(accountId string, adClientId string, adUnitId string) *AccountsAdunitsGetAdCodeCall {
  1917. c := &AccountsAdunitsGetAdCodeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1918. c.accountId = accountId
  1919. c.adClientId = adClientId
  1920. c.adUnitId = adUnitId
  1921. return c
  1922. }
  1923. // Fields allows partial responses to be retrieved. See
  1924. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1925. // for more information.
  1926. func (c *AccountsAdunitsGetAdCodeCall) Fields(s ...googleapi.Field) *AccountsAdunitsGetAdCodeCall {
  1927. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1928. return c
  1929. }
  1930. // IfNoneMatch sets the optional parameter which makes the operation
  1931. // fail if the object's ETag matches the given value. This is useful for
  1932. // getting updates only after the object has changed since the last
  1933. // request. Use googleapi.IsNotModified to check whether the response
  1934. // error from Do is the result of In-None-Match.
  1935. func (c *AccountsAdunitsGetAdCodeCall) IfNoneMatch(entityTag string) *AccountsAdunitsGetAdCodeCall {
  1936. c.ifNoneMatch_ = entityTag
  1937. return c
  1938. }
  1939. // Context sets the context to be used in this call's Do method. Any
  1940. // pending HTTP request will be aborted if the provided context is
  1941. // canceled.
  1942. func (c *AccountsAdunitsGetAdCodeCall) Context(ctx context.Context) *AccountsAdunitsGetAdCodeCall {
  1943. c.ctx_ = ctx
  1944. return c
  1945. }
  1946. // Header returns an http.Header that can be modified by the caller to
  1947. // add HTTP headers to the request.
  1948. func (c *AccountsAdunitsGetAdCodeCall) Header() http.Header {
  1949. if c.header_ == nil {
  1950. c.header_ = make(http.Header)
  1951. }
  1952. return c.header_
  1953. }
  1954. func (c *AccountsAdunitsGetAdCodeCall) doRequest(alt string) (*http.Response, error) {
  1955. reqHeaders := make(http.Header)
  1956. for k, v := range c.header_ {
  1957. reqHeaders[k] = v
  1958. }
  1959. reqHeaders.Set("User-Agent", c.s.userAgent())
  1960. if c.ifNoneMatch_ != "" {
  1961. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1962. }
  1963. var body io.Reader = nil
  1964. c.urlParams_.Set("alt", alt)
  1965. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/adcode")
  1966. urls += "?" + c.urlParams_.Encode()
  1967. req, _ := http.NewRequest("GET", urls, body)
  1968. req.Header = reqHeaders
  1969. googleapi.Expand(req.URL, map[string]string{
  1970. "accountId": c.accountId,
  1971. "adClientId": c.adClientId,
  1972. "adUnitId": c.adUnitId,
  1973. })
  1974. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1975. }
  1976. // Do executes the "adsense.accounts.adunits.getAdCode" call.
  1977. // Exactly one of *AdCode or error will be non-nil. Any non-2xx status
  1978. // code is an error. Response headers are in either
  1979. // *AdCode.ServerResponse.Header or (if a response was returned at all)
  1980. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1981. // check whether the returned error was because http.StatusNotModified
  1982. // was returned.
  1983. func (c *AccountsAdunitsGetAdCodeCall) Do(opts ...googleapi.CallOption) (*AdCode, error) {
  1984. gensupport.SetOptions(c.urlParams_, opts...)
  1985. res, err := c.doRequest("json")
  1986. if res != nil && res.StatusCode == http.StatusNotModified {
  1987. if res.Body != nil {
  1988. res.Body.Close()
  1989. }
  1990. return nil, &googleapi.Error{
  1991. Code: res.StatusCode,
  1992. Header: res.Header,
  1993. }
  1994. }
  1995. if err != nil {
  1996. return nil, err
  1997. }
  1998. defer googleapi.CloseBody(res)
  1999. if err := googleapi.CheckResponse(res); err != nil {
  2000. return nil, err
  2001. }
  2002. ret := &AdCode{
  2003. ServerResponse: googleapi.ServerResponse{
  2004. Header: res.Header,
  2005. HTTPStatusCode: res.StatusCode,
  2006. },
  2007. }
  2008. target := &ret
  2009. if err := gensupport.DecodeResponse(target, res); err != nil {
  2010. return nil, err
  2011. }
  2012. return ret, nil
  2013. // {
  2014. // "description": "Get ad code for the specified ad unit.",
  2015. // "httpMethod": "GET",
  2016. // "id": "adsense.accounts.adunits.getAdCode",
  2017. // "parameterOrder": [
  2018. // "accountId",
  2019. // "adClientId",
  2020. // "adUnitId"
  2021. // ],
  2022. // "parameters": {
  2023. // "accountId": {
  2024. // "description": "Account which contains the ad client.",
  2025. // "location": "path",
  2026. // "required": true,
  2027. // "type": "string"
  2028. // },
  2029. // "adClientId": {
  2030. // "description": "Ad client with contains the ad unit.",
  2031. // "location": "path",
  2032. // "required": true,
  2033. // "type": "string"
  2034. // },
  2035. // "adUnitId": {
  2036. // "description": "Ad unit to get the code for.",
  2037. // "location": "path",
  2038. // "required": true,
  2039. // "type": "string"
  2040. // }
  2041. // },
  2042. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/adcode",
  2043. // "response": {
  2044. // "$ref": "AdCode"
  2045. // },
  2046. // "scopes": [
  2047. // "https://www.googleapis.com/auth/adsense",
  2048. // "https://www.googleapis.com/auth/adsense.readonly"
  2049. // ]
  2050. // }
  2051. }
  2052. // method id "adsense.accounts.adunits.list":
  2053. type AccountsAdunitsListCall struct {
  2054. s *Service
  2055. accountId string
  2056. adClientId string
  2057. urlParams_ gensupport.URLParams
  2058. ifNoneMatch_ string
  2059. ctx_ context.Context
  2060. header_ http.Header
  2061. }
  2062. // List: List all ad units in the specified ad client for the specified
  2063. // account.
  2064. func (r *AccountsAdunitsService) List(accountId string, adClientId string) *AccountsAdunitsListCall {
  2065. c := &AccountsAdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2066. c.accountId = accountId
  2067. c.adClientId = adClientId
  2068. return c
  2069. }
  2070. // IncludeInactive sets the optional parameter "includeInactive":
  2071. // Whether to include inactive ad units. Default: true.
  2072. func (c *AccountsAdunitsListCall) IncludeInactive(includeInactive bool) *AccountsAdunitsListCall {
  2073. c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive))
  2074. return c
  2075. }
  2076. // MaxResults sets the optional parameter "maxResults": The maximum
  2077. // number of ad units to include in the response, used for paging.
  2078. func (c *AccountsAdunitsListCall) MaxResults(maxResults int64) *AccountsAdunitsListCall {
  2079. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2080. return c
  2081. }
  2082. // PageToken sets the optional parameter "pageToken": A continuation
  2083. // token, used to page through ad units. To retrieve the next page, set
  2084. // this parameter to the value of "nextPageToken" from the previous
  2085. // response.
  2086. func (c *AccountsAdunitsListCall) PageToken(pageToken string) *AccountsAdunitsListCall {
  2087. c.urlParams_.Set("pageToken", pageToken)
  2088. return c
  2089. }
  2090. // Fields allows partial responses to be retrieved. See
  2091. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2092. // for more information.
  2093. func (c *AccountsAdunitsListCall) Fields(s ...googleapi.Field) *AccountsAdunitsListCall {
  2094. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2095. return c
  2096. }
  2097. // IfNoneMatch sets the optional parameter which makes the operation
  2098. // fail if the object's ETag matches the given value. This is useful for
  2099. // getting updates only after the object has changed since the last
  2100. // request. Use googleapi.IsNotModified to check whether the response
  2101. // error from Do is the result of In-None-Match.
  2102. func (c *AccountsAdunitsListCall) IfNoneMatch(entityTag string) *AccountsAdunitsListCall {
  2103. c.ifNoneMatch_ = entityTag
  2104. return c
  2105. }
  2106. // Context sets the context to be used in this call's Do method. Any
  2107. // pending HTTP request will be aborted if the provided context is
  2108. // canceled.
  2109. func (c *AccountsAdunitsListCall) Context(ctx context.Context) *AccountsAdunitsListCall {
  2110. c.ctx_ = ctx
  2111. return c
  2112. }
  2113. // Header returns an http.Header that can be modified by the caller to
  2114. // add HTTP headers to the request.
  2115. func (c *AccountsAdunitsListCall) Header() http.Header {
  2116. if c.header_ == nil {
  2117. c.header_ = make(http.Header)
  2118. }
  2119. return c.header_
  2120. }
  2121. func (c *AccountsAdunitsListCall) doRequest(alt string) (*http.Response, error) {
  2122. reqHeaders := make(http.Header)
  2123. for k, v := range c.header_ {
  2124. reqHeaders[k] = v
  2125. }
  2126. reqHeaders.Set("User-Agent", c.s.userAgent())
  2127. if c.ifNoneMatch_ != "" {
  2128. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2129. }
  2130. var body io.Reader = nil
  2131. c.urlParams_.Set("alt", alt)
  2132. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
  2133. urls += "?" + c.urlParams_.Encode()
  2134. req, _ := http.NewRequest("GET", urls, body)
  2135. req.Header = reqHeaders
  2136. googleapi.Expand(req.URL, map[string]string{
  2137. "accountId": c.accountId,
  2138. "adClientId": c.adClientId,
  2139. })
  2140. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2141. }
  2142. // Do executes the "adsense.accounts.adunits.list" call.
  2143. // Exactly one of *AdUnits or error will be non-nil. Any non-2xx status
  2144. // code is an error. Response headers are in either
  2145. // *AdUnits.ServerResponse.Header or (if a response was returned at all)
  2146. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2147. // check whether the returned error was because http.StatusNotModified
  2148. // was returned.
  2149. func (c *AccountsAdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) {
  2150. gensupport.SetOptions(c.urlParams_, opts...)
  2151. res, err := c.doRequest("json")
  2152. if res != nil && res.StatusCode == http.StatusNotModified {
  2153. if res.Body != nil {
  2154. res.Body.Close()
  2155. }
  2156. return nil, &googleapi.Error{
  2157. Code: res.StatusCode,
  2158. Header: res.Header,
  2159. }
  2160. }
  2161. if err != nil {
  2162. return nil, err
  2163. }
  2164. defer googleapi.CloseBody(res)
  2165. if err := googleapi.CheckResponse(res); err != nil {
  2166. return nil, err
  2167. }
  2168. ret := &AdUnits{
  2169. ServerResponse: googleapi.ServerResponse{
  2170. Header: res.Header,
  2171. HTTPStatusCode: res.StatusCode,
  2172. },
  2173. }
  2174. target := &ret
  2175. if err := gensupport.DecodeResponse(target, res); err != nil {
  2176. return nil, err
  2177. }
  2178. return ret, nil
  2179. // {
  2180. // "description": "List all ad units in the specified ad client for the specified account.",
  2181. // "httpMethod": "GET",
  2182. // "id": "adsense.accounts.adunits.list",
  2183. // "parameterOrder": [
  2184. // "accountId",
  2185. // "adClientId"
  2186. // ],
  2187. // "parameters": {
  2188. // "accountId": {
  2189. // "description": "Account to which the ad client belongs.",
  2190. // "location": "path",
  2191. // "required": true,
  2192. // "type": "string"
  2193. // },
  2194. // "adClientId": {
  2195. // "description": "Ad client for which to list ad units.",
  2196. // "location": "path",
  2197. // "required": true,
  2198. // "type": "string"
  2199. // },
  2200. // "includeInactive": {
  2201. // "description": "Whether to include inactive ad units. Default: true.",
  2202. // "location": "query",
  2203. // "type": "boolean"
  2204. // },
  2205. // "maxResults": {
  2206. // "description": "The maximum number of ad units to include in the response, used for paging.",
  2207. // "format": "int32",
  2208. // "location": "query",
  2209. // "maximum": "10000",
  2210. // "minimum": "0",
  2211. // "type": "integer"
  2212. // },
  2213. // "pageToken": {
  2214. // "description": "A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  2215. // "location": "query",
  2216. // "type": "string"
  2217. // }
  2218. // },
  2219. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits",
  2220. // "response": {
  2221. // "$ref": "AdUnits"
  2222. // },
  2223. // "scopes": [
  2224. // "https://www.googleapis.com/auth/adsense",
  2225. // "https://www.googleapis.com/auth/adsense.readonly"
  2226. // ]
  2227. // }
  2228. }
  2229. // Pages invokes f for each page of results.
  2230. // A non-nil error returned from f will halt the iteration.
  2231. // The provided context supersedes any context provided to the Context method.
  2232. func (c *AccountsAdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error {
  2233. c.ctx_ = ctx
  2234. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2235. for {
  2236. x, err := c.Do()
  2237. if err != nil {
  2238. return err
  2239. }
  2240. if err := f(x); err != nil {
  2241. return err
  2242. }
  2243. if x.NextPageToken == "" {
  2244. return nil
  2245. }
  2246. c.PageToken(x.NextPageToken)
  2247. }
  2248. }
  2249. // method id "adsense.accounts.adunits.customchannels.list":
  2250. type AccountsAdunitsCustomchannelsListCall struct {
  2251. s *Service
  2252. accountId string
  2253. adClientId string
  2254. adUnitId string
  2255. urlParams_ gensupport.URLParams
  2256. ifNoneMatch_ string
  2257. ctx_ context.Context
  2258. header_ http.Header
  2259. }
  2260. // List: List all custom channels which the specified ad unit belongs
  2261. // to.
  2262. func (r *AccountsAdunitsCustomchannelsService) List(accountId string, adClientId string, adUnitId string) *AccountsAdunitsCustomchannelsListCall {
  2263. c := &AccountsAdunitsCustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2264. c.accountId = accountId
  2265. c.adClientId = adClientId
  2266. c.adUnitId = adUnitId
  2267. return c
  2268. }
  2269. // MaxResults sets the optional parameter "maxResults": The maximum
  2270. // number of custom channels to include in the response, used for
  2271. // paging.
  2272. func (c *AccountsAdunitsCustomchannelsListCall) MaxResults(maxResults int64) *AccountsAdunitsCustomchannelsListCall {
  2273. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2274. return c
  2275. }
  2276. // PageToken sets the optional parameter "pageToken": A continuation
  2277. // token, used to page through custom channels. To retrieve the next
  2278. // page, set this parameter to the value of "nextPageToken" from the
  2279. // previous response.
  2280. func (c *AccountsAdunitsCustomchannelsListCall) PageToken(pageToken string) *AccountsAdunitsCustomchannelsListCall {
  2281. c.urlParams_.Set("pageToken", pageToken)
  2282. return c
  2283. }
  2284. // Fields allows partial responses to be retrieved. See
  2285. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2286. // for more information.
  2287. func (c *AccountsAdunitsCustomchannelsListCall) Fields(s ...googleapi.Field) *AccountsAdunitsCustomchannelsListCall {
  2288. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2289. return c
  2290. }
  2291. // IfNoneMatch sets the optional parameter which makes the operation
  2292. // fail if the object's ETag matches the given value. This is useful for
  2293. // getting updates only after the object has changed since the last
  2294. // request. Use googleapi.IsNotModified to check whether the response
  2295. // error from Do is the result of In-None-Match.
  2296. func (c *AccountsAdunitsCustomchannelsListCall) IfNoneMatch(entityTag string) *AccountsAdunitsCustomchannelsListCall {
  2297. c.ifNoneMatch_ = entityTag
  2298. return c
  2299. }
  2300. // Context sets the context to be used in this call's Do method. Any
  2301. // pending HTTP request will be aborted if the provided context is
  2302. // canceled.
  2303. func (c *AccountsAdunitsCustomchannelsListCall) Context(ctx context.Context) *AccountsAdunitsCustomchannelsListCall {
  2304. c.ctx_ = ctx
  2305. return c
  2306. }
  2307. // Header returns an http.Header that can be modified by the caller to
  2308. // add HTTP headers to the request.
  2309. func (c *AccountsAdunitsCustomchannelsListCall) Header() http.Header {
  2310. if c.header_ == nil {
  2311. c.header_ = make(http.Header)
  2312. }
  2313. return c.header_
  2314. }
  2315. func (c *AccountsAdunitsCustomchannelsListCall) doRequest(alt string) (*http.Response, error) {
  2316. reqHeaders := make(http.Header)
  2317. for k, v := range c.header_ {
  2318. reqHeaders[k] = v
  2319. }
  2320. reqHeaders.Set("User-Agent", c.s.userAgent())
  2321. if c.ifNoneMatch_ != "" {
  2322. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2323. }
  2324. var body io.Reader = nil
  2325. c.urlParams_.Set("alt", alt)
  2326. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/customchannels")
  2327. urls += "?" + c.urlParams_.Encode()
  2328. req, _ := http.NewRequest("GET", urls, body)
  2329. req.Header = reqHeaders
  2330. googleapi.Expand(req.URL, map[string]string{
  2331. "accountId": c.accountId,
  2332. "adClientId": c.adClientId,
  2333. "adUnitId": c.adUnitId,
  2334. })
  2335. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2336. }
  2337. // Do executes the "adsense.accounts.adunits.customchannels.list" call.
  2338. // Exactly one of *CustomChannels or error will be non-nil. Any non-2xx
  2339. // status code is an error. Response headers are in either
  2340. // *CustomChannels.ServerResponse.Header or (if a response was returned
  2341. // at all) in error.(*googleapi.Error).Header. Use
  2342. // googleapi.IsNotModified to check whether the returned error was
  2343. // because http.StatusNotModified was returned.
  2344. func (c *AccountsAdunitsCustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) {
  2345. gensupport.SetOptions(c.urlParams_, opts...)
  2346. res, err := c.doRequest("json")
  2347. if res != nil && res.StatusCode == http.StatusNotModified {
  2348. if res.Body != nil {
  2349. res.Body.Close()
  2350. }
  2351. return nil, &googleapi.Error{
  2352. Code: res.StatusCode,
  2353. Header: res.Header,
  2354. }
  2355. }
  2356. if err != nil {
  2357. return nil, err
  2358. }
  2359. defer googleapi.CloseBody(res)
  2360. if err := googleapi.CheckResponse(res); err != nil {
  2361. return nil, err
  2362. }
  2363. ret := &CustomChannels{
  2364. ServerResponse: googleapi.ServerResponse{
  2365. Header: res.Header,
  2366. HTTPStatusCode: res.StatusCode,
  2367. },
  2368. }
  2369. target := &ret
  2370. if err := gensupport.DecodeResponse(target, res); err != nil {
  2371. return nil, err
  2372. }
  2373. return ret, nil
  2374. // {
  2375. // "description": "List all custom channels which the specified ad unit belongs to.",
  2376. // "httpMethod": "GET",
  2377. // "id": "adsense.accounts.adunits.customchannels.list",
  2378. // "parameterOrder": [
  2379. // "accountId",
  2380. // "adClientId",
  2381. // "adUnitId"
  2382. // ],
  2383. // "parameters": {
  2384. // "accountId": {
  2385. // "description": "Account to which the ad client belongs.",
  2386. // "location": "path",
  2387. // "required": true,
  2388. // "type": "string"
  2389. // },
  2390. // "adClientId": {
  2391. // "description": "Ad client which contains the ad unit.",
  2392. // "location": "path",
  2393. // "required": true,
  2394. // "type": "string"
  2395. // },
  2396. // "adUnitId": {
  2397. // "description": "Ad unit for which to list custom channels.",
  2398. // "location": "path",
  2399. // "required": true,
  2400. // "type": "string"
  2401. // },
  2402. // "maxResults": {
  2403. // "description": "The maximum number of custom channels to include in the response, used for paging.",
  2404. // "format": "int32",
  2405. // "location": "query",
  2406. // "maximum": "10000",
  2407. // "minimum": "0",
  2408. // "type": "integer"
  2409. // },
  2410. // "pageToken": {
  2411. // "description": "A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  2412. // "location": "query",
  2413. // "type": "string"
  2414. // }
  2415. // },
  2416. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/customchannels",
  2417. // "response": {
  2418. // "$ref": "CustomChannels"
  2419. // },
  2420. // "scopes": [
  2421. // "https://www.googleapis.com/auth/adsense",
  2422. // "https://www.googleapis.com/auth/adsense.readonly"
  2423. // ]
  2424. // }
  2425. }
  2426. // Pages invokes f for each page of results.
  2427. // A non-nil error returned from f will halt the iteration.
  2428. // The provided context supersedes any context provided to the Context method.
  2429. func (c *AccountsAdunitsCustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error {
  2430. c.ctx_ = ctx
  2431. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2432. for {
  2433. x, err := c.Do()
  2434. if err != nil {
  2435. return err
  2436. }
  2437. if err := f(x); err != nil {
  2438. return err
  2439. }
  2440. if x.NextPageToken == "" {
  2441. return nil
  2442. }
  2443. c.PageToken(x.NextPageToken)
  2444. }
  2445. }
  2446. // method id "adsense.accounts.alerts.list":
  2447. type AccountsAlertsListCall struct {
  2448. s *Service
  2449. accountId string
  2450. urlParams_ gensupport.URLParams
  2451. ifNoneMatch_ string
  2452. ctx_ context.Context
  2453. header_ http.Header
  2454. }
  2455. // List: List the alerts for the specified AdSense account.
  2456. func (r *AccountsAlertsService) List(accountId string) *AccountsAlertsListCall {
  2457. c := &AccountsAlertsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2458. c.accountId = accountId
  2459. return c
  2460. }
  2461. // Locale sets the optional parameter "locale": The locale to use for
  2462. // translating alert messages. The account locale will be used if this
  2463. // is not supplied. The AdSense default (English) will be used if the
  2464. // supplied locale is invalid or unsupported.
  2465. func (c *AccountsAlertsListCall) Locale(locale string) *AccountsAlertsListCall {
  2466. c.urlParams_.Set("locale", locale)
  2467. return c
  2468. }
  2469. // Fields allows partial responses to be retrieved. See
  2470. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2471. // for more information.
  2472. func (c *AccountsAlertsListCall) Fields(s ...googleapi.Field) *AccountsAlertsListCall {
  2473. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2474. return c
  2475. }
  2476. // IfNoneMatch sets the optional parameter which makes the operation
  2477. // fail if the object's ETag matches the given value. This is useful for
  2478. // getting updates only after the object has changed since the last
  2479. // request. Use googleapi.IsNotModified to check whether the response
  2480. // error from Do is the result of In-None-Match.
  2481. func (c *AccountsAlertsListCall) IfNoneMatch(entityTag string) *AccountsAlertsListCall {
  2482. c.ifNoneMatch_ = entityTag
  2483. return c
  2484. }
  2485. // Context sets the context to be used in this call's Do method. Any
  2486. // pending HTTP request will be aborted if the provided context is
  2487. // canceled.
  2488. func (c *AccountsAlertsListCall) Context(ctx context.Context) *AccountsAlertsListCall {
  2489. c.ctx_ = ctx
  2490. return c
  2491. }
  2492. // Header returns an http.Header that can be modified by the caller to
  2493. // add HTTP headers to the request.
  2494. func (c *AccountsAlertsListCall) Header() http.Header {
  2495. if c.header_ == nil {
  2496. c.header_ = make(http.Header)
  2497. }
  2498. return c.header_
  2499. }
  2500. func (c *AccountsAlertsListCall) doRequest(alt string) (*http.Response, error) {
  2501. reqHeaders := make(http.Header)
  2502. for k, v := range c.header_ {
  2503. reqHeaders[k] = v
  2504. }
  2505. reqHeaders.Set("User-Agent", c.s.userAgent())
  2506. if c.ifNoneMatch_ != "" {
  2507. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2508. }
  2509. var body io.Reader = nil
  2510. c.urlParams_.Set("alt", alt)
  2511. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/alerts")
  2512. urls += "?" + c.urlParams_.Encode()
  2513. req, _ := http.NewRequest("GET", urls, body)
  2514. req.Header = reqHeaders
  2515. googleapi.Expand(req.URL, map[string]string{
  2516. "accountId": c.accountId,
  2517. })
  2518. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2519. }
  2520. // Do executes the "adsense.accounts.alerts.list" call.
  2521. // Exactly one of *Alerts or error will be non-nil. Any non-2xx status
  2522. // code is an error. Response headers are in either
  2523. // *Alerts.ServerResponse.Header or (if a response was returned at all)
  2524. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2525. // check whether the returned error was because http.StatusNotModified
  2526. // was returned.
  2527. func (c *AccountsAlertsListCall) Do(opts ...googleapi.CallOption) (*Alerts, error) {
  2528. gensupport.SetOptions(c.urlParams_, opts...)
  2529. res, err := c.doRequest("json")
  2530. if res != nil && res.StatusCode == http.StatusNotModified {
  2531. if res.Body != nil {
  2532. res.Body.Close()
  2533. }
  2534. return nil, &googleapi.Error{
  2535. Code: res.StatusCode,
  2536. Header: res.Header,
  2537. }
  2538. }
  2539. if err != nil {
  2540. return nil, err
  2541. }
  2542. defer googleapi.CloseBody(res)
  2543. if err := googleapi.CheckResponse(res); err != nil {
  2544. return nil, err
  2545. }
  2546. ret := &Alerts{
  2547. ServerResponse: googleapi.ServerResponse{
  2548. Header: res.Header,
  2549. HTTPStatusCode: res.StatusCode,
  2550. },
  2551. }
  2552. target := &ret
  2553. if err := gensupport.DecodeResponse(target, res); err != nil {
  2554. return nil, err
  2555. }
  2556. return ret, nil
  2557. // {
  2558. // "description": "List the alerts for the specified AdSense account.",
  2559. // "httpMethod": "GET",
  2560. // "id": "adsense.accounts.alerts.list",
  2561. // "parameterOrder": [
  2562. // "accountId"
  2563. // ],
  2564. // "parameters": {
  2565. // "accountId": {
  2566. // "description": "Account for which to retrieve the alerts.",
  2567. // "location": "path",
  2568. // "required": true,
  2569. // "type": "string"
  2570. // },
  2571. // "locale": {
  2572. // "description": "The locale to use for translating alert messages. The account locale will be used if this is not supplied. The AdSense default (English) will be used if the supplied locale is invalid or unsupported.",
  2573. // "location": "query",
  2574. // "type": "string"
  2575. // }
  2576. // },
  2577. // "path": "accounts/{accountId}/alerts",
  2578. // "response": {
  2579. // "$ref": "Alerts"
  2580. // },
  2581. // "scopes": [
  2582. // "https://www.googleapis.com/auth/adsense",
  2583. // "https://www.googleapis.com/auth/adsense.readonly"
  2584. // ]
  2585. // }
  2586. }
  2587. // method id "adsense.accounts.customchannels.get":
  2588. type AccountsCustomchannelsGetCall struct {
  2589. s *Service
  2590. accountId string
  2591. adClientId string
  2592. customChannelId string
  2593. urlParams_ gensupport.URLParams
  2594. ifNoneMatch_ string
  2595. ctx_ context.Context
  2596. header_ http.Header
  2597. }
  2598. // Get: Get the specified custom channel from the specified ad client
  2599. // for the specified account.
  2600. func (r *AccountsCustomchannelsService) Get(accountId string, adClientId string, customChannelId string) *AccountsCustomchannelsGetCall {
  2601. c := &AccountsCustomchannelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2602. c.accountId = accountId
  2603. c.adClientId = adClientId
  2604. c.customChannelId = customChannelId
  2605. return c
  2606. }
  2607. // Fields allows partial responses to be retrieved. See
  2608. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2609. // for more information.
  2610. func (c *AccountsCustomchannelsGetCall) Fields(s ...googleapi.Field) *AccountsCustomchannelsGetCall {
  2611. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2612. return c
  2613. }
  2614. // IfNoneMatch sets the optional parameter which makes the operation
  2615. // fail if the object's ETag matches the given value. This is useful for
  2616. // getting updates only after the object has changed since the last
  2617. // request. Use googleapi.IsNotModified to check whether the response
  2618. // error from Do is the result of In-None-Match.
  2619. func (c *AccountsCustomchannelsGetCall) IfNoneMatch(entityTag string) *AccountsCustomchannelsGetCall {
  2620. c.ifNoneMatch_ = entityTag
  2621. return c
  2622. }
  2623. // Context sets the context to be used in this call's Do method. Any
  2624. // pending HTTP request will be aborted if the provided context is
  2625. // canceled.
  2626. func (c *AccountsCustomchannelsGetCall) Context(ctx context.Context) *AccountsCustomchannelsGetCall {
  2627. c.ctx_ = ctx
  2628. return c
  2629. }
  2630. // Header returns an http.Header that can be modified by the caller to
  2631. // add HTTP headers to the request.
  2632. func (c *AccountsCustomchannelsGetCall) Header() http.Header {
  2633. if c.header_ == nil {
  2634. c.header_ = make(http.Header)
  2635. }
  2636. return c.header_
  2637. }
  2638. func (c *AccountsCustomchannelsGetCall) doRequest(alt string) (*http.Response, error) {
  2639. reqHeaders := make(http.Header)
  2640. for k, v := range c.header_ {
  2641. reqHeaders[k] = v
  2642. }
  2643. reqHeaders.Set("User-Agent", c.s.userAgent())
  2644. if c.ifNoneMatch_ != "" {
  2645. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2646. }
  2647. var body io.Reader = nil
  2648. c.urlParams_.Set("alt", alt)
  2649. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}")
  2650. urls += "?" + c.urlParams_.Encode()
  2651. req, _ := http.NewRequest("GET", urls, body)
  2652. req.Header = reqHeaders
  2653. googleapi.Expand(req.URL, map[string]string{
  2654. "accountId": c.accountId,
  2655. "adClientId": c.adClientId,
  2656. "customChannelId": c.customChannelId,
  2657. })
  2658. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2659. }
  2660. // Do executes the "adsense.accounts.customchannels.get" call.
  2661. // Exactly one of *CustomChannel or error will be non-nil. Any non-2xx
  2662. // status code is an error. Response headers are in either
  2663. // *CustomChannel.ServerResponse.Header or (if a response was returned
  2664. // at all) in error.(*googleapi.Error).Header. Use
  2665. // googleapi.IsNotModified to check whether the returned error was
  2666. // because http.StatusNotModified was returned.
  2667. func (c *AccountsCustomchannelsGetCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  2668. gensupport.SetOptions(c.urlParams_, opts...)
  2669. res, err := c.doRequest("json")
  2670. if res != nil && res.StatusCode == http.StatusNotModified {
  2671. if res.Body != nil {
  2672. res.Body.Close()
  2673. }
  2674. return nil, &googleapi.Error{
  2675. Code: res.StatusCode,
  2676. Header: res.Header,
  2677. }
  2678. }
  2679. if err != nil {
  2680. return nil, err
  2681. }
  2682. defer googleapi.CloseBody(res)
  2683. if err := googleapi.CheckResponse(res); err != nil {
  2684. return nil, err
  2685. }
  2686. ret := &CustomChannel{
  2687. ServerResponse: googleapi.ServerResponse{
  2688. Header: res.Header,
  2689. HTTPStatusCode: res.StatusCode,
  2690. },
  2691. }
  2692. target := &ret
  2693. if err := gensupport.DecodeResponse(target, res); err != nil {
  2694. return nil, err
  2695. }
  2696. return ret, nil
  2697. // {
  2698. // "description": "Get the specified custom channel from the specified ad client for the specified account.",
  2699. // "httpMethod": "GET",
  2700. // "id": "adsense.accounts.customchannels.get",
  2701. // "parameterOrder": [
  2702. // "accountId",
  2703. // "adClientId",
  2704. // "customChannelId"
  2705. // ],
  2706. // "parameters": {
  2707. // "accountId": {
  2708. // "description": "Account to which the ad client belongs.",
  2709. // "location": "path",
  2710. // "required": true,
  2711. // "type": "string"
  2712. // },
  2713. // "adClientId": {
  2714. // "description": "Ad client which contains the custom channel.",
  2715. // "location": "path",
  2716. // "required": true,
  2717. // "type": "string"
  2718. // },
  2719. // "customChannelId": {
  2720. // "description": "Custom channel to retrieve.",
  2721. // "location": "path",
  2722. // "required": true,
  2723. // "type": "string"
  2724. // }
  2725. // },
  2726. // "path": "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}",
  2727. // "response": {
  2728. // "$ref": "CustomChannel"
  2729. // },
  2730. // "scopes": [
  2731. // "https://www.googleapis.com/auth/adsense",
  2732. // "https://www.googleapis.com/auth/adsense.readonly"
  2733. // ]
  2734. // }
  2735. }
  2736. // method id "adsense.accounts.customchannels.list":
  2737. type AccountsCustomchannelsListCall struct {
  2738. s *Service
  2739. accountId string
  2740. adClientId string
  2741. urlParams_ gensupport.URLParams
  2742. ifNoneMatch_ string
  2743. ctx_ context.Context
  2744. header_ http.Header
  2745. }
  2746. // List: List all custom channels in the specified ad client for the
  2747. // specified account.
  2748. func (r *AccountsCustomchannelsService) List(accountId string, adClientId string) *AccountsCustomchannelsListCall {
  2749. c := &AccountsCustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2750. c.accountId = accountId
  2751. c.adClientId = adClientId
  2752. return c
  2753. }
  2754. // MaxResults sets the optional parameter "maxResults": The maximum
  2755. // number of custom channels to include in the response, used for
  2756. // paging.
  2757. func (c *AccountsCustomchannelsListCall) MaxResults(maxResults int64) *AccountsCustomchannelsListCall {
  2758. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2759. return c
  2760. }
  2761. // PageToken sets the optional parameter "pageToken": A continuation
  2762. // token, used to page through custom channels. To retrieve the next
  2763. // page, set this parameter to the value of "nextPageToken" from the
  2764. // previous response.
  2765. func (c *AccountsCustomchannelsListCall) PageToken(pageToken string) *AccountsCustomchannelsListCall {
  2766. c.urlParams_.Set("pageToken", pageToken)
  2767. return c
  2768. }
  2769. // Fields allows partial responses to be retrieved. See
  2770. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2771. // for more information.
  2772. func (c *AccountsCustomchannelsListCall) Fields(s ...googleapi.Field) *AccountsCustomchannelsListCall {
  2773. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2774. return c
  2775. }
  2776. // IfNoneMatch sets the optional parameter which makes the operation
  2777. // fail if the object's ETag matches the given value. This is useful for
  2778. // getting updates only after the object has changed since the last
  2779. // request. Use googleapi.IsNotModified to check whether the response
  2780. // error from Do is the result of In-None-Match.
  2781. func (c *AccountsCustomchannelsListCall) IfNoneMatch(entityTag string) *AccountsCustomchannelsListCall {
  2782. c.ifNoneMatch_ = entityTag
  2783. return c
  2784. }
  2785. // Context sets the context to be used in this call's Do method. Any
  2786. // pending HTTP request will be aborted if the provided context is
  2787. // canceled.
  2788. func (c *AccountsCustomchannelsListCall) Context(ctx context.Context) *AccountsCustomchannelsListCall {
  2789. c.ctx_ = ctx
  2790. return c
  2791. }
  2792. // Header returns an http.Header that can be modified by the caller to
  2793. // add HTTP headers to the request.
  2794. func (c *AccountsCustomchannelsListCall) Header() http.Header {
  2795. if c.header_ == nil {
  2796. c.header_ = make(http.Header)
  2797. }
  2798. return c.header_
  2799. }
  2800. func (c *AccountsCustomchannelsListCall) doRequest(alt string) (*http.Response, error) {
  2801. reqHeaders := make(http.Header)
  2802. for k, v := range c.header_ {
  2803. reqHeaders[k] = v
  2804. }
  2805. reqHeaders.Set("User-Agent", c.s.userAgent())
  2806. if c.ifNoneMatch_ != "" {
  2807. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2808. }
  2809. var body io.Reader = nil
  2810. c.urlParams_.Set("alt", alt)
  2811. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/customchannels")
  2812. urls += "?" + c.urlParams_.Encode()
  2813. req, _ := http.NewRequest("GET", urls, body)
  2814. req.Header = reqHeaders
  2815. googleapi.Expand(req.URL, map[string]string{
  2816. "accountId": c.accountId,
  2817. "adClientId": c.adClientId,
  2818. })
  2819. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2820. }
  2821. // Do executes the "adsense.accounts.customchannels.list" call.
  2822. // Exactly one of *CustomChannels or error will be non-nil. Any non-2xx
  2823. // status code is an error. Response headers are in either
  2824. // *CustomChannels.ServerResponse.Header or (if a response was returned
  2825. // at all) in error.(*googleapi.Error).Header. Use
  2826. // googleapi.IsNotModified to check whether the returned error was
  2827. // because http.StatusNotModified was returned.
  2828. func (c *AccountsCustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) {
  2829. gensupport.SetOptions(c.urlParams_, opts...)
  2830. res, err := c.doRequest("json")
  2831. if res != nil && res.StatusCode == http.StatusNotModified {
  2832. if res.Body != nil {
  2833. res.Body.Close()
  2834. }
  2835. return nil, &googleapi.Error{
  2836. Code: res.StatusCode,
  2837. Header: res.Header,
  2838. }
  2839. }
  2840. if err != nil {
  2841. return nil, err
  2842. }
  2843. defer googleapi.CloseBody(res)
  2844. if err := googleapi.CheckResponse(res); err != nil {
  2845. return nil, err
  2846. }
  2847. ret := &CustomChannels{
  2848. ServerResponse: googleapi.ServerResponse{
  2849. Header: res.Header,
  2850. HTTPStatusCode: res.StatusCode,
  2851. },
  2852. }
  2853. target := &ret
  2854. if err := gensupport.DecodeResponse(target, res); err != nil {
  2855. return nil, err
  2856. }
  2857. return ret, nil
  2858. // {
  2859. // "description": "List all custom channels in the specified ad client for the specified account.",
  2860. // "httpMethod": "GET",
  2861. // "id": "adsense.accounts.customchannels.list",
  2862. // "parameterOrder": [
  2863. // "accountId",
  2864. // "adClientId"
  2865. // ],
  2866. // "parameters": {
  2867. // "accountId": {
  2868. // "description": "Account to which the ad client belongs.",
  2869. // "location": "path",
  2870. // "required": true,
  2871. // "type": "string"
  2872. // },
  2873. // "adClientId": {
  2874. // "description": "Ad client for which to list custom channels.",
  2875. // "location": "path",
  2876. // "required": true,
  2877. // "type": "string"
  2878. // },
  2879. // "maxResults": {
  2880. // "description": "The maximum number of custom channels to include in the response, used for paging.",
  2881. // "format": "int32",
  2882. // "location": "query",
  2883. // "maximum": "10000",
  2884. // "minimum": "0",
  2885. // "type": "integer"
  2886. // },
  2887. // "pageToken": {
  2888. // "description": "A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  2889. // "location": "query",
  2890. // "type": "string"
  2891. // }
  2892. // },
  2893. // "path": "accounts/{accountId}/adclients/{adClientId}/customchannels",
  2894. // "response": {
  2895. // "$ref": "CustomChannels"
  2896. // },
  2897. // "scopes": [
  2898. // "https://www.googleapis.com/auth/adsense",
  2899. // "https://www.googleapis.com/auth/adsense.readonly"
  2900. // ]
  2901. // }
  2902. }
  2903. // Pages invokes f for each page of results.
  2904. // A non-nil error returned from f will halt the iteration.
  2905. // The provided context supersedes any context provided to the Context method.
  2906. func (c *AccountsCustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error {
  2907. c.ctx_ = ctx
  2908. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2909. for {
  2910. x, err := c.Do()
  2911. if err != nil {
  2912. return err
  2913. }
  2914. if err := f(x); err != nil {
  2915. return err
  2916. }
  2917. if x.NextPageToken == "" {
  2918. return nil
  2919. }
  2920. c.PageToken(x.NextPageToken)
  2921. }
  2922. }
  2923. // method id "adsense.accounts.customchannels.adunits.list":
  2924. type AccountsCustomchannelsAdunitsListCall struct {
  2925. s *Service
  2926. accountId string
  2927. adClientId string
  2928. customChannelId string
  2929. urlParams_ gensupport.URLParams
  2930. ifNoneMatch_ string
  2931. ctx_ context.Context
  2932. header_ http.Header
  2933. }
  2934. // List: List all ad units in the specified custom channel.
  2935. func (r *AccountsCustomchannelsAdunitsService) List(accountId string, adClientId string, customChannelId string) *AccountsCustomchannelsAdunitsListCall {
  2936. c := &AccountsCustomchannelsAdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2937. c.accountId = accountId
  2938. c.adClientId = adClientId
  2939. c.customChannelId = customChannelId
  2940. return c
  2941. }
  2942. // IncludeInactive sets the optional parameter "includeInactive":
  2943. // Whether to include inactive ad units. Default: true.
  2944. func (c *AccountsCustomchannelsAdunitsListCall) IncludeInactive(includeInactive bool) *AccountsCustomchannelsAdunitsListCall {
  2945. c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive))
  2946. return c
  2947. }
  2948. // MaxResults sets the optional parameter "maxResults": The maximum
  2949. // number of ad units to include in the response, used for paging.
  2950. func (c *AccountsCustomchannelsAdunitsListCall) MaxResults(maxResults int64) *AccountsCustomchannelsAdunitsListCall {
  2951. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2952. return c
  2953. }
  2954. // PageToken sets the optional parameter "pageToken": A continuation
  2955. // token, used to page through ad units. To retrieve the next page, set
  2956. // this parameter to the value of "nextPageToken" from the previous
  2957. // response.
  2958. func (c *AccountsCustomchannelsAdunitsListCall) PageToken(pageToken string) *AccountsCustomchannelsAdunitsListCall {
  2959. c.urlParams_.Set("pageToken", pageToken)
  2960. return c
  2961. }
  2962. // Fields allows partial responses to be retrieved. See
  2963. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2964. // for more information.
  2965. func (c *AccountsCustomchannelsAdunitsListCall) Fields(s ...googleapi.Field) *AccountsCustomchannelsAdunitsListCall {
  2966. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2967. return c
  2968. }
  2969. // IfNoneMatch sets the optional parameter which makes the operation
  2970. // fail if the object's ETag matches the given value. This is useful for
  2971. // getting updates only after the object has changed since the last
  2972. // request. Use googleapi.IsNotModified to check whether the response
  2973. // error from Do is the result of In-None-Match.
  2974. func (c *AccountsCustomchannelsAdunitsListCall) IfNoneMatch(entityTag string) *AccountsCustomchannelsAdunitsListCall {
  2975. c.ifNoneMatch_ = entityTag
  2976. return c
  2977. }
  2978. // Context sets the context to be used in this call's Do method. Any
  2979. // pending HTTP request will be aborted if the provided context is
  2980. // canceled.
  2981. func (c *AccountsCustomchannelsAdunitsListCall) Context(ctx context.Context) *AccountsCustomchannelsAdunitsListCall {
  2982. c.ctx_ = ctx
  2983. return c
  2984. }
  2985. // Header returns an http.Header that can be modified by the caller to
  2986. // add HTTP headers to the request.
  2987. func (c *AccountsCustomchannelsAdunitsListCall) Header() http.Header {
  2988. if c.header_ == nil {
  2989. c.header_ = make(http.Header)
  2990. }
  2991. return c.header_
  2992. }
  2993. func (c *AccountsCustomchannelsAdunitsListCall) doRequest(alt string) (*http.Response, error) {
  2994. reqHeaders := make(http.Header)
  2995. for k, v := range c.header_ {
  2996. reqHeaders[k] = v
  2997. }
  2998. reqHeaders.Set("User-Agent", c.s.userAgent())
  2999. if c.ifNoneMatch_ != "" {
  3000. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3001. }
  3002. var body io.Reader = nil
  3003. c.urlParams_.Set("alt", alt)
  3004. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}/adunits")
  3005. urls += "?" + c.urlParams_.Encode()
  3006. req, _ := http.NewRequest("GET", urls, body)
  3007. req.Header = reqHeaders
  3008. googleapi.Expand(req.URL, map[string]string{
  3009. "accountId": c.accountId,
  3010. "adClientId": c.adClientId,
  3011. "customChannelId": c.customChannelId,
  3012. })
  3013. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3014. }
  3015. // Do executes the "adsense.accounts.customchannels.adunits.list" call.
  3016. // Exactly one of *AdUnits or error will be non-nil. Any non-2xx status
  3017. // code is an error. Response headers are in either
  3018. // *AdUnits.ServerResponse.Header or (if a response was returned at all)
  3019. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3020. // check whether the returned error was because http.StatusNotModified
  3021. // was returned.
  3022. func (c *AccountsCustomchannelsAdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) {
  3023. gensupport.SetOptions(c.urlParams_, opts...)
  3024. res, err := c.doRequest("json")
  3025. if res != nil && res.StatusCode == http.StatusNotModified {
  3026. if res.Body != nil {
  3027. res.Body.Close()
  3028. }
  3029. return nil, &googleapi.Error{
  3030. Code: res.StatusCode,
  3031. Header: res.Header,
  3032. }
  3033. }
  3034. if err != nil {
  3035. return nil, err
  3036. }
  3037. defer googleapi.CloseBody(res)
  3038. if err := googleapi.CheckResponse(res); err != nil {
  3039. return nil, err
  3040. }
  3041. ret := &AdUnits{
  3042. ServerResponse: googleapi.ServerResponse{
  3043. Header: res.Header,
  3044. HTTPStatusCode: res.StatusCode,
  3045. },
  3046. }
  3047. target := &ret
  3048. if err := gensupport.DecodeResponse(target, res); err != nil {
  3049. return nil, err
  3050. }
  3051. return ret, nil
  3052. // {
  3053. // "description": "List all ad units in the specified custom channel.",
  3054. // "httpMethod": "GET",
  3055. // "id": "adsense.accounts.customchannels.adunits.list",
  3056. // "parameterOrder": [
  3057. // "accountId",
  3058. // "adClientId",
  3059. // "customChannelId"
  3060. // ],
  3061. // "parameters": {
  3062. // "accountId": {
  3063. // "description": "Account to which the ad client belongs.",
  3064. // "location": "path",
  3065. // "required": true,
  3066. // "type": "string"
  3067. // },
  3068. // "adClientId": {
  3069. // "description": "Ad client which contains the custom channel.",
  3070. // "location": "path",
  3071. // "required": true,
  3072. // "type": "string"
  3073. // },
  3074. // "customChannelId": {
  3075. // "description": "Custom channel for which to list ad units.",
  3076. // "location": "path",
  3077. // "required": true,
  3078. // "type": "string"
  3079. // },
  3080. // "includeInactive": {
  3081. // "description": "Whether to include inactive ad units. Default: true.",
  3082. // "location": "query",
  3083. // "type": "boolean"
  3084. // },
  3085. // "maxResults": {
  3086. // "description": "The maximum number of ad units to include in the response, used for paging.",
  3087. // "format": "int32",
  3088. // "location": "query",
  3089. // "maximum": "10000",
  3090. // "minimum": "0",
  3091. // "type": "integer"
  3092. // },
  3093. // "pageToken": {
  3094. // "description": "A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  3095. // "location": "query",
  3096. // "type": "string"
  3097. // }
  3098. // },
  3099. // "path": "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}/adunits",
  3100. // "response": {
  3101. // "$ref": "AdUnits"
  3102. // },
  3103. // "scopes": [
  3104. // "https://www.googleapis.com/auth/adsense",
  3105. // "https://www.googleapis.com/auth/adsense.readonly"
  3106. // ]
  3107. // }
  3108. }
  3109. // Pages invokes f for each page of results.
  3110. // A non-nil error returned from f will halt the iteration.
  3111. // The provided context supersedes any context provided to the Context method.
  3112. func (c *AccountsCustomchannelsAdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error {
  3113. c.ctx_ = ctx
  3114. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3115. for {
  3116. x, err := c.Do()
  3117. if err != nil {
  3118. return err
  3119. }
  3120. if err := f(x); err != nil {
  3121. return err
  3122. }
  3123. if x.NextPageToken == "" {
  3124. return nil
  3125. }
  3126. c.PageToken(x.NextPageToken)
  3127. }
  3128. }
  3129. // method id "adsense.accounts.reports.generate":
  3130. type AccountsReportsGenerateCall struct {
  3131. s *Service
  3132. accountId string
  3133. urlParams_ gensupport.URLParams
  3134. ifNoneMatch_ string
  3135. ctx_ context.Context
  3136. header_ http.Header
  3137. }
  3138. // Generate: Generate an AdSense report based on the report request sent
  3139. // in the query parameters. Returns the result as JSON; to retrieve
  3140. // output in CSV format specify "alt=csv" as a query parameter.
  3141. func (r *AccountsReportsService) Generate(accountId string, startDate string, endDate string) *AccountsReportsGenerateCall {
  3142. c := &AccountsReportsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3143. c.accountId = accountId
  3144. c.urlParams_.Set("startDate", startDate)
  3145. c.urlParams_.Set("endDate", endDate)
  3146. return c
  3147. }
  3148. // Currency sets the optional parameter "currency": Optional currency to
  3149. // use when reporting on monetary metrics. Defaults to the account's
  3150. // currency if not set.
  3151. func (c *AccountsReportsGenerateCall) Currency(currency string) *AccountsReportsGenerateCall {
  3152. c.urlParams_.Set("currency", currency)
  3153. return c
  3154. }
  3155. // Dimension sets the optional parameter "dimension": Dimensions to base
  3156. // the report on.
  3157. func (c *AccountsReportsGenerateCall) Dimension(dimension ...string) *AccountsReportsGenerateCall {
  3158. c.urlParams_.SetMulti("dimension", append([]string{}, dimension...))
  3159. return c
  3160. }
  3161. // Filter sets the optional parameter "filter": Filters to be run on the
  3162. // report.
  3163. func (c *AccountsReportsGenerateCall) Filter(filter ...string) *AccountsReportsGenerateCall {
  3164. c.urlParams_.SetMulti("filter", append([]string{}, filter...))
  3165. return c
  3166. }
  3167. // Locale sets the optional parameter "locale": Optional locale to use
  3168. // for translating report output to a local language. Defaults to
  3169. // "en_US" if not specified.
  3170. func (c *AccountsReportsGenerateCall) Locale(locale string) *AccountsReportsGenerateCall {
  3171. c.urlParams_.Set("locale", locale)
  3172. return c
  3173. }
  3174. // MaxResults sets the optional parameter "maxResults": The maximum
  3175. // number of rows of report data to return.
  3176. func (c *AccountsReportsGenerateCall) MaxResults(maxResults int64) *AccountsReportsGenerateCall {
  3177. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3178. return c
  3179. }
  3180. // Metric sets the optional parameter "metric": Numeric columns to
  3181. // include in the report.
  3182. func (c *AccountsReportsGenerateCall) Metric(metric ...string) *AccountsReportsGenerateCall {
  3183. c.urlParams_.SetMulti("metric", append([]string{}, metric...))
  3184. return c
  3185. }
  3186. // Sort sets the optional parameter "sort": The name of a dimension or
  3187. // metric to sort the resulting report on, optionally prefixed with "+"
  3188. // to sort ascending or "-" to sort descending. If no prefix is
  3189. // specified, the column is sorted ascending.
  3190. func (c *AccountsReportsGenerateCall) Sort(sort ...string) *AccountsReportsGenerateCall {
  3191. c.urlParams_.SetMulti("sort", append([]string{}, sort...))
  3192. return c
  3193. }
  3194. // StartIndex sets the optional parameter "startIndex": Index of the
  3195. // first row of report data to return.
  3196. func (c *AccountsReportsGenerateCall) StartIndex(startIndex int64) *AccountsReportsGenerateCall {
  3197. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  3198. return c
  3199. }
  3200. // UseTimezoneReporting sets the optional parameter
  3201. // "useTimezoneReporting": Whether the report should be generated in the
  3202. // AdSense account's local timezone. If false default PST/PDT timezone
  3203. // will be used.
  3204. func (c *AccountsReportsGenerateCall) UseTimezoneReporting(useTimezoneReporting bool) *AccountsReportsGenerateCall {
  3205. c.urlParams_.Set("useTimezoneReporting", fmt.Sprint(useTimezoneReporting))
  3206. return c
  3207. }
  3208. // Fields allows partial responses to be retrieved. See
  3209. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3210. // for more information.
  3211. func (c *AccountsReportsGenerateCall) Fields(s ...googleapi.Field) *AccountsReportsGenerateCall {
  3212. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3213. return c
  3214. }
  3215. // IfNoneMatch sets the optional parameter which makes the operation
  3216. // fail if the object's ETag matches the given value. This is useful for
  3217. // getting updates only after the object has changed since the last
  3218. // request. Use googleapi.IsNotModified to check whether the response
  3219. // error from Do is the result of In-None-Match.
  3220. func (c *AccountsReportsGenerateCall) IfNoneMatch(entityTag string) *AccountsReportsGenerateCall {
  3221. c.ifNoneMatch_ = entityTag
  3222. return c
  3223. }
  3224. // Context sets the context to be used in this call's Do and Download
  3225. // methods. Any pending HTTP request will be aborted if the provided
  3226. // context is canceled.
  3227. func (c *AccountsReportsGenerateCall) Context(ctx context.Context) *AccountsReportsGenerateCall {
  3228. c.ctx_ = ctx
  3229. return c
  3230. }
  3231. // Header returns an http.Header that can be modified by the caller to
  3232. // add HTTP headers to the request.
  3233. func (c *AccountsReportsGenerateCall) Header() http.Header {
  3234. if c.header_ == nil {
  3235. c.header_ = make(http.Header)
  3236. }
  3237. return c.header_
  3238. }
  3239. func (c *AccountsReportsGenerateCall) doRequest(alt string) (*http.Response, error) {
  3240. reqHeaders := make(http.Header)
  3241. for k, v := range c.header_ {
  3242. reqHeaders[k] = v
  3243. }
  3244. reqHeaders.Set("User-Agent", c.s.userAgent())
  3245. if c.ifNoneMatch_ != "" {
  3246. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3247. }
  3248. var body io.Reader = nil
  3249. c.urlParams_.Set("alt", alt)
  3250. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/reports")
  3251. urls += "?" + c.urlParams_.Encode()
  3252. req, _ := http.NewRequest("GET", urls, body)
  3253. req.Header = reqHeaders
  3254. googleapi.Expand(req.URL, map[string]string{
  3255. "accountId": c.accountId,
  3256. })
  3257. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3258. }
  3259. // Download fetches the API endpoint's "media" value, instead of the normal
  3260. // API response value. If the returned error is nil, the Response is guaranteed to
  3261. // have a 2xx status code. Callers must close the Response.Body as usual.
  3262. func (c *AccountsReportsGenerateCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  3263. gensupport.SetOptions(c.urlParams_, opts...)
  3264. res, err := c.doRequest("media")
  3265. if err != nil {
  3266. return nil, err
  3267. }
  3268. if err := googleapi.CheckMediaResponse(res); err != nil {
  3269. res.Body.Close()
  3270. return nil, err
  3271. }
  3272. return res, nil
  3273. }
  3274. // Do executes the "adsense.accounts.reports.generate" call.
  3275. // Exactly one of *AdsenseReportsGenerateResponse or error will be
  3276. // non-nil. Any non-2xx status code is an error. Response headers are in
  3277. // either *AdsenseReportsGenerateResponse.ServerResponse.Header or (if a
  3278. // response was returned at all) in error.(*googleapi.Error).Header. Use
  3279. // googleapi.IsNotModified to check whether the returned error was
  3280. // because http.StatusNotModified was returned.
  3281. func (c *AccountsReportsGenerateCall) Do(opts ...googleapi.CallOption) (*AdsenseReportsGenerateResponse, error) {
  3282. gensupport.SetOptions(c.urlParams_, opts...)
  3283. res, err := c.doRequest("json")
  3284. if res != nil && res.StatusCode == http.StatusNotModified {
  3285. if res.Body != nil {
  3286. res.Body.Close()
  3287. }
  3288. return nil, &googleapi.Error{
  3289. Code: res.StatusCode,
  3290. Header: res.Header,
  3291. }
  3292. }
  3293. if err != nil {
  3294. return nil, err
  3295. }
  3296. defer googleapi.CloseBody(res)
  3297. if err := googleapi.CheckResponse(res); err != nil {
  3298. return nil, err
  3299. }
  3300. ret := &AdsenseReportsGenerateResponse{
  3301. ServerResponse: googleapi.ServerResponse{
  3302. Header: res.Header,
  3303. HTTPStatusCode: res.StatusCode,
  3304. },
  3305. }
  3306. target := &ret
  3307. if err := gensupport.DecodeResponse(target, res); err != nil {
  3308. return nil, err
  3309. }
  3310. return ret, nil
  3311. // {
  3312. // "description": "Generate an AdSense report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify \"alt=csv\" as a query parameter.",
  3313. // "httpMethod": "GET",
  3314. // "id": "adsense.accounts.reports.generate",
  3315. // "parameterOrder": [
  3316. // "accountId",
  3317. // "startDate",
  3318. // "endDate"
  3319. // ],
  3320. // "parameters": {
  3321. // "accountId": {
  3322. // "description": "Account upon which to report.",
  3323. // "location": "path",
  3324. // "required": true,
  3325. // "type": "string"
  3326. // },
  3327. // "currency": {
  3328. // "description": "Optional currency to use when reporting on monetary metrics. Defaults to the account's currency if not set.",
  3329. // "location": "query",
  3330. // "pattern": "[a-zA-Z]+",
  3331. // "type": "string"
  3332. // },
  3333. // "dimension": {
  3334. // "description": "Dimensions to base the report on.",
  3335. // "location": "query",
  3336. // "pattern": "[a-zA-Z_]+",
  3337. // "repeated": true,
  3338. // "type": "string"
  3339. // },
  3340. // "endDate": {
  3341. // "description": "End of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  3342. // "location": "query",
  3343. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  3344. // "required": true,
  3345. // "type": "string"
  3346. // },
  3347. // "filter": {
  3348. // "description": "Filters to be run on the report.",
  3349. // "location": "query",
  3350. // "pattern": "[a-zA-Z_]+(==|=@).+",
  3351. // "repeated": true,
  3352. // "type": "string"
  3353. // },
  3354. // "locale": {
  3355. // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.",
  3356. // "location": "query",
  3357. // "pattern": "[a-zA-Z_]+",
  3358. // "type": "string"
  3359. // },
  3360. // "maxResults": {
  3361. // "description": "The maximum number of rows of report data to return.",
  3362. // "format": "int32",
  3363. // "location": "query",
  3364. // "maximum": "50000",
  3365. // "minimum": "0",
  3366. // "type": "integer"
  3367. // },
  3368. // "metric": {
  3369. // "description": "Numeric columns to include in the report.",
  3370. // "location": "query",
  3371. // "pattern": "[a-zA-Z_]+",
  3372. // "repeated": true,
  3373. // "type": "string"
  3374. // },
  3375. // "sort": {
  3376. // "description": "The name of a dimension or metric to sort the resulting report on, optionally prefixed with \"+\" to sort ascending or \"-\" to sort descending. If no prefix is specified, the column is sorted ascending.",
  3377. // "location": "query",
  3378. // "pattern": "(\\+|-)?[a-zA-Z_]+",
  3379. // "repeated": true,
  3380. // "type": "string"
  3381. // },
  3382. // "startDate": {
  3383. // "description": "Start of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  3384. // "location": "query",
  3385. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  3386. // "required": true,
  3387. // "type": "string"
  3388. // },
  3389. // "startIndex": {
  3390. // "description": "Index of the first row of report data to return.",
  3391. // "format": "int32",
  3392. // "location": "query",
  3393. // "maximum": "5000",
  3394. // "minimum": "0",
  3395. // "type": "integer"
  3396. // },
  3397. // "useTimezoneReporting": {
  3398. // "description": "Whether the report should be generated in the AdSense account's local timezone. If false default PST/PDT timezone will be used.",
  3399. // "location": "query",
  3400. // "type": "boolean"
  3401. // }
  3402. // },
  3403. // "path": "accounts/{accountId}/reports",
  3404. // "response": {
  3405. // "$ref": "AdsenseReportsGenerateResponse"
  3406. // },
  3407. // "scopes": [
  3408. // "https://www.googleapis.com/auth/adsense",
  3409. // "https://www.googleapis.com/auth/adsense.readonly"
  3410. // ],
  3411. // "supportsMediaDownload": true
  3412. // }
  3413. }
  3414. // method id "adsense.accounts.reports.saved.generate":
  3415. type AccountsReportsSavedGenerateCall struct {
  3416. s *Service
  3417. accountId string
  3418. savedReportId string
  3419. urlParams_ gensupport.URLParams
  3420. ifNoneMatch_ string
  3421. ctx_ context.Context
  3422. header_ http.Header
  3423. }
  3424. // Generate: Generate an AdSense report based on the saved report ID
  3425. // sent in the query parameters.
  3426. func (r *AccountsReportsSavedService) Generate(accountId string, savedReportId string) *AccountsReportsSavedGenerateCall {
  3427. c := &AccountsReportsSavedGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3428. c.accountId = accountId
  3429. c.savedReportId = savedReportId
  3430. return c
  3431. }
  3432. // Locale sets the optional parameter "locale": Optional locale to use
  3433. // for translating report output to a local language. Defaults to
  3434. // "en_US" if not specified.
  3435. func (c *AccountsReportsSavedGenerateCall) Locale(locale string) *AccountsReportsSavedGenerateCall {
  3436. c.urlParams_.Set("locale", locale)
  3437. return c
  3438. }
  3439. // MaxResults sets the optional parameter "maxResults": The maximum
  3440. // number of rows of report data to return.
  3441. func (c *AccountsReportsSavedGenerateCall) MaxResults(maxResults int64) *AccountsReportsSavedGenerateCall {
  3442. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3443. return c
  3444. }
  3445. // StartIndex sets the optional parameter "startIndex": Index of the
  3446. // first row of report data to return.
  3447. func (c *AccountsReportsSavedGenerateCall) StartIndex(startIndex int64) *AccountsReportsSavedGenerateCall {
  3448. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  3449. return c
  3450. }
  3451. // Fields allows partial responses to be retrieved. See
  3452. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3453. // for more information.
  3454. func (c *AccountsReportsSavedGenerateCall) Fields(s ...googleapi.Field) *AccountsReportsSavedGenerateCall {
  3455. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3456. return c
  3457. }
  3458. // IfNoneMatch sets the optional parameter which makes the operation
  3459. // fail if the object's ETag matches the given value. This is useful for
  3460. // getting updates only after the object has changed since the last
  3461. // request. Use googleapi.IsNotModified to check whether the response
  3462. // error from Do is the result of In-None-Match.
  3463. func (c *AccountsReportsSavedGenerateCall) IfNoneMatch(entityTag string) *AccountsReportsSavedGenerateCall {
  3464. c.ifNoneMatch_ = entityTag
  3465. return c
  3466. }
  3467. // Context sets the context to be used in this call's Do method. Any
  3468. // pending HTTP request will be aborted if the provided context is
  3469. // canceled.
  3470. func (c *AccountsReportsSavedGenerateCall) Context(ctx context.Context) *AccountsReportsSavedGenerateCall {
  3471. c.ctx_ = ctx
  3472. return c
  3473. }
  3474. // Header returns an http.Header that can be modified by the caller to
  3475. // add HTTP headers to the request.
  3476. func (c *AccountsReportsSavedGenerateCall) Header() http.Header {
  3477. if c.header_ == nil {
  3478. c.header_ = make(http.Header)
  3479. }
  3480. return c.header_
  3481. }
  3482. func (c *AccountsReportsSavedGenerateCall) doRequest(alt string) (*http.Response, error) {
  3483. reqHeaders := make(http.Header)
  3484. for k, v := range c.header_ {
  3485. reqHeaders[k] = v
  3486. }
  3487. reqHeaders.Set("User-Agent", c.s.userAgent())
  3488. if c.ifNoneMatch_ != "" {
  3489. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3490. }
  3491. var body io.Reader = nil
  3492. c.urlParams_.Set("alt", alt)
  3493. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/reports/{savedReportId}")
  3494. urls += "?" + c.urlParams_.Encode()
  3495. req, _ := http.NewRequest("GET", urls, body)
  3496. req.Header = reqHeaders
  3497. googleapi.Expand(req.URL, map[string]string{
  3498. "accountId": c.accountId,
  3499. "savedReportId": c.savedReportId,
  3500. })
  3501. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3502. }
  3503. // Do executes the "adsense.accounts.reports.saved.generate" call.
  3504. // Exactly one of *AdsenseReportsGenerateResponse or error will be
  3505. // non-nil. Any non-2xx status code is an error. Response headers are in
  3506. // either *AdsenseReportsGenerateResponse.ServerResponse.Header or (if a
  3507. // response was returned at all) in error.(*googleapi.Error).Header. Use
  3508. // googleapi.IsNotModified to check whether the returned error was
  3509. // because http.StatusNotModified was returned.
  3510. func (c *AccountsReportsSavedGenerateCall) Do(opts ...googleapi.CallOption) (*AdsenseReportsGenerateResponse, error) {
  3511. gensupport.SetOptions(c.urlParams_, opts...)
  3512. res, err := c.doRequest("json")
  3513. if res != nil && res.StatusCode == http.StatusNotModified {
  3514. if res.Body != nil {
  3515. res.Body.Close()
  3516. }
  3517. return nil, &googleapi.Error{
  3518. Code: res.StatusCode,
  3519. Header: res.Header,
  3520. }
  3521. }
  3522. if err != nil {
  3523. return nil, err
  3524. }
  3525. defer googleapi.CloseBody(res)
  3526. if err := googleapi.CheckResponse(res); err != nil {
  3527. return nil, err
  3528. }
  3529. ret := &AdsenseReportsGenerateResponse{
  3530. ServerResponse: googleapi.ServerResponse{
  3531. Header: res.Header,
  3532. HTTPStatusCode: res.StatusCode,
  3533. },
  3534. }
  3535. target := &ret
  3536. if err := gensupport.DecodeResponse(target, res); err != nil {
  3537. return nil, err
  3538. }
  3539. return ret, nil
  3540. // {
  3541. // "description": "Generate an AdSense report based on the saved report ID sent in the query parameters.",
  3542. // "httpMethod": "GET",
  3543. // "id": "adsense.accounts.reports.saved.generate",
  3544. // "parameterOrder": [
  3545. // "accountId",
  3546. // "savedReportId"
  3547. // ],
  3548. // "parameters": {
  3549. // "accountId": {
  3550. // "description": "Account to which the saved reports belong.",
  3551. // "location": "path",
  3552. // "required": true,
  3553. // "type": "string"
  3554. // },
  3555. // "locale": {
  3556. // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.",
  3557. // "location": "query",
  3558. // "pattern": "[a-zA-Z_]+",
  3559. // "type": "string"
  3560. // },
  3561. // "maxResults": {
  3562. // "description": "The maximum number of rows of report data to return.",
  3563. // "format": "int32",
  3564. // "location": "query",
  3565. // "maximum": "50000",
  3566. // "minimum": "0",
  3567. // "type": "integer"
  3568. // },
  3569. // "savedReportId": {
  3570. // "description": "The saved report to retrieve.",
  3571. // "location": "path",
  3572. // "required": true,
  3573. // "type": "string"
  3574. // },
  3575. // "startIndex": {
  3576. // "description": "Index of the first row of report data to return.",
  3577. // "format": "int32",
  3578. // "location": "query",
  3579. // "maximum": "5000",
  3580. // "minimum": "0",
  3581. // "type": "integer"
  3582. // }
  3583. // },
  3584. // "path": "accounts/{accountId}/reports/{savedReportId}",
  3585. // "response": {
  3586. // "$ref": "AdsenseReportsGenerateResponse"
  3587. // },
  3588. // "scopes": [
  3589. // "https://www.googleapis.com/auth/adsense",
  3590. // "https://www.googleapis.com/auth/adsense.readonly"
  3591. // ]
  3592. // }
  3593. }
  3594. // method id "adsense.accounts.reports.saved.list":
  3595. type AccountsReportsSavedListCall struct {
  3596. s *Service
  3597. accountId string
  3598. urlParams_ gensupport.URLParams
  3599. ifNoneMatch_ string
  3600. ctx_ context.Context
  3601. header_ http.Header
  3602. }
  3603. // List: List all saved reports in the specified AdSense account.
  3604. func (r *AccountsReportsSavedService) List(accountId string) *AccountsReportsSavedListCall {
  3605. c := &AccountsReportsSavedListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3606. c.accountId = accountId
  3607. return c
  3608. }
  3609. // MaxResults sets the optional parameter "maxResults": The maximum
  3610. // number of saved reports to include in the response, used for paging.
  3611. func (c *AccountsReportsSavedListCall) MaxResults(maxResults int64) *AccountsReportsSavedListCall {
  3612. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3613. return c
  3614. }
  3615. // PageToken sets the optional parameter "pageToken": A continuation
  3616. // token, used to page through saved reports. To retrieve the next page,
  3617. // set this parameter to the value of "nextPageToken" from the previous
  3618. // response.
  3619. func (c *AccountsReportsSavedListCall) PageToken(pageToken string) *AccountsReportsSavedListCall {
  3620. c.urlParams_.Set("pageToken", pageToken)
  3621. return c
  3622. }
  3623. // Fields allows partial responses to be retrieved. See
  3624. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3625. // for more information.
  3626. func (c *AccountsReportsSavedListCall) Fields(s ...googleapi.Field) *AccountsReportsSavedListCall {
  3627. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3628. return c
  3629. }
  3630. // IfNoneMatch sets the optional parameter which makes the operation
  3631. // fail if the object's ETag matches the given value. This is useful for
  3632. // getting updates only after the object has changed since the last
  3633. // request. Use googleapi.IsNotModified to check whether the response
  3634. // error from Do is the result of In-None-Match.
  3635. func (c *AccountsReportsSavedListCall) IfNoneMatch(entityTag string) *AccountsReportsSavedListCall {
  3636. c.ifNoneMatch_ = entityTag
  3637. return c
  3638. }
  3639. // Context sets the context to be used in this call's Do method. Any
  3640. // pending HTTP request will be aborted if the provided context is
  3641. // canceled.
  3642. func (c *AccountsReportsSavedListCall) Context(ctx context.Context) *AccountsReportsSavedListCall {
  3643. c.ctx_ = ctx
  3644. return c
  3645. }
  3646. // Header returns an http.Header that can be modified by the caller to
  3647. // add HTTP headers to the request.
  3648. func (c *AccountsReportsSavedListCall) Header() http.Header {
  3649. if c.header_ == nil {
  3650. c.header_ = make(http.Header)
  3651. }
  3652. return c.header_
  3653. }
  3654. func (c *AccountsReportsSavedListCall) doRequest(alt string) (*http.Response, error) {
  3655. reqHeaders := make(http.Header)
  3656. for k, v := range c.header_ {
  3657. reqHeaders[k] = v
  3658. }
  3659. reqHeaders.Set("User-Agent", c.s.userAgent())
  3660. if c.ifNoneMatch_ != "" {
  3661. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3662. }
  3663. var body io.Reader = nil
  3664. c.urlParams_.Set("alt", alt)
  3665. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/reports/saved")
  3666. urls += "?" + c.urlParams_.Encode()
  3667. req, _ := http.NewRequest("GET", urls, body)
  3668. req.Header = reqHeaders
  3669. googleapi.Expand(req.URL, map[string]string{
  3670. "accountId": c.accountId,
  3671. })
  3672. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3673. }
  3674. // Do executes the "adsense.accounts.reports.saved.list" call.
  3675. // Exactly one of *SavedReports or error will be non-nil. Any non-2xx
  3676. // status code is an error. Response headers are in either
  3677. // *SavedReports.ServerResponse.Header or (if a response was returned at
  3678. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3679. // to check whether the returned error was because
  3680. // http.StatusNotModified was returned.
  3681. func (c *AccountsReportsSavedListCall) Do(opts ...googleapi.CallOption) (*SavedReports, error) {
  3682. gensupport.SetOptions(c.urlParams_, opts...)
  3683. res, err := c.doRequest("json")
  3684. if res != nil && res.StatusCode == http.StatusNotModified {
  3685. if res.Body != nil {
  3686. res.Body.Close()
  3687. }
  3688. return nil, &googleapi.Error{
  3689. Code: res.StatusCode,
  3690. Header: res.Header,
  3691. }
  3692. }
  3693. if err != nil {
  3694. return nil, err
  3695. }
  3696. defer googleapi.CloseBody(res)
  3697. if err := googleapi.CheckResponse(res); err != nil {
  3698. return nil, err
  3699. }
  3700. ret := &SavedReports{
  3701. ServerResponse: googleapi.ServerResponse{
  3702. Header: res.Header,
  3703. HTTPStatusCode: res.StatusCode,
  3704. },
  3705. }
  3706. target := &ret
  3707. if err := gensupport.DecodeResponse(target, res); err != nil {
  3708. return nil, err
  3709. }
  3710. return ret, nil
  3711. // {
  3712. // "description": "List all saved reports in the specified AdSense account.",
  3713. // "httpMethod": "GET",
  3714. // "id": "adsense.accounts.reports.saved.list",
  3715. // "parameterOrder": [
  3716. // "accountId"
  3717. // ],
  3718. // "parameters": {
  3719. // "accountId": {
  3720. // "description": "Account to which the saved reports belong.",
  3721. // "location": "path",
  3722. // "required": true,
  3723. // "type": "string"
  3724. // },
  3725. // "maxResults": {
  3726. // "description": "The maximum number of saved reports to include in the response, used for paging.",
  3727. // "format": "int32",
  3728. // "location": "query",
  3729. // "maximum": "100",
  3730. // "minimum": "0",
  3731. // "type": "integer"
  3732. // },
  3733. // "pageToken": {
  3734. // "description": "A continuation token, used to page through saved reports. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  3735. // "location": "query",
  3736. // "type": "string"
  3737. // }
  3738. // },
  3739. // "path": "accounts/{accountId}/reports/saved",
  3740. // "response": {
  3741. // "$ref": "SavedReports"
  3742. // },
  3743. // "scopes": [
  3744. // "https://www.googleapis.com/auth/adsense",
  3745. // "https://www.googleapis.com/auth/adsense.readonly"
  3746. // ]
  3747. // }
  3748. }
  3749. // Pages invokes f for each page of results.
  3750. // A non-nil error returned from f will halt the iteration.
  3751. // The provided context supersedes any context provided to the Context method.
  3752. func (c *AccountsReportsSavedListCall) Pages(ctx context.Context, f func(*SavedReports) error) error {
  3753. c.ctx_ = ctx
  3754. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3755. for {
  3756. x, err := c.Do()
  3757. if err != nil {
  3758. return err
  3759. }
  3760. if err := f(x); err != nil {
  3761. return err
  3762. }
  3763. if x.NextPageToken == "" {
  3764. return nil
  3765. }
  3766. c.PageToken(x.NextPageToken)
  3767. }
  3768. }
  3769. // method id "adsense.accounts.savedadstyles.get":
  3770. type AccountsSavedadstylesGetCall struct {
  3771. s *Service
  3772. accountId string
  3773. savedAdStyleId string
  3774. urlParams_ gensupport.URLParams
  3775. ifNoneMatch_ string
  3776. ctx_ context.Context
  3777. header_ http.Header
  3778. }
  3779. // Get: List a specific saved ad style for the specified account.
  3780. func (r *AccountsSavedadstylesService) Get(accountId string, savedAdStyleId string) *AccountsSavedadstylesGetCall {
  3781. c := &AccountsSavedadstylesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3782. c.accountId = accountId
  3783. c.savedAdStyleId = savedAdStyleId
  3784. return c
  3785. }
  3786. // Fields allows partial responses to be retrieved. See
  3787. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3788. // for more information.
  3789. func (c *AccountsSavedadstylesGetCall) Fields(s ...googleapi.Field) *AccountsSavedadstylesGetCall {
  3790. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3791. return c
  3792. }
  3793. // IfNoneMatch sets the optional parameter which makes the operation
  3794. // fail if the object's ETag matches the given value. This is useful for
  3795. // getting updates only after the object has changed since the last
  3796. // request. Use googleapi.IsNotModified to check whether the response
  3797. // error from Do is the result of In-None-Match.
  3798. func (c *AccountsSavedadstylesGetCall) IfNoneMatch(entityTag string) *AccountsSavedadstylesGetCall {
  3799. c.ifNoneMatch_ = entityTag
  3800. return c
  3801. }
  3802. // Context sets the context to be used in this call's Do method. Any
  3803. // pending HTTP request will be aborted if the provided context is
  3804. // canceled.
  3805. func (c *AccountsSavedadstylesGetCall) Context(ctx context.Context) *AccountsSavedadstylesGetCall {
  3806. c.ctx_ = ctx
  3807. return c
  3808. }
  3809. // Header returns an http.Header that can be modified by the caller to
  3810. // add HTTP headers to the request.
  3811. func (c *AccountsSavedadstylesGetCall) Header() http.Header {
  3812. if c.header_ == nil {
  3813. c.header_ = make(http.Header)
  3814. }
  3815. return c.header_
  3816. }
  3817. func (c *AccountsSavedadstylesGetCall) doRequest(alt string) (*http.Response, error) {
  3818. reqHeaders := make(http.Header)
  3819. for k, v := range c.header_ {
  3820. reqHeaders[k] = v
  3821. }
  3822. reqHeaders.Set("User-Agent", c.s.userAgent())
  3823. if c.ifNoneMatch_ != "" {
  3824. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3825. }
  3826. var body io.Reader = nil
  3827. c.urlParams_.Set("alt", alt)
  3828. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/savedadstyles/{savedAdStyleId}")
  3829. urls += "?" + c.urlParams_.Encode()
  3830. req, _ := http.NewRequest("GET", urls, body)
  3831. req.Header = reqHeaders
  3832. googleapi.Expand(req.URL, map[string]string{
  3833. "accountId": c.accountId,
  3834. "savedAdStyleId": c.savedAdStyleId,
  3835. })
  3836. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3837. }
  3838. // Do executes the "adsense.accounts.savedadstyles.get" call.
  3839. // Exactly one of *SavedAdStyle or error will be non-nil. Any non-2xx
  3840. // status code is an error. Response headers are in either
  3841. // *SavedAdStyle.ServerResponse.Header or (if a response was returned at
  3842. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3843. // to check whether the returned error was because
  3844. // http.StatusNotModified was returned.
  3845. func (c *AccountsSavedadstylesGetCall) Do(opts ...googleapi.CallOption) (*SavedAdStyle, error) {
  3846. gensupport.SetOptions(c.urlParams_, opts...)
  3847. res, err := c.doRequest("json")
  3848. if res != nil && res.StatusCode == http.StatusNotModified {
  3849. if res.Body != nil {
  3850. res.Body.Close()
  3851. }
  3852. return nil, &googleapi.Error{
  3853. Code: res.StatusCode,
  3854. Header: res.Header,
  3855. }
  3856. }
  3857. if err != nil {
  3858. return nil, err
  3859. }
  3860. defer googleapi.CloseBody(res)
  3861. if err := googleapi.CheckResponse(res); err != nil {
  3862. return nil, err
  3863. }
  3864. ret := &SavedAdStyle{
  3865. ServerResponse: googleapi.ServerResponse{
  3866. Header: res.Header,
  3867. HTTPStatusCode: res.StatusCode,
  3868. },
  3869. }
  3870. target := &ret
  3871. if err := gensupport.DecodeResponse(target, res); err != nil {
  3872. return nil, err
  3873. }
  3874. return ret, nil
  3875. // {
  3876. // "description": "List a specific saved ad style for the specified account.",
  3877. // "httpMethod": "GET",
  3878. // "id": "adsense.accounts.savedadstyles.get",
  3879. // "parameterOrder": [
  3880. // "accountId",
  3881. // "savedAdStyleId"
  3882. // ],
  3883. // "parameters": {
  3884. // "accountId": {
  3885. // "description": "Account for which to get the saved ad style.",
  3886. // "location": "path",
  3887. // "required": true,
  3888. // "type": "string"
  3889. // },
  3890. // "savedAdStyleId": {
  3891. // "description": "Saved ad style to retrieve.",
  3892. // "location": "path",
  3893. // "required": true,
  3894. // "type": "string"
  3895. // }
  3896. // },
  3897. // "path": "accounts/{accountId}/savedadstyles/{savedAdStyleId}",
  3898. // "response": {
  3899. // "$ref": "SavedAdStyle"
  3900. // },
  3901. // "scopes": [
  3902. // "https://www.googleapis.com/auth/adsense",
  3903. // "https://www.googleapis.com/auth/adsense.readonly"
  3904. // ]
  3905. // }
  3906. }
  3907. // method id "adsense.accounts.savedadstyles.list":
  3908. type AccountsSavedadstylesListCall struct {
  3909. s *Service
  3910. accountId string
  3911. urlParams_ gensupport.URLParams
  3912. ifNoneMatch_ string
  3913. ctx_ context.Context
  3914. header_ http.Header
  3915. }
  3916. // List: List all saved ad styles in the specified account.
  3917. func (r *AccountsSavedadstylesService) List(accountId string) *AccountsSavedadstylesListCall {
  3918. c := &AccountsSavedadstylesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3919. c.accountId = accountId
  3920. return c
  3921. }
  3922. // MaxResults sets the optional parameter "maxResults": The maximum
  3923. // number of saved ad styles to include in the response, used for
  3924. // paging.
  3925. func (c *AccountsSavedadstylesListCall) MaxResults(maxResults int64) *AccountsSavedadstylesListCall {
  3926. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3927. return c
  3928. }
  3929. // PageToken sets the optional parameter "pageToken": A continuation
  3930. // token, used to page through saved ad styles. To retrieve the next
  3931. // page, set this parameter to the value of "nextPageToken" from the
  3932. // previous response.
  3933. func (c *AccountsSavedadstylesListCall) PageToken(pageToken string) *AccountsSavedadstylesListCall {
  3934. c.urlParams_.Set("pageToken", pageToken)
  3935. return c
  3936. }
  3937. // Fields allows partial responses to be retrieved. See
  3938. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3939. // for more information.
  3940. func (c *AccountsSavedadstylesListCall) Fields(s ...googleapi.Field) *AccountsSavedadstylesListCall {
  3941. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3942. return c
  3943. }
  3944. // IfNoneMatch sets the optional parameter which makes the operation
  3945. // fail if the object's ETag matches the given value. This is useful for
  3946. // getting updates only after the object has changed since the last
  3947. // request. Use googleapi.IsNotModified to check whether the response
  3948. // error from Do is the result of In-None-Match.
  3949. func (c *AccountsSavedadstylesListCall) IfNoneMatch(entityTag string) *AccountsSavedadstylesListCall {
  3950. c.ifNoneMatch_ = entityTag
  3951. return c
  3952. }
  3953. // Context sets the context to be used in this call's Do method. Any
  3954. // pending HTTP request will be aborted if the provided context is
  3955. // canceled.
  3956. func (c *AccountsSavedadstylesListCall) Context(ctx context.Context) *AccountsSavedadstylesListCall {
  3957. c.ctx_ = ctx
  3958. return c
  3959. }
  3960. // Header returns an http.Header that can be modified by the caller to
  3961. // add HTTP headers to the request.
  3962. func (c *AccountsSavedadstylesListCall) Header() http.Header {
  3963. if c.header_ == nil {
  3964. c.header_ = make(http.Header)
  3965. }
  3966. return c.header_
  3967. }
  3968. func (c *AccountsSavedadstylesListCall) doRequest(alt string) (*http.Response, error) {
  3969. reqHeaders := make(http.Header)
  3970. for k, v := range c.header_ {
  3971. reqHeaders[k] = v
  3972. }
  3973. reqHeaders.Set("User-Agent", c.s.userAgent())
  3974. if c.ifNoneMatch_ != "" {
  3975. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3976. }
  3977. var body io.Reader = nil
  3978. c.urlParams_.Set("alt", alt)
  3979. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/savedadstyles")
  3980. urls += "?" + c.urlParams_.Encode()
  3981. req, _ := http.NewRequest("GET", urls, body)
  3982. req.Header = reqHeaders
  3983. googleapi.Expand(req.URL, map[string]string{
  3984. "accountId": c.accountId,
  3985. })
  3986. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3987. }
  3988. // Do executes the "adsense.accounts.savedadstyles.list" call.
  3989. // Exactly one of *SavedAdStyles or error will be non-nil. Any non-2xx
  3990. // status code is an error. Response headers are in either
  3991. // *SavedAdStyles.ServerResponse.Header or (if a response was returned
  3992. // at all) in error.(*googleapi.Error).Header. Use
  3993. // googleapi.IsNotModified to check whether the returned error was
  3994. // because http.StatusNotModified was returned.
  3995. func (c *AccountsSavedadstylesListCall) Do(opts ...googleapi.CallOption) (*SavedAdStyles, error) {
  3996. gensupport.SetOptions(c.urlParams_, opts...)
  3997. res, err := c.doRequest("json")
  3998. if res != nil && res.StatusCode == http.StatusNotModified {
  3999. if res.Body != nil {
  4000. res.Body.Close()
  4001. }
  4002. return nil, &googleapi.Error{
  4003. Code: res.StatusCode,
  4004. Header: res.Header,
  4005. }
  4006. }
  4007. if err != nil {
  4008. return nil, err
  4009. }
  4010. defer googleapi.CloseBody(res)
  4011. if err := googleapi.CheckResponse(res); err != nil {
  4012. return nil, err
  4013. }
  4014. ret := &SavedAdStyles{
  4015. ServerResponse: googleapi.ServerResponse{
  4016. Header: res.Header,
  4017. HTTPStatusCode: res.StatusCode,
  4018. },
  4019. }
  4020. target := &ret
  4021. if err := gensupport.DecodeResponse(target, res); err != nil {
  4022. return nil, err
  4023. }
  4024. return ret, nil
  4025. // {
  4026. // "description": "List all saved ad styles in the specified account.",
  4027. // "httpMethod": "GET",
  4028. // "id": "adsense.accounts.savedadstyles.list",
  4029. // "parameterOrder": [
  4030. // "accountId"
  4031. // ],
  4032. // "parameters": {
  4033. // "accountId": {
  4034. // "description": "Account for which to list saved ad styles.",
  4035. // "location": "path",
  4036. // "required": true,
  4037. // "type": "string"
  4038. // },
  4039. // "maxResults": {
  4040. // "description": "The maximum number of saved ad styles to include in the response, used for paging.",
  4041. // "format": "int32",
  4042. // "location": "query",
  4043. // "maximum": "10000",
  4044. // "minimum": "0",
  4045. // "type": "integer"
  4046. // },
  4047. // "pageToken": {
  4048. // "description": "A continuation token, used to page through saved ad styles. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  4049. // "location": "query",
  4050. // "type": "string"
  4051. // }
  4052. // },
  4053. // "path": "accounts/{accountId}/savedadstyles",
  4054. // "response": {
  4055. // "$ref": "SavedAdStyles"
  4056. // },
  4057. // "scopes": [
  4058. // "https://www.googleapis.com/auth/adsense",
  4059. // "https://www.googleapis.com/auth/adsense.readonly"
  4060. // ]
  4061. // }
  4062. }
  4063. // Pages invokes f for each page of results.
  4064. // A non-nil error returned from f will halt the iteration.
  4065. // The provided context supersedes any context provided to the Context method.
  4066. func (c *AccountsSavedadstylesListCall) Pages(ctx context.Context, f func(*SavedAdStyles) error) error {
  4067. c.ctx_ = ctx
  4068. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4069. for {
  4070. x, err := c.Do()
  4071. if err != nil {
  4072. return err
  4073. }
  4074. if err := f(x); err != nil {
  4075. return err
  4076. }
  4077. if x.NextPageToken == "" {
  4078. return nil
  4079. }
  4080. c.PageToken(x.NextPageToken)
  4081. }
  4082. }
  4083. // method id "adsense.accounts.urlchannels.list":
  4084. type AccountsUrlchannelsListCall struct {
  4085. s *Service
  4086. accountId string
  4087. adClientId string
  4088. urlParams_ gensupport.URLParams
  4089. ifNoneMatch_ string
  4090. ctx_ context.Context
  4091. header_ http.Header
  4092. }
  4093. // List: List all URL channels in the specified ad client for the
  4094. // specified account.
  4095. func (r *AccountsUrlchannelsService) List(accountId string, adClientId string) *AccountsUrlchannelsListCall {
  4096. c := &AccountsUrlchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4097. c.accountId = accountId
  4098. c.adClientId = adClientId
  4099. return c
  4100. }
  4101. // MaxResults sets the optional parameter "maxResults": The maximum
  4102. // number of URL channels to include in the response, used for paging.
  4103. func (c *AccountsUrlchannelsListCall) MaxResults(maxResults int64) *AccountsUrlchannelsListCall {
  4104. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4105. return c
  4106. }
  4107. // PageToken sets the optional parameter "pageToken": A continuation
  4108. // token, used to page through URL channels. To retrieve the next page,
  4109. // set this parameter to the value of "nextPageToken" from the previous
  4110. // response.
  4111. func (c *AccountsUrlchannelsListCall) PageToken(pageToken string) *AccountsUrlchannelsListCall {
  4112. c.urlParams_.Set("pageToken", pageToken)
  4113. return c
  4114. }
  4115. // Fields allows partial responses to be retrieved. See
  4116. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4117. // for more information.
  4118. func (c *AccountsUrlchannelsListCall) Fields(s ...googleapi.Field) *AccountsUrlchannelsListCall {
  4119. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4120. return c
  4121. }
  4122. // IfNoneMatch sets the optional parameter which makes the operation
  4123. // fail if the object's ETag matches the given value. This is useful for
  4124. // getting updates only after the object has changed since the last
  4125. // request. Use googleapi.IsNotModified to check whether the response
  4126. // error from Do is the result of In-None-Match.
  4127. func (c *AccountsUrlchannelsListCall) IfNoneMatch(entityTag string) *AccountsUrlchannelsListCall {
  4128. c.ifNoneMatch_ = entityTag
  4129. return c
  4130. }
  4131. // Context sets the context to be used in this call's Do method. Any
  4132. // pending HTTP request will be aborted if the provided context is
  4133. // canceled.
  4134. func (c *AccountsUrlchannelsListCall) Context(ctx context.Context) *AccountsUrlchannelsListCall {
  4135. c.ctx_ = ctx
  4136. return c
  4137. }
  4138. // Header returns an http.Header that can be modified by the caller to
  4139. // add HTTP headers to the request.
  4140. func (c *AccountsUrlchannelsListCall) Header() http.Header {
  4141. if c.header_ == nil {
  4142. c.header_ = make(http.Header)
  4143. }
  4144. return c.header_
  4145. }
  4146. func (c *AccountsUrlchannelsListCall) doRequest(alt string) (*http.Response, error) {
  4147. reqHeaders := make(http.Header)
  4148. for k, v := range c.header_ {
  4149. reqHeaders[k] = v
  4150. }
  4151. reqHeaders.Set("User-Agent", c.s.userAgent())
  4152. if c.ifNoneMatch_ != "" {
  4153. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4154. }
  4155. var body io.Reader = nil
  4156. c.urlParams_.Set("alt", alt)
  4157. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/urlchannels")
  4158. urls += "?" + c.urlParams_.Encode()
  4159. req, _ := http.NewRequest("GET", urls, body)
  4160. req.Header = reqHeaders
  4161. googleapi.Expand(req.URL, map[string]string{
  4162. "accountId": c.accountId,
  4163. "adClientId": c.adClientId,
  4164. })
  4165. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4166. }
  4167. // Do executes the "adsense.accounts.urlchannels.list" call.
  4168. // Exactly one of *UrlChannels or error will be non-nil. Any non-2xx
  4169. // status code is an error. Response headers are in either
  4170. // *UrlChannels.ServerResponse.Header or (if a response was returned at
  4171. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4172. // to check whether the returned error was because
  4173. // http.StatusNotModified was returned.
  4174. func (c *AccountsUrlchannelsListCall) Do(opts ...googleapi.CallOption) (*UrlChannels, error) {
  4175. gensupport.SetOptions(c.urlParams_, opts...)
  4176. res, err := c.doRequest("json")
  4177. if res != nil && res.StatusCode == http.StatusNotModified {
  4178. if res.Body != nil {
  4179. res.Body.Close()
  4180. }
  4181. return nil, &googleapi.Error{
  4182. Code: res.StatusCode,
  4183. Header: res.Header,
  4184. }
  4185. }
  4186. if err != nil {
  4187. return nil, err
  4188. }
  4189. defer googleapi.CloseBody(res)
  4190. if err := googleapi.CheckResponse(res); err != nil {
  4191. return nil, err
  4192. }
  4193. ret := &UrlChannels{
  4194. ServerResponse: googleapi.ServerResponse{
  4195. Header: res.Header,
  4196. HTTPStatusCode: res.StatusCode,
  4197. },
  4198. }
  4199. target := &ret
  4200. if err := gensupport.DecodeResponse(target, res); err != nil {
  4201. return nil, err
  4202. }
  4203. return ret, nil
  4204. // {
  4205. // "description": "List all URL channels in the specified ad client for the specified account.",
  4206. // "httpMethod": "GET",
  4207. // "id": "adsense.accounts.urlchannels.list",
  4208. // "parameterOrder": [
  4209. // "accountId",
  4210. // "adClientId"
  4211. // ],
  4212. // "parameters": {
  4213. // "accountId": {
  4214. // "description": "Account to which the ad client belongs.",
  4215. // "location": "path",
  4216. // "required": true,
  4217. // "type": "string"
  4218. // },
  4219. // "adClientId": {
  4220. // "description": "Ad client for which to list URL channels.",
  4221. // "location": "path",
  4222. // "required": true,
  4223. // "type": "string"
  4224. // },
  4225. // "maxResults": {
  4226. // "description": "The maximum number of URL channels to include in the response, used for paging.",
  4227. // "format": "int32",
  4228. // "location": "query",
  4229. // "maximum": "10000",
  4230. // "minimum": "0",
  4231. // "type": "integer"
  4232. // },
  4233. // "pageToken": {
  4234. // "description": "A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  4235. // "location": "query",
  4236. // "type": "string"
  4237. // }
  4238. // },
  4239. // "path": "accounts/{accountId}/adclients/{adClientId}/urlchannels",
  4240. // "response": {
  4241. // "$ref": "UrlChannels"
  4242. // },
  4243. // "scopes": [
  4244. // "https://www.googleapis.com/auth/adsense",
  4245. // "https://www.googleapis.com/auth/adsense.readonly"
  4246. // ]
  4247. // }
  4248. }
  4249. // Pages invokes f for each page of results.
  4250. // A non-nil error returned from f will halt the iteration.
  4251. // The provided context supersedes any context provided to the Context method.
  4252. func (c *AccountsUrlchannelsListCall) Pages(ctx context.Context, f func(*UrlChannels) error) error {
  4253. c.ctx_ = ctx
  4254. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4255. for {
  4256. x, err := c.Do()
  4257. if err != nil {
  4258. return err
  4259. }
  4260. if err := f(x); err != nil {
  4261. return err
  4262. }
  4263. if x.NextPageToken == "" {
  4264. return nil
  4265. }
  4266. c.PageToken(x.NextPageToken)
  4267. }
  4268. }
  4269. // method id "adsense.adclients.list":
  4270. type AdclientsListCall struct {
  4271. s *Service
  4272. urlParams_ gensupport.URLParams
  4273. ifNoneMatch_ string
  4274. ctx_ context.Context
  4275. header_ http.Header
  4276. }
  4277. // List: List all ad clients in this AdSense account.
  4278. func (r *AdclientsService) List() *AdclientsListCall {
  4279. c := &AdclientsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4280. return c
  4281. }
  4282. // MaxResults sets the optional parameter "maxResults": The maximum
  4283. // number of ad clients to include in the response, used for paging.
  4284. func (c *AdclientsListCall) MaxResults(maxResults int64) *AdclientsListCall {
  4285. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4286. return c
  4287. }
  4288. // PageToken sets the optional parameter "pageToken": A continuation
  4289. // token, used to page through ad clients. To retrieve the next page,
  4290. // set this parameter to the value of "nextPageToken" from the previous
  4291. // response.
  4292. func (c *AdclientsListCall) PageToken(pageToken string) *AdclientsListCall {
  4293. c.urlParams_.Set("pageToken", pageToken)
  4294. return c
  4295. }
  4296. // Fields allows partial responses to be retrieved. See
  4297. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4298. // for more information.
  4299. func (c *AdclientsListCall) Fields(s ...googleapi.Field) *AdclientsListCall {
  4300. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4301. return c
  4302. }
  4303. // IfNoneMatch sets the optional parameter which makes the operation
  4304. // fail if the object's ETag matches the given value. This is useful for
  4305. // getting updates only after the object has changed since the last
  4306. // request. Use googleapi.IsNotModified to check whether the response
  4307. // error from Do is the result of In-None-Match.
  4308. func (c *AdclientsListCall) IfNoneMatch(entityTag string) *AdclientsListCall {
  4309. c.ifNoneMatch_ = entityTag
  4310. return c
  4311. }
  4312. // Context sets the context to be used in this call's Do method. Any
  4313. // pending HTTP request will be aborted if the provided context is
  4314. // canceled.
  4315. func (c *AdclientsListCall) Context(ctx context.Context) *AdclientsListCall {
  4316. c.ctx_ = ctx
  4317. return c
  4318. }
  4319. // Header returns an http.Header that can be modified by the caller to
  4320. // add HTTP headers to the request.
  4321. func (c *AdclientsListCall) Header() http.Header {
  4322. if c.header_ == nil {
  4323. c.header_ = make(http.Header)
  4324. }
  4325. return c.header_
  4326. }
  4327. func (c *AdclientsListCall) doRequest(alt string) (*http.Response, error) {
  4328. reqHeaders := make(http.Header)
  4329. for k, v := range c.header_ {
  4330. reqHeaders[k] = v
  4331. }
  4332. reqHeaders.Set("User-Agent", c.s.userAgent())
  4333. if c.ifNoneMatch_ != "" {
  4334. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4335. }
  4336. var body io.Reader = nil
  4337. c.urlParams_.Set("alt", alt)
  4338. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients")
  4339. urls += "?" + c.urlParams_.Encode()
  4340. req, _ := http.NewRequest("GET", urls, body)
  4341. req.Header = reqHeaders
  4342. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4343. }
  4344. // Do executes the "adsense.adclients.list" call.
  4345. // Exactly one of *AdClients or error will be non-nil. Any non-2xx
  4346. // status code is an error. Response headers are in either
  4347. // *AdClients.ServerResponse.Header or (if a response was returned at
  4348. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4349. // to check whether the returned error was because
  4350. // http.StatusNotModified was returned.
  4351. func (c *AdclientsListCall) Do(opts ...googleapi.CallOption) (*AdClients, error) {
  4352. gensupport.SetOptions(c.urlParams_, opts...)
  4353. res, err := c.doRequest("json")
  4354. if res != nil && res.StatusCode == http.StatusNotModified {
  4355. if res.Body != nil {
  4356. res.Body.Close()
  4357. }
  4358. return nil, &googleapi.Error{
  4359. Code: res.StatusCode,
  4360. Header: res.Header,
  4361. }
  4362. }
  4363. if err != nil {
  4364. return nil, err
  4365. }
  4366. defer googleapi.CloseBody(res)
  4367. if err := googleapi.CheckResponse(res); err != nil {
  4368. return nil, err
  4369. }
  4370. ret := &AdClients{
  4371. ServerResponse: googleapi.ServerResponse{
  4372. Header: res.Header,
  4373. HTTPStatusCode: res.StatusCode,
  4374. },
  4375. }
  4376. target := &ret
  4377. if err := gensupport.DecodeResponse(target, res); err != nil {
  4378. return nil, err
  4379. }
  4380. return ret, nil
  4381. // {
  4382. // "description": "List all ad clients in this AdSense account.",
  4383. // "httpMethod": "GET",
  4384. // "id": "adsense.adclients.list",
  4385. // "parameters": {
  4386. // "maxResults": {
  4387. // "description": "The maximum number of ad clients to include in the response, used for paging.",
  4388. // "format": "int32",
  4389. // "location": "query",
  4390. // "maximum": "10000",
  4391. // "minimum": "0",
  4392. // "type": "integer"
  4393. // },
  4394. // "pageToken": {
  4395. // "description": "A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  4396. // "location": "query",
  4397. // "type": "string"
  4398. // }
  4399. // },
  4400. // "path": "adclients",
  4401. // "response": {
  4402. // "$ref": "AdClients"
  4403. // },
  4404. // "scopes": [
  4405. // "https://www.googleapis.com/auth/adsense",
  4406. // "https://www.googleapis.com/auth/adsense.readonly"
  4407. // ]
  4408. // }
  4409. }
  4410. // Pages invokes f for each page of results.
  4411. // A non-nil error returned from f will halt the iteration.
  4412. // The provided context supersedes any context provided to the Context method.
  4413. func (c *AdclientsListCall) Pages(ctx context.Context, f func(*AdClients) error) error {
  4414. c.ctx_ = ctx
  4415. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4416. for {
  4417. x, err := c.Do()
  4418. if err != nil {
  4419. return err
  4420. }
  4421. if err := f(x); err != nil {
  4422. return err
  4423. }
  4424. if x.NextPageToken == "" {
  4425. return nil
  4426. }
  4427. c.PageToken(x.NextPageToken)
  4428. }
  4429. }
  4430. // method id "adsense.adunits.get":
  4431. type AdunitsGetCall struct {
  4432. s *Service
  4433. adClientId string
  4434. adUnitId string
  4435. urlParams_ gensupport.URLParams
  4436. ifNoneMatch_ string
  4437. ctx_ context.Context
  4438. header_ http.Header
  4439. }
  4440. // Get: Gets the specified ad unit in the specified ad client.
  4441. func (r *AdunitsService) Get(adClientId string, adUnitId string) *AdunitsGetCall {
  4442. c := &AdunitsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4443. c.adClientId = adClientId
  4444. c.adUnitId = adUnitId
  4445. return c
  4446. }
  4447. // Fields allows partial responses to be retrieved. See
  4448. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4449. // for more information.
  4450. func (c *AdunitsGetCall) Fields(s ...googleapi.Field) *AdunitsGetCall {
  4451. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4452. return c
  4453. }
  4454. // IfNoneMatch sets the optional parameter which makes the operation
  4455. // fail if the object's ETag matches the given value. This is useful for
  4456. // getting updates only after the object has changed since the last
  4457. // request. Use googleapi.IsNotModified to check whether the response
  4458. // error from Do is the result of In-None-Match.
  4459. func (c *AdunitsGetCall) IfNoneMatch(entityTag string) *AdunitsGetCall {
  4460. c.ifNoneMatch_ = entityTag
  4461. return c
  4462. }
  4463. // Context sets the context to be used in this call's Do method. Any
  4464. // pending HTTP request will be aborted if the provided context is
  4465. // canceled.
  4466. func (c *AdunitsGetCall) Context(ctx context.Context) *AdunitsGetCall {
  4467. c.ctx_ = ctx
  4468. return c
  4469. }
  4470. // Header returns an http.Header that can be modified by the caller to
  4471. // add HTTP headers to the request.
  4472. func (c *AdunitsGetCall) Header() http.Header {
  4473. if c.header_ == nil {
  4474. c.header_ = make(http.Header)
  4475. }
  4476. return c.header_
  4477. }
  4478. func (c *AdunitsGetCall) doRequest(alt string) (*http.Response, error) {
  4479. reqHeaders := make(http.Header)
  4480. for k, v := range c.header_ {
  4481. reqHeaders[k] = v
  4482. }
  4483. reqHeaders.Set("User-Agent", c.s.userAgent())
  4484. if c.ifNoneMatch_ != "" {
  4485. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4486. }
  4487. var body io.Reader = nil
  4488. c.urlParams_.Set("alt", alt)
  4489. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/adunits/{adUnitId}")
  4490. urls += "?" + c.urlParams_.Encode()
  4491. req, _ := http.NewRequest("GET", urls, body)
  4492. req.Header = reqHeaders
  4493. googleapi.Expand(req.URL, map[string]string{
  4494. "adClientId": c.adClientId,
  4495. "adUnitId": c.adUnitId,
  4496. })
  4497. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4498. }
  4499. // Do executes the "adsense.adunits.get" call.
  4500. // Exactly one of *AdUnit or error will be non-nil. Any non-2xx status
  4501. // code is an error. Response headers are in either
  4502. // *AdUnit.ServerResponse.Header or (if a response was returned at all)
  4503. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4504. // check whether the returned error was because http.StatusNotModified
  4505. // was returned.
  4506. func (c *AdunitsGetCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  4507. gensupport.SetOptions(c.urlParams_, opts...)
  4508. res, err := c.doRequest("json")
  4509. if res != nil && res.StatusCode == http.StatusNotModified {
  4510. if res.Body != nil {
  4511. res.Body.Close()
  4512. }
  4513. return nil, &googleapi.Error{
  4514. Code: res.StatusCode,
  4515. Header: res.Header,
  4516. }
  4517. }
  4518. if err != nil {
  4519. return nil, err
  4520. }
  4521. defer googleapi.CloseBody(res)
  4522. if err := googleapi.CheckResponse(res); err != nil {
  4523. return nil, err
  4524. }
  4525. ret := &AdUnit{
  4526. ServerResponse: googleapi.ServerResponse{
  4527. Header: res.Header,
  4528. HTTPStatusCode: res.StatusCode,
  4529. },
  4530. }
  4531. target := &ret
  4532. if err := gensupport.DecodeResponse(target, res); err != nil {
  4533. return nil, err
  4534. }
  4535. return ret, nil
  4536. // {
  4537. // "description": "Gets the specified ad unit in the specified ad client.",
  4538. // "httpMethod": "GET",
  4539. // "id": "adsense.adunits.get",
  4540. // "parameterOrder": [
  4541. // "adClientId",
  4542. // "adUnitId"
  4543. // ],
  4544. // "parameters": {
  4545. // "adClientId": {
  4546. // "description": "Ad client for which to get the ad unit.",
  4547. // "location": "path",
  4548. // "required": true,
  4549. // "type": "string"
  4550. // },
  4551. // "adUnitId": {
  4552. // "description": "Ad unit to retrieve.",
  4553. // "location": "path",
  4554. // "required": true,
  4555. // "type": "string"
  4556. // }
  4557. // },
  4558. // "path": "adclients/{adClientId}/adunits/{adUnitId}",
  4559. // "response": {
  4560. // "$ref": "AdUnit"
  4561. // },
  4562. // "scopes": [
  4563. // "https://www.googleapis.com/auth/adsense",
  4564. // "https://www.googleapis.com/auth/adsense.readonly"
  4565. // ]
  4566. // }
  4567. }
  4568. // method id "adsense.adunits.getAdCode":
  4569. type AdunitsGetAdCodeCall struct {
  4570. s *Service
  4571. adClientId string
  4572. adUnitId string
  4573. urlParams_ gensupport.URLParams
  4574. ifNoneMatch_ string
  4575. ctx_ context.Context
  4576. header_ http.Header
  4577. }
  4578. // GetAdCode: Get ad code for the specified ad unit.
  4579. func (r *AdunitsService) GetAdCode(adClientId string, adUnitId string) *AdunitsGetAdCodeCall {
  4580. c := &AdunitsGetAdCodeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4581. c.adClientId = adClientId
  4582. c.adUnitId = adUnitId
  4583. return c
  4584. }
  4585. // Fields allows partial responses to be retrieved. See
  4586. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4587. // for more information.
  4588. func (c *AdunitsGetAdCodeCall) Fields(s ...googleapi.Field) *AdunitsGetAdCodeCall {
  4589. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4590. return c
  4591. }
  4592. // IfNoneMatch sets the optional parameter which makes the operation
  4593. // fail if the object's ETag matches the given value. This is useful for
  4594. // getting updates only after the object has changed since the last
  4595. // request. Use googleapi.IsNotModified to check whether the response
  4596. // error from Do is the result of In-None-Match.
  4597. func (c *AdunitsGetAdCodeCall) IfNoneMatch(entityTag string) *AdunitsGetAdCodeCall {
  4598. c.ifNoneMatch_ = entityTag
  4599. return c
  4600. }
  4601. // Context sets the context to be used in this call's Do method. Any
  4602. // pending HTTP request will be aborted if the provided context is
  4603. // canceled.
  4604. func (c *AdunitsGetAdCodeCall) Context(ctx context.Context) *AdunitsGetAdCodeCall {
  4605. c.ctx_ = ctx
  4606. return c
  4607. }
  4608. // Header returns an http.Header that can be modified by the caller to
  4609. // add HTTP headers to the request.
  4610. func (c *AdunitsGetAdCodeCall) Header() http.Header {
  4611. if c.header_ == nil {
  4612. c.header_ = make(http.Header)
  4613. }
  4614. return c.header_
  4615. }
  4616. func (c *AdunitsGetAdCodeCall) doRequest(alt string) (*http.Response, error) {
  4617. reqHeaders := make(http.Header)
  4618. for k, v := range c.header_ {
  4619. reqHeaders[k] = v
  4620. }
  4621. reqHeaders.Set("User-Agent", c.s.userAgent())
  4622. if c.ifNoneMatch_ != "" {
  4623. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4624. }
  4625. var body io.Reader = nil
  4626. c.urlParams_.Set("alt", alt)
  4627. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/adunits/{adUnitId}/adcode")
  4628. urls += "?" + c.urlParams_.Encode()
  4629. req, _ := http.NewRequest("GET", urls, body)
  4630. req.Header = reqHeaders
  4631. googleapi.Expand(req.URL, map[string]string{
  4632. "adClientId": c.adClientId,
  4633. "adUnitId": c.adUnitId,
  4634. })
  4635. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4636. }
  4637. // Do executes the "adsense.adunits.getAdCode" call.
  4638. // Exactly one of *AdCode or error will be non-nil. Any non-2xx status
  4639. // code is an error. Response headers are in either
  4640. // *AdCode.ServerResponse.Header or (if a response was returned at all)
  4641. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4642. // check whether the returned error was because http.StatusNotModified
  4643. // was returned.
  4644. func (c *AdunitsGetAdCodeCall) Do(opts ...googleapi.CallOption) (*AdCode, error) {
  4645. gensupport.SetOptions(c.urlParams_, opts...)
  4646. res, err := c.doRequest("json")
  4647. if res != nil && res.StatusCode == http.StatusNotModified {
  4648. if res.Body != nil {
  4649. res.Body.Close()
  4650. }
  4651. return nil, &googleapi.Error{
  4652. Code: res.StatusCode,
  4653. Header: res.Header,
  4654. }
  4655. }
  4656. if err != nil {
  4657. return nil, err
  4658. }
  4659. defer googleapi.CloseBody(res)
  4660. if err := googleapi.CheckResponse(res); err != nil {
  4661. return nil, err
  4662. }
  4663. ret := &AdCode{
  4664. ServerResponse: googleapi.ServerResponse{
  4665. Header: res.Header,
  4666. HTTPStatusCode: res.StatusCode,
  4667. },
  4668. }
  4669. target := &ret
  4670. if err := gensupport.DecodeResponse(target, res); err != nil {
  4671. return nil, err
  4672. }
  4673. return ret, nil
  4674. // {
  4675. // "description": "Get ad code for the specified ad unit.",
  4676. // "httpMethod": "GET",
  4677. // "id": "adsense.adunits.getAdCode",
  4678. // "parameterOrder": [
  4679. // "adClientId",
  4680. // "adUnitId"
  4681. // ],
  4682. // "parameters": {
  4683. // "adClientId": {
  4684. // "description": "Ad client with contains the ad unit.",
  4685. // "location": "path",
  4686. // "required": true,
  4687. // "type": "string"
  4688. // },
  4689. // "adUnitId": {
  4690. // "description": "Ad unit to get the code for.",
  4691. // "location": "path",
  4692. // "required": true,
  4693. // "type": "string"
  4694. // }
  4695. // },
  4696. // "path": "adclients/{adClientId}/adunits/{adUnitId}/adcode",
  4697. // "response": {
  4698. // "$ref": "AdCode"
  4699. // },
  4700. // "scopes": [
  4701. // "https://www.googleapis.com/auth/adsense",
  4702. // "https://www.googleapis.com/auth/adsense.readonly"
  4703. // ]
  4704. // }
  4705. }
  4706. // method id "adsense.adunits.list":
  4707. type AdunitsListCall struct {
  4708. s *Service
  4709. adClientId string
  4710. urlParams_ gensupport.URLParams
  4711. ifNoneMatch_ string
  4712. ctx_ context.Context
  4713. header_ http.Header
  4714. }
  4715. // List: List all ad units in the specified ad client for this AdSense
  4716. // account.
  4717. func (r *AdunitsService) List(adClientId string) *AdunitsListCall {
  4718. c := &AdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4719. c.adClientId = adClientId
  4720. return c
  4721. }
  4722. // IncludeInactive sets the optional parameter "includeInactive":
  4723. // Whether to include inactive ad units. Default: true.
  4724. func (c *AdunitsListCall) IncludeInactive(includeInactive bool) *AdunitsListCall {
  4725. c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive))
  4726. return c
  4727. }
  4728. // MaxResults sets the optional parameter "maxResults": The maximum
  4729. // number of ad units to include in the response, used for paging.
  4730. func (c *AdunitsListCall) MaxResults(maxResults int64) *AdunitsListCall {
  4731. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4732. return c
  4733. }
  4734. // PageToken sets the optional parameter "pageToken": A continuation
  4735. // token, used to page through ad units. To retrieve the next page, set
  4736. // this parameter to the value of "nextPageToken" from the previous
  4737. // response.
  4738. func (c *AdunitsListCall) PageToken(pageToken string) *AdunitsListCall {
  4739. c.urlParams_.Set("pageToken", pageToken)
  4740. return c
  4741. }
  4742. // Fields allows partial responses to be retrieved. See
  4743. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4744. // for more information.
  4745. func (c *AdunitsListCall) Fields(s ...googleapi.Field) *AdunitsListCall {
  4746. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4747. return c
  4748. }
  4749. // IfNoneMatch sets the optional parameter which makes the operation
  4750. // fail if the object's ETag matches the given value. This is useful for
  4751. // getting updates only after the object has changed since the last
  4752. // request. Use googleapi.IsNotModified to check whether the response
  4753. // error from Do is the result of In-None-Match.
  4754. func (c *AdunitsListCall) IfNoneMatch(entityTag string) *AdunitsListCall {
  4755. c.ifNoneMatch_ = entityTag
  4756. return c
  4757. }
  4758. // Context sets the context to be used in this call's Do method. Any
  4759. // pending HTTP request will be aborted if the provided context is
  4760. // canceled.
  4761. func (c *AdunitsListCall) Context(ctx context.Context) *AdunitsListCall {
  4762. c.ctx_ = ctx
  4763. return c
  4764. }
  4765. // Header returns an http.Header that can be modified by the caller to
  4766. // add HTTP headers to the request.
  4767. func (c *AdunitsListCall) Header() http.Header {
  4768. if c.header_ == nil {
  4769. c.header_ = make(http.Header)
  4770. }
  4771. return c.header_
  4772. }
  4773. func (c *AdunitsListCall) doRequest(alt string) (*http.Response, error) {
  4774. reqHeaders := make(http.Header)
  4775. for k, v := range c.header_ {
  4776. reqHeaders[k] = v
  4777. }
  4778. reqHeaders.Set("User-Agent", c.s.userAgent())
  4779. if c.ifNoneMatch_ != "" {
  4780. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4781. }
  4782. var body io.Reader = nil
  4783. c.urlParams_.Set("alt", alt)
  4784. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/adunits")
  4785. urls += "?" + c.urlParams_.Encode()
  4786. req, _ := http.NewRequest("GET", urls, body)
  4787. req.Header = reqHeaders
  4788. googleapi.Expand(req.URL, map[string]string{
  4789. "adClientId": c.adClientId,
  4790. })
  4791. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4792. }
  4793. // Do executes the "adsense.adunits.list" call.
  4794. // Exactly one of *AdUnits or error will be non-nil. Any non-2xx status
  4795. // code is an error. Response headers are in either
  4796. // *AdUnits.ServerResponse.Header or (if a response was returned at all)
  4797. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4798. // check whether the returned error was because http.StatusNotModified
  4799. // was returned.
  4800. func (c *AdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) {
  4801. gensupport.SetOptions(c.urlParams_, opts...)
  4802. res, err := c.doRequest("json")
  4803. if res != nil && res.StatusCode == http.StatusNotModified {
  4804. if res.Body != nil {
  4805. res.Body.Close()
  4806. }
  4807. return nil, &googleapi.Error{
  4808. Code: res.StatusCode,
  4809. Header: res.Header,
  4810. }
  4811. }
  4812. if err != nil {
  4813. return nil, err
  4814. }
  4815. defer googleapi.CloseBody(res)
  4816. if err := googleapi.CheckResponse(res); err != nil {
  4817. return nil, err
  4818. }
  4819. ret := &AdUnits{
  4820. ServerResponse: googleapi.ServerResponse{
  4821. Header: res.Header,
  4822. HTTPStatusCode: res.StatusCode,
  4823. },
  4824. }
  4825. target := &ret
  4826. if err := gensupport.DecodeResponse(target, res); err != nil {
  4827. return nil, err
  4828. }
  4829. return ret, nil
  4830. // {
  4831. // "description": "List all ad units in the specified ad client for this AdSense account.",
  4832. // "httpMethod": "GET",
  4833. // "id": "adsense.adunits.list",
  4834. // "parameterOrder": [
  4835. // "adClientId"
  4836. // ],
  4837. // "parameters": {
  4838. // "adClientId": {
  4839. // "description": "Ad client for which to list ad units.",
  4840. // "location": "path",
  4841. // "required": true,
  4842. // "type": "string"
  4843. // },
  4844. // "includeInactive": {
  4845. // "description": "Whether to include inactive ad units. Default: true.",
  4846. // "location": "query",
  4847. // "type": "boolean"
  4848. // },
  4849. // "maxResults": {
  4850. // "description": "The maximum number of ad units to include in the response, used for paging.",
  4851. // "format": "int32",
  4852. // "location": "query",
  4853. // "maximum": "10000",
  4854. // "minimum": "0",
  4855. // "type": "integer"
  4856. // },
  4857. // "pageToken": {
  4858. // "description": "A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  4859. // "location": "query",
  4860. // "type": "string"
  4861. // }
  4862. // },
  4863. // "path": "adclients/{adClientId}/adunits",
  4864. // "response": {
  4865. // "$ref": "AdUnits"
  4866. // },
  4867. // "scopes": [
  4868. // "https://www.googleapis.com/auth/adsense",
  4869. // "https://www.googleapis.com/auth/adsense.readonly"
  4870. // ]
  4871. // }
  4872. }
  4873. // Pages invokes f for each page of results.
  4874. // A non-nil error returned from f will halt the iteration.
  4875. // The provided context supersedes any context provided to the Context method.
  4876. func (c *AdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error {
  4877. c.ctx_ = ctx
  4878. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4879. for {
  4880. x, err := c.Do()
  4881. if err != nil {
  4882. return err
  4883. }
  4884. if err := f(x); err != nil {
  4885. return err
  4886. }
  4887. if x.NextPageToken == "" {
  4888. return nil
  4889. }
  4890. c.PageToken(x.NextPageToken)
  4891. }
  4892. }
  4893. // method id "adsense.adunits.customchannels.list":
  4894. type AdunitsCustomchannelsListCall struct {
  4895. s *Service
  4896. adClientId string
  4897. adUnitId string
  4898. urlParams_ gensupport.URLParams
  4899. ifNoneMatch_ string
  4900. ctx_ context.Context
  4901. header_ http.Header
  4902. }
  4903. // List: List all custom channels which the specified ad unit belongs
  4904. // to.
  4905. func (r *AdunitsCustomchannelsService) List(adClientId string, adUnitId string) *AdunitsCustomchannelsListCall {
  4906. c := &AdunitsCustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4907. c.adClientId = adClientId
  4908. c.adUnitId = adUnitId
  4909. return c
  4910. }
  4911. // MaxResults sets the optional parameter "maxResults": The maximum
  4912. // number of custom channels to include in the response, used for
  4913. // paging.
  4914. func (c *AdunitsCustomchannelsListCall) MaxResults(maxResults int64) *AdunitsCustomchannelsListCall {
  4915. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4916. return c
  4917. }
  4918. // PageToken sets the optional parameter "pageToken": A continuation
  4919. // token, used to page through custom channels. To retrieve the next
  4920. // page, set this parameter to the value of "nextPageToken" from the
  4921. // previous response.
  4922. func (c *AdunitsCustomchannelsListCall) PageToken(pageToken string) *AdunitsCustomchannelsListCall {
  4923. c.urlParams_.Set("pageToken", pageToken)
  4924. return c
  4925. }
  4926. // Fields allows partial responses to be retrieved. See
  4927. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4928. // for more information.
  4929. func (c *AdunitsCustomchannelsListCall) Fields(s ...googleapi.Field) *AdunitsCustomchannelsListCall {
  4930. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4931. return c
  4932. }
  4933. // IfNoneMatch sets the optional parameter which makes the operation
  4934. // fail if the object's ETag matches the given value. This is useful for
  4935. // getting updates only after the object has changed since the last
  4936. // request. Use googleapi.IsNotModified to check whether the response
  4937. // error from Do is the result of In-None-Match.
  4938. func (c *AdunitsCustomchannelsListCall) IfNoneMatch(entityTag string) *AdunitsCustomchannelsListCall {
  4939. c.ifNoneMatch_ = entityTag
  4940. return c
  4941. }
  4942. // Context sets the context to be used in this call's Do method. Any
  4943. // pending HTTP request will be aborted if the provided context is
  4944. // canceled.
  4945. func (c *AdunitsCustomchannelsListCall) Context(ctx context.Context) *AdunitsCustomchannelsListCall {
  4946. c.ctx_ = ctx
  4947. return c
  4948. }
  4949. // Header returns an http.Header that can be modified by the caller to
  4950. // add HTTP headers to the request.
  4951. func (c *AdunitsCustomchannelsListCall) Header() http.Header {
  4952. if c.header_ == nil {
  4953. c.header_ = make(http.Header)
  4954. }
  4955. return c.header_
  4956. }
  4957. func (c *AdunitsCustomchannelsListCall) doRequest(alt string) (*http.Response, error) {
  4958. reqHeaders := make(http.Header)
  4959. for k, v := range c.header_ {
  4960. reqHeaders[k] = v
  4961. }
  4962. reqHeaders.Set("User-Agent", c.s.userAgent())
  4963. if c.ifNoneMatch_ != "" {
  4964. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4965. }
  4966. var body io.Reader = nil
  4967. c.urlParams_.Set("alt", alt)
  4968. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/adunits/{adUnitId}/customchannels")
  4969. urls += "?" + c.urlParams_.Encode()
  4970. req, _ := http.NewRequest("GET", urls, body)
  4971. req.Header = reqHeaders
  4972. googleapi.Expand(req.URL, map[string]string{
  4973. "adClientId": c.adClientId,
  4974. "adUnitId": c.adUnitId,
  4975. })
  4976. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4977. }
  4978. // Do executes the "adsense.adunits.customchannels.list" call.
  4979. // Exactly one of *CustomChannels or error will be non-nil. Any non-2xx
  4980. // status code is an error. Response headers are in either
  4981. // *CustomChannels.ServerResponse.Header or (if a response was returned
  4982. // at all) in error.(*googleapi.Error).Header. Use
  4983. // googleapi.IsNotModified to check whether the returned error was
  4984. // because http.StatusNotModified was returned.
  4985. func (c *AdunitsCustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) {
  4986. gensupport.SetOptions(c.urlParams_, opts...)
  4987. res, err := c.doRequest("json")
  4988. if res != nil && res.StatusCode == http.StatusNotModified {
  4989. if res.Body != nil {
  4990. res.Body.Close()
  4991. }
  4992. return nil, &googleapi.Error{
  4993. Code: res.StatusCode,
  4994. Header: res.Header,
  4995. }
  4996. }
  4997. if err != nil {
  4998. return nil, err
  4999. }
  5000. defer googleapi.CloseBody(res)
  5001. if err := googleapi.CheckResponse(res); err != nil {
  5002. return nil, err
  5003. }
  5004. ret := &CustomChannels{
  5005. ServerResponse: googleapi.ServerResponse{
  5006. Header: res.Header,
  5007. HTTPStatusCode: res.StatusCode,
  5008. },
  5009. }
  5010. target := &ret
  5011. if err := gensupport.DecodeResponse(target, res); err != nil {
  5012. return nil, err
  5013. }
  5014. return ret, nil
  5015. // {
  5016. // "description": "List all custom channels which the specified ad unit belongs to.",
  5017. // "httpMethod": "GET",
  5018. // "id": "adsense.adunits.customchannels.list",
  5019. // "parameterOrder": [
  5020. // "adClientId",
  5021. // "adUnitId"
  5022. // ],
  5023. // "parameters": {
  5024. // "adClientId": {
  5025. // "description": "Ad client which contains the ad unit.",
  5026. // "location": "path",
  5027. // "required": true,
  5028. // "type": "string"
  5029. // },
  5030. // "adUnitId": {
  5031. // "description": "Ad unit for which to list custom channels.",
  5032. // "location": "path",
  5033. // "required": true,
  5034. // "type": "string"
  5035. // },
  5036. // "maxResults": {
  5037. // "description": "The maximum number of custom channels to include in the response, used for paging.",
  5038. // "format": "int32",
  5039. // "location": "query",
  5040. // "maximum": "10000",
  5041. // "minimum": "0",
  5042. // "type": "integer"
  5043. // },
  5044. // "pageToken": {
  5045. // "description": "A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  5046. // "location": "query",
  5047. // "type": "string"
  5048. // }
  5049. // },
  5050. // "path": "adclients/{adClientId}/adunits/{adUnitId}/customchannels",
  5051. // "response": {
  5052. // "$ref": "CustomChannels"
  5053. // },
  5054. // "scopes": [
  5055. // "https://www.googleapis.com/auth/adsense",
  5056. // "https://www.googleapis.com/auth/adsense.readonly"
  5057. // ]
  5058. // }
  5059. }
  5060. // Pages invokes f for each page of results.
  5061. // A non-nil error returned from f will halt the iteration.
  5062. // The provided context supersedes any context provided to the Context method.
  5063. func (c *AdunitsCustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error {
  5064. c.ctx_ = ctx
  5065. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5066. for {
  5067. x, err := c.Do()
  5068. if err != nil {
  5069. return err
  5070. }
  5071. if err := f(x); err != nil {
  5072. return err
  5073. }
  5074. if x.NextPageToken == "" {
  5075. return nil
  5076. }
  5077. c.PageToken(x.NextPageToken)
  5078. }
  5079. }
  5080. // method id "adsense.alerts.list":
  5081. type AlertsListCall struct {
  5082. s *Service
  5083. urlParams_ gensupport.URLParams
  5084. ifNoneMatch_ string
  5085. ctx_ context.Context
  5086. header_ http.Header
  5087. }
  5088. // List: List the alerts for this AdSense account.
  5089. func (r *AlertsService) List() *AlertsListCall {
  5090. c := &AlertsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5091. return c
  5092. }
  5093. // Locale sets the optional parameter "locale": The locale to use for
  5094. // translating alert messages. The account locale will be used if this
  5095. // is not supplied. The AdSense default (English) will be used if the
  5096. // supplied locale is invalid or unsupported.
  5097. func (c *AlertsListCall) Locale(locale string) *AlertsListCall {
  5098. c.urlParams_.Set("locale", locale)
  5099. return c
  5100. }
  5101. // Fields allows partial responses to be retrieved. See
  5102. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5103. // for more information.
  5104. func (c *AlertsListCall) Fields(s ...googleapi.Field) *AlertsListCall {
  5105. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5106. return c
  5107. }
  5108. // IfNoneMatch sets the optional parameter which makes the operation
  5109. // fail if the object's ETag matches the given value. This is useful for
  5110. // getting updates only after the object has changed since the last
  5111. // request. Use googleapi.IsNotModified to check whether the response
  5112. // error from Do is the result of In-None-Match.
  5113. func (c *AlertsListCall) IfNoneMatch(entityTag string) *AlertsListCall {
  5114. c.ifNoneMatch_ = entityTag
  5115. return c
  5116. }
  5117. // Context sets the context to be used in this call's Do method. Any
  5118. // pending HTTP request will be aborted if the provided context is
  5119. // canceled.
  5120. func (c *AlertsListCall) Context(ctx context.Context) *AlertsListCall {
  5121. c.ctx_ = ctx
  5122. return c
  5123. }
  5124. // Header returns an http.Header that can be modified by the caller to
  5125. // add HTTP headers to the request.
  5126. func (c *AlertsListCall) Header() http.Header {
  5127. if c.header_ == nil {
  5128. c.header_ = make(http.Header)
  5129. }
  5130. return c.header_
  5131. }
  5132. func (c *AlertsListCall) doRequest(alt string) (*http.Response, error) {
  5133. reqHeaders := make(http.Header)
  5134. for k, v := range c.header_ {
  5135. reqHeaders[k] = v
  5136. }
  5137. reqHeaders.Set("User-Agent", c.s.userAgent())
  5138. if c.ifNoneMatch_ != "" {
  5139. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5140. }
  5141. var body io.Reader = nil
  5142. c.urlParams_.Set("alt", alt)
  5143. urls := googleapi.ResolveRelative(c.s.BasePath, "alerts")
  5144. urls += "?" + c.urlParams_.Encode()
  5145. req, _ := http.NewRequest("GET", urls, body)
  5146. req.Header = reqHeaders
  5147. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5148. }
  5149. // Do executes the "adsense.alerts.list" call.
  5150. // Exactly one of *Alerts or error will be non-nil. Any non-2xx status
  5151. // code is an error. Response headers are in either
  5152. // *Alerts.ServerResponse.Header or (if a response was returned at all)
  5153. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5154. // check whether the returned error was because http.StatusNotModified
  5155. // was returned.
  5156. func (c *AlertsListCall) Do(opts ...googleapi.CallOption) (*Alerts, error) {
  5157. gensupport.SetOptions(c.urlParams_, opts...)
  5158. res, err := c.doRequest("json")
  5159. if res != nil && res.StatusCode == http.StatusNotModified {
  5160. if res.Body != nil {
  5161. res.Body.Close()
  5162. }
  5163. return nil, &googleapi.Error{
  5164. Code: res.StatusCode,
  5165. Header: res.Header,
  5166. }
  5167. }
  5168. if err != nil {
  5169. return nil, err
  5170. }
  5171. defer googleapi.CloseBody(res)
  5172. if err := googleapi.CheckResponse(res); err != nil {
  5173. return nil, err
  5174. }
  5175. ret := &Alerts{
  5176. ServerResponse: googleapi.ServerResponse{
  5177. Header: res.Header,
  5178. HTTPStatusCode: res.StatusCode,
  5179. },
  5180. }
  5181. target := &ret
  5182. if err := gensupport.DecodeResponse(target, res); err != nil {
  5183. return nil, err
  5184. }
  5185. return ret, nil
  5186. // {
  5187. // "description": "List the alerts for this AdSense account.",
  5188. // "httpMethod": "GET",
  5189. // "id": "adsense.alerts.list",
  5190. // "parameters": {
  5191. // "locale": {
  5192. // "description": "The locale to use for translating alert messages. The account locale will be used if this is not supplied. The AdSense default (English) will be used if the supplied locale is invalid or unsupported.",
  5193. // "location": "query",
  5194. // "type": "string"
  5195. // }
  5196. // },
  5197. // "path": "alerts",
  5198. // "response": {
  5199. // "$ref": "Alerts"
  5200. // },
  5201. // "scopes": [
  5202. // "https://www.googleapis.com/auth/adsense",
  5203. // "https://www.googleapis.com/auth/adsense.readonly"
  5204. // ]
  5205. // }
  5206. }
  5207. // method id "adsense.customchannels.get":
  5208. type CustomchannelsGetCall struct {
  5209. s *Service
  5210. adClientId string
  5211. customChannelId string
  5212. urlParams_ gensupport.URLParams
  5213. ifNoneMatch_ string
  5214. ctx_ context.Context
  5215. header_ http.Header
  5216. }
  5217. // Get: Get the specified custom channel from the specified ad client.
  5218. func (r *CustomchannelsService) Get(adClientId string, customChannelId string) *CustomchannelsGetCall {
  5219. c := &CustomchannelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5220. c.adClientId = adClientId
  5221. c.customChannelId = customChannelId
  5222. return c
  5223. }
  5224. // Fields allows partial responses to be retrieved. See
  5225. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5226. // for more information.
  5227. func (c *CustomchannelsGetCall) Fields(s ...googleapi.Field) *CustomchannelsGetCall {
  5228. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5229. return c
  5230. }
  5231. // IfNoneMatch sets the optional parameter which makes the operation
  5232. // fail if the object's ETag matches the given value. This is useful for
  5233. // getting updates only after the object has changed since the last
  5234. // request. Use googleapi.IsNotModified to check whether the response
  5235. // error from Do is the result of In-None-Match.
  5236. func (c *CustomchannelsGetCall) IfNoneMatch(entityTag string) *CustomchannelsGetCall {
  5237. c.ifNoneMatch_ = entityTag
  5238. return c
  5239. }
  5240. // Context sets the context to be used in this call's Do method. Any
  5241. // pending HTTP request will be aborted if the provided context is
  5242. // canceled.
  5243. func (c *CustomchannelsGetCall) Context(ctx context.Context) *CustomchannelsGetCall {
  5244. c.ctx_ = ctx
  5245. return c
  5246. }
  5247. // Header returns an http.Header that can be modified by the caller to
  5248. // add HTTP headers to the request.
  5249. func (c *CustomchannelsGetCall) Header() http.Header {
  5250. if c.header_ == nil {
  5251. c.header_ = make(http.Header)
  5252. }
  5253. return c.header_
  5254. }
  5255. func (c *CustomchannelsGetCall) doRequest(alt string) (*http.Response, error) {
  5256. reqHeaders := make(http.Header)
  5257. for k, v := range c.header_ {
  5258. reqHeaders[k] = v
  5259. }
  5260. reqHeaders.Set("User-Agent", c.s.userAgent())
  5261. if c.ifNoneMatch_ != "" {
  5262. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5263. }
  5264. var body io.Reader = nil
  5265. c.urlParams_.Set("alt", alt)
  5266. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}")
  5267. urls += "?" + c.urlParams_.Encode()
  5268. req, _ := http.NewRequest("GET", urls, body)
  5269. req.Header = reqHeaders
  5270. googleapi.Expand(req.URL, map[string]string{
  5271. "adClientId": c.adClientId,
  5272. "customChannelId": c.customChannelId,
  5273. })
  5274. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5275. }
  5276. // Do executes the "adsense.customchannels.get" call.
  5277. // Exactly one of *CustomChannel or error will be non-nil. Any non-2xx
  5278. // status code is an error. Response headers are in either
  5279. // *CustomChannel.ServerResponse.Header or (if a response was returned
  5280. // at all) in error.(*googleapi.Error).Header. Use
  5281. // googleapi.IsNotModified to check whether the returned error was
  5282. // because http.StatusNotModified was returned.
  5283. func (c *CustomchannelsGetCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  5284. gensupport.SetOptions(c.urlParams_, opts...)
  5285. res, err := c.doRequest("json")
  5286. if res != nil && res.StatusCode == http.StatusNotModified {
  5287. if res.Body != nil {
  5288. res.Body.Close()
  5289. }
  5290. return nil, &googleapi.Error{
  5291. Code: res.StatusCode,
  5292. Header: res.Header,
  5293. }
  5294. }
  5295. if err != nil {
  5296. return nil, err
  5297. }
  5298. defer googleapi.CloseBody(res)
  5299. if err := googleapi.CheckResponse(res); err != nil {
  5300. return nil, err
  5301. }
  5302. ret := &CustomChannel{
  5303. ServerResponse: googleapi.ServerResponse{
  5304. Header: res.Header,
  5305. HTTPStatusCode: res.StatusCode,
  5306. },
  5307. }
  5308. target := &ret
  5309. if err := gensupport.DecodeResponse(target, res); err != nil {
  5310. return nil, err
  5311. }
  5312. return ret, nil
  5313. // {
  5314. // "description": "Get the specified custom channel from the specified ad client.",
  5315. // "httpMethod": "GET",
  5316. // "id": "adsense.customchannels.get",
  5317. // "parameterOrder": [
  5318. // "adClientId",
  5319. // "customChannelId"
  5320. // ],
  5321. // "parameters": {
  5322. // "adClientId": {
  5323. // "description": "Ad client which contains the custom channel.",
  5324. // "location": "path",
  5325. // "required": true,
  5326. // "type": "string"
  5327. // },
  5328. // "customChannelId": {
  5329. // "description": "Custom channel to retrieve.",
  5330. // "location": "path",
  5331. // "required": true,
  5332. // "type": "string"
  5333. // }
  5334. // },
  5335. // "path": "adclients/{adClientId}/customchannels/{customChannelId}",
  5336. // "response": {
  5337. // "$ref": "CustomChannel"
  5338. // },
  5339. // "scopes": [
  5340. // "https://www.googleapis.com/auth/adsense",
  5341. // "https://www.googleapis.com/auth/adsense.readonly"
  5342. // ]
  5343. // }
  5344. }
  5345. // method id "adsense.customchannels.list":
  5346. type CustomchannelsListCall struct {
  5347. s *Service
  5348. adClientId string
  5349. urlParams_ gensupport.URLParams
  5350. ifNoneMatch_ string
  5351. ctx_ context.Context
  5352. header_ http.Header
  5353. }
  5354. // List: List all custom channels in the specified ad client for this
  5355. // AdSense account.
  5356. func (r *CustomchannelsService) List(adClientId string) *CustomchannelsListCall {
  5357. c := &CustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5358. c.adClientId = adClientId
  5359. return c
  5360. }
  5361. // MaxResults sets the optional parameter "maxResults": The maximum
  5362. // number of custom channels to include in the response, used for
  5363. // paging.
  5364. func (c *CustomchannelsListCall) MaxResults(maxResults int64) *CustomchannelsListCall {
  5365. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5366. return c
  5367. }
  5368. // PageToken sets the optional parameter "pageToken": A continuation
  5369. // token, used to page through custom channels. To retrieve the next
  5370. // page, set this parameter to the value of "nextPageToken" from the
  5371. // previous response.
  5372. func (c *CustomchannelsListCall) PageToken(pageToken string) *CustomchannelsListCall {
  5373. c.urlParams_.Set("pageToken", pageToken)
  5374. return c
  5375. }
  5376. // Fields allows partial responses to be retrieved. See
  5377. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5378. // for more information.
  5379. func (c *CustomchannelsListCall) Fields(s ...googleapi.Field) *CustomchannelsListCall {
  5380. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5381. return c
  5382. }
  5383. // IfNoneMatch sets the optional parameter which makes the operation
  5384. // fail if the object's ETag matches the given value. This is useful for
  5385. // getting updates only after the object has changed since the last
  5386. // request. Use googleapi.IsNotModified to check whether the response
  5387. // error from Do is the result of In-None-Match.
  5388. func (c *CustomchannelsListCall) IfNoneMatch(entityTag string) *CustomchannelsListCall {
  5389. c.ifNoneMatch_ = entityTag
  5390. return c
  5391. }
  5392. // Context sets the context to be used in this call's Do method. Any
  5393. // pending HTTP request will be aborted if the provided context is
  5394. // canceled.
  5395. func (c *CustomchannelsListCall) Context(ctx context.Context) *CustomchannelsListCall {
  5396. c.ctx_ = ctx
  5397. return c
  5398. }
  5399. // Header returns an http.Header that can be modified by the caller to
  5400. // add HTTP headers to the request.
  5401. func (c *CustomchannelsListCall) Header() http.Header {
  5402. if c.header_ == nil {
  5403. c.header_ = make(http.Header)
  5404. }
  5405. return c.header_
  5406. }
  5407. func (c *CustomchannelsListCall) doRequest(alt string) (*http.Response, error) {
  5408. reqHeaders := make(http.Header)
  5409. for k, v := range c.header_ {
  5410. reqHeaders[k] = v
  5411. }
  5412. reqHeaders.Set("User-Agent", c.s.userAgent())
  5413. if c.ifNoneMatch_ != "" {
  5414. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5415. }
  5416. var body io.Reader = nil
  5417. c.urlParams_.Set("alt", alt)
  5418. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
  5419. urls += "?" + c.urlParams_.Encode()
  5420. req, _ := http.NewRequest("GET", urls, body)
  5421. req.Header = reqHeaders
  5422. googleapi.Expand(req.URL, map[string]string{
  5423. "adClientId": c.adClientId,
  5424. })
  5425. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5426. }
  5427. // Do executes the "adsense.customchannels.list" call.
  5428. // Exactly one of *CustomChannels or error will be non-nil. Any non-2xx
  5429. // status code is an error. Response headers are in either
  5430. // *CustomChannels.ServerResponse.Header or (if a response was returned
  5431. // at all) in error.(*googleapi.Error).Header. Use
  5432. // googleapi.IsNotModified to check whether the returned error was
  5433. // because http.StatusNotModified was returned.
  5434. func (c *CustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) {
  5435. gensupport.SetOptions(c.urlParams_, opts...)
  5436. res, err := c.doRequest("json")
  5437. if res != nil && res.StatusCode == http.StatusNotModified {
  5438. if res.Body != nil {
  5439. res.Body.Close()
  5440. }
  5441. return nil, &googleapi.Error{
  5442. Code: res.StatusCode,
  5443. Header: res.Header,
  5444. }
  5445. }
  5446. if err != nil {
  5447. return nil, err
  5448. }
  5449. defer googleapi.CloseBody(res)
  5450. if err := googleapi.CheckResponse(res); err != nil {
  5451. return nil, err
  5452. }
  5453. ret := &CustomChannels{
  5454. ServerResponse: googleapi.ServerResponse{
  5455. Header: res.Header,
  5456. HTTPStatusCode: res.StatusCode,
  5457. },
  5458. }
  5459. target := &ret
  5460. if err := gensupport.DecodeResponse(target, res); err != nil {
  5461. return nil, err
  5462. }
  5463. return ret, nil
  5464. // {
  5465. // "description": "List all custom channels in the specified ad client for this AdSense account.",
  5466. // "httpMethod": "GET",
  5467. // "id": "adsense.customchannels.list",
  5468. // "parameterOrder": [
  5469. // "adClientId"
  5470. // ],
  5471. // "parameters": {
  5472. // "adClientId": {
  5473. // "description": "Ad client for which to list custom channels.",
  5474. // "location": "path",
  5475. // "required": true,
  5476. // "type": "string"
  5477. // },
  5478. // "maxResults": {
  5479. // "description": "The maximum number of custom channels to include in the response, used for paging.",
  5480. // "format": "int32",
  5481. // "location": "query",
  5482. // "maximum": "10000",
  5483. // "minimum": "0",
  5484. // "type": "integer"
  5485. // },
  5486. // "pageToken": {
  5487. // "description": "A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  5488. // "location": "query",
  5489. // "type": "string"
  5490. // }
  5491. // },
  5492. // "path": "adclients/{adClientId}/customchannels",
  5493. // "response": {
  5494. // "$ref": "CustomChannels"
  5495. // },
  5496. // "scopes": [
  5497. // "https://www.googleapis.com/auth/adsense",
  5498. // "https://www.googleapis.com/auth/adsense.readonly"
  5499. // ]
  5500. // }
  5501. }
  5502. // Pages invokes f for each page of results.
  5503. // A non-nil error returned from f will halt the iteration.
  5504. // The provided context supersedes any context provided to the Context method.
  5505. func (c *CustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error {
  5506. c.ctx_ = ctx
  5507. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5508. for {
  5509. x, err := c.Do()
  5510. if err != nil {
  5511. return err
  5512. }
  5513. if err := f(x); err != nil {
  5514. return err
  5515. }
  5516. if x.NextPageToken == "" {
  5517. return nil
  5518. }
  5519. c.PageToken(x.NextPageToken)
  5520. }
  5521. }
  5522. // method id "adsense.customchannels.adunits.list":
  5523. type CustomchannelsAdunitsListCall struct {
  5524. s *Service
  5525. adClientId string
  5526. customChannelId string
  5527. urlParams_ gensupport.URLParams
  5528. ifNoneMatch_ string
  5529. ctx_ context.Context
  5530. header_ http.Header
  5531. }
  5532. // List: List all ad units in the specified custom channel.
  5533. func (r *CustomchannelsAdunitsService) List(adClientId string, customChannelId string) *CustomchannelsAdunitsListCall {
  5534. c := &CustomchannelsAdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5535. c.adClientId = adClientId
  5536. c.customChannelId = customChannelId
  5537. return c
  5538. }
  5539. // IncludeInactive sets the optional parameter "includeInactive":
  5540. // Whether to include inactive ad units. Default: true.
  5541. func (c *CustomchannelsAdunitsListCall) IncludeInactive(includeInactive bool) *CustomchannelsAdunitsListCall {
  5542. c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive))
  5543. return c
  5544. }
  5545. // MaxResults sets the optional parameter "maxResults": The maximum
  5546. // number of ad units to include in the response, used for paging.
  5547. func (c *CustomchannelsAdunitsListCall) MaxResults(maxResults int64) *CustomchannelsAdunitsListCall {
  5548. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5549. return c
  5550. }
  5551. // PageToken sets the optional parameter "pageToken": A continuation
  5552. // token, used to page through ad units. To retrieve the next page, set
  5553. // this parameter to the value of "nextPageToken" from the previous
  5554. // response.
  5555. func (c *CustomchannelsAdunitsListCall) PageToken(pageToken string) *CustomchannelsAdunitsListCall {
  5556. c.urlParams_.Set("pageToken", pageToken)
  5557. return c
  5558. }
  5559. // Fields allows partial responses to be retrieved. See
  5560. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5561. // for more information.
  5562. func (c *CustomchannelsAdunitsListCall) Fields(s ...googleapi.Field) *CustomchannelsAdunitsListCall {
  5563. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5564. return c
  5565. }
  5566. // IfNoneMatch sets the optional parameter which makes the operation
  5567. // fail if the object's ETag matches the given value. This is useful for
  5568. // getting updates only after the object has changed since the last
  5569. // request. Use googleapi.IsNotModified to check whether the response
  5570. // error from Do is the result of In-None-Match.
  5571. func (c *CustomchannelsAdunitsListCall) IfNoneMatch(entityTag string) *CustomchannelsAdunitsListCall {
  5572. c.ifNoneMatch_ = entityTag
  5573. return c
  5574. }
  5575. // Context sets the context to be used in this call's Do method. Any
  5576. // pending HTTP request will be aborted if the provided context is
  5577. // canceled.
  5578. func (c *CustomchannelsAdunitsListCall) Context(ctx context.Context) *CustomchannelsAdunitsListCall {
  5579. c.ctx_ = ctx
  5580. return c
  5581. }
  5582. // Header returns an http.Header that can be modified by the caller to
  5583. // add HTTP headers to the request.
  5584. func (c *CustomchannelsAdunitsListCall) Header() http.Header {
  5585. if c.header_ == nil {
  5586. c.header_ = make(http.Header)
  5587. }
  5588. return c.header_
  5589. }
  5590. func (c *CustomchannelsAdunitsListCall) doRequest(alt string) (*http.Response, error) {
  5591. reqHeaders := make(http.Header)
  5592. for k, v := range c.header_ {
  5593. reqHeaders[k] = v
  5594. }
  5595. reqHeaders.Set("User-Agent", c.s.userAgent())
  5596. if c.ifNoneMatch_ != "" {
  5597. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5598. }
  5599. var body io.Reader = nil
  5600. c.urlParams_.Set("alt", alt)
  5601. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}/adunits")
  5602. urls += "?" + c.urlParams_.Encode()
  5603. req, _ := http.NewRequest("GET", urls, body)
  5604. req.Header = reqHeaders
  5605. googleapi.Expand(req.URL, map[string]string{
  5606. "adClientId": c.adClientId,
  5607. "customChannelId": c.customChannelId,
  5608. })
  5609. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5610. }
  5611. // Do executes the "adsense.customchannels.adunits.list" call.
  5612. // Exactly one of *AdUnits or error will be non-nil. Any non-2xx status
  5613. // code is an error. Response headers are in either
  5614. // *AdUnits.ServerResponse.Header or (if a response was returned at all)
  5615. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5616. // check whether the returned error was because http.StatusNotModified
  5617. // was returned.
  5618. func (c *CustomchannelsAdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) {
  5619. gensupport.SetOptions(c.urlParams_, opts...)
  5620. res, err := c.doRequest("json")
  5621. if res != nil && res.StatusCode == http.StatusNotModified {
  5622. if res.Body != nil {
  5623. res.Body.Close()
  5624. }
  5625. return nil, &googleapi.Error{
  5626. Code: res.StatusCode,
  5627. Header: res.Header,
  5628. }
  5629. }
  5630. if err != nil {
  5631. return nil, err
  5632. }
  5633. defer googleapi.CloseBody(res)
  5634. if err := googleapi.CheckResponse(res); err != nil {
  5635. return nil, err
  5636. }
  5637. ret := &AdUnits{
  5638. ServerResponse: googleapi.ServerResponse{
  5639. Header: res.Header,
  5640. HTTPStatusCode: res.StatusCode,
  5641. },
  5642. }
  5643. target := &ret
  5644. if err := gensupport.DecodeResponse(target, res); err != nil {
  5645. return nil, err
  5646. }
  5647. return ret, nil
  5648. // {
  5649. // "description": "List all ad units in the specified custom channel.",
  5650. // "httpMethod": "GET",
  5651. // "id": "adsense.customchannels.adunits.list",
  5652. // "parameterOrder": [
  5653. // "adClientId",
  5654. // "customChannelId"
  5655. // ],
  5656. // "parameters": {
  5657. // "adClientId": {
  5658. // "description": "Ad client which contains the custom channel.",
  5659. // "location": "path",
  5660. // "required": true,
  5661. // "type": "string"
  5662. // },
  5663. // "customChannelId": {
  5664. // "description": "Custom channel for which to list ad units.",
  5665. // "location": "path",
  5666. // "required": true,
  5667. // "type": "string"
  5668. // },
  5669. // "includeInactive": {
  5670. // "description": "Whether to include inactive ad units. Default: true.",
  5671. // "location": "query",
  5672. // "type": "boolean"
  5673. // },
  5674. // "maxResults": {
  5675. // "description": "The maximum number of ad units to include in the response, used for paging.",
  5676. // "format": "int32",
  5677. // "location": "query",
  5678. // "maximum": "10000",
  5679. // "minimum": "0",
  5680. // "type": "integer"
  5681. // },
  5682. // "pageToken": {
  5683. // "description": "A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  5684. // "location": "query",
  5685. // "type": "string"
  5686. // }
  5687. // },
  5688. // "path": "adclients/{adClientId}/customchannels/{customChannelId}/adunits",
  5689. // "response": {
  5690. // "$ref": "AdUnits"
  5691. // },
  5692. // "scopes": [
  5693. // "https://www.googleapis.com/auth/adsense",
  5694. // "https://www.googleapis.com/auth/adsense.readonly"
  5695. // ]
  5696. // }
  5697. }
  5698. // Pages invokes f for each page of results.
  5699. // A non-nil error returned from f will halt the iteration.
  5700. // The provided context supersedes any context provided to the Context method.
  5701. func (c *CustomchannelsAdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error {
  5702. c.ctx_ = ctx
  5703. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5704. for {
  5705. x, err := c.Do()
  5706. if err != nil {
  5707. return err
  5708. }
  5709. if err := f(x); err != nil {
  5710. return err
  5711. }
  5712. if x.NextPageToken == "" {
  5713. return nil
  5714. }
  5715. c.PageToken(x.NextPageToken)
  5716. }
  5717. }
  5718. // method id "adsense.metadata.dimensions.list":
  5719. type MetadataDimensionsListCall struct {
  5720. s *Service
  5721. urlParams_ gensupport.URLParams
  5722. ifNoneMatch_ string
  5723. ctx_ context.Context
  5724. header_ http.Header
  5725. }
  5726. // List: List the metadata for the dimensions available to this AdSense
  5727. // account.
  5728. func (r *MetadataDimensionsService) List() *MetadataDimensionsListCall {
  5729. c := &MetadataDimensionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5730. return c
  5731. }
  5732. // Fields allows partial responses to be retrieved. See
  5733. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5734. // for more information.
  5735. func (c *MetadataDimensionsListCall) Fields(s ...googleapi.Field) *MetadataDimensionsListCall {
  5736. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5737. return c
  5738. }
  5739. // IfNoneMatch sets the optional parameter which makes the operation
  5740. // fail if the object's ETag matches the given value. This is useful for
  5741. // getting updates only after the object has changed since the last
  5742. // request. Use googleapi.IsNotModified to check whether the response
  5743. // error from Do is the result of In-None-Match.
  5744. func (c *MetadataDimensionsListCall) IfNoneMatch(entityTag string) *MetadataDimensionsListCall {
  5745. c.ifNoneMatch_ = entityTag
  5746. return c
  5747. }
  5748. // Context sets the context to be used in this call's Do method. Any
  5749. // pending HTTP request will be aborted if the provided context is
  5750. // canceled.
  5751. func (c *MetadataDimensionsListCall) Context(ctx context.Context) *MetadataDimensionsListCall {
  5752. c.ctx_ = ctx
  5753. return c
  5754. }
  5755. // Header returns an http.Header that can be modified by the caller to
  5756. // add HTTP headers to the request.
  5757. func (c *MetadataDimensionsListCall) Header() http.Header {
  5758. if c.header_ == nil {
  5759. c.header_ = make(http.Header)
  5760. }
  5761. return c.header_
  5762. }
  5763. func (c *MetadataDimensionsListCall) doRequest(alt string) (*http.Response, error) {
  5764. reqHeaders := make(http.Header)
  5765. for k, v := range c.header_ {
  5766. reqHeaders[k] = v
  5767. }
  5768. reqHeaders.Set("User-Agent", c.s.userAgent())
  5769. if c.ifNoneMatch_ != "" {
  5770. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5771. }
  5772. var body io.Reader = nil
  5773. c.urlParams_.Set("alt", alt)
  5774. urls := googleapi.ResolveRelative(c.s.BasePath, "metadata/dimensions")
  5775. urls += "?" + c.urlParams_.Encode()
  5776. req, _ := http.NewRequest("GET", urls, body)
  5777. req.Header = reqHeaders
  5778. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5779. }
  5780. // Do executes the "adsense.metadata.dimensions.list" call.
  5781. // Exactly one of *Metadata or error will be non-nil. Any non-2xx status
  5782. // code is an error. Response headers are in either
  5783. // *Metadata.ServerResponse.Header or (if a response was returned at
  5784. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5785. // to check whether the returned error was because
  5786. // http.StatusNotModified was returned.
  5787. func (c *MetadataDimensionsListCall) Do(opts ...googleapi.CallOption) (*Metadata, error) {
  5788. gensupport.SetOptions(c.urlParams_, opts...)
  5789. res, err := c.doRequest("json")
  5790. if res != nil && res.StatusCode == http.StatusNotModified {
  5791. if res.Body != nil {
  5792. res.Body.Close()
  5793. }
  5794. return nil, &googleapi.Error{
  5795. Code: res.StatusCode,
  5796. Header: res.Header,
  5797. }
  5798. }
  5799. if err != nil {
  5800. return nil, err
  5801. }
  5802. defer googleapi.CloseBody(res)
  5803. if err := googleapi.CheckResponse(res); err != nil {
  5804. return nil, err
  5805. }
  5806. ret := &Metadata{
  5807. ServerResponse: googleapi.ServerResponse{
  5808. Header: res.Header,
  5809. HTTPStatusCode: res.StatusCode,
  5810. },
  5811. }
  5812. target := &ret
  5813. if err := gensupport.DecodeResponse(target, res); err != nil {
  5814. return nil, err
  5815. }
  5816. return ret, nil
  5817. // {
  5818. // "description": "List the metadata for the dimensions available to this AdSense account.",
  5819. // "httpMethod": "GET",
  5820. // "id": "adsense.metadata.dimensions.list",
  5821. // "path": "metadata/dimensions",
  5822. // "response": {
  5823. // "$ref": "Metadata"
  5824. // },
  5825. // "scopes": [
  5826. // "https://www.googleapis.com/auth/adsense",
  5827. // "https://www.googleapis.com/auth/adsense.readonly"
  5828. // ]
  5829. // }
  5830. }
  5831. // method id "adsense.metadata.metrics.list":
  5832. type MetadataMetricsListCall struct {
  5833. s *Service
  5834. urlParams_ gensupport.URLParams
  5835. ifNoneMatch_ string
  5836. ctx_ context.Context
  5837. header_ http.Header
  5838. }
  5839. // List: List the metadata for the metrics available to this AdSense
  5840. // account.
  5841. func (r *MetadataMetricsService) List() *MetadataMetricsListCall {
  5842. c := &MetadataMetricsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5843. return c
  5844. }
  5845. // Fields allows partial responses to be retrieved. See
  5846. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5847. // for more information.
  5848. func (c *MetadataMetricsListCall) Fields(s ...googleapi.Field) *MetadataMetricsListCall {
  5849. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5850. return c
  5851. }
  5852. // IfNoneMatch sets the optional parameter which makes the operation
  5853. // fail if the object's ETag matches the given value. This is useful for
  5854. // getting updates only after the object has changed since the last
  5855. // request. Use googleapi.IsNotModified to check whether the response
  5856. // error from Do is the result of In-None-Match.
  5857. func (c *MetadataMetricsListCall) IfNoneMatch(entityTag string) *MetadataMetricsListCall {
  5858. c.ifNoneMatch_ = entityTag
  5859. return c
  5860. }
  5861. // Context sets the context to be used in this call's Do method. Any
  5862. // pending HTTP request will be aborted if the provided context is
  5863. // canceled.
  5864. func (c *MetadataMetricsListCall) Context(ctx context.Context) *MetadataMetricsListCall {
  5865. c.ctx_ = ctx
  5866. return c
  5867. }
  5868. // Header returns an http.Header that can be modified by the caller to
  5869. // add HTTP headers to the request.
  5870. func (c *MetadataMetricsListCall) Header() http.Header {
  5871. if c.header_ == nil {
  5872. c.header_ = make(http.Header)
  5873. }
  5874. return c.header_
  5875. }
  5876. func (c *MetadataMetricsListCall) doRequest(alt string) (*http.Response, error) {
  5877. reqHeaders := make(http.Header)
  5878. for k, v := range c.header_ {
  5879. reqHeaders[k] = v
  5880. }
  5881. reqHeaders.Set("User-Agent", c.s.userAgent())
  5882. if c.ifNoneMatch_ != "" {
  5883. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5884. }
  5885. var body io.Reader = nil
  5886. c.urlParams_.Set("alt", alt)
  5887. urls := googleapi.ResolveRelative(c.s.BasePath, "metadata/metrics")
  5888. urls += "?" + c.urlParams_.Encode()
  5889. req, _ := http.NewRequest("GET", urls, body)
  5890. req.Header = reqHeaders
  5891. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5892. }
  5893. // Do executes the "adsense.metadata.metrics.list" call.
  5894. // Exactly one of *Metadata or error will be non-nil. Any non-2xx status
  5895. // code is an error. Response headers are in either
  5896. // *Metadata.ServerResponse.Header or (if a response was returned at
  5897. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5898. // to check whether the returned error was because
  5899. // http.StatusNotModified was returned.
  5900. func (c *MetadataMetricsListCall) Do(opts ...googleapi.CallOption) (*Metadata, error) {
  5901. gensupport.SetOptions(c.urlParams_, opts...)
  5902. res, err := c.doRequest("json")
  5903. if res != nil && res.StatusCode == http.StatusNotModified {
  5904. if res.Body != nil {
  5905. res.Body.Close()
  5906. }
  5907. return nil, &googleapi.Error{
  5908. Code: res.StatusCode,
  5909. Header: res.Header,
  5910. }
  5911. }
  5912. if err != nil {
  5913. return nil, err
  5914. }
  5915. defer googleapi.CloseBody(res)
  5916. if err := googleapi.CheckResponse(res); err != nil {
  5917. return nil, err
  5918. }
  5919. ret := &Metadata{
  5920. ServerResponse: googleapi.ServerResponse{
  5921. Header: res.Header,
  5922. HTTPStatusCode: res.StatusCode,
  5923. },
  5924. }
  5925. target := &ret
  5926. if err := gensupport.DecodeResponse(target, res); err != nil {
  5927. return nil, err
  5928. }
  5929. return ret, nil
  5930. // {
  5931. // "description": "List the metadata for the metrics available to this AdSense account.",
  5932. // "httpMethod": "GET",
  5933. // "id": "adsense.metadata.metrics.list",
  5934. // "path": "metadata/metrics",
  5935. // "response": {
  5936. // "$ref": "Metadata"
  5937. // },
  5938. // "scopes": [
  5939. // "https://www.googleapis.com/auth/adsense",
  5940. // "https://www.googleapis.com/auth/adsense.readonly"
  5941. // ]
  5942. // }
  5943. }
  5944. // method id "adsense.reports.generate":
  5945. type ReportsGenerateCall struct {
  5946. s *Service
  5947. urlParams_ gensupport.URLParams
  5948. ifNoneMatch_ string
  5949. ctx_ context.Context
  5950. header_ http.Header
  5951. }
  5952. // Generate: Generate an AdSense report based on the report request sent
  5953. // in the query parameters. Returns the result as JSON; to retrieve
  5954. // output in CSV format specify "alt=csv" as a query parameter.
  5955. func (r *ReportsService) Generate(startDate string, endDate string) *ReportsGenerateCall {
  5956. c := &ReportsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5957. c.urlParams_.Set("startDate", startDate)
  5958. c.urlParams_.Set("endDate", endDate)
  5959. return c
  5960. }
  5961. // AccountId sets the optional parameter "accountId": Accounts upon
  5962. // which to report.
  5963. func (c *ReportsGenerateCall) AccountId(accountId ...string) *ReportsGenerateCall {
  5964. c.urlParams_.SetMulti("accountId", append([]string{}, accountId...))
  5965. return c
  5966. }
  5967. // Currency sets the optional parameter "currency": Optional currency to
  5968. // use when reporting on monetary metrics. Defaults to the account's
  5969. // currency if not set.
  5970. func (c *ReportsGenerateCall) Currency(currency string) *ReportsGenerateCall {
  5971. c.urlParams_.Set("currency", currency)
  5972. return c
  5973. }
  5974. // Dimension sets the optional parameter "dimension": Dimensions to base
  5975. // the report on.
  5976. func (c *ReportsGenerateCall) Dimension(dimension ...string) *ReportsGenerateCall {
  5977. c.urlParams_.SetMulti("dimension", append([]string{}, dimension...))
  5978. return c
  5979. }
  5980. // Filter sets the optional parameter "filter": Filters to be run on the
  5981. // report.
  5982. func (c *ReportsGenerateCall) Filter(filter ...string) *ReportsGenerateCall {
  5983. c.urlParams_.SetMulti("filter", append([]string{}, filter...))
  5984. return c
  5985. }
  5986. // Locale sets the optional parameter "locale": Optional locale to use
  5987. // for translating report output to a local language. Defaults to
  5988. // "en_US" if not specified.
  5989. func (c *ReportsGenerateCall) Locale(locale string) *ReportsGenerateCall {
  5990. c.urlParams_.Set("locale", locale)
  5991. return c
  5992. }
  5993. // MaxResults sets the optional parameter "maxResults": The maximum
  5994. // number of rows of report data to return.
  5995. func (c *ReportsGenerateCall) MaxResults(maxResults int64) *ReportsGenerateCall {
  5996. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5997. return c
  5998. }
  5999. // Metric sets the optional parameter "metric": Numeric columns to
  6000. // include in the report.
  6001. func (c *ReportsGenerateCall) Metric(metric ...string) *ReportsGenerateCall {
  6002. c.urlParams_.SetMulti("metric", append([]string{}, metric...))
  6003. return c
  6004. }
  6005. // Sort sets the optional parameter "sort": The name of a dimension or
  6006. // metric to sort the resulting report on, optionally prefixed with "+"
  6007. // to sort ascending or "-" to sort descending. If no prefix is
  6008. // specified, the column is sorted ascending.
  6009. func (c *ReportsGenerateCall) Sort(sort ...string) *ReportsGenerateCall {
  6010. c.urlParams_.SetMulti("sort", append([]string{}, sort...))
  6011. return c
  6012. }
  6013. // StartIndex sets the optional parameter "startIndex": Index of the
  6014. // first row of report data to return.
  6015. func (c *ReportsGenerateCall) StartIndex(startIndex int64) *ReportsGenerateCall {
  6016. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  6017. return c
  6018. }
  6019. // UseTimezoneReporting sets the optional parameter
  6020. // "useTimezoneReporting": Whether the report should be generated in the
  6021. // AdSense account's local timezone. If false default PST/PDT timezone
  6022. // will be used.
  6023. func (c *ReportsGenerateCall) UseTimezoneReporting(useTimezoneReporting bool) *ReportsGenerateCall {
  6024. c.urlParams_.Set("useTimezoneReporting", fmt.Sprint(useTimezoneReporting))
  6025. return c
  6026. }
  6027. // Fields allows partial responses to be retrieved. See
  6028. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6029. // for more information.
  6030. func (c *ReportsGenerateCall) Fields(s ...googleapi.Field) *ReportsGenerateCall {
  6031. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6032. return c
  6033. }
  6034. // IfNoneMatch sets the optional parameter which makes the operation
  6035. // fail if the object's ETag matches the given value. This is useful for
  6036. // getting updates only after the object has changed since the last
  6037. // request. Use googleapi.IsNotModified to check whether the response
  6038. // error from Do is the result of In-None-Match.
  6039. func (c *ReportsGenerateCall) IfNoneMatch(entityTag string) *ReportsGenerateCall {
  6040. c.ifNoneMatch_ = entityTag
  6041. return c
  6042. }
  6043. // Context sets the context to be used in this call's Do and Download
  6044. // methods. Any pending HTTP request will be aborted if the provided
  6045. // context is canceled.
  6046. func (c *ReportsGenerateCall) Context(ctx context.Context) *ReportsGenerateCall {
  6047. c.ctx_ = ctx
  6048. return c
  6049. }
  6050. // Header returns an http.Header that can be modified by the caller to
  6051. // add HTTP headers to the request.
  6052. func (c *ReportsGenerateCall) Header() http.Header {
  6053. if c.header_ == nil {
  6054. c.header_ = make(http.Header)
  6055. }
  6056. return c.header_
  6057. }
  6058. func (c *ReportsGenerateCall) doRequest(alt string) (*http.Response, error) {
  6059. reqHeaders := make(http.Header)
  6060. for k, v := range c.header_ {
  6061. reqHeaders[k] = v
  6062. }
  6063. reqHeaders.Set("User-Agent", c.s.userAgent())
  6064. if c.ifNoneMatch_ != "" {
  6065. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6066. }
  6067. var body io.Reader = nil
  6068. c.urlParams_.Set("alt", alt)
  6069. urls := googleapi.ResolveRelative(c.s.BasePath, "reports")
  6070. urls += "?" + c.urlParams_.Encode()
  6071. req, _ := http.NewRequest("GET", urls, body)
  6072. req.Header = reqHeaders
  6073. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6074. }
  6075. // Download fetches the API endpoint's "media" value, instead of the normal
  6076. // API response value. If the returned error is nil, the Response is guaranteed to
  6077. // have a 2xx status code. Callers must close the Response.Body as usual.
  6078. func (c *ReportsGenerateCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  6079. gensupport.SetOptions(c.urlParams_, opts...)
  6080. res, err := c.doRequest("media")
  6081. if err != nil {
  6082. return nil, err
  6083. }
  6084. if err := googleapi.CheckMediaResponse(res); err != nil {
  6085. res.Body.Close()
  6086. return nil, err
  6087. }
  6088. return res, nil
  6089. }
  6090. // Do executes the "adsense.reports.generate" call.
  6091. // Exactly one of *AdsenseReportsGenerateResponse or error will be
  6092. // non-nil. Any non-2xx status code is an error. Response headers are in
  6093. // either *AdsenseReportsGenerateResponse.ServerResponse.Header or (if a
  6094. // response was returned at all) in error.(*googleapi.Error).Header. Use
  6095. // googleapi.IsNotModified to check whether the returned error was
  6096. // because http.StatusNotModified was returned.
  6097. func (c *ReportsGenerateCall) Do(opts ...googleapi.CallOption) (*AdsenseReportsGenerateResponse, error) {
  6098. gensupport.SetOptions(c.urlParams_, opts...)
  6099. res, err := c.doRequest("json")
  6100. if res != nil && res.StatusCode == http.StatusNotModified {
  6101. if res.Body != nil {
  6102. res.Body.Close()
  6103. }
  6104. return nil, &googleapi.Error{
  6105. Code: res.StatusCode,
  6106. Header: res.Header,
  6107. }
  6108. }
  6109. if err != nil {
  6110. return nil, err
  6111. }
  6112. defer googleapi.CloseBody(res)
  6113. if err := googleapi.CheckResponse(res); err != nil {
  6114. return nil, err
  6115. }
  6116. ret := &AdsenseReportsGenerateResponse{
  6117. ServerResponse: googleapi.ServerResponse{
  6118. Header: res.Header,
  6119. HTTPStatusCode: res.StatusCode,
  6120. },
  6121. }
  6122. target := &ret
  6123. if err := gensupport.DecodeResponse(target, res); err != nil {
  6124. return nil, err
  6125. }
  6126. return ret, nil
  6127. // {
  6128. // "description": "Generate an AdSense report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify \"alt=csv\" as a query parameter.",
  6129. // "httpMethod": "GET",
  6130. // "id": "adsense.reports.generate",
  6131. // "parameterOrder": [
  6132. // "startDate",
  6133. // "endDate"
  6134. // ],
  6135. // "parameters": {
  6136. // "accountId": {
  6137. // "description": "Accounts upon which to report.",
  6138. // "location": "query",
  6139. // "repeated": true,
  6140. // "type": "string"
  6141. // },
  6142. // "currency": {
  6143. // "description": "Optional currency to use when reporting on monetary metrics. Defaults to the account's currency if not set.",
  6144. // "location": "query",
  6145. // "pattern": "[a-zA-Z]+",
  6146. // "type": "string"
  6147. // },
  6148. // "dimension": {
  6149. // "description": "Dimensions to base the report on.",
  6150. // "location": "query",
  6151. // "pattern": "[a-zA-Z_]+",
  6152. // "repeated": true,
  6153. // "type": "string"
  6154. // },
  6155. // "endDate": {
  6156. // "description": "End of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  6157. // "location": "query",
  6158. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  6159. // "required": true,
  6160. // "type": "string"
  6161. // },
  6162. // "filter": {
  6163. // "description": "Filters to be run on the report.",
  6164. // "location": "query",
  6165. // "pattern": "[a-zA-Z_]+(==|=@).+",
  6166. // "repeated": true,
  6167. // "type": "string"
  6168. // },
  6169. // "locale": {
  6170. // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.",
  6171. // "location": "query",
  6172. // "pattern": "[a-zA-Z_]+",
  6173. // "type": "string"
  6174. // },
  6175. // "maxResults": {
  6176. // "description": "The maximum number of rows of report data to return.",
  6177. // "format": "int32",
  6178. // "location": "query",
  6179. // "maximum": "50000",
  6180. // "minimum": "0",
  6181. // "type": "integer"
  6182. // },
  6183. // "metric": {
  6184. // "description": "Numeric columns to include in the report.",
  6185. // "location": "query",
  6186. // "pattern": "[a-zA-Z_]+",
  6187. // "repeated": true,
  6188. // "type": "string"
  6189. // },
  6190. // "sort": {
  6191. // "description": "The name of a dimension or metric to sort the resulting report on, optionally prefixed with \"+\" to sort ascending or \"-\" to sort descending. If no prefix is specified, the column is sorted ascending.",
  6192. // "location": "query",
  6193. // "pattern": "(\\+|-)?[a-zA-Z_]+",
  6194. // "repeated": true,
  6195. // "type": "string"
  6196. // },
  6197. // "startDate": {
  6198. // "description": "Start of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  6199. // "location": "query",
  6200. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  6201. // "required": true,
  6202. // "type": "string"
  6203. // },
  6204. // "startIndex": {
  6205. // "description": "Index of the first row of report data to return.",
  6206. // "format": "int32",
  6207. // "location": "query",
  6208. // "maximum": "5000",
  6209. // "minimum": "0",
  6210. // "type": "integer"
  6211. // },
  6212. // "useTimezoneReporting": {
  6213. // "description": "Whether the report should be generated in the AdSense account's local timezone. If false default PST/PDT timezone will be used.",
  6214. // "location": "query",
  6215. // "type": "boolean"
  6216. // }
  6217. // },
  6218. // "path": "reports",
  6219. // "response": {
  6220. // "$ref": "AdsenseReportsGenerateResponse"
  6221. // },
  6222. // "scopes": [
  6223. // "https://www.googleapis.com/auth/adsense",
  6224. // "https://www.googleapis.com/auth/adsense.readonly"
  6225. // ],
  6226. // "supportsMediaDownload": true
  6227. // }
  6228. }
  6229. // method id "adsense.reports.saved.generate":
  6230. type ReportsSavedGenerateCall struct {
  6231. s *Service
  6232. savedReportId string
  6233. urlParams_ gensupport.URLParams
  6234. ifNoneMatch_ string
  6235. ctx_ context.Context
  6236. header_ http.Header
  6237. }
  6238. // Generate: Generate an AdSense report based on the saved report ID
  6239. // sent in the query parameters.
  6240. func (r *ReportsSavedService) Generate(savedReportId string) *ReportsSavedGenerateCall {
  6241. c := &ReportsSavedGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6242. c.savedReportId = savedReportId
  6243. return c
  6244. }
  6245. // Locale sets the optional parameter "locale": Optional locale to use
  6246. // for translating report output to a local language. Defaults to
  6247. // "en_US" if not specified.
  6248. func (c *ReportsSavedGenerateCall) Locale(locale string) *ReportsSavedGenerateCall {
  6249. c.urlParams_.Set("locale", locale)
  6250. return c
  6251. }
  6252. // MaxResults sets the optional parameter "maxResults": The maximum
  6253. // number of rows of report data to return.
  6254. func (c *ReportsSavedGenerateCall) MaxResults(maxResults int64) *ReportsSavedGenerateCall {
  6255. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6256. return c
  6257. }
  6258. // StartIndex sets the optional parameter "startIndex": Index of the
  6259. // first row of report data to return.
  6260. func (c *ReportsSavedGenerateCall) StartIndex(startIndex int64) *ReportsSavedGenerateCall {
  6261. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  6262. return c
  6263. }
  6264. // Fields allows partial responses to be retrieved. See
  6265. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6266. // for more information.
  6267. func (c *ReportsSavedGenerateCall) Fields(s ...googleapi.Field) *ReportsSavedGenerateCall {
  6268. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6269. return c
  6270. }
  6271. // IfNoneMatch sets the optional parameter which makes the operation
  6272. // fail if the object's ETag matches the given value. This is useful for
  6273. // getting updates only after the object has changed since the last
  6274. // request. Use googleapi.IsNotModified to check whether the response
  6275. // error from Do is the result of In-None-Match.
  6276. func (c *ReportsSavedGenerateCall) IfNoneMatch(entityTag string) *ReportsSavedGenerateCall {
  6277. c.ifNoneMatch_ = entityTag
  6278. return c
  6279. }
  6280. // Context sets the context to be used in this call's Do method. Any
  6281. // pending HTTP request will be aborted if the provided context is
  6282. // canceled.
  6283. func (c *ReportsSavedGenerateCall) Context(ctx context.Context) *ReportsSavedGenerateCall {
  6284. c.ctx_ = ctx
  6285. return c
  6286. }
  6287. // Header returns an http.Header that can be modified by the caller to
  6288. // add HTTP headers to the request.
  6289. func (c *ReportsSavedGenerateCall) Header() http.Header {
  6290. if c.header_ == nil {
  6291. c.header_ = make(http.Header)
  6292. }
  6293. return c.header_
  6294. }
  6295. func (c *ReportsSavedGenerateCall) doRequest(alt string) (*http.Response, error) {
  6296. reqHeaders := make(http.Header)
  6297. for k, v := range c.header_ {
  6298. reqHeaders[k] = v
  6299. }
  6300. reqHeaders.Set("User-Agent", c.s.userAgent())
  6301. if c.ifNoneMatch_ != "" {
  6302. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6303. }
  6304. var body io.Reader = nil
  6305. c.urlParams_.Set("alt", alt)
  6306. urls := googleapi.ResolveRelative(c.s.BasePath, "reports/{savedReportId}")
  6307. urls += "?" + c.urlParams_.Encode()
  6308. req, _ := http.NewRequest("GET", urls, body)
  6309. req.Header = reqHeaders
  6310. googleapi.Expand(req.URL, map[string]string{
  6311. "savedReportId": c.savedReportId,
  6312. })
  6313. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6314. }
  6315. // Do executes the "adsense.reports.saved.generate" call.
  6316. // Exactly one of *AdsenseReportsGenerateResponse or error will be
  6317. // non-nil. Any non-2xx status code is an error. Response headers are in
  6318. // either *AdsenseReportsGenerateResponse.ServerResponse.Header or (if a
  6319. // response was returned at all) in error.(*googleapi.Error).Header. Use
  6320. // googleapi.IsNotModified to check whether the returned error was
  6321. // because http.StatusNotModified was returned.
  6322. func (c *ReportsSavedGenerateCall) Do(opts ...googleapi.CallOption) (*AdsenseReportsGenerateResponse, error) {
  6323. gensupport.SetOptions(c.urlParams_, opts...)
  6324. res, err := c.doRequest("json")
  6325. if res != nil && res.StatusCode == http.StatusNotModified {
  6326. if res.Body != nil {
  6327. res.Body.Close()
  6328. }
  6329. return nil, &googleapi.Error{
  6330. Code: res.StatusCode,
  6331. Header: res.Header,
  6332. }
  6333. }
  6334. if err != nil {
  6335. return nil, err
  6336. }
  6337. defer googleapi.CloseBody(res)
  6338. if err := googleapi.CheckResponse(res); err != nil {
  6339. return nil, err
  6340. }
  6341. ret := &AdsenseReportsGenerateResponse{
  6342. ServerResponse: googleapi.ServerResponse{
  6343. Header: res.Header,
  6344. HTTPStatusCode: res.StatusCode,
  6345. },
  6346. }
  6347. target := &ret
  6348. if err := gensupport.DecodeResponse(target, res); err != nil {
  6349. return nil, err
  6350. }
  6351. return ret, nil
  6352. // {
  6353. // "description": "Generate an AdSense report based on the saved report ID sent in the query parameters.",
  6354. // "httpMethod": "GET",
  6355. // "id": "adsense.reports.saved.generate",
  6356. // "parameterOrder": [
  6357. // "savedReportId"
  6358. // ],
  6359. // "parameters": {
  6360. // "locale": {
  6361. // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.",
  6362. // "location": "query",
  6363. // "pattern": "[a-zA-Z_]+",
  6364. // "type": "string"
  6365. // },
  6366. // "maxResults": {
  6367. // "description": "The maximum number of rows of report data to return.",
  6368. // "format": "int32",
  6369. // "location": "query",
  6370. // "maximum": "50000",
  6371. // "minimum": "0",
  6372. // "type": "integer"
  6373. // },
  6374. // "savedReportId": {
  6375. // "description": "The saved report to retrieve.",
  6376. // "location": "path",
  6377. // "required": true,
  6378. // "type": "string"
  6379. // },
  6380. // "startIndex": {
  6381. // "description": "Index of the first row of report data to return.",
  6382. // "format": "int32",
  6383. // "location": "query",
  6384. // "maximum": "5000",
  6385. // "minimum": "0",
  6386. // "type": "integer"
  6387. // }
  6388. // },
  6389. // "path": "reports/{savedReportId}",
  6390. // "response": {
  6391. // "$ref": "AdsenseReportsGenerateResponse"
  6392. // },
  6393. // "scopes": [
  6394. // "https://www.googleapis.com/auth/adsense",
  6395. // "https://www.googleapis.com/auth/adsense.readonly"
  6396. // ]
  6397. // }
  6398. }
  6399. // method id "adsense.reports.saved.list":
  6400. type ReportsSavedListCall struct {
  6401. s *Service
  6402. urlParams_ gensupport.URLParams
  6403. ifNoneMatch_ string
  6404. ctx_ context.Context
  6405. header_ http.Header
  6406. }
  6407. // List: List all saved reports in this AdSense account.
  6408. func (r *ReportsSavedService) List() *ReportsSavedListCall {
  6409. c := &ReportsSavedListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6410. return c
  6411. }
  6412. // MaxResults sets the optional parameter "maxResults": The maximum
  6413. // number of saved reports to include in the response, used for paging.
  6414. func (c *ReportsSavedListCall) MaxResults(maxResults int64) *ReportsSavedListCall {
  6415. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6416. return c
  6417. }
  6418. // PageToken sets the optional parameter "pageToken": A continuation
  6419. // token, used to page through saved reports. To retrieve the next page,
  6420. // set this parameter to the value of "nextPageToken" from the previous
  6421. // response.
  6422. func (c *ReportsSavedListCall) PageToken(pageToken string) *ReportsSavedListCall {
  6423. c.urlParams_.Set("pageToken", pageToken)
  6424. return c
  6425. }
  6426. // Fields allows partial responses to be retrieved. See
  6427. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6428. // for more information.
  6429. func (c *ReportsSavedListCall) Fields(s ...googleapi.Field) *ReportsSavedListCall {
  6430. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6431. return c
  6432. }
  6433. // IfNoneMatch sets the optional parameter which makes the operation
  6434. // fail if the object's ETag matches the given value. This is useful for
  6435. // getting updates only after the object has changed since the last
  6436. // request. Use googleapi.IsNotModified to check whether the response
  6437. // error from Do is the result of In-None-Match.
  6438. func (c *ReportsSavedListCall) IfNoneMatch(entityTag string) *ReportsSavedListCall {
  6439. c.ifNoneMatch_ = entityTag
  6440. return c
  6441. }
  6442. // Context sets the context to be used in this call's Do method. Any
  6443. // pending HTTP request will be aborted if the provided context is
  6444. // canceled.
  6445. func (c *ReportsSavedListCall) Context(ctx context.Context) *ReportsSavedListCall {
  6446. c.ctx_ = ctx
  6447. return c
  6448. }
  6449. // Header returns an http.Header that can be modified by the caller to
  6450. // add HTTP headers to the request.
  6451. func (c *ReportsSavedListCall) Header() http.Header {
  6452. if c.header_ == nil {
  6453. c.header_ = make(http.Header)
  6454. }
  6455. return c.header_
  6456. }
  6457. func (c *ReportsSavedListCall) doRequest(alt string) (*http.Response, error) {
  6458. reqHeaders := make(http.Header)
  6459. for k, v := range c.header_ {
  6460. reqHeaders[k] = v
  6461. }
  6462. reqHeaders.Set("User-Agent", c.s.userAgent())
  6463. if c.ifNoneMatch_ != "" {
  6464. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6465. }
  6466. var body io.Reader = nil
  6467. c.urlParams_.Set("alt", alt)
  6468. urls := googleapi.ResolveRelative(c.s.BasePath, "reports/saved")
  6469. urls += "?" + c.urlParams_.Encode()
  6470. req, _ := http.NewRequest("GET", urls, body)
  6471. req.Header = reqHeaders
  6472. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6473. }
  6474. // Do executes the "adsense.reports.saved.list" call.
  6475. // Exactly one of *SavedReports or error will be non-nil. Any non-2xx
  6476. // status code is an error. Response headers are in either
  6477. // *SavedReports.ServerResponse.Header or (if a response was returned at
  6478. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6479. // to check whether the returned error was because
  6480. // http.StatusNotModified was returned.
  6481. func (c *ReportsSavedListCall) Do(opts ...googleapi.CallOption) (*SavedReports, error) {
  6482. gensupport.SetOptions(c.urlParams_, opts...)
  6483. res, err := c.doRequest("json")
  6484. if res != nil && res.StatusCode == http.StatusNotModified {
  6485. if res.Body != nil {
  6486. res.Body.Close()
  6487. }
  6488. return nil, &googleapi.Error{
  6489. Code: res.StatusCode,
  6490. Header: res.Header,
  6491. }
  6492. }
  6493. if err != nil {
  6494. return nil, err
  6495. }
  6496. defer googleapi.CloseBody(res)
  6497. if err := googleapi.CheckResponse(res); err != nil {
  6498. return nil, err
  6499. }
  6500. ret := &SavedReports{
  6501. ServerResponse: googleapi.ServerResponse{
  6502. Header: res.Header,
  6503. HTTPStatusCode: res.StatusCode,
  6504. },
  6505. }
  6506. target := &ret
  6507. if err := gensupport.DecodeResponse(target, res); err != nil {
  6508. return nil, err
  6509. }
  6510. return ret, nil
  6511. // {
  6512. // "description": "List all saved reports in this AdSense account.",
  6513. // "httpMethod": "GET",
  6514. // "id": "adsense.reports.saved.list",
  6515. // "parameters": {
  6516. // "maxResults": {
  6517. // "description": "The maximum number of saved reports to include in the response, used for paging.",
  6518. // "format": "int32",
  6519. // "location": "query",
  6520. // "maximum": "100",
  6521. // "minimum": "0",
  6522. // "type": "integer"
  6523. // },
  6524. // "pageToken": {
  6525. // "description": "A continuation token, used to page through saved reports. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  6526. // "location": "query",
  6527. // "type": "string"
  6528. // }
  6529. // },
  6530. // "path": "reports/saved",
  6531. // "response": {
  6532. // "$ref": "SavedReports"
  6533. // },
  6534. // "scopes": [
  6535. // "https://www.googleapis.com/auth/adsense",
  6536. // "https://www.googleapis.com/auth/adsense.readonly"
  6537. // ]
  6538. // }
  6539. }
  6540. // Pages invokes f for each page of results.
  6541. // A non-nil error returned from f will halt the iteration.
  6542. // The provided context supersedes any context provided to the Context method.
  6543. func (c *ReportsSavedListCall) Pages(ctx context.Context, f func(*SavedReports) error) error {
  6544. c.ctx_ = ctx
  6545. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6546. for {
  6547. x, err := c.Do()
  6548. if err != nil {
  6549. return err
  6550. }
  6551. if err := f(x); err != nil {
  6552. return err
  6553. }
  6554. if x.NextPageToken == "" {
  6555. return nil
  6556. }
  6557. c.PageToken(x.NextPageToken)
  6558. }
  6559. }
  6560. // method id "adsense.savedadstyles.get":
  6561. type SavedadstylesGetCall struct {
  6562. s *Service
  6563. savedAdStyleId string
  6564. urlParams_ gensupport.URLParams
  6565. ifNoneMatch_ string
  6566. ctx_ context.Context
  6567. header_ http.Header
  6568. }
  6569. // Get: Get a specific saved ad style from the user's account.
  6570. func (r *SavedadstylesService) Get(savedAdStyleId string) *SavedadstylesGetCall {
  6571. c := &SavedadstylesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6572. c.savedAdStyleId = savedAdStyleId
  6573. return c
  6574. }
  6575. // Fields allows partial responses to be retrieved. See
  6576. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6577. // for more information.
  6578. func (c *SavedadstylesGetCall) Fields(s ...googleapi.Field) *SavedadstylesGetCall {
  6579. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6580. return c
  6581. }
  6582. // IfNoneMatch sets the optional parameter which makes the operation
  6583. // fail if the object's ETag matches the given value. This is useful for
  6584. // getting updates only after the object has changed since the last
  6585. // request. Use googleapi.IsNotModified to check whether the response
  6586. // error from Do is the result of In-None-Match.
  6587. func (c *SavedadstylesGetCall) IfNoneMatch(entityTag string) *SavedadstylesGetCall {
  6588. c.ifNoneMatch_ = entityTag
  6589. return c
  6590. }
  6591. // Context sets the context to be used in this call's Do method. Any
  6592. // pending HTTP request will be aborted if the provided context is
  6593. // canceled.
  6594. func (c *SavedadstylesGetCall) Context(ctx context.Context) *SavedadstylesGetCall {
  6595. c.ctx_ = ctx
  6596. return c
  6597. }
  6598. // Header returns an http.Header that can be modified by the caller to
  6599. // add HTTP headers to the request.
  6600. func (c *SavedadstylesGetCall) Header() http.Header {
  6601. if c.header_ == nil {
  6602. c.header_ = make(http.Header)
  6603. }
  6604. return c.header_
  6605. }
  6606. func (c *SavedadstylesGetCall) doRequest(alt string) (*http.Response, error) {
  6607. reqHeaders := make(http.Header)
  6608. for k, v := range c.header_ {
  6609. reqHeaders[k] = v
  6610. }
  6611. reqHeaders.Set("User-Agent", c.s.userAgent())
  6612. if c.ifNoneMatch_ != "" {
  6613. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6614. }
  6615. var body io.Reader = nil
  6616. c.urlParams_.Set("alt", alt)
  6617. urls := googleapi.ResolveRelative(c.s.BasePath, "savedadstyles/{savedAdStyleId}")
  6618. urls += "?" + c.urlParams_.Encode()
  6619. req, _ := http.NewRequest("GET", urls, body)
  6620. req.Header = reqHeaders
  6621. googleapi.Expand(req.URL, map[string]string{
  6622. "savedAdStyleId": c.savedAdStyleId,
  6623. })
  6624. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6625. }
  6626. // Do executes the "adsense.savedadstyles.get" call.
  6627. // Exactly one of *SavedAdStyle or error will be non-nil. Any non-2xx
  6628. // status code is an error. Response headers are in either
  6629. // *SavedAdStyle.ServerResponse.Header or (if a response was returned at
  6630. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6631. // to check whether the returned error was because
  6632. // http.StatusNotModified was returned.
  6633. func (c *SavedadstylesGetCall) Do(opts ...googleapi.CallOption) (*SavedAdStyle, error) {
  6634. gensupport.SetOptions(c.urlParams_, opts...)
  6635. res, err := c.doRequest("json")
  6636. if res != nil && res.StatusCode == http.StatusNotModified {
  6637. if res.Body != nil {
  6638. res.Body.Close()
  6639. }
  6640. return nil, &googleapi.Error{
  6641. Code: res.StatusCode,
  6642. Header: res.Header,
  6643. }
  6644. }
  6645. if err != nil {
  6646. return nil, err
  6647. }
  6648. defer googleapi.CloseBody(res)
  6649. if err := googleapi.CheckResponse(res); err != nil {
  6650. return nil, err
  6651. }
  6652. ret := &SavedAdStyle{
  6653. ServerResponse: googleapi.ServerResponse{
  6654. Header: res.Header,
  6655. HTTPStatusCode: res.StatusCode,
  6656. },
  6657. }
  6658. target := &ret
  6659. if err := gensupport.DecodeResponse(target, res); err != nil {
  6660. return nil, err
  6661. }
  6662. return ret, nil
  6663. // {
  6664. // "description": "Get a specific saved ad style from the user's account.",
  6665. // "httpMethod": "GET",
  6666. // "id": "adsense.savedadstyles.get",
  6667. // "parameterOrder": [
  6668. // "savedAdStyleId"
  6669. // ],
  6670. // "parameters": {
  6671. // "savedAdStyleId": {
  6672. // "description": "Saved ad style to retrieve.",
  6673. // "location": "path",
  6674. // "required": true,
  6675. // "type": "string"
  6676. // }
  6677. // },
  6678. // "path": "savedadstyles/{savedAdStyleId}",
  6679. // "response": {
  6680. // "$ref": "SavedAdStyle"
  6681. // },
  6682. // "scopes": [
  6683. // "https://www.googleapis.com/auth/adsense",
  6684. // "https://www.googleapis.com/auth/adsense.readonly"
  6685. // ]
  6686. // }
  6687. }
  6688. // method id "adsense.savedadstyles.list":
  6689. type SavedadstylesListCall struct {
  6690. s *Service
  6691. urlParams_ gensupport.URLParams
  6692. ifNoneMatch_ string
  6693. ctx_ context.Context
  6694. header_ http.Header
  6695. }
  6696. // List: List all saved ad styles in the user's account.
  6697. func (r *SavedadstylesService) List() *SavedadstylesListCall {
  6698. c := &SavedadstylesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6699. return c
  6700. }
  6701. // MaxResults sets the optional parameter "maxResults": The maximum
  6702. // number of saved ad styles to include in the response, used for
  6703. // paging.
  6704. func (c *SavedadstylesListCall) MaxResults(maxResults int64) *SavedadstylesListCall {
  6705. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6706. return c
  6707. }
  6708. // PageToken sets the optional parameter "pageToken": A continuation
  6709. // token, used to page through saved ad styles. To retrieve the next
  6710. // page, set this parameter to the value of "nextPageToken" from the
  6711. // previous response.
  6712. func (c *SavedadstylesListCall) PageToken(pageToken string) *SavedadstylesListCall {
  6713. c.urlParams_.Set("pageToken", pageToken)
  6714. return c
  6715. }
  6716. // Fields allows partial responses to be retrieved. See
  6717. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6718. // for more information.
  6719. func (c *SavedadstylesListCall) Fields(s ...googleapi.Field) *SavedadstylesListCall {
  6720. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6721. return c
  6722. }
  6723. // IfNoneMatch sets the optional parameter which makes the operation
  6724. // fail if the object's ETag matches the given value. This is useful for
  6725. // getting updates only after the object has changed since the last
  6726. // request. Use googleapi.IsNotModified to check whether the response
  6727. // error from Do is the result of In-None-Match.
  6728. func (c *SavedadstylesListCall) IfNoneMatch(entityTag string) *SavedadstylesListCall {
  6729. c.ifNoneMatch_ = entityTag
  6730. return c
  6731. }
  6732. // Context sets the context to be used in this call's Do method. Any
  6733. // pending HTTP request will be aborted if the provided context is
  6734. // canceled.
  6735. func (c *SavedadstylesListCall) Context(ctx context.Context) *SavedadstylesListCall {
  6736. c.ctx_ = ctx
  6737. return c
  6738. }
  6739. // Header returns an http.Header that can be modified by the caller to
  6740. // add HTTP headers to the request.
  6741. func (c *SavedadstylesListCall) Header() http.Header {
  6742. if c.header_ == nil {
  6743. c.header_ = make(http.Header)
  6744. }
  6745. return c.header_
  6746. }
  6747. func (c *SavedadstylesListCall) doRequest(alt string) (*http.Response, error) {
  6748. reqHeaders := make(http.Header)
  6749. for k, v := range c.header_ {
  6750. reqHeaders[k] = v
  6751. }
  6752. reqHeaders.Set("User-Agent", c.s.userAgent())
  6753. if c.ifNoneMatch_ != "" {
  6754. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6755. }
  6756. var body io.Reader = nil
  6757. c.urlParams_.Set("alt", alt)
  6758. urls := googleapi.ResolveRelative(c.s.BasePath, "savedadstyles")
  6759. urls += "?" + c.urlParams_.Encode()
  6760. req, _ := http.NewRequest("GET", urls, body)
  6761. req.Header = reqHeaders
  6762. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6763. }
  6764. // Do executes the "adsense.savedadstyles.list" call.
  6765. // Exactly one of *SavedAdStyles or error will be non-nil. Any non-2xx
  6766. // status code is an error. Response headers are in either
  6767. // *SavedAdStyles.ServerResponse.Header or (if a response was returned
  6768. // at all) in error.(*googleapi.Error).Header. Use
  6769. // googleapi.IsNotModified to check whether the returned error was
  6770. // because http.StatusNotModified was returned.
  6771. func (c *SavedadstylesListCall) Do(opts ...googleapi.CallOption) (*SavedAdStyles, error) {
  6772. gensupport.SetOptions(c.urlParams_, opts...)
  6773. res, err := c.doRequest("json")
  6774. if res != nil && res.StatusCode == http.StatusNotModified {
  6775. if res.Body != nil {
  6776. res.Body.Close()
  6777. }
  6778. return nil, &googleapi.Error{
  6779. Code: res.StatusCode,
  6780. Header: res.Header,
  6781. }
  6782. }
  6783. if err != nil {
  6784. return nil, err
  6785. }
  6786. defer googleapi.CloseBody(res)
  6787. if err := googleapi.CheckResponse(res); err != nil {
  6788. return nil, err
  6789. }
  6790. ret := &SavedAdStyles{
  6791. ServerResponse: googleapi.ServerResponse{
  6792. Header: res.Header,
  6793. HTTPStatusCode: res.StatusCode,
  6794. },
  6795. }
  6796. target := &ret
  6797. if err := gensupport.DecodeResponse(target, res); err != nil {
  6798. return nil, err
  6799. }
  6800. return ret, nil
  6801. // {
  6802. // "description": "List all saved ad styles in the user's account.",
  6803. // "httpMethod": "GET",
  6804. // "id": "adsense.savedadstyles.list",
  6805. // "parameters": {
  6806. // "maxResults": {
  6807. // "description": "The maximum number of saved ad styles to include in the response, used for paging.",
  6808. // "format": "int32",
  6809. // "location": "query",
  6810. // "maximum": "10000",
  6811. // "minimum": "0",
  6812. // "type": "integer"
  6813. // },
  6814. // "pageToken": {
  6815. // "description": "A continuation token, used to page through saved ad styles. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  6816. // "location": "query",
  6817. // "type": "string"
  6818. // }
  6819. // },
  6820. // "path": "savedadstyles",
  6821. // "response": {
  6822. // "$ref": "SavedAdStyles"
  6823. // },
  6824. // "scopes": [
  6825. // "https://www.googleapis.com/auth/adsense",
  6826. // "https://www.googleapis.com/auth/adsense.readonly"
  6827. // ]
  6828. // }
  6829. }
  6830. // Pages invokes f for each page of results.
  6831. // A non-nil error returned from f will halt the iteration.
  6832. // The provided context supersedes any context provided to the Context method.
  6833. func (c *SavedadstylesListCall) Pages(ctx context.Context, f func(*SavedAdStyles) error) error {
  6834. c.ctx_ = ctx
  6835. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6836. for {
  6837. x, err := c.Do()
  6838. if err != nil {
  6839. return err
  6840. }
  6841. if err := f(x); err != nil {
  6842. return err
  6843. }
  6844. if x.NextPageToken == "" {
  6845. return nil
  6846. }
  6847. c.PageToken(x.NextPageToken)
  6848. }
  6849. }
  6850. // method id "adsense.urlchannels.list":
  6851. type UrlchannelsListCall struct {
  6852. s *Service
  6853. adClientId string
  6854. urlParams_ gensupport.URLParams
  6855. ifNoneMatch_ string
  6856. ctx_ context.Context
  6857. header_ http.Header
  6858. }
  6859. // List: List all URL channels in the specified ad client for this
  6860. // AdSense account.
  6861. func (r *UrlchannelsService) List(adClientId string) *UrlchannelsListCall {
  6862. c := &UrlchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6863. c.adClientId = adClientId
  6864. return c
  6865. }
  6866. // MaxResults sets the optional parameter "maxResults": The maximum
  6867. // number of URL channels to include in the response, used for paging.
  6868. func (c *UrlchannelsListCall) MaxResults(maxResults int64) *UrlchannelsListCall {
  6869. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6870. return c
  6871. }
  6872. // PageToken sets the optional parameter "pageToken": A continuation
  6873. // token, used to page through URL channels. To retrieve the next page,
  6874. // set this parameter to the value of "nextPageToken" from the previous
  6875. // response.
  6876. func (c *UrlchannelsListCall) PageToken(pageToken string) *UrlchannelsListCall {
  6877. c.urlParams_.Set("pageToken", pageToken)
  6878. return c
  6879. }
  6880. // Fields allows partial responses to be retrieved. See
  6881. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6882. // for more information.
  6883. func (c *UrlchannelsListCall) Fields(s ...googleapi.Field) *UrlchannelsListCall {
  6884. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6885. return c
  6886. }
  6887. // IfNoneMatch sets the optional parameter which makes the operation
  6888. // fail if the object's ETag matches the given value. This is useful for
  6889. // getting updates only after the object has changed since the last
  6890. // request. Use googleapi.IsNotModified to check whether the response
  6891. // error from Do is the result of In-None-Match.
  6892. func (c *UrlchannelsListCall) IfNoneMatch(entityTag string) *UrlchannelsListCall {
  6893. c.ifNoneMatch_ = entityTag
  6894. return c
  6895. }
  6896. // Context sets the context to be used in this call's Do method. Any
  6897. // pending HTTP request will be aborted if the provided context is
  6898. // canceled.
  6899. func (c *UrlchannelsListCall) Context(ctx context.Context) *UrlchannelsListCall {
  6900. c.ctx_ = ctx
  6901. return c
  6902. }
  6903. // Header returns an http.Header that can be modified by the caller to
  6904. // add HTTP headers to the request.
  6905. func (c *UrlchannelsListCall) Header() http.Header {
  6906. if c.header_ == nil {
  6907. c.header_ = make(http.Header)
  6908. }
  6909. return c.header_
  6910. }
  6911. func (c *UrlchannelsListCall) doRequest(alt string) (*http.Response, error) {
  6912. reqHeaders := make(http.Header)
  6913. for k, v := range c.header_ {
  6914. reqHeaders[k] = v
  6915. }
  6916. reqHeaders.Set("User-Agent", c.s.userAgent())
  6917. if c.ifNoneMatch_ != "" {
  6918. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6919. }
  6920. var body io.Reader = nil
  6921. c.urlParams_.Set("alt", alt)
  6922. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/urlchannels")
  6923. urls += "?" + c.urlParams_.Encode()
  6924. req, _ := http.NewRequest("GET", urls, body)
  6925. req.Header = reqHeaders
  6926. googleapi.Expand(req.URL, map[string]string{
  6927. "adClientId": c.adClientId,
  6928. })
  6929. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6930. }
  6931. // Do executes the "adsense.urlchannels.list" call.
  6932. // Exactly one of *UrlChannels or error will be non-nil. Any non-2xx
  6933. // status code is an error. Response headers are in either
  6934. // *UrlChannels.ServerResponse.Header or (if a response was returned at
  6935. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6936. // to check whether the returned error was because
  6937. // http.StatusNotModified was returned.
  6938. func (c *UrlchannelsListCall) Do(opts ...googleapi.CallOption) (*UrlChannels, error) {
  6939. gensupport.SetOptions(c.urlParams_, opts...)
  6940. res, err := c.doRequest("json")
  6941. if res != nil && res.StatusCode == http.StatusNotModified {
  6942. if res.Body != nil {
  6943. res.Body.Close()
  6944. }
  6945. return nil, &googleapi.Error{
  6946. Code: res.StatusCode,
  6947. Header: res.Header,
  6948. }
  6949. }
  6950. if err != nil {
  6951. return nil, err
  6952. }
  6953. defer googleapi.CloseBody(res)
  6954. if err := googleapi.CheckResponse(res); err != nil {
  6955. return nil, err
  6956. }
  6957. ret := &UrlChannels{
  6958. ServerResponse: googleapi.ServerResponse{
  6959. Header: res.Header,
  6960. HTTPStatusCode: res.StatusCode,
  6961. },
  6962. }
  6963. target := &ret
  6964. if err := gensupport.DecodeResponse(target, res); err != nil {
  6965. return nil, err
  6966. }
  6967. return ret, nil
  6968. // {
  6969. // "description": "List all URL channels in the specified ad client for this AdSense account.",
  6970. // "httpMethod": "GET",
  6971. // "id": "adsense.urlchannels.list",
  6972. // "parameterOrder": [
  6973. // "adClientId"
  6974. // ],
  6975. // "parameters": {
  6976. // "adClientId": {
  6977. // "description": "Ad client for which to list URL channels.",
  6978. // "location": "path",
  6979. // "required": true,
  6980. // "type": "string"
  6981. // },
  6982. // "maxResults": {
  6983. // "description": "The maximum number of URL channels to include in the response, used for paging.",
  6984. // "format": "int32",
  6985. // "location": "query",
  6986. // "maximum": "10000",
  6987. // "minimum": "0",
  6988. // "type": "integer"
  6989. // },
  6990. // "pageToken": {
  6991. // "description": "A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  6992. // "location": "query",
  6993. // "type": "string"
  6994. // }
  6995. // },
  6996. // "path": "adclients/{adClientId}/urlchannels",
  6997. // "response": {
  6998. // "$ref": "UrlChannels"
  6999. // },
  7000. // "scopes": [
  7001. // "https://www.googleapis.com/auth/adsense",
  7002. // "https://www.googleapis.com/auth/adsense.readonly"
  7003. // ]
  7004. // }
  7005. }
  7006. // Pages invokes f for each page of results.
  7007. // A non-nil error returned from f will halt the iteration.
  7008. // The provided context supersedes any context provided to the Context method.
  7009. func (c *UrlchannelsListCall) Pages(ctx context.Context, f func(*UrlChannels) error) error {
  7010. c.ctx_ = ctx
  7011. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7012. for {
  7013. x, err := c.Do()
  7014. if err != nil {
  7015. return err
  7016. }
  7017. if err := f(x); err != nil {
  7018. return err
  7019. }
  7020. if x.NextPageToken == "" {
  7021. return nil
  7022. }
  7023. c.PageToken(x.NextPageToken)
  7024. }
  7025. }