carlyemail 0.6.3 → 0.6.5
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/carlyemail.js +16 -4
- package/package.json +1 -1
- package/sdk.d.ts +73 -2
- package/sdk.js +41 -4
package/carlyemail.js
CHANGED
|
@@ -18,7 +18,7 @@ import { basename, extname, join } from "node:path";
|
|
|
18
18
|
import { fileURLToPath } from "node:url";
|
|
19
19
|
import { randomBytes } from "node:crypto";
|
|
20
20
|
|
|
21
|
-
export const VERSION = "0.6.
|
|
21
|
+
export const VERSION = "0.6.5";
|
|
22
22
|
|
|
23
23
|
const DEFAULT_API = "https://api.carlyemail.com";
|
|
24
24
|
const CONFIG_DIR = join(homedir(), ".carlyemail");
|
|
@@ -275,7 +275,7 @@ const FLAGS = {
|
|
|
275
275
|
signin: ["human-email"],
|
|
276
276
|
verify: ["code"],
|
|
277
277
|
create: ["username", "domain", "display-name"],
|
|
278
|
-
delete: ["yes"],
|
|
278
|
+
delete: ["yes", "force"],
|
|
279
279
|
send: ["from", "to", "cc", "bcc", "reply-to", "subject", "text", "html", "attach"],
|
|
280
280
|
search: ["query"],
|
|
281
281
|
reply: ["last", "text", "html", "all"],
|
|
@@ -524,7 +524,7 @@ define(
|
|
|
524
524
|
}
|
|
525
525
|
);
|
|
526
526
|
|
|
527
|
-
define("delete", "Delete an inbox and its mail", "carlyemail delete support@carlyemail.com", async (ctx) => {
|
|
527
|
+
define("delete", "Delete an inbox and its mail", "carlyemail delete support@carlyemail.com --yes", async (ctx) => {
|
|
528
528
|
const inbox = ctx.positional[0];
|
|
529
529
|
if (!inbox) throw new UsageError("which inbox? carlyemail delete <inbox>");
|
|
530
530
|
if (!ctx.flags.yes) {
|
|
@@ -532,7 +532,19 @@ define("delete", "Delete an inbox and its mail", "carlyemail delete support@carl
|
|
|
532
532
|
`this deletes ${inbox} and every message in it. Re-run with --yes to confirm.`
|
|
533
533
|
);
|
|
534
534
|
}
|
|
535
|
-
|
|
535
|
+
// An inbox that sent mail or whose key was used in the last 30 days is
|
|
536
|
+
// refused with `inbox_in_use`, and the API's fix names its own parameter.
|
|
537
|
+
// Here the answer is a flag, so say that instead.
|
|
538
|
+
const force = ctx.flags.force === true;
|
|
539
|
+
const path = `/v0/inboxes/${encodeURIComponent(inbox)}${force ? "?force=true" : ""}`;
|
|
540
|
+
try {
|
|
541
|
+
await request(ctx.config, "DELETE", path);
|
|
542
|
+
} catch (error) {
|
|
543
|
+
if (error instanceof ApiError && error.code === "inbox_in_use") {
|
|
544
|
+
error.fix = "Check nothing still sends from it. To delete it anyway, re-run with --force.";
|
|
545
|
+
}
|
|
546
|
+
throw error;
|
|
547
|
+
}
|
|
536
548
|
ctx.print(ok(`deleted ${inbox}`));
|
|
537
549
|
});
|
|
538
550
|
|
package/package.json
CHANGED
package/sdk.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface AgentSigninResponse {
|
|
|
11
11
|
export interface AgentSigninVerifyRequest {
|
|
12
12
|
human_email: string;
|
|
13
13
|
otp_code: string;
|
|
14
|
+
organization_id?: string | null;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export interface AgentSigninVerifyResponse {
|
|
@@ -18,6 +19,8 @@ export interface AgentSigninVerifyResponse {
|
|
|
18
19
|
api_key: string;
|
|
19
20
|
inbox_domain?: string | null;
|
|
20
21
|
inboxes_on_signup_domain?: Array<string>;
|
|
22
|
+
member?: MemberOut | null;
|
|
23
|
+
organizations?: Array<OrganizationChoice>;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
export interface AgentSignupRequest {
|
|
@@ -255,6 +258,8 @@ export interface Identity {
|
|
|
255
258
|
pod_id?: string | null;
|
|
256
259
|
inbox_id?: string | null;
|
|
257
260
|
api_key_id?: string | null;
|
|
261
|
+
member?: MemberOut | null;
|
|
262
|
+
organizations?: Array<OrganizationChoice>;
|
|
258
263
|
}
|
|
259
264
|
|
|
260
265
|
export interface InboxEventOut {
|
|
@@ -280,6 +285,13 @@ export interface InboxOut {
|
|
|
280
285
|
created_at: string;
|
|
281
286
|
}
|
|
282
287
|
|
|
288
|
+
export interface InviteMemberRequest {
|
|
289
|
+
email: string;
|
|
290
|
+
role?: string | null;
|
|
291
|
+
inbox_ids?: Array<string> | null;
|
|
292
|
+
name?: string | null;
|
|
293
|
+
}
|
|
294
|
+
|
|
283
295
|
export interface ListApiKeysResponse {
|
|
284
296
|
count: number;
|
|
285
297
|
next_page_token?: string | null;
|
|
@@ -341,6 +353,11 @@ export interface ListListEntriesResponse {
|
|
|
341
353
|
entries: Array<ListEntryOut>;
|
|
342
354
|
}
|
|
343
355
|
|
|
356
|
+
export interface ListMembersResponse {
|
|
357
|
+
count: number;
|
|
358
|
+
members: Array<MemberOut>;
|
|
359
|
+
}
|
|
360
|
+
|
|
344
361
|
export interface ListMessagesResponse {
|
|
345
362
|
count: number;
|
|
346
363
|
limit?: number | null;
|
|
@@ -374,6 +391,18 @@ export interface ListWebhooksResponse {
|
|
|
374
391
|
webhooks: Array<WebhookOut>;
|
|
375
392
|
}
|
|
376
393
|
|
|
394
|
+
export interface MemberOut {
|
|
395
|
+
member_id: string;
|
|
396
|
+
email: string;
|
|
397
|
+
name?: string | null;
|
|
398
|
+
role: string;
|
|
399
|
+
inbox_ids?: Array<string>;
|
|
400
|
+
status: string;
|
|
401
|
+
joined_at?: string | null;
|
|
402
|
+
last_signed_in_at?: string | null;
|
|
403
|
+
created_at?: string | null;
|
|
404
|
+
}
|
|
405
|
+
|
|
377
406
|
export interface MessageItem {
|
|
378
407
|
inbox_id: string;
|
|
379
408
|
thread_id: string;
|
|
@@ -420,17 +449,28 @@ export interface MessageOut {
|
|
|
420
449
|
authentication?: Record<string, string>;
|
|
421
450
|
}
|
|
422
451
|
|
|
452
|
+
export interface OrganizationChoice {
|
|
453
|
+
organization_id: string;
|
|
454
|
+
name?: string | null;
|
|
455
|
+
role: string;
|
|
456
|
+
status: string;
|
|
457
|
+
}
|
|
458
|
+
|
|
423
459
|
export interface OrganizationOut {
|
|
424
460
|
organization_id: string;
|
|
461
|
+
human_email?: string | null;
|
|
462
|
+
name?: string | null;
|
|
425
463
|
inbox_count: number;
|
|
426
464
|
domain_count: number;
|
|
427
465
|
pod_count?: number;
|
|
428
466
|
webhook_count?: number;
|
|
467
|
+
member_count?: number;
|
|
429
468
|
storage_bytes?: number;
|
|
430
469
|
inbox_limit?: number | null;
|
|
431
470
|
domain_limit?: number | null;
|
|
432
471
|
pod_limit?: number | null;
|
|
433
472
|
webhook_limit?: number | null;
|
|
473
|
+
member_limit?: number | null;
|
|
434
474
|
storage_limit_bytes?: number | null;
|
|
435
475
|
plan?: string | null;
|
|
436
476
|
billing_id?: string | null;
|
|
@@ -510,6 +550,16 @@ export interface SendMessageResponse {
|
|
|
510
550
|
thread_id: string;
|
|
511
551
|
}
|
|
512
552
|
|
|
553
|
+
export interface SwitchRequest {
|
|
554
|
+
organization_id: string;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
export interface SwitchResponse {
|
|
558
|
+
organization_id: string;
|
|
559
|
+
api_key: string;
|
|
560
|
+
member: MemberOut;
|
|
561
|
+
}
|
|
562
|
+
|
|
513
563
|
export interface ThreadItem {
|
|
514
564
|
inbox_id: string;
|
|
515
565
|
thread_id: string;
|
|
@@ -576,6 +626,13 @@ export interface UpdateInboxRequest {
|
|
|
576
626
|
|
|
577
627
|
export interface UpdateInboxWebhookRequest {
|
|
578
628
|
event_types?: Array<string> | null;
|
|
629
|
+
enabled?: boolean | null;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
export interface UpdateMemberRequest {
|
|
633
|
+
role?: string | null;
|
|
634
|
+
inbox_ids?: Array<string> | null;
|
|
635
|
+
name?: string | null;
|
|
579
636
|
}
|
|
580
637
|
|
|
581
638
|
export interface UpdateMessageRequest {
|
|
@@ -605,6 +662,7 @@ export interface UpdateWebhookHeadersRequest {
|
|
|
605
662
|
|
|
606
663
|
export interface UpdateWebhookRequest {
|
|
607
664
|
event_types?: Array<string> | null;
|
|
665
|
+
enabled?: boolean | null;
|
|
608
666
|
add_inbox_ids?: Array<string> | null;
|
|
609
667
|
remove_inbox_ids?: Array<string> | null;
|
|
610
668
|
add_pod_ids?: Array<string> | null;
|
|
@@ -652,6 +710,9 @@ export interface WebhookOut {
|
|
|
652
710
|
inbox_ids?: Array<string>;
|
|
653
711
|
secret?: string | null;
|
|
654
712
|
enabled?: boolean;
|
|
713
|
+
disabled_reason?: string | null;
|
|
714
|
+
disabled_at?: string | null;
|
|
715
|
+
failing_since?: string | null;
|
|
655
716
|
client_id?: string | null;
|
|
656
717
|
updated_at: string;
|
|
657
718
|
created_at: string;
|
|
@@ -680,6 +741,7 @@ export declare class Agent {
|
|
|
680
741
|
|
|
681
742
|
export declare class Auth {
|
|
682
743
|
whoami(): Promise<Identity>;
|
|
744
|
+
switchOrganization(body: SwitchRequest): Promise<SwitchResponse>;
|
|
683
745
|
}
|
|
684
746
|
|
|
685
747
|
export declare class Billing {
|
|
@@ -697,7 +759,7 @@ export declare class Inboxes {
|
|
|
697
759
|
create(body: CreateInboxRequest): Promise<InboxOut>;
|
|
698
760
|
get(inboxId: string): Promise<InboxOut>;
|
|
699
761
|
update(inboxId: string, body: UpdateInboxRequest): Promise<InboxOut>;
|
|
700
|
-
delete(inboxId: string): Promise<void>;
|
|
762
|
+
delete(inboxId: string, query?: { force?: boolean }): Promise<void>;
|
|
701
763
|
}
|
|
702
764
|
|
|
703
765
|
export declare class Messages {
|
|
@@ -774,6 +836,14 @@ export declare class ApiKeys {
|
|
|
774
836
|
deleteInbox(inboxId: string, apiKeyId: string): Promise<void>;
|
|
775
837
|
}
|
|
776
838
|
|
|
839
|
+
export declare class Members {
|
|
840
|
+
list(): Promise<ListMembersResponse>;
|
|
841
|
+
invite(body: InviteMemberRequest): Promise<MemberOut>;
|
|
842
|
+
get(memberId: string): Promise<MemberOut>;
|
|
843
|
+
update(memberId: string, body: UpdateMemberRequest): Promise<MemberOut>;
|
|
844
|
+
remove(memberId: string): Promise<void>;
|
|
845
|
+
}
|
|
846
|
+
|
|
777
847
|
export declare class Events {
|
|
778
848
|
list(query?: { eventTypes?: Array<string> | null; inboxId?: string | null; start?: string | null; end?: string | null; limit?: number | null; pageToken?: string | null }): Promise<ListEventsResponse>;
|
|
779
849
|
}
|
|
@@ -794,7 +864,7 @@ export declare class Pods {
|
|
|
794
864
|
createInbox(podId: string, body: CreateInboxRequest): Promise<InboxOut>;
|
|
795
865
|
getInbox(inboxId: string, podId: string): Promise<InboxOut>;
|
|
796
866
|
updateInbox(inboxId: string, podId: string, body: UpdateInboxRequest): Promise<InboxOut>;
|
|
797
|
-
deleteInbox(inboxId: string, podId: string): Promise<void>;
|
|
867
|
+
deleteInbox(inboxId: string, podId: string, query?: { force?: boolean }): Promise<void>;
|
|
798
868
|
listThreads(podId: string, query?: { limit?: number | null; pageToken?: string | null; labels?: Array<string> | null; before?: string | null; after?: string | null; ascending?: boolean; includeSpam?: boolean; includeBlocked?: boolean; includeUnauthenticated?: boolean; includeTrash?: boolean; senders?: Array<string> | null; recipients?: Array<string> | null; subject?: string | null }): Promise<ListThreadsResponse>;
|
|
799
869
|
searchThreads(podId: string, query?: { q?: string; limit?: number | null; pageToken?: string | null; before?: string | null; after?: string | null }): Promise<ListThreadsResponse>;
|
|
800
870
|
getThread(threadId: string, podId: string): Promise<ThreadOut>;
|
|
@@ -869,6 +939,7 @@ export declare class CarlyEmail {
|
|
|
869
939
|
lists: Lists;
|
|
870
940
|
domains: Domains;
|
|
871
941
|
apiKeys: ApiKeys;
|
|
942
|
+
members: Members;
|
|
872
943
|
events: Events;
|
|
873
944
|
metrics: Metrics;
|
|
874
945
|
pods: Pods;
|
package/sdk.js
CHANGED
|
@@ -103,6 +103,11 @@ class Auth {
|
|
|
103
103
|
whoami() {
|
|
104
104
|
return this.$.request("GET", `/v0/auth/me`);
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
/** Switch Organization */
|
|
108
|
+
switchOrganization(body) {
|
|
109
|
+
return this.$.request("POST", `/v0/auth/switch`, { body });
|
|
110
|
+
}
|
|
106
111
|
}
|
|
107
112
|
|
|
108
113
|
class Billing {
|
|
@@ -163,8 +168,8 @@ class Inboxes {
|
|
|
163
168
|
}
|
|
164
169
|
|
|
165
170
|
/** Delete Inbox */
|
|
166
|
-
delete(inboxId) {
|
|
167
|
-
return this.$.request("DELETE", `/v0/inboxes/${encode(inboxId)}
|
|
171
|
+
delete(inboxId, query = {}) {
|
|
172
|
+
return this.$.request("DELETE", `/v0/inboxes/${encode(inboxId)}`, { query: { "force": query.force } });
|
|
168
173
|
}
|
|
169
174
|
}
|
|
170
175
|
|
|
@@ -484,6 +489,37 @@ class ApiKeys {
|
|
|
484
489
|
}
|
|
485
490
|
}
|
|
486
491
|
|
|
492
|
+
class Members {
|
|
493
|
+
constructor(transport) {
|
|
494
|
+
this.$ = transport;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/** List Members */
|
|
498
|
+
list() {
|
|
499
|
+
return this.$.request("GET", `/v0/members`);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/** Invite Member */
|
|
503
|
+
invite(body) {
|
|
504
|
+
return this.$.request("POST", `/v0/members`, { body });
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/** Get Member */
|
|
508
|
+
get(memberId) {
|
|
509
|
+
return this.$.request("GET", `/v0/members/${encode(memberId)}`);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/** Update Member */
|
|
513
|
+
update(memberId, body) {
|
|
514
|
+
return this.$.request("PATCH", `/v0/members/${encode(memberId)}`, { body });
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/** Remove Member */
|
|
518
|
+
remove(memberId) {
|
|
519
|
+
return this.$.request("DELETE", `/v0/members/${encode(memberId)}`);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
487
523
|
class Events {
|
|
488
524
|
constructor(transport) {
|
|
489
525
|
this.$ = transport;
|
|
@@ -567,8 +603,8 @@ class Pods {
|
|
|
567
603
|
}
|
|
568
604
|
|
|
569
605
|
/** Delete Inbox */
|
|
570
|
-
deleteInbox(inboxId, podId) {
|
|
571
|
-
return this.$.request("DELETE", `/v0/pods/${encode(podId)}/inboxes/${encode(inboxId)}
|
|
606
|
+
deleteInbox(inboxId, podId, query = {}) {
|
|
607
|
+
return this.$.request("DELETE", `/v0/pods/${encode(podId)}/inboxes/${encode(inboxId)}`, { query: { "force": query.force } });
|
|
572
608
|
}
|
|
573
609
|
|
|
574
610
|
/** List Threads */
|
|
@@ -854,6 +890,7 @@ export class CarlyEmail {
|
|
|
854
890
|
this.lists = new Lists(transport);
|
|
855
891
|
this.domains = new Domains(transport);
|
|
856
892
|
this.apiKeys = new ApiKeys(transport);
|
|
893
|
+
this.members = new Members(transport);
|
|
857
894
|
this.events = new Events(transport);
|
|
858
895
|
this.metrics = new Metrics(transport);
|
|
859
896
|
this.pods = new Pods(transport);
|