Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

1563 linhas
56 KiB

  1. // Package manufacturers provides access to the Manufacturer Center API.
  2. //
  3. // See https://developers.google.com/manufacturers/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/manufacturers/v1"
  8. // ...
  9. // manufacturersService, err := manufacturers.New(oauthHttpClient)
  10. package manufacturers // import "google.golang.org/api/manufacturers/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "manufacturers:v1"
  41. const apiName = "manufacturers"
  42. const apiVersion = "v1"
  43. const basePath = "https://manufacturers.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // Manage your product listings for Google Manufacturer Center
  47. ManufacturercenterScope = "https://www.googleapis.com/auth/manufacturercenter"
  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. return s, nil
  56. }
  57. type Service struct {
  58. client *http.Client
  59. BasePath string // API endpoint base URL
  60. UserAgent string // optional additional User-Agent fragment
  61. Accounts *AccountsService
  62. }
  63. func (s *Service) userAgent() string {
  64. if s.UserAgent == "" {
  65. return googleapi.UserAgent
  66. }
  67. return googleapi.UserAgent + " " + s.UserAgent
  68. }
  69. func NewAccountsService(s *Service) *AccountsService {
  70. rs := &AccountsService{s: s}
  71. rs.Products = NewAccountsProductsService(s)
  72. return rs
  73. }
  74. type AccountsService struct {
  75. s *Service
  76. Products *AccountsProductsService
  77. }
  78. func NewAccountsProductsService(s *Service) *AccountsProductsService {
  79. rs := &AccountsProductsService{s: s}
  80. return rs
  81. }
  82. type AccountsProductsService struct {
  83. s *Service
  84. }
  85. // Attributes: Attributes of the product. For more information,
  86. // see
  87. // https://support.google.com/manufacturers/answer/6124116.
  88. type Attributes struct {
  89. // AdditionalImageLink: The additional images of the product. For more
  90. // information,
  91. // see
  92. // https://support.google.com/manufacturers/answer/6124116#addlimage.
  93. AdditionalImageLink []*Image `json:"additionalImageLink,omitempty"`
  94. // AgeGroup: The target age group of the product. For more information,
  95. // see
  96. // https://support.google.com/manufacturers/answer/6124116#agegroup.
  97. AgeGroup string `json:"ageGroup,omitempty"`
  98. // Brand: The brand name of the product. For more information,
  99. // see
  100. // https://support.google.com/manufacturers/answer/6124116#brand.
  101. Brand string `json:"brand,omitempty"`
  102. // Capacity: The capacity of the product. For more information,
  103. // see
  104. // https://support.google.com/manufacturers/answer/6124116#capacity.
  105. Capacity *Capacity `json:"capacity,omitempty"`
  106. // Color: The color of the product. For more information,
  107. // see
  108. // https://support.google.com/manufacturers/answer/6124116#color.
  109. Color string `json:"color,omitempty"`
  110. // Count: The count of the product. For more information,
  111. // see
  112. // https://support.google.com/manufacturers/answer/6124116#count.
  113. Count *Count `json:"count,omitempty"`
  114. // Description: The description of the product. For more information,
  115. // see
  116. // https://support.google.com/manufacturers/answer/6124116#descriptio
  117. // n.
  118. Description string `json:"description,omitempty"`
  119. // DisclosureDate: The disclosure date of the product. For more
  120. // information,
  121. // see
  122. // https://support.google.com/manufacturers/answer/6124116#disclosure
  123. // .
  124. DisclosureDate string `json:"disclosureDate,omitempty"`
  125. // ExcludedDestination: A list of excluded destinations.
  126. ExcludedDestination []string `json:"excludedDestination,omitempty"`
  127. // FeatureDescription: The rich format description of the product. For
  128. // more information,
  129. // see
  130. // https://support.google.com/manufacturers/answer/6124116#featuredes
  131. // c.
  132. FeatureDescription []*FeatureDescription `json:"featureDescription,omitempty"`
  133. // Flavor: The flavor of the product. For more information,
  134. // see
  135. // https://support.google.com/manufacturers/answer/6124116#flavor.
  136. Flavor string `json:"flavor,omitempty"`
  137. // Format: The format of the product. For more information,
  138. // see
  139. // https://support.google.com/manufacturers/answer/6124116#format.
  140. Format string `json:"format,omitempty"`
  141. // Gender: The target gender of the product. For more information,
  142. // see
  143. // https://support.google.com/manufacturers/answer/6124116#gender.
  144. Gender string `json:"gender,omitempty"`
  145. // Gtin: The Global Trade Item Number (GTIN) of the product. For more
  146. // information,
  147. // see https://support.google.com/manufacturers/answer/6124116#gtin.
  148. Gtin []string `json:"gtin,omitempty"`
  149. // ImageLink: The image of the product. For more information,
  150. // see
  151. // https://support.google.com/manufacturers/answer/6124116#image.
  152. ImageLink *Image `json:"imageLink,omitempty"`
  153. // IncludedDestination: A list of included destinations.
  154. IncludedDestination []string `json:"includedDestination,omitempty"`
  155. // ItemGroupId: The item group id of the product. For more information,
  156. // see
  157. // https://support.google.com/manufacturers/answer/6124116#itemgroupi
  158. // d.
  159. ItemGroupId string `json:"itemGroupId,omitempty"`
  160. // Material: The material of the product. For more information,
  161. // see
  162. // https://support.google.com/manufacturers/answer/6124116#material.
  163. Material string `json:"material,omitempty"`
  164. // Mpn: The Manufacturer Part Number (MPN) of the product. For more
  165. // information,
  166. // see https://support.google.com/manufacturers/answer/6124116#mpn.
  167. Mpn string `json:"mpn,omitempty"`
  168. // Pattern: The pattern of the product. For more information,
  169. // see
  170. // https://support.google.com/manufacturers/answer/6124116#pattern.
  171. Pattern string `json:"pattern,omitempty"`
  172. // ProductDetail: The details of the product. For more information,
  173. // see
  174. // https://support.google.com/manufacturers/answer/6124116#productdet
  175. // ail.
  176. ProductDetail []*ProductDetail `json:"productDetail,omitempty"`
  177. // ProductLine: The name of the group of products related to the
  178. // product. For more
  179. // information,
  180. // see
  181. // https://support.google.com/manufacturers/answer/6124116#productlin
  182. // e.
  183. ProductLine string `json:"productLine,omitempty"`
  184. // ProductName: The canonical name of the product. For more information,
  185. // see
  186. // https://support.google.com/manufacturers/answer/6124116#productnam
  187. // e.
  188. ProductName string `json:"productName,omitempty"`
  189. // ProductPageUrl: The URL of the detail page of the product. For more
  190. // information,
  191. // see
  192. // https://support.google.com/manufacturers/answer/6124116#productpag
  193. // e.
  194. ProductPageUrl string `json:"productPageUrl,omitempty"`
  195. // ProductType: The type or category of the product. For more
  196. // information,
  197. // see
  198. // https://support.google.com/manufacturers/answer/6124116#producttyp
  199. // e.
  200. ProductType []string `json:"productType,omitempty"`
  201. // ReleaseDate: The release date of the product. For more information,
  202. // see
  203. // https://support.google.com/manufacturers/answer/6124116#release.
  204. ReleaseDate string `json:"releaseDate,omitempty"`
  205. // Scent: The scent of the product. For more information, see
  206. // https://support.google.com/manufacturers/answer/6124116#scent.
  207. Scent string `json:"scent,omitempty"`
  208. // Size: The size of the product. For more information,
  209. // see
  210. // https://support.google.com/manufacturers/answer/6124116#size.
  211. Size string `json:"size,omitempty"`
  212. // SizeSystem: The size system of the product. For more information,
  213. // see
  214. // https://support.google.com/manufacturers/answer/6124116#sizesystem
  215. // .
  216. SizeSystem string `json:"sizeSystem,omitempty"`
  217. // SizeType: The size type of the product. For more information,
  218. // see
  219. // https://support.google.com/manufacturers/answer/6124116#sizetype.
  220. SizeType string `json:"sizeType,omitempty"`
  221. // SuggestedRetailPrice: The suggested retail price (MSRP) of the
  222. // product. For more information,
  223. // see https://support.google.com/manufacturers/answer/6124116#price.
  224. SuggestedRetailPrice *Price `json:"suggestedRetailPrice,omitempty"`
  225. // TargetClientId: The target client id. Should only be used in the
  226. // accounts of the data
  227. // partners.
  228. TargetClientId string `json:"targetClientId,omitempty"`
  229. // Theme: The theme of the product. For more information,
  230. // see
  231. // https://support.google.com/manufacturers/answer/6124116#theme.
  232. Theme string `json:"theme,omitempty"`
  233. // Title: The title of the product. For more information,
  234. // see
  235. // https://support.google.com/manufacturers/answer/6124116#title.
  236. Title string `json:"title,omitempty"`
  237. // VideoLink: The videos of the product. For more information,
  238. // see
  239. // https://support.google.com/manufacturers/answer/6124116#video.
  240. VideoLink []string `json:"videoLink,omitempty"`
  241. // ForceSendFields is a list of field names (e.g. "AdditionalImageLink")
  242. // to unconditionally include in API requests. By default, fields with
  243. // empty values are omitted from API requests. However, any non-pointer,
  244. // non-interface field appearing in ForceSendFields will be sent to the
  245. // server regardless of whether the field is empty or not. This may be
  246. // used to include empty fields in Patch requests.
  247. ForceSendFields []string `json:"-"`
  248. // NullFields is a list of field names (e.g. "AdditionalImageLink") to
  249. // include in API requests with the JSON null value. By default, fields
  250. // with empty values are omitted from API requests. However, any field
  251. // with an empty value appearing in NullFields will be sent to the
  252. // server as null. It is an error if a field in this list has a
  253. // non-empty value. This may be used to include null fields in Patch
  254. // requests.
  255. NullFields []string `json:"-"`
  256. }
  257. func (s *Attributes) MarshalJSON() ([]byte, error) {
  258. type NoMethod Attributes
  259. raw := NoMethod(*s)
  260. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  261. }
  262. // Capacity: The capacity of a product. For more information,
  263. // see
  264. // https://support.google.com/manufacturers/answer/6124116#capacity.
  265. type Capacity struct {
  266. // Unit: The unit of the capacity, i.e., MB, GB, or TB.
  267. Unit string `json:"unit,omitempty"`
  268. // Value: The numeric value of the capacity.
  269. Value int64 `json:"value,omitempty,string"`
  270. // ForceSendFields is a list of field names (e.g. "Unit") to
  271. // unconditionally include in API requests. By default, fields with
  272. // empty values are omitted from API requests. However, any non-pointer,
  273. // non-interface field appearing in ForceSendFields will be sent to the
  274. // server regardless of whether the field is empty or not. This may be
  275. // used to include empty fields in Patch requests.
  276. ForceSendFields []string `json:"-"`
  277. // NullFields is a list of field names (e.g. "Unit") to include in API
  278. // requests with the JSON null value. By default, fields with empty
  279. // values are omitted from API requests. However, any field with an
  280. // empty value appearing in NullFields will be sent to the server as
  281. // null. It is an error if a field in this list has a non-empty value.
  282. // This may be used to include null fields in Patch requests.
  283. NullFields []string `json:"-"`
  284. }
  285. func (s *Capacity) MarshalJSON() ([]byte, error) {
  286. type NoMethod Capacity
  287. raw := NoMethod(*s)
  288. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  289. }
  290. // Count: The number of products in a single package. For more
  291. // information,
  292. // see
  293. // https://support.google.com/manufacturers/answer/6124116#count.
  294. type Count struct {
  295. // Unit: The unit in which these products are counted.
  296. Unit string `json:"unit,omitempty"`
  297. // Value: The numeric value of the number of products in a package.
  298. Value int64 `json:"value,omitempty,string"`
  299. // ForceSendFields is a list of field names (e.g. "Unit") to
  300. // unconditionally include in API requests. By default, fields with
  301. // empty values are omitted from API requests. However, any non-pointer,
  302. // non-interface field appearing in ForceSendFields will be sent to the
  303. // server regardless of whether the field is empty or not. This may be
  304. // used to include empty fields in Patch requests.
  305. ForceSendFields []string `json:"-"`
  306. // NullFields is a list of field names (e.g. "Unit") to include in API
  307. // requests with the JSON null value. By default, fields with empty
  308. // values are omitted from API requests. However, any field with an
  309. // empty value appearing in NullFields will be sent to the server as
  310. // null. It is an error if a field in this list has a non-empty value.
  311. // This may be used to include null fields in Patch requests.
  312. NullFields []string `json:"-"`
  313. }
  314. func (s *Count) MarshalJSON() ([]byte, error) {
  315. type NoMethod Count
  316. raw := NoMethod(*s)
  317. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  318. }
  319. // DestinationStatus: The destination status.
  320. type DestinationStatus struct {
  321. // Destination: The name of the destination.
  322. Destination string `json:"destination,omitempty"`
  323. // Status: The status of the destination.
  324. //
  325. // Possible values:
  326. // "UNKNOWN" - Unspecified status, never used.
  327. // "ACTIVE" - The product is used for this destination.
  328. // "PENDING" - The decision is still pending.
  329. // "DISAPPROVED" - The product is disapproved. Please look at the
  330. // issues.
  331. Status string `json:"status,omitempty"`
  332. // ForceSendFields is a list of field names (e.g. "Destination") 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. "Destination") to include
  340. // in API requests with the JSON null value. By default, fields with
  341. // empty values are omitted from API requests. However, any field with
  342. // an 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 *DestinationStatus) MarshalJSON() ([]byte, error) {
  348. type NoMethod DestinationStatus
  349. raw := NoMethod(*s)
  350. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  351. }
  352. // Empty: A generic empty message that you can re-use to avoid defining
  353. // duplicated
  354. // empty messages in your APIs. A typical example is to use it as the
  355. // request
  356. // or the response type of an API method. For instance:
  357. //
  358. // service Foo {
  359. // rpc Bar(google.protobuf.Empty) returns
  360. // (google.protobuf.Empty);
  361. // }
  362. //
  363. // The JSON representation for `Empty` is empty JSON object `{}`.
  364. type Empty struct {
  365. // ServerResponse contains the HTTP response code and headers from the
  366. // server.
  367. googleapi.ServerResponse `json:"-"`
  368. }
  369. // FeatureDescription: A feature description of the product. For more
  370. // information,
  371. // see
  372. // https://support.google.com/manufacturers/answer/6124116#featuredes
  373. // c.
  374. type FeatureDescription struct {
  375. // Headline: A short description of the feature.
  376. Headline string `json:"headline,omitempty"`
  377. // Image: An optional image describing the feature.
  378. Image *Image `json:"image,omitempty"`
  379. // Text: A detailed description of the feature.
  380. Text string `json:"text,omitempty"`
  381. // ForceSendFields is a list of field names (e.g. "Headline") to
  382. // unconditionally include in API requests. By default, fields with
  383. // empty values are omitted from API requests. However, any non-pointer,
  384. // non-interface field appearing in ForceSendFields will be sent to the
  385. // server regardless of whether the field is empty or not. This may be
  386. // used to include empty fields in Patch requests.
  387. ForceSendFields []string `json:"-"`
  388. // NullFields is a list of field names (e.g. "Headline") to include in
  389. // API requests with the JSON null value. By default, fields with empty
  390. // values are omitted from API requests. However, any field with an
  391. // empty value appearing in NullFields will be sent to the server as
  392. // null. It is an error if a field in this list has a non-empty value.
  393. // This may be used to include null fields in Patch requests.
  394. NullFields []string `json:"-"`
  395. }
  396. func (s *FeatureDescription) MarshalJSON() ([]byte, error) {
  397. type NoMethod FeatureDescription
  398. raw := NoMethod(*s)
  399. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  400. }
  401. // Image: An image.
  402. type Image struct {
  403. // ImageUrl: The URL of the image. For crawled images, this is the
  404. // provided URL. For
  405. // uploaded images, this is a serving URL from Google if the image has
  406. // been
  407. // processed successfully.
  408. ImageUrl string `json:"imageUrl,omitempty"`
  409. // Status: The status of the image.
  410. // @OutputOnly
  411. //
  412. // Possible values:
  413. // "STATUS_UNSPECIFIED" - The image status is unspecified. Should not
  414. // be used.
  415. // "PENDING_PROCESSING" - The image was uploaded and is being
  416. // processed.
  417. // "PENDING_CRAWL" - The image crawl is still pending.
  418. // "OK" - The image was processed and it meets the requirements.
  419. // "ROBOTED" - The image URL is protected by robots.txt file and
  420. // cannot be crawled.
  421. // "XROBOTED" - The image URL is protected by X-Robots-Tag and cannot
  422. // be crawled.
  423. // "CRAWL_ERROR" - There was an error while crawling the image.
  424. // "PROCESSING_ERROR" - The image cannot be processed.
  425. // "DECODING_ERROR" - The image cannot be decoded.
  426. // "TOO_BIG" - The image is too big.
  427. // "CRAWL_SKIPPED" - The image was manually overridden and will not be
  428. // crawled.
  429. // "HOSTLOADED" - The image crawl was postponed to avoid overloading
  430. // the host.
  431. // "HTTP_404" - The image URL returned a "404 Not Found" error.
  432. Status string `json:"status,omitempty"`
  433. // Type: The type of the image, i.e., crawled or uploaded.
  434. // @OutputOnly
  435. //
  436. // Possible values:
  437. // "TYPE_UNSPECIFIED" - Type is unspecified. Should not be used.
  438. // "CRAWLED" - The image was crawled from a provided URL.
  439. // "UPLOADED" - The image was uploaded.
  440. Type string `json:"type,omitempty"`
  441. // ForceSendFields is a list of field names (e.g. "ImageUrl") to
  442. // unconditionally include in API requests. By default, fields with
  443. // empty values are omitted from API requests. However, any non-pointer,
  444. // non-interface field appearing in ForceSendFields will be sent to the
  445. // server regardless of whether the field is empty or not. This may be
  446. // used to include empty fields in Patch requests.
  447. ForceSendFields []string `json:"-"`
  448. // NullFields is a list of field names (e.g. "ImageUrl") to include in
  449. // API requests with the JSON null value. By default, fields with empty
  450. // values are omitted from API requests. However, any field with an
  451. // empty value appearing in NullFields will be sent to the server as
  452. // null. It is an error if a field in this list has a non-empty value.
  453. // This may be used to include null fields in Patch requests.
  454. NullFields []string `json:"-"`
  455. }
  456. func (s *Image) MarshalJSON() ([]byte, error) {
  457. type NoMethod Image
  458. raw := NoMethod(*s)
  459. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  460. }
  461. // Issue: Product issue.
  462. type Issue struct {
  463. // Attribute: If present, the attribute that triggered the issue. For
  464. // more information
  465. // about attributes,
  466. // see
  467. // https://support.google.com/manufacturers/answer/6124116.
  468. Attribute string `json:"attribute,omitempty"`
  469. // Description: Longer description of the issue focused on how to
  470. // resolve it.
  471. Description string `json:"description,omitempty"`
  472. // Destination: The destination this issue applies to.
  473. Destination string `json:"destination,omitempty"`
  474. // Resolution: What needs to happen to resolve the issue.
  475. //
  476. // Possible values:
  477. // "RESOLUTION_UNSPECIFIED" - Unspecified resolution, never used.
  478. // "USER_ACTION" - The user who provided the data must act in order to
  479. // resolve the issue
  480. // (for example by correcting some data).
  481. // "PENDING_PROCESSING" - The issue will be resolved automatically
  482. // (for example image crawl or
  483. // Google review). No action is required now. Resolution might lead
  484. // to
  485. // another issue (for example if crawl fails).
  486. Resolution string `json:"resolution,omitempty"`
  487. // Severity: The severity of the issue.
  488. //
  489. // Possible values:
  490. // "SEVERITY_UNSPECIFIED" - Unspecified severity, never used.
  491. // "ERROR" - Error severity. The issue prevents the usage of the whole
  492. // item.
  493. // "WARNING" - Warning severity. The issue is either one that prevents
  494. // the usage of the
  495. // attribute that triggered it or one that will soon prevent the usage
  496. // of
  497. // the whole item.
  498. // "INFO" - Info severity. The issue is one that doesn't require
  499. // immediate attention.
  500. // It is, for example, used to communicate which attributes are
  501. // still
  502. // pending review.
  503. Severity string `json:"severity,omitempty"`
  504. // Timestamp: The timestamp when this issue appeared.
  505. Timestamp string `json:"timestamp,omitempty"`
  506. // Title: Short title describing the nature of the issue.
  507. Title string `json:"title,omitempty"`
  508. // Type: The server-generated type of the issue, for
  509. // example,
  510. // “INCORRECT_TEXT_FORMATTING”, “IMAGE_NOT_SERVEABLE”, etc.
  511. Type string `json:"type,omitempty"`
  512. // ForceSendFields is a list of field names (e.g. "Attribute") to
  513. // unconditionally include in API requests. By default, fields with
  514. // empty values are omitted from API requests. However, any non-pointer,
  515. // non-interface field appearing in ForceSendFields will be sent to the
  516. // server regardless of whether the field is empty or not. This may be
  517. // used to include empty fields in Patch requests.
  518. ForceSendFields []string `json:"-"`
  519. // NullFields is a list of field names (e.g. "Attribute") to include in
  520. // API requests with the JSON null value. By default, fields with empty
  521. // values are omitted from API requests. However, any field with an
  522. // empty value appearing in NullFields will be sent to the server as
  523. // null. It is an error if a field in this list has a non-empty value.
  524. // This may be used to include null fields in Patch requests.
  525. NullFields []string `json:"-"`
  526. }
  527. func (s *Issue) MarshalJSON() ([]byte, error) {
  528. type NoMethod Issue
  529. raw := NoMethod(*s)
  530. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  531. }
  532. type ListProductsResponse struct {
  533. // NextPageToken: The token for the retrieval of the next page of
  534. // product statuses.
  535. NextPageToken string `json:"nextPageToken,omitempty"`
  536. // Products: List of the products.
  537. Products []*Product `json:"products,omitempty"`
  538. // ServerResponse contains the HTTP response code and headers from the
  539. // server.
  540. googleapi.ServerResponse `json:"-"`
  541. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  542. // unconditionally include in API requests. By default, fields with
  543. // empty values are omitted from API requests. However, any non-pointer,
  544. // non-interface field appearing in ForceSendFields will be sent to the
  545. // server regardless of whether the field is empty or not. This may be
  546. // used to include empty fields in Patch requests.
  547. ForceSendFields []string `json:"-"`
  548. // NullFields is a list of field names (e.g. "NextPageToken") to include
  549. // in API requests with the JSON null value. By default, fields with
  550. // empty values are omitted from API requests. However, any field with
  551. // an empty value appearing in NullFields will be sent to the server as
  552. // null. It is an error if a field in this list has a non-empty value.
  553. // This may be used to include null fields in Patch requests.
  554. NullFields []string `json:"-"`
  555. }
  556. func (s *ListProductsResponse) MarshalJSON() ([]byte, error) {
  557. type NoMethod ListProductsResponse
  558. raw := NoMethod(*s)
  559. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  560. }
  561. // Price: A price.
  562. type Price struct {
  563. // Amount: The numeric value of the price.
  564. Amount string `json:"amount,omitempty"`
  565. // Currency: The currency in which the price is denoted.
  566. Currency string `json:"currency,omitempty"`
  567. // ForceSendFields is a list of field names (e.g. "Amount") to
  568. // unconditionally include in API requests. By default, fields with
  569. // empty values are omitted from API requests. However, any non-pointer,
  570. // non-interface field appearing in ForceSendFields will be sent to the
  571. // server regardless of whether the field is empty or not. This may be
  572. // used to include empty fields in Patch requests.
  573. ForceSendFields []string `json:"-"`
  574. // NullFields is a list of field names (e.g. "Amount") to include in API
  575. // requests with the JSON null value. By default, fields with empty
  576. // values are omitted from API requests. However, any field with an
  577. // empty value appearing in NullFields will be sent to the server as
  578. // null. It is an error if a field in this list has a non-empty value.
  579. // This may be used to include null fields in Patch requests.
  580. NullFields []string `json:"-"`
  581. }
  582. func (s *Price) MarshalJSON() ([]byte, error) {
  583. type NoMethod Price
  584. raw := NoMethod(*s)
  585. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  586. }
  587. // Product: Product data.
  588. type Product struct {
  589. // Attributes: Attributes of the product uploaded to the Manufacturer
  590. // Center.
  591. Attributes *Attributes `json:"attributes,omitempty"`
  592. // ContentLanguage: The content language of the product as a two-letter
  593. // ISO 639-1 language code
  594. // (for example, en).
  595. ContentLanguage string `json:"contentLanguage,omitempty"`
  596. // DestinationStatuses: The status of the destinations.
  597. DestinationStatuses []*DestinationStatus `json:"destinationStatuses,omitempty"`
  598. // FinalAttributes: Final attributes of the product. The final
  599. // attributes are obtained by
  600. // overriding the uploaded attributes with the manually provided and
  601. // deleted
  602. // attributes. Google systems only process, evaluate, review, and/or use
  603. // final
  604. // attributes.
  605. //
  606. // This field is deprecated and will be removed end of July 2018. Please
  607. // use
  608. // attributes.
  609. FinalAttributes *Attributes `json:"finalAttributes,omitempty"`
  610. // Issues: A server-generated list of issues associated with the
  611. // product.
  612. Issues []*Issue `json:"issues,omitempty"`
  613. // ManuallyDeletedAttributes: Names of the attributes of the product
  614. // deleted manually via the
  615. // Manufacturer Center UI.
  616. //
  617. // This field is deprecated and will be removed end of July 2018. Please
  618. // use
  619. // attributes.
  620. ManuallyDeletedAttributes []string `json:"manuallyDeletedAttributes,omitempty"`
  621. // ManuallyProvidedAttributes: Attributes of the product provided
  622. // manually via the Manufacturer Center UI.
  623. //
  624. // This field is deprecated and will be removed end of July 2018. Please
  625. // use
  626. // attributes.
  627. ManuallyProvidedAttributes *Attributes `json:"manuallyProvidedAttributes,omitempty"`
  628. // Name: Name in the format
  629. // `{target_country}:{content_language}:{product_id}`.
  630. //
  631. // `target_country` - The target country of the product as a CLDR
  632. // territory
  633. // code (for example, US).
  634. //
  635. // `content_language` - The content language of the product as a
  636. // two-letter
  637. // ISO 639-1 language code (for example,
  638. // en).
  639. //
  640. // `product_id` - The ID of the product. For more information,
  641. // see
  642. //
  643. // https://support.google.com/manufacturers/answer/6124116#id.
  644. Name string `json:"name,omitempty"`
  645. // Parent: Parent ID in the format
  646. // `accounts/{account_id}`.
  647. //
  648. // `account_id` - The ID of the Manufacturer Center account.
  649. Parent string `json:"parent,omitempty"`
  650. // ProductId: The ID of the product. For more information,
  651. // see
  652. // https://support.google.com/manufacturers/answer/6124116#id.
  653. ProductId string `json:"productId,omitempty"`
  654. // TargetCountry: The target country of the product as a CLDR territory
  655. // code (for example,
  656. // US).
  657. TargetCountry string `json:"targetCountry,omitempty"`
  658. // UploadedAttributes: Attributes of the product uploaded via the
  659. // Manufacturer Center API or via
  660. // feeds.
  661. //
  662. // This field is deprecated and will be removed end of July 2018. Please
  663. // use
  664. // attributes.
  665. UploadedAttributes *Attributes `json:"uploadedAttributes,omitempty"`
  666. // ServerResponse contains the HTTP response code and headers from the
  667. // server.
  668. googleapi.ServerResponse `json:"-"`
  669. // ForceSendFields is a list of field names (e.g. "Attributes") to
  670. // unconditionally include in API requests. By default, fields with
  671. // empty values are omitted from API requests. However, any non-pointer,
  672. // non-interface field appearing in ForceSendFields will be sent to the
  673. // server regardless of whether the field is empty or not. This may be
  674. // used to include empty fields in Patch requests.
  675. ForceSendFields []string `json:"-"`
  676. // NullFields is a list of field names (e.g. "Attributes") to include in
  677. // API requests with the JSON null value. By default, fields with empty
  678. // values are omitted from API requests. However, any field with an
  679. // empty value appearing in NullFields will be sent to the server as
  680. // null. It is an error if a field in this list has a non-empty value.
  681. // This may be used to include null fields in Patch requests.
  682. NullFields []string `json:"-"`
  683. }
  684. func (s *Product) MarshalJSON() ([]byte, error) {
  685. type NoMethod Product
  686. raw := NoMethod(*s)
  687. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  688. }
  689. // ProductDetail: A product detail of the product. For more information,
  690. // see
  691. // https://support.google.com/manufacturers/answer/6124116#productdet
  692. // ail.
  693. type ProductDetail struct {
  694. // AttributeName: The name of the attribute.
  695. AttributeName string `json:"attributeName,omitempty"`
  696. // AttributeValue: The value of the attribute.
  697. AttributeValue string `json:"attributeValue,omitempty"`
  698. // SectionName: A short section name that can be reused between multiple
  699. // product details.
  700. SectionName string `json:"sectionName,omitempty"`
  701. // ForceSendFields is a list of field names (e.g. "AttributeName") to
  702. // unconditionally include in API requests. By default, fields with
  703. // empty values are omitted from API requests. However, any non-pointer,
  704. // non-interface field appearing in ForceSendFields will be sent to the
  705. // server regardless of whether the field is empty or not. This may be
  706. // used to include empty fields in Patch requests.
  707. ForceSendFields []string `json:"-"`
  708. // NullFields is a list of field names (e.g. "AttributeName") to include
  709. // in API requests with the JSON null value. By default, fields with
  710. // empty values are omitted from API requests. However, any field with
  711. // an empty value appearing in NullFields will be sent to the server as
  712. // null. It is an error if a field in this list has a non-empty value.
  713. // This may be used to include null fields in Patch requests.
  714. NullFields []string `json:"-"`
  715. }
  716. func (s *ProductDetail) MarshalJSON() ([]byte, error) {
  717. type NoMethod ProductDetail
  718. raw := NoMethod(*s)
  719. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  720. }
  721. // method id "manufacturers.accounts.products.delete":
  722. type AccountsProductsDeleteCall struct {
  723. s *Service
  724. parent string
  725. name string
  726. urlParams_ gensupport.URLParams
  727. ctx_ context.Context
  728. header_ http.Header
  729. }
  730. // Delete: Deletes the product from a Manufacturer Center account.
  731. func (r *AccountsProductsService) Delete(parent string, name string) *AccountsProductsDeleteCall {
  732. c := &AccountsProductsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  733. c.parent = parent
  734. c.name = name
  735. return c
  736. }
  737. // Fields allows partial responses to be retrieved. See
  738. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  739. // for more information.
  740. func (c *AccountsProductsDeleteCall) Fields(s ...googleapi.Field) *AccountsProductsDeleteCall {
  741. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  742. return c
  743. }
  744. // Context sets the context to be used in this call's Do method. Any
  745. // pending HTTP request will be aborted if the provided context is
  746. // canceled.
  747. func (c *AccountsProductsDeleteCall) Context(ctx context.Context) *AccountsProductsDeleteCall {
  748. c.ctx_ = ctx
  749. return c
  750. }
  751. // Header returns an http.Header that can be modified by the caller to
  752. // add HTTP headers to the request.
  753. func (c *AccountsProductsDeleteCall) Header() http.Header {
  754. if c.header_ == nil {
  755. c.header_ = make(http.Header)
  756. }
  757. return c.header_
  758. }
  759. func (c *AccountsProductsDeleteCall) doRequest(alt string) (*http.Response, error) {
  760. reqHeaders := make(http.Header)
  761. for k, v := range c.header_ {
  762. reqHeaders[k] = v
  763. }
  764. reqHeaders.Set("User-Agent", c.s.userAgent())
  765. var body io.Reader = nil
  766. c.urlParams_.Set("alt", alt)
  767. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/products/{+name}")
  768. urls += "?" + c.urlParams_.Encode()
  769. req, _ := http.NewRequest("DELETE", urls, body)
  770. req.Header = reqHeaders
  771. googleapi.Expand(req.URL, map[string]string{
  772. "parent": c.parent,
  773. "name": c.name,
  774. })
  775. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  776. }
  777. // Do executes the "manufacturers.accounts.products.delete" call.
  778. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  779. // code is an error. Response headers are in either
  780. // *Empty.ServerResponse.Header or (if a response was returned at all)
  781. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  782. // check whether the returned error was because http.StatusNotModified
  783. // was returned.
  784. func (c *AccountsProductsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  785. gensupport.SetOptions(c.urlParams_, opts...)
  786. res, err := c.doRequest("json")
  787. if res != nil && res.StatusCode == http.StatusNotModified {
  788. if res.Body != nil {
  789. res.Body.Close()
  790. }
  791. return nil, &googleapi.Error{
  792. Code: res.StatusCode,
  793. Header: res.Header,
  794. }
  795. }
  796. if err != nil {
  797. return nil, err
  798. }
  799. defer googleapi.CloseBody(res)
  800. if err := googleapi.CheckResponse(res); err != nil {
  801. return nil, err
  802. }
  803. ret := &Empty{
  804. ServerResponse: googleapi.ServerResponse{
  805. Header: res.Header,
  806. HTTPStatusCode: res.StatusCode,
  807. },
  808. }
  809. target := &ret
  810. if err := gensupport.DecodeResponse(target, res); err != nil {
  811. return nil, err
  812. }
  813. return ret, nil
  814. // {
  815. // "description": "Deletes the product from a Manufacturer Center account.",
  816. // "flatPath": "v1/accounts/{accountsId}/products/{productsId}",
  817. // "httpMethod": "DELETE",
  818. // "id": "manufacturers.accounts.products.delete",
  819. // "parameterOrder": [
  820. // "parent",
  821. // "name"
  822. // ],
  823. // "parameters": {
  824. // "name": {
  825. // "description": "Name in the format `{target_country}:{content_language}:{product_id}`.\n\n`target_country` - The target country of the product as a CLDR territory\n code (for example, US).\n\n`content_language` - The content language of the product as a two-letter\n ISO 639-1 language code (for example, en).\n\n`product_id` - The ID of the product. For more information, see\n https://support.google.com/manufacturers/answer/6124116#id.",
  826. // "location": "path",
  827. // "pattern": "^[^/]+$",
  828. // "required": true,
  829. // "type": "string"
  830. // },
  831. // "parent": {
  832. // "description": "Parent ID in the format `accounts/{account_id}`.\n\n`account_id` - The ID of the Manufacturer Center account.",
  833. // "location": "path",
  834. // "pattern": "^accounts/[^/]+$",
  835. // "required": true,
  836. // "type": "string"
  837. // }
  838. // },
  839. // "path": "v1/{+parent}/products/{+name}",
  840. // "response": {
  841. // "$ref": "Empty"
  842. // },
  843. // "scopes": [
  844. // "https://www.googleapis.com/auth/manufacturercenter"
  845. // ]
  846. // }
  847. }
  848. // method id "manufacturers.accounts.products.get":
  849. type AccountsProductsGetCall struct {
  850. s *Service
  851. parent string
  852. name string
  853. urlParams_ gensupport.URLParams
  854. ifNoneMatch_ string
  855. ctx_ context.Context
  856. header_ http.Header
  857. }
  858. // Get: Gets the product from a Manufacturer Center account, including
  859. // product
  860. // issues.
  861. //
  862. // A recently updated product takes around 15 minutes to process.
  863. // Changes are
  864. // only visible after it has been processed. While some issues may
  865. // be
  866. // available once the product has been processed, other issues may take
  867. // days
  868. // to appear.
  869. func (r *AccountsProductsService) Get(parent string, name string) *AccountsProductsGetCall {
  870. c := &AccountsProductsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  871. c.parent = parent
  872. c.name = name
  873. return c
  874. }
  875. // Include sets the optional parameter "include": The information to be
  876. // included in the response. Only sections listed here
  877. // will be returned.
  878. //
  879. // If this parameter is not specified, ATTRIBUTES and ISSUES are
  880. // returned.
  881. // This behavior is temporary and will be removed once all clients are
  882. // ready
  883. // or at the latest end of July 2018. After that no sections will be
  884. // returned.
  885. //
  886. // Possible values:
  887. // "UNKNOWN"
  888. // "ATTRIBUTES"
  889. // "ISSUES"
  890. // "DESTINATION_STATUSES"
  891. func (c *AccountsProductsGetCall) Include(include ...string) *AccountsProductsGetCall {
  892. c.urlParams_.SetMulti("include", append([]string{}, include...))
  893. return c
  894. }
  895. // Fields allows partial responses to be retrieved. See
  896. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  897. // for more information.
  898. func (c *AccountsProductsGetCall) Fields(s ...googleapi.Field) *AccountsProductsGetCall {
  899. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  900. return c
  901. }
  902. // IfNoneMatch sets the optional parameter which makes the operation
  903. // fail if the object's ETag matches the given value. This is useful for
  904. // getting updates only after the object has changed since the last
  905. // request. Use googleapi.IsNotModified to check whether the response
  906. // error from Do is the result of In-None-Match.
  907. func (c *AccountsProductsGetCall) IfNoneMatch(entityTag string) *AccountsProductsGetCall {
  908. c.ifNoneMatch_ = entityTag
  909. return c
  910. }
  911. // Context sets the context to be used in this call's Do method. Any
  912. // pending HTTP request will be aborted if the provided context is
  913. // canceled.
  914. func (c *AccountsProductsGetCall) Context(ctx context.Context) *AccountsProductsGetCall {
  915. c.ctx_ = ctx
  916. return c
  917. }
  918. // Header returns an http.Header that can be modified by the caller to
  919. // add HTTP headers to the request.
  920. func (c *AccountsProductsGetCall) Header() http.Header {
  921. if c.header_ == nil {
  922. c.header_ = make(http.Header)
  923. }
  924. return c.header_
  925. }
  926. func (c *AccountsProductsGetCall) doRequest(alt string) (*http.Response, error) {
  927. reqHeaders := make(http.Header)
  928. for k, v := range c.header_ {
  929. reqHeaders[k] = v
  930. }
  931. reqHeaders.Set("User-Agent", c.s.userAgent())
  932. if c.ifNoneMatch_ != "" {
  933. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  934. }
  935. var body io.Reader = nil
  936. c.urlParams_.Set("alt", alt)
  937. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/products/{+name}")
  938. urls += "?" + c.urlParams_.Encode()
  939. req, _ := http.NewRequest("GET", urls, body)
  940. req.Header = reqHeaders
  941. googleapi.Expand(req.URL, map[string]string{
  942. "parent": c.parent,
  943. "name": c.name,
  944. })
  945. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  946. }
  947. // Do executes the "manufacturers.accounts.products.get" call.
  948. // Exactly one of *Product or error will be non-nil. Any non-2xx status
  949. // code is an error. Response headers are in either
  950. // *Product.ServerResponse.Header or (if a response was returned at all)
  951. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  952. // check whether the returned error was because http.StatusNotModified
  953. // was returned.
  954. func (c *AccountsProductsGetCall) Do(opts ...googleapi.CallOption) (*Product, error) {
  955. gensupport.SetOptions(c.urlParams_, opts...)
  956. res, err := c.doRequest("json")
  957. if res != nil && res.StatusCode == http.StatusNotModified {
  958. if res.Body != nil {
  959. res.Body.Close()
  960. }
  961. return nil, &googleapi.Error{
  962. Code: res.StatusCode,
  963. Header: res.Header,
  964. }
  965. }
  966. if err != nil {
  967. return nil, err
  968. }
  969. defer googleapi.CloseBody(res)
  970. if err := googleapi.CheckResponse(res); err != nil {
  971. return nil, err
  972. }
  973. ret := &Product{
  974. ServerResponse: googleapi.ServerResponse{
  975. Header: res.Header,
  976. HTTPStatusCode: res.StatusCode,
  977. },
  978. }
  979. target := &ret
  980. if err := gensupport.DecodeResponse(target, res); err != nil {
  981. return nil, err
  982. }
  983. return ret, nil
  984. // {
  985. // "description": "Gets the product from a Manufacturer Center account, including product\nissues.\n\nA recently updated product takes around 15 minutes to process. Changes are\nonly visible after it has been processed. While some issues may be\navailable once the product has been processed, other issues may take days\nto appear.",
  986. // "flatPath": "v1/accounts/{accountsId}/products/{productsId}",
  987. // "httpMethod": "GET",
  988. // "id": "manufacturers.accounts.products.get",
  989. // "parameterOrder": [
  990. // "parent",
  991. // "name"
  992. // ],
  993. // "parameters": {
  994. // "include": {
  995. // "description": "The information to be included in the response. Only sections listed here\nwill be returned.\n\nIf this parameter is not specified, ATTRIBUTES and ISSUES are returned.\nThis behavior is temporary and will be removed once all clients are ready\nor at the latest end of July 2018. After that no sections will be returned.",
  996. // "enum": [
  997. // "UNKNOWN",
  998. // "ATTRIBUTES",
  999. // "ISSUES",
  1000. // "DESTINATION_STATUSES"
  1001. // ],
  1002. // "location": "query",
  1003. // "repeated": true,
  1004. // "type": "string"
  1005. // },
  1006. // "name": {
  1007. // "description": "Name in the format `{target_country}:{content_language}:{product_id}`.\n\n`target_country` - The target country of the product as a CLDR territory\n code (for example, US).\n\n`content_language` - The content language of the product as a two-letter\n ISO 639-1 language code (for example, en).\n\n`product_id` - The ID of the product. For more information, see\n https://support.google.com/manufacturers/answer/6124116#id.",
  1008. // "location": "path",
  1009. // "pattern": "^[^/]+$",
  1010. // "required": true,
  1011. // "type": "string"
  1012. // },
  1013. // "parent": {
  1014. // "description": "Parent ID in the format `accounts/{account_id}`.\n\n`account_id` - The ID of the Manufacturer Center account.",
  1015. // "location": "path",
  1016. // "pattern": "^accounts/[^/]+$",
  1017. // "required": true,
  1018. // "type": "string"
  1019. // }
  1020. // },
  1021. // "path": "v1/{+parent}/products/{+name}",
  1022. // "response": {
  1023. // "$ref": "Product"
  1024. // },
  1025. // "scopes": [
  1026. // "https://www.googleapis.com/auth/manufacturercenter"
  1027. // ]
  1028. // }
  1029. }
  1030. // method id "manufacturers.accounts.products.list":
  1031. type AccountsProductsListCall struct {
  1032. s *Service
  1033. parent string
  1034. urlParams_ gensupport.URLParams
  1035. ifNoneMatch_ string
  1036. ctx_ context.Context
  1037. header_ http.Header
  1038. }
  1039. // List: Lists all the products in a Manufacturer Center account.
  1040. func (r *AccountsProductsService) List(parent string) *AccountsProductsListCall {
  1041. c := &AccountsProductsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1042. c.parent = parent
  1043. return c
  1044. }
  1045. // Include sets the optional parameter "include": The information to be
  1046. // included in the response. Only sections listed here
  1047. // will be returned.
  1048. //
  1049. // If this parameter is not specified, ATTRIBUTES and ISSUES are
  1050. // returned.
  1051. // This behavior is temporary and will be removed once all clients are
  1052. // ready
  1053. // or at the latest end of July 2018. After that no sections will be
  1054. // returned.
  1055. //
  1056. // Possible values:
  1057. // "UNKNOWN"
  1058. // "ATTRIBUTES"
  1059. // "ISSUES"
  1060. // "DESTINATION_STATUSES"
  1061. func (c *AccountsProductsListCall) Include(include ...string) *AccountsProductsListCall {
  1062. c.urlParams_.SetMulti("include", append([]string{}, include...))
  1063. return c
  1064. }
  1065. // PageSize sets the optional parameter "pageSize": Maximum number of
  1066. // product statuses to return in the response, used for
  1067. // paging.
  1068. func (c *AccountsProductsListCall) PageSize(pageSize int64) *AccountsProductsListCall {
  1069. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1070. return c
  1071. }
  1072. // PageToken sets the optional parameter "pageToken": The token returned
  1073. // by the previous request.
  1074. func (c *AccountsProductsListCall) PageToken(pageToken string) *AccountsProductsListCall {
  1075. c.urlParams_.Set("pageToken", pageToken)
  1076. return c
  1077. }
  1078. // Fields allows partial responses to be retrieved. See
  1079. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1080. // for more information.
  1081. func (c *AccountsProductsListCall) Fields(s ...googleapi.Field) *AccountsProductsListCall {
  1082. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1083. return c
  1084. }
  1085. // IfNoneMatch sets the optional parameter which makes the operation
  1086. // fail if the object's ETag matches the given value. This is useful for
  1087. // getting updates only after the object has changed since the last
  1088. // request. Use googleapi.IsNotModified to check whether the response
  1089. // error from Do is the result of In-None-Match.
  1090. func (c *AccountsProductsListCall) IfNoneMatch(entityTag string) *AccountsProductsListCall {
  1091. c.ifNoneMatch_ = entityTag
  1092. return c
  1093. }
  1094. // Context sets the context to be used in this call's Do method. Any
  1095. // pending HTTP request will be aborted if the provided context is
  1096. // canceled.
  1097. func (c *AccountsProductsListCall) Context(ctx context.Context) *AccountsProductsListCall {
  1098. c.ctx_ = ctx
  1099. return c
  1100. }
  1101. // Header returns an http.Header that can be modified by the caller to
  1102. // add HTTP headers to the request.
  1103. func (c *AccountsProductsListCall) Header() http.Header {
  1104. if c.header_ == nil {
  1105. c.header_ = make(http.Header)
  1106. }
  1107. return c.header_
  1108. }
  1109. func (c *AccountsProductsListCall) doRequest(alt string) (*http.Response, error) {
  1110. reqHeaders := make(http.Header)
  1111. for k, v := range c.header_ {
  1112. reqHeaders[k] = v
  1113. }
  1114. reqHeaders.Set("User-Agent", c.s.userAgent())
  1115. if c.ifNoneMatch_ != "" {
  1116. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1117. }
  1118. var body io.Reader = nil
  1119. c.urlParams_.Set("alt", alt)
  1120. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/products")
  1121. urls += "?" + c.urlParams_.Encode()
  1122. req, _ := http.NewRequest("GET", urls, body)
  1123. req.Header = reqHeaders
  1124. googleapi.Expand(req.URL, map[string]string{
  1125. "parent": c.parent,
  1126. })
  1127. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1128. }
  1129. // Do executes the "manufacturers.accounts.products.list" call.
  1130. // Exactly one of *ListProductsResponse or error will be non-nil. Any
  1131. // non-2xx status code is an error. Response headers are in either
  1132. // *ListProductsResponse.ServerResponse.Header or (if a response was
  1133. // returned at all) in error.(*googleapi.Error).Header. Use
  1134. // googleapi.IsNotModified to check whether the returned error was
  1135. // because http.StatusNotModified was returned.
  1136. func (c *AccountsProductsListCall) Do(opts ...googleapi.CallOption) (*ListProductsResponse, error) {
  1137. gensupport.SetOptions(c.urlParams_, opts...)
  1138. res, err := c.doRequest("json")
  1139. if res != nil && res.StatusCode == http.StatusNotModified {
  1140. if res.Body != nil {
  1141. res.Body.Close()
  1142. }
  1143. return nil, &googleapi.Error{
  1144. Code: res.StatusCode,
  1145. Header: res.Header,
  1146. }
  1147. }
  1148. if err != nil {
  1149. return nil, err
  1150. }
  1151. defer googleapi.CloseBody(res)
  1152. if err := googleapi.CheckResponse(res); err != nil {
  1153. return nil, err
  1154. }
  1155. ret := &ListProductsResponse{
  1156. ServerResponse: googleapi.ServerResponse{
  1157. Header: res.Header,
  1158. HTTPStatusCode: res.StatusCode,
  1159. },
  1160. }
  1161. target := &ret
  1162. if err := gensupport.DecodeResponse(target, res); err != nil {
  1163. return nil, err
  1164. }
  1165. return ret, nil
  1166. // {
  1167. // "description": "Lists all the products in a Manufacturer Center account.",
  1168. // "flatPath": "v1/accounts/{accountsId}/products",
  1169. // "httpMethod": "GET",
  1170. // "id": "manufacturers.accounts.products.list",
  1171. // "parameterOrder": [
  1172. // "parent"
  1173. // ],
  1174. // "parameters": {
  1175. // "include": {
  1176. // "description": "The information to be included in the response. Only sections listed here\nwill be returned.\n\nIf this parameter is not specified, ATTRIBUTES and ISSUES are returned.\nThis behavior is temporary and will be removed once all clients are ready\nor at the latest end of July 2018. After that no sections will be returned.",
  1177. // "enum": [
  1178. // "UNKNOWN",
  1179. // "ATTRIBUTES",
  1180. // "ISSUES",
  1181. // "DESTINATION_STATUSES"
  1182. // ],
  1183. // "location": "query",
  1184. // "repeated": true,
  1185. // "type": "string"
  1186. // },
  1187. // "pageSize": {
  1188. // "description": "Maximum number of product statuses to return in the response, used for\npaging.",
  1189. // "format": "int32",
  1190. // "location": "query",
  1191. // "type": "integer"
  1192. // },
  1193. // "pageToken": {
  1194. // "description": "The token returned by the previous request.",
  1195. // "location": "query",
  1196. // "type": "string"
  1197. // },
  1198. // "parent": {
  1199. // "description": "Parent ID in the format `accounts/{account_id}`.\n\n`account_id` - The ID of the Manufacturer Center account.",
  1200. // "location": "path",
  1201. // "pattern": "^accounts/[^/]+$",
  1202. // "required": true,
  1203. // "type": "string"
  1204. // }
  1205. // },
  1206. // "path": "v1/{+parent}/products",
  1207. // "response": {
  1208. // "$ref": "ListProductsResponse"
  1209. // },
  1210. // "scopes": [
  1211. // "https://www.googleapis.com/auth/manufacturercenter"
  1212. // ]
  1213. // }
  1214. }
  1215. // Pages invokes f for each page of results.
  1216. // A non-nil error returned from f will halt the iteration.
  1217. // The provided context supersedes any context provided to the Context method.
  1218. func (c *AccountsProductsListCall) Pages(ctx context.Context, f func(*ListProductsResponse) error) error {
  1219. c.ctx_ = ctx
  1220. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1221. for {
  1222. x, err := c.Do()
  1223. if err != nil {
  1224. return err
  1225. }
  1226. if err := f(x); err != nil {
  1227. return err
  1228. }
  1229. if x.NextPageToken == "" {
  1230. return nil
  1231. }
  1232. c.PageToken(x.NextPageToken)
  1233. }
  1234. }
  1235. // method id "manufacturers.accounts.products.update":
  1236. type AccountsProductsUpdateCall struct {
  1237. s *Service
  1238. parent string
  1239. name string
  1240. attributes *Attributes
  1241. urlParams_ gensupport.URLParams
  1242. ctx_ context.Context
  1243. header_ http.Header
  1244. }
  1245. // Update: Inserts or updates the attributes of the product in a
  1246. // Manufacturer Center
  1247. // account.
  1248. //
  1249. // Creates a product with the provided attributes. If the product
  1250. // already
  1251. // exists, then all attributes are replaced with the new ones. The
  1252. // checks at
  1253. // upload time are minimal. All required attributes need to be present
  1254. // for a
  1255. // product to be valid. Issues may show up later after the API has
  1256. // accepted a
  1257. // new upload for a product and it is possible to overwrite an existing
  1258. // valid
  1259. // product with an invalid product. To detect this, you should retrieve
  1260. // the
  1261. // product and check it for issues once the new version is
  1262. // available.
  1263. //
  1264. // Uploaded attributes first need to be processed before they can
  1265. // be
  1266. // retrieved. Until then, new products will be unavailable, and
  1267. // retrieval
  1268. // of previously uploaded products will return the original state of
  1269. // the
  1270. // product.
  1271. func (r *AccountsProductsService) Update(parent string, name string, attributes *Attributes) *AccountsProductsUpdateCall {
  1272. c := &AccountsProductsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1273. c.parent = parent
  1274. c.name = name
  1275. c.attributes = attributes
  1276. return c
  1277. }
  1278. // Fields allows partial responses to be retrieved. See
  1279. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1280. // for more information.
  1281. func (c *AccountsProductsUpdateCall) Fields(s ...googleapi.Field) *AccountsProductsUpdateCall {
  1282. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1283. return c
  1284. }
  1285. // Context sets the context to be used in this call's Do method. Any
  1286. // pending HTTP request will be aborted if the provided context is
  1287. // canceled.
  1288. func (c *AccountsProductsUpdateCall) Context(ctx context.Context) *AccountsProductsUpdateCall {
  1289. c.ctx_ = ctx
  1290. return c
  1291. }
  1292. // Header returns an http.Header that can be modified by the caller to
  1293. // add HTTP headers to the request.
  1294. func (c *AccountsProductsUpdateCall) Header() http.Header {
  1295. if c.header_ == nil {
  1296. c.header_ = make(http.Header)
  1297. }
  1298. return c.header_
  1299. }
  1300. func (c *AccountsProductsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1301. reqHeaders := make(http.Header)
  1302. for k, v := range c.header_ {
  1303. reqHeaders[k] = v
  1304. }
  1305. reqHeaders.Set("User-Agent", c.s.userAgent())
  1306. var body io.Reader = nil
  1307. body, err := googleapi.WithoutDataWrapper.JSONReader(c.attributes)
  1308. if err != nil {
  1309. return nil, err
  1310. }
  1311. reqHeaders.Set("Content-Type", "application/json")
  1312. c.urlParams_.Set("alt", alt)
  1313. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/products/{+name}")
  1314. urls += "?" + c.urlParams_.Encode()
  1315. req, _ := http.NewRequest("PUT", urls, body)
  1316. req.Header = reqHeaders
  1317. googleapi.Expand(req.URL, map[string]string{
  1318. "parent": c.parent,
  1319. "name": c.name,
  1320. })
  1321. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1322. }
  1323. // Do executes the "manufacturers.accounts.products.update" call.
  1324. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1325. // code is an error. Response headers are in either
  1326. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1327. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1328. // check whether the returned error was because http.StatusNotModified
  1329. // was returned.
  1330. func (c *AccountsProductsUpdateCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1331. gensupport.SetOptions(c.urlParams_, opts...)
  1332. res, err := c.doRequest("json")
  1333. if res != nil && res.StatusCode == http.StatusNotModified {
  1334. if res.Body != nil {
  1335. res.Body.Close()
  1336. }
  1337. return nil, &googleapi.Error{
  1338. Code: res.StatusCode,
  1339. Header: res.Header,
  1340. }
  1341. }
  1342. if err != nil {
  1343. return nil, err
  1344. }
  1345. defer googleapi.CloseBody(res)
  1346. if err := googleapi.CheckResponse(res); err != nil {
  1347. return nil, err
  1348. }
  1349. ret := &Empty{
  1350. ServerResponse: googleapi.ServerResponse{
  1351. Header: res.Header,
  1352. HTTPStatusCode: res.StatusCode,
  1353. },
  1354. }
  1355. target := &ret
  1356. if err := gensupport.DecodeResponse(target, res); err != nil {
  1357. return nil, err
  1358. }
  1359. return ret, nil
  1360. // {
  1361. // "description": "Inserts or updates the attributes of the product in a Manufacturer Center\naccount.\n\nCreates a product with the provided attributes. If the product already\nexists, then all attributes are replaced with the new ones. The checks at\nupload time are minimal. All required attributes need to be present for a\nproduct to be valid. Issues may show up later after the API has accepted a\nnew upload for a product and it is possible to overwrite an existing valid\nproduct with an invalid product. To detect this, you should retrieve the\nproduct and check it for issues once the new version is available.\n\nUploaded attributes first need to be processed before they can be\nretrieved. Until then, new products will be unavailable, and retrieval\nof previously uploaded products will return the original state of the\nproduct.",
  1362. // "flatPath": "v1/accounts/{accountsId}/products/{productsId}",
  1363. // "httpMethod": "PUT",
  1364. // "id": "manufacturers.accounts.products.update",
  1365. // "parameterOrder": [
  1366. // "parent",
  1367. // "name"
  1368. // ],
  1369. // "parameters": {
  1370. // "name": {
  1371. // "description": "Name in the format `{target_country}:{content_language}:{product_id}`.\n\n`target_country` - The target country of the product as a CLDR territory\n code (for example, US).\n\n`content_language` - The content language of the product as a two-letter\n ISO 639-1 language code (for example, en).\n\n`product_id` - The ID of the product. For more information, see\n https://support.google.com/manufacturers/answer/6124116#id.",
  1372. // "location": "path",
  1373. // "pattern": "^[^/]+$",
  1374. // "required": true,
  1375. // "type": "string"
  1376. // },
  1377. // "parent": {
  1378. // "description": "Parent ID in the format `accounts/{account_id}`.\n\n`account_id` - The ID of the Manufacturer Center account.",
  1379. // "location": "path",
  1380. // "pattern": "^accounts/[^/]+$",
  1381. // "required": true,
  1382. // "type": "string"
  1383. // }
  1384. // },
  1385. // "path": "v1/{+parent}/products/{+name}",
  1386. // "request": {
  1387. // "$ref": "Attributes"
  1388. // },
  1389. // "response": {
  1390. // "$ref": "Empty"
  1391. // },
  1392. // "scopes": [
  1393. // "https://www.googleapis.com/auth/manufacturercenter"
  1394. // ]
  1395. // }
  1396. }