patch

Attribute Macro patch 

Source
#[patch]
Expand description

A procedural macro for building an HTTP PATCH method of trait. It includes the following attributes:

  • path - a part of the URL path (String)
  • consumes - content type for request, support: application/json, application/xml, application/x-www-form-urlencoded (String)
  • produces - accept type for response, support: application/json, application/xml, application/x-www-form-urlencoded (String)

PATCH method supports argument macros:

  • #[segment] - maps method arguments to path segments (simple types, String)
  • #[query] - maps method arguments to query parameters (simple types, String)
  • #[header] - maps method arguments to request headers (simple types, String)
  • #[body] - maps method arguments to request body (object implemented #data_transfer)
  • #[placeholder] - maps method arguments to request header placeholders

Example:

#[patch(path = "/{path_query}", consumes = "application/json", produces = "application/json")]
fn patch(&self, #[segment] path_query: &str, #[query] query_param: &str) -> ClientixResult<ClientixResponse<String>>;