Crosswake.Transfer.Contracts (crosswake v0.1.0)

View Source

Typed, versioned route-local transfer declarations for upload, download, import, and export seams.

Summary

Types

declaration()

@type declaration() :: Crosswake.Transfer.Contracts.Declaration.t()

destination()

@type destination() :: :app_sandbox | :user_visible_files | :phoenix_origin

direction()

@type direction() :: :inbound | :outbound

intent()

@type intent() :: :upload | :download | :import | :export

source()

@type source() :: :native_picker | :native_capture | :app_sandbox

state()

@type state() ::
  :queued
  | :preparing
  | :transferring
  | :awaiting_network
  | :verifying
  | :complete
  | :failed
  | :canceled

verification()

@type verification() :: :required | :none

Functions

intents()

@spec intents() :: [intent()]

new_declaration(attrs)

@spec new_declaration(keyword()) :: declaration()

new_result(attrs)

@spec new_result(keyword()) :: Crosswake.Transfer.Contracts.Result.t()

normalize_declaration(declaration)

@spec normalize_declaration(term()) :: {:ok, declaration()} | {:error, String.t()}

protocol()

@spec protocol() :: String.t()

transfer_states()

@spec transfer_states() :: [state()]

validate_picker_declaration(declaration)

@spec validate_picker_declaration(declaration()) ::
  :ok
  | {:error,
     :invalid_picker_direction | :invalid_picker_intent | :invalid_picker_source}

version()

@spec version() :: String.t()