collectionview
@nishans/core / Exports / CollectionView
#
Class: CollectionViewA class to represent collectionview of Notion
noinheritdoc
#
HierarchyCollectionBlock<ICollectionView>
↳ CollectionView
#
Index#
Constructors#
Properties#
Methods- addToChildArray
- convertTo
- createViews
- delete
- deleteCachedData
- deleteIterate
- deleteView
- deleteViews
- duplicate
- emptyStack
- executeOperation
- getCachedData
- getCachedParentData
- getCollection
- getIterate
- getLastEditedProps
- getProps
- getViews
- initializeCache
- initializeCacheForSpecificData
- initializeCacheForThisData
- printStack
- reposition
- returnNonCachedData
- saveToCache
- transfer
- update
- updateCacheIfNotPresent
- updateCacheLocally
- updateCacheManually
- updateCachedData
- updateIterate
- updateLastEditedProps
- updateView
- updateViews
#
Constructors#
constructor+ new CollectionView(arg
: NishanArg): CollectionView
#
Parameters:Name | Type |
---|---|
arg | NishanArg |
Returns: CollectionView
Inherited from: CollectionBlock
Defined in: core/src/CollectionView.ts:9
#
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:Name | Type |
---|---|
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#
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
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:Name | Type | Description |
---|---|---|
type | TBasicBlockType | TBasicBlockType basic block types |
Returns: void
Inherited from: CollectionBlock
Defined in: core/src/Block.ts:107
#
createViewsâ–¸ createViews(params
: TViewCreateInput[]): ITView
#
Parameters:Name | Type |
---|---|
params | TViewCreateInput[] |
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â–¸ Protected
deleteCachedData(): void
Delete the cached data using the id
Returns: void
Inherited from: CollectionBlock
Defined in: core/src/Data.ts:76
#
deleteIterateâ–¸ Protected
deleteIterate<TD>(args
: FilterTypes<TD>, options
: IterateAndDeleteOptions<ICollectionView>, 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<ICollectionView> |
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:Name | Type | Description |
---|---|---|
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:Name | Type | Description |
---|---|---|
args? | FilterTypes<TView> | - |
multiple? | boolean | whether 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:Name | Type | Description |
---|---|---|
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(): ICollectionView
Get the cached data using the current data id
Returns: ICollectionView
Inherited from: CollectionBlock
Defined in: core/src/Data.ts:62
#
getCachedParentDataâ–¸ getCachedParentData(): IPage
Returns: IPage
Overrides: CollectionBlock
Defined in: core/src/CollectionView.ts:14
#
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â–¸ Protected
getIterate<RD, C>(args
: FilterTypes<RD>, options
: IterateAndGetOptions<ICollectionView, 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<ICollectionView, 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â–¸ Protected
getLastEditedProps(): object
Returns: object
Name | Type |
---|---|
last_edited_by_id | string |
last_edited_by_table | string |
last_edited_time | number |
Inherited from: CollectionBlock
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 |
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:Name | Type |
---|---|
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:Name | Type |
---|---|
id | string |
type | block | 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â–¸ Protected
initializeCacheForThisData(): 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
#
repositionâ–¸ reposition(arg
: RepositionParams): void
#
Parameters:Name | Type |
---|---|
arg | RepositionParams |
Returns: void
Inherited from: CollectionBlock
Defined in: core/src/Block.ts:22
#
returnNonCachedDataâ–¸ returnNonCachedData(ids
: UpdateCacheManuallyParam): UpdateCacheManuallyParam
#
Parameters:Name | Type |
---|---|
ids | UpdateCacheManuallyParam |
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:Name | Type | Description |
---|---|---|
recordMap | Partial<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:Name | Type | Description |
---|---|---|
new_parent_id | string | Id 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:Name | Type | Description |
---|---|---|
args | Partial<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:Name | Type |
---|---|
arg | UpdateCacheManuallyParam |
Returns: Promise<void>
Inherited from: CollectionBlock
Defined in: endpoints/dist/src/Cache.d.ts:24
#
updateCacheLocallyâ–¸ updateCacheLocally(arg
: Partial<ICollectionView>, 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)[], appendToStack?
: boolean): void
Update the cache of the data using only the passed keys
#
Parameters:Name | Type | Description |
---|---|---|
arg | Partial<ICollectionView> | |
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)[] | |
appendToStack? | boolean | - |
Returns: void
Inherited from: CollectionBlock
Defined in: core/src/Data.ts:95
#
updateCacheManuallyâ–¸ updateCacheManually(arg
: string | UpdateCacheManuallyParam): Promise<void>
#
Parameters:Name | Type |
---|---|
arg | string | 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â–¸ Protected
updateIterate<TD, RD, C>(args
: UpdateTypes<TD, RD>, options
: IterateAndUpdateOptions<ICollectionView, 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<ICollectionView, 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â–¸ 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
Inherited from: CollectionBlock
Defined in: core/src/Data.ts:52
#
updateViewâ–¸ updateView(arg
: UpdateType<TView, Partial<ITableView> | Partial<IListView> | Partial<IBoardView> | Partial<IGalleryView> | Partial<ICalendarView> | Partial<ITimelineView>>): Promise<ITView>
#
Parameters:Name | Type |
---|---|
arg | UpdateType<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:Name | Type |
---|---|
args | UpdateTypes<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