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)]
14#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
15#[cfg_attr(feature = "node", napi(object))]
16#[cfg_attr(feature = "rust", derive(Builder))]
17#[derive(Debug, Clone, Default, Serialize)]
18pub struct GetUsageRequest {
19 #[serde(skip_serializing_if = "Option::is_none")]
21 pub start_time: Option<i64>,
22 #[serde(skip_serializing_if = "Option::is_none")]
24 pub end_time: Option<i64>,
25}
26
27#[cfg_attr(feature = "python", gen_stub_pyclass)]
29#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
30#[cfg_attr(feature = "node", napi(object))]
31#[derive(Debug, Clone, Serialize, Deserialize)]
32pub struct UsageData {
33 pub credits_used: i64,
35 pub credits_remaining: Option<i64>,
37 pub limit: Option<i64>,
39 pub overages: Option<i64>,
41 pub start_time: i64,
43 pub end_time: i64,
45}
46
47#[cfg_attr(feature = "python", gen_stub_pyclass)]
49#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
50#[cfg_attr(feature = "node", napi(object))]
51#[derive(Debug, Clone, Serialize, Deserialize)]
52pub struct GetUsageResponse {
53 pub data: Option<UsageData>,
55 pub error: Option<String>,
57}
58
59#[cfg_attr(feature = "python", gen_stub_pyclass)]
61#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
62#[cfg_attr(feature = "node", napi(object))]
63#[derive(Debug, Clone, Serialize, Deserialize)]
64pub struct EndpointUsage {
65 pub name: String,
67 pub chain: Option<String>,
69 pub network: Option<String>,
71 pub status: Option<String>,
73 pub credits_used: i64,
75 pub label: Option<String>,
77 #[serde(default)]
79 pub methods_breakdown: Vec<MethodUsage>,
80 pub requests: Option<i64>,
82}
83
84#[cfg_attr(feature = "python", gen_stub_pyclass)]
86#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
87#[cfg_attr(feature = "node", napi(object))]
88#[derive(Debug, Clone, Serialize, Deserialize)]
89pub struct MethodUsage {
90 pub method_name: String,
92 pub credits_used: i64,
94 pub archive: Option<bool>,
96 pub network: Option<String>,
98 pub chain: Option<String>,
100}
101
102#[cfg_attr(feature = "python", gen_stub_pyclass)]
104#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
105#[cfg_attr(feature = "node", napi(object))]
106#[derive(Debug, Clone, Serialize, Deserialize)]
107pub struct ChainUsage {
108 pub name: String,
110 pub credits_used: i64,
112}
113
114#[cfg_attr(feature = "python", gen_stub_pyclass)]
116#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
117#[cfg_attr(feature = "node", napi(object))]
118#[derive(Debug, Clone, Serialize, Deserialize)]
119pub struct UsageByEndpointData {
120 #[serde(default)]
122 pub endpoints: Vec<EndpointUsage>,
123 pub start_time: Option<i64>,
125 pub end_time: Option<i64>,
127}
128
129#[cfg_attr(feature = "python", gen_stub_pyclass)]
131#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
132#[cfg_attr(feature = "node", napi(object))]
133#[derive(Debug, Clone, Serialize, Deserialize)]
134pub struct GetUsageByEndpointResponse {
135 pub data: Option<UsageByEndpointData>,
137 pub error: Option<String>,
139}
140
141#[cfg_attr(feature = "python", gen_stub_pyclass)]
143#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
144#[cfg_attr(feature = "node", napi(object))]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146pub struct UsageByMethodData {
147 #[serde(default)]
149 pub methods: Vec<MethodUsage>,
150 pub start_time: Option<i64>,
152 pub end_time: Option<i64>,
154}
155
156#[cfg_attr(feature = "python", gen_stub_pyclass)]
158#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
159#[cfg_attr(feature = "node", napi(object))]
160#[derive(Debug, Clone, Serialize, Deserialize)]
161pub struct GetUsageByMethodResponse {
162 pub data: Option<UsageByMethodData>,
164 pub error: Option<String>,
166}
167
168#[cfg_attr(feature = "python", gen_stub_pyclass)]
170#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
171#[cfg_attr(feature = "node", napi(object))]
172#[derive(Debug, Clone, Serialize, Deserialize)]
173pub struct UsageByChainData {
174 #[serde(default)]
176 pub chains: Vec<ChainUsage>,
177 pub start_time: Option<i64>,
179 pub end_time: Option<i64>,
181}
182
183#[cfg_attr(feature = "python", gen_stub_pyclass)]
185#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
186#[cfg_attr(feature = "node", napi(object))]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188pub struct GetUsageByChainResponse {
189 pub data: Option<UsageByChainData>,
191 pub error: Option<String>,
193}
194
195#[cfg_attr(feature = "python", gen_stub_pyclass)]
197#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
198#[cfg_attr(feature = "node", napi(object))]
199#[derive(Debug, Clone, Serialize, Deserialize)]
200pub struct TagUsage {
201 pub tag_id: Option<i32>,
203 pub label: String,
205 pub credits_used: i64,
207 pub requests: i64,
209}
210
211#[cfg_attr(feature = "python", gen_stub_pyclass)]
213#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
214#[cfg_attr(feature = "node", napi(object))]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216pub struct UsageByTagData {
217 #[serde(default)]
219 pub tags: Vec<TagUsage>,
220 pub start_time: Option<i64>,
222 pub end_time: Option<i64>,
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 GetUsageByTagResponse {
232 pub data: Option<UsageByTagData>,
234 pub error: Option<String>,
236}