1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

Bulk confirm (#386)

* Add api for bulk confirm

* Rename OrganizationUserBulkConfirmResponse to OrganizationUserBulkResponse

* Add keys to contructor for OrganizationUserBulkConfirmRequest

* Linting
This commit is contained in:
Oscar Hinton 2021-05-25 19:02:49 +02:00 committed by GitHub
parent 395ded02aa
commit bacb84ca78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 6 deletions

View File

@ -37,6 +37,7 @@ import { OrganizationTaxInfoUpdateRequest } from '../models/request/organization
import { OrganizationUpdateRequest } from '../models/request/organizationUpdateRequest';
import { OrganizationUpgradeRequest } from '../models/request/organizationUpgradeRequest';
import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest';
import { OrganizationUserBulkConfirmRequest } from '../models/request/organizationUserBulkConfirmRequest';
import { OrganizationUserBulkRequest } from '../models/request/organizationUserBulkRequest';
import { OrganizationUserConfirmRequest } from '../models/request/organizationUserConfirmRequest';
import { OrganizationUserInviteRequest } from '../models/request/organizationUserInviteRequest';
@ -104,6 +105,8 @@ import { ListResponse } from '../models/response/listResponse';
import { OrganizationKeysResponse } from '../models/response/organizationKeysResponse';
import { OrganizationResponse } from '../models/response/organizationResponse';
import { OrganizationSubscriptionResponse } from '../models/response/organizationSubscriptionResponse';
import { OrganizationUserBulkPublicKeyResponse } from '../models/response/organizationUserBulkPublicKeyResponse';
import { OrganizationUserBulkResponse } from '../models/response/organizationUserBulkResponse';
import {
OrganizationUserDetailsResponse,
OrganizationUserResetPasswordDetailsReponse,
@ -280,11 +283,15 @@ export abstract class ApiService {
=> Promise<OrganizationUserResetPasswordDetailsReponse>;
postOrganizationUserInvite: (organizationId: string, request: OrganizationUserInviteRequest) => Promise<any>;
postOrganizationUserReinvite: (organizationId: string, id: string) => Promise<any>;
postManyOrganizationUserReinvite: (organizationId: string, request: OrganizationUserBulkRequest) => Promise<any>;
postManyOrganizationUserReinvite: (organizationId: string, request: OrganizationUserBulkRequest) => Promise<ListResponse<OrganizationUserBulkResponse>>;
postOrganizationUserAccept: (organizationId: string, id: string,
request: OrganizationUserAcceptRequest) => Promise<any>;
postOrganizationUserConfirm: (organizationId: string, id: string,
request: OrganizationUserConfirmRequest) => Promise<any>;
postOrganizationUsersPublicKey: (organizationId: string, request: OrganizationUserBulkRequest) =>
Promise<ListResponse<OrganizationUserBulkPublicKeyResponse>>;
postOrganizationUserBulkConfirm: (organizationId: string, request: OrganizationUserBulkConfirmRequest) => Promise<ListResponse<OrganizationUserBulkResponse>>;
putOrganizationUser: (organizationId: string, id: string, request: OrganizationUserUpdateRequest) => Promise<any>;
putOrganizationUserGroups: (organizationId: string, id: string,
request: OrganizationUserUpdateGroupsRequest) => Promise<any>;
@ -293,7 +300,7 @@ export abstract class ApiService {
putOrganizationUserResetPassword: (organizationId: string, id: string,
request: OrganizationUserResetPasswordRequest) => Promise<any>;
deleteOrganizationUser: (organizationId: string, id: string) => Promise<any>;
deleteManyOrganizationUsers: (organizationId: string, request: OrganizationUserBulkRequest) => Promise<any>;
deleteManyOrganizationUsers: (organizationId: string, request: OrganizationUserBulkRequest) => Promise<ListResponse<OrganizationUserBulkResponse>>;
getSync: () => Promise<SyncResponse>;
postImportDirectory: (organizationId: string, request: ImportDirectoryRequest) => Promise<any>;

View File

@ -0,0 +1,12 @@
type OrganizationUserBulkRequestEntry = {
id: string;
key: string;
};
export class OrganizationUserBulkConfirmRequest {
keys: OrganizationUserBulkRequestEntry[];
constructor(keys: OrganizationUserBulkRequestEntry[]) {
this.keys = keys;
}
}

View File

@ -0,0 +1,12 @@
import { BaseResponse } from './baseResponse';
export class OrganizationUserBulkPublicKeyResponse extends BaseResponse {
id: string;
key: string;
constructor(response: any) {
super(response);
this.id = this.getResponseProperty('Id');
this.key = this.getResponseProperty('Key');
}
}

View File

@ -0,0 +1,12 @@
import { BaseResponse } from './baseResponse';
export class OrganizationUserBulkResponse extends BaseResponse {
id: string;
error: string;
constructor(response: any) {
super(response);
this.id = this.getResponseProperty('Id');
this.error = this.getResponseProperty('Error');
}
}

View File

@ -41,6 +41,7 @@ import { OrganizationTaxInfoUpdateRequest } from '../models/request/organization
import { OrganizationUpdateRequest } from '../models/request/organizationUpdateRequest';
import { OrganizationUpgradeRequest } from '../models/request/organizationUpgradeRequest';
import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest';
import { OrganizationUserBulkConfirmRequest } from '../models/request/organizationUserBulkConfirmRequest';
import { OrganizationUserBulkRequest } from '../models/request/organizationUserBulkRequest';
import { OrganizationUserConfirmRequest } from '../models/request/organizationUserConfirmRequest';
import { OrganizationUserInviteRequest } from '../models/request/organizationUserInviteRequest';
@ -110,6 +111,8 @@ import { ListResponse } from '../models/response/listResponse';
import { OrganizationKeysResponse } from '../models/response/organizationKeysResponse';
import { OrganizationResponse } from '../models/response/organizationResponse';
import { OrganizationSubscriptionResponse } from '../models/response/organizationSubscriptionResponse';
import { OrganizationUserBulkPublicKeyResponse } from '../models/response/organizationUserBulkPublicKeyResponse';
import { OrganizationUserBulkResponse } from '../models/response/organizationUserBulkResponse';
import {
OrganizationUserDetailsResponse,
OrganizationUserResetPasswordDetailsReponse,
@ -814,8 +817,9 @@ export class ApiService implements ApiServiceAbstraction {
return this.send('POST', '/organizations/' + organizationId + '/users/' + id + '/reinvite', null, true, false);
}
postManyOrganizationUserReinvite(organizationId: string, request: OrganizationUserBulkRequest): Promise<any> {
return this.send('POST', '/organizations/' + organizationId + '/users/reinvite', request, true, false);
async postManyOrganizationUserReinvite(organizationId: string, request: OrganizationUserBulkRequest): Promise<ListResponse<OrganizationUserBulkResponse>> {
const r = await this.send('POST', '/organizations/' + organizationId + '/users/reinvite', request, true, true);
return new ListResponse(r, OrganizationUserBulkResponse);
}
postOrganizationUserAccept(organizationId: string, id: string,
@ -829,6 +833,16 @@ export class ApiService implements ApiServiceAbstraction {
request, true, false);
}
async postOrganizationUsersPublicKey(organizationId: string, request: OrganizationUserBulkRequest): Promise<ListResponse<OrganizationUserBulkPublicKeyResponse>> {
const r = await this.send('POST', '/organizations/' + organizationId + '/users/public-keys', request, true, true);
return new ListResponse(r, OrganizationUserBulkPublicKeyResponse);
}
async postOrganizationUserBulkConfirm(organizationId: string, request: OrganizationUserBulkConfirmRequest): Promise<ListResponse<OrganizationUserBulkResponse>> {
const r = await this.send('POST', '/organizations/' + organizationId + '/users/confirm', request, true, true);
return new ListResponse(r, OrganizationUserBulkResponse);
}
putOrganizationUser(organizationId: string, id: string, request: OrganizationUserUpdateRequest): Promise<any> {
return this.send('PUT', '/organizations/' + organizationId + '/users/' + id, request, true, false);
}
@ -854,8 +868,9 @@ export class ApiService implements ApiServiceAbstraction {
return this.send('DELETE', '/organizations/' + organizationId + '/users/' + id, null, true, false);
}
deleteManyOrganizationUsers(organizationId: string, request: OrganizationUserBulkRequest): Promise<any> {
return this.send('DELETE', '/organizations/' + organizationId + '/users', request, true, false);
async deleteManyOrganizationUsers(organizationId: string, request: OrganizationUserBulkRequest): Promise<ListResponse<OrganizationUserBulkResponse>> {
const r = await this.send('DELETE', '/organizations/' + organizationId + '/users', request, true, true);
return new ListResponse(r, OrganizationUserBulkResponse);
}
// Plan APIs