Types

List of all typescript interfaces and types used for describing data and parameters for communication with spinamp database.

IConfig

Configuration object defining set of endpoints used by SDK.

interface IConfig {
    SPINDEX_NODE_URL: string;
    PLAYLIST_NODE_URL: string;
    IPFS_GATEWAY_URL_IMAGE: string;
    IPFS_GATEWAY_URL_AUDIO: string;
}

IArtist

Object describing artist entity.

interface IArtist {
    id: string;
    name: string;
    createdAtTime: string;
    slug: string;
    profiles: {
        [platformId: string]: IArtistProfile;
    };
}

IArtistProfile

Object containing information about artist profile based on data from particular platform. One artist can own multiples profiles assigned if he uploaded tracks for multiple platforms.

interface IArtistProfile {
    platformId: string;
    platformInternalId: string;
    name: string;
    createdAtTime: string;
    avatarUrl?: string;
    websiteUrl?: string;
}

ITrack

Object describing track entity.

interface ITrack {
    id: string;
    platformInternalId: string;
    title: string;
    slug: string;
    platformId: string;
    artistId: string;
    artist: IArtist;
    lossyAudioUrl: string;
    lossyArtworkUrl?: string;
    description?: string;
    createdAtTime?: string;
    websiteUrl?: string;
}

ICollectionTrack

Object describing track from nft collection of particular address owner. It's the same as ITrack but extended with quantity property.

interface ICollectionTrack extends ITrack {
    quantity: number;
}

INft

Object describing NFT entity minted for the track

interface INft {
    id: string;
    createdAtTime: string;
    createdAtBlockNumber: string;
    chainId: string;
    tokenId: string;
    contractAddress: string;
    platformId: string;
    owners: string[];
    // deprecated - used only for backward compability and always points to first item of `owners` array
    owner: string;
    metadata: unknown;
}

ITrackNft

INft object extended with corresponding track id

interface ITrackNft extends INft {
  trackId: string;
}

IMusicPlatformData

Object containing information about platform id and it's corresponding name.

interface IMusicPlatformData {
    id: string;
    name: string;
}

IPlaylist

Object describing playlist entity.

interface IPlaylist {
    id: string;
    title: string;
    trackIds: string[];
    collector?: string; // address of user who created playlist
}

IApiListQueryParams

Set of parameters which can be passed to queries which return list of objects (fetchAllArtists, fetchAllTracks). It can be used for pagination, sorting and filtering.

Exact shape of filter and orderBy params depends on query and it can be found in API documentation of spinamp pipeline: https://open-api.spinamp.xyz/graphiql.

interface IApiListQueryParams {
    after?: string;
    before?: string;
    first?: number;
    last?: number;
    offset?: number;
    filter?: unknown;
    orderBy?: string[];
}

IApiListQueryResponse

Object returned from queries returning list of items. It contains data which can be used for pagination.

interface IApiListQueryResponse<ListItem> {
  totalCount: number;
  pageInfo: {
    hasNextPage: boolean;
    hasPreviousPage: boolean;
    startCursor: string;
    endCursor: string;
  };
  items: ListItem[];
}

Last updated