-
Notifications
You must be signed in to change notification settings - Fork 14
/
result.ts
595 lines (584 loc) · 23.3 KB
/
result.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
import * as resources from "./resources";
import {Util} from "./util";
import { IdempotencyConstants } from "./idempotency_constants";
export class Result {
readonly #_response: any;
readonly responseHeaders: any;
get subscription(): resources.Subscription {
let _subscription = this.get(
'subscription',
'Subscription',
{'subscription_items': 'SubscriptionSubscriptionItem', 'item_tiers': 'SubscriptionItemTier', 'charged_items': 'SubscriptionChargedItem', 'addons': 'SubscriptionAddon', 'event_based_addons': 'SubscriptionEventBasedAddon', 'charged_event_based_addons': 'SubscriptionChargedEventBasedAddon', 'coupons': 'SubscriptionCoupon', 'shipping_address': 'SubscriptionShippingAddress', 'referral_info': 'SubscriptionReferralInfo', 'contract_term': 'SubscriptionContractTerm', 'discounts': 'SubscriptionDiscount'}
);
return _subscription;
}
get contract_term(): resources.ContractTerm {
let _contract_term = this.get(
'contract_term',
'ContractTerm'
);
return _contract_term;
}
get discount(): resources.Discount {
let _discount = this.get(
'discount',
'Discount'
);
return _discount;
}
get advance_invoice_schedule(): resources.AdvanceInvoiceSchedule {
let _advance_invoice_schedule = this.get(
'advance_invoice_schedule',
'AdvanceInvoiceSchedule',
{'fixed_interval_schedule': 'AdvanceInvoiceScheduleFixedIntervalSchedule', 'specific_dates_schedule': 'AdvanceInvoiceScheduleSpecificDatesSchedule'}
);
return _advance_invoice_schedule;
}
get customer(): resources.Customer {
let _customer = this.get(
'customer',
'Customer',
{'billing_address': 'CustomerBillingAddress', 'referral_urls': 'CustomerReferralUrl', 'contacts': 'CustomerContact', 'payment_method': 'CustomerPaymentMethod', 'balances': 'CustomerBalance', 'entity_identifiers': 'CustomerEntityIdentifier', 'relationship': 'CustomerRelationship', 'parent_account_access': 'CustomerParentAccountAccess', 'child_account_access': 'CustomerChildAccountAccess'}
);
return _customer;
}
get hierarchy(): resources.Hierarchy {
let _hierarchy = this.get(
'hierarchy',
'Hierarchy'
);
return _hierarchy;
}
get contact(): resources.Contact {
let _contact = this.get(
'contact',
'Contact'
);
return _contact;
}
get token(): resources.Token {
let _token = this.get(
'token',
'Token'
);
return _token;
}
get payment_source(): resources.PaymentSource {
let _payment_source = this.get(
'payment_source',
'PaymentSource',
{'card': 'PaymentSourceCard', 'bank_account': 'PaymentSourceBankAccount', 'cust_voucher_source': 'PaymentSourceCustVoucherSource', 'billing_address': 'PaymentSourceBillingAddress', 'amazon_payment': 'PaymentSourceAmazonPayment', 'upi': 'PaymentSourceUpi', 'paypal': 'PaymentSourcePaypal', 'mandates': 'PaymentSourceMandate'}
);
return _payment_source;
}
get third_party_payment_method(): resources.ThirdPartyPaymentMethod {
let _third_party_payment_method = this.get(
'third_party_payment_method',
'ThirdPartyPaymentMethod'
);
return _third_party_payment_method;
}
get virtual_bank_account(): resources.VirtualBankAccount {
let _virtual_bank_account = this.get(
'virtual_bank_account',
'VirtualBankAccount'
);
return _virtual_bank_account;
}
get card(): resources.Card {
let _card = this.get(
'card',
'Card'
);
return _card;
}
get promotional_credit(): resources.PromotionalCredit {
let _promotional_credit = this.get(
'promotional_credit',
'PromotionalCredit'
);
return _promotional_credit;
}
get invoice(): resources.Invoice {
let _invoice = this.get(
'invoice',
'Invoice',
{'line_items': 'InvoiceLineItem', 'discounts': 'InvoiceDiscount', 'line_item_discounts': 'InvoiceLineItemDiscount', 'taxes': 'InvoiceTax', 'line_item_taxes': 'InvoiceLineItemTax', 'line_item_tiers': 'InvoiceLineItemTier', 'linked_payments': 'InvoiceLinkedPayment', 'dunning_attempts': 'InvoiceDunningAttempt', 'applied_credits': 'InvoiceAppliedCredit', 'adjustment_credit_notes': 'InvoiceAdjustmentCreditNote', 'issued_credit_notes': 'InvoiceIssuedCreditNote', 'linked_orders': 'InvoiceLinkedOrder', 'notes': 'InvoiceNote', 'shipping_address': 'InvoiceShippingAddress', 'billing_address': 'InvoiceBillingAddress', 'einvoice': 'InvoiceEinvoice'}
);
return _invoice;
}
get payment_reference_number(): resources.PaymentReferenceNumber {
let _payment_reference_number = this.get(
'payment_reference_number',
'PaymentReferenceNumber'
);
return _payment_reference_number;
}
get tax_withheld(): resources.TaxWithheld {
let _tax_withheld = this.get(
'tax_withheld',
'TaxWithheld'
);
return _tax_withheld;
}
get credit_note(): resources.CreditNote {
let _credit_note = this.get(
'credit_note',
'CreditNote',
{'einvoice': 'CreditNoteEinvoice', 'line_items': 'CreditNoteLineItem', 'discounts': 'CreditNoteDiscount', 'line_item_discounts': 'CreditNoteLineItemDiscount', 'line_item_tiers': 'CreditNoteLineItemTier', 'taxes': 'CreditNoteTax', 'line_item_taxes': 'CreditNoteLineItemTax', 'linked_refunds': 'CreditNoteLinkedRefund', 'allocations': 'CreditNoteAllocation', 'shipping_address': 'CreditNoteShippingAddress', 'billing_address': 'CreditNoteBillingAddress'}
);
return _credit_note;
}
get unbilled_charge(): resources.UnbilledCharge {
let _unbilled_charge = this.get(
'unbilled_charge',
'UnbilledCharge',
{'tiers': 'UnbilledChargeTier'}
);
return _unbilled_charge;
}
get order(): resources.Order {
let _order = this.get(
'order',
'Order',
{'order_line_items': 'OrderOrderLineItem', 'shipping_address': 'OrderShippingAddress', 'billing_address': 'OrderBillingAddress', 'line_item_taxes': 'OrderLineItemTax', 'line_item_discounts': 'OrderLineItemDiscount', 'linked_credit_notes': 'OrderLinkedCreditNote', 'resent_orders': 'OrderResentOrder'}
);
return _order;
}
get gift(): resources.Gift {
let _gift = this.get(
'gift',
'Gift',
{'gifter': 'GiftGifter', 'gift_receiver': 'GiftGiftReceiver', 'gift_timelines': 'GiftGiftTimeline'}
);
return _gift;
}
get transaction(): resources.Transaction {
let _transaction = this.get(
'transaction',
'Transaction',
{'linked_invoices': 'TransactionLinkedInvoice', 'linked_credit_notes': 'TransactionLinkedCreditNote', 'linked_refunds': 'TransactionLinkedRefund', 'linked_payments': 'TransactionLinkedPayment'}
);
return _transaction;
}
get hosted_page(): resources.HostedPage {
let _hosted_page = this.get(
'hosted_page',
'HostedPage'
);
return _hosted_page;
}
get estimate(): resources.Estimate {
let _estimate = this.get(
'estimate',
'Estimate',
{},
{'subscription_estimate': 'SubscriptionEstimate', 'subscription_estimates': 'SubscriptionEstimate', 'invoice_estimate': 'InvoiceEstimate', 'invoice_estimates': 'InvoiceEstimate', 'next_invoice_estimate': 'InvoiceEstimate', 'credit_note_estimates': 'CreditNoteEstimate', 'unbilled_charge_estimates': 'UnbilledCharge'}
);
_estimate.init_dependant(
this.response['estimate'],
'subscription_estimate',
{'shipping_address': 'SubscriptionEstimateShippingAddress', 'contract_term': 'SubscriptionEstimateContractTerm'}
);
_estimate.init_dependant(
this.response['estimate'],
'invoice_estimate',
{'line_items': 'InvoiceEstimateLineItem', 'discounts': 'InvoiceEstimateDiscount', 'taxes': 'InvoiceEstimateTax', 'line_item_taxes': 'InvoiceEstimateLineItemTax', 'line_item_tiers': 'InvoiceEstimateLineItemTier', 'line_item_discounts': 'InvoiceEstimateLineItemDiscount'}
);
_estimate.init_dependant(
this.response['estimate'],
'next_invoice_estimate',
{'line_items': 'InvoiceEstimateLineItem', 'discounts': 'InvoiceEstimateDiscount', 'taxes': 'InvoiceEstimateTax', 'line_item_taxes': 'InvoiceEstimateLineItemTax', 'line_item_tiers': 'InvoiceEstimateLineItemTier', 'line_item_discounts': 'InvoiceEstimateLineItemDiscount'}
);
_estimate.init_dependant_list(
this.response['estimate'],
'subscription_estimates',
{'shipping_address': 'SubscriptionEstimateShippingAddress', 'contract_term': 'SubscriptionEstimateContractTerm'}
);
_estimate.init_dependant_list(
this.response['estimate'],
'invoice_estimates',
{'line_items': 'InvoiceEstimateLineItem', 'discounts': 'InvoiceEstimateDiscount', 'taxes': 'InvoiceEstimateTax', 'line_item_taxes': 'InvoiceEstimateLineItemTax', 'line_item_tiers': 'InvoiceEstimateLineItemTier', 'line_item_discounts': 'InvoiceEstimateLineItemDiscount'}
);
_estimate.init_dependant_list(
this.response['estimate'],
'credit_note_estimates',
{'line_items': 'CreditNoteEstimateLineItem', 'discounts': 'CreditNoteEstimateDiscount', 'taxes': 'CreditNoteEstimateTax', 'line_item_taxes': 'CreditNoteEstimateLineItemTax', 'line_item_discounts': 'CreditNoteEstimateLineItemDiscount', 'line_item_tiers': 'CreditNoteEstimateLineItemTier'}
);
_estimate.init_dependant_list(
this.response['estimate'],
'unbilled_charge_estimates',
{'tiers': 'UnbilledChargeTier'}
);
return _estimate;
}
get quote(): resources.Quote {
let _quote = this.get(
'quote',
'Quote',
{'line_items': 'QuoteLineItem', 'discounts': 'QuoteDiscount', 'line_item_discounts': 'QuoteLineItemDiscount', 'taxes': 'QuoteTax', 'line_item_taxes': 'QuoteLineItemTax', 'line_item_tiers': 'QuoteLineItemTier', 'shipping_address': 'QuoteShippingAddress', 'billing_address': 'QuoteBillingAddress'}
);
return _quote;
}
get quoted_subscription(): resources.QuotedSubscription {
let _quoted_subscription = this.get(
'quoted_subscription',
'QuotedSubscription',
{'addons': 'QuotedSubscriptionAddon', 'event_based_addons': 'QuotedSubscriptionEventBasedAddon', 'coupons': 'QuotedSubscriptionCoupon', 'subscription_items': 'QuotedSubscriptionSubscriptionItem', 'item_tiers': 'QuotedSubscriptionItemTier', 'quoted_contract_term': 'QuotedSubscriptionQuotedContractTerm'}
);
return _quoted_subscription;
}
get quoted_charge(): resources.QuotedCharge {
let _quoted_charge = this.get(
'quoted_charge',
'QuotedCharge',
{'charges': 'QuotedChargeCharge', 'addons': 'QuotedChargeAddon', 'invoice_items': 'QuotedChargeInvoiceItem', 'item_tiers': 'QuotedChargeItemTier', 'coupons': 'QuotedChargeCoupon'}
);
return _quoted_charge;
}
get quote_line_group(): resources.QuoteLineGroup {
let _quote_line_group = this.get(
'quote_line_group',
'QuoteLineGroup',
{'line_items': 'QuoteLineGroupLineItem', 'discounts': 'QuoteLineGroupDiscount', 'line_item_discounts': 'QuoteLineGroupLineItemDiscount', 'taxes': 'QuoteLineGroupTax', 'line_item_taxes': 'QuoteLineGroupLineItemTax'}
);
return _quote_line_group;
}
get plan(): resources.Plan {
let _plan = this.get(
'plan',
'Plan',
{'tiers': 'PlanTier', 'applicable_addons': 'PlanApplicableAddon', 'attached_addons': 'PlanAttachedAddon', 'event_based_addons': 'PlanEventBasedAddon'}
);
return _plan;
}
get addon(): resources.Addon {
let _addon = this.get(
'addon',
'Addon',
{'tiers': 'AddonTier'}
);
return _addon;
}
get coupon(): resources.Coupon {
let _coupon = this.get(
'coupon',
'Coupon',
{'item_constraints': 'CouponItemConstraint', 'item_constraint_criteria': 'CouponItemConstraintCriteria', 'coupon_constraints': 'CouponCouponConstraint'}
);
return _coupon;
}
get coupon_set(): resources.CouponSet {
let _coupon_set = this.get(
'coupon_set',
'CouponSet'
);
return _coupon_set;
}
get coupon_code(): resources.CouponCode {
let _coupon_code = this.get(
'coupon_code',
'CouponCode'
);
return _coupon_code;
}
get address(): resources.Address {
let _address = this.get(
'address',
'Address'
);
return _address;
}
get usage(): resources.Usage {
let _usage = this.get(
'usage',
'Usage'
);
return _usage;
}
get event(): resources.Event {
let _event = this.get(
'event',
'Event',
{'webhooks': 'EventWebhook'}
);
return _event;
}
get comment(): resources.Comment {
let _comment = this.get(
'comment',
'Comment'
);
return _comment;
}
get download(): resources.Download {
let _download = this.get(
'download',
'Download'
);
return _download;
}
get portal_session(): resources.PortalSession {
let _portal_session = this.get(
'portal_session',
'PortalSession',
{'linked_customers': 'PortalSessionLinkedCustomer'}
);
return _portal_session;
}
get site_migration_detail(): resources.SiteMigrationDetail {
let _site_migration_detail = this.get(
'site_migration_detail',
'SiteMigrationDetail'
);
return _site_migration_detail;
}
get resource_migration(): resources.ResourceMigration {
let _resource_migration = this.get(
'resource_migration',
'ResourceMigration'
);
return _resource_migration;
}
get time_machine(): resources.TimeMachine {
let _time_machine = this.get(
'time_machine',
'TimeMachine'
);
return _time_machine;
}
get export(): resources.Export {
let _export = this.get(
'export',
'Export',
{'download': 'ExportDownload'}
);
return _export;
}
get payment_intent(): resources.PaymentIntent {
let _payment_intent = this.get(
'payment_intent',
'PaymentIntent',
{'payment_attempt': 'PaymentIntentPaymentAttempt'}
);
return _payment_intent;
}
get item_family(): resources.ItemFamily {
let _item_family = this.get(
'item_family',
'ItemFamily'
);
return _item_family;
}
get item(): resources.Item {
let _item = this.get(
'item',
'Item',
{'applicable_items': 'ItemApplicableItem'}
);
return _item;
}
get item_price(): resources.ItemPrice {
let _item_price = this.get(
'item_price',
'ItemPrice',
{'tiers': 'ItemPriceTier', 'tax_detail': 'ItemPriceTaxDetail', 'accounting_detail': 'ItemPriceAccountingDetail'}
);
return _item_price;
}
get attached_item(): resources.AttachedItem {
let _attached_item = this.get(
'attached_item',
'AttachedItem'
);
return _attached_item;
}
get differential_price(): resources.DifferentialPrice {
let _differential_price = this.get(
'differential_price',
'DifferentialPrice',
{'tiers': 'DifferentialPriceTier', 'parent_periods': 'DifferentialPriceParentPeriod'}
);
return _differential_price;
}
get feature(): resources.Feature {
let _feature = this.get(
'feature',
'Feature',
{'levels': 'FeatureLevel'}
);
return _feature;
}
get impacted_subscription(): resources.ImpactedSubscription {
let _impacted_subscription = this.get(
'impacted_subscription',
'ImpactedSubscription',
{'download': 'ImpactedSubscriptionDownload'}
);
return _impacted_subscription;
}
get impacted_item(): resources.ImpactedItem {
let _impacted_item = this.get(
'impacted_item',
'ImpactedItem',
{'download': 'ImpactedItemDownload'}
);
return _impacted_item;
}
get subscription_entitlement(): resources.SubscriptionEntitlement {
let _subscription_entitlement = this.get(
'subscription_entitlement',
'SubscriptionEntitlement',
{'component': 'SubscriptionEntitlementComponent'}
);
return _subscription_entitlement;
}
get item_entitlement(): resources.ItemEntitlement {
let _item_entitlement = this.get(
'item_entitlement',
'ItemEntitlement'
);
return _item_entitlement;
}
get in_app_subscription(): resources.InAppSubscription {
let _in_app_subscription = this.get(
'in_app_subscription',
'InAppSubscription'
);
return _in_app_subscription;
}
get non_subscription(): resources.NonSubscription {
let _non_subscription = this.get(
'non_subscription',
'NonSubscription'
);
return _non_subscription;
}
get entitlement_override(): resources.EntitlementOverride {
let _entitlement_override = this.get(
'entitlement_override',
'EntitlementOverride'
);
return _entitlement_override;
}
get purchase(): resources.Purchase {
let _purchase = this.get(
'purchase',
'Purchase'
);
return _purchase;
}
get payment_voucher(): resources.PaymentVoucher {
let _payment_voucher = this.get(
'payment_voucher',
'PaymentVoucher',
{'linked_invoices': 'PaymentVoucherLinkedInvoice'}
);
return _payment_voucher;
}
get unbilled_charges(): resources.UnbilledCharge[] {
let _unbilled_charges = this.get_list(
'unbilled_charges',
'UnbilledCharge',
{'tiers': 'UnbilledChargeTier'}
);
return _unbilled_charges;
}
get credit_notes(): resources.CreditNote[] {
let _credit_notes = this.get_list(
'credit_notes',
'CreditNote',
{'einvoice': 'CreditNoteEinvoice', 'line_items': 'CreditNoteLineItem', 'discounts': 'CreditNoteDiscount', 'line_item_discounts': 'CreditNoteLineItemDiscount', 'line_item_tiers': 'CreditNoteLineItemTier', 'taxes': 'CreditNoteTax', 'line_item_taxes': 'CreditNoteLineItemTax', 'linked_refunds': 'CreditNoteLinkedRefund', 'allocations': 'CreditNoteAllocation', 'shipping_address': 'CreditNoteShippingAddress', 'billing_address': 'CreditNoteBillingAddress'}
);
return _credit_notes;
}
get advance_invoice_schedules(): resources.AdvanceInvoiceSchedule[] {
let _advance_invoice_schedules = this.get_list(
'advance_invoice_schedules',
'AdvanceInvoiceSchedule',
{'fixed_interval_schedule': 'AdvanceInvoiceScheduleFixedIntervalSchedule', 'specific_dates_schedule': 'AdvanceInvoiceScheduleSpecificDatesSchedule'}
);
return _advance_invoice_schedules;
}
get hierarchies(): resources.Hierarchy[] {
let _hierarchies = this.get_list(
'hierarchies',
'Hierarchy',
{}
);
return _hierarchies;
}
get downloads(): resources.Download[] {
let _downloads = this.get_list(
'downloads',
'Download',
{}
);
return _downloads;
}
get invoices(): resources.Invoice[] {
let _invoices = this.get_list(
'invoices',
'Invoice',
{'line_items': 'InvoiceLineItem', 'discounts': 'InvoiceDiscount', 'line_item_discounts': 'InvoiceLineItemDiscount', 'taxes': 'InvoiceTax', 'line_item_taxes': 'InvoiceLineItemTax', 'line_item_tiers': 'InvoiceLineItemTier', 'linked_payments': 'InvoiceLinkedPayment', 'dunning_attempts': 'InvoiceDunningAttempt', 'applied_credits': 'InvoiceAppliedCredit', 'adjustment_credit_notes': 'InvoiceAdjustmentCreditNote', 'issued_credit_notes': 'InvoiceIssuedCreditNote', 'linked_orders': 'InvoiceLinkedOrder', 'notes': 'InvoiceNote', 'shipping_address': 'InvoiceShippingAddress', 'billing_address': 'InvoiceBillingAddress', 'einvoice': 'InvoiceEinvoice'}
);
return _invoices;
}
get differential_prices(): resources.DifferentialPrice[] {
let _differential_prices = this.get_list(
'differential_prices',
'DifferentialPrice',
{'tiers': 'DifferentialPriceTier', 'parent_periods': 'DifferentialPriceParentPeriod'}
);
return _differential_prices;
}
get in_app_subscriptions(): resources.InAppSubscription[] {
let _in_app_subscriptions = this.get_list(
'in_app_subscriptions',
'InAppSubscription',
{}
);
return _in_app_subscriptions;
}
get response() {
return this.#_response;
}
constructor(response, responseHeaders?) {
this.#_response = response;
if (responseHeaders) {
this.responseHeaders = responseHeaders;
}
}
getResponseHeaders(){
return this.responseHeaders;
}
isIdempotencyReplayed(): boolean {
const headers = this.responseHeaders;
const replayedHeader = headers[IdempotencyConstants.IDEMPOTENCY_REPLAY_HEADER];
if (replayedHeader === undefined) {
return false;
}
return Boolean(replayedHeader);
}
private get<T = any>(type, klass, sub_types = {}, dependant_types = {}): T {
return new (resources)[klass](this.response[type], sub_types, dependant_types)
}
private get_list<T = any>(type, klass, sub_types = {}, dependant_types = {}, dependant_sub_types = {}): T[] {
if(Util.isEmptyObject(this.response) || Util.isEmptyObject(this.response[type])) {
return null;
}
let set_val = [];
for(let obj of this.response[type]) {
let model = new (resources)[klass](obj, sub_types, dependant_types);
for(let k in dependant_sub_types) {
let v = dependant_sub_types[k];
model.init_dependant(obj, k, v);
}
set_val.push(model);
}
return set_val;
}
private toString(...args) {
return JSON.stringify(this.response, null, 2);
}
}