Class CollectionAPI<T>Internal
Constructors
constructor
- new CollectionAPI<T>(api, collectionName, collectionOptions?, contextOptions?): CollectionAPI<T>
Type Parameters
- T extends Doc = {
id: string;
}
Properties
Private
collectionName
collectionName: string
Private
collectionOptions
Methods
getAll
- getAll(filter?, options?): Promise<T[]>
Parameters
- filter: FilterObject = {}
- options: {
endOffset?: number;
orderBy?: OrderBy;
startOffset?: number;
} = {}Optional
endOffset?: number
Optional
orderBy?: OrderBy
Optional
startOffset?: number
Returns Promise<T[]>
getOne
- getOne(docId): Promise<T>
Returns Promise<T>
getPage
- getPage(pageNumber, pageSize, filter?, options?): Promise<T[]>
Parameters
- pageNumber: number
- pageSize: number
- filter: FilterObject = {}
- options: {
orderBy?: OrderBy;
} = {}
Returns Promise<T[]>
insertOne
- insertOne(doc): Promise<string>
Returns Promise<string>
The doc ID
replaceOne
- replaceOne(docId, doc): Promise<BazaarMessage>
Parameters
- docId: string
- doc: T | Omit<T, "id">
subscribeAll
- subscribeAll(filter, listener): Promise<(() => Promise<BazaarMessage>)>
Returns Promise<(() => Promise<BazaarMessage>)>
An unsubscribe function
subscribeOne
- subscribeOne(docId, listener): Promise<(() => Promise<BazaarMessage>)>
Returns Promise<(() => Promise<BazaarMessage>)>
An unsubscribe function
Private
withCollection
- withCollection(collectionQuery): Promise<any>
Parameters
- collectionQuery: (() => Promise<any>)
- (): Promise<any>
Returns Promise<any>
Returns Promise<any>