-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
112 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,27 @@ | ||
import { API } from "./index.js" | ||
import { User as UserInterface } from "./user.js" | ||
import { User } from "./user.js" | ||
import { WikiPage } from "./wiki.js" | ||
|
||
export namespace Home { | ||
interface Search { | ||
/** How many results there are across all pages */ | ||
total: number | ||
} | ||
|
||
export namespace Search { | ||
/** @obtainableFrom {@link API.searchUser} */ | ||
export interface User extends Search { | ||
/** The Users that have been found */ | ||
data: UserInterface[] | ||
} | ||
|
||
/** @obtainableFrom {@link API.searchWiki} */ | ||
export interface Wiki extends Search { | ||
/** The WikiPages that have been found */ | ||
data: WikiPage[] | ||
} | ||
|
||
/** | ||
* Look for a user like you would on the website! | ||
* @param query What you would put in the searchbar | ||
* @param page (defaults to 1) You normally get the first 20 results, but if page is 2, you'd get results 21 to 40 instead for example! | ||
* @param page You normally get the first **20 results**, but if page is 2, you'd get results 21 to 40 instead for example! (defaults to **1**) | ||
*/ | ||
export async function getUsers(this: API, query: string, page: number = 1): Promise<User> { | ||
export async function getUsers(this: API, query: string, page: number = 1): Promise<{data: User[], total: number}> { | ||
const response = await this.request("get", "search", {mode: "user", query, page}) | ||
return response.user | ||
return response.user // It's the only property | ||
} | ||
|
||
/** | ||
* Look for a wiki page like you would on the website! | ||
* @param query What you would put in the searchbar | ||
* @param page (defaults to 1) You normally get the first 50 results, but if page is 2, you'd get results 51 to 100 instead for example! | ||
* @param page You normally get the first **50 results**, but if page is 2, you'd get results 51 to 100 instead for example! (defaults to **1**) | ||
*/ | ||
export async function getWikiPages(this: API, query: string, page: number = 1): Promise<Wiki> { | ||
export async function getWikiPages(this: API, query: string, page: number = 1): Promise<{data: WikiPage[], total: number}> { | ||
const response = await this.request("get", "search", {mode: "wiki_page", query, page}) | ||
return response.wiki_page | ||
return response.wiki_page // It's the only property | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.