def refresh.post
cswap-bend-cli@0.1.0.0 · usage/cred.bend:238
import cswap-bend-cli@0.1.0.0/usage/cred.bend as Cred
import Base
import cswap-bend-cli@0.1.0.0/http.bend as Http
import cswap-bend-cli@0.1.0.0/json.bend as Json
import cswap-bend-cli@0.1.0.0/clock.bend as Clock
import cswap-bend-cli@0.1.0.0/usage/text.bend as UText
238
239
240
241def refresh.post(+j: Json.Json, +o: Json.Json, +rt: String) -> IO(Result<&2, &2, String, Granted>):
242 do IO<Result<&2, &2, String, Granted>>:
243 now : U32 <- Clock.now_s()
244 r : Result<&2, &2, String, Http.Reply> <- Http.request("POST", UText.token_url(),
245 [("Content-Type", "application/json"), ("User-Agent", UText.user_agent())], UText.refresh.body(rt), 10)
246 return grant.result(r, j, o, now)