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.
 
 
 

5391 lines
174 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package adsensehost provides access to the AdSense Host API.
  6. //
  7. // For product documentation, see: https://developers.google.com/adsense/host/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/adsensehost/v4.1"
  14. // ...
  15. // ctx := context.Background()
  16. // adsensehostService, err := adsensehost.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // adsensehostService, err := adsensehost.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // adsensehostService, err := adsensehost.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package adsensehost // import "google.golang.org/api/adsensehost/v4.1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "adsensehost:v4.1"
  67. const apiName = "adsensehost"
  68. const apiVersion = "v4.1"
  69. const basePath = "https://www.googleapis.com/adsensehost/v4.1/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and manage your AdSense host data and associated accounts
  73. AdsensehostScope = "https://www.googleapis.com/auth/adsensehost"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/adsensehost",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Accounts = NewAccountsService(s)
  106. s.Adclients = NewAdclientsService(s)
  107. s.Associationsessions = NewAssociationsessionsService(s)
  108. s.Customchannels = NewCustomchannelsService(s)
  109. s.Reports = NewReportsService(s)
  110. s.Urlchannels = NewUrlchannelsService(s)
  111. return s, nil
  112. }
  113. type Service struct {
  114. client *http.Client
  115. BasePath string // API endpoint base URL
  116. UserAgent string // optional additional User-Agent fragment
  117. Accounts *AccountsService
  118. Adclients *AdclientsService
  119. Associationsessions *AssociationsessionsService
  120. Customchannels *CustomchannelsService
  121. Reports *ReportsService
  122. Urlchannels *UrlchannelsService
  123. }
  124. func (s *Service) userAgent() string {
  125. if s.UserAgent == "" {
  126. return googleapi.UserAgent
  127. }
  128. return googleapi.UserAgent + " " + s.UserAgent
  129. }
  130. func NewAccountsService(s *Service) *AccountsService {
  131. rs := &AccountsService{s: s}
  132. rs.Adclients = NewAccountsAdclientsService(s)
  133. rs.Adunits = NewAccountsAdunitsService(s)
  134. rs.Reports = NewAccountsReportsService(s)
  135. return rs
  136. }
  137. type AccountsService struct {
  138. s *Service
  139. Adclients *AccountsAdclientsService
  140. Adunits *AccountsAdunitsService
  141. Reports *AccountsReportsService
  142. }
  143. func NewAccountsAdclientsService(s *Service) *AccountsAdclientsService {
  144. rs := &AccountsAdclientsService{s: s}
  145. return rs
  146. }
  147. type AccountsAdclientsService struct {
  148. s *Service
  149. }
  150. func NewAccountsAdunitsService(s *Service) *AccountsAdunitsService {
  151. rs := &AccountsAdunitsService{s: s}
  152. return rs
  153. }
  154. type AccountsAdunitsService struct {
  155. s *Service
  156. }
  157. func NewAccountsReportsService(s *Service) *AccountsReportsService {
  158. rs := &AccountsReportsService{s: s}
  159. return rs
  160. }
  161. type AccountsReportsService struct {
  162. s *Service
  163. }
  164. func NewAdclientsService(s *Service) *AdclientsService {
  165. rs := &AdclientsService{s: s}
  166. return rs
  167. }
  168. type AdclientsService struct {
  169. s *Service
  170. }
  171. func NewAssociationsessionsService(s *Service) *AssociationsessionsService {
  172. rs := &AssociationsessionsService{s: s}
  173. return rs
  174. }
  175. type AssociationsessionsService struct {
  176. s *Service
  177. }
  178. func NewCustomchannelsService(s *Service) *CustomchannelsService {
  179. rs := &CustomchannelsService{s: s}
  180. return rs
  181. }
  182. type CustomchannelsService struct {
  183. s *Service
  184. }
  185. func NewReportsService(s *Service) *ReportsService {
  186. rs := &ReportsService{s: s}
  187. return rs
  188. }
  189. type ReportsService struct {
  190. s *Service
  191. }
  192. func NewUrlchannelsService(s *Service) *UrlchannelsService {
  193. rs := &UrlchannelsService{s: s}
  194. return rs
  195. }
  196. type UrlchannelsService struct {
  197. s *Service
  198. }
  199. type Account struct {
  200. // Id: Unique identifier of this account.
  201. Id string `json:"id,omitempty"`
  202. // Kind: Kind of resource this is, in this case adsensehost#account.
  203. Kind string `json:"kind,omitempty"`
  204. // Name: Name of this account.
  205. Name string `json:"name,omitempty"`
  206. // Status: Approval status of this account. One of: PENDING, APPROVED,
  207. // DISABLED.
  208. Status string `json:"status,omitempty"`
  209. // ServerResponse contains the HTTP response code and headers from the
  210. // server.
  211. googleapi.ServerResponse `json:"-"`
  212. // ForceSendFields is a list of field names (e.g. "Id") to
  213. // unconditionally include in API requests. By default, fields with
  214. // empty values are omitted from API requests. However, any non-pointer,
  215. // non-interface field appearing in ForceSendFields will be sent to the
  216. // server regardless of whether the field is empty or not. This may be
  217. // used to include empty fields in Patch requests.
  218. ForceSendFields []string `json:"-"`
  219. // NullFields is a list of field names (e.g. "Id") to include in API
  220. // requests with the JSON null value. By default, fields with empty
  221. // values are omitted from API requests. However, any field with an
  222. // empty value appearing in NullFields will be sent to the server as
  223. // null. It is an error if a field in this list has a non-empty value.
  224. // This may be used to include null fields in Patch requests.
  225. NullFields []string `json:"-"`
  226. }
  227. func (s *Account) MarshalJSON() ([]byte, error) {
  228. type NoMethod Account
  229. raw := NoMethod(*s)
  230. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  231. }
  232. type Accounts struct {
  233. // Etag: ETag of this response for caching purposes.
  234. Etag string `json:"etag,omitempty"`
  235. // Items: The accounts returned in this list response.
  236. Items []*Account `json:"items,omitempty"`
  237. // Kind: Kind of list this is, in this case adsensehost#accounts.
  238. Kind string `json:"kind,omitempty"`
  239. // ServerResponse contains the HTTP response code and headers from the
  240. // server.
  241. googleapi.ServerResponse `json:"-"`
  242. // ForceSendFields is a list of field names (e.g. "Etag") to
  243. // unconditionally include in API requests. By default, fields with
  244. // empty values are omitted from API requests. However, any non-pointer,
  245. // non-interface field appearing in ForceSendFields will be sent to the
  246. // server regardless of whether the field is empty or not. This may be
  247. // used to include empty fields in Patch requests.
  248. ForceSendFields []string `json:"-"`
  249. // NullFields is a list of field names (e.g. "Etag") to include in API
  250. // requests with the JSON null value. By default, fields with empty
  251. // values are omitted from API requests. However, any field with an
  252. // empty value appearing in NullFields will be sent to the server as
  253. // null. It is an error if a field in this list has a non-empty value.
  254. // This may be used to include null fields in Patch requests.
  255. NullFields []string `json:"-"`
  256. }
  257. func (s *Accounts) MarshalJSON() ([]byte, error) {
  258. type NoMethod Accounts
  259. raw := NoMethod(*s)
  260. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  261. }
  262. type AdClient struct {
  263. // ArcOptIn: Whether this ad client is opted in to ARC.
  264. ArcOptIn bool `json:"arcOptIn,omitempty"`
  265. // Id: Unique identifier of this ad client.
  266. Id string `json:"id,omitempty"`
  267. // Kind: Kind of resource this is, in this case adsensehost#adClient.
  268. Kind string `json:"kind,omitempty"`
  269. // ProductCode: This ad client's product code, which corresponds to the
  270. // PRODUCT_CODE report dimension.
  271. ProductCode string `json:"productCode,omitempty"`
  272. // SupportsReporting: Whether this ad client supports being reported on.
  273. SupportsReporting bool `json:"supportsReporting,omitempty"`
  274. // ServerResponse contains the HTTP response code and headers from the
  275. // server.
  276. googleapi.ServerResponse `json:"-"`
  277. // ForceSendFields is a list of field names (e.g. "ArcOptIn") to
  278. // unconditionally include in API requests. By default, fields with
  279. // empty values are omitted from API requests. However, any non-pointer,
  280. // non-interface field appearing in ForceSendFields will be sent to the
  281. // server regardless of whether the field is empty or not. This may be
  282. // used to include empty fields in Patch requests.
  283. ForceSendFields []string `json:"-"`
  284. // NullFields is a list of field names (e.g. "ArcOptIn") to include in
  285. // API requests with the JSON null value. By default, fields with empty
  286. // values are omitted from API requests. However, any field with an
  287. // empty value appearing in NullFields will be sent to the server as
  288. // null. It is an error if a field in this list has a non-empty value.
  289. // This may be used to include null fields in Patch requests.
  290. NullFields []string `json:"-"`
  291. }
  292. func (s *AdClient) MarshalJSON() ([]byte, error) {
  293. type NoMethod AdClient
  294. raw := NoMethod(*s)
  295. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  296. }
  297. type AdClients struct {
  298. // Etag: ETag of this response for caching purposes.
  299. Etag string `json:"etag,omitempty"`
  300. // Items: The ad clients returned in this list response.
  301. Items []*AdClient `json:"items,omitempty"`
  302. // Kind: Kind of list this is, in this case adsensehost#adClients.
  303. Kind string `json:"kind,omitempty"`
  304. // NextPageToken: Continuation token used to page through ad clients. To
  305. // retrieve the next page of results, set the next request's "pageToken"
  306. // value to this.
  307. NextPageToken string `json:"nextPageToken,omitempty"`
  308. // ServerResponse contains the HTTP response code and headers from the
  309. // server.
  310. googleapi.ServerResponse `json:"-"`
  311. // ForceSendFields is a list of field names (e.g. "Etag") to
  312. // unconditionally include in API requests. By default, fields with
  313. // empty values are omitted from API requests. However, any non-pointer,
  314. // non-interface field appearing in ForceSendFields will be sent to the
  315. // server regardless of whether the field is empty or not. This may be
  316. // used to include empty fields in Patch requests.
  317. ForceSendFields []string `json:"-"`
  318. // NullFields is a list of field names (e.g. "Etag") to include in API
  319. // requests with the JSON null value. By default, fields with empty
  320. // values are omitted from API requests. However, any field with an
  321. // empty value appearing in NullFields will be sent to the server as
  322. // null. It is an error if a field in this list has a non-empty value.
  323. // This may be used to include null fields in Patch requests.
  324. NullFields []string `json:"-"`
  325. }
  326. func (s *AdClients) MarshalJSON() ([]byte, error) {
  327. type NoMethod AdClients
  328. raw := NoMethod(*s)
  329. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  330. }
  331. type AdCode struct {
  332. // AdCode: The ad code snippet.
  333. AdCode string `json:"adCode,omitempty"`
  334. // Kind: Kind this is, in this case adsensehost#adCode.
  335. Kind string `json:"kind,omitempty"`
  336. // ServerResponse contains the HTTP response code and headers from the
  337. // server.
  338. googleapi.ServerResponse `json:"-"`
  339. // ForceSendFields is a list of field names (e.g. "AdCode") to
  340. // unconditionally include in API requests. By default, fields with
  341. // empty values are omitted from API requests. However, any non-pointer,
  342. // non-interface field appearing in ForceSendFields will be sent to the
  343. // server regardless of whether the field is empty or not. This may be
  344. // used to include empty fields in Patch requests.
  345. ForceSendFields []string `json:"-"`
  346. // NullFields is a list of field names (e.g. "AdCode") to include in API
  347. // requests with the JSON null value. By default, fields with empty
  348. // values are omitted from API requests. However, any field with an
  349. // empty value appearing in NullFields will be sent to the server as
  350. // null. It is an error if a field in this list has a non-empty value.
  351. // This may be used to include null fields in Patch requests.
  352. NullFields []string `json:"-"`
  353. }
  354. func (s *AdCode) MarshalJSON() ([]byte, error) {
  355. type NoMethod AdCode
  356. raw := NoMethod(*s)
  357. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  358. }
  359. type AdStyle struct {
  360. // Colors: The colors included in the style. These are represented as
  361. // six hexadecimal characters, similar to HTML color codes, but without
  362. // the leading hash.
  363. Colors *AdStyleColors `json:"colors,omitempty"`
  364. // Corners: The style of the corners in the ad (deprecated: never
  365. // populated, ignored).
  366. Corners string `json:"corners,omitempty"`
  367. // Font: The font which is included in the style.
  368. Font *AdStyleFont `json:"font,omitempty"`
  369. // Kind: Kind this is, in this case adsensehost#adStyle.
  370. Kind string `json:"kind,omitempty"`
  371. // ForceSendFields is a list of field names (e.g. "Colors") to
  372. // unconditionally include in API requests. By default, fields with
  373. // empty values are omitted from API requests. However, any non-pointer,
  374. // non-interface field appearing in ForceSendFields will be sent to the
  375. // server regardless of whether the field is empty or not. This may be
  376. // used to include empty fields in Patch requests.
  377. ForceSendFields []string `json:"-"`
  378. // NullFields is a list of field names (e.g. "Colors") to include in API
  379. // requests with the JSON null value. By default, fields with empty
  380. // values are omitted from API requests. However, any field with an
  381. // empty value appearing in NullFields will be sent to the server as
  382. // null. It is an error if a field in this list has a non-empty value.
  383. // This may be used to include null fields in Patch requests.
  384. NullFields []string `json:"-"`
  385. }
  386. func (s *AdStyle) MarshalJSON() ([]byte, error) {
  387. type NoMethod AdStyle
  388. raw := NoMethod(*s)
  389. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  390. }
  391. // AdStyleColors: The colors included in the style. These are
  392. // represented as six hexadecimal characters, similar to HTML color
  393. // codes, but without the leading hash.
  394. type AdStyleColors struct {
  395. // Background: The color of the ad background.
  396. Background string `json:"background,omitempty"`
  397. // Border: The color of the ad border.
  398. Border string `json:"border,omitempty"`
  399. // Text: The color of the ad text.
  400. Text string `json:"text,omitempty"`
  401. // Title: The color of the ad title.
  402. Title string `json:"title,omitempty"`
  403. // Url: The color of the ad url.
  404. Url string `json:"url,omitempty"`
  405. // ForceSendFields is a list of field names (e.g. "Background") to
  406. // unconditionally include in API requests. By default, fields with
  407. // empty values are omitted from API requests. However, any non-pointer,
  408. // non-interface field appearing in ForceSendFields will be sent to the
  409. // server regardless of whether the field is empty or not. This may be
  410. // used to include empty fields in Patch requests.
  411. ForceSendFields []string `json:"-"`
  412. // NullFields is a list of field names (e.g. "Background") to include in
  413. // API requests with the JSON null value. By default, fields with empty
  414. // values are omitted from API requests. However, any field with an
  415. // empty value appearing in NullFields will be sent to the server as
  416. // null. It is an error if a field in this list has a non-empty value.
  417. // This may be used to include null fields in Patch requests.
  418. NullFields []string `json:"-"`
  419. }
  420. func (s *AdStyleColors) MarshalJSON() ([]byte, error) {
  421. type NoMethod AdStyleColors
  422. raw := NoMethod(*s)
  423. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  424. }
  425. // AdStyleFont: The font which is included in the style.
  426. type AdStyleFont struct {
  427. // Family: The family of the font. Possible values are:
  428. // ACCOUNT_DEFAULT_FAMILY, ADSENSE_DEFAULT_FAMILY, ARIAL, TIMES and
  429. // VERDANA.
  430. Family string `json:"family,omitempty"`
  431. // Size: The size of the font. Possible values are:
  432. // ACCOUNT_DEFAULT_SIZE, ADSENSE_DEFAULT_SIZE, SMALL, MEDIUM and LARGE.
  433. Size string `json:"size,omitempty"`
  434. // ForceSendFields is a list of field names (e.g. "Family") to
  435. // unconditionally include in API requests. By default, fields with
  436. // empty values are omitted from API requests. However, any non-pointer,
  437. // non-interface field appearing in ForceSendFields will be sent to the
  438. // server regardless of whether the field is empty or not. This may be
  439. // used to include empty fields in Patch requests.
  440. ForceSendFields []string `json:"-"`
  441. // NullFields is a list of field names (e.g. "Family") to include in API
  442. // requests with the JSON null value. By default, fields with empty
  443. // values are omitted from API requests. However, any field with an
  444. // empty value appearing in NullFields will be sent to the server as
  445. // null. It is an error if a field in this list has a non-empty value.
  446. // This may be used to include null fields in Patch requests.
  447. NullFields []string `json:"-"`
  448. }
  449. func (s *AdStyleFont) MarshalJSON() ([]byte, error) {
  450. type NoMethod AdStyleFont
  451. raw := NoMethod(*s)
  452. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  453. }
  454. type AdUnit struct {
  455. // Code: Identity code of this ad unit, not necessarily unique across ad
  456. // clients.
  457. Code string `json:"code,omitempty"`
  458. // ContentAdsSettings: Settings specific to content ads (AFC) and
  459. // highend mobile content ads (AFMC - deprecated).
  460. ContentAdsSettings *AdUnitContentAdsSettings `json:"contentAdsSettings,omitempty"`
  461. // CustomStyle: Custom style information specific to this ad unit.
  462. CustomStyle *AdStyle `json:"customStyle,omitempty"`
  463. // Id: Unique identifier of this ad unit. This should be considered an
  464. // opaque identifier; it is not safe to rely on it being in any
  465. // particular format.
  466. Id string `json:"id,omitempty"`
  467. // Kind: Kind of resource this is, in this case adsensehost#adUnit.
  468. Kind string `json:"kind,omitempty"`
  469. // MobileContentAdsSettings: Settings specific to WAP mobile content ads
  470. // (AFMC - deprecated).
  471. MobileContentAdsSettings *AdUnitMobileContentAdsSettings `json:"mobileContentAdsSettings,omitempty"`
  472. // Name: Name of this ad unit.
  473. Name string `json:"name,omitempty"`
  474. // Status: Status of this ad unit. Possible values are:
  475. // NEW: Indicates that the ad unit was created within the last seven
  476. // days and does not yet have any activity associated with it.
  477. //
  478. // ACTIVE: Indicates that there has been activity on this ad unit in the
  479. // last seven days.
  480. //
  481. // INACTIVE: Indicates that there has been no activity on this ad unit
  482. // in the last seven days.
  483. Status string `json:"status,omitempty"`
  484. // ServerResponse contains the HTTP response code and headers from the
  485. // server.
  486. googleapi.ServerResponse `json:"-"`
  487. // ForceSendFields is a list of field names (e.g. "Code") to
  488. // unconditionally include in API requests. By default, fields with
  489. // empty values are omitted from API requests. However, any non-pointer,
  490. // non-interface field appearing in ForceSendFields will be sent to the
  491. // server regardless of whether the field is empty or not. This may be
  492. // used to include empty fields in Patch requests.
  493. ForceSendFields []string `json:"-"`
  494. // NullFields is a list of field names (e.g. "Code") to include in API
  495. // requests with the JSON null value. By default, fields with empty
  496. // values are omitted from API requests. However, any field with an
  497. // empty value appearing in NullFields will be sent to the server as
  498. // null. It is an error if a field in this list has a non-empty value.
  499. // This may be used to include null fields in Patch requests.
  500. NullFields []string `json:"-"`
  501. }
  502. func (s *AdUnit) MarshalJSON() ([]byte, error) {
  503. type NoMethod AdUnit
  504. raw := NoMethod(*s)
  505. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  506. }
  507. // AdUnitContentAdsSettings: Settings specific to content ads (AFC) and
  508. // highend mobile content ads (AFMC - deprecated).
  509. type AdUnitContentAdsSettings struct {
  510. // BackupOption: The backup option to be used in instances where no ad
  511. // is available.
  512. BackupOption *AdUnitContentAdsSettingsBackupOption `json:"backupOption,omitempty"`
  513. // Size: Size of this ad unit. Size values are in the form
  514. // SIZE_{width}_{height}.
  515. Size string `json:"size,omitempty"`
  516. // Type: Type of this ad unit. Possible values are TEXT, TEXT_IMAGE,
  517. // IMAGE and LINK.
  518. Type string `json:"type,omitempty"`
  519. // ForceSendFields is a list of field names (e.g. "BackupOption") to
  520. // unconditionally include in API requests. By default, fields with
  521. // empty values are omitted from API requests. However, any non-pointer,
  522. // non-interface field appearing in ForceSendFields will be sent to the
  523. // server regardless of whether the field is empty or not. This may be
  524. // used to include empty fields in Patch requests.
  525. ForceSendFields []string `json:"-"`
  526. // NullFields is a list of field names (e.g. "BackupOption") to include
  527. // in API requests with the JSON null value. By default, fields with
  528. // empty values are omitted from API requests. However, any field with
  529. // an empty value appearing in NullFields will be sent to the server as
  530. // null. It is an error if a field in this list has a non-empty value.
  531. // This may be used to include null fields in Patch requests.
  532. NullFields []string `json:"-"`
  533. }
  534. func (s *AdUnitContentAdsSettings) MarshalJSON() ([]byte, error) {
  535. type NoMethod AdUnitContentAdsSettings
  536. raw := NoMethod(*s)
  537. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  538. }
  539. // AdUnitContentAdsSettingsBackupOption: The backup option to be used in
  540. // instances where no ad is available.
  541. type AdUnitContentAdsSettingsBackupOption struct {
  542. // Color: Color to use when type is set to COLOR. These are represented
  543. // as six hexadecimal characters, similar to HTML color codes, but
  544. // without the leading hash.
  545. Color string `json:"color,omitempty"`
  546. // Type: Type of the backup option. Possible values are BLANK, COLOR and
  547. // URL.
  548. Type string `json:"type,omitempty"`
  549. // Url: URL to use when type is set to URL.
  550. Url string `json:"url,omitempty"`
  551. // ForceSendFields is a list of field names (e.g. "Color") to
  552. // unconditionally include in API requests. By default, fields with
  553. // empty values are omitted from API requests. However, any non-pointer,
  554. // non-interface field appearing in ForceSendFields will be sent to the
  555. // server regardless of whether the field is empty or not. This may be
  556. // used to include empty fields in Patch requests.
  557. ForceSendFields []string `json:"-"`
  558. // NullFields is a list of field names (e.g. "Color") to include in API
  559. // requests with the JSON null value. By default, fields with empty
  560. // values are omitted from API requests. However, any field with an
  561. // empty value appearing in NullFields will be sent to the server as
  562. // null. It is an error if a field in this list has a non-empty value.
  563. // This may be used to include null fields in Patch requests.
  564. NullFields []string `json:"-"`
  565. }
  566. func (s *AdUnitContentAdsSettingsBackupOption) MarshalJSON() ([]byte, error) {
  567. type NoMethod AdUnitContentAdsSettingsBackupOption
  568. raw := NoMethod(*s)
  569. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  570. }
  571. // AdUnitMobileContentAdsSettings: Settings specific to WAP mobile
  572. // content ads (AFMC - deprecated).
  573. type AdUnitMobileContentAdsSettings struct {
  574. // MarkupLanguage: The markup language to use for this ad unit.
  575. MarkupLanguage string `json:"markupLanguage,omitempty"`
  576. // ScriptingLanguage: The scripting language to use for this ad unit.
  577. ScriptingLanguage string `json:"scriptingLanguage,omitempty"`
  578. // Size: Size of this ad unit.
  579. Size string `json:"size,omitempty"`
  580. // Type: Type of this ad unit.
  581. Type string `json:"type,omitempty"`
  582. // ForceSendFields is a list of field names (e.g. "MarkupLanguage") to
  583. // unconditionally include in API requests. By default, fields with
  584. // empty values are omitted from API requests. However, any non-pointer,
  585. // non-interface field appearing in ForceSendFields will be sent to the
  586. // server regardless of whether the field is empty or not. This may be
  587. // used to include empty fields in Patch requests.
  588. ForceSendFields []string `json:"-"`
  589. // NullFields is a list of field names (e.g. "MarkupLanguage") to
  590. // include in API requests with the JSON null value. By default, fields
  591. // with empty values are omitted from API requests. However, any field
  592. // with an empty value appearing in NullFields will be sent to the
  593. // server as null. It is an error if a field in this list has a
  594. // non-empty value. This may be used to include null fields in Patch
  595. // requests.
  596. NullFields []string `json:"-"`
  597. }
  598. func (s *AdUnitMobileContentAdsSettings) MarshalJSON() ([]byte, error) {
  599. type NoMethod AdUnitMobileContentAdsSettings
  600. raw := NoMethod(*s)
  601. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  602. }
  603. type AdUnits struct {
  604. // Etag: ETag of this response for caching purposes.
  605. Etag string `json:"etag,omitempty"`
  606. // Items: The ad units returned in this list response.
  607. Items []*AdUnit `json:"items,omitempty"`
  608. // Kind: Kind of list this is, in this case adsensehost#adUnits.
  609. Kind string `json:"kind,omitempty"`
  610. // NextPageToken: Continuation token used to page through ad units. To
  611. // retrieve the next page of results, set the next request's "pageToken"
  612. // value to this.
  613. NextPageToken string `json:"nextPageToken,omitempty"`
  614. // ServerResponse contains the HTTP response code and headers from the
  615. // server.
  616. googleapi.ServerResponse `json:"-"`
  617. // ForceSendFields is a list of field names (e.g. "Etag") to
  618. // unconditionally include in API requests. By default, fields with
  619. // empty values are omitted from API requests. However, any non-pointer,
  620. // non-interface field appearing in ForceSendFields will be sent to the
  621. // server regardless of whether the field is empty or not. This may be
  622. // used to include empty fields in Patch requests.
  623. ForceSendFields []string `json:"-"`
  624. // NullFields is a list of field names (e.g. "Etag") to include in API
  625. // requests with the JSON null value. By default, fields with empty
  626. // values are omitted from API requests. However, any field with an
  627. // empty value appearing in NullFields will be sent to the server as
  628. // null. It is an error if a field in this list has a non-empty value.
  629. // This may be used to include null fields in Patch requests.
  630. NullFields []string `json:"-"`
  631. }
  632. func (s *AdUnits) MarshalJSON() ([]byte, error) {
  633. type NoMethod AdUnits
  634. raw := NoMethod(*s)
  635. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  636. }
  637. type AssociationSession struct {
  638. // AccountId: Hosted account id of the associated publisher after
  639. // association. Present if status is ACCEPTED.
  640. AccountId string `json:"accountId,omitempty"`
  641. // Id: Unique identifier of this association session.
  642. Id string `json:"id,omitempty"`
  643. // Kind: Kind of resource this is, in this case
  644. // adsensehost#associationSession.
  645. Kind string `json:"kind,omitempty"`
  646. // ProductCodes: The products to associate with the user. Options: AFC,
  647. // AFG, AFV, AFS (deprecated), AFMC (deprecated)
  648. ProductCodes []string `json:"productCodes,omitempty"`
  649. // RedirectUrl: Redirect URL of this association session. Used to
  650. // redirect users into the AdSense association flow.
  651. RedirectUrl string `json:"redirectUrl,omitempty"`
  652. // Status: Status of the completed association, available once the
  653. // association callback token has been verified. One of ACCEPTED,
  654. // REJECTED, or ERROR.
  655. Status string `json:"status,omitempty"`
  656. // UserLocale: The preferred locale of the user themselves when going
  657. // through the AdSense association flow.
  658. UserLocale string `json:"userLocale,omitempty"`
  659. // WebsiteLocale: The locale of the user's hosted website.
  660. WebsiteLocale string `json:"websiteLocale,omitempty"`
  661. // WebsiteUrl: The URL of the user's hosted website.
  662. WebsiteUrl string `json:"websiteUrl,omitempty"`
  663. // ServerResponse contains the HTTP response code and headers from the
  664. // server.
  665. googleapi.ServerResponse `json:"-"`
  666. // ForceSendFields is a list of field names (e.g. "AccountId") to
  667. // unconditionally include in API requests. By default, fields with
  668. // empty values are omitted from API requests. However, any non-pointer,
  669. // non-interface field appearing in ForceSendFields will be sent to the
  670. // server regardless of whether the field is empty or not. This may be
  671. // used to include empty fields in Patch requests.
  672. ForceSendFields []string `json:"-"`
  673. // NullFields is a list of field names (e.g. "AccountId") to include in
  674. // API requests with the JSON null value. By default, fields with empty
  675. // values are omitted from API requests. However, any field with an
  676. // empty value appearing in NullFields will be sent to the server as
  677. // null. It is an error if a field in this list has a non-empty value.
  678. // This may be used to include null fields in Patch requests.
  679. NullFields []string `json:"-"`
  680. }
  681. func (s *AssociationSession) MarshalJSON() ([]byte, error) {
  682. type NoMethod AssociationSession
  683. raw := NoMethod(*s)
  684. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  685. }
  686. type CustomChannel struct {
  687. // Code: Code of this custom channel, not necessarily unique across ad
  688. // clients.
  689. Code string `json:"code,omitempty"`
  690. // Id: Unique identifier of this custom channel. This should be
  691. // considered an opaque identifier; it is not safe to rely on it being
  692. // in any particular format.
  693. Id string `json:"id,omitempty"`
  694. // Kind: Kind of resource this is, in this case
  695. // adsensehost#customChannel.
  696. Kind string `json:"kind,omitempty"`
  697. // Name: Name of this custom channel.
  698. Name string `json:"name,omitempty"`
  699. // ServerResponse contains the HTTP response code and headers from the
  700. // server.
  701. googleapi.ServerResponse `json:"-"`
  702. // ForceSendFields is a list of field names (e.g. "Code") to
  703. // unconditionally include in API requests. By default, fields with
  704. // empty values are omitted from API requests. However, any non-pointer,
  705. // non-interface field appearing in ForceSendFields will be sent to the
  706. // server regardless of whether the field is empty or not. This may be
  707. // used to include empty fields in Patch requests.
  708. ForceSendFields []string `json:"-"`
  709. // NullFields is a list of field names (e.g. "Code") to include in API
  710. // requests with the JSON null value. By default, fields with empty
  711. // values are omitted from API requests. However, any field with an
  712. // empty value appearing in NullFields will be sent to the server as
  713. // null. It is an error if a field in this list has a non-empty value.
  714. // This may be used to include null fields in Patch requests.
  715. NullFields []string `json:"-"`
  716. }
  717. func (s *CustomChannel) MarshalJSON() ([]byte, error) {
  718. type NoMethod CustomChannel
  719. raw := NoMethod(*s)
  720. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  721. }
  722. type CustomChannels struct {
  723. // Etag: ETag of this response for caching purposes.
  724. Etag string `json:"etag,omitempty"`
  725. // Items: The custom channels returned in this list response.
  726. Items []*CustomChannel `json:"items,omitempty"`
  727. // Kind: Kind of list this is, in this case adsensehost#customChannels.
  728. Kind string `json:"kind,omitempty"`
  729. // NextPageToken: Continuation token used to page through custom
  730. // channels. To retrieve the next page of results, set the next
  731. // request's "pageToken" value to this.
  732. NextPageToken string `json:"nextPageToken,omitempty"`
  733. // ServerResponse contains the HTTP response code and headers from the
  734. // server.
  735. googleapi.ServerResponse `json:"-"`
  736. // ForceSendFields is a list of field names (e.g. "Etag") to
  737. // unconditionally include in API requests. By default, fields with
  738. // empty values are omitted from API requests. However, any non-pointer,
  739. // non-interface field appearing in ForceSendFields will be sent to the
  740. // server regardless of whether the field is empty or not. This may be
  741. // used to include empty fields in Patch requests.
  742. ForceSendFields []string `json:"-"`
  743. // NullFields is a list of field names (e.g. "Etag") to include in API
  744. // requests with the JSON null value. By default, fields with empty
  745. // values are omitted from API requests. However, any field with an
  746. // empty value appearing in NullFields will be sent to the server as
  747. // null. It is an error if a field in this list has a non-empty value.
  748. // This may be used to include null fields in Patch requests.
  749. NullFields []string `json:"-"`
  750. }
  751. func (s *CustomChannels) MarshalJSON() ([]byte, error) {
  752. type NoMethod CustomChannels
  753. raw := NoMethod(*s)
  754. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  755. }
  756. type Report struct {
  757. // Averages: The averages of the report. This is the same length as any
  758. // other row in the report; cells corresponding to dimension columns are
  759. // empty.
  760. Averages []string `json:"averages,omitempty"`
  761. // Headers: The header information of the columns requested in the
  762. // report. This is a list of headers; one for each dimension in the
  763. // request, followed by one for each metric in the request.
  764. Headers []*ReportHeaders `json:"headers,omitempty"`
  765. // Kind: Kind this is, in this case adsensehost#report.
  766. Kind string `json:"kind,omitempty"`
  767. // Rows: The output rows of the report. Each row is a list of cells; one
  768. // for each dimension in the request, followed by one for each metric in
  769. // the request. The dimension cells contain strings, and the metric
  770. // cells contain numbers.
  771. Rows [][]string `json:"rows,omitempty"`
  772. // TotalMatchedRows: The total number of rows matched by the report
  773. // request. Fewer rows may be returned in the response due to being
  774. // limited by the row count requested or the report row limit.
  775. TotalMatchedRows int64 `json:"totalMatchedRows,omitempty,string"`
  776. // Totals: The totals of the report. This is the same length as any
  777. // other row in the report; cells corresponding to dimension columns are
  778. // empty.
  779. Totals []string `json:"totals,omitempty"`
  780. // Warnings: Any warnings associated with generation of the report.
  781. Warnings []string `json:"warnings,omitempty"`
  782. // ServerResponse contains the HTTP response code and headers from the
  783. // server.
  784. googleapi.ServerResponse `json:"-"`
  785. // ForceSendFields is a list of field names (e.g. "Averages") to
  786. // unconditionally include in API requests. By default, fields with
  787. // empty values are omitted from API requests. However, any non-pointer,
  788. // non-interface field appearing in ForceSendFields will be sent to the
  789. // server regardless of whether the field is empty or not. This may be
  790. // used to include empty fields in Patch requests.
  791. ForceSendFields []string `json:"-"`
  792. // NullFields is a list of field names (e.g. "Averages") to include in
  793. // API requests with the JSON null value. By default, fields with empty
  794. // values are omitted from API requests. However, any field with an
  795. // empty value appearing in NullFields will be sent to the server as
  796. // null. It is an error if a field in this list has a non-empty value.
  797. // This may be used to include null fields in Patch requests.
  798. NullFields []string `json:"-"`
  799. }
  800. func (s *Report) MarshalJSON() ([]byte, error) {
  801. type NoMethod Report
  802. raw := NoMethod(*s)
  803. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  804. }
  805. type ReportHeaders struct {
  806. // Currency: The currency of this column. Only present if the header
  807. // type is METRIC_CURRENCY.
  808. Currency string `json:"currency,omitempty"`
  809. // Name: The name of the header.
  810. Name string `json:"name,omitempty"`
  811. // Type: The type of the header; one of DIMENSION, METRIC_TALLY,
  812. // METRIC_RATIO, or METRIC_CURRENCY.
  813. Type string `json:"type,omitempty"`
  814. // ForceSendFields is a list of field names (e.g. "Currency") to
  815. // unconditionally include in API requests. By default, fields with
  816. // empty values are omitted from API requests. However, any non-pointer,
  817. // non-interface field appearing in ForceSendFields will be sent to the
  818. // server regardless of whether the field is empty or not. This may be
  819. // used to include empty fields in Patch requests.
  820. ForceSendFields []string `json:"-"`
  821. // NullFields is a list of field names (e.g. "Currency") to include in
  822. // API requests with the JSON null value. By default, fields with empty
  823. // values are omitted from API requests. However, any field with an
  824. // empty value appearing in NullFields will be sent to the server as
  825. // null. It is an error if a field in this list has a non-empty value.
  826. // This may be used to include null fields in Patch requests.
  827. NullFields []string `json:"-"`
  828. }
  829. func (s *ReportHeaders) MarshalJSON() ([]byte, error) {
  830. type NoMethod ReportHeaders
  831. raw := NoMethod(*s)
  832. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  833. }
  834. type UrlChannel struct {
  835. // Id: Unique identifier of this URL channel. This should be considered
  836. // an opaque identifier; it is not safe to rely on it being in any
  837. // particular format.
  838. Id string `json:"id,omitempty"`
  839. // Kind: Kind of resource this is, in this case adsensehost#urlChannel.
  840. Kind string `json:"kind,omitempty"`
  841. // UrlPattern: URL Pattern of this URL channel. Does not include
  842. // "http://" or "https://". Example: www.example.com/home
  843. UrlPattern string `json:"urlPattern,omitempty"`
  844. // ServerResponse contains the HTTP response code and headers from the
  845. // server.
  846. googleapi.ServerResponse `json:"-"`
  847. // ForceSendFields is a list of field names (e.g. "Id") to
  848. // unconditionally include in API requests. By default, fields with
  849. // empty values are omitted from API requests. However, any non-pointer,
  850. // non-interface field appearing in ForceSendFields will be sent to the
  851. // server regardless of whether the field is empty or not. This may be
  852. // used to include empty fields in Patch requests.
  853. ForceSendFields []string `json:"-"`
  854. // NullFields is a list of field names (e.g. "Id") to include in API
  855. // requests with the JSON null value. By default, fields with empty
  856. // values are omitted from API requests. However, any field with an
  857. // empty value appearing in NullFields will be sent to the server as
  858. // null. It is an error if a field in this list has a non-empty value.
  859. // This may be used to include null fields in Patch requests.
  860. NullFields []string `json:"-"`
  861. }
  862. func (s *UrlChannel) MarshalJSON() ([]byte, error) {
  863. type NoMethod UrlChannel
  864. raw := NoMethod(*s)
  865. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  866. }
  867. type UrlChannels struct {
  868. // Etag: ETag of this response for caching purposes.
  869. Etag string `json:"etag,omitempty"`
  870. // Items: The URL channels returned in this list response.
  871. Items []*UrlChannel `json:"items,omitempty"`
  872. // Kind: Kind of list this is, in this case adsensehost#urlChannels.
  873. Kind string `json:"kind,omitempty"`
  874. // NextPageToken: Continuation token used to page through URL channels.
  875. // To retrieve the next page of results, set the next request's
  876. // "pageToken" value to this.
  877. NextPageToken string `json:"nextPageToken,omitempty"`
  878. // ServerResponse contains the HTTP response code and headers from the
  879. // server.
  880. googleapi.ServerResponse `json:"-"`
  881. // ForceSendFields is a list of field names (e.g. "Etag") to
  882. // unconditionally include in API requests. By default, fields with
  883. // empty values are omitted from API requests. However, any non-pointer,
  884. // non-interface field appearing in ForceSendFields will be sent to the
  885. // server regardless of whether the field is empty or not. This may be
  886. // used to include empty fields in Patch requests.
  887. ForceSendFields []string `json:"-"`
  888. // NullFields is a list of field names (e.g. "Etag") to include in API
  889. // requests with the JSON null value. By default, fields with empty
  890. // values are omitted from API requests. However, any field with an
  891. // empty value appearing in NullFields will be sent to the server as
  892. // null. It is an error if a field in this list has a non-empty value.
  893. // This may be used to include null fields in Patch requests.
  894. NullFields []string `json:"-"`
  895. }
  896. func (s *UrlChannels) MarshalJSON() ([]byte, error) {
  897. type NoMethod UrlChannels
  898. raw := NoMethod(*s)
  899. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  900. }
  901. // method id "adsensehost.accounts.get":
  902. type AccountsGetCall struct {
  903. s *Service
  904. accountId string
  905. urlParams_ gensupport.URLParams
  906. ifNoneMatch_ string
  907. ctx_ context.Context
  908. header_ http.Header
  909. }
  910. // Get: Get information about the selected associated AdSense account.
  911. func (r *AccountsService) Get(accountId string) *AccountsGetCall {
  912. c := &AccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  913. c.accountId = accountId
  914. return c
  915. }
  916. // Fields allows partial responses to be retrieved. See
  917. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  918. // for more information.
  919. func (c *AccountsGetCall) Fields(s ...googleapi.Field) *AccountsGetCall {
  920. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  921. return c
  922. }
  923. // IfNoneMatch sets the optional parameter which makes the operation
  924. // fail if the object's ETag matches the given value. This is useful for
  925. // getting updates only after the object has changed since the last
  926. // request. Use googleapi.IsNotModified to check whether the response
  927. // error from Do is the result of In-None-Match.
  928. func (c *AccountsGetCall) IfNoneMatch(entityTag string) *AccountsGetCall {
  929. c.ifNoneMatch_ = entityTag
  930. return c
  931. }
  932. // Context sets the context to be used in this call's Do method. Any
  933. // pending HTTP request will be aborted if the provided context is
  934. // canceled.
  935. func (c *AccountsGetCall) Context(ctx context.Context) *AccountsGetCall {
  936. c.ctx_ = ctx
  937. return c
  938. }
  939. // Header returns an http.Header that can be modified by the caller to
  940. // add HTTP headers to the request.
  941. func (c *AccountsGetCall) Header() http.Header {
  942. if c.header_ == nil {
  943. c.header_ = make(http.Header)
  944. }
  945. return c.header_
  946. }
  947. func (c *AccountsGetCall) doRequest(alt string) (*http.Response, error) {
  948. reqHeaders := make(http.Header)
  949. for k, v := range c.header_ {
  950. reqHeaders[k] = v
  951. }
  952. reqHeaders.Set("User-Agent", c.s.userAgent())
  953. if c.ifNoneMatch_ != "" {
  954. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  955. }
  956. var body io.Reader = nil
  957. c.urlParams_.Set("alt", alt)
  958. c.urlParams_.Set("prettyPrint", "false")
  959. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}")
  960. urls += "?" + c.urlParams_.Encode()
  961. req, err := http.NewRequest("GET", urls, body)
  962. if err != nil {
  963. return nil, err
  964. }
  965. req.Header = reqHeaders
  966. googleapi.Expand(req.URL, map[string]string{
  967. "accountId": c.accountId,
  968. })
  969. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  970. }
  971. // Do executes the "adsensehost.accounts.get" call.
  972. // Exactly one of *Account or error will be non-nil. Any non-2xx status
  973. // code is an error. Response headers are in either
  974. // *Account.ServerResponse.Header or (if a response was returned at all)
  975. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  976. // check whether the returned error was because http.StatusNotModified
  977. // was returned.
  978. func (c *AccountsGetCall) Do(opts ...googleapi.CallOption) (*Account, error) {
  979. gensupport.SetOptions(c.urlParams_, opts...)
  980. res, err := c.doRequest("json")
  981. if res != nil && res.StatusCode == http.StatusNotModified {
  982. if res.Body != nil {
  983. res.Body.Close()
  984. }
  985. return nil, &googleapi.Error{
  986. Code: res.StatusCode,
  987. Header: res.Header,
  988. }
  989. }
  990. if err != nil {
  991. return nil, err
  992. }
  993. defer googleapi.CloseBody(res)
  994. if err := googleapi.CheckResponse(res); err != nil {
  995. return nil, err
  996. }
  997. ret := &Account{
  998. ServerResponse: googleapi.ServerResponse{
  999. Header: res.Header,
  1000. HTTPStatusCode: res.StatusCode,
  1001. },
  1002. }
  1003. target := &ret
  1004. if err := gensupport.DecodeResponse(target, res); err != nil {
  1005. return nil, err
  1006. }
  1007. return ret, nil
  1008. // {
  1009. // "description": "Get information about the selected associated AdSense account.",
  1010. // "httpMethod": "GET",
  1011. // "id": "adsensehost.accounts.get",
  1012. // "parameterOrder": [
  1013. // "accountId"
  1014. // ],
  1015. // "parameters": {
  1016. // "accountId": {
  1017. // "description": "Account to get information about.",
  1018. // "location": "path",
  1019. // "required": true,
  1020. // "type": "string"
  1021. // }
  1022. // },
  1023. // "path": "accounts/{accountId}",
  1024. // "response": {
  1025. // "$ref": "Account"
  1026. // },
  1027. // "scopes": [
  1028. // "https://www.googleapis.com/auth/adsensehost"
  1029. // ]
  1030. // }
  1031. }
  1032. // method id "adsensehost.accounts.list":
  1033. type AccountsListCall struct {
  1034. s *Service
  1035. urlParams_ gensupport.URLParams
  1036. ifNoneMatch_ string
  1037. ctx_ context.Context
  1038. header_ http.Header
  1039. }
  1040. // List: List hosted accounts associated with this AdSense account by ad
  1041. // client id.
  1042. func (r *AccountsService) List(filterAdClientId []string) *AccountsListCall {
  1043. c := &AccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1044. c.urlParams_.SetMulti("filterAdClientId", append([]string{}, filterAdClientId...))
  1045. return c
  1046. }
  1047. // Fields allows partial responses to be retrieved. See
  1048. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1049. // for more information.
  1050. func (c *AccountsListCall) Fields(s ...googleapi.Field) *AccountsListCall {
  1051. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1052. return c
  1053. }
  1054. // IfNoneMatch sets the optional parameter which makes the operation
  1055. // fail if the object's ETag matches the given value. This is useful for
  1056. // getting updates only after the object has changed since the last
  1057. // request. Use googleapi.IsNotModified to check whether the response
  1058. // error from Do is the result of In-None-Match.
  1059. func (c *AccountsListCall) IfNoneMatch(entityTag string) *AccountsListCall {
  1060. c.ifNoneMatch_ = entityTag
  1061. return c
  1062. }
  1063. // Context sets the context to be used in this call's Do method. Any
  1064. // pending HTTP request will be aborted if the provided context is
  1065. // canceled.
  1066. func (c *AccountsListCall) Context(ctx context.Context) *AccountsListCall {
  1067. c.ctx_ = ctx
  1068. return c
  1069. }
  1070. // Header returns an http.Header that can be modified by the caller to
  1071. // add HTTP headers to the request.
  1072. func (c *AccountsListCall) Header() http.Header {
  1073. if c.header_ == nil {
  1074. c.header_ = make(http.Header)
  1075. }
  1076. return c.header_
  1077. }
  1078. func (c *AccountsListCall) doRequest(alt string) (*http.Response, error) {
  1079. reqHeaders := make(http.Header)
  1080. for k, v := range c.header_ {
  1081. reqHeaders[k] = v
  1082. }
  1083. reqHeaders.Set("User-Agent", c.s.userAgent())
  1084. if c.ifNoneMatch_ != "" {
  1085. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1086. }
  1087. var body io.Reader = nil
  1088. c.urlParams_.Set("alt", alt)
  1089. c.urlParams_.Set("prettyPrint", "false")
  1090. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts")
  1091. urls += "?" + c.urlParams_.Encode()
  1092. req, err := http.NewRequest("GET", urls, body)
  1093. if err != nil {
  1094. return nil, err
  1095. }
  1096. req.Header = reqHeaders
  1097. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1098. }
  1099. // Do executes the "adsensehost.accounts.list" call.
  1100. // Exactly one of *Accounts or error will be non-nil. Any non-2xx status
  1101. // code is an error. Response headers are in either
  1102. // *Accounts.ServerResponse.Header or (if a response was returned at
  1103. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1104. // to check whether the returned error was because
  1105. // http.StatusNotModified was returned.
  1106. func (c *AccountsListCall) Do(opts ...googleapi.CallOption) (*Accounts, error) {
  1107. gensupport.SetOptions(c.urlParams_, opts...)
  1108. res, err := c.doRequest("json")
  1109. if res != nil && res.StatusCode == http.StatusNotModified {
  1110. if res.Body != nil {
  1111. res.Body.Close()
  1112. }
  1113. return nil, &googleapi.Error{
  1114. Code: res.StatusCode,
  1115. Header: res.Header,
  1116. }
  1117. }
  1118. if err != nil {
  1119. return nil, err
  1120. }
  1121. defer googleapi.CloseBody(res)
  1122. if err := googleapi.CheckResponse(res); err != nil {
  1123. return nil, err
  1124. }
  1125. ret := &Accounts{
  1126. ServerResponse: googleapi.ServerResponse{
  1127. Header: res.Header,
  1128. HTTPStatusCode: res.StatusCode,
  1129. },
  1130. }
  1131. target := &ret
  1132. if err := gensupport.DecodeResponse(target, res); err != nil {
  1133. return nil, err
  1134. }
  1135. return ret, nil
  1136. // {
  1137. // "description": "List hosted accounts associated with this AdSense account by ad client id.",
  1138. // "httpMethod": "GET",
  1139. // "id": "adsensehost.accounts.list",
  1140. // "parameterOrder": [
  1141. // "filterAdClientId"
  1142. // ],
  1143. // "parameters": {
  1144. // "filterAdClientId": {
  1145. // "description": "Ad clients to list accounts for.",
  1146. // "location": "query",
  1147. // "repeated": true,
  1148. // "required": true,
  1149. // "type": "string"
  1150. // }
  1151. // },
  1152. // "path": "accounts",
  1153. // "response": {
  1154. // "$ref": "Accounts"
  1155. // },
  1156. // "scopes": [
  1157. // "https://www.googleapis.com/auth/adsensehost"
  1158. // ]
  1159. // }
  1160. }
  1161. // method id "adsensehost.accounts.adclients.get":
  1162. type AccountsAdclientsGetCall struct {
  1163. s *Service
  1164. accountId string
  1165. adClientId string
  1166. urlParams_ gensupport.URLParams
  1167. ifNoneMatch_ string
  1168. ctx_ context.Context
  1169. header_ http.Header
  1170. }
  1171. // Get: Get information about one of the ad clients in the specified
  1172. // publisher's AdSense account.
  1173. func (r *AccountsAdclientsService) Get(accountId string, adClientId string) *AccountsAdclientsGetCall {
  1174. c := &AccountsAdclientsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1175. c.accountId = accountId
  1176. c.adClientId = adClientId
  1177. return c
  1178. }
  1179. // Fields allows partial responses to be retrieved. See
  1180. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1181. // for more information.
  1182. func (c *AccountsAdclientsGetCall) Fields(s ...googleapi.Field) *AccountsAdclientsGetCall {
  1183. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1184. return c
  1185. }
  1186. // IfNoneMatch sets the optional parameter which makes the operation
  1187. // fail if the object's ETag matches the given value. This is useful for
  1188. // getting updates only after the object has changed since the last
  1189. // request. Use googleapi.IsNotModified to check whether the response
  1190. // error from Do is the result of In-None-Match.
  1191. func (c *AccountsAdclientsGetCall) IfNoneMatch(entityTag string) *AccountsAdclientsGetCall {
  1192. c.ifNoneMatch_ = entityTag
  1193. return c
  1194. }
  1195. // Context sets the context to be used in this call's Do method. Any
  1196. // pending HTTP request will be aborted if the provided context is
  1197. // canceled.
  1198. func (c *AccountsAdclientsGetCall) Context(ctx context.Context) *AccountsAdclientsGetCall {
  1199. c.ctx_ = ctx
  1200. return c
  1201. }
  1202. // Header returns an http.Header that can be modified by the caller to
  1203. // add HTTP headers to the request.
  1204. func (c *AccountsAdclientsGetCall) Header() http.Header {
  1205. if c.header_ == nil {
  1206. c.header_ = make(http.Header)
  1207. }
  1208. return c.header_
  1209. }
  1210. func (c *AccountsAdclientsGetCall) doRequest(alt string) (*http.Response, error) {
  1211. reqHeaders := make(http.Header)
  1212. for k, v := range c.header_ {
  1213. reqHeaders[k] = v
  1214. }
  1215. reqHeaders.Set("User-Agent", c.s.userAgent())
  1216. if c.ifNoneMatch_ != "" {
  1217. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1218. }
  1219. var body io.Reader = nil
  1220. c.urlParams_.Set("alt", alt)
  1221. c.urlParams_.Set("prettyPrint", "false")
  1222. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}")
  1223. urls += "?" + c.urlParams_.Encode()
  1224. req, err := http.NewRequest("GET", urls, body)
  1225. if err != nil {
  1226. return nil, err
  1227. }
  1228. req.Header = reqHeaders
  1229. googleapi.Expand(req.URL, map[string]string{
  1230. "accountId": c.accountId,
  1231. "adClientId": c.adClientId,
  1232. })
  1233. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1234. }
  1235. // Do executes the "adsensehost.accounts.adclients.get" call.
  1236. // Exactly one of *AdClient or error will be non-nil. Any non-2xx status
  1237. // code is an error. Response headers are in either
  1238. // *AdClient.ServerResponse.Header or (if a response was returned at
  1239. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1240. // to check whether the returned error was because
  1241. // http.StatusNotModified was returned.
  1242. func (c *AccountsAdclientsGetCall) Do(opts ...googleapi.CallOption) (*AdClient, error) {
  1243. gensupport.SetOptions(c.urlParams_, opts...)
  1244. res, err := c.doRequest("json")
  1245. if res != nil && res.StatusCode == http.StatusNotModified {
  1246. if res.Body != nil {
  1247. res.Body.Close()
  1248. }
  1249. return nil, &googleapi.Error{
  1250. Code: res.StatusCode,
  1251. Header: res.Header,
  1252. }
  1253. }
  1254. if err != nil {
  1255. return nil, err
  1256. }
  1257. defer googleapi.CloseBody(res)
  1258. if err := googleapi.CheckResponse(res); err != nil {
  1259. return nil, err
  1260. }
  1261. ret := &AdClient{
  1262. ServerResponse: googleapi.ServerResponse{
  1263. Header: res.Header,
  1264. HTTPStatusCode: res.StatusCode,
  1265. },
  1266. }
  1267. target := &ret
  1268. if err := gensupport.DecodeResponse(target, res); err != nil {
  1269. return nil, err
  1270. }
  1271. return ret, nil
  1272. // {
  1273. // "description": "Get information about one of the ad clients in the specified publisher's AdSense account.",
  1274. // "httpMethod": "GET",
  1275. // "id": "adsensehost.accounts.adclients.get",
  1276. // "parameterOrder": [
  1277. // "accountId",
  1278. // "adClientId"
  1279. // ],
  1280. // "parameters": {
  1281. // "accountId": {
  1282. // "description": "Account which contains the ad client.",
  1283. // "location": "path",
  1284. // "required": true,
  1285. // "type": "string"
  1286. // },
  1287. // "adClientId": {
  1288. // "description": "Ad client to get.",
  1289. // "location": "path",
  1290. // "required": true,
  1291. // "type": "string"
  1292. // }
  1293. // },
  1294. // "path": "accounts/{accountId}/adclients/{adClientId}",
  1295. // "response": {
  1296. // "$ref": "AdClient"
  1297. // },
  1298. // "scopes": [
  1299. // "https://www.googleapis.com/auth/adsensehost"
  1300. // ]
  1301. // }
  1302. }
  1303. // method id "adsensehost.accounts.adclients.list":
  1304. type AccountsAdclientsListCall struct {
  1305. s *Service
  1306. accountId string
  1307. urlParams_ gensupport.URLParams
  1308. ifNoneMatch_ string
  1309. ctx_ context.Context
  1310. header_ http.Header
  1311. }
  1312. // List: List all hosted ad clients in the specified hosted account.
  1313. func (r *AccountsAdclientsService) List(accountId string) *AccountsAdclientsListCall {
  1314. c := &AccountsAdclientsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1315. c.accountId = accountId
  1316. return c
  1317. }
  1318. // MaxResults sets the optional parameter "maxResults": The maximum
  1319. // number of ad clients to include in the response, used for paging.
  1320. func (c *AccountsAdclientsListCall) MaxResults(maxResults int64) *AccountsAdclientsListCall {
  1321. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1322. return c
  1323. }
  1324. // PageToken sets the optional parameter "pageToken": A continuation
  1325. // token, used to page through ad clients. To retrieve the next page,
  1326. // set this parameter to the value of "nextPageToken" from the previous
  1327. // response.
  1328. func (c *AccountsAdclientsListCall) PageToken(pageToken string) *AccountsAdclientsListCall {
  1329. c.urlParams_.Set("pageToken", pageToken)
  1330. return c
  1331. }
  1332. // Fields allows partial responses to be retrieved. See
  1333. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1334. // for more information.
  1335. func (c *AccountsAdclientsListCall) Fields(s ...googleapi.Field) *AccountsAdclientsListCall {
  1336. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1337. return c
  1338. }
  1339. // IfNoneMatch sets the optional parameter which makes the operation
  1340. // fail if the object's ETag matches the given value. This is useful for
  1341. // getting updates only after the object has changed since the last
  1342. // request. Use googleapi.IsNotModified to check whether the response
  1343. // error from Do is the result of In-None-Match.
  1344. func (c *AccountsAdclientsListCall) IfNoneMatch(entityTag string) *AccountsAdclientsListCall {
  1345. c.ifNoneMatch_ = entityTag
  1346. return c
  1347. }
  1348. // Context sets the context to be used in this call's Do method. Any
  1349. // pending HTTP request will be aborted if the provided context is
  1350. // canceled.
  1351. func (c *AccountsAdclientsListCall) Context(ctx context.Context) *AccountsAdclientsListCall {
  1352. c.ctx_ = ctx
  1353. return c
  1354. }
  1355. // Header returns an http.Header that can be modified by the caller to
  1356. // add HTTP headers to the request.
  1357. func (c *AccountsAdclientsListCall) Header() http.Header {
  1358. if c.header_ == nil {
  1359. c.header_ = make(http.Header)
  1360. }
  1361. return c.header_
  1362. }
  1363. func (c *AccountsAdclientsListCall) doRequest(alt string) (*http.Response, error) {
  1364. reqHeaders := make(http.Header)
  1365. for k, v := range c.header_ {
  1366. reqHeaders[k] = v
  1367. }
  1368. reqHeaders.Set("User-Agent", c.s.userAgent())
  1369. if c.ifNoneMatch_ != "" {
  1370. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1371. }
  1372. var body io.Reader = nil
  1373. c.urlParams_.Set("alt", alt)
  1374. c.urlParams_.Set("prettyPrint", "false")
  1375. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients")
  1376. urls += "?" + c.urlParams_.Encode()
  1377. req, err := http.NewRequest("GET", urls, body)
  1378. if err != nil {
  1379. return nil, err
  1380. }
  1381. req.Header = reqHeaders
  1382. googleapi.Expand(req.URL, map[string]string{
  1383. "accountId": c.accountId,
  1384. })
  1385. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1386. }
  1387. // Do executes the "adsensehost.accounts.adclients.list" call.
  1388. // Exactly one of *AdClients or error will be non-nil. Any non-2xx
  1389. // status code is an error. Response headers are in either
  1390. // *AdClients.ServerResponse.Header or (if a response was returned at
  1391. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1392. // to check whether the returned error was because
  1393. // http.StatusNotModified was returned.
  1394. func (c *AccountsAdclientsListCall) Do(opts ...googleapi.CallOption) (*AdClients, error) {
  1395. gensupport.SetOptions(c.urlParams_, opts...)
  1396. res, err := c.doRequest("json")
  1397. if res != nil && res.StatusCode == http.StatusNotModified {
  1398. if res.Body != nil {
  1399. res.Body.Close()
  1400. }
  1401. return nil, &googleapi.Error{
  1402. Code: res.StatusCode,
  1403. Header: res.Header,
  1404. }
  1405. }
  1406. if err != nil {
  1407. return nil, err
  1408. }
  1409. defer googleapi.CloseBody(res)
  1410. if err := googleapi.CheckResponse(res); err != nil {
  1411. return nil, err
  1412. }
  1413. ret := &AdClients{
  1414. ServerResponse: googleapi.ServerResponse{
  1415. Header: res.Header,
  1416. HTTPStatusCode: res.StatusCode,
  1417. },
  1418. }
  1419. target := &ret
  1420. if err := gensupport.DecodeResponse(target, res); err != nil {
  1421. return nil, err
  1422. }
  1423. return ret, nil
  1424. // {
  1425. // "description": "List all hosted ad clients in the specified hosted account.",
  1426. // "httpMethod": "GET",
  1427. // "id": "adsensehost.accounts.adclients.list",
  1428. // "parameterOrder": [
  1429. // "accountId"
  1430. // ],
  1431. // "parameters": {
  1432. // "accountId": {
  1433. // "description": "Account for which to list ad clients.",
  1434. // "location": "path",
  1435. // "required": true,
  1436. // "type": "string"
  1437. // },
  1438. // "maxResults": {
  1439. // "description": "The maximum number of ad clients to include in the response, used for paging.",
  1440. // "format": "uint32",
  1441. // "location": "query",
  1442. // "maximum": "10000",
  1443. // "minimum": "0",
  1444. // "type": "integer"
  1445. // },
  1446. // "pageToken": {
  1447. // "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.",
  1448. // "location": "query",
  1449. // "type": "string"
  1450. // }
  1451. // },
  1452. // "path": "accounts/{accountId}/adclients",
  1453. // "response": {
  1454. // "$ref": "AdClients"
  1455. // },
  1456. // "scopes": [
  1457. // "https://www.googleapis.com/auth/adsensehost"
  1458. // ]
  1459. // }
  1460. }
  1461. // Pages invokes f for each page of results.
  1462. // A non-nil error returned from f will halt the iteration.
  1463. // The provided context supersedes any context provided to the Context method.
  1464. func (c *AccountsAdclientsListCall) Pages(ctx context.Context, f func(*AdClients) error) error {
  1465. c.ctx_ = ctx
  1466. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1467. for {
  1468. x, err := c.Do()
  1469. if err != nil {
  1470. return err
  1471. }
  1472. if err := f(x); err != nil {
  1473. return err
  1474. }
  1475. if x.NextPageToken == "" {
  1476. return nil
  1477. }
  1478. c.PageToken(x.NextPageToken)
  1479. }
  1480. }
  1481. // method id "adsensehost.accounts.adunits.delete":
  1482. type AccountsAdunitsDeleteCall struct {
  1483. s *Service
  1484. accountId string
  1485. adClientId string
  1486. adUnitId string
  1487. urlParams_ gensupport.URLParams
  1488. ctx_ context.Context
  1489. header_ http.Header
  1490. }
  1491. // Delete: Delete the specified ad unit from the specified publisher
  1492. // AdSense account.
  1493. func (r *AccountsAdunitsService) Delete(accountId string, adClientId string, adUnitId string) *AccountsAdunitsDeleteCall {
  1494. c := &AccountsAdunitsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1495. c.accountId = accountId
  1496. c.adClientId = adClientId
  1497. c.adUnitId = adUnitId
  1498. return c
  1499. }
  1500. // Fields allows partial responses to be retrieved. See
  1501. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1502. // for more information.
  1503. func (c *AccountsAdunitsDeleteCall) Fields(s ...googleapi.Field) *AccountsAdunitsDeleteCall {
  1504. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1505. return c
  1506. }
  1507. // Context sets the context to be used in this call's Do method. Any
  1508. // pending HTTP request will be aborted if the provided context is
  1509. // canceled.
  1510. func (c *AccountsAdunitsDeleteCall) Context(ctx context.Context) *AccountsAdunitsDeleteCall {
  1511. c.ctx_ = ctx
  1512. return c
  1513. }
  1514. // Header returns an http.Header that can be modified by the caller to
  1515. // add HTTP headers to the request.
  1516. func (c *AccountsAdunitsDeleteCall) Header() http.Header {
  1517. if c.header_ == nil {
  1518. c.header_ = make(http.Header)
  1519. }
  1520. return c.header_
  1521. }
  1522. func (c *AccountsAdunitsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1523. reqHeaders := make(http.Header)
  1524. for k, v := range c.header_ {
  1525. reqHeaders[k] = v
  1526. }
  1527. reqHeaders.Set("User-Agent", c.s.userAgent())
  1528. var body io.Reader = nil
  1529. c.urlParams_.Set("alt", alt)
  1530. c.urlParams_.Set("prettyPrint", "false")
  1531. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}")
  1532. urls += "?" + c.urlParams_.Encode()
  1533. req, err := http.NewRequest("DELETE", urls, body)
  1534. if err != nil {
  1535. return nil, err
  1536. }
  1537. req.Header = reqHeaders
  1538. googleapi.Expand(req.URL, map[string]string{
  1539. "accountId": c.accountId,
  1540. "adClientId": c.adClientId,
  1541. "adUnitId": c.adUnitId,
  1542. })
  1543. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1544. }
  1545. // Do executes the "adsensehost.accounts.adunits.delete" call.
  1546. // Exactly one of *AdUnit or error will be non-nil. Any non-2xx status
  1547. // code is an error. Response headers are in either
  1548. // *AdUnit.ServerResponse.Header or (if a response was returned at all)
  1549. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1550. // check whether the returned error was because http.StatusNotModified
  1551. // was returned.
  1552. func (c *AccountsAdunitsDeleteCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  1553. gensupport.SetOptions(c.urlParams_, opts...)
  1554. res, err := c.doRequest("json")
  1555. if res != nil && res.StatusCode == http.StatusNotModified {
  1556. if res.Body != nil {
  1557. res.Body.Close()
  1558. }
  1559. return nil, &googleapi.Error{
  1560. Code: res.StatusCode,
  1561. Header: res.Header,
  1562. }
  1563. }
  1564. if err != nil {
  1565. return nil, err
  1566. }
  1567. defer googleapi.CloseBody(res)
  1568. if err := googleapi.CheckResponse(res); err != nil {
  1569. return nil, err
  1570. }
  1571. ret := &AdUnit{
  1572. ServerResponse: googleapi.ServerResponse{
  1573. Header: res.Header,
  1574. HTTPStatusCode: res.StatusCode,
  1575. },
  1576. }
  1577. target := &ret
  1578. if err := gensupport.DecodeResponse(target, res); err != nil {
  1579. return nil, err
  1580. }
  1581. return ret, nil
  1582. // {
  1583. // "description": "Delete the specified ad unit from the specified publisher AdSense account.",
  1584. // "httpMethod": "DELETE",
  1585. // "id": "adsensehost.accounts.adunits.delete",
  1586. // "parameterOrder": [
  1587. // "accountId",
  1588. // "adClientId",
  1589. // "adUnitId"
  1590. // ],
  1591. // "parameters": {
  1592. // "accountId": {
  1593. // "description": "Account which contains the ad unit.",
  1594. // "location": "path",
  1595. // "required": true,
  1596. // "type": "string"
  1597. // },
  1598. // "adClientId": {
  1599. // "description": "Ad client for which to get ad unit.",
  1600. // "location": "path",
  1601. // "required": true,
  1602. // "type": "string"
  1603. // },
  1604. // "adUnitId": {
  1605. // "description": "Ad unit to delete.",
  1606. // "location": "path",
  1607. // "required": true,
  1608. // "type": "string"
  1609. // }
  1610. // },
  1611. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}",
  1612. // "response": {
  1613. // "$ref": "AdUnit"
  1614. // },
  1615. // "scopes": [
  1616. // "https://www.googleapis.com/auth/adsensehost"
  1617. // ]
  1618. // }
  1619. }
  1620. // method id "adsensehost.accounts.adunits.get":
  1621. type AccountsAdunitsGetCall struct {
  1622. s *Service
  1623. accountId string
  1624. adClientId string
  1625. adUnitId string
  1626. urlParams_ gensupport.URLParams
  1627. ifNoneMatch_ string
  1628. ctx_ context.Context
  1629. header_ http.Header
  1630. }
  1631. // Get: Get the specified host ad unit in this AdSense account.
  1632. func (r *AccountsAdunitsService) Get(accountId string, adClientId string, adUnitId string) *AccountsAdunitsGetCall {
  1633. c := &AccountsAdunitsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1634. c.accountId = accountId
  1635. c.adClientId = adClientId
  1636. c.adUnitId = adUnitId
  1637. return c
  1638. }
  1639. // Fields allows partial responses to be retrieved. See
  1640. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1641. // for more information.
  1642. func (c *AccountsAdunitsGetCall) Fields(s ...googleapi.Field) *AccountsAdunitsGetCall {
  1643. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1644. return c
  1645. }
  1646. // IfNoneMatch sets the optional parameter which makes the operation
  1647. // fail if the object's ETag matches the given value. This is useful for
  1648. // getting updates only after the object has changed since the last
  1649. // request. Use googleapi.IsNotModified to check whether the response
  1650. // error from Do is the result of In-None-Match.
  1651. func (c *AccountsAdunitsGetCall) IfNoneMatch(entityTag string) *AccountsAdunitsGetCall {
  1652. c.ifNoneMatch_ = entityTag
  1653. return c
  1654. }
  1655. // Context sets the context to be used in this call's Do method. Any
  1656. // pending HTTP request will be aborted if the provided context is
  1657. // canceled.
  1658. func (c *AccountsAdunitsGetCall) Context(ctx context.Context) *AccountsAdunitsGetCall {
  1659. c.ctx_ = ctx
  1660. return c
  1661. }
  1662. // Header returns an http.Header that can be modified by the caller to
  1663. // add HTTP headers to the request.
  1664. func (c *AccountsAdunitsGetCall) Header() http.Header {
  1665. if c.header_ == nil {
  1666. c.header_ = make(http.Header)
  1667. }
  1668. return c.header_
  1669. }
  1670. func (c *AccountsAdunitsGetCall) doRequest(alt string) (*http.Response, error) {
  1671. reqHeaders := make(http.Header)
  1672. for k, v := range c.header_ {
  1673. reqHeaders[k] = v
  1674. }
  1675. reqHeaders.Set("User-Agent", c.s.userAgent())
  1676. if c.ifNoneMatch_ != "" {
  1677. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1678. }
  1679. var body io.Reader = nil
  1680. c.urlParams_.Set("alt", alt)
  1681. c.urlParams_.Set("prettyPrint", "false")
  1682. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}")
  1683. urls += "?" + c.urlParams_.Encode()
  1684. req, err := http.NewRequest("GET", urls, body)
  1685. if err != nil {
  1686. return nil, err
  1687. }
  1688. req.Header = reqHeaders
  1689. googleapi.Expand(req.URL, map[string]string{
  1690. "accountId": c.accountId,
  1691. "adClientId": c.adClientId,
  1692. "adUnitId": c.adUnitId,
  1693. })
  1694. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1695. }
  1696. // Do executes the "adsensehost.accounts.adunits.get" call.
  1697. // Exactly one of *AdUnit or error will be non-nil. Any non-2xx status
  1698. // code is an error. Response headers are in either
  1699. // *AdUnit.ServerResponse.Header or (if a response was returned at all)
  1700. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1701. // check whether the returned error was because http.StatusNotModified
  1702. // was returned.
  1703. func (c *AccountsAdunitsGetCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  1704. gensupport.SetOptions(c.urlParams_, opts...)
  1705. res, err := c.doRequest("json")
  1706. if res != nil && res.StatusCode == http.StatusNotModified {
  1707. if res.Body != nil {
  1708. res.Body.Close()
  1709. }
  1710. return nil, &googleapi.Error{
  1711. Code: res.StatusCode,
  1712. Header: res.Header,
  1713. }
  1714. }
  1715. if err != nil {
  1716. return nil, err
  1717. }
  1718. defer googleapi.CloseBody(res)
  1719. if err := googleapi.CheckResponse(res); err != nil {
  1720. return nil, err
  1721. }
  1722. ret := &AdUnit{
  1723. ServerResponse: googleapi.ServerResponse{
  1724. Header: res.Header,
  1725. HTTPStatusCode: res.StatusCode,
  1726. },
  1727. }
  1728. target := &ret
  1729. if err := gensupport.DecodeResponse(target, res); err != nil {
  1730. return nil, err
  1731. }
  1732. return ret, nil
  1733. // {
  1734. // "description": "Get the specified host ad unit in this AdSense account.",
  1735. // "httpMethod": "GET",
  1736. // "id": "adsensehost.accounts.adunits.get",
  1737. // "parameterOrder": [
  1738. // "accountId",
  1739. // "adClientId",
  1740. // "adUnitId"
  1741. // ],
  1742. // "parameters": {
  1743. // "accountId": {
  1744. // "description": "Account which contains the ad unit.",
  1745. // "location": "path",
  1746. // "required": true,
  1747. // "type": "string"
  1748. // },
  1749. // "adClientId": {
  1750. // "description": "Ad client for which to get ad unit.",
  1751. // "location": "path",
  1752. // "required": true,
  1753. // "type": "string"
  1754. // },
  1755. // "adUnitId": {
  1756. // "description": "Ad unit to get.",
  1757. // "location": "path",
  1758. // "required": true,
  1759. // "type": "string"
  1760. // }
  1761. // },
  1762. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}",
  1763. // "response": {
  1764. // "$ref": "AdUnit"
  1765. // },
  1766. // "scopes": [
  1767. // "https://www.googleapis.com/auth/adsensehost"
  1768. // ]
  1769. // }
  1770. }
  1771. // method id "adsensehost.accounts.adunits.getAdCode":
  1772. type AccountsAdunitsGetAdCodeCall struct {
  1773. s *Service
  1774. accountId string
  1775. adClientId string
  1776. adUnitId string
  1777. urlParams_ gensupport.URLParams
  1778. ifNoneMatch_ string
  1779. ctx_ context.Context
  1780. header_ http.Header
  1781. }
  1782. // GetAdCode: Get ad code for the specified ad unit, attaching the
  1783. // specified host custom channels.
  1784. func (r *AccountsAdunitsService) GetAdCode(accountId string, adClientId string, adUnitId string) *AccountsAdunitsGetAdCodeCall {
  1785. c := &AccountsAdunitsGetAdCodeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1786. c.accountId = accountId
  1787. c.adClientId = adClientId
  1788. c.adUnitId = adUnitId
  1789. return c
  1790. }
  1791. // HostCustomChannelId sets the optional parameter
  1792. // "hostCustomChannelId": Host custom channel to attach to the ad code.
  1793. func (c *AccountsAdunitsGetAdCodeCall) HostCustomChannelId(hostCustomChannelId ...string) *AccountsAdunitsGetAdCodeCall {
  1794. c.urlParams_.SetMulti("hostCustomChannelId", append([]string{}, hostCustomChannelId...))
  1795. return c
  1796. }
  1797. // Fields allows partial responses to be retrieved. See
  1798. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1799. // for more information.
  1800. func (c *AccountsAdunitsGetAdCodeCall) Fields(s ...googleapi.Field) *AccountsAdunitsGetAdCodeCall {
  1801. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1802. return c
  1803. }
  1804. // IfNoneMatch sets the optional parameter which makes the operation
  1805. // fail if the object's ETag matches the given value. This is useful for
  1806. // getting updates only after the object has changed since the last
  1807. // request. Use googleapi.IsNotModified to check whether the response
  1808. // error from Do is the result of In-None-Match.
  1809. func (c *AccountsAdunitsGetAdCodeCall) IfNoneMatch(entityTag string) *AccountsAdunitsGetAdCodeCall {
  1810. c.ifNoneMatch_ = entityTag
  1811. return c
  1812. }
  1813. // Context sets the context to be used in this call's Do method. Any
  1814. // pending HTTP request will be aborted if the provided context is
  1815. // canceled.
  1816. func (c *AccountsAdunitsGetAdCodeCall) Context(ctx context.Context) *AccountsAdunitsGetAdCodeCall {
  1817. c.ctx_ = ctx
  1818. return c
  1819. }
  1820. // Header returns an http.Header that can be modified by the caller to
  1821. // add HTTP headers to the request.
  1822. func (c *AccountsAdunitsGetAdCodeCall) Header() http.Header {
  1823. if c.header_ == nil {
  1824. c.header_ = make(http.Header)
  1825. }
  1826. return c.header_
  1827. }
  1828. func (c *AccountsAdunitsGetAdCodeCall) doRequest(alt string) (*http.Response, error) {
  1829. reqHeaders := make(http.Header)
  1830. for k, v := range c.header_ {
  1831. reqHeaders[k] = v
  1832. }
  1833. reqHeaders.Set("User-Agent", c.s.userAgent())
  1834. if c.ifNoneMatch_ != "" {
  1835. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1836. }
  1837. var body io.Reader = nil
  1838. c.urlParams_.Set("alt", alt)
  1839. c.urlParams_.Set("prettyPrint", "false")
  1840. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/adcode")
  1841. urls += "?" + c.urlParams_.Encode()
  1842. req, err := http.NewRequest("GET", urls, body)
  1843. if err != nil {
  1844. return nil, err
  1845. }
  1846. req.Header = reqHeaders
  1847. googleapi.Expand(req.URL, map[string]string{
  1848. "accountId": c.accountId,
  1849. "adClientId": c.adClientId,
  1850. "adUnitId": c.adUnitId,
  1851. })
  1852. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1853. }
  1854. // Do executes the "adsensehost.accounts.adunits.getAdCode" call.
  1855. // Exactly one of *AdCode or error will be non-nil. Any non-2xx status
  1856. // code is an error. Response headers are in either
  1857. // *AdCode.ServerResponse.Header or (if a response was returned at all)
  1858. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1859. // check whether the returned error was because http.StatusNotModified
  1860. // was returned.
  1861. func (c *AccountsAdunitsGetAdCodeCall) Do(opts ...googleapi.CallOption) (*AdCode, error) {
  1862. gensupport.SetOptions(c.urlParams_, opts...)
  1863. res, err := c.doRequest("json")
  1864. if res != nil && res.StatusCode == http.StatusNotModified {
  1865. if res.Body != nil {
  1866. res.Body.Close()
  1867. }
  1868. return nil, &googleapi.Error{
  1869. Code: res.StatusCode,
  1870. Header: res.Header,
  1871. }
  1872. }
  1873. if err != nil {
  1874. return nil, err
  1875. }
  1876. defer googleapi.CloseBody(res)
  1877. if err := googleapi.CheckResponse(res); err != nil {
  1878. return nil, err
  1879. }
  1880. ret := &AdCode{
  1881. ServerResponse: googleapi.ServerResponse{
  1882. Header: res.Header,
  1883. HTTPStatusCode: res.StatusCode,
  1884. },
  1885. }
  1886. target := &ret
  1887. if err := gensupport.DecodeResponse(target, res); err != nil {
  1888. return nil, err
  1889. }
  1890. return ret, nil
  1891. // {
  1892. // "description": "Get ad code for the specified ad unit, attaching the specified host custom channels.",
  1893. // "httpMethod": "GET",
  1894. // "id": "adsensehost.accounts.adunits.getAdCode",
  1895. // "parameterOrder": [
  1896. // "accountId",
  1897. // "adClientId",
  1898. // "adUnitId"
  1899. // ],
  1900. // "parameters": {
  1901. // "accountId": {
  1902. // "description": "Account which contains the ad client.",
  1903. // "location": "path",
  1904. // "required": true,
  1905. // "type": "string"
  1906. // },
  1907. // "adClientId": {
  1908. // "description": "Ad client with contains the ad unit.",
  1909. // "location": "path",
  1910. // "required": true,
  1911. // "type": "string"
  1912. // },
  1913. // "adUnitId": {
  1914. // "description": "Ad unit to get the code for.",
  1915. // "location": "path",
  1916. // "required": true,
  1917. // "type": "string"
  1918. // },
  1919. // "hostCustomChannelId": {
  1920. // "description": "Host custom channel to attach to the ad code.",
  1921. // "location": "query",
  1922. // "repeated": true,
  1923. // "type": "string"
  1924. // }
  1925. // },
  1926. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/adcode",
  1927. // "response": {
  1928. // "$ref": "AdCode"
  1929. // },
  1930. // "scopes": [
  1931. // "https://www.googleapis.com/auth/adsensehost"
  1932. // ]
  1933. // }
  1934. }
  1935. // method id "adsensehost.accounts.adunits.insert":
  1936. type AccountsAdunitsInsertCall struct {
  1937. s *Service
  1938. accountId string
  1939. adClientId string
  1940. adunit *AdUnit
  1941. urlParams_ gensupport.URLParams
  1942. ctx_ context.Context
  1943. header_ http.Header
  1944. }
  1945. // Insert: Insert the supplied ad unit into the specified publisher
  1946. // AdSense account.
  1947. func (r *AccountsAdunitsService) Insert(accountId string, adClientId string, adunit *AdUnit) *AccountsAdunitsInsertCall {
  1948. c := &AccountsAdunitsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1949. c.accountId = accountId
  1950. c.adClientId = adClientId
  1951. c.adunit = adunit
  1952. return c
  1953. }
  1954. // Fields allows partial responses to be retrieved. See
  1955. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1956. // for more information.
  1957. func (c *AccountsAdunitsInsertCall) Fields(s ...googleapi.Field) *AccountsAdunitsInsertCall {
  1958. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1959. return c
  1960. }
  1961. // Context sets the context to be used in this call's Do method. Any
  1962. // pending HTTP request will be aborted if the provided context is
  1963. // canceled.
  1964. func (c *AccountsAdunitsInsertCall) Context(ctx context.Context) *AccountsAdunitsInsertCall {
  1965. c.ctx_ = ctx
  1966. return c
  1967. }
  1968. // Header returns an http.Header that can be modified by the caller to
  1969. // add HTTP headers to the request.
  1970. func (c *AccountsAdunitsInsertCall) Header() http.Header {
  1971. if c.header_ == nil {
  1972. c.header_ = make(http.Header)
  1973. }
  1974. return c.header_
  1975. }
  1976. func (c *AccountsAdunitsInsertCall) doRequest(alt string) (*http.Response, error) {
  1977. reqHeaders := make(http.Header)
  1978. for k, v := range c.header_ {
  1979. reqHeaders[k] = v
  1980. }
  1981. reqHeaders.Set("User-Agent", c.s.userAgent())
  1982. var body io.Reader = nil
  1983. body, err := googleapi.WithoutDataWrapper.JSONReader(c.adunit)
  1984. if err != nil {
  1985. return nil, err
  1986. }
  1987. reqHeaders.Set("Content-Type", "application/json")
  1988. c.urlParams_.Set("alt", alt)
  1989. c.urlParams_.Set("prettyPrint", "false")
  1990. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
  1991. urls += "?" + c.urlParams_.Encode()
  1992. req, err := http.NewRequest("POST", urls, body)
  1993. if err != nil {
  1994. return nil, err
  1995. }
  1996. req.Header = reqHeaders
  1997. googleapi.Expand(req.URL, map[string]string{
  1998. "accountId": c.accountId,
  1999. "adClientId": c.adClientId,
  2000. })
  2001. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2002. }
  2003. // Do executes the "adsensehost.accounts.adunits.insert" call.
  2004. // Exactly one of *AdUnit or error will be non-nil. Any non-2xx status
  2005. // code is an error. Response headers are in either
  2006. // *AdUnit.ServerResponse.Header or (if a response was returned at all)
  2007. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2008. // check whether the returned error was because http.StatusNotModified
  2009. // was returned.
  2010. func (c *AccountsAdunitsInsertCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  2011. gensupport.SetOptions(c.urlParams_, opts...)
  2012. res, err := c.doRequest("json")
  2013. if res != nil && res.StatusCode == http.StatusNotModified {
  2014. if res.Body != nil {
  2015. res.Body.Close()
  2016. }
  2017. return nil, &googleapi.Error{
  2018. Code: res.StatusCode,
  2019. Header: res.Header,
  2020. }
  2021. }
  2022. if err != nil {
  2023. return nil, err
  2024. }
  2025. defer googleapi.CloseBody(res)
  2026. if err := googleapi.CheckResponse(res); err != nil {
  2027. return nil, err
  2028. }
  2029. ret := &AdUnit{
  2030. ServerResponse: googleapi.ServerResponse{
  2031. Header: res.Header,
  2032. HTTPStatusCode: res.StatusCode,
  2033. },
  2034. }
  2035. target := &ret
  2036. if err := gensupport.DecodeResponse(target, res); err != nil {
  2037. return nil, err
  2038. }
  2039. return ret, nil
  2040. // {
  2041. // "description": "Insert the supplied ad unit into the specified publisher AdSense account.",
  2042. // "httpMethod": "POST",
  2043. // "id": "adsensehost.accounts.adunits.insert",
  2044. // "parameterOrder": [
  2045. // "accountId",
  2046. // "adClientId"
  2047. // ],
  2048. // "parameters": {
  2049. // "accountId": {
  2050. // "description": "Account which will contain the ad unit.",
  2051. // "location": "path",
  2052. // "required": true,
  2053. // "type": "string"
  2054. // },
  2055. // "adClientId": {
  2056. // "description": "Ad client into which to insert the ad unit.",
  2057. // "location": "path",
  2058. // "required": true,
  2059. // "type": "string"
  2060. // }
  2061. // },
  2062. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits",
  2063. // "request": {
  2064. // "$ref": "AdUnit"
  2065. // },
  2066. // "response": {
  2067. // "$ref": "AdUnit"
  2068. // },
  2069. // "scopes": [
  2070. // "https://www.googleapis.com/auth/adsensehost"
  2071. // ]
  2072. // }
  2073. }
  2074. // method id "adsensehost.accounts.adunits.list":
  2075. type AccountsAdunitsListCall struct {
  2076. s *Service
  2077. accountId string
  2078. adClientId string
  2079. urlParams_ gensupport.URLParams
  2080. ifNoneMatch_ string
  2081. ctx_ context.Context
  2082. header_ http.Header
  2083. }
  2084. // List: List all ad units in the specified publisher's AdSense account.
  2085. func (r *AccountsAdunitsService) List(accountId string, adClientId string) *AccountsAdunitsListCall {
  2086. c := &AccountsAdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2087. c.accountId = accountId
  2088. c.adClientId = adClientId
  2089. return c
  2090. }
  2091. // IncludeInactive sets the optional parameter "includeInactive":
  2092. // Whether to include inactive ad units. Default: true.
  2093. func (c *AccountsAdunitsListCall) IncludeInactive(includeInactive bool) *AccountsAdunitsListCall {
  2094. c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive))
  2095. return c
  2096. }
  2097. // MaxResults sets the optional parameter "maxResults": The maximum
  2098. // number of ad units to include in the response, used for paging.
  2099. func (c *AccountsAdunitsListCall) MaxResults(maxResults int64) *AccountsAdunitsListCall {
  2100. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2101. return c
  2102. }
  2103. // PageToken sets the optional parameter "pageToken": A continuation
  2104. // token, used to page through ad units. To retrieve the next page, set
  2105. // this parameter to the value of "nextPageToken" from the previous
  2106. // response.
  2107. func (c *AccountsAdunitsListCall) PageToken(pageToken string) *AccountsAdunitsListCall {
  2108. c.urlParams_.Set("pageToken", pageToken)
  2109. return c
  2110. }
  2111. // Fields allows partial responses to be retrieved. See
  2112. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2113. // for more information.
  2114. func (c *AccountsAdunitsListCall) Fields(s ...googleapi.Field) *AccountsAdunitsListCall {
  2115. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2116. return c
  2117. }
  2118. // IfNoneMatch sets the optional parameter which makes the operation
  2119. // fail if the object's ETag matches the given value. This is useful for
  2120. // getting updates only after the object has changed since the last
  2121. // request. Use googleapi.IsNotModified to check whether the response
  2122. // error from Do is the result of In-None-Match.
  2123. func (c *AccountsAdunitsListCall) IfNoneMatch(entityTag string) *AccountsAdunitsListCall {
  2124. c.ifNoneMatch_ = entityTag
  2125. return c
  2126. }
  2127. // Context sets the context to be used in this call's Do method. Any
  2128. // pending HTTP request will be aborted if the provided context is
  2129. // canceled.
  2130. func (c *AccountsAdunitsListCall) Context(ctx context.Context) *AccountsAdunitsListCall {
  2131. c.ctx_ = ctx
  2132. return c
  2133. }
  2134. // Header returns an http.Header that can be modified by the caller to
  2135. // add HTTP headers to the request.
  2136. func (c *AccountsAdunitsListCall) Header() http.Header {
  2137. if c.header_ == nil {
  2138. c.header_ = make(http.Header)
  2139. }
  2140. return c.header_
  2141. }
  2142. func (c *AccountsAdunitsListCall) doRequest(alt string) (*http.Response, error) {
  2143. reqHeaders := make(http.Header)
  2144. for k, v := range c.header_ {
  2145. reqHeaders[k] = v
  2146. }
  2147. reqHeaders.Set("User-Agent", c.s.userAgent())
  2148. if c.ifNoneMatch_ != "" {
  2149. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2150. }
  2151. var body io.Reader = nil
  2152. c.urlParams_.Set("alt", alt)
  2153. c.urlParams_.Set("prettyPrint", "false")
  2154. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
  2155. urls += "?" + c.urlParams_.Encode()
  2156. req, err := http.NewRequest("GET", urls, body)
  2157. if err != nil {
  2158. return nil, err
  2159. }
  2160. req.Header = reqHeaders
  2161. googleapi.Expand(req.URL, map[string]string{
  2162. "accountId": c.accountId,
  2163. "adClientId": c.adClientId,
  2164. })
  2165. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2166. }
  2167. // Do executes the "adsensehost.accounts.adunits.list" call.
  2168. // Exactly one of *AdUnits or error will be non-nil. Any non-2xx status
  2169. // code is an error. Response headers are in either
  2170. // *AdUnits.ServerResponse.Header or (if a response was returned at all)
  2171. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2172. // check whether the returned error was because http.StatusNotModified
  2173. // was returned.
  2174. func (c *AccountsAdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) {
  2175. gensupport.SetOptions(c.urlParams_, opts...)
  2176. res, err := c.doRequest("json")
  2177. if res != nil && res.StatusCode == http.StatusNotModified {
  2178. if res.Body != nil {
  2179. res.Body.Close()
  2180. }
  2181. return nil, &googleapi.Error{
  2182. Code: res.StatusCode,
  2183. Header: res.Header,
  2184. }
  2185. }
  2186. if err != nil {
  2187. return nil, err
  2188. }
  2189. defer googleapi.CloseBody(res)
  2190. if err := googleapi.CheckResponse(res); err != nil {
  2191. return nil, err
  2192. }
  2193. ret := &AdUnits{
  2194. ServerResponse: googleapi.ServerResponse{
  2195. Header: res.Header,
  2196. HTTPStatusCode: res.StatusCode,
  2197. },
  2198. }
  2199. target := &ret
  2200. if err := gensupport.DecodeResponse(target, res); err != nil {
  2201. return nil, err
  2202. }
  2203. return ret, nil
  2204. // {
  2205. // "description": "List all ad units in the specified publisher's AdSense account.",
  2206. // "httpMethod": "GET",
  2207. // "id": "adsensehost.accounts.adunits.list",
  2208. // "parameterOrder": [
  2209. // "accountId",
  2210. // "adClientId"
  2211. // ],
  2212. // "parameters": {
  2213. // "accountId": {
  2214. // "description": "Account which contains the ad client.",
  2215. // "location": "path",
  2216. // "required": true,
  2217. // "type": "string"
  2218. // },
  2219. // "adClientId": {
  2220. // "description": "Ad client for which to list ad units.",
  2221. // "location": "path",
  2222. // "required": true,
  2223. // "type": "string"
  2224. // },
  2225. // "includeInactive": {
  2226. // "description": "Whether to include inactive ad units. Default: true.",
  2227. // "location": "query",
  2228. // "type": "boolean"
  2229. // },
  2230. // "maxResults": {
  2231. // "description": "The maximum number of ad units to include in the response, used for paging.",
  2232. // "format": "uint32",
  2233. // "location": "query",
  2234. // "maximum": "10000",
  2235. // "minimum": "0",
  2236. // "type": "integer"
  2237. // },
  2238. // "pageToken": {
  2239. // "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.",
  2240. // "location": "query",
  2241. // "type": "string"
  2242. // }
  2243. // },
  2244. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits",
  2245. // "response": {
  2246. // "$ref": "AdUnits"
  2247. // },
  2248. // "scopes": [
  2249. // "https://www.googleapis.com/auth/adsensehost"
  2250. // ]
  2251. // }
  2252. }
  2253. // Pages invokes f for each page of results.
  2254. // A non-nil error returned from f will halt the iteration.
  2255. // The provided context supersedes any context provided to the Context method.
  2256. func (c *AccountsAdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error {
  2257. c.ctx_ = ctx
  2258. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2259. for {
  2260. x, err := c.Do()
  2261. if err != nil {
  2262. return err
  2263. }
  2264. if err := f(x); err != nil {
  2265. return err
  2266. }
  2267. if x.NextPageToken == "" {
  2268. return nil
  2269. }
  2270. c.PageToken(x.NextPageToken)
  2271. }
  2272. }
  2273. // method id "adsensehost.accounts.adunits.patch":
  2274. type AccountsAdunitsPatchCall struct {
  2275. s *Service
  2276. accountId string
  2277. adClientId string
  2278. adunit *AdUnit
  2279. urlParams_ gensupport.URLParams
  2280. ctx_ context.Context
  2281. header_ http.Header
  2282. }
  2283. // Patch: Update the supplied ad unit in the specified publisher AdSense
  2284. // account. This method supports patch semantics.
  2285. func (r *AccountsAdunitsService) Patch(accountId string, adClientId string, adUnitId string, adunit *AdUnit) *AccountsAdunitsPatchCall {
  2286. c := &AccountsAdunitsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2287. c.accountId = accountId
  2288. c.adClientId = adClientId
  2289. c.urlParams_.Set("adUnitId", adUnitId)
  2290. c.adunit = adunit
  2291. return c
  2292. }
  2293. // Fields allows partial responses to be retrieved. See
  2294. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2295. // for more information.
  2296. func (c *AccountsAdunitsPatchCall) Fields(s ...googleapi.Field) *AccountsAdunitsPatchCall {
  2297. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2298. return c
  2299. }
  2300. // Context sets the context to be used in this call's Do method. Any
  2301. // pending HTTP request will be aborted if the provided context is
  2302. // canceled.
  2303. func (c *AccountsAdunitsPatchCall) Context(ctx context.Context) *AccountsAdunitsPatchCall {
  2304. c.ctx_ = ctx
  2305. return c
  2306. }
  2307. // Header returns an http.Header that can be modified by the caller to
  2308. // add HTTP headers to the request.
  2309. func (c *AccountsAdunitsPatchCall) Header() http.Header {
  2310. if c.header_ == nil {
  2311. c.header_ = make(http.Header)
  2312. }
  2313. return c.header_
  2314. }
  2315. func (c *AccountsAdunitsPatchCall) doRequest(alt string) (*http.Response, error) {
  2316. reqHeaders := make(http.Header)
  2317. for k, v := range c.header_ {
  2318. reqHeaders[k] = v
  2319. }
  2320. reqHeaders.Set("User-Agent", c.s.userAgent())
  2321. var body io.Reader = nil
  2322. body, err := googleapi.WithoutDataWrapper.JSONReader(c.adunit)
  2323. if err != nil {
  2324. return nil, err
  2325. }
  2326. reqHeaders.Set("Content-Type", "application/json")
  2327. c.urlParams_.Set("alt", alt)
  2328. c.urlParams_.Set("prettyPrint", "false")
  2329. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
  2330. urls += "?" + c.urlParams_.Encode()
  2331. req, err := http.NewRequest("PATCH", urls, body)
  2332. if err != nil {
  2333. return nil, err
  2334. }
  2335. req.Header = reqHeaders
  2336. googleapi.Expand(req.URL, map[string]string{
  2337. "accountId": c.accountId,
  2338. "adClientId": c.adClientId,
  2339. })
  2340. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2341. }
  2342. // Do executes the "adsensehost.accounts.adunits.patch" call.
  2343. // Exactly one of *AdUnit or error will be non-nil. Any non-2xx status
  2344. // code is an error. Response headers are in either
  2345. // *AdUnit.ServerResponse.Header or (if a response was returned at all)
  2346. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2347. // check whether the returned error was because http.StatusNotModified
  2348. // was returned.
  2349. func (c *AccountsAdunitsPatchCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  2350. gensupport.SetOptions(c.urlParams_, opts...)
  2351. res, err := c.doRequest("json")
  2352. if res != nil && res.StatusCode == http.StatusNotModified {
  2353. if res.Body != nil {
  2354. res.Body.Close()
  2355. }
  2356. return nil, &googleapi.Error{
  2357. Code: res.StatusCode,
  2358. Header: res.Header,
  2359. }
  2360. }
  2361. if err != nil {
  2362. return nil, err
  2363. }
  2364. defer googleapi.CloseBody(res)
  2365. if err := googleapi.CheckResponse(res); err != nil {
  2366. return nil, err
  2367. }
  2368. ret := &AdUnit{
  2369. ServerResponse: googleapi.ServerResponse{
  2370. Header: res.Header,
  2371. HTTPStatusCode: res.StatusCode,
  2372. },
  2373. }
  2374. target := &ret
  2375. if err := gensupport.DecodeResponse(target, res); err != nil {
  2376. return nil, err
  2377. }
  2378. return ret, nil
  2379. // {
  2380. // "description": "Update the supplied ad unit in the specified publisher AdSense account. This method supports patch semantics.",
  2381. // "httpMethod": "PATCH",
  2382. // "id": "adsensehost.accounts.adunits.patch",
  2383. // "parameterOrder": [
  2384. // "accountId",
  2385. // "adClientId",
  2386. // "adUnitId"
  2387. // ],
  2388. // "parameters": {
  2389. // "accountId": {
  2390. // "description": "Account which contains the ad client.",
  2391. // "location": "path",
  2392. // "required": true,
  2393. // "type": "string"
  2394. // },
  2395. // "adClientId": {
  2396. // "description": "Ad client which contains the ad unit.",
  2397. // "location": "path",
  2398. // "required": true,
  2399. // "type": "string"
  2400. // },
  2401. // "adUnitId": {
  2402. // "description": "Ad unit to get.",
  2403. // "location": "query",
  2404. // "required": true,
  2405. // "type": "string"
  2406. // }
  2407. // },
  2408. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits",
  2409. // "request": {
  2410. // "$ref": "AdUnit"
  2411. // },
  2412. // "response": {
  2413. // "$ref": "AdUnit"
  2414. // },
  2415. // "scopes": [
  2416. // "https://www.googleapis.com/auth/adsensehost"
  2417. // ]
  2418. // }
  2419. }
  2420. // method id "adsensehost.accounts.adunits.update":
  2421. type AccountsAdunitsUpdateCall struct {
  2422. s *Service
  2423. accountId string
  2424. adClientId string
  2425. adunit *AdUnit
  2426. urlParams_ gensupport.URLParams
  2427. ctx_ context.Context
  2428. header_ http.Header
  2429. }
  2430. // Update: Update the supplied ad unit in the specified publisher
  2431. // AdSense account.
  2432. func (r *AccountsAdunitsService) Update(accountId string, adClientId string, adunit *AdUnit) *AccountsAdunitsUpdateCall {
  2433. c := &AccountsAdunitsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2434. c.accountId = accountId
  2435. c.adClientId = adClientId
  2436. c.adunit = adunit
  2437. return c
  2438. }
  2439. // Fields allows partial responses to be retrieved. See
  2440. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2441. // for more information.
  2442. func (c *AccountsAdunitsUpdateCall) Fields(s ...googleapi.Field) *AccountsAdunitsUpdateCall {
  2443. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2444. return c
  2445. }
  2446. // Context sets the context to be used in this call's Do method. Any
  2447. // pending HTTP request will be aborted if the provided context is
  2448. // canceled.
  2449. func (c *AccountsAdunitsUpdateCall) Context(ctx context.Context) *AccountsAdunitsUpdateCall {
  2450. c.ctx_ = ctx
  2451. return c
  2452. }
  2453. // Header returns an http.Header that can be modified by the caller to
  2454. // add HTTP headers to the request.
  2455. func (c *AccountsAdunitsUpdateCall) Header() http.Header {
  2456. if c.header_ == nil {
  2457. c.header_ = make(http.Header)
  2458. }
  2459. return c.header_
  2460. }
  2461. func (c *AccountsAdunitsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2462. reqHeaders := make(http.Header)
  2463. for k, v := range c.header_ {
  2464. reqHeaders[k] = v
  2465. }
  2466. reqHeaders.Set("User-Agent", c.s.userAgent())
  2467. var body io.Reader = nil
  2468. body, err := googleapi.WithoutDataWrapper.JSONReader(c.adunit)
  2469. if err != nil {
  2470. return nil, err
  2471. }
  2472. reqHeaders.Set("Content-Type", "application/json")
  2473. c.urlParams_.Set("alt", alt)
  2474. c.urlParams_.Set("prettyPrint", "false")
  2475. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/adclients/{adClientId}/adunits")
  2476. urls += "?" + c.urlParams_.Encode()
  2477. req, err := http.NewRequest("PUT", urls, body)
  2478. if err != nil {
  2479. return nil, err
  2480. }
  2481. req.Header = reqHeaders
  2482. googleapi.Expand(req.URL, map[string]string{
  2483. "accountId": c.accountId,
  2484. "adClientId": c.adClientId,
  2485. })
  2486. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2487. }
  2488. // Do executes the "adsensehost.accounts.adunits.update" call.
  2489. // Exactly one of *AdUnit or error will be non-nil. Any non-2xx status
  2490. // code is an error. Response headers are in either
  2491. // *AdUnit.ServerResponse.Header or (if a response was returned at all)
  2492. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2493. // check whether the returned error was because http.StatusNotModified
  2494. // was returned.
  2495. func (c *AccountsAdunitsUpdateCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  2496. gensupport.SetOptions(c.urlParams_, opts...)
  2497. res, err := c.doRequest("json")
  2498. if res != nil && res.StatusCode == http.StatusNotModified {
  2499. if res.Body != nil {
  2500. res.Body.Close()
  2501. }
  2502. return nil, &googleapi.Error{
  2503. Code: res.StatusCode,
  2504. Header: res.Header,
  2505. }
  2506. }
  2507. if err != nil {
  2508. return nil, err
  2509. }
  2510. defer googleapi.CloseBody(res)
  2511. if err := googleapi.CheckResponse(res); err != nil {
  2512. return nil, err
  2513. }
  2514. ret := &AdUnit{
  2515. ServerResponse: googleapi.ServerResponse{
  2516. Header: res.Header,
  2517. HTTPStatusCode: res.StatusCode,
  2518. },
  2519. }
  2520. target := &ret
  2521. if err := gensupport.DecodeResponse(target, res); err != nil {
  2522. return nil, err
  2523. }
  2524. return ret, nil
  2525. // {
  2526. // "description": "Update the supplied ad unit in the specified publisher AdSense account.",
  2527. // "httpMethod": "PUT",
  2528. // "id": "adsensehost.accounts.adunits.update",
  2529. // "parameterOrder": [
  2530. // "accountId",
  2531. // "adClientId"
  2532. // ],
  2533. // "parameters": {
  2534. // "accountId": {
  2535. // "description": "Account which contains the ad client.",
  2536. // "location": "path",
  2537. // "required": true,
  2538. // "type": "string"
  2539. // },
  2540. // "adClientId": {
  2541. // "description": "Ad client which contains the ad unit.",
  2542. // "location": "path",
  2543. // "required": true,
  2544. // "type": "string"
  2545. // }
  2546. // },
  2547. // "path": "accounts/{accountId}/adclients/{adClientId}/adunits",
  2548. // "request": {
  2549. // "$ref": "AdUnit"
  2550. // },
  2551. // "response": {
  2552. // "$ref": "AdUnit"
  2553. // },
  2554. // "scopes": [
  2555. // "https://www.googleapis.com/auth/adsensehost"
  2556. // ]
  2557. // }
  2558. }
  2559. // method id "adsensehost.accounts.reports.generate":
  2560. type AccountsReportsGenerateCall struct {
  2561. s *Service
  2562. accountId string
  2563. urlParams_ gensupport.URLParams
  2564. ifNoneMatch_ string
  2565. ctx_ context.Context
  2566. header_ http.Header
  2567. }
  2568. // Generate: Generate an AdSense report based on the report request sent
  2569. // in the query parameters. Returns the result as JSON; to retrieve
  2570. // output in CSV format specify "alt=csv" as a query parameter.
  2571. func (r *AccountsReportsService) Generate(accountId string, startDate string, endDate string) *AccountsReportsGenerateCall {
  2572. c := &AccountsReportsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2573. c.accountId = accountId
  2574. c.urlParams_.Set("startDate", startDate)
  2575. c.urlParams_.Set("endDate", endDate)
  2576. return c
  2577. }
  2578. // Dimension sets the optional parameter "dimension": Dimensions to base
  2579. // the report on.
  2580. func (c *AccountsReportsGenerateCall) Dimension(dimension ...string) *AccountsReportsGenerateCall {
  2581. c.urlParams_.SetMulti("dimension", append([]string{}, dimension...))
  2582. return c
  2583. }
  2584. // Filter sets the optional parameter "filter": Filters to be run on the
  2585. // report.
  2586. func (c *AccountsReportsGenerateCall) Filter(filter ...string) *AccountsReportsGenerateCall {
  2587. c.urlParams_.SetMulti("filter", append([]string{}, filter...))
  2588. return c
  2589. }
  2590. // Locale sets the optional parameter "locale": Optional locale to use
  2591. // for translating report output to a local language. Defaults to
  2592. // "en_US" if not specified.
  2593. func (c *AccountsReportsGenerateCall) Locale(locale string) *AccountsReportsGenerateCall {
  2594. c.urlParams_.Set("locale", locale)
  2595. return c
  2596. }
  2597. // MaxResults sets the optional parameter "maxResults": The maximum
  2598. // number of rows of report data to return.
  2599. func (c *AccountsReportsGenerateCall) MaxResults(maxResults int64) *AccountsReportsGenerateCall {
  2600. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2601. return c
  2602. }
  2603. // Metric sets the optional parameter "metric": Numeric columns to
  2604. // include in the report.
  2605. func (c *AccountsReportsGenerateCall) Metric(metric ...string) *AccountsReportsGenerateCall {
  2606. c.urlParams_.SetMulti("metric", append([]string{}, metric...))
  2607. return c
  2608. }
  2609. // Sort sets the optional parameter "sort": The name of a dimension or
  2610. // metric to sort the resulting report on, optionally prefixed with "+"
  2611. // to sort ascending or "-" to sort descending. If no prefix is
  2612. // specified, the column is sorted ascending.
  2613. func (c *AccountsReportsGenerateCall) Sort(sort ...string) *AccountsReportsGenerateCall {
  2614. c.urlParams_.SetMulti("sort", append([]string{}, sort...))
  2615. return c
  2616. }
  2617. // StartIndex sets the optional parameter "startIndex": Index of the
  2618. // first row of report data to return.
  2619. func (c *AccountsReportsGenerateCall) StartIndex(startIndex int64) *AccountsReportsGenerateCall {
  2620. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  2621. return c
  2622. }
  2623. // Fields allows partial responses to be retrieved. See
  2624. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2625. // for more information.
  2626. func (c *AccountsReportsGenerateCall) Fields(s ...googleapi.Field) *AccountsReportsGenerateCall {
  2627. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2628. return c
  2629. }
  2630. // IfNoneMatch sets the optional parameter which makes the operation
  2631. // fail if the object's ETag matches the given value. This is useful for
  2632. // getting updates only after the object has changed since the last
  2633. // request. Use googleapi.IsNotModified to check whether the response
  2634. // error from Do is the result of In-None-Match.
  2635. func (c *AccountsReportsGenerateCall) IfNoneMatch(entityTag string) *AccountsReportsGenerateCall {
  2636. c.ifNoneMatch_ = entityTag
  2637. return c
  2638. }
  2639. // Context sets the context to be used in this call's Do method. Any
  2640. // pending HTTP request will be aborted if the provided context is
  2641. // canceled.
  2642. func (c *AccountsReportsGenerateCall) Context(ctx context.Context) *AccountsReportsGenerateCall {
  2643. c.ctx_ = ctx
  2644. return c
  2645. }
  2646. // Header returns an http.Header that can be modified by the caller to
  2647. // add HTTP headers to the request.
  2648. func (c *AccountsReportsGenerateCall) Header() http.Header {
  2649. if c.header_ == nil {
  2650. c.header_ = make(http.Header)
  2651. }
  2652. return c.header_
  2653. }
  2654. func (c *AccountsReportsGenerateCall) doRequest(alt string) (*http.Response, error) {
  2655. reqHeaders := make(http.Header)
  2656. for k, v := range c.header_ {
  2657. reqHeaders[k] = v
  2658. }
  2659. reqHeaders.Set("User-Agent", c.s.userAgent())
  2660. if c.ifNoneMatch_ != "" {
  2661. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2662. }
  2663. var body io.Reader = nil
  2664. c.urlParams_.Set("alt", alt)
  2665. c.urlParams_.Set("prettyPrint", "false")
  2666. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{accountId}/reports")
  2667. urls += "?" + c.urlParams_.Encode()
  2668. req, err := http.NewRequest("GET", urls, body)
  2669. if err != nil {
  2670. return nil, err
  2671. }
  2672. req.Header = reqHeaders
  2673. googleapi.Expand(req.URL, map[string]string{
  2674. "accountId": c.accountId,
  2675. })
  2676. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2677. }
  2678. // Do executes the "adsensehost.accounts.reports.generate" call.
  2679. // Exactly one of *Report or error will be non-nil. Any non-2xx status
  2680. // code is an error. Response headers are in either
  2681. // *Report.ServerResponse.Header or (if a response was returned at all)
  2682. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2683. // check whether the returned error was because http.StatusNotModified
  2684. // was returned.
  2685. func (c *AccountsReportsGenerateCall) Do(opts ...googleapi.CallOption) (*Report, error) {
  2686. gensupport.SetOptions(c.urlParams_, opts...)
  2687. res, err := c.doRequest("json")
  2688. if res != nil && res.StatusCode == http.StatusNotModified {
  2689. if res.Body != nil {
  2690. res.Body.Close()
  2691. }
  2692. return nil, &googleapi.Error{
  2693. Code: res.StatusCode,
  2694. Header: res.Header,
  2695. }
  2696. }
  2697. if err != nil {
  2698. return nil, err
  2699. }
  2700. defer googleapi.CloseBody(res)
  2701. if err := googleapi.CheckResponse(res); err != nil {
  2702. return nil, err
  2703. }
  2704. ret := &Report{
  2705. ServerResponse: googleapi.ServerResponse{
  2706. Header: res.Header,
  2707. HTTPStatusCode: res.StatusCode,
  2708. },
  2709. }
  2710. target := &ret
  2711. if err := gensupport.DecodeResponse(target, res); err != nil {
  2712. return nil, err
  2713. }
  2714. return ret, nil
  2715. // {
  2716. // "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.",
  2717. // "httpMethod": "GET",
  2718. // "id": "adsensehost.accounts.reports.generate",
  2719. // "parameterOrder": [
  2720. // "accountId",
  2721. // "startDate",
  2722. // "endDate"
  2723. // ],
  2724. // "parameters": {
  2725. // "accountId": {
  2726. // "description": "Hosted account upon which to report.",
  2727. // "location": "path",
  2728. // "required": true,
  2729. // "type": "string"
  2730. // },
  2731. // "dimension": {
  2732. // "description": "Dimensions to base the report on.",
  2733. // "location": "query",
  2734. // "pattern": "[a-zA-Z_]+",
  2735. // "repeated": true,
  2736. // "type": "string"
  2737. // },
  2738. // "endDate": {
  2739. // "description": "End of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  2740. // "location": "query",
  2741. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  2742. // "required": true,
  2743. // "type": "string"
  2744. // },
  2745. // "filter": {
  2746. // "description": "Filters to be run on the report.",
  2747. // "location": "query",
  2748. // "pattern": "[a-zA-Z_]+(==|=@).+",
  2749. // "repeated": true,
  2750. // "type": "string"
  2751. // },
  2752. // "locale": {
  2753. // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.",
  2754. // "location": "query",
  2755. // "pattern": "[a-zA-Z_]+",
  2756. // "type": "string"
  2757. // },
  2758. // "maxResults": {
  2759. // "description": "The maximum number of rows of report data to return.",
  2760. // "format": "uint32",
  2761. // "location": "query",
  2762. // "maximum": "50000",
  2763. // "minimum": "0",
  2764. // "type": "integer"
  2765. // },
  2766. // "metric": {
  2767. // "description": "Numeric columns to include in the report.",
  2768. // "location": "query",
  2769. // "pattern": "[a-zA-Z_]+",
  2770. // "repeated": true,
  2771. // "type": "string"
  2772. // },
  2773. // "sort": {
  2774. // "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.",
  2775. // "location": "query",
  2776. // "pattern": "(\\+|-)?[a-zA-Z_]+",
  2777. // "repeated": true,
  2778. // "type": "string"
  2779. // },
  2780. // "startDate": {
  2781. // "description": "Start of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  2782. // "location": "query",
  2783. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  2784. // "required": true,
  2785. // "type": "string"
  2786. // },
  2787. // "startIndex": {
  2788. // "description": "Index of the first row of report data to return.",
  2789. // "format": "uint32",
  2790. // "location": "query",
  2791. // "maximum": "5000",
  2792. // "minimum": "0",
  2793. // "type": "integer"
  2794. // }
  2795. // },
  2796. // "path": "accounts/{accountId}/reports",
  2797. // "response": {
  2798. // "$ref": "Report"
  2799. // },
  2800. // "scopes": [
  2801. // "https://www.googleapis.com/auth/adsensehost"
  2802. // ]
  2803. // }
  2804. }
  2805. // method id "adsensehost.adclients.get":
  2806. type AdclientsGetCall struct {
  2807. s *Service
  2808. adClientId string
  2809. urlParams_ gensupport.URLParams
  2810. ifNoneMatch_ string
  2811. ctx_ context.Context
  2812. header_ http.Header
  2813. }
  2814. // Get: Get information about one of the ad clients in the Host AdSense
  2815. // account.
  2816. func (r *AdclientsService) Get(adClientId string) *AdclientsGetCall {
  2817. c := &AdclientsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2818. c.adClientId = adClientId
  2819. return c
  2820. }
  2821. // Fields allows partial responses to be retrieved. See
  2822. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2823. // for more information.
  2824. func (c *AdclientsGetCall) Fields(s ...googleapi.Field) *AdclientsGetCall {
  2825. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2826. return c
  2827. }
  2828. // IfNoneMatch sets the optional parameter which makes the operation
  2829. // fail if the object's ETag matches the given value. This is useful for
  2830. // getting updates only after the object has changed since the last
  2831. // request. Use googleapi.IsNotModified to check whether the response
  2832. // error from Do is the result of In-None-Match.
  2833. func (c *AdclientsGetCall) IfNoneMatch(entityTag string) *AdclientsGetCall {
  2834. c.ifNoneMatch_ = entityTag
  2835. return c
  2836. }
  2837. // Context sets the context to be used in this call's Do method. Any
  2838. // pending HTTP request will be aborted if the provided context is
  2839. // canceled.
  2840. func (c *AdclientsGetCall) Context(ctx context.Context) *AdclientsGetCall {
  2841. c.ctx_ = ctx
  2842. return c
  2843. }
  2844. // Header returns an http.Header that can be modified by the caller to
  2845. // add HTTP headers to the request.
  2846. func (c *AdclientsGetCall) Header() http.Header {
  2847. if c.header_ == nil {
  2848. c.header_ = make(http.Header)
  2849. }
  2850. return c.header_
  2851. }
  2852. func (c *AdclientsGetCall) doRequest(alt string) (*http.Response, error) {
  2853. reqHeaders := make(http.Header)
  2854. for k, v := range c.header_ {
  2855. reqHeaders[k] = v
  2856. }
  2857. reqHeaders.Set("User-Agent", c.s.userAgent())
  2858. if c.ifNoneMatch_ != "" {
  2859. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2860. }
  2861. var body io.Reader = nil
  2862. c.urlParams_.Set("alt", alt)
  2863. c.urlParams_.Set("prettyPrint", "false")
  2864. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}")
  2865. urls += "?" + c.urlParams_.Encode()
  2866. req, err := http.NewRequest("GET", urls, body)
  2867. if err != nil {
  2868. return nil, err
  2869. }
  2870. req.Header = reqHeaders
  2871. googleapi.Expand(req.URL, map[string]string{
  2872. "adClientId": c.adClientId,
  2873. })
  2874. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2875. }
  2876. // Do executes the "adsensehost.adclients.get" call.
  2877. // Exactly one of *AdClient or error will be non-nil. Any non-2xx status
  2878. // code is an error. Response headers are in either
  2879. // *AdClient.ServerResponse.Header or (if a response was returned at
  2880. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2881. // to check whether the returned error was because
  2882. // http.StatusNotModified was returned.
  2883. func (c *AdclientsGetCall) Do(opts ...googleapi.CallOption) (*AdClient, error) {
  2884. gensupport.SetOptions(c.urlParams_, opts...)
  2885. res, err := c.doRequest("json")
  2886. if res != nil && res.StatusCode == http.StatusNotModified {
  2887. if res.Body != nil {
  2888. res.Body.Close()
  2889. }
  2890. return nil, &googleapi.Error{
  2891. Code: res.StatusCode,
  2892. Header: res.Header,
  2893. }
  2894. }
  2895. if err != nil {
  2896. return nil, err
  2897. }
  2898. defer googleapi.CloseBody(res)
  2899. if err := googleapi.CheckResponse(res); err != nil {
  2900. return nil, err
  2901. }
  2902. ret := &AdClient{
  2903. ServerResponse: googleapi.ServerResponse{
  2904. Header: res.Header,
  2905. HTTPStatusCode: res.StatusCode,
  2906. },
  2907. }
  2908. target := &ret
  2909. if err := gensupport.DecodeResponse(target, res); err != nil {
  2910. return nil, err
  2911. }
  2912. return ret, nil
  2913. // {
  2914. // "description": "Get information about one of the ad clients in the Host AdSense account.",
  2915. // "httpMethod": "GET",
  2916. // "id": "adsensehost.adclients.get",
  2917. // "parameterOrder": [
  2918. // "adClientId"
  2919. // ],
  2920. // "parameters": {
  2921. // "adClientId": {
  2922. // "description": "Ad client to get.",
  2923. // "location": "path",
  2924. // "required": true,
  2925. // "type": "string"
  2926. // }
  2927. // },
  2928. // "path": "adclients/{adClientId}",
  2929. // "response": {
  2930. // "$ref": "AdClient"
  2931. // },
  2932. // "scopes": [
  2933. // "https://www.googleapis.com/auth/adsensehost"
  2934. // ]
  2935. // }
  2936. }
  2937. // method id "adsensehost.adclients.list":
  2938. type AdclientsListCall struct {
  2939. s *Service
  2940. urlParams_ gensupport.URLParams
  2941. ifNoneMatch_ string
  2942. ctx_ context.Context
  2943. header_ http.Header
  2944. }
  2945. // List: List all host ad clients in this AdSense account.
  2946. func (r *AdclientsService) List() *AdclientsListCall {
  2947. c := &AdclientsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2948. return c
  2949. }
  2950. // MaxResults sets the optional parameter "maxResults": The maximum
  2951. // number of ad clients to include in the response, used for paging.
  2952. func (c *AdclientsListCall) MaxResults(maxResults int64) *AdclientsListCall {
  2953. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2954. return c
  2955. }
  2956. // PageToken sets the optional parameter "pageToken": A continuation
  2957. // token, used to page through ad clients. To retrieve the next page,
  2958. // set this parameter to the value of "nextPageToken" from the previous
  2959. // response.
  2960. func (c *AdclientsListCall) PageToken(pageToken string) *AdclientsListCall {
  2961. c.urlParams_.Set("pageToken", pageToken)
  2962. return c
  2963. }
  2964. // Fields allows partial responses to be retrieved. See
  2965. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2966. // for more information.
  2967. func (c *AdclientsListCall) Fields(s ...googleapi.Field) *AdclientsListCall {
  2968. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2969. return c
  2970. }
  2971. // IfNoneMatch sets the optional parameter which makes the operation
  2972. // fail if the object's ETag matches the given value. This is useful for
  2973. // getting updates only after the object has changed since the last
  2974. // request. Use googleapi.IsNotModified to check whether the response
  2975. // error from Do is the result of In-None-Match.
  2976. func (c *AdclientsListCall) IfNoneMatch(entityTag string) *AdclientsListCall {
  2977. c.ifNoneMatch_ = entityTag
  2978. return c
  2979. }
  2980. // Context sets the context to be used in this call's Do method. Any
  2981. // pending HTTP request will be aborted if the provided context is
  2982. // canceled.
  2983. func (c *AdclientsListCall) Context(ctx context.Context) *AdclientsListCall {
  2984. c.ctx_ = ctx
  2985. return c
  2986. }
  2987. // Header returns an http.Header that can be modified by the caller to
  2988. // add HTTP headers to the request.
  2989. func (c *AdclientsListCall) Header() http.Header {
  2990. if c.header_ == nil {
  2991. c.header_ = make(http.Header)
  2992. }
  2993. return c.header_
  2994. }
  2995. func (c *AdclientsListCall) doRequest(alt string) (*http.Response, error) {
  2996. reqHeaders := make(http.Header)
  2997. for k, v := range c.header_ {
  2998. reqHeaders[k] = v
  2999. }
  3000. reqHeaders.Set("User-Agent", c.s.userAgent())
  3001. if c.ifNoneMatch_ != "" {
  3002. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3003. }
  3004. var body io.Reader = nil
  3005. c.urlParams_.Set("alt", alt)
  3006. c.urlParams_.Set("prettyPrint", "false")
  3007. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients")
  3008. urls += "?" + c.urlParams_.Encode()
  3009. req, err := http.NewRequest("GET", urls, body)
  3010. if err != nil {
  3011. return nil, err
  3012. }
  3013. req.Header = reqHeaders
  3014. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3015. }
  3016. // Do executes the "adsensehost.adclients.list" call.
  3017. // Exactly one of *AdClients or error will be non-nil. Any non-2xx
  3018. // status code is an error. Response headers are in either
  3019. // *AdClients.ServerResponse.Header or (if a response was returned at
  3020. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3021. // to check whether the returned error was because
  3022. // http.StatusNotModified was returned.
  3023. func (c *AdclientsListCall) Do(opts ...googleapi.CallOption) (*AdClients, error) {
  3024. gensupport.SetOptions(c.urlParams_, opts...)
  3025. res, err := c.doRequest("json")
  3026. if res != nil && res.StatusCode == http.StatusNotModified {
  3027. if res.Body != nil {
  3028. res.Body.Close()
  3029. }
  3030. return nil, &googleapi.Error{
  3031. Code: res.StatusCode,
  3032. Header: res.Header,
  3033. }
  3034. }
  3035. if err != nil {
  3036. return nil, err
  3037. }
  3038. defer googleapi.CloseBody(res)
  3039. if err := googleapi.CheckResponse(res); err != nil {
  3040. return nil, err
  3041. }
  3042. ret := &AdClients{
  3043. ServerResponse: googleapi.ServerResponse{
  3044. Header: res.Header,
  3045. HTTPStatusCode: res.StatusCode,
  3046. },
  3047. }
  3048. target := &ret
  3049. if err := gensupport.DecodeResponse(target, res); err != nil {
  3050. return nil, err
  3051. }
  3052. return ret, nil
  3053. // {
  3054. // "description": "List all host ad clients in this AdSense account.",
  3055. // "httpMethod": "GET",
  3056. // "id": "adsensehost.adclients.list",
  3057. // "parameters": {
  3058. // "maxResults": {
  3059. // "description": "The maximum number of ad clients to include in the response, used for paging.",
  3060. // "format": "uint32",
  3061. // "location": "query",
  3062. // "maximum": "10000",
  3063. // "minimum": "0",
  3064. // "type": "integer"
  3065. // },
  3066. // "pageToken": {
  3067. // "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.",
  3068. // "location": "query",
  3069. // "type": "string"
  3070. // }
  3071. // },
  3072. // "path": "adclients",
  3073. // "response": {
  3074. // "$ref": "AdClients"
  3075. // },
  3076. // "scopes": [
  3077. // "https://www.googleapis.com/auth/adsensehost"
  3078. // ]
  3079. // }
  3080. }
  3081. // Pages invokes f for each page of results.
  3082. // A non-nil error returned from f will halt the iteration.
  3083. // The provided context supersedes any context provided to the Context method.
  3084. func (c *AdclientsListCall) Pages(ctx context.Context, f func(*AdClients) error) error {
  3085. c.ctx_ = ctx
  3086. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3087. for {
  3088. x, err := c.Do()
  3089. if err != nil {
  3090. return err
  3091. }
  3092. if err := f(x); err != nil {
  3093. return err
  3094. }
  3095. if x.NextPageToken == "" {
  3096. return nil
  3097. }
  3098. c.PageToken(x.NextPageToken)
  3099. }
  3100. }
  3101. // method id "adsensehost.associationsessions.start":
  3102. type AssociationsessionsStartCall struct {
  3103. s *Service
  3104. urlParams_ gensupport.URLParams
  3105. ifNoneMatch_ string
  3106. ctx_ context.Context
  3107. header_ http.Header
  3108. }
  3109. // Start: Create an association session for initiating an association
  3110. // with an AdSense user.
  3111. func (r *AssociationsessionsService) Start(productCode []string, websiteUrl string) *AssociationsessionsStartCall {
  3112. c := &AssociationsessionsStartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3113. c.urlParams_.SetMulti("productCode", append([]string{}, productCode...))
  3114. c.urlParams_.Set("websiteUrl", websiteUrl)
  3115. return c
  3116. }
  3117. // UserLocale sets the optional parameter "userLocale": The preferred
  3118. // locale of the user.
  3119. func (c *AssociationsessionsStartCall) UserLocale(userLocale string) *AssociationsessionsStartCall {
  3120. c.urlParams_.Set("userLocale", userLocale)
  3121. return c
  3122. }
  3123. // WebsiteLocale sets the optional parameter "websiteLocale": The locale
  3124. // of the user's hosted website.
  3125. func (c *AssociationsessionsStartCall) WebsiteLocale(websiteLocale string) *AssociationsessionsStartCall {
  3126. c.urlParams_.Set("websiteLocale", websiteLocale)
  3127. return c
  3128. }
  3129. // Fields allows partial responses to be retrieved. See
  3130. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3131. // for more information.
  3132. func (c *AssociationsessionsStartCall) Fields(s ...googleapi.Field) *AssociationsessionsStartCall {
  3133. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3134. return c
  3135. }
  3136. // IfNoneMatch sets the optional parameter which makes the operation
  3137. // fail if the object's ETag matches the given value. This is useful for
  3138. // getting updates only after the object has changed since the last
  3139. // request. Use googleapi.IsNotModified to check whether the response
  3140. // error from Do is the result of In-None-Match.
  3141. func (c *AssociationsessionsStartCall) IfNoneMatch(entityTag string) *AssociationsessionsStartCall {
  3142. c.ifNoneMatch_ = entityTag
  3143. return c
  3144. }
  3145. // Context sets the context to be used in this call's Do method. Any
  3146. // pending HTTP request will be aborted if the provided context is
  3147. // canceled.
  3148. func (c *AssociationsessionsStartCall) Context(ctx context.Context) *AssociationsessionsStartCall {
  3149. c.ctx_ = ctx
  3150. return c
  3151. }
  3152. // Header returns an http.Header that can be modified by the caller to
  3153. // add HTTP headers to the request.
  3154. func (c *AssociationsessionsStartCall) Header() http.Header {
  3155. if c.header_ == nil {
  3156. c.header_ = make(http.Header)
  3157. }
  3158. return c.header_
  3159. }
  3160. func (c *AssociationsessionsStartCall) doRequest(alt string) (*http.Response, error) {
  3161. reqHeaders := make(http.Header)
  3162. for k, v := range c.header_ {
  3163. reqHeaders[k] = v
  3164. }
  3165. reqHeaders.Set("User-Agent", c.s.userAgent())
  3166. if c.ifNoneMatch_ != "" {
  3167. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3168. }
  3169. var body io.Reader = nil
  3170. c.urlParams_.Set("alt", alt)
  3171. c.urlParams_.Set("prettyPrint", "false")
  3172. urls := googleapi.ResolveRelative(c.s.BasePath, "associationsessions/start")
  3173. urls += "?" + c.urlParams_.Encode()
  3174. req, err := http.NewRequest("GET", urls, body)
  3175. if err != nil {
  3176. return nil, err
  3177. }
  3178. req.Header = reqHeaders
  3179. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3180. }
  3181. // Do executes the "adsensehost.associationsessions.start" call.
  3182. // Exactly one of *AssociationSession or error will be non-nil. Any
  3183. // non-2xx status code is an error. Response headers are in either
  3184. // *AssociationSession.ServerResponse.Header or (if a response was
  3185. // returned at all) in error.(*googleapi.Error).Header. Use
  3186. // googleapi.IsNotModified to check whether the returned error was
  3187. // because http.StatusNotModified was returned.
  3188. func (c *AssociationsessionsStartCall) Do(opts ...googleapi.CallOption) (*AssociationSession, error) {
  3189. gensupport.SetOptions(c.urlParams_, opts...)
  3190. res, err := c.doRequest("json")
  3191. if res != nil && res.StatusCode == http.StatusNotModified {
  3192. if res.Body != nil {
  3193. res.Body.Close()
  3194. }
  3195. return nil, &googleapi.Error{
  3196. Code: res.StatusCode,
  3197. Header: res.Header,
  3198. }
  3199. }
  3200. if err != nil {
  3201. return nil, err
  3202. }
  3203. defer googleapi.CloseBody(res)
  3204. if err := googleapi.CheckResponse(res); err != nil {
  3205. return nil, err
  3206. }
  3207. ret := &AssociationSession{
  3208. ServerResponse: googleapi.ServerResponse{
  3209. Header: res.Header,
  3210. HTTPStatusCode: res.StatusCode,
  3211. },
  3212. }
  3213. target := &ret
  3214. if err := gensupport.DecodeResponse(target, res); err != nil {
  3215. return nil, err
  3216. }
  3217. return ret, nil
  3218. // {
  3219. // "description": "Create an association session for initiating an association with an AdSense user.",
  3220. // "httpMethod": "GET",
  3221. // "id": "adsensehost.associationsessions.start",
  3222. // "parameterOrder": [
  3223. // "productCode",
  3224. // "websiteUrl"
  3225. // ],
  3226. // "parameters": {
  3227. // "productCode": {
  3228. // "description": "Products to associate with the user.",
  3229. // "enum": [
  3230. // "AFC",
  3231. // "AFG",
  3232. // "AFMC",
  3233. // "AFS",
  3234. // "AFV"
  3235. // ],
  3236. // "enumDescriptions": [
  3237. // "AdSense For Content",
  3238. // "AdSense For Games",
  3239. // "AdSense For Mobile Content - deprecated",
  3240. // "AdSense For Search - deprecated",
  3241. // "AdSense For Video"
  3242. // ],
  3243. // "location": "query",
  3244. // "repeated": true,
  3245. // "required": true,
  3246. // "type": "string"
  3247. // },
  3248. // "userLocale": {
  3249. // "description": "The preferred locale of the user.",
  3250. // "location": "query",
  3251. // "type": "string"
  3252. // },
  3253. // "websiteLocale": {
  3254. // "description": "The locale of the user's hosted website.",
  3255. // "location": "query",
  3256. // "type": "string"
  3257. // },
  3258. // "websiteUrl": {
  3259. // "description": "The URL of the user's hosted website.",
  3260. // "location": "query",
  3261. // "required": true,
  3262. // "type": "string"
  3263. // }
  3264. // },
  3265. // "path": "associationsessions/start",
  3266. // "response": {
  3267. // "$ref": "AssociationSession"
  3268. // },
  3269. // "scopes": [
  3270. // "https://www.googleapis.com/auth/adsensehost"
  3271. // ]
  3272. // }
  3273. }
  3274. // method id "adsensehost.associationsessions.verify":
  3275. type AssociationsessionsVerifyCall struct {
  3276. s *Service
  3277. urlParams_ gensupport.URLParams
  3278. ifNoneMatch_ string
  3279. ctx_ context.Context
  3280. header_ http.Header
  3281. }
  3282. // Verify: Verify an association session after the association callback
  3283. // returns from AdSense signup.
  3284. func (r *AssociationsessionsService) Verify(token string) *AssociationsessionsVerifyCall {
  3285. c := &AssociationsessionsVerifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3286. c.urlParams_.Set("token", token)
  3287. return c
  3288. }
  3289. // Fields allows partial responses to be retrieved. See
  3290. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3291. // for more information.
  3292. func (c *AssociationsessionsVerifyCall) Fields(s ...googleapi.Field) *AssociationsessionsVerifyCall {
  3293. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3294. return c
  3295. }
  3296. // IfNoneMatch sets the optional parameter which makes the operation
  3297. // fail if the object's ETag matches the given value. This is useful for
  3298. // getting updates only after the object has changed since the last
  3299. // request. Use googleapi.IsNotModified to check whether the response
  3300. // error from Do is the result of In-None-Match.
  3301. func (c *AssociationsessionsVerifyCall) IfNoneMatch(entityTag string) *AssociationsessionsVerifyCall {
  3302. c.ifNoneMatch_ = entityTag
  3303. return c
  3304. }
  3305. // Context sets the context to be used in this call's Do method. Any
  3306. // pending HTTP request will be aborted if the provided context is
  3307. // canceled.
  3308. func (c *AssociationsessionsVerifyCall) Context(ctx context.Context) *AssociationsessionsVerifyCall {
  3309. c.ctx_ = ctx
  3310. return c
  3311. }
  3312. // Header returns an http.Header that can be modified by the caller to
  3313. // add HTTP headers to the request.
  3314. func (c *AssociationsessionsVerifyCall) Header() http.Header {
  3315. if c.header_ == nil {
  3316. c.header_ = make(http.Header)
  3317. }
  3318. return c.header_
  3319. }
  3320. func (c *AssociationsessionsVerifyCall) doRequest(alt string) (*http.Response, error) {
  3321. reqHeaders := make(http.Header)
  3322. for k, v := range c.header_ {
  3323. reqHeaders[k] = v
  3324. }
  3325. reqHeaders.Set("User-Agent", c.s.userAgent())
  3326. if c.ifNoneMatch_ != "" {
  3327. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3328. }
  3329. var body io.Reader = nil
  3330. c.urlParams_.Set("alt", alt)
  3331. c.urlParams_.Set("prettyPrint", "false")
  3332. urls := googleapi.ResolveRelative(c.s.BasePath, "associationsessions/verify")
  3333. urls += "?" + c.urlParams_.Encode()
  3334. req, err := http.NewRequest("GET", urls, body)
  3335. if err != nil {
  3336. return nil, err
  3337. }
  3338. req.Header = reqHeaders
  3339. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3340. }
  3341. // Do executes the "adsensehost.associationsessions.verify" call.
  3342. // Exactly one of *AssociationSession or error will be non-nil. Any
  3343. // non-2xx status code is an error. Response headers are in either
  3344. // *AssociationSession.ServerResponse.Header or (if a response was
  3345. // returned at all) in error.(*googleapi.Error).Header. Use
  3346. // googleapi.IsNotModified to check whether the returned error was
  3347. // because http.StatusNotModified was returned.
  3348. func (c *AssociationsessionsVerifyCall) Do(opts ...googleapi.CallOption) (*AssociationSession, error) {
  3349. gensupport.SetOptions(c.urlParams_, opts...)
  3350. res, err := c.doRequest("json")
  3351. if res != nil && res.StatusCode == http.StatusNotModified {
  3352. if res.Body != nil {
  3353. res.Body.Close()
  3354. }
  3355. return nil, &googleapi.Error{
  3356. Code: res.StatusCode,
  3357. Header: res.Header,
  3358. }
  3359. }
  3360. if err != nil {
  3361. return nil, err
  3362. }
  3363. defer googleapi.CloseBody(res)
  3364. if err := googleapi.CheckResponse(res); err != nil {
  3365. return nil, err
  3366. }
  3367. ret := &AssociationSession{
  3368. ServerResponse: googleapi.ServerResponse{
  3369. Header: res.Header,
  3370. HTTPStatusCode: res.StatusCode,
  3371. },
  3372. }
  3373. target := &ret
  3374. if err := gensupport.DecodeResponse(target, res); err != nil {
  3375. return nil, err
  3376. }
  3377. return ret, nil
  3378. // {
  3379. // "description": "Verify an association session after the association callback returns from AdSense signup.",
  3380. // "httpMethod": "GET",
  3381. // "id": "adsensehost.associationsessions.verify",
  3382. // "parameterOrder": [
  3383. // "token"
  3384. // ],
  3385. // "parameters": {
  3386. // "token": {
  3387. // "description": "The token returned to the association callback URL.",
  3388. // "location": "query",
  3389. // "required": true,
  3390. // "type": "string"
  3391. // }
  3392. // },
  3393. // "path": "associationsessions/verify",
  3394. // "response": {
  3395. // "$ref": "AssociationSession"
  3396. // },
  3397. // "scopes": [
  3398. // "https://www.googleapis.com/auth/adsensehost"
  3399. // ]
  3400. // }
  3401. }
  3402. // method id "adsensehost.customchannels.delete":
  3403. type CustomchannelsDeleteCall struct {
  3404. s *Service
  3405. adClientId string
  3406. customChannelId string
  3407. urlParams_ gensupport.URLParams
  3408. ctx_ context.Context
  3409. header_ http.Header
  3410. }
  3411. // Delete: Delete a specific custom channel from the host AdSense
  3412. // account.
  3413. func (r *CustomchannelsService) Delete(adClientId string, customChannelId string) *CustomchannelsDeleteCall {
  3414. c := &CustomchannelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3415. c.adClientId = adClientId
  3416. c.customChannelId = customChannelId
  3417. return c
  3418. }
  3419. // Fields allows partial responses to be retrieved. See
  3420. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3421. // for more information.
  3422. func (c *CustomchannelsDeleteCall) Fields(s ...googleapi.Field) *CustomchannelsDeleteCall {
  3423. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3424. return c
  3425. }
  3426. // Context sets the context to be used in this call's Do method. Any
  3427. // pending HTTP request will be aborted if the provided context is
  3428. // canceled.
  3429. func (c *CustomchannelsDeleteCall) Context(ctx context.Context) *CustomchannelsDeleteCall {
  3430. c.ctx_ = ctx
  3431. return c
  3432. }
  3433. // Header returns an http.Header that can be modified by the caller to
  3434. // add HTTP headers to the request.
  3435. func (c *CustomchannelsDeleteCall) Header() http.Header {
  3436. if c.header_ == nil {
  3437. c.header_ = make(http.Header)
  3438. }
  3439. return c.header_
  3440. }
  3441. func (c *CustomchannelsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3442. reqHeaders := make(http.Header)
  3443. for k, v := range c.header_ {
  3444. reqHeaders[k] = v
  3445. }
  3446. reqHeaders.Set("User-Agent", c.s.userAgent())
  3447. var body io.Reader = nil
  3448. c.urlParams_.Set("alt", alt)
  3449. c.urlParams_.Set("prettyPrint", "false")
  3450. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}")
  3451. urls += "?" + c.urlParams_.Encode()
  3452. req, err := http.NewRequest("DELETE", urls, body)
  3453. if err != nil {
  3454. return nil, err
  3455. }
  3456. req.Header = reqHeaders
  3457. googleapi.Expand(req.URL, map[string]string{
  3458. "adClientId": c.adClientId,
  3459. "customChannelId": c.customChannelId,
  3460. })
  3461. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3462. }
  3463. // Do executes the "adsensehost.customchannels.delete" call.
  3464. // Exactly one of *CustomChannel or error will be non-nil. Any non-2xx
  3465. // status code is an error. Response headers are in either
  3466. // *CustomChannel.ServerResponse.Header or (if a response was returned
  3467. // at all) in error.(*googleapi.Error).Header. Use
  3468. // googleapi.IsNotModified to check whether the returned error was
  3469. // because http.StatusNotModified was returned.
  3470. func (c *CustomchannelsDeleteCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  3471. gensupport.SetOptions(c.urlParams_, opts...)
  3472. res, err := c.doRequest("json")
  3473. if res != nil && res.StatusCode == http.StatusNotModified {
  3474. if res.Body != nil {
  3475. res.Body.Close()
  3476. }
  3477. return nil, &googleapi.Error{
  3478. Code: res.StatusCode,
  3479. Header: res.Header,
  3480. }
  3481. }
  3482. if err != nil {
  3483. return nil, err
  3484. }
  3485. defer googleapi.CloseBody(res)
  3486. if err := googleapi.CheckResponse(res); err != nil {
  3487. return nil, err
  3488. }
  3489. ret := &CustomChannel{
  3490. ServerResponse: googleapi.ServerResponse{
  3491. Header: res.Header,
  3492. HTTPStatusCode: res.StatusCode,
  3493. },
  3494. }
  3495. target := &ret
  3496. if err := gensupport.DecodeResponse(target, res); err != nil {
  3497. return nil, err
  3498. }
  3499. return ret, nil
  3500. // {
  3501. // "description": "Delete a specific custom channel from the host AdSense account.",
  3502. // "httpMethod": "DELETE",
  3503. // "id": "adsensehost.customchannels.delete",
  3504. // "parameterOrder": [
  3505. // "adClientId",
  3506. // "customChannelId"
  3507. // ],
  3508. // "parameters": {
  3509. // "adClientId": {
  3510. // "description": "Ad client from which to delete the custom channel.",
  3511. // "location": "path",
  3512. // "required": true,
  3513. // "type": "string"
  3514. // },
  3515. // "customChannelId": {
  3516. // "description": "Custom channel to delete.",
  3517. // "location": "path",
  3518. // "required": true,
  3519. // "type": "string"
  3520. // }
  3521. // },
  3522. // "path": "adclients/{adClientId}/customchannels/{customChannelId}",
  3523. // "response": {
  3524. // "$ref": "CustomChannel"
  3525. // },
  3526. // "scopes": [
  3527. // "https://www.googleapis.com/auth/adsensehost"
  3528. // ]
  3529. // }
  3530. }
  3531. // method id "adsensehost.customchannels.get":
  3532. type CustomchannelsGetCall struct {
  3533. s *Service
  3534. adClientId string
  3535. customChannelId string
  3536. urlParams_ gensupport.URLParams
  3537. ifNoneMatch_ string
  3538. ctx_ context.Context
  3539. header_ http.Header
  3540. }
  3541. // Get: Get a specific custom channel from the host AdSense account.
  3542. func (r *CustomchannelsService) Get(adClientId string, customChannelId string) *CustomchannelsGetCall {
  3543. c := &CustomchannelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3544. c.adClientId = adClientId
  3545. c.customChannelId = customChannelId
  3546. return c
  3547. }
  3548. // Fields allows partial responses to be retrieved. See
  3549. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3550. // for more information.
  3551. func (c *CustomchannelsGetCall) Fields(s ...googleapi.Field) *CustomchannelsGetCall {
  3552. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3553. return c
  3554. }
  3555. // IfNoneMatch sets the optional parameter which makes the operation
  3556. // fail if the object's ETag matches the given value. This is useful for
  3557. // getting updates only after the object has changed since the last
  3558. // request. Use googleapi.IsNotModified to check whether the response
  3559. // error from Do is the result of In-None-Match.
  3560. func (c *CustomchannelsGetCall) IfNoneMatch(entityTag string) *CustomchannelsGetCall {
  3561. c.ifNoneMatch_ = entityTag
  3562. return c
  3563. }
  3564. // Context sets the context to be used in this call's Do method. Any
  3565. // pending HTTP request will be aborted if the provided context is
  3566. // canceled.
  3567. func (c *CustomchannelsGetCall) Context(ctx context.Context) *CustomchannelsGetCall {
  3568. c.ctx_ = ctx
  3569. return c
  3570. }
  3571. // Header returns an http.Header that can be modified by the caller to
  3572. // add HTTP headers to the request.
  3573. func (c *CustomchannelsGetCall) Header() http.Header {
  3574. if c.header_ == nil {
  3575. c.header_ = make(http.Header)
  3576. }
  3577. return c.header_
  3578. }
  3579. func (c *CustomchannelsGetCall) doRequest(alt string) (*http.Response, error) {
  3580. reqHeaders := make(http.Header)
  3581. for k, v := range c.header_ {
  3582. reqHeaders[k] = v
  3583. }
  3584. reqHeaders.Set("User-Agent", c.s.userAgent())
  3585. if c.ifNoneMatch_ != "" {
  3586. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3587. }
  3588. var body io.Reader = nil
  3589. c.urlParams_.Set("alt", alt)
  3590. c.urlParams_.Set("prettyPrint", "false")
  3591. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}")
  3592. urls += "?" + c.urlParams_.Encode()
  3593. req, err := http.NewRequest("GET", urls, body)
  3594. if err != nil {
  3595. return nil, err
  3596. }
  3597. req.Header = reqHeaders
  3598. googleapi.Expand(req.URL, map[string]string{
  3599. "adClientId": c.adClientId,
  3600. "customChannelId": c.customChannelId,
  3601. })
  3602. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3603. }
  3604. // Do executes the "adsensehost.customchannels.get" call.
  3605. // Exactly one of *CustomChannel or error will be non-nil. Any non-2xx
  3606. // status code is an error. Response headers are in either
  3607. // *CustomChannel.ServerResponse.Header or (if a response was returned
  3608. // at all) in error.(*googleapi.Error).Header. Use
  3609. // googleapi.IsNotModified to check whether the returned error was
  3610. // because http.StatusNotModified was returned.
  3611. func (c *CustomchannelsGetCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  3612. gensupport.SetOptions(c.urlParams_, opts...)
  3613. res, err := c.doRequest("json")
  3614. if res != nil && res.StatusCode == http.StatusNotModified {
  3615. if res.Body != nil {
  3616. res.Body.Close()
  3617. }
  3618. return nil, &googleapi.Error{
  3619. Code: res.StatusCode,
  3620. Header: res.Header,
  3621. }
  3622. }
  3623. if err != nil {
  3624. return nil, err
  3625. }
  3626. defer googleapi.CloseBody(res)
  3627. if err := googleapi.CheckResponse(res); err != nil {
  3628. return nil, err
  3629. }
  3630. ret := &CustomChannel{
  3631. ServerResponse: googleapi.ServerResponse{
  3632. Header: res.Header,
  3633. HTTPStatusCode: res.StatusCode,
  3634. },
  3635. }
  3636. target := &ret
  3637. if err := gensupport.DecodeResponse(target, res); err != nil {
  3638. return nil, err
  3639. }
  3640. return ret, nil
  3641. // {
  3642. // "description": "Get a specific custom channel from the host AdSense account.",
  3643. // "httpMethod": "GET",
  3644. // "id": "adsensehost.customchannels.get",
  3645. // "parameterOrder": [
  3646. // "adClientId",
  3647. // "customChannelId"
  3648. // ],
  3649. // "parameters": {
  3650. // "adClientId": {
  3651. // "description": "Ad client from which to get the custom channel.",
  3652. // "location": "path",
  3653. // "required": true,
  3654. // "type": "string"
  3655. // },
  3656. // "customChannelId": {
  3657. // "description": "Custom channel to get.",
  3658. // "location": "path",
  3659. // "required": true,
  3660. // "type": "string"
  3661. // }
  3662. // },
  3663. // "path": "adclients/{adClientId}/customchannels/{customChannelId}",
  3664. // "response": {
  3665. // "$ref": "CustomChannel"
  3666. // },
  3667. // "scopes": [
  3668. // "https://www.googleapis.com/auth/adsensehost"
  3669. // ]
  3670. // }
  3671. }
  3672. // method id "adsensehost.customchannels.insert":
  3673. type CustomchannelsInsertCall struct {
  3674. s *Service
  3675. adClientId string
  3676. customchannel *CustomChannel
  3677. urlParams_ gensupport.URLParams
  3678. ctx_ context.Context
  3679. header_ http.Header
  3680. }
  3681. // Insert: Add a new custom channel to the host AdSense account.
  3682. func (r *CustomchannelsService) Insert(adClientId string, customchannel *CustomChannel) *CustomchannelsInsertCall {
  3683. c := &CustomchannelsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3684. c.adClientId = adClientId
  3685. c.customchannel = customchannel
  3686. return c
  3687. }
  3688. // Fields allows partial responses to be retrieved. See
  3689. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3690. // for more information.
  3691. func (c *CustomchannelsInsertCall) Fields(s ...googleapi.Field) *CustomchannelsInsertCall {
  3692. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3693. return c
  3694. }
  3695. // Context sets the context to be used in this call's Do method. Any
  3696. // pending HTTP request will be aborted if the provided context is
  3697. // canceled.
  3698. func (c *CustomchannelsInsertCall) Context(ctx context.Context) *CustomchannelsInsertCall {
  3699. c.ctx_ = ctx
  3700. return c
  3701. }
  3702. // Header returns an http.Header that can be modified by the caller to
  3703. // add HTTP headers to the request.
  3704. func (c *CustomchannelsInsertCall) Header() http.Header {
  3705. if c.header_ == nil {
  3706. c.header_ = make(http.Header)
  3707. }
  3708. return c.header_
  3709. }
  3710. func (c *CustomchannelsInsertCall) doRequest(alt string) (*http.Response, error) {
  3711. reqHeaders := make(http.Header)
  3712. for k, v := range c.header_ {
  3713. reqHeaders[k] = v
  3714. }
  3715. reqHeaders.Set("User-Agent", c.s.userAgent())
  3716. var body io.Reader = nil
  3717. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customchannel)
  3718. if err != nil {
  3719. return nil, err
  3720. }
  3721. reqHeaders.Set("Content-Type", "application/json")
  3722. c.urlParams_.Set("alt", alt)
  3723. c.urlParams_.Set("prettyPrint", "false")
  3724. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
  3725. urls += "?" + c.urlParams_.Encode()
  3726. req, err := http.NewRequest("POST", urls, body)
  3727. if err != nil {
  3728. return nil, err
  3729. }
  3730. req.Header = reqHeaders
  3731. googleapi.Expand(req.URL, map[string]string{
  3732. "adClientId": c.adClientId,
  3733. })
  3734. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3735. }
  3736. // Do executes the "adsensehost.customchannels.insert" call.
  3737. // Exactly one of *CustomChannel or error will be non-nil. Any non-2xx
  3738. // status code is an error. Response headers are in either
  3739. // *CustomChannel.ServerResponse.Header or (if a response was returned
  3740. // at all) in error.(*googleapi.Error).Header. Use
  3741. // googleapi.IsNotModified to check whether the returned error was
  3742. // because http.StatusNotModified was returned.
  3743. func (c *CustomchannelsInsertCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  3744. gensupport.SetOptions(c.urlParams_, opts...)
  3745. res, err := c.doRequest("json")
  3746. if res != nil && res.StatusCode == http.StatusNotModified {
  3747. if res.Body != nil {
  3748. res.Body.Close()
  3749. }
  3750. return nil, &googleapi.Error{
  3751. Code: res.StatusCode,
  3752. Header: res.Header,
  3753. }
  3754. }
  3755. if err != nil {
  3756. return nil, err
  3757. }
  3758. defer googleapi.CloseBody(res)
  3759. if err := googleapi.CheckResponse(res); err != nil {
  3760. return nil, err
  3761. }
  3762. ret := &CustomChannel{
  3763. ServerResponse: googleapi.ServerResponse{
  3764. Header: res.Header,
  3765. HTTPStatusCode: res.StatusCode,
  3766. },
  3767. }
  3768. target := &ret
  3769. if err := gensupport.DecodeResponse(target, res); err != nil {
  3770. return nil, err
  3771. }
  3772. return ret, nil
  3773. // {
  3774. // "description": "Add a new custom channel to the host AdSense account.",
  3775. // "httpMethod": "POST",
  3776. // "id": "adsensehost.customchannels.insert",
  3777. // "parameterOrder": [
  3778. // "adClientId"
  3779. // ],
  3780. // "parameters": {
  3781. // "adClientId": {
  3782. // "description": "Ad client to which the new custom channel will be added.",
  3783. // "location": "path",
  3784. // "required": true,
  3785. // "type": "string"
  3786. // }
  3787. // },
  3788. // "path": "adclients/{adClientId}/customchannels",
  3789. // "request": {
  3790. // "$ref": "CustomChannel"
  3791. // },
  3792. // "response": {
  3793. // "$ref": "CustomChannel"
  3794. // },
  3795. // "scopes": [
  3796. // "https://www.googleapis.com/auth/adsensehost"
  3797. // ]
  3798. // }
  3799. }
  3800. // method id "adsensehost.customchannels.list":
  3801. type CustomchannelsListCall struct {
  3802. s *Service
  3803. adClientId string
  3804. urlParams_ gensupport.URLParams
  3805. ifNoneMatch_ string
  3806. ctx_ context.Context
  3807. header_ http.Header
  3808. }
  3809. // List: List all host custom channels in this AdSense account.
  3810. func (r *CustomchannelsService) List(adClientId string) *CustomchannelsListCall {
  3811. c := &CustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3812. c.adClientId = adClientId
  3813. return c
  3814. }
  3815. // MaxResults sets the optional parameter "maxResults": The maximum
  3816. // number of custom channels to include in the response, used for
  3817. // paging.
  3818. func (c *CustomchannelsListCall) MaxResults(maxResults int64) *CustomchannelsListCall {
  3819. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3820. return c
  3821. }
  3822. // PageToken sets the optional parameter "pageToken": A continuation
  3823. // token, used to page through custom channels. To retrieve the next
  3824. // page, set this parameter to the value of "nextPageToken" from the
  3825. // previous response.
  3826. func (c *CustomchannelsListCall) PageToken(pageToken string) *CustomchannelsListCall {
  3827. c.urlParams_.Set("pageToken", pageToken)
  3828. return c
  3829. }
  3830. // Fields allows partial responses to be retrieved. See
  3831. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3832. // for more information.
  3833. func (c *CustomchannelsListCall) Fields(s ...googleapi.Field) *CustomchannelsListCall {
  3834. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3835. return c
  3836. }
  3837. // IfNoneMatch sets the optional parameter which makes the operation
  3838. // fail if the object's ETag matches the given value. This is useful for
  3839. // getting updates only after the object has changed since the last
  3840. // request. Use googleapi.IsNotModified to check whether the response
  3841. // error from Do is the result of In-None-Match.
  3842. func (c *CustomchannelsListCall) IfNoneMatch(entityTag string) *CustomchannelsListCall {
  3843. c.ifNoneMatch_ = entityTag
  3844. return c
  3845. }
  3846. // Context sets the context to be used in this call's Do method. Any
  3847. // pending HTTP request will be aborted if the provided context is
  3848. // canceled.
  3849. func (c *CustomchannelsListCall) Context(ctx context.Context) *CustomchannelsListCall {
  3850. c.ctx_ = ctx
  3851. return c
  3852. }
  3853. // Header returns an http.Header that can be modified by the caller to
  3854. // add HTTP headers to the request.
  3855. func (c *CustomchannelsListCall) Header() http.Header {
  3856. if c.header_ == nil {
  3857. c.header_ = make(http.Header)
  3858. }
  3859. return c.header_
  3860. }
  3861. func (c *CustomchannelsListCall) doRequest(alt string) (*http.Response, error) {
  3862. reqHeaders := make(http.Header)
  3863. for k, v := range c.header_ {
  3864. reqHeaders[k] = v
  3865. }
  3866. reqHeaders.Set("User-Agent", c.s.userAgent())
  3867. if c.ifNoneMatch_ != "" {
  3868. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3869. }
  3870. var body io.Reader = nil
  3871. c.urlParams_.Set("alt", alt)
  3872. c.urlParams_.Set("prettyPrint", "false")
  3873. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
  3874. urls += "?" + c.urlParams_.Encode()
  3875. req, err := http.NewRequest("GET", urls, body)
  3876. if err != nil {
  3877. return nil, err
  3878. }
  3879. req.Header = reqHeaders
  3880. googleapi.Expand(req.URL, map[string]string{
  3881. "adClientId": c.adClientId,
  3882. })
  3883. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3884. }
  3885. // Do executes the "adsensehost.customchannels.list" call.
  3886. // Exactly one of *CustomChannels or error will be non-nil. Any non-2xx
  3887. // status code is an error. Response headers are in either
  3888. // *CustomChannels.ServerResponse.Header or (if a response was returned
  3889. // at all) in error.(*googleapi.Error).Header. Use
  3890. // googleapi.IsNotModified to check whether the returned error was
  3891. // because http.StatusNotModified was returned.
  3892. func (c *CustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) {
  3893. gensupport.SetOptions(c.urlParams_, opts...)
  3894. res, err := c.doRequest("json")
  3895. if res != nil && res.StatusCode == http.StatusNotModified {
  3896. if res.Body != nil {
  3897. res.Body.Close()
  3898. }
  3899. return nil, &googleapi.Error{
  3900. Code: res.StatusCode,
  3901. Header: res.Header,
  3902. }
  3903. }
  3904. if err != nil {
  3905. return nil, err
  3906. }
  3907. defer googleapi.CloseBody(res)
  3908. if err := googleapi.CheckResponse(res); err != nil {
  3909. return nil, err
  3910. }
  3911. ret := &CustomChannels{
  3912. ServerResponse: googleapi.ServerResponse{
  3913. Header: res.Header,
  3914. HTTPStatusCode: res.StatusCode,
  3915. },
  3916. }
  3917. target := &ret
  3918. if err := gensupport.DecodeResponse(target, res); err != nil {
  3919. return nil, err
  3920. }
  3921. return ret, nil
  3922. // {
  3923. // "description": "List all host custom channels in this AdSense account.",
  3924. // "httpMethod": "GET",
  3925. // "id": "adsensehost.customchannels.list",
  3926. // "parameterOrder": [
  3927. // "adClientId"
  3928. // ],
  3929. // "parameters": {
  3930. // "adClientId": {
  3931. // "description": "Ad client for which to list custom channels.",
  3932. // "location": "path",
  3933. // "required": true,
  3934. // "type": "string"
  3935. // },
  3936. // "maxResults": {
  3937. // "description": "The maximum number of custom channels to include in the response, used for paging.",
  3938. // "format": "uint32",
  3939. // "location": "query",
  3940. // "maximum": "10000",
  3941. // "minimum": "0",
  3942. // "type": "integer"
  3943. // },
  3944. // "pageToken": {
  3945. // "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.",
  3946. // "location": "query",
  3947. // "type": "string"
  3948. // }
  3949. // },
  3950. // "path": "adclients/{adClientId}/customchannels",
  3951. // "response": {
  3952. // "$ref": "CustomChannels"
  3953. // },
  3954. // "scopes": [
  3955. // "https://www.googleapis.com/auth/adsensehost"
  3956. // ]
  3957. // }
  3958. }
  3959. // Pages invokes f for each page of results.
  3960. // A non-nil error returned from f will halt the iteration.
  3961. // The provided context supersedes any context provided to the Context method.
  3962. func (c *CustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error {
  3963. c.ctx_ = ctx
  3964. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3965. for {
  3966. x, err := c.Do()
  3967. if err != nil {
  3968. return err
  3969. }
  3970. if err := f(x); err != nil {
  3971. return err
  3972. }
  3973. if x.NextPageToken == "" {
  3974. return nil
  3975. }
  3976. c.PageToken(x.NextPageToken)
  3977. }
  3978. }
  3979. // method id "adsensehost.customchannels.patch":
  3980. type CustomchannelsPatchCall struct {
  3981. s *Service
  3982. adClientId string
  3983. customchannel *CustomChannel
  3984. urlParams_ gensupport.URLParams
  3985. ctx_ context.Context
  3986. header_ http.Header
  3987. }
  3988. // Patch: Update a custom channel in the host AdSense account. This
  3989. // method supports patch semantics.
  3990. func (r *CustomchannelsService) Patch(adClientId string, customChannelId string, customchannel *CustomChannel) *CustomchannelsPatchCall {
  3991. c := &CustomchannelsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3992. c.adClientId = adClientId
  3993. c.urlParams_.Set("customChannelId", customChannelId)
  3994. c.customchannel = customchannel
  3995. return c
  3996. }
  3997. // Fields allows partial responses to be retrieved. See
  3998. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3999. // for more information.
  4000. func (c *CustomchannelsPatchCall) Fields(s ...googleapi.Field) *CustomchannelsPatchCall {
  4001. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4002. return c
  4003. }
  4004. // Context sets the context to be used in this call's Do method. Any
  4005. // pending HTTP request will be aborted if the provided context is
  4006. // canceled.
  4007. func (c *CustomchannelsPatchCall) Context(ctx context.Context) *CustomchannelsPatchCall {
  4008. c.ctx_ = ctx
  4009. return c
  4010. }
  4011. // Header returns an http.Header that can be modified by the caller to
  4012. // add HTTP headers to the request.
  4013. func (c *CustomchannelsPatchCall) Header() http.Header {
  4014. if c.header_ == nil {
  4015. c.header_ = make(http.Header)
  4016. }
  4017. return c.header_
  4018. }
  4019. func (c *CustomchannelsPatchCall) doRequest(alt string) (*http.Response, error) {
  4020. reqHeaders := make(http.Header)
  4021. for k, v := range c.header_ {
  4022. reqHeaders[k] = v
  4023. }
  4024. reqHeaders.Set("User-Agent", c.s.userAgent())
  4025. var body io.Reader = nil
  4026. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customchannel)
  4027. if err != nil {
  4028. return nil, err
  4029. }
  4030. reqHeaders.Set("Content-Type", "application/json")
  4031. c.urlParams_.Set("alt", alt)
  4032. c.urlParams_.Set("prettyPrint", "false")
  4033. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
  4034. urls += "?" + c.urlParams_.Encode()
  4035. req, err := http.NewRequest("PATCH", urls, body)
  4036. if err != nil {
  4037. return nil, err
  4038. }
  4039. req.Header = reqHeaders
  4040. googleapi.Expand(req.URL, map[string]string{
  4041. "adClientId": c.adClientId,
  4042. })
  4043. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4044. }
  4045. // Do executes the "adsensehost.customchannels.patch" call.
  4046. // Exactly one of *CustomChannel or error will be non-nil. Any non-2xx
  4047. // status code is an error. Response headers are in either
  4048. // *CustomChannel.ServerResponse.Header or (if a response was returned
  4049. // at all) in error.(*googleapi.Error).Header. Use
  4050. // googleapi.IsNotModified to check whether the returned error was
  4051. // because http.StatusNotModified was returned.
  4052. func (c *CustomchannelsPatchCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  4053. gensupport.SetOptions(c.urlParams_, opts...)
  4054. res, err := c.doRequest("json")
  4055. if res != nil && res.StatusCode == http.StatusNotModified {
  4056. if res.Body != nil {
  4057. res.Body.Close()
  4058. }
  4059. return nil, &googleapi.Error{
  4060. Code: res.StatusCode,
  4061. Header: res.Header,
  4062. }
  4063. }
  4064. if err != nil {
  4065. return nil, err
  4066. }
  4067. defer googleapi.CloseBody(res)
  4068. if err := googleapi.CheckResponse(res); err != nil {
  4069. return nil, err
  4070. }
  4071. ret := &CustomChannel{
  4072. ServerResponse: googleapi.ServerResponse{
  4073. Header: res.Header,
  4074. HTTPStatusCode: res.StatusCode,
  4075. },
  4076. }
  4077. target := &ret
  4078. if err := gensupport.DecodeResponse(target, res); err != nil {
  4079. return nil, err
  4080. }
  4081. return ret, nil
  4082. // {
  4083. // "description": "Update a custom channel in the host AdSense account. This method supports patch semantics.",
  4084. // "httpMethod": "PATCH",
  4085. // "id": "adsensehost.customchannels.patch",
  4086. // "parameterOrder": [
  4087. // "adClientId",
  4088. // "customChannelId"
  4089. // ],
  4090. // "parameters": {
  4091. // "adClientId": {
  4092. // "description": "Ad client in which the custom channel will be updated.",
  4093. // "location": "path",
  4094. // "required": true,
  4095. // "type": "string"
  4096. // },
  4097. // "customChannelId": {
  4098. // "description": "Custom channel to get.",
  4099. // "location": "query",
  4100. // "required": true,
  4101. // "type": "string"
  4102. // }
  4103. // },
  4104. // "path": "adclients/{adClientId}/customchannels",
  4105. // "request": {
  4106. // "$ref": "CustomChannel"
  4107. // },
  4108. // "response": {
  4109. // "$ref": "CustomChannel"
  4110. // },
  4111. // "scopes": [
  4112. // "https://www.googleapis.com/auth/adsensehost"
  4113. // ]
  4114. // }
  4115. }
  4116. // method id "adsensehost.customchannels.update":
  4117. type CustomchannelsUpdateCall struct {
  4118. s *Service
  4119. adClientId string
  4120. customchannel *CustomChannel
  4121. urlParams_ gensupport.URLParams
  4122. ctx_ context.Context
  4123. header_ http.Header
  4124. }
  4125. // Update: Update a custom channel in the host AdSense account.
  4126. func (r *CustomchannelsService) Update(adClientId string, customchannel *CustomChannel) *CustomchannelsUpdateCall {
  4127. c := &CustomchannelsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4128. c.adClientId = adClientId
  4129. c.customchannel = customchannel
  4130. return c
  4131. }
  4132. // Fields allows partial responses to be retrieved. See
  4133. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4134. // for more information.
  4135. func (c *CustomchannelsUpdateCall) Fields(s ...googleapi.Field) *CustomchannelsUpdateCall {
  4136. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4137. return c
  4138. }
  4139. // Context sets the context to be used in this call's Do method. Any
  4140. // pending HTTP request will be aborted if the provided context is
  4141. // canceled.
  4142. func (c *CustomchannelsUpdateCall) Context(ctx context.Context) *CustomchannelsUpdateCall {
  4143. c.ctx_ = ctx
  4144. return c
  4145. }
  4146. // Header returns an http.Header that can be modified by the caller to
  4147. // add HTTP headers to the request.
  4148. func (c *CustomchannelsUpdateCall) Header() http.Header {
  4149. if c.header_ == nil {
  4150. c.header_ = make(http.Header)
  4151. }
  4152. return c.header_
  4153. }
  4154. func (c *CustomchannelsUpdateCall) doRequest(alt string) (*http.Response, error) {
  4155. reqHeaders := make(http.Header)
  4156. for k, v := range c.header_ {
  4157. reqHeaders[k] = v
  4158. }
  4159. reqHeaders.Set("User-Agent", c.s.userAgent())
  4160. var body io.Reader = nil
  4161. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customchannel)
  4162. if err != nil {
  4163. return nil, err
  4164. }
  4165. reqHeaders.Set("Content-Type", "application/json")
  4166. c.urlParams_.Set("alt", alt)
  4167. c.urlParams_.Set("prettyPrint", "false")
  4168. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
  4169. urls += "?" + c.urlParams_.Encode()
  4170. req, err := http.NewRequest("PUT", urls, body)
  4171. if err != nil {
  4172. return nil, err
  4173. }
  4174. req.Header = reqHeaders
  4175. googleapi.Expand(req.URL, map[string]string{
  4176. "adClientId": c.adClientId,
  4177. })
  4178. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4179. }
  4180. // Do executes the "adsensehost.customchannels.update" call.
  4181. // Exactly one of *CustomChannel or error will be non-nil. Any non-2xx
  4182. // status code is an error. Response headers are in either
  4183. // *CustomChannel.ServerResponse.Header or (if a response was returned
  4184. // at all) in error.(*googleapi.Error).Header. Use
  4185. // googleapi.IsNotModified to check whether the returned error was
  4186. // because http.StatusNotModified was returned.
  4187. func (c *CustomchannelsUpdateCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  4188. gensupport.SetOptions(c.urlParams_, opts...)
  4189. res, err := c.doRequest("json")
  4190. if res != nil && res.StatusCode == http.StatusNotModified {
  4191. if res.Body != nil {
  4192. res.Body.Close()
  4193. }
  4194. return nil, &googleapi.Error{
  4195. Code: res.StatusCode,
  4196. Header: res.Header,
  4197. }
  4198. }
  4199. if err != nil {
  4200. return nil, err
  4201. }
  4202. defer googleapi.CloseBody(res)
  4203. if err := googleapi.CheckResponse(res); err != nil {
  4204. return nil, err
  4205. }
  4206. ret := &CustomChannel{
  4207. ServerResponse: googleapi.ServerResponse{
  4208. Header: res.Header,
  4209. HTTPStatusCode: res.StatusCode,
  4210. },
  4211. }
  4212. target := &ret
  4213. if err := gensupport.DecodeResponse(target, res); err != nil {
  4214. return nil, err
  4215. }
  4216. return ret, nil
  4217. // {
  4218. // "description": "Update a custom channel in the host AdSense account.",
  4219. // "httpMethod": "PUT",
  4220. // "id": "adsensehost.customchannels.update",
  4221. // "parameterOrder": [
  4222. // "adClientId"
  4223. // ],
  4224. // "parameters": {
  4225. // "adClientId": {
  4226. // "description": "Ad client in which the custom channel will be updated.",
  4227. // "location": "path",
  4228. // "required": true,
  4229. // "type": "string"
  4230. // }
  4231. // },
  4232. // "path": "adclients/{adClientId}/customchannels",
  4233. // "request": {
  4234. // "$ref": "CustomChannel"
  4235. // },
  4236. // "response": {
  4237. // "$ref": "CustomChannel"
  4238. // },
  4239. // "scopes": [
  4240. // "https://www.googleapis.com/auth/adsensehost"
  4241. // ]
  4242. // }
  4243. }
  4244. // method id "adsensehost.reports.generate":
  4245. type ReportsGenerateCall struct {
  4246. s *Service
  4247. urlParams_ gensupport.URLParams
  4248. ifNoneMatch_ string
  4249. ctx_ context.Context
  4250. header_ http.Header
  4251. }
  4252. // Generate: Generate an AdSense report based on the report request sent
  4253. // in the query parameters. Returns the result as JSON; to retrieve
  4254. // output in CSV format specify "alt=csv" as a query parameter.
  4255. func (r *ReportsService) Generate(startDate string, endDate string) *ReportsGenerateCall {
  4256. c := &ReportsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4257. c.urlParams_.Set("startDate", startDate)
  4258. c.urlParams_.Set("endDate", endDate)
  4259. return c
  4260. }
  4261. // Dimension sets the optional parameter "dimension": Dimensions to base
  4262. // the report on.
  4263. func (c *ReportsGenerateCall) Dimension(dimension ...string) *ReportsGenerateCall {
  4264. c.urlParams_.SetMulti("dimension", append([]string{}, dimension...))
  4265. return c
  4266. }
  4267. // Filter sets the optional parameter "filter": Filters to be run on the
  4268. // report.
  4269. func (c *ReportsGenerateCall) Filter(filter ...string) *ReportsGenerateCall {
  4270. c.urlParams_.SetMulti("filter", append([]string{}, filter...))
  4271. return c
  4272. }
  4273. // Locale sets the optional parameter "locale": Optional locale to use
  4274. // for translating report output to a local language. Defaults to
  4275. // "en_US" if not specified.
  4276. func (c *ReportsGenerateCall) Locale(locale string) *ReportsGenerateCall {
  4277. c.urlParams_.Set("locale", locale)
  4278. return c
  4279. }
  4280. // MaxResults sets the optional parameter "maxResults": The maximum
  4281. // number of rows of report data to return.
  4282. func (c *ReportsGenerateCall) MaxResults(maxResults int64) *ReportsGenerateCall {
  4283. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4284. return c
  4285. }
  4286. // Metric sets the optional parameter "metric": Numeric columns to
  4287. // include in the report.
  4288. func (c *ReportsGenerateCall) Metric(metric ...string) *ReportsGenerateCall {
  4289. c.urlParams_.SetMulti("metric", append([]string{}, metric...))
  4290. return c
  4291. }
  4292. // Sort sets the optional parameter "sort": The name of a dimension or
  4293. // metric to sort the resulting report on, optionally prefixed with "+"
  4294. // to sort ascending or "-" to sort descending. If no prefix is
  4295. // specified, the column is sorted ascending.
  4296. func (c *ReportsGenerateCall) Sort(sort ...string) *ReportsGenerateCall {
  4297. c.urlParams_.SetMulti("sort", append([]string{}, sort...))
  4298. return c
  4299. }
  4300. // StartIndex sets the optional parameter "startIndex": Index of the
  4301. // first row of report data to return.
  4302. func (c *ReportsGenerateCall) StartIndex(startIndex int64) *ReportsGenerateCall {
  4303. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  4304. return c
  4305. }
  4306. // Fields allows partial responses to be retrieved. See
  4307. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4308. // for more information.
  4309. func (c *ReportsGenerateCall) Fields(s ...googleapi.Field) *ReportsGenerateCall {
  4310. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4311. return c
  4312. }
  4313. // IfNoneMatch sets the optional parameter which makes the operation
  4314. // fail if the object's ETag matches the given value. This is useful for
  4315. // getting updates only after the object has changed since the last
  4316. // request. Use googleapi.IsNotModified to check whether the response
  4317. // error from Do is the result of In-None-Match.
  4318. func (c *ReportsGenerateCall) IfNoneMatch(entityTag string) *ReportsGenerateCall {
  4319. c.ifNoneMatch_ = entityTag
  4320. return c
  4321. }
  4322. // Context sets the context to be used in this call's Do method. Any
  4323. // pending HTTP request will be aborted if the provided context is
  4324. // canceled.
  4325. func (c *ReportsGenerateCall) Context(ctx context.Context) *ReportsGenerateCall {
  4326. c.ctx_ = ctx
  4327. return c
  4328. }
  4329. // Header returns an http.Header that can be modified by the caller to
  4330. // add HTTP headers to the request.
  4331. func (c *ReportsGenerateCall) Header() http.Header {
  4332. if c.header_ == nil {
  4333. c.header_ = make(http.Header)
  4334. }
  4335. return c.header_
  4336. }
  4337. func (c *ReportsGenerateCall) doRequest(alt string) (*http.Response, error) {
  4338. reqHeaders := make(http.Header)
  4339. for k, v := range c.header_ {
  4340. reqHeaders[k] = v
  4341. }
  4342. reqHeaders.Set("User-Agent", c.s.userAgent())
  4343. if c.ifNoneMatch_ != "" {
  4344. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4345. }
  4346. var body io.Reader = nil
  4347. c.urlParams_.Set("alt", alt)
  4348. c.urlParams_.Set("prettyPrint", "false")
  4349. urls := googleapi.ResolveRelative(c.s.BasePath, "reports")
  4350. urls += "?" + c.urlParams_.Encode()
  4351. req, err := http.NewRequest("GET", urls, body)
  4352. if err != nil {
  4353. return nil, err
  4354. }
  4355. req.Header = reqHeaders
  4356. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4357. }
  4358. // Do executes the "adsensehost.reports.generate" call.
  4359. // Exactly one of *Report or error will be non-nil. Any non-2xx status
  4360. // code is an error. Response headers are in either
  4361. // *Report.ServerResponse.Header or (if a response was returned at all)
  4362. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4363. // check whether the returned error was because http.StatusNotModified
  4364. // was returned.
  4365. func (c *ReportsGenerateCall) Do(opts ...googleapi.CallOption) (*Report, error) {
  4366. gensupport.SetOptions(c.urlParams_, opts...)
  4367. res, err := c.doRequest("json")
  4368. if res != nil && res.StatusCode == http.StatusNotModified {
  4369. if res.Body != nil {
  4370. res.Body.Close()
  4371. }
  4372. return nil, &googleapi.Error{
  4373. Code: res.StatusCode,
  4374. Header: res.Header,
  4375. }
  4376. }
  4377. if err != nil {
  4378. return nil, err
  4379. }
  4380. defer googleapi.CloseBody(res)
  4381. if err := googleapi.CheckResponse(res); err != nil {
  4382. return nil, err
  4383. }
  4384. ret := &Report{
  4385. ServerResponse: googleapi.ServerResponse{
  4386. Header: res.Header,
  4387. HTTPStatusCode: res.StatusCode,
  4388. },
  4389. }
  4390. target := &ret
  4391. if err := gensupport.DecodeResponse(target, res); err != nil {
  4392. return nil, err
  4393. }
  4394. return ret, nil
  4395. // {
  4396. // "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.",
  4397. // "httpMethod": "GET",
  4398. // "id": "adsensehost.reports.generate",
  4399. // "parameterOrder": [
  4400. // "startDate",
  4401. // "endDate"
  4402. // ],
  4403. // "parameters": {
  4404. // "dimension": {
  4405. // "description": "Dimensions to base the report on.",
  4406. // "location": "query",
  4407. // "pattern": "[a-zA-Z_]+",
  4408. // "repeated": true,
  4409. // "type": "string"
  4410. // },
  4411. // "endDate": {
  4412. // "description": "End of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  4413. // "location": "query",
  4414. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  4415. // "required": true,
  4416. // "type": "string"
  4417. // },
  4418. // "filter": {
  4419. // "description": "Filters to be run on the report.",
  4420. // "location": "query",
  4421. // "pattern": "[a-zA-Z_]+(==|=@).+",
  4422. // "repeated": true,
  4423. // "type": "string"
  4424. // },
  4425. // "locale": {
  4426. // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.",
  4427. // "location": "query",
  4428. // "pattern": "[a-zA-Z_]+",
  4429. // "type": "string"
  4430. // },
  4431. // "maxResults": {
  4432. // "description": "The maximum number of rows of report data to return.",
  4433. // "format": "uint32",
  4434. // "location": "query",
  4435. // "maximum": "50000",
  4436. // "minimum": "0",
  4437. // "type": "integer"
  4438. // },
  4439. // "metric": {
  4440. // "description": "Numeric columns to include in the report.",
  4441. // "location": "query",
  4442. // "pattern": "[a-zA-Z_]+",
  4443. // "repeated": true,
  4444. // "type": "string"
  4445. // },
  4446. // "sort": {
  4447. // "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.",
  4448. // "location": "query",
  4449. // "pattern": "(\\+|-)?[a-zA-Z_]+",
  4450. // "repeated": true,
  4451. // "type": "string"
  4452. // },
  4453. // "startDate": {
  4454. // "description": "Start of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  4455. // "location": "query",
  4456. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  4457. // "required": true,
  4458. // "type": "string"
  4459. // },
  4460. // "startIndex": {
  4461. // "description": "Index of the first row of report data to return.",
  4462. // "format": "uint32",
  4463. // "location": "query",
  4464. // "maximum": "5000",
  4465. // "minimum": "0",
  4466. // "type": "integer"
  4467. // }
  4468. // },
  4469. // "path": "reports",
  4470. // "response": {
  4471. // "$ref": "Report"
  4472. // },
  4473. // "scopes": [
  4474. // "https://www.googleapis.com/auth/adsensehost"
  4475. // ]
  4476. // }
  4477. }
  4478. // method id "adsensehost.urlchannels.delete":
  4479. type UrlchannelsDeleteCall struct {
  4480. s *Service
  4481. adClientId string
  4482. urlChannelId string
  4483. urlParams_ gensupport.URLParams
  4484. ctx_ context.Context
  4485. header_ http.Header
  4486. }
  4487. // Delete: Delete a URL channel from the host AdSense account.
  4488. func (r *UrlchannelsService) Delete(adClientId string, urlChannelId string) *UrlchannelsDeleteCall {
  4489. c := &UrlchannelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4490. c.adClientId = adClientId
  4491. c.urlChannelId = urlChannelId
  4492. return c
  4493. }
  4494. // Fields allows partial responses to be retrieved. See
  4495. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4496. // for more information.
  4497. func (c *UrlchannelsDeleteCall) Fields(s ...googleapi.Field) *UrlchannelsDeleteCall {
  4498. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4499. return c
  4500. }
  4501. // Context sets the context to be used in this call's Do method. Any
  4502. // pending HTTP request will be aborted if the provided context is
  4503. // canceled.
  4504. func (c *UrlchannelsDeleteCall) Context(ctx context.Context) *UrlchannelsDeleteCall {
  4505. c.ctx_ = ctx
  4506. return c
  4507. }
  4508. // Header returns an http.Header that can be modified by the caller to
  4509. // add HTTP headers to the request.
  4510. func (c *UrlchannelsDeleteCall) Header() http.Header {
  4511. if c.header_ == nil {
  4512. c.header_ = make(http.Header)
  4513. }
  4514. return c.header_
  4515. }
  4516. func (c *UrlchannelsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4517. reqHeaders := make(http.Header)
  4518. for k, v := range c.header_ {
  4519. reqHeaders[k] = v
  4520. }
  4521. reqHeaders.Set("User-Agent", c.s.userAgent())
  4522. var body io.Reader = nil
  4523. c.urlParams_.Set("alt", alt)
  4524. c.urlParams_.Set("prettyPrint", "false")
  4525. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/urlchannels/{urlChannelId}")
  4526. urls += "?" + c.urlParams_.Encode()
  4527. req, err := http.NewRequest("DELETE", urls, body)
  4528. if err != nil {
  4529. return nil, err
  4530. }
  4531. req.Header = reqHeaders
  4532. googleapi.Expand(req.URL, map[string]string{
  4533. "adClientId": c.adClientId,
  4534. "urlChannelId": c.urlChannelId,
  4535. })
  4536. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4537. }
  4538. // Do executes the "adsensehost.urlchannels.delete" call.
  4539. // Exactly one of *UrlChannel or error will be non-nil. Any non-2xx
  4540. // status code is an error. Response headers are in either
  4541. // *UrlChannel.ServerResponse.Header or (if a response was returned at
  4542. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4543. // to check whether the returned error was because
  4544. // http.StatusNotModified was returned.
  4545. func (c *UrlchannelsDeleteCall) Do(opts ...googleapi.CallOption) (*UrlChannel, error) {
  4546. gensupport.SetOptions(c.urlParams_, opts...)
  4547. res, err := c.doRequest("json")
  4548. if res != nil && res.StatusCode == http.StatusNotModified {
  4549. if res.Body != nil {
  4550. res.Body.Close()
  4551. }
  4552. return nil, &googleapi.Error{
  4553. Code: res.StatusCode,
  4554. Header: res.Header,
  4555. }
  4556. }
  4557. if err != nil {
  4558. return nil, err
  4559. }
  4560. defer googleapi.CloseBody(res)
  4561. if err := googleapi.CheckResponse(res); err != nil {
  4562. return nil, err
  4563. }
  4564. ret := &UrlChannel{
  4565. ServerResponse: googleapi.ServerResponse{
  4566. Header: res.Header,
  4567. HTTPStatusCode: res.StatusCode,
  4568. },
  4569. }
  4570. target := &ret
  4571. if err := gensupport.DecodeResponse(target, res); err != nil {
  4572. return nil, err
  4573. }
  4574. return ret, nil
  4575. // {
  4576. // "description": "Delete a URL channel from the host AdSense account.",
  4577. // "httpMethod": "DELETE",
  4578. // "id": "adsensehost.urlchannels.delete",
  4579. // "parameterOrder": [
  4580. // "adClientId",
  4581. // "urlChannelId"
  4582. // ],
  4583. // "parameters": {
  4584. // "adClientId": {
  4585. // "description": "Ad client from which to delete the URL channel.",
  4586. // "location": "path",
  4587. // "required": true,
  4588. // "type": "string"
  4589. // },
  4590. // "urlChannelId": {
  4591. // "description": "URL channel to delete.",
  4592. // "location": "path",
  4593. // "required": true,
  4594. // "type": "string"
  4595. // }
  4596. // },
  4597. // "path": "adclients/{adClientId}/urlchannels/{urlChannelId}",
  4598. // "response": {
  4599. // "$ref": "UrlChannel"
  4600. // },
  4601. // "scopes": [
  4602. // "https://www.googleapis.com/auth/adsensehost"
  4603. // ]
  4604. // }
  4605. }
  4606. // method id "adsensehost.urlchannels.insert":
  4607. type UrlchannelsInsertCall struct {
  4608. s *Service
  4609. adClientId string
  4610. urlchannel *UrlChannel
  4611. urlParams_ gensupport.URLParams
  4612. ctx_ context.Context
  4613. header_ http.Header
  4614. }
  4615. // Insert: Add a new URL channel to the host AdSense account.
  4616. func (r *UrlchannelsService) Insert(adClientId string, urlchannel *UrlChannel) *UrlchannelsInsertCall {
  4617. c := &UrlchannelsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4618. c.adClientId = adClientId
  4619. c.urlchannel = urlchannel
  4620. return c
  4621. }
  4622. // Fields allows partial responses to be retrieved. See
  4623. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4624. // for more information.
  4625. func (c *UrlchannelsInsertCall) Fields(s ...googleapi.Field) *UrlchannelsInsertCall {
  4626. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4627. return c
  4628. }
  4629. // Context sets the context to be used in this call's Do method. Any
  4630. // pending HTTP request will be aborted if the provided context is
  4631. // canceled.
  4632. func (c *UrlchannelsInsertCall) Context(ctx context.Context) *UrlchannelsInsertCall {
  4633. c.ctx_ = ctx
  4634. return c
  4635. }
  4636. // Header returns an http.Header that can be modified by the caller to
  4637. // add HTTP headers to the request.
  4638. func (c *UrlchannelsInsertCall) Header() http.Header {
  4639. if c.header_ == nil {
  4640. c.header_ = make(http.Header)
  4641. }
  4642. return c.header_
  4643. }
  4644. func (c *UrlchannelsInsertCall) doRequest(alt string) (*http.Response, error) {
  4645. reqHeaders := make(http.Header)
  4646. for k, v := range c.header_ {
  4647. reqHeaders[k] = v
  4648. }
  4649. reqHeaders.Set("User-Agent", c.s.userAgent())
  4650. var body io.Reader = nil
  4651. body, err := googleapi.WithoutDataWrapper.JSONReader(c.urlchannel)
  4652. if err != nil {
  4653. return nil, err
  4654. }
  4655. reqHeaders.Set("Content-Type", "application/json")
  4656. c.urlParams_.Set("alt", alt)
  4657. c.urlParams_.Set("prettyPrint", "false")
  4658. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/urlchannels")
  4659. urls += "?" + c.urlParams_.Encode()
  4660. req, err := http.NewRequest("POST", urls, body)
  4661. if err != nil {
  4662. return nil, err
  4663. }
  4664. req.Header = reqHeaders
  4665. googleapi.Expand(req.URL, map[string]string{
  4666. "adClientId": c.adClientId,
  4667. })
  4668. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4669. }
  4670. // Do executes the "adsensehost.urlchannels.insert" call.
  4671. // Exactly one of *UrlChannel or error will be non-nil. Any non-2xx
  4672. // status code is an error. Response headers are in either
  4673. // *UrlChannel.ServerResponse.Header or (if a response was returned at
  4674. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4675. // to check whether the returned error was because
  4676. // http.StatusNotModified was returned.
  4677. func (c *UrlchannelsInsertCall) Do(opts ...googleapi.CallOption) (*UrlChannel, error) {
  4678. gensupport.SetOptions(c.urlParams_, opts...)
  4679. res, err := c.doRequest("json")
  4680. if res != nil && res.StatusCode == http.StatusNotModified {
  4681. if res.Body != nil {
  4682. res.Body.Close()
  4683. }
  4684. return nil, &googleapi.Error{
  4685. Code: res.StatusCode,
  4686. Header: res.Header,
  4687. }
  4688. }
  4689. if err != nil {
  4690. return nil, err
  4691. }
  4692. defer googleapi.CloseBody(res)
  4693. if err := googleapi.CheckResponse(res); err != nil {
  4694. return nil, err
  4695. }
  4696. ret := &UrlChannel{
  4697. ServerResponse: googleapi.ServerResponse{
  4698. Header: res.Header,
  4699. HTTPStatusCode: res.StatusCode,
  4700. },
  4701. }
  4702. target := &ret
  4703. if err := gensupport.DecodeResponse(target, res); err != nil {
  4704. return nil, err
  4705. }
  4706. return ret, nil
  4707. // {
  4708. // "description": "Add a new URL channel to the host AdSense account.",
  4709. // "httpMethod": "POST",
  4710. // "id": "adsensehost.urlchannels.insert",
  4711. // "parameterOrder": [
  4712. // "adClientId"
  4713. // ],
  4714. // "parameters": {
  4715. // "adClientId": {
  4716. // "description": "Ad client to which the new URL channel will be added.",
  4717. // "location": "path",
  4718. // "required": true,
  4719. // "type": "string"
  4720. // }
  4721. // },
  4722. // "path": "adclients/{adClientId}/urlchannels",
  4723. // "request": {
  4724. // "$ref": "UrlChannel"
  4725. // },
  4726. // "response": {
  4727. // "$ref": "UrlChannel"
  4728. // },
  4729. // "scopes": [
  4730. // "https://www.googleapis.com/auth/adsensehost"
  4731. // ]
  4732. // }
  4733. }
  4734. // method id "adsensehost.urlchannels.list":
  4735. type UrlchannelsListCall struct {
  4736. s *Service
  4737. adClientId string
  4738. urlParams_ gensupport.URLParams
  4739. ifNoneMatch_ string
  4740. ctx_ context.Context
  4741. header_ http.Header
  4742. }
  4743. // List: List all host URL channels in the host AdSense account.
  4744. func (r *UrlchannelsService) List(adClientId string) *UrlchannelsListCall {
  4745. c := &UrlchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4746. c.adClientId = adClientId
  4747. return c
  4748. }
  4749. // MaxResults sets the optional parameter "maxResults": The maximum
  4750. // number of URL channels to include in the response, used for paging.
  4751. func (c *UrlchannelsListCall) MaxResults(maxResults int64) *UrlchannelsListCall {
  4752. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4753. return c
  4754. }
  4755. // PageToken sets the optional parameter "pageToken": A continuation
  4756. // token, used to page through URL channels. To retrieve the next page,
  4757. // set this parameter to the value of "nextPageToken" from the previous
  4758. // response.
  4759. func (c *UrlchannelsListCall) PageToken(pageToken string) *UrlchannelsListCall {
  4760. c.urlParams_.Set("pageToken", pageToken)
  4761. return c
  4762. }
  4763. // Fields allows partial responses to be retrieved. See
  4764. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4765. // for more information.
  4766. func (c *UrlchannelsListCall) Fields(s ...googleapi.Field) *UrlchannelsListCall {
  4767. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4768. return c
  4769. }
  4770. // IfNoneMatch sets the optional parameter which makes the operation
  4771. // fail if the object's ETag matches the given value. This is useful for
  4772. // getting updates only after the object has changed since the last
  4773. // request. Use googleapi.IsNotModified to check whether the response
  4774. // error from Do is the result of In-None-Match.
  4775. func (c *UrlchannelsListCall) IfNoneMatch(entityTag string) *UrlchannelsListCall {
  4776. c.ifNoneMatch_ = entityTag
  4777. return c
  4778. }
  4779. // Context sets the context to be used in this call's Do method. Any
  4780. // pending HTTP request will be aborted if the provided context is
  4781. // canceled.
  4782. func (c *UrlchannelsListCall) Context(ctx context.Context) *UrlchannelsListCall {
  4783. c.ctx_ = ctx
  4784. return c
  4785. }
  4786. // Header returns an http.Header that can be modified by the caller to
  4787. // add HTTP headers to the request.
  4788. func (c *UrlchannelsListCall) Header() http.Header {
  4789. if c.header_ == nil {
  4790. c.header_ = make(http.Header)
  4791. }
  4792. return c.header_
  4793. }
  4794. func (c *UrlchannelsListCall) doRequest(alt string) (*http.Response, error) {
  4795. reqHeaders := make(http.Header)
  4796. for k, v := range c.header_ {
  4797. reqHeaders[k] = v
  4798. }
  4799. reqHeaders.Set("User-Agent", c.s.userAgent())
  4800. if c.ifNoneMatch_ != "" {
  4801. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4802. }
  4803. var body io.Reader = nil
  4804. c.urlParams_.Set("alt", alt)
  4805. c.urlParams_.Set("prettyPrint", "false")
  4806. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/urlchannels")
  4807. urls += "?" + c.urlParams_.Encode()
  4808. req, err := http.NewRequest("GET", urls, body)
  4809. if err != nil {
  4810. return nil, err
  4811. }
  4812. req.Header = reqHeaders
  4813. googleapi.Expand(req.URL, map[string]string{
  4814. "adClientId": c.adClientId,
  4815. })
  4816. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4817. }
  4818. // Do executes the "adsensehost.urlchannels.list" call.
  4819. // Exactly one of *UrlChannels or error will be non-nil. Any non-2xx
  4820. // status code is an error. Response headers are in either
  4821. // *UrlChannels.ServerResponse.Header or (if a response was returned at
  4822. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4823. // to check whether the returned error was because
  4824. // http.StatusNotModified was returned.
  4825. func (c *UrlchannelsListCall) Do(opts ...googleapi.CallOption) (*UrlChannels, error) {
  4826. gensupport.SetOptions(c.urlParams_, opts...)
  4827. res, err := c.doRequest("json")
  4828. if res != nil && res.StatusCode == http.StatusNotModified {
  4829. if res.Body != nil {
  4830. res.Body.Close()
  4831. }
  4832. return nil, &googleapi.Error{
  4833. Code: res.StatusCode,
  4834. Header: res.Header,
  4835. }
  4836. }
  4837. if err != nil {
  4838. return nil, err
  4839. }
  4840. defer googleapi.CloseBody(res)
  4841. if err := googleapi.CheckResponse(res); err != nil {
  4842. return nil, err
  4843. }
  4844. ret := &UrlChannels{
  4845. ServerResponse: googleapi.ServerResponse{
  4846. Header: res.Header,
  4847. HTTPStatusCode: res.StatusCode,
  4848. },
  4849. }
  4850. target := &ret
  4851. if err := gensupport.DecodeResponse(target, res); err != nil {
  4852. return nil, err
  4853. }
  4854. return ret, nil
  4855. // {
  4856. // "description": "List all host URL channels in the host AdSense account.",
  4857. // "httpMethod": "GET",
  4858. // "id": "adsensehost.urlchannels.list",
  4859. // "parameterOrder": [
  4860. // "adClientId"
  4861. // ],
  4862. // "parameters": {
  4863. // "adClientId": {
  4864. // "description": "Ad client for which to list URL channels.",
  4865. // "location": "path",
  4866. // "required": true,
  4867. // "type": "string"
  4868. // },
  4869. // "maxResults": {
  4870. // "description": "The maximum number of URL channels to include in the response, used for paging.",
  4871. // "format": "uint32",
  4872. // "location": "query",
  4873. // "maximum": "10000",
  4874. // "minimum": "0",
  4875. // "type": "integer"
  4876. // },
  4877. // "pageToken": {
  4878. // "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.",
  4879. // "location": "query",
  4880. // "type": "string"
  4881. // }
  4882. // },
  4883. // "path": "adclients/{adClientId}/urlchannels",
  4884. // "response": {
  4885. // "$ref": "UrlChannels"
  4886. // },
  4887. // "scopes": [
  4888. // "https://www.googleapis.com/auth/adsensehost"
  4889. // ]
  4890. // }
  4891. }
  4892. // Pages invokes f for each page of results.
  4893. // A non-nil error returned from f will halt the iteration.
  4894. // The provided context supersedes any context provided to the Context method.
  4895. func (c *UrlchannelsListCall) Pages(ctx context.Context, f func(*UrlChannels) error) error {
  4896. c.ctx_ = ctx
  4897. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4898. for {
  4899. x, err := c.Do()
  4900. if err != nil {
  4901. return err
  4902. }
  4903. if err := f(x); err != nil {
  4904. return err
  4905. }
  4906. if x.NextPageToken == "" {
  4907. return nil
  4908. }
  4909. c.PageToken(x.NextPageToken)
  4910. }
  4911. }