DataService/DataService.phpView Source

Show: PublicProtectedPrivateinherited
Table of Contents
Package
Default  

\DataService

Package: Default
This file contains DataService performs CRUD operations on IPP REST APIs.

Properties

>VPropertyprivate\IEntitySerializer $requestSerializer
Serializer needs to be used for request object
Details
Type
\IEntitySerializer
>VPropertyprivate\IEntitySerializer $responseSerializer
Serializer needs to be used fore responce object
Details
Type
\IEntitySerializer
>VPropertyprivate\IRestHandler $restHandler
Rest Request Handler.
Details
Type
\IRestHandler
>VPropertyprivate\ServiceContext $serviceContext
The Service context object.
Details
Type
\ServiceContext
>VPropertyprivateboolean $verbose
If true, indicates a desire to echo verbose output
Details
Type
boolean

Methods

methodpublicAdd(\IPPIntuitEntity $entity) : \IPPIntuitEntity

Creates an entity under the specified realm. The realm must be set in the context.

Parameters
NameTypeDescription
$entity\IPPIntuitEntity

Entity to Create.

Returns
TypeDescription
\IPPIntuitEntityReturns the created version of the entity.
methodpublicCDC( $entityList,  $changedSince) : \IntuitCDCResponse

Returns List of entities changed after certain time.

Parameters
NameTypeDescription
$entityList
$changedSince
Returns
TypeDescription
\IntuitCDCResponseReturns an IntuitCDCResponse.
methodpublicCreateNewBatch() : \Batch

Creates new batch

Returns
TypeDescription
\Batchreturns the batch object
methodpublicDelete(\IPPIntuitEntity $entity) : void

Deletes an entity under the specified realm. The realm must be set in the context.

Parameters
NameTypeDescription
$entity\IPPIntuitEntity

Entity to Delete.

methodpublicDownload(object $entity) : \IPPIntuitEntity

Returns an downloaded entity under the specified realm. The realm must be set in the context.

Parameters
NameTypeDescription
$entityobject

Entity to Find

Returns
TypeDescription
\IPPIntuitEntityReturns an entity of specified Id.
methodpublicDownloadPDF(\type $entity) : boolean

Returns PDF for entities which can be downloaded as PDF

Parameters
NameTypeDescription
$entity\type
Returns
TypeDescription
boolean
Throws
ExceptionDescription
\IdsException,SdkException
methodpublicFindAll( $entityName,  $pageNumber = 0,  $pageSize = 500) : array

Retrieves specified entity based passed page number and page size

Parameters
NameTypeDescription
$entityName
$pageNumber
$pageSize
Returns
TypeDescription
arrayReturns an array of entities of specified type.
methodpublicFindById(object $entity) : \IPPIntuitEntity

Returns an entity under the specified realm. The realm must be set in the context.

Parameters
NameTypeDescription
$entityobject

Entity to Find

Returns
TypeDescription
\IPPIntuitEntityReturns an entity of specified Id.
methodpublicQuery(string $query, string $pageNumber = 0, string $pageSize = 500) : array

Retrieves specified entities based passed page number and page size and query

Parameters
NameTypeDescription
$querystring

Query to issue

$pageNumberstring

Starting page number

$pageSizestring

Page size

Returns
TypeDescription
arrayReturns an array of entities fulfilling the query.
methodpublicRetrieve(object $entity) : \IPPIntuitEntity

Returns an entity under the specified realm. The realm must be set in the context.

Parameters
NameTypeDescription
$entityobject

Entity to Find

Returns
TypeDescription
\IPPIntuitEntityReturns an entity of specified Id.
methodpublicSendEmail(\type $entity,  $email = null) : boolean

Returns PDF for entities which can be downloaded as PDF

Parameters
NameTypeDescription
$entity\type
$email
Returns
TypeDescription
boolean
Throws
ExceptionDescription
\IdsException,SdkException
methodpublicUpdate(\IPPIntuitEntity $entity) : \IPPIntuitEntity

Updates an entity under the specified realm. The realm must be set in the context.

Parameters
NameTypeDescription
$entity\IPPIntuitEntity

