-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstore-top-sellers.service.ts
More file actions
53 lines (51 loc) · 1.64 KB
/
store-top-sellers.service.ts
File metadata and controls
53 lines (51 loc) · 1.64 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
46
47
48
49
50
51
52
53
import type { SteamDataRequest } from '../schemas'
import type { StoreTopSellersResponse } from '../schemas/responses/store-top-sellers.schema'
import { BaseService } from './_base.service'
export class StoreTopSellersService extends BaseService {
constructor(apiKey: string) {
super(apiKey, 'api', 'IStoreTopSellersService')
}
/**
* @param data_request - The data request to include in the request
* @param context - The context to include in the request
* @param country_code - The country code to use for the request. If not provided, will default to 'US'. Must be a valid ISO 3166-1 alpha-2 country code.
* @param page_start - For pagination, start at the Nth top seller (0-indexed)
* @param page_count - # of top sellers to return per page
* @param start_date - The start date of the week to return. LEave blank for current week.
*/
async getStoreWeeklyTopSellers({
data_request,
context = {
// Note: this doesnt seem to make a difference as to what country code is used, but it is required by the API.
country_code: 'US',
},
country_code = 'US',
page_start = 0,
page_count = 20,
start_date,
}: {
data_request?: SteamDataRequest
context?: {
country_code: string
}
country_code?: string
page_start?: number
page_count?: number
start_date?: number
}): Promise<StoreTopSellersResponse> {
const url = this.generateSteamUrl(`/GetWeeklyTopSellers/v1`, {
input_json: JSON.stringify({
data_request,
context,
country_code,
page_start,
page_count,
start_date,
}),
})
const response = await this.sendGETRequest<{
response: StoreTopSellersResponse
}>(url)
return response.response
}
}