shred-api-client 1.9.8 → 1.9.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ declare class TenantAPI implements TenantAPISchema {
6
6
  private clientHTTP;
7
7
  constructor(env: Environment);
8
8
  getByInviteCode(inviteCode: string, context?: Context): Promise<Tenant | null>;
9
- getTenant(context: Context): Promise<Tenant | null>;
9
+ getTenant(context: Context, tenantId?: string): Promise<Tenant | null>;
10
10
  create(t: Tenant, context: Context): Promise<boolean>;
11
11
  list(context: Context): Promise<Tenant[]>;
12
12
  update(tenantId: string, updateData: Pick<Tenant, "preferences">, context: Context): Promise<boolean>;
@@ -15,9 +15,17 @@ class TenantAPI {
15
15
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}/${inviteCode}`, endpointInfo.method, null, context);
16
16
  return data;
17
17
  }
18
- async getTenant(context) {
18
+ async getTenant(context, tenantId) {
19
19
  const endpointInfo = Tenant_schema_1.TenantEndpoints.GetTenant;
20
- const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}`, endpointInfo.method, null, context);
20
+ let uri = endpointInfo.uri;
21
+ let method = endpointInfo.method;
22
+ if (tenantId) {
23
+ const endpointData = Tenant_schema_1.TenantEndpoints.GetTenantById;
24
+ const endpoint = endpointData.uri.replace(":tenantId", tenantId);
25
+ uri = endpoint;
26
+ method = endpointData.method;
27
+ }
28
+ const data = await this.clientHTTP.makeRequest(this.env, uri, method, null, context);
21
29
  return data;
22
30
  }
23
31
  async create(t, context) {
@@ -38,7 +38,7 @@ class UserAPI {
38
38
  async getBindedUsers(context) {
39
39
  const endpointData = User_schema_1.UserEndpoints.GetBindedUsers;
40
40
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}`, endpointData.method, null, context);
41
- return data.success;
41
+ return data;
42
42
  }
43
43
  async setup(context) {
44
44
  const endpointData = User_schema_1.UserEndpoints.Setup;
@@ -20,6 +20,10 @@ declare const TenantEndpoints: {
20
20
  uri: string;
21
21
  method: string;
22
22
  };
23
+ GetTenantById: {
24
+ uri: string;
25
+ method: string;
26
+ };
23
27
  UpdateTenant: {
24
28
  uri: string;
25
29
  method: string;
@@ -14,6 +14,10 @@ const TenantEndpoints = {
14
14
  uri: "/tenants/me",
15
15
  method: "GET",
16
16
  },
17
+ GetTenantById: {
18
+ uri: "/tenants/:tenantId/find",
19
+ method: "GET",
20
+ },
17
21
  UpdateTenant: {
18
22
  uri: "/tenants/update",
19
23
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.9.8",
3
+ "version": "1.9.10",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",