def run_oracle

cswap-bend-cli@0.1.0.0 · swlive.bend:63

import cswap-bend-cli@0.1.0.0/swlive.bend as Swlive
import Base
import cswap-bend-cli@0.1.0.0/fs.bend as Fs
import cswap-bend-cli@0.1.0.0/store.bend as Store
import cswap-bend-cli@0.1.0.0/store/plan.bend as SPlan

63# Ask the oracle whose token this is. OHttp is GET /api/oauth/profile; OFile
64# answers from a JSON file (tests); ONone never resolves.
65def run_oracle(+o: Oracle, +token: String) -> IO(SPlan.Prof):
66  match o:
67    case OHttp{}:
68      Store.profile_http(token)
69    case OFile{path}:
70      IO.bind(Fs.Res(String), SPlan.Prof, Fs.read_file(path), r => IO.pure(SPlan.Prof, file_prof(r)))
71    case ONone{}:
72      IO.pure(SPlan.Prof, SPlan.ProfNone{})

Uses (10)

Used by (1)