ApiIndex - Zachu/GizmoAPI GitHub Wiki

GizmoAPI

Table of Contents

Gizmo

Gizmo Application Management Platforms API wrapper for PHP

  • Full name: \Pisa\GizmoAPI\Gizmo

__construct

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

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

getConfig

Gets a single config value

Gizmo::getConfig( string $name = null ): mixed

Parameters:

Parameter Type Description
$name string

getRepository

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

hasRepository

Checks if such repository should exist

Gizmo::hasRepository( string $name ): boolean

Parameters:

Parameter Type Description
$name string Name of the repository

setConfig

Sets a config parameter

Gizmo::setConfig( string $name, mixed $value = null )

Parameters:

Parameter Type Description
$name string
$value mixed

GuzzleClientAdapter

  • Full name: \Pisa\GizmoAPI\Adapters\GuzzleClientAdapter
  • This class implements: \Pisa\GizmoAPI\Contracts\HttpClient

__construct

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

delete

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


get

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


post

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


put

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


request

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

GuzzleResponseAdapter

  • Full name: \Pisa\GizmoAPI\Adapters\GuzzleResponseAdapter
  • This class implements: \Pisa\GizmoAPI\Contracts\HttpResponse

__construct

Create a new Http Response

GuzzleResponseAdapter::__construct( \GuzzleHttp\Psr7\Response $response )

Parameters:

Parameter Type Description
$response \GuzzleHttp\Psr7\Response The real underlying Guzzle Response

assertArray

Check that http response body was an array.

GuzzleResponseAdapter::assertArray(  ): void

assertBoolean

Check that http response body was a boolean.

GuzzleResponseAdapter::assertBoolean(  ): void

assertEmpty

Check that http response body was empty.

GuzzleResponseAdapter::assertEmpty(  ): void

assertInteger

Check that http response body was an integer.

GuzzleResponseAdapter::assertInteger(  ): void

assertStatusCodes

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.

assertString

Check that http response body was string.

GuzzleResponseAdapter::assertString(  ): void

assertTime

Check that http response body is a time

GuzzleResponseAdapter::assertTime(  ): void

getBody

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.


getHeader

Get single response header

GuzzleResponseAdapter::getHeader(  $header ): string

Parameters:

Parameter Type Description
$header **** Header key

getHeaders

Get the response headers

GuzzleResponseAdapter::getHeaders(  ): array

getJson

Get the body json and decode it

GuzzleResponseAdapter::getJson(  ): mixed

Return Value:

Response


getReasonPhrase

Get the reason phrase for the according status code

GuzzleResponseAdapter::getReasonPhrase(  ): string

getStatusCode

Get the http status code

GuzzleResponseAdapter::getStatusCode(  ): integer

getString

Get the body as a string

GuzzleResponseAdapter::getString(  ): string

getType

Get the content type

GuzzleResponseAdapter::getType(  ): string

Host

  • Full name: \Pisa\GizmoAPI\Models\Host
  • Parent class: \Pisa\GizmoAPI\Models\BaseModel
  • This class implements: \Pisa\GizmoAPI\Models\HostInterface

__construct

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

__toString

Cast the model to string

Host::__toString(  ): string

delete

This method cannot be used. Host is deleted via the server service

Host::delete(  ): void

exists

Check if model exists (has a primary key)

Host::exists(  ): boolean

getInvalid

Return attributes that doesn't pass the validator

Host::getInvalid(  ): array

getRules

Returns the current validation rules

Host::getRules(  ): array

Return Value:

of \Illuminate\Validation\Factory rules


getValidator

Return the validator instance

Host::getValidator(  ): \Illuminate\Contracts\Validation\Validator

isSaved

Check if model has saved all the changes

Host::isSaved(  ): boolean

isValid

Check that the model passes validation rules

Host::isValid(  ): boolean

load

Load model attributes and mark them as saved.

Host::load( array $attributes ): void

Parameters:

Parameter Type Description
$attributes array Attributes to be loaded

mergeRules

Merge new rules to the current validation rules

Host::mergeRules( array $rules ): void

Parameters:

Parameter Type Description
$rules array \Illuminate\Validation\Factory rules

save

Create or update the model

Host::save(  ): \Pisa\GizmoAPI\Models\BaseModel

Return Value:

Return $this for chaining


setRules

Set the validation rules

Host::setRules( array $rules ): void

Parameters:

Parameter Type Description
$rules array \Illuminate\Validation\Factory rules

validate

Runs validations for the model

Host::validate(  ): boolean

Return Value:

