shred-api-client 1.7.1 → 1.7.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,6 +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
10
  create(t: Tenant, context: Context): Promise<boolean>;
10
11
  list(context: Context): Promise<Tenant[]>;
11
12
  update(tenantId: string, updateData: Pick<Tenant, "preferences">, context: Context): Promise<boolean>;
@@ -15,6 +15,11 @@ 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) {
19
+ const endpointInfo = Tenant_schema_1.TenantEndpoints.GetTenant;
20
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}`, endpointInfo.method, null, context);
21
+ return data;
22
+ }
18
23
  async create(t, context) {
19
24
  const endpointInfo = Tenant_schema_1.TenantEndpoints.CreateTenant;
20
25
  const data = await this.clientHTTP.makeRequest(this.env, `${endpointInfo.uri}`, endpointInfo.method, Object.assign({}, t), context);
@@ -4,6 +4,7 @@ interface TenantAPISchema {
4
4
  getByInviteCode: (code: string, context?: Context) => Promise<Tenant | null>;
5
5
  create: (tenant: Tenant, context: Context) => Promise<boolean>;
6
6
  list: (context: Context) => Promise<Tenant[]>;
7
+ getTenant: (context: Context) => Promise<Tenant | null>;
7
8
  update: (tenantId: string, data: Pick<Tenant, "preferences">, context: Context) => Promise<boolean>;
8
9
  }
9
10
  declare const TenantEndpoints: {
@@ -15,6 +16,10 @@ declare const TenantEndpoints: {
15
16
  uri: string;
16
17
  method: string;
17
18
  };
19
+ GetTenant: {
20
+ uri: string;
21
+ method: string;
22
+ };
18
23
  UpdateTenant: {
19
24
  uri: string;
20
25
  method: string;
@@ -10,6 +10,10 @@ const TenantEndpoints = {
10
10
  uri: "/tenants/create",
11
11
  method: "PUT",
12
12
  },
13
+ GetTenant: {
14
+ uri: "/tenants/me",
15
+ method: "GET",
16
+ },
13
17
  UpdateTenant: {
14
18
  uri: "/tenants/update",
15
19
  method: "POST",
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const ShredException_1 = __importDefault(require("./ShredException"));
7
7
  class UnauthorizedException extends ShredException_1.default {
8
8
  constructor(message) {
9
- super(message, 400);
9
+ super(message, 401);
10
10
  this.name = "UnauthorizedException";
11
11
  }
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",