GitHub

slack_web_api

API reference for slack_web_api.

The minimal Slack Web API client the adapter is built on (Effect's @effect/chat-slack/SlackWebApi). It is public, so a consumer can call a method the adapter has no op for, with the same error mapping and the same rule for writes.

Re-exports

Values

AttributeTypeDescription
DEFAULT_BASE_URLLiteral['https://slack.com/api'] = 'https://slack.com/api'

Classes

Functions

make

make(*, bot_token, base_url=DEFAULT_BASE_URL, max_retry_after=None) -> Effect[SlackWebApiService, Never, HttpClient]

Builds the client from an HttpClient and a bot token. max_retry_after caps the Retry-After a retried call waits out; None waits out any.

ParameterTypeDescription
bot_tokenRedacted[str]
base_urlstr = DEFAULT_BASE_URL
max_retry_afterDurationInput | None = None

Returns Effect[SlackWebApiService, Never, HttpClient]

def make(
    *,
    bot_token: Redacted[str],
    base_url: str = DEFAULT_BASE_URL,
    max_retry_after: DurationInput | None = None,
) -> Effect[SlackWebApiService, Never, HttpClient]:
    """Builds the client from an ``HttpClient`` and a bot token.
    ``max_retry_after`` caps the ``Retry-After`` a retried call waits out;
    ``None`` waits out any."""
    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, SlackWebApiService]:
        http = yield from HttpClient()
        return SlackWebApiService(http, bot_token, base_url, ceiling)

    return body

layer

layer(*, bot_token, base_url=DEFAULT_BASE_URL, max_retry_after=None) -> Layer[SlackWebApi, Never, HttpClient]

The client as a layer; see make.

ParameterTypeDescription
bot_tokenRedacted[str]
base_urlstr = DEFAULT_BASE_URL
max_retry_afterDurationInput | None = None

Returns Layer[SlackWebApi, Never, HttpClient]

def layer(
    *,
    bot_token: Redacted[str],
    base_url: str = DEFAULT_BASE_URL,
    max_retry_after: DurationInput | None = None,
) -> Layer[SlackWebApi, Never, HttpClient]:
    """The client as a layer; see ``make``."""
    return _layer_effect(
        SlackWebApi,
        make(bot_token=bot_token, base_url=base_url, max_retry_after=max_retry_after),
    )