vayu-ts 0.2.14 → 0.3.4

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 (217) hide show
  1. package/dist/example/index.d.ts +1 -0
  2. package/dist/example/index.js +74 -0
  3. package/dist/openapi/apis/CatalogProductsApi.d.ts +89 -0
  4. package/dist/openapi/apis/CatalogProductsApi.js +354 -0
  5. package/dist/openapi/apis/CloudUsageSubmissionApi.d.ts +25 -0
  6. package/dist/openapi/apis/CloudUsageSubmissionApi.js +85 -0
  7. package/dist/openapi/apis/ContractsApi.d.ts +21 -3
  8. package/dist/openapi/apis/ContractsApi.js +75 -3
  9. package/dist/openapi/apis/CustomersApi.d.ts +63 -0
  10. package/dist/openapi/apis/CustomersApi.js +257 -7
  11. package/dist/openapi/apis/EventsApi.d.ts +16 -0
  12. package/dist/openapi/apis/EventsApi.js +67 -12
  13. package/dist/openapi/apis/InvoicesApi.d.ts +19 -3
  14. package/dist/openapi/apis/InvoicesApi.js +69 -3
  15. package/dist/openapi/apis/ProductConsumptionsApi.js +0 -3
  16. package/dist/openapi/apis/WebhooksApi.js +0 -3
  17. package/dist/openapi/http/http.d.ts +6 -18
  18. package/dist/openapi/http/http.js +25 -13
  19. package/dist/openapi/http/isomorphic-fetch.d.ts +1 -0
  20. package/dist/openapi/http/isomorphic-fetch.js +4 -7
  21. package/dist/openapi/index.d.ts +1 -1
  22. package/dist/openapi/index.js +3 -1
  23. package/dist/openapi/models/Address.d.ts +5 -5
  24. package/dist/openapi/models/CloudUsageResult.d.ts +83 -0
  25. package/dist/openapi/models/CloudUsageResult.js +103 -0
  26. package/dist/openapi/models/Contact.d.ts +3 -1
  27. package/dist/openapi/models/Contact.js +12 -0
  28. package/dist/openapi/models/ContractStatus.d.ts +23 -0
  29. package/dist/openapi/models/ContractStatus.js +27 -0
  30. package/dist/openapi/models/CreateCatalogProductRequest.d.ts +42 -0
  31. package/dist/openapi/models/CreateCatalogProductRequest.js +44 -0
  32. package/dist/openapi/models/CreateCatalogProductResponse.d.ts +32 -0
  33. package/dist/openapi/models/CreateCatalogProductResponse.js +32 -0
  34. package/dist/openapi/models/CreateCatalogProductResponseCatalogProduct.d.ts +45 -0
  35. package/dist/openapi/models/CreateCatalogProductResponseCatalogProduct.js +62 -0
  36. package/dist/openapi/models/CreateContractRequest.d.ts +47 -5
  37. package/dist/openapi/models/CreateContractRequest.js +65 -5
  38. package/dist/openapi/models/CreateCustomerRelationRequest.d.ts +38 -0
  39. package/dist/openapi/models/CreateCustomerRelationRequest.js +38 -0
  40. package/dist/openapi/models/CreateCustomerRelationResponse.d.ts +32 -0
  41. package/dist/openapi/models/CreateCustomerRelationResponse.js +32 -0
  42. package/dist/openapi/models/CreateCustomerRelationResponseCustomerRelation.d.ts +41 -0
  43. package/dist/openapi/models/CreateCustomerRelationResponseCustomerRelation.js +56 -0
  44. package/dist/openapi/models/CreateCustomerRequest.d.ts +50 -2
  45. package/dist/openapi/models/CreateCustomerRequest.js +82 -6
  46. package/dist/openapi/models/CreateCustomerResponseCustomer.d.ts +50 -2
  47. package/dist/openapi/models/CreateCustomerResponseCustomer.js +82 -6
  48. package/dist/openapi/models/CreditLedgerEntry.d.ts +3 -1
  49. package/dist/openapi/models/CreditLedgerEntry.js +8 -2
  50. package/dist/openapi/models/Currency.d.ts +24 -0
  51. package/dist/openapi/models/Currency.js +28 -0
  52. package/dist/openapi/models/CustomField.d.ts +65 -0
  53. package/dist/openapi/models/CustomField.js +78 -0
  54. package/dist/openapi/models/CustomFieldValue.d.ts +33 -0
  55. package/dist/openapi/models/CustomFieldValue.js +44 -0
  56. package/dist/openapi/models/CustomFieldValueTypes.d.ts +19 -0
  57. package/dist/openapi/models/CustomFieldValueTypes.js +23 -0
  58. package/dist/openapi/models/CustomerCloudProviderSettings.d.ts +39 -0
  59. package/dist/openapi/models/CustomerCloudProviderSettings.js +51 -0
  60. package/dist/openapi/models/CustomerSource.d.ts +21 -0
  61. package/dist/openapi/models/CustomerSource.js +25 -0
  62. package/dist/openapi/models/DeleteCatalogProductResponse.d.ts +32 -0
  63. package/dist/openapi/models/DeleteCatalogProductResponse.js +32 -0
  64. package/dist/openapi/models/DeleteCatalogProductResponseCatalogProduct.d.ts +46 -0
  65. package/dist/openapi/models/DeleteCatalogProductResponseCatalogProduct.js +68 -0
  66. package/dist/openapi/models/DeleteContractResponseContract.d.ts +47 -5
  67. package/dist/openapi/models/DeleteContractResponseContract.js +65 -5
  68. package/dist/openapi/models/DeleteCustomerResponseCustomer.d.ts +50 -2
  69. package/dist/openapi/models/DeleteCustomerResponseCustomer.js +82 -6
  70. package/dist/openapi/models/DeleteEventsByRefsRequest.d.ts +31 -0
  71. package/dist/openapi/models/DeleteEventsByRefsRequest.js +32 -0
  72. package/dist/openapi/models/DeleteEventsByRefsResponse.d.ts +35 -0
  73. package/dist/openapi/models/DeleteEventsByRefsResponse.js +32 -0
  74. package/dist/openapi/models/DeleteEventsByRefsResponseEventsInner.d.ts +56 -0
  75. package/dist/openapi/models/DeleteEventsByRefsResponseEventsInner.js +80 -0
  76. package/dist/openapi/models/ExternalOverageStrategy.d.ts +20 -0
  77. package/dist/openapi/models/ExternalOverageStrategy.js +24 -0
  78. package/dist/openapi/models/GetCatalogProductResponse.d.ts +32 -0
  79. package/dist/openapi/models/GetCatalogProductResponse.js +32 -0
  80. package/dist/openapi/models/GetContractByIntegrationIdResponse.d.ts +32 -0
  81. package/dist/openapi/models/GetContractByIntegrationIdResponse.js +32 -0
  82. package/dist/openapi/models/GetContractResponseContract.d.ts +47 -5
  83. package/dist/openapi/models/GetContractResponseContract.js +65 -5
  84. package/dist/openapi/models/GetCustomerByIntegrationIdResponse.d.ts +32 -0
  85. package/dist/openapi/models/GetCustomerByIntegrationIdResponse.js +32 -0
  86. package/dist/openapi/models/GetCustomerByNameResponse.d.ts +32 -0
  87. package/dist/openapi/models/GetCustomerByNameResponse.js +32 -0
  88. package/dist/openapi/models/GetCustomerByNameResponseCustomer.d.ts +103 -0
  89. package/dist/openapi/models/GetCustomerByNameResponseCustomer.js +153 -0
  90. package/dist/openapi/models/GetCustomerRelationResponse.d.ts +32 -0
  91. package/dist/openapi/models/GetCustomerRelationResponse.js +32 -0
  92. package/dist/openapi/models/GetInvoiceResponseInvoice.d.ts +14 -0
  93. package/dist/openapi/models/GetInvoiceResponseInvoice.js +30 -0
  94. package/dist/openapi/models/GetInvoiceResponseInvoiceRevenueBreakdown.d.ts +39 -0
  95. package/dist/openapi/models/GetInvoiceResponseInvoiceRevenueBreakdown.js +65 -0
  96. package/dist/openapi/models/IntegrationEntity.d.ts +42 -0
  97. package/dist/openapi/models/IntegrationEntity.js +62 -0
  98. package/dist/openapi/models/IntegrationEntityTypes.d.ts +23 -0
  99. package/dist/openapi/models/IntegrationEntityTypes.js +27 -0
  100. package/dist/openapi/models/IntegrationProviders.d.ts +26 -0
  101. package/dist/openapi/models/IntegrationProviders.js +30 -0
  102. package/dist/openapi/models/IntegrationType.d.ts +26 -0
  103. package/dist/openapi/models/IntegrationType.js +30 -0
  104. package/dist/openapi/models/InvoiceBillingStatus.d.ts +21 -0
  105. package/dist/openapi/models/InvoiceBillingStatus.js +25 -0
  106. package/dist/openapi/models/InvoicePaymentStatusResponse.d.ts +39 -0
  107. package/dist/openapi/models/InvoicePaymentStatusResponse.js +74 -0
  108. package/dist/openapi/models/ListCatalogProductsResponse.d.ts +35 -0
  109. package/dist/openapi/models/ListCatalogProductsResponse.js +50 -0
  110. package/dist/openapi/models/NotificationEventType.d.ts +3 -1
  111. package/dist/openapi/models/NotificationEventType.js +2 -0
  112. package/dist/openapi/models/ObjectSerializer.d.ts +61 -0
  113. package/dist/openapi/models/ObjectSerializer.js +191 -0
  114. package/dist/openapi/models/PartnerSubmissionDetail.d.ts +46 -0
  115. package/dist/openapi/models/PartnerSubmissionDetail.js +49 -0
  116. package/dist/openapi/models/PaymentInfo.d.ts +45 -0
  117. package/dist/openapi/models/PaymentInfo.js +89 -0
  118. package/dist/openapi/models/PaymentInfoDepositTo.d.ts +32 -0
  119. package/dist/openapi/models/PaymentInfoDepositTo.js +38 -0
  120. package/dist/openapi/models/PaymentTerm.d.ts +18 -0
  121. package/dist/openapi/models/PaymentTerm.js +22 -0
  122. package/dist/openapi/models/ProductCloudProviderSettings.d.ts +39 -0
  123. package/dist/openapi/models/ProductCloudProviderSettings.js +51 -0
  124. package/dist/openapi/models/ProductGroup.d.ts +65 -0
  125. package/dist/openapi/models/ProductGroup.js +80 -0
  126. package/dist/openapi/models/ProductGroupCommitment.d.ts +45 -0
  127. package/dist/openapi/models/ProductGroupCommitment.js +53 -0
  128. package/dist/openapi/models/ProductGroupProductsInner.d.ts +68 -0
  129. package/dist/openapi/models/ProductGroupProductsInner.js +98 -0
  130. package/dist/openapi/models/ProductGroupProductsInnerCommitment.d.ts +45 -0
  131. package/dist/openapi/models/ProductGroupProductsInnerCommitment.js +53 -0
  132. package/dist/openapi/models/ProductGroupProductsInnerCommitmentScheduling.d.ts +39 -0
  133. package/dist/openapi/models/ProductGroupProductsInnerCommitmentScheduling.js +41 -0
  134. package/dist/openapi/models/ProductGroupProductsInnerPricing.d.ts +36 -0
  135. package/dist/openapi/models/ProductGroupProductsInnerPricing.js +24 -0
  136. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf.d.ts +35 -0
  137. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf.js +42 -0
  138. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf1.d.ts +37 -0
  139. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf1.js +48 -0
  140. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf1InstallmentsInner.d.ts +32 -0
  141. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf1InstallmentsInner.js +38 -0
  142. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf2.d.ts +37 -0
  143. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf2.js +48 -0
  144. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf2SubscriptionCadence.d.ts +38 -0
  145. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf2SubscriptionCadence.js +45 -0
  146. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf3.d.ts +46 -0
  147. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf3.js +78 -0
  148. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf3SubscriptionCadence.d.ts +38 -0
  149. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf3SubscriptionCadence.js +45 -0
  150. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf3TiersInner.d.ts +35 -0
  151. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf3TiersInner.js +56 -0
  152. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf4.d.ts +41 -0
  153. package/dist/openapi/models/ProductGroupProductsInnerPricingOneOf4.js +60 -0
  154. package/dist/openapi/models/ProductGroupProductsInnerScheduling.d.ts +39 -0
  155. package/dist/openapi/models/ProductGroupProductsInnerScheduling.js +41 -0
  156. package/dist/openapi/models/ProductGroupProductsInnerSchedulingDuration.d.ts +41 -0
  157. package/dist/openapi/models/ProductGroupProductsInnerSchedulingDuration.js +48 -0
  158. package/dist/openapi/models/SubmitCloudUsageRequest.d.ts +39 -0
  159. package/dist/openapi/models/SubmitCloudUsageRequest.js +38 -0
  160. package/dist/openapi/models/SyncStatus.d.ts +16 -0
  161. package/dist/openapi/models/SyncStatus.js +20 -0
  162. package/dist/openapi/models/UpdateCatalogProductRequest.d.ts +42 -0
  163. package/dist/openapi/models/UpdateCatalogProductRequest.js +44 -0
  164. package/dist/openapi/models/UpdateCatalogProductResponse.d.ts +32 -0
  165. package/dist/openapi/models/UpdateCatalogProductResponse.js +32 -0
  166. package/dist/openapi/models/UpdateCustomerRequest.d.ts +50 -2
  167. package/dist/openapi/models/UpdateCustomerRequest.js +82 -6
  168. package/dist/openapi/models/UsageWindow.d.ts +41 -0
  169. package/dist/openapi/models/UsageWindow.js +41 -0
  170. package/dist/openapi/models/all.d.ts +61 -0
  171. package/dist/openapi/models/all.js +61 -0
  172. package/dist/openapi/types/ObservableAPI.d.ts +212 -12
  173. package/dist/openapi/types/ObservableAPI.js +424 -17
  174. package/dist/openapi/types/PromiseAPI.d.ts +208 -12
  175. package/dist/openapi/types/PromiseAPI.js +294 -34
  176. package/dist/sdk/clients/CatalogProductsClient.d.ts +11 -0
  177. package/dist/sdk/clients/CatalogProductsClient.js +28 -0
  178. package/dist/sdk/clients/CloudUsageSubmissionClient.d.ts +6 -0
  179. package/dist/sdk/clients/CloudUsageSubmissionClient.js +14 -0
  180. package/dist/sdk/clients/ContractsClient.d.ts +2 -1
  181. package/dist/sdk/clients/ContractsClient.js +3 -0
  182. package/dist/sdk/clients/CreditsClient.d.ts +9 -0
  183. package/dist/sdk/clients/CreditsClient.js +22 -0
  184. package/dist/sdk/clients/CustomersClient.d.ts +6 -1
  185. package/dist/sdk/clients/CustomersClient.js +15 -0
  186. package/dist/sdk/clients/EventsClient.d.ts +2 -1
  187. package/dist/sdk/clients/EventsClient.js +3 -0
  188. package/dist/sdk/clients/InvoicesClient.d.ts +1 -0
  189. package/dist/sdk/clients/InvoicesClient.js +3 -0
  190. package/dist/sdk/clients/MeasurementsClient.d.ts +10 -0
  191. package/dist/sdk/clients/MeasurementsClient.js +25 -0
  192. package/dist/sdk/clients/index.d.ts +4 -0
  193. package/dist/sdk/clients/index.js +4 -0
  194. package/dist/sdk/index.d.ts +6 -1
  195. package/dist/sdk/index.js +13 -0
  196. package/dist/sdk/services/authenticated-http-library.d.ts +11 -0
  197. package/dist/sdk/services/authenticated-http-library.js +29 -0
  198. package/dist/sdk/services/authenticator.d.ts +11 -0
  199. package/dist/sdk/services/authenticator.js +57 -0
  200. package/dist/sdk/services/configuration.service.d.ts +7 -6
  201. package/dist/sdk/services/configuration.service.js +12 -44
  202. package/dist/sdk/types/CatalogProducts.d.ts +1 -0
  203. package/dist/sdk/types/CatalogProducts.js +2 -0
  204. package/dist/sdk/types/CloudUsageSubmission.d.ts +1 -0
  205. package/dist/sdk/types/CloudUsageSubmission.js +2 -0
  206. package/dist/sdk/types/Contracts.d.ts +1 -1
  207. package/dist/sdk/types/Credits.d.ts +1 -0
  208. package/dist/sdk/types/Credits.js +2 -0
  209. package/dist/sdk/types/Customers.d.ts +1 -1
  210. package/dist/sdk/types/Events.d.ts +1 -1
  211. package/dist/sdk/types/Invoices.d.ts +1 -1
  212. package/dist/sdk/types/Measurements.d.ts +1 -0
  213. package/dist/sdk/types/Measurements.js +2 -0
  214. package/dist/sdk/types/index.d.ts +4 -0
  215. package/dist/sdk/types/index.js +4 -0
  216. package/dist/sdk-v2/services/configuration.service.js +16 -8
  217. package/package.json +3 -4
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sdk_1 = require("../sdk");
4
+ const VAYU_API_KEY = process.env.VAYU_API_KEY;
5
+ const VAYU_HOST = process.env.VAYU_HOST;
6
+ if (!VAYU_API_KEY) {
7
+ console.error('Set VAYU_API_KEY environment variable');
8
+ process.exit(1);
9
+ }
10
+ const vayu = new sdk_1.Vayu(VAYU_API_KEY, VAYU_HOST);
11
+ async function main() {
12
+ // --- Customers ---
13
+ console.log('=== List Customers ===');
14
+ const customers = await vayu.customers.list({ limit: 5 });
15
+ console.log(`Found ${customers.total} customers`);
16
+ console.log('\n=== Create Customer ===');
17
+ const suffix = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
18
+ const created = await vayu.customers.create({
19
+ name: `SDK Example Customer ${suffix}`,
20
+ externalId: `example-${suffix}`,
21
+ });
22
+ const customerId = created.customer.id;
23
+ console.log(`Created customer: ${customerId}`);
24
+ console.log('\n=== Get Customer ===');
25
+ const fetched = await vayu.customers.get(customerId);
26
+ console.log(`Fetched: ${fetched.customer.name}`);
27
+ // --- Events ---
28
+ console.log('\n=== Send Events ===');
29
+ const events = [
30
+ {
31
+ name: 'api_call',
32
+ timestamp: new Date(),
33
+ customerAlias: `example-${suffix}`,
34
+ ref: `ref-${suffix}`,
35
+ data: { endpoint: '/users', method: 'GET' },
36
+ },
37
+ ];
38
+ const sendResult = await vayu.events.send(events);
39
+ console.log(`Valid events: ${sendResult.validEvents.length}`);
40
+ console.log(`Invalid events: ${sendResult.invalidEvents.length}`);
41
+ // --- Meters ---
42
+ console.log('\n=== List Meters ===');
43
+ const meters = await vayu.meters.list({ limit: 5 });
44
+ console.log(`Found ${meters.total} meters`);
45
+ for (const meter of meters.meters) {
46
+ console.log(` - ${meter.id}: ${meter.name}`);
47
+ }
48
+ // --- Contracts ---
49
+ console.log('\n=== List Contracts ===');
50
+ const contracts = await vayu.contracts.list({ limit: 5 });
51
+ console.log(`Found ${contracts.total} contracts`);
52
+ // --- Invoices ---
53
+ console.log('\n=== List Invoices ===');
54
+ const invoices = await vayu.invoices.list({ limit: 5 });
55
+ console.log(`Found ${invoices.total} invoices`);
56
+ // --- Catalog Products (new in latest update-sdks) ---
57
+ console.log('\n=== List Catalog Products ===');
58
+ const products = await vayu.catalogProducts.list({ limit: 5 });
59
+ console.log(`Found ${products.total} catalog products`);
60
+ // --- Cleanup ---
61
+ console.log('\n=== Delete Customer ===');
62
+ try {
63
+ await vayu.customers.delete(customerId);
64
+ console.log(`Deleted customer: ${customerId}`);
65
+ }
66
+ catch (e) {
67
+ console.log(`DeleteCustomer failed (non-fatal): ${e}`);
68
+ }
69
+ console.log('\nDone!');
70
+ }
71
+ main().catch((err) => {
72
+ console.error('Error:', err);
73
+ process.exit(1);
74
+ });
@@ -0,0 +1,89 @@
1
+ import { BaseAPIRequestFactory } from './baseapi';
2
+ import { Configuration } from '../configuration';
3
+ import { RequestContext, ResponseContext, HttpInfo } from '../http/http';
4
+ import { CreateCatalogProductRequest } from '../models/CreateCatalogProductRequest';
5
+ import { CreateCatalogProductResponse } from '../models/CreateCatalogProductResponse';
6
+ import { DeleteCatalogProductResponse } from '../models/DeleteCatalogProductResponse';
7
+ import { GetCatalogProductResponse } from '../models/GetCatalogProductResponse';
8
+ import { ListCatalogProductsResponse } from '../models/ListCatalogProductsResponse';
9
+ import { UpdateCatalogProductRequest } from '../models/UpdateCatalogProductRequest';
10
+ import { UpdateCatalogProductResponse } from '../models/UpdateCatalogProductResponse';
11
+ /**
12
+ * no description
13
+ */
14
+ export declare class CatalogProductsApiRequestFactory extends BaseAPIRequestFactory {
15
+ /**
16
+ * Create a new Catalog product.
17
+ * Create Catalog product
18
+ * @param createCatalogProductRequest
19
+ */
20
+ createCatalogProduct(createCatalogProductRequest: CreateCatalogProductRequest, _options?: Configuration): Promise<RequestContext>;
21
+ /**
22
+ * Delete a Catalog product by id.
23
+ * Delete Catalog product
24
+ * @param catalogProductId
25
+ */
26
+ deleteCatalogProduct(catalogProductId: string, _options?: Configuration): Promise<RequestContext>;
27
+ /**
28
+ * Get a Catalog product by id.
29
+ * Get Catalog product
30
+ * @param catalogProductId
31
+ */
32
+ getCatalogProduct(catalogProductId: string, _options?: Configuration): Promise<RequestContext>;
33
+ /**
34
+ * Get a list of Catalog products.
35
+ * List Catalog products
36
+ * @param limit
37
+ * @param cursor
38
+ */
39
+ listCatalogProducts(limit?: number, cursor?: string, _options?: Configuration): Promise<RequestContext>;
40
+ /**
41
+ * Update a Catalog product by id.
42
+ * Update Catalog product
43
+ * @param updateCatalogProductRequest
44
+ * @param catalogProductId
45
+ */
46
+ updateCatalogProduct(updateCatalogProductRequest: UpdateCatalogProductRequest, catalogProductId: string, _options?: Configuration): Promise<RequestContext>;
47
+ }
48
+ export declare class CatalogProductsApiResponseProcessor {
49
+ /**
50
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
51
+ * to the expected objects
52
+ *
53
+ * @params response Response returned by the server for a request to createCatalogProduct
54
+ * @throws ApiException if the response code was not in [200, 299]
55
+ */
56
+ createCatalogProductWithHttpInfo(response: ResponseContext): Promise<HttpInfo<CreateCatalogProductResponse>>;
57
+ /**
58
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
59
+ * to the expected objects
60
+ *
61
+ * @params response Response returned by the server for a request to deleteCatalogProduct
62
+ * @throws ApiException if the response code was not in [200, 299]
63
+ */
64
+ deleteCatalogProductWithHttpInfo(response: ResponseContext): Promise<HttpInfo<DeleteCatalogProductResponse>>;
65
+ /**
66
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
67
+ * to the expected objects
68
+ *
69
+ * @params response Response returned by the server for a request to getCatalogProduct
70
+ * @throws ApiException if the response code was not in [200, 299]
71
+ */
72
+ getCatalogProductWithHttpInfo(response: ResponseContext): Promise<HttpInfo<GetCatalogProductResponse>>;
73
+ /**
74
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
75
+ * to the expected objects
76
+ *
77
+ * @params response Response returned by the server for a request to listCatalogProducts
78
+ * @throws ApiException if the response code was not in [200, 299]
79
+ */
80
+ listCatalogProductsWithHttpInfo(response: ResponseContext): Promise<HttpInfo<ListCatalogProductsResponse>>;
81
+ /**
82
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
83
+ * to the expected objects
84
+ *
85
+ * @params response Response returned by the server for a request to updateCatalogProduct
86
+ * @throws ApiException if the response code was not in [200, 299]
87
+ */
88
+ updateCatalogProductWithHttpInfo(response: ResponseContext): Promise<HttpInfo<UpdateCatalogProductResponse>>;
89
+ }
@@ -0,0 +1,354 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CatalogProductsApiResponseProcessor = exports.CatalogProductsApiRequestFactory = void 0;
4
+ // TODO: better import syntax?
5
+ const baseapi_1 = require("./baseapi");
6
+ const http_1 = require("../http/http");
7
+ const ObjectSerializer_1 = require("../models/ObjectSerializer");
8
+ const exception_1 = require("./exception");
9
+ const util_1 = require("../util");
10
+ /**
11
+ * no description
12
+ */
13
+ class CatalogProductsApiRequestFactory extends baseapi_1.BaseAPIRequestFactory {
14
+ /**
15
+ * Create a new Catalog product.
16
+ * Create Catalog product
17
+ * @param createCatalogProductRequest
18
+ */
19
+ async createCatalogProduct(createCatalogProductRequest, _options) {
20
+ let _config = _options || this.configuration;
21
+ // verify required parameter 'createCatalogProductRequest' is not null or undefined
22
+ if (createCatalogProductRequest === null || createCatalogProductRequest === undefined) {
23
+ throw new baseapi_1.RequiredError("CatalogProductsApi", "createCatalogProduct", "createCatalogProductRequest");
24
+ }
25
+ // Path Params
26
+ const localVarPath = '/catalogProducts';
27
+ // Make Request Context
28
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
29
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
30
+ // Body Params
31
+ const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
32
+ "application/json"
33
+ ]);
34
+ requestContext.setHeaderParam("Content-Type", contentType);
35
+ const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(createCatalogProductRequest, "CreateCatalogProductRequest", ""), contentType);
36
+ requestContext.setBody(serializedBody);
37
+ let authMethod;
38
+ // Apply auth methods
39
+ authMethod = _config.authMethods["BearerAuthorizer"];
40
+ if (authMethod?.applySecurityAuthentication) {
41
+ await authMethod?.applySecurityAuthentication(requestContext);
42
+ }
43
+ const defaultAuth = _options?.authMethods?.default || this.configuration?.authMethods?.default;
44
+ if (defaultAuth?.applySecurityAuthentication) {
45
+ await defaultAuth?.applySecurityAuthentication(requestContext);
46
+ }
47
+ return requestContext;
48
+ }
49
+ /**
50
+ * Delete a Catalog product by id.
51
+ * Delete Catalog product
52
+ * @param catalogProductId
53
+ */
54
+ async deleteCatalogProduct(catalogProductId, _options) {
55
+ let _config = _options || this.configuration;
56
+ // verify required parameter 'catalogProductId' is not null or undefined
57
+ if (catalogProductId === null || catalogProductId === undefined) {
58
+ throw new baseapi_1.RequiredError("CatalogProductsApi", "deleteCatalogProduct", "catalogProductId");
59
+ }
60
+ // Path Params
61
+ const localVarPath = '/catalogProducts/{catalogProductId}'
62
+ .replace('{' + 'catalogProductId' + '}', encodeURIComponent(String(catalogProductId)));
63
+ // Make Request Context
64
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
65
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
66
+ let authMethod;
67
+ // Apply auth methods
68
+ authMethod = _config.authMethods["BearerAuthorizer"];
69
+ if (authMethod?.applySecurityAuthentication) {
70
+ await authMethod?.applySecurityAuthentication(requestContext);
71
+ }
72
+ const defaultAuth = _options?.authMethods?.default || this.configuration?.authMethods?.default;
73
+ if (defaultAuth?.applySecurityAuthentication) {
74
+ await defaultAuth?.applySecurityAuthentication(requestContext);
75
+ }
76
+ return requestContext;
77
+ }
78
+ /**
79
+ * Get a Catalog product by id.
80
+ * Get Catalog product
81
+ * @param catalogProductId
82
+ */
83
+ async getCatalogProduct(catalogProductId, _options) {
84
+ let _config = _options || this.configuration;
85
+ // verify required parameter 'catalogProductId' is not null or undefined
86
+ if (catalogProductId === null || catalogProductId === undefined) {
87
+ throw new baseapi_1.RequiredError("CatalogProductsApi", "getCatalogProduct", "catalogProductId");
88
+ }
89
+ // Path Params
90
+ const localVarPath = '/catalogProducts/{catalogProductId}'
91
+ .replace('{' + 'catalogProductId' + '}', encodeURIComponent(String(catalogProductId)));
92
+ // Make Request Context
93
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
94
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
95
+ let authMethod;
96
+ // Apply auth methods
97
+ authMethod = _config.authMethods["BearerAuthorizer"];
98
+ if (authMethod?.applySecurityAuthentication) {
99
+ await authMethod?.applySecurityAuthentication(requestContext);
100
+ }
101
+ const defaultAuth = _options?.authMethods?.default || this.configuration?.authMethods?.default;
102
+ if (defaultAuth?.applySecurityAuthentication) {
103
+ await defaultAuth?.applySecurityAuthentication(requestContext);
104
+ }
105
+ return requestContext;
106
+ }
107
+ /**
108
+ * Get a list of Catalog products.
109
+ * List Catalog products
110
+ * @param limit
111
+ * @param cursor
112
+ */
113
+ async listCatalogProducts(limit, cursor, _options) {
114
+ let _config = _options || this.configuration;
115
+ // Path Params
116
+ const localVarPath = '/catalogProducts';
117
+ // Make Request Context
118
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
119
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
120
+ // Query Params
121
+ if (limit !== undefined) {
122
+ requestContext.setQueryParam("limit", ObjectSerializer_1.ObjectSerializer.serialize(limit, "number", ""));
123
+ }
124
+ // Query Params
125
+ if (cursor !== undefined) {
126
+ requestContext.setQueryParam("cursor", ObjectSerializer_1.ObjectSerializer.serialize(cursor, "string", ""));
127
+ }
128
+ let authMethod;
129
+ // Apply auth methods
130
+ authMethod = _config.authMethods["BearerAuthorizer"];
131
+ if (authMethod?.applySecurityAuthentication) {
132
+ await authMethod?.applySecurityAuthentication(requestContext);
133
+ }
134
+ const defaultAuth = _options?.authMethods?.default || this.configuration?.authMethods?.default;
135
+ if (defaultAuth?.applySecurityAuthentication) {
136
+ await defaultAuth?.applySecurityAuthentication(requestContext);
137
+ }
138
+ return requestContext;
139
+ }
140
+ /**
141
+ * Update a Catalog product by id.
142
+ * Update Catalog product
143
+ * @param updateCatalogProductRequest
144
+ * @param catalogProductId
145
+ */
146
+ async updateCatalogProduct(updateCatalogProductRequest, catalogProductId, _options) {
147
+ let _config = _options || this.configuration;
148
+ // verify required parameter 'updateCatalogProductRequest' is not null or undefined
149
+ if (updateCatalogProductRequest === null || updateCatalogProductRequest === undefined) {
150
+ throw new baseapi_1.RequiredError("CatalogProductsApi", "updateCatalogProduct", "updateCatalogProductRequest");
151
+ }
152
+ // verify required parameter 'catalogProductId' is not null or undefined
153
+ if (catalogProductId === null || catalogProductId === undefined) {
154
+ throw new baseapi_1.RequiredError("CatalogProductsApi", "updateCatalogProduct", "catalogProductId");
155
+ }
156
+ // Path Params
157
+ const localVarPath = '/catalogProducts/{catalogProductId}'
158
+ .replace('{' + 'catalogProductId' + '}', encodeURIComponent(String(catalogProductId)));
159
+ // Make Request Context
160
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.PUT);
161
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
162
+ // Body Params
163
+ const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
164
+ "application/json"
165
+ ]);
166
+ requestContext.setHeaderParam("Content-Type", contentType);
167
+ const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(updateCatalogProductRequest, "UpdateCatalogProductRequest", ""), contentType);
168
+ requestContext.setBody(serializedBody);
169
+ let authMethod;
170
+ // Apply auth methods
171
+ authMethod = _config.authMethods["BearerAuthorizer"];
172
+ if (authMethod?.applySecurityAuthentication) {
173
+ await authMethod?.applySecurityAuthentication(requestContext);
174
+ }
175
+ const defaultAuth = _options?.authMethods?.default || this.configuration?.authMethods?.default;
176
+ if (defaultAuth?.applySecurityAuthentication) {
177
+ await defaultAuth?.applySecurityAuthentication(requestContext);
178
+ }
179
+ return requestContext;
180
+ }
181
+ }
182
+ exports.CatalogProductsApiRequestFactory = CatalogProductsApiRequestFactory;
183
+ class CatalogProductsApiResponseProcessor {
184
+ /**
185
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
186
+ * to the expected objects
187
+ *
188
+ * @params response Response returned by the server for a request to createCatalogProduct
189
+ * @throws ApiException if the response code was not in [200, 299]
190
+ */
191
+ async createCatalogProductWithHttpInfo(response) {
192
+ const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
193
+ if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
194
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(await response.body.text(), contentType), "CreateCatalogProductResponse", "");
195
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
196
+ }
197
+ if ((0, util_1.isCodeInRange)("400", response.httpStatusCode)) {
198
+ throw new exception_1.ApiException(response.httpStatusCode, "Bad Request", undefined, response.headers);
199
+ }
200
+ if ((0, util_1.isCodeInRange)("401", response.httpStatusCode)) {
201
+ throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", undefined, response.headers);
202
+ }
203
+ if ((0, util_1.isCodeInRange)("429", response.httpStatusCode)) {
204
+ throw new exception_1.ApiException(response.httpStatusCode, "Too Many Requests", undefined, response.headers);
205
+ }
206
+ if ((0, util_1.isCodeInRange)("500", response.httpStatusCode)) {
207
+ throw new exception_1.ApiException(response.httpStatusCode, "Internal Server Error", undefined, response.headers);
208
+ }
209
+ // Work around for missing responses in specification, e.g. for petstore.yaml
210
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
211
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(await response.body.text(), contentType), "CreateCatalogProductResponse", "");
212
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
213
+ }
214
+ throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
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 deleteCatalogProduct
221
+ * @throws ApiException if the response code was not in [200, 299]
222
+ */
223
+ async deleteCatalogProductWithHttpInfo(response) {
224
+ const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
225
+ if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
226
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(await response.body.text(), contentType), "DeleteCatalogProductResponse", "");
227
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
228
+ }
229
+ if ((0, util_1.isCodeInRange)("400", response.httpStatusCode)) {
230
+ throw new exception_1.ApiException(response.httpStatusCode, "Bad Request", undefined, response.headers);
231
+ }
232
+ if ((0, util_1.isCodeInRange)("401", response.httpStatusCode)) {
233
+ throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", undefined, response.headers);
234
+ }
235
+ if ((0, util_1.isCodeInRange)("404", response.httpStatusCode)) {
236
+ throw new exception_1.ApiException(response.httpStatusCode, "Not Found", undefined, response.headers);
237
+ }
238
+ if ((0, util_1.isCodeInRange)("429", response.httpStatusCode)) {
239
+ throw new exception_1.ApiException(response.httpStatusCode, "Too Many Requests", undefined, response.headers);
240
+ }
241
+ if ((0, util_1.isCodeInRange)("500", response.httpStatusCode)) {
242
+ throw new exception_1.ApiException(response.httpStatusCode, "Internal Server Error", undefined, response.headers);
243
+ }
244
+ // Work around for missing responses in specification, e.g. for petstore.yaml
245
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
246
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(await response.body.text(), contentType), "DeleteCatalogProductResponse", "");
247
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
248
+ }
249
+ throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
250
+ }
251
+ /**
252
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
253
+ * to the expected objects
254
+ *
255
+ * @params response Response returned by the server for a request to getCatalogProduct
256
+ * @throws ApiException if the response code was not in [200, 299]
257
+ */
258
+ async getCatalogProductWithHttpInfo(response) {
259
+ const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
260
+ if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
261
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(await response.body.text(), contentType), "GetCatalogProductResponse", "");
262
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
263
+ }
264
+ if ((0, util_1.isCodeInRange)("400", response.httpStatusCode)) {
265
+ throw new exception_1.ApiException(response.httpStatusCode, "Bad Request", undefined, response.headers);
266
+ }
267
+ if ((0, util_1.isCodeInRange)("401", response.httpStatusCode)) {
268
+ throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", undefined, response.headers);
269
+ }
270
+ if ((0, util_1.isCodeInRange)("404", response.httpStatusCode)) {
271
+ throw new exception_1.ApiException(response.httpStatusCode, "Not Found", undefined, response.headers);
272
+ }
273
+ if ((0, util_1.isCodeInRange)("429", response.httpStatusCode)) {
274
+ throw new exception_1.ApiException(response.httpStatusCode, "Too Many Requests", undefined, response.headers);
275
+ }
276
+ if ((0, util_1.isCodeInRange)("500", response.httpStatusCode)) {
277
+ throw new exception_1.ApiException(response.httpStatusCode, "Internal Server Error", undefined, response.headers);
278
+ }
279
+ // Work around for missing responses in specification, e.g. for petstore.yaml
280
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
281
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(await response.body.text(), contentType), "GetCatalogProductResponse", "");
282
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
283
+ }
284
+ throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
285
+ }
286
+ /**
287
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
288
+ * to the expected objects
289
+ *
290
+ * @params response Response returned by the server for a request to listCatalogProducts
291
+ * @throws ApiException if the response code was not in [200, 299]
292
+ */
293
+ async listCatalogProductsWithHttpInfo(response) {
294
+ const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
295
+ if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
296
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(await response.body.text(), contentType), "ListCatalogProductsResponse", "");
297
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
298
+ }
299
+ if ((0, util_1.isCodeInRange)("400", response.httpStatusCode)) {
300
+ throw new exception_1.ApiException(response.httpStatusCode, "Bad Request", undefined, response.headers);
301
+ }
302
+ if ((0, util_1.isCodeInRange)("401", response.httpStatusCode)) {
303
+ throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", undefined, response.headers);
304
+ }
305
+ if ((0, util_1.isCodeInRange)("429", response.httpStatusCode)) {
306
+ throw new exception_1.ApiException(response.httpStatusCode, "Too Many Requests", undefined, response.headers);
307
+ }
308
+ if ((0, util_1.isCodeInRange)("500", response.httpStatusCode)) {
309
+ throw new exception_1.ApiException(response.httpStatusCode, "Internal Server Error", undefined, response.headers);
310
+ }
311
+ // Work around for missing responses in specification, e.g. for petstore.yaml
312
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
313
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(await response.body.text(), contentType), "ListCatalogProductsResponse", "");
314
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
315
+ }
316
+ throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
317
+ }
318
+ /**
319
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
320
+ * to the expected objects
321
+ *
322
+ * @params response Response returned by the server for a request to updateCatalogProduct
323
+ * @throws ApiException if the response code was not in [200, 299]
324
+ */
325
+ async updateCatalogProductWithHttpInfo(response) {
326
+ const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
327
+ if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
328
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(await response.body.text(), contentType), "UpdateCatalogProductResponse", "");
329
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
330
+ }
331
+ if ((0, util_1.isCodeInRange)("400", response.httpStatusCode)) {
332
+ throw new exception_1.ApiException(response.httpStatusCode, "Bad Request", undefined, response.headers);
333
+ }
334
+ if ((0, util_1.isCodeInRange)("401", response.httpStatusCode)) {
335
+ throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", undefined, response.headers);
336
+ }
337
+ if ((0, util_1.isCodeInRange)("404", response.httpStatusCode)) {
338
+ throw new exception_1.ApiException(response.httpStatusCode, "Not Found", undefined, response.headers);
339
+ }
340
+ if ((0, util_1.isCodeInRange)("429", response.httpStatusCode)) {
341
+ throw new exception_1.ApiException(response.httpStatusCode, "Too Many Requests", undefined, response.headers);
342
+ }
343
+ if ((0, util_1.isCodeInRange)("500", response.httpStatusCode)) {
344
+ throw new exception_1.ApiException(response.httpStatusCode, "Internal Server Error", undefined, response.headers);
345
+ }
346
+ // Work around for missing responses in specification, e.g. for petstore.yaml
347
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
348
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(await response.body.text(), contentType), "UpdateCatalogProductResponse", "");
349
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
350
+ }
351
+ throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
352
+ }
353
+ }
354
+ exports.CatalogProductsApiResponseProcessor = CatalogProductsApiResponseProcessor;
@@ -0,0 +1,25 @@
1
+ import { BaseAPIRequestFactory } from './baseapi';
2
+ import { Configuration } from '../configuration';
3
+ import { RequestContext, ResponseContext, HttpInfo } from '../http/http';
4
+ import { SubmitCloudUsageRequest } from '../models/SubmitCloudUsageRequest';
5
+ /**
6
+ * no description
7
+ */
8
+ export declare class CloudUsageSubmissionApiRequestFactory extends BaseAPIRequestFactory {
9
+ /**
10
+ * Submit cloud usage data
11
+ * Submit cloud usage
12
+ * @param submitCloudUsageRequest
13
+ */
14
+ submitCloudUsage(submitCloudUsageRequest: SubmitCloudUsageRequest, _options?: Configuration): Promise<RequestContext>;
15
+ }
16
+ export declare class CloudUsageSubmissionApiResponseProcessor {
17
+ /**
18
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
19
+ * to the expected objects
20
+ *
21
+ * @params response Response returned by the server for a request to submitCloudUsage
22
+ * @throws ApiException if the response code was not in [200, 299]
23
+ */
24
+ submitCloudUsageWithHttpInfo(response: ResponseContext): Promise<HttpInfo<any>>;
25
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CloudUsageSubmissionApiResponseProcessor = exports.CloudUsageSubmissionApiRequestFactory = void 0;
4
+ // TODO: better import syntax?
5
+ const baseapi_1 = require("./baseapi");
6
+ const http_1 = require("../http/http");
7
+ const ObjectSerializer_1 = require("../models/ObjectSerializer");
8
+ const exception_1 = require("./exception");
9
+ const util_1 = require("../util");
10
+ /**
11
+ * no description
12
+ */
13
+ class CloudUsageSubmissionApiRequestFactory extends baseapi_1.BaseAPIRequestFactory {
14
+ /**
15
+ * Submit cloud usage data
16
+ * Submit cloud usage
17
+ * @param submitCloudUsageRequest
18
+ */
19
+ async submitCloudUsage(submitCloudUsageRequest, _options) {
20
+ let _config = _options || this.configuration;
21
+ // verify required parameter 'submitCloudUsageRequest' is not null or undefined
22
+ if (submitCloudUsageRequest === null || submitCloudUsageRequest === undefined) {
23
+ throw new baseapi_1.RequiredError("CloudUsageSubmissionApi", "submitCloudUsage", "submitCloudUsageRequest");
24
+ }
25
+ // Path Params
26
+ const localVarPath = '/cloudUsageSubmission';
27
+ // Make Request Context
28
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
29
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
30
+ // Body Params
31
+ const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
32
+ "application/json"
33
+ ]);
34
+ requestContext.setHeaderParam("Content-Type", contentType);
35
+ const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(submitCloudUsageRequest, "SubmitCloudUsageRequest", ""), contentType);
36
+ requestContext.setBody(serializedBody);
37
+ let authMethod;
38
+ // Apply auth methods
39
+ authMethod = _config.authMethods["BearerAuthorizer"];
40
+ if (authMethod?.applySecurityAuthentication) {
41
+ await authMethod?.applySecurityAuthentication(requestContext);
42
+ }
43
+ const defaultAuth = _options?.authMethods?.default || this.configuration?.authMethods?.default;
44
+ if (defaultAuth?.applySecurityAuthentication) {
45
+ await defaultAuth?.applySecurityAuthentication(requestContext);
46
+ }
47
+ return requestContext;
48
+ }
49
+ }
50
+ exports.CloudUsageSubmissionApiRequestFactory = CloudUsageSubmissionApiRequestFactory;
51
+ class CloudUsageSubmissionApiResponseProcessor {
52
+ /**
53
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
54
+ * to the expected objects
55
+ *
56
+ * @params response Response returned by the server for a request to submitCloudUsage
57
+ * @throws ApiException if the response code was not in [200, 299]
58
+ */
59
+ async submitCloudUsageWithHttpInfo(response) {
60
+ const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
61
+ if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
62
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(await response.body.text(), contentType), "any", "");
63
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
64
+ }
65
+ if ((0, util_1.isCodeInRange)("400", response.httpStatusCode)) {
66
+ throw new exception_1.ApiException(response.httpStatusCode, "Bad Request", undefined, response.headers);
67
+ }
68
+ if ((0, util_1.isCodeInRange)("401", response.httpStatusCode)) {
69
+ throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", undefined, response.headers);
70
+ }
71
+ if ((0, util_1.isCodeInRange)("429", response.httpStatusCode)) {
72
+ throw new exception_1.ApiException(response.httpStatusCode, "Too Many Requests", undefined, response.headers);
73
+ }
74
+ if ((0, util_1.isCodeInRange)("500", response.httpStatusCode)) {
75
+ throw new exception_1.ApiException(response.httpStatusCode, "Internal Server Error", undefined, response.headers);
76
+ }
77
+ // Work around for missing responses in specification, e.g. for petstore.yaml
78
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
79
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(await response.body.text(), contentType), "any", "");
80
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
81
+ }
82
+ throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
83
+ }
84
+ }
85
+ exports.CloudUsageSubmissionApiResponseProcessor = CloudUsageSubmissionApiResponseProcessor;