@linqapp/sdk 0.32.0 → 0.33.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.
Files changed (148) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/client.d.mts +41 -5
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +41 -5
  5. package/client.d.ts.map +1 -1
  6. package/client.js +38 -2
  7. package/client.js.map +1 -1
  8. package/client.mjs +38 -2
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/available-number.d.mts +13 -1
  12. package/resources/available-number.d.mts.map +1 -1
  13. package/resources/available-number.d.ts +13 -1
  14. package/resources/available-number.d.ts.map +1 -1
  15. package/resources/available-number.js +2 -1
  16. package/resources/available-number.js.map +1 -1
  17. package/resources/available-number.mjs +2 -1
  18. package/resources/available-number.mjs.map +1 -1
  19. package/resources/chats/chats.d.mts +125 -64
  20. package/resources/chats/chats.d.mts.map +1 -1
  21. package/resources/chats/chats.d.ts +125 -64
  22. package/resources/chats/chats.d.ts.map +1 -1
  23. package/resources/chats/chats.js +59 -59
  24. package/resources/chats/chats.js.map +1 -1
  25. package/resources/chats/chats.mjs +59 -59
  26. package/resources/chats/chats.mjs.map +1 -1
  27. package/resources/chats/index.d.mts +2 -2
  28. package/resources/chats/index.d.mts.map +1 -1
  29. package/resources/chats/index.d.ts +2 -2
  30. package/resources/chats/index.d.ts.map +1 -1
  31. package/resources/chats/location.d.mts +25 -25
  32. package/resources/chats/location.d.mts.map +1 -1
  33. package/resources/chats/location.d.ts +25 -25
  34. package/resources/chats/location.d.ts.map +1 -1
  35. package/resources/chats/location.js +27 -27
  36. package/resources/chats/location.js.map +1 -1
  37. package/resources/chats/location.mjs +27 -27
  38. package/resources/chats/location.mjs.map +1 -1
  39. package/resources/chats/messages.d.mts +17 -17
  40. package/resources/chats/messages.d.mts.map +1 -1
  41. package/resources/chats/messages.d.ts +17 -17
  42. package/resources/chats/messages.d.ts.map +1 -1
  43. package/resources/chats/messages.js +16 -16
  44. package/resources/chats/messages.js.map +1 -1
  45. package/resources/chats/messages.mjs +16 -16
  46. package/resources/chats/messages.mjs.map +1 -1
  47. package/resources/contact-card.d.mts +29 -28
  48. package/resources/contact-card.d.mts.map +1 -1
  49. package/resources/contact-card.d.ts +29 -28
  50. package/resources/contact-card.d.ts.map +1 -1
  51. package/resources/contact-card.js +23 -22
  52. package/resources/contact-card.js.map +1 -1
  53. package/resources/contact-card.mjs +23 -22
  54. package/resources/contact-card.mjs.map +1 -1
  55. package/resources/experiences.d.mts +91 -0
  56. package/resources/experiences.d.mts.map +1 -0
  57. package/resources/experiences.d.ts +91 -0
  58. package/resources/experiences.d.ts.map +1 -0
  59. package/resources/experiences.js +29 -0
  60. package/resources/experiences.js.map +1 -0
  61. package/resources/experiences.mjs +25 -0
  62. package/resources/experiences.mjs.map +1 -0
  63. package/resources/index.d.mts +7 -3
  64. package/resources/index.d.mts.map +1 -1
  65. package/resources/index.d.ts +7 -3
  66. package/resources/index.d.ts.map +1 -1
  67. package/resources/index.js +9 -1
  68. package/resources/index.js.map +1 -1
  69. package/resources/index.mjs +4 -0
  70. package/resources/index.mjs.map +1 -1
  71. package/resources/messages.d.mts +71 -35
  72. package/resources/messages.d.mts.map +1 -1
  73. package/resources/messages.d.ts +71 -35
  74. package/resources/messages.d.ts.map +1 -1
  75. package/resources/messages.js +41 -30
  76. package/resources/messages.js.map +1 -1
  77. package/resources/messages.mjs +41 -30
  78. package/resources/messages.mjs.map +1 -1
  79. package/resources/payment-handles.d.mts +87 -0
  80. package/resources/payment-handles.d.mts.map +1 -0
  81. package/resources/payment-handles.d.ts +87 -0
  82. package/resources/payment-handles.d.ts.map +1 -0
  83. package/resources/payment-handles.js +76 -0
  84. package/resources/payment-handles.js.map +1 -0
  85. package/resources/payment-handles.mjs +72 -0
  86. package/resources/payment-handles.mjs.map +1 -0
  87. package/resources/payment-providers.d.mts +58 -0
  88. package/resources/payment-providers.d.mts.map +1 -0
  89. package/resources/payment-providers.d.ts +58 -0
  90. package/resources/payment-providers.d.ts.map +1 -0
  91. package/resources/payment-providers.js +45 -0
  92. package/resources/payment-providers.js.map +1 -0
  93. package/resources/payment-providers.mjs +41 -0
  94. package/resources/payment-providers.mjs.map +1 -0
  95. package/resources/payment-requests.d.mts +2 -2
  96. package/resources/payment-requests.d.ts +2 -2
  97. package/resources/payment-requests.js +2 -2
  98. package/resources/payment-requests.mjs +2 -2
  99. package/resources/payments.d.mts +116 -0
  100. package/resources/payments.d.mts.map +1 -0
  101. package/resources/payments.d.ts +116 -0
  102. package/resources/payments.d.ts.map +1 -0
  103. package/resources/payments.js +70 -0
  104. package/resources/payments.js.map +1 -0
  105. package/resources/payments.mjs +66 -0
  106. package/resources/payments.mjs.map +1 -0
  107. package/resources/phone-numbers.d.mts +11 -11
  108. package/resources/phone-numbers.d.mts.map +1 -1
  109. package/resources/phone-numbers.d.ts +11 -11
  110. package/resources/phone-numbers.d.ts.map +1 -1
  111. package/resources/phone-numbers.js +13 -13
  112. package/resources/phone-numbers.js.map +1 -1
  113. package/resources/phone-numbers.mjs +13 -13
  114. package/resources/phone-numbers.mjs.map +1 -1
  115. package/resources/webhook-subscriptions.d.mts +11 -11
  116. package/resources/webhook-subscriptions.d.mts.map +1 -1
  117. package/resources/webhook-subscriptions.d.ts +11 -11
  118. package/resources/webhook-subscriptions.d.ts.map +1 -1
  119. package/resources/webhook-subscriptions.js +13 -13
  120. package/resources/webhook-subscriptions.js.map +1 -1
  121. package/resources/webhook-subscriptions.mjs +13 -13
  122. package/resources/webhook-subscriptions.mjs.map +1 -1
  123. package/resources/webhooks.d.mts +59 -0
  124. package/resources/webhooks.d.mts.map +1 -1
  125. package/resources/webhooks.d.ts +59 -0
  126. package/resources/webhooks.d.ts.map +1 -1
  127. package/src/client.ts +77 -6
  128. package/src/resources/available-number.ts +14 -1
  129. package/src/resources/chats/chats.ts +142 -79
  130. package/src/resources/chats/index.ts +2 -2
  131. package/src/resources/chats/location.ts +28 -28
  132. package/src/resources/chats/messages.ts +28 -28
  133. package/src/resources/contact-card.ts +36 -35
  134. package/src/resources/experiences.ts +118 -0
  135. package/src/resources/index.ts +22 -4
  136. package/src/resources/messages.ts +85 -47
  137. package/src/resources/payment-handles.ts +114 -0
  138. package/src/resources/payment-providers.ts +81 -0
  139. package/src/resources/payment-requests.ts +2 -2
  140. package/src/resources/payments.ts +163 -0
  141. package/src/resources/phone-numbers.ts +14 -14
  142. package/src/resources/webhook-subscriptions.ts +14 -14
  143. package/src/resources/webhooks.ts +61 -0
  144. package/src/version.ts +1 -1
  145. package/version.d.mts +1 -1
  146. package/version.d.ts +1 -1
  147. package/version.js +1 -1
  148. package/version.mjs +1 -1
