Attach a template workspace resource
Adds or replaces one bounded persistent read-only resource and advances the workspace revision.
POST
Adds or replaces one bounded persistent read-only resource and advances the workspace revision.
apiKeyheader
x-api-key<token>id*stringMatch
^tmpl_[0-9a-hjkmnp-tv-z]{16,24}$idempotency-key*stringLength
1 <= length <= 255application/json- body
expectedRevision*stringresource*Success
application/json- response
projectId*TemplateProjectIdMatch
^tproj_[0-9a-hjkmnp-tv-z]{16,24}$organizationId*|nullownerEpoch*integerRange
0 <= value <= 9007199254740991repositoryName*stringMatch
^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$defaultBranch*stringLength
1 <= length <= 255baseCommit*stringMatch
^[a-f0-9]{40}$remoteHead*stringMatch
^[a-f0-9]{40}$pendingRemoteHead*|nullrevision*stringoverlay*assetChanges*array<>conflicts*array<>provenance*mounts*array<|||>libraryManifestDigest*stringMatch
^[a-f0-9]{64}$createdAt*stringupdatedAt*stringcreatedBy*updatedBy*import { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const result = await samva.templates.attachWorkspaceResource({
"id": "example",
"expectedRevision": "example",
"resource": {
"resourceId": "example",
"name": "example",
"files": [
{
"path": "example",
"mediaType": "example",
"contentBase64": "example"
}
]
}
});Example Response
{
"projectId": "string",
"organizationId": "string",
"ownerEpoch": 0,
"repositoryName": "string",
"defaultBranch": "string",
"baseCommit": "string",
"remoteHead": "string",
"pendingRemoteHead": "string",
"revision": "string",
"overlay": {
"property1": "string",
"property2": "string"
},
"assetChanges": [
{
"path": "string",
"status": "added"
}
],
"conflicts": [
{
"path": "string",
"base": "string",
"draft": "string",
"main": "string"
}
],
"provenance": {
"references": [
{
"kind": "string",
"digest": "string",
"locator": "string"
}
]
},
"mounts": [
{
"kind": "project",
"root": "/project",
"access": "read-write"
}
],
"libraryManifestDigest": "string",
"createdAt": "string",
"updatedAt": "string",
"createdBy": {
"userId": "string",
"via": "api"
},
"updatedBy": {
"userId": "string",
"via": "api"
}
}