ddnet
Version:
A typescript npm package for interacting with data from ddnet.org
85 lines (84 loc) • 1.96 kB
TypeScript
import { Community } from './Community.js';
/**
* Represents servers info.
*/
export declare class Info {
#private;
/**
* Info responses cache. (12h default TTL)
*/
private static cache;
/**
* Sets the TTL (Time-To-Live) for objects in cache.
*/
static setTTL: (ttlMS?: number) => void;
/**
* Clears the {@link Info.cache}.
*/
static clearCache: () => Promise<void>;
/**
* List of major communities.
*/
communities: Community[];
/**
* Community icons directory.
*/
communityIconsDownloadUrl: string;
/**
* Game news.
*/
news: string;
/**
* Maps directory.
*/
mapDownloadUrl: string;
/**
* Latest game version.
*/
version: string;
/**
* Other parsed data.
*
* @remarks
* I think this is mostly used in the client. Still I parsed the data and added it here.
*/
other: {
location: string;
stunServersIpv6: string[];
stunServersIpv4: string[];
warnPngliteIncompatibleImages: boolean;
};
/**
* Create a new instance of {@link Info} from API data.
* Not intended to be used, use {@link new Info.new} instead.
*/
private constructor();
/**
* Fetch, parse and construct a new {@link Info} instance.
*/
static new(
/**
* Wether to bypass the info data cache.
*/
bypassCache?: boolean): Promise<Info>;
/**
* Parse an object using the {@link _Schema_info raw data zod schema}.
*/
private static parseObject;
/**
* Fetch the info data from the API.
*/
private static makeRequest;
/**
* Populate the object with the raw info data.
*/
private populate;
/**
* Refresh the info data.
*/
refresh(): Promise<this>;
/**
* Get all server addresses from all communities.
*/
getAllServerAddresses(): string[];
}