Behaviour for DAV storage adapters (CalDAV and CardDAV).
Adapters return plain maps so the protocol layer is agnostic of any
particular ORM. A reference Postgres adapter ships in
ExDav.Storage.Postgres.
Both CalDAV and CardDAV use the same callbacks parameterised by kind:
plug ExDav.CalDav.Plug,
storage: ExDav.Storage.Postgres,
authenticator: {ExDav.Authenticator.Basic,
verify: {ExDav.Storage.Postgres, :authenticate}}
plug ExDav.CardDav.Plug,
storage: ExDav.Storage.Postgres,
authenticator: {ExDav.Authenticator.Basic,
verify: {ExDav.Storage.Postgres, :authenticate}}
Summary
Types
Callbacks
@callback create_collection( username(), kind(), collection_name(), create_collection_opts() ) :: {:ok, collection()} | {:error, :no_user | :already_exists | :invalid}
@callback delete_collection(username(), kind(), collection_name()) :: :ok | {:error, :not_found}
@callback delete_resource(username(), kind(), collection_name(), resource_name()) :: :ok | {:error, :not_found | :precondition_failed}
@callback get_collection(username(), kind(), collection_name()) :: collection() | nil
@callback get_collection_with_resources(username(), kind(), collection_name()) :: collection() | nil
@callback get_resource(username(), kind(), collection_name(), resource_name()) :: resource() | nil
@callback list_collections(username(), kind()) :: [collection()]
@callback put_resource( username(), kind(), collection_name(), resource_name(), body :: String.t() ) :: {:ok, resource()} | {:error, :not_found | :invalid}
@callback sync_changes( username(), kind(), collection_name(), since :: non_neg_integer() | nil ) :: {[resource()], [resource_name()], non_neg_integer()} | {:error, :not_found}
@callback update_collection(username(), kind(), collection_name(), update_props()) :: {:ok, collection()} | {:error, :not_found | :invalid}