ApiIndex - Zachu/GizmoAPI GitHub Wiki
- Gizmo
- GuzzleClientAdapter
- GuzzleResponseAdapter
-
Host
- __construct
- __toString
- delete
- exists
- getInvalid
- getRules
- getValidator
- isSaved
- isValid
- load
- mergeRules
- save
- setRules
- validate
- fill
- getAttribute
- getAttributes
- setAttribute
- toArray
- getPrimaryKey
- getPrimaryKeyValue
- createProcess
- getLastUserLoginTime
- getLastUserLogoutTime
- getProcess
- getProcesses
- getProcessesByName
- isFree
- isTurnedOn
- setLockState
- setOrderState
- setSecurityState
- terminateProcess
- uiNotify
- userLogout
- HostRepository
- IlluminateContainerAdapter
- InternalException
- InvalidArgumentException
- News
- NewsRepository
- NotImplementedException
- RequirementException
- ServiceRepository
- SessionRepository
- UnexpectedResponseException
-
User
- __construct
- __toString
- delete
- exists
- getInvalid
- getRules
- getValidator
- isSaved
- isValid
- load
- mergeRules
- save
- setRules
- validate
- fill
- getAttribute
- getAttributes
- setAttribute
- toArray
- getPrimaryKey
- getPrimaryKeyValue
- getLoggedInHostId
- isLoggedIn
- lastLoginTime
- lastLogoutTime
- login
- logout
- rename
- resetPassword
- setEmail
- setPassword
- setUserGroup
- UserRepository
- ValidationException
Gizmo Application Management Platforms API wrapper for PHP
- Full name: \Pisa\GizmoAPI\Gizmo
Construct a GizmoAPI object
Gizmo::__construct( array $config = array(), \Pisa\GizmoAPI\Contracts\Container|null $ioc = null )Parameters:
| Parameter | Type | Description |
|---|---|---|
$config |
array | |
$ioc |
\Pisa\GizmoAPI\Contracts\Container|null | If no container is given, one is created automatically. |
Get a repository
Gizmo::__get( string $name ): \Pisa\GizmoAPI\Repositories\BaseRepositoryInterface|\Pisa\GizmoAPI\Repositories\ServiceRepositoryInterfaceParameters:
| Parameter | Type | Description |
|---|---|---|
$name |
string | Name of the repository |
Gets a single config value
Gizmo::getConfig( string $name = null ): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$name |
string |
Gets a repository. Initializes one if it's not yet initialized
Gizmo::getRepository( string $name ): \Pisa\GizmoAPI\Repositories\BaseRepositoryInterface|\Pisa\GizmoAPI\Repositories\ServiceRepositoryInterfaceParameters:
| Parameter | Type | Description |
|---|---|---|
$name |
string | Name of the repository |
Checks if such repository should exist
Gizmo::hasRepository( string $name ): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
$name |
string | Name of the repository |
Sets a config parameter
Gizmo::setConfig( string $name, mixed $value = null )Parameters:
| Parameter | Type | Description |
|---|---|---|
$name |
string | |
$value |
mixed |
- Full name: \Pisa\GizmoAPI\Adapters\GuzzleClientAdapter
- This class implements: \Pisa\GizmoAPI\Contracts\HttpClient
Create a new response
GuzzleClientAdapter::__construct( \GuzzleHttp\ClientInterface $client, \Pisa\GizmoAPI\Adapters\Loggerinterface $logger )Parameters:
| Parameter | Type | Description |
|---|---|---|
$client |
\GuzzleHttp\ClientInterface | Guzzle HTTP client |
$logger |
\Pisa\GizmoAPI\Adapters\Loggerinterface | PSR-3 Logger Interface |
Perform a HTTP DELETE request
GuzzleClientAdapter::delete( string $url, array $parameters = array(), array $options = array() ): \Pisa\GizmoAPI\Contracts\HttpResponseParameters:
| Parameter | Type | Description |
|---|---|---|
$url |
string | URL to send the request |
$parameters |
array | Key/Value pairs to form the query string |
$options |
array | Options for the underlying HTTP Client |
Return Value:
Http response
Perform a HTTP GET request
GuzzleClientAdapter::get( string $url, array $parameters = array(), array $options = array() ): \Pisa\GizmoAPI\Contracts\HttpResponseParameters:
| Parameter | Type | Description |
|---|---|---|
$url |
string | URL to send the request |
$parameters |
array | Key/Value pairs to form the query string |
$options |
array | Options for the underlying HTTP Client |
Return Value:
Http response
Perform a HTTP POST request
GuzzleClientAdapter::post( string $url, array $parameters = array(), array $options = array() ): \Pisa\GizmoAPI\Contracts\HttpResponseParameters:
| Parameter | Type | Description |
|---|---|---|
$url |
string | URL to send the request |
$parameters |
array | Key/Value pairs to form the query string |
$options |
array | Options for the underlying HTTP Client |
Return Value:
Http response
Perform a HTTP PUT request
GuzzleClientAdapter::put( string $url, array $parameters = array(), array $options = array() ): \Pisa\GizmoAPI\Contracts\HttpResponseParameters:
| Parameter | Type | Description |
|---|---|---|
$url |
string | URL to send the request |
$parameters |
array | Key/Value pairs to form the query string |
$options |
array | Options for the underlying HTTP Client |
Return Value:
Http response
Perform the HTTP request
GuzzleClientAdapter::request( string $method, string $url, array $parameters = array(), array $options = array() ): \Pisa\GizmoAPI\Adapters\GuzzleResponseAdapterParameters:
| Parameter | Type | Description |
|---|---|---|
$method |
string | HTTP method/verb |
$url |
string | URL to send the request |
$parameters |
array | Key/Value pairs to form the query string |
$options |
array | Options to pass straight to GuzzleClient |
- Full name: \Pisa\GizmoAPI\Adapters\GuzzleResponseAdapter
- This class implements: \Pisa\GizmoAPI\Contracts\HttpResponse
Create a new Http Response
GuzzleResponseAdapter::__construct( \GuzzleHttp\Psr7\Response $response )Parameters:
| Parameter | Type | Description |
|---|---|---|
$response |
\GuzzleHttp\Psr7\Response | The real underlying Guzzle Response |
Check that http response body was an array.
GuzzleResponseAdapter::assertArray( ): voidCheck that http response body was a boolean.
GuzzleResponseAdapter::assertBoolean( ): voidCheck that http response body was empty.
GuzzleResponseAdapter::assertEmpty( ): voidCheck that http response body was an integer.
GuzzleResponseAdapter::assertInteger( ): voidCheck that http response status codes match the codes we are expecting for.
GuzzleResponseAdapter::assertStatusCodes( integer|array $statusCodes = array() ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$statusCodes |
integer|array | Array of status codes to be expected. Can be a single status code too. |
Check that http response body was string.
GuzzleResponseAdapter::assertString( ): voidCheck that http response body is a time
GuzzleResponseAdapter::assertTime( ): voidGets the response body
GuzzleResponseAdapter::getBody( boolean $autodetect = true ): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$autodetect |
boolean | Autodetect the content type and give the response accordingly. Defaults to true |
Return Value:
Response body. If autodetect is false it returns the response string.
Get single response header
GuzzleResponseAdapter::getHeader( $header ): stringParameters:
| Parameter | Type | Description |
|---|---|---|
$header |
**** | Header key |
Get the response headers
GuzzleResponseAdapter::getHeaders( ): arrayGet the body json and decode it
GuzzleResponseAdapter::getJson( ): mixedReturn Value:
Response
Get the reason phrase for the according status code
GuzzleResponseAdapter::getReasonPhrase( ): stringGet the http status code
GuzzleResponseAdapter::getStatusCode( ): integerGet the body as a string
GuzzleResponseAdapter::getString( ): stringGet the content type
GuzzleResponseAdapter::getType( ): string- Full name: \Pisa\GizmoAPI\Models\Host
- Parent class: \Pisa\GizmoAPI\Models\BaseModel
- This class implements: \Pisa\GizmoAPI\Models\HostInterface
Make a new model instance
Host::__construct( \Pisa\GizmoAPI\Contracts\HttpClient $client, \Illuminate\Contracts\Validation\Factory $validatorFactory, \Psr\Log\LoggerInterface $logger, array $attributes = array() )Parameters:
| Parameter | Type | Description |
|---|---|---|
$client |
\Pisa\GizmoAPI\Contracts\HttpClient | HTTP client |
$validatorFactory |
\Illuminate\Contracts\Validation\Factory | |
$logger |
\Psr\Log\LoggerInterface | |
$attributes |
array | Attributes to initialize |
Cast the model to string
Host::__toString( ): stringThis method cannot be used. Host is deleted via the server service
Host::delete( ): voidCheck if model exists (has a primary key)
Host::exists( ): booleanReturn attributes that doesn't pass the validator
Host::getInvalid( ): arrayReturns the current validation rules
Host::getRules( ): arrayReturn Value:
of \Illuminate\Validation\Factory rules
Return the validator instance
Host::getValidator( ): \Illuminate\Contracts\Validation\ValidatorCheck if model has saved all the changes
Host::isSaved( ): booleanCheck that the model passes validation rules
Host::isValid( ): booleanLoad model attributes and mark them as saved.
Host::load( array $attributes ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$attributes |
array | Attributes to be loaded |
Merge new rules to the current validation rules
Host::mergeRules( array $rules ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$rules |
array | \Illuminate\Validation\Factory rules |
Create or update the model
Host::save( ): \Pisa\GizmoAPI\Models\BaseModelReturn Value:
Return $this for chaining
Set the validation rules
Host::setRules( array $rules ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$rules |
array | \Illuminate\Validation\Factory rules |
Runs validations for the model
Host::validate( ): booleanReturn Value:
Return true if something fails, false otherwise
Set all attributes. Use AttributeMutators if presented.
Host::fill( array $attributes ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$attributes |
array |
Get a single attribute
Host::getAttribute( string $key ): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$key |
string |
Return Value:
Attribute value
Get all attributes
Host::getAttributes( ): arraySet a single attribute. Use mutator if presented
Host::setAttribute( string $key, mixed $value )Parameters:
| Parameter | Type | Description |
|---|---|---|
$key |
string | |
$value |
mixed |
Alias for getAttributes
Host::toArray( )Gets the primary key
Host::getPrimaryKey( ): stringGets the value of the primary key
Host::getPrimaryKeyValue( ): mixedCreate a new process
Host::createProcess( array $startInfo ): integerExample:
$this->createProcess(['FileName' => 'C:\Start.bat']);
f
Parameters:
| Parameter | Type | Description |
|---|---|---|
$startInfo |
array | Information about starting the process |
Return Value:
Returns the process id.
Get the time of last user login
Host::getLastUserLoginTime( ): integerReturn Value:
Unix timestamp
Get the time of last user logout
Host::getLastUserLogoutTime( ): integerReturn Value:
Unix timestamp
Get a single process by its id
Host::getProcess( integer $processId ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$processId |
integer |
Return Value:
Array representation of the process
Get all processes running on the host
Host::getProcesses( array $criteria = array(), boolean $caseSensitive = false, integer $limit = 30, integer $skip, string $orderBy = null ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | Array of criteria to limit processes by. Defaults to array() |
$caseSensitive |
boolean | Search for case sensitive parameters. Defaults to false. |
$limit |
integer | Limit the number of fetched instances. Defaults to 30. |
$skip |
integer | Skip number of instances (i.e. fetch the next page). Defaults to 0. |
$orderBy |
string | Column to order the results with. |
Return Value:
processess
Get all processes running on the host filtered by process name
Host::getProcessesByName( string $processName ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$processName |
string |
Return Value:
processes
Checks if the host is free
Host::isFree( ): booleanShorthand for HasValidDispatcher attribute
Host::isTurnedOn( ): booleanSet the host to locked state
Host::setLockState( boolean $isLocked ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$isLocked |
boolean | true to lock, false to unlock |
Set the host order state
Host::setOrderState( boolean $isInOrder ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$isInOrder |
boolean | true to set the host in order, false to set out of order |
Set the host security state
Host::setSecurityState( boolean $isEnabled ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$isEnabled |
boolean | true to enable security profiles, false to disable |
Terminate processes
Host::terminateProcess( array $killInfo ): trueParameters:
| Parameter | Type | Description |
|---|---|---|
$killInfo |
array | Information about killing the processes |
Return Value:
on success
Send a message dialog to host
Host::uiNotify( string $message, array $parameters = array() ): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
$message |
string | Message to be sent |
$parameters |
array | Message parameters |
Return Value:
If ShowDialog is set to true, returns true if user clicks ok, false if user clicks cancel.
See Also:
- \Pisa\GizmoAPI\Models$this->defaultParameters - for parameters to modify
Logs user out from the host
Host::userLogout( ): trueReturn Value:
on success
- Full name: \Pisa\GizmoAPI\Repositories\HostRepository
- Parent class: \Pisa\GizmoAPI\Repositories\BaseRepository
- This class implements: \Pisa\GizmoAPI\Repositories\HostRepositoryInterface
HostRepository::__construct( \Pisa\GizmoAPI\Contracts\Container $ioc, \Pisa\GizmoAPI\Contracts\HttpClient $client )Parameters:
| Parameter | Type | Description |
|---|---|---|
$ioc |
\Pisa\GizmoAPI\Contracts\Container | Implementation of the ioc container |
$client |
\Pisa\GizmoAPI\Contracts\HttpClient | Implemention of http client |
Get all model instances from repository
HostRepository::all( integer $limit = 30, integer $skip, string $orderBy = null ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$limit |
integer | Limit the number of fetched instances. Defaults to 30. |
$skip |
integer | Skip number of instances (i.e. fetch the next page). Defaults to 0. |
$orderBy |
string | Column to order the results with. |
Return Value:
Returns array of model instances.
HostRepository::criteriaToFilter( array $criteria, $caseSensitive = false )- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | |
$caseSensitive |
**** |
Finds model instances by parameters
HostRepository::findBy( array $criteria, boolean $caseSensitive = false, integer $limit = 30, integer $skip, string $orderBy = null ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | Array of criteria to search for. |
$caseSensitive |
boolean | Search for case sensitive parameters. Defaults to false. |
$limit |
integer | Limit the number of fetched instances. Defaults to 30. |
$skip |
integer | Skip number of instances (i.e. fetch the next page). Defaults to 0. |
$orderBy |
string | Column to order the results with. |
Return Value:
Returns array of model instances.
Find one model entry by parameters
HostRepository::findOneBy( array $criteria, boolean $caseSensitive = false ): \Pisa\GizmoAPI\Repositories\Model|nullParameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | Array of criteria to search for |
$caseSensitive |
boolean | Search for case sensitive parameters. Defaults to false |
Return Value:
Returns the first model entry found on current criteria. Returns null if none is found.
Get model by id
HostRepository::get( integer $id ): \Pisa\GizmoAPI\Repositories\Model|nullParameters:
| Parameter | Type | Description |
|---|---|---|
$id |
integer | Id of the model entry. |
Return Value:
Returns model. If no model is found, returns null.
Check if model entry exists.
HostRepository::has( integer $id ): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
$id |
integer | Id of the model entry. |
Make a new model
HostRepository::make( array $attributes ): \Pisa\GizmoAPI\Repositories\ModelParameters:
| Parameter | Type | Description |
|---|---|---|
$attributes |
array | Attributes for the model to be made |
Return Value:
Returns model.
Gets hosts by number
HostRepository::getByNumber( integer $hostNumber ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$hostNumber |
integer | Number of the hosts to be searched for |
Return Value:
Array of hosts that match the number
Illuminate Container Adapter
- Full name: \Pisa\GizmoAPI\Adapters\IlluminateContainerAdapter
- This class implements: \Pisa\GizmoAPI\Contracts\Container
Create a container
IlluminateContainerAdapter::__construct( \Illuminate\Contracts\Container\Container|null $container = null )Parameters:
| Parameter | Type | Description |
|---|---|---|
$container |
\Illuminate\Contracts\Container\Container|null | If no container is given, one is created automatically |
Register a binding with the container
IlluminateContainerAdapter::bind( string|array $abstract, callable|null $concrete = null, boolean $shared = false ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$abstract |
string|array | If given an array, expect it to be an alias |
$concrete |
callable|null | If given null, try to resolve $abstract |
$shared |
boolean | If the created instance should be shared |
Resolve a binding.
IlluminateContainerAdapter::make( string $abstract, array $parameters = array() ): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$abstract |
string | String to resolve |
$parameters |
array | Parameters to create the new object with |
Register a shared binding with the container
IlluminateContainerAdapter::singleton( string|array $abstract, callable|null $concrete = null ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$abstract |
string|array | If given an array, expect it to be an alias |
$concrete |
callable|null | If given null, try to resolve $abstract |
Exception when there is something wrong with the library code
- Full name: \Pisa\GizmoAPI\Exceptions\InternalException
- Parent class:
- This class implements: \Pisa\GizmoAPI\Exceptions\GizmoAPIException
Exception when a function or a method is given invalid arguments
- Full name: \Pisa\GizmoAPI\Exceptions\InvalidArgumentException
- Parent class:
- This class implements: \Pisa\GizmoAPI\Exceptions\GizmoAPIException
- Full name: \Pisa\GizmoAPI\Models\News
- Parent class: \Pisa\GizmoAPI\Models\BaseModel
- This class implements: \Pisa\GizmoAPI\Models\NewsInterface
Make a new model instance
News::__construct( \Pisa\GizmoAPI\Contracts\HttpClient $client, \Illuminate\Contracts\Validation\Factory $validatorFactory, \Psr\Log\LoggerInterface $logger, array $attributes = array() )Parameters:
| Parameter | Type | Description |
|---|---|---|
$client |
\Pisa\GizmoAPI\Contracts\HttpClient | HTTP client |
$validatorFactory |
\Illuminate\Contracts\Validation\Factory | |
$logger |
\Psr\Log\LoggerInterface | |
$attributes |
array | Attributes to initialize |
Cast the model to string
News::__toString( ): stringDelete the model
News::delete( ): \Pisa\GizmoAPI\Models\BaseModelReturn Value:
Return $this for chaining.
Check if model exists (has a primary key)
News::exists( ): booleanReturn attributes that doesn't pass the validator
News::getInvalid( ): arrayReturns the current validation rules
News::getRules( ): arrayReturn Value:
of \Illuminate\Validation\Factory rules
Return the validator instance
News::getValidator( ): \Illuminate\Contracts\Validation\ValidatorCheck if model has saved all the changes
News::isSaved( ): booleanCheck that the model passes validation rules
News::isValid( ): booleanLoad model attributes and mark them as saved.
News::load( array $attributes ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$attributes |
array | Attributes to be loaded |
Merge new rules to the current validation rules
News::mergeRules( array $rules ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$rules |
array | \Illuminate\Validation\Factory rules |
Create or update the model
News::save( ): \Pisa\GizmoAPI\Models\BaseModelReturn Value:
Return $this for chaining
Set the validation rules
News::setRules( array $rules ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$rules |
array | \Illuminate\Validation\Factory rules |
Runs validations for the model
News::validate( ): booleanReturn Value:
Return true if something fails, false otherwise
Set all attributes. Use AttributeMutators if presented.
News::fill( array $attributes ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$attributes |
array |
Get a single attribute
News::getAttribute( string $key ): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$key |
string |
Return Value:
Attribute value
Get all attributes
News::getAttributes( ): arraySet a single attribute. Use mutator if presented
News::setAttribute( string $key, mixed $value )Parameters:
| Parameter | Type | Description |
|---|---|---|
$key |
string | |
$value |
mixed |
Alias for getAttributes
News::toArray( )Gets the primary key
News::getPrimaryKey( ): stringGets the value of the primary key
News::getPrimaryKeyValue( ): mixed- Full name: \Pisa\GizmoAPI\Repositories\NewsRepository
- Parent class: \Pisa\GizmoAPI\Repositories\BaseRepository
- This class implements: \Pisa\GizmoAPI\Repositories\NewsRepositoryInterface
NewsRepository::__construct( \Pisa\GizmoAPI\Contracts\Container $ioc, \Pisa\GizmoAPI\Contracts\HttpClient $client )Parameters:
| Parameter | Type | Description |
|---|---|---|
$ioc |
\Pisa\GizmoAPI\Contracts\Container | Implementation of the ioc container |
$client |
\Pisa\GizmoAPI\Contracts\HttpClient | Implemention of http client |
Get all model instances from repository
NewsRepository::all( integer $limit = 30, integer $skip, string $orderBy = null ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$limit |
integer | Limit the number of fetched instances. Defaults to 30. |
$skip |
integer | Skip number of instances (i.e. fetch the next page). Defaults to 0. |
$orderBy |
string | Column to order the results with. |
Return Value:
Returns array of model instances.
NewsRepository::criteriaToFilter( array $criteria, $caseSensitive = false )- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | |
$caseSensitive |
**** |
Finds model instances by parameters
NewsRepository::findBy( array $criteria, boolean $caseSensitive = false, integer $limit = 30, integer $skip, string $orderBy = null ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | Array of criteria to search for. |
$caseSensitive |
boolean | Search for case sensitive parameters. Defaults to false. |
$limit |
integer | Limit the number of fetched instances. Defaults to 30. |
$skip |
integer | Skip number of instances (i.e. fetch the next page). Defaults to 0. |
$orderBy |
string | Column to order the results with. |
Return Value:
Returns array of model instances.
Find one model entry by parameters
NewsRepository::findOneBy( array $criteria, boolean $caseSensitive = false ): \Pisa\GizmoAPI\Repositories\Model|nullParameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | Array of criteria to search for |
$caseSensitive |
boolean | Search for case sensitive parameters. Defaults to false |
Return Value:
Returns the first model entry found on current criteria. Returns null if none is found.
Get model by id
NewsRepository::get( integer $id ): \Pisa\GizmoAPI\Repositories\Model|nullParameters:
| Parameter | Type | Description |
|---|---|---|
$id |
integer | Id of the model entry. |
Return Value:
Returns model. If no model is found, returns null.
Check if model entry exists.
NewsRepository::has( integer $id ): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
$id |
integer | Id of the model entry. |
Make a new model
NewsRepository::make( array $attributes ): \Pisa\GizmoAPI\Repositories\ModelParameters:
| Parameter | Type | Description |
|---|---|---|
$attributes |
array | Attributes for the model to be made |
Return Value:
Returns model.
Exception when something isn't implemented
- Full name: \Pisa\GizmoAPI\Exceptions\NotImplementedException
- Parent class:
- This class implements: \Pisa\GizmoAPI\Exceptions\GizmoAPIException
Exception when a object state doesn't allow something
- Full name: \Pisa\GizmoAPI\Exceptions\RequirementException
- Parent class:
- This class implements: \Pisa\GizmoAPI\Exceptions\GizmoAPIException
- Full name: \Pisa\GizmoAPI\Repositories\ServiceRepository
- This class implements: \Pisa\GizmoAPI\Repositories\ServiceRepositoryInterface
ServiceRepository::__construct( \Pisa\GizmoAPI\Contracts\HttpClient $client )Parameters:
| Parameter | Type | Description |
|---|---|---|
$client |
\Pisa\GizmoAPI\Contracts\HttpClient | Implemention of http client |
Returns hardware id
ServiceRepository::getHardwareId( ): stringReturns license information
ServiceRepository::getLicense( ): arrayReturns the service module information
ServiceRepository::getModule( ): arrayReturns the service settings
ServiceRepository::getSettings( ): arrayReturns status of the service
ServiceRepository::getStatus( ): arrayReturns current system time.
ServiceRepository::getTime( ): integerReturn Value:
Unix timestamp
Returns the service version
ServiceRepository::getVersion( ): stringRestarts the service
ServiceRepository::restart( ): voidStops the service
ServiceRepository::stop( ): void- Full name: \Pisa\GizmoAPI\Repositories\SessionRepository
- Parent class: \Pisa\GizmoAPI\Repositories\BaseRepository
- This class implements: \Pisa\GizmoAPI\Repositories\SessionRepositoryInterface
SessionRepository::__construct( \Pisa\GizmoAPI\Contracts\HttpClient $client )Parameters:
| Parameter | Type | Description |
|---|---|---|
$client |
\Pisa\GizmoAPI\Contracts\HttpClient | Implemention of http client |
Get all model instances from repository
SessionRepository::all( integer $limit = 30, integer $skip, string $orderBy = null ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$limit |
integer | Limit the number of fetched instances. Defaults to 30. |
$skip |
integer | Skip number of instances (i.e. fetch the next page). Defaults to 0. |
$orderBy |
string | Column to order the results with. |
Return Value:
Returns array of model instances.
SessionRepository::criteriaToFilter( array $criteria, $caseSensitive = false )- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | |
$caseSensitive |
**** |
Finds model instances by parameters
SessionRepository::findBy( array $criteria, boolean $caseSensitive = false, integer $limit = 30, integer $skip, string $orderBy = null ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | Array of criteria to search for. |
$caseSensitive |
boolean | Search for case sensitive parameters. Defaults to false. |
$limit |
integer | Limit the number of fetched instances. Defaults to 30. |
$skip |
integer | Skip number of instances (i.e. fetch the next page). Defaults to 0. |
$orderBy |
string | Column to order the results with. |
Return Value:
Returns array of model instances.
Find one model entry by parameters
SessionRepository::findOneBy( array $criteria, boolean $caseSensitive = false ): \Pisa\GizmoAPI\Repositories\Model|nullParameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | Array of criteria to search for |
$caseSensitive |
boolean | Search for case sensitive parameters. Defaults to false |
Return Value:
Returns the first model entry found on current criteria. Returns null if none is found.
Get model by id
SessionRepository::get( integer $id ): \Pisa\GizmoAPI\Repositories\Model|nullParameters:
| Parameter | Type | Description |
|---|---|---|
$id |
integer | Id of the model entry. |
Return Value:
Returns model. If no model is found, returns null.
Check if model entry exists.
SessionRepository::has( integer $id ): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
$id |
integer | Id of the model entry. |
Make a new model
SessionRepository::make( array $attributes ): \Pisa\GizmoAPI\Repositories\ModelParameters:
| Parameter | Type | Description |
|---|---|---|
$attributes |
array | Attributes for the model to be made |
Return Value:
Returns model.
Finds active sessions by criteria
SessionRepository::findActiveBy( array $criteria, boolean $caseSensitive = false, integer $limit = 30, integer $skip, $orderBy = null ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | Array of criteria to search for |
$caseSensitive |
boolean | Search for case sensitive parameters. Defaults to false |
$limit |
integer | Limit the number of fetched instances. Defaults to 30 |
$skip |
integer | Skip number of instances (i.e. fetch the next page). Defaults to 0 |
$orderBy |
**** |
Return Value:
List of active sessions filtered by criteria
Find active sessions with additional information by criteria
SessionRepository::findActiveInfosBy( array $criteria, boolean $caseSensitive = false, integer $limit = 30, integer $skip, $orderBy = null ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | Array of criteria to search for |
$caseSensitive |
boolean | Search for case sensitive parameters. Defaults to false |
$limit |
integer | Limit the number of fetched instances. Defaults to 30 |
$skip |
integer | Skip number of instances (i.e. fetch the next page). Defaults to 0 |
$orderBy |
**** |
Return Value:
List of active sessions filtered by criteria
Finds one active session by criteria
SessionRepository::findOneActiveBy( array $criteria, boolean $caseSensitive = false ): array|nullParameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | Array of criteria to search for |
$caseSensitive |
boolean | Search for case sensitive parameters. Defaults to false |
Return Value:
One active session. Null if nothing found
Find one active session with additional information by criteria
SessionRepository::findOneActiveInfosBy( array $criteria, boolean $caseSensitive = false ): array|nullParameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | Array of criteria to search for |
$caseSensitive |
boolean | Search for case sensitive parameters. Defaults to false |
Return Value:
One active session. Null if nothing found
Get all active sessions
SessionRepository::getActive( integer $limit = 30, integer $skip, $orderBy = null ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$limit |
integer | Limit the number of fetched instances. Defaults to 30 |
$skip |
integer | Skip number of instances (i.e. fetch the next page). Defaults to 0 |
$orderBy |
**** |
Return Value:
List of active sessions
Get all active sessions and additional information
SessionRepository::getActiveInfos( integer $limit = 30, integer $skip, $orderBy = null ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$limit |
integer | Limit the number of fetched instances. Defaults to 30 |
$skip |
integer | Skip number of instances (i.e. fetch the next page). Defaults to 0 |
$orderBy |
**** |
Return Value:
List of active sessions
Exception when a response or the type of the response isn't what was expected
- Full name: \Pisa\GizmoAPI\Exceptions\UnexpectedResponseException
- Parent class:
- This class implements: \Pisa\GizmoAPI\Exceptions\GizmoAPIException
- Full name: \Pisa\GizmoAPI\Models\User
- Parent class: \Pisa\GizmoAPI\Models\BaseModel
- This class implements: \Pisa\GizmoAPI\Models\UserInterface
Make a new model instance
User::__construct( \Pisa\GizmoAPI\Contracts\HttpClient $client, \Illuminate\Contracts\Validation\Factory $validatorFactory, \Psr\Log\LoggerInterface $logger, array $attributes = array() )Parameters:
| Parameter | Type | Description |
|---|---|---|
$client |
\Pisa\GizmoAPI\Contracts\HttpClient | HTTP client |
$validatorFactory |
\Illuminate\Contracts\Validation\Factory | |
$logger |
\Psr\Log\LoggerInterface | |
$attributes |
array | Attributes to initialize |
Cast the model to string
User::__toString( ): stringDelete the model
User::delete( ): \Pisa\GizmoAPI\Models\BaseModelReturn Value:
Return $this for chaining.
Check if model exists (has a primary key)
User::exists( ): booleanReturn attributes that doesn't pass the validator
User::getInvalid( ): arrayReturns the current validation rules
User::getRules( ): arrayReturn Value:
of \Illuminate\Validation\Factory rules
Return the validator instance
User::getValidator( ): \Illuminate\Contracts\Validation\ValidatorCheck if model has saved all the changes
User::isSaved( ): booleanCheck that the model passes validation rules
User::isValid( ): booleanLoad model attributes and mark them as saved.
User::load( array $attributes ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$attributes |
array | Attributes to be loaded |
Merge new rules to the current validation rules
User::mergeRules( array $rules ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$rules |
array | \Illuminate\Validation\Factory rules |
Create or update the model
User::save( \Pisa\GizmoAPI\Repositories\UserRepositoryInterface $repository = null ): \Pisa\GizmoAPI\Models\BaseModelParameters:
| Parameter | Type | Description |
|---|---|---|
$repository |
\Pisa\GizmoAPI\Repositories\UserRepositoryInterface | UserRepository has to be provided when changing UserName or Email (for checking availability). Otherwise the parameter is not needed |
Return Value:
Return $this for chaining
Set the validation rules
User::setRules( array $rules ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$rules |
array | \Illuminate\Validation\Factory rules |
Runs validations for the model
User::validate( ): booleanReturn Value:
Return true if something fails, false otherwise
Set all attributes. Use AttributeMutators if presented.
User::fill( array $attributes ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$attributes |
array |
Get a single attribute
User::getAttribute( string $key ): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$key |
string |
Return Value:
Attribute value
Get all attributes
User::getAttributes( ): arraySet a single attribute. Use mutator if presented
User::setAttribute( string $key, mixed $value )Parameters:
| Parameter | Type | Description |
|---|---|---|
$key |
string | |
$value |
mixed |
Alias for getAttributes
User::toArray( )Gets the primary key
User::getPrimaryKey( ): stringGets the value of the primary key
User::getPrimaryKeyValue( ): mixedGet the Host id where the user is logged in
User::getLoggedInHostId( ): integer|falseReturn Value:
Returns integer if user is logged on a host. Otherwise returns false
Check if user is logged in
User::isLoggedIn( ): booleanGet the time of last login to a host
User::lastLoginTime( ): integerReturn Value:
Unix timestamp
Get the time of last logout from a host
User::lastLogoutTime( ): integerReturn Value:
Unix timestamp
Log user in to a host
User::login( \Pisa\GizmoAPI\Models\HostInterface $host ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$host |
\Pisa\GizmoAPI\Models\HostInterface | Host to log in |
Log user out from a host
User::logout( ): voidRenames a user
User::rename( \Pisa\GizmoAPI\Repositories\UserRepositoryInterface $repository, string $newUserName ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$repository |
\Pisa\GizmoAPI\Repositories\UserRepositoryInterface | User repository to check whether the new username is available |
$newUserName |
string | New username |
A shorthand for setPassword('')
User::resetPassword( ): voidChange the user email
User::setEmail( \Pisa\GizmoAPI\Repositories\UserRepositoryInterface $repository, string $newEmail ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$repository |
\Pisa\GizmoAPI\Repositories\UserRepositoryInterface | User repository to check whether the new email is available |
$newEmail |
string | New email |
Set new password for the user
User::setPassword( string $newPassword ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$newPassword |
string | New password |
Set user to a new user group
User::setUserGroup( integer $groupId ): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$groupId |
integer | New group id |
- Full name: \Pisa\GizmoAPI\Repositories\UserRepository
- Parent class: \Pisa\GizmoAPI\Repositories\BaseRepository
- This class implements: \Pisa\GizmoAPI\Repositories\UserRepositoryInterface
UserRepository::__construct( \Pisa\GizmoAPI\Contracts\Container $ioc, \Pisa\GizmoAPI\Contracts\HttpClient $client )Parameters:
| Parameter | Type | Description |
|---|---|---|
$ioc |
\Pisa\GizmoAPI\Contracts\Container | Implementation of the ioc container |
$client |
\Pisa\GizmoAPI\Contracts\HttpClient | Implemention of http client |
Get all model instances from repository
UserRepository::all( integer $limit = 30, integer $skip, string $orderBy = null ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$limit |
integer | Limit the number of fetched instances. Defaults to 30. |
$skip |
integer | Skip number of instances (i.e. fetch the next page). Defaults to 0. |
$orderBy |
string | Column to order the results with. |
Return Value:
Returns array of model instances.
UserRepository::criteriaToFilter( array $criteria, $caseSensitive = false )- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | |
$caseSensitive |
**** |
Finds model instances by parameters
UserRepository::findBy( array $criteria, boolean $caseSensitive = false, integer $limit = 30, integer $skip, string $orderBy = null ): arrayParameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | Array of criteria to search for. |
$caseSensitive |
boolean | Search for case sensitive parameters. Defaults to false. |
$limit |
integer | Limit the number of fetched instances. Defaults to 30. |
$skip |
integer | Skip number of instances (i.e. fetch the next page). Defaults to 0. |
$orderBy |
string | Column to order the results with. |
Return Value:
Returns array of model instances.
Find one model entry by parameters
UserRepository::findOneBy( array $criteria, boolean $caseSensitive = false ): \Pisa\GizmoAPI\Repositories\Model|nullParameters:
| Parameter | Type | Description |
|---|---|---|
$criteria |
array | Array of criteria to search for |
$caseSensitive |
boolean | Search for case sensitive parameters. Defaults to false |
Return Value:
Returns the first model entry found on current criteria. Returns null if none is found.
Get model by id
UserRepository::get( integer $id ): \Pisa\GizmoAPI\Repositories\Model|nullParameters:
| Parameter | Type | Description |
|---|---|---|
$id |
integer | Id of the model entry. |
Return Value:
Returns model. If no model is found, returns null.
Check if model entry exists.
UserRepository::has( integer $id ): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
$id |
integer | Id of the model entry. |
Make a new model
UserRepository::make( array $attributes ): \Pisa\GizmoAPI\Repositories\ModelParameters:
| Parameter | Type | Description |
|---|---|---|
$attributes |
array | Attributes for the model to be made |
Return Value:
Returns model.
Check if user LoginName exists.
UserRepository::hasLoginName( string $loginName ): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
$loginName |
string | LoginName of the user |
Check if user email exists.
UserRepository::hasUserEmail( string $userEmail ): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
$userEmail |
string | Email of the user |
Check if user username exists.
UserRepository::hasUserName( string $userName ): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
$userName |
string | UserName of the user |
Exception when an object validation fails
- Full name: \Pisa\GizmoAPI\Exceptions\ValidationException
- Parent class: \Pisa\GizmoAPI\Exceptions\RequirementException
- This class implements: \Pisa\GizmoAPI\Exceptions\GizmoAPIException
This document was automatically generated from source code comments on 2016-07-13 using phpDocumentor and cvuorinen/phpdoc-markdown-public
vendor\bin\phpdoc.bat -d src\ -t docs\ --template="vendor/cvuorinen/phpdoc-markdown-public/data/templates/markdown-public" --title="GizmoAPI"