mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
no message
This commit is contained in:
1 parent
356dd12566
commit
1f621a6bb4
4 files changed
+85
-8
No files matched your search
@@ -27,32 +27,56 @@ class Api
|
||||
self::$endpoint = Config::get('services.karat.endpoint');
|
||||
}
|
||||
|
||||
private static function doRequest($command)
|
||||
private static function doRequest($body)
|
||||
{
|
||||
$response = Http::timeout(60)
|
||||
->withOptions([
|
||||
'debug' => true,
|
||||
'verify' => false,
|
||||
])->withBasicAuth(self::$username, self::$password)
|
||||
->post(self::$endpoint, [
|
||||
'command' => $command,
|
||||
]);
|
||||
->post(self::$endpoint, $body);
|
||||
|
||||
return $response->json();
|
||||
}
|
||||
|
||||
public static function getUsers()
|
||||
{
|
||||
return self::doRequest('TM_GET_USERS')['users'];
|
||||
$body = [
|
||||
'command' => 'TM_GET_USERS',
|
||||
];
|
||||
|
||||
return self::doRequest($body)['users'];
|
||||
}
|
||||
|
||||
public static function getClients()
|
||||
{
|
||||
return self::doRequest('TM_GET_CLIENTS')['clients'];
|
||||
$body = [
|
||||
'command' => 'TM_GET_CLIENTS',
|
||||
];
|
||||
|
||||
return self::doRequest($body)['clients'];
|
||||
}
|
||||
|
||||
public static function getProjects()
|
||||
{
|
||||
return self::doRequest('TM_GET_PROJECTS')['projects'];
|
||||
$body = [
|
||||
'command' => 'TM_GET_PROJECTS',
|
||||
];
|
||||
|
||||
return self::doRequest($body)['projects'];
|
||||
}
|
||||
|
||||
public static function setTimesheet($timesheet)
|
||||
{
|
||||
$body = [
|
||||
'command' => 'TM_SET_vykaz',
|
||||
'zakazka' => $timesheet->subtask->project->code,
|
||||
'zdroj' => $timesheet->user->code,
|
||||
'hodin' => $timesheet->time,
|
||||
'datum' => $timesheet->created_at->format('Y-m-d'),
|
||||
'task_mng' => $timesheet->id,
|
||||
];
|
||||
|
||||
return self::doRequest($body);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user