Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

4454 řádky
150 KiB

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