@@ -0,0 +1,163 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+ import { path } from '../internal/utils/path';
7
+
8
+ /**
9
+ * Let an agent pay on a customer's behalf with a single-use virtual card.
10
+ * Connect a customer once, then create a payment — a virtual card is minted
11
+ * scoped to that purchase and the card details are handed back for checkout.
12
+ */
13
+ export class Payments extends APIResource {
14
+ /**
15
+ * Advances the pay flow for a connected customer handle and returns a `status`
16
+ * describing where it is (`needs_connection`, `awaiting_user_action`, `ready`,
17
+ * ...). A payment `id` appears once a card is minted. Idempotent on the
18
+ * `Idempotency-Key` header.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const payment = await client.payments.create({
23
+ * amount_cents: 2500,
24
+ * currency: 'usd',
25
+ * handle: '+14155550123',
26
+ * });
27
+ * ```
28
+ */
29
+ create(body: PaymentCreateParams, options?: RequestOptions): APIPromise<Payment> {
30
+ return this._client.post('/v3/payments', { body, ...options });
31
+ }
32
+
33
+ /**
34
+ * Get a payment
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const payment = await client.payments.retrieve('paymentId');
39
+ * ```
40
+ */
41
+ retrieve(paymentID: string, options?: RequestOptions): APIPromise<Payment> {
42
+ return this._client.get(path`/v3/payments/${paymentID}`, options);
43
+ }
44
+
45
+ /**
46
+ * Closes the virtual card and cancels the payment.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const payment = await client.payments.cancel('paymentId');
51
+ * ```
52
+ */
53
+ cancel(paymentID: string, options?: RequestOptions): APIPromise<Payment> {
54
+ return this._client.post(path`/v3/payments/${paymentID}/cancel`, options);
55
+ }
56
+
57
+ /**
58
+ * Returns a short-lived handoff for a `ready` payment. Fetch the card credentials
59
+ * **directly from the provider** with the returned `user_token` at `fetch_url` —
60
+ * the card number never passes through Linq. Do not persist PAN/CVC.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const response = await client.payments.credentials(
65
+ * 'paymentId',
66
+ * );
67
+ * ```
68
+ */
69
+ credentials(paymentID: string, options?: RequestOptions): APIPromise<PaymentCredentialsResponse> {
70
+ return this._client.get(path`/v3/payments/${paymentID}/credentials`, options);
71
+ }
72
+ }
73
+
74
+ export interface Payment {
75
+ id?: string;
76
+
77
+ amount_cents?: number;
78
+
79
+ /**
80
+ * Present when the customer must approve with a passkey.
81
+ */
82
+ approval_url?: string;
83
+
84
+ /**
85
+ * Present when the customer must attach a card.
86
+ */
87
+ attach_url?: string;
88
+
89
+ currency?: string;
90
+
91
+ description?: string;
92
+
93
+ handle?: string;
94
+
95
+ status?:
96
+ | 'needs_connection'
97
+ | 'connecting'
98
+ | 'awaiting_user_action'
99
+ | 'ready'
100
+ | 'authorized'
101
+ | 'succeeded'
102
+ | 'declined'
103
+ | 'canceled'
104
+ | 'expired';
105
+ }
106
+
107
+ export interface PaymentCredentialsResponse {
108
+ /**
109
+ * Fetch the card directly from the provider with these — never through Linq.
110
+ */
111
+ handoff?: PaymentCredentialsResponse.Handoff;
112
+ }
113
+
114
+ export namespace PaymentCredentialsResponse {
115
+ /**
116
+ * Fetch the card directly from the provider with these — never through Linq.
117
+ */
118
+ export interface Handoff {
119
+ card_ref?: string;
120
+
121
+ fetch_url?: string;
122
+
123
+ provider?: string;
124
+
125
+ /**
126
+ * Short-lived bearer to fetch the card from the provider.
127
+ */
128
+ user_token?: string;
129
+ }
130
+ }
131
+
132
+ export interface PaymentCreateParams {
133
+ amount_cents: number;
134
+
135
+ currency: string;
136
+
137
+ /**
138
+ * Customer phone (E.164) or email.
139
+ */
140
+ handle: string;
141
+
142
+ description?: string;
143
+
144
+ merchant?: PaymentCreateParams.Merchant;
145
+
146
+ metadata?: { [key: string]: string };
147
+ }
148
+
149
+ export namespace PaymentCreateParams {
150
+ export interface Merchant {
151
+ name?: string;
152
+
153
+ url?: string;
154
+ }
155
+ }
156
+
157
+ export declare namespace Payments {
158
+ export {
159
+ type Payment as Payment,
160
+ type PaymentCredentialsResponse as PaymentCredentialsResponse,
161
+ type PaymentCreateParams as PaymentCreateParams,
162
+ };
163
+ }
@@ -15,20 +15,6 @@ import { path } from '../internal/utils/path';
15
15
  * in the `from` field.
