sumup_rs/
memberships.rs

1use crate::{Membership, MembershipListResponse, Result, SumUpClient};
2
3impl SumUpClient {
4    /// Lists all memberships for the authenticated user.
5    pub async fn list_memberships(&self) -> Result<Vec<Membership>> {
6        let url = self.build_url("/v0.1/memberships")?;
7
8        let response = self
9            .http_client
10            .get(url)
11            .bearer_auth(&self.api_key)
12            .send()
13            .await?;
14
15        if response.status().is_success() {
16            let memberships_response = response.json::<MembershipListResponse>().await?;
17            Ok(memberships_response.items)
18        } else {
19            self.handle_error(response).await
20        }
21    }
22    // Note: The SumUp API does not currently have endpoints for creating, updating, or deleting memberships directly.
23    // These actions are typically handled within the SumUp dashboard.
24    // The placeholder functions below are retained in case the API is extended in the future.
25}