Skip to content

Commit

Permalink
Even more namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
TTTaevas committed Dec 5, 2023
1 parent dbc6170 commit cdbb4fb
Show file tree
Hide file tree
Showing 10 changed files with 301 additions and 327 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Your `refresh_token` can actually also expire at a (purposefully) unknown time,

### Ranking
- [x] Get Kudosu Ranking
- [x] Get Ranking
- [x] Get Ranking // split between getUserRanking(), getCountryRanking(), and getSpotlightRanking()
- [x] Get Spotlights

### Users
Expand Down
178 changes: 92 additions & 86 deletions lib/changelog.ts
Original file line number Diff line number Diff line change
@@ -1,102 +1,108 @@
interface ChangelogBuild {
created_at: Date
display_version: string
id: number
/**
* How many users are playing on this version of the game? (if lazer/web, should be 0, lazer doesn't show such stats)
*/
users: number
/**
* The name of the version
*/
version: string | null
/**
* If a video is showcased on the changelog
* @remarks The ID of a Youtube video is whatever comes after `/watch?v=` in its url
*/
youtube_id: string | null
}

/**
* Expected from ChangelogBuildWithChangelogentriesVersions
*/
export interface ChangelogBuildWithUpdatestreams extends ChangelogBuild {
update_stream: UpdateStream
}

