mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
api adjustments and org additions
This commit is contained in:
parent
b2c700ad28
commit
6b4ae1b8d5
@ -61,6 +61,7 @@ import { GroupUserResponse } from '../models/response/groupUserResponse';
|
||||
import { IdentityTokenResponse } from '../models/response/identityTokenResponse';
|
||||
import { IdentityTwoFactorResponse } from '../models/response/identityTwoFactorResponse';
|
||||
import { ListResponse } from '../models/response/listResponse';
|
||||
import { OrganizationBillingResponse } from '../models/response/organizationBillingResponse';
|
||||
import { OrganizationResponse } from '../models/response/organizationResponse';
|
||||
import {
|
||||
OrganizationUserDetailsResponse,
|
||||
@ -93,7 +94,7 @@ export abstract class ApiService {
|
||||
postEmail: (request: EmailRequest) => Promise<any>;
|
||||
postPassword: (request: PasswordRequest) => Promise<any>;
|
||||
postSecurityStamp: (request: PasswordVerificationRequest) => Promise<any>;
|
||||
postDeleteAccount: (request: PasswordVerificationRequest) => Promise<any>;
|
||||
deleteAccount: (request: PasswordVerificationRequest) => Promise<any>;
|
||||
getAccountRevisionDate: () => Promise<number>;
|
||||
postPasswordHint: (request: PasswordHintRequest) => Promise<any>;
|
||||
postRegister: (request: RegisterRequest) => Promise<any>;
|
||||
@ -194,11 +195,14 @@ export abstract class ApiService {
|
||||
postTwoFactorEmail: (request: TwoFactorEmailRequest) => Promise<any>;
|
||||
|
||||
getOrganization: (id: string) => Promise<OrganizationResponse>;
|
||||
getOrganizationBilling: (id: string) => Promise<OrganizationBillingResponse>;
|
||||
postOrganization: (request: OrganizationCreateRequest) => Promise<OrganizationResponse>;
|
||||
putOrganization: (id: string, request: OrganizationUpdateRequest) => Promise<OrganizationResponse>;
|
||||
postLeaveOrganization: (id: string) => Promise<any>;
|
||||
postOrganizationLicense: (data: FormData) => Promise<OrganizationResponse>;
|
||||
postDeleteOrganization: (id: string, request: PasswordVerificationRequest) => Promise<any>;
|
||||
postOrganizationStorage: (id: string, request: StorageRequest) => Promise<any>;
|
||||
postOrganizationPayment: (id: string, request: PaymentRequest) => Promise<any>;
|
||||
deleteOrganization: (id: string, request: PasswordVerificationRequest) => Promise<any>;
|
||||
|
||||
getEvents: (start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
||||
getEventsCipher: (id: string, start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
||||
|
32
src/models/response/organizationBillingResponse.ts
Normal file
32
src/models/response/organizationBillingResponse.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import {
|
||||
BillingChargeResponse,
|
||||
BillingInvoiceResponse,
|
||||
BillingSourceResponse,
|
||||
BillingSubscriptionResponse,
|
||||
} from './billingResponse';
|
||||
import { OrganizationResponse } from './organizationResponse';
|
||||
|
||||
export class OrganizationBillingResponse extends OrganizationResponse {
|
||||
storageName: string;
|
||||
storageGb: number;
|
||||
paymentSource: BillingSourceResponse;
|
||||
subscription: BillingSubscriptionResponse;
|
||||
upcomingInvoice: BillingInvoiceResponse;
|
||||
charges: BillingChargeResponse[] = [];
|
||||
expiration: Date;
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
this.storageName = response.StorageName;
|
||||
this.storageGb = response.StorageGb;
|
||||
this.paymentSource = response.PaymentSource == null ? null : new BillingSourceResponse(response.PaymentSource);
|
||||
this.subscription = response.Subscription == null ?
|
||||
null : new BillingSubscriptionResponse(response.Subscription);
|
||||
this.upcomingInvoice = response.UpcomingInvoice == null ?
|
||||
null : new BillingInvoiceResponse(response.UpcomingInvoice);
|
||||
if (response.Charges != null) {
|
||||
this.charges = response.Charges.map((c: any) => new BillingChargeResponse(c));
|
||||
}
|
||||
this.expiration = response.Expiration;
|
||||
}
|
||||
}
|
@ -68,6 +68,7 @@ import { GroupUserResponse } from '../models/response/groupUserResponse';
|
||||
import { IdentityTokenResponse } from '../models/response/identityTokenResponse';
|
||||
import { IdentityTwoFactorResponse } from '../models/response/identityTwoFactorResponse';
|
||||
import { ListResponse } from '../models/response/listResponse';
|
||||
import { OrganizationBillingResponse } from '../models/response/organizationBillingResponse';
|
||||
import { OrganizationResponse } from '../models/response/organizationResponse';
|
||||
import {
|
||||
OrganizationUserDetailsResponse,
|
||||
@ -208,8 +209,8 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
return this.send('POST', '/accounts/security-stamp', request, true, false);
|
||||
}
|
||||
|
||||
postDeleteAccount(request: PasswordVerificationRequest): Promise<any> {
|
||||
return this.send('POST', '/accounts/delete', request, true, false);
|
||||
deleteAccount(request: PasswordVerificationRequest): Promise<any> {
|
||||
return this.send('DELETE', '/accounts/delete', request, true, false);
|
||||
}
|
||||
|
||||
async getAccountRevisionDate(): Promise<number> {
|
||||
@ -632,6 +633,11 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
return new OrganizationResponse(r);
|
||||
}
|
||||
|
||||
async getOrganizationBilling(id: string): Promise<OrganizationBillingResponse> {
|
||||
const r = await this.send('GET', '/organizations/' + id + '/billing', null, true, true);
|
||||
return new OrganizationBillingResponse(r);
|
||||
}
|
||||
|
||||
async postOrganization(request: OrganizationCreateRequest): Promise<OrganizationResponse> {
|
||||
const r = await this.send('POST', '/organizations', request, true, true);
|
||||
return new OrganizationResponse(r);
|
||||
@ -651,8 +657,16 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
return new OrganizationResponse(r);
|
||||
}
|
||||
|
||||
postDeleteOrganization(id: string, request: PasswordVerificationRequest): Promise<any> {
|
||||
return this.send('POST', '/organizations/' + id + '/delete', request, true, false);
|
||||
postOrganizationStorage(id: string, request: StorageRequest): Promise<any> {
|
||||
return this.send('POST', '/organizations/' + id + '/storage', request, true, false);
|
||||
}
|
||||
|
||||
postOrganizationPayment(id: string, request: PaymentRequest): Promise<any> {
|
||||
return this.send('POST', '/organizations/' + id + '/payment', request, true, false);
|
||||
}
|
||||
|
||||
deleteOrganization(id: string, request: PasswordVerificationRequest): Promise<any> {
|
||||
return this.send('DELETE', '/organizations/' + id, request, true, false);
|
||||
}
|
||||
|
||||
// Event APIs
|
||||
|
Loading…
Reference in New Issue
Block a user