Stripe.FileLink (stripity_stripe v2.17.3) View Source

Work with Stripe file_link objects.

You can:

  • Create a file link
  • Retrieve a file link
  • Update a file link
  • List all file links

Stripe API reference: https://stripe.com/docs/api/file_links

Link to this section Summary

Functions

Create a file according to Stripe's file_upload rules.

List all file links.

Retrieve a file_link.

Link to this section Types

Specs

t() :: %Stripe.FileLink{
  created: Stripe.timestamp(),
  expired: boolean(),
  expires_at: Stripe.timestamp() | nil,
  file: Stripe.id() | Stripe.FileUpload.t() | nil,
  id: Stripe.id(),
  livemode: boolean(),
  metadata: map(),
  object: String.t(),
  url: String.t() | nil
}

Link to this section Functions

Link to this function

create(params, opts \\ [])

View Source

Specs

create(params, Keyword.t()) :: {:ok, t()} | {:error, Stripe.Error.t()}
when params: %{
       :file => Stripe.id() | Stripe.FileUpload.t(),
       optional(:expires_at) => Stripe.timestamp(),
       optional(:metadata) => map()
     }

Create a file according to Stripe's file_upload rules.

Takes a map with required 'file' field with FileUpload id or FileUpload struct, and optional 'expires_at' timestamp and optional 'metadata' map.

Link to this function

list(params \\ %{}, opts \\ [])

View Source

Specs

list(params, Stripe.options()) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.Error.t()}
when params: %{
       optional(:created) =>
         Stripe.timestamp()
         | %{
             optional(:gt) => Stripe.timestamp(),
             optional(:gte) => Stripe.timestamp(),
             optional(:lt) => Stripe.timestamp(),
             optional(:lte) => Stripe.timestamp()
           },
       optional(:ending_before) => t() | Stripe.id(),
       optional(:expired) => boolean(),
       optional(:file) => t() | Stripe.id(),
       optional(:limit) => 1..100,
       optional(:starting_after) => t() | Stripe.id()
     }

List all file links.

Link to this function

retrieve(file_link, opts \\ [])

View Source

Specs

retrieve(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Retrieve a file_link.

Link to this function

update(file_link, params, opts \\ [])

View Source

Specs

update(Stripe.id() | t(), params, Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}
when params: %{
       optional(:expires_at) => String.t() | Stripe.timestamp(),
       optional(:metadata) => map()
     }

Update a file_link.

Accepts params for 'expires_at' and 'metadata'. The 'expires_at' param can be either a unix timestamp, or the string "now" to expire the link immediately. The 'metadata' on an existing file link can be unset by posting an empty map.