csgopaka-typescript
v2.0.2
Published
API for csgopaka.com
Downloads
11
Maintainers
Readme
csgopaka-typescript
Examples
Buy item
import CSGOPaka from "../src";
(async () => {
try {
const csgopaka = new CSGOPaka("APIKEY");
const item = await csgopaka.buyItem(41678, "TRADE_URL");
console.log(item);
} catch (error) {
console.log(error);
}
})();
Get wallet balance
import CSGOPaka from "../src";
(async () => {
try {
const wallet = await (new CSGOPaka("APIKEY")).walletBalance();
console.log(wallet);
console.log(wallet.balance);
console.log(wallet.balanceFormatted);
} catch (error) {
console.log(error);
}
})();
Item info
import CSGOPaka from "../src";
(async () => {
try {
const csgopaka = new CSGOPaka("APIKEY");
const item = await csgopaka.itemInfo(41678);
console.log(item.toArray());
} catch (error) {
console.log(error);
}
})();
Search items
import CSGOPaka from "../src";
import {SearchSingleItemResponse} from "../src/responses/searchSingleItem.response";
(async () => {
try {
const csgopaka = new CSGOPaka("APIKEY");
const searcher = csgopaka.searchItems()
.setNameFilter('FAMAS')
.setMarketHashNameFilter('(Well-Worn)')
.setAppIdFilter(730)
.setPage(1)
.setLimit(3);
const searchResult = await searcher.search();
const pagination = searchResult.getPagination();
console.log(pagination.getCurrentPage());
console.log(pagination.getFirstPage());
console.log(pagination.getNextPage());
console.log(pagination.getPages());
console.log(pagination.getPerPage());
console.log(pagination.getPreviousPage());
console.log(pagination.getTotal());
const items: SearchSingleItemResponse[] = searchResult.getItems();
items.forEach((item: SearchSingleItemResponse) => {
console.log(item.toArray());
console.log(item.getId());
console.log(item.getName());
console.log(item.getAppId());
console.log(item.getImage());
console.log(item.getPrice());
console.log(item.getMarketHashName());
console.log(item.getSteamPrice());
});
} catch (error) {
console.log(error);
}
})();