2016-12-20 12:55:43 -05:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
/**
|
2017-02-15 16:13:32 -05:00
|
|
|
* Hummingbird Anime List Client
|
2016-12-20 12:55:43 -05:00
|
|
|
*
|
2018-08-22 13:48:27 -04:00
|
|
|
* An API client for Kitsu to manage anime and manga watch lists
|
2016-12-20 12:55:43 -05:00
|
|
|
*
|
2021-02-04 11:57:01 -05:00
|
|
|
* PHP version 8
|
2016-12-20 12:55:43 -05:00
|
|
|
*
|
2017-02-15 16:13:32 -05:00
|
|
|
* @package HummingbirdAnimeClient
|
2016-12-20 12:55:43 -05:00
|
|
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
2021-01-13 01:52:03 -05:00
|
|
|
* @copyright 2015 - 2021 Timothy J. Warren
|
2016-12-20 12:55:43 -05:00
|
|
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
2020-12-10 17:06:50 -05:00
|
|
|
* @version 5.2
|
2017-03-07 20:53:58 -05:00
|
|
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
2017-01-11 10:34:24 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Aviat\AnimeClient\API;
|
2016-12-20 12:55:43 -05:00
|
|
|
|
2020-03-11 16:26:17 -04:00
|
|
|
use Amp\Http\Client\Request;
|
2018-08-09 11:34:02 -04:00
|
|
|
use Aviat\AnimeClient\Types\FormItemData;
|
2017-01-06 21:39:01 -05:00
|
|
|
|
2016-12-20 12:55:43 -05:00
|
|
|
/**
|
|
|
|
* Common interface for anime and manga list item CRUD
|
|
|
|
*/
|
2020-01-15 12:35:37 -05:00
|
|
|
abstract class AbstractListItem {
|
2017-01-06 21:39:01 -05:00
|
|
|
|
2016-12-20 12:55:43 -05:00
|
|
|
/**
|
|
|
|
* Create a list item
|
|
|
|
*
|
2017-01-06 21:39:01 -05:00
|
|
|
* @param array $data -
|
2018-01-16 14:58:07 -05:00
|
|
|
* @return Request
|
2016-12-20 12:55:43 -05:00
|
|
|
*/
|
2020-01-15 12:35:37 -05:00
|
|
|
abstract public function create(array $data): Request;
|
2017-01-06 21:39:01 -05:00
|
|
|
|
2020-08-06 09:39:12 -04:00
|
|
|
/**
|
|
|
|
* Create a full list item for syncing
|
|
|
|
*
|
|
|
|
* @param array $data
|
|
|
|
* @return Request
|
|
|
|
*/
|
|
|
|
abstract public function createFull(array $data): Request;
|
|
|
|
|
2016-12-20 12:55:43 -05:00
|
|
|
/**
|
|
|
|
* Retrieve a list item
|
|
|
|
*
|
|
|
|
* @param string $id - The id of the list item
|
2017-01-06 21:39:01 -05:00
|
|
|
* @return array
|
2016-12-20 12:55:43 -05:00
|
|
|
*/
|
2020-01-15 12:35:37 -05:00
|
|
|
abstract public function get(string $id): array;
|
2017-01-06 21:39:01 -05:00
|
|
|
|
2018-09-20 10:41:28 -04:00
|
|
|
/**
|
|
|
|
* Increase progress on a list item
|
|
|
|
*
|
|
|
|
* @param string $id
|
|
|
|
* @param FormItemData $data
|
|
|
|
* @return Request
|
|
|
|
*/
|
2020-01-15 12:35:37 -05:00
|
|
|
abstract public function increment(string $id, FormItemData $data): Request;
|
2018-09-20 10:41:28 -04:00
|
|
|
|
2016-12-20 12:55:43 -05:00
|
|
|
/**
|
|
|
|
* Update a list item
|
2017-01-06 21:39:01 -05:00
|
|
|
*
|
2016-12-21 12:46:20 -05:00
|
|
|
* @param string $id - The id of the list item to update
|
2018-08-09 11:34:02 -04:00
|
|
|
* @param FormItemData $data - The data with which to update the list item
|
2018-01-16 14:58:07 -05:00
|
|
|
* @return Request
|
2016-12-20 12:55:43 -05:00
|
|
|
*/
|
2020-01-15 12:35:37 -05:00
|
|
|
abstract public function update(string $id, FormItemData $data): Request;
|
2017-01-06 21:39:01 -05:00
|
|
|
|
2016-12-20 12:55:43 -05:00
|
|
|
/**
|
|
|
|
* Delete a list item
|
|
|
|
*
|
|
|
|
* @param string $id - The id of the list item to delete
|
2022-01-07 12:33:01 -05:00
|
|
|
* @return Request|null
|
2016-12-20 12:55:43 -05:00
|
|
|
*/
|
2020-01-15 12:35:37 -05:00
|
|
|
abstract public function delete(string $id):?Request;
|
2016-12-20 12:55:43 -05:00
|
|
|
}
|