Skip to content

Latest commit

 

History

History
803 lines (558 loc) · 26.2 KB

PlaylistsApi.md

File metadata and controls

803 lines (558 loc) · 26.2 KB

spotify_openapi.api.PlaylistsApi

Load the API package

import 'package:spotify_openapi/api.dart';

All URIs are relative to https://api.spotify.com/v1

Method HTTP request Description
addTracksToPlaylist POST /playlists/{playlist_id}/tracks Add Items to Playlist
changePlaylistDetails PUT /playlists/{playlist_id} Change Playlist Details
checkIfUserFollowsPlaylist GET /playlists/{playlist_id}/followers/contains Check if Users Follow Playlist
createPlaylist POST /users/{user_id}/playlists Create Playlist
followPlaylist PUT /playlists/{playlist_id}/followers Follow Playlist
getACategoriesPlaylists GET /browse/categories/{category_id}/playlists Get Category's Playlists
getAListOfCurrentUsersPlaylists GET /me/playlists Get Current User's Playlists
getFeaturedPlaylists GET /browse/featured-playlists Get Featured Playlists
getListUsersPlaylists GET /users/{user_id}/playlists Get User's Playlists
getPlaylist GET /playlists/{playlist_id} Get Playlist
getPlaylistCover GET /playlists/{playlist_id}/images Get Playlist Cover Image
getPlaylistsTracks GET /playlists/{playlist_id}/tracks Get Playlist Items
removeTracksPlaylist DELETE /playlists/{playlist_id}/tracks Remove Playlist Items
reorderOrReplacePlaylistsTracks PUT /playlists/{playlist_id}/tracks Update Playlist Items
unfollowPlaylist DELETE /playlists/{playlist_id}/followers Unfollow Playlist
uploadCustomPlaylistCover PUT /playlists/{playlist_id}/images Add Custom Playlist Cover Image

addTracksToPlaylist

ReorderOrReplacePlaylistsTracks200Response addTracksToPlaylist(playlistId, position, uris, requestBody)

Add Items to Playlist

Add one or more items to a user's playlist.

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String playlistId = 3cEYpjA9oz9GiPac4AsH4n; // String | 
final int position = 0; // int | 
final String uris = spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M; // String | 
final BuiltMap<String, JsonObject> requestBody = ; // BuiltMap<String, JsonObject> | 

try {
    final response = api.addTracksToPlaylist(playlistId, position, uris, requestBody);
    print(response);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->addTracksToPlaylist: $e\n');
}

Parameters

Name Type Description Notes
playlistId String
position int [optional]
uris String [optional]
requestBody BuiltMap<String, JsonObject> [optional]

Return type

ReorderOrReplacePlaylistsTracks200Response

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

changePlaylistDetails

changePlaylistDetails(playlistId, requestBody)

Change Playlist Details

Change a playlist's name and public/private state. (The user must, of course, own the playlist.)

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String playlistId = 3cEYpjA9oz9GiPac4AsH4n; // String | 
final BuiltMap<String, JsonObject> requestBody = ; // BuiltMap<String, JsonObject> | 

try {
    api.changePlaylistDetails(playlistId, requestBody);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->changePlaylistDetails: $e\n');
}

Parameters

Name Type Description Notes
playlistId String
requestBody BuiltMap<String, JsonObject> [optional]

Return type

void (empty response body)

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

checkIfUserFollowsPlaylist

BuiltList checkIfUserFollowsPlaylist(playlistId, ids)

Check if Users Follow Playlist

Check to see if one or more Spotify users are following a specified playlist.

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String playlistId = 3cEYpjA9oz9GiPac4AsH4n; // String | 
final String ids = jmperezperez,thelinmichael,wizzler; // String | 

try {
    final response = api.checkIfUserFollowsPlaylist(playlistId, ids);
    print(response);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->checkIfUserFollowsPlaylist: $e\n');
}

Parameters

Name Type Description Notes
playlistId String
ids String

Return type

BuiltList<bool>

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

createPlaylist

PlaylistObject createPlaylist(userId, requestBody)

Create Playlist

Create a playlist for a Spotify user. (The playlist will be empty until you add tracks.)

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String userId = smedjan; // String | 
final BuiltMap<String, JsonObject> requestBody = ; // BuiltMap<String, JsonObject> | 

try {
    final response = api.createPlaylist(userId, requestBody);
    print(response);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->createPlaylist: $e\n');
}

Parameters

Name Type Description Notes
userId String
requestBody BuiltMap<String, JsonObject> [optional]