interface ChangelogBuildWithChangelogentries extends ChangelogBuild {
changelog_entries: {
id: number | null
repository: string | null
github_pull_request_id: number | null
github_url: string | null
url: string | null
type: string
category: string
title: string | null
major: boolean
export namespace Changelog {
export interface Build {
created_at: Date
display_version: string
id: number
/**
* Can be January 1st 1970!
* How many users are playing on this version of the game? (if lazer/web, should be 0, lazer doesn't show such stats)
*/
created_at: Date
users: number
/**
* Doesn't exist if no github user is associated with who's credited with the change
* The name of the version
*/
github_user?: {
display_name: string
github_url: string | null
github_username: string | null
id: number | null
osu_username: string | null
user_id: number | null
user_url: string | null
}
version: string | null
/**
* Entry message in Markdown format, embedded HTML is allowed, exists only if Markdown was requested
* If a video is showcased on the changelog
* @remarks The ID of a Youtube video is whatever comes after `/watch?v=` in its url
*/
message?: string | null
youtube_id: string | null
}

export namespace Build {
/**
* Entry message in HTML format, exists only if HTML was requested
* Expected from ChangelogBuildWithChangelogentriesVersions
*/
message_html?: string | null

}[]
}
export interface WithUpdatestreams extends Build {
update_stream: UpdateStream
}

/**
* Expected from api.getChangelogBuilds()
*/
export interface ChangelogBuildWithUpdatestreamsChangelogentries extends ChangelogBuildWithUpdatestreams, ChangelogBuildWithChangelogentries {
interface WithChangelogentries extends Build {
changelog_entries: {
id: number | null
repository: string | null
github_pull_request_id: number | null
github_url: string | null
url: string | null
type: string
category: string
title: string | null
major: boolean
/**
* Can be January 1st 1970!
*/
created_at: Date
/**
* Doesn't exist if no github user is associated with who's credited with the change
*/
github_user?: {
display_name: string
github_url: string | null
github_username: string | null
id: number | null
osu_username: string | null
user_id: number | null
user_url: string | null
}
/**
* Entry message in Markdown format, embedded HTML is allowed, exists only if Markdown was requested
*/
message?: string | null
/**
* Entry message in HTML format, exists only if HTML was requested
*/
message_html?: string | null

}[]
}

}
/**
* Expected from api.getChangelogBuilds()
*/
export interface WithUpdatestreamsChangelogentries extends WithUpdatestreams, WithChangelogentries {

/**
* Expected from api.getChangelogBuild()
*/
export interface ChangelogBuildWithChangelogentriesVersions extends ChangelogBuildWithChangelogentries {
versions: {
next: ChangelogBuildWithUpdatestreams | null
previous: ChangelogBuildWithUpdatestreams | null
}
}
}

/**
* Expected from ChangelogBuildWithUpdatestreams
*/
export interface UpdateStream {
id: number
name: string
display_name: string | null
is_featured: boolean
}
/**
* Expected from api.getChangelogBuild()
*/
export interface WithChangelogentriesVersions extends WithChangelogentries {
versions: {
next: WithUpdatestreams | null
previous: WithUpdatestreams | null
}
}
}

/**
* Expected from api.getChangelogStreams()
*/
export interface UpdateStreamWithLatestbuildUsercount extends UpdateStream {
latest_build: ChangelogBuild | null
/**
* How many users are playing on this? (if lazer/web, should be 0, lazer doesn't show such stats)
* Expected from ChangelogBuildWithUpdatestreams
*/
user_count: number
export interface UpdateStream {
id: number
name: string
display_name: string | null
is_featured: boolean
}

export namespace UpdateStream {
/**
* Expected from api.getChangelogStreams()
*/
export interface WithLatestbuildUsercount extends UpdateStream {
latest_build: Build | null
/**
* How many users are playing on this? (if lazer/web, should be 0, lazer doesn't show such stats)
*/
user_count: number
}
}
}
142 changes: 62 additions & 80 deletions lib/forum.ts
Original file line number Diff line number Diff line change
@@ -1,95 +1,77 @@
/**
* Expected from api.replyForumTopic(), api.createForumTopic(), api.getForumTopicAndPosts(), api.editForumPost()
*/
export interface ForumPost {
created_at: Date
deleted_at: Date | null
edited_at: Date | null
edited_by_id: number | null
forum_id: number
id: number
topic_id: number
user_id: number
body: {
/**
* Post content in HTML format
*/
html: string
/**
* Post content in BBCode format
*/
raw: string
export namespace Forum {
/**
* Expected from api.replyForumTopic(), api.createForumTopic(), api.getForumTopicAndPosts(), api.editForumPost()
*/
export interface Post {
created_at: Date
deleted_at: Date | null
edited_at: Date | null
edited_by_id: number | null
forum_id: number
id: number
topic_id: number
user_id: number
body: {
/** Post content in HTML format */
html: string
/** Post content in BBCode format */
raw: string
}
}
}

/**
* Expected from api.createForumTopic(), api.getForumTopicAndPosts(), api.editForumTopicTitle()
*/
export interface ForumTopic {
created_at: Date
deleted_at: Date | null
first_post_id: number
forum_id: number
id: number
is_locked: boolean
last_post_id: number
post_count: number
title: string
type: "normal" | "sticky" | "announcement"
updated_at: Date
user_id: number
poll: {
allow_vote_change: boolean
/**
* Can be in the future
*/
ended_at: Date | null
hide_incomplete_results: boolean
last_vote_at: Date | null
max_votes: number
options: {
id: number
text: {
/**
* Expected from api.createForumTopic(), api.getForumTopicAndPosts(), api.editForumTopicTitle()
*/
export interface Topic {
created_at: Date
deleted_at: Date | null
first_post_id: number
forum_id: number
id: number
is_locked: boolean
last_post_id: number
post_count: number
title: string
type: "normal" | "sticky" | "announcement"
updated_at: Date
user_id: number
poll: {
allow_vote_change: boolean
/** Can be in the future */
ended_at: Date | null
hide_incomplete_results: boolean
last_vote_at: Date | null
max_votes: number
options: {
id: number
text: {
bbcode: string
html: string
}
/** Not present if the poll is incomplete and results are hidden */
vote_count?: number
}[]
started_at: Date
title: {
bbcode: string
html: string
}
/**
* Not present if the poll is incomplete and results are hidden
*/
vote_count?: number
}[]
started_at: Date
title: {
bbcode: string
html: string
}
total_vote_count: number
} | null
total_vote_count: number
} | null
}
}

/**
* Feel free to use this interface to help you create polls with `api.createForumTopic()`!
*/
/** Feel free to use this interface to help you create polls with `api.createForumTopic()`! */
export interface PollConfig {
title: string
/**
* The things the users can vote for
*/
/** The things the users can vote for */
options: string[]
/**
* Length of voting period in days, 0 means forever
*/
/** Length of voting period in days, 0 means forever */
length_days: number
/**
* (defaults to 1) The maximum amount of votes per user!
*/
/** (defaults to 1) The maximum amount of votes per user! */
max_options?: number
/**
* (defaults to false) Do you allow users to change their vote?
*/
/** defaults to false) Do you allow users to change their vote? */
vote_change?: boolean
/**
* (defaults to false) Should the results of the poll be hidden while the voting period is still active?
*/
/** (defaults to false) Should the results of the poll be hidden while the voting period is still active? */
hide_results?: boolean
}
Loading

0 comments on commit cdbb4fb

Please sign in to comment.