Return true if something fails, false otherwise


fill

Set all attributes. Use AttributeMutators if presented.

Host::fill( array $attributes ): void

Parameters:

Parameter Type Description
$attributes array

getAttribute

Get a single attribute

Host::getAttribute( string $key ): mixed

Parameters:

Parameter Type Description
$key string

Return Value:

Attribute value


getAttributes

Get all attributes

Host::getAttributes(  ): array

setAttribute

Set a single attribute. Use mutator if presented

Host::setAttribute( string $key, mixed $value )

Parameters:

Parameter Type Description
$key string
$value mixed

toArray

Alias for getAttributes

Host::toArray(  )

getPrimaryKey

Gets the primary key

Host::getPrimaryKey(  ): string

getPrimaryKeyValue

Gets the value of the primary key

Host::getPrimaryKeyValue(  ): mixed

createProcess

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.


getLastUserLoginTime

Get the time of last user login

Host::getLastUserLoginTime(  ): integer

Return Value:

Unix timestamp


getLastUserLogoutTime

Get the time of last user logout

Host::getLastUserLogoutTime(  ): integer

Return Value:

Unix timestamp


getProcess

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


getProcesses

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


getProcessesByName

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


isFree

Checks if the host is free

Host::isFree(  ): boolean

isTurnedOn

Shorthand for HasValidDispatcher attribute

Host::isTurnedOn(  ): boolean

setLockState

Set the host to locked state

Host::setLockState( boolean $isLocked ): void

Parameters:

Parameter Type Description
$isLocked boolean true to lock, false to unlock

setOrderState

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

setSecurityState

Set the host security state

Host::setSecurityState( boolean $isEnabled ): void

Parameters:

Parameter Type Description
$isEnabled boolean true to enable security profiles, false to disable

terminateProcess

Terminate processes

Host::terminateProcess( array $killInfo ): true

Parameters:

Parameter Type Description
$killInfo array Information about killing the processes

Return Value:

on success


uiNotify

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

userLogout

Logs user out from the host

Host::userLogout(  ): true

Return Value:

on success


HostRepository

  • Full name: \Pisa\GizmoAPI\Repositories\HostRepository
  • Parent class: \Pisa\GizmoAPI\Repositories\BaseRepository
  • This class implements: \Pisa\GizmoAPI\Repositories\HostRepositoryInterface

__construct

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

all

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.


criteriaToFilter

HostRepository::criteriaToFilter( array $criteria,  $caseSensitive = false )
  • This method is static. Parameters:
Parameter Type Description
$criteria array
$caseSensitive ****

findBy

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.


findOneBy

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

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.


has

Check if model entry exists.

HostRepository::has( integer $id ): boolean

Parameters:

Parameter Type Description
$id integer Id of the model entry.

make

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.


getByNumber

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


IlluminateContainerAdapter

Illuminate Container Adapter

  • Full name: \Pisa\GizmoAPI\Adapters\IlluminateContainerAdapter
  • This class implements: \Pisa\GizmoAPI\Contracts\Container

__construct

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

bind

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

make

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

singleton

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

InternalException

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

InvalidArgumentException

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

News

  • Full name: \Pisa\GizmoAPI\Models\News
  • Parent class: \Pisa\GizmoAPI\Models\BaseModel
  • This class implements: \Pisa\GizmoAPI\Models\NewsInterface

__construct

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

__toString

Cast the model to string

News::__toString(  ): string

delete

Delete the model

News::delete(  ): \Pisa\GizmoAPI\Models\BaseModel

Return Value:

Return $this for chaining.


exists

Check if model exists (has a primary key)

News::exists(  ): boolean

getInvalid

Return attributes that doesn't pass the validator

News::getInvalid(  ): array

getRules

Returns the current validation rules

News::getRules(  ): array

Return Value:

of \Illuminate\Validation\Factory rules


getValidator

Return the validator instance

News::getValidator(  ): \Illuminate\Contracts\Validation\Validator

isSaved

Check if model has saved all the changes

News::isSaved(  ): boolean

isValid

Check that the model passes validation rules

News::isValid(  ): boolean

load

Load model attributes and mark them as saved.

News::load( array $attributes ): void

Parameters:

Parameter Type Description
$attributes array Attributes to be loaded

mergeRules

Merge new rules to the current validation rules

News::mergeRules( array $rules ): void

Parameters:

Parameter Type Description
$rules array \Illuminate\Validation\Factory rules

save

Create or update the model

News::save(  ): \Pisa\GizmoAPI\Models\BaseModel

