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\ServiceRepositoryInterface
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string | Name of the repository |
Gets a single config value
Gizmo::getConfig( string $name = null ): mixed
Parameters:
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\ServiceRepositoryInterface
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string | Name of the repository |
Checks if such repository should exist
Gizmo::hasRepository( string $name ): boolean
Parameters:
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\HttpResponse
Parameters:
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\HttpResponse
Parameters:
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\HttpResponse
Parameters:
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\HttpResponse
Parameters:
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\GuzzleResponseAdapter
Parameters:
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( ): void
Check that http response body was a boolean.
GuzzleResponseAdapter::assertBoolean( ): void
Check that http response body was empty.
GuzzleResponseAdapter::assertEmpty( ): void
Check that http response body was an integer.
GuzzleResponseAdapter::assertInteger( ): void
Check that http response status codes match the codes we are expecting for.
GuzzleResponseAdapter::assertStatusCodes( integer|array $statusCodes = array() ): void
Parameters:
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( ): void
Check that http response body is a time
GuzzleResponseAdapter::assertTime( ): void
Gets the response body
GuzzleResponseAdapter::getBody( boolean $autodetect = true ): mixed
Parameters:
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 ): string
Parameters:
Parameter | Type | Description |
---|---|---|
$header |
**** | Header key |
Get the response headers
GuzzleResponseAdapter::getHeaders( ): array
Get the body json and decode it
GuzzleResponseAdapter::getJson( ): mixed
Return Value:
Response
Get the reason phrase for the according status code
GuzzleResponseAdapter::getReasonPhrase( ): string
Get the http status code
GuzzleResponseAdapter::getStatusCode( ): integer
Get the body as a string
GuzzleResponseAdapter::getString( ): string
Get 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( ): string
This method cannot be used. Host is deleted via the server service
Host::delete( ): void
Check if model exists (has a primary key)
Host::exists( ): boolean
Return attributes that doesn't pass the validator
Host::getInvalid( ): array
Returns the current validation rules
Host::getRules( ): array
Return Value:
of \Illuminate\Validation\Factory rules
Return the validator instance
Host::getValidator( ): \Illuminate\Contracts\Validation\Validator
Check if model has saved all the changes
Host::isSaved( ): boolean
Check that the model passes validation rules
Host::isValid( ): boolean
Load model attributes and mark them as saved.
Host::load( array $attributes ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$attributes |
array | Attributes to be loaded |
Merge new rules to the current validation rules
Host::mergeRules( array $rules ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$rules |
array | \Illuminate\Validation\Factory rules |
Create or update the model
Host::save( ): \Pisa\GizmoAPI\Models\BaseModel
Return Value:
Return $this for chaining
Set the validation rules
Host::setRules( array $rules ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$rules |
array | \Illuminate\Validation\Factory rules |
Runs validations for the model
Host::validate( ): boolean
Return Value:
Return true if something fails, false otherwise
Set all attributes. Use AttributeMutators if presented.
Host::fill( array $attributes ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$attributes |
array |
Get a single attribute
Host::getAttribute( string $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
string |
Return Value:
Attribute value
Get all attributes
Host::getAttributes( ): array
Set 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( ): string
Gets the value of the primary key
Host::getPrimaryKeyValue( ): mixed
Create a new process
Host::createProcess( array $startInfo ): integer
Example:
$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( ): integer
Return Value:
Unix timestamp
Get the time of last user logout
Host::getLastUserLogoutTime( ): integer
Return Value:
Unix timestamp
Get a single process by its id
Host::getProcess( integer $processId ): array
Parameters:
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 ): array
Parameters:
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 ): array
Parameters:
Parameter | Type | Description |
---|---|---|
$processName |
string |
Return Value:
processes
Checks if the host is free
Host::isFree( ): boolean
Shorthand for HasValidDispatcher attribute
Host::isTurnedOn( ): boolean
Set the host to locked state
Host::setLockState( boolean $isLocked ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$isLocked |
boolean | true to lock, false to unlock |
Set the host order state
Host::setOrderState( boolean $isInOrder ): void
Parameters:
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 ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$isEnabled |
boolean | true to enable security profiles, false to disable |
Terminate processes
Host::terminateProcess( array $killInfo ): true
Parameters:
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() ): boolean
Parameters:
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( ): true
Return 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 ): array
Parameters:
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 ): array
Parameters:
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|null
Parameters:
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|null
Parameters:
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 ): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
$id |
integer | Id of the model entry. |
Make a new model
HostRepository::make( array $attributes ): \Pisa\GizmoAPI\Repositories\Model
Parameters:
Parameter | Type | Description |
---|---|---|
$attributes |
array | Attributes for the model to be made |
Return Value:
Returns model.
Gets hosts by number
HostRepository::getByNumber( integer $hostNumber ): array
Parameters:
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 ): void
Parameters:
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() ): mixed
Parameters:
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 ): void
Parameters:
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( ): string
Delete the model
News::delete( ): \Pisa\GizmoAPI\Models\BaseModel
Return Value:
Return $this for chaining.
Check if model exists (has a primary key)
News::exists( ): boolean
Return attributes that doesn't pass the validator
News::getInvalid( ): array
Returns the current validation rules
News::getRules( ): array
Return Value:
of \Illuminate\Validation\Factory rules
Return the validator instance
News::getValidator( ): \Illuminate\Contracts\Validation\Validator
Check if model has saved all the changes
News::isSaved( ): boolean
Check that the model passes validation rules
News::isValid( ): boolean
Load model attributes and mark them as saved.
News::load( array $attributes ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$attributes |
array | Attributes to be loaded |
Merge new rules to the current validation rules
News::mergeRules( array $rules ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$rules |
array | \Illuminate\Validation\Factory rules |
Create or update the model
News::save( ): \Pisa\GizmoAPI\Models\BaseModel
Return Value:
Return $this for chaining
Set the validation rules
News::setRules( array $rules ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$rules |
array | \Illuminate\Validation\Factory rules |
Runs validations for the model
News::validate( ): boolean
Return Value:
Return true if something fails, false otherwise
Set all attributes. Use AttributeMutators if presented.
News::fill( array $attributes ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$attributes |
array |
Get a single attribute
News::getAttribute( string $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
string |
Return Value:
Attribute value
Get all attributes
News::getAttributes( ): array
Set 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( ): string
Gets 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 ): array
Parameters:
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 ): array
Parameters:
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|null
Parameters:
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|null
Parameters:
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 ): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
$id |
integer | Id of the model entry. |
Make a new model
NewsRepository::make( array $attributes ): \Pisa\GizmoAPI\Repositories\Model
Parameters:
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( ): string
Returns license information
ServiceRepository::getLicense( ): array
Returns the service module information
ServiceRepository::getModule( ): array
Returns the service settings
ServiceRepository::getSettings( ): array
Returns status of the service
ServiceRepository::getStatus( ): array
Returns current system time.
ServiceRepository::getTime( ): integer
Return Value:
Unix timestamp
Returns the service version
ServiceRepository::getVersion( ): string
Restarts the service
ServiceRepository::restart( ): void
Stops 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 ): array
Parameters:
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 ): array
Parameters:
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|null
Parameters:
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|null
Parameters:
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 ): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
$id |
integer | Id of the model entry. |
Make a new model
SessionRepository::make( array $attributes ): \Pisa\GizmoAPI\Repositories\Model
Parameters:
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 ): array
Parameters:
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 ): array
Parameters:
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|null
Parameters:
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|null
Parameters:
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 ): array
Parameters:
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 ): array
Parameters:
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( ): string
Delete the model
User::delete( ): \Pisa\GizmoAPI\Models\BaseModel
Return Value:
Return $this for chaining.
Check if model exists (has a primary key)
User::exists( ): boolean
Return attributes that doesn't pass the validator
User::getInvalid( ): array
Returns the current validation rules
User::getRules( ): array
Return Value:
of \Illuminate\Validation\Factory rules
Return the validator instance
User::getValidator( ): \Illuminate\Contracts\Validation\Validator
Check if model has saved all the changes
User::isSaved( ): boolean
Check that the model passes validation rules
User::isValid( ): boolean
Load model attributes and mark them as saved.
User::load( array $attributes ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$attributes |
array | Attributes to be loaded |
Merge new rules to the current validation rules
User::mergeRules( array $rules ): void
Parameters:
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\BaseModel
Parameters:
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 ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$rules |
array | \Illuminate\Validation\Factory rules |
Runs validations for the model
User::validate( ): boolean
Return Value:
Return true if something fails, false otherwise
Set all attributes. Use AttributeMutators if presented.
User::fill( array $attributes ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$attributes |
array |
Get a single attribute
User::getAttribute( string $key ): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
string |
Return Value:
Attribute value
Get all attributes
User::getAttributes( ): array
Set 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( ): string
Gets the value of the primary key
User::getPrimaryKeyValue( ): mixed
Get the Host id where the user is logged in
User::getLoggedInHostId( ): integer|false
Return Value:
Returns integer if user is logged on a host. Otherwise returns false
Check if user is logged in
User::isLoggedIn( ): boolean
Get the time of last login to a host
User::lastLoginTime( ): integer
Return Value:
Unix timestamp
Get the time of last logout from a host
User::lastLogoutTime( ): integer
Return Value:
Unix timestamp
Log user in to a host
User::login( \Pisa\GizmoAPI\Models\HostInterface $host ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$host |
\Pisa\GizmoAPI\Models\HostInterface | Host to log in |
Log user out from a host
User::logout( ): void
Renames a user
User::rename( \Pisa\GizmoAPI\Repositories\UserRepositoryInterface $repository, string $newUserName ): void
Parameters:
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( ): void
Change the user email
User::setEmail( \Pisa\GizmoAPI\Repositories\UserRepositoryInterface $repository, string $newEmail ): void
Parameters:
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 ): void
Parameters:
Parameter | Type | Description |
---|---|---|
$newPassword |
string | New password |
Set user to a new user group
User::setUserGroup( integer $groupId ): void
Parameters:
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 ): array
Parameters:
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 ): array
Parameters:
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|null
Parameters:
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|null
Parameters:
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 ): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
$id |
integer | Id of the model entry. |
Make a new model
UserRepository::make( array $attributes ): \Pisa\GizmoAPI\Repositories\Model
Parameters:
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 ): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
$loginName |
string | LoginName of the user |
Check if user email exists.
UserRepository::hasUserEmail( string $userEmail ): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
$userEmail |
string | Email of the user |
Check if user username exists.
UserRepository::hasUserName( string $userName ): boolean
Parameters:
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"