veza/apps/web/src/services/api/tracks.ts

156 lines
2.6 KiB
TypeScript
Raw Normal View History

/**
* Tracks API Service
* Action 6.1.1.1: Create tracks API service
* Service layer for track-related API operations
* Wraps existing track API functions into a unified service object
*/
import {
uploadTrack,
getTracks,
getTrackRecommendations,
updateTrack,
getTrackStats,
getTrackHistory,
downloadTrack,
likeTrack,
unlikeTrack,
deleteTrack,
getTrackLikes,
createTrackShare,
initiateChunkedUpload,
uploadChunk,
completeChunkedUpload,
batchDeleteTracks,
batchUpdateTracks,
type TrackMetadata,
type UpdateTrackRequest,
type TrackStats,
type TrackHistory,
type CreateShareRequest,
type Share,
type TrackLikesResponse,
type GetTracksParams,
type GetTracksResponse,
type BatchDeleteRequest,
type BatchDeleteResponse,
type BatchUpdateRequest,
type BatchUpdateResponse,
} from '@/features/tracks/api/trackApi';
import { getTrack } from '@/features/tracks/services/trackService';
import type { Track } from '@/features/tracks/types/track';
/**
* Tracks API Service Object
* Action 6.1.1.1: Exports unified tracksApi object with all track operations
*/
export const tracksApi = {
/**
* List tracks with pagination and filters
*/
list: getTracks,
/**
* Get a single track by ID
*/
get: getTrack,
/**
* Get personalized track recommendations (D2 autoplay)
*/
getRecommendations: getTrackRecommendations,
/**
* Create/upload a new track
*/
create: uploadTrack,
/**
* Update track metadata
*/
update: updateTrack,
/**
* Delete a track
*/
delete: deleteTrack,
/**
* Get track statistics
*/
getStats: getTrackStats,
/**
* Get track history
*/
getHistory: getTrackHistory,
/**
* Download a track
*/
download: downloadTrack,
/**
* Like a track
*/
like: likeTrack,
/**
* Unlike a track
*/
unlike: unlikeTrack,
/**
* Get track likes information
*/
getLikes: getTrackLikes,
/**
* Create a share link for a track
*/
createShare: createTrackShare,
/**
* Initiate chunked upload
*/
initiateChunkedUpload,
/**
* Upload a chunk
*/
uploadChunk,
/**
* Complete chunked upload
*/
completeChunkedUpload,
/**
* Batch delete tracks
*/
batchDelete: batchDeleteTracks,
/**
* Batch update tracks
*/
batchUpdate: batchUpdateTracks,
};
// Re-export types for convenience
export type {
Track,
TrackMetadata,
UpdateTrackRequest,
TrackStats,
TrackHistory,
CreateShareRequest,
Share,
TrackLikesResponse,
GetTracksParams,
GetTracksResponse,
BatchDeleteRequest,
BatchDeleteResponse,
BatchUpdateRequest,
BatchUpdateResponse,
};