diff --git a/.changeset/pretty-peas-buy.md b/.changeset/pretty-peas-buy.md new file mode 100644 index 0000000..d4538ad --- /dev/null +++ b/.changeset/pretty-peas-buy.md @@ -0,0 +1,5 @@ +--- +"@gw2api/types": patch +--- + +Add types for `/v2/skins` diff --git a/packages/types/data/skin.ts b/packages/types/data/skin.ts new file mode 100644 index 0000000..f10f2b4 --- /dev/null +++ b/packages/types/data/skin.ts @@ -0,0 +1,56 @@ +import type { Gender, Race } from './character'; + +/** + * Skin as returned from `/v2/skins` + * @see https://wiki.guildwars2.com/wiki/API:2/skins + */ +export interface Skin { + /** The id of the skin */ + id: number; + + /** The name of the skin */ + name: string; + + /** Description of the skin */ + description?: string; + + /** The icon of the skin */ + icon?: string; + + /** The rarity of the skin */ + rarity: 'Basic' | 'Masterwork' | 'Legendary' | 'Rare' | 'Exotic' | 'Ascended'; + + /** Flags of this skin */ + flags: SkinFlag[]; + + /** Restrictions of the skin */ + restrictions: string[]; + + /** Skin type */ + type: 'Armor' | 'Back' | 'Gathering' | 'Weapon'; + + /** Skin details */ + details?: { + /** Damage type */ + damage_type?: 'Physical' | 'Choking' | 'Fire' | 'Lightning' | 'Ice'; + + /** Dye slots */ + dye_slots?: { + default: DyeSlot[]; + overrides: Record<`${Race}${Gender}`, DyeSlot[]>; + }; + + /** The subtype of this skin */ + type: 'Leggings' | 'Coat' | 'Boots' | 'Gloves' | 'Shoulders' | 'Helm' | 'HelmAquatic' | 'Foraging' | 'Logging' | 'Mining' | 'LargeBundle' | 'Rifle' | 'SmallBundle' | 'Toy' | 'ToyTwoHanded' | 'Axe' | 'Staff' | 'Hammer' | 'Pistol' | 'Longbow' | 'Dagger' | 'Sword' | 'Shortbow' | 'Focus' | 'Torch' | 'Spear' | 'Mace' | 'Speargun' | 'Greatsword' | 'Scepter' | 'Warhorn' | 'Shield' | 'Trident' | 'Lure' | 'Bait' | 'Fishing'; + + /** The weight class of this armor skin */ + weight_class?: 'Heavy' | 'Light' | 'Medium' | 'Clothing'; + }; +}; + +interface DyeSlot { + color_id: number; + material: 'leather' | 'cloth' | 'metal'; +} + +export type SkinFlag = 'ShowInWardrobe' | 'NoCost' | 'HideIfLocked' | 'OverrideRarity'; diff --git a/packages/types/endpoints.ts b/packages/types/endpoints.ts index 56e4fdf..4a9f067 100644 --- a/packages/types/endpoints.ts +++ b/packages/types/endpoints.ts @@ -14,6 +14,7 @@ import type { Item } from './data/item'; import type { MaterialCategory } from './data/material'; import type { Quaggan } from './data/quaggan'; import type { Recipe } from './data/recipe'; +import type { Skin } from './data/skin'; import type { Title } from './data/title'; import type { Tokeninfo } from './data/tokeninfo'; import type { WizardsVault, WizardsVaultListing, WizardsVaultObjective } from './data/wizardsvault'; @@ -419,6 +420,7 @@ export type EndpointType ? BulkExpandedResponseType<'/v2/materials', Url, number, MaterialCategory> : Url extends BulkExpandedEndpointUrl<'/v2/quaggans', string> ? BulkExpandedResponseType<'/v2/quaggans', Url, string, Quaggan> : Url extends BulkExpandedEndpointUrl<'/v2/recipes', number> ? BulkExpandedResponseType<'/v2/recipes', Url, number, Recipe> : + Url extends BulkExpandedEndpointUrl<'/v2/skins', number> ? BulkExpandedResponseType<'/v2/skins', Url, number, Skin> : Url extends BulkExpandedEndpointUrl<'/v2/titles', number> ? BulkExpandedResponseType<'/v2/titles', Url, number, Title> : Url extends BulkExpandedEndpointUrl<'/v2/commerce/listings', number> ? BulkExpandedResponseType<'/v2/commerce/listings', Url, number, Listing> : Url extends BulkExpandedEndpointUrl<'/v2/commerce/prices', number> ? BulkExpandedResponseType<'/v2/commerce/prices', Url, number, Price> :