#[cfg(feature = "rust")]
use bon::Builder;
#[cfg(feature = "node")]
use napi_derive::napi;
#[cfg(feature = "python")]
use pyo3::pyclass;
#[cfg(feature = "python")]
use pyo3_stub_gen::derive::gen_stub_pyclass;
use serde::{Deserialize, Serialize};
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[cfg_attr(feature = "rust", derive(Builder))]
#[derive(Debug, Clone, Default, Serialize)]
pub struct GetEndpointsRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub offset: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub search: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_by: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_direction: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub networks: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub statuses: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub dedicated: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub is_flat_rate: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tag_ids: Option<Vec<i32>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tag_labels: Option<Vec<String>>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GetEndpointsResponse {
#[serde(default)]
pub data: Vec<Endpoint>,
pub pagination: Option<Pagination>,
pub error: Option<String>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Pagination {
pub total: i64,
pub limit: i32,
pub offset: i32,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Endpoint {
pub id: String,
pub name: String,
pub label: Option<String>,
pub status: String,
pub chain: String,
pub network: String,
pub is_dedicated: bool,
pub is_flat_rate: bool,
pub http_url: String,
pub wss_url: Option<String>,
#[serde(default)]
pub tags: Vec<EndpointTag>,
#[serde(default)]
pub is_multichain: bool,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EndpointTag {
pub tag_id: i32,
pub label: String,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[cfg_attr(feature = "rust", derive(Builder))]
#[derive(Debug, Clone, Default, Serialize)]
pub struct CreateEndpointRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub chain: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub network: Option<String>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CreateEndpointResponse {
pub data: SingleEndpoint,
pub error: Option<String>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SingleEndpoint {
pub id: String,
pub label: Option<String>,
pub status: Option<String>,
pub chain: String,
pub network: String,
pub http_url: String,
pub wss_url: Option<String>,
pub security: Option<EndpointSecurity>,
pub rate_limits: Option<EndpointRateLimits>,
#[serde(default)]
pub tags: Vec<EndpointTag>,
#[serde(default)]
pub is_multichain: bool,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EndpointRateLimits {
pub rate_limit_by_ip: Option<bool>,
pub account: Option<i32>,
pub rps: Option<i32>,
pub rpm: Option<i32>,
pub rpd: Option<i32>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EndpointSecurity {
pub options: Option<EndpointSecurityOptions>,
pub tokens: Option<Vec<EndpointToken>>,
pub jwts: Option<Vec<EndpointJwt>>,
pub referrers: Option<Vec<EndpointReferrer>>,
pub domain_masks: Option<Vec<EndpointDomainMask>>,
pub ips: Option<Vec<EndpointIp>>,
pub request_filters: Option<Vec<EndpointRequestFilter>>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EndpointSecurityOptions {
pub tokens: Option<bool>,
pub jwts: Option<bool>,
#[serde(rename = "domainMasks")]
pub domain_masks: Option<bool>,
pub ips: Option<bool>,
pub referrers: Option<bool>,
#[serde(rename = "requestFilters")]
pub request_filters: Option<bool>,
#[serde(rename = "ipCustomHeader")]
pub ip_custom_header: Option<EndpointIpCustomHeaderOption>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EndpointIpCustomHeaderOption {
pub value: Option<String>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Clone, Serialize, Deserialize)]
pub struct EndpointToken {
pub id: String,
pub token: String,
}
impl std::fmt::Debug for EndpointToken {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("EndpointToken")
.field("id", &self.id)
.field("token", &"[redacted]")
.finish()
}
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Clone, Serialize, Deserialize)]
pub struct EndpointJwt {
pub id: String,
pub public_key: String,
pub kid: String,
pub name: String,
}
impl std::fmt::Debug for EndpointJwt {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("EndpointJwt")
.field("id", &self.id)
.field("public_key", &"[redacted]")
.field("kid", &self.kid)
.field("name", &self.name)
.finish()
}
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EndpointReferrer {
pub id: String,
pub referrer: Option<String>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EndpointDomainMask {
pub id: String,
pub domain: String,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EndpointIp {
pub id: String,
pub ip: String,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EndpointRequestFilter {
pub id: String,
#[serde(default)]
pub method: Vec<String>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ShowEndpointResponse {
pub data: Option<SingleEndpoint>,
pub error: Option<String>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[cfg_attr(feature = "rust", derive(Builder))]
#[derive(Debug, Clone, Default, Serialize)]
pub struct UpdateEndpointRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub label: Option<String>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[cfg_attr(feature = "rust", derive(Builder))]
#[derive(Debug, Clone, Default, Serialize)]
pub struct UpdateEndpointStatusRequest {
pub status: String,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UpdateEndpointStatusResponse {
pub data: Option<String>,
pub error: Option<String>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[cfg_attr(feature = "rust", derive(Builder))]
#[derive(Debug, Clone, Default, Serialize)]
pub struct CreateTagRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub label: Option<String>,
}
#[cfg_attr(feature = "python", gen_stub_pyclass)]
#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
#[cfg_attr(feature = "node", napi(object))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GetEndpointSecurityResponse {
pub data: Option<EndpointSecurity>,
pub error: Option<String>,
}