Skip to content

Commit

Permalink
Added accept and decline invitation to workspace calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramon Candel authored and Ramon Candel committed May 7, 2024
1 parent 7f6fe53 commit d28dd77
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
32 changes: 32 additions & 0 deletions src/workspaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<WorkspacesResponse> {
return this.client.get<WorkspacesResponse>('workspaces/', this.headers());
}
Expand Down Expand Up @@ -127,6 +139,26 @@ export class Workspaces {
this.headers(),
);
}

public acceptInvitation(inviteId: string, token: string): Promise<void> {
return this.client.post<void>(
'workspaces/invitations/accept',
{
inviteId,
},
this.getRequestHeaders(token),
);
}

public declineInvitation(inviteId: string, token: string): Promise<void> {
return this.client.post<void>(
'workspaces/invitations/decline',
{
inviteId,
},
this.getRequestHeaders(token),
);
}
}

export * from './types';

0 comments on commit d28dd77

Please sign in to comment.