artifact method

Future<Artifact> artifact(
  1. String krefUri
)

Gets an artifact by kref and returns an Artifact model.

The kref must include artifact name: kref://project/space/item.kind?r=N&a=NAME

final artifact = await client.artifact('kref://film-2024/models/hero.model?r=1&a=mesh');
print(artifact.location);

Implementation

Future<models.Artifact> artifact(String krefUri) async {
  // Parse kref to extract revision and artifact name
  final kref = Kref(krefUri);
  final artifactName = kref.artifactName;
  if (artifactName == null) {
    throw KumihoError('Artifact kref must include artifact name: $krefUri');
  }
  final revisionKref = kref.revisionKref;
  if (revisionKref == null) {
    throw KumihoError('Artifact kref must include revision: $krefUri');
  }
  final response = await getArtifact(revisionKref.uri, artifactName);
  return models.Artifact(response, this);
}