#macro-derive #structs #defines #authoring #requests #serialization #attributes

macro pandora-api-derive

Defines a derive macro and some attributes to simplify authoring structs that can be serialized as Pandora API requests

3 releases

0.1.3 May 15, 2024
0.1.2 Aug 23, 2023
0.1.0 Feb 28, 2020

#12 in #authoring

Download history 1/week @ 2024-07-27 1/week @ 2024-08-31 4/week @ 2024-09-14 12/week @ 2024-09-21 6/week @ 2024-09-28

192 downloads per month
Used in pandora-api

MIT license

11KB
169 lines

Derive macros for automatically adding an implementation of pandora_api::Pandora<Json|Rest>ApiRequest to a struct.

The name of the Pandora API method that will be called defaults to the result of converting the struct name to lower camel case (GetFoo -> getFoo). This may be overridden using the #[pandora_request(method_name = getFOOBar) struct attribute.

The default error type is Error. If a different type name is required, this may be overridden using the #[pandora_request(error_type = FooError)] struct attribute.

The default return type of the request is Response. This may be overridden using the #[pandora_request(response_type = FooResponse)] struct attribute.

The default for a request is to send it unencrypted. If the request must be encrypted, this may be overridden using the #[pandora_request(encrypted = true)] struct attribute.

Dependencies

~0.6–1MB
~24K SLoC