Did you know ... Search Documentation:
Pack bitrix24 -- docs/provider-contract.md

Provider Contract

pbitrix24 is provider-driven. The library does not store runtime auth state internally and instead delegates config and context access to an external provider module.

Required callbacks

The consuming application should expose a module that implements:

get_config(Key, Value).
load_context(ContextRef, Context).
save_context(ContextRef, Context).
delete_context(ContextRef).
default_context(ContextRef).

Context references

The library works with two context reference forms:

global.
member(MemberID).

default_context/1 should resolve the context reference used by api_call/4.

Runtime context shape

Providers should load and persist runtime context as a dict. The library uses a single normalized internal shape:

_{
    member_id: MemberID,
    access_token: AccessToken,
    refresh_token: RefreshToken,
    expires_at: ExpiresAt,
    client_endpoint: ClientEndpoint,
    server_endpoint: ServerEndpoint,
    application_token: ApplicationToken,
    user_id: UserID,
    domain: Domain
}

Required context fields

These fields are required for REST calls and token refresh:

[97, 99, 99, 101, 115, 115, 95, 116, 111, 107, 101, 110]
[114, 101, 102, 114, 101, 115, 104, 95, 116, 111, 107, 101, 110]
[101, 120, 112, 105, 114, 101, 115, 95, 97, 116]
[99, 108, 105, 101, 110, 116, 95, 101, 110, 100, 112, 111, 105, 110, 116]
These fields are required when present in install/refresh payloads and should be preserved by providers:
[115, 101, 114, 118, 101, 114, 95, 101, 110, 100, 112, 111, 105, 110, 116]
[109, 101, 109, 98, 101, 114, 95, 105, 100]
[117, 115, 101, 114, 95, 105, 100]
[100, 111, 109, 97, 105, 110]
[97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 95, 116, 111, 107, 101, 110]

Config keys

Providers must support:

[99, 108, 105, 101, 110, 116, 95, 105, 100]
[99, 108, 105, 101, 110, 116, 95, 115, 101, 99, 114, 101, 116]
Providers may optionally support:
[111, 97, 117, 116, 104, 95, 116, 111, 107, 101, 110, 95, 117, 114, 108]
If oauth_token_url is not defined, the library defaults to:
'https://oauth.bitrix.info/oauth/token/'

Semantics

Notes