Skip to content

Commit

Permalink
Add types for /v2/currencies
Browse files Browse the repository at this point in the history
  • Loading branch information
darthmaim committed Jul 26, 2024
1 parent 0a727f9 commit 76bd812
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/five-tools-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@gw2api/types": patch
---

Add types for `/v2/currencies`
4 changes: 4 additions & 0 deletions packages/types/data/color.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Color as returned from /v2/colors
* @see https://wiki.guildwars2.com/wiki/API:2/colors
*/
export type Color = {
/** The color id */
id: number;
Expand Down
20 changes: 20 additions & 0 deletions packages/types/data/currency.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Currency as returned from /v2/currencies
* @see https://wiki.guildwars2.com/wiki/API:2/currencies
*/
export type Currency = {
/** The currency id */
id: number;

/** The name of the currency */
name: string;

/** The description of the currency */
description: string;

/** The order as displayed in-game */
order: number;

/** The icon of the currency */
icon: string;
}
2 changes: 2 additions & 0 deletions packages/types/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { Character, CharacterBackstory, CharacterBuildTab, CharacterCore, C
import type { Color } from './data/color';
import type { Listing, Price, TransactionCurrent, TransactionHistoric } from './data/commerce';
import type { Createsubtoken } from './data/createsubtoken';
import type { Currency } from './data/currency';
import type { Item } from './data/item';
import type { MaterialCategory } from './data/material';
import type { Quaggan } from './data/quaggan';
Expand Down Expand Up @@ -411,6 +412,7 @@ export type EndpointType<Url extends KnownEndpoint | (string & {}), Schema exten
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/currencies', number> ? BulkExpandedResponseType<'/v2/currencies', Url, number, Currency> :
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 76bd812

Please sign in to comment.