UNPKG

guildwars2-ts

Version:

GuildWars 2 API Wrapper in Typescript

61 lines (60 loc) 2.02 kB
import type { z } from 'zod'; import { ApiBase } from '../../base/apiBase'; import { CommerceListingsDTO, CommercePricesDTO } from '../../models'; import { numberArrayType } from '../v2apiUtils'; /** * /v2/commerce Api */ export declare class CommerceApi extends ApiBase { /** * Provides access to the current items and coins available for pickup on this account. */ getDeliveries(): Promise<{ coins: number; items: { id: number; count: number; }[]; }>; /** * Returns the current coins to gems exchange rate, or vice versa. * * NOTE: When requesting coins, if the api responds with a 400, the coin amount is too low * * @param type - Gems to coins, or vice versa * @param quantity - Quantity of coins to be exchanged (in copper coins) */ getExchange(type: 'gems' | 'coins', quantity: number): Promise<{ coins_per_gem: number; quantity: number; }>; getListings(): Promise<z.infer<typeof numberArrayType>>; /** * Returns current buy and sell listings from the trading post. * * @param ids - Listing ids */ getListings(ids: number[]): Promise<z.infer<typeof CommerceListingsDTO>>; getPrices(): Promise<z.infer<typeof numberArrayType>>; /** * Returns current aggregated buy and sell listing information from the trading post. * * @param ids - Item ids */ getPrices(ids: number[]): Promise<z.infer<typeof CommercePricesDTO>>; /** * Provides access to the current and historical transactions of a player. * Results are cached for 5 minutes. * * @param status - Current or historical transactions * @param type - Buy or sell transactions */ getTransactions(status: 'current' | 'history', type: 'buys' | 'sells'): Promise<{ id: number; item_id: number; price: number; quantity: number; created: string; purchased?: string | undefined; }[]>; }