You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2836 rivejä
95 KiB

  1. // Copyright 2018 Google Inc. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // AUTO-GENERATED CODE. DO NOT EDIT.
  5. // Package adexchangeseller provides access to the Ad Exchange Seller API.
  6. //
  7. // See https://developers.google.com/ad-exchange/seller-rest/
  8. //
  9. // Usage example:
  10. //
  11. // import "google.golang.org/api/adexchangeseller/v1"
  12. // ...
  13. // adexchangesellerService, err := adexchangeseller.New(oauthHttpClient)
  14. package adexchangeseller // import "google.golang.org/api/adexchangeseller/v1"
  15. import (
  16. "bytes"
  17. "context"
  18. "encoding/json"
  19. "errors"
  20. "fmt"
  21. "io"
  22. "net/http"
  23. "net/url"
  24. "strconv"
  25. "strings"
  26. gensupport "google.golang.org/api/gensupport"
  27. googleapi "google.golang.org/api/googleapi"
  28. )
  29. // Always reference these packages, just in case the auto-generated code
  30. // below doesn't.
  31. var _ = bytes.NewBuffer
  32. var _ = strconv.Itoa
  33. var _ = fmt.Sprintf
  34. var _ = json.NewDecoder
  35. var _ = io.Copy
  36. var _ = url.Parse
  37. var _ = gensupport.MarshalJSON
  38. var _ = googleapi.Version
  39. var _ = errors.New
  40. var _ = strings.Replace
  41. var _ = context.Canceled
  42. const apiId = "adexchangeseller:v1"
  43. const apiName = "adexchangeseller"
  44. const apiVersion = "v1"
  45. const basePath = "https://www.googleapis.com/adexchangeseller/v1/"
  46. // OAuth2 scopes used by this API.
  47. const (
  48. // View and manage your Ad Exchange data
  49. AdexchangeSellerScope = "https://www.googleapis.com/auth/adexchange.seller"
  50. // View your Ad Exchange data
  51. AdexchangeSellerReadonlyScope = "https://www.googleapis.com/auth/adexchange.seller.readonly"
  52. )
  53. func New(client *http.Client) (*Service, error) {
  54. if client == nil {
  55. return nil, errors.New("client is nil")
  56. }
  57. s := &Service{client: client, BasePath: basePath}
  58. s.Adclients = NewAdclientsService(s)
  59. s.Adunits = NewAdunitsService(s)
  60. s.Customchannels = NewCustomchannelsService(s)
  61. s.Reports = NewReportsService(s)
  62. s.Urlchannels = NewUrlchannelsService(s)
  63. return s, nil
  64. }
  65. type Service struct {
  66. client *http.Client
  67. BasePath string // API endpoint base URL
  68. UserAgent string // optional additional User-Agent fragment
  69. Adclients *AdclientsService
  70. Adunits *AdunitsService
  71. Customchannels *CustomchannelsService
  72. Reports *ReportsService
  73. Urlchannels *UrlchannelsService
  74. }
  75. func (s *Service) userAgent() string {
  76. if s.UserAgent == "" {
  77. return googleapi.UserAgent
  78. }
  79. return googleapi.UserAgent + " " + s.UserAgent
  80. }
  81. func NewAdclientsService(s *Service) *AdclientsService {
  82. rs := &AdclientsService{s: s}
  83. return rs
  84. }
  85. type AdclientsService struct {
  86. s *Service
  87. }
  88. func NewAdunitsService(s *Service) *AdunitsService {
  89. rs := &AdunitsService{s: s}
  90. rs.Customchannels = NewAdunitsCustomchannelsService(s)
  91. return rs
  92. }
  93. type AdunitsService struct {
  94. s *Service
  95. Customchannels *AdunitsCustomchannelsService
  96. }
  97. func NewAdunitsCustomchannelsService(s *Service) *AdunitsCustomchannelsService {
  98. rs := &AdunitsCustomchannelsService{s: s}
  99. return rs
  100. }
  101. type AdunitsCustomchannelsService struct {
  102. s *Service
  103. }
  104. func NewCustomchannelsService(s *Service) *CustomchannelsService {
  105. rs := &CustomchannelsService{s: s}
  106. rs.Adunits = NewCustomchannelsAdunitsService(s)
  107. return rs
  108. }
  109. type CustomchannelsService struct {
  110. s *Service
  111. Adunits *CustomchannelsAdunitsService
  112. }
  113. func NewCustomchannelsAdunitsService(s *Service) *CustomchannelsAdunitsService {
  114. rs := &CustomchannelsAdunitsService{s: s}
  115. return rs
  116. }
  117. type CustomchannelsAdunitsService struct {
  118. s *Service
  119. }
  120. func NewReportsService(s *Service) *ReportsService {
  121. rs := &ReportsService{s: s}
  122. rs.Saved = NewReportsSavedService(s)
  123. return rs
  124. }
  125. type ReportsService struct {
  126. s *Service
  127. Saved *ReportsSavedService
  128. }
  129. func NewReportsSavedService(s *Service) *ReportsSavedService {
  130. rs := &ReportsSavedService{s: s}
  131. return rs
  132. }
  133. type ReportsSavedService struct {
  134. s *Service
  135. }
  136. func NewUrlchannelsService(s *Service) *UrlchannelsService {
  137. rs := &UrlchannelsService{s: s}
  138. return rs
  139. }
  140. type UrlchannelsService struct {
  141. s *Service
  142. }
  143. type AdClient struct {
  144. // ArcOptIn: Whether this ad client is opted in to ARC.
  145. ArcOptIn bool `json:"arcOptIn,omitempty"`
  146. // Id: Unique identifier of this ad client.
  147. Id string `json:"id,omitempty"`
  148. // Kind: Kind of resource this is, in this case
  149. // adexchangeseller#adClient.
  150. Kind string `json:"kind,omitempty"`
  151. // ProductCode: This ad client's product code, which corresponds to the
  152. // PRODUCT_CODE report dimension.
  153. ProductCode string `json:"productCode,omitempty"`
  154. // SupportsReporting: Whether this ad client supports being reported on.
  155. SupportsReporting bool `json:"supportsReporting,omitempty"`
  156. // ForceSendFields is a list of field names (e.g. "ArcOptIn") to
  157. // unconditionally include in API requests. By default, fields with
  158. // empty values are omitted from API requests. However, any non-pointer,
  159. // non-interface field appearing in ForceSendFields will be sent to the
  160. // server regardless of whether the field is empty or not. This may be
  161. // used to include empty fields in Patch requests.
  162. ForceSendFields []string `json:"-"`
  163. // NullFields is a list of field names (e.g. "ArcOptIn") to include in
  164. // API requests with the JSON null value. By default, fields with empty
  165. // values are omitted from API requests. However, any field with an
  166. // empty value appearing in NullFields will be sent to the server as
  167. // null. It is an error if a field in this list has a non-empty value.
  168. // This may be used to include null fields in Patch requests.
  169. NullFields []string `json:"-"`
  170. }
  171. func (s *AdClient) MarshalJSON() ([]byte, error) {
  172. type NoMethod AdClient
  173. raw := NoMethod(*s)
  174. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  175. }
  176. type AdClients struct {
  177. // Etag: ETag of this response for caching purposes.
  178. Etag string `json:"etag,omitempty"`
  179. // Items: The ad clients returned in this list response.
  180. Items []*AdClient `json:"items,omitempty"`
  181. // Kind: Kind of list this is, in this case adexchangeseller#adClients.
  182. Kind string `json:"kind,omitempty"`
  183. // NextPageToken: Continuation token used to page through ad clients. To
  184. // retrieve the next page of results, set the next request's "pageToken"
  185. // value to this.
  186. NextPageToken string `json:"nextPageToken,omitempty"`
  187. // ServerResponse contains the HTTP response code and headers from the
  188. // server.
  189. googleapi.ServerResponse `json:"-"`
  190. // ForceSendFields is a list of field names (e.g. "Etag") to
  191. // unconditionally include in API requests. By default, fields with
  192. // empty values are omitted from API requests. However, any non-pointer,
  193. // non-interface field appearing in ForceSendFields will be sent to the
  194. // server regardless of whether the field is empty or not. This may be
  195. // used to include empty fields in Patch requests.
  196. ForceSendFields []string `json:"-"`
  197. // NullFields is a list of field names (e.g. "Etag") to include in API
  198. // requests with the JSON null value. By default, fields with empty
  199. // values are omitted from API requests. However, any field with an
  200. // empty value appearing in NullFields will be sent to the server as
  201. // null. It is an error if a field in this list has a non-empty value.
  202. // This may be used to include null fields in Patch requests.
  203. NullFields []string `json:"-"`
  204. }
  205. func (s *AdClients) MarshalJSON() ([]byte, error) {
  206. type NoMethod AdClients
  207. raw := NoMethod(*s)
  208. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  209. }
  210. type AdUnit struct {
  211. // Code: Identity code of this ad unit, not necessarily unique across ad
  212. // clients.
  213. Code string `json:"code,omitempty"`
  214. // Id: Unique identifier of this ad unit. This should be considered an
  215. // opaque identifier; it is not safe to rely on it being in any
  216. // particular format.
  217. Id string `json:"id,omitempty"`
  218. // Kind: Kind of resource this is, in this case adexchangeseller#adUnit.
  219. Kind string `json:"kind,omitempty"`
  220. // Name: Name of this ad unit.
  221. Name string `json:"name,omitempty"`
  222. // Status: Status of this ad unit. Possible values are:
  223. // NEW: Indicates that the ad unit was created within the last seven
  224. // days and does not yet have any activity associated with it.
  225. //
  226. // ACTIVE: Indicates that there has been activity on this ad unit in the
  227. // last seven days.
  228. //
  229. // INACTIVE: Indicates that there has been no activity on this ad unit
  230. // in the last seven days.
  231. Status string `json:"status,omitempty"`
  232. // ServerResponse contains the HTTP response code and headers from the
  233. // server.
  234. googleapi.ServerResponse `json:"-"`
  235. // ForceSendFields is a list of field names (e.g. "Code") to
  236. // unconditionally include in API requests. By default, fields with
  237. // empty values are omitted from API requests. However, any non-pointer,
  238. // non-interface field appearing in ForceSendFields will be sent to the
  239. // server regardless of whether the field is empty or not. This may be
  240. // used to include empty fields in Patch requests.
  241. ForceSendFields []string `json:"-"`
  242. // NullFields is a list of field names (e.g. "Code") to include in API
  243. // requests with the JSON null value. By default, fields with empty
  244. // values are omitted from API requests. However, any field with an
  245. // empty value appearing in NullFields will be sent to the server as
  246. // null. It is an error if a field in this list has a non-empty value.
  247. // This may be used to include null fields in Patch requests.
  248. NullFields []string `json:"-"`
  249. }
  250. func (s *AdUnit) MarshalJSON() ([]byte, error) {
  251. type NoMethod AdUnit
  252. raw := NoMethod(*s)
  253. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  254. }
  255. type AdUnits struct {
  256. // Etag: ETag of this response for caching purposes.
  257. Etag string `json:"etag,omitempty"`
  258. // Items: The ad units returned in this list response.
  259. Items []*AdUnit `json:"items,omitempty"`
  260. // Kind: Kind of list this is, in this case adexchangeseller#adUnits.
  261. Kind string `json:"kind,omitempty"`
  262. // NextPageToken: Continuation token used to page through ad units. To
  263. // retrieve the next page of results, set the next request's "pageToken"
  264. // value to this.
  265. NextPageToken string `json:"nextPageToken,omitempty"`
  266. // ServerResponse contains the HTTP response code and headers from the
  267. // server.
  268. googleapi.ServerResponse `json:"-"`
  269. // ForceSendFields is a list of field names (e.g. "Etag") to
  270. // unconditionally include in API requests. By default, fields with
  271. // empty values are omitted from API requests. However, any non-pointer,
  272. // non-interface field appearing in ForceSendFields will be sent to the
  273. // server regardless of whether the field is empty or not. This may be
  274. // used to include empty fields in Patch requests.
  275. ForceSendFields []string `json:"-"`
  276. // NullFields is a list of field names (e.g. "Etag") to include in API
  277. // requests with the JSON null value. By default, fields with empty
  278. // values are omitted from API requests. However, any field with an
  279. // empty value appearing in NullFields will be sent to the server as
  280. // null. It is an error if a field in this list has a non-empty value.
  281. // This may be used to include null fields in Patch requests.
  282. NullFields []string `json:"-"`
  283. }
  284. func (s *AdUnits) MarshalJSON() ([]byte, error) {
  285. type NoMethod AdUnits
  286. raw := NoMethod(*s)
  287. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  288. }
  289. type CustomChannel struct {
  290. // Code: Code of this custom channel, not necessarily unique across ad
  291. // clients.
  292. Code string `json:"code,omitempty"`
  293. // Id: Unique identifier of this custom channel. This should be
  294. // considered an opaque identifier; it is not safe to rely on it being
  295. // in any particular format.
  296. Id string `json:"id,omitempty"`
  297. // Kind: Kind of resource this is, in this case
  298. // adexchangeseller#customChannel.
  299. Kind string `json:"kind,omitempty"`
  300. // Name: Name of this custom channel.
  301. Name string `json:"name,omitempty"`
  302. // TargetingInfo: The targeting information of this custom channel, if
  303. // activated.
  304. TargetingInfo *CustomChannelTargetingInfo `json:"targetingInfo,omitempty"`
  305. // ServerResponse contains the HTTP response code and headers from the
  306. // server.
  307. googleapi.ServerResponse `json:"-"`
  308. // ForceSendFields is a list of field names (e.g. "Code") to
  309. // unconditionally include in API requests. By default, fields with
  310. // empty values are omitted from API requests. However, any non-pointer,
  311. // non-interface field appearing in ForceSendFields will be sent to the
  312. // server regardless of whether the field is empty or not. This may be
  313. // used to include empty fields in Patch requests.
  314. ForceSendFields []string `json:"-"`
  315. // NullFields is a list of field names (e.g. "Code") to include in API
  316. // requests with the JSON null value. By default, fields with empty
  317. // values are omitted from API requests. However, any field with an
  318. // empty value appearing in NullFields will be sent to the server as
  319. // null. It is an error if a field in this list has a non-empty value.
  320. // This may be used to include null fields in Patch requests.
  321. NullFields []string `json:"-"`
  322. }
  323. func (s *CustomChannel) MarshalJSON() ([]byte, error) {
  324. type NoMethod CustomChannel
  325. raw := NoMethod(*s)
  326. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  327. }
  328. // CustomChannelTargetingInfo: The targeting information of this custom
  329. // channel, if activated.
  330. type CustomChannelTargetingInfo struct {
  331. // AdsAppearOn: The name used to describe this channel externally.
  332. AdsAppearOn string `json:"adsAppearOn,omitempty"`
  333. // Description: The external description of the channel.
  334. Description string `json:"description,omitempty"`
  335. // Location: The locations in which ads appear. (Only valid for content
  336. // and mobile content ads). Acceptable values for content ads are:
  337. // TOP_LEFT, TOP_CENTER, TOP_RIGHT, MIDDLE_LEFT, MIDDLE_CENTER,
  338. // MIDDLE_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT,
  339. // MULTIPLE_LOCATIONS. Acceptable values for mobile content ads are:
  340. // TOP, MIDDLE, BOTTOM, MULTIPLE_LOCATIONS.
  341. Location string `json:"location,omitempty"`
  342. // SiteLanguage: The language of the sites ads will be displayed on.
  343. SiteLanguage string `json:"siteLanguage,omitempty"`
  344. // ForceSendFields is a list of field names (e.g. "AdsAppearOn") to
  345. // unconditionally include in API requests. By default, fields with
  346. // empty values are omitted from API requests. However, any non-pointer,
  347. // non-interface field appearing in ForceSendFields will be sent to the
  348. // server regardless of whether the field is empty or not. This may be
  349. // used to include empty fields in Patch requests.
  350. ForceSendFields []string `json:"-"`
  351. // NullFields is a list of field names (e.g. "AdsAppearOn") to include
  352. // in API requests with the JSON null value. By default, fields with
  353. // empty values are omitted from API requests. However, any field with
  354. // an empty value appearing in NullFields will be sent to the server as
  355. // null. It is an error if a field in this list has a non-empty value.
  356. // This may be used to include null fields in Patch requests.
  357. NullFields []string `json:"-"`
  358. }
  359. func (s *CustomChannelTargetingInfo) MarshalJSON() ([]byte, error) {
  360. type NoMethod CustomChannelTargetingInfo
  361. raw := NoMethod(*s)
  362. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  363. }
  364. type CustomChannels struct {
  365. // Etag: ETag of this response for caching purposes.
  366. Etag string `json:"etag,omitempty"`
  367. // Items: The custom channels returned in this list response.
  368. Items []*CustomChannel `json:"items,omitempty"`
  369. // Kind: Kind of list this is, in this case
  370. // adexchangeseller#customChannels.
  371. Kind string `json:"kind,omitempty"`
  372. // NextPageToken: Continuation token used to page through custom
  373. // channels. To retrieve the next page of results, set the next
  374. // request's "pageToken" value to this.
  375. NextPageToken string `json:"nextPageToken,omitempty"`
  376. // ServerResponse contains the HTTP response code and headers from the
  377. // server.
  378. googleapi.ServerResponse `json:"-"`
  379. // ForceSendFields is a list of field names (e.g. "Etag") to
  380. // unconditionally include in API requests. By default, fields with
  381. // empty values are omitted from API requests. However, any non-pointer,
  382. // non-interface field appearing in ForceSendFields will be sent to the
  383. // server regardless of whether the field is empty or not. This may be
  384. // used to include empty fields in Patch requests.
  385. ForceSendFields []string `json:"-"`
  386. // NullFields is a list of field names (e.g. "Etag") to include in API
  387. // requests with the JSON null value. By default, fields with empty
  388. // values are omitted from API requests. However, any field with an
  389. // empty value appearing in NullFields will be sent to the server as
  390. // null. It is an error if a field in this list has a non-empty value.
  391. // This may be used to include null fields in Patch requests.
  392. NullFields []string `json:"-"`
  393. }
  394. func (s *CustomChannels) MarshalJSON() ([]byte, error) {
  395. type NoMethod CustomChannels
  396. raw := NoMethod(*s)
  397. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  398. }
  399. type Report struct {
  400. // Averages: The averages of the report. This is the same length as any
  401. // other row in the report; cells corresponding to dimension columns are
  402. // empty.
  403. Averages []string `json:"averages,omitempty"`
  404. // Headers: The header information of the columns requested in the
  405. // report. This is a list of headers; one for each dimension in the
  406. // request, followed by one for each metric in the request.
  407. Headers []*ReportHeaders `json:"headers,omitempty"`
  408. // Kind: Kind this is, in this case adexchangeseller#report.
  409. Kind string `json:"kind,omitempty"`
  410. // Rows: The output rows of the report. Each row is a list of cells; one
  411. // for each dimension in the request, followed by one for each metric in
  412. // the request. The dimension cells contain strings, and the metric
  413. // cells contain numbers.
  414. Rows [][]string `json:"rows,omitempty"`
  415. // TotalMatchedRows: The total number of rows matched by the report
  416. // request. Fewer rows may be returned in the response due to being
  417. // limited by the row count requested or the report row limit.
  418. TotalMatchedRows int64 `json:"totalMatchedRows,omitempty,string"`
  419. // Totals: The totals of the report. This is the same length as any
  420. // other row in the report; cells corresponding to dimension columns are
  421. // empty.
  422. Totals []string `json:"totals,omitempty"`
  423. // Warnings: Any warnings associated with generation of the report.
  424. Warnings []string `json:"warnings,omitempty"`
  425. // ServerResponse contains the HTTP response code and headers from the
  426. // server.
  427. googleapi.ServerResponse `json:"-"`
  428. // ForceSendFields is a list of field names (e.g. "Averages") to
  429. // unconditionally include in API requests. By default, fields with
  430. // empty values are omitted from API requests. However, any non-pointer,
  431. // non-interface field appearing in ForceSendFields will be sent to the
  432. // server regardless of whether the field is empty or not. This may be
  433. // used to include empty fields in Patch requests.
  434. ForceSendFields []string `json:"-"`
  435. // NullFields is a list of field names (e.g. "Averages") to include in
  436. // API requests with the JSON null value. By default, fields with empty
  437. // values are omitted from API requests. However, any field with an
  438. // empty value appearing in NullFields will be sent to the server as
  439. // null. It is an error if a field in this list has a non-empty value.
  440. // This may be used to include null fields in Patch requests.
  441. NullFields []string `json:"-"`
  442. }
  443. func (s *Report) MarshalJSON() ([]byte, error) {
  444. type NoMethod Report
  445. raw := NoMethod(*s)
  446. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  447. }
  448. type ReportHeaders struct {
  449. // Currency: The currency of this column. Only present if the header
  450. // type is METRIC_CURRENCY.
  451. Currency string `json:"currency,omitempty"`
  452. // Name: The name of the header.
  453. Name string `json:"name,omitempty"`
  454. // Type: The type of the header; one of DIMENSION, METRIC_TALLY,
  455. // METRIC_RATIO, or METRIC_CURRENCY.
  456. Type string `json:"type,omitempty"`
  457. // ForceSendFields is a list of field names (e.g. "Currency") to
  458. // unconditionally include in API requests. By default, fields with
  459. // empty values are omitted from API requests. However, any non-pointer,
  460. // non-interface field appearing in ForceSendFields will be sent to the
  461. // server regardless of whether the field is empty or not. This may be
  462. // used to include empty fields in Patch requests.
  463. ForceSendFields []string `json:"-"`
  464. // NullFields is a list of field names (e.g. "Currency") to include in
  465. // API requests with the JSON null value. By default, fields with empty
  466. // values are omitted from API requests. However, any field with an
  467. // empty value appearing in NullFields will be sent to the server as
  468. // null. It is an error if a field in this list has a non-empty value.
  469. // This may be used to include null fields in Patch requests.
  470. NullFields []string `json:"-"`
  471. }
  472. func (s *ReportHeaders) MarshalJSON() ([]byte, error) {
  473. type NoMethod ReportHeaders
  474. raw := NoMethod(*s)
  475. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  476. }
  477. type SavedReport struct {
  478. // Id: Unique identifier of this saved report.
  479. Id string `json:"id,omitempty"`
  480. // Kind: Kind of resource this is, in this case
  481. // adexchangeseller#savedReport.
  482. Kind string `json:"kind,omitempty"`
  483. // Name: This saved report's name.
  484. Name string `json:"name,omitempty"`
  485. // ForceSendFields is a list of field names (e.g. "Id") to
  486. // unconditionally include in API requests. By default, fields with
  487. // empty values are omitted from API requests. However, any non-pointer,
  488. // non-interface field appearing in ForceSendFields will be sent to the
  489. // server regardless of whether the field is empty or not. This may be
  490. // used to include empty fields in Patch requests.
  491. ForceSendFields []string `json:"-"`
  492. // NullFields is a list of field names (e.g. "Id") to include in API
  493. // requests with the JSON null value. By default, fields with empty
  494. // values are omitted from API requests. However, any field with an
  495. // empty value appearing in NullFields will be sent to the server as
  496. // null. It is an error if a field in this list has a non-empty value.
  497. // This may be used to include null fields in Patch requests.
  498. NullFields []string `json:"-"`
  499. }
  500. func (s *SavedReport) MarshalJSON() ([]byte, error) {
  501. type NoMethod SavedReport
  502. raw := NoMethod(*s)
  503. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  504. }
  505. type SavedReports struct {
  506. // Etag: ETag of this response for caching purposes.
  507. Etag string `json:"etag,omitempty"`
  508. // Items: The saved reports returned in this list response.
  509. Items []*SavedReport `json:"items,omitempty"`
  510. // Kind: Kind of list this is, in this case
  511. // adexchangeseller#savedReports.
  512. Kind string `json:"kind,omitempty"`
  513. // NextPageToken: Continuation token used to page through saved reports.
  514. // To retrieve the next page of results, set the next request's
  515. // "pageToken" value to this.
  516. NextPageToken string `json:"nextPageToken,omitempty"`
  517. // ServerResponse contains the HTTP response code and headers from the
  518. // server.
  519. googleapi.ServerResponse `json:"-"`
  520. // ForceSendFields is a list of field names (e.g. "Etag") to
  521. // unconditionally include in API requests. By default, fields with
  522. // empty values are omitted from API requests. However, any non-pointer,
  523. // non-interface field appearing in ForceSendFields will be sent to the
  524. // server regardless of whether the field is empty or not. This may be
  525. // used to include empty fields in Patch requests.
  526. ForceSendFields []string `json:"-"`
  527. // NullFields is a list of field names (e.g. "Etag") to include in API
  528. // requests with the JSON null value. By default, fields with empty
  529. // values are omitted from API requests. However, any field with an
  530. // empty value appearing in NullFields will be sent to the server as
  531. // null. It is an error if a field in this list has a non-empty value.
  532. // This may be used to include null fields in Patch requests.
  533. NullFields []string `json:"-"`
  534. }
  535. func (s *SavedReports) MarshalJSON() ([]byte, error) {
  536. type NoMethod SavedReports
  537. raw := NoMethod(*s)
  538. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  539. }
  540. type UrlChannel struct {
  541. // Id: Unique identifier of this URL channel. This should be considered
  542. // an opaque identifier; it is not safe to rely on it being in any
  543. // particular format.
  544. Id string `json:"id,omitempty"`
  545. // Kind: Kind of resource this is, in this case
  546. // adexchangeseller#urlChannel.
  547. Kind string `json:"kind,omitempty"`
  548. // UrlPattern: URL Pattern of this URL channel. Does not include
  549. // "http://" or "https://". Example: www.example.com/home
  550. UrlPattern string `json:"urlPattern,omitempty"`
  551. // ForceSendFields is a list of field names (e.g. "Id") to
  552. // unconditionally include in API requests. By default, fields with
  553. // empty values are omitted from API requests. However, any non-pointer,
  554. // non-interface field appearing in ForceSendFields will be sent to the
  555. // server regardless of whether the field is empty or not. This may be
  556. // used to include empty fields in Patch requests.
  557. ForceSendFields []string `json:"-"`
  558. // NullFields is a list of field names (e.g. "Id") to include in API
  559. // requests with the JSON null value. By default, fields with empty
  560. // values are omitted from API requests. However, any field with an
  561. // empty value appearing in NullFields will be sent to the server as
  562. // null. It is an error if a field in this list has a non-empty value.
  563. // This may be used to include null fields in Patch requests.
  564. NullFields []string `json:"-"`
  565. }
  566. func (s *UrlChannel) MarshalJSON() ([]byte, error) {
  567. type NoMethod UrlChannel
  568. raw := NoMethod(*s)
  569. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  570. }
  571. type UrlChannels struct {
  572. // Etag: ETag of this response for caching purposes.
  573. Etag string `json:"etag,omitempty"`
  574. // Items: The URL channels returned in this list response.
  575. Items []*UrlChannel `json:"items,omitempty"`
  576. // Kind: Kind of list this is, in this case
  577. // adexchangeseller#urlChannels.
  578. Kind string `json:"kind,omitempty"`
  579. // NextPageToken: Continuation token used to page through URL channels.
  580. // To retrieve the next page of results, set the next request's
  581. // "pageToken" value to this.
  582. NextPageToken string `json:"nextPageToken,omitempty"`
  583. // ServerResponse contains the HTTP response code and headers from the
  584. // server.
  585. googleapi.ServerResponse `json:"-"`
  586. // ForceSendFields is a list of field names (e.g. "Etag") to
  587. // unconditionally include in API requests. By default, fields with
  588. // empty values are omitted from API requests. However, any non-pointer,
  589. // non-interface field appearing in ForceSendFields will be sent to the
  590. // server regardless of whether the field is empty or not. This may be
  591. // used to include empty fields in Patch requests.
  592. ForceSendFields []string `json:"-"`
  593. // NullFields is a list of field names (e.g. "Etag") to include in API
  594. // requests with the JSON null value. By default, fields with empty
  595. // values are omitted from API requests. However, any field with an
  596. // empty value appearing in NullFields will be sent to the server as
  597. // null. It is an error if a field in this list has a non-empty value.
  598. // This may be used to include null fields in Patch requests.
  599. NullFields []string `json:"-"`
  600. }
  601. func (s *UrlChannels) MarshalJSON() ([]byte, error) {
  602. type NoMethod UrlChannels
  603. raw := NoMethod(*s)
  604. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  605. }
  606. // method id "adexchangeseller.adclients.list":
  607. type AdclientsListCall struct {
  608. s *Service
  609. urlParams_ gensupport.URLParams
  610. ifNoneMatch_ string
  611. ctx_ context.Context
  612. header_ http.Header
  613. }
  614. // List: List all ad clients in this Ad Exchange account.
  615. func (r *AdclientsService) List() *AdclientsListCall {
  616. c := &AdclientsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  617. return c
  618. }
  619. // MaxResults sets the optional parameter "maxResults": The maximum
  620. // number of ad clients to include in the response, used for paging.
  621. func (c *AdclientsListCall) MaxResults(maxResults int64) *AdclientsListCall {
  622. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  623. return c
  624. }
  625. // PageToken sets the optional parameter "pageToken": A continuation
  626. // token, used to page through ad clients. To retrieve the next page,
  627. // set this parameter to the value of "nextPageToken" from the previous
  628. // response.
  629. func (c *AdclientsListCall) PageToken(pageToken string) *AdclientsListCall {
  630. c.urlParams_.Set("pageToken", pageToken)
  631. return c
  632. }
  633. // Fields allows partial responses to be retrieved. See
  634. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  635. // for more information.
  636. func (c *AdclientsListCall) Fields(s ...googleapi.Field) *AdclientsListCall {
  637. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  638. return c
  639. }
  640. // IfNoneMatch sets the optional parameter which makes the operation
  641. // fail if the object's ETag matches the given value. This is useful for
  642. // getting updates only after the object has changed since the last
  643. // request. Use googleapi.IsNotModified to check whether the response
  644. // error from Do is the result of In-None-Match.
  645. func (c *AdclientsListCall) IfNoneMatch(entityTag string) *AdclientsListCall {
  646. c.ifNoneMatch_ = entityTag
  647. return c
  648. }
  649. // Context sets the context to be used in this call's Do method. Any
  650. // pending HTTP request will be aborted if the provided context is
  651. // canceled.
  652. func (c *AdclientsListCall) Context(ctx context.Context) *AdclientsListCall {
  653. c.ctx_ = ctx
  654. return c
  655. }
  656. // Header returns an http.Header that can be modified by the caller to
  657. // add HTTP headers to the request.
  658. func (c *AdclientsListCall) Header() http.Header {
  659. if c.header_ == nil {
  660. c.header_ = make(http.Header)
  661. }
  662. return c.header_
  663. }
  664. func (c *AdclientsListCall) doRequest(alt string) (*http.Response, error) {
  665. reqHeaders := make(http.Header)
  666. for k, v := range c.header_ {
  667. reqHeaders[k] = v
  668. }
  669. reqHeaders.Set("User-Agent", c.s.userAgent())
  670. if c.ifNoneMatch_ != "" {
  671. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  672. }
  673. var body io.Reader = nil
  674. c.urlParams_.Set("alt", alt)
  675. c.urlParams_.Set("prettyPrint", "false")
  676. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients")
  677. urls += "?" + c.urlParams_.Encode()
  678. req, _ := http.NewRequest("GET", urls, body)
  679. req.Header = reqHeaders
  680. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  681. }
  682. // Do executes the "adexchangeseller.adclients.list" call.
  683. // Exactly one of *AdClients or error will be non-nil. Any non-2xx
  684. // status code is an error. Response headers are in either
  685. // *AdClients.ServerResponse.Header or (if a response was returned at
  686. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  687. // to check whether the returned error was because
  688. // http.StatusNotModified was returned.
  689. func (c *AdclientsListCall) Do(opts ...googleapi.CallOption) (*AdClients, error) {
  690. gensupport.SetOptions(c.urlParams_, opts...)
  691. res, err := c.doRequest("json")
  692. if res != nil && res.StatusCode == http.StatusNotModified {
  693. if res.Body != nil {
  694. res.Body.Close()
  695. }
  696. return nil, &googleapi.Error{
  697. Code: res.StatusCode,
  698. Header: res.Header,
  699. }
  700. }
  701. if err != nil {
  702. return nil, err
  703. }
  704. defer googleapi.CloseBody(res)
  705. if err := googleapi.CheckResponse(res); err != nil {
  706. return nil, err
  707. }
  708. ret := &AdClients{
  709. ServerResponse: googleapi.ServerResponse{
  710. Header: res.Header,
  711. HTTPStatusCode: res.StatusCode,
  712. },
  713. }
  714. target := &ret
  715. if err := gensupport.DecodeResponse(target, res); err != nil {
  716. return nil, err
  717. }
  718. return ret, nil
  719. // {
  720. // "description": "List all ad clients in this Ad Exchange account.",
  721. // "httpMethod": "GET",
  722. // "id": "adexchangeseller.adclients.list",
  723. // "parameters": {
  724. // "maxResults": {
  725. // "description": "The maximum number of ad clients to include in the response, used for paging.",
  726. // "format": "uint32",
  727. // "location": "query",
  728. // "maximum": "10000",
  729. // "minimum": "0",
  730. // "type": "integer"
  731. // },
  732. // "pageToken": {
  733. // "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.",
  734. // "location": "query",
  735. // "type": "string"
  736. // }
  737. // },
  738. // "path": "adclients",
  739. // "response": {
  740. // "$ref": "AdClients"
  741. // },
  742. // "scopes": [
  743. // "https://www.googleapis.com/auth/adexchange.seller",
  744. // "https://www.googleapis.com/auth/adexchange.seller.readonly"
  745. // ]
  746. // }
  747. }
  748. // Pages invokes f for each page of results.
  749. // A non-nil error returned from f will halt the iteration.
  750. // The provided context supersedes any context provided to the Context method.
  751. func (c *AdclientsListCall) Pages(ctx context.Context, f func(*AdClients) error) error {
  752. c.ctx_ = ctx
  753. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  754. for {
  755. x, err := c.Do()
  756. if err != nil {
  757. return err
  758. }
  759. if err := f(x); err != nil {
  760. return err
  761. }
  762. if x.NextPageToken == "" {
  763. return nil
  764. }
  765. c.PageToken(x.NextPageToken)
  766. }
  767. }
  768. // method id "adexchangeseller.adunits.get":
  769. type AdunitsGetCall struct {
  770. s *Service
  771. adClientId string
  772. adUnitId string
  773. urlParams_ gensupport.URLParams
  774. ifNoneMatch_ string
  775. ctx_ context.Context
  776. header_ http.Header
  777. }
  778. // Get: Gets the specified ad unit in the specified ad client.
  779. func (r *AdunitsService) Get(adClientId string, adUnitId string) *AdunitsGetCall {
  780. c := &AdunitsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  781. c.adClientId = adClientId
  782. c.adUnitId = adUnitId
  783. return c
  784. }
  785. // Fields allows partial responses to be retrieved. See
  786. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  787. // for more information.
  788. func (c *AdunitsGetCall) Fields(s ...googleapi.Field) *AdunitsGetCall {
  789. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  790. return c
  791. }
  792. // IfNoneMatch sets the optional parameter which makes the operation
  793. // fail if the object's ETag matches the given value. This is useful for
  794. // getting updates only after the object has changed since the last
  795. // request. Use googleapi.IsNotModified to check whether the response
  796. // error from Do is the result of In-None-Match.
  797. func (c *AdunitsGetCall) IfNoneMatch(entityTag string) *AdunitsGetCall {
  798. c.ifNoneMatch_ = entityTag
  799. return c
  800. }
  801. // Context sets the context to be used in this call's Do method. Any
  802. // pending HTTP request will be aborted if the provided context is
  803. // canceled.
  804. func (c *AdunitsGetCall) Context(ctx context.Context) *AdunitsGetCall {
  805. c.ctx_ = ctx
  806. return c
  807. }
  808. // Header returns an http.Header that can be modified by the caller to
  809. // add HTTP headers to the request.
  810. func (c *AdunitsGetCall) Header() http.Header {
  811. if c.header_ == nil {
  812. c.header_ = make(http.Header)
  813. }
  814. return c.header_
  815. }
  816. func (c *AdunitsGetCall) doRequest(alt string) (*http.Response, error) {
  817. reqHeaders := make(http.Header)
  818. for k, v := range c.header_ {
  819. reqHeaders[k] = v
  820. }
  821. reqHeaders.Set("User-Agent", c.s.userAgent())
  822. if c.ifNoneMatch_ != "" {
  823. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  824. }
  825. var body io.Reader = nil
  826. c.urlParams_.Set("alt", alt)
  827. c.urlParams_.Set("prettyPrint", "false")
  828. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/adunits/{adUnitId}")
  829. urls += "?" + c.urlParams_.Encode()
  830. req, _ := http.NewRequest("GET", urls, body)
  831. req.Header = reqHeaders
  832. googleapi.Expand(req.URL, map[string]string{
  833. "adClientId": c.adClientId,
  834. "adUnitId": c.adUnitId,
  835. })
  836. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  837. }
  838. // Do executes the "adexchangeseller.adunits.get" call.
  839. // Exactly one of *AdUnit or error will be non-nil. Any non-2xx status
  840. // code is an error. Response headers are in either
  841. // *AdUnit.ServerResponse.Header or (if a response was returned at all)
  842. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  843. // check whether the returned error was because http.StatusNotModified
  844. // was returned.
  845. func (c *AdunitsGetCall) Do(opts ...googleapi.CallOption) (*AdUnit, error) {
  846. gensupport.SetOptions(c.urlParams_, opts...)
  847. res, err := c.doRequest("json")
  848. if res != nil && res.StatusCode == http.StatusNotModified {
  849. if res.Body != nil {
  850. res.Body.Close()
  851. }
  852. return nil, &googleapi.Error{
  853. Code: res.StatusCode,
  854. Header: res.Header,
  855. }
  856. }
  857. if err != nil {
  858. return nil, err
  859. }
  860. defer googleapi.CloseBody(res)
  861. if err := googleapi.CheckResponse(res); err != nil {
  862. return nil, err
  863. }
  864. ret := &AdUnit{
  865. ServerResponse: googleapi.ServerResponse{
  866. Header: res.Header,
  867. HTTPStatusCode: res.StatusCode,
  868. },
  869. }
  870. target := &ret
  871. if err := gensupport.DecodeResponse(target, res); err != nil {
  872. return nil, err
  873. }
  874. return ret, nil
  875. // {
  876. // "description": "Gets the specified ad unit in the specified ad client.",
  877. // "httpMethod": "GET",
  878. // "id": "adexchangeseller.adunits.get",
  879. // "parameterOrder": [
  880. // "adClientId",
  881. // "adUnitId"
  882. // ],
  883. // "parameters": {
  884. // "adClientId": {
  885. // "description": "Ad client for which to get the ad unit.",
  886. // "location": "path",
  887. // "required": true,
  888. // "type": "string"
  889. // },
  890. // "adUnitId": {
  891. // "description": "Ad unit to retrieve.",
  892. // "location": "path",
  893. // "required": true,
  894. // "type": "string"
  895. // }
  896. // },
  897. // "path": "adclients/{adClientId}/adunits/{adUnitId}",
  898. // "response": {
  899. // "$ref": "AdUnit"
  900. // },
  901. // "scopes": [
  902. // "https://www.googleapis.com/auth/adexchange.seller",
  903. // "https://www.googleapis.com/auth/adexchange.seller.readonly"
  904. // ]
  905. // }
  906. }
  907. // method id "adexchangeseller.adunits.list":
  908. type AdunitsListCall struct {
  909. s *Service
  910. adClientId string
  911. urlParams_ gensupport.URLParams
  912. ifNoneMatch_ string
  913. ctx_ context.Context
  914. header_ http.Header
  915. }
  916. // List: List all ad units in the specified ad client for this Ad
  917. // Exchange account.
  918. func (r *AdunitsService) List(adClientId string) *AdunitsListCall {
  919. c := &AdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  920. c.adClientId = adClientId
  921. return c
  922. }
  923. // IncludeInactive sets the optional parameter "includeInactive":
  924. // Whether to include inactive ad units. Default: true.
  925. func (c *AdunitsListCall) IncludeInactive(includeInactive bool) *AdunitsListCall {
  926. c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive))
  927. return c
  928. }
  929. // MaxResults sets the optional parameter "maxResults": The maximum
  930. // number of ad units to include in the response, used for paging.
  931. func (c *AdunitsListCall) MaxResults(maxResults int64) *AdunitsListCall {
  932. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  933. return c
  934. }
  935. // PageToken sets the optional parameter "pageToken": A continuation
  936. // token, used to page through ad units. To retrieve the next page, set
  937. // this parameter to the value of "nextPageToken" from the previous
  938. // response.
  939. func (c *AdunitsListCall) PageToken(pageToken string) *AdunitsListCall {
  940. c.urlParams_.Set("pageToken", pageToken)
  941. return c
  942. }
  943. // Fields allows partial responses to be retrieved. See
  944. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  945. // for more information.
  946. func (c *AdunitsListCall) Fields(s ...googleapi.Field) *AdunitsListCall {
  947. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  948. return c
  949. }
  950. // IfNoneMatch sets the optional parameter which makes the operation
  951. // fail if the object's ETag matches the given value. This is useful for
  952. // getting updates only after the object has changed since the last
  953. // request. Use googleapi.IsNotModified to check whether the response
  954. // error from Do is the result of In-None-Match.
  955. func (c *AdunitsListCall) IfNoneMatch(entityTag string) *AdunitsListCall {
  956. c.ifNoneMatch_ = entityTag
  957. return c
  958. }
  959. // Context sets the context to be used in this call's Do method. Any
  960. // pending HTTP request will be aborted if the provided context is
  961. // canceled.
  962. func (c *AdunitsListCall) Context(ctx context.Context) *AdunitsListCall {
  963. c.ctx_ = ctx
  964. return c
  965. }
  966. // Header returns an http.Header that can be modified by the caller to
  967. // add HTTP headers to the request.
  968. func (c *AdunitsListCall) Header() http.Header {
  969. if c.header_ == nil {
  970. c.header_ = make(http.Header)
  971. }
  972. return c.header_
  973. }
  974. func (c *AdunitsListCall) doRequest(alt string) (*http.Response, error) {
  975. reqHeaders := make(http.Header)
  976. for k, v := range c.header_ {
  977. reqHeaders[k] = v
  978. }
  979. reqHeaders.Set("User-Agent", c.s.userAgent())
  980. if c.ifNoneMatch_ != "" {
  981. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  982. }
  983. var body io.Reader = nil
  984. c.urlParams_.Set("alt", alt)
  985. c.urlParams_.Set("prettyPrint", "false")
  986. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/adunits")
  987. urls += "?" + c.urlParams_.Encode()
  988. req, _ := http.NewRequest("GET", urls, body)
  989. req.Header = reqHeaders
  990. googleapi.Expand(req.URL, map[string]string{
  991. "adClientId": c.adClientId,
  992. })
  993. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  994. }
  995. // Do executes the "adexchangeseller.adunits.list" call.
  996. // Exactly one of *AdUnits or error will be non-nil. Any non-2xx status
  997. // code is an error. Response headers are in either
  998. // *AdUnits.ServerResponse.Header or (if a response was returned at all)
  999. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1000. // check whether the returned error was because http.StatusNotModified
  1001. // was returned.
  1002. func (c *AdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) {
  1003. gensupport.SetOptions(c.urlParams_, opts...)
  1004. res, err := c.doRequest("json")
  1005. if res != nil && res.StatusCode == http.StatusNotModified {
  1006. if res.Body != nil {
  1007. res.Body.Close()
  1008. }
  1009. return nil, &googleapi.Error{
  1010. Code: res.StatusCode,
  1011. Header: res.Header,
  1012. }
  1013. }
  1014. if err != nil {
  1015. return nil, err
  1016. }
  1017. defer googleapi.CloseBody(res)
  1018. if err := googleapi.CheckResponse(res); err != nil {
  1019. return nil, err
  1020. }
  1021. ret := &AdUnits{
  1022. ServerResponse: googleapi.ServerResponse{
  1023. Header: res.Header,
  1024. HTTPStatusCode: res.StatusCode,
  1025. },
  1026. }
  1027. target := &ret
  1028. if err := gensupport.DecodeResponse(target, res); err != nil {
  1029. return nil, err
  1030. }
  1031. return ret, nil
  1032. // {
  1033. // "description": "List all ad units in the specified ad client for this Ad Exchange account.",
  1034. // "httpMethod": "GET",
  1035. // "id": "adexchangeseller.adunits.list",
  1036. // "parameterOrder": [
  1037. // "adClientId"
  1038. // ],
  1039. // "parameters": {
  1040. // "adClientId": {
  1041. // "description": "Ad client for which to list ad units.",
  1042. // "location": "path",
  1043. // "required": true,
  1044. // "type": "string"
  1045. // },
  1046. // "includeInactive": {
  1047. // "description": "Whether to include inactive ad units. Default: true.",
  1048. // "location": "query",
  1049. // "type": "boolean"
  1050. // },
  1051. // "maxResults": {
  1052. // "description": "The maximum number of ad units to include in the response, used for paging.",
  1053. // "format": "uint32",
  1054. // "location": "query",
  1055. // "maximum": "10000",
  1056. // "minimum": "0",
  1057. // "type": "integer"
  1058. // },
  1059. // "pageToken": {
  1060. // "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.",
  1061. // "location": "query",
  1062. // "type": "string"
  1063. // }
  1064. // },
  1065. // "path": "adclients/{adClientId}/adunits",
  1066. // "response": {
  1067. // "$ref": "AdUnits"
  1068. // },
  1069. // "scopes": [
  1070. // "https://www.googleapis.com/auth/adexchange.seller",
  1071. // "https://www.googleapis.com/auth/adexchange.seller.readonly"
  1072. // ]
  1073. // }
  1074. }
  1075. // Pages invokes f for each page of results.
  1076. // A non-nil error returned from f will halt the iteration.
  1077. // The provided context supersedes any context provided to the Context method.
  1078. func (c *AdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error {
  1079. c.ctx_ = ctx
  1080. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1081. for {
  1082. x, err := c.Do()
  1083. if err != nil {
  1084. return err
  1085. }
  1086. if err := f(x); err != nil {
  1087. return err
  1088. }
  1089. if x.NextPageToken == "" {
  1090. return nil
  1091. }
  1092. c.PageToken(x.NextPageToken)
  1093. }
  1094. }
  1095. // method id "adexchangeseller.adunits.customchannels.list":
  1096. type AdunitsCustomchannelsListCall struct {
  1097. s *Service
  1098. adClientId string
  1099. adUnitId string
  1100. urlParams_ gensupport.URLParams
  1101. ifNoneMatch_ string
  1102. ctx_ context.Context
  1103. header_ http.Header
  1104. }
  1105. // List: List all custom channels which the specified ad unit belongs
  1106. // to.
  1107. func (r *AdunitsCustomchannelsService) List(adClientId string, adUnitId string) *AdunitsCustomchannelsListCall {
  1108. c := &AdunitsCustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1109. c.adClientId = adClientId
  1110. c.adUnitId = adUnitId
  1111. return c
  1112. }
  1113. // MaxResults sets the optional parameter "maxResults": The maximum
  1114. // number of custom channels to include in the response, used for
  1115. // paging.
  1116. func (c *AdunitsCustomchannelsListCall) MaxResults(maxResults int64) *AdunitsCustomchannelsListCall {
  1117. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1118. return c
  1119. }
  1120. // PageToken sets the optional parameter "pageToken": A continuation
  1121. // token, used to page through custom channels. To retrieve the next
  1122. // page, set this parameter to the value of "nextPageToken" from the
  1123. // previous response.
  1124. func (c *AdunitsCustomchannelsListCall) PageToken(pageToken string) *AdunitsCustomchannelsListCall {
  1125. c.urlParams_.Set("pageToken", pageToken)
  1126. return c
  1127. }
  1128. // Fields allows partial responses to be retrieved. See
  1129. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1130. // for more information.
  1131. func (c *AdunitsCustomchannelsListCall) Fields(s ...googleapi.Field) *AdunitsCustomchannelsListCall {
  1132. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1133. return c
  1134. }
  1135. // IfNoneMatch sets the optional parameter which makes the operation
  1136. // fail if the object's ETag matches the given value. This is useful for
  1137. // getting updates only after the object has changed since the last
  1138. // request. Use googleapi.IsNotModified to check whether the response
  1139. // error from Do is the result of In-None-Match.
  1140. func (c *AdunitsCustomchannelsListCall) IfNoneMatch(entityTag string) *AdunitsCustomchannelsListCall {
  1141. c.ifNoneMatch_ = entityTag
  1142. return c
  1143. }
  1144. // Context sets the context to be used in this call's Do method. Any
  1145. // pending HTTP request will be aborted if the provided context is
  1146. // canceled.
  1147. func (c *AdunitsCustomchannelsListCall) Context(ctx context.Context) *AdunitsCustomchannelsListCall {
  1148. c.ctx_ = ctx
  1149. return c
  1150. }
  1151. // Header returns an http.Header that can be modified by the caller to
  1152. // add HTTP headers to the request.
  1153. func (c *AdunitsCustomchannelsListCall) Header() http.Header {
  1154. if c.header_ == nil {
  1155. c.header_ = make(http.Header)
  1156. }
  1157. return c.header_
  1158. }
  1159. func (c *AdunitsCustomchannelsListCall) doRequest(alt string) (*http.Response, error) {
  1160. reqHeaders := make(http.Header)
  1161. for k, v := range c.header_ {
  1162. reqHeaders[k] = v
  1163. }
  1164. reqHeaders.Set("User-Agent", c.s.userAgent())
  1165. if c.ifNoneMatch_ != "" {
  1166. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1167. }
  1168. var body io.Reader = nil
  1169. c.urlParams_.Set("alt", alt)
  1170. c.urlParams_.Set("prettyPrint", "false")
  1171. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/adunits/{adUnitId}/customchannels")
  1172. urls += "?" + c.urlParams_.Encode()
  1173. req, _ := http.NewRequest("GET", urls, body)
  1174. req.Header = reqHeaders
  1175. googleapi.Expand(req.URL, map[string]string{
  1176. "adClientId": c.adClientId,
  1177. "adUnitId": c.adUnitId,
  1178. })
  1179. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1180. }
  1181. // Do executes the "adexchangeseller.adunits.customchannels.list" call.
  1182. // Exactly one of *CustomChannels or error will be non-nil. Any non-2xx
  1183. // status code is an error. Response headers are in either
  1184. // *CustomChannels.ServerResponse.Header or (if a response was returned
  1185. // at all) in error.(*googleapi.Error).Header. Use
  1186. // googleapi.IsNotModified to check whether the returned error was
  1187. // because http.StatusNotModified was returned.
  1188. func (c *AdunitsCustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) {
  1189. gensupport.SetOptions(c.urlParams_, opts...)
  1190. res, err := c.doRequest("json")
  1191. if res != nil && res.StatusCode == http.StatusNotModified {
  1192. if res.Body != nil {
  1193. res.Body.Close()
  1194. }
  1195. return nil, &googleapi.Error{
  1196. Code: res.StatusCode,
  1197. Header: res.Header,
  1198. }
  1199. }
  1200. if err != nil {
  1201. return nil, err
  1202. }
  1203. defer googleapi.CloseBody(res)
  1204. if err := googleapi.CheckResponse(res); err != nil {
  1205. return nil, err
  1206. }
  1207. ret := &CustomChannels{
  1208. ServerResponse: googleapi.ServerResponse{
  1209. Header: res.Header,
  1210. HTTPStatusCode: res.StatusCode,
  1211. },
  1212. }
  1213. target := &ret
  1214. if err := gensupport.DecodeResponse(target, res); err != nil {
  1215. return nil, err
  1216. }
  1217. return ret, nil
  1218. // {
  1219. // "description": "List all custom channels which the specified ad unit belongs to.",
  1220. // "httpMethod": "GET",
  1221. // "id": "adexchangeseller.adunits.customchannels.list",
  1222. // "parameterOrder": [
  1223. // "adClientId",
  1224. // "adUnitId"
  1225. // ],
  1226. // "parameters": {
  1227. // "adClientId": {
  1228. // "description": "Ad client which contains the ad unit.",
  1229. // "location": "path",
  1230. // "required": true,
  1231. // "type": "string"
  1232. // },
  1233. // "adUnitId": {
  1234. // "description": "Ad unit for which to list custom channels.",
  1235. // "location": "path",
  1236. // "required": true,
  1237. // "type": "string"
  1238. // },
  1239. // "maxResults": {
  1240. // "description": "The maximum number of custom channels to include in the response, used for paging.",
  1241. // "format": "uint32",
  1242. // "location": "query",
  1243. // "maximum": "10000",
  1244. // "minimum": "0",
  1245. // "type": "integer"
  1246. // },
  1247. // "pageToken": {
  1248. // "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.",
  1249. // "location": "query",
  1250. // "type": "string"
  1251. // }
  1252. // },
  1253. // "path": "adclients/{adClientId}/adunits/{adUnitId}/customchannels",
  1254. // "response": {
  1255. // "$ref": "CustomChannels"
  1256. // },
  1257. // "scopes": [
  1258. // "https://www.googleapis.com/auth/adexchange.seller",
  1259. // "https://www.googleapis.com/auth/adexchange.seller.readonly"
  1260. // ]
  1261. // }
  1262. }
  1263. // Pages invokes f for each page of results.
  1264. // A non-nil error returned from f will halt the iteration.
  1265. // The provided context supersedes any context provided to the Context method.
  1266. func (c *AdunitsCustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error {
  1267. c.ctx_ = ctx
  1268. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1269. for {
  1270. x, err := c.Do()
  1271. if err != nil {
  1272. return err
  1273. }
  1274. if err := f(x); err != nil {
  1275. return err
  1276. }
  1277. if x.NextPageToken == "" {
  1278. return nil
  1279. }
  1280. c.PageToken(x.NextPageToken)
  1281. }
  1282. }
  1283. // method id "adexchangeseller.customchannels.get":
  1284. type CustomchannelsGetCall struct {
  1285. s *Service
  1286. adClientId string
  1287. customChannelId string
  1288. urlParams_ gensupport.URLParams
  1289. ifNoneMatch_ string
  1290. ctx_ context.Context
  1291. header_ http.Header
  1292. }
  1293. // Get: Get the specified custom channel from the specified ad client.
  1294. func (r *CustomchannelsService) Get(adClientId string, customChannelId string) *CustomchannelsGetCall {
  1295. c := &CustomchannelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1296. c.adClientId = adClientId
  1297. c.customChannelId = customChannelId
  1298. return c
  1299. }
  1300. // Fields allows partial responses to be retrieved. See
  1301. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1302. // for more information.
  1303. func (c *CustomchannelsGetCall) Fields(s ...googleapi.Field) *CustomchannelsGetCall {
  1304. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1305. return c
  1306. }
  1307. // IfNoneMatch sets the optional parameter which makes the operation
  1308. // fail if the object's ETag matches the given value. This is useful for
  1309. // getting updates only after the object has changed since the last
  1310. // request. Use googleapi.IsNotModified to check whether the response
  1311. // error from Do is the result of In-None-Match.
  1312. func (c *CustomchannelsGetCall) IfNoneMatch(entityTag string) *CustomchannelsGetCall {
  1313. c.ifNoneMatch_ = entityTag
  1314. return c
  1315. }
  1316. // Context sets the context to be used in this call's Do method. Any
  1317. // pending HTTP request will be aborted if the provided context is
  1318. // canceled.
  1319. func (c *CustomchannelsGetCall) Context(ctx context.Context) *CustomchannelsGetCall {
  1320. c.ctx_ = ctx
  1321. return c
  1322. }
  1323. // Header returns an http.Header that can be modified by the caller to
  1324. // add HTTP headers to the request.
  1325. func (c *CustomchannelsGetCall) Header() http.Header {
  1326. if c.header_ == nil {
  1327. c.header_ = make(http.Header)
  1328. }
  1329. return c.header_
  1330. }
  1331. func (c *CustomchannelsGetCall) doRequest(alt string) (*http.Response, error) {
  1332. reqHeaders := make(http.Header)
  1333. for k, v := range c.header_ {
  1334. reqHeaders[k] = v
  1335. }
  1336. reqHeaders.Set("User-Agent", c.s.userAgent())
  1337. if c.ifNoneMatch_ != "" {
  1338. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1339. }
  1340. var body io.Reader = nil
  1341. c.urlParams_.Set("alt", alt)
  1342. c.urlParams_.Set("prettyPrint", "false")
  1343. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}")
  1344. urls += "?" + c.urlParams_.Encode()
  1345. req, _ := http.NewRequest("GET", urls, body)
  1346. req.Header = reqHeaders
  1347. googleapi.Expand(req.URL, map[string]string{
  1348. "adClientId": c.adClientId,
  1349. "customChannelId": c.customChannelId,
  1350. })
  1351. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1352. }
  1353. // Do executes the "adexchangeseller.customchannels.get" call.
  1354. // Exactly one of *CustomChannel or error will be non-nil. Any non-2xx
  1355. // status code is an error. Response headers are in either
  1356. // *CustomChannel.ServerResponse.Header or (if a response was returned
  1357. // at all) in error.(*googleapi.Error).Header. Use
  1358. // googleapi.IsNotModified to check whether the returned error was
  1359. // because http.StatusNotModified was returned.
  1360. func (c *CustomchannelsGetCall) Do(opts ...googleapi.CallOption) (*CustomChannel, error) {
  1361. gensupport.SetOptions(c.urlParams_, opts...)
  1362. res, err := c.doRequest("json")
  1363. if res != nil && res.StatusCode == http.StatusNotModified {
  1364. if res.Body != nil {
  1365. res.Body.Close()
  1366. }
  1367. return nil, &googleapi.Error{
  1368. Code: res.StatusCode,
  1369. Header: res.Header,
  1370. }
  1371. }
  1372. if err != nil {
  1373. return nil, err
  1374. }
  1375. defer googleapi.CloseBody(res)
  1376. if err := googleapi.CheckResponse(res); err != nil {
  1377. return nil, err
  1378. }
  1379. ret := &CustomChannel{
  1380. ServerResponse: googleapi.ServerResponse{
  1381. Header: res.Header,
  1382. HTTPStatusCode: res.StatusCode,
  1383. },
  1384. }
  1385. target := &ret
  1386. if err := gensupport.DecodeResponse(target, res); err != nil {
  1387. return nil, err
  1388. }
  1389. return ret, nil
  1390. // {
  1391. // "description": "Get the specified custom channel from the specified ad client.",
  1392. // "httpMethod": "GET",
  1393. // "id": "adexchangeseller.customchannels.get",
  1394. // "parameterOrder": [
  1395. // "adClientId",
  1396. // "customChannelId"
  1397. // ],
  1398. // "parameters": {
  1399. // "adClientId": {
  1400. // "description": "Ad client which contains the custom channel.",
  1401. // "location": "path",
  1402. // "required": true,
  1403. // "type": "string"
  1404. // },
  1405. // "customChannelId": {
  1406. // "description": "Custom channel to retrieve.",
  1407. // "location": "path",
  1408. // "required": true,
  1409. // "type": "string"
  1410. // }
  1411. // },
  1412. // "path": "adclients/{adClientId}/customchannels/{customChannelId}",
  1413. // "response": {
  1414. // "$ref": "CustomChannel"
  1415. // },
  1416. // "scopes": [
  1417. // "https://www.googleapis.com/auth/adexchange.seller",
  1418. // "https://www.googleapis.com/auth/adexchange.seller.readonly"
  1419. // ]
  1420. // }
  1421. }
  1422. // method id "adexchangeseller.customchannels.list":
  1423. type CustomchannelsListCall struct {
  1424. s *Service
  1425. adClientId string
  1426. urlParams_ gensupport.URLParams
  1427. ifNoneMatch_ string
  1428. ctx_ context.Context
  1429. header_ http.Header
  1430. }
  1431. // List: List all custom channels in the specified ad client for this Ad
  1432. // Exchange account.
  1433. func (r *CustomchannelsService) List(adClientId string) *CustomchannelsListCall {
  1434. c := &CustomchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1435. c.adClientId = adClientId
  1436. return c
  1437. }
  1438. // MaxResults sets the optional parameter "maxResults": The maximum
  1439. // number of custom channels to include in the response, used for
  1440. // paging.
  1441. func (c *CustomchannelsListCall) MaxResults(maxResults int64) *CustomchannelsListCall {
  1442. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1443. return c
  1444. }
  1445. // PageToken sets the optional parameter "pageToken": A continuation
  1446. // token, used to page through custom channels. To retrieve the next
  1447. // page, set this parameter to the value of "nextPageToken" from the
  1448. // previous response.
  1449. func (c *CustomchannelsListCall) PageToken(pageToken string) *CustomchannelsListCall {
  1450. c.urlParams_.Set("pageToken", pageToken)
  1451. return c
  1452. }
  1453. // Fields allows partial responses to be retrieved. See
  1454. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1455. // for more information.
  1456. func (c *CustomchannelsListCall) Fields(s ...googleapi.Field) *CustomchannelsListCall {
  1457. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1458. return c
  1459. }
  1460. // IfNoneMatch sets the optional parameter which makes the operation
  1461. // fail if the object's ETag matches the given value. This is useful for
  1462. // getting updates only after the object has changed since the last
  1463. // request. Use googleapi.IsNotModified to check whether the response
  1464. // error from Do is the result of In-None-Match.
  1465. func (c *CustomchannelsListCall) IfNoneMatch(entityTag string) *CustomchannelsListCall {
  1466. c.ifNoneMatch_ = entityTag
  1467. return c
  1468. }
  1469. // Context sets the context to be used in this call's Do method. Any
  1470. // pending HTTP request will be aborted if the provided context is
  1471. // canceled.
  1472. func (c *CustomchannelsListCall) Context(ctx context.Context) *CustomchannelsListCall {
  1473. c.ctx_ = ctx
  1474. return c
  1475. }
  1476. // Header returns an http.Header that can be modified by the caller to
  1477. // add HTTP headers to the request.
  1478. func (c *CustomchannelsListCall) Header() http.Header {
  1479. if c.header_ == nil {
  1480. c.header_ = make(http.Header)
  1481. }
  1482. return c.header_
  1483. }
  1484. func (c *CustomchannelsListCall) doRequest(alt string) (*http.Response, error) {
  1485. reqHeaders := make(http.Header)
  1486. for k, v := range c.header_ {
  1487. reqHeaders[k] = v
  1488. }
  1489. reqHeaders.Set("User-Agent", c.s.userAgent())
  1490. if c.ifNoneMatch_ != "" {
  1491. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1492. }
  1493. var body io.Reader = nil
  1494. c.urlParams_.Set("alt", alt)
  1495. c.urlParams_.Set("prettyPrint", "false")
  1496. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels")
  1497. urls += "?" + c.urlParams_.Encode()
  1498. req, _ := http.NewRequest("GET", urls, body)
  1499. req.Header = reqHeaders
  1500. googleapi.Expand(req.URL, map[string]string{
  1501. "adClientId": c.adClientId,
  1502. })
  1503. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1504. }
  1505. // Do executes the "adexchangeseller.customchannels.list" call.
  1506. // Exactly one of *CustomChannels or error will be non-nil. Any non-2xx
  1507. // status code is an error. Response headers are in either
  1508. // *CustomChannels.ServerResponse.Header or (if a response was returned
  1509. // at all) in error.(*googleapi.Error).Header. Use
  1510. // googleapi.IsNotModified to check whether the returned error was
  1511. // because http.StatusNotModified was returned.
  1512. func (c *CustomchannelsListCall) Do(opts ...googleapi.CallOption) (*CustomChannels, error) {
  1513. gensupport.SetOptions(c.urlParams_, opts...)
  1514. res, err := c.doRequest("json")
  1515. if res != nil && res.StatusCode == http.StatusNotModified {
  1516. if res.Body != nil {
  1517. res.Body.Close()
  1518. }
  1519. return nil, &googleapi.Error{
  1520. Code: res.StatusCode,
  1521. Header: res.Header,
  1522. }
  1523. }
  1524. if err != nil {
  1525. return nil, err
  1526. }
  1527. defer googleapi.CloseBody(res)
  1528. if err := googleapi.CheckResponse(res); err != nil {
  1529. return nil, err
  1530. }
  1531. ret := &CustomChannels{
  1532. ServerResponse: googleapi.ServerResponse{
  1533. Header: res.Header,
  1534. HTTPStatusCode: res.StatusCode,
  1535. },
  1536. }
  1537. target := &ret
  1538. if err := gensupport.DecodeResponse(target, res); err != nil {
  1539. return nil, err
  1540. }
  1541. return ret, nil
  1542. // {
  1543. // "description": "List all custom channels in the specified ad client for this Ad Exchange account.",
  1544. // "httpMethod": "GET",
  1545. // "id": "adexchangeseller.customchannels.list",
  1546. // "parameterOrder": [
  1547. // "adClientId"
  1548. // ],
  1549. // "parameters": {
  1550. // "adClientId": {
  1551. // "description": "Ad client for which to list custom channels.",
  1552. // "location": "path",
  1553. // "required": true,
  1554. // "type": "string"
  1555. // },
  1556. // "maxResults": {
  1557. // "description": "The maximum number of custom channels to include in the response, used for paging.",
  1558. // "format": "uint32",
  1559. // "location": "query",
  1560. // "maximum": "10000",
  1561. // "minimum": "0",
  1562. // "type": "integer"
  1563. // },
  1564. // "pageToken": {
  1565. // "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.",
  1566. // "location": "query",
  1567. // "type": "string"
  1568. // }
  1569. // },
  1570. // "path": "adclients/{adClientId}/customchannels",
  1571. // "response": {
  1572. // "$ref": "CustomChannels"
  1573. // },
  1574. // "scopes": [
  1575. // "https://www.googleapis.com/auth/adexchange.seller",
  1576. // "https://www.googleapis.com/auth/adexchange.seller.readonly"
  1577. // ]
  1578. // }
  1579. }
  1580. // Pages invokes f for each page of results.
  1581. // A non-nil error returned from f will halt the iteration.
  1582. // The provided context supersedes any context provided to the Context method.
  1583. func (c *CustomchannelsListCall) Pages(ctx context.Context, f func(*CustomChannels) error) error {
  1584. c.ctx_ = ctx
  1585. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1586. for {
  1587. x, err := c.Do()
  1588. if err != nil {
  1589. return err
  1590. }
  1591. if err := f(x); err != nil {
  1592. return err
  1593. }
  1594. if x.NextPageToken == "" {
  1595. return nil
  1596. }
  1597. c.PageToken(x.NextPageToken)
  1598. }
  1599. }
  1600. // method id "adexchangeseller.customchannels.adunits.list":
  1601. type CustomchannelsAdunitsListCall struct {
  1602. s *Service
  1603. adClientId string
  1604. customChannelId string
  1605. urlParams_ gensupport.URLParams
  1606. ifNoneMatch_ string
  1607. ctx_ context.Context
  1608. header_ http.Header
  1609. }
  1610. // List: List all ad units in the specified custom channel.
  1611. func (r *CustomchannelsAdunitsService) List(adClientId string, customChannelId string) *CustomchannelsAdunitsListCall {
  1612. c := &CustomchannelsAdunitsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1613. c.adClientId = adClientId
  1614. c.customChannelId = customChannelId
  1615. return c
  1616. }
  1617. // IncludeInactive sets the optional parameter "includeInactive":
  1618. // Whether to include inactive ad units. Default: true.
  1619. func (c *CustomchannelsAdunitsListCall) IncludeInactive(includeInactive bool) *CustomchannelsAdunitsListCall {
  1620. c.urlParams_.Set("includeInactive", fmt.Sprint(includeInactive))
  1621. return c
  1622. }
  1623. // MaxResults sets the optional parameter "maxResults": The maximum
  1624. // number of ad units to include in the response, used for paging.
  1625. func (c *CustomchannelsAdunitsListCall) MaxResults(maxResults int64) *CustomchannelsAdunitsListCall {
  1626. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1627. return c
  1628. }
  1629. // PageToken sets the optional parameter "pageToken": A continuation
  1630. // token, used to page through ad units. To retrieve the next page, set
  1631. // this parameter to the value of "nextPageToken" from the previous
  1632. // response.
  1633. func (c *CustomchannelsAdunitsListCall) PageToken(pageToken string) *CustomchannelsAdunitsListCall {
  1634. c.urlParams_.Set("pageToken", pageToken)
  1635. return c
  1636. }
  1637. // Fields allows partial responses to be retrieved. See
  1638. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1639. // for more information.
  1640. func (c *CustomchannelsAdunitsListCall) Fields(s ...googleapi.Field) *CustomchannelsAdunitsListCall {
  1641. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1642. return c
  1643. }
  1644. // IfNoneMatch sets the optional parameter which makes the operation
  1645. // fail if the object's ETag matches the given value. This is useful for
  1646. // getting updates only after the object has changed since the last
  1647. // request. Use googleapi.IsNotModified to check whether the response
  1648. // error from Do is the result of In-None-Match.
  1649. func (c *CustomchannelsAdunitsListCall) IfNoneMatch(entityTag string) *CustomchannelsAdunitsListCall {
  1650. c.ifNoneMatch_ = entityTag
  1651. return c
  1652. }
  1653. // Context sets the context to be used in this call's Do method. Any
  1654. // pending HTTP request will be aborted if the provided context is
  1655. // canceled.
  1656. func (c *CustomchannelsAdunitsListCall) Context(ctx context.Context) *CustomchannelsAdunitsListCall {
  1657. c.ctx_ = ctx
  1658. return c
  1659. }
  1660. // Header returns an http.Header that can be modified by the caller to
  1661. // add HTTP headers to the request.
  1662. func (c *CustomchannelsAdunitsListCall) Header() http.Header {
  1663. if c.header_ == nil {
  1664. c.header_ = make(http.Header)
  1665. }
  1666. return c.header_
  1667. }
  1668. func (c *CustomchannelsAdunitsListCall) doRequest(alt string) (*http.Response, error) {
  1669. reqHeaders := make(http.Header)
  1670. for k, v := range c.header_ {
  1671. reqHeaders[k] = v
  1672. }
  1673. reqHeaders.Set("User-Agent", c.s.userAgent())
  1674. if c.ifNoneMatch_ != "" {
  1675. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1676. }
  1677. var body io.Reader = nil
  1678. c.urlParams_.Set("alt", alt)
  1679. c.urlParams_.Set("prettyPrint", "false")
  1680. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/customchannels/{customChannelId}/adunits")
  1681. urls += "?" + c.urlParams_.Encode()
  1682. req, _ := http.NewRequest("GET", urls, body)
  1683. req.Header = reqHeaders
  1684. googleapi.Expand(req.URL, map[string]string{
  1685. "adClientId": c.adClientId,
  1686. "customChannelId": c.customChannelId,
  1687. })
  1688. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1689. }
  1690. // Do executes the "adexchangeseller.customchannels.adunits.list" call.
  1691. // Exactly one of *AdUnits or error will be non-nil. Any non-2xx status
  1692. // code is an error. Response headers are in either
  1693. // *AdUnits.ServerResponse.Header or (if a response was returned at all)
  1694. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1695. // check whether the returned error was because http.StatusNotModified
  1696. // was returned.
  1697. func (c *CustomchannelsAdunitsListCall) Do(opts ...googleapi.CallOption) (*AdUnits, error) {
  1698. gensupport.SetOptions(c.urlParams_, opts...)
  1699. res, err := c.doRequest("json")
  1700. if res != nil && res.StatusCode == http.StatusNotModified {
  1701. if res.Body != nil {
  1702. res.Body.Close()
  1703. }
  1704. return nil, &googleapi.Error{
  1705. Code: res.StatusCode,
  1706. Header: res.Header,
  1707. }
  1708. }
  1709. if err != nil {
  1710. return nil, err
  1711. }
  1712. defer googleapi.CloseBody(res)
  1713. if err := googleapi.CheckResponse(res); err != nil {
  1714. return nil, err
  1715. }
  1716. ret := &AdUnits{
  1717. ServerResponse: googleapi.ServerResponse{
  1718. Header: res.Header,
  1719. HTTPStatusCode: res.StatusCode,
  1720. },
  1721. }
  1722. target := &ret
  1723. if err := gensupport.DecodeResponse(target, res); err != nil {
  1724. return nil, err
  1725. }
  1726. return ret, nil
  1727. // {
  1728. // "description": "List all ad units in the specified custom channel.",
  1729. // "httpMethod": "GET",
  1730. // "id": "adexchangeseller.customchannels.adunits.list",
  1731. // "parameterOrder": [
  1732. // "adClientId",
  1733. // "customChannelId"
  1734. // ],
  1735. // "parameters": {
  1736. // "adClientId": {
  1737. // "description": "Ad client which contains the custom channel.",
  1738. // "location": "path",
  1739. // "required": true,
  1740. // "type": "string"
  1741. // },
  1742. // "customChannelId": {
  1743. // "description": "Custom channel for which to list ad units.",
  1744. // "location": "path",
  1745. // "required": true,
  1746. // "type": "string"
  1747. // },
  1748. // "includeInactive": {
  1749. // "description": "Whether to include inactive ad units. Default: true.",
  1750. // "location": "query",
  1751. // "type": "boolean"
  1752. // },
  1753. // "maxResults": {
  1754. // "description": "The maximum number of ad units to include in the response, used for paging.",
  1755. // "format": "uint32",
  1756. // "location": "query",
  1757. // "maximum": "10000",
  1758. // "minimum": "0",
  1759. // "type": "integer"
  1760. // },
  1761. // "pageToken": {
  1762. // "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.",
  1763. // "location": "query",
  1764. // "type": "string"
  1765. // }
  1766. // },
  1767. // "path": "adclients/{adClientId}/customchannels/{customChannelId}/adunits",
  1768. // "response": {
  1769. // "$ref": "AdUnits"
  1770. // },
  1771. // "scopes": [
  1772. // "https://www.googleapis.com/auth/adexchange.seller",
  1773. // "https://www.googleapis.com/auth/adexchange.seller.readonly"
  1774. // ]
  1775. // }
  1776. }
  1777. // Pages invokes f for each page of results.
  1778. // A non-nil error returned from f will halt the iteration.
  1779. // The provided context supersedes any context provided to the Context method.
  1780. func (c *CustomchannelsAdunitsListCall) Pages(ctx context.Context, f func(*AdUnits) error) error {
  1781. c.ctx_ = ctx
  1782. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1783. for {
  1784. x, err := c.Do()
  1785. if err != nil {
  1786. return err
  1787. }
  1788. if err := f(x); err != nil {
  1789. return err
  1790. }
  1791. if x.NextPageToken == "" {
  1792. return nil
  1793. }
  1794. c.PageToken(x.NextPageToken)
  1795. }
  1796. }
  1797. // method id "adexchangeseller.reports.generate":
  1798. type ReportsGenerateCall struct {
  1799. s *Service
  1800. urlParams_ gensupport.URLParams
  1801. ifNoneMatch_ string
  1802. ctx_ context.Context
  1803. header_ http.Header
  1804. }
  1805. // Generate: Generate an Ad Exchange report based on the report request
  1806. // sent in the query parameters. Returns the result as JSON; to retrieve
  1807. // output in CSV format specify "alt=csv" as a query parameter.
  1808. func (r *ReportsService) Generate(startDate string, endDate string) *ReportsGenerateCall {
  1809. c := &ReportsGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1810. c.urlParams_.Set("startDate", startDate)
  1811. c.urlParams_.Set("endDate", endDate)
  1812. return c
  1813. }
  1814. // Dimension sets the optional parameter "dimension": Dimensions to base
  1815. // the report on.
  1816. func (c *ReportsGenerateCall) Dimension(dimension ...string) *ReportsGenerateCall {
  1817. c.urlParams_.SetMulti("dimension", append([]string{}, dimension...))
  1818. return c
  1819. }
  1820. // Filter sets the optional parameter "filter": Filters to be run on the
  1821. // report.
  1822. func (c *ReportsGenerateCall) Filter(filter ...string) *ReportsGenerateCall {
  1823. c.urlParams_.SetMulti("filter", append([]string{}, filter...))
  1824. return c
  1825. }
  1826. // Locale sets the optional parameter "locale": Optional locale to use
  1827. // for translating report output to a local language. Defaults to
  1828. // "en_US" if not specified.
  1829. func (c *ReportsGenerateCall) Locale(locale string) *ReportsGenerateCall {
  1830. c.urlParams_.Set("locale", locale)
  1831. return c
  1832. }
  1833. // MaxResults sets the optional parameter "maxResults": The maximum
  1834. // number of rows of report data to return.
  1835. func (c *ReportsGenerateCall) MaxResults(maxResults int64) *ReportsGenerateCall {
  1836. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1837. return c
  1838. }
  1839. // Metric sets the optional parameter "metric": Numeric columns to
  1840. // include in the report.
  1841. func (c *ReportsGenerateCall) Metric(metric ...string) *ReportsGenerateCall {
  1842. c.urlParams_.SetMulti("metric", append([]string{}, metric...))
  1843. return c
  1844. }
  1845. // Sort sets the optional parameter "sort": The name of a dimension or
  1846. // metric to sort the resulting report on, optionally prefixed with "+"
  1847. // to sort ascending or "-" to sort descending. If no prefix is
  1848. // specified, the column is sorted ascending.
  1849. func (c *ReportsGenerateCall) Sort(sort ...string) *ReportsGenerateCall {
  1850. c.urlParams_.SetMulti("sort", append([]string{}, sort...))
  1851. return c
  1852. }
  1853. // StartIndex sets the optional parameter "startIndex": Index of the
  1854. // first row of report data to return.
  1855. func (c *ReportsGenerateCall) StartIndex(startIndex int64) *ReportsGenerateCall {
  1856. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  1857. return c
  1858. }
  1859. // Fields allows partial responses to be retrieved. See
  1860. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1861. // for more information.
  1862. func (c *ReportsGenerateCall) Fields(s ...googleapi.Field) *ReportsGenerateCall {
  1863. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1864. return c
  1865. }
  1866. // IfNoneMatch sets the optional parameter which makes the operation
  1867. // fail if the object's ETag matches the given value. This is useful for
  1868. // getting updates only after the object has changed since the last
  1869. // request. Use googleapi.IsNotModified to check whether the response
  1870. // error from Do is the result of In-None-Match.
  1871. func (c *ReportsGenerateCall) IfNoneMatch(entityTag string) *ReportsGenerateCall {
  1872. c.ifNoneMatch_ = entityTag
  1873. return c
  1874. }
  1875. // Context sets the context to be used in this call's Do and Download
  1876. // methods. Any pending HTTP request will be aborted if the provided
  1877. // context is canceled.
  1878. func (c *ReportsGenerateCall) Context(ctx context.Context) *ReportsGenerateCall {
  1879. c.ctx_ = ctx
  1880. return c
  1881. }
  1882. // Header returns an http.Header that can be modified by the caller to
  1883. // add HTTP headers to the request.
  1884. func (c *ReportsGenerateCall) Header() http.Header {
  1885. if c.header_ == nil {
  1886. c.header_ = make(http.Header)
  1887. }
  1888. return c.header_
  1889. }
  1890. func (c *ReportsGenerateCall) doRequest(alt string) (*http.Response, error) {
  1891. reqHeaders := make(http.Header)
  1892. for k, v := range c.header_ {
  1893. reqHeaders[k] = v
  1894. }
  1895. reqHeaders.Set("User-Agent", c.s.userAgent())
  1896. if c.ifNoneMatch_ != "" {
  1897. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1898. }
  1899. var body io.Reader = nil
  1900. c.urlParams_.Set("alt", alt)
  1901. c.urlParams_.Set("prettyPrint", "false")
  1902. urls := googleapi.ResolveRelative(c.s.BasePath, "reports")
  1903. urls += "?" + c.urlParams_.Encode()
  1904. req, _ := http.NewRequest("GET", urls, body)
  1905. req.Header = reqHeaders
  1906. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1907. }
  1908. // Download fetches the API endpoint's "media" value, instead of the normal
  1909. // API response value. If the returned error is nil, the Response is guaranteed to
  1910. // have a 2xx status code. Callers must close the Response.Body as usual.
  1911. func (c *ReportsGenerateCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  1912. gensupport.SetOptions(c.urlParams_, opts...)
  1913. res, err := c.doRequest("media")
  1914. if err != nil {
  1915. return nil, err
  1916. }
  1917. if err := googleapi.CheckMediaResponse(res); err != nil {
  1918. res.Body.Close()
  1919. return nil, err
  1920. }
  1921. return res, nil
  1922. }
  1923. // Do executes the "adexchangeseller.reports.generate" call.
  1924. // Exactly one of *Report or error will be non-nil. Any non-2xx status
  1925. // code is an error. Response headers are in either
  1926. // *Report.ServerResponse.Header or (if a response was returned at all)
  1927. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1928. // check whether the returned error was because http.StatusNotModified
  1929. // was returned.
  1930. func (c *ReportsGenerateCall) Do(opts ...googleapi.CallOption) (*Report, error) {
  1931. gensupport.SetOptions(c.urlParams_, opts...)
  1932. res, err := c.doRequest("json")
  1933. if res != nil && res.StatusCode == http.StatusNotModified {
  1934. if res.Body != nil {
  1935. res.Body.Close()
  1936. }
  1937. return nil, &googleapi.Error{
  1938. Code: res.StatusCode,
  1939. Header: res.Header,
  1940. }
  1941. }
  1942. if err != nil {
  1943. return nil, err
  1944. }
  1945. defer googleapi.CloseBody(res)
  1946. if err := googleapi.CheckResponse(res); err != nil {
  1947. return nil, err
  1948. }
  1949. ret := &Report{
  1950. ServerResponse: googleapi.ServerResponse{
  1951. Header: res.Header,
  1952. HTTPStatusCode: res.StatusCode,
  1953. },
  1954. }
  1955. target := &ret
  1956. if err := gensupport.DecodeResponse(target, res); err != nil {
  1957. return nil, err
  1958. }
  1959. return ret, nil
  1960. // {
  1961. // "description": "Generate an Ad Exchange 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.",
  1962. // "httpMethod": "GET",
  1963. // "id": "adexchangeseller.reports.generate",
  1964. // "parameterOrder": [
  1965. // "startDate",
  1966. // "endDate"
  1967. // ],
  1968. // "parameters": {
  1969. // "dimension": {
  1970. // "description": "Dimensions to base the report on.",
  1971. // "location": "query",
  1972. // "pattern": "[a-zA-Z_]+",
  1973. // "repeated": true,
  1974. // "type": "string"
  1975. // },
  1976. // "endDate": {
  1977. // "description": "End of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  1978. // "location": "query",
  1979. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  1980. // "required": true,
  1981. // "type": "string"
  1982. // },
  1983. // "filter": {
  1984. // "description": "Filters to be run on the report.",
  1985. // "location": "query",
  1986. // "pattern": "[a-zA-Z_]+(==|=@).+",
  1987. // "repeated": true,
  1988. // "type": "string"
  1989. // },
  1990. // "locale": {
  1991. // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.",
  1992. // "location": "query",
  1993. // "pattern": "[a-zA-Z_]+",
  1994. // "type": "string"
  1995. // },
  1996. // "maxResults": {
  1997. // "description": "The maximum number of rows of report data to return.",
  1998. // "format": "uint32",
  1999. // "location": "query",
  2000. // "maximum": "50000",
  2001. // "minimum": "0",
  2002. // "type": "integer"
  2003. // },
  2004. // "metric": {
  2005. // "description": "Numeric columns to include in the report.",
  2006. // "location": "query",
  2007. // "pattern": "[a-zA-Z_]+",
  2008. // "repeated": true,
  2009. // "type": "string"
  2010. // },
  2011. // "sort": {
  2012. // "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.",
  2013. // "location": "query",
  2014. // "pattern": "(\\+|-)?[a-zA-Z_]+",
  2015. // "repeated": true,
  2016. // "type": "string"
  2017. // },
  2018. // "startDate": {
  2019. // "description": "Start of the date range to report on in \"YYYY-MM-DD\" format, inclusive.",
  2020. // "location": "query",
  2021. // "pattern": "\\d{4}-\\d{2}-\\d{2}|(today|startOfMonth|startOfYear)(([\\-\\+]\\d+[dwmy]){0,3}?)",
  2022. // "required": true,
  2023. // "type": "string"
  2024. // },
  2025. // "startIndex": {
  2026. // "description": "Index of the first row of report data to return.",
  2027. // "format": "uint32",
  2028. // "location": "query",
  2029. // "maximum": "5000",
  2030. // "minimum": "0",
  2031. // "type": "integer"
  2032. // }
  2033. // },
  2034. // "path": "reports",
  2035. // "response": {
  2036. // "$ref": "Report"
  2037. // },
  2038. // "scopes": [
  2039. // "https://www.googleapis.com/auth/adexchange.seller",
  2040. // "https://www.googleapis.com/auth/adexchange.seller.readonly"
  2041. // ],
  2042. // "supportsMediaDownload": true
  2043. // }
  2044. }
  2045. // method id "adexchangeseller.reports.saved.generate":
  2046. type ReportsSavedGenerateCall struct {
  2047. s *Service
  2048. savedReportId string
  2049. urlParams_ gensupport.URLParams
  2050. ifNoneMatch_ string
  2051. ctx_ context.Context
  2052. header_ http.Header
  2053. }
  2054. // Generate: Generate an Ad Exchange report based on the saved report ID
  2055. // sent in the query parameters.
  2056. func (r *ReportsSavedService) Generate(savedReportId string) *ReportsSavedGenerateCall {
  2057. c := &ReportsSavedGenerateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2058. c.savedReportId = savedReportId
  2059. return c
  2060. }
  2061. // Locale sets the optional parameter "locale": Optional locale to use
  2062. // for translating report output to a local language. Defaults to
  2063. // "en_US" if not specified.
  2064. func (c *ReportsSavedGenerateCall) Locale(locale string) *ReportsSavedGenerateCall {
  2065. c.urlParams_.Set("locale", locale)
  2066. return c
  2067. }
  2068. // MaxResults sets the optional parameter "maxResults": The maximum
  2069. // number of rows of report data to return.
  2070. func (c *ReportsSavedGenerateCall) MaxResults(maxResults int64) *ReportsSavedGenerateCall {
  2071. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2072. return c
  2073. }
  2074. // StartIndex sets the optional parameter "startIndex": Index of the
  2075. // first row of report data to return.
  2076. func (c *ReportsSavedGenerateCall) StartIndex(startIndex int64) *ReportsSavedGenerateCall {
  2077. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  2078. return c
  2079. }
  2080. // Fields allows partial responses to be retrieved. See
  2081. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2082. // for more information.
  2083. func (c *ReportsSavedGenerateCall) Fields(s ...googleapi.Field) *ReportsSavedGenerateCall {
  2084. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2085. return c
  2086. }
  2087. // IfNoneMatch sets the optional parameter which makes the operation
  2088. // fail if the object's ETag matches the given value. This is useful for
  2089. // getting updates only after the object has changed since the last
  2090. // request. Use googleapi.IsNotModified to check whether the response
  2091. // error from Do is the result of In-None-Match.
  2092. func (c *ReportsSavedGenerateCall) IfNoneMatch(entityTag string) *ReportsSavedGenerateCall {
  2093. c.ifNoneMatch_ = entityTag
  2094. return c
  2095. }
  2096. // Context sets the context to be used in this call's Do method. Any
  2097. // pending HTTP request will be aborted if the provided context is
  2098. // canceled.
  2099. func (c *ReportsSavedGenerateCall) Context(ctx context.Context) *ReportsSavedGenerateCall {
  2100. c.ctx_ = ctx
  2101. return c
  2102. }
  2103. // Header returns an http.Header that can be modified by the caller to
  2104. // add HTTP headers to the request.
  2105. func (c *ReportsSavedGenerateCall) Header() http.Header {
  2106. if c.header_ == nil {
  2107. c.header_ = make(http.Header)
  2108. }
  2109. return c.header_
  2110. }
  2111. func (c *ReportsSavedGenerateCall) doRequest(alt string) (*http.Response, error) {
  2112. reqHeaders := make(http.Header)
  2113. for k, v := range c.header_ {
  2114. reqHeaders[k] = v
  2115. }
  2116. reqHeaders.Set("User-Agent", c.s.userAgent())
  2117. if c.ifNoneMatch_ != "" {
  2118. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2119. }
  2120. var body io.Reader = nil
  2121. c.urlParams_.Set("alt", alt)
  2122. c.urlParams_.Set("prettyPrint", "false")
  2123. urls := googleapi.ResolveRelative(c.s.BasePath, "reports/{savedReportId}")
  2124. urls += "?" + c.urlParams_.Encode()
  2125. req, _ := http.NewRequest("GET", urls, body)
  2126. req.Header = reqHeaders
  2127. googleapi.Expand(req.URL, map[string]string{
  2128. "savedReportId": c.savedReportId,
  2129. })
  2130. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2131. }
  2132. // Do executes the "adexchangeseller.reports.saved.generate" call.
  2133. // Exactly one of *Report or error will be non-nil. Any non-2xx status
  2134. // code is an error. Response headers are in either
  2135. // *Report.ServerResponse.Header or (if a response was returned at all)
  2136. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2137. // check whether the returned error was because http.StatusNotModified
  2138. // was returned.
  2139. func (c *ReportsSavedGenerateCall) Do(opts ...googleapi.CallOption) (*Report, error) {
  2140. gensupport.SetOptions(c.urlParams_, opts...)
  2141. res, err := c.doRequest("json")
  2142. if res != nil && res.StatusCode == http.StatusNotModified {
  2143. if res.Body != nil {
  2144. res.Body.Close()
  2145. }
  2146. return nil, &googleapi.Error{
  2147. Code: res.StatusCode,
  2148. Header: res.Header,
  2149. }
  2150. }
  2151. if err != nil {
  2152. return nil, err
  2153. }
  2154. defer googleapi.CloseBody(res)
  2155. if err := googleapi.CheckResponse(res); err != nil {
  2156. return nil, err
  2157. }
  2158. ret := &Report{
  2159. ServerResponse: googleapi.ServerResponse{
  2160. Header: res.Header,
  2161. HTTPStatusCode: res.StatusCode,
  2162. },
  2163. }
  2164. target := &ret
  2165. if err := gensupport.DecodeResponse(target, res); err != nil {
  2166. return nil, err
  2167. }
  2168. return ret, nil
  2169. // {
  2170. // "description": "Generate an Ad Exchange report based on the saved report ID sent in the query parameters.",
  2171. // "httpMethod": "GET",
  2172. // "id": "adexchangeseller.reports.saved.generate",
  2173. // "parameterOrder": [
  2174. // "savedReportId"
  2175. // ],
  2176. // "parameters": {
  2177. // "locale": {
  2178. // "description": "Optional locale to use for translating report output to a local language. Defaults to \"en_US\" if not specified.",
  2179. // "location": "query",
  2180. // "pattern": "[a-zA-Z_]+",
  2181. // "type": "string"
  2182. // },
  2183. // "maxResults": {
  2184. // "description": "The maximum number of rows of report data to return.",
  2185. // "format": "int32",
  2186. // "location": "query",
  2187. // "maximum": "50000",
  2188. // "minimum": "0",
  2189. // "type": "integer"
  2190. // },
  2191. // "savedReportId": {
  2192. // "description": "The saved report to retrieve.",
  2193. // "location": "path",
  2194. // "required": true,
  2195. // "type": "string"
  2196. // },
  2197. // "startIndex": {
  2198. // "description": "Index of the first row of report data to return.",
  2199. // "format": "int32",
  2200. // "location": "query",
  2201. // "maximum": "5000",
  2202. // "minimum": "0",
  2203. // "type": "integer"
  2204. // }
  2205. // },
  2206. // "path": "reports/{savedReportId}",
  2207. // "response": {
  2208. // "$ref": "Report"
  2209. // },
  2210. // "scopes": [
  2211. // "https://www.googleapis.com/auth/adexchange.seller",
  2212. // "https://www.googleapis.com/auth/adexchange.seller.readonly"
  2213. // ]
  2214. // }
  2215. }
  2216. // method id "adexchangeseller.reports.saved.list":
  2217. type ReportsSavedListCall struct {
  2218. s *Service
  2219. urlParams_ gensupport.URLParams
  2220. ifNoneMatch_ string
  2221. ctx_ context.Context
  2222. header_ http.Header
  2223. }
  2224. // List: List all saved reports in this Ad Exchange account.
  2225. func (r *ReportsSavedService) List() *ReportsSavedListCall {
  2226. c := &ReportsSavedListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2227. return c
  2228. }
  2229. // MaxResults sets the optional parameter "maxResults": The maximum
  2230. // number of saved reports to include in the response, used for paging.
  2231. func (c *ReportsSavedListCall) MaxResults(maxResults int64) *ReportsSavedListCall {
  2232. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2233. return c
  2234. }
  2235. // PageToken sets the optional parameter "pageToken": A continuation
  2236. // token, used to page through saved reports. To retrieve the next page,
  2237. // set this parameter to the value of "nextPageToken" from the previous
  2238. // response.
  2239. func (c *ReportsSavedListCall) PageToken(pageToken string) *ReportsSavedListCall {
  2240. c.urlParams_.Set("pageToken", pageToken)
  2241. return c
  2242. }
  2243. // Fields allows partial responses to be retrieved. See
  2244. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2245. // for more information.
  2246. func (c *ReportsSavedListCall) Fields(s ...googleapi.Field) *ReportsSavedListCall {
  2247. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2248. return c
  2249. }
  2250. // IfNoneMatch sets the optional parameter which makes the operation
  2251. // fail if the object's ETag matches the given value. This is useful for
  2252. // getting updates only after the object has changed since the last
  2253. // request. Use googleapi.IsNotModified to check whether the response
  2254. // error from Do is the result of In-None-Match.
  2255. func (c *ReportsSavedListCall) IfNoneMatch(entityTag string) *ReportsSavedListCall {
  2256. c.ifNoneMatch_ = entityTag
  2257. return c
  2258. }
  2259. // Context sets the context to be used in this call's Do method. Any
  2260. // pending HTTP request will be aborted if the provided context is
  2261. // canceled.
  2262. func (c *ReportsSavedListCall) Context(ctx context.Context) *ReportsSavedListCall {
  2263. c.ctx_ = ctx
  2264. return c
  2265. }
  2266. // Header returns an http.Header that can be modified by the caller to
  2267. // add HTTP headers to the request.
  2268. func (c *ReportsSavedListCall) Header() http.Header {
  2269. if c.header_ == nil {
  2270. c.header_ = make(http.Header)
  2271. }
  2272. return c.header_
  2273. }
  2274. func (c *ReportsSavedListCall) doRequest(alt string) (*http.Response, error) {
  2275. reqHeaders := make(http.Header)
  2276. for k, v := range c.header_ {
  2277. reqHeaders[k] = v
  2278. }
  2279. reqHeaders.Set("User-Agent", c.s.userAgent())
  2280. if c.ifNoneMatch_ != "" {
  2281. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2282. }
  2283. var body io.Reader = nil
  2284. c.urlParams_.Set("alt", alt)
  2285. c.urlParams_.Set("prettyPrint", "false")
  2286. urls := googleapi.ResolveRelative(c.s.BasePath, "reports/saved")
  2287. urls += "?" + c.urlParams_.Encode()
  2288. req, _ := http.NewRequest("GET", urls, body)
  2289. req.Header = reqHeaders
  2290. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2291. }
  2292. // Do executes the "adexchangeseller.reports.saved.list" call.
  2293. // Exactly one of *SavedReports or error will be non-nil. Any non-2xx
  2294. // status code is an error. Response headers are in either
  2295. // *SavedReports.ServerResponse.Header or (if a response was returned at
  2296. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2297. // to check whether the returned error was because
  2298. // http.StatusNotModified was returned.
  2299. func (c *ReportsSavedListCall) Do(opts ...googleapi.CallOption) (*SavedReports, error) {
  2300. gensupport.SetOptions(c.urlParams_, opts...)
  2301. res, err := c.doRequest("json")
  2302. if res != nil && res.StatusCode == http.StatusNotModified {
  2303. if res.Body != nil {
  2304. res.Body.Close()
  2305. }
  2306. return nil, &googleapi.Error{
  2307. Code: res.StatusCode,
  2308. Header: res.Header,
  2309. }
  2310. }
  2311. if err != nil {
  2312. return nil, err
  2313. }
  2314. defer googleapi.CloseBody(res)
  2315. if err := googleapi.CheckResponse(res); err != nil {
  2316. return nil, err
  2317. }
  2318. ret := &SavedReports{
  2319. ServerResponse: googleapi.ServerResponse{
  2320. Header: res.Header,
  2321. HTTPStatusCode: res.StatusCode,
  2322. },
  2323. }
  2324. target := &ret
  2325. if err := gensupport.DecodeResponse(target, res); err != nil {
  2326. return nil, err
  2327. }
  2328. return ret, nil
  2329. // {
  2330. // "description": "List all saved reports in this Ad Exchange account.",
  2331. // "httpMethod": "GET",
  2332. // "id": "adexchangeseller.reports.saved.list",
  2333. // "parameters": {
  2334. // "maxResults": {
  2335. // "description": "The maximum number of saved reports to include in the response, used for paging.",
  2336. // "format": "int32",
  2337. // "location": "query",
  2338. // "maximum": "100",
  2339. // "minimum": "0",
  2340. // "type": "integer"
  2341. // },
  2342. // "pageToken": {
  2343. // "description": "A continuation token, used to page through saved reports. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.",
  2344. // "location": "query",
  2345. // "type": "string"
  2346. // }
  2347. // },
  2348. // "path": "reports/saved",
  2349. // "response": {
  2350. // "$ref": "SavedReports"
  2351. // },
  2352. // "scopes": [
  2353. // "https://www.googleapis.com/auth/adexchange.seller",
  2354. // "https://www.googleapis.com/auth/adexchange.seller.readonly"
  2355. // ]
  2356. // }
  2357. }
  2358. // Pages invokes f for each page of results.
  2359. // A non-nil error returned from f will halt the iteration.
  2360. // The provided context supersedes any context provided to the Context method.
  2361. func (c *ReportsSavedListCall) Pages(ctx context.Context, f func(*SavedReports) error) error {
  2362. c.ctx_ = ctx
  2363. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2364. for {
  2365. x, err := c.Do()
  2366. if err != nil {
  2367. return err
  2368. }
  2369. if err := f(x); err != nil {
  2370. return err
  2371. }
  2372. if x.NextPageToken == "" {
  2373. return nil
  2374. }
  2375. c.PageToken(x.NextPageToken)
  2376. }
  2377. }
  2378. // method id "adexchangeseller.urlchannels.list":
  2379. type UrlchannelsListCall struct {
  2380. s *Service
  2381. adClientId string
  2382. urlParams_ gensupport.URLParams
  2383. ifNoneMatch_ string
  2384. ctx_ context.Context
  2385. header_ http.Header
  2386. }
  2387. // List: List all URL channels in the specified ad client for this Ad
  2388. // Exchange account.
  2389. func (r *UrlchannelsService) List(adClientId string) *UrlchannelsListCall {
  2390. c := &UrlchannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2391. c.adClientId = adClientId
  2392. return c
  2393. }
  2394. // MaxResults sets the optional parameter "maxResults": The maximum
  2395. // number of URL channels to include in the response, used for paging.
  2396. func (c *UrlchannelsListCall) MaxResults(maxResults int64) *UrlchannelsListCall {
  2397. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2398. return c
  2399. }
  2400. // PageToken sets the optional parameter "pageToken": A continuation
  2401. // token, used to page through URL channels. To retrieve the next page,
  2402. // set this parameter to the value of "nextPageToken" from the previous
  2403. // response.
  2404. func (c *UrlchannelsListCall) PageToken(pageToken string) *UrlchannelsListCall {
  2405. c.urlParams_.Set("pageToken", pageToken)
  2406. return c
  2407. }
  2408. // Fields allows partial responses to be retrieved. See
  2409. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2410. // for more information.
  2411. func (c *UrlchannelsListCall) Fields(s ...googleapi.Field) *UrlchannelsListCall {
  2412. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2413. return c
  2414. }
  2415. // IfNoneMatch sets the optional parameter which makes the operation
  2416. // fail if the object's ETag matches the given value. This is useful for
  2417. // getting updates only after the object has changed since the last
  2418. // request. Use googleapi.IsNotModified to check whether the response
  2419. // error from Do is the result of In-None-Match.
  2420. func (c *UrlchannelsListCall) IfNoneMatch(entityTag string) *UrlchannelsListCall {
  2421. c.ifNoneMatch_ = entityTag
  2422. return c
  2423. }
  2424. // Context sets the context to be used in this call's Do method. Any
  2425. // pending HTTP request will be aborted if the provided context is
  2426. // canceled.
  2427. func (c *UrlchannelsListCall) Context(ctx context.Context) *UrlchannelsListCall {
  2428. c.ctx_ = ctx
  2429. return c
  2430. }
  2431. // Header returns an http.Header that can be modified by the caller to
  2432. // add HTTP headers to the request.
  2433. func (c *UrlchannelsListCall) Header() http.Header {
  2434. if c.header_ == nil {
  2435. c.header_ = make(http.Header)
  2436. }
  2437. return c.header_
  2438. }
  2439. func (c *UrlchannelsListCall) doRequest(alt string) (*http.Response, error) {
  2440. reqHeaders := make(http.Header)
  2441. for k, v := range c.header_ {
  2442. reqHeaders[k] = v
  2443. }
  2444. reqHeaders.Set("User-Agent", c.s.userAgent())
  2445. if c.ifNoneMatch_ != "" {
  2446. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2447. }
  2448. var body io.Reader = nil
  2449. c.urlParams_.Set("alt", alt)
  2450. c.urlParams_.Set("prettyPrint", "false")
  2451. urls := googleapi.ResolveRelative(c.s.BasePath, "adclients/{adClientId}/urlchannels")
  2452. urls += "?" + c.urlParams_.Encode()
  2453. req, _ := http.NewRequest("GET", urls, body)
  2454. req.Header = reqHeaders
  2455. googleapi.Expand(req.URL, map[string]string{
  2456. "adClientId": c.adClientId,
  2457. })
  2458. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2459. }
  2460. // Do executes the "adexchangeseller.urlchannels.list" call.
  2461. // Exactly one of *UrlChannels or error will be non-nil. Any non-2xx
  2462. // status code is an error. Response headers are in either
  2463. // *UrlChannels.ServerResponse.Header or (if a response was returned at
  2464. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2465. // to check whether the returned error was because
  2466. // http.StatusNotModified was returned.
  2467. func (c *UrlchannelsListCall) Do(opts ...googleapi.CallOption) (*UrlChannels, error) {
  2468. gensupport.SetOptions(c.urlParams_, opts...)
  2469. res, err := c.doRequest("json")
  2470. if res != nil && res.StatusCode == http.StatusNotModified {
  2471. if res.Body != nil {
  2472. res.Body.Close()
  2473. }
  2474. return nil, &googleapi.Error{
  2475. Code: res.StatusCode,
  2476. Header: res.Header,
  2477. }
  2478. }
  2479. if err != nil {
  2480. return nil, err
  2481. }
  2482. defer googleapi.CloseBody(res)
  2483. if err := googleapi.CheckResponse(res); err != nil {
  2484. return nil, err
  2485. }
  2486. ret := &UrlChannels{
  2487. ServerResponse: googleapi.ServerResponse{
  2488. Header: res.Header,
  2489. HTTPStatusCode: res.StatusCode,
  2490. },
  2491. }
  2492. target := &ret
  2493. if err := gensupport.DecodeResponse(target, res); err != nil {
  2494. return nil, err
  2495. }
  2496. return ret, nil
  2497. // {
  2498. // "description": "List all URL channels in the specified ad client for this Ad Exchange account.",
  2499. // "httpMethod": "GET",
  2500. // "id": "adexchangeseller.urlchannels.list",
  2501. // "parameterOrder": [
  2502. // "adClientId"
  2503. // ],
  2504. // "parameters": {
  2505. // "adClientId": {
  2506. // "description": "Ad client for which to list URL channels.",
  2507. // "location": "path",
  2508. // "required": true,
  2509. // "type": "string"
  2510. // },
  2511. // "maxResults": {
  2512. // "description": "The maximum number of URL channels to include in the response, used for paging.",
  2513. // "format": "uint32",
  2514. // "location": "query",
  2515. // "maximum": "10000",
  2516. // "minimum": "0",
  2517. // "type": "integer"
  2518. // },
  2519. // "pageToken": {
  2520. // "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.",
  2521. // "location": "query",
  2522. // "type": "string"
  2523. // }
  2524. // },
  2525. // "path": "adclients/{adClientId}/urlchannels",
  2526. // "response": {
  2527. // "$ref": "UrlChannels"
  2528. // },
  2529. // "scopes": [
  2530. // "https://www.googleapis.com/auth/adexchange.seller",
  2531. // "https://www.googleapis.com/auth/adexchange.seller.readonly"
  2532. // ]
  2533. // }
  2534. }
  2535. // Pages invokes f for each page of results.
  2536. // A non-nil error returned from f will halt the iteration.
  2537. // The provided context supersedes any context provided to the Context method.
  2538. func (c *UrlchannelsListCall) Pages(ctx context.Context, f func(*UrlChannels) error) error {
  2539. c.ctx_ = ctx
  2540. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2541. for {
  2542. x, err := c.Do()
  2543. if err != nil {
  2544. return err
  2545. }
  2546. if err := f(x); err != nil {
  2547. return err
  2548. }
  2549. if x.NextPageToken == "" {
  2550. return nil
  2551. }
  2552. c.PageToken(x.NextPageToken)
  2553. }
  2554. }