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

soundcloud.ts

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

soundcloud.ts - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

typedoc.json

16

API.ts

@@ -9,2 +9,5 @@ import axios from "axios"

/**
* Gets an endpoint from the Soundcloud API.
*/
public get = async (endpoint: string, params?: any) => {

@@ -20,2 +23,5 @@ if (!params) params = {}

/**
* Some endpoints use the main website as the URL.
*/
public getWebsite = async (endpoint: string, params?: any) => {

@@ -60,12 +66,2 @@ if (!params) params = {}

}
public resolve = async (resolvable: string | number, full?: boolean) => {
let id = resolvable
if (String(resolvable).includes("soundcloud")) {
const resolved = await this.get(`resolve`, {url: resolvable})
if (full) return resolved
id = resolved.id
}
return id
}
}

@@ -5,3 +5,9 @@ export default class API {

constructor(clientID: string, oauthToken: string);
/**
* Gets an endpoint from the Soundcloud API.
*/
get: (endpoint: string, params?: any) => Promise<any>;
/**
* Some endpoints use the main website as the URL.
*/
getWebsite: (endpoint: string, params?: any) => Promise<any>;

@@ -11,3 +17,2 @@ post: (endpoint: string, params?: any) => Promise<any>;

delete: (endpoint: string, params?: any) => Promise<any>;
resolve: (resolvable: string | number, full?: boolean) => Promise<any>;
}

@@ -47,2 +47,5 @@ "use strict";

this.oauthToken = oauthToken;
/**
* Gets an endpoint from the Soundcloud API.
*/
this.get = function (endpoint, params) { return __awaiter(_this, void 0, void 0, function () {

@@ -68,2 +71,5 @@ var response;

}); };
/**
* Some endpoints use the main website as the URL.
*/
this.getWebsite = function (endpoint, params) { return __awaiter(_this, void 0, void 0, function () {

@@ -149,20 +155,2 @@ var response;

}); };
this.resolve = function (resolvable, full) { return __awaiter(_this, void 0, void 0, function () {
var id, resolved;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
id = resolvable;
if (!String(resolvable).includes("soundcloud")) return [3 /*break*/, 2];
return [4 /*yield*/, this.get("resolve", { url: resolvable })];
case 1:
resolved = _a.sent();
if (full)
return [2 /*return*/, resolved];
id = resolved.id;
_a.label = 2;
case 2: return [2 /*return*/, id];
}
});
}); };
}

@@ -169,0 +157,0 @@ return API;

@@ -6,3 +6,6 @@ import api from "../API";

constructor(api: api);
/**
* Gets Soundcloud apps.
*/
get: () => Promise<SoundCloudApp[]>;
}

@@ -43,2 +43,5 @@ "use strict";

