60 lines
1.8 KiB
TypeScript
60 lines
1.8 KiB
TypeScript
/**
|
|
* EVE Swagger Interface - Alliance Endpoints
|
|
* https://developers.eveonline.com/api-explorer#/operations/GetAlliances
|
|
*/
|
|
import { esiFetch, type PublicEsiOptions } from './util/fetch';
|
|
|
|
/**
|
|
* List all active player alliances
|
|
* - This route is cached for an hour
|
|
* @returns {number[]} - An array of all active player alliance ids
|
|
*/
|
|
export async function listAlliances(options?: PublicEsiOptions): Promise<number[]> {
|
|
return await esiFetch<number[]>('/alliances/', options);
|
|
}
|
|
|
|
interface AllianceInfo {
|
|
creator_corporation_id: number;
|
|
creator_id: number;
|
|
date_founded: string;
|
|
executor_corporation_id: number;
|
|
faction_id: number;
|
|
name: string;
|
|
ticker: string;
|
|
}
|
|
|
|
/**
|
|
* Get information about a specific alliance
|
|
* - This route is cached for an hour
|
|
* @param alliance_id Alliance id
|
|
* @returns {AllianceInfo}
|
|
*/
|
|
export async function getAllianceInformation(alliance_id: number, options?: PublicEsiOptions): Promise<Partial<AllianceInfo>> {
|
|
return await esiFetch<Partial<AllianceInfo>>(`/alliances/${alliance_id}/`, options);
|
|
}
|
|
|
|
/**
|
|
* List all corporations in an alliance
|
|
* - This route is cached for an hour
|
|
* @param alliance_id Alliance id
|
|
* @returns {number[]} - Array of corporation ids
|
|
*/
|
|
export async function listAllianceCorporations(alliance_id: number, options?: PublicEsiOptions): Promise<number[]> {
|
|
return await esiFetch<number[]>(`/alliances/${alliance_id}/corporations/`, options);
|
|
}
|
|
|
|
interface AllianceIcon {
|
|
px128x128: string;
|
|
px64x64: string;
|
|
}
|
|
|
|
/**
|
|
* Get alliance icon
|
|
* - This route is cached for an hour
|
|
* @param alliance_id Alliance id
|
|
* @returns {AllianceIcon}
|
|
*/
|
|
export async function getAllianceIcon(alliance_id: number, options?: PublicEsiOptions): Promise<Partial<AllianceIcon>> {
|
|
return await esiFetch<Partial<AllianceIcon>>(`/alliances/${alliance_id}/icons/`, options);
|
|
}
|