@linqapp/sdk 0.1.0 → 0.1.4

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 (231) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/LICENSE +198 -4
  3. package/README.md +52 -52
  4. package/client.d.mts +35 -22
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +35 -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/tslib.js +6 -6
  51. package/internal/uploads.d.mts +4 -4
  52. package/internal/uploads.d.mts.map +1 -1
  53. package/internal/uploads.d.ts +4 -4
  54. package/internal/uploads.d.ts.map +1 -1
  55. package/internal/uploads.js.map +1 -1
  56. package/internal/uploads.mjs.map +1 -1
  57. package/internal/utils/base64.js +2 -2
  58. package/internal/utils/base64.js.map +1 -1
  59. package/internal/utils/base64.mjs +3 -3
  60. package/internal/utils/base64.mjs.map +1 -1
  61. package/internal/utils/log.d.mts +3 -3
  62. package/internal/utils/log.d.mts.map +1 -1
  63. package/internal/utils/log.d.ts +3 -3
  64. package/internal/utils/log.d.ts.map +1 -1
  65. package/internal/utils/log.js.map +1 -1
  66. package/internal/utils/log.mjs.map +1 -1
  67. package/internal/utils/path.js +1 -1
  68. package/internal/utils/path.js.map +1 -1
  69. package/internal/utils/path.mjs +2 -2
  70. package/internal/utils/path.mjs.map +1 -1
  71. package/internal/utils/values.js +5 -5
  72. package/internal/utils/values.js.map +1 -1
  73. package/internal/utils/values.mjs +6 -6
  74. package/internal/utils/values.mjs.map +1 -1
  75. package/package.json +4 -4
  76. package/resources/attachments.d.mts +28 -3
  77. package/resources/attachments.d.mts.map +1 -1
  78. package/resources/attachments.d.ts +28 -3
  79. package/resources/attachments.d.ts.map +1 -1
  80. package/resources/capability.d.mts +74 -0
  81. package/resources/capability.d.mts.map +1 -0
  82. package/resources/capability.d.ts +74 -0
  83. package/resources/capability.d.ts.map +1 -0
  84. package/resources/capability.js +36 -0
  85. package/resources/capability.js.map +1 -0
  86. package/resources/capability.mjs +32 -0
  87. package/resources/capability.mjs.map +1 -0
  88. package/resources/chats/chats.d.mts +129 -663
  89. package/resources/chats/chats.d.mts.map +1 -1
  90. package/resources/chats/chats.d.ts +129 -663
  91. package/resources/chats/chats.d.ts.map +1 -1
  92. package/resources/chats/chats.js +2 -2
  93. package/resources/chats/chats.js.map +1 -1
  94. package/resources/chats/chats.mjs +2 -2
  95. package/resources/chats/chats.mjs.map +1 -1
  96. package/resources/chats/index.d.mts +2 -2
  97. package/resources/chats/index.d.mts.map +1 -1
  98. package/resources/chats/index.d.ts +2 -2
  99. package/resources/chats/index.d.ts.map +1 -1
  100. package/resources/chats/index.js.map +1 -1
  101. package/resources/chats/index.mjs.map +1 -1
  102. package/resources/chats/messages.d.mts +56 -716
  103. package/resources/chats/messages.d.mts.map +1 -1
  104. package/resources/chats/messages.d.ts +56 -716
  105. package/resources/chats/messages.d.ts.map +1 -1
  106. package/resources/chats/messages.js.map +1 -1
  107. package/resources/chats/messages.mjs.map +1 -1
  108. package/resources/index.d.mts +9 -5
  109. package/resources/index.d.mts.map +1 -1
  110. package/resources/index.d.ts +9 -5
  111. package/resources/index.d.ts.map +1 -1
  112. package/resources/index.js +11 -3
  113. package/resources/index.js.map +1 -1
  114. package/resources/index.mjs +6 -2
  115. package/resources/index.mjs.map +1 -1
  116. package/resources/messages.d.mts +156 -544
  117. package/resources/messages.d.mts.map +1 -1
  118. package/resources/messages.d.ts +156 -544
  119. package/resources/messages.d.ts.map +1 -1
  120. package/resources/messages.js +1 -1
  121. package/resources/messages.js.map +1 -1
  122. package/resources/messages.mjs +1 -1
  123. package/resources/messages.mjs.map +1 -1
  124. package/resources/phone-numbers.d.mts +1 -50
  125. package/resources/phone-numbers.d.mts.map +1 -1
  126. package/resources/phone-numbers.d.ts +1 -50
  127. package/resources/phone-numbers.d.ts.map +1 -1
  128. package/resources/phone-numbers.js +0 -8
  129. package/resources/phone-numbers.js.map +1 -1
  130. package/resources/phone-numbers.mjs +0 -8
  131. package/resources/phone-numbers.mjs.map +1 -1
  132. package/resources/phonenumbers.d.mts +58 -0
  133. package/resources/phonenumbers.d.mts.map +1 -0
  134. package/resources/phonenumbers.d.ts +58 -0
  135. package/resources/phonenumbers.d.ts.map +1 -0
  136. package/resources/phonenumbers.js +17 -0
  137. package/resources/phonenumbers.js.map +1 -0
  138. package/resources/phonenumbers.mjs +13 -0
  139. package/resources/phonenumbers.mjs.map +1 -0
  140. package/resources/shared.d.mts +5 -0
  141. package/resources/shared.d.mts.map +1 -0
  142. package/resources/shared.d.ts +5 -0
  143. package/resources/shared.d.ts.map +1 -0
  144. package/resources/{webhooks.js → shared.js} +1 -3
  145. package/resources/shared.js.map +1 -0
  146. package/{src/resources/webhooks.ts → resources/shared.mjs} +2 -2
  147. package/resources/shared.mjs.map +1 -0
  148. package/resources/webhook-events.d.mts +29 -0
  149. package/resources/webhook-events.d.mts.map +1 -0
  150. package/resources/webhook-events.d.ts +29 -0
  151. package/resources/webhook-events.d.ts.map +1 -0
  152. package/resources/{webhooks/events.js → webhook-events.js} +5 -10
  153. package/resources/webhook-events.js.map +1 -0
  154. package/resources/{webhooks/events.mjs → webhook-events.mjs} +3 -8
  155. package/resources/webhook-events.mjs.map +1 -0
  156. package/resources/webhook-subscriptions.d.mts +184 -0
  157. package/resources/webhook-subscriptions.d.mts.map +1 -0
  158. package/resources/webhook-subscriptions.d.ts +184 -0
  159. package/resources/webhook-subscriptions.d.ts.map +1 -0
  160. package/resources/{webhooks/subscriptions.js → webhook-subscriptions.js} +16 -16
  161. package/resources/webhook-subscriptions.js.map +1 -0
  162. package/resources/{webhooks/subscriptions.mjs → webhook-subscriptions.mjs} +14 -14
  163. package/resources/webhook-subscriptions.mjs.map +1 -0
  164. package/src/client.ts +97 -41
  165. package/src/core/api-promise.ts +4 -4
  166. package/src/core/error.ts +2 -2
  167. package/src/core/resource.ts +3 -3
  168. package/src/index.ts +3 -3
  169. package/src/internal/parse.ts +2 -2
  170. package/src/internal/shims.ts +1 -1
  171. package/src/internal/uploads.ts +5 -5
  172. package/src/internal/utils/base64.ts +3 -3
  173. package/src/internal/utils/log.ts +3 -3
  174. package/src/internal/utils/path.ts +2 -2
  175. package/src/internal/utils/values.ts +6 -6
  176. package/src/resources/attachments.ts +81 -106
  177. package/src/resources/capability.ts +98 -0
  178. package/src/resources/chats/chats.ts +130 -771
  179. package/src/resources/chats/index.ts +3 -2
  180. package/src/resources/chats/messages.ts +61 -839
  181. package/src/resources/index.ts +29 -9
  182. package/src/resources/messages.ts +186 -642
  183. package/src/resources/phone-numbers.ts +1 -65
  184. package/src/resources/phonenumbers.ts +72 -0
  185. package/src/resources/shared.ts +6 -0
  186. package/src/resources/webhook-events.ts +57 -0
  187. package/src/resources/webhook-subscriptions.ts +238 -0
  188. package/src/version.ts +1 -1
  189. package/version.d.mts +1 -1
  190. package/version.d.ts +1 -1
  191. package/version.js +1 -1
  192. package/version.mjs +1 -1
  193. package/resources/webhooks/events.d.mts +0 -30
  194. package/resources/webhooks/events.d.mts.map +0 -1
  195. package/resources/webhooks/events.d.ts +0 -30
  196. package/resources/webhooks/events.d.ts.map +0 -1
  197. package/resources/webhooks/events.js.map +0 -1
  198. package/resources/webhooks/events.mjs.map +0 -1
  199. package/resources/webhooks/index.d.mts +0 -4
  200. package/resources/webhooks/index.d.mts.map +0 -1
  201. package/resources/webhooks/index.d.ts +0 -4
  202. package/resources/webhooks/index.d.ts.map +0 -1
  203. package/resources/webhooks/index.js +0 -11
  204. package/resources/webhooks/index.js.map +0 -1
  205. package/resources/webhooks/index.mjs +0 -5
  206. package/resources/webhooks/index.mjs.map +0 -1
  207. package/resources/webhooks/subscriptions.d.mts +0 -237
  208. package/resources/webhooks/subscriptions.d.mts.map +0 -1
  209. package/resources/webhooks/subscriptions.d.ts +0 -237
  210. package/resources/webhooks/subscriptions.d.ts.map +0 -1
  211. package/resources/webhooks/subscriptions.js.map +0 -1
  212. package/resources/webhooks/subscriptions.mjs.map +0 -1
  213. package/resources/webhooks/webhooks.d.mts +0 -14
  214. package/resources/webhooks/webhooks.d.mts.map +0 -1
  215. package/resources/webhooks/webhooks.d.ts +0 -14
  216. package/resources/webhooks/webhooks.d.ts.map +0 -1
  217. package/resources/webhooks/webhooks.js +0 -21
  218. package/resources/webhooks/webhooks.js.map +0 -1
  219. package/resources/webhooks/webhooks.mjs +0 -16
  220. package/resources/webhooks/webhooks.mjs.map +0 -1
  221. package/resources/webhooks.d.mts +0 -2
  222. package/resources/webhooks.d.mts.map +0 -1
  223. package/resources/webhooks.d.ts +0 -2
  224. package/resources/webhooks.d.ts.map +0 -1
  225. package/resources/webhooks.js.map +0 -1
  226. package/resources/webhooks.mjs +0 -3
  227. package/resources/webhooks.mjs.map +0 -1
  228. package/src/resources/webhooks/events.ts +0 -55
  229. package/src/resources/webhooks/index.ts +0 -13
  230. package/src/resources/webhooks/subscriptions.ts +0 -409
  231. package/src/resources/webhooks/webhooks.ts +0 -37