16
16
  */
17
17
  export class PhoneNumbers extends APIResource {
18
- /**
19
- * Returns all phone numbers assigned to the authenticated partner. Use this
20
- * endpoint to discover which phone numbers are available for use as the `from`
21
- * field when creating a chat, listing chats, or sending a voice memo.
22
- *
23
- * @example
24
- * ```ts
25
- * const phoneNumbers = await client.phoneNumbers.list();
26
- * ```
27
- */
28
- list(options?: RequestOptions): APIPromise<PhoneNumberListResponse> {
29
- return this._client.get('/v3/phone_numbers', options);
30
- }
31
-
32
18
  /**
33
19
  * Updates the forwarding number for a phone number. The forwarding number is where
34
20
  * inbound calls will be forwarded to.
@@ -50,6 +36,20 @@ export class PhoneNumbers extends APIResource {
50
36
  ): APIPromise<PhoneNumberUpdateResponse> {
51
37
  return this._client.put(path`/v3/phone_numbers/${phoneNumberID}`, { body, ...options });
52
38
  }
39
+
40
+ /**
41
+ * Returns all phone numbers assigned to the authenticated partner. Use this
42
+ * endpoint to discover which phone numbers are available for use as the `from`
43
+ * field when creating a chat, listing chats, or sending a voice memo.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * const phoneNumbers = await client.phoneNumbers.list();
48
+ * ```
49
+ */
50
+ list(options?: RequestOptions): APIPromise<PhoneNumberListResponse> {
51
+ return this._client.get('/v3/phone_numbers', options);
52
+ }
53
53
  }
