Class: Notiflows::Resources::Notifications

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Notifications

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 Notifications.

Parameters:



107
108
109
# File 'lib/notiflows/resources/notifications.rb', line 107

def initialize(client:)
  @client = client
end

Instance Method Details

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

Retrieve a paginated list of all notifications in your project.

A notification represents a message sent to a single recipient through a notiflow run. Each notification can have multiple deliveries (one per channel).

Parameters:

  • after (String) —

    Cursor for fetching the next page

  • before (String) —

    Cursor for fetching the previous page

  • 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

  • topic (String) —

    Filter by topic

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

Returns:

See Also:



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/notiflows/resources/notifications.rb', line 53

def list(params = {})
  parsed, options = ::Notiflows::NotificationListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "notifications",
    query: parsed,
    page: ::Notiflows::Internal::CursorPage,
    model: ::Notiflows::Notification,
    options: options
  )
end

#list_deliveries(notification_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 specific notification.

Parameters:

  • notification_id (String) —

    Notification ID (UUID)

  • 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:



92
93
94
95
96
97
98
99
100
101
102
# File 'lib/notiflows/resources/notifications.rb', line 92

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

#retrieve(id, request_options: {}) ⇒ Notiflows::Models::Notification

Retrieve a single notification by ID, including the recipient, actor, and all delivery attempts.

Parameters:

Returns:

See Also:



18
19
20
21
22
23
24
25
# File 'lib/notiflows/resources/notifications.rb', line 18

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["notifications/%1$s", id],
    model: ::Notiflows::Notification,
    options: params[:request_options]
  )
end