package/src/client.ts CHANGED
@@ -21,34 +21,53 @@ import {
21
21
  AttachmentCreateResponse,
22
22
  AttachmentRetrieveResponse,
23
23
  Attachments,
24
+ SupportedContentType,
24
25
  } from './resources/attachments';
25
26
  import {
27
+ Capability,
28
+ CapabilityCheckImessageParams,
29
+ CapabilityCheckImessageResponse,
30
+ CapabilityCheckRcsParams,
31
+ CapabilityCheckRcsResponse,
32
+ } from './resources/capability';
33
+ import {
34
+ ChatHandle,
35
+ MediaPart,
36
+ Message,
26
37
  MessageAddReactionParams,
27
- MessageAddReactionResponse,
28
38
  MessageDeleteParams,
29
- MessageRetrieveResponse,
39
+ MessageEffect,
30
40
  MessageRetrieveThreadParams,
31
41
  MessageRetrieveThreadResponse,
32
42
  Messages,
43
+ Reaction,
44
+ ReactionType,
45
+ ReplyTo,
46
+ TextPart,
33
47
  } from './resources/messages';
48
+ import { PhoneNumberListResponse, PhoneNumbers } from './resources/phone-numbers';
49
+ import { PhonenumberListResponse, Phonenumbers } from './resources/phonenumbers';
50
+ import { WebhookEventListResponse, WebhookEventType, WebhookEvents } from './resources/webhook-events';
34
51
  import {
35
- PhoneNumberListDeprecatedResponse,
36
- PhoneNumberListResponse,
37
- PhoneNumbers,
38
- } from './resources/phone-numbers';
52
+ WebhookSubscription,
53
+ WebhookSubscriptionCreateParams,
54
+ WebhookSubscriptionCreateResponse,
55
+ WebhookSubscriptionListResponse,
56
+ WebhookSubscriptionUpdateParams,
57
+ WebhookSubscriptions,
58
+ } from './resources/webhook-subscriptions';
39
59
  import {
60
+ Chat,
40
61
  ChatCreateParams,
41
62
  ChatCreateResponse,
42
63
  ChatListParams,
43
64
  ChatListResponse,
44
- ChatRetrieveResponse,
45
65
  ChatSendVoicememoParams,
46
66
  ChatSendVoicememoResponse,
47
67
  ChatUpdateParams,
48
- ChatUpdateResponse,
49
68
  Chats,
69
+ MessageContent,
50
70
  } from './resources/chats/chats';
