1#[cfg(feature = "rust")]
2use bon::Builder;
3#[cfg(feature = "node")]
4use napi_derive::napi;
5#[cfg(feature = "python")]
6use pyo3::pyclass;
7#[cfg(feature = "python")]
8use pyo3_stub_gen::derive::gen_stub_pyclass;
9use serde::{Deserialize, Serialize};
10
11#[cfg_attr(feature = "python", gen_stub_pyclass)]
13#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
14#[cfg_attr(feature = "node", napi(object))]
15#[cfg_attr(feature = "rust", derive(Builder))]
16#[derive(Debug, Clone, Default, Serialize)]
17pub struct GetEndpointsRequest {
18 #[serde(skip_serializing_if = "Option::is_none")]
20 pub limit: Option<i32>,
21 #[serde(skip_serializing_if = "Option::is_none")]
23 pub offset: Option<i32>,
24 #[serde(skip_serializing_if = "Option::is_none")]
26 pub search: Option<String>,
27 #[serde(skip_serializing_if = "Option::is_none")]
29 pub sort_by: Option<String>,
30 #[serde(skip_serializing_if = "Option::is_none")]
32 pub sort_direction: Option<String>,
33 #[serde(skip_serializing_if = "Option::is_none")]
35 pub networks: Option<Vec<String>>,
36 #[serde(skip_serializing_if = "Option::is_none")]
38 pub statuses: Option<Vec<String>>,
39 #[serde(skip_serializing_if = "Option::is_none")]
41 pub labels: Option<Vec<String>>,
42 #[serde(skip_serializing_if = "Option::is_none")]
44 pub dedicated: Option<bool>,
45 #[serde(skip_serializing_if = "Option::is_none")]
47 pub is_flat_rate: Option<bool>,
48 #[serde(skip_serializing_if = "Option::is_none")]
50 pub tag_ids: Option<Vec<i32>>,
51 #[serde(skip_serializing_if = "Option::is_none")]
53 pub tag_labels: Option<Vec<String>>,
54}
55
56#[cfg_attr(feature = "python", gen_stub_pyclass)]
58#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
59#[cfg_attr(feature = "node", napi(object))]
60#[derive(Debug, Clone, Serialize, Deserialize)]
61pub struct GetEndpointsResponse {
62 #[serde(default)]
64 pub data: Vec<Endpoint>,
65 pub pagination: Option<Pagination>,
67 pub error: Option<String>,
69}
70
71#[cfg_attr(feature = "python", gen_stub_pyclass)]
73#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
74#[cfg_attr(feature = "node", napi(object))]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76pub struct Pagination {
77 pub total: i64,
79 pub limit: i32,
81 pub offset: i32,
83}
84
85#[cfg_attr(feature = "python", gen_stub_pyclass)]
87#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
88#[cfg_attr(feature = "node", napi(object))]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90pub struct Endpoint {
91 pub id: String,
93 pub name: String,
95 pub label: Option<String>,
97 pub status: String,
99 pub chain: String,
101 pub network: String,
103 pub is_dedicated: bool,
105 pub is_flat_rate: bool,
107 pub http_url: String,
109 pub wss_url: Option<String>,
111 #[serde(default)]
113 pub tags: Vec<EndpointTag>,
114 #[serde(default)]
116 pub is_multichain: bool,
117}
118
119#[cfg_attr(feature = "python", gen_stub_pyclass)]
121#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
122#[cfg_attr(feature = "node", napi(object))]
123#[derive(Debug, Clone, Serialize, Deserialize)]
124pub struct EndpointTag {
125 pub tag_id: i32,
127 pub label: String,
129}
130
131#[cfg_attr(feature = "python", gen_stub_pyclass)]
133#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
134#[cfg_attr(feature = "node", napi(object))]
135#[cfg_attr(feature = "rust", derive(Builder))]
136#[derive(Debug, Clone, Default, Serialize)]
137pub struct CreateEndpointRequest {
138 #[serde(skip_serializing_if = "Option::is_none")]
140 pub chain: Option<String>,
141 #[serde(skip_serializing_if = "Option::is_none")]
143 pub network: Option<String>,
144}
145
146#[cfg_attr(feature = "python", gen_stub_pyclass)]
148#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
149#[cfg_attr(feature = "node", napi(object))]
150#[derive(Debug, Clone, Serialize, Deserialize)]
151pub struct CreateEndpointResponse {
152 pub data: SingleEndpoint,
154 pub error: Option<String>,
156}
157
158#[cfg_attr(feature = "python", gen_stub_pyclass)]
160#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
161#[cfg_attr(feature = "node", napi(object))]
162#[derive(Debug, Clone, Serialize, Deserialize)]
163pub struct SingleEndpoint {
164 pub id: String,
166 pub label: Option<String>,
168 pub status: Option<String>,
170 pub chain: String,
172 pub network: String,
174 pub http_url: String,
176 pub wss_url: Option<String>,
178 pub security: Option<EndpointSecurity>,
180 pub rate_limits: Option<EndpointRateLimits>,
182 #[serde(default)]
184 pub tags: Vec<EndpointTag>,
185 #[serde(default)]
187 pub is_multichain: bool,
188}
189
190#[cfg_attr(feature = "python", gen_stub_pyclass)]
192#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
193#[cfg_attr(feature = "node", napi(object))]
194#[derive(Debug, Clone, Serialize, Deserialize)]
195pub struct EndpointRateLimits {
196 pub rate_limit_by_ip: Option<bool>,
198 pub account: Option<i32>,
200 pub rps: Option<i32>,
202 pub rpm: Option<i32>,
204 pub rpd: Option<i32>,
206}
207
208#[cfg_attr(feature = "python", gen_stub_pyclass)]
212#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
213#[cfg_attr(feature = "node", napi(object))]
214#[derive(Debug, Clone, Serialize, Deserialize)]
215pub struct EndpointSecurity {
216 pub options: Option<EndpointSecurityOptions>,
218 pub tokens: Option<Vec<EndpointToken>>,
220 pub jwts: Option<Vec<EndpointJwt>>,
222 pub referrers: Option<Vec<EndpointReferrer>>,
224 pub domain_masks: Option<Vec<EndpointDomainMask>>,
226 pub ips: Option<Vec<EndpointIp>>,
228 pub request_filters: Option<Vec<EndpointRequestFilter>>,
230}
231
232#[cfg_attr(feature = "python", gen_stub_pyclass)]
234#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
235#[cfg_attr(feature = "node", napi(object))]
236#[derive(Debug, Clone, Serialize, Deserialize)]
237pub struct EndpointSecurityOptions {
238 pub tokens: Option<bool>,
240 pub jwts: Option<bool>,
242 #[serde(rename = "domainMasks")]
244 pub domain_masks: Option<bool>,
245 pub ips: Option<bool>,
247 pub referrers: Option<bool>,
249 #[serde(rename = "requestFilters")]
251 pub request_filters: Option<bool>,
252 #[serde(rename = "ipCustomHeader")]
254 pub ip_custom_header: Option<EndpointIpCustomHeaderOption>,
255}
256
257#[cfg_attr(feature = "python", gen_stub_pyclass)]
259#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
260#[cfg_attr(feature = "node", napi(object))]
261#[derive(Debug, Clone, Serialize, Deserialize)]
262pub struct EndpointIpCustomHeaderOption {
263 pub value: Option<String>,
265}
266
267#[cfg_attr(feature = "python", gen_stub_pyclass)]
269#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
270#[cfg_attr(feature = "node", napi(object))]
271#[derive(Clone, Serialize, Deserialize)]
272pub struct EndpointToken {
273 pub id: String,
275 pub token: String,
277}
278
279impl std::fmt::Debug for EndpointToken {
282 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
283 f.debug_struct("EndpointToken")
284 .field("id", &self.id)
285 .field("token", &"[redacted]")
286 .finish()
287 }
288}
289
290#[cfg_attr(feature = "python", gen_stub_pyclass)]
292#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
293#[cfg_attr(feature = "node", napi(object))]
294#[derive(Clone, Serialize, Deserialize)]
295pub struct EndpointJwt {
296 pub id: String,
298 pub public_key: String,
300 pub kid: String,
302 pub name: String,
304}
305
306impl std::fmt::Debug for EndpointJwt {
308 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
309 f.debug_struct("EndpointJwt")
310 .field("id", &self.id)
311 .field("public_key", &"[redacted]")
312 .field("kid", &self.kid)
313 .field("name", &self.name)
314 .finish()
315 }
316}
317
318#[cfg_attr(feature = "python", gen_stub_pyclass)]
320#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
321#[cfg_attr(feature = "node", napi(object))]
322#[derive(Debug, Clone, Serialize, Deserialize)]
323pub struct EndpointReferrer {
324 pub id: String,
326 pub referrer: Option<String>,
328}
329
330#[cfg_attr(feature = "python", gen_stub_pyclass)]
332#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
333#[cfg_attr(feature = "node", napi(object))]
334#[derive(Debug, Clone, Serialize, Deserialize)]
335pub struct EndpointDomainMask {
336 pub id: String,
338 pub domain: String,
340}
341
342#[cfg_attr(feature = "python", gen_stub_pyclass)]
344#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
345#[cfg_attr(feature = "node", napi(object))]
346#[derive(Debug, Clone, Serialize, Deserialize)]
347pub struct EndpointIp {
348 pub id: String,
350 pub ip: String,
352}
353
354#[cfg_attr(feature = "python", gen_stub_pyclass)]
356#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
357#[cfg_attr(feature = "node", napi(object))]
358#[derive(Debug, Clone, Serialize, Deserialize)]
359pub struct EndpointRequestFilter {
360 pub id: String,
362 #[serde(default)]
364 pub method: Vec<String>,
365}
366
367#[cfg_attr(feature = "python", gen_stub_pyclass)]
369#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
370#[cfg_attr(feature = "node", napi(object))]
371#[derive(Debug, Clone, Serialize, Deserialize)]
372pub struct ShowEndpointResponse {
373 pub data: Option<SingleEndpoint>,
375 pub error: Option<String>,
377}
378
379#[cfg_attr(feature = "python", gen_stub_pyclass)]
381#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
382#[cfg_attr(feature = "node", napi(object))]
383#[cfg_attr(feature = "rust", derive(Builder))]
384#[derive(Debug, Clone, Default, Serialize)]
385pub struct UpdateEndpointRequest {
386 #[serde(skip_serializing_if = "Option::is_none")]
388 pub label: Option<String>,
389}
390
391#[cfg_attr(feature = "python", gen_stub_pyclass)]
393#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
394#[cfg_attr(feature = "node", napi(object))]
395#[cfg_attr(feature = "rust", derive(Builder))]
396#[derive(Debug, Clone, Default, Serialize)]
397pub struct UpdateEndpointStatusRequest {
398 pub status: String,
400}
401
402#[cfg_attr(feature = "python", gen_stub_pyclass)]
404#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
405#[cfg_attr(feature = "node", napi(object))]
406#[derive(Debug, Clone, Serialize, Deserialize)]
407pub struct UpdateEndpointStatusResponse {
408 pub data: Option<String>,
410 pub error: Option<String>,
412}
413
414#[cfg_attr(feature = "python", gen_stub_pyclass)]
416#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
417#[cfg_attr(feature = "node", napi(object))]
418#[cfg_attr(feature = "rust", derive(Builder))]
419#[derive(Debug, Clone, Default, Serialize)]
420pub struct CreateTagRequest {
421 #[serde(skip_serializing_if = "Option::is_none")]
423 pub label: Option<String>,
424}
425
426#[cfg_attr(feature = "python", gen_stub_pyclass)]
428#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
429#[cfg_attr(feature = "node", napi(object))]
430#[derive(Debug, Clone, Serialize, Deserialize)]
431pub struct GetEndpointSecurityResponse {
432 pub data: Option<EndpointSecurity>,
434 pub error: Option<String>,
436}