Skip to content

Commit

Permalink
Add types for /v2/colors
Browse files Browse the repository at this point in the history
  • Loading branch information
darthmaim committed Jul 26, 2024
1 parent 3f5f34b commit 0a727f9
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-yaks-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@gw2api/types": patch
---

Add types for `/v2/colors`
48 changes: 48 additions & 0 deletions packages/types/data/color.ts
Original file line number Diff line number Diff line change
@@ -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];
};
2 changes: 2 additions & 0 deletions packages/types/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -409,6 +410,7 @@ export type EndpointType<Url extends KnownEndpoint | (string & {}), Schema exten
Url extends `/v2/characters/${string}/training` ? CharacterTraining :
Url extends BulkExpandedEndpointUrl<'/v2/characters', string> ? BulkExpandedResponseType<'/v2/characters', Url, string, Character<Schema>> :
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<Schema>> :
Url extends BulkExpandedEndpointUrl<'/v2/materials', number> ? BulkExpandedResponseType<'/v2/materials', Url, number, MaterialCategory> :
Url extends BulkExpandedEndpointUrl<'/v2/quaggans', string> ? BulkExpandedResponseType<'/v2/quaggans', Url, string, Quaggan> :
Expand Down

0 comments on commit 0a727f9

Please sign in to comment.