From c8e136ecf1b8332691e4b63bc118d36b2b548e4f Mon Sep 17 00:00:00 2001 From: Ghellab Abderrahmane <43763935+rhaym-tech@users.noreply.github.com> Date: Tue, 16 Jan 2024 08:12:48 +0900 Subject: [PATCH 1/3] Update Base URL to latest --- pages/rest-api/start.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/rest-api/start.mdx b/pages/rest-api/start.mdx index 2ff1aae..02e92a8 100644 --- a/pages/rest-api/start.mdx +++ b/pages/rest-api/start.mdx @@ -5,7 +5,7 @@ import { Tab, Tabs,Callout } from "nextra-theme-docs"; ## Base URL ``` -https://waifu.it/api +https://waifu.it/api/v4 ``` ## API Versioning @@ -54,7 +54,7 @@ Authorization: MTk4NjIyNDgzNDcxOTI1MjQ4.Cl2FMQ.ZnCjm1XVW7vRze4b7Cq4se7kKWs /* Replace "Your-API-Token" with the token you got from the Kohai Bot and the endpoint. */ - const url = "https://waifu.it/api/:endpoint" + const url = "https://waifu.it/api/v4/:endpoint" const data = async () => { try { const { data } = await axios.get(url, { headers: { @@ -79,7 +79,7 @@ Authorization: MTk4NjIyNDgzNDcxOTI1MjQ4.Cl2FMQ.ZnCjm1XVW7vRze4b7Cq4se7kKWs """ Replace "Your-API-Token" with the token you got from the Kohai Bot and the endpoint. """ - url = "https://waifu.it/api/:endpoint" + url = "https://waifu.it/api/v4/:endpoint" response = requests.get(url, headers={ "Authorization": "Your-API-Token", }) From 17f1de69ba2975b849cf42605424317815f797a5 Mon Sep 17 00:00:00 2001 From: Ghellab Abderrahmane <43763935+rhaym-tech@users.noreply.github.com> Date: Tue, 16 Jan 2024 19:00:39 +0900 Subject: [PATCH 2/3] Keep the baseAPI as it was --- pages/rest-api/start.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/rest-api/start.mdx b/pages/rest-api/start.mdx index 02e92a8..5533152 100644 --- a/pages/rest-api/start.mdx +++ b/pages/rest-api/start.mdx @@ -5,7 +5,7 @@ import { Tab, Tabs,Callout } from "nextra-theme-docs"; ## Base URL ``` -https://waifu.it/api/v4 +https://waifu.it/api ``` ## API Versioning From a3b193d12cf07444a28a0b3abea4eb4655affb31 Mon Sep 17 00:00:00 2001 From: kyrea Date: Tue, 6 Feb 2024 14:07:27 +0530 Subject: [PATCH 3/3] Added husbando endpoint and updated previous waifu endpoint --- package.json | 2 +- pages/list-of-endpoints.mdx | 1 + pages/rest-api/Images/Husbando/_meta.json | 3 + pages/rest-api/Images/Husbando/search.mdx | 233 ++++++++++++++++++++++ pages/rest-api/Images/Waifu/search.mdx | 147 ++++++++++---- pages/rest-api/Images/_meta.json | 4 + 6 files changed, 345 insertions(+), 45 deletions(-) create mode 100644 pages/rest-api/Images/Husbando/_meta.json create mode 100644 pages/rest-api/Images/Husbando/search.mdx diff --git a/package.json b/package.json index 10d5c0a..91674fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docs.waifu.it", - "version": "3.0.6", + "version": "3.1.6", "description": "The new and improved documentation for Waifu.it", "scripts": { "dev": "next dev", diff --git a/pages/list-of-endpoints.mdx b/pages/list-of-endpoints.mdx index 9c63fe6..c0566ab 100644 --- a/pages/list-of-endpoints.mdx +++ b/pages/list-of-endpoints.mdx @@ -137,6 +137,7 @@ Waifu.it supports a wealth of endpoints, which can be categorized into the follo ### Images - [Waifu:](https://docs.waifu.it/rest-api/Images/Waifu/search) Immerse yourself in the captivating world of anime with the Waifu endpoint. +- [Husbando:](https://docs.waifu.it/rest-api/Images/Husbando/search) Get yourself a good and cool looking husbando. ### Texts diff --git a/pages/rest-api/Images/Husbando/_meta.json b/pages/rest-api/Images/Husbando/_meta.json new file mode 100644 index 0000000..3cf6b01 --- /dev/null +++ b/pages/rest-api/Images/Husbando/_meta.json @@ -0,0 +1,3 @@ +{ + "search": "Search" +} diff --git a/pages/rest-api/Images/Husbando/search.mdx b/pages/rest-api/Images/Husbando/search.mdx new file mode 100644 index 0000000..093294f --- /dev/null +++ b/pages/rest-api/Images/Husbando/search.mdx @@ -0,0 +1,233 @@ +import { Tab, Tabs } from "nextra-theme-docs"; + +# Search + +This endpoint allows you to access and retrieve information about your favorite husbandos. To access the `/husbando` endpoint, you +will need to provide the proper authentication using the Authorization header. + +## Endpoint Details + +The `/husbando` endpoint allows you to retrieve information about a specific husbando. + +- **URL**: `/husbando` +- **Method**: GET +- **Content Type**: application/json + +## Authentication + +To make requests to the `/husbando` endpoint, you must include an `Authorization` header in your API calls. This header should contain a valid access token. + +### Example Authorization Header + +```jsx +Authorization: YOUR_ACCESS_TOKEN; +``` + +Replace `YOUR_ACCESS_TOKEN` with the actual token provided to you. + +## Request Headers + +The request to the `/husbando` endpoint should be a JSON object with the following headers: + +| Header | Type | Description | Required | +| --------------- | ------ | ------------------------------------------------------ | -------- | +| `Authorization` | string | The unique identifier of the user sending the request. | True | + +### Parameters + +The request parameters for the `/husbando?{parameter}={value}` endpoint. + +| Parameter | Type | Description | Required | +| --------- | ------ | ---------------------------------------------------------------------------------------------------------- | -------- | +| `name` | string | (Optional) The desired character name for the query. If not provided, a random husbando will be generated. | False | +| `anime` | string | (Optional) The desired anime name for the query. If not provided, a random husbando will be selected. | False | + +### Example Request + +Here's example of how to make a request to the `/husbando` endpoint. + + + + ```js + import axios from "axios"; + + /* + Replace "YOUR_ACCESS_TOKEN" with the token you got from the Kohai Bot and the endpoint. + */ + const url = "https://husbando.it/api/v4/husbando"; + const data = async () => { + try { + const { data } = await axios.get(url, { headers: { + Authorization: "YOUR_ACCESS_TOKEN", + } }); + return data; + } catch (err) { + throw new Error(err.message); + } + }; + + console.log(data); + ``` + + + + ```python + import requests + + """ + Replace "YOUR_ACCESS_TOKEN" with the token you got from the Kohai Bot and the endpoint. + """ + url = "https://husbando.it/api/v4/husbando" + response = requests.get(url, headers={ + "Authorization": "YOUR_ACCESS_TOKEN", + }) + data = response.json() + + print(data) + ``` + + + + +Remember to replace `YOUR_ACCESS_TOKEN` with your actual access token. + +## Responses + +The server will respond with an appropriate message based on the input provided. A successfully API request will respond +with a JSON object containing the following information: + +- `_id`: The unique identifier of the husbando. +- `name`: Information about the husbando's name. + - `first`: The first name of the husbando. + - `middle`: The middle name of the husbando (if available). + - `last`: The last name of the husbando (if available). + - `full`: The full name of the husbando. + - `native`: The native name of the husbando. + - `userPreferred`: The user's preferred name for the husbando. + - `alternative`: An array of alternative names for the husbando. + - `alternativeSpoiler`: An array of alternative names with potential spoilers. +- `image`: Information about the husbando's image. + - `large`: URL to a large image of the husbando. +- `favourites`: The number of users who have favorited the husbando. +- `siteUrl`: URL to the husbando's page on AniList. +- `description`: Description of the husbando (if available). +- `age`: Age of the husbando (if available). +- `gender`: Gender of the husbando. +- `bloodType`: Blood type of the husbando (if available). +- `dateOfBirth`: Date of birth of the husbando (if available). + - `year`: Year of birth. + - `month`: Month of birth. + - `day`: Day of birth. +- `media`: Information about the media associated with the husbando. + - `nodes`: An array of media nodes. + - `id`: The unique identifier of the media. + - `idMal`: The MyAnimeList identifier of the media. + - `coverImage`: Information about the cover image of the media. + - `medium`: URL to a medium-sized cover image of the media. + - `bannerImage`: URL to a banner image of the media (if available). + - `title`: Information about the title of the media. + - `romaji`: Romaji representation of the title. + - `english`: English representation of the title (if available). + - `native`: Native representation of the title. + - `userPreferred`: User-preferred representation of the title. + - `synonyms`: An array of synonyms for the media title. + - `popularity`: Popularity score of the media. + - `type`: Type of the media (e.g., ANIME, MANGA). + - `format`: Format of the media (e.g., TV, MANGA). + + + + **Content Type:** `application/json` + ```json copy=false + "status": 200, + "_id": 14881, + "name": { + "first": "Ura no Ojiichan", + "middle": null, + "last": null, + "full": "Ura no Ojiichan", + "native": "裏のおじいちゃん", + "userPreferred": "Ura no Ojiichan", + "alternative": [], + "alternativeSpoiler": [] + }, + "image": { + "large": "https://s4.anilist.co/file/anilistcdn/character/large/default.jpg" + }, + "favourites": 0, + "siteUrl": "https://anilist.co/character/257439", + "description": null, + "age": null, + "gender": "Male", + "bloodType": null, + "dateOfBirth": { + "year": null, + "month": null, + "day": null + }, + "media": { + "nodes": [ + { + "id": 2406, + "idMal": 2406, + "coverImage": { + "medium": "https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx2406-nP8NIct9Sci3.jpg" + }, + "bannerImage": "https://s4.anilist.co/file/anilistcdn/media/anime/banner/2406-ROqXxejQ5bH9.jpg", + "title": { + "romaji": "Sazae-san", + "english": null, + "native": "サザエさん", + "userPreferred": "Sazae-san" + }, + "synonyms": [ + "Mrs. Sazae" + ], + "popularity": 1311, + "type": "ANIME", + "format": "TV" + }, + { + "id": 43192, + "idMal": 13192, + "coverImage": { + "medium": "https://s4.anilist.co/file/anilistcdn/media/manga/cover/small/b43192-lBoylrcHjwWA.jpg" + }, + "bannerImage": null, + "title": { + "romaji": "Sazae-San", + "english": "The Wonderful World of Sazae-San", + "native": "サザエさん", + "userPreferred": "Sazae-San" + }, + "synonyms": [ + "Heisei no Sazae-san", + "The Wonderful World of Sazae-san" + ], + "popularity": 195, + "type": "MANGA", + "format": "MANGA" + } + ] + } + ``` + + + **Content Type:** `application/json` + ```json copy=false + "status": 404, + "message": {} + ``` + + + **Content Type:** `application/json` + ```json copy=false + "status": 500, + "message": {} + ``` + + + +This documentation should help you use [`axios`](https://www.npmjs.com/package/axios) for Node.js and [`requests`](https://pypi.org/project/requests/) +for Python to interact with the `/husbando` endpoint. +That's it! You are now ready to use the `/husbando` endpoint to retrieve information about your favorite husbandos. Happy coding! diff --git a/pages/rest-api/Images/Waifu/search.mdx b/pages/rest-api/Images/Waifu/search.mdx index 903f167..b199c77 100644 --- a/pages/rest-api/Images/Waifu/search.mdx +++ b/pages/rest-api/Images/Waifu/search.mdx @@ -2,11 +2,11 @@ import { Tab, Tabs } from "nextra-theme-docs"; # Search -This endpoint allows you to access and retrieve information about your favorite waifus. To access the `/waifu` endpoint, you +This endpoint allows you to access and retrieve information about your favorite waifus. To access the `/waifu` endpoint, you will need to provide the proper authentication using the Authorization header. - ## Endpoint Details + The `/waifu` endpoint allows you to retrieve information about a specific waifu. - **URL**: `/waifu` @@ -20,7 +20,7 @@ To make requests to the `/waifu` endpoint, you must include an `Authorization` h ### Example Authorization Header ```jsx -Authorization: YOUR_ACCESS_TOKEN +Authorization: YOUR_ACCESS_TOKEN; ``` Replace `YOUR_ACCESS_TOKEN` with the actual token provided to you. @@ -29,20 +29,21 @@ Replace `YOUR_ACCESS_TOKEN` with the actual token provided to you. The request to the `/waifu` endpoint should be a JSON object with the following headers: -| Header | Type | Description | Required | -| --------------- | ------- | ---------------------------------------------------- | -------- | -| `Authorization` | string | The unique identifier of the user sending the request. | True | +| Header | Type | Description | Required | +| --------------- | ------ | ------------------------------------------------------ | -------- | +| `Authorization` | string | The unique identifier of the user sending the request. | True | ### Parameters The request parameters for the `/waifu?{parameter}={value}` endpoint. -| Parameter | Type | Description | Required | -| ----------| ------ | ----------------------------------------------------- | -------- | +| Parameter | Type | Description | Required | +| --------- | ------ | ------------------------------------------------------------------------------------------------------- | -------- | | `name` | string | (Optional) The desired character name for the query. If not provided, a random waifu will be generated. | False | -| `anime` | string | (Optional) The desired anime name for the query. If not provided, a random waifu will be selected. | False | +| `anime` | string | (Optional) The desired anime name for the query. If not provided, a random waifu will be selected. | False | ### Example Request + Here's example of how to make a request to the `/waifu` endpoint. @@ -67,6 +68,7 @@ Here's example of how to make a request to the `/waifu` endpoint. console.log(data); ``` + ```python @@ -83,6 +85,7 @@ Here's example of how to make a request to the `/waifu` endpoint. print(data) ``` + @@ -90,48 +93,104 @@ Remember to replace `YOUR_ACCESS_TOKEN` with your actual access token. ## Responses -The server will respond with an appropriate message based on the input provided. A successfully API request will respond +The server will respond with an appropriate message based on the input provided. A successfully API request will respond with a JSON object containing the following information: - `_id`: The unique identifier of the waifu. -- `names`: The names of the waifu. -- `from`: The anime from where the waifu belongs to. -- `statistics`: Her statistics from the users. -- `images`: The array of URLs to an image of the waifu. -- `status`: Response status +- `name`: Information about the waifu's name. + - `first`: The first name of the waifu. + - `middle`: The middle name of the waifu (if available). + - `last`: The last name of the waifu (if available). + - `full`: The full name of the waifu. + - `native`: The native name of the waifu. + - `userPreferred`: The user's preferred name for the waifu. + - `alternative`: An array of alternative names for the waifu. + - `alternativeSpoiler`: An array of alternative names with potential spoilers. +- `image`: Information about the waifu's image. + - `large`: URL to a large image of the waifu. +- `favourites`: The number of users who have favorited the waifu. +- `siteUrl`: URL to the waifu's page on AniList. +- `description`: Description of the waifu (if available). +- `age`: Age of the waifu (if available). +- `gender`: Gender of the waifu. +- `bloodType`: Blood type of the waifu (if available). +- `dateOfBirth`: Date of birth of the waifu (if available). + - `year`: Year of birth. + - `month`: Month of birth. + - `day`: Day of birth. +- `media`: Information about the media associated with the waifu. + - `nodes`: An array of media nodes. + - `id`: The unique identifier of the media. + - `idMal`: The MyAnimeList identifier of the media. + - `coverImage`: Information about the cover image of the media. + - `medium`: URL to a medium-sized cover image of the media. + - `bannerImage`: URL to a banner image of the media (if available). + - `title`: Information about the title of the media. + - `romaji`: Romaji representation of the title. + - `english`: English representation of the title (if available). + - `native`: Native representation of the title. + - `userPreferred`: User-preferred representation of the title. + - `synonyms`: An array of synonyms for the media title. + - `popularity`: Popularity score of the media. + - `type`: Type of the media (e.g., ANIME, MANGA). + - `format`: Format of the media (e.g., TV, MANGA). **Content Type:** `application/json` ```json copy=false - "status": 200, - "_id": 48, - "images": [ - "https://rei.animecharactersdatabase.com/uploads/chars/67975-1468280545.jpg", - "https://rei.animecharactersdatabase.com/uploads/chars/67975-1074357995.jpg", - "https://rei.animecharactersdatabase.com/uploads/chars/67975-1025264171.jpg", - "https://rei.animecharactersdatabase.com/uploads/chars/67975-347417678.jpg", - "https://thicc.mywaifulist.moe/waifus/60/ac08a0604cef48cfb60db8946b4eaed65a7d5d3c8b28a340df0259328f984131.jpeg", - "https://thicc.mywaifulist.moe/waifus/60/059e4c365b97ad2dc24c459d02e9cfe9771c3e80305f893b4befbb906e537171.jpeg", - "https://thicc.mywaifulist.moe/waifus/60/88fb2e15ad401f5f14c41e2c9e4c8528f18af52ae8d45b67b3c8e652a001f4e2.jpeg" - ], - "names": { - "en": "Kanade Tachibana", - "jp": "立華 かなで", - "alt": "Tenshi" - }, - "from": { - "name": "Angel Beats!", - "type": "Anime" - }, - "statistics": { - "fav": 205, - "love": 160, - "hate": 20, - "upvote": 70, - "downvote": 8 - } + "status": 200, + "_id": 11251, + "name": { + "first": "Nanako", + "middle": null, + "last": "Kaisei", + "full": "Nanako Kaisei", + "native": "開成 奈々子", + "userPreferred": "Nanako Kaisei", + "alternative": [], + "alternativeSpoiler": [] + }, + "image": { + "large": "https://s4.anilist.co/file/anilistcdn/character/large/b220909-iQMT7Xyikifz.jpg" + }, + "favourites": 0, + "siteUrl": "https://anilist.co/character/220909", + "description": null, + "age": null, + "gender": "Female", + "bloodType": null, + "dateOfBirth": { + "year": null, + "month": null, + "day": null + }, + "media": { + "nodes": [ + { + "id": 106964, + "idMal": 118955, + "coverImage": { + "medium": "https://s4.anilist.co/file/anilistcdn/media/manga/cover/small/nx106964-FeyF5m9SQnXE.jpg" + }, + "bannerImage": "https://s4.anilist.co/file/anilistcdn/media/manga/banner/106964-ryuN7wdxWc5X.jpg", + "title": { + "romaji": "Zenaku no Kuzu", + "english": null, + "native": "善悪の屑", + "userPreferred": "Zenaku no Kuzu" + }, + "synonyms": [ + "The Scum of Good and Evil" + ], + "popularity": 548, + "type": "MANGA", + "format": "MANGA" + } + ] + } ``` + **Content Type:** `application/json` @@ -149,6 +208,6 @@ with a JSON object containing the following information: -This documentation should help you use [`axios`](https://www.npmjs.com/package/axios) for Node.js and [`requests`](https://pypi.org/project/requests/) +This documentation should help you use [`axios`](https://www.npmjs.com/package/axios) for Node.js and [`requests`](https://pypi.org/project/requests/) for Python to interact with the `/waifu` endpoint. -That's it! You are now ready to use the `/waifu` endpoint to retrieve information about your favorite waifus. Happy coding! \ No newline at end of file +That's it! You are now ready to use the `/waifu` endpoint to retrieve information about your favorite waifus. Happy coding! diff --git a/pages/rest-api/Images/_meta.json b/pages/rest-api/Images/_meta.json index 65698c4..7417102 100644 --- a/pages/rest-api/Images/_meta.json +++ b/pages/rest-api/Images/_meta.json @@ -2,5 +2,9 @@ "Waifu": { "title": "Waifu", "theme": { "collapsed": true } + }, + "Husbando": { + "title": "Husbando", + "theme": { "collapsed": true } } }