@glodon-aiot/apis
Version:
aiot apis
215 lines (214 loc) • 5.09 kB
JavaScript
var e = (c, t, s) => new Promise((r, o) => {
var a = (n) => {
try {
u(s.next(n));
} catch (i) {
o(i);
}
}, g = (n) => {
try {
u(s.throw(n));
} catch (i) {
o(i);
}
}, u = (n) => n.done ? r(n.value) : Promise.resolve(n.value).then(a, g);
u((s = s.apply(c, t)).next());
});
import p from "axios";
import { BaseApi as y } from "../base/index.mjs";
class $ extends y {
constructor(t, s) {
super(t != null ? t : p.create(), s);
}
getTenant(t) {
return e(this, null, function* () {
return this.get(`/tenant/${t}`);
});
}
listProduct() {
return e(this, null, function* () {
return this.list("/products");
});
}
listProvinces() {
return e(this, null, function* () {
return this.list("/regions/provinces");
});
}
listCities(t) {
return e(this, null, function* () {
return this.list(`/regions/provinces/${t}/city`);
});
}
listCounties(t, s) {
return e(this, null, function* () {
return this.list(`/regions/provinces/${t}/city/${s}/county`);
});
}
getOrgList(t) {
return e(this, null, function* () {
return this.list("/org", t);
});
}
getUserIdOrgList(t, s) {
return e(this, null, function* () {
return this.list(`/users/${t}/org`, s);
});
}
delOrg(t) {
return e(this, null, function* () {
return this.delete(`/org/${t}`);
});
}
postOrg(t) {
return e(this, null, function* () {
return this.post("/org", t);
});
}
patchOrg(t, s) {
return e(this, null, function* () {
return this.patch(`/org/${t}`, s);
});
}
getUsers(t, s) {
return e(this, null, function* () {
return this.list(`/tenant/${t}/users`, s);
});
}
delUser(t, s) {
return e(this, null, function* () {
return this.delete(`/tenant/${t}/users/${s}`);
});
}
postUser(t, s) {
return e(this, null, function* () {
return this.post(`/tenant/${t}/users`, s);
});
}
patchUser(t, s, r) {
return e(this, null, function* () {
return this.patch(`tenant/${t}/users/${s}`, r);
});
}
getTenantList() {
return e(this, null, function* () {
return this.get("/tenant");
});
}
getUserIdRoles(t) {
return e(this, null, function* () {
return this.get(`/users/${t}/role`);
});
}
getProductCodeRole(t) {
return e(this, null, function* () {
return this.get(`/products/${t}/role`);
});
}
postUserRole(t, s) {
return e(this, null, function* () {
return this.post(`/users/${t}/role`, s);
});
}
patchUserRole(t, s, r) {
return e(this, null, function* () {
return this.patch(`/users/${t}/role/${s}`, r);
});
}
deleteUserRole(t, s) {
return e(this, null, function* () {
return this.delete(`/users/${t}/role/${s}`);
});
}
getUsersIdProductCodeMenu(t, s, r = "web", o) {
return e(this, null, function* () {
return this.get(`/users/${t}/product/${s}/menu?groupCode=${r}`, {
level: o
});
});
}
getUserInfo(t) {
return e(this, null, function* () {
return this.get(`/users/${t}`);
});
}
uipermission(t, s, r = "web") {
return e(this, null, function* () {
return this.get(`/users/${t}/product/${s}/uipermission?groupCode=${r}`);
});
}
getAppInfo(t) {
return e(this, null, function* () {
return this.get(`/products/${t}/apps`);
});
}
getTenantUserInfo(t, s) {
return e(this, null, function* () {
return this.get(`/tenant/${t}/users/${s}`);
});
}
uploadFile(t) {
return e(this, null, function* () {
return this.upload("/upload", t);
});
}
getUserIdProductCodeOrg(t, s) {
return e(this, null, function* () {
return this.get(`/users/${t}/product/${s}/org`);
});
}
getOrg(t) {
return e(this, null, function* () {
return this.get(`/org/${t}`);
});
}
getUploadTicket(t) {
return e(this, null, function* () {
return this.get("/upload/ticket", t);
});
}
putAppInfo(t, s) {
return e(this, null, function* () {
return this.put(`/products/${t}/apps`, s);
});
}
getTenantKeySecret(t) {
return e(this, null, function* () {
return this.get(`/tenant/${t}/key`);
});
}
resetTenantKeySecret(t) {
return e(this, null, function* () {
return this.post(`/tenant/${t}/resetSecret`, void 0);
});
}
getProductsCode(t) {
return e(this, null, function* () {
return this.get(`/products/${t}`);
});
}
//longterm-token
getLongtermTokens(t) {
return e(this, null, function* () {
return this.listPaged("/longterm-token", t);
});
}
postLongtermToken(t) {
return e(this, null, function* () {
return this.post("/longterm-token", t);
});
}
deleteLongtermToken(t) {
return e(this, null, function* () {
return this.delete(`/longterm-token/${t}`);
});
}
getMyUserInfo() {
return e(this, null, function* () {
return this.get("/user/me");
});
}
}
export {
$ as DataApi
};