@flexprice/sdk 1.0.1 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/LICENSE +663 -0
  2. package/dist/ApiClient.js +455 -505
  3. package/dist/api/AuthApi.js +56 -72
  4. package/dist/api/CustomersApi.js +273 -301
  5. package/dist/api/EntitlementsApi.js +200 -224
  6. package/dist/api/EnvironmentsApi.js +129 -149
  7. package/dist/api/EventsApi.js +151 -184
  8. package/dist/api/FeaturesApi.js +167 -189
  9. package/dist/api/IntegrationsApi.js +121 -141
  10. package/dist/api/InvoicesApi.js +352 -377
  11. package/dist/api/PaymentsApi.js +202 -226
  12. package/dist/api/PlansApi.js +165 -187
  13. package/dist/api/PricesApi.js +166 -188
  14. package/dist/api/SecretsApi.js +88 -106
  15. package/dist/api/SubscriptionsApi.js +277 -307
  16. package/dist/api/TasksApi.js +168 -190
  17. package/dist/api/TenantsApi.js +114 -134
  18. package/dist/api/UsersApi.js +22 -36
  19. package/dist/api/WalletsApi.js +330 -322
  20. package/dist/index.js +1029 -1153
  21. package/dist/model/DtoAddress.js +67 -84
  22. package/dist/model/DtoAggregatedEntitlement.js +48 -65
  23. package/dist/model/DtoAggregatedFeature.js +60 -89
  24. package/dist/model/DtoAuthResponse.js +49 -66
  25. package/dist/model/DtoBillingPeriodInfo.js +49 -66
  26. package/dist/model/DtoBulkIngestEventRequest.js +49 -88
  27. package/dist/model/DtoCreateAPIKeyRequest.js +59 -89
  28. package/dist/model/DtoCreateAPIKeyResponse.js +44 -61
  29. package/dist/model/DtoCreateCustomerRequest.js +95 -125
  30. package/dist/model/DtoCreateEntitlementRequest.js +72 -102
  31. package/dist/model/DtoCreateEnvironmentRequest.js +49 -79
  32. package/dist/model/DtoCreateFeatureRequest.js +96 -112
  33. package/dist/model/DtoCreateIntegrationRequest.js +52 -82
  34. package/dist/model/DtoCreateInvoiceLineItemRequest.js +104 -136
  35. package/dist/model/DtoCreateInvoiceRequest.js +152 -179
  36. package/dist/model/DtoCreateMeterRequest.js +78 -117
  37. package/dist/model/DtoCreatePaymentRequest.js +84 -114
  38. package/dist/model/DtoCreatePlanEntitlementRequest.js +72 -102
  39. package/dist/model/DtoCreatePlanPriceRequest.js +141 -180
  40. package/dist/model/DtoCreatePlanRequest.js +83 -131
  41. package/dist/model/DtoCreatePriceRequest.js +141 -180
  42. package/dist/model/DtoCreatePriceTier.js +51 -81
  43. package/dist/model/DtoCreateSubscriptionRequest.js +115 -136
  44. package/dist/model/DtoCreateTaskRequest.js +68 -98
  45. package/dist/model/DtoCreateTenantRequest.js +50 -80
  46. package/dist/model/DtoCreateWalletRequest.js +110 -121
  47. package/dist/model/DtoCustomerEntitlementsResponse.js +49 -78
  48. package/dist/model/DtoCustomerInvoiceSummary.js +66 -83
  49. package/dist/model/DtoCustomerMultiCurrencyInvoiceSummary.js +56 -85
  50. package/dist/model/DtoCustomerResponse.js +135 -152
  51. package/dist/model/DtoCustomerUsageSummaryResponse.js +67 -96
  52. package/dist/model/DtoEntitlementResponse.js +127 -144
  53. package/dist/model/DtoEntitlementSource.js +69 -86
  54. package/dist/model/DtoEnvironmentResponse.js +61 -78
  55. package/dist/model/DtoEvent.js +83 -88
  56. package/dist/model/DtoFeatureResponse.js +129 -146
  57. package/dist/model/DtoFeatureUsageSummary.js +66 -95
  58. package/dist/model/DtoGetEventsRequest.js +193 -0
  59. package/dist/model/DtoGetEventsResponse.js +75 -88
  60. package/dist/model/DtoGetPreviewInvoiceRequest.js +55 -85
  61. package/dist/model/DtoGetUsageByMeterRequest.js +75 -105
  62. package/dist/model/DtoGetUsageBySubscriptionRequest.js +57 -87
  63. package/dist/model/DtoGetUsageBySubscriptionResponse.js +72 -101
  64. package/dist/model/DtoGetUsageRequest.js +86 -116
  65. package/dist/model/DtoGetUsageResponse.js +56 -85
  66. package/dist/model/DtoIngestEventRequest.js +78 -108
  67. package/dist/model/DtoInvoiceLineItemResponse.js +161 -178
  68. package/dist/model/DtoInvoiceResponse.js +250 -279
  69. package/dist/model/DtoLinkedIntegrationsResponse.js +35 -52
  70. package/dist/model/DtoListCustomersResponse.js +51 -80
  71. package/dist/model/DtoListEntitlementsResponse.js +51 -80
  72. package/dist/model/DtoListEnvironmentsResponse.js +52 -81
  73. package/dist/model/DtoListFeaturesResponse.js +51 -80
  74. package/dist/model/DtoListInvoicesResponse.js +51 -80
  75. package/dist/model/DtoListPaymentsResponse.js +51 -80
  76. package/dist/model/DtoListPlansResponse.js +51 -80
  77. package/dist/model/DtoListPricesResponse.js +51 -80
  78. package/dist/model/DtoListSecretsResponse.js +51 -80
  79. package/dist/model/DtoListSubscriptionPausesResponse.js +46 -75
  80. package/dist/model/DtoListSubscriptionsResponse.js +51 -80
  81. package/dist/model/DtoListTasksResponse.js +51 -80
  82. package/dist/model/DtoListWalletTransactionsResponse.js +51 -80
  83. package/dist/model/DtoLoginRequest.js +56 -86
  84. package/dist/model/DtoMeterResponse.js +99 -128
  85. package/dist/model/DtoPauseSubscriptionRequest.js +69 -99
  86. package/dist/model/DtoPaymentAttemptResponse.js +86 -103
  87. package/dist/model/DtoPaymentResponse.js +164 -181
  88. package/dist/model/DtoPlanResponse.js +124 -162
  89. package/dist/model/DtoPriceResponse.js +182 -221
  90. package/dist/model/DtoResumeSubscriptionRequest.js +46 -76
  91. package/dist/model/DtoSecretResponse.js +91 -108
  92. package/dist/model/DtoSignUpRequest.js +61 -91
  93. package/dist/model/DtoSubscriptionPauseResponse.js +135 -152
  94. package/dist/model/DtoSubscriptionResponse.js +270 -299
  95. package/dist/model/DtoSubscriptionUsageByMetersResponse.js +73 -90
  96. package/dist/model/DtoTaskResponse.js +141 -158
  97. package/dist/model/DtoTenantBillingDetails.js +57 -74
  98. package/dist/model/DtoTenantBillingUsage.js +51 -80
  99. package/dist/model/DtoTenantResponse.js +69 -86
  100. package/dist/model/DtoTopUpWalletRequest.js +89 -126
  101. package/dist/model/DtoUpdateCustomerRequest.js +89 -106
  102. package/dist/model/DtoUpdateEntitlementRequest.js +48 -65
  103. package/dist/model/DtoUpdateEnvironmentRequest.js +42 -59
  104. package/dist/model/DtoUpdateFeatureRequest.js +80 -76
  105. package/dist/model/DtoUpdatePaymentRequest.js +40 -57
  106. package/dist/model/DtoUpdatePaymentStatusRequest.js +41 -71
  107. package/dist/model/DtoUpdatePlanEntitlementRequest.js +78 -108
  108. package/dist/model/DtoUpdatePlanPriceRequest.js +147 -186
  109. package/dist/model/DtoUpdatePlanRequest.js +77 -115
  110. package/dist/model/DtoUpdatePriceRequest.js +47 -64
  111. package/dist/model/DtoUpdateTaskStatusRequest.js +38 -68
  112. package/dist/model/DtoUpdateTenantRequest.js +49 -54
  113. package/dist/model/DtoUpdateWalletRequest.js +65 -82
  114. package/dist/model/DtoUsageResult.js +38 -55
  115. package/dist/model/DtoUserResponse.js +51 -68
  116. package/dist/model/DtoWalletBalanceResponse.js +159 -176
  117. package/dist/model/DtoWalletResponse.js +120 -137
  118. package/dist/model/DtoWalletTransactionResponse.js +111 -128
  119. package/dist/model/ErrorsErrorDetail.js +47 -64
  120. package/dist/model/ErrorsErrorResponse.js +40 -57
  121. package/dist/model/MeterAggregation.js +39 -56
  122. package/dist/model/MeterFilter.js +42 -59
  123. package/dist/model/PriceJSONBTransformQuantity.js +38 -55
  124. package/dist/model/PricePrice.js +173 -212
  125. package/dist/model/PricePriceTier.js +38 -55
  126. package/dist/model/PriceTransformQuantity.js +38 -55
  127. package/dist/model/SubscriptionSubscriptionLineItem.js +165 -182
  128. package/dist/model/SubscriptionSubscriptionPause.js +135 -152
  129. package/dist/model/TypesAggregationType.js +36 -51
  130. package/dist/model/TypesAutoTopupTrigger.js +24 -41
  131. package/dist/model/TypesBillingCadence.js +24 -41
  132. package/dist/model/TypesBillingCycle.js +41 -0
  133. package/dist/model/TypesBillingModel.js +30 -46
  134. package/dist/model/TypesBillingPeriod.js +48 -61
  135. package/dist/model/TypesBillingTier.js +24 -41
  136. package/dist/model/TypesEntityType.js +30 -46
  137. package/dist/model/TypesFeatureType.js +30 -46
  138. package/dist/model/TypesFileType.js +24 -41
  139. package/dist/model/TypesInvoiceBillingReason.js +36 -51
  140. package/dist/model/TypesInvoiceCadence.js +24 -41
  141. package/dist/model/TypesInvoiceStatus.js +30 -46
  142. package/dist/model/TypesInvoiceType.js +30 -46
  143. package/dist/model/TypesPaginationResponse.js +38 -55
  144. package/dist/model/TypesPauseMode.js +30 -46
  145. package/dist/model/TypesPauseStatus.js +42 -56
  146. package/dist/model/TypesPaymentDestinationType.js +18 -36
  147. package/dist/model/TypesPaymentMethodType.js +36 -51
  148. package/dist/model/TypesPaymentStatus.js +48 -61
  149. package/dist/model/TypesPriceType.js +24 -41
  150. package/dist/model/TypesResetUsage.js +24 -41
  151. package/dist/model/TypesResumeMode.js +30 -46
  152. package/dist/model/TypesSecretProvider.js +30 -46
  153. package/dist/model/TypesSecretType.js +30 -46
  154. package/dist/model/TypesStatus.js +30 -46
  155. package/dist/model/TypesSubscriptionStatus.js +60 -71
  156. package/dist/model/TypesTaskStatus.js +36 -51
  157. package/dist/model/TypesTaskType.js +24 -41
  158. package/dist/model/TypesTransactionReason.js +60 -71
  159. package/dist/model/TypesTransactionStatus.js +30 -46
  160. package/dist/model/TypesTransactionType.js +24 -41
  161. package/dist/model/TypesWalletConfig.js +36 -53
  162. package/dist/model/TypesWalletConfigPriceType.js +30 -46
  163. package/dist/model/TypesWalletStatus.js +30 -46
  164. package/dist/model/TypesWalletTxReferenceType.js +30 -51
  165. package/dist/model/TypesWalletType.js +24 -41
  166. package/dist/model/TypesWindowSize.js +30 -46
  167. package/package.json +1 -1
  168. package/dist/api/MetersApi.js +0 -287
  169. package/dist/model/DtoUpdateMeterRequest.js +0 -110
