From 2ed8d44001614a1636198b6eec23bf769c77c143 Mon Sep 17 00:00:00 2001 From: silverpill Date: Tue, 30 Aug 2022 19:11:18 +0000 Subject: [PATCH] Add expires_at field to object returned by subscribers API endpoint --- docs/openapi.yaml | 4 ++++ src/mastodon_api/accounts/types.rs | 2 ++ src/models/subscriptions/types.rs | 2 ++ 3 files changed, 8 insertions(+) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 6832973..6b29f50 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1076,6 +1076,10 @@ components: description: Sender address. type: string example: '0xd8da6bf...' + expires_at: + description: The date when subscription expires. + type: string + format: dateTime Tag: type: object properties: diff --git a/src/mastodon_api/accounts/types.rs b/src/mastodon_api/accounts/types.rs index 2e75070..a673647 100644 --- a/src/mastodon_api/accounts/types.rs +++ b/src/mastodon_api/accounts/types.rs @@ -336,6 +336,7 @@ pub struct ApiSubscription { pub id: i32, pub sender: Account, pub sender_address: String, + pub expires_at: DateTime, } impl ApiSubscription { @@ -348,6 +349,7 @@ impl ApiSubscription { id: subscription.id, sender, sender_address: subscription.sender_address, + expires_at: subscription.expires_at, } } } diff --git a/src/models/subscriptions/types.rs b/src/models/subscriptions/types.rs index a403ec3..03d70fa 100644 --- a/src/models/subscriptions/types.rs +++ b/src/models/subscriptions/types.rs @@ -23,6 +23,7 @@ pub struct Subscription { pub id: i32, pub sender: DbActorProfile, pub sender_address: String, + pub expires_at: DateTime, } impl TryFrom<&Row> for Subscription { @@ -36,6 +37,7 @@ impl TryFrom<&Row> for Subscription { id: db_subscription.id, sender: db_sender, sender_address: db_subscription.sender_address, + expires_at: db_subscription.expires_at, }) } }