-
Notifications
You must be signed in to change notification settings - Fork 4
/
regionalinventory.clj
83 lines (71 loc) · 2.51 KB
/
regionalinventory.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
(ns happygapi.content.regionalinventory
"Content API for Shopping: regionalinventory.
Manages product items, inventory, and Merchant Center accounts for Google Shopping.
See: https://developers.google.com/shopping-contentapi/reference/rest/v2.1/regionalinventory"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn custombatch$
"https://developers.google.com/shopping-contentapi/reference/rest/v2.1/regionalinventory/custombatch
Required parameters: none
Optional parameters: none
Body:
{:entries [{:batchId integer,
:merchantId string,
:method string,
:productId string,
:regionalInventory RegionalInventory}]}
Updates regional inventory for multiple products or regions in a single request."
{:scopes ["https://www.googleapis.com/auth/content"]}
[auth args body]
{:pre [(util/has-keys? args #{})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/content/v2.1/"
"regionalinventory/batch"
#{}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn insert$
"https://developers.google.com/shopping-contentapi/reference/rest/v2.1/regionalinventory/insert
Required parameters: merchantId, productId
Optional parameters: none
Body:
{:availability string,
:customAttributes [{:groupValues [CustomAttribute],
:name string,
:value string}],
:kind string,
:price {:currency string, :value string},
:regionId string,
:salePrice {:currency string, :value string},
:salePriceEffectiveDate string}
Update the regional inventory of a product in your Merchant Center account. If a regional inventory with the same region ID already exists, this method updates that entry."
{:scopes ["https://www.googleapis.com/auth/content"]}
[auth args body]
{:pre [(util/has-keys? args #{:productId :merchantId})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/content/v2.1/"
"{merchantId}/products/{productId}/regionalinventory"
#{:productId :merchantId}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))