@@ -1,20 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
9
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
11
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
15
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
16
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
17
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
1
+ /**
18
2
  * FlexPrice API
19
3
  * FlexPrice API Service
20
4
  *
@@ -26,22 +10,23 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
26
10
  * Do not edit the class manually.
27
11
  *
28
12
  */
13
+
14
+ import ApiClient from '../ApiClient';
15
+
29
16
  /**
30
17
  * The DtoCreateInvoiceLineItemRequest model module.
31
18
  * @module model/DtoCreateInvoiceLineItemRequest
32
19
  * @version 1.0
33
20
  */
34
- var DtoCreateInvoiceLineItemRequest = /*#__PURE__*/function () {
21
+ class DtoCreateInvoiceLineItemRequest {
35
22
  /**
36
23
  * Constructs a new <code>DtoCreateInvoiceLineItemRequest</code>.
37
24
  * @alias module:model/DtoCreateInvoiceLineItemRequest
38
25
  * @param amount {Number}
39
- * @param priceId {String}
40
26
  * @param quantity {Number}
41
27
  */
42
- function DtoCreateInvoiceLineItemRequest(amount, priceId, quantity) {
43
- _classCallCheck(this, DtoCreateInvoiceLineItemRequest);
44
- DtoCreateInvoiceLineItemRequest.initialize(this, amount, priceId, quantity);
28
+ constructor(amount, quantity) {
29
+ DtoCreateInvoiceLineItemRequest.initialize(this, amount, quantity);
45
30
  }
46
31
 
47
32
  /**
@@ -49,132 +34,115 @@ var DtoCreateInvoiceLineItemRequest = /*#__PURE__*/function () {
49
34
  * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
50
35
  * Only for internal use.
51
36
  */
52
- return _createClass(DtoCreateInvoiceLineItemRequest, null, [{
53
- key: "initialize",
54
- value: function initialize(obj, amount, priceId, quantity) {
55
- obj['amount'] = amount;
56
- obj['price_id'] = priceId;
57
- obj['quantity'] = quantity;
58
- }
37
+ static initialize(obj, amount, quantity) {
38
+ obj['amount'] = amount;
39
+ obj['quantity'] = quantity;
40
+ }
59
41
 
60
- /**
61
- * Constructs a <code>DtoCreateInvoiceLineItemRequest</code> from a plain JavaScript object, optionally creating a new instance.
62
- * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
63
- * @param {Object} data The plain JavaScript object bearing properties of interest.
64
- * @param {module:model/DtoCreateInvoiceLineItemRequest} obj Optional instance to populate.
65
- * @return {module:model/DtoCreateInvoiceLineItemRequest} The populated <code>DtoCreateInvoiceLineItemRequest</code> instance.
66
- */
67
- }, {
68
- key: "constructFromObject",
69
- value: function constructFromObject(data, obj) {
70
- if (data) {
71
- obj = obj || new DtoCreateInvoiceLineItemRequest();
72
- if (data.hasOwnProperty('amount')) {
73
- obj['amount'] = _ApiClient["default"].convertToType(data['amount'], 'Number');
74
- }
75
- if (data.hasOwnProperty('display_name')) {
76
- obj['display_name'] = _ApiClient["default"].convertToType(data['display_name'], 'String');
77
- }
78
- if (data.hasOwnProperty('metadata')) {
79
- obj['metadata'] = _ApiClient["default"].convertToType(data['metadata'], {
80
- 'String': 'String'
81
- });
82
- }
83
- if (data.hasOwnProperty('meter_display_name')) {
84
- obj['meter_display_name'] = _ApiClient["default"].convertToType(data['meter_display_name'], 'String');
85
- }
86
- if (data.hasOwnProperty('meter_id')) {
87
- obj['meter_id'] = _ApiClient["default"].convertToType(data['meter_id'], 'String');
88
- }
89
- if (data.hasOwnProperty('period_end')) {
90
- obj['period_end'] = _ApiClient["default"].convertToType(data['period_end'], 'String');
91
- }
92
- if (data.hasOwnProperty('period_start')) {
93
- obj['period_start'] = _ApiClient["default"].convertToType(data['period_start'], 'String');
94
- }
95
- if (data.hasOwnProperty('plan_display_name')) {
96
- obj['plan_display_name'] = _ApiClient["default"].convertToType(data['plan_display_name'], 'String');
97
- }
98
- if (data.hasOwnProperty('plan_id')) {
99
- obj['plan_id'] = _ApiClient["default"].convertToType(data['plan_id'], 'String');
100
- }
101
- if (data.hasOwnProperty('price_id')) {
102
- obj['price_id'] = _ApiClient["default"].convertToType(data['price_id'], 'String');
103
- }
104
- if (data.hasOwnProperty('price_type')) {
105
- obj['price_type'] = _ApiClient["default"].convertToType(data['price_type'], 'String');
106
- }
107
- if (data.hasOwnProperty('quantity')) {
108
- obj['quantity'] = _ApiClient["default"].convertToType(data['quantity'], 'Number');
109
- }
42
+ /**
43
+ * Constructs a <code>DtoCreateInvoiceLineItemRequest</code> from a plain JavaScript object, optionally creating a new instance.
44
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
45
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
46
+ * @param {module:model/DtoCreateInvoiceLineItemRequest} obj Optional instance to populate.
47
+ * @return {module:model/DtoCreateInvoiceLineItemRequest} The populated <code>DtoCreateInvoiceLineItemRequest</code> instance.
48
+ */
49
+ static constructFromObject(data, obj) {
50
+ if (data) {
51
+ obj = obj || new DtoCreateInvoiceLineItemRequest();
52
+ if (data.hasOwnProperty('amount')) {
53
+ obj['amount'] = ApiClient.convertToType(data['amount'], 'Number');
110
54
  }
111
- return obj;
112
- }
113
-
114
- /**
115
- * Validates the JSON data with respect to <code>DtoCreateInvoiceLineItemRequest</code>.
116
- * @param {Object} data The plain JavaScript object bearing properties of interest.
117
- * @return {boolean} to indicate whether the JSON data is valid with respect to <code>DtoCreateInvoiceLineItemRequest</code>.
118
- */
119
- }, {
120
- key: "validateJSON",
121
- value: function validateJSON(data) {
122
- // check to make sure all required properties are present in the JSON string
123
- var _iterator = _createForOfIteratorHelper(DtoCreateInvoiceLineItemRequest.RequiredProperties),
124
- _step;
125
- try {
126
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
127
- var property = _step.value;
128
- if (!data.hasOwnProperty(property)) {
129
- throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
130
- }
131
- }
132
- // ensure the json data is a string
133
- } catch (err) {
134
- _iterator.e(err);
135
- } finally {
136
- _iterator.f();
55
+ if (data.hasOwnProperty('display_name')) {
56
+ obj['display_name'] = ApiClient.convertToType(data['display_name'], 'String');
57
+ }
58
+ if (data.hasOwnProperty('metadata')) {
59
+ obj['metadata'] = ApiClient.convertToType(data['metadata'], {
60
+ 'String': 'String'
61
+ });
137
62
  }
138
- if (data['display_name'] && !(typeof data['display_name'] === 'string' || data['display_name'] instanceof String)) {
139
- throw new Error("Expected the field `display_name` to be a primitive type in the JSON string but got " + data['display_name']);
63
+ if (data.hasOwnProperty('meter_display_name')) {
64
+ obj['meter_display_name'] = ApiClient.convertToType(data['meter_display_name'], 'String');
140
65
  }
141
- // ensure the json data is a string
142
- if (data['meter_display_name'] && !(typeof data['meter_display_name'] === 'string' || data['meter_display_name'] instanceof String)) {
143
- throw new Error("Expected the field `meter_display_name` to be a primitive type in the JSON string but got " + data['meter_display_name']);
66
+ if (data.hasOwnProperty('meter_id')) {
67
+ obj['meter_id'] = ApiClient.convertToType(data['meter_id'], 'String');
144
68
  }
145
- // ensure the json data is a string
146
- if (data['meter_id'] && !(typeof data['meter_id'] === 'string' || data['meter_id'] instanceof String)) {
147
- throw new Error("Expected the field `meter_id` to be a primitive type in the JSON string but got " + data['meter_id']);
69
+ if (data.hasOwnProperty('period_end')) {
70
+ obj['period_end'] = ApiClient.convertToType(data['period_end'], 'String');
148
71
  }
149
- // ensure the json data is a string
150
- if (data['period_end'] && !(typeof data['period_end'] === 'string' || data['period_end'] instanceof String)) {
151
- throw new Error("Expected the field `period_end` to be a primitive type in the JSON string but got " + data['period_end']);
72
+ if (data.hasOwnProperty('period_start')) {
73
+ obj['period_start'] = ApiClient.convertToType(data['period_start'], 'String');
152
74
  }
153
- // ensure the json data is a string
154
- if (data['period_start'] && !(typeof data['period_start'] === 'string' || data['period_start'] instanceof String)) {
155
- throw new Error("Expected the field `period_start` to be a primitive type in the JSON string but got " + data['period_start']);
75
+ if (data.hasOwnProperty('plan_display_name')) {
76
+ obj['plan_display_name'] = ApiClient.convertToType(data['plan_display_name'], 'String');
156
77
  }
157
- // ensure the json data is a string
158
- if (data['plan_display_name'] && !(typeof data['plan_display_name'] === 'string' || data['plan_display_name'] instanceof String)) {
159
- throw new Error("Expected the field `plan_display_name` to be a primitive type in the JSON string but got " + data['plan_display_name']);
78
+ if (data.hasOwnProperty('plan_id')) {
79
+ obj['plan_id'] = ApiClient.convertToType(data['plan_id'], 'String');
160
80
  }
161
- // ensure the json data is a string
162
- if (data['plan_id'] && !(typeof data['plan_id'] === 'string' || data['plan_id'] instanceof String)) {
163
- throw new Error("Expected the field `plan_id` to be a primitive type in the JSON string but got " + data['plan_id']);
81
+ if (data.hasOwnProperty('price_id')) {
82
+ obj['price_id'] = ApiClient.convertToType(data['price_id'], 'String');
164
83
  }
165
- // ensure the json data is a string
166
- if (data['price_id'] && !(typeof data['price_id'] === 'string' || data['price_id'] instanceof String)) {
167
- throw new Error("Expected the field `price_id` to be a primitive type in the JSON string but got " + data['price_id']);
84
+ if (data.hasOwnProperty('price_type')) {
85
+ obj['price_type'] = ApiClient.convertToType(data['price_type'], 'String');
168
86
  }
169
- // ensure the json data is a string
170
- if (data['price_type'] && !(typeof data['price_type'] === 'string' || data['price_type'] instanceof String)) {
171
- throw new Error("Expected the field `price_type` to be a primitive type in the JSON string but got " + data['price_type']);
87
+ if (data.hasOwnProperty('quantity')) {
88
+ obj['quantity'] = ApiClient.convertToType(data['quantity'], 'Number');
89
+ }
90
+ }
91
+ return obj;
92
+ }
93
+
94
+ /**
95
+ * Validates the JSON data with respect to <code>DtoCreateInvoiceLineItemRequest</code>.
96
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
97
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>DtoCreateInvoiceLineItemRequest</code>.
98
+ */
99
+ static validateJSON(data) {
100
+ // check to make sure all required properties are present in the JSON string
101
+ for (const property of DtoCreateInvoiceLineItemRequest.RequiredProperties) {
102
+ if (!data.hasOwnProperty(property)) {
103
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
172
104
  }
173
- return true;
174
105
  }
175
- }]);
176
- }();
177
- DtoCreateInvoiceLineItemRequest.RequiredProperties = ["amount", "price_id", "quantity"];
106
+ // ensure the json data is a string
107
+ if (data['display_name'] && !(typeof data['display_name'] === 'string' || data['display_name'] instanceof String)) {
108
+ throw new Error("Expected the field `display_name` to be a primitive type in the JSON string but got " + data['display_name']);
109
+ }
110
+ // ensure the json data is a string
111
+ if (data['meter_display_name'] && !(typeof data['meter_display_name'] === 'string' || data['meter_display_name'] instanceof String)) {
112
+ throw new Error("Expected the field `meter_display_name` to be a primitive type in the JSON string but got " + data['meter_display_name']);
113
+ }
114
+ // ensure the json data is a string
115
+ if (data['meter_id'] && !(typeof data['meter_id'] === 'string' || data['meter_id'] instanceof String)) {
116
+ throw new Error("Expected the field `meter_id` to be a primitive type in the JSON string but got " + data['meter_id']);
117
+ }
118
+ // ensure the json data is a string
119
+ if (data['period_end'] && !(typeof data['period_end'] === 'string' || data['period_end'] instanceof String)) {
120
+ throw new Error("Expected the field `period_end` to be a primitive type in the JSON string but got " + data['period_end']);
121
+ }
122
+ // ensure the json data is a string
123
+ if (data['period_start'] && !(typeof data['period_start'] === 'string' || data['period_start'] instanceof String)) {
124
+ throw new Error("Expected the field `period_start` to be a primitive type in the JSON string but got " + data['period_start']);
125
+ }
126
+ // ensure the json data is a string
127
+ if (data['plan_display_name'] && !(typeof data['plan_display_name'] === 'string' || data['plan_display_name'] instanceof String)) {
128
+ throw new Error("Expected the field `plan_display_name` to be a primitive type in the JSON string but got " + data['plan_display_name']);
129
+ }
130
+ // ensure the json data is a string
131
+ if (data['plan_id'] && !(typeof data['plan_id'] === 'string' || data['plan_id'] instanceof String)) {
132
+ throw new Error("Expected the field `plan_id` to be a primitive type in the JSON string but got " + data['plan_id']);
133
+ }
134
+ // ensure the json data is a string
135
+ if (data['price_id'] && !(typeof data['price_id'] === 'string' || data['price_id'] instanceof String)) {
136
+ throw new Error("Expected the field `price_id` to be a primitive type in the JSON string but got " + data['price_id']);
137
+ }
138
+ // ensure the json data is a string
139
+ if (data['price_type'] && !(typeof data['price_type'] === 'string' || data['price_type'] instanceof String)) {
140
+ throw new Error("Expected the field `price_type` to be a primitive type in the JSON string but got " + data['price_type']);
141
+ }
142
+ return true;
143
+ }
144
+ }
145
+ DtoCreateInvoiceLineItemRequest.RequiredProperties = ["amount", "quantity"];
178
146
 
179
147
  /**
180
148
  * @member {Number} amount
@@ -235,4 +203,4 @@ DtoCreateInvoiceLineItemRequest.prototype['price_type'] = undefined;
235
203
  * @member {Number} quantity
236
204
  */
237
205
  DtoCreateInvoiceLineItemRequest.prototype['quantity'] = undefined;
238
- var _default = exports["default"] = DtoCreateInvoiceLineItemRequest;
206
+ export default DtoCreateInvoiceLineItemRequest;