2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-10 07:11:00 +00:00

Add function to list all API providers

This commit is contained in:
Vjacheslav Trushkin 2021-09-12 19:35:26 +03:00
parent 00e71c20dd
commit 6c2eb2392c
2 changed files with 10 additions and 1 deletions

View File

@ -133,3 +133,6 @@ export function getAPIConfig(provider: string): IconifyAPIConfig | undefined {
/** /**
* List API providers * List API providers
*/ */
export function listAPIProviders(): string[] {
return Object.keys(configStorage);
}

View File

@ -10,7 +10,7 @@ import type {
IconifyAPIConfig, IconifyAPIConfig,
PartialIconifyAPIConfig, PartialIconifyAPIConfig,
} from './config'; } from './config';
import { getAPIConfig, setAPIConfig } from './config'; import { getAPIConfig, setAPIConfig, listAPIProviders } from './config';
import type { import type {
IconifyAPIModule, IconifyAPIModule,
IconifyAPIQueryParams, IconifyAPIQueryParams,
@ -83,6 +83,11 @@ export interface IconifyAPIInternalFunctions {
setFetch?: (item: typeof fetch) => void; setFetch?: (item: typeof fetch) => void;
getFetch?: () => typeof fetch | null; getFetch?: () => typeof fetch | null;
/**
* List all API providers (from config)
*/
listAPIProviders: () => string[];
/** /**
* Merge parameters * Merge parameters
*/ */
@ -93,6 +98,7 @@ export const APIInternalFunctions: IconifyAPIInternalFunctions = {
getAPIConfig, getAPIConfig,
setAPIModule, setAPIModule,
sendAPIQuery, sendAPIQuery,
listAPIProviders,
mergeParams, mergeParams,
}; };