Return type

PlaylistObject

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

followPlaylist

followPlaylist(playlistId, requestBody)

Follow Playlist

Add the current user as a follower of a playlist.

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String playlistId = 3cEYpjA9oz9GiPac4AsH4n; // String | 
final BuiltMap<String, JsonObject> requestBody = ; // BuiltMap<String, JsonObject> | 

try {
    api.followPlaylist(playlistId, requestBody);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->followPlaylist: $e\n');
}

Parameters

Name Type Description Notes
playlistId String
requestBody BuiltMap<String, JsonObject> [optional]

Return type

void (empty response body)

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getACategoriesPlaylists

PagingFeaturedPlaylistObject getACategoriesPlaylists(categoryId, country, limit, offset)

Get Category's Playlists

Get a list of Spotify playlists tagged with a particular category.

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String categoryId = dinner; // String | 
final String country = SE; // String | 
final int limit = 10; // int | 
final int offset = 5; // int | 

try {
    final response = api.getACategoriesPlaylists(categoryId, country, limit, offset);
    print(response);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->getACategoriesPlaylists: $e\n');
}

Parameters

Name Type Description Notes
categoryId String
country String [optional]
limit int [optional] [default to 20]
offset int [optional] [default to 0]

Return type

PagingFeaturedPlaylistObject

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getAListOfCurrentUsersPlaylists

PagingPlaylistObject getAListOfCurrentUsersPlaylists(limit, offset)

Get Current User's Playlists

Get a list of the playlists owned or followed by the current Spotify user.

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final int limit = 10; // int | 
final int offset = 5; // int | 

try {
    final response = api.getAListOfCurrentUsersPlaylists(limit, offset);
    print(response);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->getAListOfCurrentUsersPlaylists: $e\n');
}

Parameters

Name Type Description Notes
limit int [optional] [default to 20]
offset int [optional] [default to 0]

Return type

PagingPlaylistObject

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getFeaturedPlaylists

PagingFeaturedPlaylistObject getFeaturedPlaylists(country, locale, timestamp, limit, offset)

Get Featured Playlists

