-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
89 lines (75 loc) · 2.02 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
type _Num = "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "0";
export type Scalar = number | string | boolean;
export type FilePath = `${string}.${string}`;
export interface ICommand<ActionArgs extends string[]> {
name: string;
description: string;
action: (args: ActionArgs) => void;
arguments?: ActionArgs;
}
export interface IVersion {
year: `${_Num}${_Num}`;
month: `${_Num}${_Num}`;
minor: `${number}`;
patch: `${number}`;
separator: ".";
prefix: "" | "v";
}
export type ValidVersion =
`${IVersion["prefix"]}${IVersion["year"]}${IVersion["separator"]}${IVersion[
"month"
]}${IVersion["separator"]}${IVersion["minor"]}${IVersion[
"separator"
]}${IVersion["patch"]}`;
export interface IAPIResponseError {
error: boolean;
message: string;
}
export interface IGitHubResponseError {
error: string;
// deno-lint-ignore camelcase
error_description: string;
// deno-lint-ignore camelcase
error_uri: string;
}
export interface IGitHubGetUserCodePayload {
// deno-lint-ignore camelcase
client_id: string;
scope?: string;
}
export interface IGitHubGetUserCodeResponseOK {
// deno-lint-ignore camelcase
device_code: string;
// deno-lint-ignore camelcase
user_code: string;
// deno-lint-ignore camelcase
verification_uri: string;
// deno-lint-ignore camelcase
expires_in: number;
interval: number;
}
export type GitHubGetUserCodeResponse =
| IGitHubGetUserCodeResponseOK
| IGitHubResponseError;
export interface IGitHubPollAuthPayload {
// deno-lint-ignore camelcase
client_id: string;
// deno-lint-ignore camelcase
device_code: string;
// deno-lint-ignore camelcase
grant_type: "urn:ietf:params:oauth:grant-type:device_code";
}
export interface IGitHubPollAuthResponseOK {
// deno-lint-ignore camelcase
access_token: string;
// deno-lint-ignore camelcase
token_type: "bearer";
scope: string;
}
export type GitHubPollAuthResponse =
| IGitHubPollAuthResponseOK
| IGitHubResponseError;
export type PollOptions = {
interval: number;
expiresIn: number;
};