/* istanbul ignore file */ import { ContentType, Uuid } from '@standardnotes/common' import { SNNote, FileItem, SNTag, SmartView, TagItemCountChangeObserver, DecryptedPayloadInterface, EncryptedItemInterface, DecryptedTransferPayload, PredicateInterface, DecryptedItemInterface, SNComponent, SNTheme, DisplayOptions, ItemsKeyInterface, ItemContent, } from '@standardnotes/models' export interface ItemsClientInterface { get invalidItems(): EncryptedItemInterface[] associateFileWithNote(file: FileItem, note: SNNote): Promise disassociateFileWithNote(file: FileItem, note: SNNote): Promise renameFile(file: FileItem, name: string): Promise addTagToNote(note: SNNote, tag: SNTag, addHierarchy: boolean): Promise addTagToFile(file: FileItem, tag: SNTag, addHierarchy: boolean): Promise /** Creates an unmanaged, un-inserted item from a payload. */ createItemFromPayload(payload: DecryptedPayloadInterface): DecryptedItemInterface createPayloadFromObject(object: DecryptedTransferPayload): DecryptedPayloadInterface get trashedItems(): SNNote[] setPrimaryItemDisplayOptions(options: DisplayOptions): void getDisplayableNotes(): SNNote[] getDisplayableTags(): SNTag[] getDisplayableItemsKeys(): ItemsKeyInterface[] getDisplayableFiles(): FileItem[] getDisplayableNotesAndFiles(): (SNNote | FileItem)[] getDisplayableComponents(): (SNComponent | SNTheme)[] getItems(contentType: ContentType | ContentType[]): T[] notesMatchingSmartView(view: SmartView): SNNote[] addNoteCountChangeObserver(observer: TagItemCountChangeObserver): () => void allCountableNotesCount(): number countableNotesForTag(tag: SNTag | SmartView): number findTagByTitle(title: string): SNTag | undefined getTagPrefixTitle(tag: SNTag): string | undefined getTagLongTitle(tag: SNTag): string hasTagsNeedingFoldersMigration(): boolean referencesForItem(itemToLookupUuidFor: DecryptedItemInterface, contentType?: ContentType): DecryptedItemInterface[] itemsReferencingItem(itemToLookupUuidFor: DecryptedItemInterface, contentType?: ContentType): DecryptedItemInterface[] linkNoteToNote(note: SNNote, otherNote: SNNote): Promise linkFileToFile(file: FileItem, otherFile: FileItem): Promise unlinkItems( itemOne: DecryptedItemInterface, itemTwo: DecryptedItemInterface, ): Promise> /** * Finds tags with title or component starting with a search query and (optionally) not associated with a note * @param searchQuery - The query string to match * @param note - The note whose tags should be omitted from results * @returns Array containing tags matching search query and not associated with note */ searchTags(searchQuery: string, note?: SNNote): SNTag[] isValidTagParent(parentTagToLookUpUuidFor: SNTag, childToLookUpUuidFor: SNTag): boolean /** * Returns the parent for a tag */ getTagParent(itemToLookupUuidFor: SNTag): SNTag | undefined /** * Returns the hierarchy of parents for a tag * @returns Array containing all parent tags */ getTagParentChain(itemToLookupUuidFor: SNTag): SNTag[] /** * Returns all descendants for a tag * @returns Array containing all descendant tags */ getTagChildren(itemToLookupUuidFor: SNTag): SNTag[] /** * Get tags for a note sorted in natural order * @param item - The item whose tags will be returned * @returns Array containing tags associated with an item */ getSortedTagsForItem(item: DecryptedItemInterface): SNTag[] isSmartViewTitle(title: string): boolean getSmartViews(): SmartView[] getNoteCount(): number /** * Finds an item by UUID. */ findItem(uuid: Uuid): T | undefined /** * Finds an item by predicate. */ findItems(uuids: Uuid[]): T[] findSureItem(uuid: Uuid): T /** * Finds an item by predicate. */ itemsMatchingPredicate( contentType: ContentType, predicate: PredicateInterface, ): T[] /** * @param item item to be checked * @returns Whether the item is a template (unmanaged) */ isTemplateItem(item: DecryptedItemInterface): boolean createSmartView>( title: string, predicate: PredicateInterface, iconString?: string, ): Promise }