using System.Collections.Generic; using Nancy; using Nancy.Metadata.Modules; using Nancy.Metadata.Swagger.Core; using Nancy.Metadata.Swagger.Fluent; using Sony.Filtr.Globalization; namespace Sony.Filtr.AdminAPI.Modules.Globalization { public class GlobalizationMetadataModule : MetadataModule { public GlobalizationMetadataModule() { var tag = "Globalization"; Describe["GetGlobalizationLanguages"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get available languages", tag) .WithResponse(HttpStatusCode.OK, "List of name and code for language")); Describe["GetGlobalizationKeys"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get all available globalization keys", tag) .WithDefaultResponse>()); Describe["AddGlobalizationKey"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Add a new globalization key", tag) .WithRequestParameter("key", loc: "body") .WithResponse(HttpStatusCode.BadRequest, "Mising or invalid key") .WithResponse(HttpStatusCode.BadRequest, "Key already exists")); Describe["DeleteGlobalizationKey"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Delete an existing globalization key", tag) .WithRequestParameter("keyId", description: "Id of key") .WithResponse(HttpStatusCode.Accepted, "Key removed")); Describe["GetGlobalizationValues"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the globalizations for the specified culture", tag) .WithRequestParameter("cultureValue") .WithResponse(HttpStatusCode.BadRequest, "Missing or invalid culture")); Describe["AddGlobalizationValues"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Add the globalization values for the existing keys and specified culture", tag) .WithRequestParameter("cultureValue") .WithRequestModel() .WithDefaultResponse>() .WithResponse(HttpStatusCode.BadRequest, "Missing or invalid request parameters")); } } }