@@ -379,6 +379,9 @@ export class SnapcastService implements OnDestroy {
379379 }
380380
381381
382+ // GROUP ACTIONS
383+
384+
382385
383386
384387 setGroupName ( groupId : string , name : string ) : Observable < void > {
@@ -409,16 +412,109 @@ export class SnapcastService implements OnDestroy {
409412
410413 }
411414
415+ setGroupClients ( groupId : string , clientIds : string [ ] ) : Observable < void > {
416+ return this . rpc ( 'Group.SetClients' , { id : groupId , clients : clientIds } ) . pipe (
417+ map ( ( ) : void => void 0 ) ,
418+ catchError ( err => {
419+ console . error ( `SnapcastService: Failed to set clients for group ${ groupId } ` , err ) ;
420+ return throwError ( ( ) => err ) ;
421+ } )
422+ ) ;
423+ }
424+
425+ setGroupMute ( groupId : string , mute : boolean ) : Observable < void > {
426+ return this . rpc ( 'Group.SetMute' , { id : groupId , mute } ) . pipe (
427+ map ( ( ) : void => void 0 ) ,
428+ catchError ( err => {
429+ console . error ( `SnapcastService: Failed to set mute for group ${ groupId } ` , err ) ;
430+ return throwError ( ( ) => err ) ;
431+ } )
432+ ) ;
433+ }
434+
435+ getGroupStatus ( groupId : string ) : Observable < Group | undefined > {
436+ return this . rpc ( 'Group.GetStatus' , { id : groupId } ) . pipe (
437+ map ( response => response . result as Group | undefined ) ,
438+ catchError ( err => {
439+ console . error ( `SnapcastService: Failed to get status for group ${ groupId } ` , err ) ;
440+ return throwError ( ( ) => err ) ;
441+ } )
442+ ) ;
443+ }
444+
445+
446+ // SERVER ACTIONS
447+
448+ getServerStatus ( ) : Observable < SnapCastServerStatusResponse | undefined > {
449+ return this . rpc < never , SnapCastServerStatusResponse > ( 'Server.GetStatus' ) . pipe (
450+ map ( response => response . result ) ,
451+ catchError ( err => {
452+ console . error ( 'SnapcastService: Failed to get server status' , err ) ;
453+ return throwError ( ( ) => err ) ;
454+ } )
455+ ) ;
456+ }
457+
458+ getServerRpcVersion ( ) : Observable < string | undefined > {
459+ return this . rpc < never , { version : string } > ( 'Server.GetRpcVersion' ) . pipe (
460+ map ( response => response . result ?. version ) ,
461+ catchError ( err => {
462+ console . error ( 'SnapcastService: Failed to get server RPC version' , err ) ;
463+ return throwError ( ( ) => err ) ;
464+ } )
465+ ) ;
466+
467+ }
412468
469+ deleteServerClient ( clientId : string ) : Observable < void > {
470+ return this . rpc ( 'Server.DeleteClient' , { id : clientId } ) . pipe (
471+ map ( ( ) : void => void 0 ) ,
472+ catchError ( err => {
473+ console . error ( `SnapcastService: Failed to delete client ${ clientId } ` , err ) ;
474+ return throwError ( ( ) => err ) ;
475+ } )
476+ ) ;
477+ }
413478
479+ // Stream Actions
414480
481+ setStreamProperty ( streamId : string , property : keyof Stream , value : any ) : Observable < void > {
482+ const params : StreamSetPropertyRpcPayloadParams = { id : streamId , property, value } ;
483+ return this . rpc ( 'Stream.SetProperty' , params ) . pipe (
484+ map ( ( ) : void => void 0 ) ,
485+ catchError ( err => {
486+ console . error ( `SnapcastService: Failed to set property ${ property } for stream ${ streamId } ` , err ) ;
487+ return throwError ( ( ) => err ) ;
488+ } )
489+ ) ;
490+ }
415491
492+ addStream ( stream : Stream ) : Observable < void > {
493+ return this . rpc ( 'Stream.Add' , { stream } ) . pipe (
494+ map ( ( ) : void => void 0 ) ,
495+ catchError ( err => {
496+ console . error ( `SnapcastService: Failed to add stream` , err ) ;
497+ return throwError ( ( ) => err ) ;
498+ } )
499+ ) ;
500+ }
416501
417- // --- Data Access Helpers ---
418- public getClient ( clientId : string ) : Observable < Client | undefined > {
419- return this . state$ . pipe ( map ( state => state ?. server ?. groups . flatMap ( g => g . clients ) . find ( c => c . id === clientId ) ) ) ;
502+ removeStream ( streamId : string ) : Observable < void > {
503+ return this . rpc ( 'Stream.Remove' , { id : streamId } ) . pipe (
504+ map ( ( ) : void => void 0 ) ,
505+ catchError ( err => {
506+ console . error ( `SnapcastService: Failed to remove stream ${ streamId } ` , err ) ;
507+ return throwError ( ( ) => err ) ;
508+ } )
509+ ) ;
420510 }
421511
512+
513+
514+
515+
516+ // Mock server state for testing purposes
517+
422518 public mockServerState ( ) : void {
423519 const url = "assets/mock/json/server-state.json"
424520 this . http . get < SnapCastServerStatusResponse > ( url ) . subscribe ( {
0 commit comments