@sodiumlabs/gdapi
Version:
An unofficial Geometry Dash API wrapper
1,311 lines (1,294 loc) • 32.4 kB
TypeScript
import { z } from 'zod';
declare const gauntletMappings: {
1: string;
3: string;
};
declare enum GauntletName {
Fire = 1,
Ice = 2,
Poison = 3,
Shadow = 4,
Lava = 5,
Bonus = 6,
Chaos = 7,
Demon = 8,
Time = 9,
Crystal = 10,
Magic = 11,
Spike = 12,
Monster = 13,
Doom = 14,
Death = 15,
Forest = 16,
Force = 18,
Water = 21,
Haunted = 22,
Halloween = 29,
Inferno = 33,
Portal = 34,
Strange = 35,
Fantasy = 36,
Christmas = 37,
Mystery = 39,
Cursed = 40,
Cyborg = 41,
Castle = 42,
World = 46,
Galaxy = 47,
Universe = 48,
Discord = 49,
Split = 50,
NCSI = 51,
NCSII = 52
}
declare const gauntletSchema: z.ZodObject<{
/**
* The gauntlet ID
*/
id: z.ZodNumber;
/**
* The level IDs
*/
levels: z.ZodPipeline<z.ZodEffects<z.ZodString, string[], string>, z.ZodArray<z.ZodNumber, "many">>;
}, "strip", z.ZodTypeAny, {
id: number;
levels: number[];
}, {
id: number;
levels: string;
}>;
type Gauntlet = z.infer<typeof gauntletSchema>;
declare const levelMappings: {
1: string;
2: string;
3: string;
5: string;
6: string;
8: string;
9: string;
10: string;
12: string;
13: string;
14: string;
15: string;
16: string;
17: string;
18: string;
19: string;
25: string;
30: string;
31: string;
35: string;
37: string;
38: string;
39: string;
42: string;
43: string;
44: string;
45: string;
};
declare enum LevelDifficultyDenominator {
NA = 0,
Assigned = 10
}
declare enum LevelDifficultyNumerator {
Unrated = 0,
Easy = 10,
Normal = 20,
Hard = 30,
Harder = 40,
Insane = 50
}
declare enum LevelLength {
Tiny = 0,
Short = 1,
Medium = 2,
Long = 3,
XL = 4,
Platformer = 5
}
declare enum LevelEpicRating {
None = 0,
Epic = 1,
Legendary = 2,
Mythic = 3
}
declare enum LevelDemonDifficulty {
Easy = 3,
Medium = 4,
Hard = 0,
Insane = 5,
Extreme = 6
}
declare const levelSchema: z.ZodObject<{
/**
* The id of the level
*/
id: z.ZodNumber;
/**
* The name of the level
*/
name: z.ZodString;
/**
* The level description
*/
description: z.ZodEffects<z.ZodString, string, string>;
/**
* The version of the level published
*/
version: z.ZodNumber;
/**
* The player ID of the level author
*/
playerId: z.ZodNumber;
/**
* Returns 0 if the level is N/A, returns 10 if a difficulty is assigned.
*
* @type {LevelDifficultyDenominator}
*/
difficultyDenominator: z.ZodNumber;
/**
* The nominator used for calculating the level difficulty. Divided by the denominator to get the difficulty icon.
*
* Nowadays just 0 = unrated, 10 = easy, 20 = normal, 30 = hard, 40 = harder, 50 = insane.
*
* Can be also used to determine the demon difficulty as a side-effect of the voting system.
*
* @type {LevelDifficultyNumerator}
*/
difficultyNumerator: z.ZodNumber;
/**
* The amount of times the level has been downloaded
*/
downloads: z.ZodNumber;
/**
* The official song number used by the level, if applicable
*/
officialSong: z.ZodOptional<z.ZodNumber>;
/**
* The GD version the level was uploaded in.
* Divide the version number by ten to get the correct number.
*/
gameVersion: z.ZodEffects<z.ZodNumber, number, number>;
/**
* likes - dislikes
*/
likes: z.ZodNumber;
/**
* A number from 0-4, where 0 is tiny and 4 is XL
*
* @type {LevelLength}
*/
length: z.ZodNumber;
/**
* dislikes - likes
*/
dislikes: z.ZodOptional<z.ZodNumber>;
/**
* If the level's difficulty is demon
*/
demon: z.ZodBoolean;
/**
* The amount of stars rewarded for completing the level
*/
stars: z.ZodNumber;
/**
* 0 if the level is not featured, otherwise a positive number. The higher it is, the higher the level appears on the featured levels list.
*/
featureScore: z.ZodNumber;
/**
* If the level's difficulty is auto
*/
auto: z.ZodBoolean;
/**
* The ID the of the original level (if the level was copied)
*/
copiedId: z.ZodNumber;
/**
* Whether the level uses two player mode
*/
twoPlayer: z.ZodBoolean;
/**
* The ID of the custom Newgrounds song used in the level
*/
customSongId: z.ZodNumber;
/**
* The number of user coins placed in the level
*/
coins: z.ZodNumber;
/**
* If the level's user coins are verified (silver)
*/
verifiedCoins: z.ZodBoolean;
/**
* The star value requested for the level
*/
starsRequested: z.ZodNumber;
/**
* The epic rating for the level
*
* @type {LevelEpicRating}
*/
epic: z.ZodNumber;
/**
* The difficulty of the demon rating. Can also be used to determine the level difficulty non-demons had before rating as a side-effect of the voting system.
*
* @type {LevelDemonDifficulty}
*/
demonDifficulty: z.ZodNumber;
/**
* If the level is in a gauntlet
*/
isGauntlet: z.ZodBoolean;
/**
* The amount of objects in the level, used to determine if the level is considered "large". It caps at 65535
*/
objects: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
id: number;
length: number;
name: string;
description: string;
version: number;
playerId: number;
difficultyDenominator: number;
difficultyNumerator: number;
downloads: number;
gameVersion: number;
likes: number;
demon: boolean;
stars: number;
featureScore: number;
auto: boolean;
copiedId: number;
twoPlayer: boolean;
customSongId: number;
coins: number;
verifiedCoins: boolean;
starsRequested: number;
epic: number;
demonDifficulty: number;
isGauntlet: boolean;
objects: number;
officialSong?: number | undefined;
dislikes?: number | undefined;
}, {
id: number;
length: number;
name: string;
description: string;
version: number;
playerId: number;
difficultyDenominator: number;
difficultyNumerator: number;
downloads: number;
gameVersion: number;
likes: number;
demon: boolean;
stars: number;
featureScore: number;
auto: boolean;
copiedId: number;
twoPlayer: boolean;
customSongId: number;
coins: number;
verifiedCoins: boolean;
starsRequested: number;
epic: number;
demonDifficulty: number;
isGauntlet: boolean;
objects: number;
officialSong?: number | undefined;
dislikes?: number | undefined;
}>;
type Level = z.infer<typeof levelSchema>;
declare const listMappings: {
1: string;
2: string;
3: string;
5: string;
7: string;
10: string;
14: string;
19: string;
28: string;
29: string;
49: string;
50: string;
51: string;
55: string;
56: string;
};
declare enum ListDifficulty {
NA = -1,
Auto = 0,
Easy = 1,
Normal = 2,
Hard = 3,
Harder = 4,
Insane = 5,
EasyDemon = 6,
MediumDemon = 7,
HardDemon = 8,
InsaneDemon = 9,
ExtremeDemon = 10
}
declare const listSchema: z.ZodObject<{
/**
* The id of the list
*/
id: z.ZodNumber;
/**
* The name of the list
*/
name: z.ZodString;
/**
* The list description
*/
description: z.ZodEffects<z.ZodString, string, string>;
/**
* The version of the list published
*/
version: z.ZodNumber;
/**
* The difficulty of this list
*
* @type {ListDifficulty}
*/
difficulty: z.ZodNumber;
/**
* The amount of times the list has been downloaded
*/
downloads: z.ZodNumber;
/**
* likes - dislikes
*/
likes: z.ZodNumber;
/**
* If the list is rated or not
*/
rated: z.ZodBoolean;
/**
* The timestamp of when the list was uploaded
*/
uploadedAt: z.ZodNumber;
/**
* The timestamp of when the list was last updated
*/
updatedAt: z.ZodNumber;
/**
* The account ID of the list author
*/
accountId: z.ZodNumber;
/**
* The username of the list author
*/
username: z.ZodString;
/**
* All level IDs in the list
*/
levels: z.ZodPipeline<z.ZodEffects<z.ZodString, string[], string>, z.ZodArray<z.ZodNumber, "many">>;
/**
* The amount of diamonds awarded upon beating the required amount of levels in the list
*/
reward: z.ZodNumber;
/**
* The amount of levels needed to claim the list reward
*/
rewardRequirement: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
id: number;
levels: number[];
name: string;
description: string;
version: number;
downloads: number;
likes: number;
difficulty: number;
rated: boolean;
uploadedAt: number;
updatedAt: number;
accountId: number;
username: string;
reward: number;
rewardRequirement: number;
}, {
id: number;
levels: string;
name: string;
description: string;
version: number;
downloads: number;
likes: number;
difficulty: number;
rated: boolean;
uploadedAt: number;
updatedAt: number;
accountId: number;
username: string;
reward: number;
rewardRequirement: number;
}>;
type List = z.infer<typeof listSchema>;
declare const mapPacksMappings: {
1: string;
2: string;
3: string;
4: string;
5: string;
6: string;
7: string;
8: string;
};
declare enum MapPackDifficulty {
Auto = 0,
Easy = 1,
Normal = 2,
Hard = 3,
Harder = 4,
Insane = 5,
HardDemon = 6,
EasyDemon = 7,
MediumDemon = 8,
InsaneDemon = 9,
ExtremeDemon = 10
}
declare const mapPacksSchema: z.ZodObject<{
/**
* The Map Pack ID
*/
id: z.ZodNumber;
/**
* The Map Pack name
*/
name: z.ZodString;
/**
* The level IDs
*/
levels: z.ZodPipeline<z.ZodEffects<z.ZodString, string[], string>, z.ZodArray<z.ZodNumber, "many">>;
/**
* Stars given when completed
*/
stars: z.ZodNumber;
/**
* Coins given when completed
*/
coins: z.ZodNumber;
/**
* The Map Pack difficulty
*
* @type {MapPackDifficulty}
*/
difficulty: z.ZodNumber;
/**
* The RGB color of the title text
*/
textColor: z.ZodPipeline<z.ZodEffects<z.ZodString, string[], string>, z.ZodArray<z.ZodNumber, "many">>;
/**
* The RGB color of the completion bar
*/
barColor: z.ZodPipeline<z.ZodEffects<z.ZodString, string[], string>, z.ZodArray<z.ZodNumber, "many">>;
}, "strip", z.ZodTypeAny, {
id: number;
levels: number[];
name: string;
stars: number;
coins: number;
difficulty: number;
textColor: number[];
barColor: number[];
}, {
id: number;
levels: string;
name: string;
stars: number;
coins: number;
difficulty: number;
textColor: string;
barColor: string;
}>;
type MapPack = z.infer<typeof mapPacksSchema>;
declare const songMappings: {
1: string;
2: string;
3: string;
4: string;
5: string;
6: string;
7: string;
8: string;
9: string;
10: string;
11: string;
12: string;
13: string;
14: string;
15: string;
};
declare enum SongNong {
None = 0,
NCS = 1
}
declare enum SongNewType {
Yellow = 0,
Blue = 1
}
declare const songSchema: z.ZodObject<{
/**
* The ID of the song on Newgrounds
*/
id: z.ZodOptional<z.ZodNumber>;
/**
* The name of the song
*/
name: z.ZodString;
/**
* Newgrounds Artist ID
*/
artistId: z.ZodNumber;
/**
* The name of the artist who made the song
*/
artistName: z.ZodString;
/**
* Size of the song in MB, rounded to two decimal places
*/
size: z.ZodNumber;
/**
* The Video ID for the songs YouTube Video
*/
videoId: z.ZodOptional<z.ZodString>;
/**
* The URL of the newgrounds user's youtube channel
*/
youtubeURL: z.ZodOptional<z.ZodString>;
/**
* If the song artist is scouted on newgrounds
*/
isVerified: z.ZodBoolean;
/**
* Priority over the song list
*/
songPriority: z.ZodOptional<z.ZodNumber>;
/**
* Link to the song's mp3
*/
link: z.ZodEffects<z.ZodString, string, string>;
/**
* Type of NONG (Not on Newgrounds)
*
* @type {SongNong}
*/
nong: z.ZodOptional<z.ZodNumber>;
/**
* IDs of extra artists
*/
extraArtistIds: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, string[], string>, z.ZodArray<z.ZodNumber, "many">>>;
/**
* Whether the NEW icon shows up or not
*/
new: z.ZodBoolean;
/**
* Type of NEW icon. 0 for Yellow, 1 for Blue
*
* @type {SongNewType}
*/
newType: z.ZodOptional<z.ZodNumber>;
/**
* Artist names in the format [id, name][]
*/
extraArtistNames: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, string[][], string>, z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodString], null>, "many">>>;
}, "strip", z.ZodTypeAny, {
name: string;
artistId: number;
artistName: string;
size: number;
isVerified: boolean;
link: string;
new: boolean;
id?: number | undefined;
videoId?: string | undefined;
youtubeURL?: string | undefined;
songPriority?: number | undefined;
nong?: number | undefined;
extraArtistIds?: number[] | undefined;
newType?: number | undefined;
extraArtistNames?: [number, string][] | undefined;
}, {
name: string;
artistId: number;
artistName: string;
size: number;
isVerified: boolean;
link: string;
new: boolean;
id?: number | undefined;
videoId?: string | undefined;
youtubeURL?: string | undefined;
songPriority?: number | undefined;
nong?: number | undefined;
extraArtistIds?: string | undefined;
newType?: number | undefined;
extraArtistNames?: string | undefined;
}>;
type Song = z.infer<typeof songSchema>;
declare const userMappings: {
1: string;
2: string;
3: string;
4: string;
6: string;
7: string;
8: string;
9: string;
10: string;
11: string;
13: string;
14: string;
15: string;
16: string;
17: string;
18: string;
19: string;
20: string;
21: string;
22: string;
23: string;
24: string;
25: string;
26: string;
28: string;
29: string;
30: string;
42: string;
43: string;
44: string;
45: string;
46: string;
48: string;
49: string;
50: string;
51: string;
52: string;
53: string;
54: string;
55: string;
56: string;
57: string;
};
declare enum UserMessageState {
All = 0,
FriendsOnly = 1,
None = 2
}
declare enum UserFriendsState {
All = 0,
None = 1
}
declare enum UserCommentHistoryState {
All = 0,
FriendsOnly = 1,
None = 2
}
declare enum UserModeratorLevel {
None = 0,
Moderator = 1,
ElderModerator = 2
}
declare const userSchema: z.ZodObject<{
/**
* The name of player
*/
username: z.ZodString;
/**
* The ID of player
*/
id: z.ZodNumber;
/**
* The count of stars player have
*/
stars: z.ZodNumber;
/**
* The count of diamonds player have
*/
diamonds: z.ZodOptional<z.ZodNumber>;
/**
* The amount of moons the player have
*/
moons: z.ZodNumber;
/**
* The count of coins the player have
*/
secretCoins: z.ZodNumber;
/**
* The count of usercoins player have
*/
userCoins: z.ZodNumber;
/**
* First color of the player
*/
primaryColor: z.ZodNumber;
/**
* Second color of the player
*/
secondaryColor: z.ZodNumber;
/**
* Glow color of the player
*/
glowColor: z.ZodOptional<z.ZodNumber>;
/**
* The special number of the player
*/
special: z.ZodOptional<z.ZodNumber>;
/**
* The account ID of the player
*/
accountId: z.ZodNumber;
/**
* @type {UserMessageState}
*/
messageState: z.ZodOptional<z.ZodNumber>;
/**
* @type {UserFriendsState}
*/
friendsState: z.ZodOptional<z.ZodNumber>;
/**
* The time since the last levelScore submit
*/
age: z.ZodOptional<z.ZodString>;
/**
* @type {UserModeratorLevel}
*/
moderatorLevel: z.ZodOptional<z.ZodNumber>;
/**
* @type {UserCommentHistoryState}
*/
commentHistoryState: z.ZodOptional<z.ZodNumber>;
/**
* If an account is registered or not
*/
isRegistered: z.ZodOptional<z.ZodBoolean>;
/**
* The global rank of this player
*/
globalRank: z.ZodOptional<z.ZodNumber>;
/**
* The global leaderboard position of the player
*/
ranking: z.ZodOptional<z.ZodNumber>;
/**
* The count of creatorpoints player have
*/
creatorPoints: z.ZodNumber;
/**
* The count of demons player have
*/
totalDemons: z.ZodNumber;
/**
* Breakdown of the player's demons, in the format
* `{easy},{medium},{hard},{insane},{extreme},{easyPlatformer},{mediumPlatformer},{hardPlatformer},{insanePlatformer},{extremePlatformer},{weekly},{gauntlet}`
*/
demons: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, string[], string>, z.ZodArray<z.ZodNumber, "many">>>;
/**
* Breakdown of the player's classic mode non-demons, in the format
* `{auto},{easy},{normal},{hard},{harder},{insane},{daily},{gauntlet}`
*/
classicLevels: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, string[], string>, z.ZodArray<z.ZodNumber, "many">>>;
/**
* Breakdown of the player's platformer mode non-demons, in the format
* `{auto},{easy},{normal},{hard},{harder},{insane}`
*/
platformerLevels: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, string[], string>, z.ZodArray<z.ZodNumber, "many">>>;
/**
* The youtube url of the player
*/
youtube: z.ZodOptional<z.ZodString>;
/**
* The twitter of the player
*/
twitter: z.ZodOptional<z.ZodString>;
/**
* The twitch of the player
*/
twitch: z.ZodOptional<z.ZodString>;
iconId: z.ZodOptional<z.ZodNumber>;
/**
* The iconType of the player
*/
iconType: z.ZodOptional<z.ZodNumber>;
/**
* The icon number of the player
*/
accIcon: z.ZodOptional<z.ZodNumber>;
/**
* The ship number of the player
*/
accShip: z.ZodOptional<z.ZodNumber>;
/**
* The ball number of the player
*/
accBall: z.ZodOptional<z.ZodNumber>;
/**
* The bird number of the player
*/
accBird: z.ZodOptional<z.ZodNumber>;
/**
* The dart (wave) number of the player
*/
accDart: z.ZodOptional<z.ZodNumber>;
/**
* The robot number of the player
*/
accRobot: z.ZodOptional<z.ZodNumber>;
/**
* The glow number of the player
*/
accGlow: z.ZodOptional<z.ZodNumber>;
/**
* The swing number of the player
*/
accSwing: z.ZodOptional<z.ZodNumber>;
/**
* The jetpack number of the player
*/
accJetpack: z.ZodOptional<z.ZodNumber>;
/**
* The spider number of the player
*/
accSpider: z.ZodOptional<z.ZodNumber>;
/**
* The explosion number of the player
*/
accExplosion: z.ZodOptional<z.ZodNumber>;
/**
* The accountID of the player. Is used for highlighting the player on the leaderboards
*/
accountHighlight: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
id: number;
stars: number;
accountId: number;
username: string;
totalDemons: number;
creatorPoints: number;
primaryColor: number;
secondaryColor: number;
secretCoins: number;
userCoins: number;
moons: number;
ranking?: number | undefined;
accountHighlight?: number | undefined;
iconId?: number | undefined;
iconType?: number | undefined;
special?: number | undefined;
messageState?: number | undefined;
friendsState?: number | undefined;
youtube?: string | undefined;
accIcon?: number | undefined;
accShip?: number | undefined;
accBall?: number | undefined;
accBird?: number | undefined;
accDart?: number | undefined;
accRobot?: number | undefined;
accGlow?: number | undefined;
isRegistered?: boolean | undefined;
globalRank?: number | undefined;
age?: string | undefined;
accSpider?: number | undefined;
twitter?: string | undefined;
twitch?: string | undefined;
diamonds?: number | undefined;
accExplosion?: number | undefined;
moderatorLevel?: number | undefined;
commentHistoryState?: number | undefined;
glowColor?: number | undefined;
accSwing?: number | undefined;
accJetpack?: number | undefined;
demons?: number[] | undefined;
classicLevels?: number[] | undefined;
platformerLevels?: number[] | undefined;
}, {
id: number;
stars: number;
accountId: number;
username: string;
totalDemons: number;
creatorPoints: number;
primaryColor: number;
secondaryColor: number;
secretCoins: number;
userCoins: number;
moons: number;
ranking?: number | undefined;
accountHighlight?: number | undefined;
iconId?: number | undefined;
iconType?: number | undefined;
special?: number | undefined;
messageState?: number | undefined;
friendsState?: number | undefined;
youtube?: string | undefined;
accIcon?: number | undefined;
accShip?: number | undefined;
accBall?: number | undefined;
accBird?: number | undefined;
accDart?: number | undefined;
accRobot?: number | undefined;
accGlow?: number | undefined;
isRegistered?: boolean | undefined;
globalRank?: number | undefined;
age?: string | undefined;
accSpider?: number | undefined;
twitter?: string | undefined;
twitch?: string | undefined;
diamonds?: number | undefined;
accExplosion?: number | undefined;
moderatorLevel?: number | undefined;
commentHistoryState?: number | undefined;
glowColor?: number | undefined;
accSwing?: number | undefined;
accJetpack?: number | undefined;
demons?: string | undefined;
classicLevels?: string | undefined;
platformerLevels?: string | undefined;
}>;
type User = z.infer<typeof userSchema>;
declare class APIError extends Error {
response?: (Response | null) | undefined;
constructor(message: string, options?: ErrorOptions | undefined, response?: (Response | null) | undefined);
}
declare const BOOMLINGS_URL = "https://www.boomlings.com";
declare const GEOMETRY_DASH_URL = "https://www.geometrydash.com";
declare const SFX_LIBRARY_VERSION_URL = "https://geometrydashfiles.b-cdn.net/sfx/sfxlibrary_version.txt";
declare const MUSIC_LIBRARY_VERSION_URL = "https://geometrydashfiles.b-cdn.net/music/musiclibrary_version_02.txt";
/**
* Use to interact with the Geometry Dash API.
*
* @see https://wyliemaster.github.io/gddocs/#/endpoints/generic
*/
declare class REST {
/**
* Throws {@link APIError} if the request fail
*
* @param path - Must start with `/`
*/
request(method: string, path: string, body?: Record<string, string>): Promise<Response>;
post(path: string, body?: Record<string, string>): Promise<string>;
}
interface SearchLevelsOptions {
type: SearchLevelsType;
/**
* Which page to request, defaults to 0
*/
page?: number;
/**
* Search query, user ID or level list depending on type
*
* Only valid on types `Query` and `UserLists`
*/
query?: string;
/**
* The ID for the gauntlet being requested
*/
gauntlet?: number;
/**
* Difficulty filter
*/
difficulty?: SearchListsDifficulty;
/**
* Selects which demon difficulty to search. If not present, it will search all demon types
*/
demonFilter?: SearchListsDemonFilter;
/**
* Level length
*/
length?: LevelLength;
/**
* Featured filter
*/
featured?: boolean;
/**
* Original filter
*/
original?: boolean;
/**
* Two players filter
*/
twoPlayer?: boolean;
/**
* Coins filter
*/
coins?: boolean;
/**
* Epic filter
*/
epic?: boolean;
/**
* Legendary filter
*/
legendary?: boolean;
/**
* Mythic filter
*/
mythic?: boolean;
/**
* Unrated filter
*/
noStar?: boolean;
/**
* Rated filter
*/
star?: boolean;
/**
* Official (or custom) song ID, not sent when off
*/
song?: number;
/**
* Newgrounds song, 1 when on and uses song as the ID, not sent when off
*/
customSong?: number;
}
declare enum SearchLevelsType {
Query = 0,
MostDownloaded = 1,
MostLiked = 2,
Trending = 3,
Recent = 4,
UserLevels = 5,
Featured = 6,
Magic = 7,
ModeratorSentLevels = 8,
Awarded = 11,
MostLikedInGDWorld = 15,
HallOfFame = 16,
FeaturedInGDWorld = 17,
DailyHistory = 21,
WeeklyHistory = 22,
LevelList = 25
}
declare enum SearchLevelsDifficulty {
NA = -1,
Demons = -2,
Easy = 1,
Normal = 2,
Hard = 3,
Harder = 4,
Insane = 5
}
declare enum SearchLevelsDemonFilter {
EasyDemon = 1,
MediumDemon = 2,
HardDemon = 3,
InsaneDemon = 4,
ExtremeDemon = 5
}
interface SearchListsOptions {
type: SearchListsType;
/**
* Which page to request, defaults to 0
*/
page?: number;
/**
* Search query, user ID or level list depending on type
*
* Only valid on types `Query` and `UserLists`
*/
query?: string;
/**
* Difficulty filter
*/
difficulty?: SearchListsDifficulty;
/**
* Selects which demon difficulty to search. If not present, it will search all demon types
*/
demonFilter?: SearchListsDemonFilter;
/**
* Rated filter
*/
rated?: boolean;
}
declare enum SearchListsType {
Query = 0,
MostDownloaded = 1,
MostLiked = 2,
Trending = 3,
Recent = 4,
UserLists = 5,
Awarded = 11,
SentLists = 27
}
declare enum SearchListsDifficulty {
NA = -1,
Demons = -2,
Easy = 1,
Normal = 2,
Hard = 3,
Harder = 4,
Insane = 5
}
declare enum SearchListsDemonFilter {
EasyDemon = 1,
MediumDemon = 2,
HardDemon = 3,
InsaneDemon = 4,
ExtremeDemon = 5
}
interface GetUserLeaderboardOptions {
type?: "top" | "creators";
/**
* Limited to 100
*/
count?: number;
}
interface PaginationData {
/**
* Total results
*/
total: number;
/**
* Current offset
*/
offset: number;
/**
* Number per page
*/
amount: number;
}
interface DailyLevel {
/**
* Current daily level index
*/
index: number;
/**
* Time left in seconds
*/
timeLeft: number;
}
interface WeeklyLevel {
/**
* Current daily level index
*/
index: number;
/**
* Time left in seconds
*/
timeLeft: number;
}
interface GauntletsData {
gauntlets: Gauntlet[];
hash: string;
}
interface LevelCreator {
userId: number;
username: string;
accountId: number;
}
interface LevelsData {
levels: Level[];
creators: ListCreator[];
songs: Song[];
page: PaginationData;
hash: string;
}
interface ListCreator {
userId: number;
username: string;
accountId: number;
}
interface ListsData {
lists: List[];
creators: ListCreator[];
page: PaginationData;
hash: string;
}
interface MapPacksData {
packs: MapPack[];
page: PaginationData;
hash: string;
}
/**
* The client to interact with the Geometry Dash API
*/
declare class GDAPI {
readonly rest: REST;
constructor();
getDailyLevel(): Promise<DailyLevel>;
getCurrentSFXLibraryVersion(): Promise<number>;
getCurrentMusicLibraryVersion(): Promise<number>;
getGauntlets(): Promise<GauntletsData>;
/**
* @example
* ```ts
* searchLevels({
* type: SearchLevelsType.Query,
* query: "bloodbath"
* });
* ```
*/
searchLevels(options: SearchLevelsOptions): Promise<LevelsData>;
/**
* @example
* ```ts
* searchLists({
* type: SearchListType.Query,
* query: "Name"
* });
* ```
*/
searchLists(options: SearchListsOptions): Promise<ListsData>;
/**
* @param page - Starts at 0
*/
getMapPacks(page?: number): Promise<MapPacksData>;
getSongById(songId: string): Promise<Song>;
getUserById(accountId: number): Promise<User>;
getUserByName(name: string): Promise<User>;
getUserLeaderboard(options?: GetUserLeaderboardOptions): Promise<User[]>;
}
/**
* Threw when the GD response data could not be parsed
*/
declare class ParseError extends Error {
}
/**
* Parse a GD object in the format `key:value:key:value`
*/
declare const parseRawObject: (data: string) => [string, string][];
/**
* Parse and validate a GD object in the format `key:value:key:value`
*/
declare const parseObject: <T extends z.AnyZodObject>(data: string, mappings: Record<number, string>, schema: T) => z.infer<T>;
/**
* Parse and validate a GD tuple list in the format `value:value:value|value:value:value`
*/
declare const parseTupleList: <T extends z.AnyZodTuple>(list: string, schema: T) => z.infer<T>[];
/**
* Parse and validate a GD object list in the format `<object>|<object>`
*/
declare const parseObjectList: <T extends z.AnyZodObject>(list: string, mappings: Record<number, string>, schema: T) => z.infer<T>[];
/**
* Parse and validate a GD tuple in the format `value:value:value`
*/
declare const parseTuple: <T extends z.AnyZodTuple>(data: string, schema: T) => z.infer<T>;
/**
* Parse a GD groups in the format `data#data#data`
* @param count - The expected group count
*/
declare const parseGroups: (data: string, count: number) => string[];
/**
* Parse a GD song in the format `key~|~value~|~key~|~value`
*/
declare const parseRawSong: (data: string) => [string, string][];
/**
* Parse and validate a GD song in the format `key~|~value~|~key~|~value`
*/
declare const parseSong: <T extends z.AnyZodObject>(data: string, mappings: Record<number, string>, schema: T) => z.infer<T>;
/**
* Parse and validate a GD song list in the format `<song>:<song>`
*/
declare const parseSongList: <T extends z.AnyZodObject>(list: string, mappings: Record<number, string>, schema: T) => z.infer<T>[];
declare const COMMON_SECRET = "Wmfd2893gb7";
/**
* @deprecated The version will not be exported in the next major version.
*/
declare const version = "0.0.0";
export { APIError, BOOMLINGS_URL, COMMON_SECRET, type DailyLevel, GDAPI, GEOMETRY_DASH_URL, type Gauntlet, GauntletName, type GauntletsData, type GetUserLeaderboardOptions, type Level, type LevelCreator, LevelDemonDifficulty, LevelDifficultyDenominator, LevelDifficultyNumerator, LevelEpicRating, LevelLength, type LevelsData, type List, type ListCreator, ListDifficulty, type ListsData, MUSIC_LIBRARY_VERSION_URL, type MapPack, MapPackDifficulty, type MapPacksData, type PaginationData, ParseError, REST, SFX_LIBRARY_VERSION_URL, SearchLevelsDemonFilter, SearchLevelsDifficulty, type SearchLevelsOptions, SearchLevelsType, SearchListsDemonFilter, SearchListsDifficulty, type SearchListsOptions, SearchListsType, type Song, SongNewType, SongNong, type User, UserCommentHistoryState, UserFriendsState, UserMessageState, UserModeratorLevel, type WeeklyLevel, gauntletMappings, gauntletSchema, levelMappings, levelSchema, listMappings, listSchema, mapPacksMappings, mapPacksSchema, parseGroups, parseObject, parseObjectList, parseRawObject, parseRawSong, parseSong, parseSongList, parseTuple, parseTupleList, songMappings, songSchema, userMappings, userSchema, version };