def profile_http

cswap-bend-cli@0.1.0.0 · store.bend:47

import cswap-bend-cli@0.1.0.0/store.bend as Store
import Base
import cswap-bend-cli@0.1.0.0/http.bend as Http
import cswap-bend-cli@0.1.0.0/store/plan.bend as SPlan

47# GET /api/oauth/profile through Http.request (curl, the token on stdin, and the
48# CSWAP_TEST_HTTP_BASE seam). Any failure is ProfNone: "unresolvable", never
49# "wrong".
50def profile_http(+token: String) -> IO(SPlan.Prof):
51  IO.bind(Result<&2, &2, String, Http.Reply>, SPlan.Prof,
52    Http.request("GET", profile_url(), [("Authorization", "Bearer " ++ token), ("Content-Type", "application/json"), ("User-Agent", "claude-swap/1.0")], "", 5),
53    r => IO.pure(SPlan.Prof, prof_of_reply(r)))

Uses (13)

Used by (2)