Socket
Socket
Sign inDemoInstall

@rygent/spotify

Package Overview
Dependencies
0
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.0-next.75222a2.0 to 1.2.0-next.f50a2bb.0

654

dist/index.d.ts

@@ -1,21 +0,645 @@

type SearchType = 'artist' | 'album' | 'track' | 'playlist' | 'show' | 'episode';
/**
* Object for search parameters for searching for tracks, playlists, artists or albums.
* See: [Search for an item](https://developer.spotify.com/web-api/search-item/)
*
* `q` and `type` are required in the API. Previous versions of the type declarations marked them
* as optional in order for external libraries to "implement them as function call parameters instead".
* Now, the type declaration shall mark them as required. If necessary, one can consider this to be a
* "breaking change". In that case, one can use TypeScript's built-in utility type `Omit<T, K>`.
* For example, one can remove the `q` and `type` by annotating the type
* as `Omit<SearchForItemParameterObject, "q" | "type">`.
*/
interface SearchForItemParameterObject {
/**
* The search query's keywords (and optional field filters and operators).
*/
q: string;
/**
* A comma-separated list of item types to search across. Valid types are: `album`, `artist`, `playlist`, `track`, `shows`, and `episodes`.
* Search results include hits from all the specified item types.
* For example: `q=name:abacab&type=album,track` returns both albums and tracks with `“abacab”` included in their name.
*/
type: string;
/**
* An [ISO 3166-1 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) or the string `from_token`.
* If a country code is specified, only artists, albums, and tracks with content that is playable in that market is returned.
*/
market?: string | undefined;
/**
* The maximum number of results to return.
* Default: `20`. Minimum: `1`. Maximum: `50`.
*/
limit?: number | undefined;
/**
* The index of the first result to return.
* Default: `0` (first result). Maximum offset (including limit): `2,000`.
* Use with limit to get the next page of search results.
*/
offset?: number | undefined;
/**
* Possible values: `audio`.
* If `include_external=audio` is specified, the response will include any relevant audio content that is hosted externally.
* By default external content is filtered out from responses.
*/
include_external?: string | undefined;
}
interface RestrictionsObject {
reason: string;
}
/**
* Search for an album
*
* GET /v1/search?type=album
* https://developer.spotify.com/web-api/search-item/
*/
interface AlbumSearchResponse {
albums: PagingObject<AlbumObjectSimplified>;
}
/**
* Search for an artist
*
* GET /v1/search?type=artist
* https://developer.spotify.com/web-api/search-item/
*/
interface ArtistSearchResponse {
artists: PagingObject<ArtistObjectFull>;
}
/**
* Search for a playlist
*
* GET /v1/search?type=playlist
* https://developer.spotify.com/web-api/search-item/
*/
interface PlaylistSearchResponse {
playlists: PagingObject<PlaylistObjectSimplified>;
}
/**
* Search for a track
*
* GET /v1/search?type=track
* https://developer.spotify.com/web-api/search-item/
*/
interface TrackSearchResponse {
tracks: PagingObject<TrackObjectFull>;
}
/**
* Search for a show
*
* GET /v1/search?type=show
* https://developer.spotify.com/web-api/search-item/
*/
interface ShowSearchResponse {
shows: PagingObject<ShowObjectSimplified>;
}
/**
* Search for a episode
*
* GET /v1/search?type=episode
* https://developer.spotify.com/web-api/search-item/
*/
interface EpisodeSearchResponse {
episodes: PagingObject<EpisodeObjectSimplified>;
}
/**
* Search for artists/albums/tracks/playlists/show/episode
*
* GET /v1/search
* https://developer.spotify.com/web-api/search-item/
*/
interface SearchResponse extends Partial<ArtistSearchResponse>, Partial<AlbumSearchResponse>, Partial<TrackSearchResponse>, Partial<PlaylistSearchResponse>, Partial<ShowSearchResponse>, Partial<EpisodeSearchResponse> {
}
/**
* Simplified Album Object
* [album object (simplified)](https://developer.spotify.com/web-api/object-model/#album-object-simplified)
*/
interface AlbumObjectSimplified extends ContextObject {
/**
* The field is present when getting an artist’s albums.
* Possible values are “album”, “single”, “compilation”, “appears_on”.
* Compare to album_type this field represents relationship between the artist and the album.
*/
album_group?: 'album' | 'single' | 'compilation' | 'appears_on' | undefined;
/**
* The type of the album: one of “album”, “single”, or “compilation”.
*/
album_type: 'album' | 'single' | 'compilation';
/**
* The artists of the album.
* Each artist object includes a link in href to more detailed information about the artist.
*/
artists: ArtistObjectSimplified[];
/**
* The markets in which the album is available: [ISO 3166-1 alpha-2 country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
* Note that an album is considered available in a market when at least 1 of its tracks is available in that market.
*/
available_markets?: string[] | undefined;
/**
* The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the album.
*/
id: string;
/**
* The cover art for the album in various sizes, widest first.
*/
images: ImageObject[];
/**
* The name of the album. In case of an album takedown, the value may be an empty string.
*/
name: string;
/**
* The date the album was first released, for example `1981`.
* Depending on the precision, it might be shown as `1981-12` or `1981-12-15`.
*/
release_date: string;
/**
* The precision with which release_date value is known: `year`, `month`, or `day`.
*/
release_date_precision: 'year' | 'month' | 'day';
/**
* Part of the response when [Track Relinking](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/) is applied,
* the original track is not available in the given market, and Spotify did not have any tracks to relink it with.
* The track response will still contain metadata for the original track,
* and a restrictions object containing the reason why the track is not available: `"restrictions" : {"reason" : "market"}`
*/
restrictions?: RestrictionsObject | undefined;
type: 'album';
/**
* The number of tracks in the album.
*/
total_tracks: number;
}
/**
* Full Artist Object
* [artist object (full)](https://developer.spotify.com/web-api/object-model/)
*/
interface ArtistObjectFull extends ArtistObjectSimplified {
/**
* Information about the followers of the artist.
*/
followers: FollowersObject;
/**
* A list of the genres the artist is associated with.
* For example: `"Prog Rock"` , `"Post-Grunge"`.
* (If not yet classified, the array is empty.)
*/
genres: string[];
/**
* Images of the artist in various sizes, widest first.
*/
images: ImageObject[];
/**
* The popularity of the artist. The value will be between `0` and `100`, with `100` being the most popular.
* The artist’s popularity is calculated from the popularity of all the artist’s tracks.
*/
popularity: number;
}
/**
* Simplified Artist Object
* [artist object (simplified)](https://developer.spotify.com/web-api/object-model/)
*/
interface ArtistObjectSimplified extends ContextObject {
/**
* The name of the artist.
*/
name: string;
/**
* The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the artist.
*/
id: string;
type: 'artist';
}
/**
* Copyright object
* [copyright object](https://developer.spotify.com/web-api/object-model/)
*/
interface CopyrightObject {
text: string;
type: 'C' | 'P';
}
/**
* External Id object
* [](https://developer.spotify.com/web-api/object-model/)
*
* Note that there might be other types available, it couldn't be found in the docs.
*/
interface ExternalIdObject {
isrc?: string | undefined;
ean?: string | undefined;
upc?: string | undefined;
}
/**
* External Url Object
* [](https://developer.spotify.com/web-api/object-model/)
*
* Note that there might be other types available, it couldn't be found in the docs.
*/
interface ExternalUrlObject {
spotify: string;
}
/**
* Followers Object
* [](https://developer.spotify.com/web-api/object-model/)
*/
interface FollowersObject {
/**
* A link to the Web API endpoint providing full details of the followers; `null` if not available.
* Please note that this will always be set to `null`, as the Web API does not support it at the moment.
*/
href: null;
/**
* The total number of followers.
*/
total: number;
}
/**
* Image Object
* [](https://developer.spotify.com/web-api/object-model/)
*/
interface ImageObject {
/**
* The image height in pixels. If unknown: `null` or not returned.
*/
height?: number | undefined;
/**
* The source URL of the image.
*/
url: string;
/**
* The image width in pixels. If unknown: null or not returned.
*/
width?: number | undefined;
}
/**
* Paging Object wrapper used for retrieving collections from the Spotify API.
* [](https://developer.spotify.com/web-api/object-model/#paging-object)
*/
interface PagingObject<T> {
href: string;
items: T[];
limit: number;
next: string | null;
offset: number;
previous: string | null;
total: number;
}
/**
* Base Playlist Object. Does not in itself exist in Spotify Web Api,
* but needs to be made since the tracks types vary in the Full and Simplified versions.
*/
interface PlaylistBaseObject extends ContextObject {
/**
* Returns `true` if context is not search and the owner allows other users to modify the playlist.
* Otherwise returns `false`.
*/
collaborative: boolean;
/**
* The playlist description. Only returned for modified, verified playlists, otherwise null.
*/
description: string | null;
/**
* The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the playlist.
*/
id: string;
/**
* Images for the playlist. The array may be empty or contain up to three images.
* The images are returned by size in descending order.
* See [Working with Playlists](https://developer.spotify.com/documentation/general/guides/working-with-playlists/).
* Note: If returned, the source URL for the image (`url`) is temporary and will expire in less than a day.
*/
images: ImageObject[];
/**
* The name of the playlist.
*/
name: string;
/**
* The user who owns the playlist.
*/
owner: UserObjectPublic;
/**
* The playlist’s public/private status:
* `true` the playlist is public,
* `false` the playlist is private,
* or `null` the playlist status is not relevant.
*/
public: boolean | null;
/**
* The version identifier for the current playlist. Can be supplied in other requests to target a specific playlist version:
* see [Remove tracks from a playlist](https://developer.spotify.com/documentation/web-api/reference/playlists/remove-tracks-playlist/).
*/
snapshot_id: string;
type: 'playlist';
}
/**
* Playlist Object Simplified
* [](https://developer.spotify.com/web-api/object-model/)
*/
interface PlaylistObjectSimplified extends PlaylistBaseObject {
tracks: {
href: string;
total: number;
};
}
/**
* Full Track Object
* [track object (full)](https://developer.spotify.com/web-api/object-model/#track-object-full)
*/
interface TrackObjectFull extends TrackObjectSimplified {
/**
* The album on which the track appears.
*/
album: AlbumObjectSimplified;
/**
* Known external IDs for the track.
*/
external_ids: ExternalIdObject;
/**
* The popularity of the track. The value will be between `0` and `100`, with `100` being the most popular.
* The popularity of a track is a value between `0` and `100`, with `100` being the most popular.
* The popularity is calculated by algorithm and is based, in the most part,
* on the total number of plays the track has had and how recent those plays are.
*/
popularity: number;
/**
* Whether or not the track is from a local file.
*/
is_local?: boolean | undefined;
}
/**
* Simplified Track Object
* [track object (simplified)](https://developer.spotify.com/web-api/object-model/#track-object-simplified)
*/
interface TrackObjectSimplified {
/**
* The artists who performed the track.
*/
artists: ArtistObjectSimplified[];
/**
* A list of the countries in which the track can be played,
* identified by their [ISO 3166-1 alpha-2 code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
*/
available_markets?: string[] | undefined;
/**
* The disc number (usually `1` unless the album consists of more than one disc).
*/
disc_number: number;
/**
* The track length in milliseconds.
*/
duration_ms: number;
/**
* Whether or not the track has explicit lyrics (`true` = yes it does; `false` = no it does not OR unknown).
*/
explicit: boolean;
/**
* Known external URLs for this track.
*/
external_urls: ExternalUrlObject;
/**
* A link to the Web API endpoint providing full details of the track.
*/
href: string;
/**
* The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the track.
*/
id: string;
/**
* Part of the response when [Track Relinking](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/) is applied.
* If `true`, the track is playable in the given market. Otherwise, `false`.
*/
is_playable?: boolean | undefined;
/**
* Part of the response when [Track Relinking](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/) is applied,
* and the requested track has been replaced with different track.
* The track in the `linked_from` object contains information about the originally requested track.
*/
linked_from?: TrackLinkObject | undefined;
/**
* Part of the response when [Track Relinking](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/) is applied,
* the original track is not available in the given market, and Spotify did not have any tracks to relink it with.
* The track response will still contain metadata for the original track, and a restrictions object containing the reason
* why the track is not available: `"restrictions" : {"reason" : "market"}`.
*/
restrictions?: RestrictionsObject | undefined;
/**
* The name of the track.
*/
name: string;
/**
* A link to a 30 second preview (MP3 format) of the track. Can be null
*/
preview_url: string | null;
/**
* The number of the track. If an album has several discs, the track number is the number on the specified disc.
*/
track_number: number;
/**
* The object type: “track”.
*/
type: 'track';
/**
* The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the track.
*/
uri: string;
}
/**
* Track Link Object
* [](https://developer.spotify.com/web-api/object-model/#track-object-simplified)
*/
interface TrackLinkObject {
external_urls: ExternalUrlObject;
href: string;
id: string;
type: 'track';
uri: string;
}
/**
* Simplified Episode Object
* [episode object (simplified)](https://developer.spotify.com/documentation/web-api/reference/object-model/#episode-object-simplified)
*/
interface EpisodeObjectSimplified extends ContextObject {
/**
* A URL to a 30 second preview (MP3 format) of the episode. null if not available.
*/
audio_preview_url: string | null;
/**
* A description of the episode.
*/
description: string;
/**
* The episode length in milliseconds.
*/
duration_ms: number;
/**
* Whether or not the episode has explicit content (true = yes it does; false = no it does not OR unknown).
*/
explicit: boolean;
/**
* A description of the episode. This field may contain HTML tags.
*/
html_description: string;
/**
* The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the episode.
*/
id: string;
/**
* The cover art for the episode in various sizes, widest first.
*/
images: ImageObject[];
/**
* True if the episode is hosted outside of Spotify’s CDN.
*/
is_externally_hosted: boolean;
/**
* True if the episode is playable in the given market. Otherwise false.
*/
is_playable: boolean;
/**
* The language used in the episode, identified by a [ISO 639](https://en.wikipedia.org/wiki/ISO_639) code.
* @deprecated Note: This field is deprecated and might be removed in the future. Please use the languages field instead.
*/
language: string;
/**
* A list of the languages used in the episode, identified by their [ISO 639](https://en.wikipedia.org/wiki/ISO_639) code.
* Optional because sometimes only the deprecated language field is set and this one isn't set at all.
*/
languages?: string[] | undefined;
/**
* The name of the episode.
*/
name: string;
/**
* The date the episode was first released, for example "1981-12-15". Depending on the precision, it might be shown as "1981" or "1981-12".
*/
release_date: string;
/**
* The precision with which release_date value is known: "year", "month", or "day".
*/
release_date_precision: string;
/**
* The user’s most recent position in the episode. Set if the supplied access token is a user token and has the scope user-read-playback-position.
*/
resume_point?: ResumePointObject | undefined;
type: 'episode';
}
/**
* Resume Point Object
* [resume point object](https://developer.spotify.com/documentation/web-api/reference/object-model/#resume-point-object)
*/
interface ResumePointObject {
/**
* Whether or not the episode has been fully played by the user.
*/
fully_played: boolean;
/**
* The user’s most recent position in the episode in milliseconds.
*/
resume_position_ms: number;
}
/**
* Simplified Show Object
* [show object (simplified)](https://developer.spotify.com/documentation/web-api/reference/object-model/#show-object-simplified)
*/
interface ShowObjectSimplified extends ContextObject {
/**
* A list of the countries in which the show can be played, identified by their [ISO 3166-1 alpha-2 code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
*/
available_markets: string[];
/**
* The copyright statements of the show.
*/
copyrights: CopyrightObject[];
/**
* A description of the show.
*/
description: string;
/**
* A description of the show. This field may contain HTML tags.
*/
html_description: string;
/**
* Whether or not the show has explicit content (true = yes it does; false = no it does not OR unknown).
*/
explicit: boolean;
/**
* The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the show.
*/
id: string;
/**
* The cover art for the show in various sizes, widest first.
*/
images: ImageObject[];
/**
* True if all of the show’s episodes are hosted outside of Spotify’s CDN. This field might be null in some cases.
*/
is_externally_hosted: boolean | null;
/**
* A list of the languages used in the show, identified by their [ISO 639](https://en.wikipedia.org/wiki/ISO_639) code.
*/
languages: string[];
/**
* The media type of the show.
*/
media_type: string;
/**
* The name of the show.
*/
name: string;
/**
* The publisher of the show.
*/
publisher: string;
/**
* The object type: “show”.
*/
type: 'show';
/**
* Total number of episodes in the show.
*/
total_episodes?: number | undefined;
}
/**
* User Object (Public)
* [](https://developer.spotify.com/web-api/object-model/#track-object-simplified)
*/
interface UserObjectPublic {
display_name?: string | undefined;
external_urls: ExternalUrlObject;
followers?: FollowersObject | undefined;
href: string;
id: string;
images?: ImageObject[] | undefined;
type: 'user';
uri: string;
}
/**
* Context Object
* [](https://developer.spotify.com/web-api/object-model/#context-object)
*/
interface ContextObject {
/**
* The object type.
*/
type: 'artist' | 'playlist' | 'album' | 'show' | 'episode';
/**
* A link to the Web API endpoint providing full details.
*/
href: string;
/**
* Known external URLs.
*/
external_urls: ExternalUrlObject;
/**
* The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids).
*/
uri: string;
}
declare class Spotify {
private clientId;
private clientSecret;
private bearer;
constructor(configuration: {
declare class Client {
private utils;
constructor(options: {
id: string;
secret: string;
});
search<Type extends SearchType>(variable: {
type: Type;
query: string;
offset?: number;
limit?: number;
}): Promise<SpotifyApi.SearchResponse>;
private getAccessToken;
private generateBearerToken;
search(options: SearchForItemParameterObject): Promise<SearchResponse>;
}
export { Spotify };
export { Client as Spotify };

86

dist/index.js
"use strict";
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;

@@ -22,10 +20,2 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });

};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

