using System; using System.Collections.Generic; using Nancy.Metadata.Modules; using Nancy.Metadata.Swagger.Core; using Nancy.Metadata.Swagger.Fluent; using Sony.Filtr.AdminAPI.ViewModels.AppleMusic; using Sony.Filtr.AdminAPI.ViewModels.Graph; using Sony.Filtr.AppleMusic.Data; using Sony.Filtr.Contracts.Entities; namespace Sony.Filtr.AdminAPI.Modules.AppleMusic { public class AppleMusicPlaylistMetadataModule : MetadataModule { public AppleMusicPlaylistMetadataModule() { const string tag = "Apple Music playlists"; Describe["GetAppleMusicPlaylists"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get Apple Music playlists.", tag) .WithRequestParameter("buzzMarket", type: "string", description: "Get only playlists with Buzz owner from market.", loc: "query", required: false) .WithRequestParameter("buzzCategory", type: "integer", description: "Get only playlists with Buzz owner in category.", loc: "query", required: false) .WithRequestParameter("buzzAccountId", type: "integer", description: "Get only playlists from Buzz owner.", loc: "query", required: false) .WithRequestParameter("country", type: "string", description: "Use streaming numbers and playlist name from this country.", loc: "query", required: false) .WithRequestParameter("limit", type: "integer", description: "Limit (default: 100)", loc: "query", required: false) .WithRequestParameter("offset", type: "integer", description: "Offset", loc: "query", required: false) .WithDefaultResponse>()); Describe["GetAppleMusicPlaylist"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get one Apple Music playlist", tag) .WithRequestParameter("playlistId", type: "string", description: "Playlist ID of the playlist to get.", loc: "path", required: true) .WithRequestParameter("country", type: "string", description: "Use playlist name and tracklist from this country.", loc: "query", required: false) .WithDefaultResponse()); Describe["GetAppleMusicPlaylistsWithTrack"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the Apple Music playlists which contain the specified track.", tag) .WithRequestParameter("isrc", type: "string", description: "ISRC", loc: "query", required: true) .WithRequestParameter("country", type: "string", description: "country (controls streaming numbers and playlist names)", loc: "query", required: false) .WithRequestParameter("limit", type: "integer", description: "Limit", loc: "query", required: false) .WithRequestParameter("offset", type: "integer", description: "Offset", loc: "query", required: false) .WithDefaultResponse>()); Describe["GetAppleMusicPlaylistTracklistHistoryDates"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get countries and dates for tracklist history for an Apple Music playlist.", tag) .WithRequestParameter("playlistId", type: "string", description: "Playlist ID of the playlist to get tracklist history for.", loc: "path", required: true) .WithDefaultResponse>>()); Describe["GetAppleMusicPlaylistTracklistHistory"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get a historic tracklist for an Apple Music playlist.", tag) .WithRequestParameter("playlistId", type: "string", description: "Playlist ID of the playlist to get tracklist history for.", loc: "path", required: true) .WithRequestParameter("countryCode", type: "string", description: "Country code to get tracklist for.", loc: "path", required: true) .WithRequestParameter("date", type: "string", description: "Date of tracklist.", loc: "path", required: true) .WithDefaultResponse>()); Describe["GetAppleMusicPreviousPlaylistsForTrack"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the playlists which previously featured the track.", tag) .WithRequestParameter("isrc", type: "string", description: "ISRC", loc: "query", required: true) .WithRequestParameter("limit", type: "integer", description: "Limit", loc: "query", required: false) .WithRequestParameter("offset", type: "integer", description: "Offset", loc: "query", required: false) .WithDefaultResponse>()); Describe["GetAppleMusicPreviousPlaylistTracklistsPosition"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get a historic tracklist for an Apple Music playlist.", tag) .WithRequestParameter("playlistId", type: "string", description: "Playlist ID of the playlist", loc: "query", required: true) .WithRequestParameter("isrc", type: "string", description: "ISRC of the track", loc: "query", required: true) .WithRequestParameter("country", type: "string", description: "Country", loc: "query", required: true) .WithRequestParameter("startDate", type: "string", description: "StartDate.", loc: "query", required: false) .WithRequestParameter("endDate", type: "string", description: "EndDate.", loc: "query", required: false) .WithDefaultResponse>()); } } }