Class: Peddler::APIs::NotificationsV1

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/notifications_v1.rb,
lib/peddler/apis/notifications_v1/error.rb,
lib/peddler/apis/notifications_v1/error_list.rb,
lib/peddler/apis/notifications_v1/destination.rb,
lib/peddler/apis/notifications_v1/event_filter.rb,
lib/peddler/apis/notifications_v1/sqs_resource.rb,
lib/peddler/apis/notifications_v1/subscription.rb,
lib/peddler/apis/notifications_v1/subscriptions.rb,
lib/peddler/apis/notifications_v1/marketplace_ids.rb,
lib/peddler/apis/notifications_v1/tracking_filter.rb,
lib/peddler/apis/notifications_v1/destination_list.rb,
lib/peddler/apis/notifications_v1/test_notification.rb,
lib/peddler/apis/notifications_v1/aggregation_filter.rb,
lib/peddler/apis/notifications_v1/marketplace_filter.rb,
lib/peddler/apis/notifications_v1/order_change_types.rb,
lib/peddler/apis/notifications_v1/tracking_identifier.rb,
lib/peddler/apis/notifications_v1/aggregation_settings.rb,
lib/peddler/apis/notifications_v1/destination_resource.rb,
lib/peddler/apis/notifications_v1/processing_directive.rb,
lib/peddler/apis/notifications_v1/event_bridge_resource.rb,
lib/peddler/apis/notifications_v1/get_destination_response.rb,
lib/peddler/apis/notifications_v1/order_change_type_filter.rb,
lib/peddler/apis/notifications_v1/get_destinations_response.rb,
lib/peddler/apis/notifications_v1/get_subscription_response.rb,
lib/peddler/apis/notifications_v1/get_subscriptions_payload.rb,
lib/peddler/apis/notifications_v1/create_destination_request.rb,
lib/peddler/apis/notifications_v1/get_subscriptions_response.rb,
lib/peddler/apis/notifications_v1/create_destination_response.rb,
lib/peddler/apis/notifications_v1/create_subscription_request.rb,
lib/peddler/apis/notifications_v1/delete_destination_response.rb,
lib/peddler/apis/notifications_v1/create_subscription_response.rb,
lib/peddler/apis/notifications_v1/send_test_notification_request.rb,
lib/peddler/apis/notifications_v1/get_subscription_by_id_response.rb,
lib/peddler/apis/notifications_v1/send_test_notification_response.rb,
lib/peddler/apis/notifications_v1/delete_subscription_by_id_response.rb,
lib/peddler/apis/notifications_v1/destination_resource_specification.rb,
lib/peddler/apis/notifications_v1/event_bridge_resource_specification.rb,
sig/peddler/apis/notifications_v1.rbs

Overview

Selling Partner API for Notifications

The Selling Partner API for Notifications lets you subscribe to notifications that are relevant to a selling partner's business. Using this API you can create a destination to receive notifications, subscribe to notifications, delete notification subscriptions, and more.

For more information, refer to the Notifications Use Case Guide.

Defined Under Namespace

Classes: AggregationFilter, AggregationSettings, CreateDestinationRequest, CreateDestinationResponse, CreateSubscriptionRequest, CreateSubscriptionResponse, DeleteDestinationResponse, DeleteSubscriptionByIdResponse, Destination, DestinationList, DestinationResource, DestinationResourceSpecification, Error, ErrorList, EventBridgeResource, EventBridgeResourceSpecification, EventFilter, GetDestinationResponse, GetDestinationsResponse, GetSubscriptionByIdResponse, GetSubscriptionResponse, GetSubscriptionsPayload, GetSubscriptionsResponse, MarketplaceFilter, MarketplaceIds, OrderChangeTypeFilter, OrderChangeTypes, ProcessingDirective, SendTestNotificationRequest, SendTestNotificationResponse, SqsResource, Subscription, Subscriptions, TestNotification, TrackingFilter, TrackingIdentifier

Constant Summary

Constants inherited from Peddler::API

Peddler::API::TRANSIENT_STATUSES

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #base_url, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#cannot_sandbox!, #delete, #endpoint_uri, #get, #host_header, #http, #initialize, #must_sandbox!, #parse_base_url, #patch, #percent_encode, #post, #put, #request, #sandbox, #sandbox?, #stringify_array, #timestamp, #user_agent

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#create_destination(body, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Creates a destination resource to receive notifications. The createDestination operation is grantless. For more information, refer to Grantless Operations in the Selling Partner API Developer Guide.

