mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-19 08:35:18 +00:00
Can get informations of a specific conversation
This commit is contained in:
@ -26,6 +26,37 @@ class conversationsController{
|
||||
return $conversationsList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get informationsd about one conversation
|
||||
*
|
||||
* @url POST /conversations/getInfosOne
|
||||
*/
|
||||
public function getOneConversationInformations(){
|
||||
user_login_required();
|
||||
|
||||
//First, check the parametres
|
||||
if(!isset($_POST['conversationID']))
|
||||
Rest_fatal_error(501, "No conversation ID specified with the request");
|
||||
|
||||
//Extract data
|
||||
$conversationID = toInt($_POST['conversationID']);
|
||||
|
||||
//Try to get informations about the conversation
|
||||
$conversationsList = CS::get()->components->conversations->getList(userID, $conversationID);
|
||||
|
||||
//Check for errors
|
||||
if($conversationsList === false)
|
||||
Rest_fatal_error(500, "An internal error occured");
|
||||
|
||||
//Check if a conversation was found
|
||||
if(count($conversationsList) < 1)
|
||||
Rest_fatal_error(401, "Users doesn't belong to the specified conversation,".
|
||||
"or the conversation doesn't exists !");
|
||||
|
||||
//Return conversation informations
|
||||
return $conversationsList[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new conversation
|
||||
*
|
||||
|
Reference in New Issue
Block a user