createArtifact method

Future<ArtifactResponse> createArtifact(
  1. String revisionKref,
  2. String name,
  3. String location, {
  4. Map<String, String>? metadata,
  5. bool existsError = true,
})
inherited

Creates a new artifact for a revision.

revisionKref is the revision's kref URI (must include ?r=N). name is the artifact name (e.g., 'mesh', 'textures'). location is the file path or URI where the artifact is stored. metadata is optional key-value metadata for the artifact. existsError controls whether to throw if artifact exists (default: true).

Implementation

Future<ArtifactResponse> createArtifact(
  String revisionKref,
  String name,
  String location, {
  Map<String, String>? metadata,
  bool existsError = true,
}) async {
  final request = CreateArtifactRequest()
    ..revisionKref = Kref(uri: revisionKref)
    ..name = name
    ..location = location
    ..existsError = existsError;
  if (metadata != null) {
    request.metadata.addAll(metadata);
  }
  return stub.createArtifact(request, options: callOptions);
}