space
@nishans/core / Exports / Space
#
Class: SpaceA class to represent space of Notion
noinheritdoc
#
HierarchyData<ISpace>
↳ Space
#
Index#
Constructors#
Properties#
Accessors#
Methods- addMembers
- addToChildArray
- createTRootPages
- delete
- deleteCachedData
- deleteIterate
- deleteTRootPage
- deleteTRootPages
- emptyStack
- executeOperation
- getCachedData
- getIterate
- getLastEditedProps
- getProps
- getRootCollection
- getRootCollectionIds
- getRootCollections
- getSpaceView
- getTRootPage
- getTRootPages
- initializeCache
- initializeCacheForSpecificData
- initializeCacheForThisData
- printStack
- removeUsers
- returnNonCachedData
- saveToCache
- update
- updateCacheIfNotPresent
- updateCacheLocally
- updateCacheManually
- updateCachedData
- updateIterate
- updateLastEditedProps
- updateRootPage
- updateRootPages
#
Constructors#
constructor+ new Space(arg
: NishanArg): Space
#
Parameters:Name | Type |
---|---|
arg | NishanArg |
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:Name | Type |
---|---|
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:Name | Type |
---|---|
infos | [string, TSpaceMemberPermissionRole][] |
Returns: Promise<INotionUser[]>
Defined in: core/src/Space.ts:174
#
addToChildArrayâ–¸ Protected
addToChildArray(parent
: TData, position
: RepositionParams): void
Adds the passed block id in the child container array of parent
#
Parameters:Name | Type |
---|---|
parent | TData |
position | RepositionParams |
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:Name | Type |
---|---|
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â–¸ Protected
deleteCachedData(): void
Delete the cached data using the id
Returns: void
Defined in: core/src/Data.ts:76
#
deleteIterateâ–¸ Protected
deleteIterate<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:Name | Type |
---|---|
args | FilterTypes<TD> |
options | IterateAndDeleteOptions<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:Name | Type | Description |
---|---|---|
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:Name | Type | Description |
---|---|---|
args? | FilterTypes<TPage> | - |
multiple? | boolean | whether 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â–¸ Protected
getIterate<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:Name | Type |
---|---|
args | FilterTypes<RD> |
options | IterateAndGetOptions<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â–¸ Protected
getLastEditedProps(): object
Returns: object
Name | Type |
---|---|
last_edited_by_id | string |
last_edited_by_table | string |
last_edited_time | number |
Defined in: core/src/Data.ts:48
#
getPropsâ–¸ getProps(): object
Returns: object
Name | Type |
---|---|
cache | ICache |
interval | number |
logger | Logger |
shard_id | number |
space_id | string |
stack | IOperation[] |
token | string |
user_id | string |
Defined in: core/src/Data.ts:148
#
getRootCollectionâ–¸ getRootCollection(arg?
: FilterType<ICollection>): Promise<Collection>
#
Parameters:Name | Type |
---|---|
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:Name | Type |
---|---|
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:Name | Type |
---|---|
args? | FilterType<TPage> |
Returns: Promise<ITPage>
Defined in: core/src/Space.ts:86
#
getTRootPagesâ–¸ getTRootPages(args?
: FilterTypes<TPage>, multiple?
: boolean): Promise<ITPage>
#
Parameters:Name | Type |
---|---|
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:Name | Type |
---|---|
id | string |
type | block | 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â–¸ Protected
initializeCacheForThisData(): 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:Name | Type | Description |
---|---|---|
userIds | string[] | 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:Name | Type |
---|---|
ids | UpdateCacheManuallyParam |
Returns: UpdateCacheManuallyParam
Defined in: endpoints/dist/src/Cache.d.ts:21
#
saveToCacheâ–¸ saveToCache(recordMap
: Partial<RecordMap>): void
Save the passed recordMap to cache
#
Parameters:Name | Type | Description |
---|---|---|
recordMap | Partial<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:Name | Type | Description |
---|---|---|
opt | Partial<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:Name | Type |
---|---|
arg | UpdateCacheManuallyParam |
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:Name | Type | Description |
---|---|---|
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 | - |
Returns: void
Defined in: core/src/Data.ts:95
#
updateCacheManuallyâ–¸ updateCacheManually(arg
: string | UpdateCacheManuallyParam): Promise<void>
#
Parameters:Name | Type |
---|---|
arg | string | 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â–¸ Protected
updateIterate<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:Name | Default |
---|---|
TD | - |
RD | - |
C | any |
#
Parameters:Name | Type |
---|---|
args | UpdateTypes<TD, RD> |
options | IterateAndUpdateOptions<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â–¸ Protected
updateLastEditedProps(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:Name | Type |
---|---|
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:Name | Type |
---|---|
arg | UpdateType<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:Name | Type | Description |
---|---|---|
args | UpdateTypes<TPage, IPageUpdateInput | ICollectionViewPageUpdateInput> | - |
multiple? | boolean | whether multiple rootpages should be deleted |
Returns: Promise<ITPage>
Defined in: core/src/Space.ts:119