ExNylas.Threads (ExNylas v0.11.0)

Copy Markdown View Source

Interface for Nylas threads.

Nylas docs

Summary

Functions

Fetch all thread(s) matching the provided query (the SDK will handle paging).

Fetch all thread(s) matching the provided query (the SDK will handle paging).

Delete a(n) thread.

Delete a(n) thread.

Find a(n) thread.

Find a(n) thread.

Get the first thread.

Get the first thread.

Fetch thread(s), optionally provide query params.

Fetch thread(s), optionally provide query params.

Functions

all(conn, opts \\ [])

@spec all(ExNylas.Connection.t(), Keyword.t() | map()) ::
  {:ok, [struct()]} | {:error, ExNylas.Response.t()}

Fetch all thread(s) matching the provided query (the SDK will handle paging).

The second argument can be a keyword list of options + query parameters to pass to the Nylas API (map is also supported). Options supports:

  • :send_to - a single arity function to send each page of results (default is nil, e.g. results will be accumulated and returned as a list)
  • :delay - the number of milliseconds to wait between each page request (default is 0; strongly recommended to avoid rate limiting)
  • :query - a keyword list or map of query parameters to pass to the Nylas API (default is an empty list)

Examples

iex> opts = [send_to: &IO.inspect/1, delay: 3_000, query: [key: "value"]]
iex> {:ok, result} = ExNylas.Threads.all(conn, opts)

all!(conn, opts \\ [])

@spec all!(ExNylas.Connection.t(), Keyword.t() | map()) :: [struct()]

Fetch all thread(s) matching the provided query (the SDK will handle paging).

The second argument can be a keyword list of options + query parameters to pass to the Nylas API (map is also supported). Options supports:

  • :send_to - a single arity function to send each page of results (default is nil, e.g. results will be accumulated and returned as a list)
  • :delay - the number of milliseconds to wait between each page request (default is 0; strongly recommended to avoid rate limiting)
  • :query - a keyword list or map of query parameters to pass to the Nylas API (default is an empty list)

Examples

iex> opts = [send_to: &IO.inspect/1, delay: 3_000, query: [key: "value"]]
iex> result = ExNylas.Threads.all!(conn, opts)

delete(conn, id, params \\ [])

@spec delete(ExNylas.Connection.t(), String.t(), Keyword.t() | map()) ::
  {:ok, ExNylas.Response.t()} | {:error, ExNylas.Response.t()}

Delete a(n) thread.

Examples

iex> {:ok, result} = ExNylas.Threads.delete(conn, id, params)

delete!(conn, id, params \\ [])

Delete a(n) thread.

Examples

iex> result = ExNylas.Threads.delete!(conn, id, params)

find(conn, id, params \\ [])

@spec find(ExNylas.Connection.t(), String.t(), Keyword.t() | map()) ::
  {:ok, ExNylas.Response.t()} | {:error, ExNylas.Response.t()}

Find a(n) thread.

Examples

iex> {:ok, result} = ExNylas.Threads.find(conn, id, params)

find!(conn, id, params \\ [])

Find a(n) thread.

Examples

iex> result = ExNylas.Threads.find!(conn, id, params)

first(conn, params \\ [])

@spec first(ExNylas.Connection.t(), Keyword.t() | map()) ::
  {:ok, ExNylas.Response.t()} | {:error, ExNylas.Response.t()}

Get the first thread.

Examples

iex> {:ok, result} = ExNylas.Threads.first(conn, params)

first!(conn, params \\ [])

Get the first thread.

Examples

iex> result = ExNylas.Threads.first!(conn, params)

list(conn, params \\ [])

@spec list(ExNylas.Connection.t(), Keyword.t() | map()) ::
  {:ok, ExNylas.Response.t()} | {:error, ExNylas.Response.t()}

Fetch thread(s), optionally provide query params.

Examples

iex> {:ok, result} = ExNylas.Threads.list(conn, params)

list!(conn, params \\ [])

Fetch thread(s), optionally provide query params.

Examples

iex> result = ExNylas.Threads.list!(conn, params)

update(conn, id, changeset, params \\ [])

@spec update(ExNylas.Connection.t(), String.t(), map(), Keyword.t() | map()) ::
  {:ok, ExNylas.Response.t()} | {:error, ExNylas.Response.t()}

Update a(n) thread.

Examples

iex> {:ok, result} = ExNylas.Threads.update(conn, id, body, params)

update!(conn, id, changeset, params \\ [])

@spec update!(ExNylas.Connection.t(), String.t(), map(), Keyword.t() | map()) ::
  ExNylas.Response.t()

Update a(n) thread.

Examples

iex> result = ExNylas.Threads.update!(conn, id, body, params)