DSpace.API.Resource behaviour (dspace_ex v0.2.0)

Copy Markdown View Source

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

dso_uuid()

@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.

options()

@type options() :: keyword()

preferred_language()

@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 an Accept-Language header with quality values derived from list order
  • an Accept-Language header value as a string (e.g.en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7).
  • an Accept-Language header (e.g. %{:accept_language => ["fr-CH,fr;q=0.9,en;q=0.8,de;q=0.7"]}})
  • nil - Returns the server default

update()

@type update() ::
  DSpace.API.Model.ResourceUpdate.t() | %{required(binary()) => binary() | nil}

Represents a single metadata update to a resource.

Can be either

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

create(map, options)

(optional)
@callback create(map(), options()) :: DSpace.API.Operation.t()

Builds an operation to create a new resource on DSpace.

delete(binary, options)

(optional)
@callback delete(binary(), options()) :: DSpace.API.Operation.t()

Builds an operation to delete a resource on DSpace.

fetch(dso_uuid, options)

@callback fetch(dso_uuid(), options()) :: DSpace.API.Operation.t()

Builds an operation to fetch a single resource by UUID.

find(options)

(optional)
@callback find(options()) :: DSpace.API.Operation.t()

Builds an operation to fetch resources via DSpace search ("discovery").

list(options)

@callback list(options()) :: DSpace.API.Operation.t()

Builds an operation to fetch a list of resources.

replace(dso_uuid, map, options)

(optional)
@callback replace(dso_uuid(), map(), options()) :: DSpace.API.Operation.t()

Builds an operation to replace a resource on DSpace.

update(dso_uuid, list, options)

(optional)
@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.