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.
 
 
 

4593 lines
153 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package adexchangebuyer provides access to the Ad Exchange Buyer API.
  6. //
  7. // For product documentation, see: https://developers.google.com/ad-exchange/buyer-rest
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/adexchangebuyer/v1.3"
  14. // ...
  15. // ctx := context.Background()
  16. // adexchangebuyerService, err := adexchangebuyer.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // adexchangebuyerService, err := adexchangebuyer.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // adexchangebuyerService, err := adexchangebuyer.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package adexchangebuyer // import "google.golang.org/api/adexchangebuyer/v1.3"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "adexchangebuyer:v1.3"
  67. const apiName = "adexchangebuyer"
  68. const apiVersion = "v1.3"
  69. const basePath = "https://www.googleapis.com/adexchangebuyer/v1.3/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // Manage your Ad Exchange buyer account configuration
  73. AdexchangeBuyerScope = "https://www.googleapis.com/auth/adexchange.buyer"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/adexchange.buyer",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Accounts = NewAccountsService(s)
  106. s.BillingInfo = NewBillingInfoService(s)
  107. s.Budget = NewBudgetService(s)
  108. s.Creatives = NewCreativesService(s)
  109. s.DirectDeals = NewDirectDealsService(s)
  110. s.PerformanceReport = NewPerformanceReportService(s)
  111. s.PretargetingConfig = NewPretargetingConfigService(s)
  112. return s, nil
  113. }
  114. type Service struct {
  115. client *http.Client
  116. BasePath string // API endpoint base URL
  117. UserAgent string // optional additional User-Agent fragment
  118. Accounts *AccountsService
  119. BillingInfo *BillingInfoService
  120. Budget *BudgetService
  121. Creatives *CreativesService
  122. DirectDeals *DirectDealsService
  123. PerformanceReport *PerformanceReportService
  124. PretargetingConfig *PretargetingConfigService
  125. }
  126. func (s *Service) userAgent() string {
  127. if s.UserAgent == "" {
  128. return googleapi.UserAgent
  129. }
  130. return googleapi.UserAgent + " " + s.UserAgent
  131. }
  132. func NewAccountsService(s *Service) *AccountsService {
  133. rs := &AccountsService{s: s}
  134. return rs
  135. }
  136. type AccountsService struct {
  137. s *Service
  138. }
  139. func NewBillingInfoService(s *Service) *BillingInfoService {
  140. rs := &BillingInfoService{s: s}
  141. return rs
  142. }
  143. type BillingInfoService struct {
  144. s *Service
  145. }
  146. func NewBudgetService(s *Service) *BudgetService {
  147. rs := &BudgetService{s: s}
  148. return rs
  149. }
  150. type BudgetService struct {
  151. s *Service
  152. }
  153. func NewCreativesService(s *Service) *CreativesService {
  154. rs := &CreativesService{s: s}
  155. return rs
  156. }
  157. type CreativesService struct {
  158. s *Service
  159. }
  160. func NewDirectDealsService(s *Service) *DirectDealsService {
  161. rs := &DirectDealsService{s: s}
  162. return rs
  163. }
  164. type DirectDealsService struct {
  165. s *Service
  166. }
  167. func NewPerformanceReportService(s *Service) *PerformanceReportService {
  168. rs := &PerformanceReportService{s: s}
  169. return rs
  170. }
  171. type PerformanceReportService struct {
  172. s *Service
  173. }
  174. func NewPretargetingConfigService(s *Service) *PretargetingConfigService {
  175. rs := &PretargetingConfigService{s: s}
  176. return rs
  177. }
  178. type PretargetingConfigService struct {
  179. s *Service
  180. }
  181. // Account: Configuration data for an Ad Exchange buyer account.
  182. type Account struct {
  183. // BidderLocation: Your bidder locations that have distinct URLs.
  184. BidderLocation []*AccountBidderLocation `json:"bidderLocation,omitempty"`
  185. // CookieMatchingNid: The nid parameter value used in cookie match
  186. // requests. Please contact your technical account manager if you need
  187. // to change this.
  188. CookieMatchingNid string `json:"cookieMatchingNid,omitempty"`
  189. // CookieMatchingUrl: The base URL used in cookie match requests.
  190. CookieMatchingUrl string `json:"cookieMatchingUrl,omitempty"`
  191. // Id: Account id.
  192. Id int64 `json:"id,omitempty"`
  193. // Kind: Resource type.
  194. Kind string `json:"kind,omitempty"`
  195. // MaximumActiveCreatives: The maximum number of active creatives that
  196. // an account can have, where a creative is active if it was inserted or
  197. // bid with in the last 30 days. Please contact your technical account
  198. // manager if you need to change this.
  199. MaximumActiveCreatives int64 `json:"maximumActiveCreatives,omitempty"`
  200. // MaximumTotalQps: The sum of all bidderLocation.maximumQps values
  201. // cannot exceed this. Please contact your technical account manager if
  202. // you need to change this.
  203. MaximumTotalQps int64 `json:"maximumTotalQps,omitempty"`
  204. // NumberActiveCreatives: The number of creatives that this account
  205. // inserted or bid with in the last 30 days.
  206. NumberActiveCreatives int64 `json:"numberActiveCreatives,omitempty"`
  207. // ServerResponse contains the HTTP response code and headers from the
  208. // server.
  209. googleapi.ServerResponse `json:"-"`
  210. // ForceSendFields is a list of field names (e.g. "BidderLocation") to
  211. // unconditionally include in API requests. By default, fields with
  212. // empty values are omitted from API requests. However, any non-pointer,
  213. // non-interface field appearing in ForceSendFields will be sent to the
  214. // server regardless of whether the field is empty or not. This may be
  215. // used to include empty fields in Patch requests.
  216. ForceSendFields []string `json:"-"`
  217. // NullFields is a list of field names (e.g. "BidderLocation") to
  218. // include in API requests with the JSON null value. By default, fields
  219. // with empty values are omitted from API requests. However, any field
  220. // with an empty value appearing in NullFields will be sent to the
  221. // server as null. It is an error if a field in this list has a
  222. // non-empty value. This may be used to include null fields in Patch
  223. // requests.
  224. NullFields []string `json:"-"`
  225. }
  226. func (s *Account) MarshalJSON() ([]byte, error) {
  227. type NoMethod Account
  228. raw := NoMethod(*s)
  229. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  230. }
  231. type AccountBidderLocation struct {
  232. // MaximumQps: The maximum queries per second the Ad Exchange will send.
  233. MaximumQps int64 `json:"maximumQps,omitempty"`
  234. // Region: The geographical region the Ad Exchange should send requests
  235. // from. Only used by some quota systems, but always setting the value
  236. // is recommended. Allowed values:
  237. // - ASIA
  238. // - EUROPE
  239. // - US_EAST
  240. // - US_WEST
  241. Region string `json:"region,omitempty"`
  242. // Url: The URL to which the Ad Exchange will send bid requests.
  243. Url string `json:"url,omitempty"`
  244. // ForceSendFields is a list of field names (e.g. "MaximumQps") to
  245. // unconditionally include in API requests. By default, fields with
  246. // empty values are omitted from API requests. However, any non-pointer,
  247. // non-interface field appearing in ForceSendFields will be sent to the
  248. // server regardless of whether the field is empty or not. This may be
  249. // used to include empty fields in Patch requests.
  250. ForceSendFields []string `json:"-"`
  251. // NullFields is a list of field names (e.g. "MaximumQps") to include in
  252. // API requests with the JSON null value. By default, fields with empty
  253. // values are omitted from API requests. However, any field with an
  254. // empty value appearing in NullFields will be sent to the server as
  255. // null. It is an error if a field in this list has a non-empty value.
  256. // This may be used to include null fields in Patch requests.
  257. NullFields []string `json:"-"`
  258. }
  259. func (s *AccountBidderLocation) MarshalJSON() ([]byte, error) {
  260. type NoMethod AccountBidderLocation
  261. raw := NoMethod(*s)
  262. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  263. }
  264. // AccountsList: An account feed lists Ad Exchange buyer accounts that
  265. // the user has access to. Each entry in the feed corresponds to a
  266. // single buyer account.
  267. type AccountsList struct {
  268. // Items: A list of accounts.
  269. Items []*Account `json:"items,omitempty"`
  270. // Kind: Resource type.
  271. Kind string `json:"kind,omitempty"`
  272. // ServerResponse contains the HTTP response code and headers from the
  273. // server.
  274. googleapi.ServerResponse `json:"-"`
  275. // ForceSendFields is a list of field names (e.g. "Items") to
  276. // unconditionally include in API requests. By default, fields with
  277. // empty values are omitted from API requests. However, any non-pointer,
  278. // non-interface field appearing in ForceSendFields will be sent to the
  279. // server regardless of whether the field is empty or not. This may be
  280. // used to include empty fields in Patch requests.
  281. ForceSendFields []string `json:"-"`
  282. // NullFields is a list of field names (e.g. "Items") to include in API
  283. // requests with the JSON null value. By default, fields with empty
  284. // values are omitted from API requests. However, any field with an
  285. // empty value appearing in NullFields will be sent to the server as
  286. // null. It is an error if a field in this list has a non-empty value.
  287. // This may be used to include null fields in Patch requests.
  288. NullFields []string `json:"-"`
  289. }
  290. func (s *AccountsList) MarshalJSON() ([]byte, error) {
  291. type NoMethod AccountsList
  292. raw := NoMethod(*s)
  293. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  294. }
  295. // BillingInfo: The configuration data for an Ad Exchange billing info.
  296. type BillingInfo struct {
  297. // AccountId: Account id.
  298. AccountId int64 `json:"accountId,omitempty"`
  299. // AccountName: Account name.
  300. AccountName string `json:"accountName,omitempty"`
  301. // BillingId: A list of adgroup IDs associated with this particular
  302. // account. These IDs may show up as part of a realtime bidding
  303. // BidRequest, which indicates a bid request for this account.
  304. BillingId []string `json:"billingId,omitempty"`
  305. // Kind: Resource type.
  306. Kind string `json:"kind,omitempty"`
  307. // ServerResponse contains the HTTP response code and headers from the
  308. // server.
  309. googleapi.ServerResponse `json:"-"`
  310. // ForceSendFields is a list of field names (e.g. "AccountId") to
  311. // unconditionally include in API requests. By default, fields with
  312. // empty values are omitted from API requests. However, any non-pointer,
  313. // non-interface field appearing in ForceSendFields will be sent to the
  314. // server regardless of whether the field is empty or not. This may be
  315. // used to include empty fields in Patch requests.
  316. ForceSendFields []string `json:"-"`
  317. // NullFields is a list of field names (e.g. "AccountId") to include in
  318. // API requests with the JSON null value. By default, fields with empty
  319. // values are omitted from API requests. However, any field with an
  320. // empty value appearing in NullFields will be sent to the server as
  321. // null. It is an error if a field in this list has a non-empty value.
  322. // This may be used to include null fields in Patch requests.
  323. NullFields []string `json:"-"`
  324. }
  325. func (s *BillingInfo) MarshalJSON() ([]byte, error) {
  326. type NoMethod BillingInfo
  327. raw := NoMethod(*s)
  328. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  329. }
  330. // BillingInfoList: A billing info feed lists Billing Info the Ad
  331. // Exchange buyer account has access to. Each entry in the feed
  332. // corresponds to a single billing info.
  333. type BillingInfoList struct {
  334. // Items: A list of billing info relevant for your account.
  335. Items []*BillingInfo `json:"items,omitempty"`
  336. // Kind: Resource type.
  337. Kind string `json:"kind,omitempty"`
  338. // ServerResponse contains the HTTP response code and headers from the
  339. // server.
  340. googleapi.ServerResponse `json:"-"`
  341. // ForceSendFields is a list of field names (e.g. "Items") to
  342. // unconditionally include in API requests. By default, fields with
  343. // empty values are omitted from API requests. However, any non-pointer,
  344. // non-interface field appearing in ForceSendFields will be sent to the
  345. // server regardless of whether the field is empty or not. This may be
  346. // used to include empty fields in Patch requests.
  347. ForceSendFields []string `json:"-"`
  348. // NullFields is a list of field names (e.g. "Items") to include in API
  349. // requests with the JSON null value. By default, fields with empty
  350. // values are omitted from API requests. However, any field with an
  351. // empty value appearing in NullFields will be sent to the server as
  352. // null. It is an error if a field in this list has a non-empty value.
  353. // This may be used to include null fields in Patch requests.
  354. NullFields []string `json:"-"`
  355. }
  356. func (s *BillingInfoList) MarshalJSON() ([]byte, error) {
  357. type NoMethod BillingInfoList
  358. raw := NoMethod(*s)
  359. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  360. }
  361. // Budget: The configuration data for Ad Exchange RTB - Budget API.
  362. type Budget struct {
  363. // AccountId: The id of the account. This is required for get and update
  364. // requests.
  365. AccountId int64 `json:"accountId,omitempty,string"`
  366. // BillingId: The billing id to determine which adgroup to provide
  367. // budget information for. This is required for get and update requests.
  368. BillingId int64 `json:"billingId,omitempty,string"`
  369. // BudgetAmount: The daily budget amount in unit amount of the account
  370. // currency to apply for the billingId provided. This is required for
  371. // update requests.
  372. BudgetAmount int64 `json:"budgetAmount,omitempty,string"`
  373. // CurrencyCode: The currency code for the buyer. This cannot be altered
  374. // here.
  375. CurrencyCode string `json:"currencyCode,omitempty"`
  376. // Id: The unique id that describes this item.
  377. Id string `json:"id,omitempty"`
  378. // Kind: The kind of the resource, i.e. "adexchangebuyer#budget".
  379. Kind string `json:"kind,omitempty"`
  380. // ServerResponse contains the HTTP response code and headers from the
  381. // server.
  382. googleapi.ServerResponse `json:"-"`
  383. // ForceSendFields is a list of field names (e.g. "AccountId") to
  384. // unconditionally include in API requests. By default, fields with
  385. // empty values are omitted from API requests. However, any non-pointer,
  386. // non-interface field appearing in ForceSendFields will be sent to the
  387. // server regardless of whether the field is empty or not. This may be
  388. // used to include empty fields in Patch requests.
  389. ForceSendFields []string `json:"-"`
  390. // NullFields is a list of field names (e.g. "AccountId") to include in
  391. // API requests with the JSON null value. By default, fields with empty
  392. // values are omitted from API requests. However, any field with an
  393. // empty value appearing in NullFields will be sent to the server as
  394. // null. It is an error if a field in this list has a non-empty value.
  395. // This may be used to include null fields in Patch requests.
  396. NullFields []string `json:"-"`
  397. }
  398. func (s *Budget) MarshalJSON() ([]byte, error) {
  399. type NoMethod Budget
  400. raw := NoMethod(*s)
  401. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  402. }
  403. // Creative: A creative and its classification data.
  404. type Creative struct {
  405. // HTMLSnippet: The HTML snippet that displays the ad when inserted in
  406. // the web page. If set, videoURL should not be set.
  407. HTMLSnippet string `json:"HTMLSnippet,omitempty"`
  408. // AccountId: Account id.
  409. AccountId int64 `json:"accountId,omitempty"`
  410. // AdvertiserId: Detected advertiser id, if any. Read-only. This field
  411. // should not be set in requests.
  412. AdvertiserId googleapi.Int64s `json:"advertiserId,omitempty"`
  413. // AdvertiserName: The name of the company being advertised in the
  414. // creative.
  415. AdvertiserName string `json:"advertiserName,omitempty"`
  416. // AgencyId: The agency id for this creative.
  417. AgencyId int64 `json:"agencyId,omitempty,string"`
  418. // ApiUploadTimestamp: The last upload timestamp of this creative if it
  419. // was uploaded via API. Read-only. The value of this field is
  420. // generated, and will be ignored for uploads. (formatted RFC 3339
  421. // timestamp).
  422. ApiUploadTimestamp string `json:"apiUploadTimestamp,omitempty"`
  423. // Attribute: All attributes for the ads that may be shown from this
  424. // snippet.
  425. Attribute []int64 `json:"attribute,omitempty"`
  426. // BuyerCreativeId: A buyer-specific id identifying the creative in this
  427. // ad.
  428. BuyerCreativeId string `json:"buyerCreativeId,omitempty"`
  429. // ClickThroughUrl: The set of destination urls for the snippet.
  430. ClickThroughUrl []string `json:"clickThroughUrl,omitempty"`
  431. // Corrections: Shows any corrections that were applied to this
  432. // creative. Read-only. This field should not be set in requests.
  433. Corrections []*CreativeCorrections `json:"corrections,omitempty"`
  434. // DisapprovalReasons: The reasons for disapproval, if any. Note that
  435. // not all disapproval reasons may be categorized, so it is possible for
  436. // the creative to have a status of DISAPPROVED with an empty list for
  437. // disapproval_reasons. In this case, please reach out to your TAM to
  438. // help debug the issue. Read-only. This field should not be set in
  439. // requests.
  440. DisapprovalReasons []*CreativeDisapprovalReasons `json:"disapprovalReasons,omitempty"`
  441. // FilteringReasons: The filtering reasons for the creative. Read-only.
  442. // This field should not be set in requests.
  443. FilteringReasons *CreativeFilteringReasons `json:"filteringReasons,omitempty"`
  444. // Height: Ad height.
  445. Height int64 `json:"height,omitempty"`
  446. // ImpressionTrackingUrl: The set of urls to be called to record an
  447. // impression.
  448. ImpressionTrackingUrl []string `json:"impressionTrackingUrl,omitempty"`
  449. // Kind: Resource type.
  450. Kind string `json:"kind,omitempty"`
  451. // NativeAd: If nativeAd is set, HTMLSnippet and videoURL should not be
  452. // set.
  453. NativeAd *CreativeNativeAd `json:"nativeAd,omitempty"`
  454. // ProductCategories: Detected product categories, if any. Read-only.
  455. // This field should not be set in requests.
  456. ProductCategories []int64 `json:"productCategories,omitempty"`
  457. // RestrictedCategories: All restricted categories for the ads that may
  458. // be shown from this snippet.
  459. RestrictedCategories []int64 `json:"restrictedCategories,omitempty"`
  460. // SensitiveCategories: Detected sensitive categories, if any.
  461. // Read-only. This field should not be set in requests.
  462. SensitiveCategories []int64 `json:"sensitiveCategories,omitempty"`
  463. // Status: Creative serving status. Read-only. This field should not be
  464. // set in requests.
  465. Status string `json:"status,omitempty"`
  466. // VendorType: All vendor types for the ads that may be shown from this
  467. // snippet.
  468. VendorType []int64 `json:"vendorType,omitempty"`
  469. // Version: The version for this creative. Read-only. This field should
  470. // not be set in requests.
  471. Version int64 `json:"version,omitempty"`
  472. // VideoURL: The URL to fetch a video ad. If set, HTMLSnippet and the
  473. // nativeAd should not be set.
  474. VideoURL string `json:"videoURL,omitempty"`
  475. // Width: Ad width.
  476. Width int64 `json:"width,omitempty"`
  477. // ServerResponse contains the HTTP response code and headers from the
  478. // server.
  479. googleapi.ServerResponse `json:"-"`
  480. // ForceSendFields is a list of field names (e.g. "HTMLSnippet") to
  481. // unconditionally include in API requests. By default, fields with
  482. // empty values are omitted from API requests. However, any non-pointer,
  483. // non-interface field appearing in ForceSendFields will be sent to the
  484. // server regardless of whether the field is empty or not. This may be
  485. // used to include empty fields in Patch requests.
  486. ForceSendFields []string `json:"-"`
  487. // NullFields is a list of field names (e.g. "HTMLSnippet") to include
  488. // in API requests with the JSON null value. By default, fields with
  489. // empty values are omitted from API requests. However, any field with
  490. // an empty value appearing in NullFields will be sent to the server as
  491. // null. It is an error if a field in this list has a non-empty value.
  492. // This may be used to include null fields in Patch requests.
  493. NullFields []string `json:"-"`
  494. }
  495. func (s *Creative) MarshalJSON() ([]byte, error) {
  496. type NoMethod Creative
  497. raw := NoMethod(*s)
  498. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  499. }
  500. type CreativeCorrections struct {
  501. // Details: Additional details about the correction.
  502. Details []string `json:"details,omitempty"`
  503. // Reason: The type of correction that was applied to the creative.
  504. Reason string `json:"reason,omitempty"`
  505. // ForceSendFields is a list of field names (e.g. "Details") to
  506. // unconditionally include in API requests. By default, fields with
  507. // empty values are omitted from API requests. However, any non-pointer,
  508. // non-interface field appearing in ForceSendFields will be sent to the
  509. // server regardless of whether the field is empty or not. This may be
  510. // used to include empty fields in Patch requests.
  511. ForceSendFields []string `json:"-"`
  512. // NullFields is a list of field names (e.g. "Details") to include in
  513. // API requests with the JSON null value. By default, fields with empty
  514. // values are omitted from API requests. However, any field with an
  515. // empty value appearing in NullFields will be sent to the server as
  516. // null. It is an error if a field in this list has a non-empty value.
  517. // This may be used to include null fields in Patch requests.
  518. NullFields []string `json:"-"`
  519. }
  520. func (s *CreativeCorrections) MarshalJSON() ([]byte, error) {
  521. type NoMethod CreativeCorrections
  522. raw := NoMethod(*s)
  523. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  524. }
  525. type CreativeDisapprovalReasons struct {
  526. // Details: Additional details about the reason for disapproval.
  527. Details []string `json:"details,omitempty"`
  528. // Reason: The categorized reason for disapproval.
  529. Reason string `json:"reason,omitempty"`
  530. // ForceSendFields is a list of field names (e.g. "Details") to
  531. // unconditionally include in API requests. By default, fields with
  532. // empty values are omitted from API requests. However, any non-pointer,
  533. // non-interface field appearing in ForceSendFields will be sent to the
  534. // server regardless of whether the field is empty or not. This may be
  535. // used to include empty fields in Patch requests.
  536. ForceSendFields []string `json:"-"`
  537. // NullFields is a list of field names (e.g. "Details") to include in
  538. // API requests with the JSON null value. By default, fields with empty
  539. // values are omitted from API requests. However, any field with an
  540. // empty value appearing in NullFields will be sent to the server as
  541. // null. It is an error if a field in this list has a non-empty value.
  542. // This may be used to include null fields in Patch requests.
  543. NullFields []string `json:"-"`
  544. }
  545. func (s *CreativeDisapprovalReasons) MarshalJSON() ([]byte, error) {
  546. type NoMethod CreativeDisapprovalReasons
  547. raw := NoMethod(*s)
  548. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  549. }
  550. // CreativeFilteringReasons: The filtering reasons for the creative.
  551. // Read-only. This field should not be set in requests.
  552. type CreativeFilteringReasons struct {
  553. // Date: The date in ISO 8601 format for the data. The data is collected
  554. // from 00:00:00 to 23:59:59 in PST.
  555. Date string `json:"date,omitempty"`
  556. // Reasons: The filtering reasons.
  557. Reasons []*CreativeFilteringReasonsReasons `json:"reasons,omitempty"`
  558. // ForceSendFields is a list of field names (e.g. "Date") to
  559. // unconditionally include in API requests. By default, fields with
  560. // empty values are omitted from API requests. However, any non-pointer,
  561. // non-interface field appearing in ForceSendFields will be sent to the
  562. // server regardless of whether the field is empty or not. This may be
  563. // used to include empty fields in Patch requests.
  564. ForceSendFields []string `json:"-"`
  565. // NullFields is a list of field names (e.g. "Date") to include in API
  566. // requests with the JSON null value. By default, fields with empty
  567. // values are omitted from API requests. However, any field with an
  568. // empty value appearing in NullFields will be sent to the server as
  569. // null. It is an error if a field in this list has a non-empty value.
  570. // This may be used to include null fields in Patch requests.
  571. NullFields []string `json:"-"`
  572. }
  573. func (s *CreativeFilteringReasons) MarshalJSON() ([]byte, error) {
  574. type NoMethod CreativeFilteringReasons
  575. raw := NoMethod(*s)
  576. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  577. }
  578. type CreativeFilteringReasonsReasons struct {
  579. // FilteringCount: The number of times the creative was filtered for the
  580. // status. The count is aggregated across all publishers on the
  581. // exchange.
  582. FilteringCount int64 `json:"filteringCount,omitempty,string"`
  583. // FilteringStatus: The filtering status code. Please refer to the
  584. // creative-status-codes.txt file for different statuses.
  585. FilteringStatus int64 `json:"filteringStatus,omitempty"`
  586. // ForceSendFields is a list of field names (e.g. "FilteringCount") to
  587. // unconditionally include in API requests. By default, fields with
  588. // empty values are omitted from API requests. However, any non-pointer,
  589. // non-interface field appearing in ForceSendFields will be sent to the
  590. // server regardless of whether the field is empty or not. This may be
  591. // used to include empty fields in Patch requests.
  592. ForceSendFields []string `json:"-"`
  593. // NullFields is a list of field names (e.g. "FilteringCount") to
  594. // include in API requests with the JSON null value. By default, fields
  595. // with empty values are omitted from API requests. However, any field
  596. // with an empty value appearing in NullFields will be sent to the
  597. // server as null. It is an error if a field in this list has a
  598. // non-empty value. This may be used to include null fields in Patch
  599. // requests.
  600. NullFields []string `json:"-"`
  601. }
  602. func (s *CreativeFilteringReasonsReasons) MarshalJSON() ([]byte, error) {
  603. type NoMethod CreativeFilteringReasonsReasons
  604. raw := NoMethod(*s)
  605. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  606. }
  607. // CreativeNativeAd: If nativeAd is set, HTMLSnippet and videoURL should
  608. // not be set.
  609. type CreativeNativeAd struct {
  610. Advertiser string `json:"advertiser,omitempty"`
  611. // AppIcon: The app icon, for app download ads.
  612. AppIcon *CreativeNativeAdAppIcon `json:"appIcon,omitempty"`
  613. // Body: A long description of the ad.
  614. Body string `json:"body,omitempty"`
  615. // CallToAction: A label for the button that the user is supposed to
  616. // click.
  617. CallToAction string `json:"callToAction,omitempty"`
  618. // ClickTrackingUrl: The URL to use for click tracking.
  619. ClickTrackingUrl string `json:"clickTrackingUrl,omitempty"`
  620. // Headline: A short title for the ad.
  621. Headline string `json:"headline,omitempty"`
  622. // Image: A large image.
  623. Image *CreativeNativeAdImage `json:"image,omitempty"`
  624. // ImpressionTrackingUrl: The URLs are called when the impression is
  625. // rendered.
  626. ImpressionTrackingUrl []string `json:"impressionTrackingUrl,omitempty"`
  627. // Logo: A smaller image, for the advertiser logo.
  628. Logo *CreativeNativeAdLogo `json:"logo,omitempty"`
  629. // Price: The price of the promoted app including the currency info.
  630. Price string `json:"price,omitempty"`
  631. // StarRating: The app rating in the app store. Must be in the range
  632. // [0-5].
  633. StarRating float64 `json:"starRating,omitempty"`
  634. // Store: The URL to the app store to purchase/download the promoted
  635. // app.
  636. Store string `json:"store,omitempty"`
  637. // ForceSendFields is a list of field names (e.g. "Advertiser") to
  638. // unconditionally include in API requests. By default, fields with
  639. // empty values are omitted from API requests. However, any non-pointer,
  640. // non-interface field appearing in ForceSendFields will be sent to the
  641. // server regardless of whether the field is empty or not. This may be
  642. // used to include empty fields in Patch requests.
  643. ForceSendFields []string `json:"-"`
  644. // NullFields is a list of field names (e.g. "Advertiser") to include in
  645. // API requests with the JSON null value. By default, fields with empty
  646. // values are omitted from API requests. However, any field with an
  647. // empty value appearing in NullFields will be sent to the server as
  648. // null. It is an error if a field in this list has a non-empty value.
  649. // This may be used to include null fields in Patch requests.
  650. NullFields []string `json:"-"`
  651. }
  652. func (s *CreativeNativeAd) MarshalJSON() ([]byte, error) {
  653. type NoMethod CreativeNativeAd
  654. raw := NoMethod(*s)
  655. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  656. }
  657. func (s *CreativeNativeAd) UnmarshalJSON(data []byte) error {
  658. type NoMethod CreativeNativeAd
  659. var s1 struct {
  660. StarRating gensupport.JSONFloat64 `json:"starRating"`
  661. *NoMethod
  662. }
  663. s1.NoMethod = (*NoMethod)(s)
  664. if err := json.Unmarshal(data, &s1); err != nil {
  665. return err
  666. }
  667. s.StarRating = float64(s1.StarRating)
  668. return nil
  669. }
  670. // CreativeNativeAdAppIcon: The app icon, for app download ads.
  671. type CreativeNativeAdAppIcon struct {
  672. Height int64 `json:"height,omitempty"`
  673. Url string `json:"url,omitempty"`
  674. Width int64 `json:"width,omitempty"`
  675. // ForceSendFields is a list of field names (e.g. "Height") to
  676. // unconditionally include in API requests. By default, fields with
  677. // empty values are omitted from API requests. However, any non-pointer,
  678. // non-interface field appearing in ForceSendFields will be sent to the
  679. // server regardless of whether the field is empty or not. This may be
  680. // used to include empty fields in Patch requests.
  681. ForceSendFields []string `json:"-"`
  682. // NullFields is a list of field names (e.g. "Height") to include in API
  683. // requests with the JSON null value. By default, fields with empty
  684. // values are omitted from API requests. However, any field with an
  685. // empty value appearing in NullFields will be sent to the server as
  686. // null. It is an error if a field in this list has a non-empty value.
  687. // This may be used to include null fields in Patch requests.
  688. NullFields []string `json:"-"`
  689. }
  690. func (s *CreativeNativeAdAppIcon) MarshalJSON() ([]byte, error) {
  691. type NoMethod CreativeNativeAdAppIcon
  692. raw := NoMethod(*s)
  693. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  694. }
  695. // CreativeNativeAdImage: A large image.
  696. type CreativeNativeAdImage struct {
  697. Height int64 `json:"height,omitempty"`
  698. Url string `json:"url,omitempty"`
  699. Width int64 `json:"width,omitempty"`
  700. // ForceSendFields is a list of field names (e.g. "Height") to
  701. // unconditionally include in API requests. By default, fields with
  702. // empty values are omitted from API requests. However, any non-pointer,
  703. // non-interface field appearing in ForceSendFields will be sent to the
  704. // server regardless of whether the field is empty or not. This may be
  705. // used to include empty fields in Patch requests.
  706. ForceSendFields []string `json:"-"`
  707. // NullFields is a list of field names (e.g. "Height") to include in API
  708. // requests with the JSON null value. By default, fields with empty
  709. // values are omitted from API requests. However, any field with an
  710. // empty value appearing in NullFields will be sent to the server as
  711. // null. It is an error if a field in this list has a non-empty value.
  712. // This may be used to include null fields in Patch requests.
  713. NullFields []string `json:"-"`
  714. }
  715. func (s *CreativeNativeAdImage) MarshalJSON() ([]byte, error) {
  716. type NoMethod CreativeNativeAdImage
  717. raw := NoMethod(*s)
  718. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  719. }
  720. // CreativeNativeAdLogo: A smaller image, for the advertiser logo.
  721. type CreativeNativeAdLogo struct {
  722. Height int64 `json:"height,omitempty"`
  723. Url string `json:"url,omitempty"`
  724. Width int64 `json:"width,omitempty"`
  725. // ForceSendFields is a list of field names (e.g. "Height") to
  726. // unconditionally include in API requests. By default, fields with
  727. // empty values are omitted from API requests. However, any non-pointer,
  728. // non-interface field appearing in ForceSendFields will be sent to the
  729. // server regardless of whether the field is empty or not. This may be
  730. // used to include empty fields in Patch requests.
  731. ForceSendFields []string `json:"-"`
  732. // NullFields is a list of field names (e.g. "Height") to include in API
  733. // requests with the JSON null value. By default, fields with empty
  734. // values are omitted from API requests. However, any field with an
  735. // empty value appearing in NullFields will be sent to the server as
  736. // null. It is an error if a field in this list has a non-empty value.
  737. // This may be used to include null fields in Patch requests.
  738. NullFields []string `json:"-"`
  739. }
  740. func (s *CreativeNativeAdLogo) MarshalJSON() ([]byte, error) {
  741. type NoMethod CreativeNativeAdLogo
  742. raw := NoMethod(*s)
  743. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  744. }
  745. // CreativesList: The creatives feed lists the active creatives for the
  746. // Ad Exchange buyer accounts that the user has access to. Each entry in
  747. // the feed corresponds to a single creative.
  748. type CreativesList struct {
  749. // Items: A list of creatives.
  750. Items []*Creative `json:"items,omitempty"`
  751. // Kind: Resource type.
  752. Kind string `json:"kind,omitempty"`
  753. // NextPageToken: Continuation token used to page through creatives. To
  754. // retrieve the next page of results, set the next request's "pageToken"
  755. // value to this.
  756. NextPageToken string `json:"nextPageToken,omitempty"`
  757. // ServerResponse contains the HTTP response code and headers from the
  758. // server.
  759. googleapi.ServerResponse `json:"-"`
  760. // ForceSendFields is a list of field names (e.g. "Items") to
  761. // unconditionally include in API requests. By default, fields with
  762. // empty values are omitted from API requests. However, any non-pointer,
  763. // non-interface field appearing in ForceSendFields will be sent to the
  764. // server regardless of whether the field is empty or not. This may be
  765. // used to include empty fields in Patch requests.
  766. ForceSendFields []string `json:"-"`
  767. // NullFields is a list of field names (e.g. "Items") to include in API
  768. // requests with the JSON null value. By default, fields with empty
  769. // values are omitted from API requests. However, any field with an
  770. // empty value appearing in NullFields will be sent to the server as
  771. // null. It is an error if a field in this list has a non-empty value.
  772. // This may be used to include null fields in Patch requests.
  773. NullFields []string `json:"-"`
  774. }
  775. func (s *CreativesList) MarshalJSON() ([]byte, error) {
  776. type NoMethod CreativesList
  777. raw := NoMethod(*s)
  778. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  779. }
  780. // DirectDeal: The configuration data for an Ad Exchange direct deal.
  781. type DirectDeal struct {
  782. // AccountId: The account id of the buyer this deal is for.
  783. AccountId int64 `json:"accountId,omitempty"`
  784. // Advertiser: The name of the advertiser this deal is for.
  785. Advertiser string `json:"advertiser,omitempty"`
  786. // AllowsAlcohol: Whether the publisher for this deal is eligible for
  787. // alcohol ads.
  788. AllowsAlcohol bool `json:"allowsAlcohol,omitempty"`
  789. // BuyerAccountId: The account id that this deal was negotiated for. It
  790. // is either the buyer or the client that this deal was negotiated on
  791. // behalf of.
  792. BuyerAccountId int64 `json:"buyerAccountId,omitempty,string"`
  793. // CurrencyCode: The currency code that applies to the fixed_cpm value.
  794. // If not set then assumed to be USD.
  795. CurrencyCode string `json:"currencyCode,omitempty"`
  796. // DealTier: The deal type such as programmatic reservation or fixed
  797. // price and so on.
  798. DealTier string `json:"dealTier,omitempty"`
  799. // EndTime: End time for when this deal stops being active. If not set
  800. // then this deal is valid until manually disabled by the publisher. In
  801. // seconds since the epoch.
  802. EndTime int64 `json:"endTime,omitempty,string"`
  803. // FixedCpm: The fixed price for this direct deal. In cpm micros of
  804. // currency according to currency_code. If set, then this deal is
  805. // eligible for the fixed price tier of buying (highest priority, pay
  806. // exactly the configured fixed price).
  807. FixedCpm int64 `json:"fixedCpm,omitempty,string"`
  808. // Id: Deal id.
  809. Id int64 `json:"id,omitempty,string"`
  810. // Kind: Resource type.
  811. Kind string `json:"kind,omitempty"`
  812. // Name: Deal name.
  813. Name string `json:"name,omitempty"`
  814. // PrivateExchangeMinCpm: The minimum price for this direct deal. In cpm
  815. // micros of currency according to currency_code. If set, then this deal
  816. // is eligible for the private exchange tier of buying (below fixed
  817. // price priority, run as a second price auction).
  818. PrivateExchangeMinCpm int64 `json:"privateExchangeMinCpm,omitempty,string"`
  819. // PublisherBlocksOverriden: If true, the publisher has opted to have
  820. // their blocks ignored when a creative is bid with for this deal.
  821. PublisherBlocksOverriden bool `json:"publisherBlocksOverriden,omitempty"`
  822. // SellerNetwork: The name of the publisher offering this direct deal.
  823. SellerNetwork string `json:"sellerNetwork,omitempty"`
  824. // StartTime: Start time for when this deal becomes active. If not set
  825. // then this deal is active immediately upon creation. In seconds since
  826. // the epoch.
  827. StartTime int64 `json:"startTime,omitempty,string"`
  828. // ServerResponse contains the HTTP response code and headers from the
  829. // server.
  830. googleapi.ServerResponse `json:"-"`
  831. // ForceSendFields is a list of field names (e.g. "AccountId") to
  832. // unconditionally include in API requests. By default, fields with
  833. // empty values are omitted from API requests. However, any non-pointer,
  834. // non-interface field appearing in ForceSendFields will be sent to the
  835. // server regardless of whether the field is empty or not. This may be
  836. // used to include empty fields in Patch requests.
  837. ForceSendFields []string `json:"-"`
  838. // NullFields is a list of field names (e.g. "AccountId") to include in
  839. // API requests with the JSON null value. By default, fields with empty
  840. // values are omitted from API requests. However, any field with an
  841. // empty value appearing in NullFields will be sent to the server as
  842. // null. It is an error if a field in this list has a non-empty value.
  843. // This may be used to include null fields in Patch requests.
  844. NullFields []string `json:"-"`
  845. }
  846. func (s *DirectDeal) MarshalJSON() ([]byte, error) {
  847. type NoMethod DirectDeal
  848. raw := NoMethod(*s)
  849. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  850. }
  851. // DirectDealsList: A direct deals feed lists Direct Deals the Ad
  852. // Exchange buyer account has access to. This includes direct deals set
  853. // up for the buyer account as well as its merged stream seats.
  854. type DirectDealsList struct {
  855. // DirectDeals: A list of direct deals relevant for your account.
  856. DirectDeals []*DirectDeal `json:"directDeals,omitempty"`
  857. // Kind: Resource type.
  858. Kind string `json:"kind,omitempty"`
  859. // ServerResponse contains the HTTP response code and headers from the
  860. // server.
  861. googleapi.ServerResponse `json:"-"`
  862. // ForceSendFields is a list of field names (e.g. "DirectDeals") to
  863. // unconditionally include in API requests. By default, fields with
  864. // empty values are omitted from API requests. However, any non-pointer,
  865. // non-interface field appearing in ForceSendFields will be sent to the
  866. // server regardless of whether the field is empty or not. This may be
  867. // used to include empty fields in Patch requests.
  868. ForceSendFields []string `json:"-"`
  869. // NullFields is a list of field names (e.g. "DirectDeals") to include
  870. // in API requests with the JSON null value. By default, fields with
  871. // empty values are omitted from API requests. However, any field with
  872. // an empty value appearing in NullFields will be sent to the server as
  873. // null. It is an error if a field in this list has a non-empty value.
  874. // This may be used to include null fields in Patch requests.
  875. NullFields []string `json:"-"`
  876. }
  877. func (s *DirectDealsList) MarshalJSON() ([]byte, error) {
  878. type NoMethod DirectDealsList
  879. raw := NoMethod(*s)
  880. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  881. }
  882. // PerformanceReport: The configuration data for an Ad Exchange
  883. // performance report list.
  884. type PerformanceReport struct {
  885. // BidRate: The number of bid responses with an ad.
  886. BidRate float64 `json:"bidRate,omitempty"`
  887. // BidRequestRate: The number of bid requests sent to your bidder.
  888. BidRequestRate float64 `json:"bidRequestRate,omitempty"`
  889. // CalloutStatusRate: Rate of various prefiltering statuses per match.
  890. // Please refer to the callout-status-codes.txt file for different
  891. // statuses.
  892. CalloutStatusRate []interface{} `json:"calloutStatusRate,omitempty"`
  893. // CookieMatcherStatusRate: Average QPS for cookie matcher operations.
  894. CookieMatcherStatusRate []interface{} `json:"cookieMatcherStatusRate,omitempty"`
  895. // CreativeStatusRate: Rate of ads with a given status. Please refer to
  896. // the creative-status-codes.txt file for different statuses.
  897. CreativeStatusRate []interface{} `json:"creativeStatusRate,omitempty"`
  898. // FilteredBidRate: The number of bid responses that were filtered due
  899. // to a policy violation or other errors.
  900. FilteredBidRate float64 `json:"filteredBidRate,omitempty"`
  901. // HostedMatchStatusRate: Average QPS for hosted match operations.
  902. HostedMatchStatusRate []interface{} `json:"hostedMatchStatusRate,omitempty"`
  903. // InventoryMatchRate: The number of potential queries based on your
  904. // pretargeting settings.
  905. InventoryMatchRate float64 `json:"inventoryMatchRate,omitempty"`
  906. // Kind: Resource type.
  907. Kind string `json:"kind,omitempty"`
  908. // Latency50thPercentile: The 50th percentile round trip latency(ms) as
  909. // perceived from Google servers for the duration period covered by the
  910. // report.
  911. Latency50thPercentile float64 `json:"latency50thPercentile,omitempty"`
  912. // Latency85thPercentile: The 85th percentile round trip latency(ms) as
  913. // perceived from Google servers for the duration period covered by the
  914. // report.
  915. Latency85thPercentile float64 `json:"latency85thPercentile,omitempty"`
  916. // Latency95thPercentile: The 95th percentile round trip latency(ms) as
  917. // perceived from Google servers for the duration period covered by the
  918. // report.
  919. Latency95thPercentile float64 `json:"latency95thPercentile,omitempty"`
  920. // NoQuotaInRegion: Rate of various quota account statuses per quota
  921. // check.
  922. NoQuotaInRegion float64 `json:"noQuotaInRegion,omitempty"`
  923. // OutOfQuota: Rate of various quota account statuses per quota check.
  924. OutOfQuota float64 `json:"outOfQuota,omitempty"`
  925. // PixelMatchRequests: Average QPS for pixel match requests from
  926. // clients.
  927. PixelMatchRequests float64 `json:"pixelMatchRequests,omitempty"`
  928. // PixelMatchResponses: Average QPS for pixel match responses from
  929. // clients.
  930. PixelMatchResponses float64 `json:"pixelMatchResponses,omitempty"`
  931. // QuotaConfiguredLimit: The configured quota limits for this account.
  932. QuotaConfiguredLimit float64 `json:"quotaConfiguredLimit,omitempty"`
  933. // QuotaThrottledLimit: The throttled quota limits for this account.
  934. QuotaThrottledLimit float64 `json:"quotaThrottledLimit,omitempty"`
  935. // Region: The trading location of this data.
  936. Region string `json:"region,omitempty"`
  937. // SuccessfulRequestRate: The number of properly formed bid responses
  938. // received by our servers within the deadline.
  939. SuccessfulRequestRate float64 `json:"successfulRequestRate,omitempty"`
  940. // Timestamp: The unix timestamp of the starting time of this
  941. // performance data.
  942. Timestamp int64 `json:"timestamp,omitempty,string"`
  943. // UnsuccessfulRequestRate: The number of bid responses that were
  944. // unsuccessful due to timeouts, incorrect formatting, etc.
  945. UnsuccessfulRequestRate float64 `json:"unsuccessfulRequestRate,omitempty"`
  946. // ForceSendFields is a list of field names (e.g. "BidRate") to
  947. // unconditionally include in API requests. By default, fields with
  948. // empty values are omitted from API requests. However, any non-pointer,
  949. // non-interface field appearing in ForceSendFields will be sent to the
  950. // server regardless of whether the field is empty or not. This may be
  951. // used to include empty fields in Patch requests.
  952. ForceSendFields []string `json:"-"`
  953. // NullFields is a list of field names (e.g. "BidRate") to include in
  954. // API requests with the JSON null value. By default, fields with empty
  955. // values are omitted from API requests. However, any field with an
  956. // empty value appearing in NullFields will be sent to the server as
  957. // null. It is an error if a field in this list has a non-empty value.
  958. // This may be used to include null fields in Patch requests.
  959. NullFields []string `json:"-"`
  960. }
  961. func (s *PerformanceReport) MarshalJSON() ([]byte, error) {
  962. type NoMethod PerformanceReport
  963. raw := NoMethod(*s)
  964. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  965. }
  966. func (s *PerformanceReport) UnmarshalJSON(data []byte) error {
  967. type NoMethod PerformanceReport
  968. var s1 struct {
  969. BidRate gensupport.JSONFloat64 `json:"bidRate"`
  970. BidRequestRate gensupport.JSONFloat64 `json:"bidRequestRate"`
  971. FilteredBidRate gensupport.JSONFloat64 `json:"filteredBidRate"`
  972. InventoryMatchRate gensupport.JSONFloat64 `json:"inventoryMatchRate"`
  973. Latency50thPercentile gensupport.JSONFloat64 `json:"latency50thPercentile"`
  974. Latency85thPercentile gensupport.JSONFloat64 `json:"latency85thPercentile"`
  975. Latency95thPercentile gensupport.JSONFloat64 `json:"latency95thPercentile"`
  976. NoQuotaInRegion gensupport.JSONFloat64 `json:"noQuotaInRegion"`
  977. OutOfQuota gensupport.JSONFloat64 `json:"outOfQuota"`
  978. PixelMatchRequests gensupport.JSONFloat64 `json:"pixelMatchRequests"`
  979. PixelMatchResponses gensupport.JSONFloat64 `json:"pixelMatchResponses"`
  980. QuotaConfiguredLimit gensupport.JSONFloat64 `json:"quotaConfiguredLimit"`
  981. QuotaThrottledLimit gensupport.JSONFloat64 `json:"quotaThrottledLimit"`
  982. SuccessfulRequestRate gensupport.JSONFloat64 `json:"successfulRequestRate"`
  983. UnsuccessfulRequestRate gensupport.JSONFloat64 `json:"unsuccessfulRequestRate"`
  984. *NoMethod
  985. }
  986. s1.NoMethod = (*NoMethod)(s)
  987. if err := json.Unmarshal(data, &s1); err != nil {
  988. return err
  989. }
  990. s.BidRate = float64(s1.BidRate)
  991. s.BidRequestRate = float64(s1.BidRequestRate)
  992. s.FilteredBidRate = float64(s1.FilteredBidRate)
  993. s.InventoryMatchRate = float64(s1.InventoryMatchRate)
  994. s.Latency50thPercentile = float64(s1.Latency50thPercentile)
  995. s.Latency85thPercentile = float64(s1.Latency85thPercentile)
  996. s.Latency95thPercentile = float64(s1.Latency95thPercentile)
  997. s.NoQuotaInRegion = float64(s1.NoQuotaInRegion)
  998. s.OutOfQuota = float64(s1.OutOfQuota)
  999. s.PixelMatchRequests = float64(s1.PixelMatchRequests)
  1000. s.PixelMatchResponses = float64(s1.PixelMatchResponses)
  1001. s.QuotaConfiguredLimit = float64(s1.QuotaConfiguredLimit)
  1002. s.QuotaThrottledLimit = float64(s1.QuotaThrottledLimit)
  1003. s.SuccessfulRequestRate = float64(s1.SuccessfulRequestRate)
  1004. s.UnsuccessfulRequestRate = float64(s1.UnsuccessfulRequestRate)
  1005. return nil
  1006. }
  1007. // PerformanceReportList: The configuration data for an Ad Exchange
  1008. // performance report list.
  1009. type PerformanceReportList struct {
  1010. // Kind: Resource type.
  1011. Kind string `json:"kind,omitempty"`
  1012. // PerformanceReport: A list of performance reports relevant for the
  1013. // account.
  1014. PerformanceReport []*PerformanceReport `json:"performanceReport,omitempty"`
  1015. // ServerResponse contains the HTTP response code and headers from the
  1016. // server.
  1017. googleapi.ServerResponse `json:"-"`
  1018. // ForceSendFields is a list of field names (e.g. "Kind") to
  1019. // unconditionally include in API requests. By default, fields with
  1020. // empty values are omitted from API requests. However, any non-pointer,
  1021. // non-interface field appearing in ForceSendFields will be sent to the
  1022. // server regardless of whether the field is empty or not. This may be
  1023. // used to include empty fields in Patch requests.
  1024. ForceSendFields []string `json:"-"`
  1025. // NullFields is a list of field names (e.g. "Kind") to include in API
  1026. // requests with the JSON null value. By default, fields with empty
  1027. // values are omitted from API requests. However, any field with an
  1028. // empty value appearing in NullFields will be sent to the server as
  1029. // null. It is an error if a field in this list has a non-empty value.
  1030. // This may be used to include null fields in Patch requests.
  1031. NullFields []string `json:"-"`
  1032. }
  1033. func (s *PerformanceReportList) MarshalJSON() ([]byte, error) {
  1034. type NoMethod PerformanceReportList
  1035. raw := NoMethod(*s)
  1036. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1037. }
  1038. type PretargetingConfig struct {
  1039. // BillingId: The id for billing purposes, provided for reference. Leave
  1040. // this field blank for insert requests; the id will be generated
  1041. // automatically.
  1042. BillingId int64 `json:"billingId,omitempty,string"`
  1043. // ConfigId: The config id; generated automatically. Leave this field
  1044. // blank for insert requests.
  1045. ConfigId int64 `json:"configId,omitempty,string"`
  1046. // ConfigName: The name of the config. Must be unique. Required for all
  1047. // requests.
  1048. ConfigName string `json:"configName,omitempty"`
  1049. // CreativeType: List must contain exactly one of
  1050. // PRETARGETING_CREATIVE_TYPE_HTML or PRETARGETING_CREATIVE_TYPE_VIDEO.
  1051. CreativeType []string `json:"creativeType,omitempty"`
  1052. // Dimensions: Requests which allow one of these (width, height) pairs
  1053. // will match. All pairs must be supported ad dimensions.
  1054. Dimensions []*PretargetingConfigDimensions `json:"dimensions,omitempty"`
  1055. // ExcludedContentLabels: Requests with any of these content labels will
  1056. // not match. Values are from content-labels.txt in the downloadable
  1057. // files section.
  1058. ExcludedContentLabels googleapi.Int64s `json:"excludedContentLabels,omitempty"`
  1059. // ExcludedGeoCriteriaIds: Requests containing any of these geo criteria
  1060. // ids will not match.
  1061. ExcludedGeoCriteriaIds googleapi.Int64s `json:"excludedGeoCriteriaIds,omitempty"`
  1062. // ExcludedPlacements: Requests containing any of these placements will
  1063. // not match.
  1064. ExcludedPlacements []*PretargetingConfigExcludedPlacements `json:"excludedPlacements,omitempty"`
  1065. // ExcludedUserLists: Requests containing any of these users list ids
  1066. // will not match.
  1067. ExcludedUserLists googleapi.Int64s `json:"excludedUserLists,omitempty"`
  1068. // ExcludedVerticals: Requests containing any of these vertical ids will
  1069. // not match. Values are from the publisher-verticals.txt file in the
  1070. // downloadable files section.
  1071. ExcludedVerticals googleapi.Int64s `json:"excludedVerticals,omitempty"`
  1072. // GeoCriteriaIds: Requests containing any of these geo criteria ids
  1073. // will match.
  1074. GeoCriteriaIds googleapi.Int64s `json:"geoCriteriaIds,omitempty"`
  1075. // IsActive: Whether this config is active. Required for all requests.
  1076. IsActive bool `json:"isActive,omitempty"`
  1077. // Kind: The kind of the resource, i.e.
  1078. // "adexchangebuyer#pretargetingConfig".
  1079. Kind string `json:"kind,omitempty"`
  1080. // Languages: Request containing any of these language codes will match.
  1081. Languages []string `json:"languages,omitempty"`
  1082. // MobileCarriers: Requests containing any of these mobile carrier ids
  1083. // will match. Values are from mobile-carriers.csv in the downloadable
  1084. // files section.
  1085. MobileCarriers googleapi.Int64s `json:"mobileCarriers,omitempty"`
  1086. // MobileDevices: Requests containing any of these mobile device ids
  1087. // will match. Values are from mobile-devices.csv in the downloadable
  1088. // files section.
  1089. MobileDevices googleapi.Int64s `json:"mobileDevices,omitempty"`
  1090. // MobileOperatingSystemVersions: Requests containing any of these
  1091. // mobile operating system version ids will match. Values are from
  1092. // mobile-os.csv in the downloadable files section.
  1093. MobileOperatingSystemVersions googleapi.Int64s `json:"mobileOperatingSystemVersions,omitempty"`
  1094. // Placements: Requests containing any of these placements will match.
  1095. Placements []*PretargetingConfigPlacements `json:"placements,omitempty"`
  1096. // Platforms: Requests matching any of these platforms will match.
  1097. // Possible values are PRETARGETING_PLATFORM_MOBILE,
  1098. // PRETARGETING_PLATFORM_DESKTOP, and PRETARGETING_PLATFORM_TABLET.
  1099. Platforms []string `json:"platforms,omitempty"`
  1100. // SupportedCreativeAttributes: Creative attributes should be declared
  1101. // here if all creatives corresponding to this pretargeting
  1102. // configuration have that creative attribute. Values are from
  1103. // pretargetable-creative-attributes.txt in the downloadable files
  1104. // section.
  1105. SupportedCreativeAttributes googleapi.Int64s `json:"supportedCreativeAttributes,omitempty"`
  1106. // UserLists: Requests containing any of these user list ids will match.
  1107. UserLists googleapi.Int64s `json:"userLists,omitempty"`
  1108. // VendorTypes: Requests that allow any of these vendor ids will match.
  1109. // Values are from vendors.txt in the downloadable files section.
  1110. VendorTypes googleapi.Int64s `json:"vendorTypes,omitempty"`
  1111. // Verticals: Requests containing any of these vertical ids will match.
  1112. Verticals googleapi.Int64s `json:"verticals,omitempty"`
  1113. // ServerResponse contains the HTTP response code and headers from the
  1114. // server.
  1115. googleapi.ServerResponse `json:"-"`
  1116. // ForceSendFields is a list of field names (e.g. "BillingId") to
  1117. // unconditionally include in API requests. By default, fields with
  1118. // empty values are omitted from API requests. However, any non-pointer,
  1119. // non-interface field appearing in ForceSendFields will be sent to the
  1120. // server regardless of whether the field is empty or not. This may be
  1121. // used to include empty fields in Patch requests.
  1122. ForceSendFields []string `json:"-"`
  1123. // NullFields is a list of field names (e.g. "BillingId") to include in
  1124. // API requests with the JSON null value. By default, fields with empty
  1125. // values are omitted from API requests. However, any field with an
  1126. // empty value appearing in NullFields will be sent to the server as
  1127. // null. It is an error if a field in this list has a non-empty value.
  1128. // This may be used to include null fields in Patch requests.
  1129. NullFields []string `json:"-"`
  1130. }
  1131. func (s *PretargetingConfig) MarshalJSON() ([]byte, error) {
  1132. type NoMethod PretargetingConfig
  1133. raw := NoMethod(*s)
  1134. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1135. }
  1136. type PretargetingConfigDimensions struct {
  1137. // Height: Height in pixels.
  1138. Height int64 `json:"height,omitempty,string"`
  1139. // Width: Width in pixels.
  1140. Width int64 `json:"width,omitempty,string"`
  1141. // ForceSendFields is a list of field names (e.g. "Height") to
  1142. // unconditionally include in API requests. By default, fields with
  1143. // empty values are omitted from API requests. However, any non-pointer,
  1144. // non-interface field appearing in ForceSendFields will be sent to the
  1145. // server regardless of whether the field is empty or not. This may be
  1146. // used to include empty fields in Patch requests.
  1147. ForceSendFields []string `json:"-"`
  1148. // NullFields is a list of field names (e.g. "Height") to include in API
  1149. // requests with the JSON null value. By default, fields with empty
  1150. // values are omitted from API requests. However, any field with an
  1151. // empty value appearing in NullFields will be sent to the server as
  1152. // null. It is an error if a field in this list has a non-empty value.
  1153. // This may be used to include null fields in Patch requests.
  1154. NullFields []string `json:"-"`
  1155. }
  1156. func (s *PretargetingConfigDimensions) MarshalJSON() ([]byte, error) {
  1157. type NoMethod PretargetingConfigDimensions
  1158. raw := NoMethod(*s)
  1159. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1160. }
  1161. type PretargetingConfigExcludedPlacements struct {
  1162. // Token: The value of the placement. Interpretation depends on the
  1163. // placement type, e.g. URL for a site placement, channel name for a
  1164. // channel placement, app id for a mobile app placement.
  1165. Token string `json:"token,omitempty"`
  1166. // Type: The type of the placement.
  1167. Type string `json:"type,omitempty"`
  1168. // ForceSendFields is a list of field names (e.g. "Token") to
  1169. // unconditionally include in API requests. By default, fields with
  1170. // empty values are omitted from API requests. However, any non-pointer,
  1171. // non-interface field appearing in ForceSendFields will be sent to the
  1172. // server regardless of whether the field is empty or not. This may be
  1173. // used to include empty fields in Patch requests.
  1174. ForceSendFields []string `json:"-"`
  1175. // NullFields is a list of field names (e.g. "Token") to include in API
  1176. // requests with the JSON null value. By default, fields with empty
  1177. // values are omitted from API requests. However, any field with an
  1178. // empty value appearing in NullFields will be sent to the server as
  1179. // null. It is an error if a field in this list has a non-empty value.
  1180. // This may be used to include null fields in Patch requests.
  1181. NullFields []string `json:"-"`
  1182. }
  1183. func (s *PretargetingConfigExcludedPlacements) MarshalJSON() ([]byte, error) {
  1184. type NoMethod PretargetingConfigExcludedPlacements
  1185. raw := NoMethod(*s)
  1186. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1187. }
  1188. type PretargetingConfigPlacements struct {
  1189. // Token: The value of the placement. Interpretation depends on the
  1190. // placement type, e.g. URL for a site placement, channel name for a
  1191. // channel placement, app id for a mobile app placement.
  1192. Token string `json:"token,omitempty"`
  1193. // Type: The type of the placement.
  1194. Type string `json:"type,omitempty"`
  1195. // ForceSendFields is a list of field names (e.g. "Token") to
  1196. // unconditionally include in API requests. By default, fields with
  1197. // empty values are omitted from API requests. However, any non-pointer,
  1198. // non-interface field appearing in ForceSendFields will be sent to the
  1199. // server regardless of whether the field is empty or not. This may be
  1200. // used to include empty fields in Patch requests.
  1201. ForceSendFields []string `json:"-"`
  1202. // NullFields is a list of field names (e.g. "Token") to include in API
  1203. // requests with the JSON null value. By default, fields with empty
  1204. // values are omitted from API requests. However, any field with an
  1205. // empty value appearing in NullFields will be sent to the server as
  1206. // null. It is an error if a field in this list has a non-empty value.
  1207. // This may be used to include null fields in Patch requests.
  1208. NullFields []string `json:"-"`
  1209. }
  1210. func (s *PretargetingConfigPlacements) MarshalJSON() ([]byte, error) {
  1211. type NoMethod PretargetingConfigPlacements
  1212. raw := NoMethod(*s)
  1213. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1214. }
  1215. type PretargetingConfigList struct {
  1216. // Items: A list of pretargeting configs
  1217. Items []*PretargetingConfig `json:"items,omitempty"`
  1218. // Kind: Resource type.
  1219. Kind string `json:"kind,omitempty"`
  1220. // ServerResponse contains the HTTP response code and headers from the
  1221. // server.
  1222. googleapi.ServerResponse `json:"-"`
  1223. // ForceSendFields is a list of field names (e.g. "Items") to
  1224. // unconditionally include in API requests. By default, fields with
  1225. // empty values are omitted from API requests. However, any non-pointer,
  1226. // non-interface field appearing in ForceSendFields will be sent to the
  1227. // server regardless of whether the field is empty or not. This may be
  1228. // used to include empty fields in Patch requests.
  1229. ForceSendFields []string `json:"-"`
  1230. // NullFields is a list of field names (e.g. "Items") to include in API
  1231. // requests with the JSON null value. By default, fields with empty
  1232. // values are omitted from API requests. However, any field with an
  1233. // empty value appearing in NullFields will be sent to the server as
  1234. // null. It is an error if a field in this list has a non-empty value.
  1235. // This may be used to include null fields in Patch requests.
  1236. NullFields []string `json:"-"`
  1237. }
  1238. func (s *PretargetingConfigList) MarshalJSON() ([]byte, error) {
  1239. type NoMethod PretargetingConfigList
  1240. raw := NoMethod(*s)
  1241. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1242. }
  1243. // method id "adexchangebuyer.accounts.get":
  1244. type AccountsGetCall struct {
  1245. s *Service
  1246. id int64
  1247. urlParams_ gensupport.URLParams
  1248. ifNoneMatch_ string
  1249. ctx_ context.Context
  1250. header_ http.Header
  1251. }
  1252. // Get: Gets one account by ID.
  1253. func (r *AccountsService) Get(id int64) *AccountsGetCall {
  1254. c := &AccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1255. c.id = id
  1256. return c
  1257. }
  1258. // Fields allows partial responses to be retrieved. See
  1259. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1260. // for more information.
  1261. func (c *AccountsGetCall) Fields(s ...googleapi.Field) *AccountsGetCall {
  1262. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1263. return c
  1264. }
  1265. // IfNoneMatch sets the optional parameter which makes the operation
  1266. // fail if the object's ETag matches the given value. This is useful for
  1267. // getting updates only after the object has changed since the last
  1268. // request. Use googleapi.IsNotModified to check whether the response
  1269. // error from Do is the result of In-None-Match.
  1270. func (c *AccountsGetCall) IfNoneMatch(entityTag string) *AccountsGetCall {
  1271. c.ifNoneMatch_ = entityTag
  1272. return c
  1273. }
  1274. // Context sets the context to be used in this call's Do method. Any
  1275. // pending HTTP request will be aborted if the provided context is
  1276. // canceled.
  1277. func (c *AccountsGetCall) Context(ctx context.Context) *AccountsGetCall {
  1278. c.ctx_ = ctx
  1279. return c
  1280. }
  1281. // Header returns an http.Header that can be modified by the caller to
  1282. // add HTTP headers to the request.
  1283. func (c *AccountsGetCall) Header() http.Header {
  1284. if c.header_ == nil {
  1285. c.header_ = make(http.Header)
  1286. }
  1287. return c.header_
  1288. }
  1289. func (c *AccountsGetCall) doRequest(alt string) (*http.Response, error) {
  1290. reqHeaders := make(http.Header)
  1291. for k, v := range c.header_ {
  1292. reqHeaders[k] = v
  1293. }
  1294. reqHeaders.Set("User-Agent", c.s.userAgent())
  1295. if c.ifNoneMatch_ != "" {
  1296. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1297. }
  1298. var body io.Reader = nil
  1299. c.urlParams_.Set("alt", alt)
  1300. c.urlParams_.Set("prettyPrint", "false")
  1301. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}")
  1302. urls += "?" + c.urlParams_.Encode()
  1303. req, err := http.NewRequest("GET", urls, body)
  1304. if err != nil {
  1305. return nil, err
  1306. }
  1307. req.Header = reqHeaders
  1308. googleapi.Expand(req.URL, map[string]string{
  1309. "id": strconv.FormatInt(c.id, 10),
  1310. })
  1311. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1312. }
  1313. // Do executes the "adexchangebuyer.accounts.get" call.
  1314. // Exactly one of *Account or error will be non-nil. Any non-2xx status
  1315. // code is an error. Response headers are in either
  1316. // *Account.ServerResponse.Header or (if a response was returned at all)
  1317. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1318. // check whether the returned error was because http.StatusNotModified
  1319. // was returned.
  1320. func (c *AccountsGetCall) Do(opts ...googleapi.CallOption) (*Account, error) {
  1321. gensupport.SetOptions(c.urlParams_, opts...)
  1322. res, err := c.doRequest("json")
  1323. if res != nil && res.StatusCode == http.StatusNotModified {
  1324. if res.Body != nil {
  1325. res.Body.Close()
  1326. }
  1327. return nil, &googleapi.Error{
  1328. Code: res.StatusCode,
  1329. Header: res.Header,
  1330. }
  1331. }
  1332. if err != nil {
  1333. return nil, err
  1334. }
  1335. defer googleapi.CloseBody(res)
  1336. if err := googleapi.CheckResponse(res); err != nil {
  1337. return nil, err
  1338. }
  1339. ret := &Account{
  1340. ServerResponse: googleapi.ServerResponse{
  1341. Header: res.Header,
  1342. HTTPStatusCode: res.StatusCode,
  1343. },
  1344. }
  1345. target := &ret
  1346. if err := gensupport.DecodeResponse(target, res); err != nil {
  1347. return nil, err
  1348. }
  1349. return ret, nil
  1350. // {
  1351. // "description": "Gets one account by ID.",
  1352. // "httpMethod": "GET",
  1353. // "id": "adexchangebuyer.accounts.get",
  1354. // "parameterOrder": [
  1355. // "id"
  1356. // ],
  1357. // "parameters": {
  1358. // "id": {
  1359. // "description": "The account id",
  1360. // "format": "int32",
  1361. // "location": "path",
  1362. // "required": true,
  1363. // "type": "integer"
  1364. // }
  1365. // },
  1366. // "path": "accounts/{id}",
  1367. // "response": {
  1368. // "$ref": "Account"
  1369. // },
  1370. // "scopes": [
  1371. // "https://www.googleapis.com/auth/adexchange.buyer"
  1372. // ]
  1373. // }
  1374. }
  1375. // method id "adexchangebuyer.accounts.list":
  1376. type AccountsListCall struct {
  1377. s *Service
  1378. urlParams_ gensupport.URLParams
  1379. ifNoneMatch_ string
  1380. ctx_ context.Context
  1381. header_ http.Header
  1382. }
  1383. // List: Retrieves the authenticated user's list of accounts.
  1384. func (r *AccountsService) List() *AccountsListCall {
  1385. c := &AccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1386. return c
  1387. }
  1388. // Fields allows partial responses to be retrieved. See
  1389. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1390. // for more information.
  1391. func (c *AccountsListCall) Fields(s ...googleapi.Field) *AccountsListCall {
  1392. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1393. return c
  1394. }
  1395. // IfNoneMatch sets the optional parameter which makes the operation
  1396. // fail if the object's ETag matches the given value. This is useful for
  1397. // getting updates only after the object has changed since the last
  1398. // request. Use googleapi.IsNotModified to check whether the response
  1399. // error from Do is the result of In-None-Match.
  1400. func (c *AccountsListCall) IfNoneMatch(entityTag string) *AccountsListCall {
  1401. c.ifNoneMatch_ = entityTag
  1402. return c
  1403. }
  1404. // Context sets the context to be used in this call's Do method. Any
  1405. // pending HTTP request will be aborted if the provided context is
  1406. // canceled.
  1407. func (c *AccountsListCall) Context(ctx context.Context) *AccountsListCall {
  1408. c.ctx_ = ctx
  1409. return c
  1410. }
  1411. // Header returns an http.Header that can be modified by the caller to
  1412. // add HTTP headers to the request.
  1413. func (c *AccountsListCall) Header() http.Header {
  1414. if c.header_ == nil {
  1415. c.header_ = make(http.Header)
  1416. }
  1417. return c.header_
  1418. }
  1419. func (c *AccountsListCall) doRequest(alt string) (*http.Response, error) {
  1420. reqHeaders := make(http.Header)
  1421. for k, v := range c.header_ {
  1422. reqHeaders[k] = v
  1423. }
  1424. reqHeaders.Set("User-Agent", c.s.userAgent())
  1425. if c.ifNoneMatch_ != "" {
  1426. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1427. }
  1428. var body io.Reader = nil
  1429. c.urlParams_.Set("alt", alt)
  1430. c.urlParams_.Set("prettyPrint", "false")
  1431. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts")
  1432. urls += "?" + c.urlParams_.Encode()
  1433. req, err := http.NewRequest("GET", urls, body)
  1434. if err != nil {
  1435. return nil, err
  1436. }
  1437. req.Header = reqHeaders
  1438. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1439. }
  1440. // Do executes the "adexchangebuyer.accounts.list" call.
  1441. // Exactly one of *AccountsList or error will be non-nil. Any non-2xx
  1442. // status code is an error. Response headers are in either
  1443. // *AccountsList.ServerResponse.Header or (if a response was returned at
  1444. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1445. // to check whether the returned error was because
  1446. // http.StatusNotModified was returned.
  1447. func (c *AccountsListCall) Do(opts ...googleapi.CallOption) (*AccountsList, error) {
  1448. gensupport.SetOptions(c.urlParams_, opts...)
  1449. res, err := c.doRequest("json")
  1450. if res != nil && res.StatusCode == http.StatusNotModified {
  1451. if res.Body != nil {
  1452. res.Body.Close()
  1453. }
  1454. return nil, &googleapi.Error{
  1455. Code: res.StatusCode,
  1456. Header: res.Header,
  1457. }
  1458. }
  1459. if err != nil {
  1460. return nil, err
  1461. }
  1462. defer googleapi.CloseBody(res)
  1463. if err := googleapi.CheckResponse(res); err != nil {
  1464. return nil, err
  1465. }
  1466. ret := &AccountsList{
  1467. ServerResponse: googleapi.ServerResponse{
  1468. Header: res.Header,
  1469. HTTPStatusCode: res.StatusCode,
  1470. },
  1471. }
  1472. target := &ret
  1473. if err := gensupport.DecodeResponse(target, res); err != nil {
  1474. return nil, err
  1475. }
  1476. return ret, nil
  1477. // {
  1478. // "description": "Retrieves the authenticated user's list of accounts.",
  1479. // "httpMethod": "GET",
  1480. // "id": "adexchangebuyer.accounts.list",
  1481. // "path": "accounts",
  1482. // "response": {
  1483. // "$ref": "AccountsList"
  1484. // },
  1485. // "scopes": [
  1486. // "https://www.googleapis.com/auth/adexchange.buyer"
  1487. // ]
  1488. // }
  1489. }
  1490. // method id "adexchangebuyer.accounts.patch":
  1491. type AccountsPatchCall struct {
  1492. s *Service
  1493. id int64
  1494. account *Account
  1495. urlParams_ gensupport.URLParams
  1496. ctx_ context.Context
  1497. header_ http.Header
  1498. }
  1499. // Patch: Updates an existing account. This method supports patch
  1500. // semantics.
  1501. func (r *AccountsService) Patch(id int64, account *Account) *AccountsPatchCall {
  1502. c := &AccountsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1503. c.id = id
  1504. c.account = account
  1505. return c
  1506. }
  1507. // Fields allows partial responses to be retrieved. See
  1508. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1509. // for more information.
  1510. func (c *AccountsPatchCall) Fields(s ...googleapi.Field) *AccountsPatchCall {
  1511. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1512. return c
  1513. }
  1514. // Context sets the context to be used in this call's Do method. Any
  1515. // pending HTTP request will be aborted if the provided context is
  1516. // canceled.
  1517. func (c *AccountsPatchCall) Context(ctx context.Context) *AccountsPatchCall {
  1518. c.ctx_ = ctx
  1519. return c
  1520. }
  1521. // Header returns an http.Header that can be modified by the caller to
  1522. // add HTTP headers to the request.
  1523. func (c *AccountsPatchCall) Header() http.Header {
  1524. if c.header_ == nil {
  1525. c.header_ = make(http.Header)
  1526. }
  1527. return c.header_
  1528. }
  1529. func (c *AccountsPatchCall) doRequest(alt string) (*http.Response, error) {
  1530. reqHeaders := make(http.Header)
  1531. for k, v := range c.header_ {
  1532. reqHeaders[k] = v
  1533. }
  1534. reqHeaders.Set("User-Agent", c.s.userAgent())
  1535. var body io.Reader = nil
  1536. body, err := googleapi.WithoutDataWrapper.JSONReader(c.account)
  1537. if err != nil {
  1538. return nil, err
  1539. }
  1540. reqHeaders.Set("Content-Type", "application/json")
  1541. c.urlParams_.Set("alt", alt)
  1542. c.urlParams_.Set("prettyPrint", "false")
  1543. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}")
  1544. urls += "?" + c.urlParams_.Encode()
  1545. req, err := http.NewRequest("PATCH", urls, body)
  1546. if err != nil {
  1547. return nil, err
  1548. }
  1549. req.Header = reqHeaders
  1550. googleapi.Expand(req.URL, map[string]string{
  1551. "id": strconv.FormatInt(c.id, 10),
  1552. })
  1553. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1554. }
  1555. // Do executes the "adexchangebuyer.accounts.patch" call.
  1556. // Exactly one of *Account or error will be non-nil. Any non-2xx status
  1557. // code is an error. Response headers are in either
  1558. // *Account.ServerResponse.Header or (if a response was returned at all)
  1559. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1560. // check whether the returned error was because http.StatusNotModified
  1561. // was returned.
  1562. func (c *AccountsPatchCall) Do(opts ...googleapi.CallOption) (*Account, error) {
  1563. gensupport.SetOptions(c.urlParams_, opts...)
  1564. res, err := c.doRequest("json")
  1565. if res != nil && res.StatusCode == http.StatusNotModified {
  1566. if res.Body != nil {
  1567. res.Body.Close()
  1568. }
  1569. return nil, &googleapi.Error{
  1570. Code: res.StatusCode,
  1571. Header: res.Header,
  1572. }
  1573. }
  1574. if err != nil {
  1575. return nil, err
  1576. }
  1577. defer googleapi.CloseBody(res)
  1578. if err := googleapi.CheckResponse(res); err != nil {
  1579. return nil, err
  1580. }
  1581. ret := &Account{
  1582. ServerResponse: googleapi.ServerResponse{
  1583. Header: res.Header,
  1584. HTTPStatusCode: res.StatusCode,
  1585. },
  1586. }
  1587. target := &ret
  1588. if err := gensupport.DecodeResponse(target, res); err != nil {
  1589. return nil, err
  1590. }
  1591. return ret, nil
  1592. // {
  1593. // "description": "Updates an existing account. This method supports patch semantics.",
  1594. // "httpMethod": "PATCH",
  1595. // "id": "adexchangebuyer.accounts.patch",
  1596. // "parameterOrder": [
  1597. // "id"
  1598. // ],
  1599. // "parameters": {
  1600. // "id": {
  1601. // "description": "The account id",
  1602. // "format": "int32",
  1603. // "location": "path",
  1604. // "required": true,
  1605. // "type": "integer"
  1606. // }
  1607. // },
  1608. // "path": "accounts/{id}",
  1609. // "request": {
  1610. // "$ref": "Account"
  1611. // },
  1612. // "response": {
  1613. // "$ref": "Account"
  1614. // },
  1615. // "scopes": [
  1616. // "https://www.googleapis.com/auth/adexchange.buyer"
  1617. // ]
  1618. // }
  1619. }
  1620. // method id "adexchangebuyer.accounts.update":
  1621. type AccountsUpdateCall struct {
  1622. s *Service
  1623. id int64
  1624. account *Account
  1625. urlParams_ gensupport.URLParams
  1626. ctx_ context.Context
  1627. header_ http.Header
  1628. }
  1629. // Update: Updates an existing account.
  1630. func (r *AccountsService) Update(id int64, account *Account) *AccountsUpdateCall {
  1631. c := &AccountsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1632. c.id = id
  1633. c.account = account
  1634. return c
  1635. }
  1636. // Fields allows partial responses to be retrieved. See
  1637. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1638. // for more information.
  1639. func (c *AccountsUpdateCall) Fields(s ...googleapi.Field) *AccountsUpdateCall {
  1640. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1641. return c
  1642. }
  1643. // Context sets the context to be used in this call's Do method. Any
  1644. // pending HTTP request will be aborted if the provided context is
  1645. // canceled.
  1646. func (c *AccountsUpdateCall) Context(ctx context.Context) *AccountsUpdateCall {
  1647. c.ctx_ = ctx
  1648. return c
  1649. }
  1650. // Header returns an http.Header that can be modified by the caller to
  1651. // add HTTP headers to the request.
  1652. func (c *AccountsUpdateCall) Header() http.Header {
  1653. if c.header_ == nil {
  1654. c.header_ = make(http.Header)
  1655. }
  1656. return c.header_
  1657. }
  1658. func (c *AccountsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1659. reqHeaders := make(http.Header)
  1660. for k, v := range c.header_ {
  1661. reqHeaders[k] = v
  1662. }
  1663. reqHeaders.Set("User-Agent", c.s.userAgent())
  1664. var body io.Reader = nil
  1665. body, err := googleapi.WithoutDataWrapper.JSONReader(c.account)
  1666. if err != nil {
  1667. return nil, err
  1668. }
  1669. reqHeaders.Set("Content-Type", "application/json")
  1670. c.urlParams_.Set("alt", alt)
  1671. c.urlParams_.Set("prettyPrint", "false")
  1672. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{id}")
  1673. urls += "?" + c.urlParams_.Encode()
  1674. req, err := http.NewRequest("PUT", urls, body)
  1675. if err != nil {
  1676. return nil, err
  1677. }
  1678. req.Header = reqHeaders
  1679. googleapi.Expand(req.URL, map[string]string{
  1680. "id": strconv.FormatInt(c.id, 10),
  1681. })
  1682. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1683. }
  1684. // Do executes the "adexchangebuyer.accounts.update" call.
  1685. // Exactly one of *Account or error will be non-nil. Any non-2xx status
  1686. // code is an error. Response headers are in either
  1687. // *Account.ServerResponse.Header or (if a response was returned at all)
  1688. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1689. // check whether the returned error was because http.StatusNotModified
  1690. // was returned.
  1691. func (c *AccountsUpdateCall) Do(opts ...googleapi.CallOption) (*Account, error) {
  1692. gensupport.SetOptions(c.urlParams_, opts...)
  1693. res, err := c.doRequest("json")
  1694. if res != nil && res.StatusCode == http.StatusNotModified {
  1695. if res.Body != nil {
  1696. res.Body.Close()
  1697. }
  1698. return nil, &googleapi.Error{
  1699. Code: res.StatusCode,
  1700. Header: res.Header,
  1701. }
  1702. }
  1703. if err != nil {
  1704. return nil, err
  1705. }
  1706. defer googleapi.CloseBody(res)
  1707. if err := googleapi.CheckResponse(res); err != nil {
  1708. return nil, err
  1709. }
  1710. ret := &Account{
  1711. ServerResponse: googleapi.ServerResponse{
  1712. Header: res.Header,
  1713. HTTPStatusCode: res.StatusCode,
  1714. },
  1715. }
  1716. target := &ret
  1717. if err := gensupport.DecodeResponse(target, res); err != nil {
  1718. return nil, err
  1719. }
  1720. return ret, nil
  1721. // {
  1722. // "description": "Updates an existing account.",
  1723. // "httpMethod": "PUT",
  1724. // "id": "adexchangebuyer.accounts.update",
  1725. // "parameterOrder": [
  1726. // "id"
  1727. // ],
  1728. // "parameters": {
  1729. // "id": {
  1730. // "description": "The account id",
  1731. // "format": "int32",
  1732. // "location": "path",
  1733. // "required": true,
  1734. // "type": "integer"
  1735. // }
  1736. // },
  1737. // "path": "accounts/{id}",
  1738. // "request": {
  1739. // "$ref": "Account"
  1740. // },
  1741. // "response": {
  1742. // "$ref": "Account"
  1743. // },
  1744. // "scopes": [
  1745. // "https://www.googleapis.com/auth/adexchange.buyer"
  1746. // ]
  1747. // }
  1748. }
  1749. // method id "adexchangebuyer.billingInfo.get":
  1750. type BillingInfoGetCall struct {
  1751. s *Service
  1752. accountId int64
  1753. urlParams_ gensupport.URLParams
  1754. ifNoneMatch_ string
  1755. ctx_ context.Context
  1756. header_ http.Header
  1757. }
  1758. // Get: Returns the billing information for one account specified by
  1759. // account ID.
  1760. func (r *BillingInfoService) Get(accountId int64) *BillingInfoGetCall {
  1761. c := &BillingInfoGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1762. c.accountId = accountId
  1763. return c
  1764. }
  1765. // Fields allows partial responses to be retrieved. See
  1766. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1767. // for more information.
  1768. func (c *BillingInfoGetCall) Fields(s ...googleapi.Field) *BillingInfoGetCall {
  1769. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1770. return c
  1771. }
  1772. // IfNoneMatch sets the optional parameter which makes the operation
  1773. // fail if the object's ETag matches the given value. This is useful for
  1774. // getting updates only after the object has changed since the last
  1775. // request. Use googleapi.IsNotModified to check whether the response
  1776. // error from Do is the result of In-None-Match.
  1777. func (c *BillingInfoGetCall) IfNoneMatch(entityTag string) *BillingInfoGetCall {
  1778. c.ifNoneMatch_ = entityTag
  1779. return c
  1780. }
  1781. // Context sets the context to be used in this call's Do method. Any
  1782. // pending HTTP request will be aborted if the provided context is
  1783. // canceled.
  1784. func (c *BillingInfoGetCall) Context(ctx context.Context) *BillingInfoGetCall {
  1785. c.ctx_ = ctx
  1786. return c
  1787. }
  1788. // Header returns an http.Header that can be modified by the caller to
  1789. // add HTTP headers to the request.
  1790. func (c *BillingInfoGetCall) Header() http.Header {
  1791. if c.header_ == nil {
  1792. c.header_ = make(http.Header)
  1793. }
  1794. return c.header_
  1795. }
  1796. func (c *BillingInfoGetCall) doRequest(alt string) (*http.Response, error) {
  1797. reqHeaders := make(http.Header)
  1798. for k, v := range c.header_ {
  1799. reqHeaders[k] = v
  1800. }
  1801. reqHeaders.Set("User-Agent", c.s.userAgent())
  1802. if c.ifNoneMatch_ != "" {
  1803. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1804. }
  1805. var body io.Reader = nil
  1806. c.urlParams_.Set("alt", alt)
  1807. c.urlParams_.Set("prettyPrint", "false")
  1808. urls := googleapi.ResolveRelative(c.s.BasePath, "billinginfo/{accountId}")
  1809. urls += "?" + c.urlParams_.Encode()
  1810. req, err := http.NewRequest("GET", urls, body)
  1811. if err != nil {
  1812. return nil, err
  1813. }
  1814. req.Header = reqHeaders
  1815. googleapi.Expand(req.URL, map[string]string{
  1816. "accountId": strconv.FormatInt(c.accountId, 10),
  1817. })
  1818. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1819. }
  1820. // Do executes the "adexchangebuyer.billingInfo.get" call.
  1821. // Exactly one of *BillingInfo or error will be non-nil. Any non-2xx
  1822. // status code is an error. Response headers are in either
  1823. // *BillingInfo.ServerResponse.Header or (if a response was returned at
  1824. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1825. // to check whether the returned error was because
  1826. // http.StatusNotModified was returned.
  1827. func (c *BillingInfoGetCall) Do(opts ...googleapi.CallOption) (*BillingInfo, error) {
  1828. gensupport.SetOptions(c.urlParams_, opts...)
  1829. res, err := c.doRequest("json")
  1830. if res != nil && res.StatusCode == http.StatusNotModified {
  1831. if res.Body != nil {
  1832. res.Body.Close()
  1833. }
  1834. return nil, &googleapi.Error{
  1835. Code: res.StatusCode,
  1836. Header: res.Header,
  1837. }
  1838. }
  1839. if err != nil {
  1840. return nil, err
  1841. }
  1842. defer googleapi.CloseBody(res)
  1843. if err := googleapi.CheckResponse(res); err != nil {
  1844. return nil, err
  1845. }
  1846. ret := &BillingInfo{
  1847. ServerResponse: googleapi.ServerResponse{
  1848. Header: res.Header,
  1849. HTTPStatusCode: res.StatusCode,
  1850. },
  1851. }
  1852. target := &ret
  1853. if err := gensupport.DecodeResponse(target, res); err != nil {
  1854. return nil, err
  1855. }
  1856. return ret, nil
  1857. // {
  1858. // "description": "Returns the billing information for one account specified by account ID.",
  1859. // "httpMethod": "GET",
  1860. // "id": "adexchangebuyer.billingInfo.get",
  1861. // "parameterOrder": [
  1862. // "accountId"
  1863. // ],
  1864. // "parameters": {
  1865. // "accountId": {
  1866. // "description": "The account id.",
  1867. // "format": "int32",
  1868. // "location": "path",
  1869. // "required": true,
  1870. // "type": "integer"
  1871. // }
  1872. // },
  1873. // "path": "billinginfo/{accountId}",
  1874. // "response": {
  1875. // "$ref": "BillingInfo"
  1876. // },
  1877. // "scopes": [
  1878. // "https://www.googleapis.com/auth/adexchange.buyer"
  1879. // ]
  1880. // }
  1881. }
  1882. // method id "adexchangebuyer.billingInfo.list":
  1883. type BillingInfoListCall struct {
  1884. s *Service
  1885. urlParams_ gensupport.URLParams
  1886. ifNoneMatch_ string
  1887. ctx_ context.Context
  1888. header_ http.Header
  1889. }
  1890. // List: Retrieves a list of billing information for all accounts of the
  1891. // authenticated user.
  1892. func (r *BillingInfoService) List() *BillingInfoListCall {
  1893. c := &BillingInfoListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1894. return c
  1895. }
  1896. // Fields allows partial responses to be retrieved. See
  1897. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1898. // for more information.
  1899. func (c *BillingInfoListCall) Fields(s ...googleapi.Field) *BillingInfoListCall {
  1900. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1901. return c
  1902. }
  1903. // IfNoneMatch sets the optional parameter which makes the operation
  1904. // fail if the object's ETag matches the given value. This is useful for
  1905. // getting updates only after the object has changed since the last
  1906. // request. Use googleapi.IsNotModified to check whether the response
  1907. // error from Do is the result of In-None-Match.
  1908. func (c *BillingInfoListCall) IfNoneMatch(entityTag string) *BillingInfoListCall {
  1909. c.ifNoneMatch_ = entityTag
  1910. return c
  1911. }
  1912. // Context sets the context to be used in this call's Do method. Any
  1913. // pending HTTP request will be aborted if the provided context is
  1914. // canceled.
  1915. func (c *BillingInfoListCall) Context(ctx context.Context) *BillingInfoListCall {
  1916. c.ctx_ = ctx
  1917. return c
  1918. }
  1919. // Header returns an http.Header that can be modified by the caller to
  1920. // add HTTP headers to the request.
  1921. func (c *BillingInfoListCall) Header() http.Header {
  1922. if c.header_ == nil {
  1923. c.header_ = make(http.Header)
  1924. }
  1925. return c.header_
  1926. }
  1927. func (c *BillingInfoListCall) doRequest(alt string) (*http.Response, error) {
  1928. reqHeaders := make(http.Header)
  1929. for k, v := range c.header_ {
  1930. reqHeaders[k] = v
  1931. }
  1932. reqHeaders.Set("User-Agent", c.s.userAgent())
  1933. if c.ifNoneMatch_ != "" {
  1934. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1935. }
  1936. var body io.Reader = nil
  1937. c.urlParams_.Set("alt", alt)
  1938. c.urlParams_.Set("prettyPrint", "false")
  1939. urls := googleapi.ResolveRelative(c.s.BasePath, "billinginfo")
  1940. urls += "?" + c.urlParams_.Encode()
  1941. req, err := http.NewRequest("GET", urls, body)
  1942. if err != nil {
  1943. return nil, err
  1944. }
  1945. req.Header = reqHeaders
  1946. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1947. }
  1948. // Do executes the "adexchangebuyer.billingInfo.list" call.
  1949. // Exactly one of *BillingInfoList or error will be non-nil. Any non-2xx
  1950. // status code is an error. Response headers are in either
  1951. // *BillingInfoList.ServerResponse.Header or (if a response was returned
  1952. // at all) in error.(*googleapi.Error).Header. Use
  1953. // googleapi.IsNotModified to check whether the returned error was
  1954. // because http.StatusNotModified was returned.
  1955. func (c *BillingInfoListCall) Do(opts ...googleapi.CallOption) (*BillingInfoList, error) {
  1956. gensupport.SetOptions(c.urlParams_, opts...)
  1957. res, err := c.doRequest("json")
  1958. if res != nil && res.StatusCode == http.StatusNotModified {
  1959. if res.Body != nil {
  1960. res.Body.Close()
  1961. }
  1962. return nil, &googleapi.Error{
  1963. Code: res.StatusCode,
  1964. Header: res.Header,
  1965. }
  1966. }
  1967. if err != nil {
  1968. return nil, err
  1969. }
  1970. defer googleapi.CloseBody(res)
  1971. if err := googleapi.CheckResponse(res); err != nil {
  1972. return nil, err
  1973. }
  1974. ret := &BillingInfoList{
  1975. ServerResponse: googleapi.ServerResponse{
  1976. Header: res.Header,
  1977. HTTPStatusCode: res.StatusCode,
  1978. },
  1979. }
  1980. target := &ret
  1981. if err := gensupport.DecodeResponse(target, res); err != nil {
  1982. return nil, err
  1983. }
  1984. return ret, nil
  1985. // {
  1986. // "description": "Retrieves a list of billing information for all accounts of the authenticated user.",
  1987. // "httpMethod": "GET",
  1988. // "id": "adexchangebuyer.billingInfo.list",
  1989. // "path": "billinginfo",
  1990. // "response": {
  1991. // "$ref": "BillingInfoList"
  1992. // },
  1993. // "scopes": [
  1994. // "https://www.googleapis.com/auth/adexchange.buyer"
  1995. // ]
  1996. // }
  1997. }
  1998. // method id "adexchangebuyer.budget.get":
  1999. type BudgetGetCall struct {
  2000. s *Service
  2001. accountId int64
  2002. billingId int64
  2003. urlParams_ gensupport.URLParams
  2004. ifNoneMatch_ string
  2005. ctx_ context.Context
  2006. header_ http.Header
  2007. }
  2008. // Get: Returns the budget information for the adgroup specified by the
  2009. // accountId and billingId.
  2010. func (r *BudgetService) Get(accountId int64, billingId int64) *BudgetGetCall {
  2011. c := &BudgetGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2012. c.accountId = accountId
  2013. c.billingId = billingId
  2014. return c
  2015. }
  2016. // Fields allows partial responses to be retrieved. See
  2017. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2018. // for more information.
  2019. func (c *BudgetGetCall) Fields(s ...googleapi.Field) *BudgetGetCall {
  2020. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2021. return c
  2022. }
  2023. // IfNoneMatch sets the optional parameter which makes the operation
  2024. // fail if the object's ETag matches the given value. This is useful for
  2025. // getting updates only after the object has changed since the last
  2026. // request. Use googleapi.IsNotModified to check whether the response
  2027. // error from Do is the result of In-None-Match.
  2028. func (c *BudgetGetCall) IfNoneMatch(entityTag string) *BudgetGetCall {
  2029. c.ifNoneMatch_ = entityTag
  2030. return c
  2031. }
  2032. // Context sets the context to be used in this call's Do method. Any
  2033. // pending HTTP request will be aborted if the provided context is
  2034. // canceled.
  2035. func (c *BudgetGetCall) Context(ctx context.Context) *BudgetGetCall {
  2036. c.ctx_ = ctx
  2037. return c
  2038. }
  2039. // Header returns an http.Header that can be modified by the caller to
  2040. // add HTTP headers to the request.
  2041. func (c *BudgetGetCall) Header() http.Header {
  2042. if c.header_ == nil {
  2043. c.header_ = make(http.Header)
  2044. }
  2045. return c.header_
  2046. }
  2047. func (c *BudgetGetCall) doRequest(alt string) (*http.Response, error) {
  2048. reqHeaders := make(http.Header)
  2049. for k, v := range c.header_ {
  2050. reqHeaders[k] = v
  2051. }
  2052. reqHeaders.Set("User-Agent", c.s.userAgent())
  2053. if c.ifNoneMatch_ != "" {
  2054. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2055. }
  2056. var body io.Reader = nil
  2057. c.urlParams_.Set("alt", alt)
  2058. c.urlParams_.Set("prettyPrint", "false")
  2059. urls := googleapi.ResolveRelative(c.s.BasePath, "billinginfo/{accountId}/{billingId}")
  2060. urls += "?" + c.urlParams_.Encode()
  2061. req, err := http.NewRequest("GET", urls, body)
  2062. if err != nil {
  2063. return nil, err
  2064. }
  2065. req.Header = reqHeaders
  2066. googleapi.Expand(req.URL, map[string]string{
  2067. "accountId": strconv.FormatInt(c.accountId, 10),
  2068. "billingId": strconv.FormatInt(c.billingId, 10),
  2069. })
  2070. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2071. }
  2072. // Do executes the "adexchangebuyer.budget.get" call.
  2073. // Exactly one of *Budget or error will be non-nil. Any non-2xx status
  2074. // code is an error. Response headers are in either
  2075. // *Budget.ServerResponse.Header or (if a response was returned at all)
  2076. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2077. // check whether the returned error was because http.StatusNotModified
  2078. // was returned.
  2079. func (c *BudgetGetCall) Do(opts ...googleapi.CallOption) (*Budget, error) {
  2080. gensupport.SetOptions(c.urlParams_, opts...)
  2081. res, err := c.doRequest("json")
  2082. if res != nil && res.StatusCode == http.StatusNotModified {
  2083. if res.Body != nil {
  2084. res.Body.Close()
  2085. }
  2086. return nil, &googleapi.Error{
  2087. Code: res.StatusCode,
  2088. Header: res.Header,
  2089. }
  2090. }
  2091. if err != nil {
  2092. return nil, err
  2093. }
  2094. defer googleapi.CloseBody(res)
  2095. if err := googleapi.CheckResponse(res); err != nil {
  2096. return nil, err
  2097. }
  2098. ret := &Budget{
  2099. ServerResponse: googleapi.ServerResponse{
  2100. Header: res.Header,
  2101. HTTPStatusCode: res.StatusCode,
  2102. },
  2103. }
  2104. target := &ret
  2105. if err := gensupport.DecodeResponse(target, res); err != nil {
  2106. return nil, err
  2107. }
  2108. return ret, nil
  2109. // {
  2110. // "description": "Returns the budget information for the adgroup specified by the accountId and billingId.",
  2111. // "httpMethod": "GET",
  2112. // "id": "adexchangebuyer.budget.get",
  2113. // "parameterOrder": [
  2114. // "accountId",
  2115. // "billingId"
  2116. // ],
  2117. // "parameters": {
  2118. // "accountId": {
  2119. // "description": "The account id to get the budget information for.",
  2120. // "format": "int64",
  2121. // "location": "path",
  2122. // "required": true,
  2123. // "type": "string"
  2124. // },
  2125. // "billingId": {
  2126. // "description": "The billing id to get the budget information for.",
  2127. // "format": "int64",
  2128. // "location": "path",
  2129. // "required": true,
  2130. // "type": "string"
  2131. // }
  2132. // },
  2133. // "path": "billinginfo/{accountId}/{billingId}",
  2134. // "response": {
  2135. // "$ref": "Budget"
  2136. // },
  2137. // "scopes": [
  2138. // "https://www.googleapis.com/auth/adexchange.buyer"
  2139. // ]
  2140. // }
  2141. }
  2142. // method id "adexchangebuyer.budget.patch":
  2143. type BudgetPatchCall struct {
  2144. s *Service
  2145. accountId int64
  2146. billingId int64
  2147. budget *Budget
  2148. urlParams_ gensupport.URLParams
  2149. ctx_ context.Context
  2150. header_ http.Header
  2151. }
  2152. // Patch: Updates the budget amount for the budget of the adgroup
  2153. // specified by the accountId and billingId, with the budget amount in
  2154. // the request. This method supports patch semantics.
  2155. func (r *BudgetService) Patch(accountId int64, billingId int64, budget *Budget) *BudgetPatchCall {
  2156. c := &BudgetPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2157. c.accountId = accountId
  2158. c.billingId = billingId
  2159. c.budget = budget
  2160. return c
  2161. }
  2162. // Fields allows partial responses to be retrieved. See
  2163. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2164. // for more information.
  2165. func (c *BudgetPatchCall) Fields(s ...googleapi.Field) *BudgetPatchCall {
  2166. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2167. return c
  2168. }
  2169. // Context sets the context to be used in this call's Do method. Any
  2170. // pending HTTP request will be aborted if the provided context is
  2171. // canceled.
  2172. func (c *BudgetPatchCall) Context(ctx context.Context) *BudgetPatchCall {
  2173. c.ctx_ = ctx
  2174. return c
  2175. }
  2176. // Header returns an http.Header that can be modified by the caller to
  2177. // add HTTP headers to the request.
  2178. func (c *BudgetPatchCall) Header() http.Header {
  2179. if c.header_ == nil {
  2180. c.header_ = make(http.Header)
  2181. }
  2182. return c.header_
  2183. }
  2184. func (c *BudgetPatchCall) doRequest(alt string) (*http.Response, error) {
  2185. reqHeaders := make(http.Header)
  2186. for k, v := range c.header_ {
  2187. reqHeaders[k] = v
  2188. }
  2189. reqHeaders.Set("User-Agent", c.s.userAgent())
  2190. var body io.Reader = nil
  2191. body, err := googleapi.WithoutDataWrapper.JSONReader(c.budget)
  2192. if err != nil {
  2193. return nil, err
  2194. }
  2195. reqHeaders.Set("Content-Type", "application/json")
  2196. c.urlParams_.Set("alt", alt)
  2197. c.urlParams_.Set("prettyPrint", "false")
  2198. urls := googleapi.ResolveRelative(c.s.BasePath, "billinginfo/{accountId}/{billingId}")
  2199. urls += "?" + c.urlParams_.Encode()
  2200. req, err := http.NewRequest("PATCH", urls, body)
  2201. if err != nil {
  2202. return nil, err
  2203. }
  2204. req.Header = reqHeaders
  2205. googleapi.Expand(req.URL, map[string]string{
  2206. "accountId": strconv.FormatInt(c.accountId, 10),
  2207. "billingId": strconv.FormatInt(c.billingId, 10),
  2208. })
  2209. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2210. }
  2211. // Do executes the "adexchangebuyer.budget.patch" call.
  2212. // Exactly one of *Budget or error will be non-nil. Any non-2xx status
  2213. // code is an error. Response headers are in either
  2214. // *Budget.ServerResponse.Header or (if a response was returned at all)
  2215. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2216. // check whether the returned error was because http.StatusNotModified
  2217. // was returned.
  2218. func (c *BudgetPatchCall) Do(opts ...googleapi.CallOption) (*Budget, error) {
  2219. gensupport.SetOptions(c.urlParams_, opts...)
  2220. res, err := c.doRequest("json")
  2221. if res != nil && res.StatusCode == http.StatusNotModified {
  2222. if res.Body != nil {
  2223. res.Body.Close()
  2224. }
  2225. return nil, &googleapi.Error{
  2226. Code: res.StatusCode,
  2227. Header: res.Header,
  2228. }
  2229. }
  2230. if err != nil {
  2231. return nil, err
  2232. }
  2233. defer googleapi.CloseBody(res)
  2234. if err := googleapi.CheckResponse(res); err != nil {
  2235. return nil, err
  2236. }
  2237. ret := &Budget{
  2238. ServerResponse: googleapi.ServerResponse{
  2239. Header: res.Header,
  2240. HTTPStatusCode: res.StatusCode,
  2241. },
  2242. }
  2243. target := &ret
  2244. if err := gensupport.DecodeResponse(target, res); err != nil {
  2245. return nil, err
  2246. }
  2247. return ret, nil
  2248. // {
  2249. // "description": "Updates the budget amount for the budget of the adgroup specified by the accountId and billingId, with the budget amount in the request. This method supports patch semantics.",
  2250. // "httpMethod": "PATCH",
  2251. // "id": "adexchangebuyer.budget.patch",
  2252. // "parameterOrder": [
  2253. // "accountId",
  2254. // "billingId"
  2255. // ],
  2256. // "parameters": {
  2257. // "accountId": {
  2258. // "description": "The account id associated with the budget being updated.",
  2259. // "format": "int64",
  2260. // "location": "path",
  2261. // "required": true,
  2262. // "type": "string"
  2263. // },
  2264. // "billingId": {
  2265. // "description": "The billing id associated with the budget being updated.",
  2266. // "format": "int64",
  2267. // "location": "path",
  2268. // "required": true,
  2269. // "type": "string"
  2270. // }
  2271. // },
  2272. // "path": "billinginfo/{accountId}/{billingId}",
  2273. // "request": {
  2274. // "$ref": "Budget"
  2275. // },
  2276. // "response": {
  2277. // "$ref": "Budget"
  2278. // },
  2279. // "scopes": [
  2280. // "https://www.googleapis.com/auth/adexchange.buyer"
  2281. // ]
  2282. // }
  2283. }
  2284. // method id "adexchangebuyer.budget.update":
  2285. type BudgetUpdateCall struct {
  2286. s *Service
  2287. accountId int64
  2288. billingId int64
  2289. budget *Budget
  2290. urlParams_ gensupport.URLParams
  2291. ctx_ context.Context
  2292. header_ http.Header
  2293. }
  2294. // Update: Updates the budget amount for the budget of the adgroup
  2295. // specified by the accountId and billingId, with the budget amount in
  2296. // the request.
  2297. func (r *BudgetService) Update(accountId int64, billingId int64, budget *Budget) *BudgetUpdateCall {
  2298. c := &BudgetUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2299. c.accountId = accountId
  2300. c.billingId = billingId
  2301. c.budget = budget
  2302. return c
  2303. }
  2304. // Fields allows partial responses to be retrieved. See
  2305. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2306. // for more information.
  2307. func (c *BudgetUpdateCall) Fields(s ...googleapi.Field) *BudgetUpdateCall {
  2308. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2309. return c
  2310. }
  2311. // Context sets the context to be used in this call's Do method. Any
  2312. // pending HTTP request will be aborted if the provided context is
  2313. // canceled.
  2314. func (c *BudgetUpdateCall) Context(ctx context.Context) *BudgetUpdateCall {
  2315. c.ctx_ = ctx
  2316. return c
  2317. }
  2318. // Header returns an http.Header that can be modified by the caller to
  2319. // add HTTP headers to the request.
  2320. func (c *BudgetUpdateCall) Header() http.Header {
  2321. if c.header_ == nil {
  2322. c.header_ = make(http.Header)
  2323. }
  2324. return c.header_
  2325. }
  2326. func (c *BudgetUpdateCall) doRequest(alt string) (*http.Response, error) {
  2327. reqHeaders := make(http.Header)
  2328. for k, v := range c.header_ {
  2329. reqHeaders[k] = v
  2330. }
  2331. reqHeaders.Set("User-Agent", c.s.userAgent())
  2332. var body io.Reader = nil
  2333. body, err := googleapi.WithoutDataWrapper.JSONReader(c.budget)
  2334. if err != nil {
  2335. return nil, err
  2336. }
  2337. reqHeaders.Set("Content-Type", "application/json")
  2338. c.urlParams_.Set("alt", alt)
  2339. c.urlParams_.Set("prettyPrint", "false")
  2340. urls := googleapi.ResolveRelative(c.s.BasePath, "billinginfo/{accountId}/{billingId}")
  2341. urls += "?" + c.urlParams_.Encode()
  2342. req, err := http.NewRequest("PUT", urls, body)
  2343. if err != nil {
  2344. return nil, err
  2345. }
  2346. req.Header = reqHeaders
  2347. googleapi.Expand(req.URL, map[string]string{
  2348. "accountId": strconv.FormatInt(c.accountId, 10),
  2349. "billingId": strconv.FormatInt(c.billingId, 10),
  2350. })
  2351. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2352. }
  2353. // Do executes the "adexchangebuyer.budget.update" call.
  2354. // Exactly one of *Budget or error will be non-nil. Any non-2xx status
  2355. // code is an error. Response headers are in either
  2356. // *Budget.ServerResponse.Header or (if a response was returned at all)
  2357. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2358. // check whether the returned error was because http.StatusNotModified
  2359. // was returned.
  2360. func (c *BudgetUpdateCall) Do(opts ...googleapi.CallOption) (*Budget, error) {
  2361. gensupport.SetOptions(c.urlParams_, opts...)
  2362. res, err := c.doRequest("json")
  2363. if res != nil && res.StatusCode == http.StatusNotModified {
  2364. if res.Body != nil {
  2365. res.Body.Close()
  2366. }
  2367. return nil, &googleapi.Error{
  2368. Code: res.StatusCode,
  2369. Header: res.Header,
  2370. }
  2371. }
  2372. if err != nil {
  2373. return nil, err
  2374. }
  2375. defer googleapi.CloseBody(res)
  2376. if err := googleapi.CheckResponse(res); err != nil {
  2377. return nil, err
  2378. }
  2379. ret := &Budget{
  2380. ServerResponse: googleapi.ServerResponse{
  2381. Header: res.Header,
  2382. HTTPStatusCode: res.StatusCode,
  2383. },
  2384. }
  2385. target := &ret
  2386. if err := gensupport.DecodeResponse(target, res); err != nil {
  2387. return nil, err
  2388. }
  2389. return ret, nil
  2390. // {
  2391. // "description": "Updates the budget amount for the budget of the adgroup specified by the accountId and billingId, with the budget amount in the request.",
  2392. // "httpMethod": "PUT",
  2393. // "id": "adexchangebuyer.budget.update",
  2394. // "parameterOrder": [
  2395. // "accountId",
  2396. // "billingId"
  2397. // ],
  2398. // "parameters": {
  2399. // "accountId": {
  2400. // "description": "The account id associated with the budget being updated.",
  2401. // "format": "int64",
  2402. // "location": "path",
  2403. // "required": true,
  2404. // "type": "string"
  2405. // },
  2406. // "billingId": {
  2407. // "description": "The billing id associated with the budget being updated.",
  2408. // "format": "int64",
  2409. // "location": "path",
  2410. // "required": true,
  2411. // "type": "string"
  2412. // }
  2413. // },
  2414. // "path": "billinginfo/{accountId}/{billingId}",
  2415. // "request": {
  2416. // "$ref": "Budget"
  2417. // },
  2418. // "response": {
  2419. // "$ref": "Budget"
  2420. // },
  2421. // "scopes": [
  2422. // "https://www.googleapis.com/auth/adexchange.buyer"
  2423. // ]
  2424. // }
  2425. }
  2426. // method id "adexchangebuyer.creatives.get":
  2427. type CreativesGetCall struct {
  2428. s *Service
  2429. accountId int64
  2430. buyerCreativeId string
  2431. urlParams_ gensupport.URLParams
  2432. ifNoneMatch_ string
  2433. ctx_ context.Context
  2434. header_ http.Header
  2435. }
  2436. // Get: Gets the status for a single creative. A creative will be
  2437. // available 30-40 minutes after submission.
  2438. func (r *CreativesService) Get(accountId int64, buyerCreativeId string) *CreativesGetCall {
  2439. c := &CreativesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2440. c.accountId = accountId
  2441. c.buyerCreativeId = buyerCreativeId
  2442. return c
  2443. }
  2444. // Fields allows partial responses to be retrieved. See
  2445. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2446. // for more information.
  2447. func (c *CreativesGetCall) Fields(s ...googleapi.Field) *CreativesGetCall {
  2448. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2449. return c
  2450. }
  2451. // IfNoneMatch sets the optional parameter which makes the operation
  2452. // fail if the object's ETag matches the given value. This is useful for
  2453. // getting updates only after the object has changed since the last
  2454. // request. Use googleapi.IsNotModified to check whether the response
  2455. // error from Do is the result of In-None-Match.
  2456. func (c *CreativesGetCall) IfNoneMatch(entityTag string) *CreativesGetCall {
  2457. c.ifNoneMatch_ = entityTag
  2458. return c
  2459. }
  2460. // Context sets the context to be used in this call's Do method. Any
  2461. // pending HTTP request will be aborted if the provided context is
  2462. // canceled.
  2463. func (c *CreativesGetCall) Context(ctx context.Context) *CreativesGetCall {
  2464. c.ctx_ = ctx
  2465. return c
  2466. }
  2467. // Header returns an http.Header that can be modified by the caller to
  2468. // add HTTP headers to the request.
  2469. func (c *CreativesGetCall) Header() http.Header {
  2470. if c.header_ == nil {
  2471. c.header_ = make(http.Header)
  2472. }
  2473. return c.header_
  2474. }
  2475. func (c *CreativesGetCall) doRequest(alt string) (*http.Response, error) {
  2476. reqHeaders := make(http.Header)
  2477. for k, v := range c.header_ {
  2478. reqHeaders[k] = v
  2479. }
  2480. reqHeaders.Set("User-Agent", c.s.userAgent())
  2481. if c.ifNoneMatch_ != "" {
  2482. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2483. }
  2484. var body io.Reader = nil
  2485. c.urlParams_.Set("alt", alt)
  2486. c.urlParams_.Set("prettyPrint", "false")
  2487. urls := googleapi.ResolveRelative(c.s.BasePath, "creatives/{accountId}/{buyerCreativeId}")
  2488. urls += "?" + c.urlParams_.Encode()
  2489. req, err := http.NewRequest("GET", urls, body)
  2490. if err != nil {
  2491. return nil, err
  2492. }
  2493. req.Header = reqHeaders
  2494. googleapi.Expand(req.URL, map[string]string{
  2495. "accountId": strconv.FormatInt(c.accountId, 10),
  2496. "buyerCreativeId": c.buyerCreativeId,
  2497. })
  2498. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2499. }
  2500. // Do executes the "adexchangebuyer.creatives.get" call.
  2501. // Exactly one of *Creative or error will be non-nil. Any non-2xx status
  2502. // code is an error. Response headers are in either
  2503. // *Creative.ServerResponse.Header or (if a response was returned at
  2504. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2505. // to check whether the returned error was because
  2506. // http.StatusNotModified was returned.
  2507. func (c *CreativesGetCall) Do(opts ...googleapi.CallOption) (*Creative, error) {
  2508. gensupport.SetOptions(c.urlParams_, opts...)
  2509. res, err := c.doRequest("json")
  2510. if res != nil && res.StatusCode == http.StatusNotModified {
  2511. if res.Body != nil {
  2512. res.Body.Close()
  2513. }
  2514. return nil, &googleapi.Error{
  2515. Code: res.StatusCode,
  2516. Header: res.Header,
  2517. }
  2518. }
  2519. if err != nil {
  2520. return nil, err
  2521. }
  2522. defer googleapi.CloseBody(res)
  2523. if err := googleapi.CheckResponse(res); err != nil {
  2524. return nil, err
  2525. }
  2526. ret := &Creative{
  2527. ServerResponse: googleapi.ServerResponse{
  2528. Header: res.Header,
  2529. HTTPStatusCode: res.StatusCode,
  2530. },
  2531. }
  2532. target := &ret
  2533. if err := gensupport.DecodeResponse(target, res); err != nil {
  2534. return nil, err
  2535. }
  2536. return ret, nil
  2537. // {
  2538. // "description": "Gets the status for a single creative. A creative will be available 30-40 minutes after submission.",
  2539. // "httpMethod": "GET",
  2540. // "id": "adexchangebuyer.creatives.get",
  2541. // "parameterOrder": [
  2542. // "accountId",
  2543. // "buyerCreativeId"
  2544. // ],
  2545. // "parameters": {
  2546. // "accountId": {
  2547. // "description": "The id for the account that will serve this creative.",
  2548. // "format": "int32",
  2549. // "location": "path",
  2550. // "required": true,
  2551. // "type": "integer"
  2552. // },
  2553. // "buyerCreativeId": {
  2554. // "description": "The buyer-specific id for this creative.",
  2555. // "location": "path",
  2556. // "required": true,
  2557. // "type": "string"
  2558. // }
  2559. // },
  2560. // "path": "creatives/{accountId}/{buyerCreativeId}",
  2561. // "response": {
  2562. // "$ref": "Creative"
  2563. // },
  2564. // "scopes": [
  2565. // "https://www.googleapis.com/auth/adexchange.buyer"
  2566. // ]
  2567. // }
  2568. }
  2569. // method id "adexchangebuyer.creatives.insert":
  2570. type CreativesInsertCall struct {
  2571. s *Service
  2572. creative *Creative
  2573. urlParams_ gensupport.URLParams
  2574. ctx_ context.Context
  2575. header_ http.Header
  2576. }
  2577. // Insert: Submit a new creative.
  2578. func (r *CreativesService) Insert(creative *Creative) *CreativesInsertCall {
  2579. c := &CreativesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2580. c.creative = creative
  2581. return c
  2582. }
  2583. // Fields allows partial responses to be retrieved. See
  2584. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2585. // for more information.
  2586. func (c *CreativesInsertCall) Fields(s ...googleapi.Field) *CreativesInsertCall {
  2587. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2588. return c
  2589. }
  2590. // Context sets the context to be used in this call's Do method. Any
  2591. // pending HTTP request will be aborted if the provided context is
  2592. // canceled.
  2593. func (c *CreativesInsertCall) Context(ctx context.Context) *CreativesInsertCall {
  2594. c.ctx_ = ctx
  2595. return c
  2596. }
  2597. // Header returns an http.Header that can be modified by the caller to
  2598. // add HTTP headers to the request.
  2599. func (c *CreativesInsertCall) Header() http.Header {
  2600. if c.header_ == nil {
  2601. c.header_ = make(http.Header)
  2602. }
  2603. return c.header_
  2604. }
  2605. func (c *CreativesInsertCall) doRequest(alt string) (*http.Response, error) {
  2606. reqHeaders := make(http.Header)
  2607. for k, v := range c.header_ {
  2608. reqHeaders[k] = v
  2609. }
  2610. reqHeaders.Set("User-Agent", c.s.userAgent())
  2611. var body io.Reader = nil
  2612. body, err := googleapi.WithoutDataWrapper.JSONReader(c.creative)
  2613. if err != nil {
  2614. return nil, err
  2615. }
  2616. reqHeaders.Set("Content-Type", "application/json")
  2617. c.urlParams_.Set("alt", alt)
  2618. c.urlParams_.Set("prettyPrint", "false")
  2619. urls := googleapi.ResolveRelative(c.s.BasePath, "creatives")
  2620. urls += "?" + c.urlParams_.Encode()
  2621. req, err := http.NewRequest("POST", urls, body)
  2622. if err != nil {
  2623. return nil, err
  2624. }
  2625. req.Header = reqHeaders
  2626. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2627. }
  2628. // Do executes the "adexchangebuyer.creatives.insert" call.
  2629. // Exactly one of *Creative or error will be non-nil. Any non-2xx status
  2630. // code is an error. Response headers are in either
  2631. // *Creative.ServerResponse.Header or (if a response was returned at
  2632. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2633. // to check whether the returned error was because
  2634. // http.StatusNotModified was returned.
  2635. func (c *CreativesInsertCall) Do(opts ...googleapi.CallOption) (*Creative, error) {
  2636. gensupport.SetOptions(c.urlParams_, opts...)
  2637. res, err := c.doRequest("json")
  2638. if res != nil && res.StatusCode == http.StatusNotModified {
  2639. if res.Body != nil {
  2640. res.Body.Close()
  2641. }
  2642. return nil, &googleapi.Error{
  2643. Code: res.StatusCode,
  2644. Header: res.Header,
  2645. }
  2646. }
  2647. if err != nil {
  2648. return nil, err
  2649. }
  2650. defer googleapi.CloseBody(res)
  2651. if err := googleapi.CheckResponse(res); err != nil {
  2652. return nil, err
  2653. }
  2654. ret := &Creative{
  2655. ServerResponse: googleapi.ServerResponse{
  2656. Header: res.Header,
  2657. HTTPStatusCode: res.StatusCode,
  2658. },
  2659. }
  2660. target := &ret
  2661. if err := gensupport.DecodeResponse(target, res); err != nil {
  2662. return nil, err
  2663. }
  2664. return ret, nil
  2665. // {
  2666. // "description": "Submit a new creative.",
  2667. // "httpMethod": "POST",
  2668. // "id": "adexchangebuyer.creatives.insert",
  2669. // "path": "creatives",
  2670. // "request": {
  2671. // "$ref": "Creative"
  2672. // },
  2673. // "response": {
  2674. // "$ref": "Creative"
  2675. // },
  2676. // "scopes": [
  2677. // "https://www.googleapis.com/auth/adexchange.buyer"
  2678. // ]
  2679. // }
  2680. }
  2681. // method id "adexchangebuyer.creatives.list":
  2682. type CreativesListCall struct {
  2683. s *Service
  2684. urlParams_ gensupport.URLParams
  2685. ifNoneMatch_ string
  2686. ctx_ context.Context
  2687. header_ http.Header
  2688. }
  2689. // List: Retrieves a list of the authenticated user's active creatives.
  2690. // A creative will be available 30-40 minutes after submission.
  2691. func (r *CreativesService) List() *CreativesListCall {
  2692. c := &CreativesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2693. return c
  2694. }
  2695. // AccountId sets the optional parameter "accountId": When specified,
  2696. // only creatives for the given account ids are returned.
  2697. func (c *CreativesListCall) AccountId(accountId ...int64) *CreativesListCall {
  2698. var accountId_ []string
  2699. for _, v := range accountId {
  2700. accountId_ = append(accountId_, fmt.Sprint(v))
  2701. }
  2702. c.urlParams_.SetMulti("accountId", accountId_)
  2703. return c
  2704. }
  2705. // BuyerCreativeId sets the optional parameter "buyerCreativeId": When
  2706. // specified, only creatives for the given buyer creative ids are
  2707. // returned.
  2708. func (c *CreativesListCall) BuyerCreativeId(buyerCreativeId ...string) *CreativesListCall {
  2709. c.urlParams_.SetMulti("buyerCreativeId", append([]string{}, buyerCreativeId...))
  2710. return c
  2711. }
  2712. // MaxResults sets the optional parameter "maxResults": Maximum number
  2713. // of entries returned on one result page. If not set, the default is
  2714. // 100.
  2715. func (c *CreativesListCall) MaxResults(maxResults int64) *CreativesListCall {
  2716. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2717. return c
  2718. }
  2719. // PageToken sets the optional parameter "pageToken": A continuation
  2720. // token, used to page through ad clients. To retrieve the next page,
  2721. // set this parameter to the value of "nextPageToken" from the previous
  2722. // response.
  2723. func (c *CreativesListCall) PageToken(pageToken string) *CreativesListCall {
  2724. c.urlParams_.Set("pageToken", pageToken)
  2725. return c
  2726. }
  2727. // StatusFilter sets the optional parameter "statusFilter": When
  2728. // specified, only creatives having the given status are returned.
  2729. //
  2730. // Possible values:
  2731. // "approved" - Creatives which have been approved.
  2732. // "disapproved" - Creatives which have been disapproved.
  2733. // "not_checked" - Creatives whose status is not yet checked.
  2734. func (c *CreativesListCall) StatusFilter(statusFilter string) *CreativesListCall {
  2735. c.urlParams_.Set("statusFilter", statusFilter)
  2736. return c
  2737. }
  2738. // Fields allows partial responses to be retrieved. See
  2739. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2740. // for more information.
  2741. func (c *CreativesListCall) Fields(s ...googleapi.Field) *CreativesListCall {
  2742. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2743. return c
  2744. }
  2745. // IfNoneMatch sets the optional parameter which makes the operation
  2746. // fail if the object's ETag matches the given value. This is useful for
  2747. // getting updates only after the object has changed since the last
  2748. // request. Use googleapi.IsNotModified to check whether the response
  2749. // error from Do is the result of In-None-Match.
  2750. func (c *CreativesListCall) IfNoneMatch(entityTag string) *CreativesListCall {
  2751. c.ifNoneMatch_ = entityTag
  2752. return c
  2753. }
  2754. // Context sets the context to be used in this call's Do method. Any
  2755. // pending HTTP request will be aborted if the provided context is
  2756. // canceled.
  2757. func (c *CreativesListCall) Context(ctx context.Context) *CreativesListCall {
  2758. c.ctx_ = ctx
  2759. return c
  2760. }
  2761. // Header returns an http.Header that can be modified by the caller to
  2762. // add HTTP headers to the request.
  2763. func (c *CreativesListCall) Header() http.Header {
  2764. if c.header_ == nil {
  2765. c.header_ = make(http.Header)
  2766. }
  2767. return c.header_
  2768. }
  2769. func (c *CreativesListCall) doRequest(alt string) (*http.Response, error) {
  2770. reqHeaders := make(http.Header)
  2771. for k, v := range c.header_ {
  2772. reqHeaders[k] = v
  2773. }
  2774. reqHeaders.Set("User-Agent", c.s.userAgent())
  2775. if c.ifNoneMatch_ != "" {
  2776. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2777. }
  2778. var body io.Reader = nil
  2779. c.urlParams_.Set("alt", alt)
  2780. c.urlParams_.Set("prettyPrint", "false")
  2781. urls := googleapi.ResolveRelative(c.s.BasePath, "creatives")
  2782. urls += "?" + c.urlParams_.Encode()
  2783. req, err := http.NewRequest("GET", urls, body)
  2784. if err != nil {
  2785. return nil, err
  2786. }
  2787. req.Header = reqHeaders
  2788. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2789. }
  2790. // Do executes the "adexchangebuyer.creatives.list" call.
  2791. // Exactly one of *CreativesList or error will be non-nil. Any non-2xx
  2792. // status code is an error. Response headers are in either
  2793. // *CreativesList.ServerResponse.Header or (if a response was returned
  2794. // at all) in error.(*googleapi.Error).Header. Use
  2795. // googleapi.IsNotModified to check whether the returned error was
  2796. // because http.StatusNotModified was returned.
  2797. func (c *CreativesListCall) Do(opts ...googleapi.CallOption) (*CreativesList, error) {
  2798. gensupport.SetOptions(c.urlParams_, opts...)
  2799. res, err := c.doRequest("json")
  2800. if res != nil && res.StatusCode == http.StatusNotModified {
  2801. if res.Body != nil {
  2802. res.Body.Close()
  2803. }
  2804. return nil, &googleapi.Error{
  2805. Code: res.StatusCode,
  2806. Header: res.Header,
  2807. }
  2808. }
  2809. if err != nil {
  2810. return nil, err
  2811. }
  2812. defer googleapi.CloseBody(res)
  2813. if err := googleapi.CheckResponse(res); err != nil {
  2814. return nil, err
  2815. }
  2816. ret := &CreativesList{
  2817. ServerResponse: googleapi.ServerResponse{
  2818. Header: res.Header,
  2819. HTTPStatusCode: res.StatusCode,
  2820. },
  2821. }
  2822. target := &ret
  2823. if err := gensupport.DecodeResponse(target, res); err != nil {
  2824. return nil, err
  2825. }
  2826. return ret, nil
  2827. // {
  2828. // "description": "Retrieves a list of the authenticated user's active creatives. A creative will be available 30-40 minutes after submission.",
  2829. // "httpMethod": "GET",
  2830. // "id": "adexchangebuyer.creatives.list",
  2831. // "parameters": {
  2832. // "accountId": {
  2833. // "description": "When specified, only creatives for the given account ids are returned.",
  2834. // "format": "int32",
  2835. // "location": "query",
  2836. // "repeated": true,
  2837. // "type": "integer"
  2838. // },
  2839. // "buyerCreativeId": {
  2840. // "description": "When specified, only creatives for the given buyer creative ids are returned.",
  2841. // "location": "query",
  2842. // "repeated": true,
  2843. // "type": "string"
  2844. // },
  2845. // "maxResults": {
  2846. // "description": "Maximum number of entries returned on one result page. If not set, the default is 100. Optional.",
  2847. // "format": "uint32",
  2848. // "location": "query",
  2849. // "maximum": "1000",
  2850. // "minimum": "1",
  2851. // "type": "integer"
  2852. // },
  2853. // "pageToken": {
  2854. // "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. Optional.",
  2855. // "location": "query",
  2856. // "type": "string"
  2857. // },
  2858. // "statusFilter": {
  2859. // "description": "When specified, only creatives having the given status are returned.",
  2860. // "enum": [
  2861. // "approved",
  2862. // "disapproved",
  2863. // "not_checked"
  2864. // ],
  2865. // "enumDescriptions": [
  2866. // "Creatives which have been approved.",
  2867. // "Creatives which have been disapproved.",
  2868. // "Creatives whose status is not yet checked."
  2869. // ],
  2870. // "location": "query",
  2871. // "type": "string"
  2872. // }
  2873. // },
  2874. // "path": "creatives",
  2875. // "response": {
  2876. // "$ref": "CreativesList"
  2877. // },
  2878. // "scopes": [
  2879. // "https://www.googleapis.com/auth/adexchange.buyer"
  2880. // ]
  2881. // }
  2882. }
  2883. // Pages invokes f for each page of results.
  2884. // A non-nil error returned from f will halt the iteration.
  2885. // The provided context supersedes any context provided to the Context method.
  2886. func (c *CreativesListCall) Pages(ctx context.Context, f func(*CreativesList) error) error {
  2887. c.ctx_ = ctx
  2888. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2889. for {
  2890. x, err := c.Do()
  2891. if err != nil {
  2892. return err
  2893. }
  2894. if err := f(x); err != nil {
  2895. return err
  2896. }
  2897. if x.NextPageToken == "" {
  2898. return nil
  2899. }
  2900. c.PageToken(x.NextPageToken)
  2901. }
  2902. }
  2903. // method id "adexchangebuyer.directDeals.get":
  2904. type DirectDealsGetCall struct {
  2905. s *Service
  2906. id int64
  2907. urlParams_ gensupport.URLParams
  2908. ifNoneMatch_ string
  2909. ctx_ context.Context
  2910. header_ http.Header
  2911. }
  2912. // Get: Gets one direct deal by ID.
  2913. func (r *DirectDealsService) Get(id int64) *DirectDealsGetCall {
  2914. c := &DirectDealsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2915. c.id = id
  2916. return c
  2917. }
  2918. // Fields allows partial responses to be retrieved. See
  2919. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2920. // for more information.
  2921. func (c *DirectDealsGetCall) Fields(s ...googleapi.Field) *DirectDealsGetCall {
  2922. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2923. return c
  2924. }
  2925. // IfNoneMatch sets the optional parameter which makes the operation
  2926. // fail if the object's ETag matches the given value. This is useful for
  2927. // getting updates only after the object has changed since the last
  2928. // request. Use googleapi.IsNotModified to check whether the response
  2929. // error from Do is the result of In-None-Match.
  2930. func (c *DirectDealsGetCall) IfNoneMatch(entityTag string) *DirectDealsGetCall {
  2931. c.ifNoneMatch_ = entityTag
  2932. return c
  2933. }
  2934. // Context sets the context to be used in this call's Do method. Any
  2935. // pending HTTP request will be aborted if the provided context is
  2936. // canceled.
  2937. func (c *DirectDealsGetCall) Context(ctx context.Context) *DirectDealsGetCall {
  2938. c.ctx_ = ctx
  2939. return c
  2940. }
  2941. // Header returns an http.Header that can be modified by the caller to
  2942. // add HTTP headers to the request.
  2943. func (c *DirectDealsGetCall) Header() http.Header {
  2944. if c.header_ == nil {
  2945. c.header_ = make(http.Header)
  2946. }
  2947. return c.header_
  2948. }
  2949. func (c *DirectDealsGetCall) doRequest(alt string) (*http.Response, error) {
  2950. reqHeaders := make(http.Header)
  2951. for k, v := range c.header_ {
  2952. reqHeaders[k] = v
  2953. }
  2954. reqHeaders.Set("User-Agent", c.s.userAgent())
  2955. if c.ifNoneMatch_ != "" {
  2956. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2957. }
  2958. var body io.Reader = nil
  2959. c.urlParams_.Set("alt", alt)
  2960. c.urlParams_.Set("prettyPrint", "false")
  2961. urls := googleapi.ResolveRelative(c.s.BasePath, "directdeals/{id}")
  2962. urls += "?" + c.urlParams_.Encode()
  2963. req, err := http.NewRequest("GET", urls, body)
  2964. if err != nil {
  2965. return nil, err
  2966. }
  2967. req.Header = reqHeaders
  2968. googleapi.Expand(req.URL, map[string]string{
  2969. "id": strconv.FormatInt(c.id, 10),
  2970. })
  2971. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2972. }
  2973. // Do executes the "adexchangebuyer.directDeals.get" call.
  2974. // Exactly one of *DirectDeal or error will be non-nil. Any non-2xx
  2975. // status code is an error. Response headers are in either
  2976. // *DirectDeal.ServerResponse.Header or (if a response was returned at
  2977. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2978. // to check whether the returned error was because
  2979. // http.StatusNotModified was returned.
  2980. func (c *DirectDealsGetCall) Do(opts ...googleapi.CallOption) (*DirectDeal, error) {
  2981. gensupport.SetOptions(c.urlParams_, opts...)
  2982. res, err := c.doRequest("json")
  2983. if res != nil && res.StatusCode == http.StatusNotModified {
  2984. if res.Body != nil {
  2985. res.Body.Close()
  2986. }
  2987. return nil, &googleapi.Error{
  2988. Code: res.StatusCode,
  2989. Header: res.Header,
  2990. }
  2991. }
  2992. if err != nil {
  2993. return nil, err
  2994. }
  2995. defer googleapi.CloseBody(res)
  2996. if err := googleapi.CheckResponse(res); err != nil {
  2997. return nil, err
  2998. }
  2999. ret := &DirectDeal{
  3000. ServerResponse: googleapi.ServerResponse{
  3001. Header: res.Header,
  3002. HTTPStatusCode: res.StatusCode,
  3003. },
  3004. }
  3005. target := &ret
  3006. if err := gensupport.DecodeResponse(target, res); err != nil {
  3007. return nil, err
  3008. }
  3009. return ret, nil
  3010. // {
  3011. // "description": "Gets one direct deal by ID.",
  3012. // "httpMethod": "GET",
  3013. // "id": "adexchangebuyer.directDeals.get",
  3014. // "parameterOrder": [
  3015. // "id"
  3016. // ],
  3017. // "parameters": {
  3018. // "id": {
  3019. // "description": "The direct deal id",
  3020. // "format": "int64",
  3021. // "location": "path",
  3022. // "required": true,
  3023. // "type": "string"
  3024. // }
  3025. // },
  3026. // "path": "directdeals/{id}",
  3027. // "response": {
  3028. // "$ref": "DirectDeal"
  3029. // },
  3030. // "scopes": [
  3031. // "https://www.googleapis.com/auth/adexchange.buyer"
  3032. // ]
  3033. // }
  3034. }
  3035. // method id "adexchangebuyer.directDeals.list":
  3036. type DirectDealsListCall struct {
  3037. s *Service
  3038. urlParams_ gensupport.URLParams
  3039. ifNoneMatch_ string
  3040. ctx_ context.Context
  3041. header_ http.Header
  3042. }
  3043. // List: Retrieves the authenticated user's list of direct deals.
  3044. func (r *DirectDealsService) List() *DirectDealsListCall {
  3045. c := &DirectDealsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3046. return c
  3047. }
  3048. // Fields allows partial responses to be retrieved. See
  3049. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3050. // for more information.
  3051. func (c *DirectDealsListCall) Fields(s ...googleapi.Field) *DirectDealsListCall {
  3052. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3053. return c
  3054. }
  3055. // IfNoneMatch sets the optional parameter which makes the operation
  3056. // fail if the object's ETag matches the given value. This is useful for
  3057. // getting updates only after the object has changed since the last
  3058. // request. Use googleapi.IsNotModified to check whether the response
  3059. // error from Do is the result of In-None-Match.
  3060. func (c *DirectDealsListCall) IfNoneMatch(entityTag string) *DirectDealsListCall {
  3061. c.ifNoneMatch_ = entityTag
  3062. return c
  3063. }
  3064. // Context sets the context to be used in this call's Do method. Any
  3065. // pending HTTP request will be aborted if the provided context is
  3066. // canceled.
  3067. func (c *DirectDealsListCall) Context(ctx context.Context) *DirectDealsListCall {
  3068. c.ctx_ = ctx
  3069. return c
  3070. }
  3071. // Header returns an http.Header that can be modified by the caller to
  3072. // add HTTP headers to the request.
  3073. func (c *DirectDealsListCall) Header() http.Header {
  3074. if c.header_ == nil {
  3075. c.header_ = make(http.Header)
  3076. }
  3077. return c.header_
  3078. }
  3079. func (c *DirectDealsListCall) doRequest(alt string) (*http.Response, error) {
  3080. reqHeaders := make(http.Header)
  3081. for k, v := range c.header_ {
  3082. reqHeaders[k] = v
  3083. }
  3084. reqHeaders.Set("User-Agent", c.s.userAgent())
  3085. if c.ifNoneMatch_ != "" {
  3086. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3087. }
  3088. var body io.Reader = nil
  3089. c.urlParams_.Set("alt", alt)
  3090. c.urlParams_.Set("prettyPrint", "false")
  3091. urls := googleapi.ResolveRelative(c.s.BasePath, "directdeals")
  3092. urls += "?" + c.urlParams_.Encode()
  3093. req, err := http.NewRequest("GET", urls, body)
  3094. if err != nil {
  3095. return nil, err
  3096. }
  3097. req.Header = reqHeaders
  3098. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3099. }
  3100. // Do executes the "adexchangebuyer.directDeals.list" call.
  3101. // Exactly one of *DirectDealsList or error will be non-nil. Any non-2xx
  3102. // status code is an error. Response headers are in either
  3103. // *DirectDealsList.ServerResponse.Header or (if a response was returned
  3104. // at all) in error.(*googleapi.Error).Header. Use
  3105. // googleapi.IsNotModified to check whether the returned error was
  3106. // because http.StatusNotModified was returned.
  3107. func (c *DirectDealsListCall) Do(opts ...googleapi.CallOption) (*DirectDealsList, error) {
  3108. gensupport.SetOptions(c.urlParams_, opts...)
  3109. res, err := c.doRequest("json")
  3110. if res != nil && res.StatusCode == http.StatusNotModified {
  3111. if res.Body != nil {
  3112. res.Body.Close()
  3113. }
  3114. return nil, &googleapi.Error{
  3115. Code: res.StatusCode,
  3116. Header: res.Header,
  3117. }
  3118. }
  3119. if err != nil {
  3120. return nil, err
  3121. }
  3122. defer googleapi.CloseBody(res)
  3123. if err := googleapi.CheckResponse(res); err != nil {
  3124. return nil, err
  3125. }
  3126. ret := &DirectDealsList{
  3127. ServerResponse: googleapi.ServerResponse{
  3128. Header: res.Header,
  3129. HTTPStatusCode: res.StatusCode,
  3130. },
  3131. }
  3132. target := &ret
  3133. if err := gensupport.DecodeResponse(target, res); err != nil {
  3134. return nil, err
  3135. }
  3136. return ret, nil
  3137. // {
  3138. // "description": "Retrieves the authenticated user's list of direct deals.",
  3139. // "httpMethod": "GET",
  3140. // "id": "adexchangebuyer.directDeals.list",
  3141. // "path": "directdeals",
  3142. // "response": {
  3143. // "$ref": "DirectDealsList"
  3144. // },
  3145. // "scopes": [
  3146. // "https://www.googleapis.com/auth/adexchange.buyer"
  3147. // ]
  3148. // }
  3149. }
  3150. // method id "adexchangebuyer.performanceReport.list":
  3151. type PerformanceReportListCall struct {
  3152. s *Service
  3153. urlParams_ gensupport.URLParams
  3154. ifNoneMatch_ string
  3155. ctx_ context.Context
  3156. header_ http.Header
  3157. }
  3158. // List: Retrieves the authenticated user's list of performance metrics.
  3159. func (r *PerformanceReportService) List(accountId int64, endDateTime string, startDateTime string) *PerformanceReportListCall {
  3160. c := &PerformanceReportListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3161. c.urlParams_.Set("accountId", fmt.Sprint(accountId))
  3162. c.urlParams_.Set("endDateTime", endDateTime)
  3163. c.urlParams_.Set("startDateTime", startDateTime)
  3164. return c
  3165. }
  3166. // MaxResults sets the optional parameter "maxResults": Maximum number
  3167. // of entries returned on one result page. If not set, the default is
  3168. // 100.
  3169. func (c *PerformanceReportListCall) MaxResults(maxResults int64) *PerformanceReportListCall {
  3170. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3171. return c
  3172. }
  3173. // PageToken sets the optional parameter "pageToken": A continuation
  3174. // token, used to page through performance reports. To retrieve the next
  3175. // page, set this parameter to the value of "nextPageToken" from the
  3176. // previous response.
  3177. func (c *PerformanceReportListCall) PageToken(pageToken string) *PerformanceReportListCall {
  3178. c.urlParams_.Set("pageToken", pageToken)
  3179. return c
  3180. }
  3181. // Fields allows partial responses to be retrieved. See
  3182. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3183. // for more information.
  3184. func (c *PerformanceReportListCall) Fields(s ...googleapi.Field) *PerformanceReportListCall {
  3185. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3186. return c
  3187. }
  3188. // IfNoneMatch sets the optional parameter which makes the operation
  3189. // fail if the object's ETag matches the given value. This is useful for
  3190. // getting updates only after the object has changed since the last
  3191. // request. Use googleapi.IsNotModified to check whether the response
  3192. // error from Do is the result of In-None-Match.
  3193. func (c *PerformanceReportListCall) IfNoneMatch(entityTag string) *PerformanceReportListCall {
  3194. c.ifNoneMatch_ = entityTag
  3195. return c
  3196. }
  3197. // Context sets the context to be used in this call's Do method. Any
  3198. // pending HTTP request will be aborted if the provided context is
  3199. // canceled.
  3200. func (c *PerformanceReportListCall) Context(ctx context.Context) *PerformanceReportListCall {
  3201. c.ctx_ = ctx
  3202. return c
  3203. }
  3204. // Header returns an http.Header that can be modified by the caller to
  3205. // add HTTP headers to the request.
  3206. func (c *PerformanceReportListCall) Header() http.Header {
  3207. if c.header_ == nil {
  3208. c.header_ = make(http.Header)
  3209. }
  3210. return c.header_
  3211. }
  3212. func (c *PerformanceReportListCall) doRequest(alt string) (*http.Response, error) {
  3213. reqHeaders := make(http.Header)
  3214. for k, v := range c.header_ {
  3215. reqHeaders[k] = v
  3216. }
  3217. reqHeaders.Set("User-Agent", c.s.userAgent())
  3218. if c.ifNoneMatch_ != "" {
  3219. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3220. }
  3221. var body io.Reader = nil
  3222. c.urlParams_.Set("alt", alt)
  3223. c.urlParams_.Set("prettyPrint", "false")
  3224. urls := googleapi.ResolveRelative(c.s.BasePath, "performancereport")
  3225. urls += "?" + c.urlParams_.Encode()
  3226. req, err := http.NewRequest("GET", urls, body)
  3227. if err != nil {
  3228. return nil, err
  3229. }
  3230. req.Header = reqHeaders
  3231. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3232. }
  3233. // Do executes the "adexchangebuyer.performanceReport.list" call.
  3234. // Exactly one of *PerformanceReportList or error will be non-nil. Any
  3235. // non-2xx status code is an error. Response headers are in either
  3236. // *PerformanceReportList.ServerResponse.Header or (if a response was
  3237. // returned at all) in error.(*googleapi.Error).Header. Use
  3238. // googleapi.IsNotModified to check whether the returned error was
  3239. // because http.StatusNotModified was returned.
  3240. func (c *PerformanceReportListCall) Do(opts ...googleapi.CallOption) (*PerformanceReportList, error) {
  3241. gensupport.SetOptions(c.urlParams_, opts...)
  3242. res, err := c.doRequest("json")
  3243. if res != nil && res.StatusCode == http.StatusNotModified {
  3244. if res.Body != nil {
  3245. res.Body.Close()
  3246. }
  3247. return nil, &googleapi.Error{
  3248. Code: res.StatusCode,
  3249. Header: res.Header,
  3250. }
  3251. }
  3252. if err != nil {
  3253. return nil, err
  3254. }
  3255. defer googleapi.CloseBody(res)
  3256. if err := googleapi.CheckResponse(res); err != nil {
  3257. return nil, err
  3258. }
  3259. ret := &PerformanceReportList{
  3260. ServerResponse: googleapi.ServerResponse{
  3261. Header: res.Header,
  3262. HTTPStatusCode: res.StatusCode,
  3263. },
  3264. }
  3265. target := &ret
  3266. if err := gensupport.DecodeResponse(target, res); err != nil {
  3267. return nil, err
  3268. }
  3269. return ret, nil
  3270. // {
  3271. // "description": "Retrieves the authenticated user's list of performance metrics.",
  3272. // "httpMethod": "GET",
  3273. // "id": "adexchangebuyer.performanceReport.list",
  3274. // "parameterOrder": [
  3275. // "accountId",
  3276. // "endDateTime",
  3277. // "startDateTime"
  3278. // ],
  3279. // "parameters": {
  3280. // "accountId": {
  3281. // "description": "The account id to get the reports.",
  3282. // "format": "int64",
  3283. // "location": "query",
  3284. // "required": true,
  3285. // "type": "string"
  3286. // },
  3287. // "endDateTime": {
  3288. // "description": "The end time of the report in ISO 8601 timestamp format using UTC.",
  3289. // "location": "query",
  3290. // "required": true,
  3291. // "type": "string"
  3292. // },
  3293. // "maxResults": {
  3294. // "description": "Maximum number of entries returned on one result page. If not set, the default is 100. Optional.",
  3295. // "format": "uint32",
  3296. // "location": "query",
  3297. // "maximum": "1000",
  3298. // "minimum": "1",
  3299. // "type": "integer"
  3300. // },
  3301. // "pageToken": {
  3302. // "description": "A continuation token, used to page through performance reports. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response. Optional.",
  3303. // "location": "query",
  3304. // "type": "string"
  3305. // },
  3306. // "startDateTime": {
  3307. // "description": "The start time of the report in ISO 8601 timestamp format using UTC.",
  3308. // "location": "query",
  3309. // "required": true,
  3310. // "type": "string"
  3311. // }
  3312. // },
  3313. // "path": "performancereport",
  3314. // "response": {
  3315. // "$ref": "PerformanceReportList"
  3316. // },
  3317. // "scopes": [
  3318. // "https://www.googleapis.com/auth/adexchange.buyer"
  3319. // ]
  3320. // }
  3321. }
  3322. // method id "adexchangebuyer.pretargetingConfig.delete":
  3323. type PretargetingConfigDeleteCall struct {
  3324. s *Service
  3325. accountId int64
  3326. configId int64
  3327. urlParams_ gensupport.URLParams
  3328. ctx_ context.Context
  3329. header_ http.Header
  3330. }
  3331. // Delete: Deletes an existing pretargeting config.
  3332. func (r *PretargetingConfigService) Delete(accountId int64, configId int64) *PretargetingConfigDeleteCall {
  3333. c := &PretargetingConfigDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3334. c.accountId = accountId
  3335. c.configId = configId
  3336. return c
  3337. }
  3338. // Fields allows partial responses to be retrieved. See
  3339. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3340. // for more information.
  3341. func (c *PretargetingConfigDeleteCall) Fields(s ...googleapi.Field) *PretargetingConfigDeleteCall {
  3342. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3343. return c
  3344. }
  3345. // Context sets the context to be used in this call's Do method. Any
  3346. // pending HTTP request will be aborted if the provided context is
  3347. // canceled.
  3348. func (c *PretargetingConfigDeleteCall) Context(ctx context.Context) *PretargetingConfigDeleteCall {
  3349. c.ctx_ = ctx
  3350. return c
  3351. }
  3352. // Header returns an http.Header that can be modified by the caller to
  3353. // add HTTP headers to the request.
  3354. func (c *PretargetingConfigDeleteCall) Header() http.Header {
  3355. if c.header_ == nil {
  3356. c.header_ = make(http.Header)
  3357. }
  3358. return c.header_
  3359. }
  3360. func (c *PretargetingConfigDeleteCall) doRequest(alt string) (*http.Response, error) {
  3361. reqHeaders := make(http.Header)
  3362. for k, v := range c.header_ {
  3363. reqHeaders[k] = v
  3364. }
  3365. reqHeaders.Set("User-Agent", c.s.userAgent())
  3366. var body io.Reader = nil
  3367. c.urlParams_.Set("alt", alt)
  3368. c.urlParams_.Set("prettyPrint", "false")
  3369. urls := googleapi.ResolveRelative(c.s.BasePath, "pretargetingconfigs/{accountId}/{configId}")
  3370. urls += "?" + c.urlParams_.Encode()
  3371. req, err := http.NewRequest("DELETE", urls, body)
  3372. if err != nil {
  3373. return nil, err
  3374. }
  3375. req.Header = reqHeaders
  3376. googleapi.Expand(req.URL, map[string]string{
  3377. "accountId": strconv.FormatInt(c.accountId, 10),
  3378. "configId": strconv.FormatInt(c.configId, 10),
  3379. })
  3380. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3381. }
  3382. // Do executes the "adexchangebuyer.pretargetingConfig.delete" call.
  3383. func (c *PretargetingConfigDeleteCall) Do(opts ...googleapi.CallOption) error {
  3384. gensupport.SetOptions(c.urlParams_, opts...)
  3385. res, err := c.doRequest("json")
  3386. if err != nil {
  3387. return err
  3388. }
  3389. defer googleapi.CloseBody(res)
  3390. if err := googleapi.CheckResponse(res); err != nil {
  3391. return err
  3392. }
  3393. return nil
  3394. // {
  3395. // "description": "Deletes an existing pretargeting config.",
  3396. // "httpMethod": "DELETE",
  3397. // "id": "adexchangebuyer.pretargetingConfig.delete",
  3398. // "parameterOrder": [
  3399. // "accountId",
  3400. // "configId"
  3401. // ],
  3402. // "parameters": {
  3403. // "accountId": {
  3404. // "description": "The account id to delete the pretargeting config for.",
  3405. // "format": "int64",
  3406. // "location": "path",
  3407. // "required": true,
  3408. // "type": "string"
  3409. // },
  3410. // "configId": {
  3411. // "description": "The specific id of the configuration to delete.",
  3412. // "format": "int64",
  3413. // "location": "path",
  3414. // "required": true,
  3415. // "type": "string"
  3416. // }
  3417. // },
  3418. // "path": "pretargetingconfigs/{accountId}/{configId}",
  3419. // "scopes": [
  3420. // "https://www.googleapis.com/auth/adexchange.buyer"
  3421. // ]
  3422. // }
  3423. }
  3424. // method id "adexchangebuyer.pretargetingConfig.get":
  3425. type PretargetingConfigGetCall struct {
  3426. s *Service
  3427. accountId int64
  3428. configId int64
  3429. urlParams_ gensupport.URLParams
  3430. ifNoneMatch_ string
  3431. ctx_ context.Context
  3432. header_ http.Header
  3433. }
  3434. // Get: Gets a specific pretargeting configuration
  3435. func (r *PretargetingConfigService) Get(accountId int64, configId int64) *PretargetingConfigGetCall {
  3436. c := &PretargetingConfigGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3437. c.accountId = accountId
  3438. c.configId = configId
  3439. return c
  3440. }
  3441. // Fields allows partial responses to be retrieved. See
  3442. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3443. // for more information.
  3444. func (c *PretargetingConfigGetCall) Fields(s ...googleapi.Field) *PretargetingConfigGetCall {
  3445. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3446. return c
  3447. }
  3448. // IfNoneMatch sets the optional parameter which makes the operation
  3449. // fail if the object's ETag matches the given value. This is useful for
  3450. // getting updates only after the object has changed since the last
  3451. // request. Use googleapi.IsNotModified to check whether the response
  3452. // error from Do is the result of In-None-Match.
  3453. func (c *PretargetingConfigGetCall) IfNoneMatch(entityTag string) *PretargetingConfigGetCall {
  3454. c.ifNoneMatch_ = entityTag
  3455. return c
  3456. }
  3457. // Context sets the context to be used in this call's Do method. Any
  3458. // pending HTTP request will be aborted if the provided context is
  3459. // canceled.
  3460. func (c *PretargetingConfigGetCall) Context(ctx context.Context) *PretargetingConfigGetCall {
  3461. c.ctx_ = ctx
  3462. return c
  3463. }
  3464. // Header returns an http.Header that can be modified by the caller to
  3465. // add HTTP headers to the request.
  3466. func (c *PretargetingConfigGetCall) Header() http.Header {
  3467. if c.header_ == nil {
  3468. c.header_ = make(http.Header)
  3469. }
  3470. return c.header_
  3471. }
  3472. func (c *PretargetingConfigGetCall) doRequest(alt string) (*http.Response, error) {
  3473. reqHeaders := make(http.Header)
  3474. for k, v := range c.header_ {
  3475. reqHeaders[k] = v
  3476. }
  3477. reqHeaders.Set("User-Agent", c.s.userAgent())
  3478. if c.ifNoneMatch_ != "" {
  3479. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3480. }
  3481. var body io.Reader = nil
  3482. c.urlParams_.Set("alt", alt)
  3483. c.urlParams_.Set("prettyPrint", "false")
  3484. urls := googleapi.ResolveRelative(c.s.BasePath, "pretargetingconfigs/{accountId}/{configId}")
  3485. urls += "?" + c.urlParams_.Encode()
  3486. req, err := http.NewRequest("GET", urls, body)
  3487. if err != nil {
  3488. return nil, err
  3489. }
  3490. req.Header = reqHeaders
  3491. googleapi.Expand(req.URL, map[string]string{
  3492. "accountId": strconv.FormatInt(c.accountId, 10),
  3493. "configId": strconv.FormatInt(c.configId, 10),
  3494. })
  3495. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3496. }
  3497. // Do executes the "adexchangebuyer.pretargetingConfig.get" call.
  3498. // Exactly one of *PretargetingConfig or error will be non-nil. Any
  3499. // non-2xx status code is an error. Response headers are in either
  3500. // *PretargetingConfig.ServerResponse.Header or (if a response was
  3501. // returned at all) in error.(*googleapi.Error).Header. Use
  3502. // googleapi.IsNotModified to check whether the returned error was
  3503. // because http.StatusNotModified was returned.
  3504. func (c *PretargetingConfigGetCall) Do(opts ...googleapi.CallOption) (*PretargetingConfig, error) {
  3505. gensupport.SetOptions(c.urlParams_, opts...)
  3506. res, err := c.doRequest("json")
  3507. if res != nil && res.StatusCode == http.StatusNotModified {
  3508. if res.Body != nil {
  3509. res.Body.Close()
  3510. }
  3511. return nil, &googleapi.Error{
  3512. Code: res.StatusCode,
  3513. Header: res.Header,
  3514. }
  3515. }
  3516. if err != nil {
  3517. return nil, err
  3518. }
  3519. defer googleapi.CloseBody(res)
  3520. if err := googleapi.CheckResponse(res); err != nil {
  3521. return nil, err
  3522. }
  3523. ret := &PretargetingConfig{
  3524. ServerResponse: googleapi.ServerResponse{
  3525. Header: res.Header,
  3526. HTTPStatusCode: res.StatusCode,
  3527. },
  3528. }
  3529. target := &ret
  3530. if err := gensupport.DecodeResponse(target, res); err != nil {
  3531. return nil, err
  3532. }
  3533. return ret, nil
  3534. // {
  3535. // "description": "Gets a specific pretargeting configuration",
  3536. // "httpMethod": "GET",
  3537. // "id": "adexchangebuyer.pretargetingConfig.get",
  3538. // "parameterOrder": [
  3539. // "accountId",
  3540. // "configId"
  3541. // ],
  3542. // "parameters": {
  3543. // "accountId": {
  3544. // "description": "The account id to get the pretargeting config for.",
  3545. // "format": "int64",
  3546. // "location": "path",
  3547. // "required": true,
  3548. // "type": "string"
  3549. // },
  3550. // "configId": {
  3551. // "description": "The specific id of the configuration to retrieve.",
  3552. // "format": "int64",
  3553. // "location": "path",
  3554. // "required": true,
  3555. // "type": "string"
  3556. // }
  3557. // },
  3558. // "path": "pretargetingconfigs/{accountId}/{configId}",
  3559. // "response": {
  3560. // "$ref": "PretargetingConfig"
  3561. // },
  3562. // "scopes": [
  3563. // "https://www.googleapis.com/auth/adexchange.buyer"
  3564. // ]
  3565. // }
  3566. }
  3567. // method id "adexchangebuyer.pretargetingConfig.insert":
  3568. type PretargetingConfigInsertCall struct {
  3569. s *Service
  3570. accountId int64
  3571. pretargetingconfig *PretargetingConfig
  3572. urlParams_ gensupport.URLParams
  3573. ctx_ context.Context
  3574. header_ http.Header
  3575. }
  3576. // Insert: Inserts a new pretargeting configuration.
  3577. func (r *PretargetingConfigService) Insert(accountId int64, pretargetingconfig *PretargetingConfig) *PretargetingConfigInsertCall {
  3578. c := &PretargetingConfigInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3579. c.accountId = accountId
  3580. c.pretargetingconfig = pretargetingconfig
  3581. return c
  3582. }
  3583. // Fields allows partial responses to be retrieved. See
  3584. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3585. // for more information.
  3586. func (c *PretargetingConfigInsertCall) Fields(s ...googleapi.Field) *PretargetingConfigInsertCall {
  3587. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3588. return c
  3589. }
  3590. // Context sets the context to be used in this call's Do method. Any
  3591. // pending HTTP request will be aborted if the provided context is
  3592. // canceled.
  3593. func (c *PretargetingConfigInsertCall) Context(ctx context.Context) *PretargetingConfigInsertCall {
  3594. c.ctx_ = ctx
  3595. return c
  3596. }
  3597. // Header returns an http.Header that can be modified by the caller to
  3598. // add HTTP headers to the request.
  3599. func (c *PretargetingConfigInsertCall) Header() http.Header {
  3600. if c.header_ == nil {
  3601. c.header_ = make(http.Header)
  3602. }
  3603. return c.header_
  3604. }
  3605. func (c *PretargetingConfigInsertCall) doRequest(alt string) (*http.Response, error) {
  3606. reqHeaders := make(http.Header)
  3607. for k, v := range c.header_ {
  3608. reqHeaders[k] = v
  3609. }
  3610. reqHeaders.Set("User-Agent", c.s.userAgent())
  3611. var body io.Reader = nil
  3612. body, err := googleapi.WithoutDataWrapper.JSONReader(c.pretargetingconfig)
  3613. if err != nil {
  3614. return nil, err
  3615. }
  3616. reqHeaders.Set("Content-Type", "application/json")
  3617. c.urlParams_.Set("alt", alt)
  3618. c.urlParams_.Set("prettyPrint", "false")
  3619. urls := googleapi.ResolveRelative(c.s.BasePath, "pretargetingconfigs/{accountId}")
  3620. urls += "?" + c.urlParams_.Encode()
  3621. req, err := http.NewRequest("POST", urls, body)
  3622. if err != nil {
  3623. return nil, err
  3624. }
  3625. req.Header = reqHeaders
  3626. googleapi.Expand(req.URL, map[string]string{
  3627. "accountId": strconv.FormatInt(c.accountId, 10),
  3628. })
  3629. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3630. }
  3631. // Do executes the "adexchangebuyer.pretargetingConfig.insert" call.
  3632. // Exactly one of *PretargetingConfig or error will be non-nil. Any
  3633. // non-2xx status code is an error. Response headers are in either
  3634. // *PretargetingConfig.ServerResponse.Header or (if a response was
  3635. // returned at all) in error.(*googleapi.Error).Header. Use
  3636. // googleapi.IsNotModified to check whether the returned error was
  3637. // because http.StatusNotModified was returned.
  3638. func (c *PretargetingConfigInsertCall) Do(opts ...googleapi.CallOption) (*PretargetingConfig, error) {
  3639. gensupport.SetOptions(c.urlParams_, opts...)
  3640. res, err := c.doRequest("json")
  3641. if res != nil && res.StatusCode == http.StatusNotModified {
  3642. if res.Body != nil {
  3643. res.Body.Close()
  3644. }
  3645. return nil, &googleapi.Error{
  3646. Code: res.StatusCode,
  3647. Header: res.Header,
  3648. }
  3649. }
  3650. if err != nil {
  3651. return nil, err
  3652. }
  3653. defer googleapi.CloseBody(res)
  3654. if err := googleapi.CheckResponse(res); err != nil {
  3655. return nil, err
  3656. }
  3657. ret := &PretargetingConfig{
  3658. ServerResponse: googleapi.ServerResponse{
  3659. Header: res.Header,
  3660. HTTPStatusCode: res.StatusCode,
  3661. },
  3662. }
  3663. target := &ret
  3664. if err := gensupport.DecodeResponse(target, res); err != nil {
  3665. return nil, err
  3666. }
  3667. return ret, nil
  3668. // {
  3669. // "description": "Inserts a new pretargeting configuration.",
  3670. // "httpMethod": "POST",
  3671. // "id": "adexchangebuyer.pretargetingConfig.insert",
  3672. // "parameterOrder": [
  3673. // "accountId"
  3674. // ],
  3675. // "parameters": {
  3676. // "accountId": {
  3677. // "description": "The account id to insert the pretargeting config for.",
  3678. // "format": "int64",
  3679. // "location": "path",
  3680. // "required": true,
  3681. // "type": "string"
  3682. // }
  3683. // },
  3684. // "path": "pretargetingconfigs/{accountId}",
  3685. // "request": {
  3686. // "$ref": "PretargetingConfig"
  3687. // },
  3688. // "response": {
  3689. // "$ref": "PretargetingConfig"
  3690. // },
  3691. // "scopes": [
  3692. // "https://www.googleapis.com/auth/adexchange.buyer"
  3693. // ]
  3694. // }
  3695. }
  3696. // method id "adexchangebuyer.pretargetingConfig.list":
  3697. type PretargetingConfigListCall struct {
  3698. s *Service
  3699. accountId int64
  3700. urlParams_ gensupport.URLParams
  3701. ifNoneMatch_ string
  3702. ctx_ context.Context
  3703. header_ http.Header
  3704. }
  3705. // List: Retrieves a list of the authenticated user's pretargeting
  3706. // configurations.
  3707. func (r *PretargetingConfigService) List(accountId int64) *PretargetingConfigListCall {
  3708. c := &PretargetingConfigListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3709. c.accountId = accountId
  3710. return c
  3711. }
  3712. // Fields allows partial responses to be retrieved. See
  3713. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3714. // for more information.
  3715. func (c *PretargetingConfigListCall) Fields(s ...googleapi.Field) *PretargetingConfigListCall {
  3716. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3717. return c
  3718. }
  3719. // IfNoneMatch sets the optional parameter which makes the operation
  3720. // fail if the object's ETag matches the given value. This is useful for
  3721. // getting updates only after the object has changed since the last
  3722. // request. Use googleapi.IsNotModified to check whether the response
  3723. // error from Do is the result of In-None-Match.
  3724. func (c *PretargetingConfigListCall) IfNoneMatch(entityTag string) *PretargetingConfigListCall {
  3725. c.ifNoneMatch_ = entityTag
  3726. return c
  3727. }
  3728. // Context sets the context to be used in this call's Do method. Any
  3729. // pending HTTP request will be aborted if the provided context is
  3730. // canceled.
  3731. func (c *PretargetingConfigListCall) Context(ctx context.Context) *PretargetingConfigListCall {
  3732. c.ctx_ = ctx
  3733. return c
  3734. }
  3735. // Header returns an http.Header that can be modified by the caller to
  3736. // add HTTP headers to the request.
  3737. func (c *PretargetingConfigListCall) Header() http.Header {
  3738. if c.header_ == nil {
  3739. c.header_ = make(http.Header)
  3740. }
  3741. return c.header_
  3742. }
  3743. func (c *PretargetingConfigListCall) doRequest(alt string) (*http.Response, error) {
  3744. reqHeaders := make(http.Header)
  3745. for k, v := range c.header_ {
  3746. reqHeaders[k] = v
  3747. }
  3748. reqHeaders.Set("User-Agent", c.s.userAgent())
  3749. if c.ifNoneMatch_ != "" {
  3750. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3751. }
  3752. var body io.Reader = nil
  3753. c.urlParams_.Set("alt", alt)
  3754. c.urlParams_.Set("prettyPrint", "false")
  3755. urls := googleapi.ResolveRelative(c.s.BasePath, "pretargetingconfigs/{accountId}")
  3756. urls += "?" + c.urlParams_.Encode()
  3757. req, err := http.NewRequest("GET", urls, body)
  3758. if err != nil {
  3759. return nil, err
  3760. }
  3761. req.Header = reqHeaders
  3762. googleapi.Expand(req.URL, map[string]string{
  3763. "accountId": strconv.FormatInt(c.accountId, 10),
  3764. })
  3765. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3766. }
  3767. // Do executes the "adexchangebuyer.pretargetingConfig.list" call.
  3768. // Exactly one of *PretargetingConfigList or error will be non-nil. Any
  3769. // non-2xx status code is an error. Response headers are in either
  3770. // *PretargetingConfigList.ServerResponse.Header or (if a response was
  3771. // returned at all) in error.(*googleapi.Error).Header. Use
  3772. // googleapi.IsNotModified to check whether the returned error was
  3773. // because http.StatusNotModified was returned.
  3774. func (c *PretargetingConfigListCall) Do(opts ...googleapi.CallOption) (*PretargetingConfigList, error) {
  3775. gensupport.SetOptions(c.urlParams_, opts...)
  3776. res, err := c.doRequest("json")
  3777. if res != nil && res.StatusCode == http.StatusNotModified {
  3778. if res.Body != nil {
  3779. res.Body.Close()
  3780. }
  3781. return nil, &googleapi.Error{
  3782. Code: res.StatusCode,
  3783. Header: res.Header,
  3784. }
  3785. }
  3786. if err != nil {
  3787. return nil, err
  3788. }
  3789. defer googleapi.CloseBody(res)
  3790. if err := googleapi.CheckResponse(res); err != nil {
  3791. return nil, err
  3792. }
  3793. ret := &PretargetingConfigList{
  3794. ServerResponse: googleapi.ServerResponse{
  3795. Header: res.Header,
  3796. HTTPStatusCode: res.StatusCode,
  3797. },
  3798. }
  3799. target := &ret
  3800. if err := gensupport.DecodeResponse(target, res); err != nil {
  3801. return nil, err
  3802. }
  3803. return ret, nil
  3804. // {
  3805. // "description": "Retrieves a list of the authenticated user's pretargeting configurations.",
  3806. // "httpMethod": "GET",
  3807. // "id": "adexchangebuyer.pretargetingConfig.list",
  3808. // "parameterOrder": [
  3809. // "accountId"
  3810. // ],
  3811. // "parameters": {
  3812. // "accountId": {
  3813. // "description": "The account id to get the pretargeting configs for.",
  3814. // "format": "int64",
  3815. // "location": "path",
  3816. // "required": true,
  3817. // "type": "string"
  3818. // }
  3819. // },
  3820. // "path": "pretargetingconfigs/{accountId}",
  3821. // "response": {
  3822. // "$ref": "PretargetingConfigList"
  3823. // },
  3824. // "scopes": [
  3825. // "https://www.googleapis.com/auth/adexchange.buyer"
  3826. // ]
  3827. // }
  3828. }
  3829. // method id "adexchangebuyer.pretargetingConfig.patch":
  3830. type PretargetingConfigPatchCall struct {
  3831. s *Service
  3832. accountId int64
  3833. configId int64
  3834. pretargetingconfig *PretargetingConfig
  3835. urlParams_ gensupport.URLParams
  3836. ctx_ context.Context
  3837. header_ http.Header
  3838. }
  3839. // Patch: Updates an existing pretargeting config. This method supports
  3840. // patch semantics.
  3841. func (r *PretargetingConfigService) Patch(accountId int64, configId int64, pretargetingconfig *PretargetingConfig) *PretargetingConfigPatchCall {
  3842. c := &PretargetingConfigPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3843. c.accountId = accountId
  3844. c.configId = configId
  3845. c.pretargetingconfig = pretargetingconfig
  3846. return c
  3847. }
  3848. // Fields allows partial responses to be retrieved. See
  3849. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3850. // for more information.
  3851. func (c *PretargetingConfigPatchCall) Fields(s ...googleapi.Field) *PretargetingConfigPatchCall {
  3852. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3853. return c
  3854. }
  3855. // Context sets the context to be used in this call's Do method. Any
  3856. // pending HTTP request will be aborted if the provided context is
  3857. // canceled.
  3858. func (c *PretargetingConfigPatchCall) Context(ctx context.Context) *PretargetingConfigPatchCall {
  3859. c.ctx_ = ctx
  3860. return c
  3861. }
  3862. // Header returns an http.Header that can be modified by the caller to
  3863. // add HTTP headers to the request.
  3864. func (c *PretargetingConfigPatchCall) Header() http.Header {
  3865. if c.header_ == nil {
  3866. c.header_ = make(http.Header)
  3867. }
  3868. return c.header_
  3869. }
  3870. func (c *PretargetingConfigPatchCall) doRequest(alt string) (*http.Response, error) {
  3871. reqHeaders := make(http.Header)
  3872. for k, v := range c.header_ {
  3873. reqHeaders[k] = v
  3874. }
  3875. reqHeaders.Set("User-Agent", c.s.userAgent())
  3876. var body io.Reader = nil
  3877. body, err := googleapi.WithoutDataWrapper.JSONReader(c.pretargetingconfig)
  3878. if err != nil {
  3879. return nil, err
  3880. }
  3881. reqHeaders.Set("Content-Type", "application/json")
  3882. c.urlParams_.Set("alt", alt)
  3883. c.urlParams_.Set("prettyPrint", "false")
  3884. urls := googleapi.ResolveRelative(c.s.BasePath, "pretargetingconfigs/{accountId}/{configId}")
  3885. urls += "?" + c.urlParams_.Encode()
  3886. req, err := http.NewRequest("PATCH", urls, body)
  3887. if err != nil {
  3888. return nil, err
  3889. }
  3890. req.Header = reqHeaders
  3891. googleapi.Expand(req.URL, map[string]string{
  3892. "accountId": strconv.FormatInt(c.accountId, 10),
  3893. "configId": strconv.FormatInt(c.configId, 10),
  3894. })
  3895. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3896. }
  3897. // Do executes the "adexchangebuyer.pretargetingConfig.patch" call.
  3898. // Exactly one of *PretargetingConfig or error will be non-nil. Any
  3899. // non-2xx status code is an error. Response headers are in either
  3900. // *PretargetingConfig.ServerResponse.Header or (if a response was
  3901. // returned at all) in error.(*googleapi.Error).Header. Use
  3902. // googleapi.IsNotModified to check whether the returned error was
  3903. // because http.StatusNotModified was returned.
  3904. func (c *PretargetingConfigPatchCall) Do(opts ...googleapi.CallOption) (*PretargetingConfig, error) {
  3905. gensupport.SetOptions(c.urlParams_, opts...)
  3906. res, err := c.doRequest("json")
  3907. if res != nil && res.StatusCode == http.StatusNotModified {
  3908. if res.Body != nil {
  3909. res.Body.Close()
  3910. }
  3911. return nil, &googleapi.Error{
  3912. Code: res.StatusCode,
  3913. Header: res.Header,
  3914. }
  3915. }
  3916. if err != nil {
  3917. return nil, err
  3918. }
  3919. defer googleapi.CloseBody(res)
  3920. if err := googleapi.CheckResponse(res); err != nil {
  3921. return nil, err
  3922. }
  3923. ret := &PretargetingConfig{
  3924. ServerResponse: googleapi.ServerResponse{
  3925. Header: res.Header,
  3926. HTTPStatusCode: res.StatusCode,
  3927. },
  3928. }
  3929. target := &ret
  3930. if err := gensupport.DecodeResponse(target, res); err != nil {
  3931. return nil, err
  3932. }
  3933. return ret, nil
  3934. // {
  3935. // "description": "Updates an existing pretargeting config. This method supports patch semantics.",
  3936. // "httpMethod": "PATCH",
  3937. // "id": "adexchangebuyer.pretargetingConfig.patch",
  3938. // "parameterOrder": [
  3939. // "accountId",
  3940. // "configId"
  3941. // ],
  3942. // "parameters": {
  3943. // "accountId": {
  3944. // "description": "The account id to update the pretargeting config for.",
  3945. // "format": "int64",
  3946. // "location": "path",
  3947. // "required": true,
  3948. // "type": "string"
  3949. // },
  3950. // "configId": {
  3951. // "description": "The specific id of the configuration to update.",
  3952. // "format": "int64",
  3953. // "location": "path",
  3954. // "required": true,
  3955. // "type": "string"
  3956. // }
  3957. // },
  3958. // "path": "pretargetingconfigs/{accountId}/{configId}",
  3959. // "request": {
  3960. // "$ref": "PretargetingConfig"
  3961. // },
  3962. // "response": {
  3963. // "$ref": "PretargetingConfig"
  3964. // },
  3965. // "scopes": [
  3966. // "https://www.googleapis.com/auth/adexchange.buyer"
  3967. // ]
  3968. // }
  3969. }
  3970. // method id "adexchangebuyer.pretargetingConfig.update":
  3971. type PretargetingConfigUpdateCall struct {
  3972. s *Service
  3973. accountId int64
  3974. configId int64
  3975. pretargetingconfig *PretargetingConfig
  3976. urlParams_ gensupport.URLParams
  3977. ctx_ context.Context
  3978. header_ http.Header
  3979. }
  3980. // Update: Updates an existing pretargeting config.
  3981. func (r *PretargetingConfigService) Update(accountId int64, configId int64, pretargetingconfig *PretargetingConfig) *PretargetingConfigUpdateCall {
  3982. c := &PretargetingConfigUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3983. c.accountId = accountId
  3984. c.configId = configId
  3985. c.pretargetingconfig = pretargetingconfig
  3986. return c
  3987. }
  3988. // Fields allows partial responses to be retrieved. See
  3989. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3990. // for more information.
  3991. func (c *PretargetingConfigUpdateCall) Fields(s ...googleapi.Field) *PretargetingConfigUpdateCall {
  3992. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3993. return c
  3994. }
  3995. // Context sets the context to be used in this call's Do method. Any
  3996. // pending HTTP request will be aborted if the provided context is
  3997. // canceled.
  3998. func (c *PretargetingConfigUpdateCall) Context(ctx context.Context) *PretargetingConfigUpdateCall {
  3999. c.ctx_ = ctx
  4000. return c
  4001. }
  4002. // Header returns an http.Header that can be modified by the caller to
  4003. // add HTTP headers to the request.
  4004. func (c *PretargetingConfigUpdateCall) Header() http.Header {
  4005. if c.header_ == nil {
  4006. c.header_ = make(http.Header)
  4007. }
  4008. return c.header_
  4009. }
  4010. func (c *PretargetingConfigUpdateCall) doRequest(alt string) (*http.Response, error) {
  4011. reqHeaders := make(http.Header)
  4012. for k, v := range c.header_ {
  4013. reqHeaders[k] = v
  4014. }
  4015. reqHeaders.Set("User-Agent", c.s.userAgent())
  4016. var body io.Reader = nil
  4017. body, err := googleapi.WithoutDataWrapper.JSONReader(c.pretargetingconfig)
  4018. if err != nil {
  4019. return nil, err
  4020. }
  4021. reqHeaders.Set("Content-Type", "application/json")
  4022. c.urlParams_.Set("alt", alt)
  4023. c.urlParams_.Set("prettyPrint", "false")
  4024. urls := googleapi.ResolveRelative(c.s.BasePath, "pretargetingconfigs/{accountId}/{configId}")
  4025. urls += "?" + c.urlParams_.Encode()
  4026. req, err := http.NewRequest("PUT", urls, body)
  4027. if err != nil {
  4028. return nil, err
  4029. }
  4030. req.Header = reqHeaders
  4031. googleapi.Expand(req.URL, map[string]string{
  4032. "accountId": strconv.FormatInt(c.accountId, 10),
  4033. "configId": strconv.FormatInt(c.configId, 10),
  4034. })
  4035. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4036. }
  4037. // Do executes the "adexchangebuyer.pretargetingConfig.update" call.
  4038. // Exactly one of *PretargetingConfig or error will be non-nil. Any
  4039. // non-2xx status code is an error. Response headers are in either
  4040. // *PretargetingConfig.ServerResponse.Header or (if a response was
  4041. // returned at all) in error.(*googleapi.Error).Header. Use
  4042. // googleapi.IsNotModified to check whether the returned error was
  4043. // because http.StatusNotModified was returned.
  4044. func (c *PretargetingConfigUpdateCall) Do(opts ...googleapi.CallOption) (*PretargetingConfig, error) {
  4045. gensupport.SetOptions(c.urlParams_, opts...)
  4046. res, err := c.doRequest("json")
  4047. if res != nil && res.StatusCode == http.StatusNotModified {
  4048. if res.Body != nil {
  4049. res.Body.Close()
  4050. }
  4051. return nil, &googleapi.Error{
  4052. Code: res.StatusCode,
  4053. Header: res.Header,
  4054. }
  4055. }
  4056. if err != nil {
  4057. return nil, err
  4058. }
  4059. defer googleapi.CloseBody(res)
  4060. if err := googleapi.CheckResponse(res); err != nil {
  4061. return nil, err
  4062. }
  4063. ret := &PretargetingConfig{
  4064. ServerResponse: googleapi.ServerResponse{
  4065. Header: res.Header,
  4066. HTTPStatusCode: res.StatusCode,
  4067. },
  4068. }
  4069. target := &ret
  4070. if err := gensupport.DecodeResponse(target, res); err != nil {
  4071. return nil, err
  4072. }
  4073. return ret, nil
  4074. // {
  4075. // "description": "Updates an existing pretargeting config.",
  4076. // "httpMethod": "PUT",
  4077. // "id": "adexchangebuyer.pretargetingConfig.update",
  4078. // "parameterOrder": [
  4079. // "accountId",
  4080. // "configId"
  4081. // ],
  4082. // "parameters": {
  4083. // "accountId": {
  4084. // "description": "The account id to update the pretargeting config for.",
  4085. // "format": "int64",
  4086. // "location": "path",
  4087. // "required": true,
  4088. // "type": "string"
  4089. // },
  4090. // "configId": {
  4091. // "description": "The specific id of the configuration to update.",
  4092. // "format": "int64",
  4093. // "location": "path",
  4094. // "required": true,
  4095. // "type": "string"
  4096. // }
  4097. // },
  4098. // "path": "pretargetingconfigs/{accountId}/{configId}",
  4099. // "request": {
  4100. // "$ref": "PretargetingConfig"
  4101. // },
  4102. // "response": {
  4103. // "$ref": "PretargetingConfig"
  4104. // },
  4105. // "scopes": [
  4106. // "https://www.googleapis.com/auth/adexchange.buyer"
  4107. // ]
  4108. // }
  4109. }