View Source TalkJS (talkjs v0.1.0)

Elixir SDK for Talkjs. See https://talkjs.com/docs/Reference/REST_API/

Installation

If available in Hex, the package can be installed by adding talkjs to your list of dependencies in mix.exs:

def deps do
  [
    {:talkjs, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/talkjs.

Summary

Types

t()

TalkJS config

Functions

Create a new TalkJS client

Types

@type t() :: %TalkJS{
  api_key: binary(),
  app_id: binary(),
  base_url: binary(),
  http_client: term()
}

TalkJS config

Functions

@spec new(opts :: Keyword.t()) :: t()

Create a new TalkJS client

Options for the TalkJS client:application

  • :api_key - the API key provided by TalkJS (YOUR_SECRET_KEY)
  • :app_id - the app id provided by TalkJS (YOUR_APP_ID)
  • :base_url - the base URL for the API (default: "https://api.talkjs.com/v1/")
  • :http_client - the HTTP client to use (default: TalkJS.HTTPClient.HTTPC). Must adhere to TalkJS.HTTPClient behaviour

Example usage:

  client = TalkJS.new(api_key: "...", app_id: "...")
Link to this function

request(method, path, client, params, opts \\ [])

View Source
@spec request(
  method :: :get | :delete | :post | :put,
  path :: String.t(),
  client :: t(),
  params :: map(),
  opts :: Keyword.t()
) :: {:ok, term()} | {:error, term()}

Perform a request to TalkJS

Example usage:

  client = TalkJS.new(api_key: "...", app_id: "...")

  TalkJS.request(:get, "$app_id/users/#id", client, %{})