Documentation

Operation
in package
implements OperationInterface

Data object holding the information of an API command

Table of Contents

Interfaces

OperationInterface
Interface defining data objects that hold the information of an API operation

Constants

DEFAULT_COMMAND_CLASS  = 'Guzzle\Service\Command\OperationCommand'

Properties

$additionalParameters  : Parameter
$class  : string
$data  : array<string|int, mixed>
$deprecated  : bool
$description  : ServiceDescriptionInterface
$documentationUrl  : string
$errorResponses  : array<string|int, mixed>
$httpMethod  : string
$name  : string
$notes  : string
$parameters  : array<string|int, mixed>
$properties  : array<string|int, mixed>
$responseClass  : string
$responseNotes  : string
$responseType  : string
$summary  : string
$uri  : string

Methods

__construct()  : mixed
Builds an Operation object using an array of configuration data: - name: (string) Name of the command - httpMethod: (string) HTTP method of the operation - uri: (string) URI template that can create a relative or absolute URL - class: (string) Concrete class that implements this command - parameters: (array) Associative array of parameters for the command. {@see Parameter} for information.
addErrorResponse()  : self
Add an error to the command
addParam()  : self
Add a parameter to the command
getAdditionalParameters()  : Parameter|null
Get the additionalParameters of the operation
getClass()  : string
Get the concrete operation class that implements this operation
getData()  : mixed|null
Get extra data from the operation
getDeprecated()  : bool
Get whether or not the operation is deprecated
getDocumentationUrl()  : string|null
Get the documentation URL of the operation
getErrorResponses()  : array<string|int, mixed>
Get the errors that could be encountered when executing the operation
getHttpMethod()  : string|null
Get the HTTP method of the operation
getName()  : string|null
Get the name of the operation
getNotes()  : string|null
Get a longer text field to explain the behavior of the operation
getParam()  : Parameter|null
Get a single parameter of the operation
getParamNames()  : array<string|int, mixed>
Returns an array of parameter names
getParams()  : array<string|int, mixed>
Get the params of the operation
getResponseClass()  : string|null
Get what is returned from the method. Can be a primitive, class name, or model. For example, the responseClass could be 'array', which would inherently use a responseType of 'primitive'. Using a class name would set a responseType of 'class'. Specifying a model by ID will use a responseType of 'model'.
getResponseNotes()  : string|null
Get notes about the response of the operation
getResponseType()  : string
Get information about how the response is unmarshalled: One of 'primitive', 'class', 'model', or 'documentation'
getServiceDescription()  : ServiceDescriptionInterface|null
Get the service description that the operation belongs to
getSummary()  : string|null
Get a short summary of what the operation does
getUri()  : string
Get the URI that will be merged into the generated request
hasParam()  : bool
Check if the operation has a specific parameter by name
removeParam()  : self
Remove a parameter from the command
setAdditionalParameters()  : self
Set the additionalParameters of the operation
setClass()  : self
Set the concrete class of the command
setData()  : self
Set a particular data point on the operation
setDeprecated()  : self
Set whether or not the command is deprecated
setDocumentationUrl()  : self
Set the URL pointing to additional documentation on the command
setErrorResponses()  : self
Set all of the error responses of the operation
setHttpMethod()  : self
Set the HTTP method of the command
setName()  : self
Set the name of the command
setNotes()  : self
Set a longer text field to explain the behavior of the operation.
setResponseClass()  : self
Set what is returned from the method. Can be a primitive, class name, or model. For example: 'array', 'Guzzle\\Foo\\Baz', or 'MyModelName' (to reference a model by ID).
setResponseNotes()  : self
Set notes about the response of the operation
setResponseType()  : self
Set qualifying information about the responseClass. One of 'primitive', 'class', 'model', or 'documentation'
setServiceDescription()  : self
Set the service description that the operation belongs to
setSummary()  : self
Set a short summary of what the operation does
setUri()  : self
Set the URI template of the command
toArray()  : array<string|int, mixed>
Get the array representation of an object
inferResponseType()  : mixed
Infer the response type from the responseClass value

Constants

DEFAULT_COMMAND_CLASS

public string DEFAULT_COMMAND_CLASS = 'Guzzle\Service\Command\OperationCommand'

Default command class to use when none is specified

Properties

$additionalParameters

protected Parameter $additionalParameters

Additional parameters schema

$class

protected string $class

Class of the command object

$data

protected array<string|int, mixed> $data

Extra operation information

$deprecated

protected bool $deprecated

Whether or not the command is deprecated

$documentationUrl

protected string $documentationUrl

Reference URL providing more information about the operation

$errorResponses

protected array<string|int, mixed> $errorResponses

Array of errors that could occur when running the command

$httpMethod

protected string $httpMethod

HTTP method

$name

protected string $name

Name of the command

$notes

protected string $notes

A longer text field to explain the behavior of the operation.

$parameters

protected array<string|int, mixed> $parameters = array()

Parameters

$properties

protected static array<string|int, mixed> $properties = array('name' => true, 'httpMethod' => true, 'uri' => true, 'class' => true, 'responseClass' => true, 'responseType' => true, 'responseNotes' => true, 'notes' => true, 'summary' => true, 'documentationUrl' => true, 'deprecated' => true, 'data' => true, 'parameters' => true, 'additionalParameters' => true, 'errorResponses' => true)

Hashmap of properties that can be specified. Represented as a hash to speed up constructor.

$responseClass

protected string $responseClass

This is what is returned from the method

$responseNotes

protected string $responseNotes

Information about the response returned by the operation

$responseType

protected string $responseType

Type information about the response

$summary

protected string $summary

This is a short summary of what the operation does

$uri

protected string $uri

HTTP URI of the command

Methods

__construct()

Builds an Operation object using an array of configuration data: - name: (string) Name of the command - httpMethod: (string) HTTP method of the operation - uri: (string) URI template that can create a relative or absolute URL - class: (string) Concrete class that implements this command - parameters: (array) Associative array of parameters for the command. {@see Parameter} for information.

public __construct([array<string|int, mixed> $config = array() ][, ServiceDescriptionInterface $description = null ]) : mixed
  • summary: (string) This is a short summary of what the operation does
  • notes: (string) A longer text field to explain the behavior of the operation.
  • documentationUrl: (string) Reference URL providing more information about the operation
  • responseClass: (string) This is what is returned from the method. Can be a primitive, PSR-0 compliant class name, or model.
  • responseNotes: (string) Information about the response returned by the operation
  • responseType: (string) One of 'primitive', 'class', 'model', or 'documentation'. If not specified, this value will be automatically inferred based on whether or not there is a model matching the name, if a matching PSR-0 compliant class name is found, or set to 'primitive' by default.
  • deprecated: (bool) Set to true if this is a deprecated command
  • errorResponses: (array) Errors that could occur when executing the command. Array of hashes, each with a 'code' (the HTTP response code), 'reason' (response reason phrase or description of the error), and 'class' (a custom exception class that would be thrown if the error is encountered).
  • data: (array) Any extra data that might be used to help build or serialize the operation
  • additionalParameters: (null|array) Parameter schema to use when an option is passed to the operation that is not in the schema
Parameters
$config : array<string|int, mixed> = array()

Array of configuration data

$description : ServiceDescriptionInterface = null

Service description used to resolve models if $ref tags are found

addErrorResponse()

Add an error to the command

public addErrorResponse(string $code, string $reason, string $class) : self
Parameters
$code : string

HTTP response code

$reason : string

HTTP response reason phrase or information about the error

$class : string

Exception class associated with the error

Return values
self

addParam()

Add a parameter to the command

public addParam(Parameter $param) : self
Parameters
$param : Parameter

Parameter to add

Return values
self

getAdditionalParameters()

Get the additionalParameters of the operation

public getAdditionalParameters() : Parameter|null
Return values
Parameter|null

getClass()

Get the concrete operation class that implements this operation

public getClass() : string
Return values
string

getData()

Get extra data from the operation

public getData(mixed $name) : mixed|null
Parameters
$name : mixed

Name of the data point to retrieve

Return values
mixed|null

getDeprecated()

Get whether or not the operation is deprecated

public getDeprecated() : bool
Return values
bool

getDocumentationUrl()

Get the documentation URL of the operation

public getDocumentationUrl() : string|null
Return values
string|null

getErrorResponses()

Get the errors that could be encountered when executing the operation

public getErrorResponses() : array<string|int, mixed>
Return values
array<string|int, mixed>

getHttpMethod()

Get the HTTP method of the operation

public getHttpMethod() : string|null
Return values
string|null

