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.
 
 
 

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