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



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



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



\ServiceContext $serviceContextThe Service context object.
Details- Type
- \ServiceContext
Methods



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



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



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



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



DownloadPDF(\type $entity) : booleanReturns PDF for entities which can be downloaded as PDF
Parameters| Name | Type | Description |
|---|
| $entity | \type | |
|---|
ReturnsThrows| Exception | Description |
|---|
| \IdsException, | SdkException |



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



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



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



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



SendEmail(\type $entity, $email = null) : booleanReturns PDF for entities which can be downloaded as PDF
Parameters| Name | Type | Description |
|---|
| $entity | \type | |
|---|
| $email | | |
|---|
ReturnsThrows| Exception | Description |
|---|
| \IdsException, | SdkException |



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



Upload(string $imgBits, string $fileName, string $mimeType, \IPPAttachable $objAttachable) : arrayParameters| Name | 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 |
|---|
Returns| Type | Description |
|---|
| array | Returns an array of entities fulfilling the query. |



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



__construct(\ServiceContext $serviceContext) : voidInitializes a new instance of the DataService class.
Parameters| Name | Type | Description |
|---|
| $serviceContext | \ServiceContext | IPP Service Context |
|---|



cleanPhpClassNameToIntuitEntityName(string $phpClassName) : stringstaticClean a POPO class name (like 'IPPClass') to be an IPP v3 Entity name (like 'Class')
Parameters| Name | Type | Description |
|---|
| $phpClassName | string | POPO class name |
|---|
Returns| Type | Description |
|---|
| string | Intuit Entity name |



convertToTimestamp(\type $str) : integerParse input date-time string into unix timestamp
Parameters| Name | Type | Description |
|---|
| $str | \type | |
|---|
Returns| Type | Description |
|---|
| integer | timestamp or false overwise |



decorateIntuitEntityToPhpClassName( $intuitEntityName) : \POPOstaticDecorate an IPP v3 Entity name (like 'Class') to be a POPO class name (like 'IPPClass')
Parameters| Name | Type | Description |
|---|
| $intuitEntityName | | |
|---|
Returns| Type | Description |
|---|
| \POPO | class name |



executeObjectSerializer(\IPPIntuitEntity $entity, String $urlResource) : \typeSerializes oblect into specified format
Parameters| Name | Type | Description |
|---|
| $entity | \IPPIntuitEntity | |
|---|
| $urlResource | String | |
|---|
Returns 


fixTaxServicePayload( $entity, $content) : voidMethods provides workaround to succesfully process TaxService response
Parameters| Name | Type | Description |
|---|
| $entity | | |
|---|
| $content | | |
|---|



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


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



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



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



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



getRequestParameters(string $uri, string $method, string $type, string $apiName = null) : \RequestParametersWraps and returns RequestParameters object
Parameters| Name | Type | Description |
|---|
| $uri | string | |
|---|
| $method | string | |
|---|
| $type | string | |
|---|
| $apiName | string | |
|---|
Returns| Type | Description |
|---|
| \RequestParameters | |



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



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



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



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



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


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



isAllowed( $entity, $method) : voidSimple verification for entities which can be returned as PDF
Parameters| Name | Type | Description |
|---|
| $entity | | |
|---|
| $method | | |
|---|



isJsonOnly(\type $entity) : booleanReturn true if specified entity can work with JSON only serialization
Parameters| Name | Type | Description |
|---|
| $entity | \type | |
|---|
Returns 


isTaxServiceSafe(\IPPTaxService $entity) : \typeVerifies that entity has TaxService type
If this class is not available on include_path or wab't loaded the method will return false
Parameters| Name | Type | Description |
|---|
| $entity | \IPPTaxService | |
|---|
Returns 


isValidTimeStamp( $timestamp) : voidChecks if input string is a valid timestamp or not
Parameters| Name | Type | Description |
|---|
| $timestamp | | |
|---|



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



verifyChangedSince(mixed $value) : integerVerifies input and returns unix timestamp
Parameters| Name | Type | Description |
|---|
| $value | mixed | |
|---|
Returns 


verifyEmailAddress(\type $email) : \typeVerifies string as email agains RFC 822
Parameters| Name | Type | Description |
|---|
| $email | \type | |
|---|
Returns