Skip to main content

__public_api_endpoint

Macro __public_api_endpoint 

Source
macro_rules! __public_api_endpoint {
    (
        $path:expr_2021,
        // API version this endpoint was introduced in, at the current consensus level.
        $version_introduced:expr_2021,
        async |$state:ident: &$state_ty:ty, $context:ident, $param:ident: $param_ty:ty| -> $resp_ty:ty $body:block
    ) => { ... };
}
Expand description

Declares an API endpoint that does not require guardian authentication.

ยงExample

struct State;

let _: ApiEndpoint<State> = public_api_endpoint! {
    "/foobar",
    ApiVersion::new(0, 3),
    async |state: &State, _dbtx, params: ()| -> i32 {
        Ok(0)
    }
};