Skip to content

Commit bed0044

Browse files
committed
refactor: rename MediaControlArgs -> MediaControlOptions
1 parent dce8f0d commit bed0044

File tree

3 files changed

+24
-36
lines changed

3 files changed

+24
-36
lines changed

packages/client-api/src/desktop/desktop-commands.ts

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,23 @@ export interface AudioFunction {
2525
type: 'audio';
2626
function: {
2727
name: 'set_volume';
28-
args: SetVolumeArgs;
28+
args: {
29+
volume: number;
30+
deviceId?: string;
31+
};
2932
};
3033
}
3134

32-
export interface SetVolumeArgs {
33-
volume: number;
34-
deviceId?: string;
35-
}
36-
3735
export interface MediaFunction {
3836
type: 'media';
3937
function: {
4038
name: 'play' | 'pause' | 'toggle_play_pause' | 'next' | 'previous';
41-
args: MediaControlArgs;
39+
args: {
40+
sessionId?: string;
41+
};
4242
};
4343
}
4444

45-
export interface MediaFunction {
46-
type: 'media';
47-
function: {
48-
name: 'play' | 'pause' | 'toggle_play_pause' | 'next' | 'previous';
49-
args: MediaControlArgs;
50-
};
51-
}
52-
53-
export interface MediaControlArgs {
54-
sessionId?: string;
55-
}
56-
5745
function startWidget(
5846
configPath: string,
5947
placement: WidgetPlacement,

packages/client-api/src/providers/media/create-media-provider.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { z } from 'zod';
22
import { createBaseProvider } from '../create-base-provider';
33
import { desktopCommands, onProviderEmit } from '~/desktop';
44
import type {
5-
MediaControlArgs,
5+
MediaControlOptions,
66
MediaOutput,
77
MediaProvider,
88
MediaProviderConfig,
@@ -27,48 +27,48 @@ export function createMediaProvider(
2727
queue.output({
2828
...result.output,
2929
session: result.output.currentSession,
30-
play: (args?: MediaControlArgs) => {
30+
play: (options?: MediaControlOptions) => {
3131
return desktopCommands.callProviderFunction(configHash, {
3232
type: 'media',
3333
function: {
3434
name: 'play',
35-
args: args ?? {},
35+
args: options ?? {},
3636
},
3737
});
3838
},
39-
pause: (args?: MediaControlArgs) => {
39+
pause: (options?: MediaControlOptions) => {
4040
return desktopCommands.callProviderFunction(configHash, {
4141
type: 'media',
4242
function: {
4343
name: 'pause',
44-
args: args ?? {},
44+
args: options ?? {},
4545
},
4646
});
4747
},
48-
togglePlayPause: (args?: MediaControlArgs) => {
48+
togglePlayPause: (options?: MediaControlOptions) => {
4949
return desktopCommands.callProviderFunction(configHash, {
5050
type: 'media',
5151
function: {
5252
name: 'toggle_play_pause',
53-
args: args ?? {},
53+
args: options ?? {},
5454
},
5555
});
5656
},
57-
next: (args?: MediaControlArgs) => {
57+
next: (options?: MediaControlOptions) => {
5858
return desktopCommands.callProviderFunction(configHash, {
5959
type: 'media',
6060
function: {
6161
name: 'next',
62-
args: args ?? {},
62+
args: options ?? {},
6363
},
6464
});
6565
},
66-
previous: (args?: MediaControlArgs) => {
66+
previous: (options?: MediaControlOptions) => {
6767
return desktopCommands.callProviderFunction(configHash, {
6868
type: 'media',
6969
function: {
7070
name: 'previous',
71-
args: args ?? {},
71+
args: options ?? {},
7272
},
7373
});
7474
},

packages/client-api/src/providers/media/media-provider-types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ export interface MediaOutput {
99
session: MediaSession | null;
1010
currentSession: MediaSession | null;
1111
allSessions: MediaSession[];
12-
play(args?: MediaControlArgs): void;
13-
pause(args?: MediaControlArgs): void;
14-
togglePlayPause(args?: MediaControlArgs): void;
15-
next(args?: MediaControlArgs): void;
16-
previous(args?: MediaControlArgs): void;
12+
play(options?: MediaControlOptions): void;
13+
pause(options?: MediaControlOptions): void;
14+
togglePlayPause(options?: MediaControlOptions): void;
15+
next(options?: MediaControlOptions): void;
16+
previous(options?: MediaControlOptions): void;
1717
}
1818

19-
export interface MediaControlArgs {
19+
export interface MediaControlOptions {
2020
sessionId?: string;
2121
}
2222

0 commit comments

Comments
 (0)