[READ-ONLY] Mirror of https://github.com/probablykasper/ferrum. Music library app for Mac, Linux and Windows ferrum.kasper.space
electron linux macos music music-library music-player napi windows
0

Configure Feed

Select the types of activity you want to include in your feed.

ferrum / mobile / bindings.ts
5.7 kB 140 lines
1 2// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually. 3 4/** user-defined commands **/ 5 6 7export const commands = { 8async errorPopup(msg: string) : Promise<void> { 9 await TAURI_INVOKE("error_popup", { msg }); 10}, 11async loadLibrary(libraryJson: string) : Promise<Result<LibraryTauri, string>> { 12 try { 13 return { status: "ok", data: await TAURI_INVOKE("load_library", { libraryJson }) }; 14} catch (e) { 15 if(e instanceof Error) throw e; 16 else return { status: "error", error: e as any }; 17} 18}, 19async openFilePersistentAndroid() : Promise<Result<string | null, string>> { 20 try { 21 return { status: "ok", data: await TAURI_INVOKE("open_file_persistent_android") }; 22} catch (e) { 23 if(e instanceof Error) throw e; 24 else return { status: "error", error: e as any }; 25} 26}, 27async getTrackByItemId(itemId: number) : Promise<Result<Track, string>> { 28 try { 29 return { status: "ok", data: await TAURI_INVOKE("get_track_by_item_id", { itemId }) }; 30} catch (e) { 31 if(e instanceof Error) throw e; 32 else return { status: "error", error: e as any }; 33} 34}, 35async getTracksPage(options: TracksPageOptions) : Promise<Result<TracksPage, string>> { 36 try { 37 return { status: "ok", data: await TAURI_INVOKE("get_tracks_page", { options }) }; 38} catch (e) { 39 if(e instanceof Error) throw e; 40 else return { status: "error", error: e as any }; 41} 42} 43} 44 45/** user-defined events **/ 46 47 48 49/** user-defined constants **/ 50 51 52 53/** user-defined types **/ 54 55export type CountObject = { count: string; fromDate: string; toDate: string } 56export type Folder = { id: string; name: string; description?: string | null; liked: boolean; disliked: boolean; 57/** 58 * For example "itunes" 59 */ 60importedFrom?: string | null; 61/** 62 * For example iTunes Persistent ID 63 */ 64originalId?: string | null; dateImported?: string | null; dateCreated?: string | null; children: string[] } 65export type LibraryTauri = { track_lists: Partial<{ [key in string]: TrackList }>; song_count: string } 66export type Playlist = { id: string; name: string; description?: string | null; liked: boolean; disliked: boolean; importedFrom?: string | null; originalId?: string | null; dateImported?: string | null; dateCreated?: string | null; tracks: string[] } 67export type Special = { id: string; name: SpecialTrackListName; dateCreated: string; children: string[] } 68export type SpecialTrackListName = "Root" 69export type Track = { size: string; duration: number; bitrate: number; sampleRate: number; file: string; dateModified: string; dateAdded: string; name: string; importedFrom?: string | null; 70/** 71 * Imported ID, like iTunes Persistent ID 72 */ 73originalId?: string | null; artist?: string; composer?: string | null; sortName?: string | null; sortArtist?: string | null; sortComposer?: string | null; genre?: string | null; rating?: number | null; year?: string | null; bpm?: number | null; comments?: string | null; grouping?: string | null; liked?: boolean | null; disliked?: boolean | null; disabled?: boolean | null; compilation?: boolean | null; albumName?: string | null; albumArtist?: string | null; sortAlbumName?: string | null; sortAlbumArtist?: string | null; trackNum?: number | null; trackCount?: number | null; discNum?: number | null; discCount?: number | null; dateImported?: string | null; playCount?: number | null; plays?: string[] | null; playsImported?: CountObject[] | null; skipCount?: number | null; skips?: string[] | null; skipsImported?: CountObject[] | null; 74/** 75 * -100 to 100 76 */ 77volume?: number | null } 78export type TrackList = ({ type: "playlist" } & Playlist) | ({ type: "folder" } & Folder) | ({ type: "special" } & Special) 79export type TracksPage = { playlist_kind: string; playlist_name: string; playlist_description: string | null; playlist_length: number; item_ids: number[] } 80export type TracksPageOptions = { playlist_id: string; sort_key: string; sort_desc: boolean; filter_query: string; group_album_tracks: boolean } 81 82/** tauri-specta globals **/ 83 84import { 85 invoke as TAURI_INVOKE, 86 Channel as TAURI_CHANNEL, 87} from "@tauri-apps/api/core"; 88import * as TAURI_API_EVENT from "@tauri-apps/api/event"; 89import { type WebviewWindow as __WebviewWindow__ } from "@tauri-apps/api/webviewWindow"; 90 91type __EventObj__<T> = { 92 listen: ( 93 cb: TAURI_API_EVENT.EventCallback<T>, 94 ) => ReturnType<typeof TAURI_API_EVENT.listen<T>>; 95 once: ( 96 cb: TAURI_API_EVENT.EventCallback<T>, 97 ) => ReturnType<typeof TAURI_API_EVENT.once<T>>; 98 emit: null extends T 99 ? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit> 100 : (payload: T) => ReturnType<typeof TAURI_API_EVENT.emit>; 101}; 102 103export type Result<T, E> = 104 | { status: "ok"; data: T } 105 | { status: "error"; error: E }; 106 107function __makeEvents__<T extends Record<string, any>>( 108 mappings: Record<keyof T, string>, 109) { 110 return new Proxy( 111 {} as unknown as { 112 [K in keyof T]: __EventObj__<T[K]> & { 113 (handle: __WebviewWindow__): __EventObj__<T[K]>; 114 }; 115 }, 116 { 117 get: (_, event) => { 118 const name = mappings[event as keyof T]; 119 120 return new Proxy((() => {}) as any, { 121 apply: (_, __, [window]: [__WebviewWindow__]) => ({ 122 listen: (arg: any) => window.listen(name, arg), 123 once: (arg: any) => window.once(name, arg), 124 emit: (arg: any) => window.emit(name, arg), 125 }), 126 get: (_, command: keyof __EventObj__<any>) => { 127 switch (command) { 128 case "listen": 129 return (arg: any) => TAURI_API_EVENT.listen(name, arg); 130 case "once": 131 return (arg: any) => TAURI_API_EVENT.once(name, arg); 132 case "emit": 133 return (arg: any) => TAURI_API_EVENT.emit(name, arg); 134 } 135 }, 136 }); 137 }, 138 }, 139 ); 140}