選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

5232 行
170 KiB

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