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.
 
 
 

2820 lines
94 KiB

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