forked from clerk/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.ts
More file actions
28 lines (26 loc) · 707 Bytes
/
Copy pathClient.ts
File metadata and controls
28 lines (26 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import type { ClientJSON } from './JSON';
import { Session } from './Session';
export class Client {
constructor(
readonly id: string,
readonly sessionIds: string[],
readonly sessions: Session[],
readonly signInId: string | null,
readonly signUpId: string | null,
readonly lastActiveSessionId: string | null,
readonly createdAt: number,
readonly updatedAt: number,
) {}
static fromJSON(data: ClientJSON): Client {
return new Client(
data.id,
data.session_ids,
data.sessions.map(x => Session.fromJSON(x)),
data.sign_in_id,
data.sign_up_id,
data.last_active_session_id,
data.created_at,
data.updated_at,
);
}
}