Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gillesdemey/soundcloud-v2

Client for SoundCloud's API v2
https://github.com/gillesdemey/soundcloud-v2

Last synced: 3 days ago
JSON representation

Client for SoundCloud's API v2

Awesome Lists containing this project

README

        

# SoundCloud v2 API

Client for SoundCloud's API v2

## Usage

Create a new SoundCloud client.

```javascript
var client = new SoundCloud({
access_token: 'oauth-token',
client_id: 'client-id',
app_version: 'v1.0.0' // optional
})
```

Call the libraries API, followed by an HTTP method. Supported methods are `get`, `post`, `put` and `delete`.

You can chain multiple functions if they're nested resources.

After calling an HTTP method, you are returned a Promise object.

```javascript
client
.tracks({ id: 222053868 })
.related({ limit: 1 })
.get()
// working with a Promise object here
.then(function (res) {
console.log(res.body.collection[0].title)
})
.catch(function (err) {
console.error(err)
})
```

### API

#### Me
```javascript
client
.me()
```

#### Activities
```javascript
client
.activities()
```

#### Stream
```javascript
client
.stream({ limit: 5 })
```

#### Tracks

```javascript
client
.tracks({ id: 222053868 })
```

##### Related
```javascript
client
.tracks({ id: 222053868 })
.related({ limit: 1 })
```