Creatio. Client
(creatio v0.3.1)
Copy Markdown
Client struct and configuration for communicating with Creatio CRM APIs.
Wraps a Req.Request pre-configured with the base URL, authentication headers,
read-only safety guards, and content negotiation required by Creatio.
Summary
Functions
Ensures that the input is a %Creatio.Client{}, converting a %Req.Request{} if necessary.
Builds a Creatio.Client from an existing Req.Request.
Creates a new Creatio.Client.
Sets an OAuth 2.0 Bearer token on the client.
Sets Forms authentication cookies and BPMCSRF token on the client.
Sets a custom header on the client's underlying Req.Request.
Returns the underlying configured Req.Request from the client.
Types
@type t() :: %Creatio.Client{ auth_mode: :none | :bearer | :forms | nil, auth_token: String.t() | nil, base_url: String.t(), bpmcsrf: String.t() | nil, client_id: String.t() | nil, client_secret: String.t() | nil, cookie: String.t() | nil, identity_service_url: String.t() | nil, options: keyword(), read_only: boolean(), req: Req.Request.t() }
Functions
@spec ensure_client(t() | Req.Request.t()) :: t()
Ensures that the input is a %Creatio.Client{}, converting a %Req.Request{} if necessary.
@spec from_req(Req.Request.t(), keyword() | map()) :: t()
Builds a Creatio.Client from an existing Req.Request.
@spec new(keyword() | map() | Req.Request.t()) :: t()
Creates a new Creatio.Client.
Can accept a keyword list of options, a map of options, or an existing Req.Request.
Options
:base_url- The base URL of your Creatio instance (e.g.,"https://myinstance.creatio.com").:auth_token- An OAuth 2.0 Bearer access token.:cookie- Cookie string for Forms authentication (e.g.".ASPXAUTH=...; BPMLOADER=...").:bpmcsrf- The BPMCSRF token for Forms authentication.:identity_service_url- Identity service base URL for OAuth 2.0.:client_id- OAuth 2.0 client ID.:client_secret- OAuth 2.0 client secret.:read_only- Iftrue, enables defense-in-depth read-only mode to prevent mutation requests (defaults tofalse, orApplication.get_env(:creatio, :read_only), orCREATIO_READ_ONLYenv var).:req_options- Extra keyword options forwarded toReq.new/1(e.g.:plug,:retry, etc.).
Sets an OAuth 2.0 Bearer token on the client.
Sets Forms authentication cookies and BPMCSRF token on the client.
Sets a custom header on the client's underlying Req.Request.
@spec to_req(t()) :: Req.Request.t()
Returns the underlying configured Req.Request from the client.