Functions for making requests against a shop's authenticated API.
Functions for making requests against a shop's authenticated API.
Takes a keyword resource-type
and a map of attrs
, and returns a partial request map for creating a resource member.
Takes a keyword `resource-type` and a map of `attrs`, and returns a partial request map for creating a resource member.
Returns a partial request map to delete a resource member.
Returns a partial request map to delete a resource member.
(extract-kicker-args args)
Used by the kicker functions to parse argument lists. The most verbose form takes a resource type keyword, a map of either params or attributes, and a map of request options:
(def auth {:shop "foo.myshopify.com"
:access-token "70bc2f19efa5129f202e661ac6fd38f3"})
(get-list :products {:limit 2} auth)
If you only provide one map, it's assumed to be the params/attributes, so you'll need to provide authentication with with-opts
:
(with-opts auth
(get-list :products {:limit 2}))
If you don't give a keyword as the first argument, the function will look for the resource type under a :shopify.resources/type
key in the params/attributes map. This key is present in all resource attribute maps returned by the library, so you can chain together reading and writing operations conveniently like so:
(with-opts auth
(-> (get-one :page {:id 99})
(update-in [:title]
clojure.string/upper-case)
(update-in [:body-html]
#(clojure.string/replace % "." "!"))
save!))
Used by the kicker functions to parse argument lists. The most verbose form takes a resource type keyword, a map of either params or attributes, and a map of request options: (def auth {:shop "foo.myshopify.com" :access-token "70bc2f19efa5129f202e661ac6fd38f3"}) (get-list :products {:limit 2} auth) If you only provide one map, it's assumed to be the params/attributes, so you'll need to provide authentication with `with-opts`: (with-opts auth (get-list :products {:limit 2})) If you don't give a keyword as the first argument, the function will look for the resource type under a `:shopify.resources/type` key in the params/attributes map. This key is present in all resource attribute maps returned by the library, so you can chain together reading and writing operations conveniently like so: (with-opts auth (-> (get-one :page {:id 99}) (update-in [:title] clojure.string/upper-case) (update-in [:body-html] #(clojure.string/replace % "." "!")) save!))
(get-all & args)
Eagerly gets all the resources described by the arguments in parallel. Returns a sequence which is a lazy concatenation of all pages.
Eagerly gets _all_ the resources described by the arguments in parallel. Returns a sequence which is a lazy concatenation of all pages.
(get-count-request resource-type params)
Returns a partial request map to get the count of the given resource/params.
Returns a partial request map to get the count of the given resource/params.
Returns a partial request map to get a collection of the given resource type with the given params.
Returns a partial request map to get a collection of the given resource type with the given params.
Returns a partial request map to get a member of the given resource with the given attributes.
Returns a partial request map to get a member of the given resource with the given attributes.
(get-shop & [request-opts])
A convenience function to get the singleton shop resource.
A convenience function to get the singleton shop resource.
Returns true if the given attributes appear to refer to a member which already exists on the server.
Returns true if the given attributes appear to refer to a member which already exists on the server.
Delegates to create-request
if the attributes are new, or update-request
if they're persisted.
Delegates to `create-request` if the attributes are new, or `update-request` if they're persisted.
Returns a partial request map to update a member of the given resource with the given attributes.
Returns a partial request map to update a member of the given resource with the given attributes.
(with-opts opts & exprs)
A convenience macro to define the same base request options for any request to the Shopify API. opts
would most often be an auth map, but it could include any default options for the request.
A convenience macro to define the same base request options for any request to the Shopify API. `opts` would most often be an auth map, but it could include any default options for the request.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close