@astrada.co/ts-astrada-sdk 1.1.0 → 1.3.0

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 (251) hide show
  1. package/.github/workflows/api-sdk-release.yml +33 -20
  2. package/CHANGELOG.md +2 -2
  3. package/LICENSE +21 -0
  4. package/README.md +0 -2
  5. package/dist/apis/CardApi.js +218 -0
  6. package/dist/apis/CardSubscriptionApi.js +268 -0
  7. package/dist/apis/CardholderApi.js +138 -0
  8. package/dist/apis/EnrollmentMethodsApi.js +139 -0
  9. package/dist/apis/NetworkBulkFeedsApi.js +264 -0
  10. package/dist/apis/SubaccountsApi.js +319 -0
  11. package/dist/apis/TransactionMessagesApi.js +138 -0
  12. package/dist/apis/TransactionsApi.js +215 -0
  13. package/dist/apis/WebhooksApi.js +380 -0
  14. package/{lib → dist}/models/Card.js +5 -4
  15. package/{lib → dist}/models/CardLinks.js +3 -2
  16. package/{lib → dist}/models/CardSubscription.js +7 -6
  17. package/{lib → dist}/models/CardSubscriptionLinks.js +3 -2
  18. package/{lib → dist}/models/Cardholder.js +6 -5
  19. package/{lib → dist}/models/CardholderCorporate.js +2 -1
  20. package/{lib → dist}/models/CardholderLinks.js +3 -2
  21. package/{lib → dist}/models/Conflict.js +2 -1
  22. package/{lib → dist}/models/CreateNetworkBulkFeedRequest.js +2 -1
  23. package/{lib → dist}/models/CreateSubaccountRequest.js +3 -2
  24. package/{lib → dist}/models/CreateWebhook201Response.d.ts +2 -0
  25. package/{lib → dist}/models/CreateWebhook201Response.js +8 -5
  26. package/{lib → dist}/models/CreateWebhookRequest.d.ts +2 -0
  27. package/{lib → dist}/models/CreateWebhookRequest.js +5 -2
  28. package/{lib → dist}/models/EnrollmentMethods200Response.js +2 -1
  29. package/dist/models/EnrollmentMethods413Response.d.ts +45 -0
  30. package/dist/models/EnrollmentMethods413Response.js +62 -0
  31. package/{lib → dist}/models/EnrollmentMethodsRequest.js +2 -1
  32. package/dist/models/GetCardSubscription404Response.d.ts +57 -0
  33. package/dist/models/GetCardSubscription404Response.js +66 -0
  34. package/{lib → dist}/models/GetSubaccounts200Response.js +4 -3
  35. package/{lib → dist}/models/GetSubaccounts200ResponseEmbedded.js +3 -2
  36. package/{lib → dist}/models/GetSubaccounts200ResponseLinks.js +3 -2
  37. package/{lib → dist}/models/GetTransactions200Response.js +4 -3
  38. package/{lib → dist}/models/GetTransactions200ResponseEmbedded.js +3 -2
  39. package/{lib → dist}/models/InlineObject.js +3 -2
  40. package/{lib → dist}/models/InlineObject1.js +2 -1
  41. package/{lib → dist}/models/InlineObject2.js +2 -1
  42. package/{lib → dist}/models/InlineObject3.js +2 -1
  43. package/{lib → dist}/models/InlineObject4.js +2 -1
  44. package/{lib → dist}/models/InlineObject5.js +2 -1
  45. package/{lib → dist}/models/InlineObjectErrorsInner.js +2 -1
  46. package/{lib → dist}/models/Link.js +2 -1
  47. package/{lib → dist}/models/ListCardSubscriptions200Response.js +4 -3
  48. package/{lib → dist}/models/ListCardSubscriptions200ResponseEmbedded.js +3 -2
  49. package/{lib → dist}/models/ListCardSubscriptions200ResponseLinks.js +3 -2
  50. package/dist/models/ListCardSubscriptions400Response.d.ts +52 -0
  51. package/dist/models/ListCardSubscriptions400Response.js +65 -0
  52. package/dist/models/ListCardSubscriptions400ResponseErrorsInner.d.ts +38 -0
  53. package/dist/models/ListCardSubscriptions400ResponseErrorsInner.js +55 -0
  54. package/dist/models/ListCardSubscriptions401Response.d.ts +45 -0
  55. package/dist/models/ListCardSubscriptions401Response.js +62 -0
  56. package/dist/models/ListCardSubscriptions403Response.d.ts +45 -0
  57. package/dist/models/ListCardSubscriptions403Response.js +62 -0
  58. package/dist/models/ListCardSubscriptions500Response.d.ts +45 -0
  59. package/dist/models/ListCardSubscriptions500Response.js +62 -0
  60. package/{lib → dist}/models/ListCards200Response.js +4 -3
  61. package/{lib → dist}/models/ListCards200ResponseEmbedded.js +3 -2
  62. package/{lib → dist}/models/ListNetworkBulkFeeds200Response.js +4 -3
  63. package/{lib → dist}/models/ListNetworkBulkFeeds200ResponseEmbedded.js +3 -2
  64. package/{lib → dist}/models/ListWebhooks200Response.js +4 -3
  65. package/{lib → dist}/models/ListWebhooks200ResponseEmbedded.js +3 -2
  66. package/{lib → dist}/models/ListWebhooks200ResponseLinks.js +3 -2
  67. package/{lib → dist}/models/NetworkBulkFeeds.d.ts +16 -1
  68. package/{lib → dist}/models/NetworkBulkFeeds.js +18 -5
  69. package/{lib → dist}/models/Subaccount.js +6 -5
  70. package/{lib → dist}/models/SubaccountConfiguration.js +3 -2
  71. package/{lib → dist}/models/SubaccountConfigurationVISA.js +2 -1
  72. package/{lib → dist}/models/Transaction.js +7 -6
  73. package/{lib → dist}/models/TransactionAcceptor.js +2 -1
  74. package/{lib → dist}/models/TransactionLinks.js +3 -2
  75. package/{lib → dist}/models/TransactionMessage.js +7 -6
  76. package/{lib → dist}/models/TransactionMessageAcceptor.js +2 -1
  77. package/{lib → dist}/models/UnprocessableEntity.js +2 -1
  78. package/{lib → dist}/models/UpdateCardSubscriptionRequest.js +2 -1
  79. package/{lib → dist}/models/UpdateSubaccountRequest.js +3 -2
  80. package/{lib → dist}/models/UpdateWebhookRequest.d.ts +2 -0
  81. package/{lib → dist}/models/UpdateWebhookRequest.js +5 -2
  82. package/{lib → dist}/models/Webhook.d.ts +2 -0
  83. package/{lib → dist}/models/Webhook.js +8 -5
  84. package/{lib → dist}/models/index.d.ts +7 -7
  85. package/{lib → dist}/models/index.js +7 -7
  86. package/dist/runtime.js +638 -0
  87. package/docs/Card.md +54 -0
  88. package/docs/CardApi.md +176 -0
  89. package/docs/CardLinks.md +36 -0
  90. package/docs/CardSubscription.md +56 -0
  91. package/docs/CardSubscriptionApi.md +252 -0
  92. package/docs/CardSubscriptionLinks.md +38 -0
  93. package/docs/Cardholder.md +44 -0
  94. package/docs/CardholderApi.md +85 -0
  95. package/docs/CardholderCorporate.md +37 -0
  96. package/docs/CardholderLinks.md +34 -0
  97. package/docs/Conflict.md +40 -0
  98. package/docs/CreateNetworkBulkFeedRequest.md +38 -0
  99. package/docs/CreateSubaccountRequest.md +36 -0
  100. package/docs/CreateWebhook201Response.md +52 -0
  101. package/docs/CreateWebhookRequest.md +42 -0
  102. package/docs/EnrollmentMethods200Response.md +34 -0
  103. package/docs/EnrollmentMethods413Response.md +36 -0
  104. package/docs/EnrollmentMethodsApi.md +85 -0
  105. package/docs/EnrollmentMethodsRequest.md +34 -0
  106. package/docs/GetCardSubscription404Response.md +40 -0
  107. package/docs/GetSubaccounts200Response.md +36 -0
  108. package/docs/GetSubaccounts200ResponseEmbedded.md +34 -0
  109. package/docs/GetSubaccounts200ResponseLinks.md +36 -0
  110. package/docs/GetTransactions200Response.md +36 -0
  111. package/docs/GetTransactions200ResponseEmbedded.md +34 -0
  112. package/docs/Link.md +48 -0
  113. package/docs/ListCardSubscriptions200Response.md +38 -0
  114. package/docs/ListCardSubscriptions200ResponseEmbedded.md +34 -0
  115. package/docs/ListCardSubscriptions200ResponseLinks.md +42 -0
  116. package/docs/ListCardSubscriptions400Response.md +38 -0
  117. package/docs/ListCardSubscriptions400ResponseErrorsInner.md +36 -0
  118. package/docs/ListCardSubscriptions401Response.md +36 -0
  119. package/docs/ListCardSubscriptions403Response.md +36 -0
  120. package/docs/ListCardSubscriptions500Response.md +36 -0
  121. package/docs/ListCards200Response.md +38 -0
  122. package/docs/ListCards200ResponseEmbedded.md +34 -0
  123. package/docs/ListNetworkBulkFeeds200Response.md +38 -0
  124. package/docs/ListNetworkBulkFeeds200ResponseEmbedded.md +34 -0
  125. package/docs/ListWebhooks200Response.md +37 -0
  126. package/docs/ListWebhooks200ResponseEmbedded.md +34 -0
  127. package/docs/ListWebhooks200ResponseLinks.md +36 -0
  128. package/docs/NetworkBulkFeeds.md +48 -0
  129. package/docs/NetworkBulkFeedsApi.md +247 -0
  130. package/docs/Subaccount.md +46 -0
  131. package/docs/SubaccountConfiguration.md +37 -0
  132. package/docs/SubaccountConfigurationVISA.md +34 -0
  133. package/docs/SubaccountsApi.md +321 -0
  134. package/docs/Transaction.md +66 -0
  135. package/docs/TransactionAcceptor.md +41 -0
  136. package/docs/TransactionLinks.md +40 -0
  137. package/docs/TransactionMessage.md +70 -0
  138. package/docs/TransactionMessageAcceptor.md +47 -0
  139. package/docs/TransactionMessagesApi.md +85 -0
  140. package/docs/TransactionsApi.md +174 -0
  141. package/docs/UnprocessableEntity.md +36 -0
  142. package/docs/UpdateCardSubscriptionRequest.md +34 -0
  143. package/docs/UpdateSubaccountRequest.md +36 -0
  144. package/docs/UpdateWebhookRequest.md +40 -0
  145. package/docs/Webhook.md +51 -0
  146. package/docs/WebhooksApi.md +401 -0
  147. package/openapitools.json +7 -0
  148. package/package.json +11 -11
  149. package/src/apis/CardApi.ts +15 -15
  150. package/src/apis/CardSubscriptionApi.ts +15 -15
  151. package/src/apis/CardholderApi.ts +15 -15
  152. package/src/apis/EnrollmentMethodsApi.ts +15 -15
  153. package/src/apis/NetworkBulkFeedsApi.ts +15 -15
  154. package/src/apis/SubaccountsApi.ts +15 -15
  155. package/src/apis/TransactionMessagesApi.ts +15 -15
  156. package/src/apis/TransactionsApi.ts +15 -15
  157. package/src/apis/WebhooksApi.ts +15 -15
  158. package/src/models/Card.ts +2 -2
  159. package/src/models/CardSubscription.ts +4 -4
  160. package/src/models/Cardholder.ts +2 -2
  161. package/src/models/CreateWebhook201Response.ts +5 -3
  162. package/src/models/CreateWebhookRequest.ts +3 -1
  163. package/src/models/EnrollmentMethods413Response.ts +85 -0
  164. package/src/models/GetCardSubscription404Response.ts +101 -0
  165. package/src/models/ListCardSubscriptions400Response.ts +101 -0
  166. package/src/models/ListCardSubscriptions400ResponseErrorsInner.ts +75 -0
  167. package/src/models/ListCardSubscriptions401Response.ts +85 -0
  168. package/src/models/ListCardSubscriptions403Response.ts +85 -0
  169. package/src/models/ListCardSubscriptions500Response.ts +85 -0
  170. package/src/models/NetworkBulkFeeds.ts +22 -3
  171. package/src/models/Subaccount.ts +2 -2
  172. package/src/models/Transaction.ts +3 -3
  173. package/src/models/TransactionMessage.ts +3 -3
  174. package/src/models/UpdateWebhookRequest.ts +3 -1
  175. package/src/models/Webhook.ts +5 -3
  176. package/src/models/index.ts +7 -7
  177. package/src/runtime.ts +0 -1
  178. package/tsconfig.json +14 -7
  179. package/dist/astrada.co-ts-astrada-sdk-1.1.0.tgz +0 -0
  180. package/lib/apis/CardApi.js +0 -109
  181. package/lib/apis/CardSubscriptionApi.js +0 -133
  182. package/lib/apis/CardholderApi.js +0 -56
  183. package/lib/apis/EnrollmentMethodsApi.js +0 -57
  184. package/lib/apis/NetworkBulkFeedsApi.js +0 -129
  185. package/lib/apis/SubaccountsApi.js +0 -157
  186. package/lib/apis/TransactionMessagesApi.js +0 -56
  187. package/lib/apis/TransactionsApi.js +0 -106
  188. package/lib/apis/WebhooksApi.js +0 -194
  189. package/lib/runtime.js +0 -394
  190. package/openapi-generator/templates/README.mustache +0 -274
  191. package/openapi-generator/templates/runtime.mustache +0 -515
  192. /package/{lib → dist}/apis/CardApi.d.ts +0 -0
  193. /package/{lib → dist}/apis/CardSubscriptionApi.d.ts +0 -0
  194. /package/{lib → dist}/apis/CardholderApi.d.ts +0 -0
  195. /package/{lib → dist}/apis/EnrollmentMethodsApi.d.ts +0 -0
  196. /package/{lib → dist}/apis/NetworkBulkFeedsApi.d.ts +0 -0
  197. /package/{lib → dist}/apis/SubaccountsApi.d.ts +0 -0
  198. /package/{lib → dist}/apis/TransactionMessagesApi.d.ts +0 -0
  199. /package/{lib → dist}/apis/TransactionsApi.d.ts +0 -0
  200. /package/{lib → dist}/apis/WebhooksApi.d.ts +0 -0
  201. /package/{lib → dist}/apis/index.d.ts +0 -0
  202. /package/{lib → dist}/apis/index.js +0 -0
  203. /package/{lib → dist}/index.d.ts +0 -0
  204. /package/{lib → dist}/index.js +0 -0
  205. /package/{lib → dist}/models/Card.d.ts +0 -0
  206. /package/{lib → dist}/models/CardLinks.d.ts +0 -0
  207. /package/{lib → dist}/models/CardSubscription.d.ts +0 -0
  208. /package/{lib → dist}/models/CardSubscriptionLinks.d.ts +0 -0
  209. /package/{lib → dist}/models/Cardholder.d.ts +0 -0
  210. /package/{lib → dist}/models/CardholderCorporate.d.ts +0 -0
  211. /package/{lib → dist}/models/CardholderLinks.d.ts +0 -0
  212. /package/{lib → dist}/models/Conflict.d.ts +0 -0
  213. /package/{lib → dist}/models/CreateNetworkBulkFeedRequest.d.ts +0 -0
  214. /package/{lib → dist}/models/CreateSubaccountRequest.d.ts +0 -0
  215. /package/{lib → dist}/models/EnrollmentMethods200Response.d.ts +0 -0
  216. /package/{lib → dist}/models/EnrollmentMethodsRequest.d.ts +0 -0
  217. /package/{lib → dist}/models/GetSubaccounts200Response.d.ts +0 -0
  218. /package/{lib → dist}/models/GetSubaccounts200ResponseEmbedded.d.ts +0 -0
  219. /package/{lib → dist}/models/GetSubaccounts200ResponseLinks.d.ts +0 -0
  220. /package/{lib → dist}/models/GetTransactions200Response.d.ts +0 -0
  221. /package/{lib → dist}/models/GetTransactions200ResponseEmbedded.d.ts +0 -0
  222. /package/{lib → dist}/models/InlineObject.d.ts +0 -0
  223. /package/{lib → dist}/models/InlineObject1.d.ts +0 -0
  224. /package/{lib → dist}/models/InlineObject2.d.ts +0 -0
  225. /package/{lib → dist}/models/InlineObject3.d.ts +0 -0
  226. /package/{lib → dist}/models/InlineObject4.d.ts +0 -0
  227. /package/{lib → dist}/models/InlineObject5.d.ts +0 -0
  228. /package/{lib → dist}/models/InlineObjectErrorsInner.d.ts +0 -0
  229. /package/{lib → dist}/models/Link.d.ts +0 -0
  230. /package/{lib → dist}/models/ListCardSubscriptions200Response.d.ts +0 -0
  231. /package/{lib → dist}/models/ListCardSubscriptions200ResponseEmbedded.d.ts +0 -0
  232. /package/{lib → dist}/models/ListCardSubscriptions200ResponseLinks.d.ts +0 -0
  233. /package/{lib → dist}/models/ListCards200Response.d.ts +0 -0
  234. /package/{lib → dist}/models/ListCards200ResponseEmbedded.d.ts +0 -0
  235. /package/{lib → dist}/models/ListNetworkBulkFeeds200Response.d.ts +0 -0
  236. /package/{lib → dist}/models/ListNetworkBulkFeeds200ResponseEmbedded.d.ts +0 -0
  237. /package/{lib → dist}/models/ListWebhooks200Response.d.ts +0 -0
  238. /package/{lib → dist}/models/ListWebhooks200ResponseEmbedded.d.ts +0 -0
  239. /package/{lib → dist}/models/ListWebhooks200ResponseLinks.d.ts +0 -0
  240. /package/{lib → dist}/models/Subaccount.d.ts +0 -0
  241. /package/{lib → dist}/models/SubaccountConfiguration.d.ts +0 -0
  242. /package/{lib → dist}/models/SubaccountConfigurationVISA.d.ts +0 -0
  243. /package/{lib → dist}/models/Transaction.d.ts +0 -0
  244. /package/{lib → dist}/models/TransactionAcceptor.d.ts +0 -0
  245. /package/{lib → dist}/models/TransactionLinks.d.ts +0 -0
  246. /package/{lib → dist}/models/TransactionMessage.d.ts +0 -0
  247. /package/{lib → dist}/models/TransactionMessageAcceptor.d.ts +0 -0
  248. /package/{lib → dist}/models/UnprocessableEntity.d.ts +0 -0
  249. /package/{lib → dist}/models/UpdateCardSubscriptionRequest.d.ts +0 -0
  250. /package/{lib → dist}/models/UpdateSubaccountRequest.d.ts +0 -0
  251. /package/{lib → dist}/runtime.d.ts +0 -0
