shred-api-client 1.5.2 → 1.5.3

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,5 +6,8 @@ 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
+ create(tenantId: string, name: string, context: Context): Promise<boolean>;
10
+ list(context: Context): Promise<Tenant[]>;
11
+ update(tenantId: string, updateData: Pick<Tenant, "preferences">, context: Context): Promise<boolean>;
9
12
  }
10
13
  export default TenantAPI;
@@ -15,5 +15,20 @@ 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 create(tenantId, name, context) {
19
+ const endpointInfo = Tenant_schema_1.TenantEndpoints.CreateTenant;
20
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}`, endpointInfo.method, { tenantId, name }, context);
21
+ return data;
22
+ }
23
+ async list(context) {
24
+ const endpointInfo = Tenant_schema_1.TenantEndpoints.ListAll;
25
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}`, endpointInfo.method, null, context);
26
+ return data;
27
+ }
28
+ async update(tenantId, updateData, context) {
29
+ const endpointInfo = Tenant_schema_1.TenantEndpoints.UpdateTenant;
30
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}`, endpointInfo.method, { tenantId, data: updateData }, context);
31
+ return data;
32
+ }
18
33
  }
19
34
  exports.default = TenantAPI;
@@ -2,12 +2,27 @@ import { Subscription } from "./Subscription.schema";
2
2
  import Context from "./Context";
3
3
  interface TenantAPISchema {
4
4
  getByInviteCode: (code: string, context?: Context) => Promise<Tenant | null>;
5
+ create: (tenantId: string, name: string, context: Context) => Promise<boolean>;
6
+ list: (context: Context) => Promise<Tenant[]>;
7
+ update: (tenantId: string, data: Pick<Tenant, "preferences">, context: Context) => Promise<boolean>;
5
8
  }
6
9
  declare const TenantEndpoints: {
7
10
  GetByInviteCode: {
8
11
  uri: string;
9
12
  method: string;
10
13
  };
14
+ CreateTenant: {
15
+ uri: string;
16
+ method: string;
17
+ };
18
+ UpdateTenant: {
19
+ uri: string;
20
+ method: string;
21
+ };
22
+ ListAll: {
23
+ uri: string;
24
+ method: string;
25
+ };
11
26
  };
12
27
  type Preferences = {
13
28
  iconUrl: string;
@@ -6,5 +6,17 @@ const TenantEndpoints = {
6
6
  uri: "/tenants/public/invitation/",
7
7
  method: "GET",
8
8
  },
9
+ CreateTenant: {
10
+ uri: "/tenants/create",
11
+ method: "PUT",
12
+ },
13
+ UpdateTenant: {
14
+ uri: "/tenants/update",
15
+ method: "POST",
16
+ },
17
+ ListAll: {
18
+ uri: "/tenants/list",
19
+ method: "GET",
20
+ },
9
21
  };
10
22
  exports.TenantEndpoints = TenantEndpoints;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",