Initial commit
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Service management service
|
||||
*/
|
||||
|
||||
import { fileManagerApi } from './api';
|
||||
import type { SourceSelector } from '@/types/common';
|
||||
import type { ServiceInterface, ServiceRecord } from '@/types/service';
|
||||
|
||||
export const serviceService = {
|
||||
|
||||
/**
|
||||
* List all available services
|
||||
*
|
||||
* @param sources - Optional source selector to filter services
|
||||
* @returns Promise with service list grouped by provider
|
||||
*/
|
||||
async list(sources?: SourceSelector): Promise<ServiceRecord> {
|
||||
return await fileManagerApi.execute<ServiceRecord>('service.list', {
|
||||
sources: sources || null
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Check which services exist/are available
|
||||
*
|
||||
* @param sources - Source selector with service IDs to check
|
||||
* @returns Promise with service availability status
|
||||
*/
|
||||
async extant(sources: SourceSelector): Promise<Record<string, boolean>> {
|
||||
return await fileManagerApi.execute<Record<string, boolean>>('service.extant', { sources });
|
||||
},
|
||||
|
||||
/**
|
||||
* Fetch a specific service
|
||||
*
|
||||
* @param provider - Provider identifier
|
||||
* @param identifier - Service identifier
|
||||
* @returns Promise with service details
|
||||
*/
|
||||
async fetch(provider: string, identifier: string): Promise<ServiceInterface> {
|
||||
return await fileManagerApi.execute<ServiceInterface>('service.fetch', {
|
||||
provider,
|
||||
identifier
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default serviceService;
|
||||
Reference in New Issue
Block a user