Skip to main content

quicknode_sdk/admin/
endpoint_urls.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};
8use std::collections::HashMap;
9
10/// HTTP/WSS URL pair for a single network on a multichain endpoint.
11#[cfg_attr(feature = "python", gen_stub_pyclass)]
12#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
13#[cfg_attr(feature = "node", napi(object))]
14#[derive(Debug, Clone, Serialize, Deserialize)]
15pub struct EndpointUrl {
16    /// HTTP RPC URL.
17    pub http_url: String,
18    /// WebSocket RPC URL, when available.
19    pub wss_url: Option<String>,
20}
21
22/// Inner data for `get_endpoint_urls` — the http/wss URLs for the endpoint and,
23/// when the endpoint is multichain, a per-network map of additional URLs.
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 GetEndpointUrlsData {
29    /// HTTP RPC URL.
30    pub http_url: String,
31    /// WebSocket RPC URL, when available.
32    pub wss_url: Option<String>,
33    /// Per-network URLs for multichain endpoints; `None` for single-chain endpoints.
34    pub multichain_urls: Option<HashMap<String, EndpointUrl>>,
35}
36
37/// Response from `get_endpoint_urls`.
38#[cfg_attr(feature = "python", gen_stub_pyclass)]
39#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
40#[cfg_attr(feature = "node", napi(object))]
41#[derive(Debug, Clone, Serialize, Deserialize)]
42pub struct GetEndpointUrlsResponse {
43    /// URLs for the endpoint.
44    pub data: Option<GetEndpointUrlsData>,
45    /// Error message when the request did not succeed.
46    pub error: Option<String>,
47}