removed the api methods names constant list, and used the custom attribute on each command as the source for the LastAsyncCommandBase.Method property instead.

This commit is contained in:
Melvyn 2015-06-20 16:22:20 +02:00
parent 3aa33663b5
commit 2e3ab5bf79
43 changed files with 57 additions and 357 deletions

View File

@ -2,16 +2,12 @@
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Album
{
[ApiMethodName(LastMethodsNames.album_shout)]
[ApiMethodName("album.shout")]
internal class AddShoutCommand : PostAsyncCommandBase<LastResponse>
{
public override string Method
{ get { return LastMethodsNames.album_shout; } }
public string Album { get; set; }
public string Artist { get; set; }

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Album
{
[ApiMethodName(LastMethodsNames.album_getInfo)]
[ApiMethodName("album.getInfo")]
internal class GetInfoCommand : GetAsyncCommandBase<LastResponse<LastAlbum>>
{
public override string Method
{ get { return LastMethodsNames.album_getInfo; } }
public string AlbumMbid { get; set; }
public string ArtistName { get; set; }

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Album
{
[ApiMethodName(LastMethodsNames.album_getShouts)]
[ApiMethodName("album.getShouts")]
internal class GetShoutsCommand : GetAsyncCommandBase<PageResponse<LastShout>>
{
public override string Method
{ get { return LastMethodsNames.album_getShouts; } }
public string AlbumName { get; set; }
public string ArtistName { get; set; }

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Album
{
[ApiMethodName(LastMethodsNames.album_getTags)]
[ApiMethodName("album.getTags")]
internal class GetTagsByUserCommand : GetAsyncCommandBase<PageResponse<LastTag>>
{
public override string Method
{ get { return LastMethodsNames.album_getTags; } }
public string ArtistName { get; set; }
public string AlbumName { get; set; }

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Album
{
[ApiMethodName(LastMethodsNames.album_getTopTags)]
[ApiMethodName("album.getTopTags")]
internal class GetTopTagsCommand : GetAsyncCommandBase<PageResponse<LastTag>>
{
public override string Method
{ get { return LastMethodsNames.album_getTopTags; } }
public string AlbumMbid { get; set; }
public string ArtistName { get; set; }

View File

@ -5,16 +5,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Album
{
[ApiMethodName(LastMethodsNames.album_search)]
[ApiMethodName("album.search")]
internal class SearchCommand : GetAsyncCommandBase<PageResponse<LastAlbum>>
{
public override string Method
{ get { return LastMethodsNames.album_search; } }
public string AlbumName { get; set; }
public SearchCommand(ILastAuth auth, string albumName)

View File

@ -1,16 +1,12 @@
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Artist
{
[ApiMethodName(LastMethodsNames.artist_shout)]
[ApiMethodName("artist.shout")]
internal class AddShoutCommand : PostAsyncCommandBase<LastResponse>
{
public override string Method
{ get { return LastMethodsNames.artist_shout; } }
public string Artist { get; set; }
public string Message { get; set; }

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Artist
{
[ApiMethodName(LastMethodsNames.artist_getInfo)]
[ApiMethodName("artist.getInfo")]
internal class GetInfoCommand : GetAsyncCommandBase<LastResponse<LastArtist>>
{
public override string Method
{ get { return LastMethodsNames.artist_getInfo; } }
public string ArtistMbid { get; set; }
public string ArtistName { get; set; }

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Artist
{
[ApiMethodName(LastMethodsNames.artist_getShouts)]
[ApiMethodName("artist.getShouts")]
internal class GetShoutsCommand : GetAsyncCommandBase<PageResponse<LastShout>>
{
public override string Method
{ get { return LastMethodsNames.artist_getShouts; } }
public string ArtistName { get; set; }
public bool Autocorrect { get; set; }

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Artist
{
[ApiMethodName(LastMethodsNames.artist_getSimilar)]
[ApiMethodName("artist.getSimilar")]
internal class GetSimilarCommand : GetAsyncCommandBase<PageResponse<LastArtist>>
{
public override string Method
{ get { return LastMethodsNames.artist_getSimilar; } }
public bool Autocorrect { get; set; }
public string ArtistName { get; set; }

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Artist
{
[ApiMethodName(LastMethodsNames.artist_getTags)]
[ApiMethodName("artist.getTags")]
internal class GetTagsByUserCommand : GetAsyncCommandBase<PageResponse<LastTag>>
{
public override string Method
{ get { return LastMethodsNames.artist_getTags; } }
public string ArtistName { get; set; }
public string Username { get; set; }

View File

@ -5,16 +5,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Artist
{
[ApiMethodName(LastMethodsNames.artist_getTopAlbums)]
[ApiMethodName("artist.getTopAlbums")]
internal class GetTopAlbumsCommand : GetAsyncCommandBase<PageResponse<LastAlbum>>
{
public override string Method
{ get { return LastMethodsNames.artist_getTopAlbums; } }
public string ArtistName { get; set; }
public GetTopAlbumsCommand(ILastAuth auth, string artistname)

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Artist
{
[ApiMethodName(LastMethodsNames.artist_getTopTags)]
[ApiMethodName("artist.getTopTags")]
internal class GetTopTagsCommand : GetAsyncCommandBase<PageResponse<LastTag>>
{
public override string Method
{ get { return LastMethodsNames.artist_getTopTags; } }
public string ArtistName { get; set; }
public bool Autocorrect { get; set; }

View File

@ -5,16 +5,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Artist
{
[ApiMethodName(LastMethodsNames.artist_getTopTracks)]
[ApiMethodName("artist.getTopTracks")]
internal class GetTopTracksCommand : GetAsyncCommandBase<PageResponse<LastTrack>>
{
public override string Method
{ get { return LastMethodsNames.artist_getTopTracks; } }
public string ArtistName { get; set; }
public GetTopTracksCommand(ILastAuth auth, string artistname)

View File

@ -5,16 +5,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Artist
{
[ApiMethodName(LastMethodsNames.artist_search)]
[ApiMethodName("artist.search")]
internal class SearchCommand : GetAsyncCommandBase<PageResponse<LastArtist>>
{
public override string Method
{ get { return LastMethodsNames.artist_search; } }
public string ArtistName { get; set; }
public SearchCommand(ILastAuth auth, string artistName)

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Auth
{
[ApiMethodName(LastMethodsNames.auth_getMobileSession)]
[ApiMethodName("auth.getMobileSession")]
internal class GetMobileSessionCommand : UnauthenticatedPostAsyncCommandBase<LastResponse<LastUserSession>>
{
public override string Method
{ get { return LastMethodsNames.auth_getMobileSession; } }
public string Username { get; set; }
public string Password { get; set; }

View File

@ -5,16 +5,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Chart
{
[ApiMethodName(LastMethodsNames.chart_getTopArtists)]
[ApiMethodName("chart.getTopArtists")]
internal class GetTopArtistsCommand : GetAsyncCommandBase<PageResponse<LastArtist>>
{
public override string Method
{ get { return LastMethodsNames.chart_getTopArtists; } }
public GetTopArtistsCommand(ILastAuth auth) : base(auth) { }
public override void SetParameters()

View File

@ -5,16 +5,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Chart
{
[ApiMethodName(LastMethodsNames.chart_getTopTracks)]
[ApiMethodName("chart.getTopTracks")]
internal class GetTopTracksCommand : GetAsyncCommandBase<PageResponse<LastTrack>>
{
public override string Method
{ get { return LastMethodsNames.chart_getTopTracks; } }
public GetTopTracksCommand(ILastAuth auth) : base(auth) { }
public override void SetParameters()

View File

@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using System.Reflection;
namespace IF.Lastfm.Core.Api.Commands
{
@ -11,7 +12,19 @@ namespace IF.Lastfm.Core.Api.Commands
/// </summary>
public abstract class LastAsyncCommandBase
{
public abstract string Method { get; }
public string Method
{
get
{
var methodNameAttribute = this.GetType().GetTypeInfo().GetCustomAttribute<ApiMethodNameAttribute>();
if (methodNameAttribute == null)
{
throw new NotImplementedException(@"Could not find an ApiMethodNameAttribute on the current Command implementation.
This custom attribute must be present on all Commands. For more information, see the ApiMethodNameAttribute documentation.");
}
return methodNameAttribute.Text;
}
}
public Dictionary<string, string> Parameters { get; set; }

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Library
{
[ApiMethodName(LastMethodsNames.library_getTracks)]
[ApiMethodName("library.getTracks")]
internal class GetTracksCommand : GetAsyncCommandBase<PageResponse<LastTrack>>
{
public override string Method
{ get { return LastMethodsNames.library_getTracks; } }
public string Username { get; private set; }
public string Artist { get; private set; }

View File

@ -6,14 +6,10 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Library {
[ApiMethodName(LastMethodsNames.library_removeScrobble)]
[ApiMethodName("library.removeScrobble")]
internal class RemoveScrobbleCommand : PostAsyncCommandBase<LastResponse> {
public override string Method
{ get { return LastMethodsNames.library_removeScrobble; } }
public string Artist { get; set; }
public string Track { get; set; }

View File

@ -1,14 +1,10 @@
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Library {
[ApiMethodName(LastMethodsNames.library_removeTrack)]
[ApiMethodName("library.removeTrack")]
internal class RemoveTrackCommand : PostAsyncCommandBase<LastResponse> {
public override string Method
{ get { return LastMethodsNames.library_removeTrack; } }
public string Artist { get; set; }
public string Track { get; set; }

View File

@ -1,16 +1,12 @@
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Track
{
[ApiMethodName(LastMethodsNames.track_shout)]
[ApiMethodName("track.shout")]
internal class AddShoutCommand : PostAsyncCommandBase<LastResponse>
{
public override string Method
{ get { return LastMethodsNames.track_shout; } }
public string Track { get; set; }
public string Artist { get; set; }

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Track
{
[ApiMethodName(LastMethodsNames.track_getInfo)]
[ApiMethodName("track.getInfo")]
internal class GetInfoCommand : GetAsyncCommandBase<LastResponse<LastTrack>>
{
public override string Method
{ get { return LastMethodsNames.track_getInfo; } }
public string TrackMbid { get; set; }
public string TrackName { get; set; }

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Track
{
[ApiMethodName(LastMethodsNames.track_getShouts)]
[ApiMethodName("track.getShouts")]
internal class GetShoutsCommand : GetAsyncCommandBase<PageResponse<LastShout>>
{
public override string Method
{ get { return LastMethodsNames.track_getShouts; } }
public string TrackName { get; set; }
public string ArtistName { get; set; }

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Track
{
[ApiMethodName(LastMethodsNames.track_getSimilar)]
[ApiMethodName("track.getSimilar")]
internal class GetSimilarCommand : GetAsyncCommandBase<PageResponse<LastTrack>>
{
public override string Method
{ get { return LastMethodsNames.track_getSimilar; } }
public string ArtistName { get; set; }
public int? Limit { get; set; }

View File

@ -1,16 +1,12 @@
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Track
{
[ApiMethodName(LastMethodsNames.track_love)]
[ApiMethodName("track.love")]
internal class LoveCommand : PostAsyncCommandBase<LastResponse>
{
public override string Method
{ get { return LastMethodsNames.track_love; } }
public string TrackName { get; set; }
public string ArtistName { get; set; }

View File

@ -7,16 +7,12 @@
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Objects;
using IF.Lastfm.Core.Scrobblers;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Track
{
[ApiMethodName(LastMethodsNames.track_scrobble)]
[ApiMethodName("track.scrobble")]
internal class ScrobbleCommand : PostAsyncCommandBase<ScrobbleResponse>
{
public override string Method
{ get { return LastMethodsNames.track_scrobble; } }
public IList<Scrobble> Scrobbles { get; private set; }
public ScrobbleCommand(ILastAuth auth, IList<Scrobble> scrobbles)

View File

@ -5,16 +5,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Track
{
[ApiMethodName(LastMethodsNames.track_search)]
[ApiMethodName("track.search")]
internal class SearchCommand : GetAsyncCommandBase<PageResponse<LastTrack>>
{
public override string Method
{ get { return LastMethodsNames.track_search; } }
public string TrackName { get; set; }
public SearchCommand(ILastAuth auth, string trackName)

View File

@ -1,16 +1,12 @@
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Track
{
[ApiMethodName(LastMethodsNames.track_unlove)]
[ApiMethodName("track.unlove")]
internal class UnloveCommand : PostAsyncCommandBase<LastResponse>
{
public override string Method
{ get { return LastMethodsNames.track_unlove; } }
public string TrackName { get; set; }
public string ArtistName { get; set; }

View File

@ -4,16 +4,12 @@
using IF.Lastfm.Core.Api.Enums;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Objects;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.Track
{
[ApiMethodName(LastMethodsNames.track_updateNowPlaying)]
[ApiMethodName("track.updateNowPlaying")]
internal class UpdateNowPlayingCommand : PostAsyncCommandBase<LastResponse>
{
public override string Method
{ get { return LastMethodsNames.track_updateNowPlaying; } }
public string Artist { get; set; }
public string Album { get; set; }

View File

@ -1,16 +1,12 @@
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.User
{
[ApiMethodName(LastMethodsNames.user_shout)]
[ApiMethodName("user.shout")]
internal class AddShoutCommand : PostAsyncCommandBase<LastResponse>
{
public override string Method
{ get { return LastMethodsNames.user_shout; } }
public string Recipient { get; set; }
public string Message { get; set; }

View File

@ -5,16 +5,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.User
{
[ApiMethodName(LastMethodsNames.user_getInfo)]
[ApiMethodName("user.getInfo")]
internal class GetInfoCommand : GetAsyncCommandBase<LastResponse<LastUser>>
{
public override string Method
{ get { return LastMethodsNames.user_getInfo; } }
public string Username { get; set; }
public GetInfoCommand(ILastAuth auth, string username) : base(auth)

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.User
{
[ApiMethodName(LastMethodsNames.user_getRecentStations)]
[ApiMethodName("user.getRecentStations")]
internal class GetRecentStationsCommand : PostAsyncCommandBase<PageResponse<LastStation>>
{
public override string Method
{ get { return LastMethodsNames.user_getRecentStations; } }
public string Username { get; private set; }
public GetRecentStationsCommand(ILastAuth auth, string username) : base(auth)

View File

@ -6,16 +6,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.User
{
[ApiMethodName(LastMethodsNames.user_getRecentTracks)]
[ApiMethodName("user.getRecentTracks")]
internal class GetRecentTracksCommand : GetAsyncCommandBase<PageResponse<LastTrack>>
{
public override string Method
{ get { return LastMethodsNames.user_getRecentTracks; } }
public string Username { get; private set; }
public DateTimeOffset? From { get; set; }

View File

@ -5,16 +5,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.User
{
[ApiMethodName(LastMethodsNames.user_getRecommendedArtists)]
[ApiMethodName("user.getRecommendedArtists")]
internal class GetRecommendedArtistsCommand : PostAsyncCommandBase<PageResponse<LastArtist>>
{
public override string Method
{ get { return LastMethodsNames.user_getRecommendedArtists; } }
public GetRecommendedArtistsCommand(ILastAuth auth) : base(auth) { }
public override void SetParameters()

View File

@ -5,16 +5,12 @@
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.User
{
[ApiMethodName(LastMethodsNames.user_getShouts)]
[ApiMethodName("user.getShouts")]
internal class GetShoutsCommand : GetAsyncCommandBase<PageResponse<LastShout>>
{
public override string Method
{ get { return LastMethodsNames.user_getShouts; } }
public string Username { get; set; }
public GetShoutsCommand(ILastAuth auth, string username) : base(auth)

View File

@ -4,16 +4,12 @@
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Objects;
using Newtonsoft.Json.Linq;
using IF.Lastfm.Core.Enums;
namespace IF.Lastfm.Core.Api.Commands.User
{
[ApiMethodName(LastMethodsNames.user_getTopAlbums)]
[ApiMethodName("user.getTopAlbums")]
internal class GetTopAlbumsCommand : GetAsyncCommandBase<PageResponse<LastAlbum>>
{
public override string Method
{ get { return LastMethodsNames.user_getTopAlbums; } }
public string Username { get; set; }
public LastStatsTimeSpan TimeSpan { get; set; }

View File

@ -1,159 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IF.Lastfm.Core.Enums
{
/// <summary>
/// Auto-generated class containing all the Last.Fm Api methods names.
/// </summary>
/// <remarks>
/// Generated using the following code:
/// var allMethods = ProgressReport.GetApiMethods().SelectMany(x => x.Value).OrderBy(x => x);
/// var getValidName = new Func<string, string>(x => x.Replace('.', '_'));
/// var getConstDefinition = new Func<string, string>(x => string.Format("internal const string {0} = \"{1}\";", getValidName(x), x));
/// var allMethodsAsConstDefinitions = "internal static class LastMethodsNames\n{" + string.Join("\n", allMethods.Select(x => getConstDefinition(x))) + "}";
/// </remarks>
internal static class LastMethodsNames
{
// Warning: not listed on the Api documentation page!
internal const string album_shout = "album.shout";
internal const string track_shout = "track.shout";
internal const string album_addTags = "album.addTags";
internal const string album_getBuylinks = "album.getBuylinks";
internal const string album_getInfo = "album.getInfo";
internal const string album_getShouts = "album.getShouts";
internal const string album_getTags = "album.getTags";
internal const string album_getTopTags = "album.getTopTags";
internal const string album_removeTag = "album.removeTag";
internal const string album_search = "album.search";
internal const string album_share = "album.share";
internal const string artist_addTags = "artist.addTags";
internal const string artist_getCorrection = "artist.getCorrection";
internal const string artist_getEvents = "artist.getEvents";
internal const string artist_getInfo = "artist.getInfo";
internal const string artist_getPastEvents = "artist.getPastEvents";
internal const string artist_getPodcast = "artist.getPodcast";
internal const string artist_getShouts = "artist.getShouts";
internal const string artist_getSimilar = "artist.getSimilar";
internal const string artist_getTags = "artist.getTags";
internal const string artist_getTopAlbums = "artist.getTopAlbums";
internal const string artist_getTopFans = "artist.getTopFans";
internal const string artist_getTopTags = "artist.getTopTags";
internal const string artist_getTopTracks = "artist.getTopTracks";
internal const string artist_removeTag = "artist.removeTag";
internal const string artist_search = "artist.search";
internal const string artist_share = "artist.share";
internal const string artist_shout = "artist.shout";
internal const string auth_getMobileSession = "auth.getMobileSession";
internal const string auth_getSession = "auth.getSession";
internal const string auth_getToken = "auth.getToken";
internal const string chart_getHypedArtists = "chart.getHypedArtists";
internal const string chart_getHypedTracks = "chart.getHypedTracks";
internal const string chart_getLovedTracks = "chart.getLovedTracks";
internal const string chart_getTopArtists = "chart.getTopArtists";
internal const string chart_getTopTags = "chart.getTopTags";
internal const string chart_getTopTracks = "chart.getTopTracks";
internal const string event_attend = "event.attend";
internal const string event_getAttendees = "event.getAttendees";
internal const string event_getInfo = "event.getInfo";
internal const string event_getShouts = "event.getShouts";
internal const string event_share = "event.share";
internal const string event_shout = "event.shout";
internal const string geo_getEvents = "geo.getEvents";
internal const string geo_getMetroArtistChart = "geo.getMetroArtistChart";
internal const string geo_getMetroHypeArtistChart = "geo.getMetroHypeArtistChart";
internal const string geo_getMetroHypeTrackChart = "geo.getMetroHypeTrackChart";
internal const string geo_getMetros = "geo.getMetros";
internal const string geo_getMetroTrackChart = "geo.getMetroTrackChart";
internal const string geo_getMetroUniqueArtistChart = "geo.getMetroUniqueArtistChart";
internal const string geo_getMetroUniqueTrackChart = "geo.getMetroUniqueTrackChart";
internal const string geo_getMetroWeeklyChartlist = "geo.getMetroWeeklyChartlist";
internal const string geo_getTopArtists = "geo.getTopArtists";
internal const string geo_getTopTracks = "geo.getTopTracks";
internal const string group_getHype = "group.getHype";
internal const string group_getMembers = "group.getMembers";
internal const string group_getWeeklyAlbumChart = "group.getWeeklyAlbumChart";
internal const string group_getWeeklyArtistChart = "group.getWeeklyArtistChart";
internal const string group_getWeeklyChartList = "group.getWeeklyChartList";
internal const string group_getWeeklyTrackChart = "group.getWeeklyTrackChart";
internal const string library_addAlbum = "library.addAlbum";
internal const string library_addArtist = "library.addArtist";
internal const string library_addTrack = "library.addTrack";
internal const string library_getAlbums = "library.getAlbums";
internal const string library_getArtists = "library.getArtists";
internal const string library_getTracks = "library.getTracks";
internal const string library_removeAlbum = "library.removeAlbum";
internal const string library_removeArtist = "library.removeArtist";
internal const string library_removeScrobble = "library.removeScrobble";
internal const string library_removeTrack = "library.removeTrack";
internal const string playlist_addTrack = "playlist.addTrack";
internal const string playlist_create = "playlist.create";
internal const string radio_getPlaylist = "radio.getPlaylist";
internal const string radio_search = "radio.search";
internal const string radio_tune = "radio.tune";
internal const string tag_getInfo = "tag.getInfo";
internal const string tag_getSimilar = "tag.getSimilar";
internal const string tag_getTopAlbums = "tag.getTopAlbums";
internal const string tag_getTopArtists = "tag.getTopArtists";
internal const string tag_getTopTags = "tag.getTopTags";
internal const string tag_getTopTracks = "tag.getTopTracks";
internal const string tag_getWeeklyArtistChart = "tag.getWeeklyArtistChart";
internal const string tag_getWeeklyChartList = "tag.getWeeklyChartList";
internal const string tag_search = "tag.search";
internal const string tasteometer_compare = "tasteometer.compare";
internal const string tasteometer_compareGroup = "tasteometer.compareGroup";
internal const string track_addTags = "track.addTags";
internal const string track_ban = "track.ban";
internal const string track_getBuylinks = "track.getBuylinks";
internal const string track_getCorrection = "track.getCorrection";
internal const string track_getFingerprintMetadata = "track.getFingerprintMetadata";
internal const string track_getInfo = "track.getInfo";
internal const string track_getShouts = "track.getShouts";
internal const string track_getSimilar = "track.getSimilar";
internal const string track_getTags = "track.getTags";
internal const string track_getTopFans = "track.getTopFans";
internal const string track_getTopTags = "track.getTopTags";
internal const string track_love = "track.love";
internal const string track_removeTag = "track.removeTag";
internal const string track_scrobble = "track.scrobble";
internal const string track_search = "track.search";
internal const string track_share = "track.share";
internal const string track_unban = "track.unban";
internal const string track_unlove = "track.unlove";
internal const string track_updateNowPlaying = "track.updateNowPlaying";
internal const string user_getArtistTracks = "user.getArtistTracks";
internal const string user_getBannedTracks = "user.getBannedTracks";
internal const string user_getEvents = "user.getEvents";
internal const string user_getFriends = "user.getFriends";
internal const string user_getInfo = "user.getInfo";
internal const string user_getLovedTracks = "user.getLovedTracks";
internal const string user_getNeighbours = "user.getNeighbours";
internal const string user_getNewReleases = "user.getNewReleases";
internal const string user_getPastEvents = "user.getPastEvents";
internal const string user_getPersonalTags = "user.getPersonalTags";
internal const string user_getPlaylists = "user.getPlaylists";
internal const string user_getRecentStations = "user.getRecentStations";
internal const string user_getRecentTracks = "user.getRecentTracks";
internal const string user_getRecommendedArtists = "user.getRecommendedArtists";
internal const string user_getRecommendedEvents = "user.getRecommendedEvents";
internal const string user_getShouts = "user.getShouts";
internal const string user_getTopAlbums = "user.getTopAlbums";
internal const string user_getTopArtists = "user.getTopArtists";
internal const string user_getTopTags = "user.getTopTags";
internal const string user_getTopTracks = "user.getTopTracks";
internal const string user_getWeeklyAlbumChart = "user.getWeeklyAlbumChart";
internal const string user_getWeeklyArtistChart = "user.getWeeklyArtistChart";
internal const string user_getWeeklyChartList = "user.getWeeklyChartList";
internal const string user_getWeeklyTrackChart = "user.getWeeklyTrackChart";
internal const string user_shout = "user.shout";
internal const string user_signUp = "user.signUp";
internal const string user_terms = "user.terms";
internal const string venue_getEvents = "venue.getEvents";
internal const string venue_getPastEvents = "venue.getPastEvents";
internal const string venue_search = "venue.search";
}
}

View File

@ -1,4 +1,5 @@
using System;
using IF.Lastfm.Core.Api.Commands;
using System;
namespace IF.Lastfm.Core.Api.Helpers
{
@ -12,6 +13,10 @@ public ApiNameAttribute(string name)
}
}
/// <summary>
/// This attribute defines the api method name (i.e: "album.getInfo") for a Command.
/// When applied on a <see cref="LastAsyncCommandBase"/> implementation, the <see cref="LastAsyncCommandBase.Method"/> property is set to the attribute value.
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
public class ApiMethodNameAttribute : ApiNameAttribute
{

View File

@ -111,7 +111,6 @@
<Compile Include="Api\IChartApi.cs" />
<Compile Include="Api\ITrackApi.cs" />
<Compile Include="Api\IUserApi.cs" />
<Compile Include="Api\Enums\LastMethodsNames.cs" />
<Compile Include="Api\LibraryApi.cs" />
<Compile Include="Objects\Scrobble.cs" />
<Compile Include="Api\TrackApi.cs" />

View File

@ -10,11 +10,6 @@ namespace IF.Lastfm.Syro.Helpers
{
public class DummyGetAsyncCommand<T> : GetAsyncCommandBase<T>, IDummyCommand where T : LastResponse, new()
{
public override string Method
{
get { throw new NotImplementedException(); }
}
public JObject Response { get; set; }
public DummyGetAsyncCommand(ILastAuth auth)

View File

@ -13,11 +13,6 @@ namespace IF.Lastfm.Syro.Helpers
{
public class DummyPostAsyncCommand<T> : PostAsyncCommandBase<T>, IDummyCommand where T : LastResponse, new()
{
public override string Method
{
get { throw new NotImplementedException(); }
}
public JObject Response { get; private set; }
public DummyPostAsyncCommand(ILastAuth auth) : base(auth)
{