Interface: IContents

contents.IContents

The interface for the contents service.

Methods

copy

copy(path, toDir): Promise<IModel>

Copy a file into a given directory.

Parameters

Name

Type

Description

path

string

The original file path.

toDir

string

The destination directory path.

Returns

Promise<IModel>

A promise which resolves with the new contents model when the file is copied.

Notes

The server will select the name of the copied file.

Defined in

packages/contents/lib/tokens.d.ts:31


createCheckpoint

createCheckpoint(path): Promise<ICheckpointModel>

Create a checkpoint for a file.

Parameters

Name

Type

Description

path

string

The path of the file.

Returns

Promise<ICheckpointModel>

A promise which resolves with the new checkpoint model when the checkpoint is created.

Defined in

packages/contents/lib/tokens.d.ts:73


delete

delete(path): Promise<void>

Delete a file.

Parameters

Name

Type

Description

path

string

The path to the file.

Returns

Promise<void>

Defined in

packages/contents/lib/tokens.d.ts:64


deleteCheckpoint

deleteCheckpoint(path, checkpointID): Promise<void>

Delete a checkpoint for a file.

Parameters

Name

Type

Description

path

string

The path of the file.

checkpointID

string

The id of the checkpoint to delete.

Returns

Promise<void>

A promise which resolves when the checkpoint is deleted.

Defined in

packages/contents/lib/tokens.d.ts:100


get

get(path, options?): Promise<null | IModel>

Get a file or directory.

Parameters

Name

Type

path

string

options?

IFetchOptions

Returns

Promise<null | IModel>

A promise which resolves with the file content.

Defined in

packages/contents/lib/tokens.d.ts:40


listCheckpoints

listCheckpoints(path): Promise<ICheckpointModel[]>

List available checkpoints for a file.

Parameters

Name

Type

Description

path

string

The path of the file.

Returns

Promise<ICheckpointModel[]>

A promise which resolves with a list of checkpoint models for the file.

Defined in

packages/contents/lib/tokens.d.ts:82


newUntitled

newUntitled(options?): Promise<null | IModel>

Create a new untitled file or directory in the specified directory path.

Parameters

Name

Type

options?

ICreateOptions

Returns

Promise<null | IModel>

A promise which resolves with the created file content when the file is created.

Defined in

packages/contents/lib/tokens.d.ts:18


rename

rename(oldLocalPath, newLocalPath): Promise<IModel>

Rename a file or directory.

Parameters

Name

Type

Description

oldLocalPath

string

The original file path.

newLocalPath

string

The new file path.

Returns

Promise<IModel>

A promise which resolves with the new file content model when the file is renamed.

Defined in

packages/contents/lib/tokens.d.ts:49


restoreCheckpoint

restoreCheckpoint(path, checkpointID): Promise<void>

Restore a file to a known checkpoint state.

Parameters

Name

Type

Description

path

string

The path of the file.

checkpointID

string

The id of the checkpoint to restore.

Returns

Promise<void>

A promise which resolves when the checkpoint is restored.

Defined in

packages/contents/lib/tokens.d.ts:91


save

save(path, options?): Promise<null | IModel>

Save a file.

Parameters

Name

Type

Description

path

string

The desired file path.

options?

Partial<IModel>

Optional overrides to the model.

Returns

Promise<null | IModel>

A promise which resolves with the file content model when the file is saved.

Defined in

packages/contents/lib/tokens.d.ts:58