Knock.Objects (Knock v0.4.14) View Source

Knock resources for accessing Objects

Link to this section Summary

Types

An object reference is how we refer to a particular object in a collection

Functions

Adds subscriptions for all recipients passed as arguments

Builds an object reference, which can be used in workflow trigger calls.

Creates a bulk operation to create subscriptions for a set of recipients to a set of objects within the given collection.

Bulk deletes one or more objects in a collection.

Bulk upserts one or more objects in a collection.

Deletes the given object.

Delete subscriptions for recipients passed as arguments

Gets the given object.

Returns all of the users preference sets

Returns channel data for the given channel id.

Returns paginated messages for the given object

Returns the preference set for the user.

Returns paginated schedules for the given object

Returns paginated subscriptions for the given object as recipient

Returns paginated list of objects for a collection

Returns paginated subscriptions for the given object

Upserts the given object in the collection with the attrs provided.

Upserts channel data for the given channel id.

Sets an entire preference set for the user. Will overwrite any existing data.

Unsets the channel data for the given channel id.

Link to this section Types

Specs

ref() :: %{id: :string, collection: :string}

An object reference is how we refer to a particular object in a collection

Link to this section Functions

Link to this function

add_subscriptions(client, collection, id, params)

View Source

Specs

add_subscriptions(Knock.Client.t(), String.t(), String.t(), map()) ::
  Knock.Api.response()

Adds subscriptions for all recipients passed as arguments

Expected properties:

  • recipients: list of recipients to create subscriptions for
  • properties: data to be stored at the subscription level for each recipient
Link to this function

build_ref(collection, id)

View Source

Specs

build_ref(String.t(), String.t()) :: ref()

Builds an object reference, which can be used in workflow trigger calls.

Link to this function

bulk_add_subscriptions(client, collection, subscriptions)

View Source

Specs

bulk_add_subscriptions(Knock.Client.t(), String.t(), [map()]) ::
  Knock.Api.response()

Creates a bulk operation to create subscriptions for a set of recipients to a set of objects within the given collection.

Each entry in the provided subscriptions list should have the properties:

  • id: the id of an object for subscribing
  • recipients: a list of recipients to subscribe to the object
  • properties (optional): a map of properties to apply to each recipient subscription
Link to this function

bulk_delete(client, collection, object_ids)

View Source

Specs

bulk_delete(Knock.Client.t(), String.t(), [String.t()]) :: Knock.Api.response()

Bulk deletes one or more objects in a collection.

Link to this function

bulk_set(client, collection, objects)

View Source

Specs

bulk_set(Knock.Client.t(), String.t(), [map()]) :: Knock.Api.response()

Bulk upserts one or more objects in a collection.

Link to this function

delete(client, collection, id)

View Source

Specs

Deletes the given object.

Link to this function

delete_subscriptions(client, collection, id, params)

View Source

Specs

delete_subscriptions(Knock.Client.t(), String.t(), String.t(), %{
  recipients: [String.t() | map()]
}) :: Knock.Api.response()

Delete subscriptions for recipients passed as arguments

Expected properties:

  • recipients: list of recipients to create subscriptions for
Link to this function

get(client, collection, id)

View Source

Specs

Gets the given object.

Link to this function

get_all_preferences(client, collection, id)

View Source

Specs

get_all_preferences(Knock.Client.t(), String.t(), String.t()) ::
  Knock.Api.response()

Returns all of the users preference sets

Link to this function

get_channel_data(client, collection, id, channel_id)

View Source

Specs

get_channel_data(Knock.Client.t(), String.t(), String.t(), String.t()) ::
  Knock.Api.response()

Returns channel data for the given channel id.

Link to this function

get_messages(client, collection, id, options \\ [])

View Source

Specs

Returns paginated messages for the given object

Available optional parameters:

#

- page_size: specify size of the page to be returned by the api. (max limit: 50)

- after: after cursor for pagination

- before: before cursor for pagination

- status: list of statuses to filter messages with

- tenant: tenant_id to filter messages with

- channel_id: channel_id to filter messages with

- source: workflow key to filter messages with

- trigger_data: trigger payload to filter messages with

Link to this function

get_preferences(client, collection, id, options \\ [])

View Source

Specs

get_preferences(Knock.Client.t(), String.t(), String.t(), Keyword.t()) ::
  Knock.Api.response()

