Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Unreleased

- BREAKING: Moving REST client to its own repo. Check the new REST entry in the [README](./#REST)
If the REST client is used you must include the new REST client repo:
`{:shopify_api_rest, github: "orbit-apps/elixir-shopifyapi-rest", tag: "v0.1.0"}`
- 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`
- 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.
- New: Add handle and raw app config to the App struct
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [AuthTokens](#AuthTokens)
- [Webhooks](#Webhooks)
- [GraphQL](#GraphQL)
- [REST](#REST)
- [Telemetry](#Telemetry)

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

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.

## REST

The REST client has been moved to its [own repo](https://github.com/orbit-apps/elixir-shopifyapi-rest)

Using:

- include the new dependency `{:shopify_api, github: "pixelunion/elixir-shopifyapi-rest", tag: "v0.1.0"}`
- make clean and compile `mix clean && mix compile`, as there is an optional endpoint `ShopifyAPI.request/2`
that is not compiled in unless the REST client is included.
- make a REST call `iex> ShopifyAPI.REST.Product.all(token)`

## Telemetry

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.
Expand Down
6 changes: 4 additions & 2 deletions lib/shopify_api.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
defmodule ShopifyAPI do
alias ShopifyAPI.GraphQL.GraphQLQuery
alias ShopifyAPI.GraphQL.GraphQLResponse
alias ShopifyAPI.RateLimiting
alias ShopifyAPI.Throttled

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

def request(token, func), do: Throttled.request(func, token, RateLimiting.RESTTracker)
if function_exported?(ShopifyAPI.RateLiting.RESTTracker, :init, 0) do
def request(token, func),
do: ShopifyAPIThrottled.request(func, token, ShopifyAPI.RateLimiting.RESTTracker)
end

@doc false
# Accessor for API transport layer, defaults to `https://`.
Expand Down
1 change: 0 additions & 1 deletion lib/shopify_api/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ defmodule ShopifyAPI.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
RateLimiting.RESTTracker.init()
RateLimiting.GraphQLTracker.init()

# Define workers and child supervisors to be supervised
Expand Down
16 changes: 0 additions & 16 deletions lib/shopify_api/rate_limiting/rest.ex

This file was deleted.

57 changes: 0 additions & 57 deletions lib/shopify_api/rate_limiting/rest_call_limits.ex

This file was deleted.

70 changes: 0 additions & 70 deletions lib/shopify_api/rate_limiting/rest_tracker.ex

This file was deleted.

90 changes: 0 additions & 90 deletions lib/shopify_api/rest.ex

This file was deleted.

25 changes: 0 additions & 25 deletions lib/shopify_api/rest/access_scope.ex

This file was deleted.

Loading
Loading