DataService/DataService.php
- Package
- Default
Package: DefaultThis file contains DataService performs CRUD operations on IPP REST APIs.
Properties



\IEntitySerializer $requestSerializer
Serializer needs to be used for request object
Details- Type
- \IEntitySerializer



\IEntitySerializer $responseSerializer
Serializer needs to be used fore responce object
Details- Type
- \IEntitySerializer



\ServiceContext $serviceContext
The Service context object.
Details- Type
- \ServiceContext
Methods



Add(\IPPIntuitEntity $entity) : \IPPIntuitEntity
Creates an entity under the specified realm. The realm must be set in the context.
ParametersName | Type | Description |
---|
$entity | \IPPIntuitEntity | Entity to Create. |
---|
ReturnsType | Description |
---|
\IPPIntuitEntity | Returns the created version of the entity. |



CDC( $entityList, $changedSince) : \IntuitCDCResponse
Returns List of entities changed after certain time.
ParametersName | Type | Description |
---|
$entityList | | |
---|
$changedSince | | |
---|
ReturnsType | Description |
---|
\IntuitCDCResponse | Returns an IntuitCDCResponse. |



Delete(\IPPIntuitEntity $entity) : void
Deletes an entity under the specified realm. The realm must be set in the context.
ParametersName | Type | Description |
---|
$entity | \IPPIntuitEntity | Entity to Delete. |
---|



Download(object $entity) : \IPPIntuitEntity
Returns an downloaded entity under the specified realm. The realm must be set in the context.
ParametersName | Type | Description |
---|
$entity | object | Entity to Find |
---|
ReturnsType | Description |
---|
\IPPIntuitEntity | Returns an entity of specified Id. |



DownloadPDF(\type $entity) : boolean
Returns PDF for entities which can be downloaded as PDF
ParametersName | Type | Description |
---|
$entity | \type | |
---|
ReturnsThrowsException | Description |
---|
\IdsException, | SdkException |



FindAll( $entityName, $pageNumber = 0, $pageSize = 500) : array
Retrieves specified entity based passed page number and page size
ParametersName | Type | Description |
---|
$entityName | | |
---|
$pageNumber | | |
---|
$pageSize | | |
---|
ReturnsType | Description |
---|
array | Returns an array of entities of specified type. |



FindById(object $entity) : \IPPIntuitEntity
Returns an entity under the specified realm. The realm must be set in the context.
ParametersName | Type | Description |
---|
$entity | object | Entity to Find |
---|
ReturnsType | Description |
---|
\IPPIntuitEntity | Returns an entity of specified Id. |



Query(string $query, string $pageNumber = 0, string $pageSize = 500) : array
Retrieves specified entities based passed page number and page size and query
ParametersName | Type | Description |
---|
$query | string | Query to issue |
---|
$pageNumber | string | Starting page number |
---|
$pageSize | string | Page size |
---|
ReturnsType | Description |
---|
array | Returns an array of entities fulfilling the query. |



Retrieve(object $entity) : \IPPIntuitEntity
Returns an entity under the specified realm. The realm must be set in the context.
ParametersName | Type | Description |
---|
$entity | object | Entity to Find |
---|
ReturnsType | Description |
---|
\IPPIntuitEntity | Returns an entity of specified Id. |



SendEmail(\type $entity, $email = null) : boolean
Returns PDF for entities which can be downloaded as PDF
ParametersName | Type | Description |
---|
$entity | \type | |
---|
$email | | |
---|
ReturnsThrowsException | Description |
---|
\IdsException, | SdkException |



Update(\IPPIntuitEntity $entity) : \IPPIntuitEntity
Updates an entity under the specified realm. The realm must be set in the context.
ParametersName | Type | Description |
---|
$entity | \IPPIntuitEntity | Entity to Update. |
---|
ReturnsType | Description |
---|
\IPPIntuitEntity | Returns an updated version of the entity with updated identifier and sync token. |



Upload(string $imgBits, string $fileName, string $mimeType, \IPPAttachable $objAttachable) : array
ParametersName | Type | Description |
---|
$imgBits | string | image bytes |
---|
$fileName | string | Filename to use for this file |
---|
$mimeType | string | MIME type to send in the HTTP Headers |
---|
$objAttachable | \IPPAttachable | entity describing the attachement |
---|
ReturnsType | Description |
---|
array | Returns an array of entities fulfilling the query. |



Void(\IPPIntuitEntity $entity) : void
Voids an entity under the specified realm. The realm must be set in the context.
ParametersName | Type | Description |
---|
$entity | \IPPIntuitEntity | Entity to Void. |
---|



__construct(\ServiceContext $serviceContext) : void
Initializes a new instance of the DataService class.
ParametersName | Type | Description |
---|
$serviceContext | \ServiceContext | IPP Service Context |
---|



cleanPhpClassNameToIntuitEntityName(string $phpClassName) : string
staticClean a POPO class name (like 'IPPClass') to be an IPP v3 Entity name (like 'Class')
ParametersName | Type | Description |
---|
$phpClassName | string | POPO class name |
---|
ReturnsType | Description |
---|
string | Intuit Entity name |



