diff --git a/package.json b/package.json index 8de79fd..d8c9bab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@internxt/sdk", - "version": "1.4.79", + "version": "1.4.80", "description": "An sdk for interacting with Internxt's services", "repository": { "type": "git", diff --git a/src/workspaces/index.ts b/src/workspaces/index.ts index 605f38c..459a24a 100644 --- a/src/workspaces/index.ts +++ b/src/workspaces/index.ts @@ -32,6 +32,18 @@ export class Workspaces { return headersWithToken(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token); } + private getRequestHeaders(token?: string) { + const headers = { + ...this.headers(), + }; + + if (token) { + headers.Authorization = 'Bearer ' + token; + } + + return headers; + } + public getWorkspaces(): Promise { return this.client.get('workspaces/', this.headers()); } @@ -127,6 +139,26 @@ export class Workspaces { this.headers(), ); } + + public acceptInvitation(inviteId: string, token: string): Promise { + return this.client.post( + 'workspaces/invitations/accept', + { + inviteId, + }, + this.getRequestHeaders(token), + ); + } + + public declineInvitation(inviteId: string, token: string): Promise { + return this.client.post( + 'workspaces/invitations/decline', + { + inviteId, + }, + this.getRequestHeaders(token), + ); + } } export * from './types';