soundcloud-api-ts-next
    Preparing search index...

    Variable scKeysConst

    scKeys: {
        all: () => readonly ["sc"];
        me: () => readonly ["sc", "me"];
        meConnections: () => readonly ["sc", "me", "connections"];
        playlist: (id: string | number) => readonly ["sc", "playlist", string];
        searchTracks: (
            q: string,
            limit?: number,
        ) => readonly ["sc", "search", "tracks", string, number | "default"];
        searchUsers: (
            q: string,
            limit?: number,
        ) => readonly ["sc", "search", "users", string, number | "default"];
        track: (id: string | number) => readonly ["sc", "track", string];
        tracks: (ids: (string | number)[]) => readonly ["sc", "tracks", string];
        user: (id: string | number) => readonly ["sc", "user", string];
    } = ...

    Query key factories for use with TanStack Query, SWR, or any cache keyed by arrays.

    Keys are stable, serialisable arrays that describe the resource being fetched. Use these with scFetchers to integrate SoundCloud data into your preferred data-fetching library without taking a dependency on it.

    Type Declaration

    • all: () => readonly ["sc"]

      Root key — matches every SoundCloud query.

    • me: () => readonly ["sc", "me"]

      Key for the authenticated user's profile.

    • meConnections: () => readonly ["sc", "me", "connections"]

      Key for the authenticated user's linked service connections.

    • playlist: (id: string | number) => readonly ["sc", "playlist", string]

      Key for a single playlist.

    • searchTracks: (
          q: string,
          limit?: number,
      ) => readonly ["sc", "search", "tracks", string, number | "default"]

      Key for a track search query.

    • searchUsers: (
          q: string,
          limit?: number,
      ) => readonly ["sc", "search", "users", string, number | "default"]

      Key for a user search query.

    • track: (id: string | number) => readonly ["sc", "track", string]

      Key for a single track.

    • tracks: (ids: (string | number)[]) => readonly ["sc", "tracks", string]

      Key for a batch of tracks by IDs.

    • user: (id: string | number) => readonly ["sc", "user", string]

      Key for a single user.

    // TanStack Query
    useQuery({ queryKey: scKeys.track(123), queryFn: () => scFetchers.track(123) });

    // SWR
    useSWR(scKeys.track(123), () => scFetchers.track(123));

    scFetchers for the matching fetcher functions