@seamapi/http 1.64.0 → 1.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/connect.cjs +136 -0
  2. package/dist/connect.cjs.map +1 -1
  3. package/dist/connect.d.cts +61 -16
  4. package/dist/index.cjs +138 -0
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +1 -1
  7. package/lib/seam/connect/resolve-action-attempt.d.ts +16 -16
  8. package/lib/seam/connect/routes/customers/customers.d.ts +13 -0
  9. package/lib/seam/connect/routes/customers/customers.js +9 -0
  10. package/lib/seam/connect/routes/customers/customers.js.map +1 -1
  11. package/lib/seam/connect/routes/seam/console/v1/index.d.ts +1 -0
  12. package/lib/seam/connect/routes/seam/console/v1/index.js +1 -0
  13. package/lib/seam/connect/routes/seam/console/v1/index.js.map +1 -1
  14. package/lib/seam/connect/routes/seam/console/v1/timelines/index.d.ts +1 -0
  15. package/lib/seam/connect/routes/seam/console/v1/timelines/index.js +6 -0
  16. package/lib/seam/connect/routes/seam/console/v1/timelines/index.js.map +1 -0
  17. package/lib/seam/connect/routes/seam/console/v1/timelines/timelines.d.ts +34 -0
  18. package/lib/seam/connect/routes/seam/console/v1/timelines/timelines.js +102 -0
  19. package/lib/seam/connect/routes/seam/console/v1/timelines/timelines.js.map +1 -0
  20. package/lib/seam/connect/routes/seam/console/v1/v1.d.ts +2 -0
  21. package/lib/seam/connect/routes/seam/console/v1/v1.js +4 -0
  22. package/lib/seam/connect/routes/seam/console/v1/v1.js.map +1 -1
  23. package/lib/seam/connect/routes/seam-http-endpoints.d.ts +7 -4
  24. package/lib/seam/connect/routes/seam-http-endpoints.js +18 -0
  25. package/lib/seam/connect/routes/seam-http-endpoints.js.map +1 -1
  26. package/lib/version.d.ts +1 -1
  27. package/lib/version.js +1 -1
  28. package/package.json +3 -3
  29. package/src/lib/seam/connect/routes/customers/customers.ts +33 -0
  30. package/src/lib/seam/connect/routes/seam/console/v1/index.ts +1 -0
  31. package/src/lib/seam/connect/routes/seam/console/v1/timelines/index.ts +6 -0
  32. package/src/lib/seam/connect/routes/seam/console/v1/timelines/timelines.ts +212 -0
  33. package/src/lib/seam/connect/routes/seam/console/v1/v1.ts +6 -0
  34. package/src/lib/seam/connect/routes/seam-http-endpoints.ts +43 -0
  35. package/src/lib/version.ts +1 -1
@@ -3,4 +3,5 @@
3
3
  * Do not edit this file or add other files to this directory.
4
4
  */
5
5
 
