WIP OAPI 3.0 Annotations

This commit is contained in:
Irfan 2020-07-16 05:40:54 +05:00
parent d744117aa5
commit c2f40c2268
29 changed files with 3440 additions and 20 deletions

View File

@ -15,6 +15,7 @@ use App\Http\Resources\V4\MoreInfoResource;
use App\Http\Resources\V4\AnimeNewsResource;
use App\Http\Resources\V4\PicturesResource;
use App\Http\Resources\V4\RecommendationsResource;
use App\Http\Resources\V4\ResultsResource;
use App\Http\Resources\V4\ReviewsResource;
use App\Http\Resources\V4\AnimeStaffResource;
use App\Http\Resources\V4\AnimeStatisticsResource;
@ -120,6 +121,23 @@ class AnimeController extends Controller
);
}
/**
* @OA\Get(
* path="/anime/{id}/characters",
* operationId="getAnimeCharacters",
* tags={"anime characters"},
*
* @OA\Response(
* response="200",
* description="Returns anime characters resource",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function characters(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -175,6 +193,23 @@ class AnimeController extends Controller
);
}
/**
* @OA\Get(
* path="/anime/{id}/staff",
* operationId="getAnimeStaff",
* tags={"anime staff"},
*
* @OA\Response(
* response="200",
* description="Returns anime staff resource",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function staff(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -231,6 +266,23 @@ class AnimeController extends Controller
);
}
/**
* @OA\Get(
* path="/anime/{id}/episodes/{mal_id}",
* operationId="getAnimeEpisodeById",
* tags={"anime episode"},
*
* @OA\Response(
* response="200",
* description="Returns a single anime episode resource",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function episode(Request $request, int $id, int $episodeId)
{
$results = DB::table($this->getRouteTable($request))
@ -287,6 +339,96 @@ class AnimeController extends Controller
);
}
/**
* @OA\Get(
* path="/anime/{id}/episodes",
* operationId="getAnimeEpisodes",
* tags={"anime episodes"},
*
* @OA\Response(
* response="200",
* description="Returns a list of anime episodes",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*
* @OA\Schema(
* schema="anime episodes",
* description="Anime Episodes Resource",
*
* @OA\Property(
* property="data",
* type="object",
*
* allOf={
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(
* @OA\Property(
* property="results",
* type="array",
* @OA\Items(
* type="object",
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="title",
* type="string",
* description="Title"
* ),
* @OA\Property(
* property="title_japanese",
* type="string",
* description="Title Japanese"
* ),
* @OA\Property(
* property="title_romanji",
* type="string",
* description="title_romanji"
* ),
* @OA\Property(
* property="duration",
* type="integer",
* description="Episode duration in seconds"
* ),
* @OA\Property(
* property="aired",
* type="string",
* description="Aired Date ISO8601"
* ),
* @OA\Property(
* property="filler",
* type="bool",
* description="Filler episode"
* ),
* @OA\Property(
* property="recap",
* type="bool",
* description="Recap episode"
* ),
* @OA\Property(
* property="synopsis",
* type="string",
* description="Episode Synopsis"
* ),
* ),
* ),
* ),
* }
* ),
* )
*/
public function episodes(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -332,7 +474,7 @@ class AnimeController extends Controller
->get();
}
$response = (new AnimeEpisodesResource(
$response = (new ResultsResource(
$results->first()
))->response();
@ -343,6 +485,38 @@ class AnimeController extends Controller
);
}
/**
* @OA\Get(
* path="/anime/{id}/news",
* operationId="getAnimeNews",
* tags={"anime news"},
*
* @OA\Response(
* response="200",
* description="Returns a list of anime news topics",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*
* @OA\Schema(
* schema="anime news",
* description="Anime News Resource",
*
* @OA\Property(
* property="data",
* type="object",
*
* allOf={
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(ref="#/components/schemas/news"),
* }
* ),
* )
*/
public function news(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -388,7 +562,7 @@ class AnimeController extends Controller
->get();
}
$response = (new NewsResource(
$response = (new ResultsResource(
$results->first()
))->response();
@ -399,6 +573,23 @@ class AnimeController extends Controller
);
}
/**
* @OA\Get(
* path="/anime/{id}/forum",
* operationId="getAnimeTopics",
* tags={"forum"},
*
* @OA\Response(
* response="200",
* description="Returns a list of anime forum topics",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function forum(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -455,6 +646,23 @@ class AnimeController extends Controller
);
}
/**
* @OA\Get(
* path="/anime/{id}/videos",
* operationId="getAnimeVideos",
* tags={"anime videos"},
*
* @OA\Response(
* response="200",
* description="Returns a list of anime forum topics",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function videos(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -510,6 +718,23 @@ class AnimeController extends Controller
);
}
/**
* @OA\Get(
* path="/anime/{id}/pictures",
* operationId="getAnimePictures",
* tags={"pictures"},
*
* @OA\Response(
* response="200",
* description="Returns a list of anime forum topics",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function pictures(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -565,6 +790,23 @@ class AnimeController extends Controller
);
}
/**
* @OA\Get(
* path="/anime/{id}/statistics",
* operationId="getAnimeStatistics",
* tags={"anime statistics"},
*
* @OA\Response(
* response="200",
* description="Returns anime statistics",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function stats(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -620,6 +862,23 @@ class AnimeController extends Controller
);
}
/**
* @OA\Get(
* path="/anime/{id}/moreinfo",
* operationId="getAnimeMoreInfo",
* tags={"moreinfo"},
*
* @OA\Response(
* response="200",
* description="Returns anime statistics",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function moreInfo(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -675,6 +934,23 @@ class AnimeController extends Controller
);
}
/**
* @OA\Get(
* path="/anime/{id}/recommendations",
* operationId="getAnimeRecommendations",
* tags={"recommendations"},
*
* @OA\Response(
* response="200",
* description="Returns anime recommendations",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function recommendations(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -730,6 +1006,23 @@ class AnimeController extends Controller
);
}
/**
* @OA\Get(
* path="/anime/{id}/userupdates",
* operationId="getAnimeUserUpdates",
* tags={"anime userupdates"},
*
* @OA\Response(
* response="200",
* description="Returns anime recommendations",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function userupdates(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -786,6 +1079,23 @@ class AnimeController extends Controller
);
}
/**
* @OA\Get(
* path="/anime/{id}/reviews",
* operationId="getAnimeReviews",
* tags={"anime reviews"},
*
* @OA\Response(
* response="200",
* description="Returns anime reviews",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function reviews(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))

View File

@ -92,6 +92,23 @@ class CharacterController extends Controller
);
}
/**
* @OA\Get(
* path="/characters/{id}/pictures",
* operationId="getCharacterPictures",
* tags={"pictures"},
*
* @OA\Response(
* response="200",
* description="Returns a list of pictures of the character",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function pictures(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))

View File

@ -17,12 +17,27 @@ class Controller extends BaseController
{
/**
* @OA\OpenApi(
* @OA\Info(
* version="4.0.0",
* title="Jikan API",
* version="4.0",
* description="[Jikan](https://jikan.moe) is an **Unofficial** MyAnimeList API. It scrapes the website to satisfy the need for an API - which MyAnimeList lacks.",
* termsOfService="https://jikan.moe/terms",
* @OA\Contact(
* email="neko@jikan.moe",
* name="Support"
* email="neko@jikan.moe"
* ),
* @OA\License(
* name="MIT",
* url="https://github.com/jikan-me/jikan-rest/blob/master/LICENSE"
* )
* ),
* @OA\Server(
* description="Jikan REST API Alpha",
* url="https://api.jikan.moe/v4-alpha"
* ),
* @OA\ExternalDocumentation(
* description="Find out more about Jikan",
* url="https://jikan.moe"
* )
* )
*/

