Exact.System.Me (exact_online v0.1.0)

Copy Markdown View Source

The current user and the division they are logged in to.

This is the one endpoint that does not need a division, which makes it the starting point after an OAuth exchange: call division/1 to learn which division to scope the client to.

Reference: Me

Summary

Functions

Fetches the division the user is currently logged in to.

Fetches the current user.

Functions

division(client)

@spec division(Exact.Client.t()) :: {:ok, integer()} | {:error, Exact.Error.t()}

Fetches the division the user is currently logged in to.

{:ok, division} = Exact.System.Me.division(client)
client = Exact.Client.put_division(client, division)

get(client, opts \\ [])

@spec get(Exact.Client.t(), keyword()) ::
  {:ok, map() | nil} | {:error, Exact.Error.t()}

Fetches the current user.

Exact Online returns this as a collection with a single record; the record is unwrapped for you.

{:ok, me} = Exact.System.Me.get(client)
me["FullName"]