@seamapi/http 1.39.0 → 1.40.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 (132) hide show
  1. package/README.md +8 -8
  2. package/dist/connect.cjs +86 -1153
  3. package/dist/connect.cjs.map +1 -1
  4. package/dist/connect.d.cts +43 -298
  5. package/dist/index.cjs.map +1 -1
  6. package/lib/seam/connect/auth.js +3 -3
  7. package/lib/seam/connect/auth.js.map +1 -1
  8. package/lib/seam/connect/index.d.ts +0 -1
  9. package/lib/seam/connect/index.js +0 -1
  10. package/lib/seam/connect/index.js.map +1 -1
  11. package/lib/seam/connect/options.d.ts +9 -9
  12. package/lib/seam/connect/options.js +7 -7
  13. package/lib/seam/connect/options.js.map +1 -1
  14. package/lib/seam/connect/parse-options.d.ts +2 -2
  15. package/lib/seam/connect/parse-options.js +2 -2
  16. package/lib/seam/connect/parse-options.js.map +1 -1
  17. package/lib/seam/connect/routes/index.d.ts +2 -0
  18. package/lib/seam/connect/routes/index.js +2 -0
  19. package/lib/seam/connect/routes/index.js.map +1 -1
  20. package/lib/seam/connect/routes/seam/index.d.ts +0 -3
  21. package/lib/seam/connect/routes/seam/index.js +0 -3
  22. package/lib/seam/connect/routes/seam/index.js.map +1 -1
  23. package/lib/seam/connect/routes/seam-http-endpoints-without-workspace.d.ts +17 -0
  24. package/lib/seam/connect/routes/seam-http-endpoints-without-workspace.js +54 -0
  25. package/lib/seam/connect/routes/seam-http-endpoints-without-workspace.js.map +1 -0
  26. package/lib/seam/connect/routes/seam-http-endpoints.d.ts +2 -16
  27. package/lib/seam/connect/routes/seam-http-endpoints.js +0 -95
  28. package/lib/seam/connect/routes/seam-http-endpoints.js.map +1 -1
  29. package/lib/seam/connect/routes/seam-http-without-workspace.d.ts +18 -0
  30. package/lib/seam/connect/routes/seam-http-without-workspace.js +47 -0
  31. package/lib/seam/connect/routes/seam-http-without-workspace.js.map +1 -0
  32. package/lib/version.d.ts +1 -1
  33. package/lib/version.js +1 -1
  34. package/package.json +3 -3
  35. package/src/lib/seam/connect/auth.ts +8 -8
  36. package/src/lib/seam/connect/index.ts +0 -1
  37. package/src/lib/seam/connect/options.ts +19 -19
  38. package/src/lib/seam/connect/parse-options.ts +4 -4
  39. package/src/lib/seam/connect/routes/index.ts +2 -0
  40. package/src/lib/seam/connect/routes/seam/index.ts +0 -3
  41. package/src/lib/seam/connect/routes/seam-http-endpoints-without-workspace.ts +126 -0
  42. package/src/lib/seam/connect/routes/seam-http-endpoints.ts +0 -252
  43. package/src/lib/seam/connect/routes/seam-http-without-workspace.ts +96 -0
  44. package/src/lib/version.ts +1 -1
  45. package/lib/seam/connect/routes/seam/bridge/index.d.ts +0 -1
  46. package/lib/seam/connect/routes/seam/bridge/index.js +0 -6
  47. package/lib/seam/connect/routes/seam/bridge/index.js.map +0 -1
  48. package/lib/seam/connect/routes/seam/bridge/v1/bridge-client-sessions/bridge-client-sessions.d.ts +0 -86
  49. package/lib/seam/connect/routes/seam/bridge/v1/bridge-client-sessions/bridge-client-sessions.js +0 -150
  50. package/lib/seam/connect/routes/seam/bridge/v1/bridge-client-sessions/bridge-client-sessions.js.map +0 -1
  51. package/lib/seam/connect/routes/seam/bridge/v1/bridge-client-sessions/index.d.ts +0 -1
  52. package/lib/seam/connect/routes/seam/bridge/v1/bridge-client-sessions/index.js +0 -6
  53. package/lib/seam/connect/routes/seam/bridge/v1/bridge-client-sessions/index.js.map +0 -1
  54. package/lib/seam/connect/routes/seam/bridge/v1/bridge-connected-systems/bridge-connected-systems.d.ts +0 -34
  55. package/lib/seam/connect/routes/seam/bridge/v1/bridge-connected-systems/bridge-connected-systems.js +0 -102
  56. package/lib/seam/connect/routes/seam/bridge/v1/bridge-connected-systems/bridge-connected-systems.js.map +0 -1
  57. package/lib/seam/connect/routes/seam/bridge/v1/bridge-connected-systems/index.d.ts +0 -1
  58. package/lib/seam/connect/routes/seam/bridge/v1/bridge-connected-systems/index.js +0 -6
  59. package/lib/seam/connect/routes/seam/bridge/v1/bridge-connected-systems/index.js.map +0 -1
  60. package/lib/seam/connect/routes/seam/bridge/v1/index.d.ts +0 -3
  61. package/lib/seam/connect/routes/seam/bridge/v1/index.js +0 -8
  62. package/lib/seam/connect/routes/seam/bridge/v1/index.js.map +0 -1
  63. package/lib/seam/connect/routes/seam/bridge/v1/v1.d.ts +0 -23
  64. package/lib/seam/connect/routes/seam/bridge/v1/v1.js +0 -97
  65. package/lib/seam/connect/routes/seam/bridge/v1/v1.js.map +0 -1
  66. package/lib/seam/connect/routes/seam/instant-key/index.d.ts +0 -1
  67. package/lib/seam/connect/routes/seam/instant-key/index.js +0 -6
  68. package/lib/seam/connect/routes/seam/instant-key/index.js.map +0 -1
  69. package/lib/seam/connect/routes/seam/instant-key/v1/client-sessions/client-sessions.d.ts +0 -34
  70. package/lib/seam/connect/routes/seam/instant-key/v1/client-sessions/client-sessions.js +0 -102
  71. package/lib/seam/connect/routes/seam/instant-key/v1/client-sessions/client-sessions.js.map +0 -1
  72. package/lib/seam/connect/routes/seam/instant-key/v1/client-sessions/index.d.ts +0 -1
  73. package/lib/seam/connect/routes/seam/instant-key/v1/client-sessions/index.js +0 -6
  74. package/lib/seam/connect/routes/seam/instant-key/v1/client-sessions/index.js.map +0 -1
  75. package/lib/seam/connect/routes/seam/instant-key/v1/index.d.ts +0 -2
  76. package/lib/seam/connect/routes/seam/instant-key/v1/index.js +0 -7
  77. package/lib/seam/connect/routes/seam/instant-key/v1/index.js.map +0 -1
  78. package/lib/seam/connect/routes/seam/instant-key/v1/v1.d.ts +0 -21
  79. package/lib/seam/connect/routes/seam/instant-key/v1/v1.js +0 -93
  80. package/lib/seam/connect/routes/seam/instant-key/v1/v1.js.map +0 -1
  81. package/lib/seam/connect/routes/seam/mobile-sdk/index.d.ts +0 -1
  82. package/lib/seam/connect/routes/seam/mobile-sdk/index.js +0 -6
  83. package/lib/seam/connect/routes/seam/mobile-sdk/index.js.map +0 -1
  84. package/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/acs.d.ts +0 -21
  85. package/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/acs.js +0 -93
  86. package/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/acs.js.map +0 -1
  87. package/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/credentials/credentials.d.ts +0 -34
  88. package/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/credentials/credentials.js +0 -102
  89. package/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/credentials/credentials.js.map +0 -1
  90. package/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/credentials/index.d.ts +0 -1
  91. package/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/credentials/index.js +0 -6
  92. package/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/credentials/index.js.map +0 -1
  93. package/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/index.d.ts +0 -2
  94. package/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/index.js +0 -7
  95. package/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/index.js.map +0 -1
  96. package/lib/seam/connect/routes/seam/mobile-sdk/v1/index.d.ts +0 -3
  97. package/lib/seam/connect/routes/seam/mobile-sdk/v1/index.js +0 -8
  98. package/lib/seam/connect/routes/seam/mobile-sdk/v1/index.js.map +0 -1
  99. package/lib/seam/connect/routes/seam/mobile-sdk/v1/phone-sessions/index.d.ts +0 -1
  100. package/lib/seam/connect/routes/seam/mobile-sdk/v1/phone-sessions/index.js +0 -6
  101. package/lib/seam/connect/routes/seam/mobile-sdk/v1/phone-sessions/index.js.map +0 -1
  102. package/lib/seam/connect/routes/seam/mobile-sdk/v1/phone-sessions/phone-sessions.d.ts +0 -34
  103. package/lib/seam/connect/routes/seam/mobile-sdk/v1/phone-sessions/phone-sessions.js +0 -102
  104. package/lib/seam/connect/routes/seam/mobile-sdk/v1/phone-sessions/phone-sessions.js.map +0 -1
  105. package/lib/seam/connect/routes/seam/mobile-sdk/v1/v1.d.ts +0 -23
  106. package/lib/seam/connect/routes/seam/mobile-sdk/v1/v1.js +0 -97
  107. package/lib/seam/connect/routes/seam/mobile-sdk/v1/v1.js.map +0 -1
  108. package/lib/seam/connect/seam-http-multi-workspace.d.ts +0 -12
  109. package/lib/seam/connect/seam-http-multi-workspace.js +0 -36
  110. package/lib/seam/connect/seam-http-multi-workspace.js.map +0 -1
  111. package/src/lib/seam/connect/routes/seam/bridge/index.ts +0 -6
  112. package/src/lib/seam/connect/routes/seam/bridge/v1/bridge-client-sessions/bridge-client-sessions.ts +0 -398
  113. package/src/lib/seam/connect/routes/seam/bridge/v1/bridge-client-sessions/index.ts +0 -6
  114. package/src/lib/seam/connect/routes/seam/bridge/v1/bridge-connected-systems/bridge-connected-systems.ts +0 -215
  115. package/src/lib/seam/connect/routes/seam/bridge/v1/bridge-connected-systems/index.ts +0 -6
  116. package/src/lib/seam/connect/routes/seam/bridge/v1/index.ts +0 -8
  117. package/src/lib/seam/connect/routes/seam/bridge/v1/v1.ts +0 -184
  118. package/src/lib/seam/connect/routes/seam/instant-key/index.ts +0 -6
  119. package/src/lib/seam/connect/routes/seam/instant-key/v1/client-sessions/client-sessions.ts +0 -219
  120. package/src/lib/seam/connect/routes/seam/instant-key/v1/client-sessions/index.ts +0 -6
  121. package/src/lib/seam/connect/routes/seam/instant-key/v1/index.ts +0 -7
  122. package/src/lib/seam/connect/routes/seam/instant-key/v1/v1.ts +0 -176
  123. package/src/lib/seam/connect/routes/seam/mobile-sdk/index.ts +0 -6
  124. package/src/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/acs.ts +0 -176
  125. package/src/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/credentials/credentials.ts +0 -215
  126. package/src/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/credentials/index.ts +0 -6
  127. package/src/lib/seam/connect/routes/seam/mobile-sdk/v1/acs/index.ts +0 -7
  128. package/src/lib/seam/connect/routes/seam/mobile-sdk/v1/index.ts +0 -8
  129. package/src/lib/seam/connect/routes/seam/mobile-sdk/v1/phone-sessions/index.ts +0 -6
  130. package/src/lib/seam/connect/routes/seam/mobile-sdk/v1/phone-sessions/phone-sessions.ts +0 -215
  131. package/src/lib/seam/connect/routes/seam/mobile-sdk/v1/v1.ts +0 -181
  132. package/src/lib/seam/connect/seam-http-multi-workspace.ts +0 -80
