OpenPayments.Types.AccessTokenRequest (open_payments_elixir v1.0.0)

Copy Markdown View Source

Resource access requested through a grant request's access_token field.

Required access is an ordered list of typed access entries, validated by OpenPayments.Types.Access. The pinned schema permits additional JSON fields, which are retained in extensions. Empty access arrays remain valid.

Inspection omits all values because access can contain card authorization data. Explicit map/JSON export includes the protocol payload. This type does not issue, store or manage access tokens. Validate manually modified structs with validate/1; to_map/1 converts shape without validating it.

Summary

Functions

Decodes the requested access array and preserves permitted extension fields.

Converts to grant protocol fields, including card payloads, without validating.

Revalidates typed access entries, array constraints and extension fields.

Types

t()

@type t() :: %OpenPayments.Types.AccessTokenRequest{
  access: OpenPayments.Types.Access.t(),
  extensions: %{optional(String.t()) => term()}
}

Functions

from_map(data)

@spec from_map(map()) :: {:ok, t()} | {:error, OpenPayments.Error.t()}

Decodes the requested access array and preserves permitted extension fields.

to_map(request)

@spec to_map(t()) :: map()

Converts to grant protocol fields, including card payloads, without validating.

validate(request)

@spec validate(t()) :: :ok | {:error, OpenPayments.Error.t()}

Revalidates typed access entries, array constraints and extension fields.