using System.Collections.Generic; using Nancy; using Nancy.Metadata.Modules; using Nancy.Metadata.Swagger.Core; using Nancy.Metadata.Swagger.Fluent; using Sony.Filtr.ContentManagement.Data; namespace Sony.Filtr.AdminAPI.Modules { public class ContentManagementMetadataModule : MetadataModule { public ContentManagementMetadataModule() { var tag = "Pages"; Describe["GetPages"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get available pages for the specified market and service", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestParameter("service", description: "ServiceType") .WithDefaultResponse>() .WithResponse(HttpStatusCode.NotFound, "The specified servicetype could not be found")); Describe["GetPage"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the page with the specified id", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestParameter("service", description: "ServiceType") .WithRequestParameter("id", description: "Page id") .WithDefaultResponse() .WithResponse(HttpStatusCode.NotFound, "The specified servicetype could not be found")); Describe["UpdatePage"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Update the specified page", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestParameter("service", description: "ServiceType") .WithRequestParameter("id", description: "Page id") .WithRequestModel() .WithDefaultResponse() .WithResponse(HttpStatusCode.NotFound, "The specified servicetype could not be found") .WithResponse(HttpStatusCode.NotFound, "The specified page could not be found") ); Describe["AddPage"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Add a new page for the specified market and service", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestParameter("service", description: "ServiceType") .WithRequestModel() .WithDefaultResponse() .WithResponse(HttpStatusCode.NotFound, "The specified servicetype could not be found") .WithResponse(HttpStatusCode.BadRequest, "Existing page with same pageKey exists") ); Describe["DeletePage"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Delete an existing page", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestParameter("service", description: "ServiceType") .WithRequestParameter("id", description: "Page id") .WithResponse(HttpStatusCode.NoContent, "The specified page has been removed") .WithResponse(HttpStatusCode.NotFound, "The specified page could not be found") ); Describe["SetPageBlocks"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Set the blocks used for the page in the specific order", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestParameter("service", description: "ServiceType") .WithRequestParameter("id", description: "Page id") .WithRequestModel() .WithDefaultResponse() .WithResponse(HttpStatusCode.NotFound, "The specified page could not be found") ); Describe["GetBlocks"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the available blocks for the specified market", tag) .WithRequestParameter("countryCode", description: "Market id") .WithDefaultResponse>() ); Describe["GetBlock"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the block with the specified id", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestParameter("id", description: "Block id") .WithDefaultResponse() .WithResponse(HttpStatusCode.NotFound, "The specified block could not be found") ); Describe["UpdateBlock"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Update an existing block", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestParameter("id", description: "Block id") .WithRequestModel() .WithDefaultResponse() .WithResponse(HttpStatusCode.NotFound, "The specified block could not be found") ); Describe["AddBlock"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Add a new block to the specified market", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestModel() .WithDefaultResponse() ); Describe["DeleteBlock"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Delete the specified block", tag) .WithRequestParameter("countryCode", description: "Market id") .WithRequestParameter("id", description: "Block id") .WithResponse(HttpStatusCode.NoContent, "The specified block has been removed") .WithResponse(HttpStatusCode.NotFound, "The specified block could not be found")); } } }