working team update/create (still need enroll)
This commit is contained in:
@@ -4,6 +4,7 @@ import type {
|
||||
SpotifyPlaybackState,
|
||||
SpotifyPlaybackSnapshot,
|
||||
SpotifyError,
|
||||
SpotifyTrack,
|
||||
} from './types';
|
||||
|
||||
const SPOTIFY_API_BASE = 'https://api.spotify.com/v1';
|
||||
@@ -123,6 +124,11 @@ export class SpotifyWebApiClient {
|
||||
return this.request<{ id: string; display_name: string }>('/me');
|
||||
}
|
||||
|
||||
async searchTracks(query: string, limit: number = 20): Promise<{ tracks: { items: SpotifyTrack[] } }> {
|
||||
const encodedQuery = encodeURIComponent(query);
|
||||
return this.request<{ tracks: { items: SpotifyTrack[] } }>(`/search?q=${encodedQuery}&type=track&limit=${limit}`);
|
||||
}
|
||||
|
||||
updateAccessToken(accessToken: string): void {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
@@ -103,6 +103,8 @@ export interface SpotifyContextType extends SpotifyAuthState {
|
||||
capturePlaybackState: () => Promise<void>;
|
||||
resumePlaybackState: () => Promise<void>;
|
||||
clearCapturedState: () => void;
|
||||
|
||||
searchTracks: (query: string) => Promise<SpotifyTrack[]>;
|
||||
}
|
||||
|
||||
export interface PKCEState {
|
||||
|
||||
Reference in New Issue
Block a user