Class: Notiflows::Resources::Users::Notifications

Inherits:
Object
  • Object
show all
Defined in:
lib/notiflows/resources/users/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:



74
75
76
# File 'lib/notiflows/resources/users/notifications.rb', line 74

def initialize(client:)
  @client = client
end

Instance Method Details

#list(user_external_id, 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 all notifications sent to a specific user.

Parameters:

  • user_external_id (String) —

    User external ID

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



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/notiflows/resources/users/notifications.rb', line 59

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

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

Retrieve a specific notification for a user, including all delivery attempts.

Parameters:

  • notification_id (String) —

    Notification 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/notifications.rb', line 20

def retrieve(notification_id, params)
  parsed, options = ::Notiflows::Users::NotificationRetrieveParams.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/notifications/%2$s", user_external_id, notification_id],
    model: ::Notiflows::Notification,
    options: options
  )
end