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