angular-sw-modules
Bower component packaging modules to interact with api v6.
How to install
You can git clone this repo with the following methods:
git clone git@gitlab.snowite.fr:nathand/angular-sw-modules.git
git clone http://gitlab.snowite.fr/nathand/angular-sw-modules.git
You can also add this project as a dependency in your nodejs project by editing the bower.json
file as follow:
{
"dependencies": {
"angular-sw-modules": "git@gitlab.snowite.fr:nathand/angular-sw-modules.git",
"angular-sw-modules": "http://gitlab.snowite.fr/nathand/angular-sw-modules.git",
}
}
Build & development
Run grunt
for building.
Testing
Running grunt test
will run the unit tests with karma.
Modules
Add sw.modules
in your Angular module dependencies.
Albums
Service: AlbumsSrv
getAlbum(id)
- @desc Get album from its id
- @param {Number} id
- @return {Promise}
getTracks(id, options, timeout)
- @desc Get album's tracks from its id
- @param {Number} id
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
Articles
Service: ArticlesSrv
getArticle(id)
- @desc Get article info from its id
- @param {Number} id
- @return {Promise}
getTypes()
- @desc Get articles' types
- @return {Promise}
getTypeContent(id)
- @desc Get content of an article's type
- @param {Number} id
- @return {Promise}
Artists
Service: ArtistsSrv
getArtist(id)
- @desc Get artist info from its id
- @param {Number} id
- @return {Promise}
getAlbums(id, options, timeout)
- @desc Get artist's albums
- @param {Number} id
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
getTopTracks(id, timeout)
- @desc Get top tracks relative to an artist id
- @param {Number} id
- @param {Promise} timeout
- @return {Promise}
getSimilars(id, options, timeout)
- @desc Get artists similars to a specific artist
- @param {Number} id
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
Auth
Service: AuthSrv
register(email, login, password)
- @desc Register a new user
- @param {String} email
- @param {String} login
- @param {String} password
- @return {Promise}
login(login, password)
- @desc Sign in a user + cache the JWT for logged calls
- @param {String} login
- @param {String} password
- @return {Promise}
refreshToken()
- @desc Refresh the token from the one stored in the cache
- @return {Promise}
logout()
- @desc Log out the user (i.e. remove token from cache)
- @return {Promise}
Browse
Service: BrowseSrv
getGenres()
- @desc Get music genres
- @return {Promise}
getTopAlbums(options, timeout)
- @desc Get top albums
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
getTopAlbumsByGenre(id, options, timeout)
- @desc Get top albums by genre
- @param {Number} id
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
getTopTracks(options, timeout)
- @desc Get top tracks
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
getTopTracksByGenre(id, options, timeout)
- @desc Get top tracks by genre
- @param {Number} id
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
getNewReleasesAlbums(options, timeout)
- @desc Get new releases albums
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
getNewReleasesAlbumsByGenre(id, options, timeout)
- @desc Get new releases albums by genre
- @param {Number} id
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
Cordova
Service: SdkSrv
init()
- @desc Init native SDK
- @return {Promise}
setWifiOnly(wifi)
- @desc Set offline sync only in wifi
- @param {Boolean} wifi
- @return {Promise}
setOfflineOnly(offline)
- @desc Force offline only
- @param {Boolean} offline
- @return {Promise}
isWifiOnly()
- @desc Check if it's wifi only for offline
- @return {Promise}
isOfflineOnly()
- @desc Check if it's offline only
- @return {Promise}
setOfflineFormat(format)
- @desc Set files format for downloading
- @param {String} format => low/medium/high
- @return {Promise}
getOfflineFormat()
- @desc Get offline download format
- @return {Promise}
login(login, password)
- @desc Sign in a user
- @param {String} login
- @param {String} password
- @return {Promise}
logout()
- @desc Sign out a user
- @return {Promise}
refreshToken()
- @desc Refresh a token
- @return {Promise}
encrypt(str)
- @desc Encrypt a string
- @param {String} str
- @return {Promise}
decrypt(str)
- @desc Decrypt a string
- @param {String} str
- @return {Promise}
registerPushNotifications(pushToken)
- @desc Register device push token
- @param {String} pushToken
- @return {Promise}
on(evt, fn)
- @desc Listen sdk events
- @param {String} evt
- @event tokenExpired
- @event tokenHasBeenRefreshed
- @event subscriptionExpired
- @param {Function} fn
Service: PlayerSrv
play(playId, trackId)
- @desc Play
- @param {String} playId
- @param {Number} trackId
- @return {Promise}
pause()
- @desc Pause
- @return {Promise}
resume()
- @desc Resume
- @return {Promise}
seekTo(time)
- @desc Seek to a specific time
- @param {Number} time
- @return {Promise}
setVolume(value)
- @desc Set volume
- @param {Number} value => [0, 1]
- @return {Promise}
getVolume()
- @desc Get volume
- @return {Promise}
airplay()
- @desc Launch airplay
- @return {Promise}
isAirplay()
- @desc Check if airplay is enabled by the system
- @return {Promise}
on(evt, fn)
- @desc Listen play events
- @param {String} evt
- @event time track time elapsed
- @event end end of track
- @event volume
- @event pause
- @event previous
- @event next
- @event airplay
- @event error play error
- @param {Function} fn
Service: OfflineSrv
setAlbum(id)
- @desc Set an album offline
- @param {Number} id
- @return {Promise}
setTracklist(id)
- @desc Set a tracklist offline
- @param {Number} id
- @return {Promise}
setFavoriteTracks()
- @desc Set all favorite tracks offline
- @return {Promise}
getAlbums(options)
- @desc Get albums offline
- @param {Object} options
- @param {Number} limit for iterator's creating
- @return {Promise}
getTracklists(options)
- @desc Get tracklists offline
- @param {Object} options
- @param {Number} limit for iterator's creating
- @return {Promise}
getFavoriteTracks(options)
- @desc Get favorite tracks offline
- @param {Object} options
- @param {Number} limit for iterator's creating
- @return {Promise}
getAlbum(id, options)
- @desc Get album offline
- @param {Number} id
- @param {Object} options
- @param {Number} limit for iterator's creating
- @return {Promise}
getTracklist(id, options)
- @desc Get tracklist offline
- @param {Number} id
- @param {Object} options
- @param {Number} limit for iterator's creating
- @return {Promise}
purgeAll()
- @desc Purge all contents
- @return {Promise}
purgeAlbum(id)
- @desc Purge album offline
- @param {Number} id
- @return {Promise}
purgeTracklist(id)
- @desc Purge tracklist offline
- @param {Number} id
- @return {Promise}
purgeFavoriteTracks()
- @desc Purge favorite tracks offline
- @return {Promise}
isAlbumOffline(id)
- @desc Check if an album is offline
- @param {Number} id
- @return {Promise}
isTracklistOffline(id)
- @desc Check if a tracklist is offline
- @param {Number} id
- @return {Promise}
isFavoriteTracksOffline()
- @desc Check if favorite tracks are offline
- @return {Promise}
isTracksOffline(ids)
- @desc Check if tracks are offline
- @param {Array} ids
- @return {Promise}
getCover(url)
- @desc Get cover
- @param {String} url
- @return {Promise}
getDiskUsed()
- @desc Get data disk size used for offline
- @return {Promise}
syncAlbum(id)
- @desc Sync offline album
- @param {Number} id
- @return {Promise}
syncTracklist(id)
- @desc Sync offline tracklist
- @param {Number} id
- @return {Promise}
syncFavoriteTracks()
- @desc Sync offline favorite tracks
- @return {Promise}
on(evt, fn)
- @desc Listen play events
- @param {String} evt
- @event download percentage downloaded
- @event error offline error
- @param {Function} fn
Helpers
Service: HelpersSrv
addAlbumToList(listId, albumId)
- @desc Add an album to a list
- @param {Number} listId
- @param {Number} albumId
- @return {Promise}
addTracklistToList(listId, tracklistId)
- @desc Add a tracklist to a list
- @param {Number} listId
- @param {Number} albumId
- @return {Promise}
Lists
Service: ListsSrv
getTypes()
- @desc Get lists' types
- @return {Promise}
get(id)
- @desc Get
- @param {Number} id
- @return {Promise}
getTracks(id, options, timeout)
- @desc Get tracks from a list id
- @param {Number} id
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
create(type, title, isPublic, lifetime)
- @desc Create a list
- @param {String} type
- @param {String} title
- @param {Boolean} isPublic
- @param {Number} lifetime
- @return {Promise}
update(id, update)
- @desc Update list info
- @param {Number} id
- @param {Object} update
- @return {Promise}
addItem(id, items)
- @desc Add an item in a list
- @param {Number} id
- @param {Array} items
- @return {Promise}
replaceItem(id, items)
- @desc Replace an item in a list
- @param {Number} id
- @param {Array} items
- @return {Promise}
delete(id)
- @desc Delete a list
- @param {Number} id
- @return {Promise}
addTags(id, tags)
- @desc Add tags in a list
- @param {Number} id
- @param {Array} tags
- @return {Promise}
replaceTags(id, tags)
- @desc Add a tag in a list
- @param {Number} id
- @param {Array} tags
- @return {Promise}
Products
Service: ProductsSrv
getAll()
- @desc Get all products
- @return {Promise}
get(id)
- @desc Get product
- @param {Number} id
- @return {Promise}
getPrices(id)
- @desc Get product's prices
- @param {Number} id
- @return {Promise}
setPrices(id, priceObject)
- @desc Set product's prices
- @param {Number} id
- @param {Object} priceObject
- @return {Promise}
Search
Service: SearchSrv
search(term, options)
- @desc Global search (i.e. lists + artists + albums + tracks + articles)
- @param {String} term
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @return {Promise}
searchLists(term, options, timeout)
- @desc Lists search
- @param {String} term
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
searchArtists(term, options, timeout)
- @desc Artists search
- @param {String} term
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
searchAlbums(term, options, timeout)
- @desc Albums search
- @param {String} term
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
searchTracks(term, options, timeout)
- @desc Tracks search
- @param {String} term
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
searchArticles(term, options, timeout)
- @desc Articles search
- @param {String} term
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
saveHistory(term)
- @desc Save a term in the search history
- @param {String} term
- @return {Promise}
getHistory()
- @desc Get history
- @return {Promise}
purgeHistory(term)
- @desc Purge an item or all history
- @param {String} term <Optional>
- @return {Promise}
Users
Service: UsersSrv
createTracklist(title, isPublic)
- @desc Create a tracklist
- @param {String} title
- @param {Boolean} isPublic
- @return {Promise}
getTracklist(id)
- @desc Get a tracklist from its id
- @param {Number} id
- @param {Object} options <Optional>
- @return {Promise}
getTracklists(options, timeout)
- @desc Get all tracklists
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
updateTracklist(id, update)
- @desc Update tracklist's info
- @param {Number} id
- @param {Object} update
- @return {Promise}
deleteTracklist(id)
- @desc Delete tracklist
- @param {Number} id
- @return {Promise}
addTracksToTracklist(id, tracks)
- @desc Add tracks to a tracklist
- @param {Number} id
- @param {Array | Number} tracks
- @return {Promise}
replaceTracksFromTracklist(id, tracks)
- @desc Replace tracks to a tracklist
- @param {Number} id
- @param {Array} tracks
- @return {Promise}
deleteTracksFromTracklist(id, tracks)
- @desc Delete tracks to a tracklist
- @param {Number} id
- @param {Array | Number} tracks
- @return {Promise}
getFavorites(type, options, timeout)
- @desc Get user's favorites
- @param {String} type ie 'artists' || 'albums' || 'tracks'
- @param {Object} options <Optional>
- @param {Number} offset
- @param {Number} limit
- @param {Promise} timeout
- @return {Iterator}
addFavorites(type, items)
- @desc Add favorites to the user's profile
- @param {String} type ie 'artists' || 'albums' || 'tracks'
- @param {Array | Number} items
- @return {Promise}
checkFavorites(type, items)
- @desc Check if favorites exist in the user's profile
- @param {String} type ie 'artists' || 'albums' || 'tracks'
- @param {Array | Number} items
- @return {Promise}
replaceFavorites(type, items)
- @desc Reorder user's favorites
- @param {String} type ie 'artists' || 'albums' || 'tracks'
- @param {Array | Number} items
- @return {Promise}
deleteFavorites(type, items)
- @desc Delete user's favorites
- @param {String} type ie 'artists' || 'albums' || 'tracks'
- @param {Array | Number} items
- @return {Promise}
getNotifications(language, read)
- @desc Get user's notifications
- @param {String} language
- @param {Boolean} read
- @return {Promise}
updateNotifications(_id, read)
- @desc Update user's notifications
- @param {Number} id
- @param {Boolean} read
- @return {Promise}