use stripe_client_core::{
RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
};
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct ListFileLinkBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
created: Option<stripe_types::RangeQueryTs>,
#[serde(skip_serializing_if = "Option::is_none")]
ending_before: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
expired: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
file: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
starting_after: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListFileLinkBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListFileLinkBuilder").finish_non_exhaustive()
}
}
impl ListFileLinkBuilder {
fn new() -> Self {
Self {
created: None,
ending_before: None,
expand: None,
expired: None,
file: None,
limit: None,
starting_after: None,
}
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ListFileLink {
inner: ListFileLinkBuilder,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListFileLink {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListFileLink").finish_non_exhaustive()
}
}
impl ListFileLink {
pub fn new() -> Self {
Self { inner: ListFileLinkBuilder::new() }
}
pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
self.inner.created = Some(created.into());
self
}
pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
self.inner.ending_before = Some(ending_before.into());
self
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
pub fn expired(mut self, expired: impl Into<bool>) -> Self {
self.inner.expired = Some(expired.into());
self
}
pub fn file(mut self, file: impl Into<String>) -> Self {
self.inner.file = Some(file.into());
self
}
pub fn limit(mut self, limit: impl Into<i64>) -> Self {
self.inner.limit = Some(limit.into());
self
}
pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
self.inner.starting_after = Some(starting_after.into());
self
}
}
impl Default for ListFileLink {
fn default() -> Self {
Self::new()
}
}
impl ListFileLink {
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
pub fn paginate(
&self,
) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::FileLink>> {
stripe_client_core::ListPaginator::new_list("/file_links", &self.inner)
}
}
impl StripeRequest for ListFileLink {
type Output = stripe_types::List<stripe_shared::FileLink>;
fn build(&self) -> RequestBuilder {
RequestBuilder::new(StripeMethod::Get, "/file_links").query(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct RetrieveFileLinkBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrieveFileLinkBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RetrieveFileLinkBuilder").finish_non_exhaustive()
}
}
impl RetrieveFileLinkBuilder {
fn new() -> Self {
Self { expand: None }
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct RetrieveFileLink {
inner: RetrieveFileLinkBuilder,
link: stripe_shared::FileLinkId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrieveFileLink {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RetrieveFileLink").finish_non_exhaustive()
}
}
impl RetrieveFileLink {
pub fn new(link: impl Into<stripe_shared::FileLinkId>) -> Self {
Self { link: link.into(), inner: RetrieveFileLinkBuilder::new() }
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
}
impl RetrieveFileLink {
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
}
impl StripeRequest for RetrieveFileLink {
type Output = stripe_shared::FileLink;
fn build(&self) -> RequestBuilder {
let link = &self.link;
RequestBuilder::new(StripeMethod::Get, format!("/file_links/{link}")).query(&self.inner)
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct CreateFileLinkBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
expires_at: Option<stripe_types::Timestamp>,
file: String,
#[serde(skip_serializing_if = "Option::is_none")]
metadata: Option<std::collections::HashMap<String, String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreateFileLinkBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreateFileLinkBuilder").finish_non_exhaustive()
}
}
impl CreateFileLinkBuilder {
fn new(file: impl Into<String>) -> Self {
Self { expand: None, expires_at: None, file: file.into(), metadata: None }
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreateFileLink {
inner: CreateFileLinkBuilder,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreateFileLink {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreateFileLink").finish_non_exhaustive()
}
}
impl CreateFileLink {
pub fn new(file: impl Into<String>) -> Self {
Self { inner: CreateFileLinkBuilder::new(file.into()) }
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
pub fn expires_at(mut self, expires_at: impl Into<stripe_types::Timestamp>) -> Self {
self.inner.expires_at = Some(expires_at.into());
self
}
pub fn metadata(
mut self,
metadata: impl Into<std::collections::HashMap<String, String>>,
) -> Self {
self.inner.metadata = Some(metadata.into());
self
}
}
impl CreateFileLink {
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
}
impl StripeRequest for CreateFileLink {
type Output = stripe_shared::FileLink;
fn build(&self) -> RequestBuilder {
RequestBuilder::new(StripeMethod::Post, "/file_links").form(&self.inner)
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct UpdateFileLinkBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
expires_at: Option<UpdateFileLinkExpiresAt>,
#[serde(skip_serializing_if = "Option::is_none")]
metadata: Option<std::collections::HashMap<String, String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdateFileLinkBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdateFileLinkBuilder").finish_non_exhaustive()
}
}
impl UpdateFileLinkBuilder {
fn new() -> Self {
Self { expand: None, expires_at: None, metadata: None }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub enum UpdateFileLinkExpiresAt {
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdateFileLinkExpiresAt {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdateFileLinkExpiresAt").finish_non_exhaustive()
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdateFileLink {
inner: UpdateFileLinkBuilder,
link: stripe_shared::FileLinkId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdateFileLink {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdateFileLink").finish_non_exhaustive()
}
}
impl UpdateFileLink {
pub fn new(link: impl Into<stripe_shared::FileLinkId>) -> Self {
Self { link: link.into(), inner: UpdateFileLinkBuilder::new() }
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
pub fn expires_at(mut self, expires_at: impl Into<UpdateFileLinkExpiresAt>) -> Self {
self.inner.expires_at = Some(expires_at.into());
self
}
pub fn metadata(
mut self,
metadata: impl Into<std::collections::HashMap<String, String>>,
) -> Self {
self.inner.metadata = Some(metadata.into());
self
}
}
impl UpdateFileLink {
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
}
impl StripeRequest for UpdateFileLink {
type Output = stripe_shared::FileLink;
fn build(&self) -> RequestBuilder {
let link = &self.link;
RequestBuilder::new(StripeMethod::Post, format!("/file_links/{link}")).form(&self.inner)
}
}