collectionviewpage

@nishans/core / Exports / CollectionViewPage

Class: CollectionViewPage#

A class to represent collectionviewpage of Notion

noinheritdoc

Hierarchy#

Index#

Constructors#

Properties#

Methods#

Constructors#

constructor#

+ new CollectionViewPage(arg: NishanArg): CollectionViewPage

Parameters:#

NameType
argNishanArg

Returns: CollectionViewPage

Inherited from: CollectionBlock

Defined in: core/src/CollectionViewPage.ts:11

Properties#

cache#

• cache: ICache

Inherited from: CollectionBlock.cache

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


getConfigs#

• Protected getConfigs: () => Configs

Inherited from: CollectionBlock.getConfigs

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 }

Inherited from: CollectionBlock.headers

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


id#

• id: string

Inherited from: CollectionBlock.id

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


init_cache#

• init_cache: boolean= false

Inherited from: CollectionBlock.init_cache

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


interval#

• interval: number

Inherited from: CollectionBlock.interval

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


logger#

• Protected logger: Logger

Inherited from: CollectionBlock.logger

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


shard_id#

• shard_id: number

Inherited from: CollectionBlock.shard_id

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


space_id#

• space_id: string

Inherited from: CollectionBlock.space_id

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


stack#

• stack: IOperation[]

Inherited from: CollectionBlock.stack

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


token#

• token: string

Inherited from: CollectionBlock.token

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


type#

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

Inherited from: CollectionBlock.type

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


user_id#

• user_id: string

Inherited from: CollectionBlock.user_id

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

Methods#

addPublicPermission#

â–¸ addPublicPermission(role: TPublicPermissionRole, options?: Partial<IPublicPermissionOptions>): void

Parameters:#

NameType
roleTPublicPermissionRole
options?Partial<IPublicPermissionOptions>

Returns: void

Defined in: core/src/CollectionViewPage.ts:103


addSharedUser#

â–¸ addSharedUser(email: string, role: TUserPermissionRole): Promise<INotionUser>

Parameters:#

NameType
emailstring
roleTUserPermissionRole

Returns: Promise<INotionUser>

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


addSharedUsers#

â–¸ addSharedUsers(args: [string, TUserPermissionRole][]): Promise<INotionUser[]>

Share page to users with specific permissions

Parameters:#

NameTypeDescription
args[string, TUserPermissionRole][]array of userid and role of user to share pages to

Returns: Promise<INotionUser[]>

Defined in: core/src/CollectionViewPage.ts:30


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

Inherited from: CollectionBlock

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


convertTo#

â–¸ convertTo(type: TBasicBlockType): void

Convert the current block to a different basic block

Parameters:#

NameTypeDescription
typeTBasicBlockTypeTBasicBlockType basic block types

Returns: void

Inherited from: CollectionBlock

Defined in: core/src/Block.ts:107


createViews#

â–¸ createViews(params: TViewCreateInput[]): ITView

Parameters:#

NameType
paramsTViewCreateInput[]

Returns: ITView

Inherited from: CollectionBlock

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


delete#

â–¸ delete(): void

Delete the current block

Returns: void

Inherited from: CollectionBlock

Defined in: core/src/Block.ts:117


deleteCachedData#

â–¸ ProtecteddeleteCachedData(): void

Delete the cached data using the id

Returns: void

Inherited from: CollectionBlock

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


deleteIterate#

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

Type parameters:#

Name
TD

Parameters:#

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

Returns: Promise<TD[]>

Inherited from: CollectionBlock

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


deleteView#

â–¸ deleteView(arg?: FilterType<TView>): Promise<void>

Delete a single root page from the space

Parameters:#

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

Returns: Promise<void>

Inherited from: CollectionBlock

Defined in: core/src/CollectionBlock.ts:104


deleteViews#

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

Delete multiple root_pages or root_collection_view_pages

Parameters:#

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

Returns: Promise<void>

Inherited from: CollectionBlock

Defined in: core/src/CollectionBlock.ts:113


duplicate#

â–¸ duplicate(infos: { id?: undefined | string }[]): Promise<ITBlock>

Duplicate the current block

Parameters:#

NameTypeDescription
infos{ id?: undefined | string }[]Array of objects containing information regarding the position and id of the duplicated block

Returns: Promise<ITBlock>

A block map

Inherited from: CollectionBlock

