1 | <?php declare(strict_types=1); |
||
29 | class Anime extends API { |
||
30 | |||
31 | // Display constants |
||
32 | const WATCHING = 'Watching'; |
||
33 | const PLAN_TO_WATCH = 'Plan to Watch'; |
||
34 | const DROPPED = 'Dropped'; |
||
35 | const ON_HOLD = 'On Hold'; |
||
36 | const COMPLETED = 'Completed'; |
||
37 | |||
38 | /** |
||
39 | * Map of API status constants to display constants |
||
40 | * @var array |
||
41 | */ |
||
42 | protected $const_map = [ |
||
43 | AnimeWatchingStatus::WATCHING => self::WATCHING, |
||
44 | AnimeWatchingStatus::PLAN_TO_WATCH => self::PLAN_TO_WATCH, |
||
45 | AnimeWatchingStatus::ON_HOLD => self::ON_HOLD, |
||
46 | AnimeWatchingStatus::DROPPED => self::DROPPED, |
||
47 | AnimeWatchingStatus::COMPLETED => self::COMPLETED, |
||
48 | ]; |
||
49 | |||
50 | protected $kitsuModel; |
||
51 | |||
52 | protected $malModel; |
||
53 | |||
54 | protected $useMALAPI; |
||
55 | |||
56 | /** |
||
57 | * Anime constructor. |
||
58 | * @param ContainerInterface $container |
||
59 | */ |
||
60 | public function __construct(ContainerInterface $container) { |
||
69 | |||
70 | /** |
||
71 | * Get a category out of the full list |
||
72 | * |
||
73 | * @param string $status |
||
74 | * @return array |
||
75 | */ |
||
76 | public function getList($status) |
||
86 | |||
87 | /** |
||
88 | * Get information about an anime from its slug |
||
89 | * |
||
90 | * @param string $slug |
||
91 | * @return array |
||
92 | */ |
||
93 | public function getAnime($slug) |
||
97 | |||
98 | /** |
||
99 | * Get anime by its kitsu id |
||
100 | * |
||
101 | * @param string $animeId |
||
102 | * @return array |
||
103 | */ |
||
104 | public function getAnimeById($animeId) |
||
108 | |||
109 | /** |
||
110 | * Search for anime by name |
||
111 | * |
||
112 | * @param string $name |
||
113 | * @return array |
||
114 | */ |
||
115 | public function search($name) |
||
119 | |||
120 | /** |
||
121 | * Get information about a specific list item |
||
122 | * for editing/updating that item |
||
123 | * |
||
124 | * @param string $itemId |
||
125 | * @return array |
||
126 | */ |
||
127 | public function getLibraryItem(string $itemId): array |
||
131 | |||
132 | /** |
||
133 | * Add an anime to your list |
||
134 | * |
||
135 | * @param array $data |
||
136 | * @return bool |
||
137 | */ |
||
138 | public function createLibraryItem(array $data): bool |
||
162 | |||
163 | /** |
||
164 | * Update a list entry |
||
165 | * |
||
166 | * @param array $data |
||
167 | * @return array |
||
168 | */ |
||
169 | public function updateLibraryItem(array $data): array |
||
189 | |||
190 | /** |
||
191 | * Delete a list entry |
||
192 | * |
||
193 | * @param string $id |
||
194 | * @param string|null $malId |
||
195 | * @return bool |
||
196 | */ |
||
197 | public function deleteLibraryItem(string $id, string $malId = null): bool |
||
212 | } |
||
213 | // End of AnimeModel.php |