Returns the preference set for the user.

Link to this function

get_schedules(client, collection, id, options \\ [])

View Source

Specs

Returns paginated schedules for the given object

Available optional parameters:

#

- page_size: specify size of the page to be returned by the api. (max limit: 50)

- after: after cursor for pagination

- before: before cursor for pagination

- tenant: tenant_id to filter messages with

- workflow: workflow key to filter messages with

Link to this function

get_subscriptions(client, collection, id, options \\ [])

View Source

Specs

get_subscriptions(Knock.Client.t(), String.t(), String.t(), Keyword.t()) ::
  Knock.Api.response()

Returns paginated subscriptions for the given object as recipient

Available optional parameters:

#

- page_size: specify size of the page to be returned by the api. (max limit: 50)

- after: after cursor for pagination

- before: before cursor for pagination

Link to this function

list(client, collection, options \\ [])

View Source

Specs

Returns paginated list of objects for a collection

Available optional parameters:

#

- page_size: specify size of the page to be returned by the api. (max limit: 50)

- after: after cursor for pagination

- before: before cursor for pagination

Link to this function

list_subscriptions(client, collection, id, options \\ [])

View Source

Specs

list_subscriptions(Knock.Client.t(), String.t(), String.t(), Keyword.t()) ::
  Knock.Api.response()

Returns paginated subscriptions for the given object

Available optional parameters:

#

- page_size: specify size of the page to be returned by the api. (max limit: 50)

- after: after cursor for pagination

- before: before cursor for pagination

Link to this function

set(client, collection, id, attrs)

View Source

Specs

Upserts the given object in the collection with the attrs provided.

Link to this function

set_categories_preferences(client, collection, id, categories, options \\ [])

View Source

Specs

set_categories_preferences(
  Knock.Client.t(),
  String.t(),
  String.t(),
  map(),
  Keyword.t()
) :: Knock.Api.response()

Sets the category preferences for the user.

Link to this function

set_category_preferences(client, collection, id, category_key, setting, options \\ [])

View Source

Specs

set_category_preferences(
  Knock.Client.t(),
  String.t(),
  String.t(),
  String.t(),
  map() | boolean(),
  Keyword.t()
) :: Knock.Api.response()

Sets the category preference for the user.

Link to this function

set_channel_data(client, collection, id, channel_id, channel_data)

View Source

Specs

set_channel_data(Knock.Client.t(), String.t(), String.t(), String.t(), map()) ::
  Knock.Api.response()

Upserts channel data for the given channel id.

Link to this function

set_channel_type_preferences(client, collection, id, channel_type, setting, options \\ [])

View Source

Specs

set_channel_type_preferences(
  Knock.Client.t(),
  String.t(),
  String.t(),
  String.t(),
  boolean(),
  Keyword.t()
) :: Knock.Api.response()

Sets the channel type preference for the user.

Link to this function

set_channel_types_preferences(client, collection, id, channel_types, options \\ [])

View Source

Specs

set_channel_types_preferences(
  Knock.Client.t(),
  String.t(),
  String.t(),
  map(),
  Keyword.t()
) :: Knock.Api.response()

Sets the channel type preferences for the user.

Link to this function

set_preferences(client, collection, id, preferences, options \\ [])

View Source

Specs

set_preferences(Knock.Client.t(), String.t(), String.t(), map(), Keyword.t()) ::
  Knock.Api.response()

Sets an entire preference set for the user. Will overwrite any existing data.

Link to this function

set_workflow_preferences(client, collection, id, workflow_key, setting, options \\ [])

View Source

Specs

set_workflow_preferences(
  Knock.Client.t(),
  String.t(),
  String.t(),
  String.t(),
  map() | boolean(),
  Keyword.t()
) :: Knock.Api.response()

Sets the workflow preference for the user.

Link to this function

set_workflows_preferences(client, collection, id, workflows, options \\ [])

View Source

Specs

set_workflows_preferences(
  Knock.Client.t(),
  String.t(),
  String.t(),
  map(),
  Keyword.t()
) :: Knock.Api.response()

Sets the workflow preferences for the user.

Link to this function

unset_channel_data(client, collection, id, channel_id)

View Source

Specs

unset_channel_data(Knock.Client.t(), String.t(), String.t(), String.t()) ::
  Knock.Api.response()

Unsets the channel data for the given channel id.