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.
 
 
 

8699 lines
286 KiB

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