import { WebClient } from "https://deno.land/x/slack_oauth@3.0.2/deps.ts";
A client for Slack's Web API
This client provides an alias for each Web API method. Each method is a convenience wrapper for calling the WebClient#apiCall method using the method name as the first parameter.
Constructors
Properties
This object's logger instance
Preference for immediately rejecting API calls which result in a rate-limited response
Queue of requests in which a maximum of WebClientOptions.maxRequestConcurrency can concurrently be in-flight.
Configuration for retry operations. See node-retry for more details.
The base URL for reaching Slack's Web API. Consider changing this value for testing purposes.
Methods
Processes an HTTP response into a WebAPICallResult by performing JSON parsing on the body and merging relevent HTTP headers into the object.
Low-level function to make a single API request. handles queuing, retries, and http-level errors
Transforms options (a simple key-value object) into an acceptable value for a body. This can be either a string, used when posting with a content-type of url-encoded. Or, it can be a readable stream, used when the options contain a binary (a stream or a buffer) and the upload should be done with content-type multipart/form-data.
Generic method for calling a Web API method
Iterate over the result pages of a cursor-paginated Web API method. This method can return two types of values,
depending on which arguments are used. When up to two parameters are used, the return value is an async iterator
which can be used as the iterable in a for-await-of loop. When three or four parameters are used, the return
value is a promise that resolves at the end of iteration. The third parameter, shouldStop
, is a function that is
called with each page
and can end iteration by returning true
. The fourth parameter, reduce
, is a function
that is called with three arguments: accumulator
, page
, and index
. The accumulator
is a value of any type
you choose, but it will contain undefined
when reduce
is called for the first time. The page
argument and
index
arguments are exactly what they say they are. The reduce
function's return value will be passed in as
accumulator
the next time its called, and the returned promise will resolve to the last value of accumulator
.
The for-await-of syntax is part of ES2018. It is available natively in Node starting with v10.0.0. You may be able to use it in earlier JavaScript runtimes by transpiling your source with a tool like Babel. However, the transpiled code will likely sacrifice performance.