pkg-sdk-test 0.0.14 → 0.0.15
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.
- package/README.md +295 -0
- package/dist/cjs/BaseClient.js +3 -3
- package/dist/cjs/Client.d.ts +4 -4
- package/dist/cjs/Client.js +3 -3
- package/dist/cjs/api/errors/BadRequestError.d.ts +3 -3
- package/dist/cjs/api/errors/BadRequestError.js +1 -1
- package/dist/cjs/api/errors/InternalServerError.d.ts +3 -3
- package/dist/cjs/api/errors/InternalServerError.js +1 -1
- package/dist/cjs/api/errors/NotFoundError.d.ts +3 -3
- package/dist/cjs/api/errors/NotFoundError.js +1 -1
- package/dist/cjs/api/errors/UnauthorizedError.d.ts +3 -3
- package/dist/cjs/api/errors/UnauthorizedError.js +1 -1
- package/dist/cjs/api/resources/payments/client/Client.d.ts +23 -23
- package/dist/cjs/api/resources/payments/client/Client.js +37 -37
- package/dist/cjs/api/resources/payments/client/requests/CryptopayCreatePaymentRequest.d.ts +2 -2
- package/dist/cjs/api/resources/payments/client/requests/CryptopaySimulatePaymentRequest.d.ts +2 -2
- package/dist/cjs/api/resources/payments/client/requests/GetV1PaymentsRequest.d.ts +1 -1
- package/dist/cjs/api/resources/payments/types/GetV1PaymentsPaymentIdResponse.d.ts +2 -2
- package/dist/cjs/api/resources/staticWallets/client/Client.d.ts +23 -23
- package/dist/cjs/api/resources/staticWallets/client/Client.js +32 -32
- package/dist/cjs/api/types/CryptopayListPaymentsResponse.d.ts +2 -2
- package/dist/cjs/api/types/CryptopayListStaticDepositsResponse.d.ts +2 -2
- package/dist/cjs/api/types/CryptopayListStaticWalletsResponse.d.ts +2 -2
- package/dist/cjs/api/types/CryptopayPaymentResponse.d.ts +5 -5
- package/dist/cjs/api/types/CryptopayPublicPaymentResponse.d.ts +4 -4
- package/dist/cjs/auth/HeaderAuthProvider.js +1 -1
- package/dist/cjs/errors/{SuwardApiError.d.ts → SuwardSDKError.d.ts} +1 -1
- package/dist/cjs/errors/{SuwardApiError.js → SuwardSDKError.js} +4 -4
- package/dist/{esm/errors/SuwardApiTimeoutError.d.mts → cjs/errors/SuwardSDKTimeoutError.d.ts} +1 -1
- package/dist/cjs/errors/{SuwardApiTimeoutError.js → SuwardSDKTimeoutError.js} +4 -4
- package/dist/cjs/errors/handleNonStatusCodeError.js +5 -5
- package/dist/cjs/errors/index.d.ts +2 -2
- package/dist/cjs/errors/index.js +5 -5
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.js +5 -5
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +3 -3
- package/dist/esm/Client.d.mts +4 -4
- package/dist/esm/Client.mjs +1 -1
- package/dist/esm/api/errors/BadRequestError.d.mts +3 -3
- package/dist/esm/api/errors/BadRequestError.mjs +1 -1
- package/dist/esm/api/errors/InternalServerError.d.mts +3 -3
- package/dist/esm/api/errors/InternalServerError.mjs +1 -1
- package/dist/esm/api/errors/NotFoundError.d.mts +3 -3
- package/dist/esm/api/errors/NotFoundError.mjs +1 -1
- package/dist/esm/api/errors/UnauthorizedError.d.mts +3 -3
- package/dist/esm/api/errors/UnauthorizedError.mjs +1 -1
- package/dist/esm/api/resources/payments/client/Client.d.mts +23 -23
- package/dist/esm/api/resources/payments/client/Client.mjs +37 -37
- package/dist/esm/api/resources/payments/client/requests/CryptopayCreatePaymentRequest.d.mts +2 -2
- package/dist/esm/api/resources/payments/client/requests/CryptopaySimulatePaymentRequest.d.mts +2 -2
- package/dist/esm/api/resources/payments/client/requests/GetV1PaymentsRequest.d.mts +1 -1
- package/dist/esm/api/resources/payments/types/GetV1PaymentsPaymentIdResponse.d.mts +2 -2
- package/dist/esm/api/resources/staticWallets/client/Client.d.mts +23 -23
- package/dist/esm/api/resources/staticWallets/client/Client.mjs +32 -32
- package/dist/esm/api/types/CryptopayListPaymentsResponse.d.mts +2 -2
- package/dist/esm/api/types/CryptopayListStaticDepositsResponse.d.mts +2 -2
- package/dist/esm/api/types/CryptopayListStaticWalletsResponse.d.mts +2 -2
- package/dist/esm/api/types/CryptopayPaymentResponse.d.mts +5 -5
- package/dist/esm/api/types/CryptopayPublicPaymentResponse.d.mts +4 -4
- package/dist/esm/auth/HeaderAuthProvider.mjs +1 -1
- package/dist/esm/errors/{SuwardApiError.d.mts → SuwardSDKError.d.mts} +1 -1
- package/dist/esm/errors/{SuwardApiError.mjs → SuwardSDKError.mjs} +2 -2
- package/dist/{cjs/errors/SuwardApiTimeoutError.d.ts → esm/errors/SuwardSDKTimeoutError.d.mts} +1 -1
- package/dist/esm/errors/{SuwardApiTimeoutError.mjs → SuwardSDKTimeoutError.mjs} +2 -2
- package/dist/esm/errors/handleNonStatusCodeError.mjs +5 -5
- package/dist/esm/errors/index.d.mts +2 -2
- package/dist/esm/errors/index.mjs +2 -2
- package/dist/esm/index.d.mts +3 -3
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +86 -82
- package/reference.md +698 -0
package/README.md
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# Suward TypeScript Library
|
|
2
|
+
|
|
3
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fcrylabsorg%2Fsuward-sdk-ts)
|
|
4
|
+
[](https://www.npmjs.com/package/pkg-sdk-test)
|
|
5
|
+
|
|
6
|
+
The Suward TypeScript library provides convenient access to the Suward APIs from TypeScript.
|
|
7
|
+
|
|
8
|
+
## Table of Contents
|
|
9
|
+
|
|
10
|
+
- [Installation](#installation)
|
|
11
|
+
- [Reference](#reference)
|
|
12
|
+
- [Usage](#usage)
|
|
13
|
+
- [Request and Response Types](#request-and-response-types)
|
|
14
|
+
- [Exception Handling](#exception-handling)
|
|
15
|
+
- [Advanced](#advanced)
|
|
16
|
+
- [Subpackage Exports](#subpackage-exports)
|
|
17
|
+
- [Additional Headers](#additional-headers)
|
|
18
|
+
- [Additional Query String Parameters](#additional-query-string-parameters)
|
|
19
|
+
- [Retries](#retries)
|
|
20
|
+
- [Timeouts](#timeouts)
|
|
21
|
+
- [Aborting Requests](#aborting-requests)
|
|
22
|
+
- [Access Raw Response Data](#access-raw-response-data)
|
|
23
|
+
- [Logging](#logging)
|
|
24
|
+
- [Custom Fetch](#custom-fetch)
|
|
25
|
+
- [Runtime Compatibility](#runtime-compatibility)
|
|
26
|
+
- [Contributing](#contributing)
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npm i -s pkg-sdk-test
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Reference
|
|
35
|
+
|
|
36
|
+
A full reference for this library is available [here](https://github.com/crylabsorg/suward-sdk-ts/blob/HEAD/./reference.md).
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
Instantiate and use the client with the following:
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { SuwardSDKClient } from "pkg-sdk-test";
|
|
44
|
+
|
|
45
|
+
const client = new SuwardSDKClient({ environment: "YOUR_BASE_URL", apiKey: "YOUR_API_KEY" });
|
|
46
|
+
await client.payments.createPayment();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Request and Response Types
|
|
50
|
+
|
|
51
|
+
The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
|
|
52
|
+
following namespace:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { SuwardSDK } from "pkg-sdk-test";
|
|
56
|
+
|
|
57
|
+
const request: SuwardSDK.GetV1PaymentsRequest = {
|
|
58
|
+
...
|
|
59
|
+
};
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Exception Handling
|
|
63
|
+
|
|
64
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
|
65
|
+
will be thrown.
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import { SuwardSDKError } from "pkg-sdk-test";
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
await client.payments.createPayment(...);
|
|
72
|
+
} catch (err) {
|
|
73
|
+
if (err instanceof SuwardSDKError) {
|
|
74
|
+
console.log(err.statusCode);
|
|
75
|
+
console.log(err.message);
|
|
76
|
+
console.log(err.body);
|
|
77
|
+
console.log(err.rawResponse);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Advanced
|
|
83
|
+
|
|
84
|
+
### Subpackage Exports
|
|
85
|
+
|
|
86
|
+
This SDK supports direct imports of subpackage clients, which allows JavaScript bundlers to tree-shake and include only the imported subpackage code. This results in much smaller bundle sizes.
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { PaymentsClient } from 'pkg-sdk-test/payments';
|
|
90
|
+
|
|
91
|
+
const client = new PaymentsClient({...});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Additional Headers
|
|
95
|
+
|
|
96
|
+
If you would like to send additional headers as part of the request, use the `headers` request option.
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import { SuwardSDKClient } from "pkg-sdk-test";
|
|
100
|
+
|
|
101
|
+
const client = new SuwardSDKClient({
|
|
102
|
+
...
|
|
103
|
+
headers: {
|
|
104
|
+
'X-Custom-Header': 'custom value'
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const response = await client.payments.createPayment(..., {
|
|
109
|
+
headers: {
|
|
110
|
+
'X-Custom-Header': 'custom value'
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Additional Query String Parameters
|
|
116
|
+
|
|
117
|
+
If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
const response = await client.payments.createPayment(..., {
|
|
121
|
+
queryParams: {
|
|
122
|
+
'customQueryParamKey': 'custom query param value'
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Retries
|
|
128
|
+
|
|
129
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
|
130
|
+
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
|
|
131
|
+
retry limit (default: 2).
|
|
132
|
+
|
|
133
|
+
Which status codes are retried depends on the `retryStatusCodes` generator configuration:
|
|
134
|
+
|
|
135
|
+
**`legacy`** (current default): retries on
|
|
136
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
137
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
138
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
|
|
139
|
+
|
|
140
|
+
**`recommended`**: retries on
|
|
141
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
142
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
143
|
+
- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
|
|
144
|
+
- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
|
|
145
|
+
- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
|
|
146
|
+
|
|
147
|
+
Use the `maxRetries` request option to configure this behavior.
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
const response = await client.payments.createPayment(..., {
|
|
151
|
+
maxRetries: 0 // override maxRetries at the request level
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Timeouts
|
|
156
|
+
|
|
157
|
+
The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
const response = await client.payments.createPayment(..., {
|
|
161
|
+
timeoutInSeconds: 30 // override timeout to 30s
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Aborting Requests
|
|
166
|
+
|
|
167
|
+
The SDK allows users to abort requests at any point by passing in an abort signal.
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
const controller = new AbortController();
|
|
171
|
+
const response = await client.payments.createPayment(..., {
|
|
172
|
+
abortSignal: controller.signal
|
|
173
|
+
});
|
|
174
|
+
controller.abort(); // aborts the request
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Access Raw Response Data
|
|
178
|
+
|
|
179
|
+
The SDK provides access to raw response data, including headers, through the `.withRawResponse()` method.
|
|
180
|
+
The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
const { data, rawResponse } = await client.payments.createPayment(...).withRawResponse();
|
|
184
|
+
|
|
185
|
+
console.log(data);
|
|
186
|
+
console.log(rawResponse.headers['X-My-Header']);
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Logging
|
|
190
|
+
|
|
191
|
+
The SDK supports logging. You can configure the logger by passing in a `logging` object to the client options.
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
import { SuwardSDKClient, logging } from "pkg-sdk-test";
|
|
195
|
+
|
|
196
|
+
const client = new SuwardSDKClient({
|
|
197
|
+
...
|
|
198
|
+
logging: {
|
|
199
|
+
level: logging.LogLevel.Debug, // defaults to logging.LogLevel.Info
|
|
200
|
+
logger: new logging.ConsoleLogger(), // defaults to ConsoleLogger
|
|
201
|
+
silent: false, // defaults to true, set to false to enable logging
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
```
|
|
205
|
+
The `logging` object can have the following properties:
|
|
206
|
+
- `level`: The log level to use. Defaults to `logging.LogLevel.Info`.
|
|
207
|
+
- `logger`: The logger to use. Defaults to a `logging.ConsoleLogger`.
|
|
208
|
+
- `silent`: Whether to silence the logger. Defaults to `true`.
|
|
209
|
+
|
|
210
|
+
The `level` property can be one of the following values:
|
|
211
|
+
- `logging.LogLevel.Debug`
|
|
212
|
+
- `logging.LogLevel.Info`
|
|
213
|
+
- `logging.LogLevel.Warn`
|
|
214
|
+
- `logging.LogLevel.Error`
|
|
215
|
+
|
|
216
|
+
To provide a custom logger, you can pass in an object that implements the `logging.ILogger` interface.
|
|
217
|
+
|
|
218
|
+
<details>
|
|
219
|
+
<summary>Custom logger examples</summary>
|
|
220
|
+
|
|
221
|
+
Here's an example using the popular `winston` logging library.
|
|
222
|
+
```ts
|
|
223
|
+
import winston from 'winston';
|
|
224
|
+
|
|
225
|
+
const winstonLogger = winston.createLogger({...});
|
|
226
|
+
|
|
227
|
+
const logger: logging.ILogger = {
|
|
228
|
+
debug: (msg, ...args) => winstonLogger.debug(msg, ...args),
|
|
229
|
+
info: (msg, ...args) => winstonLogger.info(msg, ...args),
|
|
230
|
+
warn: (msg, ...args) => winstonLogger.warn(msg, ...args),
|
|
231
|
+
error: (msg, ...args) => winstonLogger.error(msg, ...args),
|
|
232
|
+
};
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Here's an example using the popular `pino` logging library.
|
|
236
|
+
|
|
237
|
+
```ts
|
|
238
|
+
import pino from 'pino';
|
|
239
|
+
|
|
240
|
+
const pinoLogger = pino({...});
|
|
241
|
+
|
|
242
|
+
const logger: logging.ILogger = {
|
|
243
|
+
debug: (msg, ...args) => pinoLogger.debug(args, msg),
|
|
244
|
+
info: (msg, ...args) => pinoLogger.info(args, msg),
|
|
245
|
+
warn: (msg, ...args) => pinoLogger.warn(args, msg),
|
|
246
|
+
error: (msg, ...args) => pinoLogger.error(args, msg),
|
|
247
|
+
};
|
|
248
|
+
```
|
|
249
|
+
</details>
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
### Custom Fetch
|
|
253
|
+
|
|
254
|
+
The SDK provides a low-level `fetch` method for making custom HTTP requests while still
|
|
255
|
+
benefiting from SDK-level configuration like authentication, retries, timeouts, and logging.
|
|
256
|
+
This is useful for calling API endpoints not yet supported in the SDK.
|
|
257
|
+
|
|
258
|
+
```typescript
|
|
259
|
+
const response = await client.fetch("/v1/custom/endpoint", {
|
|
260
|
+
method: "GET",
|
|
261
|
+
}, {
|
|
262
|
+
timeoutInSeconds: 30,
|
|
263
|
+
maxRetries: 3,
|
|
264
|
+
headers: {
|
|
265
|
+
"X-Custom-Header": "custom-value",
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
const data = await response.json();
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Runtime Compatibility
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
The SDK works in the following runtimes:
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
- Node.js 18+
|
|
280
|
+
- Vercel
|
|
281
|
+
- Cloudflare Workers
|
|
282
|
+
- Deno v1.25+
|
|
283
|
+
- Bun 1.0+
|
|
284
|
+
- React Native
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
## Contributing
|
|
288
|
+
|
|
289
|
+
While we value open-source contributions to this SDK, this library is generated programmatically.
|
|
290
|
+
Additions made directly to this library would have to be moved over to our generation code,
|
|
291
|
+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
|
292
|
+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
|
293
|
+
an issue first to discuss with us!
|
|
294
|
+
|
|
295
|
+
On the other hand, contributions to the README are always very welcome!
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -42,9 +42,9 @@ const core = __importStar(require("./core/index.js"));
|
|
|
42
42
|
function normalizeClientOptions(options) {
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
|
-
"X-Fern-SDK-Name": "
|
|
46
|
-
"X-Fern-SDK-Version": "0.0.
|
|
47
|
-
"User-Agent": "
|
|
45
|
+
"X-Fern-SDK-Name": "pkg-sdk-test",
|
|
46
|
+
"X-Fern-SDK-Version": "0.0.15",
|
|
47
|
+
"User-Agent": "pkg-sdk-test/0.0.15",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -3,16 +3,16 @@ import { StaticWalletsClient } from "./api/resources/staticWallets/client/Client
|
|
|
3
3
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
4
4
|
import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
|
|
5
5
|
import * as core from "./core/index.js";
|
|
6
|
-
export declare namespace
|
|
6
|
+
export declare namespace SuwardSDKClient {
|
|
7
7
|
type Options = BaseClientOptions;
|
|
8
8
|
interface RequestOptions extends BaseRequestOptions {
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
export declare class
|
|
12
|
-
protected readonly _options: NormalizedClientOptionsWithAuth<
|
|
11
|
+
export declare class SuwardSDKClient {
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<SuwardSDKClient.Options>;
|
|
13
13
|
protected _payments: PaymentsClient | undefined;
|
|
14
14
|
protected _staticWallets: StaticWalletsClient | undefined;
|
|
15
|
-
constructor(options:
|
|
15
|
+
constructor(options: SuwardSDKClient.Options);
|
|
16
16
|
get payments(): PaymentsClient;
|
|
17
17
|
get staticWallets(): StaticWalletsClient;
|
|
18
18
|
/**
|
package/dist/cjs/Client.js
CHANGED
|
@@ -43,12 +43,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
46
|
+
exports.SuwardSDKClient = void 0;
|
|
47
47
|
const Client_js_1 = require("./api/resources/payments/client/Client.js");
|
|
48
48
|
const Client_js_2 = require("./api/resources/staticWallets/client/Client.js");
|
|
49
49
|
const BaseClient_js_1 = require("./BaseClient.js");
|
|
50
50
|
const core = __importStar(require("./core/index.js"));
|
|
51
|
-
class
|
|
51
|
+
class SuwardSDKClient {
|
|
52
52
|
constructor(options) {
|
|
53
53
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
54
54
|
}
|
|
@@ -85,4 +85,4 @@ class SuwardApiClient {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
exports.
|
|
88
|
+
exports.SuwardSDKClient = SuwardSDKClient;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as core from "../../core/index.js";
|
|
2
2
|
import * as errors from "../../errors/index.js";
|
|
3
|
-
import type * as
|
|
4
|
-
export declare class BadRequestError extends errors.
|
|
5
|
-
constructor(body:
|
|
3
|
+
import type * as SuwardSDK from "../index.js";
|
|
4
|
+
export declare class BadRequestError extends errors.SuwardSDKError {
|
|
5
|
+
constructor(body: SuwardSDK.ControllerErrorResponse, rawResponse?: core.RawResponse);
|
|
6
6
|
}
|
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.BadRequestError = void 0;
|
|
38
38
|
const errors = __importStar(require("../../errors/index.js"));
|
|
39
|
-
class BadRequestError extends errors.
|
|
39
|
+
class BadRequestError extends errors.SuwardSDKError {
|
|
40
40
|
constructor(body, rawResponse) {
|
|
41
41
|
super({
|
|
42
42
|
message: "BadRequestError",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as core from "../../core/index.js";
|
|
2
2
|
import * as errors from "../../errors/index.js";
|
|
3
|
-
import type * as
|
|
4
|
-
export declare class InternalServerError extends errors.
|
|
5
|
-
constructor(body:
|
|
3
|
+
import type * as SuwardSDK from "../index.js";
|
|
4
|
+
export declare class InternalServerError extends errors.SuwardSDKError {
|
|
5
|
+
constructor(body: SuwardSDK.ControllerErrorResponse, rawResponse?: core.RawResponse);
|
|
6
6
|
}
|
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.InternalServerError = void 0;
|
|
38
38
|
const errors = __importStar(require("../../errors/index.js"));
|
|
39
|
-
class InternalServerError extends errors.
|
|
39
|
+
class InternalServerError extends errors.SuwardSDKError {
|
|
40
40
|
constructor(body, rawResponse) {
|
|
41
41
|
super({
|
|
42
42
|
message: "InternalServerError",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as core from "../../core/index.js";
|
|
2
2
|
import * as errors from "../../errors/index.js";
|
|
3
|
-
import type * as
|
|
4
|
-
export declare class NotFoundError extends errors.
|
|
5
|
-
constructor(body:
|
|
3
|
+
import type * as SuwardSDK from "../index.js";
|
|
4
|
+
export declare class NotFoundError extends errors.SuwardSDKError {
|
|
5
|
+
constructor(body: SuwardSDK.ControllerErrorResponse, rawResponse?: core.RawResponse);
|
|
6
6
|
}
|
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.NotFoundError = void 0;
|
|
38
38
|
const errors = __importStar(require("../../errors/index.js"));
|
|
39
|
-
class NotFoundError extends errors.
|
|
39
|
+
class NotFoundError extends errors.SuwardSDKError {
|
|
40
40
|
constructor(body, rawResponse) {
|
|
41
41
|
super({
|
|
42
42
|
message: "NotFoundError",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as core from "../../core/index.js";
|
|
2
2
|
import * as errors from "../../errors/index.js";
|
|
3
|
-
import type * as
|
|
4
|
-
export declare class UnauthorizedError extends errors.
|
|
5
|
-
constructor(body:
|
|
3
|
+
import type * as SuwardSDK from "../index.js";
|
|
4
|
+
export declare class UnauthorizedError extends errors.SuwardSDKError {
|
|
5
|
+
constructor(body: SuwardSDK.ControllerErrorResponse, rawResponse?: core.RawResponse);
|
|
6
6
|
}
|
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.UnauthorizedError = void 0;
|
|
38
38
|
const errors = __importStar(require("../../errors/index.js"));
|
|
39
|
-
class UnauthorizedError extends errors.
|
|
39
|
+
class UnauthorizedError extends errors.SuwardSDKError {
|
|
40
40
|
constructor(body, rawResponse) {
|
|
41
41
|
super({
|
|
42
42
|
message: "UnauthorizedError",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
3
|
import * as core from "../../../../core/index.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as SuwardSDK from "../../../index.js";
|
|
5
5
|
export declare namespace PaymentsClient {
|
|
6
6
|
type Options = BaseClientOptions;
|
|
7
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
@@ -13,80 +13,80 @@ export declare class PaymentsClient {
|
|
|
13
13
|
/**
|
|
14
14
|
* List payments for a project
|
|
15
15
|
*
|
|
16
|
-
* @param {
|
|
16
|
+
* @param {SuwardSDK.GetV1PaymentsRequest} request
|
|
17
17
|
* @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
18
|
*
|
|
19
|
-
* @throws {@link
|
|
20
|
-
* @throws {@link
|
|
21
|
-
* @throws {@link
|
|
19
|
+
* @throws {@link SuwardSDK.BadRequestError}
|
|
20
|
+
* @throws {@link SuwardSDK.UnauthorizedError}
|
|
21
|
+
* @throws {@link SuwardSDK.InternalServerError}
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* await client.payments.listPayments()
|
|
25
25
|
*/
|
|
26
|
-
listPayments(request?:
|
|
26
|
+
listPayments(request?: SuwardSDK.GetV1PaymentsRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise<SuwardSDK.CryptopayListPaymentsResponse>;
|
|
27
27
|
private __listPayments;
|
|
28
28
|
/**
|
|
29
29
|
* Create a new payment
|
|
30
30
|
*
|
|
31
|
-
* @param {
|
|
31
|
+
* @param {SuwardSDK.CryptopayCreatePaymentRequest} request
|
|
32
32
|
* @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
33
33
|
*
|
|
34
|
-
* @throws {@link
|
|
35
|
-
* @throws {@link
|
|
36
|
-
* @throws {@link
|
|
34
|
+
* @throws {@link SuwardSDK.BadRequestError}
|
|
35
|
+
* @throws {@link SuwardSDK.UnauthorizedError}
|
|
36
|
+
* @throws {@link SuwardSDK.InternalServerError}
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* await client.payments.createPayment()
|
|
40
40
|
*/
|
|
41
|
-
createPayment(request?:
|
|
41
|
+
createPayment(request?: SuwardSDK.CryptopayCreatePaymentRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise<SuwardSDK.CryptopayPaymentResponse>;
|
|
42
42
|
private __createPayment;
|
|
43
43
|
/**
|
|
44
44
|
* Returns full payment details when called with an API key (merchant view).
|
|
45
45
|
* Returns limited payment details when called without an API key (customer view).
|
|
46
46
|
*
|
|
47
|
-
* @param {
|
|
47
|
+
* @param {SuwardSDK.GetV1PaymentsPaymentIdRequest} request
|
|
48
48
|
* @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
49
49
|
*
|
|
50
|
-
* @throws {@link
|
|
50
|
+
* @throws {@link SuwardSDK.InternalServerError}
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
53
|
* await client.payments.getPayment({
|
|
54
54
|
* paymentId: "paymentId"
|
|
55
55
|
* })
|
|
56
56
|
*/
|
|
57
|
-
getPayment(request:
|
|
57
|
+
getPayment(request: SuwardSDK.GetV1PaymentsPaymentIdRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise<SuwardSDK.GetV1PaymentsPaymentIdResponse>;
|
|
58
58
|
private __getPayment;
|
|
59
59
|
/**
|
|
60
60
|
* Cancel a payment
|
|
61
61
|
*
|
|
62
|
-
* @param {
|
|
62
|
+
* @param {SuwardSDK.PostV1PaymentsPaymentIdCancelRequest} request
|
|
63
63
|
* @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
64
64
|
*
|
|
65
|
-
* @throws {@link
|
|
66
|
-
* @throws {@link
|
|
65
|
+
* @throws {@link SuwardSDK.UnauthorizedError}
|
|
66
|
+
* @throws {@link SuwardSDK.InternalServerError}
|
|
67
67
|
*
|
|
68
68
|
* @example
|
|
69
69
|
* await client.payments.cancelPayment({
|
|
70
70
|
* paymentId: "paymentId"
|
|
71
71
|
* })
|
|
72
72
|
*/
|
|
73
|
-
cancelPayment(request:
|
|
73
|
+
cancelPayment(request: SuwardSDK.PostV1PaymentsPaymentIdCancelRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise<SuwardSDK.CryptopayPaymentResponse>;
|
|
74
74
|
private __cancelPayment;
|
|
75
75
|
/**
|
|
76
76
|
* Simulate payment status change (test mode only)
|
|
77
77
|
*
|
|
78
|
-
* @param {
|
|
78
|
+
* @param {SuwardSDK.CryptopaySimulatePaymentRequest} request
|
|
79
79
|
* @param {PaymentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
80
80
|
*
|
|
81
|
-
* @throws {@link
|
|
82
|
-
* @throws {@link
|
|
83
|
-
* @throws {@link
|
|
81
|
+
* @throws {@link SuwardSDK.BadRequestError}
|
|
82
|
+
* @throws {@link SuwardSDK.UnauthorizedError}
|
|
83
|
+
* @throws {@link SuwardSDK.InternalServerError}
|
|
84
84
|
*
|
|
85
85
|
* @example
|
|
86
86
|
* await client.payments.simulatePayment({
|
|
87
87
|
* paymentId: "paymentId"
|
|
88
88
|
* })
|
|
89
89
|
*/
|
|
90
|
-
simulatePayment(request:
|
|
90
|
+
simulatePayment(request: SuwardSDK.CryptopaySimulatePaymentRequest, requestOptions?: PaymentsClient.RequestOptions): core.HttpResponsePromise<SuwardSDK.CryptopayPaymentResponse>;
|
|
91
91
|
private __simulatePayment;
|
|
92
92
|
}
|