@linqapp/sdk 0.1.0 → 0.1.3

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 (223) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/LICENSE +198 -4
  3. package/README.md +52 -52
  4. package/client.d.mts +34 -22
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +34 -22
  7. package/client.d.ts.map +1 -1
  8. package/client.js +50 -41
  9. package/client.js.map +1 -1
  10. package/client.mjs +49 -40
  11. package/client.mjs.map +1 -1
  12. package/core/api-promise.d.mts +2 -2
  13. package/core/api-promise.d.mts.map +1 -1
  14. package/core/api-promise.d.ts +2 -2
  15. package/core/api-promise.d.ts.map +1 -1
  16. package/core/api-promise.js.map +1 -1
  17. package/core/api-promise.mjs.map +1 -1
  18. package/core/error.d.mts +2 -2
  19. package/core/error.d.mts.map +1 -1
  20. package/core/error.d.ts +2 -2
  21. package/core/error.d.ts.map +1 -1
  22. package/core/error.js +4 -4
  23. package/core/error.js.map +1 -1
  24. package/core/error.mjs +2 -2
  25. package/core/error.mjs.map +1 -1
  26. package/core/resource.d.mts +3 -3
  27. package/core/resource.d.mts.map +1 -1
  28. package/core/resource.d.ts +3 -3
  29. package/core/resource.d.ts.map +1 -1
  30. package/core/resource.js.map +1 -1
  31. package/core/resource.mjs.map +1 -1
  32. package/index.d.mts +3 -3
  33. package/index.d.mts.map +1 -1
  34. package/index.d.ts +3 -3
  35. package/index.d.ts.map +1 -1
  36. package/index.js +4 -4
  37. package/index.js.map +1 -1
  38. package/index.mjs +3 -3
  39. package/index.mjs.map +1 -1
  40. package/internal/parse.d.mts +2 -2
  41. package/internal/parse.d.mts.map +1 -1
  42. package/internal/parse.d.ts +2 -2
  43. package/internal/parse.d.ts.map +1 -1
  44. package/internal/parse.js.map +1 -1
  45. package/internal/parse.mjs.map +1 -1
  46. package/internal/shims.js +1 -1
  47. package/internal/shims.js.map +1 -1
  48. package/internal/shims.mjs +1 -1
  49. package/internal/shims.mjs.map +1 -1
  50. package/internal/uploads.d.mts +4 -4
  51. package/internal/uploads.d.mts.map +1 -1
  52. package/internal/uploads.d.ts +4 -4
  53. package/internal/uploads.d.ts.map +1 -1
  54. package/internal/uploads.js.map +1 -1
  55. package/internal/uploads.mjs.map +1 -1
  56. package/internal/utils/base64.js +2 -2
  57. package/internal/utils/base64.js.map +1 -1
  58. package/internal/utils/base64.mjs +3 -3
  59. package/internal/utils/base64.mjs.map +1 -1
  60. package/internal/utils/log.d.mts +3 -3
  61. package/internal/utils/log.d.mts.map +1 -1
  62. package/internal/utils/log.d.ts +3 -3
  63. package/internal/utils/log.d.ts.map +1 -1
  64. package/internal/utils/log.js.map +1 -1
  65. package/internal/utils/log.mjs.map +1 -1
  66. package/internal/utils/path.js +1 -1
  67. package/internal/utils/path.js.map +1 -1
  68. package/internal/utils/path.mjs +2 -2
  69. package/internal/utils/path.mjs.map +1 -1
  70. package/internal/utils/values.js +5 -5
  71. package/internal/utils/values.js.map +1 -1
  72. package/internal/utils/values.mjs +6 -6
  73. package/internal/utils/values.mjs.map +1 -1
  74. package/package.json +4 -4
  75. package/resources/attachments.d.mts +28 -3
  76. package/resources/attachments.d.mts.map +1 -1
  77. package/resources/attachments.d.ts +28 -3
  78. package/resources/attachments.d.ts.map +1 -1
  79. package/resources/capability.d.mts +74 -0
  80. package/resources/capability.d.mts.map +1 -0
  81. package/resources/capability.d.ts +74 -0
  82. package/resources/capability.d.ts.map +1 -0
  83. package/resources/capability.js +36 -0
  84. package/resources/capability.js.map +1 -0
  85. package/resources/capability.mjs +32 -0
  86. package/resources/capability.mjs.map +1 -0
  87. package/resources/chats/chats.d.mts +133 -663
  88. package/resources/chats/chats.d.mts.map +1 -1
  89. package/resources/chats/chats.d.ts +133 -663
  90. package/resources/chats/chats.d.ts.map +1 -1
  91. package/resources/chats/chats.js +2 -2
  92. package/resources/chats/chats.js.map +1 -1
  93. package/resources/chats/chats.mjs +2 -2
  94. package/resources/chats/chats.mjs.map +1 -1
  95. package/resources/chats/index.d.mts +2 -2
  96. package/resources/chats/index.d.mts.map +1 -1
  97. package/resources/chats/index.d.ts +2 -2
  98. package/resources/chats/index.d.ts.map +1 -1
  99. package/resources/chats/index.js.map +1 -1
  100. package/resources/chats/index.mjs.map +1 -1
  101. package/resources/chats/messages.d.mts +55 -716
  102. package/resources/chats/messages.d.mts.map +1 -1
  103. package/resources/chats/messages.d.ts +55 -716
  104. package/resources/chats/messages.d.ts.map +1 -1
  105. package/resources/chats/messages.js.map +1 -1
  106. package/resources/chats/messages.mjs.map +1 -1
  107. package/resources/index.d.mts +8 -5
  108. package/resources/index.d.mts.map +1 -1
  109. package/resources/index.d.ts +8 -5
  110. package/resources/index.d.ts.map +1 -1
  111. package/resources/index.js +9 -3
  112. package/resources/index.js.map +1 -1
  113. package/resources/index.mjs +5 -2
  114. package/resources/index.mjs.map +1 -1
  115. package/resources/messages.d.mts +129 -553
  116. package/resources/messages.d.mts.map +1 -1
  117. package/resources/messages.d.ts +129 -553
  118. package/resources/messages.d.ts.map +1 -1
  119. package/resources/messages.js +1 -1
  120. package/resources/messages.js.map +1 -1
  121. package/resources/messages.mjs +1 -1
  122. package/resources/messages.mjs.map +1 -1
  123. package/resources/phone-numbers.d.mts +1 -50
  124. package/resources/phone-numbers.d.mts.map +1 -1
  125. package/resources/phone-numbers.d.ts +1 -50
  126. package/resources/phone-numbers.d.ts.map +1 -1
  127. package/resources/phone-numbers.js +0 -8
  128. package/resources/phone-numbers.js.map +1 -1
  129. package/resources/phone-numbers.mjs +0 -8
  130. package/resources/phone-numbers.mjs.map +1 -1
  131. package/resources/phonenumbers.d.mts +58 -0
  132. package/resources/phonenumbers.d.mts.map +1 -0
  133. package/resources/phonenumbers.d.ts +58 -0
  134. package/resources/phonenumbers.d.ts.map +1 -0
  135. package/resources/phonenumbers.js +17 -0
  136. package/resources/phonenumbers.js.map +1 -0
  137. package/resources/phonenumbers.mjs +13 -0
  138. package/resources/phonenumbers.mjs.map +1 -0
  139. package/resources/webhook-events.d.mts +29 -0
  140. package/resources/webhook-events.d.mts.map +1 -0
  141. package/resources/webhook-events.d.ts +29 -0
  142. package/resources/webhook-events.d.ts.map +1 -0
  143. package/resources/{webhooks/events.js → webhook-events.js} +5 -10
  144. package/resources/webhook-events.js.map +1 -0
  145. package/resources/{webhooks/events.mjs → webhook-events.mjs} +3 -8
  146. package/resources/webhook-events.mjs.map +1 -0
  147. package/resources/webhook-subscriptions.d.mts +184 -0
  148. package/resources/webhook-subscriptions.d.mts.map +1 -0
  149. package/resources/webhook-subscriptions.d.ts +184 -0
  150. package/resources/webhook-subscriptions.d.ts.map +1 -0
  151. package/resources/{webhooks/subscriptions.js → webhook-subscriptions.js} +16 -16
  152. package/resources/webhook-subscriptions.js.map +1 -0
  153. package/resources/{webhooks/subscriptions.mjs → webhook-subscriptions.mjs} +14 -14
  154. package/resources/webhook-subscriptions.mjs.map +1 -0
  155. package/src/client.ts +97 -41
  156. package/src/core/api-promise.ts +4 -4
  157. package/src/core/error.ts +2 -2
  158. package/src/core/resource.ts +3 -3
  159. package/src/index.ts +3 -3
  160. package/src/internal/parse.ts +2 -2
  161. package/src/internal/shims.ts +1 -1
  162. package/src/internal/uploads.ts +5 -5
  163. package/src/internal/utils/base64.ts +3 -3
  164. package/src/internal/utils/log.ts +3 -3
  165. package/src/internal/utils/path.ts +2 -2
  166. package/src/internal/utils/values.ts +6 -6
  167. package/src/resources/attachments.ts +81 -106
  168. package/src/resources/capability.ts +98 -0
  169. package/src/resources/chats/chats.ts +135 -770
  170. package/src/resources/chats/index.ts +4 -2
  171. package/src/resources/chats/messages.ts +60 -839
  172. package/src/resources/index.ts +29 -9
  173. package/src/resources/messages.ts +153 -659
  174. package/src/resources/phone-numbers.ts +1 -65
  175. package/src/resources/phonenumbers.ts +72 -0
  176. package/src/resources/webhook-events.ts +57 -0
  177. package/src/resources/webhook-subscriptions.ts +238 -0
  178. package/src/version.ts +1 -1
  179. package/version.d.mts +1 -1
  180. package/version.d.ts +1 -1
  181. package/version.js +1 -1
  182. package/version.mjs +1 -1
  183. package/resources/webhooks/events.d.mts +0 -30
  184. package/resources/webhooks/events.d.mts.map +0 -1
  185. package/resources/webhooks/events.d.ts +0 -30
  186. package/resources/webhooks/events.d.ts.map +0 -1
  187. package/resources/webhooks/events.js.map +0 -1
  188. package/resources/webhooks/events.mjs.map +0 -1
  189. package/resources/webhooks/index.d.mts +0 -4
  190. package/resources/webhooks/index.d.mts.map +0 -1
  191. package/resources/webhooks/index.d.ts +0 -4
  192. package/resources/webhooks/index.d.ts.map +0 -1
  193. package/resources/webhooks/index.js +0 -11
  194. package/resources/webhooks/index.js.map +0 -1
  195. package/resources/webhooks/index.mjs +0 -5
  196. package/resources/webhooks/index.mjs.map +0 -1
  197. package/resources/webhooks/subscriptions.d.mts +0 -237
  198. package/resources/webhooks/subscriptions.d.mts.map +0 -1
  199. package/resources/webhooks/subscriptions.d.ts +0 -237
  200. package/resources/webhooks/subscriptions.d.ts.map +0 -1
  201. package/resources/webhooks/subscriptions.js.map +0 -1
  202. package/resources/webhooks/subscriptions.mjs.map +0 -1
  203. package/resources/webhooks/webhooks.d.mts +0 -14
  204. package/resources/webhooks/webhooks.d.mts.map +0 -1
  205. package/resources/webhooks/webhooks.d.ts +0 -14
  206. package/resources/webhooks/webhooks.d.ts.map +0 -1
  207. package/resources/webhooks/webhooks.js +0 -21
  208. package/resources/webhooks/webhooks.js.map +0 -1
  209. package/resources/webhooks/webhooks.mjs +0 -16
  210. package/resources/webhooks/webhooks.mjs.map +0 -1
  211. package/resources/webhooks.d.mts +0 -2
  212. package/resources/webhooks.d.mts.map +0 -1
  213. package/resources/webhooks.d.ts +0 -2
  214. package/resources/webhooks.d.ts.map +0 -1
  215. package/resources/webhooks.js +0 -6
  216. package/resources/webhooks.js.map +0 -1
  217. package/resources/webhooks.mjs +0 -3
  218. package/resources/webhooks.mjs.map +0 -1
  219. package/src/resources/webhooks/events.ts +0 -55
  220. package/src/resources/webhooks/index.ts +0 -13
  221. package/src/resources/webhooks/subscriptions.ts +0 -409
  222. package/src/resources/webhooks/webhooks.ts +0 -37
  223. package/src/resources/webhooks.ts +0 -3
