@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,118 @@
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 Experiences extends APIResource {
14
+ /**
15
+ * Get one experience
16
+ */
17
+ retrieve(experience: string, options?: RequestOptions): APIPromise<ExperienceRetrieveResponse> {
18
+ return this._client.get(path`/v3/experiences/${experience}`, options);
19
+ }
20
+
21
+ /**
22
+ * The experiences enabled for your account, with the actions you may invoke on
23
+ * each and the fields each action accepts. This is the authoritative list — an
24
+ * action missing here cannot be sent.
25
+ */
26
+ list(options?: RequestOptions): APIPromise<ExperienceListResponse> {
27
+ return this._client.get('/v3/experiences', options);
28
+ }
29
+ }
30
+
31
+ /**
32
+ * What an experience offers you. Deliberately a projection: where its templates
33
+ * live and how they are built is not yours to depend on, so it is not here.
34
+ */
35
+ export interface ExperienceRetrieveResponse {
36
+ actions?: Array<ExperienceRetrieveResponse.Action>;
37
+
38
+ display_name?: string;
39
+
40
+ experience?: string;
41
+ }
42
+
43
+ export namespace ExperienceRetrieveResponse {
44
+ export interface Action {
45
+ /**
46
+ * Fields you may send in `params`, keyed by the exact name to use.
47
+ */
48
+ fields?: { [key: string]: Action.Fields };
49
+
50
+ name?: string;
51
+
52
+ summary?: string;
53
+ }
54
+
55
+ export namespace Action {
56
+ export interface Fields {
57
+ /**
58
+ * Maximum length, for strings.
59
+ */
60
+ max?: number;
61
+
62
+ required?: boolean;
63
+
64
+ type?: 'string' | 'cents' | 'int' | 'url';
65
+ }
66
+ }
67
+ }
68
+
69
+ export interface ExperienceListResponse {
70
+ experiences?: Array<ExperienceListResponse.Experience>;
71
+ }
72
+
73
+ export namespace ExperienceListResponse {
74
+ /**
75
+ * What an experience offers you. Deliberately a projection: where its templates
76
+ * live and how they are built is not yours to depend on, so it is not here.
77
+ */
78
+ export interface Experience {
79
+ actions?: Array<Experience.Action>;
80
+
81
+ display_name?: string;
82
+
83
+ experience?: string;
84
+ }
85
+
86
+ export namespace Experience {
87
+ export interface Action {
88
+ /**
89
+ * Fields you may send in `params`, keyed by the exact name to use.
90
+ */
91
+ fields?: { [key: string]: Action.Fields };
92
+
93
+ name?: string;
94
+
95
+ summary?: string;
96
+ }
97
+
98
+ export namespace Action {
99
+ export interface Fields {
100
+ /**
101
+ * Maximum length, for strings.
102
+ */
103
+ max?: number;
104
+
105
+ required?: boolean;
106
+
107
+ type?: 'string' | 'cents' | 'int' | 'url';
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
+ export declare namespace Experiences {
114
+ export {
115
+ type ExperienceRetrieveResponse as ExperienceRetrieveResponse,
116
+ type ExperienceListResponse as ExperienceListResponse,
117
+ };
118
+ }
@@ -32,8 +32,8 @@ export {
32
32
  type ChatLeaveChatResponse,
33
33
  type ChatSendVoicememoResponse,
34
34
  type ChatCreateParams,
35
- type ChatListChatsParams,
36
35
  type ChatUpdateParams,
36
+ type ChatListChatsParams,
37
37
  type ChatSendVoicememoParams,
38
38
  type ChatsListChatsPagination,
39
39
  } from './chats/chats';
@@ -41,10 +41,11 @@ export {
41
41
  ContactCard,
42
42
  type SetContactCard,
43
43
  type ContactCardRetrieveResponse,
44
- type ContactCardRetrieveParams,
45
44
  type ContactCardCreateParams,
45
+ type ContactCardRetrieveParams,
46
46
  type ContactCardUpdateParams,
47
47
  } from './contact-card';
48
+ export { Experiences, type ExperienceRetrieveResponse, type ExperienceListResponse } from './experiences';
48
49
  export {
49
50
  Messages,
50
51
  type Message,
@@ -54,12 +55,23 @@ export {
54
55
  type MessageAddReactionResponse,
55
56
  type MessageUpdateAppCardResponse,
56
57
  type MessageCreateParams,
57
- type MessageListMessagesThreadParams,
58
- type MessageAddReactionParams,
59
58
  type MessageUpdateParams,
59
+ type MessageAddReactionParams,
60
+ type MessageListMessagesThreadParams,
60
61
  type MessageUpdateAppCardParams,
61
62
  type MessagesListMessagesPagination,
62
63
  } from './messages';
64
+ export {
65
+ PaymentHandles,
66
+ type PaymentHandleConnection,
67
+ type PaymentHandleVerifyParams,
68
+ } from './payment-handles';
69
+ export {
70
+ PaymentProviders,
71
+ type PaymentProvider,
72
+ type PaymentProviderConnectResponse,
73
+ type PaymentProviderConnectParams,
74
+ } from './payment-providers';
63
75
  export {
64
76
  PaymentRequests,
65
77
  type PaymentRequest,
@@ -67,6 +79,12 @@ export {
67
79
  type PaymentRequestCreateParams,
68
80
  type PaymentRequestListParams,
69
81
  } from './payment-requests';
82
+ export {
83
+ Payments,
84
+ type Payment,
85
+ type PaymentCredentialsResponse,
86
+ type PaymentCreateParams,
87
+ } from './payments';
70
88
  export {
71
89
  PhoneNumbers,
72
90
  type PhoneNumberUpdateResponse,
@@ -100,6 +100,15 @@ export class Messages extends APIResource {
100
100
  * Recipients (`to`) are an order-independent set: a single handle is a direct
101
101
  * chat, multiple handles a group chat.
102
102
  *
103
+ * ## Excluding lines
104
+ *
105
+ * `exclude_from` keeps specific lines out of **this** send's line pick. It only
106
+ * affects picking a line for a new chat — an existing chat is always reused on its
107
+ * own line, preferring a chat on a non-excluded line when the recipients have more
108
+ * than one. An exclusion never abandons a live chat or moves it to a new number,
109
+ * so if the only chat these recipients have is on an excluded line, that chat is
110
+ * still used. `from` tells you the line that was actually used.
111
+ *
103
112
  * ## Differences from POST /v3/chats
104
113
  *
105
114
  * - The first message **may contain a link** (including for a newly created chat).
@@ -144,52 +153,43 @@ export class Messages extends APIResource {
144
153
  }
145
154
 
146
155
  /**
147
- * Retrieve all messages in a conversation thread. Given any message ID in the
148
- * thread, returns the originator message and all replies in chronological order.
149
- *
150
- * If the message is not part of a thread, returns just that single message.
151
- *
152
- * Supports pagination and configurable ordering.
156
+ * Retrieve a specific message by its ID. This endpoint returns the full message
157
+ * details including text, attachments, reactions, and metadata.
153
158
  *
154
159
  * @example
155
160
  * ```ts
156
- * // Automatically fetches more pages as needed.
157
- * for await (const message of client.messages.listMessagesThread(
161
+ * const message = await client.messages.retrieve(
158
162
  * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
159
- * )) {
160
- * // ...
161
- * }
163
+ * );
162
164
  * ```
163
165
  */
164
- listMessagesThread(
165
- messageID: string,
166
- query: MessageListMessagesThreadParams | null | undefined = {},
167
- options?: RequestOptions,
168
- ): PagePromise<MessagesListMessagesPagination, Message> {
169
- return this._client.getAPIList(path`/v3/messages/${messageID}/thread`, ListMessagesPagination<Message>, {
170
- query,
171
- ...options,
172
- });
166
+ retrieve(messageID: string, options?: RequestOptions): APIPromise<Message> {
167
+ return this._client.get(path`/v3/messages/${messageID}`, options);
173
168
  }
174
169
 
175
170
  /**
176
- * Retrieve a specific message by its ID. This endpoint returns the full message
177
- * details including text, attachments, reactions, and metadata.
171
+ * Edit the text content of a specific part of a previously sent message.
172
+ *
173
+ * **Note:** A message can be edited up to 5 times, and only within 15 minutes of
174
+ * when it was originally sent.
178
175
  *
179
176
  * @example
180
177
  * ```ts
181
- * const message = await client.messages.retrieve(
178
+ * const message = await client.messages.update(
182
179
  * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
180
+ * { text: 'This is the edited message content' },
183
181
  * );
184
182
  * ```
185
183
  */
186
- retrieve(messageID: string, options?: RequestOptions): APIPromise<Message> {
187
- return this._client.get(path`/v3/messages/${messageID}`, options);
184
+ update(messageID: string, body: MessageUpdateParams, options?: RequestOptions): APIPromise<Message> {
185
+ return this._client.patch(path`/v3/messages/${messageID}`, { body, ...options });
188
186
  }
189
187
 
190
188
  /**
191
189
  * Deletes a message from the Linq API only. This does NOT unsend or remove the
192
- * message from the actual chat — recipients will still see the message.
190
+ * message from the actual chat — recipients will still see the message. Re-sending
191
+ * with a deleted message's idempotency key returns 404 — a deleted message is
192
+ * never resent.
193
193
  *
194
194
  * @example
195
195
  * ```ts
@@ -236,21 +236,32 @@ export class Messages extends APIResource {
236
236
  }
237
237
 
238
238
  /**
239
- * Edit the text content of a specific part of a previously sent message.
239
+ * Retrieve all messages in a conversation thread. Given any message ID in the
240
+ * thread, returns the originator message and all replies in chronological order.
240
241
  *
241
- * **Note:** A message can be edited up to 5 times, and only within 15 minutes of
242
- * when it was originally sent.
242
+ * If the message is not part of a thread, returns just that single message.
243
+ *
244
+ * Supports pagination and configurable ordering.
243
245
  *
244
246
  * @example
245
247
  * ```ts
246
- * const message = await client.messages.update(
248
+ * // Automatically fetches more pages as needed.
249
+ * for await (const message of client.messages.listMessagesThread(
247
250
  * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
248
- * { text: 'This is the edited message content' },
249
- * );
251
+ * )) {
252
+ * // ...
253
+ * }
250
254
  * ```
251
255
  */
252
- update(messageID: string, body: MessageUpdateParams, options?: RequestOptions): APIPromise<Message> {
253
- return this._client.patch(path`/v3/messages/${messageID}`, { body, ...options });
256
+ listMessagesThread(
257
+ messageID: string,
258
+ query: MessageListMessagesThreadParams | null | undefined = {},
259
+ options?: RequestOptions,
260
+ ): PagePromise<MessagesListMessagesPagination, Message> {
261
+ return this._client.getAPIList(path`/v3/messages/${messageID}/thread`, ListMessagesPagination<Message>, {
262
+ query,
263
+ ...options,
264
+ });
254
265
  }
255
266
 
256
267
  /**
@@ -385,6 +396,16 @@ export interface Message {
385
396
  */
386
397
  read_at?: string | null;
387
398
 
399
+ /**
400
+ * Present only when this message was recovered by reconciliation rather than
401
+ * delivered live, and set to the time of that recovery. The field is omitted
402
+ * entirely for normally-delivered messages, which is the overwhelming majority.
403
+ * When present, expect `sent_at` to be substantially earlier — the message is
404
+ * genuine but was ingested late, so it may not have appeared in earlier reads of
405
+ * this conversation.
406
+ */
407
+ reconciled_at?: string;
408
+
388
409
  /**
389
410
  * Indicates this message is a threaded reply to another message
390
411
  */
@@ -702,6 +723,23 @@ export interface MessageCreateParams {
702
723
  */
703
724
  continuation_message?: MessageCreateParams.ContinuationMessage;
704
725
 
726
+ /**
727
+ * Body param: Lines (E.164) not to pick for this send. Applies for this request
728
+ * only — nothing is remembered between calls.
729
+ *
730
+ * **Exclusion only affects picking a line for a new chat.** If `to` already has a
731
+ * chat, that chat is reused on its own line, and a chat on a non-excluded line is
732
+ * preferred when there is more than one. If the only chat these recipients have is
733
+ * on an excluded line, it is still reused — an exclusion never abandons a live
734
+ * chat or moves it to a new number. Check `from` in the response to see the line
735
+ * that was actually used.
736
+ *
737
+ * Numbers that are not your lines are ignored. Every entry must be E.164 — a value
738
+ * like `4155551234` is rejected rather than silently skipped. Excluding every one
739
+ * of your available lines returns 400 when a line has to be picked.
740
+ */
741
+ exclude_from?: Array<string>;
742
+
705
743
  /**
706
744
  * Header param: Optional idempotency key for the send. Reuse the same key to
707
745
  * safely retry without sending twice. May also be supplied as
@@ -728,11 +766,16 @@ export namespace MessageCreateParams {
728
766
  }
729
767
  }
730
768
 
731
- export interface MessageListMessagesThreadParams extends ListMessagesPaginationParams {
769
+ export interface MessageUpdateParams {
732
770
  /**
733
- * Sort order for messages (asc = oldest first, desc = newest first)
771
+ * New text content for the message part
734
772
  */
735
- order?: 'asc' | 'desc';
773
+ text: string;
774
+
775
+ /**
776
+ * Index of the message part to edit. Defaults to 0.
777
+ */
778
+ part_index?: number;
736
779
  }
737
780
 
738
781
  export interface MessageAddReactionParams {
@@ -761,16 +804,11 @@ export interface MessageAddReactionParams {
761
804
  part_index?: number;
762
805
  }
763
806
 
764
- export interface MessageUpdateParams {
765
- /**
766
- * New text content for the message part
767
- */
768
- text: string;
769
-
807
+ export interface MessageListMessagesThreadParams extends ListMessagesPaginationParams {
770
808
  /**
771
- * Index of the message part to edit. Defaults to 0.
809
+ * Sort order for messages (asc = oldest first, desc = newest first)
772
810
  */
773
- part_index?: number;
811
+ order?: 'asc' | 'desc';
774
812
  }
775
813
 
776
814
  export interface MessageUpdateAppCardParams {
@@ -888,9 +926,9 @@ export declare namespace Messages {
888
926
  type MessageUpdateAppCardResponse as MessageUpdateAppCardResponse,
889
927
  type MessagesListMessagesPagination as MessagesListMessagesPagination,
890
928
  type MessageCreateParams as MessageCreateParams,
891
- type MessageListMessagesThreadParams as MessageListMessagesThreadParams,
892
- type MessageAddReactionParams as MessageAddReactionParams,
893
929
  type MessageUpdateParams as MessageUpdateParams,
930
+ type MessageAddReactionParams as MessageAddReactionParams,
931
+ type MessageListMessagesThreadParams as MessageListMessagesThreadParams,
894
932
  type MessageUpdateAppCardParams as MessageUpdateAppCardParams,
895
933
  };
896
934
  }
@@ -0,0 +1,114 @@
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 PaymentHandles extends APIResource {
14
+ /**
15
+ * Starts connecting a customer (by phone/email) so an agent can pay on their
16
+ * behalf. Linq drives the OTP + consent ceremony through the messaging channel;
17
+ * this returns `pending` and a `connection.created` webhook fires once the
18
+ * customer completes it.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const paymentHandleConnection =
23
+ * await client.paymentHandles.connect('handle');
24
+ * ```
25
+ */
26
+ connect(handle: string, options?: RequestOptions): APIPromise<PaymentHandleConnection> {
27
+ return this._client.post(path`/v3/payments/handles/${handle}/connect`, options);
28
+ }
29
+
30
+ /**
31
+ * Get a handle's connection status
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const paymentHandleConnection =
36
+ * await client.paymentHandles.connection('handle');
37
+ * ```
38
+ */
39
+ connection(handle: string, options?: RequestOptions): APIPromise<PaymentHandleConnection> {
40
+ return this._client.get(path`/v3/payments/handles/${handle}/connection`, options);
41
+ }
42
+
43
+ /**
44
+ * Revokes this partner's grant for the customer. Only your grant is removed; the
45
+ * customer's wallet at the provider is untouched.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const paymentHandleConnection =
50
+ * await client.paymentHandles.revoke('handle');
51
+ * ```
52
+ */
53
+ revoke(handle: string, options?: RequestOptions): APIPromise<PaymentHandleConnection> {
54
+ return this._client.delete(path`/v3/payments/handles/${handle}/connection`, options);
55
+ }
56
+
57
+ /**
58
+ * Completes the ceremony `connect` started: verifies the code, records the
59
+ * customer's consent, and stores the connection. Returns `connected` on success,
60
+ * after which payments for this handle no longer need the customer present.
61
+ *
62
+ * The code reaches you however your channel works — typically the customer replies
63
+ * with it in the thread. Codes are single-use and short-lived; if one has expired,
64
+ * call `connect` again for a fresh `connect_id`.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * const paymentHandleConnection =
69
+ * await client.paymentHandles.verify('handle', {
70
+ * code: '482913',
71
+ * connect_id: 'cs_01HZY8',
72
+ * });
73
+ * ```
74
+ */
75
+ verify(
76
+ handle: string,
77
+ body: PaymentHandleVerifyParams,
78
+ options?: RequestOptions,
79
+ ): APIPromise<PaymentHandleConnection> {
80
+ return this._client.post(path`/v3/payments/handles/${handle}/verify`, { body, ...options });
81
+ }
82
+ }
83
+
84
+ export interface PaymentHandleConnection {
85
+ /**
86
+ * Returned only by `connect`, and only while the ceremony is pending. Nothing on
87
+ * our side persists it — it comes back from the provider and is required again to
88
+ * verify — so hold it until you submit the code.
89
+ */
90
+ connect_id?: string;
91
+
92
+ handle?: string;
93
+
94
+ status?: 'not_connected' | 'pending' | 'connected' | 'revoked';
95
+ }
96
+
97
+ export interface PaymentHandleVerifyParams {
98
+ /**
99
+ * The one-time code the customer received.
100
+ */
101
+ code: string;
102
+
103
+ /**
104
+ * The id returned by `connect`.
105
+ */
106
+ connect_id: string;
107
+ }
108
+
109
+ export declare namespace PaymentHandles {
110
+ export {
111
+ type PaymentHandleConnection as PaymentHandleConnection,
112
+ type PaymentHandleVerifyParams as PaymentHandleVerifyParams,
113
+ };
114
+ }
@@ -0,0 +1,81 @@
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 PaymentProviders extends APIResource {
14
+ /**
15
+ * Returns your organization's onboarding status for a payment provider.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const paymentProvider =
20
+ * await client.paymentProviders.retrieve('provider');
21
+ * ```
22
+ */
23
+ retrieve(provider: string, options?: RequestOptions): APIPromise<PaymentProvider> {
24
+ return this._client.get(path`/v3/payments/providers/${provider}`, options);
25
+ }
26
+
27
+ /**
28
+ * Begins connecting your organization to a payment provider (e.g. `agentcard`).
29
+ * Returns a hosted URL where an admin authorizes the connection; on completion the
30
+ * provider redirects back and Linq stores your connected credentials.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const response = await client.paymentProviders.connect(
35
+ * 'provider',
36
+ * {
37
+ * return_url: 'https://partner.example/settings/payments',
38
+ * },
39
+ * );
40
+ * ```
41
+ */
42
+ connect(
43
+ provider: string,
44
+ body: PaymentProviderConnectParams,
45
+ options?: RequestOptions,
46
+ ): APIPromise<PaymentProviderConnectResponse> {
47
+ return this._client.post(path`/v3/payments/providers/${provider}/connect`, { body, ...options });
48
+ }
49
+ }
50
+
51
+ export interface PaymentProvider {
52
+ provider?: string;
53
+
54
+ status?: 'onboarding' | 'ready' | 'disabled';
55
+ }
56
+
57
+ export interface PaymentProviderConnectResponse {
58
+ /**
59
+ * Send the admin here to authorize the connection.
60
+ */
61
+ hosted_url?: string;
62
+
63
+ session_id?: string;
64
+
65
+ status?: string;
66
+ }
67
+
68
+ export interface PaymentProviderConnectParams {
69
+ /**
70
+ * Where to send the admin after they authorize the connection.
71
+ */
72
+ return_url: string;
73
+ }
74
+
75
+ export declare namespace PaymentProviders {
76
+ export {
77
+ type PaymentProvider as PaymentProvider,
78
+ type PaymentProviderConnectResponse as PaymentProviderConnectResponse,
79
+ type PaymentProviderConnectParams as PaymentProviderConnectParams,
80
+ };
81
+ }
@@ -25,7 +25,7 @@ import { path } from '../internal/utils/path';
25
25
  *
26
26
  * ## Connected accounts (Stripe Standard, direct charges)
27
27
  *
28
- * Agent Pay runs on **Stripe Connect Standard accounts** using **direct
28
+ * Payments run on **Stripe Connect Standard accounts** using **direct
29
29
  * charges**: the charge is created on *your* connected account and **you are
30
30
  * the merchant of record**. That means the money, the payout schedule, the
31
31
  * customer relationship, and the compliance surface are all yours — Linq
@@ -108,7 +108,7 @@ import { path } from '../internal/utils/path';
108
108
  * no-install checkout sheet. Everywhere else (Android, desktop, iPhones
109
109
  * without the App Clip yet) the same URL opens the web checkout, so the link
110
110
  * always works. The App Clip experience for your payment links is registered
111
- * automatically by Linq and refreshed whenever you update your Agent Pay
111
+ * automatically by Linq and refreshed whenever you update your payments
112
112
  * branding; a newly registered experience can take up to ~24 hours to
113
113
  * activate on Apple's side, during which links open the web checkout.
114
114
  *