The minimal Graph API client the WhatsApp adapter is built on (Effect's
@effect/chat-whatsapp/WhatsAppGraphApi). It is public, so a consumer can
call an endpoint the adapter has no op for, with the same error mapping and
the same rule for writes.
Re-exports#
Values#
| Attribute | Type | Description |
|---|---|---|
DEFAULT_BASE_URL | Literal['https://graph.facebook.com/v24.0'] = 'https://graph.facebook.com/v24.0' | The Graph API version the adapter was written against. |
Types#
| Type | Definition | Description |
|---|---|---|
Method | type Method = Literal['GET', 'POST', 'DELETE'] |
Classes#
Functions#
make#
make(*, access_token, base_url=DEFAULT_BASE_URL, max_retry_after=None) -> Effect[WhatsAppGraphApiService, Never, HttpClient]Builds the client from an HttpClient and a system user access
token. max_retry_after caps the Retry-After a retry waits for;
see WhatsAppGraphApiService.
| Parameter | Type | Description |
|---|---|---|
access_token | Redacted[str] | |
base_url | str = DEFAULT_BASE_URL | |
max_retry_after | DurationInput | None = None |
Returns Effect[WhatsAppGraphApiService, Never, HttpClient]
def make(
*,
access_token: Redacted[str],
base_url: str = DEFAULT_BASE_URL,
max_retry_after: DurationInput | None = None,
) -> Effect[WhatsAppGraphApiService, Never, HttpClient]:
"""Builds the client from an ``HttpClient`` and a system user access
token. ``max_retry_after`` caps the ``Retry-After`` a retry waits for;
see ``WhatsAppGraphApiService``."""
ceiling = None if max_retry_after is None else from_input_unsafe(max_retry_after)
@fx.gen
def body() -> Generator[Effect[Any, Never, HttpClient], Any, WhatsAppGraphApiService]:
http = yield from HttpClient()
return WhatsAppGraphApiService(http, access_token, base_url, ceiling)
return bodylayer#
layer(*, access_token, base_url=DEFAULT_BASE_URL, max_retry_after=None) -> Layer[WhatsAppGraphApi, Never, HttpClient]The client as a layer.
| Parameter | Type | Description |
|---|---|---|
access_token | Redacted[str] | |
base_url | str = DEFAULT_BASE_URL | |
max_retry_after | DurationInput | None = None |
Returns Layer[WhatsAppGraphApi, Never, HttpClient]
def layer(
*,
access_token: Redacted[str],
base_url: str = DEFAULT_BASE_URL,
max_retry_after: DurationInput | None = None,
) -> Layer[WhatsAppGraphApi, Never, HttpClient]:
"""The client as a layer."""
return _layer_effect(
WhatsAppGraphApi,
make(access_token=access_token, base_url=base_url, max_retry_after=max_retry_after),
)