Space
Datalayer Core / Space
Class: Space
Defined in: src/models/SpaceDTO.ts:76
Space domain model that wraps API responses with convenient methods. Provides workspace management with data refresh and content creation operations.
Example
const space = spaces[0];
const items = await space.getItems();
const notebook = await space.createNotebook({ name: 'Analysis' });
Constructors
Constructor
new Space(
data,client):SpaceDTO
Defined in: src/models/SpaceDTO.ts:88
Create a Space instance.
Parameters
data
Space data from API
client
Client instance
Returns
SpaceDTO
Properties
_data
protected_data:SpaceData
Defined in: src/models/SpaceDTO.ts:77
Accessors
description
Get Signature
get description():
string
Defined in: src/models/SpaceDTO.ts:154
The description of the space.
Returns
string
handle
Get Signature
get handle():
string
Defined in: src/models/SpaceDTO.ts:133
URL-friendly handle for the space.
Returns
string
name
Get Signature
get name():
string
Defined in: src/models/SpaceDTO.ts:147
The name of the space.
Returns
string
uid
Get Signature
get uid():
string
Defined in: src/models/SpaceDTO.ts:127
Unique identifier for the space.
Returns
string
variant
Get Signature
get variant():
string
Defined in: src/models/SpaceDTO.ts:139
Space variant type.
Returns
string
Methods
createLexical()
createLexical(
data):Promise<LexicalDTO>
Defined in: src/models/SpaceDTO.ts:271
Create a new lexical document in this space.
Parameters
data
Lexical creation configuration
description
string
file?
Blob | File
name
string
Returns
Promise<LexicalDTO>
Created Lexical instance
createNotebook()
createNotebook(
data):Promise<Notebook>
Defined in: src/models/SpaceDTO.ts:252
Create a new notebook in this space.
Parameters
data
Notebook creation configuration
description
string
file?
Blob | File
name
string
Returns
Promise<Notebook>
Created Notebook instance
getItems()
getItems():
Promise<(LexicalDTO|Notebook)[]>
Defined in: src/models/SpaceDTO.ts:230
Get all items in this space as model instances.
Returns
Promise<(LexicalDTO | Notebook)[]>
Array of Notebook and Lexical model instances
rawData()
rawData():
SpaceData
Defined in: src/models/SpaceDTO.ts:325
Get the raw space data exactly as received from the API. This preserves the original snake_case naming from the API response.
Returns
Raw space data from API
refresh()
refresh():
Promise<void>
Defined in: src/models/SpaceDTO.ts:112
Refresh space data from the API by fetching user's spaces.
Returns
Promise<void>
toJSON()
toJSON():
SpaceJSON
Defined in: src/models/SpaceDTO.ts:301
Get space data in camelCase format. Returns only the core fields that consumers need. This provides a stable interface regardless of API changes.
Returns
Core space data with camelCase properties
toString()
toString():
string
Defined in: src/models/SpaceDTO.ts:331
String representation of the space.
Returns
string