this.api = api;
/**
* Gets Soundcloud apps.
*/
this.get = function () { return __awaiter(_this, void 0, void 0, function () {

@@ -45,0 +48,0 @@ var response;

@@ -6,3 +6,6 @@ import api from "../API";

constructor(api: api);
/**
* Gets a comment using its ID.
*/
get: (commentID: number) => Promise<SoundCloudComment>;
}

@@ -43,2 +43,5 @@ "use strict";

this.api = api;
/**
* Gets a comment using its ID.
*/
this.get = function (commentID) { return __awaiter(_this, void 0, void 0, function () {

@@ -45,0 +48,0 @@ var response;

@@ -7,8 +7,29 @@ import api from "../API";

constructor(api: api);
/**
* Gets your own profile, or your ID if pass in a true param.
*/
get: <B extends boolean>(returnID?: B) => Promise<B extends true ? number : SoundCloudUser>;
/**
* Gets activities from your homepage.
*/
activities: () => Promise<SoundCloudActivityCollection>;
/**
* Gets affiliated activities.
*/
activitiesAffiliated: () => Promise<SoundCloudActivityCollection>;
/**
* Gets exclusive activities.
*/
activitiesExclusive: () => Promise<SoundCloudActivityCollection>;
/**
* Gets your own activities only.
*/
activitiesOwn: () => Promise<SoundCloudActivityCollection>;
/**
* Gets your app connections, id any.
*/
connections: () => Promise<SoundCloudConnection[]>;
/**
* Gets a connection from its ID.
*/
connection: (connectionID: number) => Promise<SoundCloudConnection>;

@@ -15,0 +36,0 @@ tracks: () => Promise<import("../types").SoundCloudTrack[]>;

@@ -45,2 +45,5 @@ "use strict";

this.users = new index_1.Users(this.api);
/**
* Gets your own profile, or your ID if pass in a true param.
*/
this.get = function (returnID) { return __awaiter(_this, void 0, void 0, function () {

@@ -59,2 +62,5 @@ var response;

}); };
/**
* Gets activities from your homepage.
*/
this.activities = function () { return __awaiter(_this, void 0, void 0, function () {

@@ -71,2 +77,5 @@ var response;

}); };
/**
* Gets affiliated activities.
*/
this.activitiesAffiliated = function () { return __awaiter(_this, void 0, void 0, function () {

@@ -83,2 +92,5 @@ var response;

}); };
/**
* Gets exclusive activities.
*/
this.activitiesExclusive = function () { return __awaiter(_this, void 0, void 0, function () {

@@ -95,2 +107,5 @@ var response;

}); };
/**
* Gets your own activities only.
*/
this.activitiesOwn = function () { return __awaiter(_this, void 0, void 0, function () {

@@ -107,2 +122,5 @@ var response;

}); };
/**
* Gets your app connections, id any.
*/
this.connections = function () { return __awaiter(_this, void 0, void 0, function () {

@@ -122,2 +140,5 @@ var id, response;

}); };
/**
* Gets a connection from its ID.
*/
this.connection = function (connectionID) { return __awaiter(_this, void 0, void 0, function () {

@@ -124,0 +145,0 @@ var id, response;

@@ -6,3 +6,6 @@ import api from "../API";

constructor(api: api);
/**
* Gets the Oembed for a track, playlist, or user.
*/
get: (params: SoundCloudOembedFilter) => Promise<SoundCloudOembed>;
}

@@ -43,2 +43,5 @@ "use strict";

this.api = api;
/**
* Gets the Oembed for a track, playlist, or user.
*/
this.get = function (params) { return __awaiter(_this, void 0, void 0, function () {

@@ -45,0 +48,0 @@ var response;

@@ -7,5 +7,14 @@ import api from "../API";

constructor(api: api);
/**
* Searches for playlists.
*/
search: (params?: SoundCloudPlaylistFilter) => Promise<SoundCloudPlaylist[]>;
/**
* Fetches a playlist from URL or ID.
*/
get: (playlistResolvable: string | number) => Promise<SoundCloudPlaylist>;
/**
* Requires Authentication - Gets the secret token from one of your playlists.
*/
secretToken: (playlistResolvable: string | number) => Promise<SoundCloudSecretToken>;
}

@@ -45,2 +45,5 @@ "use strict";

this.resolve = new index_1.Resolve(this.api);
/**
* Searches for playlists.
*/
this.search = function (params) { return __awaiter(_this, void 0, void 0, function () {

@@ -57,2 +60,5 @@ var response;

}); };
/**
* Fetches a playlist from URL or ID.
*/
this.get = function (playlistResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -74,2 +80,5 @@ var playlistID, response;

}); };
/**
* Requires Authentication - Gets the secret token from one of your playlists.
*/
this.secretToken = function (playlistResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -76,0 +85,0 @@ var playlistID, response;

@@ -5,3 +5,6 @@ import api from "../API";

constructor(api: api);
/**
* Gets the ID of a user/playlist/track from the soundcloud URL.
*/
get: (resolvable: string | number, full?: boolean) => Promise<any>;
}

@@ -43,2 +43,5 @@ "use strict";

this.api = api;
/**
* Gets the ID of a user/playlist/track from the soundcloud URL.
*/
this.get = function (resolvable, full) { return __awaiter(_this, void 0, void 0, function () {

@@ -45,0 +48,0 @@ var id, resolved;

@@ -7,9 +7,30 @@ import api from "../API";

constructor(api: api);
/**
* Searches for tracks.
*/
search: (params?: SoundCloudTrackFilter) => Promise<any>;
/**
* Fetches a track by URL or ID.
*/
get: (trackResolvable: string | number) => Promise<SoundCloudTrack>;
/**
* Fetches all comments on a track.
*/
comments: (trackResolvable: string | number) => Promise<SoundCloudComment[]>;
/**
* Gets a specific comment.
*/
comment: (trackResolvable: string | number, commentID: number) => Promise<SoundCloudComment>;
/**
* Get all users who favorited the track.
*/
favoriters: (trackResolvable: string | number) => Promise<SoundCloudUser[]>;
/**
* Get a specific favoriter.
*/
favoriter: (trackResolvable: string | number, userResolvable: string | number) => Promise<SoundCloudUser>;
/**
* Requires Authentication - Gets the secret token from one of your own tracks.
*/
secretToken: (trackResolvable: string | number) => Promise<SoundCloudSecretToken>;
}

@@ -45,2 +45,5 @@ "use strict";

this.resolve = new index_1.Resolve(this.api);
/**
* Searches for tracks.
*/
this.search = function (params) { return __awaiter(_this, void 0, void 0, function () {

@@ -57,2 +60,5 @@ var response;

}); };
/**
* Fetches a track by URL or ID.
*/
this.get = function (trackResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -74,2 +80,5 @@ var id, response;

}); };
/**
* Fetches all comments on a track.
*/
this.comments = function (trackResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -89,2 +98,5 @@ var trackID, response;

}); };
/**
* Gets a specific comment.
*/
this.comment = function (trackResolvable, commentID) { return __awaiter(_this, void 0, void 0, function () {

@@ -104,2 +116,5 @@ var trackID, response;

}); };
/**
* Get all users who favorited the track.
*/
this.favoriters = function (trackResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -119,2 +134,5 @@ var trackID, response;

}); };
/**
* Get a specific favoriter.
*/
this.favoriter = function (trackResolvable, userResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -137,2 +155,5 @@ var trackID, userID, response;

}); };
/**
* Requires Authentication - Gets the secret token from one of your own tracks.
*/
this.secretToken = function (trackResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -139,0 +160,0 @@ var trackID, response;

@@ -7,14 +7,50 @@ import api from "../API";

constructor(api: api);
/**
* Searches for users.
*/
search: (params?: SoundCloudUserFilter) => Promise<SoundCloudUser[]>;
/**
* Gets a user by URL or ID.
*/
get: (userResolvable: string | number) => Promise<SoundCloudUser>;
/**
* Gets all the tracks by the user.
*/
tracks: (userResolvable: string | number) => Promise<SoundCloudTrack[]>;
/**
* Gets all the playlists by the user.
*/
playlists: (userResolvable: string | number) => Promise<SoundCloudPlaylist[]>;
/**
* Gets all the users the user is following.
*/
followings: (userResolvable: string | number) => Promise<SoundCloudUserCollection>;
/**
* Gets a specific following.
*/
following: (userResolvable: string | number, anotherUserResolvable: string | number) => Promise<SoundCloudUser>;
/**
* Gets all of a users followers.
*/
followers: (userResolvable: string | number) => Promise<SoundCloudUserCollection>;
/**
* Gets a specific follower.
*/
follower: (userResolvable: string | number, anotherUserResolvable: string | number) => Promise<SoundCloudUser>;
/**
* Gets all comments by the user.
*/
comments: (userResolvable: string | number) => Promise<SoundCloudComment[]>;
/**
* Gets all of a users favorite tracks.
*/
favorites: (userResolvable: string | number) => Promise<SoundCloudTrack[]>;
/**
* Gets a specific favorite track.
*/
favorite: (userResolvable: string | number, trackResolvable: string | number) => Promise<SoundCloudTrack>;
/**
* Gets all the web profiles on a users sidebar.
*/
webProfiles: (userResolvable: string | number) => Promise<SoundCloudWebProfile[]>;
}

@@ -45,2 +45,5 @@ "use strict";

this.resolve = new index_1.Resolve(this.api);
/**
* Searches for users.
*/
this.search = function (params) { return __awaiter(_this, void 0, void 0, function () {

@@ -57,2 +60,5 @@ var response;

}); };
/**
* Gets a user by URL or ID.
*/
this.get = function (userResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -74,2 +80,5 @@ var userID, response;

}); };
/**
* Gets all the tracks by the user.
*/
this.tracks = function (userResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -89,2 +98,5 @@ var userID, response;

}); };
/**
* Gets all the playlists by the user.
*/
this.playlists = function (userResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -104,2 +116,5 @@ var userID, response;

}); };
/**
* Gets all the users the user is following.
*/
this.followings = function (userResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -119,2 +134,5 @@ var userID, response;

}); };
/**
* Gets a specific following.
*/
this.following = function (userResolvable, anotherUserResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -137,2 +155,5 @@ var userID, followingID, response;

}); };
/**
* Gets all of a users followers.
*/
this.followers = function (userResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -152,2 +173,5 @@ var userID, response;

}); };
/**
* Gets a specific follower.
*/
this.follower = function (userResolvable, anotherUserResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -170,2 +194,5 @@ var userID, followerID, response;

}); };
/**
* Gets all comments by the user.
*/
this.comments = function (userResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -185,2 +212,5 @@ var userID, response;

}); };
/**
* Gets all of a users favorite tracks.
*/
this.favorites = function (userResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -200,2 +230,5 @@ var userID, response;

}); };
/**
* Gets a specific favorite track.
*/
this.favorite = function (userResolvable, trackResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -218,2 +251,5 @@ var userID, trackID, response;

}); };
/**
* Gets all the web profiles on a users sidebar.
*/
this.webProfiles = function (userResolvable) { return __awaiter(_this, void 0, void 0, function () {

@@ -220,0 +256,0 @@ var userID, response;

import api from "./API";
import { Tracks, Users, Playlists, Oembed, Resolve, Me, Comments, Apps } from "./entities/index";
/**
* The main class for interacting with the Soundcloud API.
*/
export default class Soundcloud {

@@ -4,0 +7,0 @@ static clientID: string;

@@ -9,2 +9,5 @@ "use strict";

var publicID = "BeGVhOrGmfboy1LtiHTQF6Ejpt9ULJCI";
/**
* The main class for interacting with the Soundcloud API.
*/
var Soundcloud = /** @class */ (function () {

@@ -11,0 +14,0 @@ function Soundcloud(clientID, oauthToken) {

@@ -7,2 +7,5 @@ import api from "../API"

/**
* Gets Soundcloud apps.
*/
public get = async () => {

@@ -9,0 +12,0 @@ const response = await this.api.get(`/apps`)

@@ -7,2 +7,5 @@ import api from "../API"

/**
* Gets a comment using its ID.
*/
public get = async (commentID: number) => {

@@ -9,0 +12,0 @@ const response = await this.api.get(`/comments/${commentID}`)

@@ -9,2 +9,5 @@ import api from "../API"

/**
* Gets your own profile, or your ID if pass in a true param.
*/
public get = async <B extends boolean>(returnID?: B): Promise<B extends true ? number : SoundCloudUser> => {

@@ -16,2 +19,5 @@ const response = await this.api.get(`/me`)

/**
* Gets activities from your homepage.
*/
public activities = async () => {

@@ -22,2 +28,5 @@ const response = await this.api.get(`/me/activities`)

/**
* Gets affiliated activities.
*/
public activitiesAffiliated = async () => {

@@ -28,2 +37,5 @@ const response = await this.api.get(`/me/activities/tracks/affiliated`)

/**
* Gets exclusive activities.
*/
public activitiesExclusive = async () => {

@@ -34,2 +46,5 @@ const response = await this.api.get(`/me/activities/tracks/exclusive`)

/**
* Gets your own activities only.
*/
public activitiesOwn = async () => {

@@ -40,2 +55,5 @@ const response = await this.api.get(`/me/activities/all/own`)

/**
* Gets your app connections, id any.
*/
public connections = async () => {

@@ -47,2 +65,5 @@ const id = await this.get(true)

/**
* Gets a connection from its ID.
*/
public connection = async (connectionID: number) => {

@@ -49,0 +70,0 @@ const id = await this.get(true)

@@ -7,2 +7,5 @@ import api from "../API"

/**
* Gets the Oembed for a track, playlist, or user.
*/
public get = async (params: SoundCloudOembedFilter) => {

@@ -9,0 +12,0 @@ const response = await this.api.getWebsite(`/oembed`, params)

@@ -9,2 +9,5 @@ import api from "../API"

/**
* Searches for playlists.
*/
public search = async (params?: SoundCloudPlaylistFilter) => {

@@ -15,2 +18,5 @@ const response = await this.api.get(`/playlists`, params)

/**
* Fetches a playlist from URL or ID.
*/
public get = async (playlistResolvable: string | number): Promise<SoundCloudPlaylist> => {

@@ -23,2 +29,5 @@ const playlistID = await this.resolve.get(playlistResolvable, true)

/**
* Requires Authentication - Gets the secret token from one of your playlists.
*/
public secretToken = async (playlistResolvable: string | number) => {

@@ -25,0 +34,0 @@ const playlistID = await this.resolve.get(playlistResolvable)

@@ -6,2 +6,5 @@ import api from "../API"

/**
* Gets the ID of a user/playlist/track from the soundcloud URL.
*/
public get = async (resolvable: string | number, full?: boolean) => {

@@ -8,0 +11,0 @@ if (!String(resolvable).match(/\d{8,}/) && !String(resolvable).includes("soundcloud")) {

@@ -8,2 +8,5 @@ import api from "../API"

/**
* Searches for tracks.
*/
public search = async (params?: SoundCloudTrackFilter) => {

@@ -14,2 +17,5 @@ const response = await this.api.get(`/tracks`, params)

/**
* Fetches a track by URL or ID.
*/
public get = async (trackResolvable: string | number): Promise<SoundCloudTrack> => {

@@ -22,2 +28,5 @@ const id = await this.resolve.get(trackResolvable, true)

/**
* Fetches all comments on a track.
*/
public comments = async (trackResolvable: string | number) => {

@@ -29,2 +38,5 @@ const trackID = await this.resolve.get(trackResolvable)

/**
* Gets a specific comment.
*/
public comment = async (trackResolvable: string | number, commentID: number) => {

@@ -36,2 +48,5 @@ const trackID = await this.resolve.get(trackResolvable)

/**
* Get all users who favorited the track.
*/
public favoriters = async (trackResolvable: string | number) => {

@@ -43,2 +58,5 @@ const trackID = await this.resolve.get(trackResolvable)

/**
* Get a specific favoriter.
*/
public favoriter = async (trackResolvable: string | number, userResolvable: string | number) => {

@@ -51,2 +69,5 @@ const trackID = await this.resolve.get(trackResolvable)

/**
* Requires Authentication - Gets the secret token from one of your own tracks.
*/
public secretToken = async (trackResolvable: string | number) => {

@@ -53,0 +74,0 @@ const trackID = await this.resolve.get(trackResolvable)

@@ -10,2 +10,5 @@ import api from "../API"

/**
* Searches for users.
*/
public search = async (params?: SoundCloudUserFilter) => {

@@ -16,2 +19,5 @@ const response = await this.api.get(`/users`, params)

/**
* Gets a user by URL or ID.
*/
public get = async (userResolvable: string | number): Promise<SoundCloudUser> => {

@@ -24,2 +30,5 @@ const userID = await this.resolve.get(userResolvable, true)

/**
* Gets all the tracks by the user.
*/
public tracks = async (userResolvable: string | number) => {

@@ -31,2 +40,5 @@ const userID = await this.resolve.get(userResolvable)

/**
* Gets all the playlists by the user.
*/
public playlists = async (userResolvable: string | number) => {

@@ -38,2 +50,5 @@ const userID = await this.resolve.get(userResolvable)

/**
* Gets all the users the user is following.
*/
public followings = async (userResolvable: string | number) => {

@@ -45,2 +60,5 @@ const userID = await this.resolve.get(userResolvable)

/**
* Gets a specific following.
*/
public following = async (userResolvable: string | number, anotherUserResolvable: string | number) => {

@@ -53,2 +71,5 @@ const userID = await this.resolve.get(userResolvable)

/**
* Gets all of a users followers.
*/
public followers = async (userResolvable: string | number) => {

@@ -60,2 +81,5 @@ const userID = await this.resolve.get(userResolvable)

/**
* Gets a specific follower.
*/
public follower = async (userResolvable: string | number, anotherUserResolvable: string | number) => {

@@ -68,2 +92,5 @@ const userID = await this.resolve.get(userResolvable)

/**
* Gets all comments by the user.
*/
public comments = async (userResolvable: string | number) => {

@@ -75,2 +102,5 @@ const userID = await this.resolve.get(userResolvable)

/**
* Gets all of a users favorite tracks.
*/
public favorites = async (userResolvable: string | number) => {

@@ -82,2 +112,5 @@ const userID = await this.resolve.get(userResolvable)

/**
* Gets a specific favorite track.
*/
public favorite = async (userResolvable: string | number, trackResolvable: string | number) => {

@@ -90,2 +123,5 @@ const userID = await this.resolve.get(userResolvable)

/**
* Gets all the web profiles on a users sidebar.
*/
public webProfiles = async (userResolvable: string | number) => {

@@ -92,0 +128,0 @@ const userID = await this.resolve.get(userResolvable)

{
"name": "soundcloud.ts",
"version": "0.0.1",
"version": "0.0.2",
"description": "Wrapper for the Soundcloud API with typings",

@@ -18,3 +18,3 @@ "main": "dist/soundcloud.js",

"keywords": [
"Soundcloud",
"soundcloud",
"typescript",

@@ -21,0 +21,0 @@ "ts",

@@ -21,2 +21,3 @@ <div align="left">

- [**SoundCloud API Documentation**](https://developers.soundcloud.com/docs/api/reference)
- [**Soundcloud.ts Documentation**](https://tenpi.github.io/soundcloud.ts/)

@@ -23,0 +24,0 @@ ### Getting Started

@@ -6,2 +6,5 @@ import api from "./API"

/**
* The main class for interacting with the Soundcloud API.
*/
export default class Soundcloud {

@@ -8,0 +11,0 @@ public static clientID: string

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