coc-api
Version:
Yet another Clash of Clans API, but with TS support
17 lines (14 loc) • 507 B
text/typescript
/// <reference path="../../types/types.d.ts"/>
export default class LocationId {
static readonly path: string = '/locations/{locationId}';
static async get(api: IClashOfClansAPI, locationId: number): Promise<ILocation> {
try {
const res = await api.get<undefined, ILocation>(
this.path.replace('{locationId}', locationId.toString())
);
return res.data;
} catch (err: unknown) {
throw err as IError;
}
}
}