Can get informations of a specific conversation

This commit is contained in:
Pierre
2017-06-16 19:08:58 +02:00
parent 93d5ec8044
commit b1e340e0c1
3 changed files with 108 additions and 26 deletions

View File

@ -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
*