UNPKG

@glodon-aiot/apis

Version:

aiot apis

58 lines (57 loc) 1.24 kB
var r = (h, t, e) => new Promise((n, s) => { var p = (o) => { try { u(e.next(o)); } catch (g) { s(g); } }, i = (o) => { try { u(e.throw(o)); } catch (g) { s(g); } }, u = (o) => o.done ? n(o.value) : Promise.resolve(o.value).then(p, i); u((e = e.apply(h, t)).next()); }); import c from "axios"; import { BaseApi as l } from "../base/index.mjs"; class y extends l { constructor(t, e) { super(t != null ? t : c.create(), e); } getLoginUrl() { return r(this, null, function* () { return this.get("/openAddress"); }); } getToken(t, e) { return r(this, null, function* () { return this.get(t, e); }); } getAIoTTokenByGTeamToken(t) { return r(this, null, function* () { return this.post("/validate/glodonCloud", t).then((e) => e.accessToken); }); } postRefreshToken(t, e, n, s = "3600", p) { return r(this, null, function* () { return this.post("/refresh-token", { oldToken: t, tenant: e, orgId: n, expired: s, product: p }); }); } logout() { return r(this, null, function* () { return this.post("/logout", {}); }); } } export { y as AuthApi };