@@ -1,176 +0,0 @@
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 { seamApiLtsVersion } from 'lib/lts-version.js'
7
- import {
8
- getAuthHeadersForClientSessionToken,
9
- warnOnInsecureuserIdentifierKey,
10
- } from 'lib/seam/connect/auth.js'
11
- import { type Client, createClient } from 'lib/seam/connect/client.js'
12
- import {
13
- isSeamHttpOptionsWithApiKey,
14
- isSeamHttpOptionsWithClient,
15
- isSeamHttpOptionsWithClientSessionToken,
16
- isSeamHttpOptionsWithConsoleSessionToken,
17
- isSeamHttpOptionsWithPersonalAccessToken,
18
- type SeamHttpFromPublishableKeyOptions,
19
- SeamHttpInvalidOptionsError,
20
- type SeamHttpOptions,
21
- type SeamHttpOptionsWithApiKey,
22
- type SeamHttpOptionsWithClient,
23
- type SeamHttpOptionsWithClientSessionToken,
24
- type SeamHttpOptionsWithConsoleSessionToken,
25
- type SeamHttpOptionsWithPersonalAccessToken,
26
- type SeamHttpRequestOptions,
27
- } from 'lib/seam/connect/options.js'
28
- import {
29
- limitToSeamHttpRequestOptions,
30
- parseOptions,
31
- } from 'lib/seam/connect/parse-options.js'
32
- import { SeamHttpClientSessions } from 'lib/seam/connect/routes/client-sessions/index.js'
33
- import type { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
34
- import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
35
-
36
- import { SeamHttpSeamMobileSdkV1AcsCredentials } from './credentials/index.js'
37
-
38
- export class SeamHttpSeamMobileSdkV1Acs {
39
- client: Client
40
- readonly defaults: Required<SeamHttpRequestOptions>
41
- readonly ltsVersion = seamApiLtsVersion
42
- static ltsVersion = seamApiLtsVersion
43
-
44
- constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
45
- const options = parseOptions(apiKeyOrOptions)
46
- if (!options.isUndocumentedApiEnabled) {
47
- throw new Error(
48
- 'Cannot use undocumented API without isUndocumentedApiEnabled',
49
- )
50
- }
51
- this.client = 'client' in options ? options.client : createClient(options)
52
- this.defaults = limitToSeamHttpRequestOptions(options)
53
- }
54
-
55
- static fromClient(
56
- client: SeamHttpOptionsWithClient['client'],
57
- options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
58
- ): SeamHttpSeamMobileSdkV1Acs {
59
- const constructorOptions = { ...options, client }
60
- if (!isSeamHttpOptionsWithClient(constructorOptions)) {
61
- throw new SeamHttpInvalidOptionsError('Missing client')
62
- }
63
- return new SeamHttpSeamMobileSdkV1Acs(constructorOptions)
64
- }
65
-
66
- static fromApiKey(
67
- apiKey: SeamHttpOptionsWithApiKey['apiKey'],
68
- options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
69
- ): SeamHttpSeamMobileSdkV1Acs {
70
- const constructorOptions = { ...options, apiKey }
71
- if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
72
- throw new SeamHttpInvalidOptionsError('Missing apiKey')
73
- }
74
- return new SeamHttpSeamMobileSdkV1Acs(constructorOptions)
75
- }
76
-
77
- static fromClientSessionToken(
78
- clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
79
- options: Omit<
80
- SeamHttpOptionsWithClientSessionToken,
81
- 'clientSessionToken'
82
- > = {},
83
- ): SeamHttpSeamMobileSdkV1Acs {
84
- const constructorOptions = { ...options, clientSessionToken }
85
- if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
86
- throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
87
- }
88
- return new SeamHttpSeamMobileSdkV1Acs(constructorOptions)
89
- }
90
-
91
- static async fromPublishableKey(
92
- publishableKey: string,
93
- userIdentifierKey: string,
94
- options: SeamHttpFromPublishableKeyOptions = {},
95
- ): Promise<SeamHttpSeamMobileSdkV1Acs> {
96
- warnOnInsecureuserIdentifierKey(userIdentifierKey)
97
- const clientOptions = parseOptions({ ...options, publishableKey })
98
- if (isSeamHttpOptionsWithClient(clientOptions)) {
99
- throw new SeamHttpInvalidOptionsError(
100
- 'The client option cannot be used with SeamHttpSeamMobileSdkV1Acs.fromPublishableKey',
101
- )
102
- }
103
- const client = createClient(clientOptions)
104
- const clientSessions = SeamHttpClientSessions.fromClient(client)
105
- const { token } = await clientSessions.getOrCreate({
106
- user_identifier_key: userIdentifierKey,
107
- })
108
- return SeamHttpSeamMobileSdkV1Acs.fromClientSessionToken(token, options)
109
- }
110
-
111
- static fromConsoleSessionToken(
112
- consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
113
- workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
114
- options: Omit<
115
- SeamHttpOptionsWithConsoleSessionToken,
116
- 'consoleSessionToken' | 'workspaceId'
117
- > = {},
118
- ): SeamHttpSeamMobileSdkV1Acs {
119
- const constructorOptions = { ...options, consoleSessionToken, workspaceId }
120
- if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
121
- throw new SeamHttpInvalidOptionsError(
122
- 'Missing consoleSessionToken or workspaceId',
123
- )
124
- }
125
- return new SeamHttpSeamMobileSdkV1Acs(constructorOptions)
126
- }
127
-
128
- static fromPersonalAccessToken(
129
- personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
130
- workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
131
- options: Omit<
132
- SeamHttpOptionsWithPersonalAccessToken,
133
- 'personalAccessToken' | 'workspaceId'
134
- > = {},
135
- ): SeamHttpSeamMobileSdkV1Acs {
136
- const constructorOptions = { ...options, personalAccessToken, workspaceId }
137
- if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
138
- throw new SeamHttpInvalidOptionsError(
139
- 'Missing personalAccessToken or workspaceId',
140
- )
141
- }
142
- return new SeamHttpSeamMobileSdkV1Acs(constructorOptions)
143
- }
144
-
145
- createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
146
- request: SeamHttpRequest<TResponse, TResponseKey>,
147
- ): SeamPaginator<TResponse, TResponseKey> {
148
- return new SeamPaginator<TResponse, TResponseKey>(this, request)
149
- }
150
-
151
- async updateClientSessionToken(
152
- clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
153
- ): Promise<void> {
154
- const { headers } = this.client.defaults
155
- const authHeaders = getAuthHeadersForClientSessionToken({
156
- clientSessionToken,
157
- })
158
- for (const key of Object.keys(authHeaders)) {
159
- if (headers[key] == null) {
160
- throw new Error(
161
- 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
162
- )
163
- }
164
- }
165
- this.client.defaults.headers = { ...headers, ...authHeaders }
166
- const clientSessions = SeamHttpClientSessions.fromClient(this.client)
167
- await clientSessions.get()
168
- }
169
-
170
- get credentials(): SeamHttpSeamMobileSdkV1AcsCredentials {
171
- return SeamHttpSeamMobileSdkV1AcsCredentials.fromClient(
172
- this.client,
173
- this.defaults,
174
- )
175
- }
176
- }
@@ -1,215 +0,0 @@
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 SeamHttpSeamMobileSdkV1AcsCredentials {
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
- ): SeamHttpSeamMobileSdkV1AcsCredentials {
60
- const constructorOptions = { ...options, client }
61
- if (!isSeamHttpOptionsWithClient(constructorOptions)) {
62
- throw new SeamHttpInvalidOptionsError('Missing client')
63
- }
64
- return new SeamHttpSeamMobileSdkV1AcsCredentials(constructorOptions)
65
- }
66
-
67
- static fromApiKey(
68
- apiKey: SeamHttpOptionsWithApiKey['apiKey'],
69
- options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
70
- ): SeamHttpSeamMobileSdkV1AcsCredentials {
71
- const constructorOptions = { ...options, apiKey }
72
- if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
73
- throw new SeamHttpInvalidOptionsError('Missing apiKey')
74
- }
75
- return new SeamHttpSeamMobileSdkV1AcsCredentials(constructorOptions)
76
- }
77
-
78
- static fromClientSessionToken(
79
- clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
80
- options: Omit<
81
- SeamHttpOptionsWithClientSessionToken,
82
- 'clientSessionToken'
83
- > = {},
84
- ): SeamHttpSeamMobileSdkV1AcsCredentials {
85
- const constructorOptions = { ...options, clientSessionToken }
86
- if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
87
- throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
88
- }
89
- return new SeamHttpSeamMobileSdkV1AcsCredentials(constructorOptions)
90
- }
91
-
92
- static async fromPublishableKey(
93
- publishableKey: string,
94
- userIdentifierKey: string,
95
- options: SeamHttpFromPublishableKeyOptions = {},
96
- ): Promise<SeamHttpSeamMobileSdkV1AcsCredentials> {
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 SeamHttpSeamMobileSdkV1AcsCredentials.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 SeamHttpSeamMobileSdkV1AcsCredentials.fromClientSessionToken(
110
- token,
111
- options,
112
- )
113
- }
114
-
115
- static fromConsoleSessionToken(
116
- consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
117
- workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
118
- options: Omit<
119
- SeamHttpOptionsWithConsoleSessionToken,
120
- 'consoleSessionToken' | 'workspaceId'
121
- > = {},
122
- ): SeamHttpSeamMobileSdkV1AcsCredentials {
123
- const constructorOptions = { ...options, consoleSessionToken, workspaceId }
124
- if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
125
- throw new SeamHttpInvalidOptionsError(
126
- 'Missing consoleSessionToken or workspaceId',
127
- )
128
- }
129
- return new SeamHttpSeamMobileSdkV1AcsCredentials(constructorOptions)
130
- }
131
-
132
- static fromPersonalAccessToken(
133
- personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
134
- workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
135
- options: Omit<
136
- SeamHttpOptionsWithPersonalAccessToken,
137
- 'personalAccessToken' | 'workspaceId'
138
- > = {},
139
- ): SeamHttpSeamMobileSdkV1AcsCredentials {
140
- const constructorOptions = { ...options, personalAccessToken, workspaceId }
141
- if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
142
- throw new SeamHttpInvalidOptionsError(
143
- 'Missing personalAccessToken or workspaceId',
144
- )
145
- }
146
- return new SeamHttpSeamMobileSdkV1AcsCredentials(constructorOptions)
147
- }
148
-
149
- createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
150
- request: SeamHttpRequest<TResponse, TResponseKey>,
151
- ): SeamPaginator<TResponse, TResponseKey> {
152
- return new SeamPaginator<TResponse, TResponseKey>(this, request)
153
- }
154
-
155
- async updateClientSessionToken(
156
- clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
157
- ): Promise<void> {
158
- const { headers } = this.client.defaults
159
- const authHeaders = getAuthHeadersForClientSessionToken({
160
- clientSessionToken,
161
- })
162
- for (const key of Object.keys(authHeaders)) {
163
- if (headers[key] == null) {
164
- throw new Error(
165
- 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
166
- )
167
- }
168
- }
169
- this.client.defaults.headers = { ...headers, ...authHeaders }
170
- const clientSessions = SeamHttpClientSessions.fromClient(this.client)
171
- await clientSessions.get()
172
- }
173
-
174
- list(
175
- parameters?: SeamMobileSdkV1AcsCredentialsListParameters,
176
- options: SeamMobileSdkV1AcsCredentialsListOptions = {},
177
- ): SeamMobileSdkV1AcsCredentialsListRequest {
178
- if (!this.defaults.isUndocumentedApiEnabled) {
179
- throw new Error(
180
- 'Cannot use undocumented API without isUndocumentedApiEnabled',
181
- )
182
- }
183
- return new SeamHttpRequest(this, {
184
- pathname: '/seam/mobile_sdk/v1/acs/credentials/list',
185
- method: 'POST',
186
- body: parameters,
187
- responseKey: 'acs_credentials',
188
- options,
189
- })
190
- }
191
- }
192
-
193
- export type SeamMobileSdkV1AcsCredentialsListParameters =
194
- RouteRequestBody<'/seam/mobile_sdk/v1/acs/credentials/list'>
195
-
196
- /**
197
- * @deprecated Use SeamMobileSdkV1AcsCredentialsListParameters instead.
198
- */
199
- export type SeamMobileSdkV1AcsCredentialsListParams =
200
- SeamMobileSdkV1AcsCredentialsListParameters
201
-
202
- /**
203
- * @deprecated Use SeamMobileSdkV1AcsCredentialsListRequest instead.
204
- */
205
- export type SeamMobileSdkV1AcsCredentialsListResponse = SetNonNullable<
206
- Required<RouteResponse<'/seam/mobile_sdk/v1/acs/credentials/list'>>
207
- >
208
-
209
- export type SeamMobileSdkV1AcsCredentialsListRequest = SeamHttpRequest<
210
- SeamMobileSdkV1AcsCredentialsListResponse,
211
- 'acs_credentials'
212
- >
213
-
214
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
215
- export interface SeamMobileSdkV1AcsCredentialsListOptions {}
@@ -1,6 +0,0 @@
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 './credentials.js'
@@ -1,7 +0,0 @@
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 './acs.js'
7
- export * from './credentials/index.js'
@@ -1,8 +0,0 @@
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 './acs/index.js'
7
- export * from './phone-sessions/index.js'
8
- export * from './v1.js'
@@ -1,6 +0,0 @@
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 './phone-sessions.js'
@@ -1,215 +0,0 @@
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 SeamHttpSeamMobileSdkV1PhoneSessions {
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
- ): SeamHttpSeamMobileSdkV1PhoneSessions {
60
- const constructorOptions = { ...options, client }
61
- if (!isSeamHttpOptionsWithClient(constructorOptions)) {
62
- throw new SeamHttpInvalidOptionsError('Missing client')
63
- }
64
- return new SeamHttpSeamMobileSdkV1PhoneSessions(constructorOptions)
65
- }
66
-
67
- static fromApiKey(
68
- apiKey: SeamHttpOptionsWithApiKey['apiKey'],
69
- options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
70
- ): SeamHttpSeamMobileSdkV1PhoneSessions {
71
- const constructorOptions = { ...options, apiKey }
72
- if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
73
- throw new SeamHttpInvalidOptionsError('Missing apiKey')
74
- }
75
- return new SeamHttpSeamMobileSdkV1PhoneSessions(constructorOptions)
76
- }
77
-
78
- static fromClientSessionToken(
79
- clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
80
- options: Omit<
81
- SeamHttpOptionsWithClientSessionToken,
82
- 'clientSessionToken'
83
- > = {},
84
- ): SeamHttpSeamMobileSdkV1PhoneSessions {
85
- const constructorOptions = { ...options, clientSessionToken }
86
- if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
87
- throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
88
- }
89
- return new SeamHttpSeamMobileSdkV1PhoneSessions(constructorOptions)
90
- }
91
-
92
- static async fromPublishableKey(
93
- publishableKey: string,
94
- userIdentifierKey: string,
95
- options: SeamHttpFromPublishableKeyOptions = {},
96
- ): Promise<SeamHttpSeamMobileSdkV1PhoneSessions> {
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 SeamHttpSeamMobileSdkV1PhoneSessions.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 SeamHttpSeamMobileSdkV1PhoneSessions.fromClientSessionToken(
110
- token,
111
- options,
112
- )
113
- }
114
-
115
- static fromConsoleSessionToken(
116
- consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
117
- workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
118
- options: Omit<
119
- SeamHttpOptionsWithConsoleSessionToken,
120
- 'consoleSessionToken' | 'workspaceId'
121
- > = {},
122
- ): SeamHttpSeamMobileSdkV1PhoneSessions {
123
- const constructorOptions = { ...options, consoleSessionToken, workspaceId }
124
- if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
125
- throw new SeamHttpInvalidOptionsError(
126
- 'Missing consoleSessionToken or workspaceId',
127
- )
128
- }
129
- return new SeamHttpSeamMobileSdkV1PhoneSessions(constructorOptions)
130
- }
131
-
132
- static fromPersonalAccessToken(
133
- personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
134
- workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
135
- options: Omit<
136
- SeamHttpOptionsWithPersonalAccessToken,
137
- 'personalAccessToken' | 'workspaceId'
138
- > = {},
139
- ): SeamHttpSeamMobileSdkV1PhoneSessions {
140
- const constructorOptions = { ...options, personalAccessToken, workspaceId }
141
- if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
142
- throw new SeamHttpInvalidOptionsError(
143
- 'Missing personalAccessToken or workspaceId',
144
- )
145
- }
146
- return new SeamHttpSeamMobileSdkV1PhoneSessions(constructorOptions)
147
- }
148
-
149
- createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
150
- request: SeamHttpRequest<TResponse, TResponseKey>,
151
- ): SeamPaginator<TResponse, TResponseKey> {
152
- return new SeamPaginator<TResponse, TResponseKey>(this, request)
153
- }
154
-
155
- async updateClientSessionToken(
156
- clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
157
- ): Promise<void> {
158
- const { headers } = this.client.defaults
159
- const authHeaders = getAuthHeadersForClientSessionToken({
160
- clientSessionToken,
161
- })
162
- for (const key of Object.keys(authHeaders)) {
163
- if (headers[key] == null) {
164
- throw new Error(
165
- 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
166
- )
167
- }
168
- }
169
- this.client.defaults.headers = { ...headers, ...authHeaders }
170
- const clientSessions = SeamHttpClientSessions.fromClient(this.client)
171
- await clientSessions.get()
172
- }
173
-
174
- getOrCreate(
175
- parameters?: SeamMobileSdkV1PhoneSessionsGetOrCreateParameters,
176
- options: SeamMobileSdkV1PhoneSessionsGetOrCreateOptions = {},
177
- ): SeamMobileSdkV1PhoneSessionsGetOrCreateRequest {
178
- if (!this.defaults.isUndocumentedApiEnabled) {
179
- throw new Error(
180
- 'Cannot use undocumented API without isUndocumentedApiEnabled',
181
- )
182
- }
183
- return new SeamHttpRequest(this, {
184
- pathname: '/seam/mobile_sdk/v1/phone_sessions/get_or_create',
185
- method: 'POST',
186
- body: parameters,
187
- responseKey: 'phone_session',
188
- options,
189
- })
190
- }
191
- }
192
-
193
- export type SeamMobileSdkV1PhoneSessionsGetOrCreateParameters =
194
- RouteRequestBody<'/seam/mobile_sdk/v1/phone_sessions/get_or_create'>
195
-
196
- /**
197
- * @deprecated Use SeamMobileSdkV1PhoneSessionsGetOrCreateParameters instead.
198
- */
199
- export type SeamMobileSdkV1PhoneSessionsGetOrCreateBody =
200
- SeamMobileSdkV1PhoneSessionsGetOrCreateParameters
201
-
202
- /**
203
- * @deprecated Use SeamMobileSdkV1PhoneSessionsGetOrCreateRequest instead.
204
- */
205
- export type SeamMobileSdkV1PhoneSessionsGetOrCreateResponse = SetNonNullable<
206
- Required<RouteResponse<'/seam/mobile_sdk/v1/phone_sessions/get_or_create'>>
207
- >
208
-
209
- export type SeamMobileSdkV1PhoneSessionsGetOrCreateRequest = SeamHttpRequest<
210
- SeamMobileSdkV1PhoneSessionsGetOrCreateResponse,
211
- 'phone_session'
212
- >
213
-
214
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
215
- export interface SeamMobileSdkV1PhoneSessionsGetOrCreateOptions {}