Skip to main content

stripe_connect/apps_secret/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Eq, PartialEq)]
6#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
7#[derive(serde::Serialize)]
8struct ListAppsSecretBuilder {
9    #[serde(skip_serializing_if = "Option::is_none")]
10    ending_before: Option<String>,
11    #[serde(skip_serializing_if = "Option::is_none")]
12    expand: Option<Vec<String>>,
13    #[serde(skip_serializing_if = "Option::is_none")]
14    limit: Option<i64>,
15    scope: ListAppsSecretScope,
16    #[serde(skip_serializing_if = "Option::is_none")]
17    starting_after: Option<String>,
18}
19#[cfg(feature = "redact-generated-debug")]
20impl std::fmt::Debug for ListAppsSecretBuilder {
21    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
22        f.debug_struct("ListAppsSecretBuilder").finish_non_exhaustive()
23    }
24}
25impl ListAppsSecretBuilder {
26    fn new(scope: impl Into<ListAppsSecretScope>) -> Self {
27        Self {
28            ending_before: None,
29            expand: None,
30            limit: None,
31            scope: scope.into(),
32            starting_after: None,
33        }
34    }
35}
36/// Specifies the scoping of the secret.
37/// Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
38#[derive(Clone, Eq, PartialEq)]
39#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
40#[derive(serde::Serialize)]
41pub struct ListAppsSecretScope {
42    /// The secret scope type.
43    #[serde(rename = "type")]
44    pub type_: ListAppsSecretScopeType,
45    /// The user ID.
46    /// This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
47    #[serde(skip_serializing_if = "Option::is_none")]
48    pub user: Option<String>,
49}
50#[cfg(feature = "redact-generated-debug")]
51impl std::fmt::Debug for ListAppsSecretScope {
52    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
53        f.debug_struct("ListAppsSecretScope").finish_non_exhaustive()
54    }
55}
56impl ListAppsSecretScope {
57    pub fn new(type_: impl Into<ListAppsSecretScopeType>) -> Self {
58        Self { type_: type_.into(), user: None }
59    }
60}
61/// The secret scope type.
62#[derive(Clone, Eq, PartialEq)]
63#[non_exhaustive]
64pub enum ListAppsSecretScopeType {
65    Account,
66    User,
67    /// An unrecognized value from Stripe. Should not be used as a request parameter.
68    Unknown(String),
69}
70impl ListAppsSecretScopeType {
71    pub fn as_str(&self) -> &str {
72        use ListAppsSecretScopeType::*;
73        match self {
74            Account => "account",
75            User => "user",
76            Unknown(v) => v,
77        }
78    }
79}
80
81impl std::str::FromStr for ListAppsSecretScopeType {
82    type Err = std::convert::Infallible;
83    fn from_str(s: &str) -> Result<Self, Self::Err> {
84        use ListAppsSecretScopeType::*;
85        match s {
86            "account" => Ok(Account),
87            "user" => Ok(User),
88            v => {
89                tracing::warn!("Unknown value '{}' for enum '{}'", v, "ListAppsSecretScopeType");
90                Ok(Unknown(v.to_owned()))
91            }
92        }
93    }
94}
95impl std::fmt::Display for ListAppsSecretScopeType {
96    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
97        f.write_str(self.as_str())
98    }
99}
100
101#[cfg(not(feature = "redact-generated-debug"))]
102impl std::fmt::Debug for ListAppsSecretScopeType {
103    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
104        f.write_str(self.as_str())
105    }
106}
107#[cfg(feature = "redact-generated-debug")]
108impl std::fmt::Debug for ListAppsSecretScopeType {
109    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
110        f.debug_struct(stringify!(ListAppsSecretScopeType)).finish_non_exhaustive()
111    }
112}
113impl serde::Serialize for ListAppsSecretScopeType {
114    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
115    where
116        S: serde::Serializer,
117    {
118        serializer.serialize_str(self.as_str())
119    }
120}
121#[cfg(feature = "deserialize")]
122impl<'de> serde::Deserialize<'de> for ListAppsSecretScopeType {
123    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
124        use std::str::FromStr;
125        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
126        Ok(Self::from_str(&s).expect("infallible"))
127    }
128}
129/// List all secrets stored on the given scope.
130#[derive(Clone)]
131#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
132#[derive(serde::Serialize)]
133pub struct ListAppsSecret {
134    inner: ListAppsSecretBuilder,
135}
136#[cfg(feature = "redact-generated-debug")]
137impl std::fmt::Debug for ListAppsSecret {
138    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
139        f.debug_struct("ListAppsSecret").finish_non_exhaustive()
140    }
141}
142impl ListAppsSecret {
143    /// Construct a new `ListAppsSecret`.
144    pub fn new(scope: impl Into<ListAppsSecretScope>) -> Self {
145        Self { inner: ListAppsSecretBuilder::new(scope.into()) }
146    }
147    /// A cursor for use in pagination.
148    /// `ending_before` is an object ID that defines your place in the list.
149    /// 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.
150    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
151        self.inner.ending_before = Some(ending_before.into());
152        self
153    }
154    /// Specifies which fields in the response should be expanded.
155    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
156        self.inner.expand = Some(expand.into());
157        self
158    }
159    /// A limit on the number of objects to be returned.
160    /// Limit can range between 1 and 100, and the default is 10.
161    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
162        self.inner.limit = Some(limit.into());
163        self
164    }
165    /// A cursor for use in pagination.
166    /// `starting_after` is an object ID that defines your place in the list.
167    /// 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.
168    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
169        self.inner.starting_after = Some(starting_after.into());
170        self
171    }
172}
173impl ListAppsSecret {
174    /// Send the request and return the deserialized response.
175    pub async fn send<C: StripeClient>(
176        &self,
177        client: &C,
178    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
179        self.customize().send(client).await
180    }
181
182    /// Send the request and return the deserialized response, blocking until completion.
183    pub fn send_blocking<C: StripeBlockingClient>(
184        &self,
185        client: &C,
186    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
187        self.customize().send_blocking(client)
188    }
189
190    pub fn paginate(
191        &self,
192    ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_connect::AppsSecret>> {
193        stripe_client_core::ListPaginator::new_list("/apps/secrets", &self.inner)
194    }
195}
196
197impl StripeRequest for ListAppsSecret {
198    type Output = stripe_types::List<stripe_connect::AppsSecret>;
199
200    fn build(&self) -> RequestBuilder {
201        RequestBuilder::new(StripeMethod::Get, "/apps/secrets").query(&self.inner)
202    }
203}
204#[derive(Clone, Eq, PartialEq)]
205#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
206#[derive(serde::Serialize)]
207struct FindAppsSecretBuilder {
208    #[serde(skip_serializing_if = "Option::is_none")]
209    expand: Option<Vec<String>>,
210    name: String,
211    scope: FindAppsSecretScope,
212}
213#[cfg(feature = "redact-generated-debug")]
214impl std::fmt::Debug for FindAppsSecretBuilder {
215    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
216        f.debug_struct("FindAppsSecretBuilder").finish_non_exhaustive()
217    }
218}
219impl FindAppsSecretBuilder {
220    fn new(name: impl Into<String>, scope: impl Into<FindAppsSecretScope>) -> Self {
221        Self { expand: None, name: name.into(), scope: scope.into() }
222    }
223}
224/// Specifies the scoping of the secret.
225/// Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
226#[derive(Clone, Eq, PartialEq)]
227#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
228#[derive(serde::Serialize)]
229pub struct FindAppsSecretScope {
230    /// The secret scope type.
231    #[serde(rename = "type")]
232    pub type_: FindAppsSecretScopeType,
233    /// The user ID.
234    /// This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
235    #[serde(skip_serializing_if = "Option::is_none")]
236    pub user: Option<String>,
237}
238#[cfg(feature = "redact-generated-debug")]
239impl std::fmt::Debug for FindAppsSecretScope {
240    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
241        f.debug_struct("FindAppsSecretScope").finish_non_exhaustive()
242    }
243}
244impl FindAppsSecretScope {
245    pub fn new(type_: impl Into<FindAppsSecretScopeType>) -> Self {
246        Self { type_: type_.into(), user: None }
247    }
248}
249/// The secret scope type.
250#[derive(Clone, Eq, PartialEq)]
251#[non_exhaustive]
252pub enum FindAppsSecretScopeType {
253    Account,
254    User,
255    /// An unrecognized value from Stripe. Should not be used as a request parameter.
256    Unknown(String),
257}
258impl FindAppsSecretScopeType {
259    pub fn as_str(&self) -> &str {
260        use FindAppsSecretScopeType::*;
261        match self {
262            Account => "account",
263            User => "user",
264            Unknown(v) => v,
265        }
266    }
267}
268
269impl std::str::FromStr for FindAppsSecretScopeType {
270    type Err = std::convert::Infallible;
271    fn from_str(s: &str) -> Result<Self, Self::Err> {
272        use FindAppsSecretScopeType::*;
273        match s {
274            "account" => Ok(Account),
275            "user" => Ok(User),
276            v => {
277                tracing::warn!("Unknown value '{}' for enum '{}'", v, "FindAppsSecretScopeType");
278                Ok(Unknown(v.to_owned()))
279            }
280        }
281    }
282}
283impl std::fmt::Display for FindAppsSecretScopeType {
284    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
285        f.write_str(self.as_str())
286    }
287}
288
289#[cfg(not(feature = "redact-generated-debug"))]
290impl std::fmt::Debug for FindAppsSecretScopeType {
291    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
292        f.write_str(self.as_str())
293    }
294}
295#[cfg(feature = "redact-generated-debug")]
296impl std::fmt::Debug for FindAppsSecretScopeType {
297    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
298        f.debug_struct(stringify!(FindAppsSecretScopeType)).finish_non_exhaustive()
299    }
300}
301impl serde::Serialize for FindAppsSecretScopeType {
302    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
303    where
304        S: serde::Serializer,
305    {
306        serializer.serialize_str(self.as_str())
307    }
308}
309#[cfg(feature = "deserialize")]
310impl<'de> serde::Deserialize<'de> for FindAppsSecretScopeType {
311    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
312        use std::str::FromStr;
313        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
314        Ok(Self::from_str(&s).expect("infallible"))
315    }
316}
317/// Finds a secret in the secret store by name and scope.
318#[derive(Clone)]
319#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
320#[derive(serde::Serialize)]
321pub struct FindAppsSecret {
322    inner: FindAppsSecretBuilder,
323}
324#[cfg(feature = "redact-generated-debug")]
325impl std::fmt::Debug for FindAppsSecret {
326    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
327        f.debug_struct("FindAppsSecret").finish_non_exhaustive()
328    }
329}
330impl FindAppsSecret {
331    /// Construct a new `FindAppsSecret`.
332    pub fn new(name: impl Into<String>, scope: impl Into<FindAppsSecretScope>) -> Self {
333        Self { inner: FindAppsSecretBuilder::new(name.into(), scope.into()) }
334    }
335    /// Specifies which fields in the response should be expanded.
336    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
337        self.inner.expand = Some(expand.into());
338        self
339    }
340}
341impl FindAppsSecret {
342    /// Send the request and return the deserialized response.
343    pub async fn send<C: StripeClient>(
344        &self,
345        client: &C,
346    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
347        self.customize().send(client).await
348    }
349
350    /// Send the request and return the deserialized response, blocking until completion.
351    pub fn send_blocking<C: StripeBlockingClient>(
352        &self,
353        client: &C,
354    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
355        self.customize().send_blocking(client)
356    }
357}
358
359impl StripeRequest for FindAppsSecret {
360    type Output = stripe_connect::AppsSecret;
361
362    fn build(&self) -> RequestBuilder {
363        RequestBuilder::new(StripeMethod::Get, "/apps/secrets/find").query(&self.inner)
364    }
365}
366#[derive(Clone, Eq, PartialEq)]
367#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
368#[derive(serde::Serialize)]
369struct CreateAppsSecretBuilder {
370    #[serde(skip_serializing_if = "Option::is_none")]
371    expand: Option<Vec<String>>,
372    #[serde(skip_serializing_if = "Option::is_none")]
373    expires_at: Option<stripe_types::Timestamp>,
374    name: String,
375    payload: String,
376    scope: CreateAppsSecretScope,
377}
378#[cfg(feature = "redact-generated-debug")]
379impl std::fmt::Debug for CreateAppsSecretBuilder {
380    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
381        f.debug_struct("CreateAppsSecretBuilder").finish_non_exhaustive()
382    }
383}
384impl CreateAppsSecretBuilder {
385    fn new(
386        name: impl Into<String>,
387        payload: impl Into<String>,
388        scope: impl Into<CreateAppsSecretScope>,
389    ) -> Self {
390        Self {
391            expand: None,
392            expires_at: None,
393            name: name.into(),
394            payload: payload.into(),
395            scope: scope.into(),
396        }
397    }
398}
399/// Specifies the scoping of the secret.
400/// Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
401#[derive(Clone, Eq, PartialEq)]
402#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
403#[derive(serde::Serialize)]
404pub struct CreateAppsSecretScope {
405    /// The secret scope type.
406    #[serde(rename = "type")]
407    pub type_: CreateAppsSecretScopeType,
408    /// The user ID.
409    /// This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
410    #[serde(skip_serializing_if = "Option::is_none")]
411    pub user: Option<String>,
412}
413#[cfg(feature = "redact-generated-debug")]
414impl std::fmt::Debug for CreateAppsSecretScope {
415    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
416        f.debug_struct("CreateAppsSecretScope").finish_non_exhaustive()
417    }
418}
419impl CreateAppsSecretScope {
420    pub fn new(type_: impl Into<CreateAppsSecretScopeType>) -> Self {
421        Self { type_: type_.into(), user: None }
422    }
423}
424/// The secret scope type.
425#[derive(Clone, Eq, PartialEq)]
426#[non_exhaustive]
427pub enum CreateAppsSecretScopeType {
428    Account,
429    User,
430    /// An unrecognized value from Stripe. Should not be used as a request parameter.
431    Unknown(String),
432}
433impl CreateAppsSecretScopeType {
434    pub fn as_str(&self) -> &str {
435        use CreateAppsSecretScopeType::*;
436        match self {
437            Account => "account",
438            User => "user",
439            Unknown(v) => v,
440        }
441    }
442}
443
444impl std::str::FromStr for CreateAppsSecretScopeType {
445    type Err = std::convert::Infallible;
446    fn from_str(s: &str) -> Result<Self, Self::Err> {
447        use CreateAppsSecretScopeType::*;
448        match s {
449            "account" => Ok(Account),
450            "user" => Ok(User),
451            v => {
452                tracing::warn!("Unknown value '{}' for enum '{}'", v, "CreateAppsSecretScopeType");
453                Ok(Unknown(v.to_owned()))
454            }
455        }
456    }
457}
458impl std::fmt::Display for CreateAppsSecretScopeType {
459    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
460        f.write_str(self.as_str())
461    }
462}
463
464#[cfg(not(feature = "redact-generated-debug"))]
465impl std::fmt::Debug for CreateAppsSecretScopeType {
466    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
467        f.write_str(self.as_str())
468    }
469}
470#[cfg(feature = "redact-generated-debug")]
471impl std::fmt::Debug for CreateAppsSecretScopeType {
472    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
473        f.debug_struct(stringify!(CreateAppsSecretScopeType)).finish_non_exhaustive()
474    }
475}
476impl serde::Serialize for CreateAppsSecretScopeType {
477    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
478    where
479        S: serde::Serializer,
480    {
481        serializer.serialize_str(self.as_str())
482    }
483}
484#[cfg(feature = "deserialize")]
485impl<'de> serde::Deserialize<'de> for CreateAppsSecretScopeType {
486    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
487        use std::str::FromStr;
488        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
489        Ok(Self::from_str(&s).expect("infallible"))
490    }
491}
492/// Create or replace a secret in the secret store.
493#[derive(Clone)]
494#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
495#[derive(serde::Serialize)]
496pub struct CreateAppsSecret {
497    inner: CreateAppsSecretBuilder,
498}
499#[cfg(feature = "redact-generated-debug")]
500impl std::fmt::Debug for CreateAppsSecret {
501    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
502        f.debug_struct("CreateAppsSecret").finish_non_exhaustive()
503    }
504}
505impl CreateAppsSecret {
506    /// Construct a new `CreateAppsSecret`.
507    pub fn new(
508        name: impl Into<String>,
509        payload: impl Into<String>,
510        scope: impl Into<CreateAppsSecretScope>,
511    ) -> Self {
512        Self { inner: CreateAppsSecretBuilder::new(name.into(), payload.into(), scope.into()) }
513    }
514    /// Specifies which fields in the response should be expanded.
515    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
516        self.inner.expand = Some(expand.into());
517        self
518    }
519    /// The Unix timestamp for the expiry time of the secret, after which the secret deletes.
520    pub fn expires_at(mut self, expires_at: impl Into<stripe_types::Timestamp>) -> Self {
521        self.inner.expires_at = Some(expires_at.into());
522        self
523    }
524}
525impl CreateAppsSecret {
526    /// Send the request and return the deserialized response.
527    pub async fn send<C: StripeClient>(
528        &self,
529        client: &C,
530    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
531        self.customize().send(client).await
532    }
533
534    /// Send the request and return the deserialized response, blocking until completion.
535    pub fn send_blocking<C: StripeBlockingClient>(
536        &self,
537        client: &C,
538    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
539        self.customize().send_blocking(client)
540    }
541}
542
543impl StripeRequest for CreateAppsSecret {
544    type Output = stripe_connect::AppsSecret;
545
546    fn build(&self) -> RequestBuilder {
547        RequestBuilder::new(StripeMethod::Post, "/apps/secrets").form(&self.inner)
548    }
549}
550#[derive(Clone, Eq, PartialEq)]
551#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
552#[derive(serde::Serialize)]
553struct DeleteWhereAppsSecretBuilder {
554    #[serde(skip_serializing_if = "Option::is_none")]
555    expand: Option<Vec<String>>,
556    name: String,
557    scope: DeleteWhereAppsSecretScope,
558}
559#[cfg(feature = "redact-generated-debug")]
560impl std::fmt::Debug for DeleteWhereAppsSecretBuilder {
561    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
562        f.debug_struct("DeleteWhereAppsSecretBuilder").finish_non_exhaustive()
563    }
564}
565impl DeleteWhereAppsSecretBuilder {
566    fn new(name: impl Into<String>, scope: impl Into<DeleteWhereAppsSecretScope>) -> Self {
567        Self { expand: None, name: name.into(), scope: scope.into() }
568    }
569}
570/// Specifies the scoping of the secret.
571/// Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
572#[derive(Clone, Eq, PartialEq)]
573#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
574#[derive(serde::Serialize)]
575pub struct DeleteWhereAppsSecretScope {
576    /// The secret scope type.
577    #[serde(rename = "type")]
578    pub type_: DeleteWhereAppsSecretScopeType,
579    /// The user ID.
580    /// This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
581    #[serde(skip_serializing_if = "Option::is_none")]
582    pub user: Option<String>,
583}
584#[cfg(feature = "redact-generated-debug")]
585impl std::fmt::Debug for DeleteWhereAppsSecretScope {
586    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
587        f.debug_struct("DeleteWhereAppsSecretScope").finish_non_exhaustive()
588    }
589}
590impl DeleteWhereAppsSecretScope {
591    pub fn new(type_: impl Into<DeleteWhereAppsSecretScopeType>) -> Self {
592        Self { type_: type_.into(), user: None }
593    }
594}
595/// The secret scope type.
596#[derive(Clone, Eq, PartialEq)]
597#[non_exhaustive]
598pub enum DeleteWhereAppsSecretScopeType {
599    Account,
600    User,
601    /// An unrecognized value from Stripe. Should not be used as a request parameter.
602    Unknown(String),
603}
604impl DeleteWhereAppsSecretScopeType {
605    pub fn as_str(&self) -> &str {
606        use DeleteWhereAppsSecretScopeType::*;
607        match self {
608            Account => "account",
609            User => "user",
610            Unknown(v) => v,
611        }
612    }
613}
614
615impl std::str::FromStr for DeleteWhereAppsSecretScopeType {
616    type Err = std::convert::Infallible;
617    fn from_str(s: &str) -> Result<Self, Self::Err> {
618        use DeleteWhereAppsSecretScopeType::*;
619        match s {
620            "account" => Ok(Account),
621            "user" => Ok(User),
622            v => {
623                tracing::warn!(
624                    "Unknown value '{}' for enum '{}'",
625                    v,
626                    "DeleteWhereAppsSecretScopeType"
627                );
628                Ok(Unknown(v.to_owned()))
629            }
630        }
631    }
632}
633impl std::fmt::Display for DeleteWhereAppsSecretScopeType {
634    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
635        f.write_str(self.as_str())
636    }
637}
638
639#[cfg(not(feature = "redact-generated-debug"))]
640impl std::fmt::Debug for DeleteWhereAppsSecretScopeType {
641    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
642        f.write_str(self.as_str())
643    }
644}
645#[cfg(feature = "redact-generated-debug")]
646impl std::fmt::Debug for DeleteWhereAppsSecretScopeType {
647    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
648        f.debug_struct(stringify!(DeleteWhereAppsSecretScopeType)).finish_non_exhaustive()
649    }
650}
651impl serde::Serialize for DeleteWhereAppsSecretScopeType {
652    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
653    where
654        S: serde::Serializer,
655    {
656        serializer.serialize_str(self.as_str())
657    }
658}
659#[cfg(feature = "deserialize")]
660impl<'de> serde::Deserialize<'de> for DeleteWhereAppsSecretScopeType {
661    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
662        use std::str::FromStr;
663        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
664        Ok(Self::from_str(&s).expect("infallible"))
665    }
666}
667/// Deletes a secret from the secret store by name and scope.
668#[derive(Clone)]
669#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
670#[derive(serde::Serialize)]
671pub struct DeleteWhereAppsSecret {
672    inner: DeleteWhereAppsSecretBuilder,
673}
674#[cfg(feature = "redact-generated-debug")]
675impl std::fmt::Debug for DeleteWhereAppsSecret {
676    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
677        f.debug_struct("DeleteWhereAppsSecret").finish_non_exhaustive()
678    }
679}
680impl DeleteWhereAppsSecret {
681    /// Construct a new `DeleteWhereAppsSecret`.
682    pub fn new(name: impl Into<String>, scope: impl Into<DeleteWhereAppsSecretScope>) -> Self {
683        Self { inner: DeleteWhereAppsSecretBuilder::new(name.into(), scope.into()) }
684    }
685    /// Specifies which fields in the response should be expanded.
686    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
687        self.inner.expand = Some(expand.into());
688        self
689    }
690}
691impl DeleteWhereAppsSecret {
692    /// Send the request and return the deserialized response.
693    pub async fn send<C: StripeClient>(
694        &self,
695        client: &C,
696    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
697        self.customize().send(client).await
698    }
699
700    /// Send the request and return the deserialized response, blocking until completion.
701    pub fn send_blocking<C: StripeBlockingClient>(
702        &self,
703        client: &C,
704    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
705        self.customize().send_blocking(client)
706    }
707}
708
709impl StripeRequest for DeleteWhereAppsSecret {
710    type Output = stripe_connect::AppsSecret;
711
712    fn build(&self) -> RequestBuilder {
713        RequestBuilder::new(StripeMethod::Post, "/apps/secrets/delete").form(&self.inner)
714    }
715}