using System.Collections.Generic; using Nancy; using Nancy.Metadata.Modules; using Nancy.Metadata.Swagger.Core; using Nancy.Metadata.Swagger.Fluent; using Sony.Filtr.Contracts.Entities; namespace Sony.Filtr.AdminAPI.Modules.PublicData { public class CarouselImagesMetadataModule : MetadataModule { public CarouselImagesMetadataModule() { var tag = "Carousel Images"; Describe["GetCarouselImages"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get all carousel images in the specified market", tag) .WithRequestParameter("countryCode", description: "Market id") .WithDefaultResponse>()); Describe["GetSingleCarouselImage"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the specified carousel image", tag) .WithRequestParameter("countryCode", description: "Market id") .WithDefaultResponse() .WithResponse(HttpStatusCode.NotFound, "Carousel image with specified id could not be found")); Describe["AddCarouselImage"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Add a new carousel image to the specified market", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestModel() .WithDefaultResponse()); Describe["UpdateCarouselImage"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Update the specified carousel image", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestParameter("imageId", description: "Carousel image id") .WithRequestModel() .WithDefaultResponse() .WithResponse(HttpStatusCode.NotFound, "If image with specified id can not be found") .WithResponse(HttpStatusCode.BadRequest, "If market of image does not match parameter")); Describe["DeleteCarouselImage"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Delete the specified carousel image", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestParameter("imageId", description: "Carousel image id") .WithResponse(HttpStatusCode.NoContent, "Image has been deleted") .WithResponse(HttpStatusCode.NotFound, "If image with specified id can not be found")); Describe["UploadCarouselImageImage"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Upload an image to the carousel image entity", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestParameter("imageId", description: "Carousel image id") .WithRequestParameter("image", description: "Image stream in jpeg or png format", loc: "body") .WithDefaultResponse() .WithResponse(HttpStatusCode.NotFound, "If image with specified id can not be found") .WithResponse(HttpStatusCode.BadRequest, "Invalid image file or format") ); } } }