IAM Subjects

Subjects interface

Access to the subjects endpoint.

The user is not expected to use this class directly. It is an attribute of the Archivist class.

For example instantiate an Archivist instance and execute the methods of the class:

with open(".auth_token", mode="r", encoding="utf-8") as tokenfile:
    authtoken = tokenfile.read().strip()

# Initialize connection to Archivist
arch = Archivist(
    "https://app.datatrails.ai",
    authtoken,
)
subject = arch.subjects.create(...)
class archivist.subjects.Subject[source]

Subject object

class archivist.subjects._SubjectsClient(archivist_instance: Archivist)[source]

SubjectsClient

Access to subjects entities using CRUD interface. This class is usually accessed as an attribute of the Archivist class.

Parameters:

archivist (Archivist) -- Archivist instance

count(*, display_name: str | None = None) int[source]

Count subjects.

Counts number of subjects that match criteria.

Parameters:

display_name (str) -- display name (optional)

Returns:

integer count of subjects.

create(display_name: str, wallet_pub_key: list[str], tessera_pub_key: list[str]) Subject[source]

Create subject

Creates subject with defined attributes.

Parameters:
  • display_name (str) -- display name of subject.

  • wallet_pub_key (list) -- wallet public keys

  • tessera_pub_key (list) -- tessera public keys

Returns:

Subject instance

create_from_b64(data: dict[str, Any]) Subject[source]

Create subject

Creates subject with request body from b64 encoded string

Parameters:

data (dict) -- Dictionary with 2 fields:

A YAML representation of the data argument would be:

display_name: An imported subject
subject_string: ey66...
Returns:

Subject instance

create_from_data(data: dict[str, Any]) Subject[source]

Create subject

Creates subject with request body from data stream. Suitable for reading data from a file using json.load or yaml.load

Parameters:

data (dict) -- request body of subject.

Returns:

Subject instance

delete(identity: str) dict[str, Any][source]

Delete Subject

Deletes subject.

Parameters:

identity (str) -- subjects identity e.g. subjects/xxxxxxxxxxxxxxxxxxxxxxx

Returns:

Subject instance - empty?

import_subject(display_name: str, subject: Subject) Subject[source]
Create subject from another subject usually

from another organization.

Parameters:
  • display_name (str) -- display_name of the subject

  • subject (Subject) -- Subject object

Returns:

Subject instance

list(*, page_size: int | None = None, display_name: str | None = None)[source]

List subjects.

List subjects that match criteria.

Parameters:
  • display_name (str) -- display name (optional)

  • page_size (int) -- optional page size. (Rarely used).

Returns:

iterable that returns Subject instances

read(identity: str) Subject[source]

Read Subject

Reads subject.

Parameters:

identity (str) -- subjects identity e.g. subjects/xxxxxxxxxxxxxxxxxxxxxxx

Returns:

Subject instance

share(name: str, other_name: str, other_archivist: Archivist) tuple[Subject, Subject][source]
Import the self subjects from the foreign archivist connection

from another organization - mutually share.

Parameters:
  • name (str) -- display_name of the foreign self subject in this archivist

  • other_name (str) -- display_name of the self subject in other archivist

  • other_archivist (Archivist) -- Archivist object

Returns:

2-tuple of Subject instance

update(identity: str, *, display_name: str | None = None, wallet_pub_key: list[str] | None = None, tessera_pub_key: list[str] | None = None) Subject[source]

Update Subject

Update subject.

Parameters:
  • identity (str) -- subjects identity e.g. subjects/xxxxxxxxxxxxxxxxxxxxxxx

  • display_name (str) -- display name of subject.

  • wallet_pub_key (list) -- wallet public keys

  • tessera_pub_key (list) -- tessera public keys

Returns:

Subject instance

wait_for_confirmation(identity: str) Subject[source]

Wait for subject to be confirmed.

Waits for subject to be confirmed.

Parameters:

identity (str) -- identity of asset

Returns:

True if subject is confirmed.