season in lowercase

This commit is contained in:
Irfan 2020-07-14 17:15:45 +05:00
parent 1bc746db77
commit 8232efdecb
12 changed files with 1023 additions and 14 deletions

View File

@ -115,4 +115,7 @@ SLAVE_KEY_HEADER="X-Master"
###
GITHUB_REPORTING=true
GITHUB_REST="jikan-me/jikan-rest"
GITHUB_API="jikan-me/jikan
GITHUB_API="jikan-me/jikan
SWAGGER_VERSION=3.0

View File

@ -127,7 +127,8 @@ class Anime extends Model
return null;
}
return explode(' ', $premiered)[0];
$season = explode(' ', $premiered)[0];
return strtolower($season);
}
public function setYearAttribute($value)

View File

@ -44,6 +44,23 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class AnimeController extends Controller
{
/**
* @OA\Get(
* path="/anime/{id}",
* operationId="getAnimeById",
* tags={"anime"},
*
* @OA\Response(
* response="200",
* description="Returns anime resource",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function main(Request $request, int $id)
{
$results = Anime::query()

View File

@ -4,18 +4,10 @@ namespace App\Http\Controllers\V4DB;
use App\Http\HttpHelper;
use App\Providers\SerializerFactory;
use App\Providers\SerializerServiceProdivder;
use App\Providers\SerializerServiceProviderV3;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Jikan\Jikan;
use Jikan\MyAnimeList\MalClient;
use JMS\Serializer\Context;
use JMS\Serializer\Serializer;
use Laravel\Lumen\Routing\Controller as BaseController;
use mysql_xdevapi\Exception;
use r\Queries\Control\Http;
use Symfony\Component\HttpFoundation\Response;
/**
* Class Controller
@ -23,6 +15,18 @@ use Symfony\Component\HttpFoundation\Response;
*/
class Controller extends BaseController
{
/**
* @OA\Info(
* title="Jikan API",
* version="4.0",
* @OA\Contact(
* email="neko@jikan.moe",
* name="Support"
* )
* )
*/
/**
* @var Serializer
*/

View File

@ -6,6 +6,186 @@ use Illuminate\Http\Resources\Json\JsonResource;
class AnimeResource extends JsonResource
{
/**
* @OA\Schema(
* schema="anime",
* description="Anime Resource",
*
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="images",
* type="object",
* description="Images",
* @OA\Property(
* property="jpg",
* type="object",
* description="Available images in JPG",
* @OA\Property(
* property="image_url",
* type="string",
* description="Image URL JPG (225x335)",
* ),
* @OA\Property(
* property="small_image_url",
* type="string",
* description="Small Image URL JPG (50x74)",
* ),
* @OA\Property(
* property="large_image_url",
* type="string",
* description="Image URL JPG (300x446)",
* ),
* ),
* @OA\Property(
* property="webp",
* type="object",
* description="Available images in WEBP",
* @OA\Property(
* property="image_url",
* type="string",
* description="Image URL WEBP (225x335)",
* ),
* @OA\Property(
* property="small_image_url",
* type="string",
* description="Small Image URL WEBP (50x74)",
* ),
* @OA\Property(
* property="large_image_url",
* type="string",
* description="Image URL WEBP (300x446)",
* ),
* ),
* ),
* @OA\Property(
* property="trailer",
* ref="#/components/schemas/trailer"
* ),
*
* @OA\Property(
* property="title",
* type="string",
* description="Title"
* ),
* @OA\Property(
* property="title_english",
* type="string",
* description="English Title"
* ),
* @OA\Property(
* property="title_japanese",
* type="string",
* description="Japanese Title"
* ),
* @OA\Property(
* property="title_synonyms",
* type="array",
* description="Other Titles",
* @OA\Items(
* type="string"
* )
* ),
* @OA\Property(
* property="type",
* type="string",
* enum={"TV","OVA","Movie","Special","ONA","Music"},
* description="Anime Type"
* ),
* @OA\Property(
* property="source",
* type="string",
* description="Original Material/Source adapted from"
* ),
* @OA\Property(
* property="episodes",
* type="integer",
* description="Episode count"
* ),
* @OA\Property(
* property="status",
* type="string",
* enum={"Finished Airing", "Currently Airing", "Not yet aired"},
* description="Airing status"
* ),
* @OA\Property(
* property="airing",
* type="bool",
* description="Airing boolean"
* ),
* @OA\Property(
* property="aired",
* ref="#/components/schemas/daterange"
* ),
* @OA\Property(
* property="duration",
* type="string",
* description="Parsed raw duration"
* ),
* @OA\Property(
* property="rating",
* type="string",
* enum={"G - All Ages", "PG - Children", "PG-13 - Teens 13 or older", "R - 17+ (violence & profanity)", "R+ - Mild Nudity", "Rx - Hentai" },
* description="Anime audience rating"
* ),
* @OA\Property(
* property="score",
* type="float",
* description="Score"
* ),
* @OA\Property(
* property="scored_by",
* type="integer",
* description="Number of users"
* ),
* @OA\Property(
* property="rank",
* type="integer",
* description="Ranking"
* ),
* @OA\Property(
* property="popularity",
* type="integer",
* description="Popularity"
* ),
* @OA\Property(
* property="members",
* type="integer",
* description="Number of users who have added this entry to their list"
* ),
* @OA\Property(
* property="favorites",
* type="integer",
* description="Number of users who have favorited this entry"
* ),
* @OA\Property(
* property="synopsis",
* type="string",
* description="Synopsis"
* ),
* @OA\Property(
* property="background",
* type="string",
* description="Background"
* ),
* @OA\Property(
* property="season",
* type="float",
* description="Score"
* ),
*
* )
*/
/**
* Transform the resource into an array.
*
@ -31,7 +211,7 @@ class AnimeResource extends JsonResource
'aired' => $this->aired,
'duration' => $this->duration,
'rating' => $this->rating,
'scored' => $this->score,
'score' => $this->score,
'scored_by' => $this->scored_by,
'rank' => $this->rank,
'popularity' => $this->popularity,

View File

@ -6,5 +6,94 @@ use Illuminate\Http\Resources\Json\JsonResource;
class CommonResource extends JsonResource
{
/**
* @OA\Schema(
* schema="trailer",
* type="object",
* description="Youtube Details",
*
* @OA\Property(
* property="youtube_id",
* type="string",
* description="YouTube ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="YouTube URL"
* ),
* @OA\Property(
* property="embed_url",
* type="string",
* description="Parsed Embed URL"
* ),
* ),
*
* @OA\Schema(
* schema="daterange",
* type="object",
* description="Date range",
*
* @OA\Property(
* property="from",
* type="string",
* description="Date ISO8601"
* ),
* @OA\Property(
* property="to",
* type="string",
* description="Date ISO8601"
* ),
* @OA\Property(
* property="prop",
* type="object",
* description="Date Prop",
* @OA\Property(
* property="from",
* type="object",
* description="Date Prop From",
* @OA\Property(
* property="day",
* type="integer",
* description="Day"
* ),
* @OA\Property(
* property="month",
* type="integer",
* description="Month"
* ),
* @OA\Property(
* property="year",
* type="integer",
* description="year"
* ),
* ),
* @OA\Property(
* property="to",
* type="object",
* description="Date Prop To",
* @OA\Property(
* property="day",
* type="integer",
* description="Day"
* ),
* @OA\Property(
* property="month",
* type="integer",
* description="Month"
* ),
* @OA\Property(
* property="year",
* type="integer",
* description="year"
* ),
* ),
* @OA\Property(
* property="string",
* type="string",
* description="Raw parsed string"
* ),
* ),
* )
*/
}

View File

@ -37,6 +37,8 @@ $app->register(Jenssegers\Mongodb\MongodbServiceProvider::class);
$app->withFacades();
$app->withEloquent();
$app->configure('swagger-lume');
/*
|--------------------------------------------------------------------------
| Register Container Bindings
@ -99,6 +101,8 @@ $app->configure('queue');
$app->configure('controller-to-table-mapping');
$app->configure('controller');
$app->register(\SwaggerLume\ServiceProvider::class);
if (env('CACHING')) {
$app->configure('cache');
$app->register(Illuminate\Redis\RedisServiceProvider::class);

View File

@ -9,6 +9,7 @@
"ext-json": "*",
"ext-mongodb": "*",
"danielmewes/php-rql": "dev-master",
"darkaonline/swagger-lume": "7",
"divineomega/cachetphp": "^0.2.0",
"fabpot/goutte": "3.2.3",
"flipbox/lumen-generator": "^6",
@ -22,7 +23,8 @@
"predis/predis": "^1.1",
"symfony/yaml": "^4.1",
"vlucas/phpdotenv": "^4",
"voku/anti-xss": "^4.0"
"voku/anti-xss": "^4.0",
"zircote/swagger-php": "3.*"
},
"require-dev": {
"fzaninotto/faker": "^1.9.1",

176
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "2aa457b1ebc4916d31595557c9a0d095",
"content-hash": "e3247d03ea2c99fbb0f463eb109a8f79",
"packages": [
{
"name": "brick/math",
@ -164,6 +164,60 @@
],
"time": "2016-05-31T01:55:32+00:00"
},
{
"name": "darkaonline/swagger-lume",
"version": "7.0",
"source": {
"type": "git",
"url": "https://github.com/DarkaOnLine/SwaggerLume.git",
"reference": "f51914718ab6a9b23c66febdef82d26da2f2fad8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/DarkaOnLine/SwaggerLume/zipball/f51914718ab6a9b23c66febdef82d26da2f2fad8",
"reference": "f51914718ab6a9b23c66febdef82d26da2f2fad8",
"shasum": ""
},
"require": {
"laravel/lumen-framework": "~6.0|~7.0",
"php": ">=7.2",
"swagger-api/swagger-ui": "^3.0",
"zircote/swagger-php": "~2.0|3.*"
},
"require-dev": {
"fzaninotto/faker": "~1.8",
"mockery/mockery": "1.*",
"phpunit/phpunit": "8.*",
"satooshi/php-coveralls": "^2.0",
"vlucas/phpdotenv": "~3.3|~4.0"
},
"type": "library",
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"SwaggerLume\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Darius Matulionis",
"email": "darius@matulionis.lt"
}
],
"description": "Swagger integration to Lumen 5",
"keywords": [
"laravel",
"lumen",
"swagger"
],
"time": "2020-03-26T09:34:03+00:00"
},
{
"name": "divineomega/cachetphp",
"version": "v0.2",
@ -3687,6 +3741,63 @@
],
"time": "2020-03-29T20:13:32+00:00"
},
{
"name": "swagger-api/swagger-ui",
"version": "v3.28.0",
"source": {
"type": "git",
"url": "https://github.com/swagger-api/swagger-ui.git",
"reference": "3cef22736827b933b0f116e33847a47f7724bd16"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/3cef22736827b933b0f116e33847a47f7724bd16",
"reference": "3cef22736827b933b0f116e33847a47f7724bd16",
"shasum": ""
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Anna Bodnia",
"email": "anna.bodnia@gmail.com"
},
{
"name": "Buu Nguyen",
"email": "buunguyen@gmail.com"
},
{
"name": "Josh Ponelat",
"email": "jponelat@gmail.com"
},
{
"name": "Kyle Shockey",
"email": "kyleshockey1@gmail.com"
},
{
"name": "Robert Barnwell",
"email": "robert@robertismy.name"
},
{
"name": "Sahar Jafari",
"email": "shr.jafari@gmail.com"
}
],
"description": " Swagger UI is a collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.",
"homepage": "http://swagger.io",
"keywords": [
"api",
"documentation",
"openapi",
"specification",
"swagger",
"ui"
],
"time": "2020-06-29T12:43:36+00:00"
},
{
"name": "symfony/browser-kit",
"version": "v4.4.8",
@ -5473,6 +5584,69 @@
"utf8"
],
"time": "2020-05-14T00:59:19+00:00"
},
{
"name": "zircote/swagger-php",
"version": "3.0.4",
"source": {
"type": "git",
"url": "https://github.com/zircote/swagger-php.git",
"reference": "fa47d62c22c95272625624fbf8109fa46ffac43b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zircote/swagger-php/zipball/fa47d62c22c95272625624fbf8109fa46ffac43b",
"reference": "fa47d62c22c95272625624fbf8109fa46ffac43b",
"shasum": ""
},
"require": {
"doctrine/annotations": "*",
"php": ">=7.2",
"symfony/finder": ">=2.2",
"symfony/yaml": ">=3.3"
},
"require-dev": {
"phpunit/phpunit": ">=8",
"squizlabs/php_codesniffer": ">=3.3",
"zendframework/zend-form": "<2.8"
},
"bin": [
"bin/openapi"
],
"type": "library",
"autoload": {
"psr-4": {
"OpenApi\\": "src"
},
"files": [
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Robert Allen",
"email": "zircote@gmail.com",
"homepage": "http://www.zircote.com"
},
{
"name": "Bob Fanger",
"email": "bfanger@gmail.com",
"homepage": "http://bfanger.nl"
}
],
"description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations",
"homepage": "https://github.com/zircote/swagger-php/",
"keywords": [
"api",
"json",
"rest",
"service discovery"
],
"time": "2020-05-07T09:10:49+00:00"
}
],
"packages-dev": [

204
config/swagger-lume.php Normal file
View File

@ -0,0 +1,204 @@
<?php
return [
'api' => [
/*
|--------------------------------------------------------------------------
| Edit to set the api's title
|--------------------------------------------------------------------------
*/
'title' => 'Swagger Lume API',
],
'routes' => [
/*
|--------------------------------------------------------------------------
| Route for accessing api documentation interface
|--------------------------------------------------------------------------
*/
'api' => '/api/documentation',
/*
|--------------------------------------------------------------------------
| Route for accessing parsed swagger annotations.
|--------------------------------------------------------------------------
*/
'docs' => '/docs',
/*
|--------------------------------------------------------------------------
| Route for Oauth2 authentication callback.
|--------------------------------------------------------------------------
*/
'oauth2_callback' => '/api/oauth2-callback',
/*
|--------------------------------------------------------------------------
| Route for serving assets
|--------------------------------------------------------------------------
*/
'assets' => '/swagger-ui-assets',
/*
|--------------------------------------------------------------------------
| Middleware allows to prevent unexpected access to API documentation
|--------------------------------------------------------------------------
*/
'middleware' => [
'api' => [],
'asset' => [],
'docs' => [],
'oauth2_callback' => [],
],
],
'paths' => [
/*
|--------------------------------------------------------------------------
| Absolute path to location where parsed swagger annotations will be stored
|--------------------------------------------------------------------------
*/
'docs' => storage_path('api-docs'),
/*
|--------------------------------------------------------------------------
| File name of the generated json documentation file
|--------------------------------------------------------------------------
*/
'docs_json' => 'api-docs.json',
/*
|--------------------------------------------------------------------------
| Absolute path to directory containing the swagger annotations are stored.
|--------------------------------------------------------------------------
*/
'annotations' => base_path('app'),
/*
|--------------------------------------------------------------------------
| Absolute path to directories that you would like to exclude from swagger generation
|--------------------------------------------------------------------------
*/
'excludes' => [],
/*
|--------------------------------------------------------------------------
| Edit to set the swagger scan base path
|--------------------------------------------------------------------------
*/
'base' => env('L5_SWAGGER_BASE_PATH', null),
/*
|--------------------------------------------------------------------------
| Absolute path to directory where to export views
|--------------------------------------------------------------------------
*/
'views' => base_path('resources/views/vendor/swagger-lume'),
],
/*
|--------------------------------------------------------------------------
| API security definitions. Will be generated into documentation file.
|--------------------------------------------------------------------------
*/
'security' => [
/*
|--------------------------------------------------------------------------
| Examples of Security definitions
|--------------------------------------------------------------------------
*/
/*
'api_key_security_example' => [ // Unique name of security
'type' => 'apiKey', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
'description' => 'A short description for security scheme',
'name' => 'api_key', // The name of the header or query parameter to be used.
'in' => 'header', // The location of the API key. Valid values are "query" or "header".
],
'oauth2_security_example' => [ // Unique name of security
'type' => 'oauth2', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
'description' => 'A short description for oauth2 security scheme.',
'flow' => 'implicit', // The flow used by the OAuth2 security scheme. Valid values are "implicit", "password", "application" or "accessCode".
'authorizationUrl' => 'http://example.com/auth', // The authorization URL to be used for (implicit/accessCode)
//'tokenUrl' => 'http://example.com/auth' // The authorization URL to be used for (password/application/accessCode)
'scopes' => [
'read:projects' => 'read your projects',
'write:projects' => 'modify projects in your account',
]
],*/
/* Open API 3.0 support
'passport' => [ // Unique name of security
'type' => 'oauth2', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
'description' => 'Laravel passport oauth2 security.',
'in' => 'header',
'scheme' => 'https',
'flows' => [
"password" => [
"authorizationUrl" => config('app.url') . '/oauth/authorize',
"tokenUrl" => config('app.url') . '/oauth/token',
"refreshUrl" => config('app.url') . '/token/refresh',
"scopes" => []
],
],
],
*/
],
/*
|--------------------------------------------------------------------------
| Turn this off to remove swagger generation on production
|--------------------------------------------------------------------------
*/
'generate_always' => env('SWAGGER_GENERATE_ALWAYS', false),
/*
|--------------------------------------------------------------------------
| Edit to set the swagger version number
|--------------------------------------------------------------------------
*/
'swagger_version' => env('SWAGGER_VERSION', '3.0'),
/*
|--------------------------------------------------------------------------
| Edit to trust the proxy's ip address - needed for AWS Load Balancer
|--------------------------------------------------------------------------
*/
'proxy' => false,
/*
|--------------------------------------------------------------------------
| Configs plugin allows to fetch external configs instead of passing them to SwaggerUIBundle.
| See more at: https://github.com/swagger-api/swagger-ui#configs-plugin
|--------------------------------------------------------------------------
*/
'additional_config_url' => null,
/*
|--------------------------------------------------------------------------
| Apply a sort to the operation list of each API. It can be 'alpha' (sort by paths alphanumerically),
| 'method' (sort by HTTP method).
| Default is the order returned by the server unchanged.
|--------------------------------------------------------------------------
*/
'operations_sort' => env('L5_SWAGGER_OPERATIONS_SORT', null),
/*
|--------------------------------------------------------------------------
| Uncomment to pass the validatorUrl parameter to SwaggerUi init on the JS
| side. A null value here disables validation.
|--------------------------------------------------------------------------
*/
'validator_url' => null,
/*
|--------------------------------------------------------------------------
| Uncomment to add constants which can be used in anotations
|--------------------------------------------------------------------------
*/
'constants' => [
// 'SWAGGER_LUME_CONST_HOST' => env('SWAGGER_LUME_CONST_HOST', 'http://my-default-host.com'),
],
];

