Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@soundify/api

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@soundify/api - npm Package Compare versions

Comparing version 0.0.37 to 0.1.0-alpha.0

14

esm/client.js

@@ -39,3 +39,3 @@ import { objectToSearchParams, } from "@soundify/shared";

}
async fetch(baseURL, responseType, { body, query, method } = {}) {
async fetch(baseURL, responseType, { body, query, method, headers } = {}) {
const url = new URL("https://api.spotify.com/v1" + baseURL);

@@ -46,2 +46,7 @@ if (query) {

const serializedBody = body ? JSON.stringify(body) : undefined;
const mergedHeaders = new Headers({
"Content-Type": "application/json",
"Accept": "application/json",
...headers,
});
let isTriedRefreshToken = false;

@@ -53,9 +58,6 @@ let retryTimesOn5xx = this.opts.retryTimesOn5xx;

const call = async () => {
mergedHeaders.set("Authorization", "Bearer " + accessToken);
const res = await fetch(url, {
method,
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer " + accessToken,
},
headers: mergedHeaders,
body: serializedBody,

@@ -62,0 +64,0 @@ });

@@ -44,3 +44,3 @@ /**

* @param uris List of Spotify URIs to add, can be track or episode URIs
* @param pasition The position to insert the items, a zero-based index
* @param position The position to insert the items, a zero-based index
*/

@@ -62,3 +62,3 @@ export const addItemsToPlaylist = async (client, playlist_id, uris, position) => {

* @param uri Spotify URIs to add, can be track or episode URIs
* @param pasition The position to insert the items, a zero-based index
* @param position The position to insert the items, a zero-based index
*/

@@ -68,1 +68,140 @@ export const addItemToPlaylist = async (client, playlist_id, uri, position) => {

};
/**
* Reorder items in a playlist depending on the request's parameters.
*
* @param client Spotify HTTPClient
* @param playlist_id The Spotify ID of the playlist.
* @param opts Additional options for request
*/
export const reorderPlaylistItems = async (client, playlist_id, opts) => {
return await client.fetch(`/playlists/${playlist_id}/tracks`, "json", {
method: "PUT",
body: opts,
});
};
/**
* Replace items in a playlist. Replacing items in a playlist will overwrite its existing items.
* This operation can be used for replacing or clearing items in a playlist.
*
* @param client Spotify HTTPClient
* @param playlist_id The Spotify ID of the playlist.
* @param uris List of Spotify URIs to set, can be track or episode URIs. A maximum of 100 items can be set in one request.
*/
export const replacePlaylistItems = async (client, playlist_id, uris) => {
return await client.fetch(`/playlists/${playlist_id}/tracks`, "json", {
method: "PUT",
body: {
uris,
},
});
};
/**
* Remove one or more items from a user's playlist.
*
* @param client Spotify HTTPClient
* @param playlist_id The Spotify ID of the playlist.
* @param uris List of Spotify URIs to set, can be track or episode URIs. A maximum of 100 items can be set in one request.
* @param snapshot_id The playlist's snapshot ID against which you want to make the changes.
*/
export const removePlaylistItems = async (client, playlist_id, uris, snapshot_id) => {
return await client.fetch(`/playlists/${playlist_id}/tracks`, "json", {
method: "DELETE",
body: {
tracks: uris.map((uri) => ({ uri })),
snapshot_id,
},
});
};
/**
* Remove one item from a user's playlist.
*
* @param client Spotify HTTPClient
* @param playlist_id The Spotify ID of the playlist.
* @param uri Spotify URI to set, can be track or episode URIs.
* @param snapshot_id The playlist's snapshot ID against which you want to make the changes.
*/
export const removePlaylistItem = async (client, playlist_id, uri, snapshot_id) => {
return await removePlaylistItems(client, playlist_id, [uri], snapshot_id);
};
/**
* Get a list of the playlists owned or followed by the current Spotify user.
*
* @param client Spotify HTTPClient
* @param opts Additional options for request
*/
export const getCurrentUsersPlaylists = async (client, opts) => {
return await client.fetch("/me/playlists", "json", {
query: opts,
});
};
/**
* Get a list of the playlists owned or followed by a Spotify user.
*
* @param client Spotify HTTPClient
* @param user_id The user's Spotify user ID.
* @param opts Additional options for request
*/
export const getUsersPlaylists = async (client, user_id, opts) => {
return await client.fetch(`/users/${user_id}/playlists`, "json", {
query: opts,
});
};
/**
* Create a playlist for a Spotify user. (The playlist will be empty until you add tracks.)
*
* @param client Spotify HTTPClient
* @param user_id The user's Spotify user ID.
* @param body Data that will be assinged to new playlist
*/
export const createPlaylist = async (client, user_id, body) => {
return await client.fetch(`/users/${user_id}/playlists`, "json", {
body,
method: "POST",
});
};
/**
* Get a list of Spotify featured playlists (shown, for example, on a Spotify player's 'Browse' tab).
*
* @param client Spotify HTTPClient
* @param opts Additional options for request
*/
export const getFeaturedPlaylists = async (client, opts) => {
return await client.fetch("/browse/featured-playlists", "json", {
query: opts,
});
};
/**
* Get a list of Spotify playlists tagged with a particular category.
*
* @param client Spotify HTTPClient
* @param category_id The Spotify category ID for the category.
* @param opts Additional options for request
*/
export const getCategorysPlaylists = async (client, category_id, opts) => {
return await client.fetch(`/browse/categories/${category_id}/playlists`, "json", {
query: opts,
});
};
/**
* Get the current image associated with a specific playlist.
*
* @param client Spotify HTTPClient
*/
export const getPlaylistCoverImage = async (client, playlist_id) => {
return await client.fetch(`/playlists/${playlist_id}/images`, "json");
};
/**
* Upload custom images to the playlist.
*
* @param playlist_id The Spotify ID of the playlist.
* @param image The image should contain a Base64 encoded JPEG image data, maximum payload size is 256 KB.
*/
export const uploadPlaylistCoverImage = async (client, playlist_id, image) => {
return await client.fetch(`/playlists/${playlist_id}/images`, "void", {
method: "PUT",
headers: {
"Content-Type": "image/jpeg",
},
body: image,
});
};

@@ -6,3 +6,3 @@ /**

*/
export const getCurrentUserProfile = async (client) => {
export const getCurrentUser = async (client) => {
return await client.fetch("/me", "json");

@@ -47,3 +47,3 @@ };

*/
export const getUserProfile = async (client, user_id) => {
export const getUser = async (client, user_id) => {
return await client.fetch("/users/" + user_id, "json");

@@ -50,0 +50,0 @@ };

@@ -5,3 +5,3 @@ {

"name": "@soundify/api",
"version": "0.0.37",
"version": "0.1.0-alpha.0",
"description": "🎧 Modern Spotify api wrapper for Node, Deno, and browser",

@@ -13,5 +13,5 @@ "license": "MIT",

"dependencies": {
"@soundify/shared": "0.0.37"
"@soundify/shared": "0.1.0-alpha.0"
},
"packageManager": "pnpm@7.29.3",
"packageManager": "pnpm@7.30.0",
"repository": {

@@ -18,0 +18,0 @@ "type": "git",

import { HTTPClient } from "@soundify/shared";
import { PagingObject, PagingOptions } from "../general.types.js";
import { Market } from "../market/market.types.js";
import { Track } from "../track/track.types.js";
import { TrackSimplified } from "../track/track.types.js";
import { Album, AlbumSimplified } from "./album.types.js";

@@ -37,3 +37,3 @@ /**

*/
export declare const getAlbumTracks: (client: HTTPClient, album_id: string, opts?: GetAlbumTrackOpts) => Promise<PagingObject<Track>>;
export declare const getAlbumTracks: (client: HTTPClient, album_id: string, opts?: GetAlbumTrackOpts) => Promise<PagingObject<TrackSimplified>>;
interface GetSavedAlbumsOpts extends PagingOptions {

@@ -40,0 +40,0 @@ /**

@@ -1,14 +0,20 @@

import { ExternalIds, ExternalUrls, Image, PagingObject, RestrictionsReason } from "../general.types.js";
import { Copyright, ExternalIds, ExternalUrls, Image, PagingObject, RestrictionsReason } from "../general.types.js";
import { Artist, ArtistSimplified } from "../artist/artist.types.js";
import { Market } from "../market/market.types.js";
import { Track } from "../track/track.types.js";
import { TrackSimplified } from "../track/track.types.js";
import { Genre } from "../genre/genre.types.js";
import { JSONObject } from "@soundify/shared";
/**
* The types of album.
*/
export type AlbumType = "single" | "album" | "compilation";
/**
* The groups of album.
*/
export type AlbumGroup = AlbumType | "appears_on";
interface AlbumBase extends JSONObject {
/**
* The type of the album.
*
* TODO check if it is caps or not
*/
album_type: "album" | "single" | "compilation";
album_type: AlbumType;
/**

@@ -79,14 +85,3 @@ * The number of tracks in the album.

*/
copyrights?: {
/**
* The copyright text for this content.
*/
text: string;
/**
* The type of copyright: \
* C = the copyright \
* P = the sound recording (performance) copyright
*/
type: string;
}[];
copyrights?: Copyright[];
/**

@@ -107,3 +102,2 @@ * A list of the genres the album is associated with.

}
export type AlbumGroup = "album" | "single" | "compilation" | "appears_on";
export interface AlbumSimplified extends AlbumBase, JSONObject {

@@ -128,4 +122,4 @@ /**

*/
tracks: PagingObject<Track>;
tracks: PagingObject<TrackSimplified>;
}
export {};
import { JSONObject } from "@soundify/shared";
import { Genre } from "../genre/genre.types.js";
import { ExternalUrls, Followers, Image } from "../general.types.js";

@@ -39,3 +38,3 @@ export interface ArtistSimplified extends JSONObject {

*/
genres: Genre[];
genres: string[];
/**

@@ -42,0 +41,0 @@ * Images of the artist in various sizes, widest first.

@@ -122,1 +122,16 @@ import { JSONObject, SearchParams } from "@soundify/shared";

}
/**
* The copyright object contains the type and the name of copyright.
*/
export interface Copyright extends JSONObject {
/**
* The copyright text for this content.
*/
text: string;
/**
* The type of copyright: \
* C = the copyright \
* P = the sound recording (performance) copyright
*/
type: "C" | "P";
}

@@ -1,5 +0,5 @@

import { HTTPClient, JSONObject, SearchParams } from "@soundify/shared";
import { HTTPClient, JSONObject, NonNullableJSON, SearchParams } from "@soundify/shared";
import { Market } from "../market/market.types.js";
import { PagingObject, PagingOptions } from "../general.types.js";
import { Playlist, PlaylistTrack } from "./playlist.types.js";
import { Image, PagingObject, PagingOptions } from "../general.types.js";
import { FeaturedPlaylists, Playlist, PlaylistSimplified, PlaylistTrack } from "./playlist.types.js";
interface PlaylistFieldsOpts extends SearchParams {

@@ -83,3 +83,3 @@ /**

* @param uris List of Spotify URIs to add, can be track or episode URIs
* @param pasition The position to insert the items, a zero-based index
* @param position The position to insert the items, a zero-based index
*/

@@ -93,5 +93,153 @@ export declare const addItemsToPlaylist: (client: HTTPClient, playlist_id: string, uris: string[], position?: number) => Promise<SnapshotResponse>;

* @param uri Spotify URIs to add, can be track or episode URIs
* @param pasition The position to insert the items, a zero-based index
* @param position The position to insert the items, a zero-based index
*/
export declare const addItemToPlaylist: (client: HTTPClient, playlist_id: string, uri: string, position?: number) => Promise<SnapshotResponse>;
export interface ReorderPlaylistItemsOpts extends SearchParams {
/**
* The position of the first item to be reordered.
*/
range_start?: number;
/**
* The position where the items should be inserted.
*/
insert_before?: number;
/**
* The amount of items to be reordered. Defaults to 1 if not set.
* The range of items to be reordered begins from the `range_start` position, and includes the `range_length` subsequent items.
*/
range_length?: number;
/**
* The playlist's snapshot ID against which you want to make the changes.
*/
snapshot_id?: string;
}
/**
* Reorder items in a playlist depending on the request's parameters.
*
* @param client Spotify HTTPClient
* @param playlist_id The Spotify ID of the playlist.
* @param opts Additional options for request
*/
export declare const reorderPlaylistItems: (client: HTTPClient, playlist_id: string, opts?: ReorderPlaylistItemsOpts) => Promise<SnapshotResponse>;
/**
* Replace items in a playlist. Replacing items in a playlist will overwrite its existing items.
* This operation can be used for replacing or clearing items in a playlist.
*
* @param client Spotify HTTPClient
* @param playlist_id The Spotify ID of the playlist.
* @param uris List of Spotify URIs to set, can be track or episode URIs. A maximum of 100 items can be set in one request.
*/
export declare const replacePlaylistItems: (client: HTTPClient, playlist_id: string, uris: string[]) => Promise<SnapshotResponse>;
/**
* Remove one or more items from a user's playlist.
*
* @param client Spotify HTTPClient
* @param playlist_id The Spotify ID of the playlist.
* @param uris List of Spotify URIs to set, can be track or episode URIs. A maximum of 100 items can be set in one request.
* @param snapshot_id The playlist's snapshot ID against which you want to make the changes.
*/
export declare const removePlaylistItems: (client: HTTPClient, playlist_id: string, uris: string[], snapshot_id?: string) => Promise<SnapshotResponse>;
/**
* Remove one item from a user's playlist.
*
* @param client Spotify HTTPClient
* @param playlist_id The Spotify ID of the playlist.
* @param uri Spotify URI to set, can be track or episode URIs.
* @param snapshot_id The playlist's snapshot ID against which you want to make the changes.
*/
export declare const removePlaylistItem: (client: HTTPClient, playlist_id: string, uri: string, snapshot_id?: string) => Promise<SnapshotResponse>;
/**
* Get a list of the playlists owned or followed by the current Spotify user.
*
* @param client Spotify HTTPClient
* @param opts Additional options for request
*/
export declare const getCurrentUsersPlaylists: (client: HTTPClient, opts?: PagingOptions) => Promise<PagingObject<PlaylistSimplified>>;
/**
* Get a list of the playlists owned or followed by a Spotify user.
*
* @param client Spotify HTTPClient
* @param user_id The user's Spotify user ID.
* @param opts Additional options for request
*/
export declare const getUsersPlaylists: (client: HTTPClient, user_id: string, opts?: PagingOptions) => Promise<PagingObject<PlaylistSimplified>>;
interface CreatePlaylistBody extends JSONObject {
/**
* The name for the new playlist, for example "Your Coolest Playlist". This name does not need to be unique; a user may have several playlists with the same name.
*/
name: string;
/**
* Defaults to true. If true the playlist will be public, if false it will be private. To be able to create private playlists, the user must have granted the playlist-modify-private scope
*/
public?: boolean;
/**
* Defaults to false. If true the playlist will be collaborative. Note: to create a collaborative playlist you must also set public to false. To create collaborative playlists you must have granted `playlist-modify-private` and `playlist-modify-public` scopes.
*/
collaborative?: boolean;
/**
* Value for playlist description as displayed in Spotify Clients and in the Web API.
*/
description?: string;
}
/**
* Create a playlist for a Spotify user. (The playlist will be empty until you add tracks.)
*
* @param client Spotify HTTPClient
* @param user_id The user's Spotify user ID.
* @param body Data that will be assinged to new playlist
*/
export declare const createPlaylist: (client: HTTPClient, user_id: string, body: CreatePlaylistBody) => Promise<Playlist>;
interface GetFeaturedPlaylistsOpts extends SearchParams, PagingOptions {
/**
* A country: an ISO 3166-1 alpha-2 country code. Provide this parameter if you want the list of returned items to be relevant to a particular country. If omitted, the returned items will be relevant to all countries.
*/
country?: string;
/**
* The desired language, consisting of a lowercase ISO 639-1 language code and an uppercase ISO 3166-1 alpha-2 country code, joined by an underscore. For example: es_MX, meaning "Spanish (Mexico)". Provide this parameter if you want the results returned in a particular language (where available).
*
* @example "sv_SE"
*/
locale?: string;
/**
* A timestamp in ISO 8601 format: yyyy-MM-ddTHH:mm:ss. Use this parameter to specify the user's local time to get results tailored for that specific date and time in the day. If not provided, the response defaults to the current UTC time. Example: "2014-10-23T09:00:00" for a user whose local time is 9AM. If there were no featured playlists (or there is no data) at the specified time, the response will revert to the current UTC time.
*
* @example "2014-10-23T09:00:00"
*/
timestamp: string;
}
/**
* Get a list of Spotify featured playlists (shown, for example, on a Spotify player's 'Browse' tab).
*
* @param client Spotify HTTPClient
* @param opts Additional options for request
*/
export declare const getFeaturedPlaylists: (client: HTTPClient, opts?: GetFeaturedPlaylistsOpts) => Promise<FeaturedPlaylists>;
interface GetCategorysPlaylistsOpts extends SearchParams, PagingOptions {
/**
* A country: an ISO 3166-1 alpha-2 country code. Provide this parameter to ensure that the category exists for a particular country.
* @example "SE"
*/
country: string;
}
/**
* Get a list of Spotify playlists tagged with a particular category.
*
* @param client Spotify HTTPClient
* @param category_id The Spotify category ID for the category.
* @param opts Additional options for request
*/
export declare const getCategorysPlaylists: (client: HTTPClient, category_id: string, opts?: GetCategorysPlaylistsOpts) => Promise<FeaturedPlaylists>;
/**
* Get the current image associated with a specific playlist.
*
* @param client Spotify HTTPClient
*/
export declare const getPlaylistCoverImage: (client: HTTPClient, playlist_id: string) => Promise<NonNullableJSON<Image>[]>;
/**
* Upload custom images to the playlist.
*
* @param playlist_id The Spotify ID of the playlist.
* @param image The image should contain a Base64 encoded JPEG image data, maximum payload size is 256 KB.
*/
export declare const uploadPlaylistCoverImage: (client: HTTPClient, playlist_id: string, image: string) => Promise<void>;
export {};
import { ExternalUrls, Followers, Image, PagingObject } from "../general.types.js";
import { UserPublic, UserPublicSimplified } from "../user/user.types.js";
import { UserPublic } from "../user/user.types.js";
import { Track } from "../track/track.types.js";
import { JSONObject } from "@soundify/shared";
interface PlaylistBase extends JSONObject {
export interface PlaylistSimplified extends JSONObject {
/**

@@ -19,6 +19,2 @@ * `true` if the owner allows other users to modify the playlist.

/**
* Information about the followers of the playlist.
*/
followers: Followers;
/**
* A link to the Web API endpoint providing full details of the playlist.

@@ -46,12 +42,4 @@ */

*/
owner: Omit<UserPublic, "images">;
owner: UserPublic;
/**
* The playlist's public/private status:
*
* `true` => the playlist is public \
* `false` => the playlist is private \
* `null` => the playlist status is not relevant
*/
public: boolean | null;
/**
* The version identifier for the current playlist.

@@ -69,18 +57,16 @@ * Can be supplied in other requests to target a specific playlist version.

uri: string;
/** A collection containing a link ( href ) to the Web API endpoint where full details of the playlist’s tracks can be retrieved, along with the total number of tracks in the playlist. */
tracks: PlaylistTracksReference;
}
export interface SimplifiedPlaylist extends PlaylistBase, JSONObject {
export interface PlaylistTracksReference extends JSONObject {
/**
* The tracks of the playlist.
* A link to the Web API endpoint where full details of the playlist’s tracks can be retrieved.
*/
tracks: {
href: string;
total: number;
};
href: string;
/** The total number of tracks in playlist. */
total: number;
}
export interface Playlist extends PlaylistBase, JSONObject {
/**
* The tracks of the playlist.
*/
tracks: PagingObject<Track>;
}
/**
* The structure containing the details of the Spotify Track in the playlist.
*/
export interface PlaylistTrack extends JSONObject {

@@ -96,3 +82,3 @@ /**

*/
added_by: UserPublicSimplified;
added_by: UserPublic | null;
/**

@@ -102,4 +88,29 @@ * Whether this track or episode is a local file or not.

is_local: boolean;
track: Track;
track: Track | null;
}
export {};
export interface Playlist extends PlaylistSimplified, JSONObject {
/**
* Information about the followers of the playlist.
*/
followers: Followers;
/**
* The playlist's public/private status:
*
* `true` => the playlist is public \
* `false` => the playlist is private \
* `null` => the playlist status is not relevant
*/
public: boolean | null;
/**
* The tracks of the playlist.
*/
tracks: PagingObject<PlaylistTrack>;
}
export interface FeaturedPlaylists extends JSONObject {
/** The message from the featured playlists. */
message: string;
/**
* The list of the featured playlists wrapped in Paging object.
*/
playlists: PagingObject<PlaylistTrack>;
}

@@ -6,20 +6,37 @@ import { JSONObject, SearchParams } from "@soundify/shared";

import { Market } from "../market/market.types.js";
import { ArtistSimplified } from "../artist/artist.types.js";
import { ExternalIds, ExternalUrls, RestrictionsReason } from "../general.types.js";
export interface Track extends JSONObject {
export interface LinkedTrack extends JSONObject {
/**
* The album on which the track appears.
* A map of url name and the url.
*/
album: AlbumSimplified;
external_urls: ExternalUrls;
/**
* The api url where you can get the full details of the linked track.
*/
href: string;
/**
* The Spotify ID for the track.
*/
id: string;
/**
* The object type: "track".
*/
type: "track";
/**
* The Spotify URI for the track.
*/
uri: string;
}
export interface TrackSimplified extends JSONObject {
/**
* The artists who performed the track.
*/
artists: Artist[];
artists: ArtistSimplified[];
/**
* The markets in which the album is available:
* ISO 3166-1 alpha-2 country codes.
* A list of the countries in which the track can be played.
*/
available_markets: Market[];
/**
* The disc number
* (usually 1 unless the album consists of more than one disc).
* The disc number (usually 1 unless the album consists of more than one disc).
*/

@@ -35,9 +52,3 @@ disc_number: number;

explicit: boolean;
/**
* Known external IDs for the track.
*/
external_ids: ExternalIds;
/**
* Known external URLs for this track.
*/
/** External URLs for this track. */
external_urls: ExternalUrls;

@@ -49,5 +60,5 @@ /**

/**
* The Spotify ID for the track.
* Whether or not the track is from a local file.
*/
id: string;
is_local: boolean;
/**

@@ -59,17 +70,10 @@ * If true, the track is playable in the given market.

/**
* Included in the response when a content restriction is applied.
* Part of the response when Track Relinking is applied and is only part of the response if the track linking, in fact, exists.
*/
restrictions?: {
reason: RestrictionsReason;
};
linked_from?: LinkedTrack;
/**
* Name of the track.
* The name of the track.
*/
name: string;
/**
* The popularity of the track.
* The value will be between 0 and 100, with 100 being the most popular.
*/
popularity: number;
/**
* A link to a 30 second preview (MP3 format) of the track.

@@ -79,2 +83,8 @@ */

/**
* Included in the response when a content restriction is applied.
*/
restrictions?: {
reason: RestrictionsReason;
};
/**
* The number of the track. If an album has several discs, the track number is the number on the specified disc.

@@ -84,2 +94,6 @@ */

/**
* The Spotify ID for the track.
*/
id: string;
/**
* The object type: "track".

@@ -92,6 +106,21 @@ */

uri: string;
}
export interface Track extends TrackSimplified, JSONObject {
/**
* Whether or not the track is from a local file.
* The album on which the track appears.
*/
is_local: boolean;
album: AlbumSimplified;
/**
* The artists who performed the track.
*/
artists: Artist[];
/**
* Known external IDs for the track.
*/
external_ids: ExternalIds;
/**
* The popularity of the track.
* The value will be between 0 and 100, with 100 being the most popular.
*/
popularity: number;
}

@@ -336,3 +365,3 @@ export interface AudioFeatures extends JSONObject {

}
interface AudioAnalysisGeneric extends JSONObject {
interface TimeInterval extends JSONObject {
/**

@@ -351,3 +380,3 @@ * The starting point (in seconds) of the time interval.

}
interface AudioAnalysisSection extends AudioAnalysisGeneric, JSONObject {
interface AudioAnalysisSection extends TimeInterval, JSONObject {
/**

@@ -400,3 +429,3 @@ * The overall loudness of the section in decibels (dB).

}
interface AudioAnalysisSegment extends AudioAnalysisGeneric, JSONObject {
interface AudioAnalysisSegment extends TimeInterval, JSONObject {
/**

@@ -435,3 +464,3 @@ * The onset loudness of the segment in decibels (dB).

*/
bars: AudioAnalysisGeneric[];
bars: TimeInterval[];
/**

@@ -441,3 +470,3 @@ * The time intervals of beats throughout the track.

*/
beats: AudioAnalysisGeneric[];
beats: TimeInterval[];
/**

@@ -454,3 +483,3 @@ * Sections are defined by large variations in rhythm or timbre, e.g. chorus, verse, bridge, guitar solo, etc. Each section contains its own descriptions of `tempo`, `key`, `mode`, `time_signature`, and `loudness`.

*/
tatums: AudioAnalysisGeneric[];
tatums: TimeInterval[];
}

@@ -618,2 +647,32 @@ export interface GetRecommendationsOpts extends SearchParams {

}
export interface RecommendationSeed extends JSONObject {
/**
* The number of tracks available after min_* and max_* filters have been applied.
*/
afterFilteringSize: number;
/**
* The number of tracks available after relinking for regional availability.
*/
afterRelinkingSize: number;
/**
* A link to the full track or artist data for this seed.
*
* For tracks this will be a link to a Track Object. \
* For artists a link to an Artist Object. \
* For genre seeds, this value will be null.
*/
href: string | null;
/**
* The id used to select this seed. This will be the same as the string used in the `seed_artists`, `seed_tracks` or `seed_genres` parameter.
*/
id: string;
/**
* The number of recommended tracks available for this seed.
*/
initialPoolSize: number;
/**
* The entity type of this seed.
*/
type: "artist" | "track" | "genre";
}
export interface Recomendations extends JSONObject {

@@ -623,36 +682,8 @@ /**

*/
seeds: {
/**
* The number of tracks available after min_* and max_* filters have been applied.
*/
afterFilteringSize: number;
/**
* The number of tracks available after relinking for regional availability.
*/
afterRelinkingSize: number;
/**
* A link to the full track or artist data for this seed.
*
* For tracks this will be a link to a Track Object. \
* For artists a link to an Artist Object. \
* For genre seeds, this value will be null.
*/
href: string | null;
/**
* The id used to select this seed. This will be the same as the string used in the `seed_artists`, `seed_tracks` or `seed_genres` parameter.
*/
id: string;
/**
* The number of recommended tracks available for this seed.
*/
initialPoolSize: number;
/**
* The entity type of this seed.
*
* TODO check if it is caps or not
*/
type: "artist" | "track" | "genre";
}[];
tracks: Track[];
seeds: RecommendationSeed[];
/**
* An array of track object (simplified) ordered according to the parameters supplied.
*/
tracks: TrackSimplified[];
}
export {};

@@ -11,3 +11,3 @@ import { Artist } from "../artist/artist.types.js";

*/
export declare const getCurrentUserProfile: (client: HTTPClient) => Promise<UserPrivate>;
export declare const getCurrentUser: (client: HTTPClient) => Promise<UserPrivate>;
interface GetUserTopItemsOpts extends SearchParams, PagingOptions {

@@ -60,3 +60,3 @@ /**

*/
export declare const getUserProfile: (client: HTTPClient, user_id: string) => Promise<UserPublic>;
export declare const getUser: (client: HTTPClient, user_id: string) => Promise<UserPublic>;
/**

@@ -63,0 +63,0 @@ * Add the current user as a follower of a playlist.

import { JSONObject } from "@soundify/shared";
import { type ExternalUrls, type Followers, type Image } from "../general.types.js";
export interface UserPublicSimplified extends JSONObject {
export interface UserPublic extends JSONObject {
/**
* The name displayed on the user's profile.
* `null` if not available
*/
display_name: string | null;
/**
* Known external URLs for this user.

@@ -11,3 +16,3 @@ */

*/
followers: Followers;
followers?: Followers;
/**

@@ -26,2 +31,6 @@ * A link to the Web API endpoint for this user.

/**
* The user's profile image.
*/
images?: Image[];
/**
* The Spotify URI for the user.

@@ -31,11 +40,19 @@ */

}
export interface UserPublic extends UserPublicSimplified, JSONObject {
/**
* The product type in the User object.
*/
export type UserProductType = "free" | "open" | "premium";
/**
* The spotify api object containing the information of explicit content.
*/
export interface ExplicitContentSettings extends JSONObject {
/**
* The name displayed on the user's profile.
* When true, indicates that explicit content should not be played.
*/
display_name: string | null;
filter_enabled: boolean;
/**
* The user's profile image.
* When true, indicates that the explicit content setting is locked
* and can't be changed by the user.
*/
images: Image[];
filter_locked: boolean;
}

@@ -49,3 +66,3 @@ export interface UserPrivate extends UserPublic, JSONObject {

*/
country?: string;
country: string;
/**

@@ -60,3 +77,3 @@ * The user's email address, as entered by the user when creating

*/
email?: string;
email: string;
/**

@@ -67,13 +84,3 @@ * The user's explicit content settings.

*/
explicit_content?: {
/**
* When true, indicates that explicit content should not be played.
*/
filter_enabled: boolean;
/**
* When true, indicates that the explicit content setting is locked
* and can't be changed by the user.
*/
filter_locked: boolean;
};
explicit_content?: ExplicitContentSettings;
/**

@@ -85,3 +92,11 @@ * The user's Spotify subscription level: "premium", "free", etc.

*/
product?: "premium" | "free" | "open";
product?: UserProductType;
/**
* The user's profile image.
*/
images: Image[];
/**
* Information about the followers of the user.
*/
followers: Followers;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc