Skip to content

platform/workspace

Documentation

Overview

Classes

Workspace

createWorkspace()

Creates a new workspace with the given name.

ts
static createWorkspace(name: string): Workspace;
ParameterTypeDescription
namestringThe name of the workspace to create.

Returns

  • Type: Workspace
  • Description: The newly created Workspace instance.

getWorkspace()

Retrieves an existing workspace by name.

ts
static getWorkspace(name: string): Workspace;
ParameterTypeDescription
namestringThe name of the workspace to retrieve.

Returns

  • Type: Workspace
  • Description: The Workspace instance.

getWorkspacesNames()

Retrieves the names of all existing workspaces.

ts
static getWorkspacesNames(): void;

Returns

  • Type: void
  • Description: An array of workspace names.

deleteWorkspace()

Deletes the workspace with the specified name.

ts
static deleteWorkspace(name: string): void;
ParameterTypeDescription
namestringThe name of the workspace to delete.

Returns

  • Type: void
  • Description:

getProjects()

Gets a collection of all projects within this workspace.

ts
getProjects(): Projects;

Returns

  • Type: Projects
  • Description: A Projects collection instance.

createProject()

Creates a new project within this workspace.

ts
createProject(name: string): Project;
ParameterTypeDescription
namestringThe name of the project to create.

Returns

  • Type: Project
  • Description: The newly created Project instance.

getProject()

Retrieves an existing project by name from this workspace.

ts
getProject(name: string): Project;
ParameterTypeDescription
namestringThe name of the project to retrieve.

Returns

  • Type: Project
  • Description: The Project instance.

deleteProject()

Deletes a project from this workspace by name.

ts
deleteProject(name: string): void;
ParameterTypeDescription
namestringThe name of the project to delete.

Returns

  • Type: void
  • Description:

exists()

Checks if the workspace currently exists.

ts
exists(): boolean;

Returns

  • Type: boolean
  • Description: True if the workspace exists, false otherwise.

existsFolder()

Checks if a specific folder path exists within the workspace's filesystem structure.

ts
existsFolder(path: string): boolean;
ParameterTypeDescription
pathstringThe relative path to the folder.

Returns

  • Type: boolean
  • Description: True if the folder exists.

existsFile()

Checks if a specific file path exists within the workspace's filesystem structure.

ts
existsFile(path: string): boolean;
ParameterTypeDescription
pathstringThe relative path to the file.

Returns

  • Type: boolean
  • Description: True if the file exists.

copyProject()

Copies a project from a source name to a target name within the workspace.

ts
copyProject(source: string, target: string): void;
ParameterTypeDescription
sourcestringThe name of the project to copy.
targetstringThe name of the new project copy.

Returns

  • Type: void
  • Description:

moveProject()

Moves a project from a source name to a target name (renaming it).

ts
moveProject(source: string, target: string): void;
ParameterTypeDescription
sourcestringThe current name of the project.
targetstringThe new name/path of the project.

Returns

  • Type: void
  • Description:

Projects

size()

Gets the number of projects in the collection.

ts
size(): number;

Returns

  • Type: number
  • Description: The size of the collection.

get()

Gets a Project instance at the specified index.

ts
get(index: number): Project;
ParameterTypeDescription
indexnumberThe index of the project.

Returns

  • Type: Project
  • Description: The Project instance.

Project

getName()

Gets the name of the project.

ts
getName(): string;

Returns

  • Type: string
  • Description: The project name.

getPath()

Gets the path of the project.

ts
getPath(): string;

Returns

  • Type: string
  • Description: The project path (relative to the repository/workspace root).

createFolder()

Creates a new folder within the project.

ts
createFolder(path: string): Folder;
ParameterTypeDescription
pathstringThe path of the folder to create (relative to the project root).

Returns

  • Type: Folder
  • Description: The newly created Folder instance.

exists()

Checks if the project itself exists.

ts
exists(): boolean;

Returns

  • Type: boolean
  • Description: True if the project exists.

existsFolder()

Checks if a specific folder path exists within the project.

ts
existsFolder(path: string): boolean;
ParameterTypeDescription
pathstringThe relative path to the folder.

Returns

  • Type: boolean
  • Description: True if the folder exists.

getFolder()

Retrieves a folder by its path relative to the project root.

ts
getFolder(path: string): Folder;
ParameterTypeDescription
pathstringThe relative path to the folder.

Returns

  • Type: Folder
  • Description: The Folder instance.

getFolders()

Retrieves a collection of folders at a specific path.

ts
getFolders(path: string): Folders;
ParameterTypeDescription
pathstringThe path containing the folders to retrieve.

Returns

  • Type: Folders
  • Description: The Folders collection instance.

deleteFolder()

Deletes a folder from the project.

ts
deleteFolder(path: string): void;
ParameterTypeDescription
pathstringThe path of the folder to delete (relative to the project root).

Returns

  • Type: void
  • Description:

createFile()

Creates a new file within the project.

ts
createFile(path: string, input: any): File;
ParameterTypeDescription
pathstringThe path of the file to create (relative to the project root).
inputanyOptional initial content as a byte array.

Returns

  • Type: File
  • Description: The newly created File instance.

existsFile()

Checks if a specific file path exists within the project.

ts
existsFile(path: string): boolean;
ParameterTypeDescription
pathstringThe relative path to the file.

Returns

  • Type: boolean
  • Description: True if the file exists.

getFile()

Retrieves a file by its path relative to the project root.

ts
getFile(path: string): File;
ParameterTypeDescription
pathstringThe relative path to the file.

Returns

  • Type: File
  • Description: The File instance.

getFiles()

Retrieves a collection of files at a specific path.

ts
getFiles(path: string): Files;
ParameterTypeDescription
pathstringThe path containing the files to retrieve.

Returns

  • Type: Files
  • Description: The Files collection instance.

deleteFile()

Deletes a file from the project.

ts
deleteFile(path: string): void;
ParameterTypeDescription
pathstringThe path of the file to delete (relative to the project root).

Returns

  • Type: void
  • Description:

Folders

size()

Gets the number of folders in the collection.

ts
size(): number;

Returns

  • Type: number
  • Description: The size of the collection.

get()

Gets a Folder instance at the specified index.

ts
get(index: number): Folder;
ParameterTypeDescription
indexnumberThe index of the folder.

Returns

  • Type: Folder
  • Description: The Folder instance.

Files

size()

Gets the number of files in the collection.

ts
size(): number;

Returns

  • Type: number
  • Description: The size of the collection.

get()

Gets a File instance at the specified index.

ts
get(index: number): File;
ParameterTypeDescription
indexnumberThe index of the file.

Returns

  • Type: File
  • Description: The File instance.

Folder

getName()

Gets the name of the folder.

ts
getName(): string;

Returns

  • Type: string
  • Description: The folder name.

getPath()

Gets the full path of the folder.

ts
getPath(): string;

Returns

  • Type: string
  • Description: The folder path.

createFolder()

Creates a new sub-folder within this folder.

ts
createFolder(path: string): Folder;
ParameterTypeDescription
pathstringThe path of the sub-folder to create (relative to this folder).

Returns

  • Type: Folder
  • Description: The newly created Folder instance.

exists()

Checks if the folder itself exists.

ts
exists(): boolean;

Returns

  • Type: boolean
  • Description: True if the folder exists.

existsFolder()

Checks if a specific sub-folder path exists within this folder.

ts
existsFolder(path: string): boolean;
ParameterTypeDescription
pathstringThe relative path to the sub-folder.

Returns

  • Type: boolean
  • Description: True if the sub-folder exists.

getFolder()

Retrieves a sub-folder by its path relative to this folder.

ts
getFolder(path: string): Folder;
ParameterTypeDescription
pathstringThe relative path to the sub-folder.

Returns

  • Type: Folder
  • Description: The Folder instance.

getFolders()

Retrieves a collection of folders at a specific path relative to this folder.

ts
getFolders(path: string): Folders;
ParameterTypeDescription
pathstringThe path containing the folders to retrieve.

Returns

  • Type: Folders
  • Description: The Folders collection instance.

deleteFolder()

Deletes a sub-folder from this folder.

ts
deleteFolder(path: string): void;
ParameterTypeDescription
pathstringThe path of the sub-folder to delete (relative to this folder).

Returns

  • Type: void
  • Description:

createFile()

Creates a new file within this folder.

ts
createFile(path: string, input: any): File;
ParameterTypeDescription
pathstringThe path of the file to create (relative to this folder).
inputanyOptional initial content as a byte array.

Returns

  • Type: File
  • Description: The newly created File instance.

existsFile()

Checks if a specific file path exists within this folder.

ts
existsFile(path: string): boolean;
ParameterTypeDescription
pathstringThe relative path to the file.

Returns

  • Type: boolean
  • Description: True if the file exists.

getFile()

Retrieves a file by its path relative to this folder.

ts
getFile(path: string): File;
ParameterTypeDescription
pathstringThe relative path to the file.

Returns

  • Type: File
  • Description: The File instance.

getFiles()

Retrieves a collection of files at a specific path relative to this folder.

ts
getFiles(path: string): Files;
ParameterTypeDescription
pathstringThe path containing the files to retrieve.

Returns

  • Type: Files
  • Description: The Files collection instance.

deleteFile()

Deletes a file from this folder.

ts
deleteFile(path: string): void;
ParameterTypeDescription
pathstringThe path of the file to delete (relative to this folder).

Returns

  • Type: void
  • Description:

File

getName()

Gets the name of the file.

ts
getName(): string;

Returns

  • Type: string
  • Description: The file name.

getPath()

Gets the full path of the file.

ts
getPath(): string;

Returns

  • Type: string
  • Description: The file path.

getContentType()

Gets the content type (MIME type) of the file.

ts
getContentType(): string;

Returns

  • Type: string
  • Description: The content type string.

isBinary()

Checks if the file content is determined to be binary.

ts
isBinary(): boolean;

Returns

  • Type: boolean
  • Description: True if binary, false if text.

getContent()

Gets the content of the file as a JavaScript-friendly byte array.

ts
getContent(): void;

Returns

  • Type: void
  • Description: The content bytes.

getText()

Gets the content of the file as a text string.

ts
getText(): string;

Returns

  • Type: string
  • Description: The text content.

setContent()

Sets the content of the file using a byte array.

ts
setContent(input: any): void;
ParameterTypeDescription
inputanyThe new content bytes.

Returns

  • Type: void
  • Description:

setText()

Sets the content of the file using a text string. The string is converted to a byte array before saving.

ts
setText(input: string): void;
ParameterTypeDescription
inputstringThe new text content.

Returns

  • Type: void
  • Description:

exists()

Checks if the file exists.

ts
exists(): boolean;

Returns

  • Type: boolean
  • Description: True if the file exists.