Add API types
This commit is contained in:
parent
d60ed432ce
commit
6fb581f7fe
11
src/types/Category.ts
Normal file
11
src/types/Category.ts
Normal file
@ -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
|
||||
}
|
25
src/types/CategoryData.ts
Normal file
25
src/types/CategoryData.ts
Normal file
@ -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[]
|
||||
}
|
18
src/types/Chat.ts
Normal file
18
src/types/Chat.ts
Normal file
@ -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 }
|
||||
}
|
6
src/types/Emote.ts
Normal file
6
src/types/Emote.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export interface Emote {
|
||||
name: string,
|
||||
urls : {
|
||||
[k: string]: string
|
||||
}
|
||||
}
|
9
src/types/Search.ts
Normal file
9
src/types/Search.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import type { StreamData, StreamerData } from "./"
|
||||
import type { Category } from "./"
|
||||
|
||||
export interface SearchResult {
|
||||
channels: StreamerData[]
|
||||
categories: Category[]
|
||||
relatedChannels: StreamData[]
|
||||
channelsWithTag: StreamData[]
|
||||
}
|
28
src/types/Streamer.ts
Normal file
28
src/types/Streamer.ts
Normal file
@ -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
|
||||
}
|
7
src/types/index.ts
Normal file
7
src/types/index.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export * from './Search'
|
||||
export * from './Streamer'
|
||||
export * from './Chat'
|
||||
export * from './Chat'
|
||||
export * from './Category'
|
||||
export * from './CategoryData'
|
||||
|
Loading…
x
Reference in New Issue
Block a user