Entity to Update.

Returns
TypeDescription
\IPPIntuitEntityReturns an updated version of the entity with updated identifier and sync token.
methodpublicUpload(string $imgBits, string $fileName, string $mimeType, \IPPAttachable $objAttachable) : array

Uploads an image

Parameters
NameTypeDescription
$imgBitsstring

image bytes

$fileNamestring

Filename to use for this file

$mimeTypestring

MIME type to send in the HTTP Headers

$objAttachable\IPPAttachable

entity describing the attachement

Returns
TypeDescription
arrayReturns an array of entities fulfilling the query.
methodpublicVoid(\IPPIntuitEntity $entity) : void

Voids an entity under the specified realm. The realm must be set in the context.

Parameters
NameTypeDescription
$entity\IPPIntuitEntity

Entity to Void.

methodpublic__construct(\ServiceContext $serviceContext) : void

Initializes a new instance of the DataService class.

Parameters
NameTypeDescription
$serviceContext\ServiceContext

IPP Service Context

methodprivatecleanPhpClassNameToIntuitEntityName(string $phpClassName) : string
static

Clean a POPO class name (like 'IPPClass') to be an IPP v3 Entity name (like 'Class')

Parameters
NameTypeDescription
$phpClassNamestring

POPO class name

Returns
TypeDescription
stringIntuit Entity name
methodprivateconvertToTimestamp(\type $str) : integer

Parse input date-time string into unix timestamp

Parameters
NameTypeDescription
$str\type
Returns
TypeDescription
integertimestamp or false overwise
methodprivatedecorateIntuitEntityToPhpClassName( $intuitEntityName) : \POPO
static

Decorate an IPP v3 Entity name (like 'Class') to be a POPO class name (like 'IPPClass')

Parameters
NameTypeDescription
$intuitEntityName
Returns
TypeDescription
\POPOclass name
methodprotectedexecuteObjectSerializer(\IPPIntuitEntity $entity, String $urlResource) : \type

Serializes oblect into specified format

Parameters
NameTypeDescription
$entity\IPPIntuitEntity
$urlResourceString
Returns
TypeDescription
\type
methodprivatefixTaxServicePayload( $entity,  $content) : void

Methods provides workaround to succesfully process TaxService response

Parameters
NameTypeDescription
$entity
$content
methodpublicforceJsonSerializers() : void

Force json serializers for request and response

methodprivategetContentType() : string

Returns content type depends from seriaization format

Returns
TypeDescription
string
methodprivategetEntityResourceName( $entity) : void
static

Parameters
NameTypeDescription
$entity
methodpublicgetExportFileNameForPDF(\type $entity, \type $ext,  $usetimestamp = true) : \type

Returns PDF filename based on entity type and id

Parameters
NameTypeDescription
$entity\type
$ext\type
$usetimestamp
Returns
TypeDescription
\type
methodprivategetFileExportDir() : string

Returns path to directory where SDK should save files

Returns
TypeDescription
string
methodprivategetGetRequestParameters(string $uri, string $type) : \RequestParameters

Returns pre-defined request with GET method

Parameters
NameTypeDescription
$uristring
$typestring
Returns
TypeDescription
\RequestParameters
methodpublicgetMinorVersion() : void

methodprivategetPostJsonRequest(\type $uri) : \RequestParameters

Returns post request with pre-defined POST method and JSON serialization

Parameters
NameTypeDescription
$uri\type
Returns
TypeDescription
\RequestParameters
methodprivategetPostRequest(\type $uri) : \RequestParameters

Returns pre-defined request with POST method and content type from settings

Parameters
NameTypeDescription
$uri\type
Returns
TypeDescription
\RequestParameters
methodprivategetPostRequestParameters(string $uri, string $type) : \RequestParameters

Returns pre-defined request with POST method

Parameters
NameTypeDescription
$uristring
$typestring
Returns
TypeDescription
\RequestParameters
methodprivategetPrefixFromSettings() : string

Returns prefix for contentWriter

Returns
TypeDescription
string
methodprotectedgetRequestParameters(string $uri, string $method, string $type, string $apiName = null) : \RequestParameters

