stripe_misc/scheduled_query_run/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Debug, serde::Serialize)]
6struct ListScheduledQueryRunBuilder {
7    #[serde(skip_serializing_if = "Option::is_none")]
8    ending_before: Option<String>,
9    #[serde(skip_serializing_if = "Option::is_none")]
10    expand: Option<Vec<String>>,
11    #[serde(skip_serializing_if = "Option::is_none")]
12    limit: Option<i64>,
13    #[serde(skip_serializing_if = "Option::is_none")]
14    starting_after: Option<String>,
15}
16impl ListScheduledQueryRunBuilder {
17    fn new() -> Self {
18        Self { ending_before: None, expand: None, limit: None, starting_after: None }
19    }
20}
21/// Returns a list of scheduled query runs.
22#[derive(Clone, Debug, serde::Serialize)]
23pub struct ListScheduledQueryRun {
24    inner: ListScheduledQueryRunBuilder,
25}
26impl ListScheduledQueryRun {
27    /// Construct a new `ListScheduledQueryRun`.
28    pub fn new() -> Self {
29        Self { inner: ListScheduledQueryRunBuilder::new() }
30    }
31    /// A cursor for use in pagination.
32    /// `ending_before` is an object ID that defines your place in the list.
33    /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
34    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
35        self.inner.ending_before = Some(ending_before.into());
36        self
37    }
38    /// Specifies which fields in the response should be expanded.
39    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
40        self.inner.expand = Some(expand.into());
41        self
42    }
43    /// A limit on the number of objects to be returned.
44    /// Limit can range between 1 and 100, and the default is 10.
45    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
46        self.inner.limit = Some(limit.into());
47        self
48    }
49    /// A cursor for use in pagination.
50    /// `starting_after` is an object ID that defines your place in the list.
51    /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
52    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
53        self.inner.starting_after = Some(starting_after.into());
54        self
55    }
56}
57impl Default for ListScheduledQueryRun {
58    fn default() -> Self {
59        Self::new()
60    }
61}
62impl ListScheduledQueryRun {
63    /// Send the request and return the deserialized response.
64    pub async fn send<C: StripeClient>(
65        &self,
66        client: &C,
67    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
68        self.customize().send(client).await
69    }
70
71    /// Send the request and return the deserialized response, blocking until completion.
72    pub fn send_blocking<C: StripeBlockingClient>(
73        &self,
74        client: &C,
75    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
76        self.customize().send_blocking(client)
77    }
78
79    pub fn paginate(
80        &self,
81    ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_misc::ScheduledQueryRun>> {
82        stripe_client_core::ListPaginator::new_list("/sigma/scheduled_query_runs", &self.inner)
83    }
84}
85
86impl StripeRequest for ListScheduledQueryRun {
87    type Output = stripe_types::List<stripe_misc::ScheduledQueryRun>;
88
89    fn build(&self) -> RequestBuilder {
90        RequestBuilder::new(StripeMethod::Get, "/sigma/scheduled_query_runs").query(&self.inner)
91    }
92}
93#[derive(Clone, Debug, serde::Serialize)]
94struct RetrieveScheduledQueryRunBuilder {
95    #[serde(skip_serializing_if = "Option::is_none")]
96    expand: Option<Vec<String>>,
97}
98impl RetrieveScheduledQueryRunBuilder {
99    fn new() -> Self {
100        Self { expand: None }
101    }
102}
103/// Retrieves the details of an scheduled query run.
104#[derive(Clone, Debug, serde::Serialize)]
105pub struct RetrieveScheduledQueryRun {
106    inner: RetrieveScheduledQueryRunBuilder,
107    scheduled_query_run: String,
108}
109impl RetrieveScheduledQueryRun {
110    /// Construct a new `RetrieveScheduledQueryRun`.
111    pub fn new(scheduled_query_run: impl Into<String>) -> Self {
112        Self {
113            scheduled_query_run: scheduled_query_run.into(),
114            inner: RetrieveScheduledQueryRunBuilder::new(),
115        }
116    }
117    /// Specifies which fields in the response should be expanded.
118    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
119        self.inner.expand = Some(expand.into());
120        self
121    }
122}
123impl RetrieveScheduledQueryRun {
124    /// Send the request and return the deserialized response.
125    pub async fn send<C: StripeClient>(
126        &self,
127        client: &C,
128    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
129        self.customize().send(client).await
130    }
131
132    /// Send the request and return the deserialized response, blocking until completion.
133    pub fn send_blocking<C: StripeBlockingClient>(
134        &self,
135        client: &C,
136    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
137        self.customize().send_blocking(client)
138    }
139}
140
141impl StripeRequest for RetrieveScheduledQueryRun {
142    type Output = stripe_misc::ScheduledQueryRun;
143
144    fn build(&self) -> RequestBuilder {
145        let scheduled_query_run = &self.scheduled_query_run;
146        RequestBuilder::new(
147            StripeMethod::Get,
148            format!("/sigma/scheduled_query_runs/{scheduled_query_run}"),
149        )
150        .query(&self.inner)
151    }
152}