ModelClient

class pystclient.clients.ModelClient(session: Session)

Bases: BaseClient

Client for managing FMU models in the STC platform.

Provides methods to upload, search, retrieve metadata for, and delete FMU (Functional Mock-up Unit) models stored on the STC API.

__init__(session: Session) None

Methods

__init__(session)

delete_models(id_list)

Remove one or more FMU models from the STC platform by their IDs.

find_models_by_filename(filename)

Search the STC platform for FMU models whose filename matches the given string.

retrieve_model_info_by_name(fmu_models)

Look up and populate version and ID for FMU models that are missing this information.

upload_model(fmu_path)

Upload an FMU file to the STC platform.

Attributes

session

delete_models(id_list: list[UUID | str]) bool

Remove one or more FMU models from the STC platform by their IDs.

Parameters:

id_list – List of FMU model IDs to delete

Returns:

True if the server accepted the deletion request

find_models_by_filename(filename: str) list[FmuModelInformation]

Search the STC platform for FMU models whose filename matches the given string.

Fetches all available FMU models from the API and returns those with an exact filename match. Returns an empty list if no models match.

Parameters:

filename – The exact FMU filename to search for (e.g. "MyModel.fmu")

Returns:

List of FMU model records matching the filename

retrieve_model_info_by_name(fmu_models: list[FmuSelect]) list[FmuSelect]

Look up and populate version and ID for FMU models that are missing this information.

For each model in the list whose version is None, queries the STC API to find a matching model by ID or filename, then fills in the version and id fields from the remote record.

Parameters:

fmu_models – List of FMU model selectors to resolve

Returns:

The same list with version and id populated for each entry

Raises:

FmuModelNotFoundError – If a model cannot be matched by ID or filename on the server

upload_model(fmu_path: Path) UploadedModelInfo

Upload an FMU file to the STC platform.

The file is sent as a multipart form upload. On success the server returns metadata about the newly created model record.

Parameters:

fmu_path – Local filesystem path to the .fmu file to upload

Returns:

Metadata for the newly uploaded model, including its assigned ID and version