Return Value:

Return $this for chaining


setRules

Set the validation rules

News::setRules( array $rules ): void

Parameters:

Parameter Type Description
$rules array \Illuminate\Validation\Factory rules

validate

Runs validations for the model

News::validate(  ): boolean

Return Value:

Return true if something fails, false otherwise


fill

Set all attributes. Use AttributeMutators if presented.

News::fill( array $attributes ): void

Parameters:

Parameter Type Description
$attributes array

getAttribute

Get a single attribute

News::getAttribute( string $key ): mixed

Parameters:

Parameter Type Description
$key string

Return Value:

Attribute value


getAttributes

Get all attributes

News::getAttributes(  ): array

setAttribute

Set a single attribute. Use mutator if presented

News::setAttribute( string $key, mixed $value )

Parameters:

Parameter Type Description
$key string
$value mixed

toArray

Alias for getAttributes

News::toArray(  )

getPrimaryKey

Gets the primary key

News::getPrimaryKey(  ): string

getPrimaryKeyValue

Gets the value of the primary key

News::getPrimaryKeyValue(  ): mixed

NewsRepository

  • Full name: \Pisa\GizmoAPI\Repositories\NewsRepository
  • Parent class: \Pisa\GizmoAPI\Repositories\BaseRepository
  • This class implements: \Pisa\GizmoAPI\Repositories\NewsRepositoryInterface

__construct

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

all

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.


criteriaToFilter

NewsRepository::criteriaToFilter( array $criteria,  $caseSensitive = false )
  • This method is static. Parameters:
Parameter Type Description
$criteria array
$caseSensitive ****

findBy

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.


findOneBy

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

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.


has

Check if model entry exists.

NewsRepository::has( integer $id ): boolean

Parameters:

Parameter Type Description
$id integer Id of the model entry.

make

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.


NotImplementedException

Exception when something isn't implemented

  • Full name: \Pisa\GizmoAPI\Exceptions\NotImplementedException
  • Parent class:
  • This class implements: \Pisa\GizmoAPI\Exceptions\GizmoAPIException

RequirementException

Exception when a object state doesn't allow something

  • Full name: \Pisa\GizmoAPI\Exceptions\RequirementException
  • Parent class:
  • This class implements: \Pisa\GizmoAPI\Exceptions\GizmoAPIException

ServiceRepository

  • Full name: \Pisa\GizmoAPI\Repositories\ServiceRepository
  • This class implements: \Pisa\GizmoAPI\Repositories\ServiceRepositoryInterface

__construct

ServiceRepository::__construct( \Pisa\GizmoAPI\Contracts\HttpClient $client )

Parameters:

Parameter Type Description
$client \Pisa\GizmoAPI\Contracts\HttpClient Implemention of http client

getHardwareId

Returns hardware id

ServiceRepository::getHardwareId(  ): string

getLicense

Returns license information

ServiceRepository::getLicense(  ): array

getModule

Returns the service module information

ServiceRepository::getModule(  ): array

getSettings

Returns the service settings

ServiceRepository::getSettings(  ): array

getStatus

Returns status of the service

ServiceRepository::getStatus(  ): array

getTime

Returns current system time.

ServiceRepository::getTime(  ): integer

Return Value:

Unix timestamp


getVersion

Returns the service version

ServiceRepository::getVersion(  ): string

restart

Restarts the service

ServiceRepository::restart(  ): void

stop

Stops the service

ServiceRepository::stop(  ): void

SessionRepository

  • Full name: \Pisa\GizmoAPI\Repositories\SessionRepository
  • Parent class: \Pisa\GizmoAPI\Repositories\BaseRepository
  • This class implements: \Pisa\GizmoAPI\Repositories\SessionRepositoryInterface

__construct

SessionRepository::__construct( \Pisa\GizmoAPI\Contracts\HttpClient $client )

Parameters:

Parameter Type Description
$client \Pisa\GizmoAPI\Contracts\HttpClient Implemention of http client

all

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.


criteriaToFilter

SessionRepository::criteriaToFilter( array $criteria,  $caseSensitive = false )
  • This method is static. Parameters:
Parameter Type Description
$criteria array
$caseSensitive ****

findBy

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.


findOneBy

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

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.


has

Check if model entry exists.

SessionRepository::has( integer $id ): boolean

Parameters:

Parameter Type Description
$id integer Id of the model entry.

make

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.


findActiveBy

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


findActiveInfosBy

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


findOneActiveBy

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


findOneActiveInfosBy

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


getActive

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


getActiveInfos

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


