Skip to content

Commit 304d47d

Browse files
committed
shopify has slowly been deprecating the rest api, lets move it to its own repo
1 parent 285dcc2 commit 304d47d

55 files changed

Lines changed: 27 additions & 4077 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Unreleased
22

3+
- BREAKING: Moving REST client to its own repo. Check the new REST entry in the [README](./#REST)
4+
If the REST client is used you must include the new REST client repo:
5+
`{:shopify_api_rest, github: "orbit-apps/elixir-shopifyapi-rest", tag: "v0.1.0"}`
36
- BREAKING: AppServer now defaults to a single app instance, this is a compile env if you want to use the old multi app config add `config :shopify_api, :app_server, :multi_app` to your `config/config.exs`
47
- New: Single app mode for AppServer, is API compatible with the multi app setup. This greatly simplifies the most common setup, one app <> one phoenix setup.
58
- New: Add handle and raw app config to the App struct

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [AuthTokens](#AuthTokens)
1414
- [Webhooks](#Webhooks)
1515
- [GraphQL](#GraphQL)
16+
- [REST](#REST)
1617
- [Telemetry](#Telemetry)
1718

1819
## Installation
@@ -223,6 +224,17 @@ config :shopify_api, ShopifyAPI.GraphQL, graphql_version: "2024-10"
223224

224225
We are soft deprecating the old `ShopifyAPI.graphql_request/4`. It will not be marked as deprecated until people have had a chance to move over to the new method. The reasons for the move include 1) moving away from HTTPoison and towards Req. 2) Better handling of partial failures. 3) Overall cleaner implementations and more access to proper errors.
225226

227+
## REST
228+
229+
The REST client has been moved to its [own repo](https://github.com/orbit-apps/elixir-shopifyapi-rest)
230+
231+
Using:
232+
233+
- include the new dependency `{:shopify_api, github: "pixelunion/elixir-shopifyapi-rest", tag: "v0.1.0"}`
234+
- make clean and compile `mix clean && mix compile`, as there is an optional endpoint `ShopifyAPI.request/2`
235+
that is not compiled in unless the REST client is included.
236+
- make a REST call `iex> ShopifyAPI.REST.Product.all(token)`
237+
226238
## Telemetry
227239

228240
The `shopify_api` library will emit events using the [`:telemetry`](https://github.com/beam-telemetry/telemetry) library. Consumers of `shopify_api` can then use these events for customized metrics aggregation and more.

lib/shopify_api.ex

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
defmodule ShopifyAPI do
22
alias ShopifyAPI.GraphQL.GraphQLQuery
33
alias ShopifyAPI.GraphQL.GraphQLResponse
4-
alias ShopifyAPI.RateLimiting
54
alias ShopifyAPI.Throttled
65

76
@shopify_admin_uri URI.new!("https://admin.shopify.com")
@@ -40,7 +39,11 @@ defmodule ShopifyAPI do
4039
def execute_graphql(%GraphQLQuery{} = query, scope, opts \\ []),
4140
do: ShopifyAPI.GraphQL.execute(query, scope, opts)
4241

43-
def request(token, func), do: Throttled.request(func, token, RateLimiting.RESTTracker)
42+
43+
if function_exported?(ShopifyAPI.RateLiting.RESTTracker, :init, 0) do
44+
def request(token, func),
45+
do: ShopifyAPIThrottled.request(func, token, ShopifyAPI.RateLimiting.RESTTracker)
46+
end
4447

4548
@doc false
4649
# Accessor for API transport layer, defaults to `https://`.

lib/shopify_api/application.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ defmodule ShopifyAPI.Application do
66
# See https://hexdocs.pm/elixir/Application.html
77
# for more information on OTP Applications
88
def start(_type, _args) do
9-
RateLimiting.RESTTracker.init()
109
RateLimiting.GraphQLTracker.init()
1110

1211
# Define workers and child supervisors to be supervised

lib/shopify_api/rate_limiting/rest.ex

Lines changed: 0 additions & 16 deletions
This file was deleted.

lib/shopify_api/rate_limiting/rest_call_limits.ex

Lines changed: 0 additions & 57 deletions
This file was deleted.

lib/shopify_api/rate_limiting/rest_tracker.ex

Lines changed: 0 additions & 70 deletions
This file was deleted.

lib/shopify_api/rest.ex

Lines changed: 0 additions & 90 deletions
This file was deleted.

lib/shopify_api/rest/access_scope.ex

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)