@@ -36,15 +26,10 @@

__export(src_exports, {
Spotify: () => Spotify
Spotify: () => Client
});
module.exports = __toCommonJS(src_exports);
// src/lib/constants.ts
var endpoint = "https://api.spotify.com/v1/";
var oauth2 = "https://accounts.spotify.com/api/token/";
// src/index.ts
var import_axios = __toESM(require("axios"));
var Spotify = class {
// src/structures/Util.ts
var Util = class {
static {
__name(this, "Spotify");
__name(this, "Util");
}

@@ -57,15 +42,22 @@ clientId;

};
constructor(configuration) {
this.clientId = configuration.id;
this.clientSecret = configuration.secret;
constructor(options) {
this.clientId = options.id;
this.clientSecret = options.secret;
}
async search(variable) {
const { type, query, offset = 0, limit = 10 } = variable;
async fetch(options) {
const { endpoint, params } = options;
try {
const response = await import_axios.default.get(`${endpoint}search?q=${encodeURIComponent(query)}&type=${type}&offset=${offset}&limit=${limit}`, {
headers: { Authorization: `Bearer ${await this.getAccessToken()}` }
const response = await fetch(`https://api.spotify.com/v1${endpoint}${params}`, {
method: "GET",
headers: {
Authorization: `Bearer ${await this.getAccessToken()}`
}
});
return response.data;
if (response.status === 200) {
const result = await response.json();
return result;
}
throw new Error(`Received status ${response.status} (${response.statusText})`);
} catch (error) {
throw new Error(error.message);
throw error;
}

@@ -82,13 +74,39 @@ }

async generateBearerToken() {
const params = `grant_type=client_credentials&client_id=${this.clientId}&client_secret=${this.clientSecret}`;
try {
const body = `grant_type=client_credentials&client_id=${this.clientId}&client_secret=${this.clientSecret}`;
const response = await import_axios.default.post(oauth2, body, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
const result = response.data;
this.bearer = { token: result.access_token, expire: Date.now() + result.expires_in * 1e3 };
return result.access_token;
const response = await fetch("https://accounts.spotify.com/api/token", {
method: "POST",
body: params,
headers: {
"Content-Type": "application/x-www-form-urlencoded"
}
});
if (response.status === 200) {
const result = await response.json();
this.bearer = { token: result.access_token, expire: Date.now() + result.expires_in * 1e3 };
return result.access_token;
}
throw new Error(`Received status ${response.status} (${response.statusText})`);
} catch (error) {
throw new Error(error.message);
throw error;
}
}
};
// src/structures/Client.ts
var Client = class {
static {
__name(this, "Client");
}
utils;
constructor(options) {
this.utils = new Util({ id: options.id, secret: options.secret });
}
async search(options) {
const { type, q, offset = 0, limit = 20 } = options;
const params = `?q=${encodeURIComponent(q)}&type=${type}&offset=${offset}&limit=${limit}`;
const response = await this.utils.fetch({ endpoint: "/search", params });
return response;
}
};
// Annotate the CommonJS export names for ESM import in node:

@@ -95,0 +113,0 @@ 0 && (module.exports = {

{
"name": "@rygent/spotify",
"version": "1.2.0-next.75222a2.0",
"description": "A simple to use API library for the Spotify REST API.",
"version": "1.2.0-next.f50a2bb.0",
"description": "An UNOFFICIAL wrapper for Spotify REST API written in typescript.",
"license": "MIT",

@@ -10,5 +10,10 @@ "main": "./dist/index.js",

"exports": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},

@@ -29,6 +34,2 @@ "scripts": {

},
"dependencies": {
"@types/spotify-api": "^0.0.25",
"axios": "^1.6.1"
},
"homepage": "https://github.com/Rygent/Utilities/tree/main/packages/spotify",

@@ -51,2 +52,8 @@ "repository": {

},
"keywords": [
"spotify",
"wrapper",
"api",
"spotify-api"
],
"publishConfig": {

@@ -53,0 +60,0 @@ "access": "public"

@@ -1,10 +0,9 @@

# Spotify API
# Spotify Wrapper
A simple to use API library for the Spotify REST API.
Only supports searching for `track | album | artist` however the 2 former ones have not been tested.
An UNOFFICIAL wrapper for Spotify REST API written in typescript.
#### What's Different?
You can visit the official docs for Spotify [here][spotify docs] to find out everything you can do.
- Uses `axios` instead.
- The code base has been completely rewritten to typescript.
> [!IMPORTANT]
> This project is still under development, not everything supported yet.

@@ -16,20 +15,13 @@ ## Installation

yarn add @rygent/spotify
pnpm i @rygent/spotify
```
## API
## Usage
### Search
```ts
import { Spotify } from '@rygent/spotify';
```js
<spotify>.search({ type: 'artist|album|track', query: 'My search query', offset: 0, limit: 20 });
```
#### Example
```js
const { Spotify } = require('@rygent/spotify');
const spotify = new Spotify({
id: 'your client id',
secret: 'your client secret'
id: 'your client id',
secret: 'your client secret'
});

@@ -43,6 +35,13 @@

> **Note**
> The `offset` property is optional and the search will default to `0` if one is not supplied.
> [!NOTE]
>
> - **offset**: This property is optional and the default value is `0`.
> - **limit**: This property is optional and the default value is `20`.
> **Note**
> The `limit` property is optional and the search will default to `20` if one is not supplied.
---
<i>This project is not affiliated with nor endorsed by Spotify.</i>
<!-- LINKS -->
[spotify docs]: https://developer.spotify.com/documentation/web-api

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc