@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
package/src/client.ts CHANGED
@@ -21,34 +21,54 @@ 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,
70
+ ServiceType,
50
71
  } from './resources/chats/chats';
51
- import { Webhooks } from './resources/webhooks/webhooks';
52
72
  import { type Fetch } from './internal/builtin-types';
53
73
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
54
74
  import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -64,14 +84,17 @@ import { isEmptyObj } from './internal/utils/values';
64
84
 
65
85
  export interface ClientOptions {
66
86
  /**
67
- * Defaults to process.env['LINQ_API_KEY'].
87
+ * Bearer token authentication. Include your API token in the Authorization header.
88
+ *
89
+ * Format: `Authorization: Bearer <your-token>`
90
+ *
68
91
  */
69
92
  apiKey?: string | undefined;
70
93
 
71
94
  /**
72
95
  * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
73
96
  *
74
- * Defaults to process.env['LINQ_BASE_URL'].
97
+ * Defaults to process.env['LINQ_API_V3_BASE_URL'].
75
98
  */
76
99
  baseURL?: string | null | undefined;
77
100
 
@@ -125,7 +148,7 @@ export interface ClientOptions {
125
148
  /**
126
149
  * Set the log level.
127
150
  *
128
- * Defaults to process.env['LINQ_LOG'] or 'warn' if it isn't set.
151
+ * Defaults to process.env['LINQ_API_V3_LOG'] or 'warn' if it isn't set.
129
152
  */
130
153
  logLevel?: LogLevel | undefined;
131
154
 
@@ -138,9 +161,9 @@ export interface ClientOptions {
138
161
  }
139
162
 
140
163
  /**
141
- * API Client for interfacing with the Linq API.
164
+ * API Client for interfacing with the Linq API V3 API.
142
165
  */
143
- export class Linq {
166
+ export class LinqAPIV3 {
144
167
  apiKey: string;
145
168
 
146
169
  baseURL: string;
@@ -156,10 +179,10 @@ export class Linq {
156
179
  private _options: ClientOptions;
157
180
 
158
181
  /**
159
- * API Client for interfacing with the Linq API.
182
+ * API Client for interfacing with the Linq API V3 API.
160
183
  *
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.
184
+ * @param {string | undefined} [opts.apiKey=process.env['LINQ_API_V3_API_KEY'] ?? undefined]
185
+ * @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
186
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
164
187
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
165
188
  * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
@@ -168,13 +191,13 @@ export class Linq {
168
191
  * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
169
192
  */
170
193
  constructor({
171
- baseURL = readEnv('LINQ_BASE_URL'),
172
- apiKey = readEnv('LINQ_API_KEY'),
194
+ baseURL = readEnv('LINQ_API_V3_BASE_URL'),
195
+ apiKey = readEnv('LINQ_API_V3_API_KEY'),
173
196
  ...opts
174
197
  }: ClientOptions = {}) {
175
198
  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' }).",
199
+ throw new Errors.LinqAPIV3Error(
200
+ "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
201
  );
179
202
  }
180
203
 
@@ -185,14 +208,14 @@ export class Linq {
185
208
  };
186
209
 
187
210
  this.baseURL = options.baseURL!;
188
- this.timeout = options.timeout ?? Linq.DEFAULT_TIMEOUT /* 1 minute */;
211
+ this.timeout = options.timeout ?? LinqAPIV3.DEFAULT_TIMEOUT /* 1 minute */;
189
212
  this.logger = options.logger ?? console;
190
213
  const defaultLogLevel = 'warn';
191
214
  // Set default logLevel early so that we can log a warning in parseLogLevel.
192
215
  this.logLevel = defaultLogLevel;
193
216
  this.logLevel =
194
217
  parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ??
195
- parseLogLevel(readEnv('LINQ_LOG'), "process.env['LINQ_LOG']", this) ??
218
+ parseLogLevel(readEnv('LINQ_API_V3_LOG'), "process.env['LINQ_API_V3_LOG']", this) ??
196
219
  defaultLogLevel;
197
220
  this.fetchOptions = options.fetchOptions;
198
221
  this.maxRetries = options.maxRetries ?? 2;
@@ -255,7 +278,7 @@ export class Linq {
255
278
  if (value === null) {
256
279
  return `${encodeURIComponent(key)}=`;
257
280
  }
258
- throw new Errors.LinqError(
281
+ throw new Errors.LinqAPIV3Error(
259
282
  `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
283
  );
261
284
  })
@@ -742,10 +765,10 @@ export class Linq {
742
765
  }
743
766
  }
744
767
 
745
- static Linq = this;
768
+ static LinqAPIV3 = this;
746
769
  static DEFAULT_TIMEOUT = 60000; // 1 minute
747
770
 
748
- static LinqError = Errors.LinqError;
771
+ static LinqAPIV3Error = Errors.LinqAPIV3Error;
749
772
  static APIError = Errors.APIError;
750
773
  static APIConnectionError = Errors.APIConnectionError;
751
774
  static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
@@ -764,24 +787,31 @@ export class Linq {
764
787
  chats: API.Chats = new API.Chats(this);
765
788
  messages: API.Messages = new API.Messages(this);
766
789
  attachments: API.Attachments = new API.Attachments(this);
790
+ phonenumbers: API.Phonenumbers = new API.Phonenumbers(this);
767
791
  phoneNumbers: API.PhoneNumbers = new API.PhoneNumbers(this);
768
- webhooks: API.Webhooks = new API.Webhooks(this);
792
+ webhookEvents: API.WebhookEvents = new API.WebhookEvents(this);
793
+ webhookSubscriptions: API.WebhookSubscriptions = new API.WebhookSubscriptions(this);
794
+ capability: API.Capability = new API.Capability(this);
769
795
  }
770
796
 
771
- Linq.Chats = Chats;
772
- Linq.Messages = Messages;
773
- Linq.Attachments = Attachments;
774
- Linq.PhoneNumbers = PhoneNumbers;
775
- Linq.Webhooks = Webhooks;
797
+ LinqAPIV3.Chats = Chats;
798
+ LinqAPIV3.Messages = Messages;
799
+ LinqAPIV3.Attachments = Attachments;
800
+ LinqAPIV3.Phonenumbers = Phonenumbers;
801
+ LinqAPIV3.PhoneNumbers = PhoneNumbers;
802
+ LinqAPIV3.WebhookEvents = WebhookEvents;
803
+ LinqAPIV3.WebhookSubscriptions = WebhookSubscriptions;
804
+ LinqAPIV3.Capability = Capability;
776
805
 
777
- export declare namespace Linq {
806
+ export declare namespace LinqAPIV3 {
778
807
  export type RequestOptions = Opts.RequestOptions;
779
808
 
780
809
  export {
781
810
  Chats as Chats,
811
+ type Chat as Chat,
812
+ type MessageContent as MessageContent,
813
+ type ServiceType as ServiceType,
782
814
  type ChatCreateResponse as ChatCreateResponse,
783
- type ChatRetrieveResponse as ChatRetrieveResponse,
784
- type ChatUpdateResponse as ChatUpdateResponse,
785
815
  type ChatListResponse as ChatListResponse,
786
816
  type ChatSendVoicememoResponse as ChatSendVoicememoResponse,
787
817
  type ChatCreateParams as ChatCreateParams,
@@ -792,8 +822,14 @@ export declare namespace Linq {
792
822
 
793
823
  export {
794
824
  Messages as Messages,
795
- type MessageRetrieveResponse as MessageRetrieveResponse,
796
- type MessageAddReactionResponse as MessageAddReactionResponse,
825
+ type ChatHandle as ChatHandle,
826
+ type MediaPart as MediaPart,
827
+ type Message as Message,
828
+ type MessageEffect as MessageEffect,
829
+ type Reaction as Reaction,
830
+ type ReactionType as ReactionType,
831
+ type ReplyTo as ReplyTo,
832
+ type TextPart as TextPart,
797
833
  type MessageRetrieveThreadResponse as MessageRetrieveThreadResponse,
798
834
  type MessageDeleteParams as MessageDeleteParams,
799
835
  type MessageAddReactionParams as MessageAddReactionParams,
@@ -802,16 +838,36 @@ export declare namespace Linq {
802
838
 
803
839
  export {
804
840
  Attachments as Attachments,
841
+ type SupportedContentType as SupportedContentType,
805
842
  type AttachmentCreateResponse as AttachmentCreateResponse,
806
843
  type AttachmentRetrieveResponse as AttachmentRetrieveResponse,
807
844
  type AttachmentCreateParams as AttachmentCreateParams,
808
845
  };
809
846
 
847
+ export { Phonenumbers as Phonenumbers, type PhonenumberListResponse as PhonenumberListResponse };
848
+
849
+ export { PhoneNumbers as PhoneNumbers, type PhoneNumberListResponse as PhoneNumberListResponse };
850
+
851
+ export {
852
+ WebhookEvents as WebhookEvents,
853
+ type WebhookEventType as WebhookEventType,
854
+ type WebhookEventListResponse as WebhookEventListResponse,
855
+ };
856
+
810
857
  export {
811
- PhoneNumbers as PhoneNumbers,
812
- type PhoneNumberListResponse as PhoneNumberListResponse,
813
- type PhoneNumberListDeprecatedResponse as PhoneNumberListDeprecatedResponse,
858
+ WebhookSubscriptions as WebhookSubscriptions,
859
+ type WebhookSubscription as WebhookSubscription,
860
+ type WebhookSubscriptionCreateResponse as WebhookSubscriptionCreateResponse,
861
+ type WebhookSubscriptionListResponse as WebhookSubscriptionListResponse,
862
+ type WebhookSubscriptionCreateParams as WebhookSubscriptionCreateParams,
863
+ type WebhookSubscriptionUpdateParams as WebhookSubscriptionUpdateParams,
814
864
  };
815
865
 
816
- export { Webhooks as Webhooks };
866
+ export {
867
+ Capability as Capability,
868
+ type CapabilityCheckImessageResponse as CapabilityCheckImessageResponse,
869
+ type CapabilityCheckRcsResponse as CapabilityCheckRcsResponse,
870
+ type CapabilityCheckImessageParams as CapabilityCheckImessageParams,
871
+ type CapabilityCheckRcsParams as CapabilityCheckRcsParams,
872
+ };
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 => {