From 6fb581f7fe9742249a1ee0deb22109e6e0d76ff4 Mon Sep 17 00:00:00 2001 From: dragongoose Date: Sun, 18 Jun 2023 23:19:20 -0400 Subject: [PATCH] Add API types --- src/types/Category.ts | 11 +++++++++++ src/types/CategoryData.ts | 25 +++++++++++++++++++++++++ src/types/Chat.ts | 18 ++++++++++++++++++ src/types/Emote.ts | 6 ++++++ src/types/Search.ts | 9 +++++++++ src/types/Streamer.ts | 28 ++++++++++++++++++++++++++++ src/types/index.ts | 7 +++++++ 7 files changed, 104 insertions(+) create mode 100644 src/types/Category.ts create mode 100644 src/types/CategoryData.ts create mode 100644 src/types/Chat.ts create mode 100644 src/types/Emote.ts create mode 100644 src/types/Search.ts create mode 100644 src/types/Streamer.ts create mode 100644 src/types/index.ts diff --git a/src/types/Category.ts b/src/types/Category.ts new file mode 100644 index 0000000..dd3a36a --- /dev/null +++ b/src/types/Category.ts @@ -0,0 +1,11 @@ +export type Tag = string + +export interface Category { + name: string + displayName: string + viewers: number + tags: Tag[] + createdAt?: Date + cursor?: string + image: string +} \ No newline at end of file diff --git a/src/types/CategoryData.ts b/src/types/CategoryData.ts new file mode 100644 index 0000000..d47cfc0 --- /dev/null +++ b/src/types/CategoryData.ts @@ -0,0 +1,25 @@ +import type { Tag } from "./" +import type { StreamData } from "./" + +export interface CategoryMinifiedStream { + title: string + viewers: number + preview: string + tags: Tag[] + cursor: string + streamer: { + name: string + pfp: string + colorHex: string + } + } + +export interface CategoryData { + name: string + cover: string + description: string + viewers: number + followers: number + tags: Tag[] + streams: CategoryMinifiedStream[] + } \ No newline at end of file diff --git a/src/types/Chat.ts b/src/types/Chat.ts new file mode 100644 index 0000000..cdee99e --- /dev/null +++ b/src/types/Chat.ts @@ -0,0 +1,18 @@ +export interface TwitchChatOptions { + login: { + username: string, + password: string + }, + channels: string[] +} + +export const MessageTypes = ['PRIVMSG', 'WHISPER'] +export type MessageType = typeof MessageTypes[number]; + +export interface Metadata { + username: string + messageType: MessageType + channel: string + message: string + tags: { [k:string]:any } +} diff --git a/src/types/Emote.ts b/src/types/Emote.ts new file mode 100644 index 0000000..89d9ad6 --- /dev/null +++ b/src/types/Emote.ts @@ -0,0 +1,6 @@ +export interface Emote { + name: string, + urls : { + [k: string]: string + } +} \ No newline at end of file diff --git a/src/types/Search.ts b/src/types/Search.ts new file mode 100644 index 0000000..8b5947d --- /dev/null +++ b/src/types/Search.ts @@ -0,0 +1,9 @@ +import type { StreamData, StreamerData } from "./" +import type { Category } from "./" + +export interface SearchResult { + channels: StreamerData[] + categories: Category[] + relatedChannels: StreamData[] + channelsWithTag: StreamData[] +} \ No newline at end of file diff --git a/src/types/Streamer.ts b/src/types/Streamer.ts new file mode 100644 index 0000000..c105b73 --- /dev/null +++ b/src/types/Streamer.ts @@ -0,0 +1,28 @@ +export interface Social { + type: string | null + text: string, + link: string +} + +export interface StreamData { + tags: string[] + title: string + topic: string + startedAt: number + viewers: number + preview: string + cursor?: string +} + +export interface StreamerData { + username: string + followers: number + isLive: boolean + about: string + socials?: Social[] + pfp: string + stream?: StreamData | null + isPartner: boolean | null + colorHex: string + id: number +} \ No newline at end of file diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 0000000..becf132 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,7 @@ +export * from './Search' +export * from './Streamer' +export * from './Chat' +export * from './Chat' +export * from './Category' +export * from './CategoryData' +