54
54
 
55
55
  export interface PhoneNumberUpdateResponse {
@@ -187,20 +187,6 @@ export class WebhookSubscriptions extends APIResource {
187
187
  return this._client.post('/v3/webhook-subscriptions', { body, ...options });
188
188
  }
189
189
 
190
- /**
191
- * Retrieve all webhook subscriptions for the authenticated partner. Returns a list
192
- * of active and inactive subscriptions with their configuration and status.
193
- *
194
- * @example
195
- * ```ts
196
- * const webhookSubscriptions =
197
- * await client.webhookSubscriptions.list();
198
- * ```
199
- */
200
- list(options?: RequestOptions): APIPromise<WebhookSubscriptionListResponse> {
201
- return this._client.get('/v3/webhook-subscriptions', options);
202
- }
203
-
204
190
  /**
205
191
  * Retrieve details for a specific webhook subscription including its target URL,
206
192
  * subscribed events, and current status.
@@ -243,6 +229,20 @@ export class WebhookSubscriptions extends APIResource {
243
229
  return this._client.put(path`/v3/webhook-subscriptions/${subscriptionID}`, { body, ...options });
244
230
  }
245
231
 
232
+ /**
233
+ * Retrieve all webhook subscriptions for the authenticated partner. Returns a list
234
+ * of active and inactive subscriptions with their configuration and status.
235
+ *
236
+ * @example
237
+ * ```ts
238
+ * const webhookSubscriptions =
239
+ * await client.webhookSubscriptions.list();
240
+ * ```
241
+ */
242
+ list(options?: RequestOptions): APIPromise<WebhookSubscriptionListResponse> {
243
+ return this._client.get('/v3/webhook-subscriptions', options);
244
+ }
245
+
246
246
  /**
247
247
  * Delete a webhook subscription.
248
248
  *
@@ -102,6 +102,17 @@ export interface MessageEventV2 {
102
102
  */
103
103
  read_at?: string | null;
104
104
 
105
+ /**
106
+ * Present only when this message was recovered by reconciliation rather than
107
+ * delivered live, and set to the time of that recovery. The field is omitted
108
+ * entirely for normally-delivered messages, which is the overwhelming majority.
109
+ * When present, expect `sent_at` to be substantially earlier than delivery of this
110
+ * event: the message is genuine but is arriving late and out of real-time order,
111
+ * so treat it as history rather than as a live inbound (for example, suppress
112
+ * auto-replies).
113
+ */
114
+ reconciled_at?: string;
115
+
105
116
  /**
106
117
  * Reference to the message this is replying to (for threaded replies)
107
118
  */
@@ -173,6 +184,17 @@ export namespace MessageEventV2 {
173
184
  * Current health bucket for the chat. See the
174
185
  * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
175
186
  * to react. `doc_url` deep-links to the relevant section.
187
+ *
188
+ * `OPTED_OUT` is terminal — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`,
189
+ * `CANCEL`, `END`, or `QUIT`, and you should send nothing further on this chat.
190
+ * The keyword must be the whole trimmed message, never part of a longer one:
191
+ * `STOP` counts, `please stop` does not. Most keywords must match exactly,
192
+ * including case. `OPT OUT` is the exception — it matches in any casing, with or
193
+ * without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all count.
194
+ * It clears if they later send `START`, `OPTIN`, or `UNSTOP`, or if they keep
195
+ * replying on the chat — sustained two-way conversation is treated as a sign the
196
+ * stop keyword was a false positive. Suppressing sends to opted-out recipients is
197
+ * your responsibility — Linq surfaces the status but does not block the send.
176
198
  */
177
199
  status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL' | 'OPTED_OUT';
178
200
 
@@ -345,6 +367,17 @@ export interface MessagePayload {
345
367
  */
346
368
  read_at?: string | null;
347
369
 
370
+ /**
371
+ * Present only when this message was recovered by reconciliation rather than
372
+ * delivered live, and set to the time of that recovery. The field is omitted
373
+ * entirely for normally-delivered messages, which is the overwhelming majority.
374
+ * When present, expect `sent_at` to be substantially earlier than delivery of this
375
+ * event: the message is genuine but is arriving late and out of real-time order,
376
+ * so treat it as history rather than as a live inbound (for example, suppress
377
+ * auto-replies).
378
+ */
379
+ reconciled_at?: string;
380
+
348
381
  /**
349
382
  * Reference to the message this is replying to
350
383
  */
@@ -935,6 +968,9 @@ export interface MessageFailedWebhookEvent {
935
968
  * Error details for message.failed webhook events. See
936
969
  * [WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error
937
970
  * code reference.
971
+ *
972
+ * In rare cases the message can still be delivered after this event fires — a
973
+ * `message.delivered` webhook for the same message ID may follow.
938
974
  */
939
975
  data: MessageFailedWebhookEvent.Data;
940
976
 
@@ -975,6 +1011,9 @@ export namespace MessageFailedWebhookEvent {
975
1011
  * Error details for message.failed webhook events. See
976
1012
  * [WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error
977
1013
  * code reference.
1014
+ *
1015
+ * In rare cases the message can still be delivered after this event fires — a
1016
+ * `message.delivered` webhook for the same message ID may follow.
978
1017
  */
979
1018
  export interface Data {
980
1019
  /**
@@ -1157,6 +1196,17 @@ export namespace MessageEditedWebhookEvent {
1157
1196
  * Current health bucket for the chat. See the
1158
1197
  * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
1159
1198
  * to react. `doc_url` deep-links to the relevant section.
1199
+ *
1200
+ * `OPTED_OUT` is terminal — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`,
1201
+ * `CANCEL`, `END`, or `QUIT`, and you should send nothing further on this chat.
1202
+ * The keyword must be the whole trimmed message, never part of a longer one:
1203
+ * `STOP` counts, `please stop` does not. Most keywords must match exactly,
1204
+ * including case. `OPT OUT` is the exception — it matches in any casing, with or
1205
+ * without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all count.
1206
+ * It clears if they later send `START`, `OPTIN`, or `UNSTOP`, or if they keep
1207
+ * replying on the chat — sustained two-way conversation is treated as a sign the
1208
+ * stop keyword was a false positive. Suppressing sends to opted-out recipients is
1209
+ * your responsibility — Linq surfaces the status but does not block the send.
1160
1210
  */
1161
1211
  status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL' | 'OPTED_OUT';
1162
1212
 
@@ -1579,6 +1629,17 @@ export namespace ChatCreatedWebhookEvent {
1579
1629
  * Current health bucket for the chat. See the
1580
1630
  * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
1581
1631
  * to react. `doc_url` deep-links to the relevant section.
1632
+ *
1633
+ * `OPTED_OUT` is terminal — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`,
1634
+ * `CANCEL`, `END`, or `QUIT`, and you should send nothing further on this chat.
1635
+ * The keyword must be the whole trimmed message, never part of a longer one:
1636
+ * `STOP` counts, `please stop` does not. Most keywords must match exactly,
1637
+ * including case. `OPT OUT` is the exception — it matches in any casing, with or
1638
+ * without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all count.
1639
+ * It clears if they later send `START`, `OPTIN`, or `UNSTOP`, or if they keep
1640
+ * replying on the chat — sustained two-way conversation is treated as a sign the
1641
+ * stop keyword was a false positive. Suppressing sends to opted-out recipients is
1642
+ * your responsibility — Linq surfaces the status but does not block the send.
1582
1643
  */
1583
1644
  status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL' | 'OPTED_OUT';
1584
1645
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.32.0'; // x-release-please-version
1
+ export const VERSION = '0.33.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.32.0";
1
+ export declare const VERSION = "0.33.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.32.0";
1
+ export declare const VERSION = "0.33.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.32.0'; // x-release-please-version
4
+ exports.VERSION = '0.33.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.32.0'; // x-release-please-version
1
+ export const VERSION = '0.33.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map