View File

@ -7,6 +7,7 @@ use App\Http\HttpHelper;
use App\Http\HttpResponse;
use App\Http\Resources\V4\AnimeCharactersResource;
use App\Http\Resources\V4\AnimeForumResource;
use App\Http\Resources\V4\ResultsResource;
use App\Http\Resources\V4\ReviewsResource;
use App\Http\Resources\V4\UserUpdatesResource;
use App\Http\Resources\V4\RecommendationsResource;
@ -120,6 +121,23 @@ class MangaController extends Controller
);
}
/**
* @OA\Get(
* path="/manga/{id}/characters",
* operationId="getMangaCharacters",
* tags={"manga characters"},
*
* @OA\Response(
* response="200",
* description="Returns manga characters resource",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function characters(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -175,6 +193,38 @@ class MangaController extends Controller
);
}
/**
* @OA\Get(
* path="/manga/{id}/news",
* operationId="getMangaNews",
* tags={"manga news"},
*
* @OA\Response(
* response="200",
* description="Returns a list of manga news topics",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*
* @OA\Schema(
* schema="manga news",
* description="Manga News Resource",
*
* @OA\Property(
* property="data",
* type="object",
*
* allOf={
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(ref="#/components/schemas/news"),
* }
* ),
* )
*/
public function news(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -186,7 +236,7 @@ class MangaController extends Controller
|| $this->isExpired($request, $results)
) {
$page = $request->get('page') ?? 1;
$manga = ['articles' => $this->jikan->getNewsList(new MangaNewsRequest($id, $page))];
$manga = $this->jikan->getNewsList(new MangaNewsRequest($id, $page));
$response = \json_decode($this->serializer->serialize($manga, 'json'), true);
if (HttpHelper::hasError($response)) {
@ -220,7 +270,7 @@ class MangaController extends Controller
->get();
}
$response = (new NewsResource(
$response = (new ResultsResource(
$results->first()
))->response();
@ -231,6 +281,23 @@ class MangaController extends Controller
);
}
/**
* @OA\Get(
* path="/manga/{id}/forum",
* operationId="getMangaTopics",
* tags={"forum"},
*
* @OA\Response(
* response="200",
* description="Returns a list of manga forum topics",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function forum(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -287,6 +354,23 @@ class MangaController extends Controller
);
}
/**
* @OA\Get(
* path="/manga/{id}/pictures",
* operationId="getMangaPictures",
* tags={"pictures"},
*
* @OA\Response(
* response="200",
* description="Returns a list of manga forum topics",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function pictures(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -342,6 +426,23 @@ class MangaController extends Controller
);
}
/**
* @OA\Get(
* path="/manga/{id}/statistics",
* operationId="getMangaStatistics",
* tags={"manga statistics"},
*
* @OA\Response(
* response="200",
* description="Returns anime statistics",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function stats(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -397,6 +498,23 @@ class MangaController extends Controller
);
}
/**
* @OA\Get(
* path="/manga/{id}/moreinfo",
* operationId="getMangaMoreInfo",
* tags={"moreinfo"},
*
* @OA\Response(
* response="200",
* description="Returns manga moreinfo",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function moreInfo(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -452,6 +570,23 @@ class MangaController extends Controller
);
}
/**
* @OA\Get(
* path="/manga/{id}/recommendations",
* operationId="getMangaRecommendations",
* tags={"recommendations"},
*
* @OA\Response(
* response="200",
* description="Returns manga recommendations",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function recommendations(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -507,6 +642,23 @@ class MangaController extends Controller
);
}
/**
* @OA\Get(
* path="/manga/{id}/userupdates",
* operationId="getMangaUserUpdates",
* tags={"manga userupdates"},
*
* @OA\Response(
* response="200",
* description="Returns manga user updates",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function userupdates(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -563,6 +715,23 @@ class MangaController extends Controller
);
}
/**
* @OA\Get(
* path="/manga/{id}/reviews",
* operationId="getMangaReviews",
* tags={"manga reviews"},
*
* @OA\Response(
* response="200",
* description="Returns manga reviews",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function reviews(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))

View File

@ -91,6 +91,23 @@ class PersonController extends Controller
);
}
/**
* @OA\Get(
* path="/people/{id}/pictures",
* operationId="getPersonPictures",
* tags={"pictures"},
*
* @OA\Response(
* response="200",
* description="Returns a list of pictures of the person",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function pictures(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))

View File

@ -45,6 +45,23 @@ class SearchController extends Controller
private $request;
const MAX_RESULTS_PER_PAGE = 25;
/**
* @OA\Get(
* path="/anime",
* operationId="getAnimeSearch",
* tags={"anime search"},
*
* @OA\Response(
* response="200",
* description="Returns search results for anime",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function anime(Request $request)
{
$this->request = $request;
@ -81,6 +98,23 @@ class SearchController extends Controller
);
}
/**
* @OA\Get(
* path="/manga",
* operationId="getMangaSearch",
* tags={"manga search"},
*
* @OA\Response(
* response="200",
* description="Returns search results for manga",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function manga(Request $request)
{
$this->request = $request;
@ -117,6 +151,23 @@ class SearchController extends Controller
);
}
/**
* @OA\Get(
* path="/people",
* operationId="getPeopleSearch",
* tags={"people search"},
*
* @OA\Response(
* response="200",
* description="Returns search results for people",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function people(Request $request)
{
$page = $request->get('page') ?? 1;
@ -152,6 +203,23 @@ class SearchController extends Controller
);
}
/**
* @OA\Get(
* path="/characters",
* operationId="getCharactersSearch",
* tags={"characters search"},
*
* @OA\Response(
* response="200",
* description="Returns search results for characters",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function character(Request $request)
{
$page = $request->get('page') ?? 1;
@ -187,6 +255,23 @@ class SearchController extends Controller
);
}
/**
* @OA\Get(
* path="/users",
* operationId="getUsersSearch",
* tags={"users search"},
*
* @OA\Response(
* response="200",
* description="Returns search results for users",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function users(Request $request)
{
$results = DB::table($this->getRouteTable($request))
@ -246,6 +331,23 @@ class SearchController extends Controller
);
}
/**
* @OA\Get(
* path="/userbyid",
* operationId="getUserById",
* tags={"user by id search"},
*
* @OA\Response(
* response="200",
* description="Returns username by ID search",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function userById(Request $request, int $id)
{
$results = DB::table($this->getRouteTable($request))
@ -301,6 +403,23 @@ class SearchController extends Controller
);
}
/**
* @OA\Get(
* path="/clubs",
* operationId="getClubsSearch",
* tags={"clubs search"},
*
* @OA\Response(
* response="200",
* description="Returns search results for clubs",
* @OA\JsonContent()
* ),
* @OA\Response(
* response="400",
* description="Error: Bad request. When required parameters were not supplied.",
* ),
* )
*/
public function clubs(Request $request)
{
$this->request = $request;

View File

@ -6,6 +6,67 @@ use Illuminate\Http\Resources\Json\JsonResource;
class AnimeCharactersResource extends JsonResource
{
/**
* @OA\Schema(
* schema="anime characters",
* description="Anime Characters Resource",
*
* @OA\Property(
* property="data",
* type="array",
* @OA\Items(
* type="object",
*
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="image_url",
* type="string",
* description="Image URL"
* ),
* @OA\Property(
* property="name",
* type="string",
* description="Character Name"
* ),
* @OA\Property(
* property="role",
* type="string",
* description="Character's Role"
* ),
* @OA\Property(
* property="voice_actors",
* type="array",
* @OA\Items(
* type="object",
* allOf={
* @OA\Schema(ref="#/components/schemas/mal_url"),
* @OA\Schema(
* @OA\Property(
* property="image_url",
* type="string",
* ),
* @OA\Property(
* property="language",
* type="string",
* ),
* ),
* },
* ),
* ),
* ),
* ),
* )
*/
/**
* Transform the resource into an array.
*

View File

@ -12,6 +12,21 @@ class AnimeCollection extends ResourceCollection
* The resource that this resource collects.
*
* @var string
*
* @OA\Schema(
* schema="anime search",
* description="Anime Search Resource",
*
* @OA\Property(
* property="data",
* type="object",
*
* allOf={
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(ref="#/components/schemas/anime"),
* }
* ),
* )
*/
public $collects = 'App\Http\Resources\V4\AnimeResource';

View File

@ -6,6 +6,68 @@ use Illuminate\Http\Resources\Json\JsonResource;
class AnimeEpisodeResource extends JsonResource
{
/**
* @OA\Schema(
* schema="anime episode",
* description="Anime Episode Resource",
*
* @OA\Property(
* property="data",
* type="object",
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="title",
* type="string",
* description="Title"
* ),
* @OA\Property(
* property="title_japanese",
* type="string",
* description="Title Japanese"
* ),
* @OA\Property(
* property="title_romanji",
* type="string",
* description="title_romanji"
* ),
* @OA\Property(
* property="duration",
* type="integer",
* description="Episode duration in seconds"
* ),
* @OA\Property(
* property="aired",
* type="string",
* description="Aired Date ISO8601"
* ),
* @OA\Property(
* property="filler",
* type="bool",
* description="Filler episode"
* ),
* @OA\Property(
* property="recap",
* type="bool",
* description="Recap episode"
* ),
* @OA\Property(
* property="synopsis",
* type="string",
* description="Episode Synopsis"
* ),
* ),
* )
*/
/**
* Transform the resource into an array.
*

View File

@ -15,9 +15,9 @@ class AnimeEpisodesResource extends JsonResource
public function toArray($request)
{
return [
'last_visible_page' => $this['episodes_last_page'],
'last_visible_page' => $this['last_visible_page'] ?? 1,
'has_next_page' => $this['has_next_page'] ?? false,
'episodes' => $this['episodes']
'results' => $this['results']
];
}
}

View File

@ -6,6 +6,44 @@ use Illuminate\Http\Resources\Json\JsonResource;
class AnimeStaffResource extends JsonResource
{
/**
* @OA\Schema(
* schema="anime staff",
* description="Anime Staff Resource",
*
* @OA\Property(
* property="data",
* type="array",
* @OA\Items(
* type="object",
*
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="name",
* type="string",
* description="Name"
* ),
* @OA\Property(
* property="positions",
* type="array",
* description="Staff Positions",
* @OA\Items(type="string")
* ),
* ),
* ),
* )
*/
/**
* Transform the resource into an array.
*

View File

@ -11,6 +11,70 @@ class AnimeStatisticsResource extends JsonResource
*
* @param \Illuminate\Http\Request $request
* @return array
*
* @OA\Schema(
* schema="anime statistics",
* description="Anime Statistics Resource",
*
* @OA\Property(
* property="data",
* type="object",
*
* @OA\Property(
* property="watching",
* type="integer",
* description="Number of users watching the resource"
* ),
* @OA\Property(
* property="completed",
* type="integer",
* description="Number of users who have completed the resource"
* ),
* @OA\Property(
* property="on_hold",
* type="integer",
* description="Number of users who have put the resource on hold"
* ),
* @OA\Property(
* property="dropped",
* type="integer",
* description="Number of users who have dropped the resource"
* ),
* @OA\Property(
* property="plan_to_watch",
* type="integer",
* description="Number of users who have planned to watch the resource"
* ),
* @OA\Property(
* property="total",
* type="integer",
* description="Total number of users who have the resource added to their lists"
* ),
*
* @OA\Property(
* property="scores",
* type="array",
* @OA\Items(
* type="object",
* @OA\Property(
* property="score",
* type="integer",
* description="The number Score"
* ),
* @OA\Property(
* property="votes",
* type="integer",
* description="Number of votes for this score"
* ),
* @OA\Property(
* property="percentage",
* type="float",
* description="Percentage of votes for this score"
* ),
* ),
* ),
* ),
* )
*/
public function toArray($request)
{

View File

@ -11,6 +11,71 @@ class AnimeVideosResource extends JsonResource
*
* @param \Illuminate\Http\Request $request
* @return array
*
* @OA\Schema(
* schema="anime videos",
* description="Anime Videos Resource",
*
* @OA\Property(
* property="data",
* type="object",
*
* @OA\Property(
* property="promos",
* type="array",
* @OA\Items(
* type="object",
* @OA\Property(
* property="title",
* type="string",
* description="Title"
* ),
* @OA\Property(
* property="image_url",
* type="string",
* description="Image URL"
* ),
* @OA\Property(
* property="trailer",
* ref="#/components/schemas/trailer"
* ),
* ),
* ),
* @OA\Property(
* property="episodes",
* type="array",
*
* @OA\Items(
* type="object",
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="title",
* type="string",
* description="Title"
* ),
* @OA\Property(
* property="episode",
* type="string",
* description="Episode"
* ),
* @OA\Property(
* property="image_url",
* type="string",
* description="Image URL"
* ),
* ),
* ),
* ),
* )
*/
public function toArray($request)
{

View File

@ -12,6 +12,21 @@ class CharacterCollection extends ResourceCollection
* The resource that this resource collects.
*
* @var string
*
* @OA\Schema(
* schema="characters search",
* description="Characters Search Resource",
*
* @OA\Property(
* property="data",
* type="object",
*
* allOf={
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(ref="#/components/schemas/character"),
* }
* ),
* )
*/
public $collects = 'App\Http\Resources\V4\CharacterResource';

View File

@ -27,6 +27,35 @@ class CommonResource extends JsonResource
* type="string",
* description="Parsed Embed URL"
* ),
* @OA\Property(
* property="images",
* type="object",
* @OA\Property(
* property="image_url",
* type="string",
* description="Default Image Size URL (120x90)"
* ),
* @OA\Property(
* property="small_image_url",
* type="string",
* description="Small Image Size URL (640x480)"
* ),
* @OA\Property(
* property="medium_image_url",
* type="string",
* description="Medium Image Size URL (320x180)"
* ),
* @OA\Property(
* property="large_image_url",
* type="string",
* description="Large Image Size URL (480x360)"
* ),
* @OA\Property(
* property="maximum_image_url",
* type="string",
* description="Maximum Image Size URL (1280x720)"
* ),
* ),
* ),
*
* @OA\Schema(
@ -173,5 +202,80 @@ class CommonResource extends JsonResource
* ),
* ),
* ),
*
* @OA\Schema(
* schema="pagination",
* type="object",
* @OA\Property(
* property="last_visible_page",
* type="integer"
* ),
* @OA\Property(
* property="has_next_page",
* type="bool"
* ),
* ),
*
* @OA\Schema(
* schema="news",
* type="object",
* @OA\Property(
* property="results",
* type="array",
* @OA\Items(
* type="object",
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="title",
* type="string",
* description="Title"
* ),
* @OA\Property(
* property="date",
* type="string",
* description="Post Date ISO8601"
* ),
* @OA\Property(
* property="author_username",
* type="string",
* description="Author MyAnimeList Username"
* ),
* @OA\Property(
* property="author_url",
* type="string",
* description="Author Profile URL"
* ),
* @OA\Property(
* property="forum_url",
* type="string",
* description="Forum topic URL"
* ),
* @OA\Property(
* property="image_url",
* type="string",
* description="Image URL"
* ),
* @OA\Property(
* property="comments",
* type="integer",
* description="Comment count"
* ),
* @OA\Property(
* property="excerpt",
* type="string",
* description="Excerpt"
* ),
* ),
* ),
* ),
*/
}

