ExNylas.Events (ExNylas v0.11.0)

Copy Markdown View Source

Interface for Nylas events.

Nylas docs

Summary

Functions

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

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

Create and validate a event, use create/update to send to Nylas.

Create and validate a event, use create/update to send to Nylas.

Delete a(n) event.

Delete a(n) event.

Find a(n) event.

Get the first event.

Get the first event.

Fetch event(s), optionally provide query params.

Fetch event(s), optionally provide query params.

Send an RSVP for a given event.

Send an RSVP for a given event.

Functions

all(conn, opts \\ [])

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

Fetch all event(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.Events.all(conn, opts)

all!(conn, opts \\ [])

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

Fetch all event(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.Events.all!(conn, opts)

build(payload)

@spec build(map() | struct()) :: {:ok, struct()} | {:error, Ecto.Changeset.t()}

Create and validate a event, use create/update to send to Nylas.

Examples

iex> {:ok, result} = ExNylas.Events.build(payload)

build!(payload)

@spec build!(map() | struct()) :: struct()

Create and validate a event, use create/update to send to Nylas.

Examples

iex> result = ExNylas.Events.build!(payload)

create(conn, body, params \\ [])

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

Create a(n) event.

Examples

iex> {:ok, result} = ExNylas.Events.create(conn, body, params)

create!(conn, body, params \\ [])

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

Create a(n) event.

Examples

iex> result = ExNylas.Events.create(conn, body, params)

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) event.

Examples

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

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

Delete a(n) event.

Examples

iex> result = ExNylas.Events.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) event.

Examples

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

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

Find a(n) event.

Examples

iex> result = ExNylas.Events.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 event.

Examples

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

first!(conn, params \\ [])

Get the first event.

Examples

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

import_events(conn, params \\ [])

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

Import events.

Examples

iex> {:ok, result} = ExNylas.Events.import_events(conn, params)

import_events!(conn, params \\ [])

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

Import events.

Examples

iex> result = ExNylas.Events.import_events!(conn, params)

list(conn, params \\ [])

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

Fetch event(s), optionally provide query params.

Examples

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

list!(conn, params \\ [])

Fetch event(s), optionally provide query params.

Examples

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

rsvp(conn, event_id, status, calendar_id)

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

Send an RSVP for a given event.

Examples

iex> {:ok, success} = ExNylas.Events.rsvp(conn, event_id, status, calendar_id)

rsvp!(conn, event_id, status, calendar_id)

Send an RSVP for a given event.

Examples

iex> success = ExNylas.Events.rsvp!(conn, event_id, status, calendar_id)

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) event.

Examples

iex> {:ok, result} = ExNylas.Events.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) event.

Examples

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