1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-07 07:56:23 +00:00

Add a test API to push messages to current user context

This permits to test easily some usecases.
It should be disabled at release.
This commit is contained in:
Loïc Blot 2018-12-10 16:23:03 +01:00
parent f8e3b4bfe1
commit fdcb6b4f14
2 changed files with 22 additions and 1 deletions

View File

@ -43,7 +43,7 @@ $application->registerRoutes($this, array('routes' => array(
array('name' => 'api#fetch_messages_count', 'url' => '/api/v2/messages/count', 'verb' => 'GET'), // Android APIv2
// Android API v3
// @TODO
array('name' => 'api#generate_sms_test_data', 'url' => '/api/v3/test/generate_sms_data', 'verb' => 'POST'), // Android APIv3
// Android API v4
// @TODO future calls to sending calls recorded on the phone

View File

@ -229,4 +229,25 @@ class ApiController extends Controller {
// @TODO
return new JSONResponse(array("messages" => array()));
}
/**
* @NoAdminRequired
* @NoCSRFRequired
*
* @param $smsCount
* @param $smsDatas
* @return JSONResponse
*
* produce a bunch of data to test application
*/
public function generateSmsTestData () {
return $this->push(2, array(
array("_id" => 702, "type" => 1, "mbox" => 0, "read" => "true",
"seen" => "true", "date" => 1654777777, "address" => "+33123456789",
"body" => "hello dude"),
array("_id" => 685, "type" => 1, "mbox" => 1, "read" => "true",
"seen" => "true", "date" => 1654777777, "address" => "+33123456789",
"body" => "😀🌍⭐🌎🌔🌒🐕🍖🥂🍻🎮🤸‍♂️🚇🈲❕📘📚📈🇸🇨🇮🇲"),
));
}
}