///
declare type HttpMethod = 'get' | 'post' | 'patch' | 'put' | 'delete';
declare type RumpusServer = 'local' | 'dev' | 'beta';
export declare type VersionedItem = 'privacy' | 'terms' | 'terms-rce' | 'rumpus';
export interface DelegationOptions {
delegationKey?: string;
doNotUseKey?: boolean;
}
export interface RequestOptions extends DelegationOptions {
body?: Record;
query?: {
[param: string]: string | number | boolean | undefined;
};
}
export interface RumpusResponse {
status: number;
data: Data;
meta?: any;
message?: string;
location?: string;
next?: string;
errors: any[];
headers: {
[header: string]: string;
};
requestId: string;
remainingRequests: number;
}
export interface RateLimitInfo {
limit: number;
remaining: number;
nextReset: Date;
}
/** Class for interacting with the Rumpus CE API. */
export default class RumpusCE {
defaultDelegationKey: string | undefined;
private _server;
private _request;
private _levelheadAPI;
private _baseUrl;
private _rateLimitInfo;
constructor(defaultDelegationKey?: string | undefined, server?: RumpusServer, auth?: {
username: string;
password: string;
});
/** Rumpus has multiple servers for different stages of development. */
get server(): RumpusServer;
/** Given the specific Rumpus server this RumpusCE instance is talking to, the base URL making up the root of all requests. */
get baseUrl(): string;
/** The Rumpus CE Levelhead API, as a nested collection of methods. */
get levelhead(): {
aliases: {
search: (userIds: string | string[], query?: import("../index.js").AliasSearch | undefined, options?: DelegationOptions | undefined) => Promise;
};
bookmarks: {
search: (query?: import("../index.js").BookmarkSearch | undefined, options?: DelegationOptions | undefined) => Promise;
add: (levelId: string, options?: DelegationOptions | undefined) => Promise;
remove: (levelId: string, options?: DelegationOptions | undefined) => Promise;
};
levels: {
search: (query?: import("../index.js").LevelheadLevelSearch | undefined, options?: DelegationOptions | undefined) => Promise>;
getTags: (options?: DelegationOptions | undefined) => Promise;
getLikes: (levelId: string, query?: import("../index.js").LevelheadLevelLikesSearch | undefined, options?: DelegationOptions | undefined) => Promise>;
getFavorites: (levelId: string, query?: {
limit?: number | undefined;
userIds?: string | string[] | undefined;
beforeId?: string | undefined;
includeAliases?: boolean | undefined;
} | undefined, options?: DelegationOptions | undefined) => Promise>;
};
players: {
search: (query?: import("../index.js").LevelheadPlayerSearch | undefined, options?: DelegationOptions | undefined) => Promise>;
getPlayer: (userId?: string | undefined, options?: DelegationOptions | undefined) => Promise;
getLikedLevels: (userId?: string | undefined, query?: import("../index.js").LevelheadPlayerLikesSearch | undefined, options?: DelegationOptions | undefined) => Promise>;
getFavoritedLevels: (userId?: string | undefined, query?: import("../index.js").LevelheadPlayerLikesSearch | undefined, options?: DelegationOptions | undefined) => Promise>;
getFollowers: (userId?: string | undefined, query?: import("../index.js").LevelheadPlayerFollowsSearch | undefined, options?: DelegationOptions | undefined) => Promise>;
/** The Rumpus CE Levelhead API, as a nested collection of methods. */
getFollowing: (userId?: string | undefined, query?: import("../index.js").LevelheadPlayerFollowsSearch | undefined, options?: DelegationOptions | undefined) => Promise>;
follow: (userId: string, options?: DelegationOptions | undefined) => Promise;
unfollow: (userId: string, options?: DelegationOptions | undefined) => Promise;
};
};
/**
* Number of requests that can be made by this client
* before running into the API rate limit (unless the
* cooldown has expired.)
*/
get requestsRemaining(): number;
/**
* Whether the client has hit the rate limit and, if so,
* is still within the cooldown period. If `true` the
* client will receive a 429 error until the cooldown
* expires.
*/
get isRateLimited(): boolean;
get rateLimitInfo(): RateLimitInfo;
/** Fetch version information from Rumpus, including server and legal doc versions.
* Useful for triggering events on change (e.g. when the server version changes,
* that might indicate broken or new funcionality; when legal docs change, the change
* in version is considered your notice).
* */
version(): Promise<{
server: RumpusServer;
rumpus: string;
terms: string;
'terms-rce': string;
privacy: string;
}>;
/** Get the list of permissions for a given Delegation Key.
* Useful for verifying that your calls to Rumpus CE will succeed.
*/
delegationKeyPermissions(delegationKey?: string): Promise<{
userId: string;
passId: string;
permissions: (string | {
url: string;
methods: string[];
})[];
}>;
/** Send a GET request to Rumpus CE. */
get(url: string, options?: Omit): Promise>;
/** Send a POST request to Rumpus CE. */
post(url: string, options?: RequestOptions): Promise>;
/** Send a PUT request to Rumpus CE. */
put(url: string, options?: RequestOptions): Promise>;
/** Send a PATCH request to Rumpus CE. */
patch(url: string, options?: RequestOptions): Promise>;
delete(url: string, options?: Omit): Promise>;
/** Send a request to Rumpus CE. */
request(method: HttpMethod, url: string, options?: RequestOptions): Promise>;
createLogoUrl(size: number): string;
}
export {};
//# sourceMappingURL=RumpusCE.d.ts.map