Implementation namespace for discljord.messaging
.
Implementation namespace for `discljord.messaging`.
(defdispatch endpoint-name
[major-var & params]
[& opts]
opts-sym
method
status-sym
body-sym
url-str
method-params
promise-val)
Defines a dispatch method for the the endpoint with endpoint-name
.
In the parameter declarations [major-var & params]
, the major variable always comes first,
no matter at which position it is in the actual endpoint definition.
Even if the corresponding endpoint does not have a major variable,
a symbol for it needs to be provided in the parameters (typically _
since it will always be bound to nil
).
opts
are the optional parameters as specified in the endpoint definition,
method
is the http method used (:get
, :post
, ...),
status-sym
is a symbol that will be bound to the response code (http status),
body-sym
is a symbol that will be bound to the response body (as a string),
url-string
is the url of the endpoint (its expression can depend on the arguments),
method-params
is a map describing what to send in the request,
promise-val
is the expression that will be in the promise returned to the user of the endpoint.
Defines a dispatch method for the the endpoint with `endpoint-name`. In the parameter declarations `[major-var & params]`, the major variable always comes first, no matter at which position it is in the actual endpoint definition. Even if the corresponding endpoint does not have a major variable, a symbol for it needs to be provided in the parameters (typically `_` since it will always be bound to `nil`). `opts` are the optional parameters as specified in the endpoint definition, `method` is the http method used (`:get`, `:post`, ...), `status-sym` is a symbol that will be bound to the response code (http status), `body-sym` is a symbol that will be bound to the response body (as a string), `url-string` is the url of the endpoint (its expression can depend on the arguments), `method-params` is a map describing what to send in the request, `promise-val` is the expression that will be in the promise returned to the user of the endpoint.
Takes a process and endpoint, and dispatches an http request. Must return the response object from the call to allow the runtime to update the rate limit.
Takes a process and endpoint, and dispatches an http request. Must return the response object from the call to allow the runtime to update the rate limit.
(make-request! token rate-limits global-limit endpoint event-data bucket)
Makes a request after waiting for the rate limit, retrying if necessary.
Makes a request after waiting for the rate limit, retrying if necessary.
(rate-limited? rate-limit)
Returns the number of millis until the limit expires, or nil if not limited
Returns the number of millis until the limit expires, or nil if not limited
(start! token)
Takes a token for a bot and returns a channel to communicate with the message sending process.
Takes a token for a bot and returns a channel to communicate with the message sending process.
(step-agent process [endpoint & event-data :as event])
Takes a process and an event, and runs the request, respecting rate limits
Takes a process and an event, and runs the request, respecting rate limits
(stop! channel)
Takes the channel returned from start! and stops the messaging process.
Takes the channel returned from start! and stops the messaging process.
(update-rate-limit rate-limit headers)
Takes a rate-limit and a map of headers and returns an updated rate-limit.
If rate limit headers are included in the map, then the rate limit is updated to them, otherwise the existing rate limit is used, but the remaining limit is decremented.
Takes a rate-limit and a map of headers and returns an updated rate-limit. If rate limit headers are included in the map, then the rate limit is updated to them, otherwise the existing rate limit is used, but the remaining limit is decremented.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close