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

Commit 37cc03f

Browse files
committed
Normalize getClientSessionToken options type
1 parent ec99ba9 commit 37cc03f

2 files changed

Lines changed: 19 additions & 18 deletions

File tree

docs/classes/Seam.md

Lines changed: 7 additions & 2 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: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,24 +159,28 @@ export class Seam extends Routes {
159159
}
160160
}
161161

162-
static async getClientSessionToken(
163-
ops: CSTParams
164-
): Promise<APIResponse<ClientSessionResponse>> {
162+
static async getClientSessionToken(options: {
163+
publishableKey?: string
164+
userIdentifierKey: string
165+
endpoint?: string
166+
workspaceId?: string
167+
apiKey?: string
168+
}): Promise<APIResponse<ClientSessionResponse>> {
165169
const { apiKey, endpoint, axiosOptions } =
166-
getSeamClientOptionsWithDefaults(ops)
170+
getSeamClientOptionsWithDefaults(options)
167171
let headers: AxiosRequestHeaders = {
168172
...axiosOptions?.headers,
169173
}
170174

171-
if (ops.publishableKey?.startsWith("seam_pk")) {
175+
if (options.publishableKey?.startsWith("seam_pk")) {
172176
// frontend mode
173-
headers["seam-publishable-key"] = ops.publishableKey
177+
headers["seam-publishable-key"] = options.publishableKey
174178
} else if (apiKey?.startsWith("seam_")) {
175179
// backend mode
176180
headers["seam-api-key"] = apiKey
177181
}
178-
if (ops.userIdentifierKey) {
179-
headers["seam-user-identifier-key"] = ops.userIdentifierKey
182+
if (options.userIdentifierKey) {
183+
headers["seam-user-identifier-key"] = options.userIdentifierKey
180184
} else {
181185
throw new Error("userIdentifierKey is required")
182186
}
@@ -204,11 +208,3 @@ export class Seam extends Routes {
204208
}
205209
}
206210
}
207-
208-
type CSTParams = {
209-
publishableKey?: string
210-
userIdentifierKey: string
211-
endpoint?: string
212-
workspaceId?: string
213-
apiKey?: string
214-
}

0 commit comments

Comments
 (0)