DSpace.API.Operation.JSON (dspace_ex v0.2.0)

Copy Markdown View Source

Represents a JSON operation against the DSpace API.

This module is usually not used directly. Operation data structures are constructed by API operation modules. Building your own operations is useful in cases where dspace_ex doesn't support a specific API functionality yet.

The before_step field allows to specify a function to be called at execution time. It takes the operation, the client configuration and override options and allows to modify them before the HTTP request is made or produce other side effects based on their data.

Summary

Functions

Creates a new JSON operation from the given options.

Updates the operation with the given header.

Updates the operation with the given language option.

Updates the operation with the given param.

Types

t()

@type t() :: %DSpace.API.Operation.JSON{
  before_step: function() | nil,
  content_type: :json | :form | :multipart | :uri_list,
  data: map() | list() | binary() | nil,
  expected_status: [non_neg_integer()] | nil,
  headers: %{optional(atom()) => [binary()]},
  http_method: :get | :head | :post | :put | :patch | :delete,
  params: keyword(),
  path: binary(),
  stream_impl: function() | nil,
  supported_versions: %{
    required(:any | :dspace | :cris) => Version.requirement()
  },
  transformer: function(),
  version_overrides: [{binary(), keyword()}]
}

Functions

new(options)

@spec new(Enumerable.t()) :: t()

Creates a new JSON operation from the given options.

put_header(op, header, value)

@spec put_header(t(), atom(), binary() | list()) :: t()

Updates the operation with the given header.

put_lang(op, options)

@spec put_lang(
  t(),
  keyword()
) :: t()

Updates the operation with the given language option.

Options

put_param(op, key, value)

@spec put_param(t(), atom(), term()) :: t()

Updates the operation with the given param.