-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbindings.ts
64 lines (50 loc) · 2.48 KB
/
bindings.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
/* eslint-disable */
// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually.
declare global {
interface Window {
__TAURI_INVOKE__<T>(cmd: string, args?: Record<string, unknown>): Promise<T>;
}
}
// Function avoids 'window not defined' in SSR
const invoke = () => window.__TAURI_INVOKE__;
export function errorPopup(msg: string) {
return invoke()<null>("error_popup", { msg })
}
export function getSettings() {
return invoke()<Settings>("get_settings")
}
export function tags() {
return invoke()<string[]>("tags")
}
export function setChannels(channels: Channel[]) {
return invoke()<null>("set_channels", { channels })
}
export function addChannel(options: AddChannelOptions) {
return invoke()<null>("add_channel", { options })
}
export function setGeneralSettings(apiKey: string, maxConcurrentRequests: number, checkInBackground: boolean) {
return invoke()<null>("set_general_settings", { apiKey,maxConcurrentRequests,checkInBackground })
}
export function checkNow() {
return invoke()<null>("check_now")
}
export function getHistory() {
return invoke()<UndoHistory>("get_history")
}
export function getVideos(options: Options, after: After | null) {
return invoke()<Video[]>("get_videos", { options,after })
}
export function archive(id: string) {
return invoke()<null>("archive", { id })
}
export function unarchive(id: string) {
return invoke()<null>("unarchive", { id })
}
export type Settings = { api_key: string; max_concurrent_requests: number; channels: Channel[]; check_in_background: boolean }
export type Options = { show_all: boolean; show_archived: boolean; channel_filter: string; tag: string | null; limit: number }
export type Video = { id: string; title: string; description: string; publishTimeMs: number; durationMs: number; thumbnailStandard: boolean; thumbnailMaxres: boolean; channelId: string; channelName: string; unread: boolean; archived: boolean }
export type After = { publishTimeMs: number; id: string }
export type Channel = { id: string; name: string; icon: string; uploads_playlist_id: string; from_time: number; refresh_rate_ms: number; tags: string[] }
export type UndoHistory = { entries: ([number, Action])[] }
export type AddChannelOptions = { url: string; from_time: number; refresh_rate_ms: number; tags: string[] }
export type Action = "CheckNow" | { Archive: string } | { Unarchive: string } | { AddChannel: string } | { UpdateOrDeleteChannels: string }