@messagebird/sdk 0.12.0 → 0.12.2
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.d.mts +282 -54
- package/dist/index.mjs +51 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -585,6 +585,228 @@ type EventVoiceCallAnswered = {
|
|
|
585
585
|
timestamp: string;
|
|
586
586
|
data: EventVoiceCallAnsweredData;
|
|
587
587
|
};
|
|
588
|
+
/**
|
|
589
|
+
* Payload of the verify.verification.verified event.
|
|
590
|
+
*/
|
|
591
|
+
type EventVerifyVerificationVerifiedData = EventVerifyBase & {
|
|
592
|
+
/**
|
|
593
|
+
* The verification's state, always `verified`. Open enum for forward compatibility.
|
|
594
|
+
*/
|
|
595
|
+
status: string;
|
|
596
|
+
/**
|
|
597
|
+
* The channel whose passcode the recipient confirmed, the channel that converted. Null when the verification was resolved without attributing a channel.
|
|
598
|
+
*/
|
|
599
|
+
channel: VerificationChannel | null;
|
|
600
|
+
/**
|
|
601
|
+
* Time the verification was verified.
|
|
602
|
+
*/
|
|
603
|
+
verified_at: string;
|
|
604
|
+
};
|
|
605
|
+
/**
|
|
606
|
+
* The channel a passcode is delivered over. Open enum — new channels may be added over time, so treat any unrecognized value as a future channel rather than an error.
|
|
607
|
+
*/
|
|
608
|
+
type VerificationChannel = string;
|
|
609
|
+
/**
|
|
610
|
+
* The recipient to verify. Provide an `email_address`, a `phone_number`, or both; at least one is required. The addresses also identify the verification: a check must supply exactly the set used on the create call, so a verification created with both addresses is not found by either one alone.
|
|
611
|
+
*
|
|
612
|
+
*/
|
|
613
|
+
type VerificationTo = {
|
|
614
|
+
/**
|
|
615
|
+
* The recipient's email address. Case does not matter; the address is lowercased before use.
|
|
616
|
+
*/
|
|
617
|
+
email_address?: string;
|
|
618
|
+
/**
|
|
619
|
+
* The recipient's phone number in E.164 format, with the leading `+` and country code (for example `+15551234567`). A number in any other format is rejected as an invalid recipient (`422`).
|
|
620
|
+
*/
|
|
621
|
+
phone_number?: string;
|
|
622
|
+
};
|
|
623
|
+
type VerificationId = string;
|
|
624
|
+
/**
|
|
625
|
+
* Identity fields shared by every Verify lifecycle event payload.
|
|
626
|
+
*/
|
|
627
|
+
type EventVerifyBase = {
|
|
628
|
+
/**
|
|
629
|
+
* ID of the verification session.
|
|
630
|
+
*/
|
|
631
|
+
verification_id: VerificationId;
|
|
632
|
+
/**
|
|
633
|
+
* ID of the workspace.
|
|
634
|
+
*/
|
|
635
|
+
workspace_id: WorkspaceId;
|
|
636
|
+
/**
|
|
637
|
+
* The recipient identity of the verification session (email address, phone number, or both), echoed on every event so you can correlate without an extra lookup. An individual attempt reports the single address it was dispatched to in its own `address` field.
|
|
638
|
+
*/
|
|
639
|
+
to: VerificationTo;
|
|
640
|
+
/**
|
|
641
|
+
* The metadata object provided when the verification was created, echoed on every event for the session so you can correlate events with your own records. Null when the verification carried no metadata.
|
|
642
|
+
*
|
|
643
|
+
*/
|
|
644
|
+
metadata: {
|
|
645
|
+
[key: string]: unknown;
|
|
646
|
+
} | null;
|
|
647
|
+
};
|
|
648
|
+
/**
|
|
649
|
+
* The verification was successfully resolved: the recipient confirmed the correct code.
|
|
650
|
+
*/
|
|
651
|
+
type EventVerifyVerificationVerified = {
|
|
652
|
+
/**
|
|
653
|
+
* Event type.
|
|
654
|
+
*/
|
|
655
|
+
type: "verify.verification.verified";
|
|
656
|
+
/**
|
|
657
|
+
* Time the verification was verified.
|
|
658
|
+
*/
|
|
659
|
+
timestamp: string;
|
|
660
|
+
data: EventVerifyVerificationVerifiedData;
|
|
661
|
+
};
|
|
662
|
+
/**
|
|
663
|
+
* Payload of the verify.verification.created event.
|
|
664
|
+
*/
|
|
665
|
+
type EventVerifyVerificationCreatedData = EventVerifyBase & {
|
|
666
|
+
/**
|
|
667
|
+
* The first channel of the verification's resolved channel plan.
|
|
668
|
+
*/
|
|
669
|
+
channel: VerificationChannel;
|
|
670
|
+
/**
|
|
671
|
+
* The verification's state at creation, always `pending`. Open enum for forward compatibility.
|
|
672
|
+
*/
|
|
673
|
+
status: string;
|
|
674
|
+
/**
|
|
675
|
+
* Time the verification session was created.
|
|
676
|
+
*/
|
|
677
|
+
created_at: string;
|
|
678
|
+
};
|
|
679
|
+
/**
|
|
680
|
+
* A verification session was created and its first one-time passcode is being sent.
|
|
681
|
+
*/
|
|
682
|
+
type EventVerifyVerificationCreated = {
|
|
683
|
+
/**
|
|
684
|
+
* Event type.
|
|
685
|
+
*/
|
|
686
|
+
type: "verify.verification.created";
|
|
687
|
+
/**
|
|
688
|
+
* Time the verification session was created.
|
|
689
|
+
*/
|
|
690
|
+
timestamp: string;
|
|
691
|
+
data: EventVerifyVerificationCreatedData;
|
|
692
|
+
};
|
|
693
|
+
/**
|
|
694
|
+
* Why a passcode send did not deliver. Open enum — new reasons may be added over time, so treat any unrecognized value as a future reason rather than an error. v1 emits `carrier_rejected` (SMS), `hard_bounce` (email), `undelivered` (a generic terminal delivery failure), and `channel_unavailable` (the channel could not be used and the verification failed over).
|
|
695
|
+
*/
|
|
696
|
+
type VerificationAttemptFailureReason = string;
|
|
697
|
+
/**
|
|
698
|
+
* Payload of the verify.attempt.undelivered event.
|
|
699
|
+
*/
|
|
700
|
+
type EventVerifyAttemptUndeliveredData = EventVerifyBase & {
|
|
701
|
+
/**
|
|
702
|
+
* The channel this attempt was sent on.
|
|
703
|
+
*/
|
|
704
|
+
channel: VerificationChannel;
|
|
705
|
+
/**
|
|
706
|
+
* The single address this attempt was dispatched to, an E.164 phone number or an email address.
|
|
707
|
+
*/
|
|
708
|
+
address: string;
|
|
709
|
+
/**
|
|
710
|
+
* Why the attempt failed to reach the recipient.
|
|
711
|
+
*/
|
|
712
|
+
reason: VerificationAttemptFailureReason;
|
|
713
|
+
/**
|
|
714
|
+
* Diagnostic text describing the failure, for display only. Null when none was reported.
|
|
715
|
+
*/
|
|
716
|
+
error: string | null;
|
|
717
|
+
/**
|
|
718
|
+
* Time the failure was recorded.
|
|
719
|
+
*/
|
|
720
|
+
failed_at: string;
|
|
721
|
+
};
|
|
722
|
+
/**
|
|
723
|
+
* A one-time passcode failed to deliver to the recipient.
|
|
724
|
+
*/
|
|
725
|
+
type EventVerifyAttemptUndelivered = {
|
|
726
|
+
/**
|
|
727
|
+
* Event type.
|
|
728
|
+
*/
|
|
729
|
+
type: "verify.attempt.undelivered";
|
|
730
|
+
/**
|
|
731
|
+
* Time the failure was recorded.
|
|
732
|
+
*/
|
|
733
|
+
timestamp: string;
|
|
734
|
+
data: EventVerifyAttemptUndeliveredData;
|
|
735
|
+
};
|
|
736
|
+
/**
|
|
737
|
+
* Payload of the verify.attempt.sent event.
|
|
738
|
+
*/
|
|
739
|
+
type EventVerifyAttemptSentData = EventVerifyBase & {
|
|
740
|
+
/**
|
|
741
|
+
* The channel this attempt was sent on.
|
|
742
|
+
*/
|
|
743
|
+
channel: VerificationChannel;
|
|
744
|
+
/**
|
|
745
|
+
* The single address this attempt was dispatched to, an E.164 phone number or an email address.
|
|
746
|
+
*/
|
|
747
|
+
address: string;
|
|
748
|
+
/**
|
|
749
|
+
* The sender the passcode was sent from: a phone number, alphanumeric sender ID, short code, or email address. Null when the channel exposes no sender.
|
|
750
|
+
*/
|
|
751
|
+
from: string | null;
|
|
752
|
+
/**
|
|
753
|
+
* Time the passcode was dispatched.
|
|
754
|
+
*/
|
|
755
|
+
sent_at: string;
|
|
756
|
+
};
|
|
757
|
+
/**
|
|
758
|
+
* A one-time passcode was dispatched to the recipient on a channel.
|
|
759
|
+
*/
|
|
760
|
+
type EventVerifyAttemptSent = {
|
|
761
|
+
/**
|
|
762
|
+
* Event type.
|
|
763
|
+
*/
|
|
764
|
+
type: "verify.attempt.sent";
|
|
765
|
+
/**
|
|
766
|
+
* Time the passcode was dispatched.
|
|
767
|
+
*/
|
|
768
|
+
timestamp: string;
|
|
769
|
+
data: EventVerifyAttemptSentData;
|
|
770
|
+
};
|
|
771
|
+
/**
|
|
772
|
+
* Payload of the verify.attempt.delivered event.
|
|
773
|
+
*/
|
|
774
|
+
type EventVerifyAttemptDeliveredData = EventVerifyBase & {
|
|
775
|
+
/**
|
|
776
|
+
* The channel this attempt was sent on.
|
|
777
|
+
*/
|
|
778
|
+
channel: VerificationChannel;
|
|
779
|
+
/**
|
|
780
|
+
* The single address this attempt was dispatched to, an E.164 phone number or an email address.
|
|
781
|
+
*/
|
|
782
|
+
address: string;
|
|
783
|
+
/**
|
|
784
|
+
* Carrier that delivered the message, when the carrier network reports it. Always null for email and WhatsApp.
|
|
785
|
+
*/
|
|
786
|
+
carrier: string | null;
|
|
787
|
+
/**
|
|
788
|
+
* Mobile country code and mobile network code of the delivering carrier, when reported. Always null for email and WhatsApp.
|
|
789
|
+
*/
|
|
790
|
+
mcc_mnc: string | null;
|
|
791
|
+
/**
|
|
792
|
+
* Time delivery was confirmed.
|
|
793
|
+
*/
|
|
794
|
+
delivered_at: string;
|
|
795
|
+
};
|
|
796
|
+
/**
|
|
797
|
+
* The channel confirmed delivery of a one-time passcode to the recipient.
|
|
798
|
+
*/
|
|
799
|
+
type EventVerifyAttemptDelivered = {
|
|
800
|
+
/**
|
|
801
|
+
* Event type.
|
|
802
|
+
*/
|
|
803
|
+
type: "verify.attempt.delivered";
|
|
804
|
+
/**
|
|
805
|
+
* Time delivery was confirmed.
|
|
806
|
+
*/
|
|
807
|
+
timestamp: string;
|
|
808
|
+
data: EventVerifyAttemptDeliveredData;
|
|
809
|
+
};
|
|
588
810
|
/**
|
|
589
811
|
* Payload of the sms.undelivered event.
|
|
590
812
|
*/
|
|
@@ -1818,6 +2040,16 @@ type WebhookEvent = ({
|
|
|
1818
2040
|
} & EventSmsTfnVerificationSubmitted) | ({
|
|
1819
2041
|
type: "sms.undelivered";
|
|
1820
2042
|
} & EventSmsUndelivered) | ({
|
|
2043
|
+
type: "verify.attempt.delivered";
|
|
2044
|
+
} & EventVerifyAttemptDelivered) | ({
|
|
2045
|
+
type: "verify.attempt.sent";
|
|
2046
|
+
} & EventVerifyAttemptSent) | ({
|
|
2047
|
+
type: "verify.attempt.undelivered";
|
|
2048
|
+
} & EventVerifyAttemptUndelivered) | ({
|
|
2049
|
+
type: "verify.verification.created";
|
|
2050
|
+
} & EventVerifyVerificationCreated) | ({
|
|
2051
|
+
type: "verify.verification.verified";
|
|
2052
|
+
} & EventVerifyVerificationVerified) | ({
|
|
1821
2053
|
type: "voice_call.answered";
|
|
1822
2054
|
} & EventVoiceCallAnswered) | ({
|
|
1823
2055
|
type: "voice_call.ended";
|
|
@@ -2623,6 +2855,10 @@ type MailboxStatsSummary = {
|
|
|
2623
2855
|
*/
|
|
2624
2856
|
readonly received: number;
|
|
2625
2857
|
};
|
|
2858
|
+
/**
|
|
2859
|
+
* The bucket grain of the series, either `day` or `hour`.
|
|
2860
|
+
*/
|
|
2861
|
+
type StatsGrain = "day" | "hour";
|
|
2626
2862
|
/**
|
|
2627
2863
|
* The window and bucket grain the response covers, echoed from the request, plus the freshness boundary the data is current to.
|
|
2628
2864
|
*
|
|
@@ -2636,10 +2872,7 @@ type EmailStatsSeriesPeriod = {
|
|
|
2636
2872
|
* Inclusive end of the window. A calendar day (YYYY-MM-DD, in the requested `timezone`) on the day grain; on the hour grain, an RFC 3339 UTC instant marking the start of the last hour bucket, which falls on a local hour boundary when `timezone` is set.
|
|
2637
2873
|
*/
|
|
2638
2874
|
readonly to: string;
|
|
2639
|
-
|
|
2640
|
-
* The bucket grain of the series, either `day` or `hour`.
|
|
2641
|
-
*/
|
|
2642
|
-
readonly grain: string;
|
|
2875
|
+
readonly grain: StatsGrain;
|
|
2643
2876
|
/**
|
|
2644
2877
|
* The instant the statistics in this response are current to: events recorded up to roughly this time are reflected, while more recent events may not be yet. Statistics are served from a rolling aggregation that refreshes every few seconds, so a response is near-real-time but not live; use this field to label data freshness rather than assuming the numbers are to-the-second. Null when the freshness boundary is not being reported.
|
|
2645
2878
|
*
|
|
@@ -4181,28 +4414,13 @@ type VerificationCheckResult = {
|
|
|
4181
4414
|
*/
|
|
4182
4415
|
readonly attempts_remaining?: number | null;
|
|
4183
4416
|
};
|
|
4184
|
-
/**
|
|
4185
|
-
* The channel a passcode is delivered over. Open enum — new channels may be added over time, so treat any unrecognized value as a future channel rather than an error.
|
|
4186
|
-
*/
|
|
4187
|
-
type VerificationChannel = string;
|
|
4188
4417
|
type VerificationChannelEntry = {
|
|
4189
4418
|
channel: VerificationChannel;
|
|
4190
4419
|
};
|
|
4191
4420
|
/**
|
|
4192
|
-
*
|
|
4193
|
-
*
|
|
4421
|
+
* Why a verification session reached its final state without succeeding: `attempts_exhausted` (too many incorrect passcodes) or `ttl_elapsed` (the time window elapsed before a correct passcode). Open enum — new reasons may be added over time, so treat any unrecognized value as a future reason rather than an error.
|
|
4194
4422
|
*/
|
|
4195
|
-
type
|
|
4196
|
-
/**
|
|
4197
|
-
* The recipient's email address. Case does not matter; the address is lowercased before use.
|
|
4198
|
-
*/
|
|
4199
|
-
email_address?: string;
|
|
4200
|
-
/**
|
|
4201
|
-
* The recipient's phone number in E.164 format, with the leading `+` and country code (for example `+15551234567`). A number in any other format is rejected as an invalid recipient (`422`).
|
|
4202
|
-
*/
|
|
4203
|
-
phone_number?: string;
|
|
4204
|
-
};
|
|
4205
|
-
type VerificationId = string;
|
|
4423
|
+
type VerificationTerminalReason = string;
|
|
4206
4424
|
type Verification = {
|
|
4207
4425
|
readonly id: VerificationId;
|
|
4208
4426
|
/**
|
|
@@ -4210,9 +4428,9 @@ type Verification = {
|
|
|
4210
4428
|
*/
|
|
4211
4429
|
readonly status: "pending" | "verified" | "failed" | "expired" | "canceled" | "blocked";
|
|
4212
4430
|
/**
|
|
4213
|
-
* Why the verification reached its final state
|
|
4431
|
+
* Why the verification reached its final state, or null while `pending` and once `verified`. See the enum for the values it can take.
|
|
4214
4432
|
*/
|
|
4215
|
-
readonly reason?:
|
|
4433
|
+
readonly reason?: VerificationTerminalReason | null;
|
|
4216
4434
|
readonly to: VerificationTo;
|
|
4217
4435
|
/**
|
|
4218
4436
|
* The channels this verification uses to deliver the passcode, in attempt order: the first entry is tried first and later entries are fallbacks. An email recipient is verified over email; a phone recipient is verified over SMS.
|
|
@@ -7277,61 +7495,66 @@ declare class DomainsResource extends Resource {
|
|
|
7277
7495
|
verify(domainId: string, options?: RequestOptions): APIPromise<Domain>;
|
|
7278
7496
|
}
|
|
7279
7497
|
//#endregion
|
|
7280
|
-
//#region src/resources/contactProperties.d.ts
|
|
7281
|
-
/** Body for `bird.contactProperties.create`. */
|
|
7282
|
-
type ContactPropertyCreateParams = ContactPropertyCreateRequest;
|
|
7283
|
-
/** Body for `bird.contactProperties.update` — a partial patch. */
|
|
7284
|
-
type ContactPropertyUpdateParams = ContactPropertyUpdateRequest;
|
|
7285
|
-
/** Filters and cursor params for `bird.contactProperties.list`. */
|
|
7498
|
+
//#region src/resources/contactProperties.gen.d.ts
|
|
7286
7499
|
type ContactPropertyListQuery = NonNullable<ListContactPropertiesData["query"]>;
|
|
7287
|
-
declare class
|
|
7500
|
+
declare class ContactPropertiesResourceBase extends Resource {
|
|
7288
7501
|
/**
|
|
7289
|
-
*
|
|
7290
|
-
* how contacts reference the field in their `data`.
|
|
7502
|
+
* List the workspace's contact properties as a cursor page, newest first. Archived properties are included, marked by their archived flag.
|
|
7291
7503
|
*
|
|
7292
|
-
* @example
|
|
7293
|
-
* const prop = await bird.contactProperties.create({ key: "plan", type: "string" });
|
|
7294
|
-
* console.log(prop.id); // "cp_…"
|
|
7295
|
-
*/
|
|
7296
|
-
create(params: ContactPropertyCreateParams, options?: RequestOptions): APIPromise<ContactProperty>;
|
|
7297
|
-
/**
|
|
7298
|
-
* List the workspace's contact properties. `await` resolves the first page;
|
|
7299
|
-
* `for await` walks every property across pages.
|
|
7300
|
-
*
|
|
7301
|
-
* @example
|
|
7504
|
+
* @example Iterate every contact property, or take one page
|
|
7302
7505
|
* for await (const prop of bird.contactProperties.list()) {
|
|
7303
7506
|
* console.log(prop.key, prop.type);
|
|
7304
7507
|
* }
|
|
7508
|
+
* const page = await bird.contactProperties.list({ limit: 50 }); // page.data, page.next_cursor
|
|
7305
7509
|
*/
|
|
7306
7510
|
list(query?: ContactPropertyListQuery, options?: RequestOptions): PaginatedPromise<ContactProperty>;
|
|
7307
7511
|
/**
|
|
7308
|
-
*
|
|
7512
|
+
* Get a single contact property by ID: key, type, fallback value, and archived state.
|
|
7309
7513
|
*
|
|
7310
|
-
* @example
|
|
7514
|
+
* @example Fetch a contact property by id
|
|
7311
7515
|
* const prop = await bird.contactProperties.get("cp_01krdgeqcxet5s7t44vh8rt9mg");
|
|
7516
|
+
* console.log(prop.key, prop.type);
|
|
7312
7517
|
*/
|
|
7313
7518
|
get(propertyId: string, options?: RequestOptions): APIPromise<ContactProperty>;
|
|
7314
7519
|
/**
|
|
7315
|
-
*
|
|
7520
|
+
* Archive a contact property: the key is rejected in new contact writes and stops rendering in templates, while stored values remain readable. The key stays reserved and counts toward the 200-property limit; reverse with `contact_properties.unarchive`.
|
|
7316
7521
|
*
|
|
7317
|
-
* @example
|
|
7318
|
-
* await bird.contactProperties.
|
|
7522
|
+
* @example Archive a property, retiring the field without deleting its data
|
|
7523
|
+
* const prop = await bird.contactProperties.archive("cp_01krdgeqcxet5s7t44vh8rt9mg");
|
|
7524
|
+
* console.log(prop.key, prop.archived);
|
|
7319
7525
|
*/
|
|
7320
|
-
|
|
7526
|
+
archive(propertyId: string, options?: RequestOptions): APIPromise<ContactProperty>;
|
|
7527
|
+
/**
|
|
7528
|
+
* Reactivate an archived contact property so its key is accepted in contact writes and renders in templates again. Fails with a conflict if the property is not archived.
|
|
7529
|
+
*
|
|
7530
|
+
* @example Restore an archived property
|
|
7531
|
+
* await bird.contactProperties.unarchive("cp_01krdgeqcxet5s7t44vh8rt9mg");
|
|
7532
|
+
*/
|
|
7533
|
+
unarchive(propertyId: string, options?: RequestOptions): APIPromise<ContactProperty>;
|
|
7534
|
+
}
|
|
7535
|
+
//#endregion
|
|
7536
|
+
//#region src/resources/contactProperties.d.ts
|
|
7537
|
+
/** Body for `bird.contactProperties.create`. */
|
|
7538
|
+
type ContactPropertyCreateParams = ContactPropertyCreateRequest;
|
|
7539
|
+
/** Body for `bird.contactProperties.update` — a partial patch. */
|
|
7540
|
+
type ContactPropertyUpdateParams = ContactPropertyUpdateRequest;
|
|
7541
|
+
declare class ContactPropertiesResource extends ContactPropertiesResourceBase {
|
|
7321
7542
|
/**
|
|
7322
|
-
*
|
|
7543
|
+
* Define a contact property. The `key` must be unique in the workspace and is
|
|
7544
|
+
* how contacts reference the field in their `data`.
|
|
7323
7545
|
*
|
|
7324
7546
|
* @example
|
|
7325
|
-
* await bird.contactProperties.
|
|
7547
|
+
* const prop = await bird.contactProperties.create({ key: "plan", type: "string" });
|
|
7548
|
+
* console.log(prop.id); // "cp_…"
|
|
7326
7549
|
*/
|
|
7327
|
-
|
|
7550
|
+
create(params: ContactPropertyCreateParams, options?: RequestOptions): APIPromise<ContactProperty>;
|
|
7328
7551
|
/**
|
|
7329
|
-
*
|
|
7552
|
+
* Update a contact property. Only the fields you send change.
|
|
7330
7553
|
*
|
|
7331
7554
|
* @example
|
|
7332
|
-
* await bird.contactProperties.
|
|
7555
|
+
* await bird.contactProperties.update("cp_01krdgeqcxet5s7t44vh8rt9mg", { fallback_value: "free" });
|
|
7333
7556
|
*/
|
|
7334
|
-
|
|
7557
|
+
update(propertyId: string, params: ContactPropertyUpdateParams, options?: RequestOptions): APIPromise<ContactProperty>;
|
|
7335
7558
|
}
|
|
7336
7559
|
//#endregion
|
|
7337
7560
|
//#region src/resources/contacts.gen.d.ts
|
|
@@ -8053,6 +8276,11 @@ declare const WebhookEventType: {
|
|
|
8053
8276
|
readonly SmsTfnVerificationRejected: "sms.tfn_verification.rejected";
|
|
8054
8277
|
readonly SmsTfnVerificationSubmitted: "sms.tfn_verification.submitted";
|
|
8055
8278
|
readonly SmsUndelivered: "sms.undelivered";
|
|
8279
|
+
readonly VerifyAttemptDelivered: "verify.attempt.delivered";
|
|
8280
|
+
readonly VerifyAttemptSent: "verify.attempt.sent";
|
|
8281
|
+
readonly VerifyAttemptUndelivered: "verify.attempt.undelivered";
|
|
8282
|
+
readonly VerifyVerificationCreated: "verify.verification.created";
|
|
8283
|
+
readonly VerifyVerificationVerified: "verify.verification.verified";
|
|
8056
8284
|
readonly VoiceCallAnswered: "voice_call.answered";
|
|
8057
8285
|
readonly VoiceCallEnded: "voice_call.ended";
|
|
8058
8286
|
readonly VoiceCallInitiated: "voice_call.initiated";
|
package/dist/index.mjs
CHANGED
|
@@ -3717,32 +3717,16 @@ var DomainsResource = class extends Resource {
|
|
|
3717
3717
|
}
|
|
3718
3718
|
};
|
|
3719
3719
|
//#endregion
|
|
3720
|
-
//#region src/resources/contactProperties.ts
|
|
3721
|
-
var
|
|
3722
|
-
/**
|
|
3723
|
-
* Define a contact property. The `key` must be unique in the workspace and is
|
|
3724
|
-
* how contacts reference the field in their `data`.
|
|
3725
|
-
*
|
|
3726
|
-
* @example
|
|
3727
|
-
* const prop = await bird.contactProperties.create({ key: "plan", type: "string" });
|
|
3728
|
-
* console.log(prop.id); // "cp_…"
|
|
3729
|
-
*/
|
|
3730
|
-
create(params, options) {
|
|
3731
|
-
return this.call("POST", options, ({ signal, headers }) => createContactProperty({
|
|
3732
|
-
client: this.client,
|
|
3733
|
-
body: params,
|
|
3734
|
-
headers,
|
|
3735
|
-
signal
|
|
3736
|
-
}));
|
|
3737
|
-
}
|
|
3720
|
+
//#region src/resources/contactProperties.gen.ts
|
|
3721
|
+
var ContactPropertiesResourceBase = class extends Resource {
|
|
3738
3722
|
/**
|
|
3739
|
-
* List the workspace's contact properties
|
|
3740
|
-
* `for await` walks every property across pages.
|
|
3723
|
+
* List the workspace's contact properties as a cursor page, newest first. Archived properties are included, marked by their archived flag.
|
|
3741
3724
|
*
|
|
3742
|
-
* @example
|
|
3725
|
+
* @example Iterate every contact property, or take one page
|
|
3743
3726
|
* for await (const prop of bird.contactProperties.list()) {
|
|
3744
3727
|
* console.log(prop.key, prop.type);
|
|
3745
3728
|
* }
|
|
3729
|
+
* const page = await bird.contactProperties.list({ limit: 50 }); // page.data, page.next_cursor
|
|
3746
3730
|
*/
|
|
3747
3731
|
list(query, options) {
|
|
3748
3732
|
return this.paginated("GET", options, ({ signal, headers }, cursor) => listContactProperties({
|
|
@@ -3756,10 +3740,11 @@ var ContactPropertiesResource = class extends Resource {
|
|
|
3756
3740
|
}));
|
|
3757
3741
|
}
|
|
3758
3742
|
/**
|
|
3759
|
-
*
|
|
3743
|
+
* Get a single contact property by ID: key, type, fallback value, and archived state.
|
|
3760
3744
|
*
|
|
3761
|
-
* @example
|
|
3745
|
+
* @example Fetch a contact property by id
|
|
3762
3746
|
* const prop = await bird.contactProperties.get("cp_01krdgeqcxet5s7t44vh8rt9mg");
|
|
3747
|
+
* console.log(prop.key, prop.type);
|
|
3763
3748
|
*/
|
|
3764
3749
|
get(propertyId, options) {
|
|
3765
3750
|
return this.call("GET", options, ({ signal, headers }) => getContactProperty({
|
|
@@ -3770,44 +3755,65 @@ var ContactPropertiesResource = class extends Resource {
|
|
|
3770
3755
|
}));
|
|
3771
3756
|
}
|
|
3772
3757
|
/**
|
|
3773
|
-
*
|
|
3758
|
+
* Archive a contact property: the key is rejected in new contact writes and stops rendering in templates, while stored values remain readable. The key stays reserved and counts toward the 200-property limit; reverse with `contact_properties.unarchive`.
|
|
3774
3759
|
*
|
|
3775
|
-
* @example
|
|
3776
|
-
* await bird.contactProperties.
|
|
3760
|
+
* @example Archive a property, retiring the field without deleting its data
|
|
3761
|
+
* const prop = await bird.contactProperties.archive("cp_01krdgeqcxet5s7t44vh8rt9mg");
|
|
3762
|
+
* console.log(prop.key, prop.archived);
|
|
3777
3763
|
*/
|
|
3778
|
-
|
|
3779
|
-
return this.call("
|
|
3764
|
+
archive(propertyId, options) {
|
|
3765
|
+
return this.call("POST", options, ({ signal, headers }) => archiveContactProperty({
|
|
3780
3766
|
client: this.client,
|
|
3781
3767
|
path: { property_id: propertyId },
|
|
3782
|
-
body: params,
|
|
3783
3768
|
headers,
|
|
3784
3769
|
signal
|
|
3785
3770
|
}));
|
|
3786
3771
|
}
|
|
3787
3772
|
/**
|
|
3788
|
-
*
|
|
3773
|
+
* Reactivate an archived contact property so its key is accepted in contact writes and renders in templates again. Fails with a conflict if the property is not archived.
|
|
3789
3774
|
*
|
|
3790
|
-
* @example
|
|
3791
|
-
* await bird.contactProperties.
|
|
3775
|
+
* @example Restore an archived property
|
|
3776
|
+
* await bird.contactProperties.unarchive("cp_01krdgeqcxet5s7t44vh8rt9mg");
|
|
3792
3777
|
*/
|
|
3793
|
-
|
|
3794
|
-
return this.call("POST", options, ({ signal, headers }) =>
|
|
3778
|
+
unarchive(propertyId, options) {
|
|
3779
|
+
return this.call("POST", options, ({ signal, headers }) => unarchiveContactProperty({
|
|
3795
3780
|
client: this.client,
|
|
3796
3781
|
path: { property_id: propertyId },
|
|
3797
3782
|
headers,
|
|
3798
3783
|
signal
|
|
3799
3784
|
}));
|
|
3800
3785
|
}
|
|
3786
|
+
};
|
|
3787
|
+
//#endregion
|
|
3788
|
+
//#region src/resources/contactProperties.ts
|
|
3789
|
+
var ContactPropertiesResource = class extends ContactPropertiesResourceBase {
|
|
3801
3790
|
/**
|
|
3802
|
-
*
|
|
3791
|
+
* Define a contact property. The `key` must be unique in the workspace and is
|
|
3792
|
+
* how contacts reference the field in their `data`.
|
|
3803
3793
|
*
|
|
3804
3794
|
* @example
|
|
3805
|
-
* await bird.contactProperties.
|
|
3795
|
+
* const prop = await bird.contactProperties.create({ key: "plan", type: "string" });
|
|
3796
|
+
* console.log(prop.id); // "cp_…"
|
|
3806
3797
|
*/
|
|
3807
|
-
|
|
3808
|
-
return this.call("POST", options, ({ signal, headers }) =>
|
|
3798
|
+
create(params, options) {
|
|
3799
|
+
return this.call("POST", options, ({ signal, headers }) => createContactProperty({
|
|
3800
|
+
client: this.client,
|
|
3801
|
+
body: params,
|
|
3802
|
+
headers,
|
|
3803
|
+
signal
|
|
3804
|
+
}));
|
|
3805
|
+
}
|
|
3806
|
+
/**
|
|
3807
|
+
* Update a contact property. Only the fields you send change.
|
|
3808
|
+
*
|
|
3809
|
+
* @example
|
|
3810
|
+
* await bird.contactProperties.update("cp_01krdgeqcxet5s7t44vh8rt9mg", { fallback_value: "free" });
|
|
3811
|
+
*/
|
|
3812
|
+
update(propertyId, params, options) {
|
|
3813
|
+
return this.call("PATCH", options, ({ signal, headers }) => updateContactProperty({
|
|
3809
3814
|
client: this.client,
|
|
3810
3815
|
path: { property_id: propertyId },
|
|
3816
|
+
body: params,
|
|
3811
3817
|
headers,
|
|
3812
3818
|
signal
|
|
3813
3819
|
}));
|
|
@@ -4743,9 +4749,9 @@ var BirdClient = class {
|
|
|
4743
4749
|
this.#headers = {
|
|
4744
4750
|
...opts.defaultHeaders,
|
|
4745
4751
|
Authorization: `Bearer ${opts.apiKey}`,
|
|
4746
|
-
"User-Agent": `bird-sdk-js/0.12.
|
|
4752
|
+
"User-Agent": `bird-sdk-js/0.12.2`,
|
|
4747
4753
|
"Bird-Surface": "sdk-js",
|
|
4748
|
-
"Bird-Version": "0.12.
|
|
4754
|
+
"Bird-Version": "0.12.2"
|
|
4749
4755
|
};
|
|
4750
4756
|
const caller = detectCaller();
|
|
4751
4757
|
if (caller) this.#headers["Bird-Caller"] = caller;
|
|
@@ -4872,6 +4878,11 @@ const WebhookEventType = {
|
|
|
4872
4878
|
SmsTfnVerificationRejected: "sms.tfn_verification.rejected",
|
|
4873
4879
|
SmsTfnVerificationSubmitted: "sms.tfn_verification.submitted",
|
|
4874
4880
|
SmsUndelivered: "sms.undelivered",
|
|
4881
|
+
VerifyAttemptDelivered: "verify.attempt.delivered",
|
|
4882
|
+
VerifyAttemptSent: "verify.attempt.sent",
|
|
4883
|
+
VerifyAttemptUndelivered: "verify.attempt.undelivered",
|
|
4884
|
+
VerifyVerificationCreated: "verify.verification.created",
|
|
4885
|
+
VerifyVerificationVerified: "verify.verification.verified",
|
|
4875
4886
|
VoiceCallAnswered: "voice_call.answered",
|
|
4876
4887
|
VoiceCallEnded: "voice_call.ended",
|
|
4877
4888
|
VoiceCallInitiated: "voice_call.initiated",
|