# soundcloud-api-client

> Dead simple, promise-based Node.js library for interacting with the SoundCloud public API

Latest version **0.0.9** (published 2018-11-20) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install soundcloud-api-client
pnpm add soundcloud-api-client
yarn add soundcloud-api-client
bun add soundcloud-api-client
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2018-11-20 |
| First published | 2018-11-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 11.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 12 |
| Author | iammordaty |
| Maintainers | iammordaty |
| Keywords | soundcloud, api, nodejs |

## Links

- npm: https://www.npmjs.com/package/soundcloud-api-client
- Repository: https://github.com/iammordaty/soundcloud-api-client
- Homepage: https://github.com/iammordaty/soundcloud-api-client#readme
- Issues: https://github.com/iammordaty/soundcloud-api-client/issues
- npm.io page: https://npm.io/package/soundcloud-api-client

## Dependencies (2)

- [request](https://npm.io/package/request.md) ^2.88.0
- [request-promise](https://npm.io/package/request-promise.md) ^4.2.2

## Recent versions

- 0.0.9 (latest) — 2018-11-20
- 0.0.8 — 2018-11-19
- 0.0.7 — 2018-11-15
- 0.0.6 — 2018-11-14
- 0.0.5 — 2018-11-14
- 0.0.4 — 2018-11-14
- 0.0.3 — 2018-11-14
- 0.0.2 — 2018-11-14

## README

# soundcloud-api-client

Node.js module for the [SoundCloud API](http://soundcloud.com). See full API documentation [here](https://developers.soundcloud.com/docs/api/reference).

## Table of Contents

- [Getting Started](#getting-started)
  - [Installation](#installation)
  - [Usage](#usage)
  - [API](#api)
- [Examples](#examples)
- [Further information](#further-information)
- [License](#license)

## Getting Started

In order to use the module, you need to acquire a `client_id` for your application, which can be obtained from [SoundCloud for Developers page](https://developers.soundcloud.com/).

### Installation

This library can be installed through npm:

```
$ npm install --save soundcloud-api-client
```

### Usage

The following example shows how to initialize the library and perform a search request with sample criteria.

```js
const SoundCloud = require('soundcloud-api-client');

const client_id = 'your-client-id';
const soundcloud = new SoundCloud({ client_id });

const q = 'live mix';
const genres = [ 'house', 'tech-house', 'techno' ].join(',');

soundcloud.get('/tracks', { q, genres })
    .then(tracks => /* process tracks */)
    .catch(e => /* handle error */);
```

The next example demonstrates how to fetch 10 most recent user comments.

```js
const user = 'user-name-or-id'; // user id is necessary to fetch user tracks
const offset = 0;
const limit = 10;

soundcloud.get(`/users/${user}/comments`, { offset, limit })
    .then(comments => /* process comments */)
    .catch(e => /* handle error */);
```

### API

The main export of this library is the SoundCloud class.

#### SoundCloud

The SoundCloud constructor accepts a `config` object which may contain one or more of the following options:

* `client_id` – Your client Id (required)
* `hostname` – Override the default host API calls are issued to

#### get

Performs a get request. The method takes two parameters:

* `pathname` – Request pathname or URL (required)
* `params` – Request parameters (see API documentation page for possible values)

#### download

Saves the specified resource to the local file system. The method takes two parameters:

* `pathname` – Remote pathname or URL (required)
* `filename` – Local pathname (required)

## Examples

Various examples can be found in the [examples directory on GitHub.com](https://github.com/iammordaty/soundcloud-api-client/tree/master/examples). Also have a look at the [RunKit](https://npm.runkit.com/soundcloud-api-client), where you can test this library.

## Further information

 - [SoundCloud HTTP API Reference](https://developers.soundcloud.com/docs/api/reference)

## License

soundcloud-api-client is licensed under the MIT License.

---
_Source: https://npm.io/package/soundcloud-api-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
