@linqapp/sdk 0.35.1 → 0.37.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 (87) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/client.d.mts +86 -5
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +86 -5
  5. package/client.d.ts.map +1 -1
  6. package/client.js +84 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +84 -3
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/attachments.d.mts +3 -5
  12. package/resources/attachments.d.mts.map +1 -1
  13. package/resources/attachments.d.ts +3 -5
  14. package/resources/attachments.d.ts.map +1 -1
  15. package/resources/attachments.js +3 -5
  16. package/resources/attachments.js.map +1 -1
  17. package/resources/attachments.mjs +3 -5
  18. package/resources/attachments.mjs.map +1 -1
  19. package/resources/capability.d.mts +22 -0
  20. package/resources/capability.d.mts.map +1 -1
  21. package/resources/capability.d.ts +22 -0
  22. package/resources/capability.d.ts.map +1 -1
  23. package/resources/capability.js +7 -0
  24. package/resources/capability.js.map +1 -1
  25. package/resources/capability.mjs +7 -0
  26. package/resources/capability.mjs.map +1 -1
  27. package/resources/chats/chats.d.mts +20 -14
  28. package/resources/chats/chats.d.mts.map +1 -1
  29. package/resources/chats/chats.d.ts +20 -14
  30. package/resources/chats/chats.d.ts.map +1 -1
  31. package/resources/chats/chats.js.map +1 -1
  32. package/resources/chats/chats.mjs.map +1 -1
  33. package/resources/chats/messages.d.mts +4 -3
  34. package/resources/chats/messages.d.mts.map +1 -1
  35. package/resources/chats/messages.d.ts +4 -3
  36. package/resources/chats/messages.d.ts.map +1 -1
  37. package/resources/experiences.d.mts +61 -3
  38. package/resources/experiences.d.mts.map +1 -1
  39. package/resources/experiences.d.ts +61 -3
  40. package/resources/experiences.d.ts.map +1 -1
  41. package/resources/experiences.js +61 -3
  42. package/resources/experiences.js.map +1 -1
  43. package/resources/experiences.mjs +61 -3
  44. package/resources/experiences.mjs.map +1 -1
  45. package/resources/index.d.mts +1 -1
  46. package/resources/index.d.mts.map +1 -1
  47. package/resources/index.d.ts +1 -1
  48. package/resources/index.d.ts.map +1 -1
  49. package/resources/index.js.map +1 -1
  50. package/resources/index.mjs.map +1 -1
  51. package/resources/messages/messages.d.mts +13 -8
  52. package/resources/messages/messages.d.mts.map +1 -1
  53. package/resources/messages/messages.d.ts +13 -8
  54. package/resources/messages/messages.d.ts.map +1 -1
  55. package/resources/messages/messages.js.map +1 -1
  56. package/resources/messages/messages.mjs.map +1 -1
  57. package/resources/payment-requests.d.mts +35 -0
  58. package/resources/payment-requests.d.mts.map +1 -1
  59. package/resources/payment-requests.d.ts +35 -0
  60. package/resources/payment-requests.d.ts.map +1 -1
  61. package/resources/payment-requests.js +35 -0
  62. package/resources/payment-requests.js.map +1 -1
  63. package/resources/payment-requests.mjs +35 -0
  64. package/resources/payment-requests.mjs.map +1 -1
  65. package/resources/phone-numbers.d.mts +229 -1
  66. package/resources/phone-numbers.d.mts.map +1 -1
  67. package/resources/phone-numbers.d.ts +229 -1
  68. package/resources/phone-numbers.d.ts.map +1 -1
  69. package/resources/phone-numbers.js +36 -0
  70. package/resources/phone-numbers.js.map +1 -1
  71. package/resources/phone-numbers.mjs +36 -0
  72. package/resources/phone-numbers.mjs.map +1 -1
  73. package/src/client.ts +104 -3
  74. package/src/resources/attachments.ts +3 -5
  75. package/src/resources/capability.ts +24 -0
  76. package/src/resources/chats/chats.ts +21 -15
  77. package/src/resources/chats/messages.ts +4 -3
  78. package/src/resources/experiences.ts +61 -3
  79. package/src/resources/index.ts +10 -0
  80. package/src/resources/messages/messages.ts +13 -8
  81. package/src/resources/payment-requests.ts +35 -0
  82. package/src/resources/phone-numbers.ts +286 -0
  83. package/src/version.ts +1 -1
  84. package/version.d.mts +1 -1
  85. package/version.d.ts +1 -1
  86. package/version.js +1 -1
  87. package/version.mjs +1 -1
