Skip to main content

quicknode_sdk/admin/
account.rs

1#[cfg(feature = "node")]
2use napi_derive::napi;
3#[cfg(feature = "python")]
4use pyo3::pyclass;
5#[cfg(feature = "python")]
6use pyo3_stub_gen::derive::gen_stub_pyclass;
7use serde::{Deserialize, Serialize};
8
9/// The account's current subscription.
10#[cfg_attr(feature = "python", gen_stub_pyclass)]
11#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
12#[cfg_attr(feature = "node", napi(object))]
13#[derive(Debug, Clone, Serialize, Deserialize)]
14pub struct AccountSubscription {
15    /// Plan name (e.g. `Accelerate`).
16    pub plan_name: Option<String>,
17    /// Subscription status (e.g. `active`).
18    pub status: Option<String>,
19    /// Billing interval (e.g. `monthly`).
20    pub interval: Option<String>,
21}
22
23/// Details about a Quicknode account.
24#[cfg_attr(feature = "python", gen_stub_pyclass)]
25#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
26#[cfg_attr(feature = "node", napi(object))]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct AccountInfo {
29    /// Numeric account id.
30    pub id: i64,
31    /// Account name.
32    pub name: String,
33    /// ISO 8601 timestamp of when the account was created.
34    pub created_at: String,
35    /// Billing version (e.g. `v6`).
36    pub billing_version: Option<String>,
37    /// The account's current subscription, when present.
38    pub subscription: Option<AccountSubscription>,
39}
40
41/// Response from `account_info`.
42#[cfg_attr(feature = "python", gen_stub_pyclass)]
43#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
44#[cfg_attr(feature = "node", napi(object))]
45#[derive(Debug, Clone, Serialize, Deserialize)]
46pub struct AccountInfoResponse {
47    /// Account details, when the request succeeded.
48    pub data: Option<AccountInfo>,
49    /// Error message when the request did not succeed.
50    pub error: Option<String>,
51}