-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathecon.service.ts
More file actions
45 lines (41 loc) · 1.12 KB
/
Copy pathecon.service.ts
File metadata and controls
45 lines (41 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import type { TradeOffersSummaryResponse } from '../schemas/responses'
import { BaseService } from './_base.service'
export class EconService extends BaseService {
constructor(apiKey: string) {
super(apiKey, 'api', 'IEconService')
}
/**
* Gets count of pending and new trade offers
*/
async getTradeOffersSummary(
steamUserId: string,
): Promise<TradeOffersSummaryResponse> {
const url = this.generateSteamUrl(`/GetTradeOffersSummary/v1`, {
steamid: steamUserId,
})
const response = await this.sendGETRequest<{
response: TradeOffersSummaryResponse
}>(url)
return response.response
}
/**
* Get a history of trades
* TODO: Not yet typed
*/
async getTradeHistory(steamUserId: string): Promise<any> {
const url = this.generateSteamUrl(`/GetTradeHistory/v1`, {
steamid: steamUserId,
})
return await this.sendGETRequest<any>(url)
}
/**
* Get a list of trade offers
* TODO: Not yet typed
*/
async getTradeOffers(steamUserId: string): Promise<any> {
const url = this.generateSteamUrl(`/GetTradeOffers/v1`, {
steamid: steamUserId,
})
return await this.sendGETRequest<any>(url)
}
}