Get a list of Spotify featured playlists (shown, for example, on a Spotify player's 'Browse' tab).

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String country = SE; // String | 
final String locale = sv_SE; // String | 
final String timestamp = 2014-10-23T09:00:00; // String | 
final int limit = 10; // int | 
final int offset = 5; // int | 

try {
    final response = api.getFeaturedPlaylists(country, locale, timestamp, limit, offset);
    print(response);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->getFeaturedPlaylists: $e\n');
}

Parameters

Name Type Description Notes
country String [optional]
locale String [optional]
timestamp String [optional]
limit int [optional] [default to 20]
offset int [optional] [default to 0]

Return type

PagingFeaturedPlaylistObject

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getListUsersPlaylists

PagingPlaylistObject getListUsersPlaylists(userId, limit, offset)

Get User's Playlists

Get a list of the playlists owned or followed by a Spotify user.

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String userId = smedjan; // String | 
final int limit = 10; // int | 
final int offset = 5; // int | 

try {
    final response = api.getListUsersPlaylists(userId, limit, offset);
    print(response);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->getListUsersPlaylists: $e\n');
}

Parameters

Name Type Description Notes
userId String
limit int [optional] [default to 20]
offset int [optional] [default to 0]

Return type

PagingPlaylistObject

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getPlaylist

PlaylistObject getPlaylist(playlistId, market, fields, additionalTypes)

Get Playlist

Get a playlist owned by a Spotify user.

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String playlistId = 3cEYpjA9oz9GiPac4AsH4n; // String | 
final String market = ES; // String | 
final String fields = items(added_by.id,track(name,href,album(name,href))); // String | 
final String additionalTypes = additionalTypes_example; // String | 

try {
    final response = api.getPlaylist(playlistId, market, fields, additionalTypes);
    print(response);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->getPlaylist: $e\n');
}

Parameters

Name Type Description Notes
playlistId String
market String [optional]
fields String [optional]
additionalTypes String [optional]

Return type

PlaylistObject

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getPlaylistCover

BuiltList getPlaylistCover(playlistId)

Get Playlist Cover Image

Get the current image associated with a specific playlist.

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String playlistId = 3cEYpjA9oz9GiPac4AsH4n; // String | 

try {
    final response = api.getPlaylistCover(playlistId);
    print(response);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->getPlaylistCover: $e\n');
}

Parameters

Name Type Description Notes
playlistId String

Return type

BuiltList<ImageObject>

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getPlaylistsTracks

PagingPlaylistTrackObject getPlaylistsTracks(playlistId, market, fields, limit, offset, additionalTypes)

Get Playlist Items

Get full details of the items of a playlist owned by a Spotify user.

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String playlistId = 3cEYpjA9oz9GiPac4AsH4n; // String | 
final String market = ES; // String | 
final String fields = items(added_by.id,track(name,href,album(name,href))); // String | 
final int limit = 10; // int | 
final int offset = 5; // int | 
final String additionalTypes = additionalTypes_example; // String | 

try {
    final response = api.getPlaylistsTracks(playlistId, market, fields, limit, offset, additionalTypes);
    print(response);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->getPlaylistsTracks: $e\n');
}

Parameters

Name Type Description Notes
playlistId String
market String [optional]
fields String [optional]
limit int [optional] [default to 20]
offset int [optional] [default to 0]
additionalTypes String [optional]

Return type

PagingPlaylistTrackObject

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

removeTracksPlaylist

ReorderOrReplacePlaylistsTracks200Response removeTracksPlaylist(playlistId, removeTracksPlaylistRequest)

Remove Playlist Items

Remove one or more items from a user's playlist.

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String playlistId = 3cEYpjA9oz9GiPac4AsH4n; // String | 
final RemoveTracksPlaylistRequest removeTracksPlaylistRequest = ; // RemoveTracksPlaylistRequest | 

try {
    final response = api.removeTracksPlaylist(playlistId, removeTracksPlaylistRequest);
    print(response);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->removeTracksPlaylist: $e\n');
}

Parameters

Name Type Description Notes
playlistId String
removeTracksPlaylistRequest RemoveTracksPlaylistRequest [optional]

Return type

ReorderOrReplacePlaylistsTracks200Response

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

reorderOrReplacePlaylistsTracks

ReorderOrReplacePlaylistsTracks200Response reorderOrReplacePlaylistsTracks(playlistId, uris, requestBody)

Update Playlist Items

Either reorder or replace items in a playlist depending on the request's parameters. To reorder items, include range_start, insert_before, range_length and snapshot_id in the request's body. To replace items, include uris as either a query parameter or in the request's body. Replacing items in a playlist will overwrite its existing items. This operation can be used for replacing or clearing items in a playlist.
Note: Replace and reorder are mutually exclusive operations which share the same endpoint, but have different parameters. These operations can't be applied together in a single request.

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String playlistId = 3cEYpjA9oz9GiPac4AsH4n; // String | 
final String uris = uris_example; // String | 
final BuiltMap<String, JsonObject> requestBody = ; // BuiltMap<String, JsonObject> | 

try {
    final response = api.reorderOrReplacePlaylistsTracks(playlistId, uris, requestBody);
    print(response);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->reorderOrReplacePlaylistsTracks: $e\n');
}

Parameters

Name Type Description Notes
playlistId String
uris String [optional]
requestBody BuiltMap<String, JsonObject> [optional]

Return type

ReorderOrReplacePlaylistsTracks200Response

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

unfollowPlaylist

unfollowPlaylist(playlistId)

Unfollow Playlist

Remove the current user as a follower of a playlist.

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String playlistId = 3cEYpjA9oz9GiPac4AsH4n; // String | 

try {
    api.unfollowPlaylist(playlistId);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->unfollowPlaylist: $e\n');
}

Parameters

Name Type Description Notes
playlistId String

Return type

void (empty response body)

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

uploadCustomPlaylistCover

uploadCustomPlaylistCover(playlistId, body)

Add Custom Playlist Cover Image

Replace the image used to represent a specific playlist.

Example

import 'package:spotify_openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: oauth_2_0
//defaultApiClient.getAuthentication<OAuth>('oauth_2_0').accessToken = 'YOUR_ACCESS_TOKEN';

final api = SpotifyOpenapi().getPlaylistsApi();
final String playlistId = 3cEYpjA9oz9GiPac4AsH4n; // String | 
final String body = BYTE_ARRAY_DATA_HERE; // String | 

try {
    api.uploadCustomPlaylistCover(playlistId, body);
} catch on DioException (e) {
    print('Exception when calling PlaylistsApi->uploadCustomPlaylistCover: $e\n');
}

Parameters

Name Type Description Notes
playlistId String
body String [optional]

Return type

void (empty response body)

Authorization

oauth_2_0

HTTP request headers

  • Content-Type: image/jpeg
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]