using System.Collections.Generic; using System.Linq; using Nancy; using Nancy.Metadata.Modules; using Nancy.Metadata.Swagger.Core; using Nancy.Metadata.Swagger.Fluent; using Nancy.ModelBinding; using Sony.Filtr.ApiConsumer; using Sony.Filtr.Contracts.Abstractions; namespace Sony.Filtr.AdminAPI.Modules { public class ApiConsumerMetadataModule : MetadataModule { public ApiConsumerMetadataModule() { const string tag = "API Consumer"; Describe["GetApiConsumers"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the available API Consumers", tag) .WithDefaultResponse>()); Describe["AddApiConsumers"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Add a new API Consumer", tag) .WithRequestModel() .WithDefaultResponse() .WithResponse(HttpStatusCode.BadRequest, "If no valid API Consumer specified")); Describe["GetSingleApiConsumer"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get a specific API Consumer", tag) .WithRequestParameter("id", description: "Id of the API Consumer") .WithDefaultResponse() .WithResponse(HttpStatusCode.BadRequest, "If no valid API Consumer Id is specified")); Describe["UpdateApiConsumer"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Update a specific API Consumer", tag) .WithRequestParameter("id", description: "Id of the API Consumer") .WithRequestModel() .WithDefaultResponse() .WithResponse(HttpStatusCode.BadRequest, "If no valid API Consumer Id is specified")); Describe["DeleteApiConsumer"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Delete a specific API Consumer", tag) .WithRequestParameter("id", description: "Id of the API consumer") .WithResponse(HttpStatusCode.NoContent, "API Consumer has been deleted") .WithResponse(HttpStatusCode.BadRequest, "If no valid API Consumer Id is specified")); } } }