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.
 
 
 

7751 lines
258 KiB

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