Parameters:

  • body (Hash)

    The request schema for the createDestination operation.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (Hash[untyped, untyped])
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



168
169
170
171
172
# File 'lib/peddler/apis/notifications_v1.rb', line 168

def create_destination(body, rate_limit: 1.0)
  path = "/notifications/v1/destinations"
  parser = -> { CreateDestinationResponse }
  post(path, body:, rate_limit:, parser:)
end

#create_subscription(body, notification_type, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Creates a subscription for the specified notification type to be delivered to the specified destination. Before you can subscribe, you must first create the destination by calling the createDestination operation. If the notification type that you specify supports multiple payload versions, you can use this operation to subscribe to a different payload version if you already have an existing subscription for a different payload version.

Parameters:

  • body (Hash)

    The request schema for the createSubscription operation.

  • notification_type (String)

    The type of notification. For more information about notification types, refer to the Notifications API v1 Use Case Guide.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (Hash[untyped, untyped])
  • (String)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



84
85
86
87
88
# File 'lib/peddler/apis/notifications_v1.rb', line 84

def create_subscription(body, notification_type, rate_limit: 1.0)
  path = "/notifications/v1/subscriptions/#{percent_encode(notification_type)}"
  parser = -> { CreateSubscriptionResponse }
  post(path, body:, rate_limit:, parser:)
end

#delete_destination(destination_id, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Deletes the destination that you specify. The deleteDestination operation is grantless. For more information, refer to Grantless Operations in the Selling Partner API Developer Guide.

Parameters:

  • destination_id (String)

    The identifier for the destination that you want to delete.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (String)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



197
198
199
200
201
# File 'lib/peddler/apis/notifications_v1.rb', line 197

def delete_destination(destination_id, rate_limit: 1.0)
  path = "/notifications/v1/destinations/#{percent_encode(destination_id)}"
  parser = -> { DeleteDestinationResponse }
  delete(path, rate_limit:, parser:)
end

#delete_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Deletes the subscription indicated by the subscription identifier and notification type that you specify. The subscription identifier can be for any subscription associated with your application. After you successfully call this operation, notifications will stop being sent for the associated subscription. The deleteSubscriptionById operation is grantless. For more information, refer to Grantless Operations in the Selling Partner API Developer Guide.

Parameters:

  • subscription_id (String)

    The identifier for the subscription that you want to delete.

  • notification_type (String)

    The type of notification. For more information about notification types, refer to the Notifications API v1 Use Case Guide.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (String)
  • (String)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



122
123
124
125
126
# File 'lib/peddler/apis/notifications_v1.rb', line 122

def delete_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0)
  path = "/notifications/v1/subscriptions/#{percent_encode(notification_type)}/#{percent_encode(subscription_id)}"
  parser = -> { DeleteSubscriptionByIdResponse }
  delete(path, rate_limit:, parser:)
end

#get_destination(destination_id, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns information about the destination that you specify. The getDestination operation is grantless. For more information, refer to Grantless Operations in the Selling Partner API Developer Guide.

Parameters:

  • destination_id (String)

    The identifier generated when you created the destination.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (String)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



183
184
185
186
187
# File 'lib/peddler/apis/notifications_v1.rb', line 183

def get_destination(destination_id, rate_limit: 1.0)
  path = "/notifications/v1/destinations/#{percent_encode(destination_id)}"
  parser = -> { GetDestinationResponse }
  get(path, rate_limit:, parser:)
end

#get_destinations(rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns information about all destinations. The getDestinations operation is grantless. For more information, refer to Grantless Operations in the Selling Partner API Developer Guide.

Parameters:

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • rate_limit: (Float) (defaults to: 1.0)

Returns:



153
154
155
156
157
# File 'lib/peddler/apis/notifications_v1.rb', line 153

def get_destinations(rate_limit: 1.0)
  path = "/notifications/v1/destinations"
  parser = -> { GetDestinationsResponse }
  get(path, rate_limit:, parser:)
end