Defined in: core/src/Block.ts:32


emptyStack#

â–¸ emptyStack(): void

Returns: void

Inherited from: CollectionBlock

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


executeOperation#

â–¸ executeOperation(): Promise<void>

Returns: Promise<void>

Inherited from: CollectionBlock

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


getCachedData#

â–¸ getCachedData(): ICollectionViewPage

Get the cached data using the current data id

Returns: ICollectionViewPage

Inherited from: CollectionBlock

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


getCachedParentData#

â–¸ getCachedParentData(): IPage | ISpace

Returns: IPage | ISpace

Overrides: CollectionBlock

Defined in: core/src/CollectionViewPage.ts:16


getCollection#

â–¸ getCollection(): Promise<Collection>

Fetch the corresponding collection of the collection block using the collection_id

Returns: Promise<Collection>

The corresponding collection object

Inherited from: CollectionBlock

Defined in: core/src/CollectionBlock.ts:40


getIterate#

â–¸ ProtectedgetIterate<RD, C>(args: FilterTypes<RD>, options: IterateAndGetOptions<ICollectionViewPage, 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<ICollectionViewPage, C>
transform(id: string) => undefined | RD
cb?(id: string, data: RD, container: C) => any

Returns: Promise<C>

Inherited from: CollectionBlock

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


getLastEditedProps#

â–¸ ProtectedgetLastEditedProps(): object

Returns: object

NameType
last_edited_by_idstring
last_edited_by_tablestring
last_edited_timenumber

Inherited from: CollectionBlock

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


getProps#

â–¸ getProps(): object

Returns: object

NameType
cacheICache
intervalnumber
loggerLogger
shard_idnumber
space_idstring
stackIOperation[]
tokenstring
user_idstring

Inherited from: CollectionBlock

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


getViews#

â–¸ getViews(args?: FilterTypes<TView>, multiple?: boolean): Promise<ITView>

Get all the views associated with the collection block

Parameters:#

NameType
args?FilterTypes<TView>
multiple?boolean

Returns: Promise<ITView>

An array of view objects of the collectionblock

Inherited from: CollectionBlock

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


initializeCache#

â–¸ initializeCache(): Promise<void>

Returns: Promise<void>

Inherited from: CollectionBlock

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>

Inherited from: CollectionBlock

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


initializeCacheForThisData#

â–¸ ProtectedinitializeCacheForThisData(): Promise<void>

Returns: Promise<void>

Inherited from: CollectionBlock

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


printStack#

â–¸ printStack(): void

Returns: void

Inherited from: CollectionBlock

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


removePublicPermission#

â–¸ removePublicPermission(): void

Returns: void

Defined in: core/src/CollectionViewPage.ts:122


removeSharedUser#

â–¸ removeSharedUser(id: string): void

Remove a single user from the pages permission option

Parameters:#

NameTypeDescription
idstringId of the user to remove from permission

Returns: void

Defined in: core/src/CollectionViewPage.ts:91


removeSharedUsers#

â–¸ removeSharedUsers(ids: string[]): void

Remove multiple users from the pages permission option

Parameters:#

NameType
idsstring[]

Returns: void

Defined in: core/src/CollectionViewPage.ts:99


removeSpacePermission#

â–¸ removeSpacePermission(): void

Returns: void

Defined in: core/src/CollectionViewPage.ts:136


reposition#

â–¸ reposition(arg: RepositionParams): void

Parameters:#

NameType
argRepositionParams

Returns: void

Inherited from: CollectionBlock

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


returnNonCachedData#

â–¸ returnNonCachedData(ids: UpdateCacheManuallyParam): UpdateCacheManuallyParam

Parameters:#

NameType
idsUpdateCacheManuallyParam

Returns: UpdateCacheManuallyParam

Inherited from: CollectionBlock

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

Inherited from: CollectionBlock

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


transfer#

â–¸ transfer(new_parent_id: string): void

Transfer a block from one parent page to another page

Parameters:#

NameTypeDescription
new_parent_idstringId of the new parent page

Returns: void

Inherited from: CollectionBlock

Defined in: core/src/Block.ts:149


update#

â–¸ update(args: Partial<ICollectionViewInput> | Partial<ICollectionViewPageInput> | Partial<ILinkedDBInput>): void

Update a block's properties and format

Parameters:#

NameTypeDescription
argsPartial<ICollectionViewInput> | Partial<ICollectionViewPageInput> | Partial<ILinkedDBInput>Block update format and properties options

Returns: void

Inherited from: CollectionBlock

Defined in: core/src/Block.ts:89


updateCacheIfNotPresent#

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

Parameters:#

NameType
argUpdateCacheManuallyParam

Returns: Promise<void>

Inherited from: CollectionBlock

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


updateCacheLocally#

â–¸ updateCacheLocally(arg: Partial<ICollectionViewPage>, keys: readonly (id | space_id | shard_id | type | alive | version | parent_id | parent_table | created_time | last_edited_time | collection_id | view_ids | created_by_id | created_by_table | last_edited_by_id | last_edited_by_table | permissions)[], appendToStack?: boolean): void

Update the cache of the data using only the passed keys

Parameters:#

NameTypeDescription
argPartial<ICollectionViewPage>
keysreadonly (id | space_id | shard_id | type | alive | version | parent_id | parent_table | created_time | last_edited_time | collection_id | view_ids | created_by_id | created_by_table | last_edited_by_id | last_edited_by_table | permissions)[]
appendToStack?boolean-

Returns: void

Inherited from: CollectionBlock

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


updateCacheManually#

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

Parameters:#

NameType
argstring | UpdateCacheManuallyParam

Returns: Promise<void>

Inherited from: CollectionBlock

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


updateCachedData#

â–¸ updateCachedData(): Promise<void>

Returns: Promise<void>

Inherited from: CollectionBlock

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


updateIterate#

â–¸ ProtectedupdateIterate<TD, RD, C>(args: UpdateTypes<TD, RD>, options: IterateAndUpdateOptions<ICollectionViewPage, 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<ICollectionViewPage, C>
transform(id: string) => undefined | TD
cb?(id: string, data: TD, updated\_data: RD, container: C) => any

Returns: Promise<C>

Inherited from: CollectionBlock

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

Inherited from: CollectionBlock

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


updatePublicPermission#

â–¸ updatePublicPermission(role: TPublicPermissionRole, options?: Partial<IPublicPermissionOptions>): void

Parameters:#

NameType
roleTPublicPermissionRole
options?Partial<IPublicPermissionOptions>

Returns: void

Defined in: core/src/CollectionViewPage.ts:107


updateSharedUser#

â–¸ updateSharedUser(id: string, role: TUserPermissionRole): Promise<void>

Update the role of the current user based on their id

Parameters:#

NameTypeDescription
idstringId of the user to update
roleTUserPermissionRolenew Role of the user to update

Returns: Promise<void>

Defined in: core/src/CollectionViewPage.ts:61


updateSharedUsers#

â–¸ updateSharedUsers(args: [string, TUserPermissionRole][]): void

Update the role of the current users based on their id

Parameters:#

NameTypeDescription
args[string, TUserPermissionRole][]array of array [id of the user, role type for the user]

Returns: void

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


updateSpacePermission#

â–¸ updateSpacePermission(role: TUserPermissionRole): void

Parameters:#

NameType
roleTUserPermissionRole

Returns: void

Defined in: core/src/CollectionViewPage.ts:126


updateView#

â–¸ updateView(arg: UpdateType<TView, Partial<ITableView> | Partial<IListView> | Partial<IBoardView> | Partial<IGalleryView> | Partial<ICalendarView> | Partial<ITimelineView>>): Promise<ITView>

Parameters:#

NameType
argUpdateType<TView, Partial<ITableView> | Partial<IListView> | Partial<IBoardView> | Partial<IGalleryView> | Partial<ICalendarView> | Partial<ITimelineView>>

Returns: Promise<ITView>

Inherited from: CollectionBlock

Defined in: core/src/CollectionBlock.ts:78


updateViews#

â–¸ updateViews(args: UpdateTypes<TView, Partial<ITableView> | Partial<IListView> | Partial<IBoardView> | Partial<IGalleryView> | Partial<ICalendarView> | Partial<ITimelineView>>, multiple?: boolean): Promise<ITView>

Parameters:#

NameType
argsUpdateTypes<TView, Partial<ITableView> | Partial<IListView> | Partial<IBoardView> | Partial<IGalleryView> | Partial<ICalendarView> | Partial<ITimelineView>>
multiple?boolean

Returns: Promise<ITView>

Inherited from: CollectionBlock

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