From ce5fade7ae1810c57d5a68d8aa17a88ee4920dcd Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 4 Jun 2020 17:29:54 +0300 Subject: [PATCH] Add API provider types to types package --- packages/types/package.json | 2 +- packages/types/provider.ts | 40 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 packages/types/provider.ts diff --git a/packages/types/package.json b/packages/types/package.json index 50011f6..1657e0e 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,7 +1,7 @@ { "name": "@iconify/types", "description": "Types for Iconify data", - "version": "1.0.2", + "version": "1.0.3", "author": "Vjacheslav Trushkin", "license": "(Apache-2.0 OR GPL-2.0)", "main": "./index.js", diff --git a/packages/types/provider.ts b/packages/types/provider.ts new file mode 100644 index 0000000..5abfe18 --- /dev/null +++ b/packages/types/provider.ts @@ -0,0 +1,40 @@ +/** + * Raw data sent by API + */ + +// Links +export interface APIProviderRawDataLinks { + // Collections list + home?: string; + // Collection. Available variables: {prefix} + collection?: string; + // Icon. Available variables: {prefix}, {name} + icon?: string; +} + +// NPM +export interface APIProviderRawDataNPM { + // Package name for installation. Available variables: {prefix} + package?: string; + + // Icon import source. Available variables: {prefix}, {name} + icon?: string; +} + +// Main type +export interface APIProviderRawData { + // Provider name (as used in icon names) + provider: string; + + // Provider name (human readable version) + title?: string; + + // API link(s), though they are usually redundant because API end point is used to retrieve data + api?: string | string[]; + + // Links to website + links?: APIProviderRawDataLinks; + + // NPM packages for icons, used when showing code samples + npm?: APIProviderRawDataNPM; +}