@@ -935,6 +935,138 @@ public async Task<ListResponse<Boolean>> CheckSavedTracksAsync(List<String> ids)
935
935
return new ListResponse < Boolean > { List = null , Error = res [ "error" ] . ToObject < Error > ( ) } ;
936
936
}
937
937
938
+ /// <summary>
939
+ /// Save one or more albums to the current user’s “Your Music” library.
940
+ /// </summary>
941
+ /// <param name="ids">A list of the Spotify IDs</param>
942
+ /// <returns></returns>
943
+ /// <remarks>AUTH NEEDED</remarks>
944
+ public ErrorResponse SaveAlbums ( List < String > ids )
945
+ {
946
+ JArray array = new JArray ( ids ) ;
947
+ return UploadData < ErrorResponse > ( _builder . SaveAlbums ( ) , array . ToString ( Formatting . None ) , "PUT" ) ?? new ErrorResponse ( ) ;
948
+ }
949
+
950
+ /// <summary>
951
+ /// Save one or more albums to the current user’s “Your Music” library asynchronously.
952
+ /// </summary>
953
+ /// <param name="ids">A list of the Spotify IDs</param>
954
+ /// <returns></returns>
955
+ /// <remarks>AUTH NEEDED</remarks>
956
+ public async Task < ErrorResponse > SaveAlbumsAsync ( List < String > ids )
957
+ {
958
+ JArray array = new JArray ( ids ) ;
959
+ return await UploadDataAsync < ErrorResponse > ( _builder . SaveAlbums ( ) , array . ToString ( Formatting . None ) , "PUT" ) ?? new ErrorResponse ( ) ;
960
+ }
961
+
962
+ /// <summary>
963
+ /// Save one album to the current user’s “Your Music” library.
964
+ /// </summary>
965
+ /// <param name="id">A Spotify ID</param>
966
+ /// <returns></returns>
967
+ /// <remarks>AUTH NEEDED</remarks>
968
+ public ErrorResponse SaveAlbum ( String id )
969
+ {
970
+ return SaveAlbums ( new List < string > { id } ) ;
971
+ }
972
+
973
+ /// <summary>
974
+ /// Save one album to the current user’s “Your Music” library asynchronously.
975
+ /// </summary>
976
+ /// <param name="id">A Spotify ID</param>
977
+ /// <returns></returns>
978
+ /// <remarks>AUTH NEEDED</remarks>
979
+ public async Task < ErrorResponse > SaveAlbumAsync ( String id )
980
+ {
981
+ return await SaveAlbumsAsync ( new List < string > { id } ) ;
982
+ }
983
+
984
+ /// <summary>
985
+ /// Get a list of the albums saved in the current Spotify user’s “Your Music” library.
986
+ /// </summary>
987
+ /// <param name="limit">The maximum number of objects to return. Default: 20. Minimum: 1. Maximum: 50.</param>
988
+ /// <param name="offset">The index of the first object to return. Default: 0 (i.e., the first object)</param>
989
+ /// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
990
+ /// <returns></returns>
991
+ /// <remarks>AUTH NEEDED</remarks>
992
+ public Paging < SavedTrack > GetSavedAlbums ( int limit = 20 , int offset = 0 , String market = "" )
993
+ {
994
+ if ( ! UseAuth )
995
+ throw new InvalidOperationException ( "Auth is required for GetSavedAlbums" ) ;
996
+ return DownloadData < Paging < SavedTrack > > ( _builder . GetSavedAlbums ( limit , offset , market ) ) ;
997
+ }
998
+
999
+ /// <summary>
1000
+ /// Get a list of the albums saved in the current Spotify user’s “Your Music” library asynchronously.
1001
+ /// </summary>
1002
+ /// <param name="limit">The maximum number of objects to return. Default: 20. Minimum: 1. Maximum: 50.</param>
1003
+ /// <param name="offset">The index of the first object to return. Default: 0 (i.e., the first object)</param>
1004
+ /// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
1005
+ /// <returns></returns>
1006
+ /// <remarks>AUTH NEEDED</remarks>
1007
+ public async Task < Paging < SavedTrack > > GetSavedAlbumsAsync ( int limit = 20 , int offset = 0 , String market = "" )
1008
+ {
1009
+ if ( ! UseAuth )
1010
+ throw new InvalidOperationException ( "Auth is required for GetSavedAlbumsAsync" ) ;
1011
+ return await DownloadDataAsync < Paging < SavedTrack > > ( _builder . GetSavedAlbums ( limit , offset , market ) ) ;
1012
+ }
1013
+
1014
+ /// <summary>
1015
+ /// Remove one or more albums from the current user’s “Your Music” library.
1016
+ /// </summary>
1017
+ /// <param name="ids">A list of the Spotify IDs.</param>
1018
+ /// <returns></returns>
1019
+ /// <remarks>AUTH NEEDED</remarks>
1020
+ public ErrorResponse RemoveSavedAlbums ( List < String > ids )
1021
+ {
1022
+ JArray array = new JArray ( ids ) ;
1023
+ return UploadData < ErrorResponse > ( _builder . RemoveSavedAlbums ( ) , array . ToString ( Formatting . None ) , "DELETE" ) ?? new ErrorResponse ( ) ;
1024
+ }
1025
+
1026
+ /// <summary>
1027
+ /// Remove one or more albums from the current user’s “Your Music” library asynchronously.
1028
+ /// </summary>
1029
+ /// <param name="ids">A list of the Spotify IDs.</param>
1030
+ /// <returns></returns>
1031
+ /// <remarks>AUTH NEEDED</remarks>
1032
+ public async Task < ErrorResponse > RemoveSavedAlbumsAsync ( List < String > ids )
1033
+ {
1034
+ JArray array = new JArray ( ids ) ;
1035
+ return await UploadDataAsync < ErrorResponse > ( _builder . RemoveSavedAlbums ( ) , array . ToString ( Formatting . None ) , "DELETE" ) ?? new ErrorResponse ( ) ;
1036
+ }
1037
+
1038
+ /// <summary>
1039
+ /// Check if one or more albums is already saved in the current Spotify user’s “Your Music” library.
1040
+ /// </summary>
1041
+ /// <param name="ids">A list of the Spotify IDs.</param>
1042
+ /// <returns></returns>
1043
+ /// <remarks>AUTH NEEDED</remarks>
1044
+ public ListResponse < Boolean > CheckSavedAlbums ( List < String > ids )
1045
+ {
1046
+ if ( ! UseAuth )
1047
+ throw new InvalidOperationException ( "Auth is required for CheckSavedTracks" ) ;
1048
+ JToken res = DownloadData < JToken > ( _builder . CheckSavedAlbums ( ids ) ) ;
1049
+ if ( res is JArray )
1050
+ return new ListResponse < Boolean > { List = res . ToObject < List < Boolean > > ( ) , Error = null } ;
1051
+ return new ListResponse < Boolean > { List = null , Error = res [ "error" ] . ToObject < Error > ( ) } ;
1052
+ }
1053
+
1054
+ /// <summary>
1055
+ /// Check if one or more albums is already saved in the current Spotify user’s “Your Music” library asynchronously.
1056
+ /// </summary>
1057
+ /// <param name="ids">A list of the Spotify IDs.</param>
1058
+ /// <returns></returns>
1059
+ /// <remarks>AUTH NEEDED</remarks>
1060
+ public async Task < ListResponse < Boolean > > CheckSavedAlbumsAsync ( List < String > ids )
1061
+ {
1062
+ if ( ! UseAuth )
1063
+ throw new InvalidOperationException ( "Auth is required for CheckSavedAlbumsAsync" ) ;
1064
+ JToken res = await DownloadDataAsync < JToken > ( _builder . CheckSavedAlbums ( ids ) ) ;
1065
+ if ( res is JArray )
1066
+ return new ListResponse < Boolean > { List = res . ToObject < List < Boolean > > ( ) , Error = null } ;
1067
+ return new ListResponse < Boolean > { List = null , Error = res [ "error" ] . ToObject < Error > ( ) } ;
1068
+ }
1069
+
938
1070
#endregion Library
939
1071
940
1072
#region Playlists
0 commit comments