@getmanza/sdk 0.0.0-stage → 1.0.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.
- package/CHANGELOG.md +91 -0
- package/LICENSE +21 -0
- package/README.md +154 -2
- package/dist/client.d.ts +43 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/errors.d.ts +46 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.cjs +655 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +613 -0
- package/dist/page.d.ts +19 -0
- package/dist/page.d.ts.map +1 -0
- package/dist/resources/accounts.d.ts +19 -0
- package/dist/resources/accounts.d.ts.map +1 -0
- package/dist/resources/base.d.ts +19 -0
- package/dist/resources/base.d.ts.map +1 -0
- package/dist/resources/beneficiaries.d.ts +12 -0
- package/dist/resources/beneficiaries.d.ts.map +1 -0
- package/dist/resources/checkout_sessions.d.ts +7 -0
- package/dist/resources/checkout_sessions.d.ts.map +1 -0
- package/dist/resources/customers.d.ts +14 -0
- package/dist/resources/customers.d.ts.map +1 -0
- package/dist/resources/entity.d.ts +6 -0
- package/dist/resources/entity.d.ts.map +1 -0
- package/dist/resources/invoices.d.ts +20 -0
- package/dist/resources/invoices.d.ts.map +1 -0
- package/dist/resources/payee_trust_requests.d.ts +9 -0
- package/dist/resources/payee_trust_requests.d.ts.map +1 -0
- package/dist/resources/payment_links.d.ts +10 -0
- package/dist/resources/payment_links.d.ts.map +1 -0
- package/dist/resources/transfer_drafts.d.ts +15 -0
- package/dist/resources/transfer_drafts.d.ts.map +1 -0
- package/dist/resources/webhook_endpoints.d.ts +20 -0
- package/dist/resources/webhook_endpoints.d.ts.map +1 -0
- package/dist/response.d.ts +10 -0
- package/dist/response.d.ts.map +1 -0
- package/dist/transfer_authorization.d.ts +27 -0
- package/dist/transfer_authorization.d.ts.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +70 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@getmanza/sdk` (formerly `@getzazu/sdk`) are documented here.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
|
+
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
Renamed from Zazu to Manza; the first release under the new name is 1.0.0.
|
|
11
|
+
|
|
12
|
+
### Changed (breaking)
|
|
13
|
+
|
|
14
|
+
- Package `@getzazu/sdk` is now `@getmanza/sdk`.
|
|
15
|
+
- `Zazu` client is now `Manza`; every `Zazu*Error` is now `Manza*Error`
|
|
16
|
+
(`ZazuError` → `ManzaError`, `ZazuValidationError` → `ManzaValidationError`, …).
|
|
17
|
+
- `ZazuResponse` is now `ManzaResponse`.
|
|
18
|
+
- The version header is `Manza-Version` (was `Zazu-Version`).
|
|
19
|
+
- The User-Agent is `manza-ts/<version>` (was `zazu-ts/<version>`).
|
|
20
|
+
- Repository moved to `getmanza/manza-ts`.
|
|
21
|
+
|
|
22
|
+
### Deprecated
|
|
23
|
+
|
|
24
|
+
- `ZAZU_API_KEY`, `ZAZU_BASE_URL`, `ZAZU_API_VERSION` and `ZAZU_TIMEOUT_MS` still
|
|
25
|
+
work as a fallback for all of 1.x, with a one-time deprecation warning per
|
|
26
|
+
variable. Use the `MANZA_*` names; the fallback is removed in 2.0.
|
|
27
|
+
|
|
28
|
+
### Migration guide
|
|
29
|
+
|
|
30
|
+
| Before | After |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `bun add @getzazu/sdk` | `bun add @getmanza/sdk` |
|
|
33
|
+
| `import { Zazu } from "@getzazu/sdk"` | `import { Manza } from "@getmanza/sdk"` |
|
|
34
|
+
| `new Zazu({ apiKey })` | `new Manza({ apiKey })` |
|
|
35
|
+
| `err instanceof ZazuValidationError` | `err instanceof ManzaValidationError` |
|
|
36
|
+
| `ZAZU_API_KEY` | `MANZA_API_KEY` |
|
|
37
|
+
| `ZAZU_BASE_URL` | `MANZA_BASE_URL` |
|
|
38
|
+
| `ZAZU_API_VERSION` | `MANZA_API_VERSION` |
|
|
39
|
+
| `ZAZU_TIMEOUT_MS` | `MANZA_TIMEOUT_MS` |
|
|
40
|
+
|
|
41
|
+
## [0.3.0]
|
|
42
|
+
|
|
43
|
+
Mirrors zazu-ruby v0.3.0. Default `baseUrl` moved to `https://ma.manza.finance`
|
|
44
|
+
(production); the South-Africa host is `https://za.manza.finance`.
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
|
|
48
|
+
- `ZazuConflictError` (10th error class) — 409 responses now surface here, with
|
|
49
|
+
`paymentId` set from `error.payment_id` so a duplicate `client_reference`
|
|
50
|
+
points at the existing draft.
|
|
51
|
+
- `transferDrafts.authorize(id, { authorization_id, signature })` and
|
|
52
|
+
`transferDrafts.decline(id, { authorization_id, reason? })`. A blank
|
|
53
|
+
signature raises `ZazuArgumentError` before any HTTP call — the server
|
|
54
|
+
counts a missing one as a failed attempt.
|
|
55
|
+
- `TransferAuthorization` namespace (`signatureInput`, `sign`, `payeeFor`,
|
|
56
|
+
`SIGNATURE_VERSION`) for building the versioned, pipe-joined input and
|
|
57
|
+
computing its lowercase-hex HMAC-SHA256. Pure functions, no HTTP.
|
|
58
|
+
Verified against the shared fixed vector in `zazu-ruby`. `sign` is
|
|
59
|
+
**async** (Web Crypto, no `node:crypto` import) so it runs on every
|
|
60
|
+
target runtime — Node 20+, Bun, Deno, browsers, Workers.
|
|
61
|
+
- `beneficiaries.create`, `beneficiaries.listExternalAccounts`,
|
|
62
|
+
`beneficiaries.getExternalAccount`, `beneficiaries.createExternalAccount`.
|
|
63
|
+
- `payeeTrustRequests` resource — `create({ external_account_ids })` and `get`.
|
|
64
|
+
- `transfer_drafts.create` now accepts `client_reference` (unique per entity,
|
|
65
|
+
≤128 chars).
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
|
|
69
|
+
- Default `baseUrl`: `https://zazu.ma` → `https://ma.manza.finance`.
|
|
70
|
+
- 400 responses now raise `ZazuValidationError` (previously fell through to
|
|
71
|
+
the base `ZazuError`).
|
|
72
|
+
|
|
73
|
+
## [0.2.1]
|
|
74
|
+
|
|
75
|
+
Version alignment: the whole SDK family now releases in lockstep with zazu-ruby. Includes the transferDrafts + beneficiaries resources from 0.2.x.
|
|
76
|
+
|
|
77
|
+
### Added
|
|
78
|
+
|
|
79
|
+
- `checkoutSessions` resource — `create` and `get` mirror `Zazu::Resources::CheckoutSessions` in zazu-ruby v0.2.0
|
|
80
|
+
|
|
81
|
+
## [0.1.0]
|
|
82
|
+
|
|
83
|
+
Initial release.
|
|
84
|
+
|
|
85
|
+
### Added
|
|
86
|
+
|
|
87
|
+
- Runtime-agnostic `Zazu` client built on native `fetch`
|
|
88
|
+
- Resource modules: `accounts`, `customers`, `entity`, `invoices`, `paymentLinks`, `webhookEndpoints`
|
|
89
|
+
- Cursor-based `Page<T>` with async iterator
|
|
90
|
+
- Nine-class error hierarchy mirroring `zazu-ruby`
|
|
91
|
+
- Cassette-replay test harness driven by the Ruby SDK's release tarball
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Manza
|
|
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
CHANGED
|
@@ -1,3 +1,155 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @getmanza/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript SDK for the [Manza API](https://get-manza.com). Runtime-agnostic — runs on Node 20+, Bun, Deno, browsers, and Cloudflare Workers using native `fetch`.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bun add @getmanza/sdk # or npm / pnpm / yarn
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Manza } from "@getmanza/sdk";
|
|
13
|
+
|
|
14
|
+
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
|
|
15
|
+
|
|
16
|
+
const entity = await manza.entity.get();
|
|
17
|
+
console.log(entity.body);
|
|
18
|
+
|
|
19
|
+
const customers = await manza.customers.list({ q: "Acme" });
|
|
20
|
+
for (const c of customers.data) console.log(c);
|
|
21
|
+
|
|
22
|
+
// Walk every page lazily
|
|
23
|
+
for await (const customer of customers.records()) {
|
|
24
|
+
console.log(customer);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Environment variables `MANZA_API_KEY`, `MANZA_BASE_URL`, `MANZA_API_VERSION`, and `MANZA_TIMEOUT_MS` are read by default (Node/Bun only — browsers must pass options explicitly). The legacy `ZAZU_*` names still work for all of 1.x as a fallback and log a one-time deprecation warning. Upgrading from `@getzazu/sdk`? See the migration guide in [CHANGELOG.md](CHANGELOG.md).
|
|
29
|
+
|
|
30
|
+
## Resources
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
manza.entity.get();
|
|
34
|
+
|
|
35
|
+
manza.accounts.list({ currency_code: "MAD" });
|
|
36
|
+
manza.accounts.get(accountId);
|
|
37
|
+
manza.accounts.listTransactions(accountId);
|
|
38
|
+
manza.accounts.getTransaction(accountId, transactionId);
|
|
39
|
+
|
|
40
|
+
manza.customers.list({ q: "Acme" });
|
|
41
|
+
manza.customers.get(id);
|
|
42
|
+
manza.customers.create({ ... });
|
|
43
|
+
manza.customers.update(id, { ... });
|
|
44
|
+
manza.customers.delete(id);
|
|
45
|
+
|
|
46
|
+
manza.invoices.list();
|
|
47
|
+
manza.invoices.create({ ... });
|
|
48
|
+
// state-transition methods exist but the underlying public API is
|
|
49
|
+
// not yet wired up — see getmanza/app issue #2174.
|
|
50
|
+
|
|
51
|
+
manza.paymentLinks.list();
|
|
52
|
+
manza.paymentLinks.create({ ... });
|
|
53
|
+
manza.paymentLinks.cancel(id);
|
|
54
|
+
|
|
55
|
+
manza.webhookEndpoints.list();
|
|
56
|
+
manza.webhookEndpoints.create({ url, events: [...] });
|
|
57
|
+
manza.webhookEndpoints.test(id);
|
|
58
|
+
manza.webhookEndpoints.regenerateSecret(id);
|
|
59
|
+
manza.webhookEndpoints.enable(id);
|
|
60
|
+
manza.webhookEndpoints.disable(id);
|
|
61
|
+
|
|
62
|
+
manza.checkoutSessions.create({ account_id, amount, success_url, cancel_url });
|
|
63
|
+
manza.checkoutSessions.get(id);
|
|
64
|
+
|
|
65
|
+
manza.beneficiaries.list();
|
|
66
|
+
manza.beneficiaries.get(id);
|
|
67
|
+
manza.beneficiaries.create({ beneficiary_type: "individual", person_name: "Jane Doe" });
|
|
68
|
+
manza.beneficiaries.listExternalAccounts(beneficiaryId);
|
|
69
|
+
manza.beneficiaries.getExternalAccount(beneficiaryId, id);
|
|
70
|
+
manza.beneficiaries.createExternalAccount(beneficiaryId, { account_number });
|
|
71
|
+
|
|
72
|
+
manza.transferDrafts.create({ account_id, beneficiary_id, amount: "150.00", client_reference });
|
|
73
|
+
manza.transferDrafts.get(id);
|
|
74
|
+
manza.transferDrafts.authorize(id, { authorization_id, signature });
|
|
75
|
+
manza.transferDrafts.decline(id, { authorization_id, reason });
|
|
76
|
+
|
|
77
|
+
manza.payeeTrustRequests.create({ external_account_ids: [id] });
|
|
78
|
+
manza.payeeTrustRequests.get(id);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Transfer authorization
|
|
82
|
+
|
|
83
|
+
The `payment.authorization_requested` webhook delivers an `authorization_id` and a one-time `nonce`. Build the signature input from your own record of the draft (not the webhook's `signature_input`, which is there only to compare against), sign it with the authorizer endpoint's signing secret, and pass the result to `transferDrafts.authorize`.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { Manza, TransferAuthorization } from "@getmanza/sdk";
|
|
87
|
+
|
|
88
|
+
const input = TransferAuthorization.signatureInput({
|
|
89
|
+
payment_id: draft.id,
|
|
90
|
+
nonce,
|
|
91
|
+
amount: draft.amount, // The API's decimal string verbatim ("2500.0"), not a number.
|
|
92
|
+
currency_code: draft.currency_code,
|
|
93
|
+
account_id: draft.account_id,
|
|
94
|
+
payee: TransferAuthorization.payeeFor({ external_account_id: draft.external_account_id }),
|
|
95
|
+
client_reference: draft.client_reference,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const signature = await TransferAuthorization.sign({
|
|
99
|
+
secret: signingSecret,
|
|
100
|
+
signature_input: input,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
await manza.transferDrafts.authorize(draft.id, {
|
|
104
|
+
authorization_id: authorizationId,
|
|
105
|
+
signature,
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`TransferAuthorization.sign` is async — it uses the Web Crypto API so it works on Node, Bun, Deno, browsers, and Workers without a `node:crypto` import.
|
|
110
|
+
|
|
111
|
+
Use a key other than the one that created the draft — otherwise 403 `same_key_forbidden`. A blank signature raises `ManzaArgumentError` locally; the server counts a missing one as a failed attempt, and five fail the challenge.
|
|
112
|
+
|
|
113
|
+
## Errors
|
|
114
|
+
|
|
115
|
+
Ten concrete subclasses; discriminate with `instanceof`.
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
import { ManzaValidationError, ManzaRateLimitError, ManzaNotFoundError } from "@getmanza/sdk";
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
await manza.customers.create({ ... });
|
|
122
|
+
} catch (e) {
|
|
123
|
+
if (e instanceof ManzaValidationError) {
|
|
124
|
+
console.error(e.param, e.body);
|
|
125
|
+
} else if (e instanceof ManzaRateLimitError) {
|
|
126
|
+
console.warn(`Retry after ${e.retryAfter}s`);
|
|
127
|
+
} else if (e instanceof ManzaNotFoundError) {
|
|
128
|
+
/* ... */
|
|
129
|
+
} else {
|
|
130
|
+
throw e;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Wire format
|
|
136
|
+
|
|
137
|
+
Response bodies are returned as-is from the API — `snake_case` keys, no auto-camelCasing. The same shape ships across every Manza SDK (Ruby, TypeScript, Python, ...) so the cassette contract is one-to-one.
|
|
138
|
+
|
|
139
|
+
## Cassette-replay testing
|
|
140
|
+
|
|
141
|
+
Tests replay the canonical cassettes recorded by [manza-ruby](https://github.com/getmanza/manza-ruby). The cassettes are downloaded at CI time from the Ruby SDK's release tarball, parsed via `js-yaml`, and replayed with [msw](https://mswjs.io). Same interactions, same assertions, every language.
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
bun run fetch:cassettes
|
|
145
|
+
bun test
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Sibling SDKs
|
|
149
|
+
|
|
150
|
+
- [manza-ruby](https://github.com/getmanza/manza-ruby) — reference implementation (records the cassettes)
|
|
151
|
+
- manza-python, manza-php, manza-go, manza-crystal, manza-elixir — coming up
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Accounts } from "./resources/accounts.js";
|
|
2
|
+
import { Beneficiaries } from "./resources/beneficiaries.js";
|
|
3
|
+
import { CheckoutSessions } from "./resources/checkout_sessions.js";
|
|
4
|
+
import { Customers } from "./resources/customers.js";
|
|
5
|
+
import { Entity } from "./resources/entity.js";
|
|
6
|
+
import { Invoices } from "./resources/invoices.js";
|
|
7
|
+
import { PayeeTrustRequests } from "./resources/payee_trust_requests.js";
|
|
8
|
+
import { PaymentLinks } from "./resources/payment_links.js";
|
|
9
|
+
import { TransferDrafts } from "./resources/transfer_drafts.js";
|
|
10
|
+
import { WebhookEndpoints } from "./resources/webhook_endpoints.js";
|
|
11
|
+
import { ZazuResponse } from "./response.js";
|
|
12
|
+
export interface ZazuClientOptions {
|
|
13
|
+
apiKey?: string | undefined;
|
|
14
|
+
baseUrl?: string;
|
|
15
|
+
apiVersion?: string | undefined;
|
|
16
|
+
timeoutMs?: number;
|
|
17
|
+
fetch?: typeof fetch;
|
|
18
|
+
}
|
|
19
|
+
export interface RequestOptions {
|
|
20
|
+
params?: Record<string, unknown> | undefined;
|
|
21
|
+
body?: unknown;
|
|
22
|
+
headers?: Record<string, string> | undefined;
|
|
23
|
+
}
|
|
24
|
+
export declare class Zazu {
|
|
25
|
+
#private;
|
|
26
|
+
readonly apiKey: string;
|
|
27
|
+
readonly baseUrl: string;
|
|
28
|
+
readonly apiVersion: string | null;
|
|
29
|
+
readonly timeoutMs: number;
|
|
30
|
+
readonly accounts: Accounts;
|
|
31
|
+
readonly beneficiaries: Beneficiaries;
|
|
32
|
+
readonly checkoutSessions: CheckoutSessions;
|
|
33
|
+
readonly customers: Customers;
|
|
34
|
+
readonly entity: Entity;
|
|
35
|
+
readonly invoices: Invoices;
|
|
36
|
+
readonly payeeTrustRequests: PayeeTrustRequests;
|
|
37
|
+
readonly paymentLinks: PaymentLinks;
|
|
38
|
+
readonly transferDrafts: TransferDrafts;
|
|
39
|
+
readonly webhookEndpoints: WebhookEndpoints;
|
|
40
|
+
constructor(options?: ZazuClientOptions);
|
|
41
|
+
request<T = unknown>(method: string, path: string, options?: RequestOptions): Promise<ZazuResponse<T>>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,SAAS,CAAC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|
|
2
|
+
status?: number;
|
|
3
|
+
requestId?: string | null;
|
|
4
|
+
type?: string | null;
|
|
5
|
+
param?: string | null;
|
|
6
|
+
body?: unknown;
|
|
7
|
+
headers?: Headers | null;
|
|
8
|
+
}
|
|
9
|
+
export declare class ZazuError extends Error {
|
|
10
|
+
readonly status: number | undefined;
|
|
11
|
+
readonly requestId: string | null;
|
|
12
|
+
readonly type: string | null;
|
|
13
|
+
readonly param: string | null;
|
|
14
|
+
readonly body: unknown;
|
|
15
|
+
readonly headers: Headers | null;
|
|
16
|
+
constructor(message: string, options?: ZazuErrorOptions);
|
|
17
|
+
}
|
|
18
|
+
export declare class ZazuConfigurationError extends ZazuError {
|
|
19
|
+
}
|
|
20
|
+
export declare class ZazuConnectionError extends ZazuError {
|
|
21
|
+
}
|
|
22
|
+
export declare class ZazuAuthenticationError extends ZazuError {
|
|
23
|
+
}
|
|
24
|
+
export declare class ZazuForbiddenError extends ZazuError {
|
|
25
|
+
}
|
|
26
|
+
export declare class ZazuNotFoundError extends ZazuError {
|
|
27
|
+
}
|
|
28
|
+
export declare class ZazuValidationError extends ZazuError {
|
|
29
|
+
}
|
|
30
|
+
export declare class ZazuRateLimitError extends ZazuError {
|
|
31
|
+
readonly retryAfter: number | null;
|
|
32
|
+
constructor(message: string, options?: ZazuErrorOptions & {
|
|
33
|
+
retryAfter?: number | null;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export declare class ZazuServerError extends ZazuError {
|
|
37
|
+
}
|
|
38
|
+
export declare class ZazuArgumentError extends ZazuError {
|
|
39
|
+
}
|
|
40
|
+
export declare class ZazuConflictError extends ZazuError {
|
|
41
|
+
readonly paymentId: string | null;
|
|
42
|
+
constructor(message: string, options?: ZazuErrorOptions & {
|
|
43
|
+
paymentId?: string | null;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","s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