BulkOperationInterface
in
Interface for element of bulk/concurrent call to the billing. Represents one API call task.
How it works:
- callConcurrent() crawl given iterable recursively to find all objects, implementing AsyncOperationInterface
- For each object, it will get the API endpoint by calling
getCallEndpoint()
and call params by callinggetCallParams()
- All the found array will be called in parallel with respect to desired concurrency level
- For each object:
- if the call was succed, the result will put to the object by call p rocessResponse()
- in a case of failure exception object will put to the object by calling processException()
Finally we have each object filled with call result, good or bad.
Table of Contents
- getCallEndpoint() : string|null
- Should return Billing API endpoint to call
- getCallParams() : array<string|int, mixed>
- Should return Billing API call params, which will be placed to { "params": /HERE/ } of API call.
- processException() : void
- Will be called on call failure with exception happened
- processResponse() : void
- Will be called on success with response data array
Methods
getCallEndpoint()
Should return Billing API endpoint to call
public
getCallEndpoint() : string|null
May retirn null to bypass billing call for this element if required
Return values
string|null —getCallParams()
Should return Billing API call params, which will be placed to { "params": /HERE/ } of API call.
public
getCallParams() : array<string|int, mixed>
Return values
array<string|int, mixed> —processException()
Will be called on call failure with exception happened
public
processException(PortaException $ex) : void
Parameters
- $ex : PortaException
-
exception, thrown while complete the call
Return values
void —processResponse()
Will be called on success with response data array
public
processResponse(array<string|int, mixed> $response) : void
Parameters
- $response : array<string|int, mixed>
-
the dataset, returned by billing