getName()

Get the name of the operation

public getName() : string|null
Return values
string|null

getNotes()

Get a longer text field to explain the behavior of the operation

public getNotes() : string|null
Return values
string|null

getParam()

Get a single parameter of the operation

public getParam(mixed $param) : Parameter|null
Parameters
$param : mixed

Parameter to retrieve by name

Return values
Parameter|null

getParamNames()

Returns an array of parameter names

public getParamNames() : array<string|int, mixed>
Return values
array<string|int, mixed>

getParams()

Get the params of the operation

public getParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

getResponseClass()

Get what is returned from the method. Can be a primitive, class name, or model. For example, the responseClass could be 'array', which would inherently use a responseType of 'primitive'. Using a class name would set a responseType of 'class'. Specifying a model by ID will use a responseType of 'model'.

public getResponseClass() : string|null
Return values
string|null

getResponseNotes()

Get notes about the response of the operation

public getResponseNotes() : string|null
Return values
string|null

getResponseType()

Get information about how the response is unmarshalled: One of 'primitive', 'class', 'model', or 'documentation'

public getResponseType() : string
Return values
string

getSummary()

Get a short summary of what the operation does

public getSummary() : string|null
Return values
string|null

getUri()

Get the URI that will be merged into the generated request

public getUri() : string
Return values
string

hasParam()

Check if the operation has a specific parameter by name

public hasParam(mixed $name) : bool
Parameters
$name : mixed

Name of the param

Return values
bool

removeParam()

Remove a parameter from the command

public removeParam(string $name) : self
Parameters
$name : string

Name of the parameter to remove

Return values
self

setAdditionalParameters()

Set the additionalParameters of the operation

public setAdditionalParameters(Parameter|null $parameter) : self
Parameters
$parameter : Parameter|null

Parameter to set

Return values
self

setClass()

Set the concrete class of the command

public setClass(string $className) : self
Parameters
$className : string

Concrete class name

Return values
self

setData()

Set a particular data point on the operation

public setData(string $name, mixed $value) : self
Parameters
$name : string

Name of the data value

$value : mixed

Value to set

Return values
self

setDeprecated()

Set whether or not the command is deprecated

public setDeprecated(bool $isDeprecated) : self
Parameters
$isDeprecated : bool

Set to true to mark as deprecated

Return values
self

setDocumentationUrl()

Set the URL pointing to additional documentation on the command

public setDocumentationUrl(string $docUrl) : self
Parameters
$docUrl : string

Documentation URL

Return values
self

setErrorResponses()

Set all of the error responses of the operation

public setErrorResponses(array<string|int, mixed> $errorResponses) : self
Parameters
$errorResponses : array<string|int, mixed>

Hash of error name to a hash containing a code, reason, class

Return values
self

setHttpMethod()

Set the HTTP method of the command

public setHttpMethod(string $httpMethod) : self
Parameters
$httpMethod : string

Method to set

Return values
self

setName()

Set the name of the command

public setName(string $name) : self
Parameters
$name : string

Name of the command

Return values
self

setNotes()

Set a longer text field to explain the behavior of the operation.

public setNotes(string $notes) : self
Parameters
$notes : string

Notes on the operation

Return values
self

setResponseClass()

Set what is returned from the method. Can be a primitive, class name, or model. For example: 'array', 'Guzzle\\Foo\\Baz', or 'MyModelName' (to reference a model by ID).

public setResponseClass(string $responseClass) : self
Parameters
$responseClass : string

Type of response

Return values
self

setResponseNotes()

Set notes about the response of the operation

public setResponseNotes(string $notes) : self
Parameters
$notes : string

Response notes

Return values
self

setResponseType()

Set qualifying information about the responseClass. One of 'primitive', 'class', 'model', or 'documentation'

public setResponseType(string $responseType) : self
Parameters
$responseType : string

Response type information

Tags
throws
InvalidArgumentException
Return values
self

setSummary()

Set a short summary of what the operation does

public setSummary(string $summary) : self
Parameters
$summary : string

Short summary of the operation

Return values
self

setUri()

Set the URI template of the command

public setUri(string $uri) : self
Parameters
$uri : string

URI template to set

Return values
self

toArray()

Get the array representation of an object

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

inferResponseType()

Infer the response type from the responseClass value

protected inferResponseType() : mixed

        
On this page

Search results