@@ -50,6 +50,275 @@ export class PhoneNumbers extends APIResource {
50
50
  list(options?: RequestOptions): APIPromise<PhoneNumberListResponse> {
51
51
  return this._client.get('/v3/phone_numbers', options);
52
52
  }
53
+
54
+ /**
55
+ * Returns the audit's status and, once complete, the report. Audits are scoped to
56
+ * the line in the URL — an `auditId` started on a different line returns `404`.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const reputationAudit =
61
+ * await client.phoneNumbers.getReputationAudit('auditId', {
62
+ * phoneNumber: 'phoneNumber',
63
+ * });
64
+ * ```
65
+ */
66
+ getReputationAudit(
67
+ auditID: string,
68
+ params: PhoneNumberGetReputationAuditParams,
69
+ options?: RequestOptions,
70
+ ): APIPromise<ReputationAudit> {
71
+ const { phoneNumber } = params;
72
+ return this._client.get(path`/v3/phone_numbers/${phoneNumber}/reputation_audit/${auditID}`, options);
73
+ }
74
+
75
+ /**
76
+ * Starts an asynchronous reputation audit for a line and returns an `audit_id`.
77
+ * Poll the GET endpoint for the result.
78
+ *
79
+ * Rate limited per line: only one audit may run at a time (a second request
80
+ * returns `409` while the first is still in progress), and a new audit can't be
81
+ * started for the same line until a cooldown elapses (`429`, with `Retry-After`
82
+ * carrying the wait).
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * const reputationAuditStarted =
87
+ * await client.phoneNumbers.startReputationAudit(
88
+ * 'phoneNumber',
89
+ * );
90
+ * ```
91
+ */
92
+ startReputationAudit(phoneNumber: string, options?: RequestOptions): APIPromise<ReputationAuditStarted> {
93
+ return this._client.post(path`/v3/phone_numbers/${phoneNumber}/reputation_audit`, options);
94
+ }
95
+ }
96
+
97
+ export interface ReputationActionItem {
98
+ detail?: string;
99
+
100
+ expected_impact?: 'high' | 'medium' | 'low';
101
+
102
+ /**
103
+ * 1 = do first
104
+ */
105
+ priority?: number;
106
+
107
+ title?: string;
108
+ }
109
+
110
+ export interface ReputationAudit {
111
+ audit_id: string;
112
+
113
+ /**
114
+ * `pending` until the report is ready — poll until `complete` or `error`.
115
+ */
116
+ status: 'pending' | 'complete' | 'error';
117
+
118
+ /**
119
+ * Present only when `status` is `error`. Short, generic reason safe to display.
120
+ */
121
+ error?: string;
122
+
123
+ /**
124
+ * When the report was generated; signals reflect the line at this moment.
125
+ */
126
+ generated_at?: string;
127
+
128
+ /**
129
+ * The line audited, E.164.
130
+ */
131
+ phone?: string;
132
+
133
+ /**
134
+ * Present only when `status` is `complete`.
135
+ */
136
+ report?: ReputationReport;
137
+ }
138
+
139
+ export interface ReputationAuditStarted {
140
+ /**
141
+ * Identifier for this audit. Poll
142
+ * `GET /v3/phone_numbers/{phoneNumber}/reputation_audit/{auditId}` until `status`
143
+ * is `complete` or `error`.
144
+ */
145
+ audit_id: string;
146
+
147
+ /**
148
+ * A newly started audit is `pending`.
149
+ */
150
+ status: 'pending' | 'complete' | 'error';
151
+ }
152
+
153
+ export interface ReputationDriver {
154
+ /**
155
+ * Stable driver-category identifier — what is dragging the line, or one of its
156
+ * conversations, down.
157
+ *
158
+ * - `low_engagement` — The conversation is one-sided: several messages sent, few
159
+ * or no replies back. Pause or rework outreach where recipients are not
160
+ * replying, and lead with messages that invite a response. Conversation-level:
161
+ * it appears on `evidence.unhealthy_chats[].driver_keys`, never in `drivers`.
162
+ * - `overall_conversation_health` — A large share of the line's active
163
+ * conversations are trending unhealthy. Fix those conversations first — review
164
+ * their content and timing, and whether recipients are engaging.
165
+ * - `volume_spike` — The line's daily sending volume jumped far above its own
166
+ * normal level. Ramp gradually instead of spiking, spread large sends across
167
+ * days, and prioritize people who have already engaged.
168
+ * - `new_conversation_rate` — The line is starting too many brand-new
169
+ * conversations in a single day. Spread new conversations out over time instead
170
+ * of starting many at once.
171
+ * - `opt_out_handling` — Recipients asked this line to stop. Honor every stop
172
+ * request immediately: send nothing further to that recipient unless they opt
173
+ * back in. Every send to them is rejected with `403` (error code `2024`),
174
+ * including a final courtesy message — to send one telling them they can reply
175
+ * to resume, set `override_optout: true` on that single request.
176
+ * - `flagged` — The line is currently restricted and its messages may not be
177
+ * reaching recipients. Move active traffic to a healthy line now, and let this
178
+ * one recover before sending more.
179
+ * - `other` — Fallback for a signal without dedicated partner copy.
180
+ */
181
+ key?: ReputationDriverKey;
182
+
183
+ /**
184
+ * A specific observed figure when available; otherwise a short qualitative note.
185
+ */
186
+ metric?: string;
187
+
188
+ /**
189
+ * One plain-English sentence.
190
+ */
191
+ summary?: string;
192
+ }
193
+
194
+ /**
195
+ * Stable driver-category identifier — what is dragging the line, or one of its
196
+ * conversations, down.
197
+ *
198
+ * - `low_engagement` — The conversation is one-sided: several messages sent, few
199
+ * or no replies back. Pause or rework outreach where recipients are not
200
+ * replying, and lead with messages that invite a response. Conversation-level:
201
+ * it appears on `evidence.unhealthy_chats[].driver_keys`, never in `drivers`.
202
+ * - `overall_conversation_health` — A large share of the line's active
203
+ * conversations are trending unhealthy. Fix those conversations first — review
204
+ * their content and timing, and whether recipients are engaging.
205
+ * - `volume_spike` — The line's daily sending volume jumped far above its own
206
+ * normal level. Ramp gradually instead of spiking, spread large sends across
207
+ * days, and prioritize people who have already engaged.
208
+ * - `new_conversation_rate` — The line is starting too many brand-new
209
+ * conversations in a single day. Spread new conversations out over time instead
210
+ * of starting many at once.
211
+ * - `opt_out_handling` — Recipients asked this line to stop. Honor every stop
212
+ * request immediately: send nothing further to that recipient unless they opt
213
+ * back in. Every send to them is rejected with `403` (error code `2024`),
214
+ * including a final courtesy message — to send one telling them they can reply
215
+ * to resume, set `override_optout: true` on that single request.
216
+ * - `flagged` — The line is currently restricted and its messages may not be
217
+ * reaching recipients. Move active traffic to a healthy line now, and let this
218
+ * one recover before sending more.
219
+ * - `other` — Fallback for a signal without dedicated partner copy.
220
+ */
221
+ export type ReputationDriverKey =
222
+ | 'low_engagement'
223
+ | 'overall_conversation_health'
224
+ | 'volume_spike'
225
+ | 'new_conversation_rate'
226
+ | 'opt_out_handling'
227
+ | 'flagged'
228
+ | 'other';
229
+
230
+ /**
231
+ * The specific conversations behind the drivers, so partners can verify every
232
+ * claim against their own send logs. Each `chat_id` can be fetched via
233
+ * `GET /v3/chats/{chatId}` — its current health appears there.
234
+ */
235
+ export interface ReputationEvidence {
236
+ /**
237
+ * Worst first — most messages sent after the stop request; honor these
238
+ * immediately.
239
+ */
240
+ opt_out_chats?: Array<ReputationOptOutChat>;
241
+
242
+ /**
243
+ * Up to 15, worst first.
244
+ */
245
+ unhealthy_chats?: Array<ReputationUnhealthyChat>;
246
+ }
247
+
248
+ export interface ReputationOptOutChat {
249
+ chat_id?: string;
250
+
251
+ /**
252
+ * Outbound messages sent after the recipient asked to stop.
253
+ */
254
+ messages_after_stop?: number;
255
+ }
256
+
257
+ export interface ReputationReport {
258
+ /**
259
+ * Ordered by `priority`; 1 = do first.
260
+ */
261
+ action_items?: Array<ReputationActionItem>;
262
+
263
+ /**
264
+ * Ranked, highest impact first.
265
+ */
266
+ drivers?: Array<ReputationDriver>;
267
+
268
+ /**
269
+ * The specific conversations behind the drivers, so partners can verify every
270
+ * claim against their own send logs. Each `chat_id` can be fetched via
271
+ * `GET /v3/chats/{chatId}` — its current health appears there.
272
+ */
273
+ evidence?: ReputationEvidence;
274
+
275
+ /**
276
+ * The `key` of the most important driver. Empty string when the line has nothing
277
+ * to act on — the report then carries a single reassurance action item. Its values
278
+ * are the `ReputationDriverKey` vocabulary — see that schema for what each means
279
+ * and what to do about it.
280
+ */
281
+ primary_driver?: string;
282
+
283
+ /**
284
+ * Current reputation of this phone line.
285
+ *
286
+ * - `HEALTHY` — The line is in good standing. Send normally.
287
+ * - `AT_RISK` — Warning signs on the line: engagement is low across many of its
288
+ * conversations, or it's starting too many brand-new conversations in a single
289
+ * day — and a spike in send volume can add to either. Slow the line's send pace,
290
+ * avoid opening many new conversations at once, and review your messaging
291
+ * patterns.
292
+ * - `CRITICAL` — Strong signals that messages from this line aren't landing well.
293
+ * Pause outbound on the line until it recovers.
294
+ *
295
+ * Defaults to `HEALTHY` for lines that have not yet been scored.
296
+ */
297
+ severity?: 'HEALTHY' | 'AT_RISK' | 'CRITICAL';
298
+
299
+ /**
300
+ * Deterministic markdown rendering of this report, suitable for feeding directly
301
+ * to automated systems and AI agents as investigation context. Rendered from the
302
+ * structured fields above, which remain the source of truth.
303
+ */
304
+ summary_markdown?: string;
305
+ }
306
+
307
+ export interface ReputationUnhealthyChat {
308
+ chat_id?: string;
309
+
310
+ /**
311
+ * What is dragging this conversation down, in the same vocabulary as the report's
312
+ * drivers. Each key's meaning and the fix for it are documented on
313
+ * `ReputationDriverKey`.
314
+ */
315
+ driver_keys?: Array<ReputationDriverKey>;
316
+
317
+ /**
318
+ * The conversation's current health — the same value `GET /v3/chats/{chatId}`
319
+ * reports for it.
320
+ */
321
+ status?: 'AT_RISK' | 'CRITICAL' | 'OPTED_OUT';
53
322
  }