#get_subscription(notification_type, payload_version: nil, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns information about subscription of the specified notification type and payload version. payloadVersion is an optional parameter. When you do not provide payloadVersion, the operation returns the latest payload version subscription's information. You can use this API to get subscription information when you do not have a subscription identifier.

Parameters:

  • notification_type (String)

    The type of notification. For more information about notification types, refer to the Notifications API v1 Use Case Guide.

  • payload_version (String) (defaults to: nil)

    The version of the payload object to be used in the notification.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (String)
  • payload_version: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



63
64
65
66
67
68
69
70
# File 'lib/peddler/apis/notifications_v1.rb', line 63

def get_subscription(notification_type, payload_version: nil, rate_limit: 1.0)
  path = "/notifications/v1/subscriptions/#{percent_encode(notification_type)}"
  params = {
    "payloadVersion" => payload_version,
  }.compact
  parser = -> { GetSubscriptionResponse }
  get(path, params:, rate_limit:, parser:)
end

#get_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns information about a subscription for the specified notification type. The getSubscriptionById operation is grantless. For more information, refer to Grantless Operations in the Selling Partner API Developer Guide.

Parameters:

  • subscription_id (String)

    The identifier for the subscription that you want to get.

  • notification_type (String)

    The type of notification. For more information about notification types, refer to the Notifications API v1 Use Case Guide.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (String)
  • (String)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



102
103
104
105
106
# File 'lib/peddler/apis/notifications_v1.rb', line 102

def get_subscription_by_id(subscription_id, notification_type, rate_limit: 1.0)
  path = "/notifications/v1/subscriptions/#{percent_encode(notification_type)}/#{percent_encode(subscription_id)}"
  parser = -> { GetSubscriptionByIdResponse }
  get(path, rate_limit:, parser:)
end

#get_subscriptions(notification_types, payload_version: nil, page_size: 30, next_token: nil, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns information about subscriptions of the specified notification type. You can use this API to retrieve all subscriptions when multiple subscriptions exist for a notification type (for example, when using filter expressions).

The operation returns all subscriptions for the caller's party.

payloadVersion is an optional parameter. When you do not provide payloadVersion, the operation returns subscriptions across all payload versions.

Parameters:

  • notification_types (Array<String>)

    A list of notification types to retrieve subscriptions for. Currently limited to a single notification type per request. For more information about notification types, refer to the Notifications API v1 Use Case Guide.

  • payload_version (String) (defaults to: nil)

    The version of the payload object to be used in the notification.

  • page_size (Integer) (defaults to: 30)

    The maximum number of subscriptions to return per page. Minimum value is 30. Maximum value is 100. Default is 30.

  • next_token (String) (defaults to: nil)

    A token to retrieve the next page of results. If this field is not empty in a response, pass its value in the next request to retrieve the next page.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (Array[String])
  • payload_version: (String, nil) (defaults to: nil)
  • page_size: (Integer, nil) (defaults to: 30)
  • next_token: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/peddler/apis/notifications_v1.rb', line 39

def get_subscriptions(notification_types, payload_version: nil, page_size: 30, next_token: nil, rate_limit: 1.0)
  path = "/notifications/v1/subscriptions"
  params = {
    "notificationTypes" => stringify_array(notification_types),
    "payloadVersion" => payload_version,
    "pageSize" => page_size,
    "nextToken" => next_token,
  }.compact
  parser = -> { GetSubscriptionsResponse }
  get(path, params:, rate_limit:, parser:)
end

#send_test_notification(body, notification_type, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Sends a mock notification of the specified type to your SQS. The sendTestNotification API is grantless. For more information, see "Grantless operations" in the Selling Partner API Developer Guide.

Parameters:

  • body (Hash)

    The request schema for the sendTestNotification operation.

  • notification_type (String)

    The type of notification. For more information about notification types, refer to the Notifications API v1 Use Case Guide.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (Hash[untyped, untyped])
  • (String)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



138
139
140
141
142
143
144
# File 'lib/peddler/apis/notifications_v1.rb', line 138

def send_test_notification(body, notification_type, rate_limit: 1.0)
  must_sandbox!

  path = "/notifications/v1/subscriptions/#{percent_encode(notification_type)}/testNotification"
  parser = -> { SendTestNotificationResponse }
  post(path, body:, rate_limit:, parser:)
end