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

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

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:



95
96
97
# File 'lib/knockapi/resources/users/feeds.rb', line 95

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:



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

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, has_tenant: nil, locale: 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](/integrations/in-app/knock#customizing-api-response-content) 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.

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.

  • has_tenant (Boolean)

    Whether the feed items have a tenant.

  • locale (String)

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

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



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/knockapi/resources/users/feeds.rb', line 80

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