51
- import { Webhooks } from './resources/webhooks/webhooks';
52
71
  import { type Fetch } from './internal/builtin-types';
53
72
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
54
73
  import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -64,14 +83,17 @@ import { isEmptyObj } from './internal/utils/values';
64
83
 
65
84
  export interface ClientOptions {
66
85
  /**
67
- * Defaults to process.env['LINQ_API_KEY'].
86
+ * Bearer token authentication. Include your API token in the Authorization header.
87
+ *
88
+ * Format: `Authorization: Bearer <your-token>`
89
+ *
68
90
  */
69
91
  apiKey?: string | undefined;
70
92
 
71
93
  /**
72
94
  * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
73
95
  *
74
- * Defaults to process.env['LINQ_BASE_URL'].
96
+ * Defaults to process.env['LINQ_API_V3_BASE_URL'].
75
97
  */
76
98
  baseURL?: string | null | undefined;
77
99
 
@@ -125,7 +147,7 @@ export interface ClientOptions {
125
147
  /**
126
148
  * Set the log level.
127
149
  *
128
- * Defaults to process.env['LINQ_LOG'] or 'warn' if it isn't set.
150
+ * Defaults to process.env['LINQ_API_V3_LOG'] or 'warn' if it isn't set.
129
151
  */
130
152
  logLevel?: LogLevel | undefined;
131
153
 
@@ -138,9 +160,9 @@ export interface ClientOptions {
138
160
  }
139
161
 
140
162
  /**
141
- * API Client for interfacing with the Linq API.
163
+ * API Client for interfacing with the Linq API V3 API.
142
164
  */
143
- export class Linq {
165
+ export class LinqAPIV3 {
144
166
  apiKey: string;
145
167
 
146
168
  baseURL: string;
@@ -156,10 +178,10 @@ export class Linq {
156
178
  private _options: ClientOptions;
157
179
 
158
180
  /**
159
- * API Client for interfacing with the Linq API.
181
+ * API Client for interfacing with the Linq API V3 API.
160
182
  *
161
- * @param {string | undefined} [opts.apiKey=process.env['LINQ_API_KEY'] ?? undefined]
162
- * @param {string} [opts.baseURL=process.env['LINQ_BASE_URL'] ?? https://api.linqapp.com/api/partner] - Override the default base URL for the API.
183
+ * @param {string | undefined} [opts.apiKey=process.env['LINQ_API_V3_API_KEY'] ?? undefined]
184
+ * @param {string} [opts.baseURL=process.env['LINQ_API_V3_BASE_URL'] ?? https://api.linqapp.com/api/partner] - Override the default base URL for the API.
163
185
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
164
186
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
165
187
  * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
@@ -168,13 +190,13 @@ export class Linq {
168
190
  * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
169
191
  */
170
192
  constructor({
171
- baseURL = readEnv('LINQ_BASE_URL'),
172
- apiKey = readEnv('LINQ_API_KEY'),
193
+ baseURL = readEnv('LINQ_API_V3_BASE_URL'),
194
+ apiKey = readEnv('LINQ_API_V3_API_KEY'),
173
195
  ...opts
174
196
  }: ClientOptions = {}) {
175
197
  if (apiKey === undefined) {
176
- throw new Errors.LinqError(
177
- "The LINQ_API_KEY environment variable is missing or empty; either provide it, or instantiate the Linq client with an apiKey option, like new Linq({ apiKey: 'My API Key' }).",
198
+ throw new Errors.LinqAPIV3Error(
199
+ "The LINQ_API_V3_API_KEY environment variable is missing or empty; either provide it, or instantiate the LinqAPIV3 client with an apiKey option, like new LinqAPIV3({ apiKey: 'My API Key' }).",
178
200
  );
179
201
  }
180
202
 
@@ -185,14 +207,14 @@ export class Linq {
185
207
  };
186
208
 
187
209
  this.baseURL = options.baseURL!;
188
- this.timeout = options.timeout ?? Linq.DEFAULT_TIMEOUT /* 1 minute */;
210
+ this.timeout = options.timeout ?? LinqAPIV3.DEFAULT_TIMEOUT /* 1 minute */;
189
211
  this.logger = options.logger ?? console;
190
212
  const defaultLogLevel = 'warn';
191
213
  // Set default logLevel early so that we can log a warning in parseLogLevel.
192
214
  this.logLevel = defaultLogLevel;
193
215
  this.logLevel =
194
216
  parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ??
195
- parseLogLevel(readEnv('LINQ_LOG'), "process.env['LINQ_LOG']", this) ??
217
+ parseLogLevel(readEnv('LINQ_API_V3_LOG'), "process.env['LINQ_API_V3_LOG']", this) ??
196
218
  defaultLogLevel;
197
219
  this.fetchOptions = options.fetchOptions;
198
220
  this.maxRetries = options.maxRetries ?? 2;
@@ -255,7 +277,7 @@ export class Linq {
255
277
  if (value === null) {
256
278
  return `${encodeURIComponent(key)}=`;
257
279
  }
258
- throw new Errors.LinqError(
280
+ throw new Errors.LinqAPIV3Error(
259
281
  `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
260
282
  );
261
283
  })
@@ -742,10 +764,10 @@ export class Linq {
742
764
  }
743
765
  }
744
766
 
745
- static Linq = this;
767
+ static LinqAPIV3 = this;
746
768
  static DEFAULT_TIMEOUT = 60000; // 1 minute
747
769
 
748
- static LinqError = Errors.LinqError;
770
+ static LinqAPIV3Error = Errors.LinqAPIV3Error;
749
771
  static APIError = Errors.APIError;
750
772
  static APIConnectionError = Errors.APIConnectionError;
751
773
  static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
@@ -764,24 +786,30 @@ export class Linq {
764
786
  chats: API.Chats = new API.Chats(this);
765
787
  messages: API.Messages = new API.Messages(this);
766
788
  attachments: API.Attachments = new API.Attachments(this);
789
+ phonenumbers: API.Phonenumbers = new API.Phonenumbers(this);
767
790
  phoneNumbers: API.PhoneNumbers = new API.PhoneNumbers(this);
768
- webhooks: API.Webhooks = new API.Webhooks(this);
791
+ webhookEvents: API.WebhookEvents = new API.WebhookEvents(this);
792
+ webhookSubscriptions: API.WebhookSubscriptions = new API.WebhookSubscriptions(this);
793
+ capability: API.Capability = new API.Capability(this);
769
794
  }
770
795
 
771
- Linq.Chats = Chats;
772
- Linq.Messages = Messages;
773
- Linq.Attachments = Attachments;
774
- Linq.PhoneNumbers = PhoneNumbers;
775
- Linq.Webhooks = Webhooks;
796
+ LinqAPIV3.Chats = Chats;
797
+ LinqAPIV3.Messages = Messages;
798
+ LinqAPIV3.Attachments = Attachments;
799
+ LinqAPIV3.Phonenumbers = Phonenumbers;
800
+ LinqAPIV3.PhoneNumbers = PhoneNumbers;
801
+ LinqAPIV3.WebhookEvents = WebhookEvents;
802
+ LinqAPIV3.WebhookSubscriptions = WebhookSubscriptions;
803
+ LinqAPIV3.Capability = Capability;
776
804
 
777
- export declare namespace Linq {
805
+ export declare namespace LinqAPIV3 {
778
806
  export type RequestOptions = Opts.RequestOptions;
779
807
 
780
808
  export {
781
809
  Chats as Chats,
810
+ type Chat as Chat,
811
+ type MessageContent as MessageContent,
782
812
  type ChatCreateResponse as ChatCreateResponse,
783
- type ChatRetrieveResponse as ChatRetrieveResponse,
784
- type ChatUpdateResponse as ChatUpdateResponse,
785
813
  type ChatListResponse as ChatListResponse,
786
814
  type ChatSendVoicememoResponse as ChatSendVoicememoResponse,
787
815
  type ChatCreateParams as ChatCreateParams,
@@ -792,8 +820,14 @@ export declare namespace Linq {
792
820
 
793
821
  export {
794
822
  Messages as Messages,
795
- type MessageRetrieveResponse as MessageRetrieveResponse,
796
- type MessageAddReactionResponse as MessageAddReactionResponse,
823
+ type ChatHandle as ChatHandle,
824
+ type MediaPart as MediaPart,
825
+ type Message as Message,
826
+ type MessageEffect as MessageEffect,
827
+ type Reaction as Reaction,
828
+ type ReactionType as ReactionType,
829
+ type ReplyTo as ReplyTo,
830
+ type TextPart as TextPart,
797
831
  type MessageRetrieveThreadResponse as MessageRetrieveThreadResponse,
798
832
  type MessageDeleteParams as MessageDeleteParams,
799
833
  type MessageAddReactionParams as MessageAddReactionParams,
@@ -802,16 +836,38 @@ export declare namespace Linq {
802
836
 
803
837
  export {
804
838
  Attachments as Attachments,
839
+ type SupportedContentType as SupportedContentType,
805
840
  type AttachmentCreateResponse as AttachmentCreateResponse,
806
841
  type AttachmentRetrieveResponse as AttachmentRetrieveResponse,
807
842
  type AttachmentCreateParams as AttachmentCreateParams,
808
843
  };
809
844
 
845
+ export { Phonenumbers as Phonenumbers, type PhonenumberListResponse as PhonenumberListResponse };
846
+
847
+ export { PhoneNumbers as PhoneNumbers, type PhoneNumberListResponse as PhoneNumberListResponse };
848
+
849
+ export {
850
+ WebhookEvents as WebhookEvents,
851
+ type WebhookEventType as WebhookEventType,
852
+ type WebhookEventListResponse as WebhookEventListResponse,
853
+ };
854
+
855
+ export {
856
+ WebhookSubscriptions as WebhookSubscriptions,
857
+ type WebhookSubscription as WebhookSubscription,
858
+ type WebhookSubscriptionCreateResponse as WebhookSubscriptionCreateResponse,
859
+ type WebhookSubscriptionListResponse as WebhookSubscriptionListResponse,
860
+ type WebhookSubscriptionCreateParams as WebhookSubscriptionCreateParams,
861
+ type WebhookSubscriptionUpdateParams as WebhookSubscriptionUpdateParams,
862
+ };
863
+
810
864
  export {
811
- PhoneNumbers as PhoneNumbers,
812
- type PhoneNumberListResponse as PhoneNumberListResponse,
813
- type PhoneNumberListDeprecatedResponse as PhoneNumberListDeprecatedResponse,
865
+ Capability as Capability,
866
+ type CapabilityCheckImessageResponse as CapabilityCheckImessageResponse,
867
+ type CapabilityCheckRcsResponse as CapabilityCheckRcsResponse,
868
+ type CapabilityCheckImessageParams as CapabilityCheckImessageParams,
869
+ type CapabilityCheckRcsParams as CapabilityCheckRcsParams,
814
870
  };
815
871
 
816
- export { Webhooks as Webhooks };
872
+ export type ServiceType = API.ServiceType;
817
873
  }
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { type Linq } from '../client';
3
+ import { type LinqAPIV3 } from '../client';
4
4
 
5
5
  import { type PromiseOrValue } from '../internal/types';
6
6
  import { APIResponseProps, defaultParseResponse } from '../internal/parse';
@@ -11,13 +11,13 @@ import { APIResponseProps, defaultParseResponse } from '../internal/parse';
11
11
  */
12
12
  export class APIPromise<T> extends Promise<T> {
13
13
  private parsedPromise: Promise<T> | undefined;
14
- #client: Linq;
14
+ #client: LinqAPIV3;
15
15
 
16
16
  constructor(
17
- client: Linq,
17
+ client: LinqAPIV3,
18
18
  private responsePromise: Promise<APIResponseProps>,
19
19
  private parseResponse: (
20
- client: Linq,
20
+ client: LinqAPIV3,
21
21
  props: APIResponseProps,
22
22
  ) => PromiseOrValue<T> = defaultParseResponse,
23
23
  ) {
package/src/core/error.ts CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  import { castToError } from '../internal/errors';
4
4
 
5
- export class LinqError extends Error {}
5
+ export class LinqAPIV3Error extends Error {}
6
6
 
7
7
  export class APIError<
8
8
  TStatus extends number | undefined = number | undefined,
9
9
  THeaders extends Headers | undefined = Headers | undefined,
10
10
  TError extends Object | undefined = Object | undefined,
11
- > extends LinqError {
11
+ > extends LinqAPIV3Error {
12
12
  /** HTTP status for the response that caused the error */
13
13
  readonly status: TStatus;
14
14
  /** HTTP headers for the response that caused the error */
@@ -1,11 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import type { Linq } from '../client';
3
+ import type { LinqAPIV3 } from '../client';
4
4
 
5
5
  export abstract class APIResource {
6
- protected _client: Linq;
6
+ protected _client: LinqAPIV3;
7
7
 
8
- constructor(client: Linq) {
8
+ constructor(client: LinqAPIV3) {
9
9
  this._client = client;
10
10
  }
11
11
  }
package/src/index.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export { Linq as default } from './client';
3
+ export { LinqAPIV3 as default } from './client';
4
4
 
5
5
  export { type Uploadable, toFile } from './core/uploads';
6
6
  export { APIPromise } from './core/api-promise';
7
- export { Linq, type ClientOptions } from './client';
7
+ export { LinqAPIV3, type ClientOptions } from './client';
8
8
  export {
9
- LinqError,
9
+ LinqAPIV3Error,
10
10
  APIError,
11
11
  APIConnectionError,
12
12
  APIConnectionTimeoutError,
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import type { FinalRequestOptions } from './request-options';
4
- import { type Linq } from '../client';
4
+ import { type LinqAPIV3 } from '../client';
5
5
  import { formatRequestDetails, loggerFor } from './utils/log';
6
6
 
7
7
  export type APIResponseProps = {
@@ -13,7 +13,7 @@ export type APIResponseProps = {
13
13
  startTime: number;
14
14
  };
15
15
 
16
- export async function defaultParseResponse<T>(client: Linq, props: APIResponseProps): Promise<T> {
16
+ export async function defaultParseResponse<T>(client: LinqAPIV3, props: APIResponseProps): Promise<T> {
17
17
  const { response, requestLogID, retryOfRequestLogID, startTime } = props;
18
18
  const body = await (async () => {
19
19
  // fetch refuses to read the body when the status code is 204.
@@ -16,7 +16,7 @@ export function getDefaultFetch(): Fetch {
16
16
  }
17
17
 
18
18
  throw new Error(
19
- '`fetch` is not defined as a global; Either pass `fetch` to the client, `new Linq({ fetch })` or polyfill the global, `globalThis.fetch = fetch`',
19
+ '`fetch` is not defined as a global; Either pass `fetch` to the client, `new LinqAPIV3({ fetch })` or polyfill the global, `globalThis.fetch = fetch`',
20
20
  );
21
21
  }
22
22
 
@@ -1,6 +1,6 @@
1
1
  import { type RequestOptions } from './request-options';
2
2
  import type { FilePropertyBag, Fetch } from './builtin-types';
3
- import type { Linq } from '../client';
3
+ import type { LinqAPIV3 } from '../client';
4
4
  import { ReadableStreamFrom } from './shims';
5
5
 
6
6
  export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView;
@@ -74,7 +74,7 @@ export const isAsyncIterable = (value: any): value is AsyncIterable<any> =>
74
74
  */
75
75
  export const maybeMultipartFormRequestOptions = async (
76
76
  opts: RequestOptions,
77
- fetch: Linq | Fetch,
77
+ fetch: LinqAPIV3 | Fetch,
78
78
  ): Promise<RequestOptions> => {
79
79
  if (!hasUploadableValue(opts.body)) return opts;
80
80
 
@@ -85,7 +85,7 @@ type MultipartFormRequestOptions = Omit<RequestOptions, 'body'> & { body: unknow
85
85
 
86
86
  export const multipartFormRequestOptions = async (
87
87
  opts: MultipartFormRequestOptions,
88
- fetch: Linq | Fetch,
88
+ fetch: LinqAPIV3 | Fetch,
89
89
  ): Promise<RequestOptions> => {
90
90
  return { ...opts, body: await createForm(opts.body, fetch) };
91
91
  };
@@ -98,7 +98,7 @@ const supportsFormDataMap = /* @__PURE__ */ new WeakMap<Fetch, Promise<boolean>>
98
98
  * This function detects if the fetch function provided supports the global FormData object to avoid
99
99
  * confusing error messages later on.
100
100
  */
101
- function supportsFormData(fetchObject: Linq | Fetch): Promise<boolean> {
101
+ function supportsFormData(fetchObject: LinqAPIV3 | Fetch): Promise<boolean> {
102
102
  const fetch: Fetch = typeof fetchObject === 'function' ? fetchObject : (fetchObject as any).fetch;
103
103
  const cached = supportsFormDataMap.get(fetch);
104
104
  if (cached) return cached;
@@ -124,7 +124,7 @@ function supportsFormData(fetchObject: Linq | Fetch): Promise<boolean> {
124
124
 
125
125
  export const createForm = async <T = Record<string, unknown>>(
126
126
  body: T | undefined,
127
- fetch: Linq | Fetch,
127
+ fetch: LinqAPIV3 | Fetch,
128
128
  ): Promise<FormData> => {
129
129
  if (!(await supportsFormData(fetch))) {
130
130
  throw new TypeError(
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { LinqError } from '../../core/error';
3
+ import { LinqAPIV3Error } from '../../core/error';
4
4
  import { encodeUTF8 } from './bytes';
5
5
 
6
6
  export const toBase64 = (data: string | Uint8Array | null | undefined): string => {
@@ -18,7 +18,7 @@ export const toBase64 = (data: string | Uint8Array | null | undefined): string =
18
18
  return btoa(String.fromCharCode.apply(null, data as any));
19
19
  }
20
20
 
21
- throw new LinqError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
21
+ throw new LinqAPIV3Error('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
22
22
  };
23
23
 
24
24
  export const fromBase64 = (str: string): Uint8Array => {
@@ -36,5 +36,5 @@ export const fromBase64 = (str: string): Uint8Array => {
36
36
  return buf;
37
37
  }
38
38
 
39
- throw new LinqError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
39
+ throw new LinqAPIV3Error('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
40
40
  };
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { hasOwn } from './values';
4
- import { type Linq } from '../../client';
4
+ import { type LinqAPIV3 } from '../../client';
5
5
  import { RequestOptions } from '../request-options';
6
6
 
7
7
  type LogFn = (message: string, ...rest: unknown[]) => void;
@@ -24,7 +24,7 @@ const levelNumbers = {
24
24
  export const parseLogLevel = (
25
25
  maybeLevel: string | undefined,
26
26
  sourceName: string,
27
- client: Linq,
27
+ client: LinqAPIV3,
28
28
  ): LogLevel | undefined => {
29
29
  if (!maybeLevel) {
30
30
  return undefined;
@@ -60,7 +60,7 @@ const noopLogger = {
60
60
 
61
61
  let cachedLoggers = /* @__PURE__ */ new WeakMap<Logger, [LogLevel, Logger]>();
62
62
 
63
- export function loggerFor(client: Linq): Logger {
63
+ export function loggerFor(client: LinqAPIV3): Logger {
64
64
  const logger = client.logger;
65
65
  const logLevel = client.logLevel ?? 'off';
66
66
  if (!logger) {
@@ -1,4 +1,4 @@
1
- import { LinqError } from '../../core/error';
1
+ import { LinqAPIV3Error } from '../../core/error';
2
2
 
3
3
  /**
4
4
  * Percent-encode everything that isn't safe to have in a path without encoding safe chars.
@@ -72,7 +72,7 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
72
72
  return acc + spaces + arrows;
73
73
  }, '');
74
74
 
75
- throw new LinqError(
75
+ throw new LinqAPIV3Error(
76
76
  `Path parameters result in path with invalid segments:\n${invalidSegments
77
77
  .map((e) => e.error)
78
78
  .join('\n')}\n${path}\n${underline}`,
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { LinqError } from '../../core/error';
3
+ import { LinqAPIV3Error } from '../../core/error';
4
4
 
5
5
  // https://url.spec.whatwg.org/#url-scheme-string
6
6
  const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
@@ -39,7 +39,7 @@ export function isObj(obj: unknown): obj is Record<string, unknown> {
39
39
 
40
40
  export const ensurePresent = <T>(value: T | null | undefined): T => {
41
41
  if (value == null) {
42
- throw new LinqError(`Expected a value to be given but received ${value} instead.`);
42
+ throw new LinqAPIV3Error(`Expected a value to be given but received ${value} instead.`);
43
43
  }
44
44
 
45
45
  return value;
@@ -47,10 +47,10 @@ export const ensurePresent = <T>(value: T | null | undefined): T => {
47
47
 
48
48
  export const validatePositiveInteger = (name: string, n: unknown): number => {
49
49
  if (typeof n !== 'number' || !Number.isInteger(n)) {
50
- throw new LinqError(`${name} must be an integer`);
50
+ throw new LinqAPIV3Error(`${name} must be an integer`);
51
51
  }
52
52
  if (n < 0) {
53
- throw new LinqError(`${name} must be a positive integer`);
53
+ throw new LinqAPIV3Error(`${name} must be a positive integer`);
54
54
  }
55
55
  return n;
56
56
  };
@@ -59,14 +59,14 @@ export const coerceInteger = (value: unknown): number => {
59
59
  if (typeof value === 'number') return Math.round(value);
60
60
  if (typeof value === 'string') return parseInt(value, 10);
61
61
 
62
- throw new LinqError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
62
+ throw new LinqAPIV3Error(`Could not coerce ${value} (type: ${typeof value}) into a number`);
63
63
  };
64
64
 
65
65
  export const coerceFloat = (value: unknown): number => {
66
66
  if (typeof value === 'number') return value;
67
67
  if (typeof value === 'string') return parseFloat(value);
68
68
 
69
- throw new LinqError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
69
+ throw new LinqAPIV3Error(`Could not coerce ${value} (type: ${typeof value}) into a number`);
70
70
  };
71
71
 
72
72
  export const coerceBoolean = (value: unknown): boolean => {