6
+ export * from './timelines/index.js'
6
7
  export * from './v1.js'
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Automatically generated by codegen/smith.ts.
3
+ * Do not edit this file or add other files to this directory.
4
+ */
5
+
6
+ export * from './timelines.js'
@@ -0,0 +1,212 @@
1
+ /*
2
+ * Automatically generated by codegen/smith.ts.
3
+ * Do not edit this file or add other files to this directory.
4
+ */
5
+
6
+ import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
7
+
8
+ import { seamApiLtsVersion } from 'lib/lts-version.js'
9
+ import {
10
+ getAuthHeadersForClientSessionToken,
11
+ warnOnInsecureuserIdentifierKey,
12
+ } from 'lib/seam/connect/auth.js'
13
+ import { type Client, createClient } from 'lib/seam/connect/client.js'
14
+ import {
15
+ isSeamHttpOptionsWithApiKey,
16
+ isSeamHttpOptionsWithClient,
17
+ isSeamHttpOptionsWithClientSessionToken,
18
+ isSeamHttpOptionsWithConsoleSessionToken,
19
+ isSeamHttpOptionsWithPersonalAccessToken,
20
+ type SeamHttpFromPublishableKeyOptions,
21
+ SeamHttpInvalidOptionsError,
22
+ type SeamHttpOptions,
23
+ type SeamHttpOptionsWithApiKey,
24
+ type SeamHttpOptionsWithClient,
25
+ type SeamHttpOptionsWithClientSessionToken,
26
+ type SeamHttpOptionsWithConsoleSessionToken,
27
+ type SeamHttpOptionsWithPersonalAccessToken,
28
+ type SeamHttpRequestOptions,
29
+ } from 'lib/seam/connect/options.js'
30
+ import {
31
+ limitToSeamHttpRequestOptions,
32
+ parseOptions,
33
+ } from 'lib/seam/connect/parse-options.js'
34
+ import { SeamHttpClientSessions } from 'lib/seam/connect/routes/client-sessions/index.js'
35
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
36
+ import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
37
+ import type { SetNonNullable } from 'lib/types.js'
38
+
39
+ export class SeamHttpSeamConsoleV1Timelines {
40
+ client: Client
41
+ readonly defaults: Required<SeamHttpRequestOptions>
42
+ readonly ltsVersion = seamApiLtsVersion
43
+ static ltsVersion = seamApiLtsVersion
44
+
45
+ constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
46
+ const options = parseOptions(apiKeyOrOptions)
47
+ if (!options.isUndocumentedApiEnabled) {
48
+ throw new Error(
49
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
50
+ )
51
+ }
52
+ this.client = 'client' in options ? options.client : createClient(options)
53
+ this.defaults = limitToSeamHttpRequestOptions(options)
54
+ }
55
+
56
+ static fromClient(
57
+ client: SeamHttpOptionsWithClient['client'],
58
+ options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
59
+ ): SeamHttpSeamConsoleV1Timelines {
60
+ const constructorOptions = { ...options, client }
61
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
62
+ throw new SeamHttpInvalidOptionsError('Missing client')
63
+ }
64
+ return new SeamHttpSeamConsoleV1Timelines(constructorOptions)
65
+ }
66
+
67
+ static fromApiKey(
68
+ apiKey: SeamHttpOptionsWithApiKey['apiKey'],
69
+ options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
70
+ ): SeamHttpSeamConsoleV1Timelines {
71
+ const constructorOptions = { ...options, apiKey }
72
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
73
+ throw new SeamHttpInvalidOptionsError('Missing apiKey')
74
+ }
75
+ return new SeamHttpSeamConsoleV1Timelines(constructorOptions)
76
+ }
77
+
78
+ static fromClientSessionToken(
79
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
80
+ options: Omit<
81
+ SeamHttpOptionsWithClientSessionToken,
82
+ 'clientSessionToken'
83
+ > = {},
84
+ ): SeamHttpSeamConsoleV1Timelines {
85
+ const constructorOptions = { ...options, clientSessionToken }
86
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
87
+ throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
88
+ }
89
+ return new SeamHttpSeamConsoleV1Timelines(constructorOptions)
90
+ }
91
+
92
+ static async fromPublishableKey(
93
+ publishableKey: string,
94
+ userIdentifierKey: string,
95
+ options: SeamHttpFromPublishableKeyOptions = {},
96
+ ): Promise<SeamHttpSeamConsoleV1Timelines> {
97
+ warnOnInsecureuserIdentifierKey(userIdentifierKey)
98
+ const clientOptions = parseOptions({ ...options, publishableKey })
99
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
100
+ throw new SeamHttpInvalidOptionsError(
101
+ 'The client option cannot be used with SeamHttpSeamConsoleV1Timelines.fromPublishableKey',
102
+ )
103
+ }
104
+ const client = createClient(clientOptions)
105
+ const clientSessions = SeamHttpClientSessions.fromClient(client)
106
+ const { token } = await clientSessions.getOrCreate({
107
+ user_identifier_key: userIdentifierKey,
108
+ })
109
+ return SeamHttpSeamConsoleV1Timelines.fromClientSessionToken(token, options)
110
+ }
111
+
112
+ static fromConsoleSessionToken(
113
+ consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
114
+ workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
115
+ options: Omit<
116
+ SeamHttpOptionsWithConsoleSessionToken,
117
+ 'consoleSessionToken' | 'workspaceId'
118
+ > = {},
119
+ ): SeamHttpSeamConsoleV1Timelines {
120
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId }
121
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
122
+ throw new SeamHttpInvalidOptionsError(
123
+ 'Missing consoleSessionToken or workspaceId',
124
+ )
125
+ }
126
+ return new SeamHttpSeamConsoleV1Timelines(constructorOptions)
127
+ }
128
+
129
+ static fromPersonalAccessToken(
130
+ personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
131
+ workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
132
+ options: Omit<
133
+ SeamHttpOptionsWithPersonalAccessToken,
134
+ 'personalAccessToken' | 'workspaceId'
135
+ > = {},
136
+ ): SeamHttpSeamConsoleV1Timelines {
137
+ const constructorOptions = { ...options, personalAccessToken, workspaceId }
138
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
139
+ throw new SeamHttpInvalidOptionsError(
140
+ 'Missing personalAccessToken or workspaceId',
141
+ )
142
+ }
143
+ return new SeamHttpSeamConsoleV1Timelines(constructorOptions)
144
+ }
145
+
146
+ createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
147
+ request: SeamHttpRequest<TResponse, TResponseKey>,
148
+ ): SeamPaginator<TResponse, TResponseKey> {
149
+ return new SeamPaginator<TResponse, TResponseKey>(this, request)
150
+ }
151
+
152
+ async updateClientSessionToken(
153
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
154
+ ): Promise<void> {
155
+ const { headers } = this.client.defaults
156
+ const authHeaders = getAuthHeadersForClientSessionToken({
157
+ clientSessionToken,
158
+ })
159
+ for (const key of Object.keys(authHeaders)) {
160
+ if (headers[key] == null) {
161
+ throw new Error(
162
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
163
+ )
164
+ }
165
+ }
166
+ this.client.defaults.headers = { ...headers, ...authHeaders }
167
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
168
+ await clientSessions.get()
169
+ }
170
+
171
+ get(
172
+ parameters?: SeamConsoleV1TimelinesGetParameters,
173
+ options: SeamConsoleV1TimelinesGetOptions = {},
174
+ ): SeamConsoleV1TimelinesGetRequest {
175
+ if (!this.defaults.isUndocumentedApiEnabled) {
176
+ throw new Error(
177
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
178
+ )
179
+ }
180
+ return new SeamHttpRequest(this, {
181
+ pathname: '/seam/console/v1/timelines/get',
182
+ method: 'POST',
183
+ body: parameters,
184
+ responseKey: 'timeline',
185
+ options,
186
+ })
187
+ }
188
+ }
189
+
190
+ export type SeamConsoleV1TimelinesGetParameters =
191
+ RouteRequestBody<'/seam/console/v1/timelines/get'>
192
+
193
+ /**
194
+ * @deprecated Use SeamConsoleV1TimelinesGetParameters instead.
195
+ */
196
+ export type SeamConsoleV1TimelinesGetParams =
197
+ SeamConsoleV1TimelinesGetParameters
198
+
199
+ /**
200
+ * @deprecated Use SeamConsoleV1TimelinesGetRequest instead.
201
+ */
202
+ export type SeamConsoleV1TimelinesGetResponse = SetNonNullable<
203
+ Required<RouteResponse<'/seam/console/v1/timelines/get'>>
204
+ >
205
+
206
+ export type SeamConsoleV1TimelinesGetRequest = SeamHttpRequest<
207
+ SeamConsoleV1TimelinesGetResponse,
208
+ 'timeline'
209
+ >
210
+
211
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
212
+ export interface SeamConsoleV1TimelinesGetOptions {}
@@ -36,6 +36,8 @@ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
36
36
  import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
