NekUpload.metadata.user module

class NekUpload.metadata.user.InvenioOrgInfo(name: str)[source]

Bases: InvenioUserInfo

Holds information about an organisation in the format expected from InvenioRDM. Effectively a model for the InvenioRDM Author as an Organisation field.

classmethod from_json(data: dict[str, Any]) InvenioOrgInfo[source]

Deserialise json serialisable object to reconstruct an object of this class.

Parameters:

data (Dict[str,Any]) – JSON serialisable object

Returns:

Reconstructed object

Return type:

InvenioOrgInfo

get_info() dict[str, Any][source]

Return the json payload package, formatted in a way InvenioRDM API expects

Returns:

json payload package, formatted in a way InvenioRDM API expects

Return type:

Dict[str,Any]

to_json_serialisable()[source]

Return a json serialisable object representing this class

Returns:

JSON serialisable object

Return type:

Dict[str,Any]

class NekUpload.metadata.user.InvenioPersonInfo(given_name: str, family_name: str)[source]

Bases: InvenioUserInfo

Holds information about a person in the format expected from InvenioRDM. Effectively a model for the InvenioRDM Author as a Person field.

classmethod from_json(data: dict[str, Any]) InvenioPersonInfo[source]

Deserialise json serialisable object to reconstruct an object of this class.

Parameters:

data (Dict[str,Any]) – JSON serialisable object

Returns:

Reconstructed object

Return type:

InvenioPersonInfo

get_info() dict[str, Any][source]

Return the json payload package, formatted in a way InvenioRDM API expects

Returns:

json payload package, formatted in a way InvenioRDM API expects

Return type:

Dict[str,Any]

to_json_serialisable() dict[str, Any][source]

Return a json serialisable object representing this class

Returns:

JSON serialisable object

Return type:

Dict[str,Any]

class NekUpload.metadata.user.InvenioUserInfo[source]

Bases: ABC

Base abstract class describing information about a user

add_identifier(identifier: Identifier) None[source]

Add a persistent identifier related to the user

Parameters:

identifier (Identifier) – Object describing a unique identifier

Raises:

ValueError – _description_

abstractmethod classmethod from_json(data: dict[str, Any]) InvenioUserInfo[source]

Deserialise json serialisable object to reconstruct an object of this class. Factory method.

Parameters:

data (Dict[str,Any]) – JSON serialisable object

Returns:

Object

Return type:

InvenioUserInfo

abstractmethod get_info() dict[str, Any][source]

Return the json payload package

Returns:

JSON representation of the information, formatted for an API call

Return type:

Dict[str,Any]

abstractmethod to_json_serialisable() dict[str, Any][source]

Return a json serialisable object representing this class

Returns:

JSON serialisable object

Return type:

Dict[str,Any]

class NekUpload.metadata.user.InvenioUserInfoFactory[source]

Bases: object

classmethod create_from_json(json_data: dict[str, Any]) InvenioUserInfo[source]

Create suitable object from json. Note that to figure out which object to create, “type” is used as unique identifier

Parameters:

json_data (dict[str,Any]) – JSON serialised data

Raises:

ValueError – _description_

Returns:

An object of this class or subclass

Return type:

InvenioUserInfo