From 13e7b69887d6888880f43564d98cf20259afdc62 Mon Sep 17 00:00:00 2001 From: pxp9 Date: Fri, 21 Jun 2024 09:24:32 +0200 Subject: [PATCH] tag with serde --- src/objects.rs | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/src/objects.rs b/src/objects.rs index 7672751..77ac695 100644 --- a/src/objects.rs +++ b/src/objects.rs @@ -4104,23 +4104,18 @@ pub enum RevenueWithdrawalState { } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)] -pub struct RevenueWithdrawalStatePending { - #[builder(setter(into))] - pub r#type: String, -} +#[serde(tag = "pending", rename_all = "snake_case")] +pub struct RevenueWithdrawalStatePending {} #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)] -pub struct RevenueWithdrawalStateFailed { - #[builder(setter(into))] - pub r#type: String, -} +#[serde(tag = "failed", rename_all = "snake_case")] +pub struct RevenueWithdrawalStateFailed {} #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)] +#[serde(tag = "succeeded", rename_all = "snake_case")] pub struct RevenueWithdrawalStateSucceeded { - #[builder(setter(into))] - pub r#type: String, pub date: u64, - url: String, + pub url: String, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] @@ -4131,24 +4126,20 @@ pub enum TransactionPartner { } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)] +#[serde(tag = "fragment", rename_all = "snake_case")] pub struct TransactionPartnerFragment { - #[builder(setter(into))] - pub r#type: String, - withdrawal_state: RevenueWithdrawalState, + pub withdrawal_state: RevenueWithdrawalState, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)] +#[serde(tag = "user", rename_all = "snake_case")] pub struct TransactionPartnerUser { - #[builder(setter(into))] - pub r#type: String, pub user: User, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)] -pub struct TransactionPartnerOther { - #[builder(setter(into))] - pub r#type: String, -} +#[serde(tag = "other", rename_all = "snake_case")] +pub struct TransactionPartnerOther {} #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)] pub struct StarTransaction {