2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-12 21:57:50 +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
*/
export function listAPIProviders(): string[] {
return Object.keys(configStorage);
}

View File

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