From e8663b4e335f26cc4b0d80bbed62c39a33746506 Mon Sep 17 00:00:00 2001 From: Awilum Date: Sat, 14 Aug 2021 14:02:10 +0300 Subject: [PATCH] feat(endpoints): add Media endpoints #565 --- src/flextype/routes/endpoints/media.php | 106 ++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 src/flextype/routes/endpoints/media.php diff --git a/src/flextype/routes/endpoints/media.php b/src/flextype/routes/endpoints/media.php new file mode 100644 index 00000000..3cda8278 --- /dev/null +++ b/src/flextype/routes/endpoints/media.php @@ -0,0 +1,106 @@ +get('/api/media', [Content::class, 'fetch']); + +/** + * Create media + * + * endpoint: POST /api/media + * + * Body: + * id - [REQUIRED] - Unique identifier of the media. + * token - [REQUIRED] - Valid public token. + * access_token - [REQUIRED] - Valid access token. + * data - [REQUIRED] - Data to store for the media. + * + * Returns: + * Returns the media object for the media that was just created. + */ +app()->post('/api/media', [Content::class, 'create']); + +/** + * Update media + * + * endpoint: PATCH /api/media + * + * Body: + * id - [REQUIRED] - Unique identifier of the media. + * token - [REQUIRED] - Valid public token. + * access_token - [REQUIRED] - Valid access token. + * data - [REQUIRED] - Data to update for the media. + * + * Returns: + * Returns the media object for the media that was just updated. + */ +app()->patch('/api/media', [Content::class, 'update']); + +/** + * Move media + * + * endpoint: PUT /api/media + * + * Body: + * id - [REQUIRED] - Unique identifier of the media. + * new_id - [REQUIRED] - New Unique identifier of the media. + * token - [REQUIRED] - Valid public token. + * access_token - [REQUIRED] - Valid access token. + * + * Returns: + * Returns the media object for the media that was just moved. + */ +app()->put('/api/media', [Content::class, 'move']); + +/** + * Copy media + * + * endpoint: PUT /api/media/copy + * + * Body: + * id - [REQUIRED] - Unique identifier of the media. + * new_id - [REQUIRED] - New Unique identifier of the media. + * token - [REQUIRED] - Valid public token. + * access_token - [REQUIRED] - Valid access token. + * + * Returns: + * Returns the media object for the media that was just copied. + */ +app()->put('/api/media/copy', [Content::class, 'copy']); + +/** + * Delete media + * + * endpoint: DELETE /api/media + * + * Body: + * id - [REQUIRED] - Unique identifier of the media. + * token - [REQUIRED] - Valid pulbic token. + * access_token - [REQUIRED] - Valid access token. + * + * Returns: + * Returns an empty body with HTTP status 204 + */ +app()->delete('/api/media', [Content::class, 'delete']);