vayu-ts 0.0.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 (255) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +202 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +17 -0
  5. package/dist/openapi/apis/AuthApi.d.ts +26 -0
  6. package/dist/openapi/apis/AuthApi.js +93 -0
  7. package/dist/openapi/apis/ContractsApi.d.ts +72 -0
  8. package/dist/openapi/apis/ContractsApi.js +307 -0
  9. package/dist/openapi/apis/CreditsApi.d.ts +57 -0
  10. package/dist/openapi/apis/CreditsApi.js +248 -0
  11. package/dist/openapi/apis/CustomersApi.d.ts +89 -0
  12. package/dist/openapi/apis/CustomersApi.js +388 -0
  13. package/dist/openapi/apis/EventsApi.d.ts +91 -0
  14. package/dist/openapi/apis/EventsApi.js +408 -0
  15. package/dist/openapi/apis/IntegrationsApi.d.ts +41 -0
  16. package/dist/openapi/apis/IntegrationsApi.js +170 -0
  17. package/dist/openapi/apis/InvoicesApi.d.ts +41 -0
  18. package/dist/openapi/apis/InvoicesApi.js +166 -0
  19. package/dist/openapi/apis/MetersApi.d.ts +73 -0
  20. package/dist/openapi/apis/MetersApi.js +316 -0
  21. package/dist/openapi/apis/PlansApi.d.ts +56 -0
  22. package/dist/openapi/apis/PlansApi.js +235 -0
  23. package/dist/openapi/apis/ReportsApi.d.ts +41 -0
  24. package/dist/openapi/apis/ReportsApi.js +166 -0
  25. package/dist/openapi/apis/WebhooksApi.d.ts +25 -0
  26. package/dist/openapi/apis/WebhooksApi.js +101 -0
  27. package/dist/openapi/apis/baseapi.d.ts +33 -0
  28. package/dist/openapi/apis/baseapi.js +41 -0
  29. package/dist/openapi/apis/exception.d.ts +19 -0
  30. package/dist/openapi/apis/exception.js +22 -0
  31. package/dist/openapi/auth/auth.d.ts +54 -0
  32. package/dist/openapi/auth/auth.js +50 -0
  33. package/dist/openapi/configuration.d.ts +63 -0
  34. package/dist/openapi/configuration.js +34 -0
  35. package/dist/openapi/http/http.d.ts +142 -0
  36. package/dist/openapi/http/http.js +229 -0
  37. package/dist/openapi/http/isomorphic-fetch.d.ts +5 -0
  38. package/dist/openapi/http/isomorphic-fetch.js +33 -0
  39. package/dist/openapi/index.d.ts +10 -0
  40. package/dist/openapi/index.js +38 -0
  41. package/dist/openapi/middleware.d.ts +54 -0
  42. package/dist/openapi/middleware.js +16 -0
  43. package/dist/openapi/models/AggregationMethod.d.ts +40 -0
  44. package/dist/openapi/models/AggregationMethod.js +46 -0
  45. package/dist/openapi/models/AggregationOperator.d.ts +24 -0
  46. package/dist/openapi/models/AggregationOperator.js +28 -0
  47. package/dist/openapi/models/BillingCycleStatus.d.ts +15 -0
  48. package/dist/openapi/models/BillingCycleStatus.js +19 -0
  49. package/dist/openapi/models/BillingInterval.d.ts +18 -0
  50. package/dist/openapi/models/BillingInterval.js +22 -0
  51. package/dist/openapi/models/Condition.d.ts +29 -0
  52. package/dist/openapi/models/Condition.js +31 -0
  53. package/dist/openapi/models/ContractStatus.d.ts +18 -0
  54. package/dist/openapi/models/ContractStatus.js +22 -0
  55. package/dist/openapi/models/CreateContractRequest.d.ts +43 -0
  56. package/dist/openapi/models/CreateContractRequest.js +49 -0
  57. package/dist/openapi/models/CreateContractResponse.d.ts +29 -0
  58. package/dist/openapi/models/CreateContractResponse.js +31 -0
  59. package/dist/openapi/models/CreateCustomerRequest.d.ts +35 -0
  60. package/dist/openapi/models/CreateCustomerRequest.js +37 -0
  61. package/dist/openapi/models/CreateCustomerResponse.d.ts +29 -0
  62. package/dist/openapi/models/CreateCustomerResponse.js +31 -0
  63. package/dist/openapi/models/CreateCustomerResponseCustomer.d.ts +38 -0
  64. package/dist/openapi/models/CreateCustomerResponseCustomer.js +55 -0
  65. package/dist/openapi/models/CreditLedgerEntry.d.ts +32 -0
  66. package/dist/openapi/models/CreditLedgerEntry.js +49 -0
  67. package/dist/openapi/models/Criterion.d.ts +31 -0
  68. package/dist/openapi/models/Criterion.js +43 -0
  69. package/dist/openapi/models/CriterionOperator.d.ts +23 -0
  70. package/dist/openapi/models/CriterionOperator.js +27 -0
  71. package/dist/openapi/models/Currency.d.ts +17 -0
  72. package/dist/openapi/models/Currency.js +21 -0
  73. package/dist/openapi/models/DeductCreditsRequest.d.ts +35 -0
  74. package/dist/openapi/models/DeductCreditsRequest.js +37 -0
  75. package/dist/openapi/models/DeleteContractResponse.d.ts +29 -0
  76. package/dist/openapi/models/DeleteContractResponse.js +31 -0
  77. package/dist/openapi/models/DeleteContractResponseContract.d.ts +47 -0
  78. package/dist/openapi/models/DeleteContractResponseContract.js +73 -0
  79. package/dist/openapi/models/DeleteCustomerResponse.d.ts +29 -0
  80. package/dist/openapi/models/DeleteCustomerResponse.js +31 -0
  81. package/dist/openapi/models/DeleteCustomerResponseCustomer.d.ts +39 -0
  82. package/dist/openapi/models/DeleteCustomerResponseCustomer.js +61 -0
  83. package/dist/openapi/models/DeleteEventResponse.d.ts +29 -0
  84. package/dist/openapi/models/DeleteEventResponse.js +31 -0
  85. package/dist/openapi/models/DeleteEventResponseEvent.d.ts +56 -0
  86. package/dist/openapi/models/DeleteEventResponseEvent.js +82 -0
  87. package/dist/openapi/models/DeleteMeterResponse.d.ts +29 -0
  88. package/dist/openapi/models/DeleteMeterResponse.js +31 -0
  89. package/dist/openapi/models/DeleteMeterResponseMeter.d.ts +43 -0
  90. package/dist/openapi/models/DeleteMeterResponseMeter.js +73 -0
  91. package/dist/openapi/models/DeletePlanResponse.d.ts +29 -0
  92. package/dist/openapi/models/DeletePlanResponse.js +31 -0
  93. package/dist/openapi/models/DeletePlanResponsePlan.d.ts +39 -0
  94. package/dist/openapi/models/DeletePlanResponsePlan.js +67 -0
  95. package/dist/openapi/models/Event.d.ts +49 -0
  96. package/dist/openapi/models/Event.js +55 -0
  97. package/dist/openapi/models/EventsDryRunRequest.d.ts +29 -0
  98. package/dist/openapi/models/EventsDryRunRequest.js +31 -0
  99. package/dist/openapi/models/EventsDryRunResponse.d.ts +29 -0
  100. package/dist/openapi/models/EventsDryRunResponse.js +31 -0
  101. package/dist/openapi/models/EventsDryRunResponseObject.d.ts +32 -0
  102. package/dist/openapi/models/EventsDryRunResponseObject.js +43 -0
  103. package/dist/openapi/models/EventsDryRunResponseObjectEvent.d.ts +35 -0
  104. package/dist/openapi/models/EventsDryRunResponseObjectEvent.js +61 -0
  105. package/dist/openapi/models/EventsDryRunResponseObjectMeterWithValuesInner.d.ts +41 -0
  106. package/dist/openapi/models/EventsDryRunResponseObjectMeterWithValuesInner.js +61 -0
  107. package/dist/openapi/models/Filter.d.ts +32 -0
  108. package/dist/openapi/models/Filter.js +34 -0
  109. package/dist/openapi/models/GetCommitmentReportResponse.d.ts +44 -0
  110. package/dist/openapi/models/GetCommitmentReportResponse.js +115 -0
  111. package/dist/openapi/models/GetContractResponse.d.ts +29 -0
  112. package/dist/openapi/models/GetContractResponse.js +31 -0
  113. package/dist/openapi/models/GetContractResponseContract.d.ts +46 -0
  114. package/dist/openapi/models/GetContractResponseContract.js +67 -0
  115. package/dist/openapi/models/GetCustomerResponse.d.ts +29 -0
  116. package/dist/openapi/models/GetCustomerResponse.js +31 -0
  117. package/dist/openapi/models/GetEventResponse.d.ts +29 -0
  118. package/dist/openapi/models/GetEventResponse.js +31 -0
  119. package/dist/openapi/models/GetEventResponseEvent.d.ts +55 -0
  120. package/dist/openapi/models/GetEventResponseEvent.js +76 -0
  121. package/dist/openapi/models/GetInvoiceResponse.d.ts +29 -0
  122. package/dist/openapi/models/GetInvoiceResponse.js +31 -0
  123. package/dist/openapi/models/GetInvoiceResponseInvoice.d.ts +50 -0
  124. package/dist/openapi/models/GetInvoiceResponseInvoice.js +79 -0
  125. package/dist/openapi/models/GetMeterResponse.d.ts +29 -0
  126. package/dist/openapi/models/GetMeterResponse.js +31 -0
  127. package/dist/openapi/models/GetMeterResponseMeter.d.ts +42 -0
  128. package/dist/openapi/models/GetMeterResponseMeter.js +67 -0
  129. package/dist/openapi/models/GetPlanResponse.d.ts +29 -0
  130. package/dist/openapi/models/GetPlanResponse.js +31 -0
  131. package/dist/openapi/models/GetPlanResponsePlan.d.ts +38 -0
  132. package/dist/openapi/models/GetPlanResponsePlan.js +61 -0
  133. package/dist/openapi/models/GetProductsUsageReportResponse.d.ts +44 -0
  134. package/dist/openapi/models/GetProductsUsageReportResponse.js +115 -0
  135. package/dist/openapi/models/GrantCreditsRequest.d.ts +35 -0
  136. package/dist/openapi/models/GrantCreditsRequest.js +37 -0
  137. package/dist/openapi/models/InvalidEvent.d.ts +33 -0
  138. package/dist/openapi/models/InvalidEvent.js +37 -0
  139. package/dist/openapi/models/LineItem.d.ts +35 -0
  140. package/dist/openapi/models/LineItem.js +37 -0
  141. package/dist/openapi/models/ListContractsResponse.d.ts +32 -0
  142. package/dist/openapi/models/ListContractsResponse.js +49 -0
  143. package/dist/openapi/models/ListCreditLedgerEntriesResponse.d.ts +32 -0
  144. package/dist/openapi/models/ListCreditLedgerEntriesResponse.js +31 -0
  145. package/dist/openapi/models/ListCustomersResponse.d.ts +32 -0
  146. package/dist/openapi/models/ListCustomersResponse.js +49 -0
  147. package/dist/openapi/models/ListInvoicesResponse.d.ts +32 -0
  148. package/dist/openapi/models/ListInvoicesResponse.js +49 -0
  149. package/dist/openapi/models/ListMetersResponse.d.ts +32 -0
  150. package/dist/openapi/models/ListMetersResponse.js +49 -0
  151. package/dist/openapi/models/ListPlansResponse.d.ts +32 -0
  152. package/dist/openapi/models/ListPlansResponse.js +49 -0
  153. package/dist/openapi/models/LoginRequest.d.ts +31 -0
  154. package/dist/openapi/models/LoginRequest.js +31 -0
  155. package/dist/openapi/models/LoginResponse.d.ts +31 -0
  156. package/dist/openapi/models/LoginResponse.js +31 -0
  157. package/dist/openapi/models/Meter.d.ts +39 -0
  158. package/dist/openapi/models/Meter.js +49 -0
  159. package/dist/openapi/models/NetSuiteExportSalesOrderRequest.d.ts +30 -0
  160. package/dist/openapi/models/NetSuiteExportSalesOrderRequest.js +43 -0
  161. package/dist/openapi/models/NetSuiteSyncInvoicesRequest.d.ts +34 -0
  162. package/dist/openapi/models/NetSuiteSyncInvoicesRequest.js +47 -0
  163. package/dist/openapi/models/NetSuiteSyncInvoicesRequestData.d.ts +39 -0
  164. package/dist/openapi/models/NetSuiteSyncInvoicesRequestData.js +85 -0
  165. package/dist/openapi/models/NetSuiteSyncInvoicesRequestDataEntity.d.ts +28 -0
  166. package/dist/openapi/models/NetSuiteSyncInvoicesRequestDataEntity.js +31 -0
  167. package/dist/openapi/models/NetSuiteSyncInvoicesRequestDataItem.d.ts +29 -0
  168. package/dist/openapi/models/NetSuiteSyncInvoicesRequestDataItem.js +31 -0
  169. package/dist/openapi/models/NetSuiteSyncInvoicesRequestDataItemItemsInner.d.ts +33 -0
  170. package/dist/openapi/models/NetSuiteSyncInvoicesRequestDataItemItemsInner.js +55 -0
  171. package/dist/openapi/models/NetSuiteSyncInvoicesResponse.d.ts +29 -0
  172. package/dist/openapi/models/NetSuiteSyncInvoicesResponse.js +37 -0
  173. package/dist/openapi/models/NotificationEventType.d.ts +17 -0
  174. package/dist/openapi/models/NotificationEventType.js +21 -0
  175. package/dist/openapi/models/ObjectSerializer.d.ts +106 -0
  176. package/dist/openapi/models/ObjectSerializer.js +488 -0
  177. package/dist/openapi/models/PaymentTerm.d.ts +15 -0
  178. package/dist/openapi/models/PaymentTerm.js +19 -0
  179. package/dist/openapi/models/Period.d.ts +32 -0
  180. package/dist/openapi/models/Period.js +40 -0
  181. package/dist/openapi/models/PlanBillingData.d.ts +37 -0
  182. package/dist/openapi/models/PlanBillingData.js +58 -0
  183. package/dist/openapi/models/PlanStatus.d.ts +19 -0
  184. package/dist/openapi/models/PlanStatus.js +23 -0
  185. package/dist/openapi/models/QueryEventsResponse.d.ts +32 -0
  186. package/dist/openapi/models/QueryEventsResponse.js +31 -0
  187. package/dist/openapi/models/QueryEventsResponseEventsInner.d.ts +52 -0
  188. package/dist/openapi/models/QueryEventsResponseEventsInner.js +73 -0
  189. package/dist/openapi/models/SendEventsRequest.d.ts +29 -0
  190. package/dist/openapi/models/SendEventsRequest.js +31 -0
  191. package/dist/openapi/models/SendEventsResponse.d.ts +37 -0
  192. package/dist/openapi/models/SendEventsResponse.js +37 -0
  193. package/dist/openapi/models/UpdateCustomerRequest.d.ts +35 -0
  194. package/dist/openapi/models/UpdateCustomerRequest.js +37 -0
  195. package/dist/openapi/models/UpdateCustomerResponse.d.ts +29 -0
  196. package/dist/openapi/models/UpdateCustomerResponse.js +31 -0
  197. package/dist/openapi/models/UpdateMeterRequest.d.ts +39 -0
  198. package/dist/openapi/models/UpdateMeterRequest.js +49 -0
  199. package/dist/openapi/models/UpdateMeterResponse.d.ts +29 -0
  200. package/dist/openapi/models/UpdateMeterResponse.js +31 -0
  201. package/dist/openapi/models/WebhookSubscribeRequest.d.ts +30 -0
  202. package/dist/openapi/models/WebhookSubscribeRequest.js +37 -0
  203. package/dist/openapi/models/all.d.ts +79 -0
  204. package/dist/openapi/models/all.js +95 -0
  205. package/dist/openapi/rxjsStub.d.ts +10 -0
  206. package/dist/openapi/rxjsStub.js +31 -0
  207. package/dist/openapi/servers.d.ts +39 -0
  208. package/dist/openapi/servers.js +52 -0
  209. package/dist/openapi/types/ObjectParamAPI.d.ts +825 -0
  210. package/dist/openapi/types/ObjectParamAPI.js +590 -0
  211. package/dist/openapi/types/ObservableAPI.d.ts +532 -0
  212. package/dist/openapi/types/ObservableAPI.js +1060 -0
  213. package/dist/openapi/types/PromiseAPI.d.ts +509 -0
  214. package/dist/openapi/types/PromiseAPI.js +684 -0
  215. package/dist/openapi/util.d.ts +15 -0
  216. package/dist/openapi/util.js +42 -0
  217. package/dist/sdk/clients/ContractsClient.d.ts +10 -0
  218. package/dist/sdk/clients/ContractsClient.js +42 -0
  219. package/dist/sdk/clients/CustomersClient.d.ts +11 -0
  220. package/dist/sdk/clients/CustomersClient.js +47 -0
  221. package/dist/sdk/clients/EventsClient.d.ts +11 -0
  222. package/dist/sdk/clients/EventsClient.js +49 -0
  223. package/dist/sdk/clients/InvoicesClient.d.ts +7 -0
  224. package/dist/sdk/clients/InvoicesClient.js +32 -0
  225. package/dist/sdk/clients/MetersClient.d.ts +10 -0
  226. package/dist/sdk/clients/MetersClient.js +42 -0
  227. package/dist/sdk/clients/PlansClient.d.ts +8 -0
  228. package/dist/sdk/clients/PlansClient.js +37 -0
  229. package/dist/sdk/clients/index.d.ts +6 -0
  230. package/dist/sdk/clients/index.js +22 -0
  231. package/dist/sdk/index.d.ts +13 -0
  232. package/dist/sdk/index.js +59 -0
  233. package/dist/sdk/services/configuration.service.d.ts +21 -0
  234. package/dist/sdk/services/configuration.service.js +104 -0
  235. package/dist/sdk/services/index.d.ts +1 -0
  236. package/dist/sdk/services/index.js +17 -0
  237. package/dist/sdk/types/Contracts.d.ts +1 -0
  238. package/dist/sdk/types/Contracts.js +2 -0
  239. package/dist/sdk/types/Customers.d.ts +1 -0
  240. package/dist/sdk/types/Customers.js +2 -0
  241. package/dist/sdk/types/Events.d.ts +1 -0
  242. package/dist/sdk/types/Events.js +2 -0
  243. package/dist/sdk/types/Invoices.d.ts +1 -0
  244. package/dist/sdk/types/Invoices.js +2 -0
  245. package/dist/sdk/types/Meters.d.ts +1 -0
  246. package/dist/sdk/types/Meters.js +2 -0
  247. package/dist/sdk/types/Plans.d.ts +1 -0
  248. package/dist/sdk/types/Plans.js +2 -0
  249. package/dist/sdk/types/index.d.ts +7 -0
  250. package/dist/sdk/types/index.js +23 -0
  251. package/dist/sdk/types/pagination-options.d.ts +4 -0
  252. package/dist/sdk/types/pagination-options.js +2 -0
  253. package/dist/types.d.ts +1 -0
  254. package/dist/types.js +17 -0
  255. package/package.json +51 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 weft-finance
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,202 @@
1
+ # Vayu API Client Library ![client version](https://img.shields.io/npm/v/vayu-ts?label=Latest%20Version)
2
+
3
+ ## Overview
4
+
5
+ The Vayu API client library in TypeScript allows you to submit events for processing and storage, manage billing-related entities, and perform various other operations seamlessly.
6
+
7
+ ## Installation
8
+
9
+ Install the Vayu API client library using npm:
10
+
11
+ ```bash
12
+ npm i vayu-ts
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ### Initialization
18
+
19
+ Initialize the Vayu API client. The `baseUrl` parameter is optional and defaults to Vayu's public API servers.
20
+
21
+ ```typescript
22
+ import { Vayu } from 'vayu-ts';
23
+
24
+ const vayu = new Vayu(
25
+ 'your-access-token',
26
+ );
27
+ ```
28
+
29
+ ### Authentication
30
+
31
+ #### Login and authenticate
32
+
33
+ ```typescript
34
+ await vayu.login();
35
+ ```
36
+
37
+ ### Events
38
+
39
+ #### Sending Events
40
+
41
+ To send a batch of events for processing and storage:
42
+
43
+ ```typescript
44
+ const events: Event[] = [
45
+ {
46
+ name: 'api_call', // The distinctive label assigned to an event
47
+ timestamp: new Date().toISOString(), // The exact moment of event occurrence in ISO 8601 format
48
+ customerAlias: 'customer_12345', // A unique identifier assigned to each customer
49
+ ref: '4f6cf35x-2c4y-483z-a0a9-158621f77a21', // A universally unique identifier for each event
50
+ data: {
51
+ key1: 'processing_duration', // Example additional data
52
+ key2: 'api_url' // Example additional data
53
+ }
54
+ }
55
+ ];
56
+
57
+ const response = await vayu.events.send(events);
58
+
59
+ console.log(response.validEvents);
60
+ console.log(response.invalidEvents);
61
+ ```
62
+
63
+ #### Querying Events
64
+
65
+ To fetch events occurring within a specified timestamp range:
66
+
67
+ ```typescript
68
+ const response = await vayu.events.query({
69
+ startTime: '2023-09-01T00:00:00.000Z',
70
+ endTime: '2023-09-30T23:59:59.999Z',
71
+ eventName: 'api_call',
72
+ limit: 10
73
+ });
74
+
75
+ console.log(response.events);
76
+ ```
77
+
78
+ #### Getting Event by Ref ID
79
+
80
+ To get a specific event using its reference ID:
81
+
82
+ ```typescript
83
+ const response = await vayu.events.get('4f6cf35x-2c4y-483z-a0a9-158621f77a21');
84
+
85
+ console.log(response.event);
86
+ ```
87
+
88
+ #### Deleting Event by Ref ID
89
+
90
+ To delete a specific event using its reference ID:
91
+
92
+ ```typescript
93
+ const response = await vayu.events.delete('4f6cf35x-2c4y-483z-a0a9-158621f77a21');
94
+
95
+ console.log(response.event);
96
+ ```
97
+
98
+ ### Customers
99
+
100
+ #### Creating a Customer
101
+
102
+ To create a new customer:
103
+
104
+ ```typescript
105
+ const response = await vayu.customers.create({
106
+ name: 'John Doe',
107
+ alias: 'customer_12345'
108
+ });
109
+
110
+ console.log(response.customer);
111
+ ```
112
+
113
+ #### Updating a Customer
114
+
115
+ To update an existing customer by ID:
116
+
117
+ ```typescript
118
+ const response = await vayu.customers.update('customer-id', {
119
+ name: 'Jane Doe',
120
+ alias: 'customer_67890'
121
+ });
122
+
123
+ console.log(response.customer);
124
+ ```
125
+
126
+ #### Deleting a Customer
127
+
128
+ To delete a customer by ID:
129
+
130
+ ```typescript
131
+ const response = await vayu.customers.delete('customer-id');
132
+
133
+ console.log(response.customer);
134
+ ```
135
+
136
+ ### Meters
137
+
138
+ Meters are entities that track and aggregate usage data based on events. They are crucial for billing and monitoring purposes.
139
+
140
+ #### Listing Meters
141
+
142
+ To get a list of meters:
143
+
144
+ ```typescript
145
+ const response = await vayu.meters.list({
146
+ limit: 10,
147
+ cursor: 'next-cursor'
148
+ });
149
+
150
+ console.log(response.meters);
151
+ console.log(response.total);
152
+ console.log(response.hasMore);
153
+ console.log(response.nextCursor);
154
+ ```
155
+
156
+ ## Features
157
+
158
+ The Vayu API client library provides access to the following features:
159
+
160
+ - **Auth**
161
+ - `auth.login()`
162
+ - **Events**
163
+ - `events.sendEvents()`
164
+ - `events.queryEvents()`
165
+ - `events.getEventByRefId()`
166
+ - `events.deleteEventByRefId()`
167
+ - `events.sendEventsDryRun()`
168
+ - **Customers**
169
+ - `customers.createCustomer()`
170
+ - `customers.updateCustomer()`
171
+ - `customers.deleteCustomer()`
172
+ - `customers.listCustomers()`
173
+ - `customers.getCustomer()`
174
+ - **Meters**
175
+ - `meters.getMeter()`
176
+ - `meters.updateMeter()`
177
+ - `meters.deleteMeter()`
178
+ - `meters.listMeters()`
179
+ - **Plans**
180
+ - `plans.getPlan()`
181
+ - `plans.deletePlan()`
182
+ - `plans.listPlans()`
183
+ - **Contracts**
184
+ - `contracts.createContract()`
185
+ - `contracts.deleteContract()`
186
+ - `contracts.listContracts()`
187
+ - `contracts.getContract()`
188
+ - **Invoices**
189
+ - `invoices.getInvoice()`
190
+ - `invoices.listInvoices()`
191
+
192
+ ## Support
193
+
194
+ If you have any questions or need further assistance, please contact Vayu at `team@withvayu.com`.
195
+
196
+ ## License
197
+
198
+ This project is licensed under the MIT License.
199
+
200
+ ---
201
+
202
+ This README provides an overview and usage examples for the Vayu API client library. For more detailed information on each method, please refer to the official Vayu API documentation.
@@ -0,0 +1 @@
1
+ export * from './sdk';
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./sdk"), exports);
@@ -0,0 +1,26 @@
1
+ import { BaseAPIRequestFactory } from './baseapi';
2
+ import { Configuration } from '../configuration';
3
+ import { RequestContext, ResponseContext, HttpInfo } from '../http/http';
4
+ import { LoginRequest } from '../models/LoginRequest';
5
+ import { LoginResponse } from '../models/LoginResponse';
6
+ /**
7
+ * no description
8
+ */
9
+ export declare class AuthApiRequestFactory extends BaseAPIRequestFactory {
10
+ /**
11
+ * This endpoint is designed to acquire a temporary access token. Submit the auth token in the request body to obtain a new access token. Use this new token for subsequent API calls. Token is set to expire every hour.
12
+ * Login by obtaining a new access token
13
+ * @param loginRequest
14
+ */
15
+ login(loginRequest: LoginRequest, _options?: Configuration): Promise<RequestContext>;
16
+ }
17
+ export declare class AuthApiResponseProcessor {
18
+ /**
19
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
20
+ * to the expected objects
21
+ *
22
+ * @params response Response returned by the server for a request to login
23
+ * @throws ApiException if the response code was not in [200, 299]
24
+ */
25
+ loginWithHttpInfo(response: ResponseContext): Promise<HttpInfo<LoginResponse>>;
26
+ }
@@ -0,0 +1,93 @@
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.AuthApiResponseProcessor = exports.AuthApiRequestFactory = 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 AuthApiRequestFactory extends baseapi_1.BaseAPIRequestFactory {
23
+ /**
24
+ * This endpoint is designed to acquire a temporary access token. Submit the auth token in the request body to obtain a new access token. Use this new token for subsequent API calls. Token is set to expire every hour.
25
+ * Login by obtaining a new access token
26
+ * @param loginRequest
27
+ */
28
+ login(loginRequest, _options) {
29
+ var _a, _b, _c;
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ let _config = _options || this.configuration;
32
+ // verify required parameter 'loginRequest' is not null or undefined
33
+ if (loginRequest === null || loginRequest === undefined) {
34
+ throw new baseapi_1.RequiredError("AuthApi", "login", "loginRequest");
35
+ }
36
+ // Path Params
37
+ const localVarPath = '/login';
38
+ // Make Request Context
39
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
40
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
41
+ // Body Params
42
+ const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
43
+ "application/json"
44
+ ]);
45
+ requestContext.setHeaderParam("Content-Type", contentType);
46
+ const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(loginRequest, "LoginRequest", ""), contentType);
47
+ requestContext.setBody(serializedBody);
48
+ 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);
49
+ if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
50
+ yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
51
+ }
52
+ return requestContext;
53
+ });
54
+ }
55
+ }
56
+ exports.AuthApiRequestFactory = AuthApiRequestFactory;
57
+ class AuthApiResponseProcessor {
58
+ /**
59
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
60
+ * to the expected objects
61
+ *
62
+ * @params response Response returned by the server for a request to login
63
+ * @throws ApiException if the response code was not in [200, 299]
64
+ */
65
+ loginWithHttpInfo(response) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
68
+ if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
69
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "LoginResponse", "");
70
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
71
+ }
72
+ if ((0, util_1.isCodeInRange)("400", response.httpStatusCode)) {
73
+ throw new exception_1.ApiException(response.httpStatusCode, "Bad Request", undefined, response.headers);
74
+ }
75
+ if ((0, util_1.isCodeInRange)("401", response.httpStatusCode)) {
76
+ throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", undefined, response.headers);
77
+ }
78
+ if ((0, util_1.isCodeInRange)("429", response.httpStatusCode)) {
79
+ throw new exception_1.ApiException(response.httpStatusCode, "Too Many Requests", undefined, response.headers);
80
+ }
81
+ if ((0, util_1.isCodeInRange)("500", response.httpStatusCode)) {
82
+ throw new exception_1.ApiException(response.httpStatusCode, "Internal Server Error", undefined, response.headers);
83
+ }
84
+ // Work around for missing responses in specification, e.g. for petstore.yaml
85
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
86
+ const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "LoginResponse", "");
87
+ return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
88
+ }
89
+ throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
90
+ });
91
+ }
92
+ }
93
+ exports.AuthApiResponseProcessor = AuthApiResponseProcessor;
@@ -0,0 +1,72 @@
1
+ import { BaseAPIRequestFactory } from './baseapi';
2
+ import { Configuration } from '../configuration';
3
+ import { RequestContext, ResponseContext, HttpInfo } from '../http/http';
4
+ import { CreateContractRequest } from '../models/CreateContractRequest';
5
+ import { CreateContractResponse } from '../models/CreateContractResponse';
6
+ import { DeleteContractResponse } from '../models/DeleteContractResponse';
7
+ import { GetContractResponse } from '../models/GetContractResponse';
8
+ import { ListContractsResponse } from '../models/ListContractsResponse';
9
+ /**
10
+ * no description
11
+ */
12
+ export declare class ContractsApiRequestFactory extends BaseAPIRequestFactory {
13
+ /**
14
+ * Create a new Contract.
15
+ * Create Contract
16
+ * @param createContractRequest
17
+ */
18
+ createContract(createContractRequest: CreateContractRequest, _options?: Configuration): Promise<RequestContext>;
19
+ /**
20
+ * Delete a Contract by id.
21
+ * Delete Contract
22
+ * @param contractId
23
+ */
24
+ deleteContract(contractId: string, _options?: Configuration): Promise<RequestContext>;
25
+ /**
26
+ * Get a Contract by id.
27
+ * Get Contract
28
+ * @param contractId
29
+ */
30
+ getContract(contractId: string, _options?: Configuration): Promise<RequestContext>;
31
+ /**
32
+ * Get a list of Contracts.
33
+ * List Contracts
34
+ * @param limit
35
+ * @param cursor
36
+ */
37
+ listContracts(limit?: number, cursor?: string, _options?: Configuration): Promise<RequestContext>;
38
+ }
39
+ export declare class ContractsApiResponseProcessor {
40
+ /**
41
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
42
+ * to the expected objects
43
+ *
44
+ * @params response Response returned by the server for a request to createContract
45
+ * @throws ApiException if the response code was not in [200, 299]
46
+ */
47
+ createContractWithHttpInfo(response: ResponseContext): Promise<HttpInfo<CreateContractResponse>>;
48
+ /**
49
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
50
+ * to the expected objects
51
+ *
52
+ * @params response Response returned by the server for a request to deleteContract
53
+ * @throws ApiException if the response code was not in [200, 299]
54
+ */
55
+ deleteContractWithHttpInfo(response: ResponseContext): Promise<HttpInfo<DeleteContractResponse>>;
56
+ /**
57
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
58
+ * to the expected objects
59
+ *
60
+ * @params response Response returned by the server for a request to getContract
61
+ * @throws ApiException if the response code was not in [200, 299]
62
+ */
63
+ getContractWithHttpInfo(response: ResponseContext): Promise<HttpInfo<GetContractResponse>>;
64
+ /**
65
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
66
+ * to the expected objects
67
+ *
68
+ * @params response Response returned by the server for a request to listContracts
69
+ * @throws ApiException if the response code was not in [200, 299]
70
+ */
71
+ listContractsWithHttpInfo(response: ResponseContext): Promise<HttpInfo<ListContractsResponse>>;
72
+ }