ExStreamClient.Operations.Chat.Channels (ExStreamClient v0.1.0)

View Source
Modules for interacting with the `chat/channels` group of OpenAI APIs

API Reference: https://platform.openai.com/docs/api-reference/chat/channels

Summary

Functions

delete_channel(type, id, opts \\ [])

@spec delete_channel(String.t(), String.t(), [{:hard_delete, boolean()}]) ::
  {:ok, ExStreamClient.Model.DeleteChannelResponse.t()} | {:error, any()}
Deletes channel

Sends events:

  • channel.deleted

  • channel.deleted

    ### Required Arguments:

      - `type`
      - `id`

    ### Optional Arguments:

      - `hard_delete`

delete_channels(payload)

Allows to delete several channels at once asynchronously

Sends events:

  • channel.deleted

  • channel.deleted

    ### Required Arguments:

      - `payload`: DeleteChannelsRequest

delete_draft(type, id, opts \\ [])

@spec delete_draft(String.t(), String.t(), user_id: String.t(), parent_id: String.t()) ::
  {:ok, ExStreamClient.Model.Response.t()} | {:error, any()}
Deletes a draft

Sends events:

  • draft.deleted

    ### Required Arguments:

      - `type`
      - `id`

    ### Optional Arguments:

      - `parent_id`
      - `user_id`

delete_file(type, id, opts \\ [])

@spec delete_file(String.t(), String.t(), [{:url, String.t()}]) ::
  {:ok, ExStreamClient.Model.Response.t()} | {:error, any()}
Deletes previously uploaded file


### Required Arguments:
    - `type`
    - `id`
### Optional Arguments:
    - `url`

delete_image(type, id, opts \\ [])

@spec delete_image(String.t(), String.t(), [{:url, String.t()}]) ::
  {:ok, ExStreamClient.Model.Response.t()} | {:error, any()}
Deletes previously uploaded image


### Required Arguments:
    - `type`
    - `id`
### Optional Arguments:
    - `url`

get_draft(type, id, opts \\ [])

@spec get_draft(String.t(), String.t(), user_id: String.t(), parent_id: String.t()) ::
  {:ok, ExStreamClient.Model.GetDraftResponse.t()} | {:error, any()}
Get a draft


### Required Arguments:
    - `type`
    - `id`
### Optional Arguments:
    - `parent_id`
    - `user_id`

get_many_messages(type, id, ids)

@spec get_many_messages(String.t(), String.t(), list()) ::
  {:ok, ExStreamClient.Model.GetManyMessagesResponse.t()} | {:error, any()}
Returns list messages found by IDs


### Required Arguments:
    - `type`
    - `id`
    - `ids`

get_or_create_channel(type, id, payload)

This Method creates a channel or returns an existing one with matching attributes

Sends events:

  • channel.created

  • member.added

  • member.removed

  • member.updated

  • user.watching.start

    ### Required Arguments:

      - `type`
      - `id`
      - `payload`: ChannelGetOrCreateRequest

get_or_create_distinct_channel(type, payload)

@spec get_or_create_distinct_channel(
  String.t(),
  ExStreamClient.Model.ChannelGetOrCreateRequest.t()
) :: {:ok, ExStreamClient.Model.ChannelStateResponse.t()} | {:error, any()}
This Method creates a channel or returns an existing one with matching attributes

Sends events:

  • channel.created

  • member.added

  • member.removed

  • member.updated

  • user.watching.start

    ### Required Arguments:

      - `type`
      - `payload`: ChannelGetOrCreateRequest

hide_channel(type, id, payload)

Marks channel as hidden for current user

Sends events:

  • channel.hidden

  • channel.hidden

    ### Required Arguments:

      - `type`
      - `id`
      - `payload`: HideChannelRequest

mark_channels_read(payload)

Marks channels as read up to the specific message. If no channels is given, mark all channel as read

Sends events:

  • message.read

  • message.read

    ### Required Arguments:

      - `payload`: MarkChannelsReadRequest

mark_read(type, id, payload)

Marks channel as read up to the specific message

Sends events:

  • message.read

  • message.read

    ### Required Arguments:

      - `type`
      - `id`
      - `payload`: MarkReadRequest

mark_unread(type, id, payload)

Marks channel as unread from a specific message


### Required Arguments:
    - `type`
    - `id`
    - `payload`: MarkUnreadRequest

query_channels(payload)

Query channels with filter query


### Required Arguments:
    - `payload`: QueryChannelsRequest

send_event(type, id, payload)

Sends event to the channel


### Required Arguments:
    - `type`
    - `id`
    - `payload`: SendEventRequest

send_message(type, id, payload)

Sends new message to the specified channel

Sends events:

  • message.new

  • message.updated

  • message.new

  • message.updated

    ### Required Arguments:

      - `type`
      - `id`
      - `payload`: SendMessageRequest

show_channel(type, id, payload)

Shows previously hidden channel

Sends events:

  • channel.visible

  • channel.visible

    ### Required Arguments:

      - `type`
      - `id`
      - `payload`: ShowChannelRequest

truncate_channel(type, id, payload)

Truncates messages from a channel. Can be applied to the entire channel or scoped to specific members.

Sends events:

  • channel.truncated

  • channel.truncated

    ### Required Arguments:

      - `type`
      - `id`
      - `payload`: TruncateChannelRequest

update_channel(type, id, payload)

Change channel data

Sends events:

  • channel.updated

  • member.added

  • member.removed

  • member.updated

  • message.new

  • channel.updated

  • member.added

  • member.removed

  • member.updated

  • message.new

    ### Required Arguments:

      - `type`
      - `id`
      - `payload`: UpdateChannelRequest

update_channel_partial(type, id, payload)

Updates certain fields of the channel

Sends events:

  • channel.updated

  • channel.updated

    ### Required Arguments:

      - `type`
      - `id`
      - `payload`: UpdateChannelPartialRequest

update_member_partial(type, id, payload, opts \\ [])

@spec update_member_partial(
  String.t(),
  String.t(),
  ExStreamClient.Model.UpdateMemberPartialRequest.t(),
  [{:user_id, String.t()}]
) ::
  {:ok, ExStreamClient.Model.UpdateMemberPartialResponse.t()} | {:error, any()}
### Required Arguments:
    - `type`
    - `id`
    - `payload`: UpdateMemberPartialRequest
### Optional Arguments:
    - `user_id`

upload_file(type, id, payload)

Uploads file


### Required Arguments:
    - `type`
    - `id`
    - `payload`: FileUploadRequest

upload_image(type, id, payload)

Uploads image


### Required Arguments:
    - `type`
    - `id`
    - `payload`: ImageUploadRequest