Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
João Vitor Pedrosa Cavalcante committed Jan 7, 2018
1 parent d30762c commit 3f6e245
Showing 1 changed file with 34 additions and 42 deletions.
76 changes: 34 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,30 @@ This library depends on [fetch](https://fetch.spec.whatwg.org/) to make requests
```sh
npm install wrappify --save
```

## How to use

### ES6

```js
// to import a specific method
import { method } from 'wrappify';
import Wrappify from 'wrappify';

const spotify = new Wrappify({
token: 'YOUR_TOKEN_HERE'
});

// to import everything
import * as wrappify from 'wrappify';
// using method
spotify.search.artists('Linkin Park');
```

### CommonJS

```js
var wrappify = require('wrappify');
const Wrappify = require('wrappify').default;

const spotify = new Wrappify({
token: 'YOUR_TOKEN_HERE'
});
```

### UMD in Browser
Expand All @@ -50,37 +57,22 @@ var wrappify = require('wrappify');
<script src="wrappify.min.js"></script>
```

After that the library will be available to the Global as `wrappify`. Follow an example:
After that the library will be available to the Global as `Wrappify`. Follow an example:

```js
const albums = wrappify.searchAlbums('Choosen Artist');

const spotify = new Wrappify({
token: 'YOUR_TOKEN_HERE'
});

const albums = spotify.search.albums('Choosen Artist');
```

## Methods

> Follow the methods that the library provides.
### search(query, types)

> Search for informations about artists, albums, tracks or playlists. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/).
**Arguments**

| Argument | Type | Options |
|----------|-------------------|-----------------------------------------|
|`query` |*string* | 'Any search query' |
|`type` |*Array of strings* | ['artist', 'album', 'track', 'playlist']|

**Example**

```js
search('Linkin Park', ['artist', 'album'])
.then(data => {
// do what you want with the data
})
```

### searchAlbums(query)
### search.albums(query)

> Search for informations about Albums with provided query. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) with type defined as *album*.
Expand All @@ -94,13 +86,13 @@ search('Linkin Park', ['artist', 'album'])
**Example**

```js
searchAlbums('Linkin Park')
spotify.search.albums('Linkin Park')
.then(data => {
// do what you want with the data
})
```

### searchArtists(query)
### search.artists(query)

> Search for informations about Artists with provided query. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) with type defined as *artist*.
Expand All @@ -114,13 +106,13 @@ searchAlbums('Linkin Park')
**Example**

```js
searchArtists('Linkin Park')
spotify.search.artists('Linkin Park')
.then(data => {
// do what you want with the data
})
```

### searchTracks(query)
### search.tracks(query)

> Search for informations about Tracks with provided query. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) with type defined as *track*.
Expand All @@ -134,13 +126,13 @@ searchArtists('Linkin Park')
**Example**

```js
searchTracks('Numb')
spotify.search.tracks('Numb')
.then(data => {
// do what you want with the data
})
```

### searchPlaylists(query)
### search.playlists(query)

> Search for informations about Playlist with provided query. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) with type defined as *playlist*.
Expand All @@ -154,13 +146,13 @@ searchTracks('Numb')
**Example**

```js
searchPlaylists('Happy Day')
spotify.search.playlists('Happy Day')
.then(data => {
// do what you want with the data
})
```

### getAlbum(id)
### album.getAlbum(id)

> Search for informations about a specific Album with provided id. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-album/).
Expand All @@ -174,13 +166,13 @@ searchPlaylists('Happy Day')
**Example**

```js
getAlbum('4aawyAB9vmqN3uQ7FjRGTy')
spotify.album.getAlbum('4aawyAB9vmqN3uQ7FjRGTy')
.then(data => {
// do what you want with the data
})
```

### getAlbums(ids)
### album.getAlbums(ids)

> Search for informations about some Albums with all id's. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-several-albums/).
Expand All @@ -193,13 +185,13 @@ getAlbum('4aawyAB9vmqN3uQ7FjRGTy')
**Example**

```js
getAlbum(['4aawyAB9vmqN3uQ7FjRGTy', '1A2GTWGtFfWp7KSQTwWOyo'])
spotify.album.getAlbums(['4aawyAB9vmqN3uQ7FjRGTy', '1A2GTWGtFfWp7KSQTwWOyo'])
.then(data => {
// do what you want with the data
})
```

### getAlbumTracks(id)
### album.getTracks(id)

> Search for all tracks in a specific Album with provided id. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-album-tracks/).
Expand All @@ -212,7 +204,7 @@ getAlbum(['4aawyAB9vmqN3uQ7FjRGTy', '1A2GTWGtFfWp7KSQTwWOyo'])
**Example**

```js
getAlbum('4aawyAB9vmqN3uQ7FjRGTy')
spotify.album.getTracks('4aawyAB9vmqN3uQ7FjRGTy')
.then(data => {
// do what you want with the data
})
Expand All @@ -236,4 +228,4 @@ See also the list of [contributors](https://github.com/kavalcante/wrappify/contr

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

0 comments on commit 3f6e245

Please sign in to comment.