space

@nishans/core / Exports / Space

Class: Space#

A class to represent space of Notion

noinheritdoc

Hierarchy#

  • Data<ISpace>

    ↳ Space

Index#

Constructors#

Properties#

Accessors#

Methods#

Constructors#

constructor#

+ new Space(arg: NishanArg): Space

Parameters:#

NameType
argNishanArg

Returns: Space

Defined in: core/src/Space.ts:23

Properties#

cache#

• cache: ICache

Defined in: endpoints/dist/src/Cache.d.ts:4


getConfigs#

• Protected getConfigs: () => Configs

Defined in: endpoints/dist/src/Cache.d.ts:15


headers#

• headers: { headers: { cookie: string ; x-notion-active-user-header: string } }

Type declaration:#

NameType
headers{ cookie: string ; x-notion-active-user-header: string }

Defined in: endpoints/dist/src/Cache.d.ts:7


id#

• id: string

Defined in: core/src/Data.ts:33


init_cache#

• init_cache: boolean= false

Defined in: core/src/Data.ts:35


interval#

• interval: number

Defined in: endpoints/dist/src/Cache.d.ts:6


logger#

• Protected logger: Logger

Defined in: core/src/Data.ts:36


shard_id#

• shard_id: number

Defined in: core/src/Operations.ts:9


space_id#

• space_id: string

Defined in: core/src/Operations.ts:8


space_view#

• Optional space_view: undefined | ISpaceView

Defined in: core/src/Space.ts:23


stack#

• stack: IOperation[]

Defined in: core/src/Operations.ts:7


token#

• token: string

Defined in: endpoints/dist/src/Cache.d.ts:5


type#

• type: block | collection | collection_view | space | notion_user | space_view | user_root | user_settings

Defined in: core/src/Data.ts:34


user_id#

• user_id: string

Defined in: endpoints/dist/src/Cache.d.ts:13

Accessors#

spaceView#

• spaceView(): ISpaceView

Returns: ISpaceView

Defined in: core/src/Space.ts:29

Methods#

addMembers#

â–¸ addMembers(infos: [string, TSpaceMemberPermissionRole][]): Promise<INotionUser[]>

Parameters:#

NameType
infos[string, TSpaceMemberPermissionRole][]

Returns: Promise<INotionUser[]>

Defined in: core/src/Space.ts:174


addToChildArray#

â–¸ ProtectedaddToChildArray(parent: TData, position: RepositionParams): void

Adds the passed block id in the child container array of parent

Parameters:#

NameType
parentTData
positionRepositionParams

Returns: void

created Operation and a function to update the cache and the class data

Defined in: core/src/Data.ts:86


createTRootPages#

â–¸ createTRootPages(contents: (IPageCreateInput & { position?: RepositionParams } | ICollectionViewPageInput & { position?: RepositionParams })[]): Promise<ITBlock>

Parameters:#

NameType
contents(IPageCreateInput & { position?: RepositionParams } | ICollectionViewPageInput & { position?: RepositionParams })[]

Returns: Promise<ITBlock>

Defined in: core/src/Space.ts:82


delete#

â–¸ delete(): Promise<void>

Delete the current workspace

Returns: Promise<void>

Defined in: core/src/Space.ts:66


deleteCachedData#

â–¸ ProtecteddeleteCachedData(): void

Delete the cached data using the id

Returns: void

Defined in: core/src/Data.ts:76


deleteIterate#

â–¸ ProtecteddeleteIterate<TD>(args: FilterTypes<TD>, options: IterateAndDeleteOptions<ISpace>, transform: (id: string) => undefined | TD, cb?: (id: string, data: TD) => void | Promise<any>): Promise<TD[]>

Type parameters:#

Name
TD

Parameters:#

NameType
argsFilterTypes<TD>
optionsIterateAndDeleteOptions<ISpace>
transform(id: string) => undefined | TD
cb?(id: string, data: TD) => void | Promise<any>

Returns: Promise<TD[]>

Defined in: core/src/Data.ts:118


deleteTRootPage#

â–¸ deleteTRootPage(arg?: FilterType<TPage>): Promise<void>

Delete a single root page from the space

Parameters:#

NameTypeDescription
arg?FilterType<TPage>Criteria to filter the page to be deleted

Returns: Promise<void>

Defined in: core/src/Space.ts:143


deleteTRootPages#

â–¸ deleteTRootPages(args?: FilterTypes<TPage>, multiple?: boolean): Promise<void>

Delete multiple root_pages or root_collection_view_pages from the space

Parameters:#

NameTypeDescription
args?FilterTypes<TPage>-
multiple?booleanwhether or not multiple root pages should be deleted

Returns: Promise<void>

Defined in: core/src/Space.ts:152


emptyStack#

â–¸ emptyStack(): void

Returns: void

Defined in: core/src/Operations.ts:18


executeOperation#

â–¸ executeOperation(): Promise<void>

