diff --git a/.changeset/dirty-yaks-leave.md b/.changeset/dirty-yaks-leave.md new file mode 100644 index 0000000..c3b75c2 --- /dev/null +++ b/.changeset/dirty-yaks-leave.md @@ -0,0 +1,5 @@ +--- +"@gw2api/types": patch +--- + +Add types for `/v2/colors` diff --git a/packages/types/data/color.ts b/packages/types/data/color.ts new file mode 100644 index 0000000..d44769d --- /dev/null +++ b/packages/types/data/color.ts @@ -0,0 +1,48 @@ +export type Color = { + /** The color id */ + id: number; + + /** The name of this color */ + name: string; + + /** The base RGB color */ + base_rgb: [number, number, number]; + + /** Color categories */ + categories: string[]; + + /** Appearance on cloth */ + cloth: ColorMaterial; + + /** Appearance on fur */ + fur?: ColorMaterial; + + /** Appearance on leather */ + leather: ColorMaterial; + + /** Appearance on metal */ + metal: ColorMaterial; + + /** Item id of the dye */ + item?: number; +}; + +type ColorMaterial = { + /** Brightness of the color */ + brightness: number; + + /** Contrast of the color */ + contrast: number; + + /** HSL hue of the color */ + hue: number; + + /** HSL lightness of the color */ + lightness: number; + + /** HSL saturation of the color */ + saturation: number; + + /** Precalculated RGB color */ + rgb: [number, number, number]; +}; diff --git a/packages/types/endpoints.ts b/packages/types/endpoints.ts index 2305ad3..74e6034 100644 --- a/packages/types/endpoints.ts +++ b/packages/types/endpoints.ts @@ -6,6 +6,7 @@ import type { AccountMaterials } from './data/account-material'; import type { AccountWallet } from './data/account-wallet'; import type { AccountWizardsVaultListing, AccountWizardsVaultMetaObjectives, AccountWizardsVaultSpecialObjectives } from './data/account-wizardsvault'; import type { Character, CharacterBackstory, CharacterBuildTab, CharacterCore, CharacterCrafting, CharacterEquipment, CharacterEquipmentTab, CharacterInventory, CharacterRecipes, CharacterSkills, CharacterSpecializations, CharacterTraining } from './data/character'; +import type { Color } from './data/color'; import type { Listing, Price, TransactionCurrent, TransactionHistoric } from './data/commerce'; import type { Createsubtoken } from './data/createsubtoken'; import type { Item } from './data/item'; @@ -409,6 +410,7 @@ export type EndpointType ? BulkExpandedResponseType<'/v2/characters', Url, string, Character> : Url extends CreateSubtokenUrl<'/v2/createsubtoken'> ? Createsubtoken : + Url extends BulkExpandedEndpointUrl<'/v2/colors', number> ? BulkExpandedResponseType<'/v2/colors', Url, number, Color> : Url extends BulkExpandedEndpointUrl<'/v2/items', number> ? BulkExpandedResponseType<'/v2/items', Url, number, Item> : Url extends BulkExpandedEndpointUrl<'/v2/materials', number> ? BulkExpandedResponseType<'/v2/materials', Url, number, MaterialCategory> : Url extends BulkExpandedEndpointUrl<'/v2/quaggans', string> ? BulkExpandedResponseType<'/v2/quaggans', Url, string, Quaggan> :