Kayako User 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
Adds an e-mail to the list user e-mails.
addEmail(string $email, bool $clear)
Parameters
$email
string
E-mail address.
$clear
bool
Clear the list before adding.
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 user.
createNew(string $full_name, string $email, \kyUserGroup $user_group, string $password) : \kyUser
WARNING: Data is not sent to Kayako unless you explicitly call create() on this method's result.
Parameters
$full_name
string
Full name of new user.
$email
string
E-mail address of new user.
$password
string
Password of new user.
Returns
Deletes the object on the server.
delete()
Inherited
inherited_from |
\kyObjectBase::delete() |
Fetches the object from server.
get(int | array $id) : \kyObjectBase
Inherited
inherited_from |
\kyObjectBase::get() |
Parameters
$id
int
array
Object identifier or list of identifiers (ex. ticket identifier and ticket post identifier when fetching TicketPost).
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[]
Fetches all users.
getAll(int $starting_user_id, int $max_items) : \kyResultSet
Optionaly you can get segment of user objects by defining starting user identifier and maximum items count.
Parameters
$starting_user_id
int
Optional starting user identifier.
$max_items
int
Optional maximum items count. Defaults to 1000 when starting user is defined.
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 object controller.
getController() : string
Inherited
inherited_from |
\kyObjectBase::getController() |
Returns
string
Returns date and time when the user 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
Return designation of the user.
getDesignation() : string
Returns first e-mail from the list of user e-mails.
getEmail() : string
Returns list of user e-mails.
getEmails() : string[]
Returns whether the user has enabled daylight saving time.
getEnableDST() : bool
Returns full name of the user.
getFullName() : 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 the user is enabled.
getIsEnabled() : bool
Returns date and time when the user last logged in.
getLastVisit(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 phone number of the user.
getPhone() : string
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[]
Returns expiration date of Service Level Agreement plan assignment or null when expiration is disabled.
getSLAPlanExpiry(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
Return Service Level Agreement plan assigned to the user.
getSLAPlanId() : int
Returns salutation of the user.
getSalutation() : string
see |
\global\kyUser::SALUTATION |
filterBy |
|
orderBy |
|
Returns
string
Returns timezone of the user.
getTimezone() : string
Returns expiration date of the user or null when expiration is disabled.
getUserExpiry(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 user group of the user.
getUserGroup(bool $reload) : \kyUserGroup
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 user group identifier of the user.
getUserGroupId() : int
Returns user organization assigned to the user.
getUserOrganization(bool $reload) : \kyUserOrganization
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 identifier of user organization assigned to the user.
getUserOrganizationId() : int
Returns role of the user.
getUserRole() : string
see |
\global\kyUser:ROLE |
filterBy |
|
orderBy |
|
Returns
string
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 ticket with this User as the author.
newTicket(\kyDepartment $department, string $contents, string $subject) : \kyTicket
WARNING: Data is not sent to Kayako unless you explicitly call create() on this method's result.
Parameters
$department
\kyDepartment
Department where the ticket will be created.
$contents
string
Contents of the first post.
$subject
string
Subject of the ticket.
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
Searches for users.
search(string $query) : \kyResultSet
Performs server-side search of users. The search query is run against
email, full name, phone, organization name and user group.
Parameters
$query
string
The search query.
Returns
Sets designation of the user.
setDesignation(string $designation) : \kyUser
Parameters
$designation
string
Designation of the user.
Returns
Sets whether the user has enabled daylight saving time.
setEnableDST(bool $enable_dst) : \kyUser
Parameters
$enable_dst
bool
True, to enable daylight saving time. False, to disable daylight saving time.
Returns
Sets full name of the user.
setFullName(string $full_name) : \kyUser
Parameters
$full_name
string
Full name of the user.
Returns
Sets whether the user is enabled.
setIsEnabled(bool $is_enabled) : \kyUser
Parameters
$is_enabled
bool
True, to enable the user. False, to disable the user.
Returns
Sets password of the user.
setPassword(string $password) : \kyUser
Parameters
$password
string
Password of the user.
Returns
Sets phone number of the user.
setPhone(string $phone) : \kyUser
Parameters
$phone
string
Phone number of the user.
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 expiration date of Service Level Agreement plan assignment.
setSLAPlanExpiry(string | int | null $sla_plan_expiry) : \kyUser
see |
\global\http://www.php.net/manual/en/function.strtotime.php |
Parameters
$sla_plan_expiry
string
int
null
Date and time when Service Level Agreement plan for this user will expire (timestamp or string format understood by PHP strtotime). Null to disable expiration.
Returns
Sets identifier of the Service Level Agreement plan assigned to the user.
setSLAPlanId(int $sla_plan_id) : \kyUser
Parameters
$sla_plan_id
int
Service Level Agreement plan identifier.
Returns
Sets salutation of the user.
setSalutation(string $salutation) : \kyUser
see |
\global\kyUser::SALUTATION |
Parameters
$salutation
string
User salutation.
Returns
Sets whether to send welcome email to new user.
setSendWelcomeEmail(bool $send_welcome_email) : \kyUser
Parameters
$send_welcome_email
bool
True, to send welcome email to new user. False, otherwise.
Returns
Sets timezone of the user.
setTimezone(string $timezone) : \kyUser
See http://php.net/manual/en/timezones.php for list of available timezones.
Parameters
$timezone
string
Timezone of the user.
Returns
Sets expiration date of the user.
setUserExpiry(string | int | null $user_expiry) : \kyUser
see |
\global\http://www.php.net/manual/en/function.strtotime.php |
Parameters
$user_expiry
string
int
null
Date and time when the user will expire (timestamp or string format understood by PHP strtotime). Null to disable expiration.
Returns
Sets user group for the user.
setUserGroup(\kyUserGroup $user_group) : \kyUser
Sets user group identifier of the user.
setUserGroupId(int $user_group_id) : \kyUser
Parameters
$user_group_id
int
User group identifier.
Returns
Sets user organization assigned to the user.
setUserOrganization(\kyUserOrganization $user_organization) : \kyUser
Sets user organization assigned the user by its identifier.
setUserOrganizationId(int $user_organization_id) : \kyUser
Parameters
$user_organization_id
int
User organization identifier.
Returns
Sets role of the user.
setUserRole(string $user_role) : \kyUser
Parameters
$user_role
string
User role.
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
Inherited
inherited_from |
\kyObjectBase::update() |
Exceptions
Returns
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 |
Default Kayako controller used to operate on this objects.
$controller : string
Override in descending classes.
Timestamp of when the user was created.
$dateline : int
User designation.
$designation : string
List of user's e-mail addresses.
$email : string[]
apiField |
required_create=true |
If Daylight Saving Time is enabled for the user.
$enable_dst : bool
Full name of the user.
$full_name : string
User identifier.
$id : int
Whether this user is enabled.
$is_enabled : bool
Timestamp of when the user last visited support center.
$last_visit : int
Indicates the name of object element in XML response.
$object_xml_name : string
Override in descending classes.
User password.
$password : string
apiField |
required_create=true |
User phone number.
$phone : string
Controls if the object can be created/updated/deleted.
$read_only : bool
Inherited
Override in descending classes.
inherited_from |
\kyObjectBase::$$read_only |
User salutation.
$salutation : string
see |
\global\kyUser::SALUTATION |
apiField |
|
Whether welcome e-mail should be send upon creation of the user.
$send_welcome_email : bool
Timestamp of when the Service Level Agreement plan associated to this user will expire.
$sla_plan_expiry : int
Identifier of Service Level Agreement plan associated to this user.
$sla_plan_id : int
Timezone of the user.
$timezone : string
Timestamp of when the user will expire.
$user_expiry : int
User group identifier.
$user_group_id : int
apiField |
required_create=true |
User organization identifier.
$user_organization_id : int
User role.
$user_role : string
see |
\global\kyUser::ROLE |
apiField |
|
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 |
Constants
Data key for storing files to send as multipart/form-data.
FILES_DATA_NAME : string
Inherited
inherited_from |
\kyObjectBase::FILES_DATA_NAME |
ROLE_MANAGER
ROLE_MANAGER
SALUTATION_DR
SALUTATION_DR
SALUTATION_MISS
SALUTATION_MISS
SALUTATION_MR
SALUTATION_MR
SALUTATION_MRS
SALUTATION_MRS