Kayako TicketPost object.
All objects interacting with Kayako REST API should extend this class and
define:
* Kayako controller
* XML element name holding object's data in REST response
Methods
Default constructor.
__construct(array $data)
Inherited
inherited_from |
\kyObjectBase::__construct() |
Parameters
$data
array
Object data from XML response converted into array.
Returns API field value.
__get(string $api_field_name) : mixed
Inherited
Returns API field value based on API field name used by Kayako.
Parameters
$api_field_name
string
API field name.
Returns
mixed
Sets API field value.
__set(string $api_field_name, mixed $value) : mixed
Inherited
Sets API field value based on API field name used by Kayako.
Parameters
$api_field_name
string
API field name.
$value
mixed
API field value.
Returns
mixed
Returns object description with it's type and identifier.
__toString() : string
Inherited
Calls toString() method to get the object description.
inherited_from |
\kyObjectBase::__toString() |
Returns
string
Should build the array of object data for creating or updating the object.
buildData(bool $create) : array
Values must be set in format accepted by REST API.
Parameters
$create
bool
Indicates if the result will be used to create (true) or update (false) an object.
Returns
array
Checks wheter this object has all required fields set.
checkRequiredAPIFields(bool $create, bool $throw_exception) : string[] | bool
Inherited
inherited_from |
\kyObjectBase::checkRequiredAPIFields() |
Parameters
$create
bool
True when object will be created. False when object will be updated.
$throw_exception
bool
True to throw an exception on missing fields. False to return list of missing fields or true when there are none.
Exceptions
\kyException |
When there are missing field values and $throw_exception is true. |
Returns
string[]
bool
List of missing API fields or true when there are none.
Creates an object on the server and refreshes its local data.
create() : \kyObjectBase
Inherited
inherited_from |
\kyObjectBase::create() |
Exceptions
Returns
Creates new ticket post.
createNew(\kyTicket $ticket, \kyUser | \kyStaff $creator, string $contents) : \kyTicketPost
WARNING: Data is not sent to Kayako unless you explicitly call create() on this method's result.
Parameters
$ticket
\kyTicket
Ticket in which to create the post.
$contents
string
Contents of new post.
Returns
Deletes the object on the server.
delete()
Returns ticket post.
get(int $ticket_id, int $id) : \kyTicketPost
Parameters
$ticket_id
int
Ticket identifier.
$id
int
Ticket post identifier.
Returns
Returns array of API fields.
getAPIFields() : string[]
Inherited
Format of returned array:
array(
'' => Field description. (getter: , setter: ),
...repeat...
)
inherited_from |
\kyObjectBase::getAPIFields() |
Returns
string[]
Returns all posts of the ticket.
getAll(int $ticket_id) : \kyResultSet
Parameters
$ticket_id
int
Ticket identifier.
Returns
Returns list of attachments in this post.
getAttachments(bool $reload) : \kyResultSet
Result is cached.
Parameters
$reload
bool
True to reload attachments from server.
Returns
Returns list of available filter methods for use in result sets with objects of this type.
getAvailableFilterMethods(bool $filter_names_only) : array
Inherited
Optionaly you can return get method names used to filter objects.
inherited_from |
\kyObjectBase::getAvailableFilterMethods() |
Parameters
$filter_names_only
bool
True (default) to return array('filterByXXX', 'filterByYYY', ...). False to return array('filterByXXX' => 'getXXX', 'filterByYYY' => 'YYY', ...).
Returns
array
Returns list of available order methods for use in result sets with objects of this type.
getAvailableOrderMethods(bool $order_names_only) : array
Inherited
Optionaly you can return get method names used to order objects.
inherited_from |
\kyObjectBase::getAvailableOrderMethods() |
Parameters
$order_names_only
bool
True (default) to return array('orderByXXX', 'orderByYYY', ...). False to return array('orderByXXX' => 'getXXX', 'orderByYYY' => 'YYY', ...).
Returns
array
Returns contents of this post.
getContents() : string
Returns object controller.
getController() : string
Inherited
inherited_from |
\kyObjectBase::getController() |
Returns
string
Returns creator of this post (User or Staff).
getCreator() : \kyUser | \kyStaff
Returns type of this ticket post creator.
getCreatorType() : int
see |
\global\kyTicketPost::CREATOR |
filterBy |
|
orderBy |
|
Returns
int
Returns date and time this post was created.
getDateline(string $format) : string
see |
\global\http://www.php.net/manual/en/function.date.php |
filterBy |
|
orderBy |
|
Parameters
$format
string
Output format of the date. If null the format set in client configuration is used.
Returns
string
Returns the email address of the person who created the ticket post.
getEmail() : string
Returns the email address of the user associated with the ticket.
getEmailTo() : string
Applicable when the 'send email' option is used by the a staff user when creating the ticket post.
Returns
string
Returns the full name of the person who created the ticket post.
getFullName() : string
Returns whether this ticket post has attachments.
getHasAttachments() : bool
Returns IP address from which this post was created.
getIPAddress() : string
Should return object identifier or complete list of identifiers as needed by API to identify the object (ex.
getId(bool $complete) : int | array
ticket identifier and ticket post identifier in case of TicketPost).
Parameters
$complete
bool
True to return complete list of identifiers as needed by API to identify the object.
Returns
int
array
Returns whether this post was created through an email queue.
getIsEmailed() : bool
Returns whether this ticket post contains HTML data.
getIsHTML() : bool
Returns whether the ticket post was created as private (hidden from the customer) or not.
getIsPrivate() : bool
Returns whether this post was created by owner of e-mail marked as Third Party in ticket properties.
getIsThirdParty() : bool
Returns list of required API fields for objects of this class.
getRequiredAPIFields(bool $create) : string[]
Inherited
inherited_from |
\kyObjectBase::getRequiredAPIFields() |
Parameters
$create
bool
True when object will be created. False when object will be updated.
Returns
string[]
Gets the staff user, the creator of this ticket post.
getStaff(bool $reload) : \kyStaff
Parameters
$reload
bool
True to reload data from server. False to use the cached value (if present).
Returns
Returns identifier of staff user, the creator of this post.
getStaffId() : int
Returns subject of this post.
getSubject() : string
Returns the ticket that this post is connected with.
getTicket(bool $reload) : \kyTicket
Result is cached until the end of script.
Parameters
$reload
bool
True to reload data from server. False to use the cached value (if present).
Returns
Returns the ticket identifier.
getTicketId() : int
Gets the user, the creator of this ticket post.
getUser(bool $reload) : \kyUser
Parameters
$reload
bool
True to reload data from server. False to use the cached value (if present).
Returns
Returns identifier of the user, the creator of this post.
getUserId() : int
Returns whether the object is new and not yet saved on the server.
isNew() : bool
Inherited
inherited_from |
\kyObjectBase::isNew() |
Returns
bool
Returns whether this object is read only.
isReadOnly() : bool
Inherited
inherited_from |
\kyObjectBase::isReadOnly() |
Returns
bool
Creates new attachment in this post with contents provided as parameter.
newAttachment(string $contents, string $file_name) : \kyTicketAttachment
WARNING: Data is not sent to Kayako unless you explicitly call create() on this method's result.
Parameters
$contents
string
Raw contents of the file.
$file_name
string
Filename.
Returns
Creates new attachment in this post with contents read from physical file.
newAttachmentFromFile(string $file_path, string $file_name) : \kyTicketAttachment
WARNING: Data is not sent to Kayako unless you explicitly call create() on this method's result.
Parameters
$file_path
string
Path to file.
$file_name
string
Optional. Use to set filename other than physical file.
Returns
Refreshes the object data from server.
refresh() : \kyObjectBase
Inherited
inherited_from |
\kyObjectBase::refresh() |
Exceptions
Returns
Saves (creates or updates) the object to the server.
save() : \kyObjectBase
Inherited
inherited_from |
\kyObjectBase::save() |
Returns
Sets contents of this post.
setContents(string $contents) : \kyTicketPost
Parameters
$contents
string
Post contents.
Returns
Sets the creator (User or Staff) of this post.
setCreator(int | \kyUser | \kyStaff $creator, int $type) : \kyTicketPost
see |
\global\kyTicketPost::CREATOR |
Parameters
$creator
int
\kyUser
\kyStaff
User identifier OR staff identifier OR user OR staff user.
$type
int
Creator type. Required only when $creator is an identifier.
Returns
Sets whether the ticket post should be created as private (hidden from the customer) or not.
setIsPrivate(bool $is_private) : \kyTicketPost
Parameters
$is_private
bool
Whether the ticket post should be created as private (hidden from the customer) or not.
Returns
Sets whether this object is read only.
setReadOnly(bool $read_only) : bool
Inherited
inherited_from |
\kyObjectBase::setReadOnly() |
Parameters
$read_only
bool
Read only flag.
Returns
bool
Sets identifier of staff user, the creator of this post.
setStaffId(int $staff_id) : \kyTicketPost
Parameters
$staff_id
int
Staff user identifier.
Returns
Sets subject of this post.
setSubject(string $subject) : \kyTicketPost
Parameters
$subject
string
Post subject.
Returns
Sets the ticket identifier.
setTicketId(int $ticket_id) : \kyTicketPost
Parameters
$ticket_id
int
Ticket identifier.
Returns
Sets identifier of the user, the creator of this post.
setUserId(int $user_id) : \kyTicketPost
Parameters
$user_id
int
User identifier.
Returns
Should return short (one line) description of the object (it's title, name, etc.).
toString() : string
Updates the object on the server and refreshes its local data.
update() : \kyObjectBase
Returns REST client.
getRESTClient() : \kyRESTClientInterface
Inherited
inherited_from |
\kyObjectBase::getRESTClient() |
Returns
Should use passed data to fill object properties.
parseData(array $data)
Parameters
$data
array
Object data from XML response.
Builds API fields list.
initAPIFieldsAccessors()
Inherited
Scans protected and private properties of called class, searches for
apiField |
[name=field name] [accessor=setter/getter name] [getter=getter name] [setter=setter name] [required_create=true if field if required when creating object] [required_update=true if field if required when udpating object] [required=true if field if required when creating or updating object]
and builds API field list with property name, description, setter and getter method names, and required flags. |
see |
\global\kyObjectBase::$_api_fields |
inherited_from |
\kyObjectBase::initAPIFieldsAccessors() |
Properties
Cache for available filter methods.
$_filter_methods : string[]
Inherited
Format:
array(
'' => array(
'' => '',
...repeat for every filtering enabled method...
),
...repeat for every object class...
)
inherited_from |
\kyObjectBase::$$_filter_methods |
Cache for available order methods.
$_order_methods : string[]
Inherited
Format:
array(
'' => array(
'' => '',
...repeat for every ordering enabled method...
),
...repeat for every object class...
)
inherited_from |
\kyObjectBase::$$_order_methods |
Ticket post contents.
$contents : string
apiField |
required_create=true |
Default Kayako controller used to operate on this objects.
$controller : string
Override in descending classes.
Type of this ticket post creator.
$creator : int
see |
\global\kyTicketPost::CREATOR |
apiField |
getter=getCreatorType |
Timestamp of creation date and time.
$dateline : int
The email address of the person who created the ticket post.
$email : string
The email address of the user associated with the ticket.
$email_to : string
Applicable when the 'send email' option is used by the a staff user when creating the ticket post.
The full name of the person who created the ticket post.
$full_name : int
Whether this ticket post has attachments.
$has_attachments : bool
Ticket post identifier.
$id : int
IP address from which this post was created.
$ip_address : string
Whether this post was created through an email queue.
$is_emailed : bool
Whether this ticket post contains HTML data.
$is_html : bool
Whether the ticket post should be created as private (hidden from the customer) or not.
$is_private : bool
Whether this post was created by owner of e-mail marked as Third Party in ticket properties.
$is_third_party : bool
Indicates the name of object element in XML response.
$object_xml_name : string
Override in descending classes.
Controls if the object can be created/updated/deleted.
$read_only : bool
Inherited
Override in descending classes.
inherited_from |
\kyObjectBase::$$read_only |
Staff user identifier.
$staff_id : int
Applicable if the post was created by staff user.
The subject this ticket post.
$subject : string
If the ticket post was created through an e-mail queue this is subject of the email message that resulted in the creation of the post.
Ticket identifier.
$ticket_id : int
apiField |
required_create=true |
Identifier of the user who created this post.
$user_id : int
Applicable if the post was created by a known user through an email queue or through the web interface.
Cache for API fields.
$_api_fields : array
Inherited
Format:
array(
'' => array(
'' => array(
'property' => '',
'description' => '',
'getter' => '',
'setter' => '',
'required_create' => ,
'required_update' =>
),
...repeat for every class api field...
),
...repeat for every object class...
)
inherited_from |
\kyObjectBase::$$_api_fields |
Staff user, the creator of this post.
$staff : \kyStaff
Applicable if the post was created by staff user.
Ticket that this post is connected to.
$ticket : \kyTicket
User, the creator of this post.
$user : \kyUser
Constants
Post creator type - owner of e-mail marked as BCC in ticket properties.
CREATOR_BCC : int
Post creator type - owner of e-mail marked as CC in ticket properties.
CREATOR_CC : int
Post creator type - user.
CREATOR_CLIENT : int
Post creator type - staff user.
CREATOR_STAFF : int
Post creator type - owner of e-mail marked as Third Party in ticket properties.
CREATOR_THIRDPARTY : int
Post creator type - user.
CREATOR_USER : int
Data key for storing files to send as multipart/form-data.
FILES_DATA_NAME : string
Inherited
inherited_from |
\kyObjectBase::FILES_DATA_NAME |
Whether this post is a survey comment.