54
323
 
55
324
  export interface PhoneNumberUpdateResponse {
@@ -152,10 +421,27 @@ export interface PhoneNumberUpdateParams {
152
421
  forwarding_number: string | null;
153
422
  }
154
423
 
424
+ export interface PhoneNumberGetReputationAuditParams {
425
+ /**
426
+ * The line in E.164 format.
427
+ */
428
+ phoneNumber: string;
429
+ }
430
+
155
431
  export declare namespace PhoneNumbers {
156
432
  export {
433
+ type ReputationActionItem as ReputationActionItem,
434
+ type ReputationAudit as ReputationAudit,
435
+ type ReputationAuditStarted as ReputationAuditStarted,
436
+ type ReputationDriver as ReputationDriver,
437
+ type ReputationDriverKey as ReputationDriverKey,
438
+ type ReputationEvidence as ReputationEvidence,
439
+ type ReputationOptOutChat as ReputationOptOutChat,
440
+ type ReputationReport as ReputationReport,
441
+ type ReputationUnhealthyChat as ReputationUnhealthyChat,
157
442
  type PhoneNumberUpdateResponse as PhoneNumberUpdateResponse,
158
443
  type PhoneNumberListResponse as PhoneNumberListResponse,
159
444
  type PhoneNumberUpdateParams as PhoneNumberUpdateParams,
445
+ type PhoneNumberGetReputationAuditParams as PhoneNumberGetReputationAuditParams,
160
446
  };
161
447
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.35.1'; // x-release-please-version
1
+ export const VERSION = '0.37.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.35.1";
1
+ export declare const VERSION = "0.37.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.35.1";
1
+ export declare const VERSION = "0.37.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.35.1'; // x-release-please-version
4
+ exports.VERSION = '0.37.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.35.1'; // x-release-please-version
1
+ export const VERSION = '0.37.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map