Description
The RestRouteMetadata class describes additional metadata for a route.
Properties
Method
Method
publicstring Method { get; set; }
Route
Route
publicstring Route { get; set; }
Tags
Tags
publicstring[] Tags { get; set; }
QueryParams
Query paramters
publicList<QueryParam> QueryParams { get; set; } = new List<QueryParam>()
BodySchema
Body schema
publicObjectSchema BodySchema { get; set; }
NeedsFile
Needs a file option
publicbool NeedsFile { get; set; }
Responses
List containing responses.
publicList<ResponseData> Responses { get; set; } = new List<ResponseData>()
Authentication
Authentication. Accepted values are “basic” and “bearer”.
publicstring Authentication { get; set; }
Instance methods
SetsMethodAndRoute
Sets the method and route.
publicRestRouteMetadata SetsMethodAndRoute(string method, string route)
- method: string - method
- route: string - route
- returns: RestRouteMetadata - instance with defined method and route.
SetsTags
Sets the tags.
publicRestRouteMetadata SetsTags(params string[] tags)
- tags: params string[] -tags
- returns: RestRouteMetadata - instance with defined tags.
ExpectsHeader
Expects header
publicRestRouteMetadata ExpectsHeader()
- returns: RestRouteMetadata - instance of the class.
ReceivesQueryParam
Sets the name, type code, required, default value and description.
publicRestRouteMetadata ReceivesQueryParam(string name, TypeCode typeCode, bool required = false, object defaultValue = null, string description = null)
- name: string - name
- typeCode: TypeCode - data type code
- required: bool - true if required and false otherwise
- defaultValue: object - default value
- description: string - description
- returns: RestRouteMetadata - instance with defined name, type code, required, default value and description.
ReceivesOptionalQueryParam
Sets the parameter as optional.
publicRestRouteMetadata ReceivesOptionalQueryParam(string name, TypeCode typeCode, object defaultValue = null, string description = null)
- name: string - name
- typeCode: TypeCode - data type code
- defaultValue: object - default value
- description: string - description
- returns: RestRouteMetadata - instance with parameter set as optional.
ReceivesRequiredQueryParam
Sets a parameter as required.
publicRestRouteMetadata ReceivesRequiredQueryParam(string name, TypeCode typeCode, object defaultValue = null, string description = null)
- name: string - name
- typeCode: TypeCode - data type code
- defaultValue: object - default value
- description: string - description
- returns: RestRouteMetadata - instance with the parameter set as required.
ReceivesCorrelationIdParam
Sets the CorrelationId parameter.
publicRestRouteMetadata ReceivesCorrelationIdParam()
- returns: RestRouteMetadata - instance with correlationId
ReceivesBodyFromSchema
Sets the body from a schema.
publicRestRouteMetadata ReceivesBodyFromSchema(ObjectSchema schema)
- schema: ObjectSchema - schema
- returns: RestRouteMetadata - instance with body.
ReceivesFile
Sets NeedsFile as true.
publicRestRouteMetadata ReceivesFile()
- returns: RestRouteMetadata - instance with NeedsFile set as true.
SendsData
Sets the status code, description and schema for responses.
publicRestRouteMetadata SendsData(int statusCode, string description, object schema = null)
- statusCode: int - status code
- description: string - description
- schema: object - schema
- returns: RestRouteMetadata - instance with defined status code, description and schema for responses.
SendsData200
Sets SendData to 200 (Success).
publicRestRouteMetadata SendsData200(object schema = null)
- schema:schema
- returns: RestRouteMetadata - instance with SendsData set as 200 (Success).
SendsDataPage200
Sets SendData to 200 (Success).
publicRestRouteMetadata SendsDataPage200(object schema)
- schema: object - schema
- returns: RestRouteMetadata - instance with SendsData set as 200 (Success).
SendsData400
Sets SendData to 400 (Bad request).
publicRestRouteMetadata SendsData400(object schema = null)
- schema: object - schema
- returns: RestRouteMetadata - instance with SendsData set as 400 (Bad request).
UsesBasicAuthentication
Sets Authentication to basic.
publicRestRouteMetadata UsesBasicAuthentication()
- returns: RestRouteMetadata - instance with Authentication set as basic.
UsesBearerAuthentication
Sets Authentication to bearer.
publicRestRouteMetadata UsesBearerAuthentication()
- returns: RestRouteMetadata - instance with Authentication set as bearer.