@seamapi/http 1.65.0 → 1.67.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 +122 -2
  2. package/dist/connect.cjs.map +1 -1
  3. package/dist/connect.d.cts +47 -16
  4. package/dist/index.cjs +124 -2
  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/seam/console/v1/index.d.ts +1 -0
  9. package/lib/seam/connect/routes/seam/console/v1/index.js +1 -0
  10. package/lib/seam/connect/routes/seam/console/v1/index.js.map +1 -1
  11. package/lib/seam/connect/routes/seam/console/v1/timelines/index.d.ts +1 -0
  12. package/lib/seam/connect/routes/seam/console/v1/timelines/index.js +6 -0
  13. package/lib/seam/connect/routes/seam/console/v1/timelines/index.js.map +1 -0
  14. package/lib/seam/connect/routes/seam/console/v1/timelines/timelines.d.ts +34 -0
  15. package/lib/seam/connect/routes/seam/console/v1/timelines/timelines.js +102 -0
  16. package/lib/seam/connect/routes/seam/console/v1/timelines/timelines.js.map +1 -0
  17. package/lib/seam/connect/routes/seam/console/v1/v1.d.ts +2 -0
  18. package/lib/seam/connect/routes/seam/console/v1/v1.js +4 -0
  19. package/lib/seam/connect/routes/seam/console/v1/v1.js.map +1 -1
  20. package/lib/seam/connect/routes/seam-http-endpoints.d.ts +4 -2
  21. package/lib/seam/connect/routes/seam-http-endpoints.js +11 -0
  22. package/lib/seam/connect/routes/seam-http-endpoints.js.map +1 -1
  23. package/lib/seam/connect/routes/workspaces/customization-profiles/customization-profiles.d.ts +2 -2
  24. package/lib/seam/connect/routes/workspaces/customization-profiles/customization-profiles.js +2 -2
  25. package/lib/seam/connect/routes/workspaces/customization-profiles/customization-profiles.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/seam/console/v1/index.ts +1 -0
  30. package/src/lib/seam/connect/routes/seam/console/v1/timelines/index.ts +6 -0
  31. package/src/lib/seam/connect/routes/seam/console/v1/timelines/timelines.ts +212 -0
  32. package/src/lib/seam/connect/routes/seam/console/v1/v1.ts +6 -0
  33. package/src/lib/seam/connect/routes/seam-http-endpoints.ts +26 -0
  34. package/src/lib/seam/connect/routes/workspaces/customization-profiles/customization-profiles.ts +4 -8
  35. package/src/lib/version.ts +1 -1
@@ -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 = {},
@@ -545,6 +545,12 @@ import {
545
545
  type SeamConsoleV1GetResourceLocatorRequest,
546
546
  SeamHttpSeamConsoleV1,
547
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'
548
554
  import {
549
555
  type SeamCustomerV1AutomationRunsListOptions,
550
556
  type SeamCustomerV1AutomationRunsListParameters,
@@ -2825,6 +2831,24 @@ export class SeamHttpEndpoints {
2825
2831
  }
2826
2832
  }
2827
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
+
2828
2852
  get ['/seam/customer/v1/automation_runs/list'](): (
2829
2853
  parameters?: SeamCustomerV1AutomationRunsListParameters,
2830
2854
  options?: SeamCustomerV1AutomationRunsListOptions,
@@ -4127,6 +4151,7 @@ export type SeamHttpEndpointQueryPaths =
4127
4151
  | '/phones/get'
4128
4152
  | '/phones/list'
4129
4153
  | '/seam/console/v1/get_resource_locator'
4154
+ | '/seam/console/v1/timelines/get'
4130
4155
  | '/seam/customer/v1/automation_runs/list'
4131
4156
  | '/seam/customer/v1/automations/get'
4132
4157
  | '/seam/customer/v1/events/list'
@@ -4165,6 +4190,7 @@ export type SeamHttpEndpointPaginatedQueryPaths =
4165
4190
  | '/connect_webviews/list'
4166
4191
  | '/connected_accounts/list'
4167
4192
  | '/devices/list'
4193
+ | '/seam/console/v1/timelines/get'
4168
4194
  | '/seam/customer/v1/automation_runs/list'
4169
4195
 
4170
4196
  export type SeamHttpEndpointMutationPaths =
@@ -3,11 +3,7 @@
3
3
  * Do not edit this file or add other files to this directory.
4
4
  */
5
5
 
6
- import type {
7
- RouteRequestBody,
8
- RouteRequestParams,
9
- RouteResponse,
10
- } from '@seamapi/types/connect'
6
+ import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
11
7
 
12
8
  import { seamApiLtsVersion } from 'lib/lts-version.js'
13
9
  import {
@@ -222,8 +218,8 @@ export class SeamHttpWorkspacesCustomizationProfiles {
222
218
  }
223
219
  return new SeamHttpRequest(this, {
224
220
  pathname: '/workspaces/customization_profiles/list',
225
- method: 'GET',
226
- params: parameters,
221
+ method: 'POST',
222
+ body: parameters,
227
223
  responseKey: 'customization_profiles',
228
224
  options,
229
225
  })
@@ -315,7 +311,7 @@ export type WorkspacesCustomizationProfilesGetRequest = SeamHttpRequest<
315
311
  export interface WorkspacesCustomizationProfilesGetOptions {}
316
312
 
317
313
  export type WorkspacesCustomizationProfilesListParameters =
318
- RouteRequestParams<'/workspaces/customization_profiles/list'>
314
+ RouteRequestBody<'/workspaces/customization_profiles/list'>
319
315
 
320
316
  /**
321
317
  * @deprecated Use WorkspacesCustomizationProfilesListParameters instead.
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '1.65.0'
1
+ const seamapiJavascriptHttpVersion = '1.67.0'
2
2
 
3
3
  export default seamapiJavascriptHttpVersion