MCPcopy Index your code
hub / github.com/lingodotdev/lingo.dev / createCliSession

Function createCliSession

packages/cli/src/cli/cmd/login.ts:83–93  ·  view source on GitHub ↗
(apiUrl: string, verifier: string)

Source from the content-addressed store, hash-verified

81};
82
83async function createCliSession(apiUrl: string, verifier: string): Promise<CreateSessionResponse> {
84 const res = await fetch(`${apiUrl}/cli-sessions`, {
85 method: "POST",
86 headers: { "Content-Type": "application/json" },
87 body: JSON.stringify({ verifier }),
88 });
89 if (!res.ok) {
90 throw new Error(`Failed to start CLI session (HTTP ${res.status})`);
91 }
92 return (await res.json()) as CreateSessionResponse;
93}
94
95async function pollForApiKey(apiUrl: string, sessionId: string, verifier: string): Promise<string> {
96 const deadline = Date.now() + POLL_TIMEOUT_MS;

Callers 1

loginFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected