1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

[SM-288] Rename requests and responses to follow naming convention (#3806)

This commit is contained in:
Oscar Hinton
2022-10-18 19:01:42 +02:00
committed by GitHub
parent c2df5c608e
commit cf2d3f5382
375 changed files with 868 additions and 1054 deletions

View File

@@ -0,0 +1,85 @@
import { BaseResponse } from "./base.response";
export class SubscriptionResponse extends BaseResponse {
storageName: string;
storageGb: number;
maxStorageGb: number;
subscription: BillingSubscriptionResponse;
upcomingInvoice: BillingSubscriptionUpcomingInvoiceResponse;
license: any;
expiration: string;
usingInAppPurchase: boolean;
constructor(response: any) {
super(response);
this.storageName = this.getResponseProperty("StorageName");
this.storageGb = this.getResponseProperty("StorageGb");
this.maxStorageGb = this.getResponseProperty("MaxStorageGb");
this.license = this.getResponseProperty("License");
this.expiration = this.getResponseProperty("Expiration");
this.usingInAppPurchase = this.getResponseProperty("UsingInAppPurchase");
const subscription = this.getResponseProperty("Subscription");
const upcomingInvoice = this.getResponseProperty("UpcomingInvoice");
this.subscription = subscription == null ? null : new BillingSubscriptionResponse(subscription);
this.upcomingInvoice =
upcomingInvoice == null
? null
: new BillingSubscriptionUpcomingInvoiceResponse(upcomingInvoice);
}
}
export class BillingSubscriptionResponse extends BaseResponse {
trialStartDate: string;
trialEndDate: string;
periodStartDate: string;
periodEndDate: string;
cancelledDate: string;
cancelAtEndDate: boolean;
status: string;
cancelled: boolean;
items: BillingSubscriptionItemResponse[] = [];
constructor(response: any) {
super(response);
this.trialEndDate = this.getResponseProperty("TrialStartDate");
this.trialEndDate = this.getResponseProperty("TrialEndDate");
this.periodStartDate = this.getResponseProperty("PeriodStartDate");
this.periodEndDate = this.getResponseProperty("PeriodEndDate");
this.cancelledDate = this.getResponseProperty("CancelledDate");
this.cancelAtEndDate = this.getResponseProperty("CancelAtEndDate");
this.status = this.getResponseProperty("Status");
this.cancelled = this.getResponseProperty("Cancelled");
const items = this.getResponseProperty("Items");
if (items != null) {
this.items = items.map((i: any) => new BillingSubscriptionItemResponse(i));
}
}
}
export class BillingSubscriptionItemResponse extends BaseResponse {
name: string;
amount: number;
quantity: number;
interval: string;
sponsoredSubscriptionItem: boolean;
constructor(response: any) {
super(response);
this.name = this.getResponseProperty("Name");
this.amount = this.getResponseProperty("Amount");
this.quantity = this.getResponseProperty("Quantity");
this.interval = this.getResponseProperty("Interval");
this.sponsoredSubscriptionItem = this.getResponseProperty("SponsoredSubscriptionItem");
}
}
export class BillingSubscriptionUpcomingInvoiceResponse extends BaseResponse {
date: string;
amount: number;
constructor(response: any) {
super(response);
this.date = this.getResponseProperty("Date");
this.amount = this.getResponseProperty("Amount");
}
}