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
$description
protected
ServiceDescriptionInterface
$description
$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
selfaddParam()
Add a parameter to the command
public
addParam(Parameter $param) : self
Parameters
- $param : Parameter
-
Parameter to add
Return values
selfgetAdditionalParameters()
Get the additionalParameters of the operation
public
getAdditionalParameters() : Parameter|null
Return values
Parameter|nullgetClass()
Get the concrete operation class that implements this operation
public
getClass() : string
Return values
stringgetData()
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|nullgetDeprecated()
Get whether or not the operation is deprecated
public
getDeprecated() : bool
Return values
boolgetDocumentationUrl()
Get the documentation URL of the operation
public
getDocumentationUrl() : string|null
Return values
string|nullgetErrorResponses()
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|nullgetName()
Get the name of the operation
public
getName() : string|null
Return values
string|nullgetNotes()
Get a longer text field to explain the behavior of the operation
public
getNotes() : string|null
Return values
string|nullgetParam()
Get a single parameter of the operation
public
getParam(mixed $param) : Parameter|null
Parameters
- $param : mixed
-
Parameter to retrieve by name
Return values
Parameter|nullgetParamNames()
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|nullgetResponseNotes()
Get notes about the response of the operation
public
getResponseNotes() : string|null
Return values
string|nullgetResponseType()
Get information about how the response is unmarshalled: One of 'primitive', 'class', 'model', or 'documentation'
public
getResponseType() : string
Return values
stringgetServiceDescription()
Get the service description that the operation belongs to
public
getServiceDescription() : ServiceDescriptionInterface|null
Return values
ServiceDescriptionInterface|nullgetSummary()
Get a short summary of what the operation does
public
getSummary() : string|null
Return values
string|nullgetUri()
Get the URI that will be merged into the generated request
public
getUri() : string
Return values
stringhasParam()
Check if the operation has a specific parameter by name
public
hasParam(mixed $name) : bool
Parameters
- $name : mixed
-
Name of the param
Return values
boolremoveParam()
Remove a parameter from the command
public
removeParam(string $name) : self
Parameters
- $name : string
-
Name of the parameter to remove
Return values
selfsetAdditionalParameters()
Set the additionalParameters of the operation
public
setAdditionalParameters(Parameter|null $parameter) : self
Parameters
- $parameter : Parameter|null
-
Parameter to set
Return values
selfsetClass()
Set the concrete class of the command
public
setClass(string $className) : self
Parameters
- $className : string
-
Concrete class name
Return values
selfsetData()
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
selfsetDeprecated()
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
selfsetDocumentationUrl()
Set the URL pointing to additional documentation on the command
public
setDocumentationUrl(string $docUrl) : self
Parameters
- $docUrl : string
-
Documentation URL
Return values
selfsetErrorResponses()
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
selfsetHttpMethod()
Set the HTTP method of the command
public
setHttpMethod(string $httpMethod) : self
Parameters
- $httpMethod : string
-
Method to set
Return values
selfsetName()
Set the name of the command
public
setName(string $name) : self
Parameters
- $name : string
-
Name of the command
Return values
selfsetNotes()
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
selfsetResponseClass()
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
selfsetResponseNotes()
Set notes about the response of the operation
public
setResponseNotes(string $notes) : self
Parameters
- $notes : string
-
Response notes
Return values
selfsetResponseType()
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
Return values
selfsetServiceDescription()
Set the service description that the operation belongs to
public
setServiceDescription(ServiceDescriptionInterface $description) : self
Parameters
- $description : ServiceDescriptionInterface
-
Service description
Return values
selfsetSummary()
Set a short summary of what the operation does
public
setSummary(string $summary) : self
Parameters
- $summary : string
-
Short summary of the operation
Return values
selfsetUri()
Set the URI template of the command
public
setUri(string $uri) : self
Parameters
- $uri : string
-
URI template to set
Return values
selftoArray()
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