Skip to content

File methods: update, delete

The File Verbs update, delete as typed SDK methods, with inputs, result, refusals and an example.

Reference for File, one group of File methods.

File.update

Changes the given properties of a File. Verb page.

TypeScript
interface FileVerbs {
  update(input: FileUpdateInput, options?: SB.CallOptions): SB.Call<File>
}

Emits File.updated.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the File.
contentTypestringThe media type, such as application/pdf.
sizeintegerThe size in bytes.
namestringThe file name it was uploaded with.
visibilitystringWho may read it: Owner, Customer, or Public. The default is Owner.

Returns

OutputTypeRequiredDescription
fileFilerequiredThe File.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

TypeScript
import { $ } from 'startup-builder'

const file = await $.File.update({ id: 'file_V1AuhyCTsH', size: 1 })

File.delete

Deletes a File: a soft delete that keeps its history, undone by Thing.restore. Verb page.

TypeScript
interface FileVerbs {
  delete(input: FileDeleteInput, options?: SB.CallOptions): SB.Call<File>
}

Emits File.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the File.

Returns

OutputTypeRequiredDescription
fileFilerequiredThe File.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

TypeScript
import { $ } from 'startup-builder'

const file = await $.File.delete({ id: 'file_V1AuhyCTsH' })