@@ -0,0 +1,184 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import * as WebhookEventsAPI from "./webhook-events.mjs";
3
+ import { APIPromise } from "../core/api-promise.mjs";
4
+ import { RequestOptions } from "../internal/request-options.mjs";
5
+ export declare class WebhookSubscriptions extends APIResource {
6
+ /**
7
+ * Create a new webhook subscription to receive events at a target URL. Upon
8
+ * creation, a signing secret is generated for verifying webhook authenticity.
9
+ * **Store this secret securely — it cannot be retrieved later.**
10
+ *
11
+ * **Webhook Delivery:**
12
+ *
13
+ * - Events are sent via HTTP POST to the target URL
14
+ * - Each request includes `X-Webhook-Signature` and `X-Webhook-Timestamp` headers
15
+ * - Signature is HMAC-SHA256 over `{timestamp}.{payload}` — see
16
+ * [Webhook Events](/docs/webhook-events) for verification details
17
+ * - Failed deliveries (5xx, 429, network errors) are retried up to 10 times over
18
+ * ~2 hours with exponential backoff
19
+ * - Client errors (4xx except 429) are not retried
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const webhookSubscription =
24
+ * await client.webhookSubscriptions.create({
25
+ * subscribed_events: [
26
+ * 'message.sent',
27
+ * 'message.delivered',
28
+ * 'message.read',
29
+ * ],
30
+ * target_url: 'https://webhooks.example.com/linq/events',
31
+ * });
32
+ * ```
33
+ */
34
+ create(body: WebhookSubscriptionCreateParams, options?: RequestOptions): APIPromise<WebhookSubscriptionCreateResponse>;
35
+ /**
36
+ * Retrieve details for a specific webhook subscription including its target URL,
37
+ * subscribed events, and current status.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const webhookSubscription =
42
+ * await client.webhookSubscriptions.retrieve(
43
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
44
+ * );
45
+ * ```
46
+ */
47
+ retrieve(subscriptionID: string, options?: RequestOptions): APIPromise<WebhookSubscription>;
48
+ /**
49
+ * Update an existing webhook subscription. You can modify the target URL,
50
+ * subscribed events, or activate/deactivate the subscription.
51
+ *
52
+ * **Note:** The signing secret cannot be changed via this endpoint.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * const webhookSubscription =
57
+ * await client.webhookSubscriptions.update(
58
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
59
+ * {
60
+ * target_url:
61
+ * 'https://webhooks.example.com/linq/events',
62
+ * },
63
+ * );
64
+ * ```
65
+ */
66
+ update(subscriptionID: string, body: WebhookSubscriptionUpdateParams, options?: RequestOptions): APIPromise<WebhookSubscription>;
67
+ /**
68
+ * Retrieve all webhook subscriptions for the authenticated partner. Returns a list
69
+ * of active and inactive subscriptions with their configuration and status.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * const webhookSubscriptions =
74
+ * await client.webhookSubscriptions.list();
75
+ * ```
76
+ */
77
+ list(options?: RequestOptions): APIPromise<WebhookSubscriptionListResponse>;
78
+ /**
79
+ * Delete a webhook subscription.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * await client.webhookSubscriptions.delete(
84
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
85
+ * );
86
+ * ```
87
+ */
88
+ delete(subscriptionID: string, options?: RequestOptions): APIPromise<void>;
89
+ }
90
+ export interface WebhookSubscription {
91
+ /**
92
+ * Unique identifier for the webhook subscription
93
+ */
94
+ id: string;
95
+ /**
96
+ * When the subscription was created
97
+ */
98
+ created_at: string;
99
+ /**
100
+ * Whether this subscription is currently active
101
+ */
102
+ is_active: boolean;
103
+ /**
104
+ * List of event types this subscription receives
105
+ */
106
+ subscribed_events: Array<WebhookEventsAPI.WebhookEventType>;
107
+ /**
108
+ * URL where webhook events will be sent
109
+ */
110
+ target_url: string;
111
+ /**
112
+ * When the subscription was last updated
113
+ */
114
+ updated_at: string;
115
+ }
116
+ /**
117
+ * Response returned when creating a webhook subscription. Includes the signing
118
+ * secret which is only shown once.
119
+ */
120
+ export interface WebhookSubscriptionCreateResponse {
121
+ /**
122
+ * Unique identifier for the webhook subscription
123
+ */
124
+ id: string;
125
+ /**
126
+ * When the subscription was created
127
+ */
128
+ created_at: string;
129
+ /**
130
+ * Whether this subscription is currently active
131
+ */
132
+ is_active: boolean;
133
+ /**
134
+ * Secret for verifying webhook signatures. Store this securely - it cannot be
135
+ * retrieved again.
136
+ */
137
+ signing_secret: string;
138
+ /**
139
+ * List of event types this subscription receives
140
+ */
141
+ subscribed_events: Array<WebhookEventsAPI.WebhookEventType>;
142
+ /**
143
+ * URL where webhook events will be sent
144
+ */
145
+ target_url: string;
146
+ /**
147
+ * When the subscription was last updated
148
+ */
149
+ updated_at: string;
150
+ }
151
+ export interface WebhookSubscriptionListResponse {
152
+ /**
153
+ * List of webhook subscriptions
154
+ */
155
+ subscriptions: Array<WebhookSubscription>;
156
+ }
157
+ export interface WebhookSubscriptionCreateParams {
158
+ /**
159
+ * List of event types to subscribe to
160
+ */
161
+ subscribed_events: Array<WebhookEventsAPI.WebhookEventType>;
162
+ /**
163
+ * URL where webhook events will be sent. Must be HTTPS.
164
+ */
165
+ target_url: string;
166
+ }
167
+ export interface WebhookSubscriptionUpdateParams {
168
+ /**
169
+ * Activate or deactivate the subscription
170
+ */
171
+ is_active?: boolean;
172
+ /**
173
+ * Updated list of event types to subscribe to
174
+ */
175
+ subscribed_events?: Array<WebhookEventsAPI.WebhookEventType>;
176
+ /**
177
+ * New target URL for webhook events
178
+ */
179
+ target_url?: string;
180
+ }
181
+ export declare namespace WebhookSubscriptions {
182
+ export { type WebhookSubscription as WebhookSubscription, type WebhookSubscriptionCreateResponse as WebhookSubscriptionCreateResponse, type WebhookSubscriptionListResponse as WebhookSubscriptionListResponse, type WebhookSubscriptionCreateParams as WebhookSubscriptionCreateParams, type WebhookSubscriptionUpdateParams as WebhookSubscriptionUpdateParams, };
183
+ }
184
+ //# sourceMappingURL=webhook-subscriptions.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-subscriptions.d.mts","sour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EX;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,iBAAiB,EAAE,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAE5D;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,+BAA+B;IAC9C;;OAEG;IACH,aAAa,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,+BAA+B;IAC9C;;OAEG;IACH,iBAAiB,EAAE,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAE5D;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,+BAA+B;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAE7D;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,WAAW,oBAAoB,CAAC;IAC5C,OAAO,EACL,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iCAAiC,IAAI,iCAAiC,EAC3E,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,+BAA+B,IAAI,+BAA+B,GACxE,CAAC;CACH"}
@@ -0,0 +1,184 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import * as WebhookEventsAPI from "./webhook-events.js";
3
+ import { APIPromise } from "../core/api-promise.js";
4
+ import { RequestOptions } from "../internal/request-options.js";
5
+ export declare class WebhookSubscriptions extends APIResource {
6
+ /**
7
+ * Create a new webhook subscription to receive events at a target URL. Upon
8
+ * creation, a signing secret is generated for verifying webhook authenticity.
9
+ * **Store this secret securely — it cannot be retrieved later.**
10
+ *
11
+ * **Webhook Delivery:**
12
+ *
13
+ * - Events are sent via HTTP POST to the target URL
14
+ * - Each request includes `X-Webhook-Signature` and `X-Webhook-Timestamp` headers
15
+ * - Signature is HMAC-SHA256 over `{timestamp}.{payload}` — see
16
+ * [Webhook Events](/docs/webhook-events) for verification details
17
+ * - Failed deliveries (5xx, 429, network errors) are retried up to 10 times over
18
+ * ~2 hours with exponential backoff
19
+ * - Client errors (4xx except 429) are not retried
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const webhookSubscription =
24
+ * await client.webhookSubscriptions.create({
25
+ * subscribed_events: [
26
+ * 'message.sent',
27
+ * 'message.delivered',
28
+ * 'message.read',
29
+ * ],
30
+ * target_url: 'https://webhooks.example.com/linq/events',
31
+ * });
32
+ * ```
33
+ */
34
+ create(body: WebhookSubscriptionCreateParams, options?: RequestOptions): APIPromise<WebhookSubscriptionCreateResponse>;
35
+ /**
36
+ * Retrieve details for a specific webhook subscription including its target URL,
37
+ * subscribed events, and current status.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const webhookSubscription =
42
+ * await client.webhookSubscriptions.retrieve(
43
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
44
+ * );
45
+ * ```
46
+ */
47
+ retrieve(subscriptionID: string, options?: RequestOptions): APIPromise<WebhookSubscription>;
48
+ /**
49
+ * Update an existing webhook subscription. You can modify the target URL,
50
+ * subscribed events, or activate/deactivate the subscription.
51
+ *
52
+ * **Note:** The signing secret cannot be changed via this endpoint.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * const webhookSubscription =
57
+ * await client.webhookSubscriptions.update(
58
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
59
+ * {
60
+ * target_url:
61
+ * 'https://webhooks.example.com/linq/events',
62
+ * },
63
+ * );
64
+ * ```
65
+ */
66
+ update(subscriptionID: string, body: WebhookSubscriptionUpdateParams, options?: RequestOptions): APIPromise<WebhookSubscription>;
67
+ /**
68
+ * Retrieve all webhook subscriptions for the authenticated partner. Returns a list
69
+ * of active and inactive subscriptions with their configuration and status.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * const webhookSubscriptions =
74
+ * await client.webhookSubscriptions.list();
75
+ * ```
76
+ */
77
+ list(options?: RequestOptions): APIPromise<WebhookSubscriptionListResponse>;
78
+ /**
79
+ * Delete a webhook subscription.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * await client.webhookSubscriptions.delete(
84
+ * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
85
+ * );
86
+ * ```
87
+ */
88
+ delete(subscriptionID: string, options?: RequestOptions): APIPromise<void>;
89
+ }
90
+ export interface WebhookSubscription {
91
+ /**
92
+ * Unique identifier for the webhook subscription
93
+ */
94
+ id: string;
95
+ /**
96
+ * When the subscription was created
97
+ */
98
+ created_at: string;
99
+ /**
100
+ * Whether this subscription is currently active
101
+ */
102
+ is_active: boolean;
103
+ /**
104
+ * List of event types this subscription receives
105
+ */
106
+ subscribed_events: Array<WebhookEventsAPI.WebhookEventType>;
107
+ /**
108
+ * URL where webhook events will be sent
109
+ */
110
+ target_url: string;
111
+ /**
112
+ * When the subscription was last updated
113
+ */
114
+ updated_at: string;
115
+ }
116
+ /**
117
+ * Response returned when creating a webhook subscription. Includes the signing
118
+ * secret which is only shown once.
119
+ */
120
+ export interface WebhookSubscriptionCreateResponse {
121
+ /**
122
+ * Unique identifier for the webhook subscription
123
+ */
124
+ id: string;
125
+ /**
126
+ * When the subscription was created
127
+ */
128
+ created_at: string;
129
+ /**
130
+ * Whether this subscription is currently active
131
+ */
132
+ is_active: boolean;
133
+ /**
134
+ * Secret for verifying webhook signatures. Store this securely - it cannot be
135
+ * retrieved again.
136
+ */
137
+ signing_secret: string;
138
+ /**
139
+ * List of event types this subscription receives
140
+ */
141
+ subscribed_events: Array<WebhookEventsAPI.WebhookEventType>;
142
+ /**
143
+ * URL where webhook events will be sent
144
+ */
145
+ target_url: string;
146
+ /**
147
+ * When the subscription was last updated
148
+ */
149
+ updated_at: string;
150
+ }
151
+ export interface WebhookSubscriptionListResponse {
152
+ /**
153
+ * List of webhook subscriptions
154
+ */
155
+ subscriptions: Array<WebhookSubscription>;
156
+ }
157
+ export interface WebhookSubscriptionCreateParams {
158
+ /**
159
+ * List of event types to subscribe to
160
+ */
161
+ subscribed_events: Array<WebhookEventsAPI.WebhookEventType>;
162
+ /**
163
+ * URL where webhook events will be sent. Must be HTTPS.
164
+ */
165
+ target_url: string;
166
+ }
167
+ export interface WebhookSubscriptionUpdateParams {
168
+ /**
169
+ * Activate or deactivate the subscription
170
+ */
171
+ is_active?: boolean;
172
+ /**
173
+ * Updated list of event types to subscribe to
174
+ */
175
+ subscribed_events?: Array<WebhookEventsAPI.WebhookEventType>;
176
+ /**
177
+ * New target URL for webhook events
178
+ */
179
+ target_url?: string;
180
+ }
181
+ export declare namespace WebhookSubscriptions {
182
+ export { type WebhookSubscription as WebhookSubscription, type WebhookSubscriptionCreateResponse as WebhookSubscriptionCreateResponse, type WebhookSubscriptionListResponse as WebhookSubscriptionListResponse, type WebhookSubscriptionCreateParams as WebhookSubscriptionCreateParams, type WebhookSubscriptionUpdateParams as WebhookSubscriptionUpdateParams, };
183
+ }
184
+ //# sourceMappingURL=webhook-subscriptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-subscriptions.d.ts","sourceRoot":"","sources":["../src/resources/webhook-subscriptions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,gBAAgB;OACrB,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,oBAAqB,SAAQ,WAAW;IACnD;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CACJ,IAAI,EAAE,+BAA+B,EACrC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,iCAAiC,CAAC;IAIhD;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9C;;OAEG;IACH,aAAa,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,+BAA+B;IAC9C;;OAEG;IACH,iBAAiB,EAAE,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAE5D;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,+BAA+B;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAE7D;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,WAAW,oBAAoB,CAAC;IAC5C,OAAO,EACL,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iCAAiC,IAAI,iCAAiC,EAC3E,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,+BAA+B,IAAI,+BAA+B,GACxE,CAAC;CACH"}
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Subscriptions = void 0;
5
- const resource_1 = require("../../core/resource.js");
6
- const headers_1 = require("../../internal/headers.js");
7
- const path_1 = require("../../internal/utils/path.js");
8
- class Subscriptions extends resource_1.APIResource {
4
+ exports.WebhookSubscriptions = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ const headers_1 = require("../internal/headers.js");
7
+ const path_1 = require("../internal/utils/path.js");
8
+ class WebhookSubscriptions extends resource_1.APIResource {
9
9
  /**
10
10
  * Create a new webhook subscription to receive events at a target URL. Upon
11
11
  * creation, a signing secret is generated for verifying webhook authenticity.
@@ -23,8 +23,8 @@ class Subscriptions extends resource_1.APIResource {
23
23
  *
24
24
  * @example
25
25
  * ```ts
26
- * const subscription =
27
- * await client.webhooks.subscriptions.create({
26
+ * const webhookSubscription =
27
+ * await client.webhookSubscriptions.create({
28
28
  * subscribed_events: [
29
29
  * 'message.sent',
30
30
  * 'message.delivered',
@@ -43,8 +43,8 @@ class Subscriptions extends resource_1.APIResource {
43
43
  *
44
44
  * @example
45
45
  * ```ts
46
- * const subscription =
47
- * await client.webhooks.subscriptions.retrieve(
46
+ * const webhookSubscription =
47
+ * await client.webhookSubscriptions.retrieve(
48
48
  * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
49
49
  * );
50
50
  * ```
@@ -60,8 +60,8 @@ class Subscriptions extends resource_1.APIResource {
60
60
  *
61
61
  * @example
62
62
  * ```ts
63
- * const subscription =
64
- * await client.webhooks.subscriptions.update(
63
+ * const webhookSubscription =
64
+ * await client.webhookSubscriptions.update(
65
65
  * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
66
66
  * {
67
67
  * target_url:
@@ -79,8 +79,8 @@ class Subscriptions extends resource_1.APIResource {
79
79
  *
80
80
  * @example
81
81
  * ```ts
82
- * const subscriptions =
83
- * await client.webhooks.subscriptions.list();
82
+ * const webhookSubscriptions =
83
+ * await client.webhookSubscriptions.list();
84
84
  * ```
85
85
  */
86
86
  list(options) {
@@ -91,7 +91,7 @@ class Subscriptions extends resource_1.APIResource {
91
91
  *
92
92
  * @example
93
93
  * ```ts
94
- * await client.webhooks.subscriptions.delete(
94
+ * await client.webhookSubscriptions.delete(
95
95
  * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
96
96
  * );
97
97
  * ```
@@ -103,5 +103,5 @@ class Subscriptions extends resource_1.APIResource {
103
103
  });
104
104
  }
105
105
  }
106
- exports.Subscriptions = Subscriptions;
107
- //# sourceMappingURL=subscriptions.js.map
106
+ exports.WebhookSubscriptions = WebhookSubscriptions;
107
+ //# sourceMappingURL=webhook-subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-subscriptions.js","sourceRoot":"","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
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../../core/resource.mjs";
3
- import { buildHeaders } from "../../internal/headers.mjs";
4
- import { path } from "../../internal/utils/path.mjs";
5
- export class Subscriptions extends APIResource {
2
+ import { APIResource } from "../core/resource.mjs";
3
+ import { buildHeaders } from "../internal/headers.mjs";
4
+ import { path } from "../internal/utils/path.mjs";
5
+ export class WebhookSubscriptions extends APIResource {
6
6
  /**
7
7
  * Create a new webhook subscription to receive events at a target URL. Upon
8
8
  * creation, a signing secret is generated for verifying webhook authenticity.
@@ -20,8 +20,8 @@ export class Subscriptions extends APIResource {
20
20
  *
21
21
  * @example
22
22
  * ```ts
23
- * const subscription =
24
- * await client.webhooks.subscriptions.create({
23
+ * const webhookSubscription =
24
+ * await client.webhookSubscriptions.create({
25
25
  * subscribed_events: [
26
26
  * 'message.sent',
27
27
  * 'message.delivered',
@@ -40,8 +40,8 @@ export class Subscriptions extends APIResource {
40
40
  *
41
41
  * @example
42
42
  * ```ts
43
- * const subscription =
44
- * await client.webhooks.subscriptions.retrieve(
43
+ * const webhookSubscription =
44
+ * await client.webhookSubscriptions.retrieve(
45
45
  * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
46
46
  * );
47
47
  * ```
@@ -57,8 +57,8 @@ export class Subscriptions extends APIResource {
57
57
  *
58
58
  * @example
59
59
  * ```ts
60
- * const subscription =
61
- * await client.webhooks.subscriptions.update(
60
+ * const webhookSubscription =
61
+ * await client.webhookSubscriptions.update(
62
62
  * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
63
63
  * {
64
64
  * target_url:
@@ -76,8 +76,8 @@ export class Subscriptions extends APIResource {
76
76
  *
77
77
  * @example
78
78
  * ```ts
79
- * const subscriptions =
80
- * await client.webhooks.subscriptions.list();
79
+ * const webhookSubscriptions =
80
+ * await client.webhookSubscriptions.list();
81
81
  * ```
82
82
  */
83
83
  list(options) {
@@ -88,7 +88,7 @@ export class Subscriptions extends APIResource {
88
88
  *
89
89
  * @example
90
90
  * ```ts
91
- * await client.webhooks.subscriptions.delete(
91
+ * await client.webhookSubscriptions.delete(
92
92
  * 'b2c3d4e5-f6a7-8901-bcde-f23456789012',
93
93
  * );
94
94
  * ```
@@ -100,4 +100,4 @@ export class Subscriptions extends APIResource {
100
100
  });
101
101
  }
102
102
  }
103
- //# sourceMappingURL=subscriptions.mjs.map
103
+ //# sourceMappingURL=webhook-subscriptions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-subscriptions.mjs","sourceRoot":"","sources":["../src/resources/webhook-subscriptions.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,oBAAqB,SAAQ,WAAW;IACnD;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CACJ,IAAqC,EACrC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,cAAsB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,6BAA6B,cAAc,EAAE,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CACJ,cAAsB,EACtB,IAAqC,EACrC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,6BAA6B,cAAc,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnG,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,G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