UnexpectedResponseException

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

User

  • Full name: \Pisa\GizmoAPI\Models\User
  • Parent class: \Pisa\GizmoAPI\Models\BaseModel
  • This class implements: \Pisa\GizmoAPI\Models\UserInterface

__construct

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

__toString

Cast the model to string

User::__toString(  ): string

delete

Delete the model

User::delete(  ): \Pisa\GizmoAPI\Models\BaseModel

Return Value:

Return $this for chaining.


exists

Check if model exists (has a primary key)

User::exists(  ): boolean

getInvalid

Return attributes that doesn't pass the validator

User::getInvalid(  ): array

getRules

Returns the current validation rules

User::getRules(  ): array

Return Value:

of \Illuminate\Validation\Factory rules


getValidator

Return the validator instance

User::getValidator(  ): \Illuminate\Contracts\Validation\Validator

isSaved

Check if model has saved all the changes

User::isSaved(  ): boolean

isValid

Check that the model passes validation rules

User::isValid(  ): boolean

load

Load model attributes and mark them as saved.

User::load( array $attributes ): void

Parameters:

Parameter Type Description
$attributes array Attributes to be loaded

mergeRules

Merge new rules to the current validation rules

User::mergeRules( array $rules ): void

Parameters:

Parameter Type Description
$rules array \Illuminate\Validation\Factory rules

save

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


setRules

Set the validation rules

User::setRules( array $rules ): void

Parameters:

Parameter Type Description
$rules array \Illuminate\Validation\Factory rules

validate

Runs validations for the model

User::validate(  ): boolean

Return Value:

Return true if something fails, false otherwise


fill

Set all attributes. Use AttributeMutators if presented.

User::fill( array $attributes ): void

Parameters:

Parameter Type Description
$attributes array

getAttribute

Get a single attribute

User::getAttribute( string $key ): mixed

Parameters:

Parameter Type Description
$key string

Return Value:

Attribute value


getAttributes

Get all attributes

User::getAttributes(  ): array

setAttribute

Set a single attribute. Use mutator if presented

User::setAttribute( string $key, mixed $value )

Parameters:

Parameter Type Description
$key string
$value mixed

toArray

Alias for getAttributes

User::toArray(  )

getPrimaryKey

Gets the primary key

User::getPrimaryKey(  ): string

getPrimaryKeyValue

Gets the value of the primary key

User::getPrimaryKeyValue(  ): mixed

getLoggedInHostId

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


isLoggedIn

Check if user is logged in

User::isLoggedIn(  ): boolean

lastLoginTime

Get the time of last login to a host

User::lastLoginTime(  ): integer

Return Value:

Unix timestamp


lastLogoutTime

Get the time of last logout from a host

User::lastLogoutTime(  ): integer

Return Value:

Unix timestamp


login

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

logout

Log user out from a host

User::logout(  ): void

rename

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

resetPassword

A shorthand for setPassword('')

User::resetPassword(  ): void

setEmail

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

setPassword

Set new password for the user

User::setPassword( string $newPassword ): void

Parameters:

Parameter Type Description
$newPassword string New password

setUserGroup

Set user to a new user group

User::setUserGroup( integer $groupId ): void

Parameters:

Parameter Type Description
$groupId integer New group id

UserRepository

  • Full name: \Pisa\GizmoAPI\Repositories\UserRepository
  • Parent class: \Pisa\GizmoAPI\Repositories\BaseRepository
  • This class implements: \Pisa\GizmoAPI\Repositories\UserRepositoryInterface

__construct

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

all

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.


criteriaToFilter

UserRepository::criteriaToFilter( array $criteria,  $caseSensitive = false )
  • This method is static. Parameters:
Parameter Type Description
$criteria array
$caseSensitive ****

findBy

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.


findOneBy

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

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.


has

Check if model entry exists.

UserRepository::has( integer $id ): boolean

Parameters:

Parameter Type Description
$id integer Id of the model entry.

make

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.


hasLoginName

Check if user LoginName exists.

UserRepository::hasLoginName( string $loginName ): boolean

Parameters:

Parameter Type Description
$loginName string LoginName of the user

hasUserEmail

Check if user email exists.

UserRepository::hasUserEmail( string $userEmail ): boolean

Parameters:

Parameter Type Description
$userEmail string Email of the user

hasUserName

Check if user username exists.

UserRepository::hasUserName( string $userName ): boolean

Parameters:

Parameter Type Description
$userName string UserName of the user

ValidationException

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"

⚠️ **GitHub.com Fallback** ⚠️