diff --git a/types/package.json b/types/package.json new file mode 100644 index 00000000..417a7998 --- /dev/null +++ b/types/package.json @@ -0,0 +1,19 @@ +{ + "name": "@oengusio/types", + "version": "1.0.0", + "description": "Javascript API typings for the oengus API", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/esamarathon/oengus-webapp.git" + }, + "author": "duncte123", + "license": "AGPL-3.0", + "bugs": { + "url": "https://github.com/esamarathon/oengus-webapp/issues" + }, + "homepage": "https://github.com/esamarathon/oengus-webapp#readme" +} diff --git a/types/src/Profile.ts b/types/src/Profile.ts new file mode 100644 index 00000000..9b49e15b --- /dev/null +++ b/types/src/Profile.ts @@ -0,0 +1,12 @@ +import SocialAccount from './SocialAccount'; + +export default interface Profile { + id: number; + username: string; + displayName: string; + enabled: boolean; + pronouns: string[]; + languagesSpoken: string[]; + connections: SocialAccount[]; + country: string; +} diff --git a/types/src/SocialAccount.ts b/types/src/SocialAccount.ts new file mode 100644 index 00000000..95580c48 --- /dev/null +++ b/types/src/SocialAccount.ts @@ -0,0 +1,19 @@ +export type ConnectionPlatform = + 'DISCORD' | + 'EMAIL' | + 'FACEBOOK' | + 'INSTAGRAM' | + 'PHONE' | + 'NICO' | + 'MASTODON' | + 'SNAPCHAT' | + 'SPEEDRUNCOM' | + 'TWITCH' | + 'TWITTER' | + 'YOUTUBE'; + +export default interface SocialAccount { + id?: number; + platform: ConnectionPlatform | string; + username: string; +} diff --git a/types/src/index.ts b/types/src/index.ts new file mode 100644 index 00000000..e69de29b diff --git a/types/src/user.ts b/types/src/user.ts new file mode 100644 index 00000000..1edca070 --- /dev/null +++ b/types/src/user.ts @@ -0,0 +1,22 @@ +import SocialAccount from './SocialAccount'; + +/** + * @deprecated should be replaced with profile instead + */ +export default interface User { + id: number; + username: string; + displayName: string; + mail: string; + // stored as comma seperated list in db + pronouns: string; + languagesSpoken: string; + country: string; + roles: string[]; + connections: SocialAccount[]; + enabled: boolean; + discordId: number; + twitterId: string; + twitchId: string; + patreonId: string; +}