@roxyon/api-client 0.5.0 → 0.6.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/dist/index.cjs +10 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -560,6 +560,7 @@ interface DeleteDatabaseResult {
|
|
|
560
560
|
declare class DatabasesApi {
|
|
561
561
|
private readonly client;
|
|
562
562
|
constructor(client: RoxyonClient);
|
|
563
|
+
/** `POST /databases/list` — through the console, because PAT/OAuth callers can't read /Databases directly. */
|
|
563
564
|
list(subscriptionId: string): Promise<DatabaseSummary[]>;
|
|
564
565
|
/** `POST /databases/create` — provision a database + user; the reconciler does the rest. */
|
|
565
566
|
create(input: CreateDatabaseInput): Promise<CreateDatabaseResult>;
|
|
@@ -643,6 +644,7 @@ interface DeleteEmailResult {
|
|
|
643
644
|
declare class EmailApi {
|
|
644
645
|
private readonly client;
|
|
645
646
|
constructor(client: RoxyonClient);
|
|
647
|
+
/** `POST /emails/list` — through the console, because PAT/OAuth callers can't read /Emails directly. */
|
|
646
648
|
list(subscriptionId: string): Promise<EmailSummary[]>;
|
|
647
649
|
/** `POST /emails/create` — provision a mailbox; the reconciler does the rest. */
|
|
648
650
|
create(input: CreateEmailInput): Promise<CreateEmailResult>;
|
package/dist/index.d.ts
CHANGED
|
@@ -560,6 +560,7 @@ interface DeleteDatabaseResult {
|
|
|
560
560
|
declare class DatabasesApi {
|
|
561
561
|
private readonly client;
|
|
562
562
|
constructor(client: RoxyonClient);
|
|
563
|
+
/** `POST /databases/list` — through the console, because PAT/OAuth callers can't read /Databases directly. */
|
|
563
564
|
list(subscriptionId: string): Promise<DatabaseSummary[]>;
|
|
564
565
|
/** `POST /databases/create` — provision a database + user; the reconciler does the rest. */
|
|
565
566
|
create(input: CreateDatabaseInput): Promise<CreateDatabaseResult>;
|
|
@@ -643,6 +644,7 @@ interface DeleteEmailResult {
|
|
|
643
644
|
declare class EmailApi {
|
|
644
645
|
private readonly client;
|
|
645
646
|
constructor(client: RoxyonClient);
|
|
647
|
+
/** `POST /emails/list` — through the console, because PAT/OAuth callers can't read /Emails directly. */
|
|
646
648
|
list(subscriptionId: string): Promise<EmailSummary[]>;
|
|
647
649
|
/** `POST /emails/create` — provision a mailbox; the reconciler does the rest. */
|
|
648
650
|
create(input: CreateEmailInput): Promise<CreateEmailResult>;
|
package/dist/index.js
CHANGED
|
@@ -746,14 +746,14 @@ var DatabasesApi = class {
|
|
|
746
746
|
this.client = client;
|
|
747
747
|
}
|
|
748
748
|
client;
|
|
749
|
+
/** `POST /databases/list` — through the console, because PAT/OAuth callers can't read /Databases directly. */
|
|
749
750
|
async list(subscriptionId) {
|
|
750
|
-
const r = await this.client.
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
order: "-createdAt",
|
|
754
|
-
where: { Subscription: subscriptionId, eye: { in: "1,0" } }
|
|
751
|
+
const r = await this.client.console("POST", "/databases/list", {
|
|
752
|
+
body: { subscription: subscriptionId },
|
|
753
|
+
tolerateHttpError: true
|
|
755
754
|
});
|
|
756
|
-
|
|
755
|
+
if (!r?.ok) throw new RoxyonApiError(r?.error || "Could not list the databases.", { body: r });
|
|
756
|
+
return r.databases ?? [];
|
|
757
757
|
}
|
|
758
758
|
/** `POST /databases/create` — provision a database + user; the reconciler does the rest. */
|
|
759
759
|
async create(input) {
|
|
@@ -811,14 +811,11 @@ var EmailApi = class {
|
|
|
811
811
|
this.client = client;
|
|
812
812
|
}
|
|
813
813
|
client;
|
|
814
|
+
/** `POST /emails/list` — through the console, because PAT/OAuth callers can't read /Emails directly. */
|
|
814
815
|
async list(subscriptionId) {
|
|
815
|
-
const r = await this.client.
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
order: "-createdAt",
|
|
819
|
-
where: { Subscription: subscriptionId, eye: { in: "1,0" } }
|
|
820
|
-
});
|
|
821
|
-
return r.results ?? [];
|
|
816
|
+
const r = await this.client.console("POST", "/emails/list", { body: { subscription: subscriptionId }, tolerateHttpError: true });
|
|
817
|
+
if (!r?.ok) throw new RoxyonApiError(r?.error || "Could not list the mailboxes.", { body: r });
|
|
818
|
+
return (r.emails ?? []).map((e) => ({ ...e, LocalPart: e.Email.split("@")[0] ?? "" }));
|
|
822
819
|
}
|
|
823
820
|
/** `POST /emails/create` — provision a mailbox; the reconciler does the rest. */
|
|
824
821
|
async create(input) {
|