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}
115
116#[cfg_attr(feature = "python", gen_stub_pyclass)]
118#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
119#[cfg_attr(feature = "node", napi(object))]
120#[derive(Debug, Clone, Serialize, Deserialize)]
121pub struct EndpointTag {
122 pub tag_id: i32,
124 pub label: String,
126}
127
128#[cfg_attr(feature = "python", gen_stub_pyclass)]
130#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
131#[cfg_attr(feature = "node", napi(object))]
132#[cfg_attr(feature = "rust", derive(Builder))]
133#[derive(Debug, Clone, Default, Serialize)]
134pub struct CreateEndpointRequest {
135 #[serde(skip_serializing_if = "Option::is_none")]
137 pub chain: Option<String>,
138 #[serde(skip_serializing_if = "Option::is_none")]
140 pub network: Option<String>,
141}
142
143#[cfg_attr(feature = "python", gen_stub_pyclass)]
145#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
146#[cfg_attr(feature = "node", napi(object))]
147#[derive(Debug, Clone, Serialize, Deserialize)]
148pub struct CreateEndpointResponse {
149 pub data: SingleEndpoint,
151 pub error: Option<String>,
153}
154
155#[cfg_attr(feature = "python", gen_stub_pyclass)]
157#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
158#[cfg_attr(feature = "node", napi(object))]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160pub struct SingleEndpoint {
161 pub id: String,
163 pub label: Option<String>,
165 pub status: Option<String>,
167 pub chain: String,
169 pub network: String,
171 pub http_url: String,
173 pub wss_url: Option<String>,
175 pub security: Option<EndpointSecurity>,
177 pub rate_limits: Option<EndpointRateLimits>,
179 #[serde(default)]
181 pub tags: Vec<EndpointTag>,
182}
183
184#[cfg_attr(feature = "python", gen_stub_pyclass)]
186#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
187#[cfg_attr(feature = "node", napi(object))]
188#[derive(Debug, Clone, Serialize, Deserialize)]
189pub struct EndpointRateLimits {
190 pub rate_limit_by_ip: Option<bool>,
192 pub account: Option<i32>,
194 pub rps: Option<i32>,
196 pub rpm: Option<i32>,
198 pub rpd: Option<i32>,
200}
201
202#[cfg_attr(feature = "python", gen_stub_pyclass)]
206#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
207#[cfg_attr(feature = "node", napi(object))]
208#[derive(Debug, Clone, Serialize, Deserialize)]
209pub struct EndpointSecurity {
210 pub options: Option<EndpointSecurityOptions>,
212 pub tokens: Option<Vec<EndpointToken>>,
214 pub jwts: Option<Vec<EndpointJwt>>,
216 pub referrers: Option<Vec<EndpointReferrer>>,
218 pub domain_masks: Option<Vec<EndpointDomainMask>>,
220 pub ips: Option<Vec<EndpointIp>>,
222 pub request_filters: Option<Vec<EndpointRequestFilter>>,
224}
225
226#[cfg_attr(feature = "python", gen_stub_pyclass)]
228#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
229#[cfg_attr(feature = "node", napi(object))]
230#[derive(Debug, Clone, Serialize, Deserialize)]
231pub struct EndpointSecurityOptions {
232 pub tokens: Option<bool>,
234 pub jwts: Option<bool>,
236 #[serde(rename = "domainMasks")]
238 pub domain_masks: Option<bool>,
239 pub ips: Option<bool>,
241 pub referrers: Option<bool>,
243 #[serde(rename = "requestFilters")]
245 pub request_filters: Option<bool>,
246 #[serde(rename = "ipCustomHeader")]
248 pub ip_custom_header: Option<EndpointIpCustomHeaderOption>,
249}
250
251#[cfg_attr(feature = "python", gen_stub_pyclass)]
253#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
254#[cfg_attr(feature = "node", napi(object))]
255#[derive(Debug, Clone, Serialize, Deserialize)]
256pub struct EndpointIpCustomHeaderOption {
257 pub value: Option<String>,
259}
260
261#[cfg_attr(feature = "python", gen_stub_pyclass)]
263#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
264#[cfg_attr(feature = "node", napi(object))]
265#[derive(Clone, Serialize, Deserialize)]
266pub struct EndpointToken {
267 pub id: String,
269 pub token: String,
271}
272
273impl std::fmt::Debug for EndpointToken {
276 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
277 f.debug_struct("EndpointToken")
278 .field("id", &self.id)
279 .field("token", &"[redacted]")
280 .finish()
281 }
282}
283
284#[cfg_attr(feature = "python", gen_stub_pyclass)]
286#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
287#[cfg_attr(feature = "node", napi(object))]
288#[derive(Clone, Serialize, Deserialize)]
289pub struct EndpointJwt {
290 pub id: String,
292 pub public_key: String,
294 pub kid: String,
296 pub name: String,
298}
299
300impl std::fmt::Debug for EndpointJwt {
302 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
303 f.debug_struct("EndpointJwt")
304 .field("id", &self.id)
305 .field("public_key", &"[redacted]")
306 .field("kid", &self.kid)
307 .field("name", &self.name)
308 .finish()
309 }
310}
311
312#[cfg_attr(feature = "python", gen_stub_pyclass)]
314#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
315#[cfg_attr(feature = "node", napi(object))]
316#[derive(Debug, Clone, Serialize, Deserialize)]
317pub struct EndpointReferrer {
318 pub id: String,
320 pub referrer: Option<String>,
322}
323
324#[cfg_attr(feature = "python", gen_stub_pyclass)]
326#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
327#[cfg_attr(feature = "node", napi(object))]
328#[derive(Debug, Clone, Serialize, Deserialize)]
329pub struct EndpointDomainMask {
330 pub id: String,
332 pub domain: String,
334}
335
336#[cfg_attr(feature = "python", gen_stub_pyclass)]
338#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
339#[cfg_attr(feature = "node", napi(object))]
340#[derive(Debug, Clone, Serialize, Deserialize)]
341pub struct EndpointIp {
342 pub id: String,
344 pub ip: String,
346}
347
348#[cfg_attr(feature = "python", gen_stub_pyclass)]
350#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
351#[cfg_attr(feature = "node", napi(object))]
352#[derive(Debug, Clone, Serialize, Deserialize)]
353pub struct EndpointRequestFilter {
354 pub id: String,
356 #[serde(default)]
358 pub method: Vec<String>,
359}
360
361#[cfg_attr(feature = "python", gen_stub_pyclass)]
363#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
364#[cfg_attr(feature = "node", napi(object))]
365#[derive(Debug, Clone, Serialize, Deserialize)]
366pub struct ShowEndpointResponse {
367 pub data: Option<SingleEndpoint>,
369 pub error: Option<String>,
371}
372
373#[cfg_attr(feature = "python", gen_stub_pyclass)]
375#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
376#[cfg_attr(feature = "node", napi(object))]
377#[cfg_attr(feature = "rust", derive(Builder))]
378#[derive(Debug, Clone, Default, Serialize)]
379pub struct UpdateEndpointRequest {
380 #[serde(skip_serializing_if = "Option::is_none")]
382 pub label: Option<String>,
383}
384
385#[cfg_attr(feature = "python", gen_stub_pyclass)]
387#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
388#[cfg_attr(feature = "node", napi(object))]
389#[cfg_attr(feature = "rust", derive(Builder))]
390#[derive(Debug, Clone, Default, Serialize)]
391pub struct UpdateEndpointStatusRequest {
392 pub status: String,
394}
395
396#[cfg_attr(feature = "python", gen_stub_pyclass)]
398#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
399#[cfg_attr(feature = "node", napi(object))]
400#[derive(Debug, Clone, Serialize, Deserialize)]
401pub struct UpdateEndpointStatusResponse {
402 pub data: Option<String>,
404 pub error: Option<String>,
406}
407
408#[cfg_attr(feature = "python", gen_stub_pyclass)]
410#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
411#[cfg_attr(feature = "node", napi(object))]
412#[cfg_attr(feature = "rust", derive(Builder))]
413#[derive(Debug, Clone, Default, Serialize)]
414pub struct CreateTagRequest {
415 #[serde(skip_serializing_if = "Option::is_none")]
417 pub label: Option<String>,
418}
419
420#[cfg_attr(feature = "python", gen_stub_pyclass)]
422#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
423#[cfg_attr(feature = "node", napi(object))]
424#[derive(Debug, Clone, Serialize, Deserialize)]
425pub struct GetEndpointSecurityResponse {
426 pub data: Option<EndpointSecurity>,
428 pub error: Option<String>,
430}