Specifies the behaviour of an API resource module.
Summary
Types
Represents a "DSpace Object" UUID.
Represents the preferred language for metadata when retrieving a resource.
Represents a single metadata update to a resource.
Callbacks
Builds an operation to create a new resource on DSpace.
Builds an operation to delete a resource on DSpace.
Builds an operation to fetch a single resource by UUID.
Builds an operation to fetch resources via DSpace search ("discovery").
Builds an operation to fetch a list of resources.
Builds an operation to replace a resource on DSpace.
Builds an operation to update an existing resource on DSpace.
Types
@type dso_uuid() :: binary()
Represents a "DSpace Object" UUID.
Most repository entities (community, collection, item, user, user group, file, etc.) called "objects" in DSpace-speak will have such a UUID.
@type options() :: keyword()
@type preferred_language() :: :all | atom() | binary() | [atom() | binary()] | %{required(atom()) => [binary()]} | nil
Represents the preferred language for metadata when retrieving a resource.
Note that if the preferred language is not available for a given metadata value, all language variants of that value will be returned by the server.
Can be either
:all- Returns all language variants (default)- a language tag as an atom or string (e.g.
:en). - a list of language tags as atoms or strings (e.g.
[:en, :de_AT]). This will send anAccept-Languageheader with quality values derived from list order - an
Accept-Languageheader value as a string (e.g.en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7). - an
Accept-Languageheader (e.g.%{:accept_language => ["fr-CH,fr;q=0.9,en;q=0.8,de;q=0.7"]}}) nil- Returns the server default
@type update() :: DSpace.API.Model.ResourceUpdate.t() | %{required(binary()) => binary() | nil}
Represents a single metadata update to a resource.
Can be either
- a
DSpace.API.Model.ResourceUpdate.t/0 - a plain string-keyed map
Examples
%DSpace.API.Resource{
op: :replace,
path: "/metadata/dc.title/0/value",
value: "New Title"
}
%{
"op" => "replace",
"path" => "/metadata/dc.title/0/value",
"value" => "New Title"
}
Callbacks
@callback create(map(), options()) :: DSpace.API.Operation.t()
Builds an operation to create a new resource on DSpace.
@callback delete(binary(), options()) :: DSpace.API.Operation.t()
Builds an operation to delete a resource on DSpace.
@callback fetch(dso_uuid(), options()) :: DSpace.API.Operation.t()
Builds an operation to fetch a single resource by UUID.
@callback find(options()) :: DSpace.API.Operation.t()
Builds an operation to fetch resources via DSpace search ("discovery").
@callback list(options()) :: DSpace.API.Operation.t()
Builds an operation to fetch a list of resources.
@callback replace(dso_uuid(), map(), options()) :: DSpace.API.Operation.t()
Builds an operation to replace a resource on DSpace.
@callback update(dso_uuid(), [update()], options()) :: DSpace.API.Operation.t()
Builds an operation to update an existing resource on DSpace.
The payload is a list of update/0.