Wraps and returns RequestParameters object

Parameters
NameTypeDescription
$uristring
$methodstring
$typestring
$apiNamestring
Returns
TypeDescription
\RequestParameters
methodprotectedgetRequestSerializer() : \IEntitySerializer

Returns serializer for request objects

Returns
TypeDescription
\IEntitySerializer
methodprotectedgetResponseSerializer() : \IEntitySerializer

Returns serializer for responce objects

Returns
TypeDescription
\IEntitySerializer
methodprotectedgetRestHandler() : \SyncRestHandler

Returns new instance of rest handler

Returns
TypeDescription
\SyncRestHandler
methodprotectedgetSerializationFormat() : string

Returns current serialization format

Returns
TypeDescription
string
methodprivategetXmlFromObj(\POPOObject $phpObj) : string

Marshall a POPO object to XML, presumably for inclusion on an IPP v3 API call

This code is dead!
Parameters
NameTypeDescription
$phpObj\POPOObject

inbound POPO object

Returns
TypeDescription
stringXML output derived from POPO object
Details
Depricated
 
methodprivatehandleTaxService(\IPPIntuitEntity $entity, string $uri) : string

Handles unusual URL mapping for TaxService

Parameters
NameTypeDescription
$entity\IPPIntuitEntity
$uristring
Returns
TypeDescription
string
methodprotectedinitPostRequest(\type $entity, \type $uri) : \RequestParameters

Returns post request, depends on configuration and entity rule "jsonOnly"

Parameters
NameTypeDescription
$entity\type
$uri\type
Returns
TypeDescription
\RequestParameters
methodprivateisAllowed( $entity,  $method) : void

Simple verification for entities which can be returned as PDF

Parameters
NameTypeDescription
$entity
$method
methodprivateisFileExport() : boolean

Returns true if SDK is configured to export files to another location

Returns
TypeDescription
boolean
methodprivateisJsonOnly(\type $entity) : boolean

Return true if specified entity can work with JSON only serialization

Parameters
NameTypeDescription
$entity\type
Returns
TypeDescription
boolean
methodprivateisReturnContentWriter() : boolean

Returns true or false if writer object is allowed as return result

Returns
TypeDescription
boolean
methodprivateisTaxServiceSafe(\IPPTaxService $entity) : \type

Verifies that entity has TaxService type If this class is not available on include_path or wab't loaded the method will return false

Parameters
NameTypeDescription
$entity\IPPTaxService
Returns
TypeDescription
\type
methodprivateisTempFile() : boolean

Returns true if SDK is configured to save temporary files

Returns
TypeDescription
boolean
methodpublicisValidTimeStamp( $timestamp) : void

Checks if input string is a valid timestamp or not

Parameters
NameTypeDescription
$timestamp
methodprivatelogError( $message) : void

Parameters
NameTypeDescription
$message
methodprivatelogInfo( $message) : void

Parameters
NameTypeDescription
$message
methodprotectedprocessDownloadedContent(\ContentWriter $writer, integer $responseCode, string $fileName = null) : mixed

Saves exported (e.g. check DownloadPDF) entity into file according to strategy in settings

Parameters
NameTypeDescription
$writer\ContentWriter
$responseCodeinteger
$fileNamestring
Returns
TypeDescription
mixedfull path with filename or open handler
methodpublicsetupSerializers() : void

Setups serializers objects for responces and requests based on service context

methodprivateuseMinorVersion() : void

methodprivatevalidateEntityId( $entity) : void

Parameters
NameTypeDescription
$entity
methodprotectedverifyChangedSince(mixed $value) : integer

Verifies input and returns unix timestamp

Parameters
NameTypeDescription
$valuemixed
Returns
TypeDescription
integer
methodpublicverifyEmailAddress(\type $email) : \type

Verifies string as email agains RFC 822

Parameters
NameTypeDescription
$email\type
Returns
TypeDescription
\type
methodprivateverifyOperationAccess( $entity,  $func) : void

Parameters
NameTypeDescription
$entity
$func
Documentation was generated by phpDocumentor 2.8.5.