Initial commit
This commit is contained in:
39
packages/lib/src/eve/esi/location.ts
Normal file
39
packages/lib/src/eve/esi/location.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { checkScopesAndGetCharacterId, esiFetch, type EsiOptions } from './util/fetch';
|
||||
|
||||
import { ESI_SCOPE } from '../oauth';
|
||||
export interface Location {
|
||||
solar_system_id: number;
|
||||
station_id: number;
|
||||
structure_id: number;
|
||||
}
|
||||
|
||||
// required scope: esi-location.read_location.v1
|
||||
export function getCharacterLocation(options: EsiOptions) {
|
||||
const character_id = checkScopesAndGetCharacterId(options, ESI_SCOPE['esi-location.read_location.v1']);
|
||||
return esiFetch<Partial<Location>>(`/characters/${character_id}/location/`, options);
|
||||
}
|
||||
|
||||
export interface Online {
|
||||
last_login: string;
|
||||
last_logout: string;
|
||||
logins: number;
|
||||
online: boolean;
|
||||
}
|
||||
|
||||
// required scope: esi-location.read_online.v1
|
||||
export function getCharacterOnline(options: EsiOptions) {
|
||||
const character_id = checkScopesAndGetCharacterId(options, ESI_SCOPE['esi-location.read_online.v1']);
|
||||
return esiFetch<Partial<Online>>(`/characters/${character_id}/online/`, options);
|
||||
}
|
||||
|
||||
export interface CurrentShip {
|
||||
ship_item_id: number;
|
||||
ship_type_id: number;
|
||||
ship_name: string;
|
||||
}
|
||||
|
||||
// required scope: esi-location.read_ship_type.v1
|
||||
export function getCharacterCurrentShip(options: EsiOptions) {
|
||||
const character_id = checkScopesAndGetCharacterId(options, ESI_SCOPE['esi-location.read_ship_type.v1']);
|
||||
return esiFetch<Partial<CurrentShip>>(`/characters/${character_id}/ship/`, options);
|
||||
}
|
||||
Reference in New Issue
Block a user