1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// this file is @generated
#![allow(clippy::doc_markdown, clippy::default_trait_access)]
#[allow(unused_imports, clippy::wildcard_imports)]
use crate::{error::Result, models::*, Configuration};
/// The connect API, from the client's
/// [`connect`](crate::api::Meteroid::connect).
#[derive(Clone)]
pub struct Connect {
cfg: std::sync::Arc<Configuration>,
options: crate::api::RequestOptions,
}
impl std::fmt::Debug for Connect {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Connect")
.field("options", &self.options)
.finish_non_exhaustive()
}
}
impl Connect {
pub(super) fn new(cfg: std::sync::Arc<Configuration>) -> Self {
Self {
cfg,
options: crate::api::RequestOptions::default(),
}
}
/// Applies `options` (headers, timeout, retries, idempotency key) to the calls made
/// through the returned value.
#[must_use]
pub fn with_options(mut self, options: crate::api::RequestOptions) -> Self {
self.options = options;
self
}
/// List connected accounts
///
/// List all connected accounts for this platform.
///
/// `GET /api/v1/connected-accounts`.
///
/// # Errors
///
/// An API error's body is [`RestErrorResponse`](crate::models::RestErrorResponse) (429).
pub fn list_connected_accounts(
&self,
) -> crate::api::Call<crate::models::ConnectedAccountsResponse> {
crate::request::Request::new(http::Method::GET, "/api/v1/connected-accounts")
.with_options(&self.options)
.json(&self.cfg)
}
/// Create connected account
///
/// Create a new pending connected account (Express flow). Returns the
/// account and an onboarding link for the user to complete setup.
///
/// `POST /api/v1/connected-accounts`.
///
/// # Errors
///
/// An API error's body is [`RestErrorResponse`](crate::models::RestErrorResponse) (429).
pub fn create_connected_account(
&self,
create_connected_account_request: crate::models::CreateConnectedAccountRequest,
) -> crate::api::Call<crate::models::CreateConnectedAccountResponse> {
crate::request::Request::new(http::Method::POST, "/api/v1/connected-accounts")
.with_body_param(create_connected_account_request)
.with_options(&self.options)
.json(&self.cfg)
}
/// Get connected account
///
/// Retrieve a connected account by ID.
///
/// `GET /api/v1/connected-accounts/{id}`.
///
/// # Errors
///
/// An API error's body is [`RestErrorResponse`](crate::models::RestErrorResponse) (429).
pub fn retrieve_connected_account(
&self,
id: impl Into<crate::models::ConnectedAccountId>,
) -> crate::api::Call<crate::models::ConnectedAccount> {
crate::request::Request::new(http::Method::GET, "/api/v1/connected-accounts/{id}")
.with_path_param("id", Into::<crate::models::ConnectedAccountId>::into(id))
.with_options(&self.options)
.json(&self.cfg)
}
/// Disconnect account
///
/// Revoke a connected account. All associated tokens are invalidated.
///
/// `DELETE /api/v1/connected-accounts/{id}`.
///
/// # Errors
///
/// An API error's body is [`RestErrorResponse`](crate::models::RestErrorResponse) (429).
pub fn disconnect_account(
&self,
id: impl Into<crate::models::ConnectedAccountId>,
) -> crate::api::Call<()> {
crate::request::Request::new(http::Method::DELETE, "/api/v1/connected-accounts/{id}")
.with_path_param("id", Into::<crate::models::ConnectedAccountId>::into(id))
.with_options(&self.options)
.empty(&self.cfg)
}
/// Create onboarding link
///
/// Generate a new onboarding link for a connected account. Any existing
/// unused link is invalidated. The link expires after a configured duration.
///
/// `POST /api/v1/connected-accounts/{id}/onboarding`.
///
/// # Errors
///
/// An API error's body is [`RestErrorResponse`](crate::models::RestErrorResponse) (429).
pub fn create_onboarding_link(
&self,
id: impl Into<crate::models::ConnectedAccountId>,
create_onboarding_link_request: crate::models::CreateOnboardingLinkRequest,
) -> crate::api::Call<crate::models::OnboardingLinkResponse> {
crate::request::Request::new(
http::Method::POST,
"/api/v1/connected-accounts/{id}/onboarding",
)
.with_path_param("id", Into::<crate::models::ConnectedAccountId>::into(id))
.with_body_param(create_onboarding_link_request)
.with_options(&self.options)
.json(&self.cfg)
}
}