Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit 029b165

Browse files
feat: Add clientSessions.create and clientSessions.getOrCreate (#205)
* Add clientSessions.create and *.getOrCreate * Fix tests * Add container logs to CI * Update src/seam-connect/routes.ts Co-authored-by: Evan Sosenko <[email protected]> --------- Co-authored-by: Evan Sosenko <[email protected]>
1 parent c8b2328 commit 029b165

File tree

10 files changed

+142
-53
lines changed

10 files changed

+142
-53
lines changed

docs/classes/Seam.md

Lines changed: 35 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/interfaces/ClientSession.md

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/interfaces/ClientSessionResponse.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/modules.md

Lines changed: 50 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/seam-connect/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
SuccessfulAPIResponse,
1414
} from "../types/globals"
1515
import { version } from "../../package.json"
16-
import { ClientSessionResponse } from "../types"
16+
import { ClientSessionsResponse } from "../types"
1717

1818
export interface SeamClientOptions {
1919
/* Seam API Key */
@@ -102,7 +102,7 @@ export class Seam extends Routes {
102102
endpoint?: string
103103
workspaceId?: string
104104
apiKey?: string
105-
}): Promise<APIResponse<ClientSessionResponse>> {
105+
}): Promise<APIResponse<ClientSessionsResponse>> {
106106
const { apiKey, endpoint, axiosOptions } =
107107
getSeamClientOptionsWithDefaults(options)
108108

src/seam-connect/routes.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ import {
4242
NoiseThresholdsDeleteRequest,
4343
NoiseThresholdsCreateRequest,
4444
NoiseThresholdsUpdateRequest,
45+
ClientSessionsCreateRequest,
46+
ClientSessionsGetOrCreateRequest,
4547
UnmanagedAccessCodeConvertToManagedRequest,
4648
DeviceModelsListRequest,
4749
} from "../types/route-requests"
@@ -72,6 +74,7 @@ import {
7274
WorkspaceResetSandboxResponse,
7375
WorkspacesListResponse,
7476
NoiseThresholdsListResponse,
77+
ClientSessionsResponse,
7578
DeviceModelsListResponse,
7679
} from "../types/route-responses"
7780

@@ -467,6 +470,21 @@ export abstract class Routes {
467470
}),
468471
}
469472

473+
public readonly clientSessions = {
474+
create: (params: ClientSessionsCreateRequest) =>
475+
this.makeRequestAndFormat<ClientSessionsResponse>("client_session", {
476+
url: "/client_sessions/create",
477+
method: "POST",
478+
params,
479+
}),
480+
getOrCreate: (params: ClientSessionsGetOrCreateRequest) =>
481+
this.makeRequestAndFormat<ClientSessionsResponse>("client_session", {
482+
url: "/client_sessions/create",
483+
method: "PUT",
484+
params,
485+
}),
486+
}
487+
470488
public readonly deviceModels = {
471489
list: (params?: DeviceModelsListRequest) =>
472490
this.makeRequestAndFormat<DeviceModelsListResponse>("device_models", {

src/types/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ export type Event = Flatten<SeamEvent["event_type"]>
347347

348348
export interface ClientSession {
349349
token: string
350-
user_id: string
350+
client_session_id: string
351351
created_at: string
352352
}
353353

src/types/route-requests.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,14 @@ export type NoiseThresholdsDeleteRequest = {
211211
noise_threshold_id: string
212212
}
213213

214+
export type ClientSessionsCreateRequest = {
215+
user_identifier_key: string
216+
connect_webview_ids?: string[]
217+
connected_account_ids?: string[]
218+
}
219+
220+
export type ClientSessionsGetOrCreateRequest = ClientSessionsCreateRequest
221+
214222
export type DeviceModelsListRequest = {
215223
main_category?: string
216224
support_level?: string

0 commit comments

Comments
 (0)