pronounsfu/frontend/lib/types.ts

98 lines
1.6 KiB
TypeScript
Raw Normal View History

2022-05-12 07:41:32 -07:00
export interface MeUser extends User {
2022-05-05 07:33:44 -07:00
discord: string | null;
discord_username: string | null;
}
2022-05-10 07:33:29 -07:00
export interface User {
id: string;
username: string;
display_name: string | null;
bio: string | null;
avatar_urls: string[] | null;
2022-05-10 07:33:29 -07:00
links: string[] | null;
members: PartialMember[];
2022-10-27 08:11:10 -07:00
names: Name[];
pronouns: Pronoun[];
2022-05-10 17:23:45 -07:00
fields: Field[];
2022-05-10 07:33:29 -07:00
}
export interface PartialMember {
id: string;
name: string;
2022-10-27 08:11:10 -07:00
avatar_urls: string[] | null;
}
export interface Member extends PartialMember {
bio: string | null;
links: string[] | null;
id: string;
name: string;
avatar_urls: string[] | null;
user?: PartialUser;
2022-05-10 07:33:29 -07:00
}
export interface Name {
name: string;
status: WordStatus;
}
export interface Pronoun {
display_text?: string;
pronouns: string;
status: WordStatus;
}
2022-05-10 17:23:45 -07:00
export interface Field {
name: string;
favourite: string[] | null;
okay: string[] | null;
jokingly: string[] | null;
friends_only: string[] | null;
avoid: string[] | null;
}
2022-05-05 07:33:44 -07:00
export interface APIError {
code: ErrorCode;
message?: string;
2022-05-26 07:11:22 -07:00
details?: string;
2022-05-05 07:33:44 -07:00
}
export enum WordStatus {
Favourite = 1,
Okay = 2,
Jokingly = 3,
FriendsOnly = 4,
Avoid = 5,
}
2022-05-05 07:33:44 -07:00
export enum ErrorCode {
BadRequest = 400,
Forbidden = 403,
InternalServerError = 500,
InvalidState = 1001,
InvalidOAuthCode = 1002,
InvalidToken = 1003,
2022-05-05 07:33:44 -07:00
UserNotFound = 2001,
}
2022-05-26 07:11:22 -07:00
export interface SignupRequest {
username: string;
ticket: string;
invite_code?: string;
}
2022-10-27 08:11:10 -07:00
2022-11-17 17:17:27 -08:00
export interface SignupResponse {
user: MeUser;
token: string;
}
2022-10-27 08:11:10 -07:00
export interface PartialUser {
id: string;
username: string;
display_name: string | null;
avatar_urls: string[] | null;
}