using System.Collections.Generic; using Filtr.Core.FacebookUsers.Data; 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 { public class ServiceAccountMetadataModule : MetadataModule { public ServiceAccountMetadataModule() { var tag = "Service Account"; Describe["GetServiceAccounts"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get all available service accounts", tag) .WithDefaultResponse>()); Describe["GetServiceAccountsInMarket"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the available service accounts in the market", tag) .WithRequestParameter("countryCode", description: "Market Id") .WithDefaultResponse>() .WithResponse(HttpStatusCode.BadRequest, "Missing or invalid market id")); Describe["DeleteServiceAccount"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Delete an existing service account", tag) .WithRequestParameter("serviceAccountId") .WithRequestParameter("countryCode", description: "Market Id") .WithResponse(HttpStatusCode.NoContent, "Service account has been deleted") .WithResponse(HttpStatusCode.NotFound, "No service account with specified id could be found")); Describe["AddServiceAccount"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Add a new service account", tag) .WithRequestParameter("countryCode", description: "Market Id") .WithRequestModel() .WithDefaultResponse() .WithResponse(HttpStatusCode.BadRequest, "Missing or invalid market id") .WithResponse(HttpStatusCode.Conflict, "An existing service account with same type and identifier already exists") ); Describe["UpdateServiceAccount"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Update an existing service account (does not update service type, market id or id (use add))", tag) .WithRequestParameter("serviceAccountId") .WithRequestParameter("countryCode", description: "Market Id") .WithRequestModel() .WithResponse(HttpStatusCode.NotFound, "No service account with specified id")); } } }