@nextcloud/vue
Version:
Nextcloud vue components
46 lines (45 loc) • 1.58 kB
TypeScript
/**
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
export interface ReferenceProvider {
id: string;
title: string;
icon_url: string;
order: number;
search_providers_ids?: string[];
}
export declare const anyLinkProviderId = "any-link";
/**
* @param providerId - The provider ID
* @return The provider object
*/
export declare function getProvider(providerId: string): ReferenceProvider | undefined;
/**
* Get raw provider list as it was provided by the server
*/
export declare function getProviders(): ReferenceProvider[];
/**
* Helper function to sort a list of providers according to 2 factors:
* - their "last used timestamp"
* - their "order" property (coming from the provider declaration in the server implementation)
*
* @param providerList - List of provider objects
* @return The sorted provider list
*/
export declare function sortProviders(providerList: ReferenceProvider[]): ReferenceProvider[];
/**
* Helper function to search a provider from a search query
* Result is a sorted list of providers
*
* @param query - The search query
* @param limit - (optional) max number of results
* @return The sorted/filtered provider list
*/
export declare function searchProvider(query: string, limit?: number): ReferenceProvider[];
/**
* Update the "last used timestamp" on the server side and then locally in the frontend
*
* @param providerId - The id of the search provider
*/
export declare function touchProvider(providerId: number): Promise<void>;