Oauth2.token.pick: def of bend-kit-oauth2@0.11.0.1 Import: import bend-kit-oauth2@0.11.0.1/oauth2.bend as Oauth2 Lines 143-151 of bend-kit-oauth2@0.11.0.1/oauth2.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-oauth2@0.11.0.1/oauth2.bend&start_line=143&end_line=151 import Base import bend-kit-time@0.3.0.0/time.bend as Time import bend-kit-json@0.7.0.0/json.bend as Json import bend-kit-encoding@0.5.0.0/encoding.bend as Enc import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes # ยง6: a refresh reply without refresh_token keeps the old one. b: the body, decoded only for an error. def token.pick(ok: Bool, +status: U32, +old: String, now: Time.Instant, b: Bytes.Bytes, g: Got) -> Result<&1, &1, Err, Token>: match ok: case True{}: Got{a, t, +r, s, e, er, d} = g Done{Token{a, t, Bool.pick(String, String.is_empty(r), old, r), s, expiry(now, Json.u32.num(e))}} case False{}: Got{a, t, r, s, e, +er, d} = g Fail{Bool.pick(Err, String.is_empty(er), ErrReply{status, Enc.utf8.decode(b)}, ErrOAuth{status, er, d})} Uses (14): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.is_empty https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=Bytes https://jend.leeeet.dev/definition.txt?path=bend-kit-encoding@0.5.0.0/encoding.bend&name=utf8.decode https://jend.leeeet.dev/definition.txt?path=bend-kit-json@0.7.0.0/json.bend&name=u32.num https://jend.leeeet.dev/definition.txt?path=bend-kit-oauth2@0.11.0.1/oauth2.bend&name=Err https://jend.leeeet.dev/definition.txt?path=bend-kit-oauth2@0.11.0.1/oauth2.bend&name=Got https://jend.leeeet.dev/definition.txt?path=bend-kit-oauth2@0.11.0.1/oauth2.bend&name=Token https://jend.leeeet.dev/definition.txt?path=bend-kit-oauth2@0.11.0.1/oauth2.bend&name=expiry https://jend.leeeet.dev/definition.txt?path=bend-kit-time@0.3.0.0/time.bend&name=Instant