using System.Collections.Generic; using Nancy; using Nancy.Metadata.Modules; using Nancy.Metadata.Swagger.Core; using Nancy.Metadata.Swagger.Fluent; using Nancy.Metadata.Swagger.Model; using Sony.Filtr.AdminAPI.ViewModels; using Sony.Filtr.Playlists.Spotify; namespace Sony.Filtr.AdminAPI.Modules.EditorialPlaylist { public class EditorialPlaylistMetadataModule : MetadataModule { public EditorialPlaylistMetadataModule() { var tag = "Playlist"; Describe["GetEditorialPlaylistByCountry"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get all editorial playlists grouped by country", tag) .WithRequestParameter("getDetails", type: "boolean", description: "Include extra details for playlists") .WithDefaultResponse>>()); Describe["GetAllEditorialPlaylists"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get all editorial playlists in all markets", tag) .WithRequestParameter("getDetails", type: "boolean", description: "Include extra details for playlists") .WithDefaultResponse>()); Describe["GetSpecifiedEditorialPlaylistsExcel"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the specified editorial playlists in CSV-format", tag) .WithRequestParameter("playlistId", description: "Comma separated list of playlist ids.") .WithDefaultResponse()); Describe["GetAllPlaylists"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get all playlists (including buzz)", tag) .WithDefaultResponse>()); Describe["GetEditorialPlaylistInMarket"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the editorial playlists in the market", tag) .WithRequestParameter("countryCode") .WithRequestParameter("getDetails", type: "boolean", description: "Include extra details for playlists") .WithDefaultResponse>()); Describe["GetEditorialPlaylistInMarketExcel"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the editorial playlists in the market in CSV-format", tag) .WithDefaultResponse()); Describe["AddEditorialPlaylist"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Add the new editorial playlist to the market.", tag) .WithRequestModel() .WithResponseModel(HttpStatusCode.Created) .WithResponse(HttpStatusCode.BadRequest, "Invalid request parameter") .WithResponse(HttpStatusCode.BadRequest, "Playlist with uri already exists") .WithResponse(HttpStatusCode.BadRequest, "Playlist can not be requested from Spotify") ); Describe["GetSingleEditorialPlaylist"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the editorial playlist with the specified id", tag) .WithRequestParameter("id", description: "Playlist id") .WithDefaultResponse() .WithResponse(HttpStatusCode.BadRequest, "Invalid or missing Id") .WithResponse(HttpStatusCode.NotFound, "Playlist not found") ); Describe["UpdateEditorialPlaylist"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Update an existing editorial playlist", tag) .WithRequestParameter("id", description: "Playlist id") .WithRequestModel() .WithResponseModel(HttpStatusCode.Created) .WithResponse(HttpStatusCode.BadRequest, "Invalid request parameter") .WithResponse(HttpStatusCode.NotFound, "Playlist with id can not be found") ); Describe["DeleteEditorialPlaylist"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Delete an editorial playlist", tag) .WithRequestParameter("id", description: "Playlist id") .WithResponse(HttpStatusCode.NoContent, "Playlist has been removed")); Describe["GetMarketPlaylists"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Gets all SME playlists that are local, or that have streams in the local market", tag) .WithRequestParameter("countryCode") .WithDefaultResponse>() ); } } }