def refresh.fields
import cswap-bend-cli@0.1.0.0/usage/cred.bend as Credimport Base
import cswap-bend-cli@0.1.0.0/json.bend as Json
127# The credential's oauth object after a grant: accessToken, expiresAt (ms),
128# then refreshToken and scopes when the response carries them.
129def refresh.fields(+o: Json.Json, +at: String, +ex: U32, +rt: Maybe<&2, String>, +sc: Maybe<&2, String>, +now: U32) -> Json.Json:
130 set.sc(sc, set.rt(rt, Json.set("expiresAt", Json.JNum{U32.show((now + ex : U32)) ++ "000"}, Json.set("accessToken", Json.JStr{at}, o))))