diff --git a/src/abstractions/api.service.ts b/src/abstractions/api.service.ts index f45469b40a..8b2a39f098 100644 --- a/src/abstractions/api.service.ts +++ b/src/abstractions/api.service.ts @@ -17,6 +17,7 @@ import { ImportDirectoryRequest } from '../models/request/importDirectoryRequest import { ImportOrganizationCiphersRequest } from '../models/request/importOrganizationCiphersRequest'; import { KeysRequest } from '../models/request/keysRequest'; import { OrganizationCreateRequest } from '../models/request/organizationCreateRequest'; +import { OrganizationUpdateRequest } from '../models/request/organizationUpdateRequest'; import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest'; import { OrganizationUserConfirmRequest } from '../models/request/organizationUserConfirmRequest'; import { OrganizationUserInviteRequest } from '../models/request/organizationUserInviteRequest'; @@ -192,9 +193,12 @@ export abstract class ApiService { postTwoFactorEmailSetup: (request: TwoFactorEmailRequest) => Promise; postTwoFactorEmail: (request: TwoFactorEmailRequest) => Promise; + getOrganization: (id: string) => Promise; postOrganization: (request: OrganizationCreateRequest) => Promise; + putOrganization: (id: string, request: OrganizationUpdateRequest) => Promise; postLeaveOrganization: (id: string) => Promise; postOrganizationLicense: (data: FormData) => Promise; + deleteOrganization: (id: string) => Promise; getEvents: (start: string, end: string, token: string) => Promise>; getEventsCipher: (id: string, start: string, end: string, token: string) => Promise>; diff --git a/src/models/request/organizationUpdateRequest.ts b/src/models/request/organizationUpdateRequest.ts new file mode 100644 index 0000000000..ffb9149b34 --- /dev/null +++ b/src/models/request/organizationUpdateRequest.ts @@ -0,0 +1,5 @@ +export class OrganizationUpdateRequest { + name: string; + businessName: string; + billingEmail: string; +} diff --git a/src/services/api.service.ts b/src/services/api.service.ts index ccdac7d6a5..06d0c299e6 100644 --- a/src/services/api.service.ts +++ b/src/services/api.service.ts @@ -23,6 +23,7 @@ import { ImportDirectoryRequest } from '../models/request/importDirectoryRequest import { ImportOrganizationCiphersRequest } from '../models/request/importOrganizationCiphersRequest'; import { KeysRequest } from '../models/request/keysRequest'; import { OrganizationCreateRequest } from '../models/request/organizationCreateRequest'; +import { OrganizationUpdateRequest } from '../models/request/organizationUpdateRequest'; import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest'; import { OrganizationUserConfirmRequest } from '../models/request/organizationUserConfirmRequest'; import { OrganizationUserInviteRequest } from '../models/request/organizationUserInviteRequest'; @@ -626,11 +627,21 @@ export class ApiService implements ApiServiceAbstraction { // Organization APIs + async getOrganization(id: string): Promise { + const r = await this.send('GET', '/organizations/' + id, null, true, true); + return new OrganizationResponse(r); + } + async postOrganization(request: OrganizationCreateRequest): Promise { const r = await this.send('POST', '/organizations', request, true, true); return new OrganizationResponse(r); } + async putOrganization(id: string, request: OrganizationUpdateRequest): Promise { + const r = await this.send('PUT', '/organizations/' + id, request, true, true); + return new OrganizationResponse(r); + } + postLeaveOrganization(id: string): Promise { return this.send('POST', '/organizations/' + id + '/leave', null, true, false); } @@ -640,6 +651,10 @@ export class ApiService implements ApiServiceAbstraction { return new OrganizationResponse(r); } + deleteOrganization(id: string): Promise { + return this.send('DELETE', '/organizations/' + id, null, true, false); + } + // Event APIs async getEvents(start: string, end: string, token: string): Promise> {