convertToTimestamp(\type $str) : integer
Parse input date-time string into unix timestamp
ParametersName | Type | Description |
---|
$str | \type | |
---|
ReturnsType | Description |
---|
integer | timestamp or false overwise |



decorateIntuitEntityToPhpClassName( $intuitEntityName) : \POPO
staticDecorate an IPP v3 Entity name (like 'Class') to be a POPO class name (like 'IPPClass')
ParametersName | Type | Description |
---|
$intuitEntityName | | |
---|
ReturnsType | Description |
---|
\POPO | class name |



executeObjectSerializer(\IPPIntuitEntity $entity, String $urlResource) : \type
Serializes oblect into specified format
ParametersName | Type | Description |
---|
$entity | \IPPIntuitEntity | |
---|
$urlResource | String | |
---|
Returns 


fixTaxServicePayload( $entity, $content) : void
Methods provides workaround to succesfully process TaxService response
ParametersName | Type | Description |
---|
$entity | | |
---|
$content | | |
---|



getExportFileNameForPDF(\type $entity, \type $ext, $usetimestamp = true) : \type
Returns PDF filename based on entity type and id
ParametersName | Type | Description |
---|
$entity | \type | |
---|
$ext | \type | |
---|
$usetimestamp | | |
---|
Returns 


getGetRequestParameters(string $uri, string $type) : \RequestParameters
Returns pre-defined request with GET method
ParametersName | Type | Description |
---|
$uri | string | |
---|
$type | string | |
---|
ReturnsType | Description |
---|
\RequestParameters | |



getPostJsonRequest(\type $uri) : \RequestParameters
Returns post request with pre-defined POST method and JSON serialization
ParametersName | Type | Description |
---|
$uri | \type | |
---|
ReturnsType | Description |
---|
\RequestParameters | |



getPostRequest(\type $uri) : \RequestParameters
Returns pre-defined request with POST method and content type from settings
ParametersName | Type | Description |
---|
$uri | \type | |
---|
ReturnsType | Description |
---|
\RequestParameters | |



getPostRequestParameters(string $uri, string $type) : \RequestParameters
Returns pre-defined request with POST method
ParametersName | Type | Description |
---|
$uri | string | |
---|
$type | string | |
---|
ReturnsType | Description |
---|
\RequestParameters | |



getRequestParameters(string $uri, string $method, string $type, string $apiName = null) : \RequestParameters
Wraps and returns RequestParameters object
ParametersName | Type | Description |
---|
$uri | string | |
---|
$method | string | |
---|
$type | string | |
---|
$apiName | string | |
---|
ReturnsType | Description |
---|
\RequestParameters | |



getRequestSerializer() : \IEntitySerializer
Returns serializer for request objects
ReturnsType | Description |
---|
\IEntitySerializer | |



getResponseSerializer() : \IEntitySerializer
Returns serializer for responce objects
ReturnsType | Description |
---|
\IEntitySerializer | |



getRestHandler() : \SyncRestHandler
Returns new instance of rest handler
ReturnsType | Description |
---|
\SyncRestHandler | |



getXmlFromObj(\POPOObject $phpObj) : string
Marshall a POPO object to XML, presumably for inclusion on an IPP v3 API call
This code is dead!
ParametersName | Type | Description |
---|
$phpObj | \POPOObject | inbound POPO object |
---|
ReturnsType | Description |
---|
string | XML output derived from POPO object |
Details- Depricated
-



handleTaxService(\IPPIntuitEntity $entity, string $uri) : string
Handles unusual URL mapping for TaxService
ParametersName | Type | Description |
---|
$entity | \IPPIntuitEntity | |
---|
$uri | string | |
---|
Returns 


initPostRequest(\type $entity, \type $uri) : \RequestParameters
Returns post request, depends on configuration and entity rule "jsonOnly"
ParametersName | Type | Description |
---|
$entity | \type | |
---|
$uri | \type | |
---|
ReturnsType | Description |
---|
\RequestParameters | |



isAllowed( $entity, $method) : void
Simple verification for entities which can be returned as PDF
ParametersName | Type | Description |
---|
$entity | | |
---|
$method | | |
---|



isJsonOnly(\type $entity) : boolean
Return true if specified entity can work with JSON only serialization
ParametersName | Type | Description |
---|
$entity | \type | |
---|
Returns 


isTaxServiceSafe(\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
ParametersName | Type | Description |
---|
$entity | \IPPTaxService | |
---|
Returns 


isValidTimeStamp( $timestamp) : void
Checks if input string is a valid timestamp or not
ParametersName | Type | Description |
---|
$timestamp | | |
---|



processDownloadedContent(\ContentWriter $writer, integer $responseCode, string $fileName = null) : mixed
Saves exported (e.g. check DownloadPDF) entity into file according to strategy in settings
ParametersName | Type | Description |
---|
$writer | \ContentWriter | |
---|
$responseCode | integer | |
---|
$fileName | string | |
---|
ReturnsType | Description |
---|
mixed | full path with filename or open handler |



verifyChangedSince(mixed $value) : integer
Verifies input and returns unix timestamp
ParametersName | Type | Description |
---|
$value | mixed | |
---|
Returns 


verifyEmailAddress(\type $email) : \type
Verifies string as email agains RFC 822
ParametersName | Type | Description |
---|
$email | \type | |
---|
Returns