Update: data.d.ts

This commit is contained in:
xiangyu 2022-08-23 17:41:38 +08:00
parent eaffc800f0
commit fdbf369454

15
typing/data.d.ts vendored
View File

@ -32,6 +32,7 @@ declare interface _ZoteroDataObjectConstructable {
} }
// chrome/content/zotero/xpcom/data/item.js // chrome/content/zotero/xpcom/data/item.js
// TODO: complete this part
declare interface _ZoteroItem extends _ZoteroDataObject { declare interface _ZoteroItem extends _ZoteroDataObject {
isRegularItem: () => boolean; isRegularItem: () => boolean;
@ -64,6 +65,9 @@ declare interface _ZoteroItem extends _ZoteroDataObject {
name?: string; name?: string;
creatorType: string; creatorType: string;
}[]; }[];
getBestAttachment: () => Promise<_ZoteroItem>;
getBestAttachments: () => Promise<_ZoteroItem[]>;
getBestAttachmentState: () => Promise<object>;
// Only image annotation & attachment item // Only image annotation & attachment item
getFilePathAsync: () => string; getFilePathAsync: () => string;
// Only notes // Only notes
@ -72,10 +76,13 @@ declare interface _ZoteroItem extends _ZoteroDataObject {
setNote: (content: string) => void; setNote: (content: string) => void;
getNoteTitle: () => string; getNoteTitle: () => string;
// Only Annotation // Only Annotation
getAnnotations: (includeTrashed: boolean = false) => _ZoteroItem[];
annotationType: string; annotationType: string;
annotationComment: string; annotationComment: string;
annotationText: string; annotationText: string;
annotationPosition: string; annotationPosition: string;
annotationColor: string;
annotationPageLabel: string;
} }
declare interface _ZoteroItemConstructable { declare interface _ZoteroItemConstructable {
@ -130,10 +137,12 @@ declare interface _ZoteroCollection extends _ZoteroDataObject {
loadFromRow: (row: object[]) => void; loadFromRow: (row: object[]) => void;
hasChildCollections: (includeTrashed: boolean = false) => boolean; hasChildCollections: (includeTrashed: boolean = false) => boolean;
hasChildItems: () => boolean; hasChildItems: () => boolean;
getChildCollections: (asIDs: boolean) => _ZoteroCollection[] | number[]; getChildCollections: (
asIDs: boolean = false
) => _ZoteroCollection[] | number[];
getChildItems: ( getChildItems: (
asIDs: boolean, asIDs: boolean,
includeDeleted: boolean includeDeleted: boolean = false
) => _ZoteroItem[] | number[]; ) => _ZoteroItem[] | number[];
addItem: (itemID: number, options: object = {}) => Promise<any>; // do not require save addItem: (itemID: number, options: object = {}) => Promise<any>; // do not require save
addItems: (itemIDs: number[], options: object = {}) => Promise<any>; // do not require save addItems: (itemIDs: number[], options: object = {}) => Promise<any>; // do not require save
@ -144,7 +153,7 @@ declare interface _ZoteroCollection extends _ZoteroDataObject {
diff: (collection: _ZoteroCollection, includeMatches: boolean) => Array<any>; diff: (collection: _ZoteroCollection, includeMatches: boolean) => Array<any>;
clone: (libraryID: number) => _ZoteroCollection; // not saved clone: (libraryID: number) => _ZoteroCollection; // not saved
isCollection: () => true; isCollection: () => true;
serialize: (nested: boolean) => { serialize: (nested: boolean = false) => {
primary: { primary: {
collectionID: number; collectionID: number;
libraryID: number; libraryID: number;