@@ -1,106 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * Astrada API
6
- * Welcome to our API Reference. 👋
7
- *
8
- * The version of the OpenAPI document: 2024-02-28
9
- * Contact: developer@astrada.co
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.GetTransactionsOrderEnum = exports.TransactionsApi = void 0;
17
- const runtime = require("../runtime");
18
- const index_1 = require("../models/index");
19
- /**
20
- *
21
- */
22
- class TransactionsApi extends runtime.BaseAPI {
23
- /**
24
- * Returns a transaction by its unique identifier, including details about the transaction\'s state and relevant transactional data.
25
- * Retrieve transaction
26
- */
27
- async getTransactionByIdRaw(requestParameters, initOverrides) {
28
- if (requestParameters['transactionId'] == null) {
29
- throw new runtime.RequiredError('transactionId', 'Required parameter "transactionId" was null or undefined when calling getTransactionById().');
30
- }
31
- const queryParameters = {};
32
- const headerParameters = {};
33
- if (this.configuration && this.configuration.accessToken) {
34
- // oauth required
35
- headerParameters["Authorization"] = await this.configuration.accessToken("main-auth", ["transactions:read"]);
36
- }
37
- let urlPath = `/transactions/{transactionId}`;
38
- urlPath = urlPath.replace(`{${"transactionId"}}`, encodeURIComponent(String(requestParameters['transactionId'])));
39
- const response = await this.request({
40
- path: urlPath,
41
- method: 'GET',
42
- headers: headerParameters,
43
- query: queryParameters,
44
- }, initOverrides);
45
- return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.TransactionFromJSON)(jsonValue));
46
- }
47
- /**
48
- * Returns a transaction by its unique identifier, including details about the transaction\'s state and relevant transactional data.
49
- * Retrieve transaction
50
- */
51
- async getTransactionById(requestParameters, initOverrides) {
52
- const response = await this.getTransactionByIdRaw(requestParameters, initOverrides);
53
- return await response.value();
54
- }
55
- /**
56
- * Returns a list of all transactions under the account. By default, `GET /transactions` returns transactions ordered by the latest `createdAt`. You can combine the different filters as documented. This endpoint supports [cursor-based pagination](https://docs.astrada.co/reference/pagination).
57
- * List transactions
58
- */
59
- async getTransactionsRaw(requestParameters, initOverrides) {
60
- const queryParameters = {};
61
- if (requestParameters['transactionMessageId'] != null) {
62
- queryParameters['transactionMessageId'] = requestParameters['transactionMessageId'];
63
- }
64
- if (requestParameters['cursor'] != null) {
65
- queryParameters['cursor'] = requestParameters['cursor'];
66
- }
67
- if (requestParameters['cardId'] != null) {
68
- queryParameters['cardId'] = requestParameters['cardId'];
69
- }
70
- if (requestParameters['limit'] != null) {
71
- queryParameters['limit'] = requestParameters['limit'];
72
- }
73
- if (requestParameters['order'] != null) {
74
- queryParameters['order'] = requestParameters['order'];
75
- }
76
- const headerParameters = {};
77
- if (this.configuration && this.configuration.accessToken) {
78
- // oauth required
79
- headerParameters["Authorization"] = await this.configuration.accessToken("main-auth", ["transactions:read"]);
80
- }
81
- let urlPath = `/transactions`;
82
- const response = await this.request({
83
- path: urlPath,
84
- method: 'GET',
85
- headers: headerParameters,
86
- query: queryParameters,
87
- }, initOverrides);
88
- return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.GetTransactions200ResponseFromJSON)(jsonValue));
89
- }
90
- /**
91
- * Returns a list of all transactions under the account. By default, `GET /transactions` returns transactions ordered by the latest `createdAt`. You can combine the different filters as documented. This endpoint supports [cursor-based pagination](https://docs.astrada.co/reference/pagination).
92
- * List transactions
93
- */
94
- async getTransactions(requestParameters = {}, initOverrides) {
95
- const response = await this.getTransactionsRaw(requestParameters, initOverrides);
96
- return await response.value();
97
- }
98
- }
99
- exports.TransactionsApi = TransactionsApi;
100
- /**
101
- * @export
102
- */
103
- exports.GetTransactionsOrderEnum = {
104
- Asc: 'asc',
105
- Desc: 'desc'
106
- };
@@ -1,194 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * Astrada API
6
- * Welcome to our API Reference. 👋
7
- *
8
- * The version of the OpenAPI document: 2024-02-28
9
- * Contact: developer@astrada.co
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.WebhooksApi = void 0;
17
- const runtime = require("../runtime");
18
- const index_1 = require("../models/index");
19
- /**
20
- *
21
- */
22
- class WebhooksApi extends runtime.BaseAPI {
23
- /**
24
- * Registers a new webhook for capturing event notifications.
25
- * Create webhook
26
- */
27
- async createWebhookRaw(requestParameters, initOverrides) {
28
- if (requestParameters['createWebhookRequest'] == null) {
29
- throw new runtime.RequiredError('createWebhookRequest', 'Required parameter "createWebhookRequest" was null or undefined when calling createWebhook().');
30
- }
31
- const queryParameters = {};
32
- const headerParameters = {};
33
- headerParameters['Content-Type'] = 'application/json';
34
- if (this.configuration && this.configuration.accessToken) {
35
- // oauth required
36
- headerParameters["Authorization"] = await this.configuration.accessToken("main-auth", ["webhooks:write"]);
37
- }
38
- let urlPath = `/webhooks`;
39
- const response = await this.request({
40
- path: urlPath,
41
- method: 'POST',
42
- headers: headerParameters,
43
- query: queryParameters,
44
- body: (0, index_1.CreateWebhookRequestToJSON)(requestParameters['createWebhookRequest']),
45
- }, initOverrides);
46
- return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.CreateWebhook201ResponseFromJSON)(jsonValue));
47
- }
48
- /**
49
- * Registers a new webhook for capturing event notifications.
50
- * Create webhook
51
- */
52
- async createWebhook(requestParameters, initOverrides) {
53
- const response = await this.createWebhookRaw(requestParameters, initOverrides);
54
- return await response.value();
55
- }
56
- /**
57
- * Remove a configured webhook by its identifier. Results in the resource being deleted and no longer available.
58
- * Delete webhook
59
- */
60
- async deleteWebhookRaw(requestParameters, initOverrides) {
61
- if (requestParameters['webhookId'] == null) {
62
- throw new runtime.RequiredError('webhookId', 'Required parameter "webhookId" was null or undefined when calling deleteWebhook().');
63
- }
64
- const queryParameters = {};
65
- const headerParameters = {};
66
- if (this.configuration && this.configuration.accessToken) {
67
- // oauth required
68
- headerParameters["Authorization"] = await this.configuration.accessToken("main-auth", ["webhooks:write"]);
69
- }
70
- let urlPath = `/webhooks/{webhookId}`;
71
- urlPath = urlPath.replace(`{${"webhookId"}}`, encodeURIComponent(String(requestParameters['webhookId'])));
72
- const response = await this.request({
73
- path: urlPath,
74
- method: 'DELETE',
75
- headers: headerParameters,
76
- query: queryParameters,
77
- }, initOverrides);
78
- return new runtime.VoidApiResponse(response);
79
- }
80
- /**
81
- * Remove a configured webhook by its identifier. Results in the resource being deleted and no longer available.
82
- * Delete webhook
83
- */
84
- async deleteWebhook(requestParameters, initOverrides) {
85
- await this.deleteWebhookRaw(requestParameters, initOverrides);
86
- }
87
- /**
88
- * Returns detailed information about a specific webhook by its identifier, including its configuration and event subscription details.
89
- * Retrieve webhook
90
- */
91
- async getWebhookRaw(requestParameters, initOverrides) {
92
- if (requestParameters['webhookId'] == null) {
93
- throw new runtime.RequiredError('webhookId', 'Required parameter "webhookId" was null or undefined when calling getWebhook().');
94
- }
95
- const queryParameters = {};
96
- const headerParameters = {};
97
- if (this.configuration && this.configuration.accessToken) {
98
- // oauth required
99
- headerParameters["Authorization"] = await this.configuration.accessToken("main-auth", ["webhooks:read"]);
100
- }
101
- let urlPath = `/webhooks/{webhookId}`;
102
- urlPath = urlPath.replace(`{${"webhookId"}}`, encodeURIComponent(String(requestParameters['webhookId'])));
103
- const response = await this.request({
104
- path: urlPath,
105
- method: 'GET',
106
- headers: headerParameters,
107
- query: queryParameters,
108
- }, initOverrides);
109
- return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.WebhookFromJSON)(jsonValue));
110
- }
111
- /**
112
- * Returns detailed information about a specific webhook by its identifier, including its configuration and event subscription details.
113
- * Retrieve webhook
114
- */
115
- async getWebhook(requestParameters, initOverrides) {
116
- const response = await this.getWebhookRaw(requestParameters, initOverrides);
117
- return await response.value();
118
- }
119
- /**
120
- * Returns all webhooks configured under the account, optionally filtered by subaccount, including details on the events each webhook is subscribed to. This endpoint supports [cursor-based pagination](https://docs.astrada.co/reference/pagination).
121
- * List webhooks
122
- */
123
- async listWebhooksRaw(requestParameters, initOverrides) {
124
- const queryParameters = {};
125
- if (requestParameters['subaccountId'] != null) {
126
- queryParameters['subaccountId'] = requestParameters['subaccountId'];
127
- }
128
- if (requestParameters['limit'] != null) {
129
- queryParameters['limit'] = requestParameters['limit'];
130
- }
131
- if (requestParameters['cursor'] != null) {
132
- queryParameters['cursor'] = requestParameters['cursor'];
133
- }
134
- const headerParameters = {};
135
- if (this.configuration && this.configuration.accessToken) {
136
- // oauth required
137
- headerParameters["Authorization"] = await this.configuration.accessToken("main-auth", ["webhooks:read"]);
138
- }
139
- let urlPath = `/webhooks`;
140
- const response = await this.request({
141
- path: urlPath,
142
- method: 'GET',
143
- headers: headerParameters,
144
- query: queryParameters,
145
- }, initOverrides);
146
- return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ListWebhooks200ResponseFromJSON)(jsonValue));
147
- }
148
- /**
149
- * Returns all webhooks configured under the account, optionally filtered by subaccount, including details on the events each webhook is subscribed to. This endpoint supports [cursor-based pagination](https://docs.astrada.co/reference/pagination).
150
- * List webhooks
151
- */
152
- async listWebhooks(requestParameters = {}, initOverrides) {
153
- const response = await this.listWebhooksRaw(requestParameters, initOverrides);
154
- return await response.value();
155
- }
156
- /**
157
- * Updates the configuration of an existing webhook, allowing changes to the event subscriptions or notification URL.
158
- * Update webhook
159
- */
160
- async updateWebhookRaw(requestParameters, initOverrides) {
161
- if (requestParameters['webhookId'] == null) {
162
- throw new runtime.RequiredError('webhookId', 'Required parameter "webhookId" was null or undefined when calling updateWebhook().');
163
- }
164
- if (requestParameters['updateWebhookRequest'] == null) {
165
- throw new runtime.RequiredError('updateWebhookRequest', 'Required parameter "updateWebhookRequest" was null or undefined when calling updateWebhook().');
166
- }
167
- const queryParameters = {};
168
- const headerParameters = {};
169
- headerParameters['Content-Type'] = 'application/json';
170
- if (this.configuration && this.configuration.accessToken) {
171
- // oauth required
172
- headerParameters["Authorization"] = await this.configuration.accessToken("main-auth", ["webhooks:write"]);
173
- }
174
- let urlPath = `/webhooks/{webhookId}`;
175
- urlPath = urlPath.replace(`{${"webhookId"}}`, encodeURIComponent(String(requestParameters['webhookId'])));
176
- const response = await this.request({
177
- path: urlPath,
178
- method: 'PATCH',
179
- headers: headerParameters,
180
- query: queryParameters,
181
- body: (0, index_1.UpdateWebhookRequestToJSON)(requestParameters['updateWebhookRequest']),
182
- }, initOverrides);
183
- return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.WebhookFromJSON)(jsonValue));
184
- }
185
- /**
186
- * Updates the configuration of an existing webhook, allowing changes to the event subscriptions or notification URL.
187
- * Update webhook
188
- */
189
- async updateWebhook(requestParameters, initOverrides) {
190
- const response = await this.updateWebhookRaw(requestParameters, initOverrides);
191
- return await response.value();
192
- }
193
- }
194
- exports.WebhooksApi = WebhooksApi;
package/lib/runtime.js DELETED
@@ -1,394 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * Astrada API
6
- * Welcome to our API Reference. 👋
7
- *
8
- * The version of the OpenAPI document: 2024-02-28
9
- * Contact: developer@astrada.co
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.TextApiResponse = exports.BlobApiResponse = exports.VoidApiResponse = exports.JSONApiResponse = exports.COLLECTION_FORMATS = exports.RequiredError = exports.FetchError = exports.ResponseError = exports.BaseAPI = exports.AuthenticationClient = exports.Configuration = exports.BASE_PATH = void 0;
17
- exports.querystring = querystring;
18
- exports.exists = exists;
19
- exports.mapValues = mapValues;
20
- exports.canConsumeForm = canConsumeForm;
21
- exports.BASE_PATH = "https://api.astrada.co".replace(/\/+$/, "");
22
- class Configuration {
23
- constructor(configuration) {
24
- this.configuration = configuration;
25
- this.authClient = new AuthenticationClient({
26
- basePath: this.basePath,
27
- clientId: this.clientId,
28
- clientSecret: this.clientSecret,
29
- accountId: this.accountId,
30
- fetchApi: this.fetchApi
31
- });
32
- }
33
- set config(configuration) {
34
- this.configuration = configuration;
35
- }
36
- get accessToken() {
37
- return this.authClient.getAccessToken.bind(this.authClient);
38
- }
39
- get accountId() {
40
- return this.configuration.accountId;
41
- }
42
- get clientId() {
43
- return this.configuration.clientId;
44
- }
45
- get clientSecret() {
46
- return this.configuration.clientSecret;
47
- }
48
- get basePath() {
49
- return this.configuration.basePath != null ? this.configuration.basePath : exports.BASE_PATH;
50
- }
51
- get fetchApi() {
52
- return this.configuration.fetchApi;
53
- }
54
- get middleware() {
55
- return this.configuration.middleware || [];
56
- }
57
- get queryParamsStringify() {
58
- return this.configuration.queryParamsStringify || querystring;
59
- }
60
- get headers() {
61
- return this.configuration.headers;
62
- }
63
- get credentials() {
64
- return this.configuration.credentials;
65
- }
66
- }
67
- exports.Configuration = Configuration;
68
- class AuthenticationClient {
69
- constructor(authConfig) {
70
- this.authConfig = authConfig;
71
- this.cachedToken = null;
72
- this.tokenExpiry = 0;
73
- }
74
- async getAccessToken(name, scopes) {
75
- if (this.isTokenValid()) {
76
- return 'Bearer ' + this.cachedToken.access_token;
77
- }
78
- const tokenResponse = await this.requestNewToken();
79
- this.cacheToken(tokenResponse);
80
- return 'Bearer ' + tokenResponse.access_token;
81
- }
82
- async requestNewToken() {
83
- const params = new URLSearchParams({
84
- client_id: this.authConfig.clientId,
85
- client_secret: this.authConfig.clientSecret,
86
- grant_type: "client_credentials",
87
- });
88
- const url = `${this.authConfig.basePath}/auth/realms/${this.authConfig.accountId}/protocol/openid-connect/token`;
89
- const response = await (this.authConfig.fetchApi || fetch)(url, {
90
- method: 'POST',
91
- headers: {
92
- 'Content-Type': 'application/x-www-form-urlencoded',
93
- },
94
- body: params
95
- });
96
- const data = await response.json();
97
- if (response && (response.status >= 200 && response.status < 300)) {
98
- return data;
99
- }
100
- if (data) {
101
- const astradaError = {
102
- error: data.error || "authentication_failed",
103
- error_description: data.error_description ||
104
- "Failed to authenticate with Astrada API",
105
- status: response.status,
106
- };
107
- throw new ResponseError(response, `Authentication failed: ${astradaError.error_description}`);
108
- }
109
- throw new ResponseError(response, 'Response returned an error code');
110
- }
111
- cacheToken(token) {
112
- this.cachedToken = token;
113
- this.tokenExpiry = Date.now() + token.expires_in * 1000 - 30000; // 30s buffer
114
- }
115
- isTokenValid() {
116
- return this.cachedToken !== null && Date.now() < this.tokenExpiry;
117
- }
118
- clearCache() {
119
- this.cachedToken = null;
120
- this.tokenExpiry = 0;
121
- }
122
- }
123
- exports.AuthenticationClient = AuthenticationClient;
124
- /**
125
- * This is the base class for all generated API classes.
126
- */
127
- class BaseAPI {
128
- constructor(configuration) {
129
- this.configuration = configuration;
130
- this.cachedToken = null;
131
- this.tokenExpiry = 0;
132
- this.fetchApi = async (url, init) => {
133
- let fetchParams = { url, init };
134
- for (const middleware of this.middleware) {
135
- if (middleware.pre) {
136
- fetchParams = await middleware.pre({
137
- fetch: this.fetchApi,
138
- ...fetchParams,
139
- }) || fetchParams;
140
- }
141
- }
142
- let response = undefined;
143
- try {
144
- response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
145
- }
146
- catch (e) {
147
- for (const middleware of this.middleware) {
148
- if (middleware.onError) {
149
- response = await middleware.onError({
150
- fetch: this.fetchApi,
151
- url: fetchParams.url,
152
- init: fetchParams.init,
153
- error: e,
154
- response: response ? response.clone() : undefined,
155
- }) || response;
156
- }
157
- }
158
- if (response === undefined) {
159
- if (e instanceof Error) {
160
- throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
161
- }
162
- else {
163
- throw e;
164
- }
165
- }
166
- }
167
- for (const middleware of this.middleware) {
168
- if (middleware.post) {
169
- response = await middleware.post({
170
- fetch: this.fetchApi,
171
- url: fetchParams.url,
172
- init: fetchParams.init,
173
- response: response.clone(),
174
- }) || response;
175
- }
176
- }
177
- return response;
178
- };
179
- this.middleware = configuration.middleware;
180
- }
181
- withMiddleware(...middlewares) {
182
- const next = this.clone();
183
- next.middleware = next.middleware.concat(...middlewares);
184
- return next;
185
- }
186
- withPreMiddleware(...preMiddlewares) {
187
- const middlewares = preMiddlewares.map((pre) => ({ pre }));
188
- return this.withMiddleware(...middlewares);
189
- }
190
- withPostMiddleware(...postMiddlewares) {
191
- const middlewares = postMiddlewares.map((post) => ({ post }));
192
- return this.withMiddleware(...middlewares);
193
- }
194
- /**
195
- * Check if the given MIME is a JSON MIME.
196
- * JSON MIME examples:
197
- * application/json
198
- * application/json; charset=UTF8
199
- * APPLICATION/JSON
200
- * application/vnd.company+json
201
- * @param mime - MIME (Multipurpose Internet Mail Extensions)
202
- * @return True if the given MIME is JSON, false otherwise.
203
- */
204
- isJsonMime(mime) {
205
- if (!mime) {
206
- return false;
207
- }
208
- return BaseAPI.jsonRegex.test(mime);
209
- }
210
- async request(context, initOverrides) {
211
- const { url, init } = await this.createFetchParams(context, initOverrides);
212
- const response = await this.fetchApi(url, init);
213
- if (response && (response.status >= 200 && response.status < 300)) {
214
- return response;
215
- }
216
- throw new ResponseError(response, 'Response returned an error code');
217
- }
218
- async createFetchParams(context, initOverrides) {
219
- let url = this.configuration.basePath + context.path;
220
- if (context.query !== undefined && Object.keys(context.query).length !== 0) {
221
- // only add the querystring to the URL if there are query parameters.
222
- // this is done to avoid urls ending with a "?" character which buggy webservers
223
- // do not handle correctly sometimes.
224
- url += '?' + this.configuration.queryParamsStringify(context.query);
225
- }
226
- const headers = Object.assign({}, this.configuration.headers, context.headers);
227
- Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
228
- const initOverrideFn = typeof initOverrides === "function"
229
- ? initOverrides
230
- : async () => initOverrides;
231
- const initParams = {
232
- method: context.method,
233
- headers,
234
- body: context.body,
235
- credentials: this.configuration.credentials,
236
- };
237
- const overriddenInit = {
238
- ...initParams,
239
- ...(await initOverrideFn({
240
- init: initParams,
241
- context,
242
- }))
243
- };
244
- let body;
245
- if (isFormData(overriddenInit.body)
246
- || (overriddenInit.body instanceof URLSearchParams)
247
- || isBlob(overriddenInit.body)) {
248
- body = overriddenInit.body;
249
- }
250
- else if (this.isJsonMime(headers['Content-Type'])) {
251
- body = JSON.stringify(overriddenInit.body);
252
- }
253
- else {
254
- body = overriddenInit.body;
255
- }
256
- const init = {
257
- ...overriddenInit,
258
- body
259
- };
260
- return { url, init };
261
- }
262
- /**
263
- * Create a shallow clone of `this` by constructing a new instance
264
- * and then shallow cloning data members.
265
- */
266
- clone() {
267
- const constructor = this.constructor;
268
- const next = new constructor(this.configuration);
269
- next.middleware = this.middleware.slice();
270
- return next;
271
- }
272
- }
273
- exports.BaseAPI = BaseAPI;
274
- BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
275
- ;
276
- function isBlob(value) {
277
- return typeof Blob !== 'undefined' && value instanceof Blob;
278
- }
279
- function isFormData(value) {
280
- return typeof FormData !== "undefined" && value instanceof FormData;
281
- }
282
- class ResponseError extends Error {
283
- constructor(response, msg) {
284
- super(msg);
285
- this.response = response;
286
- this.name = "ResponseError";
287
- }
288
- }
289
- exports.ResponseError = ResponseError;
290
- class FetchError extends Error {
291
- constructor(cause, msg) {
292
- super(msg);
293
- this.cause = cause;
294
- this.name = "FetchError";
295
- }
296
- }
297
- exports.FetchError = FetchError;
298
- class RequiredError extends Error {
299
- constructor(field, msg) {
300
- super(msg);
301
- this.field = field;
302
- this.name = "RequiredError";
303
- }
304
- }
305
- exports.RequiredError = RequiredError;
306
- exports.COLLECTION_FORMATS = {
307
- csv: ",",
308
- ssv: " ",
309
- tsv: "\t",
310
- pipes: "|",
311
- };
312
- function querystring(params, prefix = '') {
313
- return Object.keys(params)
314
- .map(key => querystringSingleKey(key, params[key], prefix))
315
- .filter(part => part.length > 0)
316
- .join('&');
317
- }
318
- function querystringSingleKey(key, value, keyPrefix = '') {
319
- const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
320
- if (value instanceof Array) {
321
- const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
322
- .join(`&${encodeURIComponent(fullKey)}=`);
323
- return `${encodeURIComponent(fullKey)}=${multiValue}`;
324
- }
325
- if (value instanceof Set) {
326
- const valueAsArray = Array.from(value);
327
- return querystringSingleKey(key, valueAsArray, keyPrefix);
328
- }
329
- if (value instanceof Date) {
330
- return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
331
- }
332
- if (value instanceof Object) {
333
- return querystring(value, fullKey);
334
- }
335
- return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
336
- }
337
- function exists(json, key) {
338
- const value = json[key];
339
- return value !== null && value !== undefined;
340
- }
341
- function mapValues(data, fn) {
342
- const result = {};
343
- for (const key of Object.keys(data)) {
344
- result[key] = fn(data[key]);
345
- }
346
- return result;
347
- }
348
- function canConsumeForm(consumes) {
349
- for (const consume of consumes) {
350
- if ('multipart/form-data' === consume.contentType) {
351
- return true;
352
- }
353
- }
354
- return false;
355
- }
356
- class JSONApiResponse {
357
- constructor(raw, transformer = (jsonValue) => jsonValue) {
358
- this.raw = raw;
359
- this.transformer = transformer;
360
- }
361
- async value() {
362
- return this.transformer(await this.raw.json());
363
- }
364
- }
365
- exports.JSONApiResponse = JSONApiResponse;
366
- class VoidApiResponse {
367
- constructor(raw) {
368
- this.raw = raw;
369
- }
370
- async value() {
371
- return undefined;
372
- }
373
- }
374
- exports.VoidApiResponse = VoidApiResponse;
375
- class BlobApiResponse {
376
- constructor(raw) {
377
- this.raw = raw;
378
- }
379
- async value() {
380
- return await this.raw.blob();
381
- }
382
- ;
383
- }
384
- exports.BlobApiResponse = BlobApiResponse;
385
- class TextApiResponse {
386
- constructor(raw) {
387
- this.raw = raw;
388
- }
389
- async value() {
390
- return await this.raw.text();
391
- }
392
- ;
393
- }
394
- exports.TextApiResponse = TextApiResponse;