Skip to main content

quicknode_sdk/admin/
bulk.rs

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/// Parameters for `bulk_update_endpoint_status`.
12#[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 BulkUpdateEndpointStatusRequest {
18    /// Endpoint ids to update.
19    pub ids: Vec<String>,
20    /// Target status (`active` or `paused`).
21    pub status: String,
22}
23
24/// Per-endpoint result within a bulk response.
25#[cfg_attr(feature = "python", gen_stub_pyclass)]
26#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
27#[cfg_attr(feature = "node", napi(object))]
28#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct BulkOperationResult {
30    /// Endpoint id the result refers to.
31    pub id: String,
32    /// Whether the operation succeeded for this endpoint.
33    pub success: bool,
34}
35
36/// Summary data for a `bulk_update_endpoint_status` response.
37#[cfg_attr(feature = "python", gen_stub_pyclass)]
38#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
39#[cfg_attr(feature = "node", napi(object))]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41pub struct BulkUpdateEndpointStatusData {
42    /// Total number of endpoints processed.
43    pub total: i32,
44    /// Number successfully updated.
45    pub updated_count: i32,
46    /// Number that failed.
47    pub failed_count: i32,
48    /// Per-endpoint outcomes.
49    #[serde(default)]
50    pub results: Vec<BulkOperationResult>,
51}
52
53/// Response from `bulk_update_endpoint_status`.
54#[cfg_attr(feature = "python", gen_stub_pyclass)]
55#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
56#[cfg_attr(feature = "node", napi(object))]
57#[derive(Debug, Clone, Serialize, Deserialize)]
58pub struct BulkUpdateEndpointStatusResponse {
59    /// Bulk update summary.
60    pub data: Option<BulkUpdateEndpointStatusData>,
61    /// Error message when the request did not succeed.
62    pub error: Option<String>,
63}
64
65/// Parameters for `bulk_add_tag`.
66#[cfg_attr(feature = "python", gen_stub_pyclass)]
67#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
68#[cfg_attr(feature = "node", napi(object))]
69#[cfg_attr(feature = "rust", derive(Builder))]
70#[derive(Debug, Clone, Default, Serialize)]
71pub struct BulkAddTagRequest {
72    /// Endpoint ids to tag.
73    pub ids: Vec<String>,
74    /// Label of the tag to apply (created if it doesn't exist).
75    pub label: String,
76}
77
78/// Tag reference returned on bulk tag operations.
79#[cfg_attr(feature = "python", gen_stub_pyclass)]
80#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
81#[cfg_attr(feature = "node", napi(object))]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83pub struct BulkTag {
84    /// Tag identifier.
85    pub tag_id: i32,
86    /// Tag label.
87    pub label: String,
88}
89
90/// Summary data for a `bulk_add_tag` response.
91#[cfg_attr(feature = "python", gen_stub_pyclass)]
92#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
93#[cfg_attr(feature = "node", napi(object))]
94#[derive(Debug, Clone, Serialize, Deserialize)]
95pub struct BulkAddTagData {
96    /// Total number of endpoints processed.
97    pub total: i32,
98    /// Number successfully tagged.
99    pub updated_count: i32,
100    /// Number that failed.
101    pub failed_count: i32,
102    /// Per-endpoint outcomes.
103    #[serde(default)]
104    pub results: Vec<BulkOperationResult>,
105    /// The tag that was applied.
106    pub tag: BulkTag,
107}
108
109/// Response from `bulk_add_tag`.
110#[cfg_attr(feature = "python", gen_stub_pyclass)]
111#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
112#[cfg_attr(feature = "node", napi(object))]
113#[derive(Debug, Clone, Serialize, Deserialize)]
114pub struct BulkAddTagResponse {
115    /// Bulk add-tag summary.
116    pub data: Option<BulkAddTagData>,
117    /// Error message when the request did not succeed.
118    pub error: Option<String>,
119}
120
121/// Parameters for `bulk_remove_tag`.
122#[cfg_attr(feature = "python", gen_stub_pyclass)]
123#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
124#[cfg_attr(feature = "node", napi(object))]
125#[cfg_attr(feature = "rust", derive(Builder))]
126#[derive(Debug, Clone, Default, Serialize)]
127pub struct BulkRemoveTagRequest {
128    /// Endpoint ids to untag.
129    pub ids: Vec<String>,
130    /// Tag to remove.
131    pub tag_id: i32,
132}
133
134/// Summary data for a `bulk_remove_tag` response.
135#[cfg_attr(feature = "python", gen_stub_pyclass)]
136#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
137#[cfg_attr(feature = "node", napi(object))]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139pub struct BulkRemoveTagData {
140    /// Total number of endpoints processed.
141    pub total: i32,
142    /// Number successfully updated.
143    pub updated_count: i32,
144    /// Number that failed.
145    pub failed_count: i32,
146    /// Per-endpoint outcomes.
147    #[serde(default)]
148    pub results: Vec<BulkOperationResult>,
149}
150
151/// Response from `bulk_remove_tag`.
152#[cfg_attr(feature = "python", gen_stub_pyclass)]
153#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
154#[cfg_attr(feature = "node", napi(object))]
155#[derive(Debug, Clone, Serialize, Deserialize)]
156pub struct BulkRemoveTagResponse {
157    /// Bulk remove-tag summary.
158    pub data: Option<BulkRemoveTagData>,
159    /// Error message when the request did not succeed.
160    pub error: Option<String>,
161}