Skip to main content

api_put

Macro api_put 

Source
macro_rules! api_put {
    (
        $(#[$m:meta])*
        $fn_name:ident,
        $op_id:literal,
        $visibility:expr,
        $ret_type:ty,
        $( ($param:ident: $param_t:ty) => $replace:literal ),*,
        $body_param:ident: $param_type:ty,
    ) => { ... };
    (
        $(#[$m:meta])*
        $fn_name:ident,
        $op_id:literal,
        $visibility:expr,
        $ret_type:ty,
        $( ($param:ident: $param_t:ty) => $replace:literal ),*
        ; $( $qkind:ident($qparam:ident: $qparam_t:ty) => $qkey:literal ),*
        ; $body_param:ident: $body_t:ty $(,)?
    ) => { ... };
}
Expand description

Create a function for calling a single endpoint with a PUT request.

Follows the structure of the api_post! macro: path parameters, followed by the data that will be passed to serde_json::to_string to set the request’s body.

§Example

pub struct SomeGroup<'a> {
    pub(crate) esi: &'a Esi,
}

impl SomeGroup<'_> {

    api_put!(
        /// Docs for the generated function
        function_name,
        "some_operation_id",
        RequestType::Authenticated,
        (),
        (fleet_id: i32) => "{fleet_id}",
        settings: &serde_json::Value,
    );

}