@takeal/cusfront-sdk 0.1.0 → 0.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.
- package/CHANGELOG.md +104 -2
- package/README.md +393 -14
- package/dist/devices-C3JHi2Hi.d.cts +165 -0
- package/dist/devices-DP_hxwmW.d.ts +165 -0
- package/dist/{http-BkZZZI8K.d.cts → http-B-OQwMYn.d.cts} +13 -2
- package/dist/{http-BkZZZI8K.d.ts → http-B-OQwMYn.d.ts} +13 -2
- package/dist/index.cjs +425 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +77 -8
- package/dist/index.d.ts +77 -8
- package/dist/index.js +422 -26
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +133 -6
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +65 -3
- package/dist/react/index.d.ts +65 -3
- package/dist/react/index.js +131 -8
- package/dist/react/index.js.map +1 -1
- package/dist/resources/auth.cjs +73 -15
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.d.cts +100 -9
- package/dist/resources/auth.d.ts +100 -9
- package/dist/resources/auth.js +73 -15
- package/dist/resources/auth.js.map +1 -1
- package/dist/resources/balance.cjs +4 -3
- package/dist/resources/balance.cjs.map +1 -1
- package/dist/resources/balance.d.cts +8 -9
- package/dist/resources/balance.d.ts +8 -9
- package/dist/resources/balance.js +4 -3
- package/dist/resources/balance.js.map +1 -1
- package/dist/resources/blog.d.cts +1 -1
- package/dist/resources/blog.d.ts +1 -1
- package/dist/resources/branding.cjs.map +1 -1
- package/dist/resources/branding.d.cts +8 -2
- package/dist/resources/branding.d.ts +8 -2
- package/dist/resources/branding.js.map +1 -1
- package/dist/resources/cards.cjs +33 -1
- package/dist/resources/cards.cjs.map +1 -1
- package/dist/resources/cards.d.cts +105 -4
- package/dist/resources/cards.d.ts +105 -4
- package/dist/resources/cards.js +33 -1
- package/dist/resources/cards.js.map +1 -1
- package/dist/resources/deposits.d.cts +1 -1
- package/dist/resources/deposits.d.ts +1 -1
- package/dist/resources/devices.cjs +92 -0
- package/dist/resources/devices.cjs.map +1 -0
- package/dist/resources/devices.d.cts +3 -0
- package/dist/resources/devices.d.ts +3 -0
- package/dist/resources/devices.js +89 -0
- package/dist/resources/devices.js.map +1 -0
- package/dist/resources/me.cjs +32 -0
- package/dist/resources/me.cjs.map +1 -0
- package/dist/resources/me.d.cts +40 -0
- package/dist/resources/me.d.ts +40 -0
- package/dist/resources/me.js +30 -0
- package/dist/resources/me.js.map +1 -0
- package/dist/resources/notifications.cjs +53 -0
- package/dist/resources/notifications.cjs.map +1 -0
- package/dist/resources/notifications.d.cts +109 -0
- package/dist/resources/notifications.d.ts +109 -0
- package/dist/resources/notifications.js +51 -0
- package/dist/resources/notifications.js.map +1 -0
- package/dist/resources/push.cjs +65 -0
- package/dist/resources/push.cjs.map +1 -0
- package/dist/resources/push.d.cts +76 -0
- package/dist/resources/push.d.ts +76 -0
- package/dist/resources/push.js +62 -0
- package/dist/resources/push.js.map +1 -0
- package/dist/resources/sessions.cjs +26 -0
- package/dist/resources/sessions.cjs.map +1 -0
- package/dist/resources/sessions.d.cts +43 -0
- package/dist/resources/sessions.d.ts +43 -0
- package/dist/resources/sessions.js +24 -0
- package/dist/resources/sessions.js.map +1 -0
- package/dist/resources/subscriptions.cjs.map +1 -1
- package/dist/resources/subscriptions.d.cts +8 -1
- package/dist/resources/subscriptions.d.ts +8 -1
- package/dist/resources/subscriptions.js.map +1 -1
- package/dist/resources/wallet.cjs +24 -0
- package/dist/resources/wallet.cjs.map +1 -0
- package/dist/resources/wallet.d.cts +39 -0
- package/dist/resources/wallet.d.ts +39 -0
- package/dist/resources/wallet.js +22 -0
- package/dist/resources/wallet.js.map +1 -0
- package/dist/telegram.cjs +466 -28
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.d.cts +65 -7
- package/dist/telegram.d.ts +65 -7
- package/dist/telegram.js +465 -29
- package/dist/telegram.js.map +1 -1
- package/package.json +37 -3
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { H as HttpClient } from '../http-B-OQwMYn.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sessions resource — `client.sessions.*`.
|
|
5
|
+
*
|
|
6
|
+
* Every device or browser the user is signed in on. Lets a settings screen
|
|
7
|
+
* show "where you're signed in" and sign one or all of them out.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const sessions = await client.sessions.list();
|
|
11
|
+
* const others = sessions.filter((s) => !s.current);
|
|
12
|
+
* await client.sessions.revokeOthers();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
interface UserSession {
|
|
16
|
+
/** Session id; pass it to `revoke`. */
|
|
17
|
+
jti: string;
|
|
18
|
+
issued_at: string;
|
|
19
|
+
expires_at: string;
|
|
20
|
+
last_seen_at: string;
|
|
21
|
+
/** Client IP recorded for the session, if known. */
|
|
22
|
+
remote_ip?: string | null;
|
|
23
|
+
/** Browser or app that opened the session, if known. */
|
|
24
|
+
user_agent?: string | null;
|
|
25
|
+
/** `true` for the session this client is using. */
|
|
26
|
+
current: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare class SessionsResource {
|
|
29
|
+
private readonly http;
|
|
30
|
+
constructor(http: HttpClient);
|
|
31
|
+
/** All live sessions of the account, this one included. */
|
|
32
|
+
list(): Promise<UserSession[]>;
|
|
33
|
+
/** Sign out one session. Works on the current one too; the stored JWT
|
|
34
|
+
* stops working, so follow with `client.auth.signOut()`.
|
|
35
|
+
* 404 when the session is unknown or already signed out. */
|
|
36
|
+
revoke(jti: string): Promise<void>;
|
|
37
|
+
/** Sign out every session except this one. */
|
|
38
|
+
revokeOthers(): Promise<{
|
|
39
|
+
revoked_sessions: number;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { SessionsResource, type UserSession };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { H as HttpClient } from '../http-B-OQwMYn.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sessions resource — `client.sessions.*`.
|
|
5
|
+
*
|
|
6
|
+
* Every device or browser the user is signed in on. Lets a settings screen
|
|
7
|
+
* show "where you're signed in" and sign one or all of them out.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const sessions = await client.sessions.list();
|
|
11
|
+
* const others = sessions.filter((s) => !s.current);
|
|
12
|
+
* await client.sessions.revokeOthers();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
interface UserSession {
|
|
16
|
+
/** Session id; pass it to `revoke`. */
|
|
17
|
+
jti: string;
|
|
18
|
+
issued_at: string;
|
|
19
|
+
expires_at: string;
|
|
20
|
+
last_seen_at: string;
|
|
21
|
+
/** Client IP recorded for the session, if known. */
|
|
22
|
+
remote_ip?: string | null;
|
|
23
|
+
/** Browser or app that opened the session, if known. */
|
|
24
|
+
user_agent?: string | null;
|
|
25
|
+
/** `true` for the session this client is using. */
|
|
26
|
+
current: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare class SessionsResource {
|
|
29
|
+
private readonly http;
|
|
30
|
+
constructor(http: HttpClient);
|
|
31
|
+
/** All live sessions of the account, this one included. */
|
|
32
|
+
list(): Promise<UserSession[]>;
|
|
33
|
+
/** Sign out one session. Works on the current one too; the stored JWT
|
|
34
|
+
* stops working, so follow with `client.auth.signOut()`.
|
|
35
|
+
* 404 when the session is unknown or already signed out. */
|
|
36
|
+
revoke(jti: string): Promise<void>;
|
|
37
|
+
/** Sign out every session except this one. */
|
|
38
|
+
revokeOthers(): Promise<{
|
|
39
|
+
revoked_sessions: number;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { SessionsResource, type UserSession };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/resources/sessions.ts
|
|
2
|
+
var SessionsResource = class {
|
|
3
|
+
constructor(http) {
|
|
4
|
+
this.http = http;
|
|
5
|
+
}
|
|
6
|
+
/** All live sessions of the account, this one included. */
|
|
7
|
+
async list() {
|
|
8
|
+
return this.http.get("/me/sessions");
|
|
9
|
+
}
|
|
10
|
+
/** Sign out one session. Works on the current one too; the stored JWT
|
|
11
|
+
* stops working, so follow with `client.auth.signOut()`.
|
|
12
|
+
* 404 when the session is unknown or already signed out. */
|
|
13
|
+
async revoke(jti) {
|
|
14
|
+
await this.http.delete(`/me/sessions/${encodeURIComponent(jti)}`);
|
|
15
|
+
}
|
|
16
|
+
/** Sign out every session except this one. */
|
|
17
|
+
async revokeOthers() {
|
|
18
|
+
return this.http.post("/me/sessions/terminate-others");
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { SessionsResource };
|
|
23
|
+
//# sourceMappingURL=sessions.js.map
|
|
24
|
+
//# sourceMappingURL=sessions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/resources/sessions.ts"],"names":[],"mappings":";AA6BO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,MAAM,IAAA,GAA+B;AACnC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,cAAc,CAAA;AAAA,EACpD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,OAAO,GAAA,EAA4B;AACvC,IAAA,MAAM,KAAK,IAAA,CAAK,MAAA,CAAa,gBAAgB,kBAAA,CAAmB,GAAG,CAAC,CAAA,CAAE,CAAA;AAAA,EACxE;AAAA;AAAA,EAGA,MAAM,YAAA,GAAsD;AAC1D,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,IAAA,CAAmC,+BAA+B,CAAA;AAAA,EACrF;AACF","file":"sessions.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Sessions resource — `client.sessions.*`.\n *\n * Every device or browser the user is signed in on. Lets a settings screen\n * show \"where you're signed in\" and sign one or all of them out.\n *\n * ```ts\n * const sessions = await client.sessions.list();\n * const others = sessions.filter((s) => !s.current);\n * await client.sessions.revokeOthers();\n * ```\n */\n\nexport interface UserSession {\n /** Session id; pass it to `revoke`. */\n jti: string;\n issued_at: string;\n expires_at: string;\n last_seen_at: string;\n /** Client IP recorded for the session, if known. */\n remote_ip?: string | null;\n /** Browser or app that opened the session, if known. */\n user_agent?: string | null;\n /** `true` for the session this client is using. */\n current: boolean;\n}\n\nexport class SessionsResource {\n constructor(private readonly http: HttpClient) {}\n\n /** All live sessions of the account, this one included. */\n async list(): Promise<UserSession[]> {\n return this.http.get<UserSession[]>(\"/me/sessions\");\n }\n\n /** Sign out one session. Works on the current one too; the stored JWT\n * stops working, so follow with `client.auth.signOut()`.\n * 404 when the session is unknown or already signed out. */\n async revoke(jti: string): Promise<void> {\n await this.http.delete<void>(`/me/sessions/${encodeURIComponent(jti)}`);\n }\n\n /** Sign out every session except this one. */\n async revokeOthers(): Promise<{ revoked_sessions: number }> {\n return this.http.post<{ revoked_sessions: number }>(\"/me/sessions/terminate-others\");\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":";;;AAkCO,IAAM,wBAAN,MAA4B;AAAA,EACjC,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA,EAEhD,MAAM,GAAA,GAA8B;AAClC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAmB,CAAA;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,IAAI,QAAA,EAAsD;AAC9D,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAA,EAAqB;AAAA,MACvD,IAAA,EAAM,EAAE,QAAA;AAAS,KAClB,CAAA;AAAA,EACH;AACF","file":"subscriptions.cjs","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Subscriptions resource — `client.subscriptions.*`.\n *\n * Which channels the signed-in user agreed to receive announcements on.\n * `available` tells you which toggles to render: a deployment with no\n * Telegram bot configured can't deliver there, so offering the switch would\n * be a lie.\n *\n * ```ts\n * const { channels, available } = await client.subscriptions.get();\n * await client.subscriptions.set([...channels, \"telegram\"]);\n * ```\n *\n * Unrelated to paid/VIP tiers — this is only about announcements.\n *\n * @deprecated Announcements are now the `marketing` category of the\n * notification preferences. Read them with\n * `client.notifications.getPreferences()` and change them with\n * `client.notifications.setPreferences({ categories: { marketing: { email: true, telegram: false } } })`.\n * This endpoint keeps working as an alias over that setting.\n */\n\nexport type BroadcastChannel = \"email\" | \"telegram\" | (string & {});\n\nexport interface Subscriptions {\n /** Channels the user currently receives announcements on. */\n channels: BroadcastChannel[];\n /** Channels this deployment can actually deliver on. */\n available: BroadcastChannel[];\n}\n\n/** @deprecated See the note at the top of this module. */\nexport class SubscriptionsResource {\n constructor(private readonly http: HttpClient) {}\n\n async get(): Promise<Subscriptions> {\n return this.http.get<Subscriptions>(\"/me/subscriptions\");\n }\n\n /**\n * Replace the whole set — this is a PUT, not a merge. Pass `[]` to opt out\n * of everything.\n */\n async set(channels: BroadcastChannel[]): Promise<Subscriptions> {\n return this.http.put<Subscriptions>(\"/me/subscriptions\", {\n body: { channels },\n });\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HttpClient } from '../http-
|
|
1
|
+
import { H as HttpClient } from '../http-B-OQwMYn.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Subscriptions resource — `client.subscriptions.*`.
|
|
@@ -14,6 +14,12 @@ import { H as HttpClient } from '../http-BkZZZI8K.cjs';
|
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
16
|
* Unrelated to paid/VIP tiers — this is only about announcements.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated Announcements are now the `marketing` category of the
|
|
19
|
+
* notification preferences. Read them with
|
|
20
|
+
* `client.notifications.getPreferences()` and change them with
|
|
21
|
+
* `client.notifications.setPreferences({ categories: { marketing: { email: true, telegram: false } } })`.
|
|
22
|
+
* This endpoint keeps working as an alias over that setting.
|
|
17
23
|
*/
|
|
18
24
|
type BroadcastChannel = "email" | "telegram" | (string & {});
|
|
19
25
|
interface Subscriptions {
|
|
@@ -22,6 +28,7 @@ interface Subscriptions {
|
|
|
22
28
|
/** Channels this deployment can actually deliver on. */
|
|
23
29
|
available: BroadcastChannel[];
|
|
24
30
|
}
|
|
31
|
+
/** @deprecated See the note at the top of this module. */
|
|
25
32
|
declare class SubscriptionsResource {
|
|
26
33
|
private readonly http;
|
|
27
34
|
constructor(http: HttpClient);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HttpClient } from '../http-
|
|
1
|
+
import { H as HttpClient } from '../http-B-OQwMYn.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Subscriptions resource — `client.subscriptions.*`.
|
|
@@ -14,6 +14,12 @@ import { H as HttpClient } from '../http-BkZZZI8K.js';
|
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
16
|
* Unrelated to paid/VIP tiers — this is only about announcements.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated Announcements are now the `marketing` category of the
|
|
19
|
+
* notification preferences. Read them with
|
|
20
|
+
* `client.notifications.getPreferences()` and change them with
|
|
21
|
+
* `client.notifications.setPreferences({ categories: { marketing: { email: true, telegram: false } } })`.
|
|
22
|
+
* This endpoint keeps working as an alias over that setting.
|
|
17
23
|
*/
|
|
18
24
|
type BroadcastChannel = "email" | "telegram" | (string & {});
|
|
19
25
|
interface Subscriptions {
|
|
@@ -22,6 +28,7 @@ interface Subscriptions {
|
|
|
22
28
|
/** Channels this deployment can actually deliver on. */
|
|
23
29
|
available: BroadcastChannel[];
|
|
24
30
|
}
|
|
31
|
+
/** @deprecated See the note at the top of this module. */
|
|
25
32
|
declare class SubscriptionsResource {
|
|
26
33
|
private readonly http;
|
|
27
34
|
constructor(http: HttpClient);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":";AAkCO,IAAM,wBAAN,MAA4B;AAAA,EACjC,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA,EAEhD,MAAM,GAAA,GAA8B;AAClC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAmB,CAAA;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,IAAI,QAAA,EAAsD;AAC9D,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAA,EAAqB;AAAA,MACvD,IAAA,EAAM,EAAE,QAAA;AAAS,KAClB,CAAA;AAAA,EACH;AACF","file":"subscriptions.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Subscriptions resource — `client.subscriptions.*`.\n *\n * Which channels the signed-in user agreed to receive announcements on.\n * `available` tells you which toggles to render: a deployment with no\n * Telegram bot configured can't deliver there, so offering the switch would\n * be a lie.\n *\n * ```ts\n * const { channels, available } = await client.subscriptions.get();\n * await client.subscriptions.set([...channels, \"telegram\"]);\n * ```\n *\n * Unrelated to paid/VIP tiers — this is only about announcements.\n *\n * @deprecated Announcements are now the `marketing` category of the\n * notification preferences. Read them with\n * `client.notifications.getPreferences()` and change them with\n * `client.notifications.setPreferences({ categories: { marketing: { email: true, telegram: false } } })`.\n * This endpoint keeps working as an alias over that setting.\n */\n\nexport type BroadcastChannel = \"email\" | \"telegram\" | (string & {});\n\nexport interface Subscriptions {\n /** Channels the user currently receives announcements on. */\n channels: BroadcastChannel[];\n /** Channels this deployment can actually deliver on. */\n available: BroadcastChannel[];\n}\n\n/** @deprecated See the note at the top of this module. */\nexport class SubscriptionsResource {\n constructor(private readonly http: HttpClient) {}\n\n async get(): Promise<Subscriptions> {\n return this.http.get<Subscriptions>(\"/me/subscriptions\");\n }\n\n /**\n * Replace the whole set — this is a PUT, not a merge. Pass `[]` to opt out\n * of everything.\n */\n async set(channels: BroadcastChannel[]): Promise<Subscriptions> {\n return this.http.put<Subscriptions>(\"/me/subscriptions\", {\n body: { channels },\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/resources/wallet.ts
|
|
4
|
+
var WalletResource = class {
|
|
5
|
+
constructor(http) {
|
|
6
|
+
this.http = http;
|
|
7
|
+
}
|
|
8
|
+
/** Current wallet currency + the currencies the user may switch to. */
|
|
9
|
+
async get(opts = {}) {
|
|
10
|
+
return this.http.get("/me/wallet", { signal: opts.signal });
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Switch the wallet currency. Fails with `409 wallet_not_empty` while any
|
|
14
|
+
* balance is non-zero, and `400 currency_not_allowed` for a currency the
|
|
15
|
+
* deployment does not offer.
|
|
16
|
+
*/
|
|
17
|
+
async set(currency, opts = {}) {
|
|
18
|
+
return this.http.put("/me/wallet", { body: { currency }, signal: opts.signal });
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.WalletResource = WalletResource;
|
|
23
|
+
//# sourceMappingURL=wallet.cjs.map
|
|
24
|
+
//# sourceMappingURL=wallet.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/resources/wallet.ts"],"names":[],"mappings":";;;AAuBO,IAAM,iBAAN,MAAqB;AAAA,EAC1B,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,MAAM,GAAA,CAAI,IAAA,GAAiC,EAAC,EAAoB;AAC9D,IAAA,OAAO,IAAA,CAAK,KAAK,GAAA,CAAY,YAAA,EAAc,EAAE,MAAA,EAAQ,IAAA,CAAK,QAAQ,CAAA;AAAA,EACpE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,GAAA,CAAI,QAAA,EAAkB,IAAA,GAAiC,EAAC,EAAoB;AAChF,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAY,YAAA,EAAc,EAAE,IAAA,EAAM,EAAE,QAAA,EAAS,EAAG,MAAA,EAAQ,IAAA,CAAK,MAAA,EAAQ,CAAA;AAAA,EACxF;AACF","file":"wallet.cjs","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Wallet resource — `client.wallet.*`.\n *\n * Which currency the user's wallet is held in. Deposits in any other\n * currency are converted on funding (quote first, see `client.deposits`);\n * cards issued in another currency are paid from the wallet with an FX leg\n * at issuance. A user may switch currency only while every balance is zero\n * and only to a currency the deployment offers (`allowed`).\n */\n\n/** The user's wallet currency and what they may switch to. */\nexport interface Wallet {\n /** ISO 4217 code the wallet is held in. */\n currency: string;\n /** `true` when chosen by the user (or set by an operator), `false` when it\n * is the deployment default. */\n explicit: boolean;\n /** Currencies accepted by `set()`. */\n allowed: string[];\n}\n\nexport class WalletResource {\n constructor(private readonly http: HttpClient) {}\n\n /** Current wallet currency + the currencies the user may switch to. */\n async get(opts: { signal?: AbortSignal } = {}): Promise<Wallet> {\n return this.http.get<Wallet>(\"/me/wallet\", { signal: opts.signal });\n }\n\n /**\n * Switch the wallet currency. Fails with `409 wallet_not_empty` while any\n * balance is non-zero, and `400 currency_not_allowed` for a currency the\n * deployment does not offer.\n */\n async set(currency: string, opts: { signal?: AbortSignal } = {}): Promise<Wallet> {\n return this.http.put<Wallet>(\"/me/wallet\", { body: { currency }, signal: opts.signal });\n }\n}\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { H as HttpClient } from '../http-B-OQwMYn.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wallet resource — `client.wallet.*`.
|
|
5
|
+
*
|
|
6
|
+
* Which currency the user's wallet is held in. Deposits in any other
|
|
7
|
+
* currency are converted on funding (quote first, see `client.deposits`);
|
|
8
|
+
* cards issued in another currency are paid from the wallet with an FX leg
|
|
9
|
+
* at issuance. A user may switch currency only while every balance is zero
|
|
10
|
+
* and only to a currency the deployment offers (`allowed`).
|
|
11
|
+
*/
|
|
12
|
+
/** The user's wallet currency and what they may switch to. */
|
|
13
|
+
interface Wallet {
|
|
14
|
+
/** ISO 4217 code the wallet is held in. */
|
|
15
|
+
currency: string;
|
|
16
|
+
/** `true` when chosen by the user (or set by an operator), `false` when it
|
|
17
|
+
* is the deployment default. */
|
|
18
|
+
explicit: boolean;
|
|
19
|
+
/** Currencies accepted by `set()`. */
|
|
20
|
+
allowed: string[];
|
|
21
|
+
}
|
|
22
|
+
declare class WalletResource {
|
|
23
|
+
private readonly http;
|
|
24
|
+
constructor(http: HttpClient);
|
|
25
|
+
/** Current wallet currency + the currencies the user may switch to. */
|
|
26
|
+
get(opts?: {
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
}): Promise<Wallet>;
|
|
29
|
+
/**
|
|
30
|
+
* Switch the wallet currency. Fails with `409 wallet_not_empty` while any
|
|
31
|
+
* balance is non-zero, and `400 currency_not_allowed` for a currency the
|
|
32
|
+
* deployment does not offer.
|
|
33
|
+
*/
|
|
34
|
+
set(currency: string, opts?: {
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
}): Promise<Wallet>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { type Wallet, WalletResource };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { H as HttpClient } from '../http-B-OQwMYn.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wallet resource — `client.wallet.*`.
|
|
5
|
+
*
|
|
6
|
+
* Which currency the user's wallet is held in. Deposits in any other
|
|
7
|
+
* currency are converted on funding (quote first, see `client.deposits`);
|
|
8
|
+
* cards issued in another currency are paid from the wallet with an FX leg
|
|
9
|
+
* at issuance. A user may switch currency only while every balance is zero
|
|
10
|
+
* and only to a currency the deployment offers (`allowed`).
|
|
11
|
+
*/
|
|
12
|
+
/** The user's wallet currency and what they may switch to. */
|
|
13
|
+
interface Wallet {
|
|
14
|
+
/** ISO 4217 code the wallet is held in. */
|
|
15
|
+
currency: string;
|
|
16
|
+
/** `true` when chosen by the user (or set by an operator), `false` when it
|
|
17
|
+
* is the deployment default. */
|
|
18
|
+
explicit: boolean;
|
|
19
|
+
/** Currencies accepted by `set()`. */
|
|
20
|
+
allowed: string[];
|
|
21
|
+
}
|
|
22
|
+
declare class WalletResource {
|
|
23
|
+
private readonly http;
|
|
24
|
+
constructor(http: HttpClient);
|
|
25
|
+
/** Current wallet currency + the currencies the user may switch to. */
|
|
26
|
+
get(opts?: {
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
}): Promise<Wallet>;
|
|
29
|
+
/**
|
|
30
|
+
* Switch the wallet currency. Fails with `409 wallet_not_empty` while any
|
|
31
|
+
* balance is non-zero, and `400 currency_not_allowed` for a currency the
|
|
32
|
+
* deployment does not offer.
|
|
33
|
+
*/
|
|
34
|
+
set(currency: string, opts?: {
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
}): Promise<Wallet>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { type Wallet, WalletResource };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/resources/wallet.ts
|
|
2
|
+
var WalletResource = class {
|
|
3
|
+
constructor(http) {
|
|
4
|
+
this.http = http;
|
|
5
|
+
}
|
|
6
|
+
/** Current wallet currency + the currencies the user may switch to. */
|
|
7
|
+
async get(opts = {}) {
|
|
8
|
+
return this.http.get("/me/wallet", { signal: opts.signal });
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Switch the wallet currency. Fails with `409 wallet_not_empty` while any
|
|
12
|
+
* balance is non-zero, and `400 currency_not_allowed` for a currency the
|
|
13
|
+
* deployment does not offer.
|
|
14
|
+
*/
|
|
15
|
+
async set(currency, opts = {}) {
|
|
16
|
+
return this.http.put("/me/wallet", { body: { currency }, signal: opts.signal });
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { WalletResource };
|
|
21
|
+
//# sourceMappingURL=wallet.js.map
|
|
22
|
+
//# sourceMappingURL=wallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/resources/wallet.ts"],"names":[],"mappings":";AAuBO,IAAM,iBAAN,MAAqB;AAAA,EAC1B,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,MAAM,GAAA,CAAI,IAAA,GAAiC,EAAC,EAAoB;AAC9D,IAAA,OAAO,IAAA,CAAK,KAAK,GAAA,CAAY,YAAA,EAAc,EAAE,MAAA,EAAQ,IAAA,CAAK,QAAQ,CAAA;AAAA,EACpE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,GAAA,CAAI,QAAA,EAAkB,IAAA,GAAiC,EAAC,EAAoB;AAChF,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAY,YAAA,EAAc,EAAE,IAAA,EAAM,EAAE,QAAA,EAAS,EAAG,MAAA,EAAQ,IAAA,CAAK,MAAA,EAAQ,CAAA;AAAA,EACxF;AACF","file":"wallet.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Wallet resource — `client.wallet.*`.\n *\n * Which currency the user's wallet is held in. Deposits in any other\n * currency are converted on funding (quote first, see `client.deposits`);\n * cards issued in another currency are paid from the wallet with an FX leg\n * at issuance. A user may switch currency only while every balance is zero\n * and only to a currency the deployment offers (`allowed`).\n */\n\n/** The user's wallet currency and what they may switch to. */\nexport interface Wallet {\n /** ISO 4217 code the wallet is held in. */\n currency: string;\n /** `true` when chosen by the user (or set by an operator), `false` when it\n * is the deployment default. */\n explicit: boolean;\n /** Currencies accepted by `set()`. */\n allowed: string[];\n}\n\nexport class WalletResource {\n constructor(private readonly http: HttpClient) {}\n\n /** Current wallet currency + the currencies the user may switch to. */\n async get(opts: { signal?: AbortSignal } = {}): Promise<Wallet> {\n return this.http.get<Wallet>(\"/me/wallet\", { signal: opts.signal });\n }\n\n /**\n * Switch the wallet currency. Fails with `409 wallet_not_empty` while any\n * balance is non-zero, and `400 currency_not_allowed` for a currency the\n * deployment does not offer.\n */\n async set(currency: string, opts: { signal?: AbortSignal } = {}): Promise<Wallet> {\n return this.http.put<Wallet>(\"/me/wallet\", { body: { currency }, signal: opts.signal });\n }\n}\n"]}
|