vayu-ts 0.1.4 → 0.2.3

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 (158) hide show
  1. package/dist/openapi-v2/apis/AuthenticationApi.d.ts +24 -0
  2. package/dist/openapi-v2/apis/AuthenticationApi.js +79 -0
  3. package/dist/openapi-v2/apis/CustomersApi.d.ts +92 -0
  4. package/dist/openapi-v2/apis/CustomersApi.js +362 -0
  5. package/dist/openapi-v2/apis/EntitlementsApi.d.ts +49 -0
  6. package/dist/openapi-v2/apis/EntitlementsApi.js +176 -0
  7. package/dist/openapi-v2/apis/EventsApi.d.ts +63 -0
  8. package/dist/openapi-v2/apis/EventsApi.js +231 -0
  9. package/dist/openapi-v2/apis/InvoicesApi.d.ts +88 -0
  10. package/dist/openapi-v2/apis/InvoicesApi.js +344 -0
  11. package/dist/openapi-v2/apis/ProductsApi.d.ts +76 -0
  12. package/dist/openapi-v2/apis/ProductsApi.js +295 -0
  13. package/dist/openapi-v2/apis/baseapi.d.ts +33 -0
  14. package/dist/openapi-v2/apis/baseapi.js +41 -0
  15. package/dist/openapi-v2/apis/exception.d.ts +19 -0
  16. package/dist/openapi-v2/apis/exception.js +22 -0
  17. package/dist/openapi-v2/auth/auth.d.ts +38 -0
  18. package/dist/openapi-v2/auth/auth.js +16 -0
  19. package/dist/openapi-v2/configuration.d.ts +63 -0
  20. package/dist/openapi-v2/configuration.js +34 -0
  21. package/dist/openapi-v2/http/http.d.ts +142 -0
  22. package/dist/openapi-v2/http/http.js +229 -0
  23. package/dist/openapi-v2/http/isomorphic-fetch.d.ts +5 -0
  24. package/dist/openapi-v2/http/isomorphic-fetch.js +33 -0
  25. package/dist/openapi-v2/index.d.ts +10 -0
  26. package/dist/openapi-v2/index.js +33 -0
  27. package/dist/openapi-v2/middleware.d.ts +54 -0
  28. package/dist/openapi-v2/middleware.js +16 -0
  29. package/dist/openapi-v2/models/APICreateCustomerPayload.d.ts +45 -0
  30. package/dist/openapi-v2/models/APICreateCustomerPayload.js +49 -0
  31. package/dist/openapi-v2/models/APICreateInvoicePayload.d.ts +41 -0
  32. package/dist/openapi-v2/models/APICreateInvoicePayload.js +49 -0
  33. package/dist/openapi-v2/models/APICreateProductPayload.d.ts +43 -0
  34. package/dist/openapi-v2/models/APICreateProductPayload.js +55 -0
  35. package/dist/openapi-v2/models/APICustomer.d.ts +64 -0
  36. package/dist/openapi-v2/models/APICustomer.js +76 -0
  37. package/dist/openapi-v2/models/APIEntitlement.d.ts +56 -0
  38. package/dist/openapi-v2/models/APIEntitlement.js +79 -0
  39. package/dist/openapi-v2/models/APIEvent.d.ts +72 -0
  40. package/dist/openapi-v2/models/APIEvent.js +88 -0
  41. package/dist/openapi-v2/models/APIIngestEventPayload.d.ts +49 -0
  42. package/dist/openapi-v2/models/APIIngestEventPayload.js +55 -0
  43. package/dist/openapi-v2/models/APIInvoice.d.ts +71 -0
  44. package/dist/openapi-v2/models/APIInvoice.js +88 -0
  45. package/dist/openapi-v2/models/APIInvoiceBillingPeriod.d.ts +38 -0
  46. package/dist/openapi-v2/models/APIInvoiceBillingPeriod.js +40 -0
  47. package/dist/openapi-v2/models/APIProduct.d.ts +62 -0
  48. package/dist/openapi-v2/models/APIProduct.js +82 -0
  49. package/dist/openapi-v2/models/APIQueryPayloadAPICustomer.d.ts +43 -0
  50. package/dist/openapi-v2/models/APIQueryPayloadAPICustomer.js +49 -0
  51. package/dist/openapi-v2/models/APIQueryPayloadAPIEntitlement.d.ts +43 -0
  52. package/dist/openapi-v2/models/APIQueryPayloadAPIEntitlement.js +49 -0
  53. package/dist/openapi-v2/models/APIQueryPayloadAPIEvent.d.ts +43 -0
  54. package/dist/openapi-v2/models/APIQueryPayloadAPIEvent.js +49 -0
  55. package/dist/openapi-v2/models/APIQueryPayloadAPIInvoice.d.ts +43 -0
  56. package/dist/openapi-v2/models/APIQueryPayloadAPIInvoice.js +49 -0
  57. package/dist/openapi-v2/models/APIQueryPayloadAPIProduct.d.ts +43 -0
  58. package/dist/openapi-v2/models/APIQueryPayloadAPIProduct.js +49 -0
  59. package/dist/openapi-v2/models/APIUpdateCustomerPayload.d.ts +45 -0
  60. package/dist/openapi-v2/models/APIUpdateCustomerPayload.js +49 -0
  61. package/dist/openapi-v2/models/APIUpdateInvoicePayload.d.ts +41 -0
  62. package/dist/openapi-v2/models/APIUpdateInvoicePayload.js +49 -0
  63. package/dist/openapi-v2/models/APIUpdateProductPayload.d.ts +43 -0
  64. package/dist/openapi-v2/models/APIUpdateProductPayload.js +55 -0
  65. package/dist/openapi-v2/models/Aggregation.d.ts +32 -0
  66. package/dist/openapi-v2/models/Aggregation.js +43 -0
  67. package/dist/openapi-v2/models/AggregationMethods.d.ts +18 -0
  68. package/dist/openapi-v2/models/AggregationMethods.js +22 -0
  69. package/dist/openapi-v2/models/Condition.d.ts +29 -0
  70. package/dist/openapi-v2/models/Condition.js +31 -0
  71. package/dist/openapi-v2/models/Criterion.d.ts +32 -0
  72. package/dist/openapi-v2/models/Criterion.js +43 -0
  73. package/dist/openapi-v2/models/CriterionOperators.d.ts +23 -0
  74. package/dist/openapi-v2/models/CriterionOperators.js +27 -0
  75. package/dist/openapi-v2/models/CriterionValue.d.ts +27 -0
  76. package/dist/openapi-v2/models/CriterionValue.js +24 -0
  77. package/dist/openapi-v2/models/EntitlementRevision.d.ts +36 -0
  78. package/dist/openapi-v2/models/EntitlementRevision.js +55 -0
  79. package/dist/openapi-v2/models/Event.d.ts +54 -0
  80. package/dist/openapi-v2/models/Event.js +85 -0
  81. package/dist/openapi-v2/models/IngestEventToTheSystem201Response.d.ts +31 -0
  82. package/dist/openapi-v2/models/IngestEventToTheSystem201Response.js +43 -0
  83. package/dist/openapi-v2/models/InvoiceProductBreakdown.d.ts +36 -0
  84. package/dist/openapi-v2/models/InvoiceProductBreakdown.js +46 -0
  85. package/dist/openapi-v2/models/Login200Response.d.ts +28 -0
  86. package/dist/openapi-v2/models/Login200Response.js +31 -0
  87. package/dist/openapi-v2/models/LoginRequest.d.ts +28 -0
  88. package/dist/openapi-v2/models/LoginRequest.js +31 -0
  89. package/dist/openapi-v2/models/ObjectSerializer.d.ts +67 -0
  90. package/dist/openapi-v2/models/ObjectSerializer.js +377 -0
  91. package/dist/openapi-v2/models/Pricing.d.ts +30 -0
  92. package/dist/openapi-v2/models/Pricing.js +37 -0
  93. package/dist/openapi-v2/models/PricingTiersInner.d.ts +31 -0
  94. package/dist/openapi-v2/models/PricingTiersInner.js +49 -0
  95. package/dist/openapi-v2/models/ProductBreakdown.d.ts +29 -0
  96. package/dist/openapi-v2/models/ProductBreakdown.js +37 -0
  97. package/dist/openapi-v2/models/QueryResultAPICustomer.d.ts +40 -0
  98. package/dist/openapi-v2/models/QueryResultAPICustomer.js +43 -0
  99. package/dist/openapi-v2/models/QueryResultAPIEntitlement.d.ts +40 -0
  100. package/dist/openapi-v2/models/QueryResultAPIEntitlement.js +43 -0
  101. package/dist/openapi-v2/models/QueryResultAPIEvent.d.ts +40 -0
  102. package/dist/openapi-v2/models/QueryResultAPIEvent.js +43 -0
  103. package/dist/openapi-v2/models/QueryResultAPIInvoice.d.ts +40 -0
  104. package/dist/openapi-v2/models/QueryResultAPIInvoice.js +43 -0
  105. package/dist/openapi-v2/models/QueryResultAPIProduct.d.ts +40 -0
  106. package/dist/openapi-v2/models/QueryResultAPIProduct.js +43 -0
  107. package/dist/openapi-v2/models/ReviseEntitlementPayload.d.ts +37 -0
  108. package/dist/openapi-v2/models/ReviseEntitlementPayload.js +43 -0
  109. package/dist/openapi-v2/models/UpdateEventPayload.d.ts +33 -0
  110. package/dist/openapi-v2/models/UpdateEventPayload.js +31 -0
  111. package/dist/openapi-v2/models/all.d.ts +40 -0
  112. package/dist/openapi-v2/models/all.js +56 -0
  113. package/dist/openapi-v2/rxjsStub.d.ts +10 -0
  114. package/dist/openapi-v2/rxjsStub.js +31 -0
  115. package/dist/openapi-v2/servers.d.ts +38 -0
  116. package/dist/openapi-v2/servers.js +51 -0
  117. package/dist/openapi-v2/types/ObservableAPI.d.ts +281 -0
  118. package/dist/openapi-v2/types/ObservableAPI.js +694 -0
  119. package/dist/openapi-v2/types/PromiseAPI.d.ts +268 -0
  120. package/dist/openapi-v2/types/PromiseAPI.js +405 -0
  121. package/dist/openapi-v2/util.d.ts +15 -0
  122. package/dist/openapi-v2/util.js +42 -0
  123. package/dist/sdk/services/configuration.service.js +1 -1
  124. package/dist/sdk-v2/clients/CustomersClient.d.ts +11 -0
  125. package/dist/sdk-v2/clients/CustomersClient.js +50 -0
  126. package/dist/sdk-v2/clients/EntitlementsClient.d.ts +8 -0
  127. package/dist/sdk-v2/clients/EntitlementsClient.js +35 -0
  128. package/dist/sdk-v2/clients/EventsClient.d.ts +9 -0
  129. package/dist/sdk-v2/clients/EventsClient.js +40 -0
  130. package/dist/sdk-v2/clients/InvoicesClient.d.ts +11 -0
  131. package/dist/sdk-v2/clients/InvoicesClient.js +50 -0
  132. package/dist/sdk-v2/clients/ProductsClient.d.ts +10 -0
  133. package/dist/sdk-v2/clients/ProductsClient.js +45 -0
  134. package/dist/sdk-v2/clients/index.d.ts +4 -0
  135. package/dist/sdk-v2/clients/index.js +20 -0
  136. package/dist/sdk-v2/index.d.ts +11 -0
  137. package/dist/sdk-v2/index.js +53 -0
  138. package/dist/sdk-v2/services/configuration.service.d.ts +21 -0
  139. package/dist/sdk-v2/services/configuration.service.js +98 -0
  140. package/dist/sdk-v2/services/index.d.ts +1 -0
  141. package/dist/sdk-v2/services/index.js +17 -0
  142. package/dist/sdk-v2/types/Customers.d.ts +1 -0
  143. package/dist/sdk-v2/types/Customers.js +2 -0
  144. package/dist/sdk-v2/types/Entitlements.d.ts +1 -0
  145. package/dist/sdk-v2/types/Entitlements.js +2 -0
  146. package/dist/sdk-v2/types/Events.d.ts +1 -0
  147. package/dist/sdk-v2/types/Events.js +2 -0
  148. package/dist/sdk-v2/types/Invoices.d.ts +1 -0
  149. package/dist/sdk-v2/types/Invoices.js +2 -0
  150. package/dist/sdk-v2/types/Products.d.ts +1 -0
  151. package/dist/sdk-v2/types/Products.js +2 -0
  152. package/dist/sdk-v2/types/index.d.ts +6 -0
  153. package/dist/sdk-v2/types/index.js +24 -0
  154. package/dist/v2.d.ts +1 -0
  155. package/dist/v2.js +17 -0
  156. package/package.json +17 -1
  157. package/dist/openapi/types/ObjectParamAPI.d.ts +0 -845
  158. package/dist/openapi/types/ObjectParamAPI.js +0 -606
