glyde/api
What a handler is given to make REST calls with, and the executor the
endpoint helpers call. Lives here rather than in glyde so noun modules
can import it without a cycle.
Types
Why a REST call did not produce an answer. Discord answered and said no, nothing answered at all, or the limiter would not let it go.
pub type CallFailure {
Refused(error.ApiError)
Unreachable(transport.Unreachable)
Withheld(limiter.Refusal)
}
Constructors
-
Refused(error.ApiError)Discord answered, with a non-2xx or a body its own decoder would not take.
glyde/rest/erroris where the questions about it live. A 429 has already been waited out and retried before it arrives here. -
Unreachable(transport.Unreachable)The request never got an answer: no route to the host, a timeout, a proxy speaking something that is not HTTP.
-
Withheld(limiter.Refusal)Never sent, and waiting would not help: the limiter will not send it at all. In practice the invalid-request budget is spent.
Values
pub fn describe_failure(failure: CallFailure) -> String
pub fn execute(
api: Api,
call: rest.Call(a),
) -> Result(a, CallFailure)
Send one call and wait for the answer. Blocks this handler process, which is its own and holds up nothing else. A 429 is waited out and retried.