Returns: Promise<void>

Defined in: core/src/Operations.ts:26


getCachedData#

â–¸ getCachedData(): ISpace

Get the cached data using the current data id

Returns: ISpace

Defined in: core/src/Data.ts:62


getIterate#

â–¸ ProtectedgetIterate<RD, C>(args: FilterTypes<RD>, options: IterateAndGetOptions<ISpace, C>, transform: (id: string) => undefined | RD, cb?: (id: string, data: RD, container: C) => any): Promise<C>

Type parameters:#

Name
RD
C

Parameters:#

NameType
argsFilterTypes<RD>
optionsIterateAndGetOptions<ISpace, C>
transform(id: string) => undefined | RD
cb?(id: string, data: RD, container: C) => any

Returns: Promise<C>

Defined in: core/src/Data.ts:138


getLastEditedProps#

â–¸ ProtectedgetLastEditedProps(): object

Returns: object

NameType
last_edited_by_idstring
last_edited_by_tablestring
last_edited_timenumber

Defined in: core/src/Data.ts:48


getProps#

â–¸ getProps(): object

Returns: object

NameType
cacheICache
intervalnumber
loggerLogger
shard_idnumber
space_idstring
stackIOperation[]
tokenstring
user_idstring

Defined in: core/src/Data.ts:148


getRootCollection#

â–¸ getRootCollection(arg?: FilterType<ICollection>): Promise<Collection>

Parameters:#

NameType
arg?FilterType<ICollection>

Returns: Promise<Collection>

Defined in: core/src/Space.ts:161


getRootCollectionIds#

â–¸ getRootCollectionIds(): string[]

Returns: string[]

Defined in: core/src/Space.ts:38


getRootCollections#

â–¸ getRootCollections(args?: FilterTypes<ICollection>, multiple?: boolean): Promise<Collection[]>

Parameters:#

NameType
args?FilterTypes<ICollection>
multiple?boolean

Returns: Promise<Collection[]>

Defined in: core/src/Space.ts:165


getSpaceView#

â–¸ getSpaceView(): SpaceView

Get the space view associated with the space

Returns: SpaceView

The associated space view object

Defined in: core/src/Space.ts:46


getTRootPage#

â–¸ getTRootPage(args?: FilterType<TPage>): Promise<ITPage>

Parameters:#

NameType
args?FilterType<TPage>

Returns: Promise<ITPage>

Defined in: core/src/Space.ts:86


getTRootPages#

â–¸ getTRootPages(args?: FilterTypes<TPage>, multiple?: boolean): Promise<ITPage>

Parameters:#

NameType
args?FilterTypes<TPage>
multiple?boolean

Returns: Promise<ITPage>

Defined in: core/src/Space.ts:90


initializeCache#

â–¸ initializeCache(): Promise<void>

Returns: Promise<void>

Defined in: endpoints/dist/src/Cache.d.ts:22


initializeCacheForSpecificData#

â–¸ initializeCacheForSpecificData(id: string, type: block | collection | collection_view | space | notion_user | space_view | user_root | user_settings): Promise<void>

Parameters:#

NameType
idstring
typeblock | collection | collection_view | space | notion_user | space_view | user_root | user_settings

Returns: Promise<void>

Defined in: endpoints/dist/src/Cache.d.ts:25


initializeCacheForThisData#

â–¸ ProtectedinitializeCacheForThisData(): Promise<void>

Returns: Promise<void>

Defined in: core/src/Data.ts:111


printStack#

â–¸ printStack(): void

Returns: void

Defined in: core/src/Operations.ts:22


removeUsers#

â–¸ removeUsers(userIds: string[]): Promise<void>

Remove multiple users from the current space

Parameters:#

NameTypeDescription
userIdsstring[]ids of the user to remove from the workspace

Returns: Promise<void>

Defined in: core/src/Space.ts:203


returnNonCachedData#

â–¸ returnNonCachedData(ids: UpdateCacheManuallyParam): UpdateCacheManuallyParam

Parameters:#

NameType
idsUpdateCacheManuallyParam

Returns: UpdateCacheManuallyParam

Defined in: endpoints/dist/src/Cache.d.ts:21


saveToCache#

â–¸ saveToCache(recordMap: Partial<RecordMap>): void

Save the passed recordMap to cache

Parameters:#

NameTypeDescription
recordMapPartial<RecordMap>RecordMap map to save to cache

Returns: void

Defined in: endpoints/dist/src/Cache.d.ts:20


update#

â–¸ update(opt: Partial<Pick<ISpace, name | icon | disable_public_access | disable_guests | disable_move_to_space | disable_export | domain | invite_link_enabled | beta_enabled>>): void

Update the space settings

Parameters:#

NameTypeDescription
optPartial<Pick<ISpace, name | icon | disable_public_access | disable_guests | disable_move_to_space | disable_export | domain | invite_link_enabled | beta_enabled>>Properties of the space to update