@@ -0,0 +1,295 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ProductsApiResponseProcessor = exports.ProductsApiRequestFactory = void 0;
13
+ // TODO: better import syntax?
14
+ const baseapi_1 = require("./baseapi");
15
+ const http_1 = require("../http/http");
16
+ const ObjectSerializer_1 = require("../models/ObjectSerializer");
17
+ const exception_1 = require("./exception");
18
+ const util_1 = require("../util");
19
+ /**
20
+ * no description
21
+ */
22
+ class ProductsApiRequestFactory extends baseapi_1.BaseAPIRequestFactory {
23
+ /**
24
+ * @param aPICreateProductPayload
25
+ */
26
+ createProduct(aPICreateProductPayload, _options) {
27
+ var _a, _b, _c;
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ let _config = _options || this.configuration;
30
+ // verify required parameter 'aPICreateProductPayload' is not null or undefined
31
+ if (aPICreateProductPayload === null || aPICreateProductPayload === undefined) {
32
+ throw new baseapi_1.RequiredError("ProductsApi", "createProduct", "aPICreateProductPayload");
33
+ }
34
+ // Path Params
35
+ const localVarPath = '/products';
36
+ // Make Request Context
37
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
38
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
39
+ // Body Params
40
+ const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
41
+ "application/json"
42
+ ]);
43
+ requestContext.setHeaderParam("Content-Type", contentType);
44
+ const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(aPICreateProductPayload, "APICreateProductPayload", ""), contentType);
45
+ requestContext.setBody(serializedBody);
46
+ const defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
47
+ if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
48
+ yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
49
+ }
50
+ return requestContext;
51
+ });
52
+ }
53
+ /**
54
+ * @param id
55
+ */
56
+ deleteProduct(id, _options) {
57
+ var _a, _b, _c;
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ let _config = _options || this.configuration;
60
+ // verify required parameter 'id' is not null or undefined
61
+ if (id === null || id === undefined) {
62
+ throw new baseapi_1.RequiredError("ProductsApi", "deleteProduct", "id");
63
+ }
64
+ // Path Params
65
+ const localVarPath = '/products/{id}'
66
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
67
+ // Make Request Context
68
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
69
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
70
+ const defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
71
+ if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
72
+ yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
73
+ }
74
+ return requestContext;
75
+ });
76
+ }
77
+ /**
78
+ * @param id
79
+ */
80
+ getProduct(id, _options) {
81
+ var _a, _b, _c;
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ let _config = _options || this.configuration;
84
+ // verify required parameter 'id' is not null or undefined
85
+ if (id === null || id === undefined) {
86
+ throw new baseapi_1.RequiredError("ProductsApi", "getProduct", "id");
87
+ }
88
+ // Path Params
89
+ const localVarPath = '/products/{id}'
90
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
91
+ // Make Request Context
92
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
93
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
94
+ const defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
95
+ if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
96
+ yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
97
+ }
98
+ return requestContext;
99
+ });
100
+ }
101
+ /**
102
+ * @param aPIQueryPayloadAPIProduct
103
+ */
104
+ queryProducts(aPIQueryPayloadAPIProduct, _options) {
105
+ var _a, _b, _c;
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ let _config = _options || this.configuration;
108
+ // verify required parameter 'aPIQueryPayloadAPIProduct' is not null or undefined
109
+ if (aPIQueryPayloadAPIProduct === null || aPIQueryPayloadAPIProduct === undefined) {
110
+ throw new baseapi_1.RequiredError("ProductsApi", "queryProducts", "aPIQueryPayloadAPIProduct");
111
+ }
112
+ // Path Params
113
+ const localVarPath = '/products/query';
114
+ // Make Request Context
115
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
116
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
117
+ // Body Params
118
+ const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
119
+ "application/json"
120
+ ]);
121
+ requestContext.setHeaderParam("Content-Type", contentType);
122
+ const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(aPIQueryPayloadAPIProduct, "APIQueryPayloadAPIProduct", ""), contentType);
123
+ requestContext.setBody(serializedBody);
124
+ const defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
125
+ if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
126
+ yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
127
+ }
128
+ return requestContext;
129
+ });
130
+ }
131
+ /**
132
+ * @param aPIUpdateProductPayload
133
+ * @param id
134
+ */
135
+ updateProduct(aPIUpdateProductPayload, id, _options) {
136
+ var _a, _b, _c;
137
+ return __awaiter(this, void 0, void 0, function* () {
138
+ let _config = _options || this.configuration;
139
+ // verify required parameter 'aPIUpdateProductPayload' is not null or undefined
140
+ if (aPIUpdateProductPayload === null || aPIUpdateProductPayload === undefined) {
141
+ throw new baseapi_1.RequiredError("ProductsApi", "updateProduct", "aPIUpdateProductPayload");
142
+ }
143
+ // verify required parameter 'id' is not null or undefined
144
+ if (id === null || id === undefined) {
145
+ throw new baseapi_1.RequiredError("ProductsApi", "updateProduct", "id");
146
+ }
147
+ // Path Params
148
+ const localVarPath = '/products/{id}'
149
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
150
+ // Make Request Context
151
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.PUT);
152
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
153
+ // Body Params
154
+ const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
155
+ "application/json"
156
+ ]);
157
+ requestContext.setHeaderParam("Content-Type", contentType);
158
+ const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(aPIUpdateProductPayload, "APIUpdateProductPayload", ""), contentType);
159
+ requestContext.setBody(serializedBody);
160
+ const defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
161
+ if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
162
+ yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
163
+ }
164
+ return requestContext;
165
+ });
166
+ }
167
+ }
168
+ exports.ProductsApiRequestFactory = ProductsApiRequestFactory;
169
+ class ProductsApiResponseProcessor {
170
+ /**
171
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
172
+ * to the expected objects
173
+ *
174
+ * @params response Response returned by the server for a request to createProduct
175
+ * @throws ApiException if the response code was not in [200, 299]
176
+ */
177
+ createProductWithHttpInfo(response) {
178
+ return __awaiter(this, void 0, void 0, function* () {
179
+ const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
180
+ if ((0, util_1.isCodeInRange)("201", response.httpStatusCode)) {
181
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "APIProduct", "");
182
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
183
+ }
184
+ if ((0, util_1.isCodeInRange)("400", response.httpStatusCode)) {
185
+ throw new exception_1.ApiException(response.httpStatusCode, "Invalid payload", undefined, response.headers);
186
+ }
187
+ // Work around for missing responses in specification, e.g. for petstore.yaml
188
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
189
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "APIProduct", "");
190
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
191
+ }
192
+ throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
193
+ });
194
+ }
195
+ /**
196
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
197
+ * to the expected objects
198
+ *
199
+ * @params response Response returned by the server for a request to deleteProduct
200
+ * @throws ApiException if the response code was not in [200, 299]
201
+ */
202
+ deleteProductWithHttpInfo(response) {
203
+ return __awaiter(this, void 0, void 0, function* () {
204
+ const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
205
+ if ((0, util_1.isCodeInRange)("204", response.httpStatusCode)) {
206
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, undefined);
207
+ }
208
+ // Work around for missing responses in specification, e.g. for petstore.yaml
209
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
210
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "void", "");
211
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
212
+ }
213
+ throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
214
+ });
215
+ }
216
+ /**
217
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
218
+ * to the expected objects
219
+ *
220
+ * @params response Response returned by the server for a request to getProduct
221
+ * @throws ApiException if the response code was not in [200, 299]
222
+ */
223
+ getProductWithHttpInfo(response) {
224
+ return __awaiter(this, void 0, void 0, function* () {
225
+ const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
226
+ if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
227
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "APIProduct", "");
228
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
229
+ }
230
+ if ((0, util_1.isCodeInRange)("404", response.httpStatusCode)) {
231
+ throw new exception_1.ApiException(response.httpStatusCode, "Product not found", undefined, response.headers);
232
+ }
233
+ // Work around for missing responses in specification, e.g. for petstore.yaml
234
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
235
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "APIProduct", "");
236
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
237
+ }
238
+ throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
239
+ });
240
+ }
241
+ /**
242
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
243
+ * to the expected objects
244
+ *
245
+ * @params response Response returned by the server for a request to queryProducts
246
+ * @throws ApiException if the response code was not in [200, 299]
247
+ */
248
+ queryProductsWithHttpInfo(response) {
249
+ return __awaiter(this, void 0, void 0, function* () {
250
+ const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
251
+ if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
252
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "QueryResultAPIProduct", "");
253
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
254
+ }
255
+ if ((0, util_1.isCodeInRange)("400", response.httpStatusCode)) {
256
+ throw new exception_1.ApiException(response.httpStatusCode, "Invalid query", undefined, response.headers);
257
+ }
258
+ // Work around for missing responses in specification, e.g. for petstore.yaml
259
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
260
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "QueryResultAPIProduct", "");
261
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
262
+ }
263
+ throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
264
+ });
265
+ }
266
+ /**
267
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
268
+ * to the expected objects
269
+ *
270
+ * @params response Response returned by the server for a request to updateProduct
271
+ * @throws ApiException if the response code was not in [200, 299]
272
+ */
273
+ updateProductWithHttpInfo(response) {
274
+ return __awaiter(this, void 0, void 0, function* () {
275
+ const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
276
+ if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
277
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "APIProduct", "");
278
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
279
+ }
280
+ if ((0, util_1.isCodeInRange)("400", response.httpStatusCode)) {
281
+ throw new exception_1.ApiException(response.httpStatusCode, "Invalid payload", undefined, response.headers);
282
+ }
283
+ if ((0, util_1.isCodeInRange)("404", response.httpStatusCode)) {
284
+ throw new exception_1.ApiException(response.httpStatusCode, "Product not found", undefined, response.headers);
285
+ }
286
+ // Work around for missing responses in specification, e.g. for petstore.yaml
287
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
288
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "APIProduct", "");
289
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
290
+ }
291
+ throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
292
+ });
293
+ }
294
+ }
295
+ exports.ProductsApiResponseProcessor = ProductsApiResponseProcessor;
@@ -0,0 +1,33 @@
1
+ import { Configuration } from '../configuration';
2
+ /**
3
+ *
4
+ * @export
5
+ */
6
+ export declare const COLLECTION_FORMATS: {
7
+ csv: string;
8
+ ssv: string;
9
+ tsv: string;
10
+ pipes: string;
11
+ };
12
+ /**
13
+ *
14
+ * @export
15
+ * @class BaseAPI
16
+ */
17
+ export declare class BaseAPIRequestFactory {
18
+ protected configuration: Configuration;
19
+ constructor(configuration: Configuration);
20
+ }
21
+ /**
22
+ *
23
+ * @export
24
+ * @class RequiredError
25
+ * @extends {Error}
26
+ */
27
+ export declare class RequiredError extends Error {
28
+ api: string;
29
+ method: string;
30
+ field: string;
31
+ name: "RequiredError";
32
+ constructor(api: string, method: string, field: string);
33
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RequiredError = exports.BaseAPIRequestFactory = exports.COLLECTION_FORMATS = void 0;
4
+ /**
5
+ *
6
+ * @export
7
+ */
8
+ exports.COLLECTION_FORMATS = {
9
+ csv: ",",
10
+ ssv: " ",
11
+ tsv: "\t",
12
+ pipes: "|",
13
+ };
14
+ /**
15
+ *
16
+ * @export
17
+ * @class BaseAPI
18
+ */
19
+ class BaseAPIRequestFactory {
20
+ constructor(configuration) {
21
+ this.configuration = configuration;
22
+ }
23
+ }
24
+ exports.BaseAPIRequestFactory = BaseAPIRequestFactory;
25
+ ;
26
+ /**
27
+ *
28
+ * @export
29
+ * @class RequiredError
30
+ * @extends {Error}
31
+ */
32
+ class RequiredError extends Error {
33
+ constructor(api, method, field) {
34
+ super("Required parameter " + field + " was null or undefined when calling " + api + "." + method + ".");
35
+ this.api = api;
36
+ this.method = method;
37
+ this.field = field;
38
+ this.name = "RequiredError";
39
+ }
40
+ }
41
+ exports.RequiredError = RequiredError;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Represents an error caused by an api call i.e. it has attributes for a HTTP status code
3
+ * and the returned body object.
4
+ *
5
+ * Example
6
+ * API returns a ErrorMessageObject whenever HTTP status code is not in [200, 299]
7
+ * => ApiException(404, someErrorMessageObject)
8
+ *
9
+ */
10
+ export declare class ApiException<T> extends Error {
11
+ code: number;
12
+ body: T;
13
+ headers: {
14
+ [key: string]: string;
15
+ };
16
+ constructor(code: number, message: string, body: T, headers: {
17
+ [key: string]: string;
18
+ });
19
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiException = void 0;
4
+ /**
5
+ * Represents an error caused by an api call i.e. it has attributes for a HTTP status code
6
+ * and the returned body object.
7
+ *
8
+ * Example
9
+ * API returns a ErrorMessageObject whenever HTTP status code is not in [200, 299]
10
+ * => ApiException(404, someErrorMessageObject)
11
+ *
12
+ */
13
+ class ApiException extends Error {
14
+ constructor(code, message, body, headers) {
15
+ super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " +
16
+ JSON.stringify(headers));
17
+ this.code = code;
18
+ this.body = body;
19
+ this.headers = headers;
20
+ }
21
+ }
22
+ exports.ApiException = ApiException;
@@ -0,0 +1,38 @@
1
+ import { RequestContext } from "../http/http";
2
+ /**
3
+ * Interface authentication schemes.
4
+ */
5
+ export interface SecurityAuthentication {
6
+ getName(): string;
7
+ /**
8
+ * Applies the authentication scheme to the request context
9
+ *
10
+ * @params context the request context which should use this authentication scheme
11
+ */
12
+ applySecurityAuthentication(context: RequestContext): void | Promise<void>;
13
+ }
14
+ export interface TokenProvider {
15
+ getToken(): Promise<string> | string;
16
+ }
17
+ export type AuthMethods = {
18
+ "default"?: SecurityAuthentication;
19
+ };
20
+ export type ApiKeyConfiguration = string;
21
+ export type HttpBasicConfiguration = {
22
+ "username": string;
23
+ "password": string;
24
+ };
25
+ export type HttpBearerConfiguration = {
26
+ tokenProvider: TokenProvider;
27
+ };
28
+ export type OAuth2Configuration = {
29
+ accessToken: string;
30
+ };
31
+ export type AuthMethodsConfiguration = {
32
+ "default"?: SecurityAuthentication;
33
+ };
34
+ /**
35
+ * Creates the authentication methods from a swagger description.
36
+ *
37
+ */
38
+ export declare function configureAuthMethods(config: AuthMethodsConfiguration | undefined): AuthMethods;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configureAuthMethods = void 0;
4
+ /**
5
+ * Creates the authentication methods from a swagger description.
6
+ *
7
+ */
8
+ function configureAuthMethods(config) {
9
+ let authMethods = {};
10
+ if (!config) {
11
+ return authMethods;
12
+ }
13
+ authMethods["default"] = config["default"];
14
+ return authMethods;
15
+ }
16
+ exports.configureAuthMethods = configureAuthMethods;
@@ -0,0 +1,63 @@
1
+ import { HttpLibrary } from "./http/http";
2
+ import { Middleware, PromiseMiddleware } from "./middleware";
3
+ import { BaseServerConfiguration } from "./servers";
4
+ import { AuthMethods, AuthMethodsConfiguration } from "./auth/auth";
5
+ export interface Configuration {
6
+ readonly baseServer: BaseServerConfiguration;
7
+ readonly httpApi: HttpLibrary;
8
+ readonly middleware: Middleware[];
9
+ readonly authMethods: AuthMethods;
10
+ }
11
+ /**
12
+ * Interface with which a configuration object can be configured.
13
+ */
14
+ export interface ConfigurationParameters {
15
+ /**
16
+ * Default server to use - a list of available servers (according to the
17
+ * OpenAPI yaml definition) is included in the `servers` const in `./servers`. You can also
18
+ * create your own server with the `ServerConfiguration` class from the same
19
+ * file.
20
+ */
21
+ baseServer?: BaseServerConfiguration;
22
+ /**
23
+ * HTTP library to use e.g. IsomorphicFetch. This can usually be skipped as
24
+ * all generators come with a default library.
25
+ * If available, additional libraries can be imported from `./http/*`
26
+ */
27
+ httpApi?: HttpLibrary;
28
+ /**
29
+ * The middlewares which will be applied to requests and responses. You can
30
+ * add any number of middleware components to modify requests before they
31
+ * are sent or before they are deserialized by implementing the `Middleware`
32
+ * interface defined in `./middleware`
33
+ */
34
+ middleware?: Middleware[];
35
+ /**
36
+ * Configures middleware functions that return promises instead of
37
+ * Observables (which are used by `middleware`). Otherwise allows for the
38
+ * same functionality as `middleware`, i.e., modifying requests before they
39
+ * are sent and before they are deserialized.
40
+ */
41
+ promiseMiddleware?: PromiseMiddleware[];
42
+ /**
43
+ * Configuration for the available authentication methods (e.g., api keys)
44
+ * according to the OpenAPI yaml definition. For the definition, please refer to
45
+ * `./auth/auth`
46
+ */
47
+ authMethods?: AuthMethodsConfiguration;
48
+ }
49
+ /**
50
+ * Provide your `ConfigurationParameters` to this function to get a `Configuration`
51
+ * object that can be used to configure your APIs (in the constructor or
52
+ * for each request individually).
53
+ *
54
+ * If a property is not included in conf, a default is used:
55
+ * - baseServer: server1
56
+ * - httpApi: IsomorphicFetchHttpLibrary
57
+ * - middleware: []
58
+ * - promiseMiddleware: []
59
+ * - authMethods: {}
60
+ *
61
+ * @param conf partial configuration
62
+ */
63
+ export declare function createConfiguration(conf?: ConfigurationParameters): Configuration;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createConfiguration = void 0;
4
+ const middleware_1 = require("./middleware");
5
+ const isomorphic_fetch_1 = require("./http/isomorphic-fetch");
6
+ const servers_1 = require("./servers");
7
+ const auth_1 = require("./auth/auth");
8
+ /**
9
+ * Provide your `ConfigurationParameters` to this function to get a `Configuration`
10
+ * object that can be used to configure your APIs (in the constructor or
11
+ * for each request individually).
12
+ *
13
+ * If a property is not included in conf, a default is used:
14
+ * - baseServer: server1
15
+ * - httpApi: IsomorphicFetchHttpLibrary
16
+ * - middleware: []
17
+ * - promiseMiddleware: []
18
+ * - authMethods: {}
19
+ *
20
+ * @param conf partial configuration
21
+ */
22
+ function createConfiguration(conf = {}) {
23
+ const configuration = {
24
+ baseServer: conf.baseServer !== undefined ? conf.baseServer : servers_1.server1,
25
+ httpApi: conf.httpApi || new isomorphic_fetch_1.IsomorphicFetchHttpLibrary(),
26
+ middleware: conf.middleware || [],
27
+ authMethods: (0, auth_1.configureAuthMethods)(conf.authMethods)
28
+ };
29
+ if (conf.promiseMiddleware) {
30
+ conf.promiseMiddleware.forEach(m => configuration.middleware.push(new middleware_1.PromiseMiddlewareWrapper(m)));
31
+ }
32
+ return configuration;
33
+ }
34
+ exports.createConfiguration = createConfiguration;