View Source Circlex.Api.Subscriptions (Circlex v0.1.6)

API Client to the Subscriptions API.

Reference: https://developers.circle.com/reference/listsubscriptions

Link to this section Summary

Functions

Retrieve a list of existing notification subscriptions with details.

Subscribe to receiving notifications at a given endpoint.

To remove a subscription, all its subscription requests' statuses must be either 'confirmed', 'deleted' or a combination of those.

Link to this section Functions

Link to this function

list_subscriptions(opts \\ [])

View Source

Retrieve a list of existing notification subscriptions with details.

Reference: https://developers.circle.com/reference/listsubscriptions

examples

Examples

iex> host = Circlex.Test.start_server()
iex> Circlex.Api.Subscriptions.list_subscriptions(host: host)
{
  :ok,
  [
    %Circlex.Struct.Subscription{
      endpoint:
        "https://us-west1-treasury-stage.cloudfunctions.net/treasury-circle-sns-subscriber-function-443f885",
      id: "8e25e48a-8c84-4186-988c-4055bda7807a",
      subscription_details: [
        %{
          "status" => "confirmed",
          "url" =>
            "arn:aws:sns:us-east-1:908968368384:sandbox_platform-notifications-topic:3c849cdd-af12-4c28-a4fe-d0d037079cc0"
        },
        %{
          "status" => "confirmed",
          "url" =>
            "arn:aws:sns:us-west-2:908968368384:sandbox_platform-notifications-topic:48a51c19-6549-4b9c-be4a-926f77bb95a0"
        }
      ]
    }
  ]
}
Link to this function

subscribe(endpoint, opts \\ [])

View Source

Subscribe to receiving notifications at a given endpoint.

Reference: https://developers.circle.com/reference/subscribe

examples

Examples

iex> host = Circlex.Test.start_server()
iex> Circlex.Api.Subscriptions.subscribe("https://example.com", host: host)
{:ok,
 %Circlex.Struct.Subscription{
   endpoint: "https://example.com",
   id: "a033a6d8-05ae-11ed-9e62-6a1733211c00",
   subscription_details: []
 }}
Link to this function

unsubscribe(id, opts \\ [])

View Source

To remove a subscription, all its subscription requests' statuses must be either 'confirmed', 'deleted' or a combination of those.

Reference: https://developers.circle.com/reference/unsubscribe

examples

Examples

iex> host = Circlex.Test.start_server()
iex> Circlex.Api.Subscriptions.unsubscribe("8e25e48a-8c84-4186-988c-4055bda7807a", host: host)
{:ok, %{}}