Class: Knockapi::Resources::Users::Feeds

Inherits:
Object
  • Object
show all
Defined in:
lib/knockapi/resources/users/feeds.rb,
sig/knockapi/resources/users/feeds.rbs

Overview

A user is an individual from your system, represented in Knock. They are most commonly a recipient of a notification.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Feeds

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

Parameters:



107
108
109
# File 'lib/knockapi/resources/users/feeds.rb', line 107

def initialize(client:)
  @client = client
end

Instance Method Details

#get_settings(user_id, id, request_options: {}) ⇒ Knockapi::Models::Users::FeedGetSettingsResponse

Returns the feed settings for a user.

Parameters:

  • user_id (String)

    The unique identifier of the user.

  • id (String)

    The unique identifier for the channel.

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

Returns:

See Also:



22
23
24
25
26
27
28
29
# File 'lib/knockapi/resources/users/feeds.rb', line 22

def get_settings(user_id, id, params = {})
  @client.request(
    method: :get,
    path: ["v1/users/%1$s/feeds/%2$s/settings", user_id, id],
    model: Knockapi::Models::Users::FeedGetSettingsResponse,
    options: params[:request_options]
  )
end

#list_items(user_id, id, after: nil, archived: nil, before: nil, exclude: nil, has_tenant: nil, inserted_at: nil, locale: nil, mode: nil, page_size: nil, source: nil, status: nil, tenant: nil, trigger_data: nil, workflow_categories: nil, request_options: {}) ⇒ Knockapi::Internal::EntriesCursor<Knockapi::Models::Users::FeedListItemsResponse>

Some parameter documentations has been truncated, see Models::Users::FeedListItemsParams for more details.

Returns a paginated list of feed items for a user in reverse chronological order, including metadata about the feed. If the user has not yet been identified within Knock, an empty feed will be returned.

You can customize the response using response filters to exclude or only include specific properties on your resources.

Notes:

  • When making this call from a client-side environment, use your publishable key along with a user token.
  • This endpoint’s rate limit is always scoped per-user and per-environment. This is true even for requests made without a signed user token.
  • Any attachments present in trigger data are automatically excluded from both the data and activities fields of UserInAppFeedResponse.

Parameters:

  • user_id (String)

    The unique identifier of the user.

  • id (String)

    The unique identifier for the channel.

  • after (String)

    The cursor to fetch entries after.

  • archived (Symbol, Knockapi::Models::Users::FeedListItemsParams::Archived)

    The archived status of the feed items.

  • before (String)

    The cursor to fetch entries before.

  • exclude (String)

    Comma-separated list of field paths to exclude from the response. Use dot notati

  • has_tenant (Boolean)

    Whether the feed items have a tenant.

  • inserted_at (Knockapi::Models::Users::FeedListItemsParams::InsertedAt)
  • locale (String)

    The locale to render the feed items in. Must be in the IETF 5646 format (e.g. `e

  • mode (Symbol, Knockapi::Models::Users::FeedListItemsParams::Mode)

    The mode to render the feed items in. Can be compact or rich. Defaults to `r

  • page_size (Integer)

    The number of items per page (defaults to 50).

  • source (String)

    The workflow key associated with the message in the feed.

  • status (Symbol, Knockapi::Models::Users::FeedListItemsParams::Status)

    The status of the feed items.

  • tenant (String)

    The tenant associated with the feed items.

  • trigger_data (String)

    The trigger data of the feed items (as a JSON string).

  • workflow_categories (Array<String>)

    The workflow categories of the feed items.

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

Returns:

See Also:



91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/knockapi/resources/users/feeds.rb', line 91

def list_items(user_id, id, params = {})
  parsed, options = Knockapi::Users::FeedListItemsParams.dump_request(params)
  query = Knockapi::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["v1/users/%1$s/feeds/%2$s", user_id, id],
    query: query,
    page: Knockapi::Internal::EntriesCursor,
    model: Knockapi::Models::Users::FeedListItemsResponse,
    options: options
  )
end