Package 'omekasr'

Title: Interact with the Omeka S API from R
Description: Interact with the Omeka S API from R.
Authors: Giorgio Comai [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-0515-9542>)
Maintainer: Giorgio Comai <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9003
Built: 2026-05-21 08:57:34 UTC
Source: https://codeberg.org/giocomai/omekasr

Help Index


Checks if the base url given or set for the session can be parsed

Description

Checks if the base url given or set for the session can be parsed

Usage

o_check_url(base_url = NULL, silent = FALSE, error = TRUE)

Arguments

base_url

Endpoint of the API of the Omeka installation, or base url of the website. Internally, it is ensured that the api suffix is always appended to the given url.

silent

Logical, defaults to FALSE. If TRUE, the function does not print informative messages related to this check.

error

Logical, defaults to TRUE. If TRUE, the function throws an error if this check fails.

Value

A list with three elements: valid (either TRUE or FALSE), value (returning base_url), and message (returning an informative message about the result of the check, typically shown with cli::cli_inform()).

Examples

try(
  o_check_url("wrong_url/api")
  )

o_check_url("wrong_url/api", error = FALSE)

o_check_url("http://127.0.0.0")

Retrieve results from Omeka S API

Description

Retrieve results from Omeka S API

Usage

o_get(id, type = c("items", "properties"), base_url = NULL)

Arguments

id

An Omeka S numeric identifier.

type

Defaults to "items". Accepted values include "item" and "properties".

base_url

Endpoint of the API of the Omeka installation, or base url of the website. Internally, it is ensured that the api suffix is always appended to the given url.

Value

A list object, with attributes detailing the source url, the type of API endpoint called, and the timestamp of data retrieval.

Examples

## Not run: 
  o_get(id = 123, type = "items")
  o_get(id = "123", type = "items") # id can be given as character
  o_get(id = 12, type = "properties")

## End(Not run)

Retrieve Omeka S item based on id

Description

Retrieve Omeka S item based on id

Usage

o_get_item(item_id, base_url = NULL)

Arguments

item_id

The numeric identifier of an Omeka S item.

base_url

Defaults to NULL, typically set for the active session with o_set().

Value

A list object, with everything returned by the API.

Examples

## Not run: 
  o_get_item(id = 123)

## End(Not run)

Retrieve Omeka S property based on id

Description

Retrieve Omeka S property based on id

Usage

o_get_property(property_id, base_url = NULL)

Arguments

property_id

The numeric identifier of an Omeka S property.

base_url

Defaults to NULL, typically set for the active session with o_set().

Value

A list object, with everything returned by the API.

Examples

## Not run: 
  o_get_property(property_id = 12)

## End(Not run)

Sets settings for the current session.

Description

Sets settings for the current session.

Usage

o_set(base_url = NULL, error = TRUE)

Arguments

base_url

Endpoint of the API of the Omeka installation, or base url of the website. Internally, it is ensured that the api suffix is always appended to the given url.

error

Defaults to TRUE. Passed to o_check_url(). If TRUE, throws an error if the url set or retrieved is invalid.

Value

Invisibly, the settings as a list.

Examples

o_set(base_url = "https://example.com/api")

base_url <- o_set()[["base_url"]]

base_url

Situation report

Description

Performs a set of tests for troubleshooting common issues, and provides informative message.

Usage

o_sitrep(base_url = NULL)

Arguments

base_url

Endpoint of the API of the Omeka installation, or base url of the website. Internally, it is ensured that the api suffix is always appended to the given url.

Value

Nothing, used for its side effects.

Examples

o_sitrep()

S7 class representing an Omeka S item

Description

S7 class representing an Omeka S item

Usage

omekas_item(
  data = list(),
  url = character(0),
  type = character(0),
  retrieved_at = Sys.time(),
  id = integer(0)
)

Arguments

data

A list; the parsed json from the API response.

url

Full URL from where the response was retrieved.

type

The type of contents or resource retrieved from the API, e.g. "items", or "properties".

retrieved_at

Time when the given resource was retrieved.

id

Numeric, the identifier of the resource requested.


S7 class representing an Omeka S property

Description

S7 class representing an Omeka S property

Usage

omekas_property(
  data = list(),
  url = character(0),
  type = character(0),
  retrieved_at = Sys.time(),
  id = integer(0)
)

Arguments

data

A list; the parsed json from the API response.

url

Full URL from where the response was retrieved.

type

The type of contents or resource retrieved from the API, e.g. "items", or "properties".

retrieved_at

Time when the given resource was retrieved.

id

Numeric, the identifier of the resource requested.


S7 class representing an Omeka S API response

Description

S7 class representing an Omeka S API response

Usage

omekas_response(
  data = list(),
  url = character(0),
  type = character(0),
  retrieved_at = Sys.time()
)

Arguments

data

A list; the parsed json from the API response.

url

Full URL from where the response was retrieved.

type

The type of contents or resource retrieved from the API, e.g. "items", or "properties".

retrieved_at

Time when the given resource was retrieved.