37
37
  import type { SetNonNullable } from 'lib/types.js'
38
38
 
39
+ import { SeamHttpSeamConsoleV1Timelines } from './timelines/index.js'
40
+
39
41
  export class SeamHttpSeamConsoleV1 {
40
42
  client: Client
41
43
  readonly defaults: Required<SeamHttpRequestOptions>
@@ -168,6 +170,10 @@ export class SeamHttpSeamConsoleV1 {
168
170
  await clientSessions.get()
169
171
  }
170
172
 
173
+ get timelines(): SeamHttpSeamConsoleV1Timelines {
174
+ return SeamHttpSeamConsoleV1Timelines.fromClient(this.client, this.defaults)
175
+ }
176
+
171
177
  getResourceLocator(
172
178
  parameters?: SeamConsoleV1GetResourceLocatorParameters,
173
179
  options: SeamConsoleV1GetResourceLocatorOptions = {},
@@ -390,6 +390,9 @@ import {
390
390
  type CustomersCreatePortalOptions,
391
391
  type CustomersCreatePortalParameters,
392
392
  type CustomersCreatePortalRequest,
393
+ type CustomersDeleteDataOptions,
394
+ type CustomersDeleteDataParameters,
395
+ type CustomersDeleteDataRequest,
393
396
  type CustomersPushDataOptions,
394
397
  type CustomersPushDataParameters,
395
398
  type CustomersPushDataRequest,
@@ -542,6 +545,12 @@ import {
542
545
  type SeamConsoleV1GetResourceLocatorRequest,
543
546
  SeamHttpSeamConsoleV1,
544
547
  } from './seam/console/v1/index.js'
548
+ import {
549
+ type SeamConsoleV1TimelinesGetOptions,
550
+ type SeamConsoleV1TimelinesGetParameters,
551
+ type SeamConsoleV1TimelinesGetRequest,
552
+ SeamHttpSeamConsoleV1Timelines,
553
+ } from './seam/console/v1/timelines/index.js'
545
554
  import {
546
555
  type SeamCustomerV1AutomationRunsListOptions,
547
556
  type SeamCustomerV1AutomationRunsListParameters,
@@ -2303,6 +2312,19 @@ export class SeamHttpEndpoints {
2303
2312
  }
2304
2313
  }
2305
2314
 
2315
+ get ['/customers/delete_data'](): (
2316
+ parameters?: CustomersDeleteDataParameters,
2317
+ options?: CustomersDeleteDataOptions,
2318
+ ) => CustomersDeleteDataRequest {
2319
+ const { client, defaults } = this
2320
+ return function customersDeleteData(
2321
+ ...args: Parameters<SeamHttpCustomers['deleteData']>
2322
+ ): ReturnType<SeamHttpCustomers['deleteData']> {
2323
+ const seam = SeamHttpCustomers.fromClient(client, defaults)
2324
+ return seam.deleteData(...args)
2325
+ }
2326
+ }
2327
+
2306
2328
  get ['/customers/push_data'](): (
2307
2329
  parameters?: CustomersPushDataParameters,
2308
2330
  options?: CustomersPushDataOptions,
@@ -2809,6 +2831,24 @@ export class SeamHttpEndpoints {
2809
2831
  }
2810
2832
  }
2811
2833
 
2834
+ get ['/seam/console/v1/timelines/get'](): (
2835
+ parameters?: SeamConsoleV1TimelinesGetParameters,
2836
+ options?: SeamConsoleV1TimelinesGetOptions,
2837
+ ) => SeamConsoleV1TimelinesGetRequest {
2838
+ const { client, defaults } = this
2839
+ if (!this.defaults.isUndocumentedApiEnabled) {
2840
+ throw new Error(
2841
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
2842
+ )
2843
+ }
2844
+ return function seamConsoleV1TimelinesGet(
2845
+ ...args: Parameters<SeamHttpSeamConsoleV1Timelines['get']>
2846
+ ): ReturnType<SeamHttpSeamConsoleV1Timelines['get']> {
2847
+ const seam = SeamHttpSeamConsoleV1Timelines.fromClient(client, defaults)
2848
+ return seam.get(...args)
2849
+ }
2850
+ }
2851
+
2812
2852
  get ['/seam/customer/v1/automation_runs/list'](): (
2813
2853
  parameters?: SeamCustomerV1AutomationRunsListParameters,
2814
2854
  options?: SeamCustomerV1AutomationRunsListOptions,
@@ -4111,6 +4151,7 @@ export type SeamHttpEndpointQueryPaths =
4111
4151
  | '/phones/get'
4112
4152
  | '/phones/list'
4113
4153
  | '/seam/console/v1/get_resource_locator'
4154
+ | '/seam/console/v1/timelines/get'
4114
4155
  | '/seam/customer/v1/automation_runs/list'
4115
4156
  | '/seam/customer/v1/automations/get'
4116
4157
  | '/seam/customer/v1/events/list'
@@ -4149,6 +4190,7 @@ export type SeamHttpEndpointPaginatedQueryPaths =
4149
4190
  | '/connect_webviews/list'
4150
4191
  | '/connected_accounts/list'
4151
4192
  | '/devices/list'
4193
+ | '/seam/console/v1/timelines/get'
4152
4194
  | '/seam/customer/v1/automation_runs/list'
4153
4195
 
4154
4196
  export type SeamHttpEndpointMutationPaths =
@@ -4203,6 +4245,7 @@ export type SeamHttpEndpointMutationPaths =
4203
4245
  | '/connected_accounts/sync'
4204
4246
  | '/connected_accounts/update'
4205
4247
  | '/customers/create_portal'
4248
+ | '/customers/delete_data'
4206
4249
  | '/customers/push_data'
4207
4250
  | '/devices/delete'
4208
4251
  | '/devices/update'
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '1.64.0'
1
+ const seamapiJavascriptHttpVersion = '1.66.0'
2
2
 
3
3
  export default seamapiJavascriptHttpVersion