# Playlists

### **Queries**

#### **useFeaturedPlaylistsQuery**(queryOptions?: [UseQueryOptions](https://tanstack.com/query/v4/docs/reference/useQuery)): {playlists: [IPlaylist](https://spinamp.gitbook.io/spinamp-sdk/reference/api-reference/types#iplaylist)\[], ...[UseQueryResult](https://tanstack.com/query/v4/docs/reference/useQuery)}

Used for querying list of playlists, which are currently marked as featured on spinamp.

#### **usePlaylistDetailsQuery**(playlistId: string, queryOptions?: [UseQueryOptions](https://tanstack.com/query/v4/docs/reference/useQuery)): {playlist: [IPlaylist](https://spinamp.gitbook.io/spinamp-sdk/reference/api-reference/types#iplaylist) | null, playlistTracks: [ITrack](https://spinamp.gitbook.io/spinamp-sdk/reference/api-reference/types#itrack)\[], ...[UseQueryResult](https://tanstack.com/query/v4/docs/reference/useQuery)}

Used for querying playlist details based on provided playlist id. It returns `playlist` object and `playlistTracks` array containing list of full tracks objects belonging to provided playlist.

#### **useCollectorPlaylistsQuery**(**ethAddress: string,** queryOptions?: [UseQueryOptions](https://tanstack.com/query/v4/docs/reference/useQuery)): {playlists: [IPlaylist](https://spinamp.gitbook.io/spinamp-sdk/reference/api-reference/types#iplaylist)\[], ...[UseQueryResult](https://tanstack.com/query/v4/docs/reference/useQuery)}

Used for querying list of playlists, created by user with provided ethereum address.

### Mutations

#### **useCreatePlaylistMutation**(mutationOptions?: [UseMutationOptions](https://tanstack.com/query/v4/docs/reference/useMutation)): {mutate: ({playlist: Omit<[IPlaylist](https://spinamp.gitbook.io/spinamp-sdk/reference/api-reference/types#iplaylist), 'id'>, signer: [Signer](https://docs.ethers.io/v5/api/signer/)}), ...[UseMutationResult](https://tanstack.com/query/v4/docs/reference/useMutation)}

Used for playlist creation. Hook returns `mutate` function which takes new playlist object and ethers signer object for API authentication.

#### **useUpdatePlaylistMutation**(mutationOptions?: [UseMutationOptions](https://tanstack.com/query/v4/docs/reference/useMutation)): {mutate: ({id: string, playlist: Partial<[IPlaylist](https://spinamp.gitbook.io/spinamp-sdk/reference/api-reference/types#iplaylist)>, signer: [Signer](https://docs.ethers.io/v5/api/signer/)}), ...[UseMutationResult](https://tanstack.com/query/v4/docs/reference/useMutation)}

Used for updating playlist. Hook returns `mutate` function which takes id of edited playlist, playlist object with properties to update and ethers signer object for API authentication.