Returns: void

Defined in: core/src/Space.ts:59


updateCacheIfNotPresent#

â–¸ updateCacheIfNotPresent(arg: UpdateCacheManuallyParam): Promise<void>

Parameters:#

NameType
argUpdateCacheManuallyParam

Returns: Promise<void>

Defined in: endpoints/dist/src/Cache.d.ts:24


updateCacheLocally#

â–¸ updateCacheLocally(arg: Partial<ISpace>, keys: readonly (id | shard_id | name | icon | version | created_time | last_edited_time | created_by_id | created_by_table | last_edited_by_id | last_edited_by_table | permissions | disable_public_access | disable_guests | disable_move_to_space | disable_export | domain | invite_link_enabled | beta_enabled | pages | invite_link_code | plan_type)[], appendToStack?: boolean): void

Update the cache of the data using only the passed keys

Parameters:#

NameTypeDescription
argPartial<ISpace>
keysreadonly (id | shard_id | name | icon | version | created_time | last_edited_time | created_by_id | created_by_table | last_edited_by_id | last_edited_by_table | permissions | disable_public_access | disable_guests | disable_move_to_space | disable_export | domain | invite_link_enabled | beta_enabled | pages | invite_link_code | plan_type)[]
appendToStack?boolean-

Returns: void

Defined in: core/src/Data.ts:95


updateCacheManually#

â–¸ updateCacheManually(arg: string | UpdateCacheManuallyParam): Promise<void>

Parameters:#

NameType
argstring | UpdateCacheManuallyParam

Returns: Promise<void>

Defined in: endpoints/dist/src/Cache.d.ts:23


updateCachedData#

â–¸ updateCachedData(): Promise<void>

Returns: Promise<void>

Defined in: core/src/Data.ts:69


updateIterate#

â–¸ ProtectedupdateIterate<TD, RD, C>(args: UpdateTypes<TD, RD>, options: IterateAndUpdateOptions<ISpace, C>, transform: (id: string) => undefined | TD, cb?: (id: string, data: TD, updated\_data: RD, container: C) => any): Promise<C>

Type parameters:#

NameDefault
TD-
RD-
Cany

Parameters:#

NameType
argsUpdateTypes<TD, RD>
optionsIterateAndUpdateOptions<ISpace, C>
transform(id: string) => undefined | TD
cb?(id: string, data: TD, updated\_data: RD, container: C) => any

Returns: Promise<C>

Defined in: core/src/Data.ts:128


updateLastEditedProps#

â–¸ ProtectedupdateLastEditedProps(data?: INotionUser | IText | ITodo | IHeader | ISubHeader | ISubSubHeader | IBulletedList | INumberedList | IToggle | IQuote | IDivider | ICallout | IPage | ICollectionView | ICollectionViewPage | ILinkToPage | IVideo | IAudio | IImage | IWebBookmark | ICode | IFile | ITOC | IEquation | IBreadcrumb | IFactory | IEmbed | ITweet | ICodepen | IMaps | IFigma | IDrive | IGist | IColumnList | IColumn | ICollection | ITableView | IListView | IBoardView | IGalleryView | ICalendarView | ITimelineView | ISpace | ISpaceView | IUserRoot | IUserSettings): void

Parameters:#

NameType
data?INotionUser | IText | ITodo | IHeader | ISubHeader | ISubSubHeader | IBulletedList | INumberedList | IToggle | IQuote | IDivider | ICallout | IPage | ICollectionView | ICollectionViewPage | ILinkToPage | IVideo | IAudio | IImage | IWebBookmark | ICode | IFile | ITOC | IEquation | IBreadcrumb | IFactory | IEmbed | ITweet | ICodepen | IMaps | IFigma | IDrive | IGist | IColumnList | IColumn | ICollection | ITableView | IListView | IBoardView | IGalleryView | ICalendarView | ITimelineView | ISpace | ISpaceView | IUserRoot | IUserSettings

Returns: void

Defined in: core/src/Data.ts:52


updateRootPage#

â–¸ updateRootPage(arg: UpdateType<TPage, IPageUpdateInput | ICollectionViewPageUpdateInput>): Promise<ITPage>

Update a singular root page in the space

Parameters:#

NameType
argUpdateType<TPage, IPageUpdateInput | ICollectionViewPageUpdateInput>

Returns: Promise<ITPage>

Defined in: core/src/Space.ts:110


updateRootPages#

â–¸ updateRootPages(args: UpdateTypes<TPage, IPageUpdateInput | ICollectionViewPageUpdateInput>, multiple?: boolean): Promise<ITPage>

Update multiple root pages located in the space

Parameters:#

NameTypeDescription
argsUpdateTypes<TPage, IPageUpdateInput | ICollectionViewPageUpdateInput>-
multiple?booleanwhether multiple rootpages should be deleted

Returns: Promise<ITPage>

Defined in: core/src/Space.ts:119