@seamapi/http 1.25.0 → 1.26.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.
@@ -33,6 +33,7 @@ export * from './phones-simulate.js';
33
33
  export * from './thermostats.js';
34
34
  export * from './thermostats-schedules.js';
35
35
  export * from './thermostats-simulate.js';
36
+ export * from './unstable-locations.js';
36
37
  export * from './user-identities.js';
37
38
  export * from './user-identities-enrollment-automations.js';
38
39
  export * from './webhooks.js';
@@ -33,6 +33,7 @@ export * from './phones-simulate.js';
33
33
  export * from './thermostats.js';
34
34
  export * from './thermostats-schedules.js';
35
35
  export * from './thermostats-simulate.js';
36
+ export * from './unstable-locations.js';
36
37
  export * from './user-identities.js';
37
38
  export * from './user-identities-enrollment-automations.js';
38
39
  export * from './webhooks.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,UAAU,CAAA;AACxB,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,2BAA2B,CAAA;AACzC,cAAc,8CAA8C,CAAA;AAC5D,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mBAAmB,CAAA;AACjC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB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Ac,qCAAqC,CAAA;AACnD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6CAA6C,CAAA;AAC3D,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,47 @@
1
+ import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect';
2
+ import { type Client } from '../../../../lib/seam/connect/client.js';
3
+ import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken, type SeamHttpRequestOptions } from '../../../../lib/seam/connect/options.js';
4
+ import { SeamHttpRequest } from '../../../../lib/seam/connect/seam-http-request.js';
5
+ import { SeamPaginator } from '../../../../lib/seam/connect/seam-paginator.js';
6
+ import type { SetNonNullable } from '../../../../lib/types.js';
7
+ export declare class SeamHttpUnstableLocations {
8
+ client: Client;
9
+ readonly defaults: Required<SeamHttpRequestOptions>;
10
+ constructor(apiKeyOrOptions?: string | SeamHttpOptions);
11
+ static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpUnstableLocations;
12
+ static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpUnstableLocations;
13
+ static fromClientSessionToken(clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], options?: Omit<SeamHttpOptionsWithClientSessionToken, 'clientSessionToken'>): SeamHttpUnstableLocations;
14
+ static fromPublishableKey(publishableKey: string, userIdentifierKey: string, options?: SeamHttpFromPublishableKeyOptions): Promise<SeamHttpUnstableLocations>;
15
+ static fromConsoleSessionToken(consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'], workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'], options?: Omit<SeamHttpOptionsWithConsoleSessionToken, 'consoleSessionToken' | 'workspaceId'>): SeamHttpUnstableLocations;
16
+ static fromPersonalAccessToken(personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'], workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'], options?: Omit<SeamHttpOptionsWithPersonalAccessToken, 'personalAccessToken' | 'workspaceId'>): SeamHttpUnstableLocations;
17
+ createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(request: SeamHttpRequest<TResponse, TResponseKey>): SeamPaginator<TResponse, TResponseKey>;
18
+ updateClientSessionToken(clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken']): Promise<void>;
19
+ addDevices(body?: UnstableLocationsAddDevicesBody): SeamHttpRequest<void, undefined>;
20
+ create(body?: UnstableLocationsCreateBody): SeamHttpRequest<UnstableLocationsCreateResponse, 'location'>;
21
+ delete(body?: UnstableLocationsDeleteParams): SeamHttpRequest<void, undefined>;
22
+ get(body?: UnstableLocationsGetParams): SeamHttpRequest<UnstableLocationsGetResponse, 'location'>;
23
+ list(body?: UnstableLocationsListParams): SeamHttpRequest<UnstableLocationsListResponse, 'locations'>;
24
+ removeDevices(body?: UnstableLocationsRemoveDevicesParams): SeamHttpRequest<void, undefined>;
25
+ update(body?: UnstableLocationsUpdateBody): SeamHttpRequest<UnstableLocationsUpdateResponse, 'location'>;
26
+ }
27
+ export type UnstableLocationsAddDevicesBody = RouteRequestBody<'/unstable_locations/add_devices'>;
28
+ export type UnstableLocationsAddDevicesResponse = SetNonNullable<Required<RouteResponse<'/unstable_locations/add_devices'>>>;
29
+ export type UnstableLocationsAddDevicesOptions = never;
30
+ export type UnstableLocationsCreateBody = RouteRequestBody<'/unstable_locations/create'>;
31
+ export type UnstableLocationsCreateResponse = SetNonNullable<Required<RouteResponse<'/unstable_locations/create'>>>;
32
+ export type UnstableLocationsCreateOptions = never;
33
+ export type UnstableLocationsDeleteParams = RouteRequestBody<'/unstable_locations/delete'>;
34
+ export type UnstableLocationsDeleteResponse = SetNonNullable<Required<RouteResponse<'/unstable_locations/delete'>>>;
35
+ export type UnstableLocationsDeleteOptions = never;
36
+ export type UnstableLocationsGetParams = RouteRequestBody<'/unstable_locations/get'>;
37
+ export type UnstableLocationsGetResponse = SetNonNullable<Required<RouteResponse<'/unstable_locations/get'>>>;
38
+ export type UnstableLocationsGetOptions = never;
39
+ export type UnstableLocationsListParams = RouteRequestBody<'/unstable_locations/list'>;
40
+ export type UnstableLocationsListResponse = SetNonNullable<Required<RouteResponse<'/unstable_locations/list'>>>;
41
+ export type UnstableLocationsListOptions = never;
42
+ export type UnstableLocationsRemoveDevicesParams = RouteRequestBody<'/unstable_locations/remove_devices'>;
43
+ export type UnstableLocationsRemoveDevicesResponse = SetNonNullable<Required<RouteResponse<'/unstable_locations/remove_devices'>>>;
44
+ export type UnstableLocationsRemoveDevicesOptions = never;
45
+ export type UnstableLocationsUpdateBody = RouteRequestBody<'/unstable_locations/update'>;
46
+ export type UnstableLocationsUpdateResponse = SetNonNullable<Required<RouteResponse<'/unstable_locations/update'>>>;
47
+ export type UnstableLocationsUpdateOptions = never;
@@ -0,0 +1,140 @@
1
+ /*
2
+ * Automatically generated by generate-routes.ts.
3
+ * Do not edit this file or add other files to this directory.
4
+ */
5
+ import { getAuthHeadersForClientSessionToken, warnOnInsecureuserIdentifierKey, } from '../../../../lib/seam/connect/auth.js';
6
+ import { createClient } from '../../../../lib/seam/connect/client.js';
7
+ import { isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
8
+ import { limitToSeamHttpRequestOptions, parseOptions, } from '../../../../lib/seam/connect/parse-options.js';
9
+ import { SeamHttpRequest } from '../../../../lib/seam/connect/seam-http-request.js';
10
+ import { SeamPaginator } from '../../../../lib/seam/connect/seam-paginator.js';
11
+ import { SeamHttpClientSessions } from './client-sessions.js';
12
+ export class SeamHttpUnstableLocations {
13
+ constructor(apiKeyOrOptions = {}) {
14
+ const options = parseOptions(apiKeyOrOptions);
15
+ this.client = 'client' in options ? options.client : createClient(options);
16
+ this.defaults = limitToSeamHttpRequestOptions(options);
17
+ }
18
+ static fromClient(client, options = {}) {
19
+ const constructorOptions = { ...options, client };
20
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
21
+ throw new SeamHttpInvalidOptionsError('Missing client');
22
+ }
23
+ return new SeamHttpUnstableLocations(constructorOptions);
24
+ }
25
+ static fromApiKey(apiKey, options = {}) {
26
+ const constructorOptions = { ...options, apiKey };
27
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
28
+ throw new SeamHttpInvalidOptionsError('Missing apiKey');
29
+ }
30
+ return new SeamHttpUnstableLocations(constructorOptions);
31
+ }
32
+ static fromClientSessionToken(clientSessionToken, options = {}) {
33
+ const constructorOptions = { ...options, clientSessionToken };
34
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
35
+ throw new SeamHttpInvalidOptionsError('Missing clientSessionToken');
36
+ }
37
+ return new SeamHttpUnstableLocations(constructorOptions);
38
+ }
39
+ static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
40
+ warnOnInsecureuserIdentifierKey(userIdentifierKey);
41
+ const clientOptions = parseOptions({ ...options, publishableKey });
42
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
43
+ throw new SeamHttpInvalidOptionsError('The client option cannot be used with SeamHttp.fromPublishableKey');
44
+ }
45
+ const client = createClient(clientOptions);
46
+ const clientSessions = SeamHttpClientSessions.fromClient(client);
47
+ const { token } = await clientSessions.getOrCreate({
48
+ user_identifier_key: userIdentifierKey,
49
+ });
50
+ return SeamHttpUnstableLocations.fromClientSessionToken(token, options);
51
+ }
52
+ static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
53
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId };
54
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
55
+ throw new SeamHttpInvalidOptionsError('Missing consoleSessionToken or workspaceId');
56
+ }
57
+ return new SeamHttpUnstableLocations(constructorOptions);
58
+ }
59
+ static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
60
+ const constructorOptions = { ...options, personalAccessToken, workspaceId };
61
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
62
+ throw new SeamHttpInvalidOptionsError('Missing personalAccessToken or workspaceId');
63
+ }
64
+ return new SeamHttpUnstableLocations(constructorOptions);
65
+ }
66
+ createPaginator(request) {
67
+ return new SeamPaginator(this, request);
68
+ }
69
+ async updateClientSessionToken(clientSessionToken) {
70
+ const { headers } = this.client.defaults;
71
+ const authHeaders = getAuthHeadersForClientSessionToken({
72
+ clientSessionToken,
73
+ });
74
+ for (const key of Object.keys(authHeaders)) {
75
+ if (headers[key] == null) {
76
+ throw new Error('Cannot update a clientSessionToken on a client created without a clientSessionToken');
77
+ }
78
+ }
79
+ this.client.defaults.headers = { ...headers, ...authHeaders };
80
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client);
81
+ await clientSessions.get();
82
+ }
83
+ addDevices(body) {
84
+ return new SeamHttpRequest(this, {
85
+ pathname: '/unstable_locations/add_devices',
86
+ method: 'post',
87
+ body,
88
+ responseKey: undefined,
89
+ });
90
+ }
91
+ create(body) {
92
+ return new SeamHttpRequest(this, {
93
+ pathname: '/unstable_locations/create',
94
+ method: 'post',
95
+ body,
96
+ responseKey: 'location',
97
+ });
98
+ }
99
+ delete(body) {
100
+ return new SeamHttpRequest(this, {
101
+ pathname: '/unstable_locations/delete',
102
+ method: 'post',
103
+ body,
104
+ responseKey: undefined,
105
+ });
106
+ }
107
+ get(body) {
108
+ return new SeamHttpRequest(this, {
109
+ pathname: '/unstable_locations/get',
110
+ method: 'post',
111
+ body,
112
+ responseKey: 'location',
113
+ });
114
+ }
115
+ list(body) {
116
+ return new SeamHttpRequest(this, {
117
+ pathname: '/unstable_locations/list',
118
+ method: 'post',
119
+ body,
120
+ responseKey: 'locations',
121
+ });
122
+ }
123
+ removeDevices(body) {
124
+ return new SeamHttpRequest(this, {
125
+ pathname: '/unstable_locations/remove_devices',
126
+ method: 'post',
127
+ body,
128
+ responseKey: undefined,
129
+ });
130
+ }
131
+ update(body) {
132
+ return new SeamHttpRequest(this, {
133
+ pathname: '/unstable_locations/update',
134
+ method: 'post',
135
+ body,
136
+ responseKey: 'location',
137
+ });
138
+ }
139
+ }
140
+ //# sourceMappingURL=unstable-locations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unstable-locations.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/unstable-locations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACL,mCAAmC,EACnC,+BAA+B,GAChC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,GAQ5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,6BAA6B,EAC7B,YAAY,GACb,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAGlE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,MAAM,OAAO,yBAAyB;IAIpC,YAAY,kBAA4C,EAAE;QACxD,MAAM,OAAO,GAAG,YAAY,CAAC,eAAe,CAAC,CAAA;QAC7C,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AAM,EAAE,MAAM;YACd,IAAI;YACJ,WAAW,EAAE,SAAS;SACvB,CAAC,CAAA;IACJ,CAAC;IAED,GAAG,CACD,IAAiC;QAEjC,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE;YAC/B,QAAQ,EAAE,yBAAyB;YACnC,MAAM,EAAE,MAAM;YACd,IAAI;YACJ,WAAW,EAAE,UAAU;SACxB,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,CACF,IAAkC;QAElC,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE;YAC/B,QAAQ,EAAE,0BAA0B;YACpC,MAAM,EAAE,MAAM;YACd,IAAI;YACJ,WAAW,EAAE,WAAW;SACzB,CAAC,CAAA;IACJ,CAAC;IAED,aAAa,CACX,IAA2C;QAE3C,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE;YAC/B,QAAQ,EAAE,oCAAoC;YAC9C,MAAM,EAAE,MAAM;YACd,IAAI;YACJ,WAAW,EAAE,SAAS;SACvB,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,CACJ,IAAkC;QAElC,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE;YAC/B,QAAQ,EAAE,4BAA4B;YACtC,MAAM,EAAE,MAAM;YACd,IAAI;YACJ,WAAW,EAAE,UAAU;SACxB,CAAC,CAAA;IACJ,CAAC;CACF"}
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const seamapiJavascriptHttpVersion = "1.25.0";
1
+ declare const seamapiJavascriptHttpVersion = "1.26.0";
2
2
  export default seamapiJavascriptHttpVersion;
