mirror of
https://github.com/jikan-me/jikan-rest.git
synced 2025-02-20 11:23:35 +08:00
WIP OAPI 3.0 Annotations
This commit is contained in:
parent
8232efdecb
commit
d744117aa5
@ -183,8 +183,8 @@ class Anime extends Model
|
||||
public function getThemesAttribute()
|
||||
{
|
||||
return [
|
||||
'opening' => $this->attributes['opening_themes'],
|
||||
'ending' => $this->attributes['ending_themes'],
|
||||
'openings' => $this->attributes['opening_themes'],
|
||||
'endings' => $this->attributes['ending_themes'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ class Character extends Model
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $appends = ['images'];
|
||||
protected $appends = ['images', 'favorites'];
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
@ -43,7 +43,7 @@ class Character extends Model
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'_id', 'trailer_url', 'premiered', 'opening_themes', 'ending_themes', 'images'
|
||||
'_id', 'trailer_url', 'premiered', 'opening_themes', 'ending_themes', 'images', 'member_favorites'
|
||||
];
|
||||
|
||||
public function getImageAttribute()
|
||||
@ -62,6 +62,11 @@ class Character extends Model
|
||||
];
|
||||
}
|
||||
|
||||
public function getFavoritesAttribute()
|
||||
{
|
||||
return $this->attributes['member_favorites'];
|
||||
}
|
||||
|
||||
public static function scrape(int $id)
|
||||
{
|
||||
$data = app('JikanParser')->getCharacter(new CharacterRequest($id));
|
||||
|
@ -16,6 +16,24 @@ use MongoDB\BSON\UTCDateTime;
|
||||
|
||||
class CharacterController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/characters/{id}",
|
||||
* operationId="getCharacterById",
|
||||
* tags={"character"},
|
||||
*
|
||||
* @OA\Response(
|
||||
* response="200",
|
||||
* description="Returns manga 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 = Character::query()
|
||||
|
@ -44,7 +44,23 @@ use MongoDB\BSON\UTCDateTime;
|
||||
|
||||
class MangaController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/manga/{id}",
|
||||
* operationId="getMangaById",
|
||||
* tags={"manga"},
|
||||
*
|
||||
* @OA\Response(
|
||||
* response="200",
|
||||
* description="Returns manga 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 = Manga::query()
|
||||
|
@ -16,6 +16,23 @@ use MongoDB\BSON\UTCDateTime;
|
||||
|
||||
class PersonController extends Controller
|
||||
{
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/people/{id}",
|
||||
* operationId="getPersonById",
|
||||
* tags={"person"},
|
||||
*
|
||||
* @OA\Response(
|
||||
* response="200",
|
||||
* description="Returns person 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 = Person::query()
|
||||
|
@ -178,11 +178,73 @@ class AnimeResource extends JsonResource
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="season",
|
||||
* type="float",
|
||||
* description="Score"
|
||||
* type="string",
|
||||
* enum={"Summer", "Winter", "Spring", "Fall"},
|
||||
* description="Season"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="year",
|
||||
* type="integer",
|
||||
* description="Year"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="broadcast",
|
||||
* ref="#/components/schemas/broadcast"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="related",
|
||||
* ref="#/components/schemas/relation"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="producers",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* ref="#/components/schemas/mal_url"
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="licensors",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* ref="#/components/schemas/mal_url"
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="studios",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* ref="#/components/schemas/mal_url"
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="genres",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* ref="#/components/schemas/mal_url"
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="themes",
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="openings",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="string",
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="endings",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="string",
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
|
||||
*
|
||||
* )
|
||||
*/
|
||||
|
||||
|
@ -6,6 +6,143 @@ use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class CharacterResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @OA\Schema(
|
||||
* schema="character",
|
||||
* description="Character 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="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="name",
|
||||
* type="string",
|
||||
* description="Name"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="nicknames",
|
||||
* type="array",
|
||||
* description="Other Names",
|
||||
* @OA\Items(
|
||||
* type="string"
|
||||
* )
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="favorites",
|
||||
* type="integer",
|
||||
* description="Number of users who have favorited this entry"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="about",
|
||||
* type="string",
|
||||
* description="Synopsis"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="animeography",
|
||||
* 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="role",
|
||||
* type="string",
|
||||
* ),
|
||||
* ),
|
||||
* },
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="mangaography",
|
||||
* 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="role",
|
||||
* type="string",
|
||||
* ),
|
||||
* ),
|
||||
* },
|
||||
* ),
|
||||
* ),
|
||||
* @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.
|
||||
*
|
||||
@ -20,8 +157,8 @@ class CharacterResource extends JsonResource
|
||||
'images' => $this->image,
|
||||
'name' => $this->name,
|
||||
'nicknames' => $this->nicknames,
|
||||
'favorites' => $this->favorites,
|
||||
'about' => $this->about,
|
||||
'member_favorites' => $this->member_favorites,
|
||||
'animeography' => $this->animeography,
|
||||
'mangaography' => $this->mangaography,
|
||||
'voice_actors' => $this->voice_actors,
|
||||
|
@ -94,6 +94,84 @@ class CommonResource extends JsonResource
|
||||
* description="Raw parsed string"
|
||||
* ),
|
||||
* ),
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="broadcast",
|
||||
* type="object",
|
||||
* description="Broadcast Details",
|
||||
*
|
||||
* @OA\Property(
|
||||
* property="day",
|
||||
* type="string",
|
||||
* description="Day of the week"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="time",
|
||||
* type="string",
|
||||
* description="Time in 24 hour format"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="timezone",
|
||||
* type="string",
|
||||
* description="Timezone (Tz Database format https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="string",
|
||||
* type="string",
|
||||
* description="Raw parsed broadcast string"
|
||||
* ),
|
||||
* ),
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="mal_url",
|
||||
* type="object",
|
||||
* description="Parsed URL Data",
|
||||
* @OA\Property(
|
||||
* property="mal_id",
|
||||
* type="integer",
|
||||
* description="MyAnimeList ID"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="type",
|
||||
* type="string",
|
||||
* description="Type of resource"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="name",
|
||||
* type="string",
|
||||
* description="Resource Name/Title"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="url",
|
||||
* type="string",
|
||||
* description="MyAnimeList URL"
|
||||
* ),
|
||||
* ),
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="relation",
|
||||
* type="array",
|
||||
* description="Related resources",
|
||||
*
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="relation",
|
||||
* type="string",
|
||||
* description="Relation type"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="items",
|
||||
* type="array",
|
||||
* description="Related items",
|
||||
*
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* ref="#/components/schemas/mal_url"
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
*/
|
||||
}
|
@ -6,6 +6,196 @@ use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class MangaResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @OA\Schema(
|
||||
* schema="manga",
|
||||
* description="Manga 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="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={"Manga", "Novel", "One-shot", "Doujinshi", "Manhua", "Manhwa", "OEL"},
|
||||
* description="Manga Type"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="chapters",
|
||||
* type="integer",
|
||||
* description="Chapter count"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="volumnes",
|
||||
* type="integer",
|
||||
* description="Volume count"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="status",
|
||||
* type="string",
|
||||
* enum={"Finished", "Publishing", "On Hiatus", "Discontinued", "Not yet published"},
|
||||
* description="Publishing status"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="publishing",
|
||||
* type="bool",
|
||||
* description="Publishing boolean"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="published",
|
||||
* ref="#/components/schemas/daterange"
|
||||
* ),
|
||||
* @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="broadcast",
|
||||
* ref="#/components/schemas/broadcast"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="related",
|
||||
* ref="#/components/schemas/relation"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="authors",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* ref="#/components/schemas/mal_url"
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="serializations",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* ref="#/components/schemas/mal_url"
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="genres",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* ref="#/components/schemas/mal_url"
|
||||
* ),
|
||||
* ),
|
||||
* )
|
||||
*/
|
||||
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
|
@ -6,6 +6,146 @@ use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PersonResource extends JsonResource
|
||||
{
|
||||
|
||||
/**
|
||||
* @OA\Schema(
|
||||
* schema="person",
|
||||
* description="Person Resource",
|
||||
*
|
||||
* @OA\Property(
|
||||
* property="mal_id",
|
||||
* type="integer",
|
||||
* description="MyAnimeList ID"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="url",
|
||||
* type="string",
|
||||
* description="MyAnimeList URL"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="website_url",
|
||||
* type="string",
|
||||
* description="Person's website 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 (225x350)",
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="webp",
|
||||
* type="object",
|
||||
* description="Available images in WEBP",
|
||||
* @OA\Property(
|
||||
* property="image_url",
|
||||
* type="string",
|
||||
* description="Image URL WEBP (225x350)",
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
*
|
||||
* @OA\Property(
|
||||
* property="name",
|
||||
* type="string",
|
||||
* description="Name"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="given_name",
|
||||
* type="string",
|
||||
* description="Given Name"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="family_name",
|
||||
* type="string",
|
||||
* description="Family Name"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="alternate_names",
|
||||
* type="array",
|
||||
* description="Other Names",
|
||||
* @OA\Items(
|
||||
* type="string"
|
||||
* )
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="birthday",
|
||||
* type="string",
|
||||
* description="Birthday Date ISO8601"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="favorites",
|
||||
* type="integer",
|
||||
* description="Number of users who have favorited this entry"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="about",
|
||||
* type="string",
|
||||
* description="Synopsis"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="voice_acting_roles",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="role",
|
||||
* type="string",
|
||||
* description="Role"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="anime",
|
||||
* ref="#/components/schemas/mal_url"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="character",
|
||||
* ref="#/components/schemas/mal_url"
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="anime_staff_positions",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="position",
|
||||
* type="string",
|
||||
* description="Position"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="anime",
|
||||
* ref="#/components/schemas/mal_url"
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="published_manga",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="position",
|
||||
* type="string",
|
||||
* description="Position"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="manga",
|
||||
* ref="#/components/schemas/mal_url"
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
* )
|
||||
*/
|
||||
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
@ -17,15 +157,15 @@ class PersonResource extends JsonResource
|
||||
return [
|
||||
'mal_id' => $this->mal_id,
|
||||
'url' => $this->url,
|
||||
'website_url' => 'website_url',
|
||||
'website_url' => $this->website_url,
|
||||
'images' => $this->image,
|
||||
'name' => $this->name,
|
||||
'given_name' => $this->given_name,
|
||||
'family_name' => $this->family_name,
|
||||
'alternate_names' => $this->alternate_names,
|
||||
'birthday' => $this->birthday,
|
||||
'favorites' => $this->favorites,
|
||||
'about' => $this->about,
|
||||
'member_favorites' => $this->member_favorites,
|
||||
'voice_acting_roles' => $this->voice_acting_roles,
|
||||
'anime_staff_positions' => $this->anime_staff_positions,
|
||||
'published_manga' => $this->published_manga,
|
||||
|
@ -29,7 +29,7 @@ class Person extends Model
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $appends = ['images'];
|
||||
protected $appends = ['images', 'favorites'];
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
@ -44,9 +44,14 @@ class Person extends Model
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'_id', 'images'
|
||||
'_id', 'images', 'member_favorites'
|
||||
];
|
||||
|
||||
public function getFavoritesAttribute()
|
||||
{
|
||||
return $this->attributes['member_favorites'];
|
||||
}
|
||||
|
||||
public function getImageAttribute()
|
||||
{
|
||||
$imageUrl = $this->attributes['image_url'];
|
||||
|
@ -29,6 +29,69 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/characters/{id}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"character"
|
||||
],
|
||||
"operationId": "getCharacterById",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Returns manga resource",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Error: Bad request. When required parameters were not supplied."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/manga/{id}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"manga"
|
||||
],
|
||||
"operationId": "getMangaById",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Returns manga resource",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Error: Bad request. When required parameters were not supplied."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/people/{id}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"person"
|
||||
],
|
||||
"operationId": "getPersonById",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Returns person resource",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Error: Bad request. When required parameters were not supplied."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
@ -143,6 +206,252 @@
|
||||
},
|
||||
"aired": {
|
||||
"$ref": "#/components/schemas/daterange"
|
||||
},
|
||||
"duration": {
|
||||
"description": "Parsed raw duration",
|
||||
"type": "string"
|
||||
},
|
||||
"rating": {
|
||||
"description": "Anime audience rating",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"G - All Ages",
|
||||
"PG - Children",
|
||||
"PG-13 - Teens 13 or older",
|
||||
"R - 17+ (violence & profanity)",
|
||||
"R+ - Mild Nudity",
|
||||
"Rx - Hentai"
|
||||
]
|
||||
},
|
||||
"score": {
|
||||
"description": "Score",
|
||||
"type": "float"
|
||||
},
|
||||
"scored_by": {
|
||||
"description": "Number of users",
|
||||
"type": "integer"
|
||||
},
|
||||
"rank": {
|
||||
"description": "Ranking",
|
||||
"type": "integer"
|
||||
},
|
||||
"popularity": {
|
||||
"description": "Popularity",
|
||||
"type": "integer"
|
||||
},
|
||||
"members": {
|
||||
"description": "Number of users who have added this entry to their list",
|
||||
"type": "integer"
|
||||
},
|
||||
"favorites": {
|
||||
"description": "Number of users who have favorited this entry",
|
||||
"type": "integer"
|
||||
},
|
||||
"synopsis": {
|
||||
"description": "Synopsis",
|
||||
"type": "string"
|
||||
},
|
||||
"background": {
|
||||
"description": "Background",
|
||||
"type": "string"
|
||||
},
|
||||
"season": {
|
||||
"description": "Season",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Summer",
|
||||
"Winter",
|
||||
"Spring",
|
||||
"Fall"
|
||||
]
|
||||
},
|
||||
"year": {
|
||||
"description": "Year",
|
||||
"type": "integer"
|
||||
},
|
||||
"broadcast": {
|
||||
"$ref": "#/components/schemas/broadcast"
|
||||
},
|
||||
"related": {
|
||||
"$ref": "#/components/schemas/relation"
|
||||
},
|
||||
"producers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
}
|
||||
},
|
||||
"licensors": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
}
|
||||
},
|
||||
"studios": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
}
|
||||
},
|
||||
"genres": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
}
|
||||
},
|
||||
"themes": {
|
||||
"properties": {
|
||||
"openings": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"endings": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"character": {
|
||||
"description": "Character 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"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"name": {
|
||||
"description": "Name",
|
||||
"type": "string"
|
||||
},
|
||||
"nicknames": {
|
||||
"description": "Other Names",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"favorites": {
|
||||
"description": "Number of users who have favorited this entry",
|
||||
"type": "integer"
|
||||
},
|
||||
"about": {
|
||||
"description": "Synopsis",
|
||||
"type": "string"
|
||||
},
|
||||
"animeography": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"image_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"role": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"mangaography": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"image_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"role": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"voice_actors": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"image_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"language": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
@ -224,6 +533,367 @@
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"broadcast": {
|
||||
"description": "Broadcast Details",
|
||||
"properties": {
|
||||
"day": {
|
||||
"description": "Day of the week",
|
||||
"type": "string"
|
||||
},
|
||||
"time": {
|
||||
"description": "Time in 24 hour format",
|
||||
"type": "string"
|
||||
},
|
||||
"timezone": {
|
||||
"description": "Timezone (Tz Database format https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)",
|
||||
"type": "string"
|
||||
},
|
||||
"string": {
|
||||
"description": "Raw parsed broadcast string",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"mal_url": {
|
||||
"description": "Parsed URL Data",
|
||||
"properties": {
|
||||
"mal_id": {
|
||||
"description": "MyAnimeList ID",
|
||||
"type": "integer"
|
||||
},
|
||||
"type": {
|
||||
"description": "Type of resource",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "Resource Name/Title",
|
||||
"type": "string"
|
||||
},
|
||||
"url": {
|
||||
"description": "MyAnimeList URL",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"relation": {
|
||||
"description": "Related resources",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"properties": {
|
||||
"relation": {
|
||||
"description": "Relation type",
|
||||
"type": "string"
|
||||
},
|
||||
"items": {
|
||||
"description": "Related items",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"manga": {
|
||||
"description": "Manga 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"
|
||||
},
|
||||
"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": "Manga Type",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Manga",
|
||||
"Novel",
|
||||
"One-shot",
|
||||
"Doujinshi",
|
||||
"Manhua",
|
||||
"Manhwa",
|
||||
"OEL"
|
||||
]
|
||||
},
|
||||
"chapters": {
|
||||
"description": "Chapter count",
|
||||
"type": "integer"
|
||||
},
|
||||
"volumnes": {
|
||||
"description": "Volume count",
|
||||
"type": "integer"
|
||||
},
|
||||
"status": {
|
||||
"description": "Publishing status",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Finished",
|
||||
"Publishing",
|
||||
"On Hiatus",
|
||||
"Discontinued",
|
||||
"Not yet published"
|
||||
]
|
||||
},
|
||||
"publishing": {
|
||||
"description": "Publishing boolean",
|
||||
"type": "bool"
|
||||
},
|
||||
"published": {
|
||||
"$ref": "#/components/schemas/daterange"
|
||||
},
|
||||
"score": {
|
||||
"description": "Score",
|
||||
"type": "float"
|
||||
},
|
||||
"scored_by": {
|
||||
"description": "Number of users",
|
||||
"type": "integer"
|
||||
},
|
||||
"rank": {
|
||||
"description": "Ranking",
|
||||
"type": "integer"
|
||||
},
|
||||
"popularity": {
|
||||
"description": "Popularity",
|
||||
"type": "integer"
|
||||
},
|
||||
"members": {
|
||||
"description": "Number of users who have added this entry to their list",
|
||||
"type": "integer"
|
||||
},
|
||||
"favorites": {
|
||||
"description": "Number of users who have favorited this entry",
|
||||
"type": "integer"
|
||||
},
|
||||
"synopsis": {
|
||||
"description": "Synopsis",
|
||||
"type": "string"
|
||||
},
|
||||
"background": {
|
||||
"description": "Background",
|
||||
"type": "string"
|
||||
},
|
||||
"broadcast": {
|
||||
"$ref": "#/components/schemas/broadcast"
|
||||
},
|
||||
"related": {
|
||||
"$ref": "#/components/schemas/relation"
|
||||
},
|
||||
"authors": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
}
|
||||
},
|
||||
"serializations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
}
|
||||
},
|
||||
"genres": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"person": {
|
||||
"description": "Person Resource",
|
||||
"properties": {
|
||||
"mal_id": {
|
||||
"description": "MyAnimeList ID",
|
||||
"type": "integer"
|
||||
},
|
||||
"url": {
|
||||
"description": "MyAnimeList URL",
|
||||
"type": "string"
|
||||
},
|
||||
"website_url": {
|
||||
"description": "Person's website URL",
|
||||
"type": "string"
|
||||
},
|
||||
"images": {
|
||||
"description": "Images",
|
||||
"properties": {
|
||||
"jpg": {
|
||||
"description": "Available images in JPG",
|
||||
"properties": {
|
||||
"image_url": {
|
||||
"description": "Image URL JPG (225x350)",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"webp": {
|
||||
"description": "Available images in WEBP",
|
||||
"properties": {
|
||||
"image_url": {
|
||||
"description": "Image URL WEBP (225x350)",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"name": {
|
||||
"description": "Name",
|
||||
"type": "string"
|
||||
},
|
||||
"given_name": {
|
||||
"description": "Given Name",
|
||||
"type": "string"
|
||||
},
|
||||
"family_name": {
|
||||
"description": "Family Name",
|
||||
"type": "string"
|
||||
},
|
||||
"alternate_names": {
|
||||
"description": "Other Names",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"birthday": {
|
||||
"description": "Birthday Date ISO8601",
|
||||
"type": "string"
|
||||
},
|
||||
"favorites": {
|
||||
"description": "Number of users who have favorited this entry",
|
||||
"type": "integer"
|
||||
},
|
||||
"about": {
|
||||
"description": "Synopsis",
|
||||
"type": "string"
|
||||
},
|
||||
"voice_acting_roles": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"properties": {
|
||||
"role": {
|
||||
"description": "Role",
|
||||
"type": "string"
|
||||
},
|
||||
"anime": {
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
},
|
||||
"character": {
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"anime_staff_positions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"properties": {
|
||||
"position": {
|
||||
"description": "Position",
|
||||
"type": "string"
|
||||
},
|
||||
"anime": {
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"published_manga": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"properties": {
|
||||
"position": {
|
||||
"description": "Position",
|
||||
"type": "string"
|
||||
},
|
||||
"manga": {
|
||||
"$ref": "#/components/schemas/mal_url"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user