-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.ts
29 lines (21 loc) · 912 Bytes
/
types.ts
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
29
import type { paths } from "../openapi";
export type CodexSprTextResponse =
paths["/spr"]["get"]["responses"][200]["content"]["text/plain"];
export type CodexSprJsonResponse =
paths["/spr"]["get"]["responses"][200]["content"]["application/json"];
export type CodexSprContentType = "json" | "text";
export type CodexSpr<T extends CodexSprContentType> = T extends "json"
? CodexSprJsonResponse
: T extends "text"
? CodexSprTextResponse
: never;
export type CodexPeerIdTextResponse =
paths["/peerid"]["get"]["responses"][200]["content"]["text/plain"];
export type CodexPeerIdJsonResponse =
paths["/peerid"]["get"]["responses"][200]["content"]["application/json"];
export type CodexPeerIdContentType = "json" | "text";
export type CodexPeerId<T extends CodexPeerIdContentType> = T extends "json"
? CodexPeerIdJsonResponse
: T extends "text"
? CodexPeerIdTextResponse
: never;