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; using Sony.Filtr.Contracts.Entities.Buzz; namespace Sony.Filtr.AdminAPI.Modules.Buzz { public class BuzzUserAccountMetadataModule : MetadataModule { public BuzzUserAccountMetadataModule() { const string tag = "Buzz User Accounts"; Describe["BuzzUserAccountListCategories"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("List all available buzz categories", tag) .WithDefaultResponse>() ); Describe["BuzzUserAccountGetUsers"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the users in the specified category and service", tag) .WithRequestParameter("buzzCategoryId", loc: "query", description: "Filter by the specified category. It is possible to specify multiple categories.", required: false) .WithRequestParameter("serviceType", loc: "query", description: "Filter by serviceType.", required: false) .WithRequestParameter("limit", loc: "query", description: "Limit", required: false) .WithRequestParameter("offset", loc: "query", description: "offset", required: false) .WithDefaultResponse>() .WithResponse(HttpStatusCode.NotFound, "If the specified category is not available")); Describe["BuzzUserAccountGetUser"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get the user with the specified id", tag) .WithRequestParameter("userId", loc: "path", description: "Id of the buzz user account", required: true) .WithDefaultResponse() .WithResponse(HttpStatusCode.NotFound, "The specified user can not be found")); Describe["BuzzUserAccountGetUserHistory"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Get history of subscribers and playlist subscribers for user with the specified id", tag) .WithRequestParameter("userId", loc: "path", description: "Id of the buzz user account", required: true) .WithRequestParameter("startDate", loc: "query", description: "Only include values after this date", required: false) .WithRequestParameter("endDate", loc: "query", description: "Only include values before this date", required: false) .WithDefaultResponse() .WithResponse(HttpStatusCode.NotFound, "The specified user can not be found")); Describe["BuzzUserAccountAddUser"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Add a new user in the specified category.", tag) .WithRequestModel() .WithDefaultResponse() .WithResponse(HttpStatusCode.BadRequest, "If no valid request parameter or if user does not exist at Spotify")); Describe["BuzzUserAccountUpdateUser"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Update an existing user.", tag) .WithRequestParameter("userId", description: "Id of user") .WithRequestModel() .WithDefaultResponse() .WithResponse(HttpStatusCode.BadRequest, "If no valid request parameter or if user does not exist at Spotify") .WithResponse(HttpStatusCode.NotFound, "User with id could not be found")); Describe["BuzzUserAccountDeleteUser"] = description => new SwaggerRouteMetadata(description).With(c => c.WithDescription("Delete an existing user.", tag) .WithRequestParameter("userId", description: "Id of user") .WithResponse(HttpStatusCode.Accepted, "User has been removed") .WithResponse(HttpStatusCode.BadRequest, "If no valid request parameter") .WithResponse(HttpStatusCode.NotFound, "User with id could not be found")); } } }