struct Koa
- Koa
- Struct
- Value
- Object
Defined in:
koa.crkoa/global.cr
koa/route.cr
Constructors
Class Method Summary
-
.array(name : String, type : String, *, desc : String | Nil = nil)
Defines an array schema
-
.auth(key : String)
Adds a registered authentication method to the succeeding route.
-
.auth(keys : Array(String))
Sets the list of authentication methods of the succeeding route.
-
.basic_auth(key : String)
Adds a Basic authentication method.
-
.bearer_auth(key : String, format : String)
Adds a Bearer authentication method.
-
.binary(name : String, *, desc : String | Nil = nil)
Defines a binary schema
-
.body(*, type = "application/json", required = true, desc : String | Nil = nil, ref : String | Nil = nil)
Specifies the required request body of the succeeding route.
-
.cookie(name : String, *, desc : String | Nil = nil, required = true, type : String = "string", low_priority = false)
Adds a cookie parameter to the succeeding route.
-
.cookie_auth(key : String, name : String)
Adds a API Key authentication method.
-
.delete(path : String)
Registers a delete route.
-
.describe(summary : String, desc : String | Nil = nil)
Sets
summary
anddescription
(optional) of the succeeding route. -
.generate : OpenAPI::Document | Nil
Generates an instance of
OpenAPI::Document
that contains the API specification. -
.get(path : String)
Registers a get route.
- .global_tag(name : String, *, desc : String | Nil = nil)
-
.header(name : String, *, desc : String | Nil = nil, required = true, type : String = "string", low_priority = false)
Adds a header parameter to the succeeding route.
-
.init(title : String, *, desc : String | Nil = nil, version = "1.0.0")
Initializes Koa and sets the
Info
object of the API. -
.object(name : String, schema : Hash(String, String), *, desc : String | Nil = nil)
Defines an object schema
-
.options(path : String)
Registers a options route.
-
.patch(path : String)
Registers a patch route.
-
.path(name : String, *, desc : String | Nil = nil, required = true, type : String = "string", low_priority = false)
Adds a path parameter to the succeeding route.
-
.post(path : String)
Registers a post route.
-
.put(path : String)
Registers a put route.
-
.query(name : String, *, desc : String | Nil = nil, required = true, type : String = "string", low_priority = false)
Adds a query parameter to the succeeding route.
-
.response(status : UInt32, desc : String = "OK", *, ref : String | Nil = nil, media_type = "application/json")
Adds a response to the succeeding route.
-
.server(url : String, desc : String | Nil = nil)
Adds a server to the server list.
-
.tag(tag : String)
Adds a tag to the succeeding route.
-
.tags(tags : Array(String))
Sets the tags of the succeeding route.
Instance Method Summary
Constructor Detail
Class Method Detail
Defines an array schema
Sets the list of authentication methods of the succeeding route.
Specifies the required request body of the succeeding route.
Adds a cookie parameter to the succeeding route.
Registers a delete route.
This method will be invoked by the monkey-patched Kemal, and you don't need to call it manually.
Sets summary
and description
(optional) of the succeeding route.
Generates an instance of OpenAPI::Document
that contains the API specification.
You can get the YAML or JSON representation using to_yaml
or to_json
Registers a get route.
This method will be invoked by the monkey-patched Kemal, and you don't need to call it manually.
Adds a header parameter to the succeeding route.
Initializes Koa and sets the Info
object of the API.
Defines an object schema
Registers a options route.
This method will be invoked by the monkey-patched Kemal, and you don't need to call it manually.
Registers a patch route.
This method will be invoked by the monkey-patched Kemal, and you don't need to call it manually.
Adds a path parameter to the succeeding route.
Registers a post route.
This method will be invoked by the monkey-patched Kemal, and you don't need to call it manually.
Registers a put route.
This method will be invoked by the monkey-patched Kemal, and you don't need to call it manually.
Adds a query parameter to the succeeding route.
Adds a response to the succeeding route.
The response {"200" => "OK"} is automatically added, and you can overwrite it with Koa.response "200", "New description"
.