Class: Notiflows::Resources::Users::Deliveries

Inherits:
Object
  • Object
show all
Defined in:
lib/notiflows/resources/users/deliveries.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Deliveries

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Deliveries.

Parameters:



76
77
78
# File 'lib/notiflows/resources/users/deliveries.rb', line 76

def initialize(client:)
  @client = client
end

Instance Method Details

#list(user_external_id, after: nil, before: nil, channel_id: nil, created_after: nil, created_before: nil, limit: nil, status: nil, topic: nil, request_options: {}) ⇒ Notiflows::Internal::CursorPage<Notiflows::Models::Delivery>

Retrieve all delivery attempts for a user across all channels.

Parameters:

  • user_external_id (String) —

    User external ID

  • after (String) —

    Cursor for fetching the next page

  • before (String) —

    Cursor for fetching the previous page

  • channel_id (String) —

    Filter by channel ID (UUID)

  • created_after (String) —

    Filter by created after (ISO 8601 datetime)

  • created_before (String) —

    Filter by created before (ISO 8601 datetime)

  • limit (Integer) —

    Number of items per page (default: 25, max: 1000)

  • status (String) —

    Filter by status (pending, sent, failed)

  • topic (String) —

    Filter by topic name

  • request_options (Notiflows::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/notiflows/resources/users/deliveries.rb', line 61

def list(user_external_id, params = {})
  parsed, options = ::Notiflows::Users::DeliveryListParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["users/%1$s/deliveries", user_external_id],
    query: parsed,
    page: ::Notiflows::Internal::CursorPage,
    model: ::Notiflows::Delivery,
    options: options
  )
end

#retrieve(delivery_id, user_external_id:, request_options: {}) ⇒ Notiflows::Models::Delivery

Retrieve details of a specific delivery attempt for a user.

Parameters:

  • delivery_id (String) —

    Delivery ID (UUID)

  • user_external_id (String) —

    User external ID

  • request_options (Notiflows::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/notiflows/resources/users/deliveries.rb', line 20

def retrieve(delivery_id, params)
  parsed, options = ::Notiflows::Users::DeliveryRetrieveParams.dump_request(params)
  user_external_id =
    parsed.delete(:user_external_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["users/%1$s/deliveries/%2$s", user_external_id, delivery_id],
    model: ::Notiflows::Delivery,
    options: options
  )
end