-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from spinen/feature/builderForScheduledTasks
builder for scheduled tasks
- Loading branch information
Showing
10 changed files
with
307 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace Spinen\Ncentral; | ||
|
||
use Spinen\Ncentral\Support\Model; | ||
|
||
/** | ||
* Class DetailedScheduledTask | ||
* | ||
* @property int $deviceId | ||
* @property int $taskId | ||
* @property string $deviceName | ||
* @property string $message | ||
* @property string $output | ||
* @property string $outputFileName | ||
* @property string $status | ||
* @property string $taskName | ||
*/ | ||
class DetailedScheduledTask extends Model | ||
{ | ||
/** | ||
* The attributes that should be cast to native types. | ||
* | ||
* @var array | ||
*/ | ||
protected $casts = [ | ||
'deviceId' => 'int', | ||
'taskId' => 'int', | ||
]; | ||
|
||
/** | ||
* Path to API endpoint. | ||
*/ | ||
protected string $extra = '/status/details'; | ||
|
||
/** | ||
* Path to API endpoint. | ||
*/ | ||
protected string $path = '/scheduled-tasks'; | ||
|
||
/** | ||
* The primary key for the model. | ||
*/ | ||
protected string $primaryKey = 'taskId'; | ||
|
||
/** | ||
* Is the model readonly? | ||
*/ | ||
protected bool $readonlyModel = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Spinen\Ncentral\Exceptions; | ||
|
||
use RuntimeException; | ||
use Throwable; | ||
|
||
class ApiException extends RuntimeException | ||
{ | ||
protected string $body; | ||
|
||
protected int $status; | ||
|
||
public function __construct( | ||
string $message, | ||
int $code, | ||
?Throwable $previous = null, | ||
?string $body = null, | ||
) { | ||
parent::__construct(message: $message, code: $code, previous: $previous); | ||
|
||
$this->body = $body; | ||
} | ||
|
||
public function getBody(): string | ||
{ | ||
return $this->body; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.