View File

@ -11,6 +11,80 @@ class ForumResource extends JsonResource
*
* @param \Illuminate\Http\Request $request
* @return array
*
* @OA\Schema(
* schema="forum",
* description="Forum Resource",
*
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(
* type="object",
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="title",
* type="string",
* description="Title"
* ),
* @OA\Property(
* property="date",
* type="string",
* description="Post Date ISO8601"
* ),
* @OA\Property(
* property="author_username",
* type="string",
* description="Author MyAnimeList Username"
* ),
* @OA\Property(
* property="author_url",
* type="string",
* description="Author Profile URL"
* ),
* @OA\Property(
* property="comments",
* type="integer",
* description="Comment count"
* ),
* @OA\Property(
* property="last_comment",
* type="object",
* description="Last comment details",
* @OA\Property(
* property="url",
* type="string",
* description="Last comment URL"
* ),
* @OA\Property(
* property="author_username",
* type="string",
* description="Author MyAnimeList Username"
* ),
* @OA\Property(
* property="author_url",
* type="string",
* description="Author Profile URL"
* ),
* @OA\Property(
* property="date",
* type="string",
* description="Last comment date posted ISO8601"
* ),
* ),
* ),
* ),
* )
*/
public function toArray($request)
{

View File

@ -11,6 +11,45 @@ class MangaCharactersResource extends JsonResource
*
* @param \Illuminate\Http\Request $request
* @return array
*
* @OA\Schema(
* schema="manga characters",
* description="Manga Characters Resource",
*
* @OA\Property(
* property="data",
* type="array",
* @OA\Items(
* type="object",
*
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="image_url",
* type="string",
* description="Image URL"
* ),
* @OA\Property(
* property="name",
* type="string",
* description="Character Name"
* ),
* @OA\Property(
* property="role",
* type="string",
* description="Character's Role"
* ),
* ),
* ),
* )
*/
public function toArray($request)
{

View File

@ -12,6 +12,21 @@ class MangaCollection extends ResourceCollection
* The resource that this resource collects.
*
* @var string
*
* @OA\Schema(
* schema="manga search",
* description="Manga Search Resource",
*
* @OA\Property(
* property="data",
* type="object",
*
* allOf={
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(ref="#/components/schemas/manga"),
* }
* ),
* )
*/
public $collects = 'App\Http\Resources\V4\MangaResource';

View File

@ -11,6 +11,70 @@ class MangaStatisticsResource extends JsonResource
*
* @param \Illuminate\Http\Request $request
* @return array
*
* @OA\Schema(
* schema="manga statistics",
* description="Manga Statistics Resource",
*
* @OA\Property(
* property="data",
* type="object",
*
* @OA\Property(
* property="reading",
* type="integer",
* description="Number of users reading the resource"
* ),
* @OA\Property(
* property="completed",
* type="integer",
* description="Number of users who have completed the resource"
* ),
* @OA\Property(
* property="on_hold",
* type="integer",
* description="Number of users who have put the resource on hold"
* ),
* @OA\Property(
* property="dropped",
* type="integer",
* description="Number of users who have dropped the resource"
* ),
* @OA\Property(
* property="plan_to_read",
* type="integer",
* description="Number of users who have planned to read the resource"
* ),
* @OA\Property(
* property="total",
* type="integer",
* description="Total number of users who have the resource added to their lists"
* ),
*
* @OA\Property(
* property="scores",
* type="array",
* @OA\Items(
* type="object",
* @OA\Property(
* property="score",
* type="integer",
* description="The number Score"
* ),
* @OA\Property(
* property="votes",
* type="integer",
* description="Number of votes for this score"
* ),
* @OA\Property(
* property="percentage",
* type="float",
* description="Percentage of votes for this score"
* ),
* ),
* ),
* ),
* )
*/
public function toArray($request)
{

View File

@ -11,6 +11,22 @@ class MoreInfoResource extends JsonResource
*
* @param \Illuminate\Http\Request $request
* @return array
*
* @OA\Schema(
* schema="moreinfo",
* description="More Info Resource",
*
* @OA\Property(
* property="data",
* type="object",
*
* @OA\Property(
* property="moreinfo",
* type="string",
* description="Additional information on the entry"
* ),
* ),
* )
*/
public function toArray($request)
{

View File

@ -12,6 +12,21 @@ class PersonCollection extends ResourceCollection
* The resource that this resource collects.
*
* @var string
*
* @OA\Schema(
* schema="people search",
* description="People Search Resource",
*
* @OA\Property(
* property="data",
* type="object",
*
* allOf={
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(ref="#/components/schemas/person"),
* }
* ),
* )
*/
public $collects = 'App\Http\Resources\V4\PersonResource';

View File

@ -11,6 +11,51 @@ class PicturesResource extends JsonResource
*
* @param \Illuminate\Http\Request $request
* @return array
*
* @OA\Schema(
* schema="pictures",
* description="Pictures Resource",
*
* @OA\Property(
* property="data",
* type="object",
*
* @OA\Property(
* property="jpg",
* type="array",
* @OA\Items(
* type="object",
* @OA\Property(
* property="image_url",
* type="string",
* description="Default JPG Image Size URL"
* ),
* @OA\Property(
* property="large_image_url",
* type="string",
* description="Large JPG Image Size URL"
* ),
* ),
* ),
* @OA\Property(
* property="webp",
* type="array",
* @OA\Items(
* type="object",
* @OA\Property(
* property="image_url",
* type="string",
* description="Default JPG Image Size URL"
* ),
* @OA\Property(
* property="large_image_url",
* type="string",
* description="Large JPG Image Size URL"
* ),
* ),
* ),
* ),
* )
*/
public function toArray($request)
{

View File

@ -11,6 +11,45 @@ class RecommendationsResource extends JsonResource
*
* @param \Illuminate\Http\Request $request
* @return array
*
* @OA\Schema(
* schema="recommendations",
* description="Recommendations Resource",
*
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(
* type="object",
* @OA\Property(
* property="mal_id",
* type="integer",
* description="Recommended MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="Recommended MyAnimeList URL"
* ),
* @OA\Property(
* property="recommendation_url",
* type="string",
* description="Recommendation MyAnimeList URL"
* ),
* @OA\Property(
* property="title",
* type="string",
* description="Recommended Entry Title"
* ),
* @OA\Property(
* property="recommendation_count",
* type="integer",
* description="Number of users who have recommended this entry"
* ),
* ),
* ),
* )
*/
public function toArray($request)
{

View File

@ -6,6 +6,211 @@ use Illuminate\Http\Resources\Json\JsonResource;
class ReviewsResource extends JsonResource
{
/**
* @OA\Schema(
* schema="anime reviews",
* description="Anime Reviews Resource",
*
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(
* type="object",
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="type",
* type="string",
* description="Entry Type"
* ),
* @OA\Property(
* property="votes",
* type="integer",
* description="Number of user votes on the Review"
* ),
* @OA\Property(
* property="date",
* type="string",
* description="Review created date ISO8601"
* ),
* @OA\Property(
* property="scores",
* type="object",
* description="Review Scores breakdown",
* @OA\Property(
* property="overall",
* type="integer",
* description="Overall Score"
* ),
* @OA\Property(
* property="story",
* type="integer",
* description="Story Score"
* ),
* @OA\Property(
* property="animation",
* type="integer",
* description="Animation Score"
* ),
* @OA\Property(
* property="sound",
* type="integer",
* description="Sound Score"
* ),
* @OA\Property(
* property="character",
* type="integer",
* description="Character Score"
* ),
* @OA\Property(
* property="enjoyment",
* type="integer",
* description="Enjoyment Score"
* ),
* ),
* @OA\Property(
* property="review",
* type="string",
* description="Review content"
* ),
* @OA\Property(
* property="reviewer",
* type="object",
* description="Reviewer details",
* @OA\Property(
* property="username",
* type="string",
* description="MyAnimeList Username"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList Profile URL"
* ),
* @OA\Property(
* property="image_url",
* type="string",
* description="User Display Picture Image URL"
* ),
* @OA\Property(
* property="episodes_seen",
* type="integer",
* description="Number of episodes seen"
* ),
* ),
* ),
* ),
* ),
*
* @OA\Schema(
* schema="manga reviews",
* description="Manga Reviews Resource",
*
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(
* type="object",
* @OA\Property(
* property="mal_id",
* type="integer",
* description="MyAnimeList ID"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="type",
* type="string",
* description="Entry Type"
* ),
* @OA\Property(
* property="votes",
* type="integer",
* description="Number of user votes on the Review"
* ),
* @OA\Property(
* property="date",
* type="string",
* description="Review created date ISO8601"
* ),
* @OA\Property(
* property="scores",
* type="object",
* description="Review Scores breakdown",
* @OA\Property(
* property="overall",
* type="integer",
* description="Overall Score"
* ),
* @OA\Property(
* property="story",
* type="integer",
* description="Story Score"
* ),
* @OA\Property(
* property="art",
* type="integer",
* description="Art Score"
* ),
* @OA\Property(
* property="character",
* type="integer",
* description="Character Score"
* ),
* @OA\Property(
* property="enjoyment",
* type="integer",
* description="Enjoyment Score"
* ),
* ),
* @OA\Property(
* property="review",
* type="string",
* description="Review content"
* ),
* @OA\Property(
* property="reviewer",
* type="object",
* description="Reviewer details",
* @OA\Property(
* property="username",
* type="string",
* description="MyAnimeList Username"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList Profile URL"
* ),
* @OA\Property(
* property="image_url",
* type="string",
* description="User Display Picture Image URL"
* ),
* @OA\Property(
* property="episodes_seen",
* type="integer",
* description="Number of episodes seen"
* ),
* ),
* ),
* ),
* )
*/
/**
* Transform the resource into an array.
*

View File

@ -11,6 +11,124 @@ class UserUpdatesResource extends JsonResource
*
* @param \Illuminate\Http\Request $request
* @return array
*
* @OA\Schema(
* schema="anime userupdates",
* description="Anime User Updates Resource",
*
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(
* type="object",
* @OA\Property(
* property="username",
* type="string",
* description="MyAnimeList Username"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="image_url",
* type="string",
* description="Image URL"
* ),
* @OA\Property(
* property="score",
* type="integer",
* description="User Score"
* ),
* @OA\Property(
* property="status",
* type="string",
* description="User list status"
* ),
* @OA\Property(
* property="episodes_seen",
* type="integer",
* description="Number of episodes seen"
* ),
* @OA\Property(
* property="episodes_total",
* type="integer",
* description="Total number of episodes"
* ),
* @OA\Property(
* property="date",
* type="string",
* description="Last updated date ISO8601"
* ),
* ),
* ),
* ),
*
* @OA\Schema(
* schema="manga userupdates",
* description="Manga User Updates Resource",
*
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(
* type="object",
* @OA\Property(
* property="username",
* type="string",
* description="MyAnimeList Username"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList URL"
* ),
* @OA\Property(
* property="image_url",
* type="string",
* description="Image URL"
* ),
* @OA\Property(
* property="score",
* type="integer",
* description="User Score"
* ),
* @OA\Property(
* property="status",
* type="string",
* description="User list status"
* ),
* @OA\Property(
* property="volumes_read",
* type="integer",
* description="Number of volumes read"
* ),
* @OA\Property(
* property="volumes_total",
* type="integer",
* description="Total number of volumes"
* ),
* @OA\Property(
* property="chapters_read",
* type="integer",
* description="Number of chapters read"
* ),
* @OA\Property(
* property="chapters_total",
* type="integer",
* description="Total number of chapters"
* ),
* @OA\Property(
* property="date",
* type="string",
* description="Last updated date ISO8601"
* ),
* ),
* ),
* )
*/
public function toArray($request)
{

View File

@ -155,12 +155,12 @@ $commonMiddleware = [
// 'source-data-manager'
];
$app->router->group(
[
'prefix' => 'v4',
'prefix' => 'v4-alpha',
'namespace' => env('SOURCE') === 'local' ? 'App\Http\Controllers\V4DB' : 'App\Http\Controllers\V4',
'middleware' => $commonMiddleware
],
function ($router) {
require __DIR__.'/../routes/web.v4.php';

View File

@ -18,10 +18,11 @@ class CreateIndex extends Migration
*/
public function up()
{
$mappings = config('controller-to-table-mapping');
$mappings = config('controller');
$mapped = [];
foreach ($mappings as $table) {
foreach ($mappings as $controller) {
$table = $controller['table_name'];
if (in_array($table, $mapped) || in_array($table, self::IGNORE) || Schema::hasTable($table)) {
continue;
}

View File

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateMagazineTable extends Migration
class CreateMagazinesTable extends Migration
{
/**
* Run the migrations.

File diff suppressed because it is too large Load Diff