View File

@ -0,0 +1,101 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{config('swagger-lume.api.title')}}</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="{{ swagger_lume_asset('swagger-ui.css') }}" >
<link rel="icon" type="image/png" href="{{ swagger_lume_asset('favicon-32x32.png') }}" sizes="32x32" />
<link rel="icon" type="image/png" href="{{ swagger_lume_asset('favicon-16x16.png') }}" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
body {
margin:0;
background: #fafafa;
}
</style>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
<defs>
<symbol viewBox="0 0 20 20" id="unlocked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
</symbol>
<symbol viewBox="0 0 20 20" id="locked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="close">
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow">
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow-down">
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="jump-to">
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="expand">
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
</symbol>
</defs>
</svg>
<div id="swagger-ui"></div>
<script src="{{ swagger_lume_asset('swagger-ui-bundle.js') }}"> </script>
<script src="{{ swagger_lume_asset('swagger-ui-standalone-preset.js') }}"> </script>
<script>
window.onload = function() {
// Build a system
const ui = SwaggerUIBundle({
dom_id: '#swagger-ui',
url: "{!! $urlToDocs !!}",
operationsSorter: {!! isset($operationsSorter) ? '"' . $operationsSorter . '"' : 'null' !!},
configUrl: {!! isset($additionalConfigUrl) ? '"' . $additionalConfigUrl . '"' : 'null' !!},
validatorUrl: {!! isset($validatorUrl) ? '"' . $validatorUrl . '"' : 'null' !!},
oauth2RedirectUrl: "{{ route('swagger-lume.oauth2_callback') }}",
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
window.ui = ui
}
</script>
</body>
</html>

View File

@ -0,0 +1,230 @@
{
"openapi": "3.0.0",
"info": {
"title": "Jikan API",
"contact": {
"name": "Support",
"email": "neko@jikan.moe"
},
"version": "4.0"
},
"paths": {
"/anime/{id}": {
"get": {
"tags": [
"anime"
],
"operationId": "getAnimeById",
"responses": {
"200": {
"description": "Returns anime resource",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Error: Bad request. When required parameters were not supplied."
}
}
}
}
},
"components": {
"schemas": {
"anime": {
"description": "Anime Resource",
"properties": {
"mal_id": {
"description": "MyAnimeList ID",
"type": "integer"
},
"url": {
"description": "MyAnimeList URL",
"type": "string"
},
"images": {
"description": "Images",
"properties": {
"jpg": {
"description": "Available images in JPG",
"properties": {
"image_url": {
"description": "Image URL JPG (225x335)",
"type": "string"
},
"small_image_url": {
"description": "Small Image URL JPG (50x74)",
"type": "string"
},
"large_image_url": {
"description": "Image URL JPG (300x446)",
"type": "string"
}
},
"type": "object"
},
"webp": {
"description": "Available images in WEBP",
"properties": {
"image_url": {
"description": "Image URL WEBP (225x335)",
"type": "string"
},
"small_image_url": {
"description": "Small Image URL WEBP (50x74)",
"type": "string"
},
"large_image_url": {
"description": "Image URL WEBP (300x446)",
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"trailer": {
"$ref": "#/components/schemas/trailer"
},
"title": {
"description": "Title",
"type": "string"
},
"title_english": {
"description": "English Title",
"type": "string"
},
"title_japanese": {
"description": "Japanese Title",
"type": "string"
},
"title_synonyms": {
"description": "Other Titles",
"type": "array",
"items": {
"type": "string"
}
},
"type": {
"description": "Anime Type",
"type": "string",
"enum": [
"TV",
"OVA",
"Movie",
"Special",
"ONA",
"Music"
]
},
"source": {
"description": "Original Material/Source adapted from",
"type": "string"
},
"episodes": {
"description": "Episode count",
"type": "integer"
},
"status": {
"description": "Airing status",
"type": "string",
"enum": [
"Finished Airing",
"Currently Airing",
"Not yet aired"
]
},
"airing": {
"description": "Airing boolean",
"type": "bool"
},
"aired": {
"$ref": "#/components/schemas/daterange"
}
},
"type": "object"
},
"trailer": {
"description": "Youtube Details",
"properties": {
"youtube_id": {
"description": "YouTube ID",
"type": "string"
},
"url": {
"description": "YouTube URL",
"type": "string"
},
"embed_url": {
"description": "Parsed Embed URL",
"type": "string"
}
},
"type": "object"
},
"daterange": {
"description": "Date range",
"properties": {
"from": {
"description": "Date ISO8601",
"type": "string"
},
"to": {
"description": "Date ISO8601",
"type": "string"
},
"prop": {
"description": "Date Prop",
"properties": {
"from": {
"description": "Date Prop From",
"properties": {
"day": {
"description": "Day",
"type": "integer"
},
"month": {
"description": "Month",
"type": "integer"
},
"year": {
"description": "year",
"type": "integer"
}
},
"type": "object"
},
"to": {
"description": "Date Prop To",
"properties": {
"day": {
"description": "Day",
"type": "integer"
},
"month": {
"description": "Month",
"type": "integer"
},
"year": {
"description": "year",
"type": "integer"
}
},
"type": "object"
},
"string": {
"description": "Raw parsed string",
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}
}
}
}