stylehub/endpoints/meme.php

18 lines
691 B
PHP
Raw Normal View History

2024-04-25 09:04:10 +02:00
<?php
2024-04-27 11:48:58 +02:00
declare(strict_types=1);
2024-04-25 09:04:10 +02:00
require_once "lib/meme.php";
function endpoint($endpoint_data): array
{
return match ($endpoint_data["action"]) {
2024-04-25 22:08:02 +02:00
"addMeme" => addMeme($endpoint_data['meme_title'], $endpoint_data['meme_text'], $endpoint_data['meme_image_id']),
2024-04-25 09:40:21 +02:00
"renderGallery" => renderMemeGallery(),
2024-04-26 01:17:49 +02:00
"deleteMeme" => deleteMeme($endpoint_data['meme_id']),
2024-04-27 10:30:01 +02:00
"getMemeVotes" => getMemeVotes($endpoint_data['meme_id']),
2024-04-27 11:23:42 +02:00
"deleteVoteMeme" => deleteVoteMeme($endpoint_data['meme_id']),
2024-04-27 10:30:01 +02:00
"voteMeme" => voteMeme($endpoint_data['meme_id'], $endpoint_data['is_upvote']),
default => ["Status" => "Fail", "Message" => "Invalid action"],
2024-04-25 09:04:10 +02:00
};
}