#macro-derive #serialization #authoring #structs #requests #defines #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

#14 in #authoring

Download history 11/week @ 2024-02-17 32/week @ 2024-02-24 5/week @ 2024-03-02 6/week @ 2024-03-09 2/week @ 2024-03-16 39/week @ 2024-03-30 5/week @ 2024-04-06 1/week @ 2024-04-20 1/week @ 2024-04-27 157/week @ 2024-05-11 57/week @ 2024-05-18

215 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.7–1.1MB
~25K SLoC