package/lib/version.js CHANGED
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '1.25.0';
1
+ const seamapiJavascriptHttpVersion = '1.26.0';
2
2
  export default seamapiJavascriptHttpVersion;
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamapi/http",
3
- "version": "1.25.0",
3
+ "version": "1.26.0",
4
4
  "description": "JavaScript HTTP client for the Seam API written in TypeScript.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -84,7 +84,7 @@
84
84
  "npm": ">= 9.0.0"
85
85
  },
86
86
  "peerDependencies": {
87
- "@seamapi/types": "^1.351.1"
87
+ "@seamapi/types": "^1.365.0"
88
88
  },
89
89
  "peerDependenciesMeta": {
90
90
  "@seamapi/types": {
@@ -92,14 +92,14 @@
92
92
  }
93
93
  },
94
94
  "dependencies": {
95
- "@seamapi/url-search-params-serializer": "^1.1.0",
95
+ "@seamapi/url-search-params-serializer": "^1.2.0",
96
96
  "axios": "^1.5.0",
97
97
  "axios-better-stacktrace": "^2.1.7",
98
98
  "axios-retry": "^4.4.2"
99
99
  },
100
100
  "devDependencies": {
101
- "@seamapi/fake-seam-connect": "^1.76.0",
102
- "@seamapi/types": "1.351.1",
101
+ "@seamapi/fake-seam-connect": "^1.77.0",
102
+ "@seamapi/types": "1.365.0",
103
103
  "@types/eslint": "^8.44.2",
104
104
  "@types/jsonwebtoken": "^9.0.6",
105
105
  "@types/node": "^20.8.10",
@@ -33,6 +33,7 @@ export * from './phones-simulate.js'
33
33
  export * from './thermostats.js'
34
34
  export * from './thermostats-schedules.js'
35
35
  export * from './thermostats-simulate.js'
36
+ export * from './unstable-locations.js'
36
37
  export * from './user-identities.js'
37
38
  export * from './user-identities-enrollment-automations.js'
38
39
  export * from './webhooks.js'
@@ -0,0 +1,303 @@
1
+ /*
2
+ * Automatically generated by generate-routes.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 {
9
+ getAuthHeadersForClientSessionToken,
10
+ warnOnInsecureuserIdentifierKey,
11
+ } from 'lib/seam/connect/auth.js'
12
+ import { type Client, createClient } from 'lib/seam/connect/client.js'
13
+ import {
14
+ isSeamHttpOptionsWithApiKey,
15
+ isSeamHttpOptionsWithClient,
16
+ isSeamHttpOptionsWithClientSessionToken,
17
+ isSeamHttpOptionsWithConsoleSessionToken,
18
+ isSeamHttpOptionsWithPersonalAccessToken,
19
+ type SeamHttpFromPublishableKeyOptions,
20
+ SeamHttpInvalidOptionsError,
21
+ type SeamHttpOptions,
22
+ type SeamHttpOptionsWithApiKey,
23
+ type SeamHttpOptionsWithClient,
24
+ type SeamHttpOptionsWithClientSessionToken,
25
+ type SeamHttpOptionsWithConsoleSessionToken,
26
+ type SeamHttpOptionsWithPersonalAccessToken,
27
+ type SeamHttpRequestOptions,
28
+ } from 'lib/seam/connect/options.js'
29
+ import {
30
+ limitToSeamHttpRequestOptions,
31
+ parseOptions,
32
+ } from 'lib/seam/connect/parse-options.js'
33
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
34
+ import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
35
+ import type { SetNonNullable } from 'lib/types.js'
36
+
37
+ import { SeamHttpClientSessions } from './client-sessions.js'
38
+
39
+ export class SeamHttpUnstableLocations {
40
+ client: Client
41
+ readonly defaults: Required<SeamHttpRequestOptions>
42
+
43
+ constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
44
+ const options = parseOptions(apiKeyOrOptions)
45
+ this.client = 'client' in options ? options.client : createClient(options)
46
+ this.defaults = limitToSeamHttpRequestOptions(options)
47
+ }
48
+
49
+ static fromClient(
50
+ client: SeamHttpOptionsWithClient['client'],
51
+ options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
52
+ ): SeamHttpUnstableLocations {
53
+ const constructorOptions = { ...options, client }
54
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
55
+ throw new SeamHttpInvalidOptionsError('Missing client')
56
+ }
57
+ return new SeamHttpUnstableLocations(constructorOptions)
58
+ }
59
+
60
+ static fromApiKey(
61
+ apiKey: SeamHttpOptionsWithApiKey['apiKey'],
62
+ options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
63
+ ): SeamHttpUnstableLocations {
64
+ const constructorOptions = { ...options, apiKey }
65
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
66
+ throw new SeamHttpInvalidOptionsError('Missing apiKey')
67
+ }
68
+ return new SeamHttpUnstableLocations(constructorOptions)
69
+ }
70
+
71
+ static fromClientSessionToken(
72
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
73
+ options: Omit<
74
+ SeamHttpOptionsWithClientSessionToken,
75
+ 'clientSessionToken'
76
+ > = {},
77
+ ): SeamHttpUnstableLocations {
78
+ const constructorOptions = { ...options, clientSessionToken }
79
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
80
+ throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
81
+ }
82
+ return new SeamHttpUnstableLocations(constructorOptions)
83
+ }
84
+
85
+ static async fromPublishableKey(
86
+ publishableKey: string,
87
+ userIdentifierKey: string,
88
+ options: SeamHttpFromPublishableKeyOptions = {},
89
+ ): Promise<SeamHttpUnstableLocations> {
90
+ warnOnInsecureuserIdentifierKey(userIdentifierKey)
91
+ const clientOptions = parseOptions({ ...options, publishableKey })
92
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
93
+ throw new SeamHttpInvalidOptionsError(
94
+ 'The client option cannot be used with SeamHttp.fromPublishableKey',
95
+ )
96
+ }
97
+ const client = createClient(clientOptions)
98
+ const clientSessions = SeamHttpClientSessions.fromClient(client)
99
+ const { token } = await clientSessions.getOrCreate({
100
+ user_identifier_key: userIdentifierKey,
101
+ })
102
+ return SeamHttpUnstableLocations.fromClientSessionToken(token, options)
103
+ }
104
+
105
+ static fromConsoleSessionToken(
106
+ consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
107
+ workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
108
+ options: Omit<
109
+ SeamHttpOptionsWithConsoleSessionToken,
110
+ 'consoleSessionToken' | 'workspaceId'
111
+ > = {},
112
+ ): SeamHttpUnstableLocations {
113
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId }
114
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
115
+ throw new SeamHttpInvalidOptionsError(
116
+ 'Missing consoleSessionToken or workspaceId',
117
+ )
118
+ }
119
+ return new SeamHttpUnstableLocations(constructorOptions)
120
+ }
121
+
122
+ static fromPersonalAccessToken(
123
+ personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
124
+ workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
125
+ options: Omit<
126
+ SeamHttpOptionsWithPersonalAccessToken,
127
+ 'personalAccessToken' | 'workspaceId'
128
+ > = {},
129
+ ): SeamHttpUnstableLocations {
130
+ const constructorOptions = { ...options, personalAccessToken, workspaceId }
131
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
132
+ throw new SeamHttpInvalidOptionsError(
133
+ 'Missing personalAccessToken or workspaceId',
134
+ )
135
+ }
136
+ return new SeamHttpUnstableLocations(constructorOptions)
137
+ }
138
+
139
+ createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
140
+ request: SeamHttpRequest<TResponse, TResponseKey>,
141
+ ): SeamPaginator<TResponse, TResponseKey> {
142
+ return new SeamPaginator<TResponse, TResponseKey>(this, request)
143
+ }
144
+
145
+ async updateClientSessionToken(
146
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
147
+ ): Promise<void> {
148
+ const { headers } = this.client.defaults
149
+ const authHeaders = getAuthHeadersForClientSessionToken({
150
+ clientSessionToken,
151
+ })
152
+ for (const key of Object.keys(authHeaders)) {
153
+ if (headers[key] == null) {
154
+ throw new Error(
155
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
156
+ )
157
+ }
158
+ }
159
+ this.client.defaults.headers = { ...headers, ...authHeaders }
160
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
161
+ await clientSessions.get()
162
+ }
163
+
164
+ addDevices(
165
+ body?: UnstableLocationsAddDevicesBody,
166
+ ): SeamHttpRequest<void, undefined> {
167
+ return new SeamHttpRequest(this, {
168
+ pathname: '/unstable_locations/add_devices',
169
+ method: 'post',
170
+ body,
171
+ responseKey: undefined,
172
+ })
173
+ }
174
+
175
+ create(
176
+ body?: UnstableLocationsCreateBody,
177
+ ): SeamHttpRequest<UnstableLocationsCreateResponse, 'location'> {
178
+ return new SeamHttpRequest(this, {
179
+ pathname: '/unstable_locations/create',
180
+ method: 'post',
181
+ body,
182
+ responseKey: 'location',
183
+ })
184
+ }
185
+
186
+ delete(
187
+ body?: UnstableLocationsDeleteParams,
188
+ ): SeamHttpRequest<void, undefined> {
189
+ return new SeamHttpRequest(this, {
190
+ pathname: '/unstable_locations/delete',
191
+ method: 'post',
192
+ body,
193
+ responseKey: undefined,
194
+ })
195
+ }
196
+
197
+ get(
198
+ body?: UnstableLocationsGetParams,
199
+ ): SeamHttpRequest<UnstableLocationsGetResponse, 'location'> {
200
+ return new SeamHttpRequest(this, {
201
+ pathname: '/unstable_locations/get',
202
+ method: 'post',
203
+ body,
204
+ responseKey: 'location',
205
+ })
206
+ }
207
+
208
+ list(
209
+ body?: UnstableLocationsListParams,
210
+ ): SeamHttpRequest<UnstableLocationsListResponse, 'locations'> {
211
+ return new SeamHttpRequest(this, {
212
+ pathname: '/unstable_locations/list',
213
+ method: 'post',
214
+ body,
215
+ responseKey: 'locations',
216
+ })
217
+ }
218
+
219
+ removeDevices(
220
+ body?: UnstableLocationsRemoveDevicesParams,
221
+ ): SeamHttpRequest<void, undefined> {
222
+ return new SeamHttpRequest(this, {
223
+ pathname: '/unstable_locations/remove_devices',
224
+ method: 'post',
225
+ body,
226
+ responseKey: undefined,
227
+ })
228
+ }
229
+
230
+ update(
231
+ body?: UnstableLocationsUpdateBody,
232
+ ): SeamHttpRequest<UnstableLocationsUpdateResponse, 'location'> {
233
+ return new SeamHttpRequest(this, {
234
+ pathname: '/unstable_locations/update',
235
+ method: 'post',
236
+ body,
237
+ responseKey: 'location',
238
+ })
239
+ }
240
+ }
241
+
242
+ export type UnstableLocationsAddDevicesBody =
243
+ RouteRequestBody<'/unstable_locations/add_devices'>
244
+
245
+ export type UnstableLocationsAddDevicesResponse = SetNonNullable<
246
+ Required<RouteResponse<'/unstable_locations/add_devices'>>
247
+ >
248
+
249
+ export type UnstableLocationsAddDevicesOptions = never
250
+
251
+ export type UnstableLocationsCreateBody =
252
+ RouteRequestBody<'/unstable_locations/create'>
253
+
254
+ export type UnstableLocationsCreateResponse = SetNonNullable<
255
+ Required<RouteResponse<'/unstable_locations/create'>>
256
+ >
257
+
258
+ export type UnstableLocationsCreateOptions = never
259
+
260
+ export type UnstableLocationsDeleteParams =
261
+ RouteRequestBody<'/unstable_locations/delete'>
262
+
263
+ export type UnstableLocationsDeleteResponse = SetNonNullable<
264
+ Required<RouteResponse<'/unstable_locations/delete'>>
265
+ >
266
+
267
+ export type UnstableLocationsDeleteOptions = never
268
+
269
+ export type UnstableLocationsGetParams =
270
+ RouteRequestBody<'/unstable_locations/get'>
271
+
272
+ export type UnstableLocationsGetResponse = SetNonNullable<
273
+ Required<RouteResponse<'/unstable_locations/get'>>
274
+ >
275
+
276
+ export type UnstableLocationsGetOptions = never
277
+
278
+ export type UnstableLocationsListParams =
279
+ RouteRequestBody<'/unstable_locations/list'>
280
+
281
+ export type UnstableLocationsListResponse = SetNonNullable<
282
+ Required<RouteResponse<'/unstable_locations/list'>>
283
+ >
284
+
285
+ export type UnstableLocationsListOptions = never
286
+
287
+ export type UnstableLocationsRemoveDevicesParams =
288
+ RouteRequestBody<'/unstable_locations/remove_devices'>
289
+
290
+ export type UnstableLocationsRemoveDevicesResponse = SetNonNullable<
291
+ Required<RouteResponse<'/unstable_locations/remove_devices'>>
292
+ >
293
+
294
+ export type UnstableLocationsRemoveDevicesOptions = never
295
+
296
+ export type UnstableLocationsUpdateBody =
297
+ RouteRequestBody<'/unstable_locations/update'>
298
+
299
+ export type UnstableLocationsUpdateResponse = SetNonNullable<
300
+ Required<RouteResponse<'/unstable_locations/update'>>
301
+ >
302
+
303
+ export type UnstableLocationsUpdateOptions = never
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '1.25.0'
1
+ const seamapiJavascriptHttpVersion = '1.26.0'
2
2
 
3
3
  export default seamapiJavascriptHttpVersion