Kayako Staff 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

author Tomasz Sawicki (https://github.com/Furgas)
link http://wiki.kayako.com/display/DEV/REST+-+Staff
since Kayako version 4.01.204
package Object\Staff

 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.

link http://wiki.kayako.com/display/DEV/REST+API+Reference
inherited_from \kyObjectBase::__get()

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.

link http://wiki.kayako.com/display/DEV/REST+API+Reference
inherited_from \kyObjectBase::__set()

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[]boolList 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

\BadMethodCallException
\kyException

Returns

Creates new staff user.

createNew(string $first_name, string $last_name, string $user_name, string $email, \kyStaffGroup $staff_group, string $password) : \kyStaff

WARNING: Data is not sent to Kayako unless you explicitly call create() on this method's result.

Parameters

$first_name

string

First name of new staff user.

$last_name

string

Last name of new staff user.

$user_name

string

Login username of new staff user.

$email

string

E-mail address of new staff user.

$staff_group

\kyStaffGroup

Staff group of new staff user.

$password

string

Password for new staff 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

intarray

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 objects from server.

getAll(array $search_parameters) : \kyResultSet
Inherited

inherited_from \kyObjectBase::getAll()

Parameters

$search_parameters

array

Optional. Additional search parameters.

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 designation of the staff user.

getDesignation() : string

filterBy
orderBy

Returns

string

Returns e-mail address of the staff user.

getEmail() : string

filterBy
orderBy

Returns

string

Returns whether Daylight Saving Time is enabled for the staff user.

getEnableDST() : bool

filterBy

Returns

bool

Returns first name of the staff user.

getFirstName() : string

filterBy
orderBy

Returns

string

Returns full name of the staff user.

getFullName() : string

filterBy
orderBy

Returns

string

Returns default greeting message when the staff user accepts a live chat request.

getGreeting() : string

filterBy

Returns

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

intarray

Returns whether the staff user is enabled.

getIsEnabled() : bool

filterBy
orderBy

Returns

bool

Returns last name of the staff user.

getLastName() : string

filterBy
orderBy

Returns

string

Returns mobile number of the staff user.

getMobileNumber() : string

filterBy

Returns

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 signature that will be appended to each reply made by the staff user.

getSignature() : string

The value is not available when the object was fetched from the server.

Returns

string

Returns staff group of the staff user.

getStaffGroup(bool $reload) : \kyStaffGroup

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 staff group identifier of the staff user.

getStaffGroupId() : int

filterBy
orderBy

Returns

int

Returns timezone of the staff user.

getTimezone() : string

Returns

string

Returns login username of the staff user.

getUserName() : string

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 staff 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

\BadMethodCallException

Returns

Saves (creates or updates) the object to the server.

save() : \kyObjectBase
Inherited

inherited_from \kyObjectBase::save()

Returns

Sets designation of the staff user.

setDesignation(string $designation) : \kyStaff

Parameters

$designation

string

Designation of the staff user.

Returns

Sets e-mail address of the staff user.

setEmail(string $email) : \kyStaff

Parameters

$email

string

E-mail address of the staff user.

Returns

Sets whether Daylight Saving Time is enabled for the staff user.

setEnableDST(bool $enable_dst) : \kyStaff

True is the default value when creating new staff user.

Parameters

$enable_dst

bool

True to enable Daylight Saving Time for the staff user. False to disable.

Returns

Sets first name of the staff user.

setFirstName(string $first_name) : \kyStaff

Parameters

$first_name

string

First name of the staff user.

Returns

Sets default greeting message when the staff user accepts a live chat request.

setGreeting(string $greeting) : \kyStaff

Parameters

$greeting

string

Default greeting message when the staff user accepts a live chat request.

Returns

Sets whether the staff user is enabled.

setIsEnabled(bool $is_enabled) : \kyStaff

True is the default value when creating new staff user.

Parameters

$is_enabled

bool

True to enable the staff user. False to disable.

Returns

Sets last name of the staff user.

setLastName(string $last_name) : \kyStaff

Parameters

$last_name

string

Last name of the staff user.

Returns

Sets mobile number of the staff user.

setMobileNumber(string $mobile_number) : \kyStaff

Parameters

$mobile_number

string

Mobile number of the staff user.

Returns

Sets password for the staff user.

setPassword(string $password) : \kyStaff

Parameters

$password

string

Password for the staff 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 signature that wil be appended to each reply made by the staff user.

setSignature(string $signature) : \kyStaff

Parameters

$signature

string

Signature that will be appended to each reply made by the staff user.

Returns

Sets staff group for the staff user.

setStaffGroup(\kyStaffGroup $staff_group) : \kyStaff

Parameters

$staff_group

\kyStaffGroup

Staff group object.

Returns

Sets staff group identifier for the staff user.

setStaffGroupId(int $staff_group_id) : \kyStaff

Parameters

$staff_group_id

int

Staff group identifier.

Returns

Sets timezone of the staff user.

setTimezone(string $timezone) : \kyStaff

filterBy

Parameters

$timezone

string

Timezone of the staff user.

Returns

Sets login username of the staff user.

setUserName(string $user_name) : \kyStaff

Parameters

$user_name

string

Login username of the staff user.

Returns

Should return short (one line) description of the object (it's title, name, etc.).

toString() : string

Returns

string

Updates the object on the server and refreshes its local data.

update() : \kyObjectBase
Inherited

inherited_from \kyObjectBase::update()

Exceptions

\BadMethodCallException
\kyException

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.

 

Staff designation.

$designation : string

apiField
 

Staff e-mail.

$email : string

apiField required_create=true
 

Is Daylight Saving Time enabled.

$enable_dst : bool

apiField
 

Staff first name.

$first_name : string

apiField required=true
 

Staff full name.

$full_name : string

apiField
 

Staff livechat greeting message.

$greeting : string

apiField
 

Staff identifier.

$id : int

apiField
 

Is this staff enabled.

$is_enabled : bool

apiField
 

Staff last name.

$last_name : string

apiField required=true
 

Staff mobile number.

$mobile_number : string

apiField
 

Indicates the name of object element in XML response.

$object_xml_name : string

Override in descending classes.

 

Staff password.

$password : string

apiField required_create=true
 

Controls if the object can be created/updated/deleted.

$read_only : bool
Inherited

Override in descending classes.

inherited_from \kyObjectBase::$$read_only
 

Staff signature appended to posts.

$signature : string

apiField
 

Staff group identifier.

$staff_group_id : int

apiField required_create=true
 

Staff timezone.

$timezone : string

apiField
 

Staff username (login).

$user_name : string

apiField required_create=true
 

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 group.

$staff_group : \kyStaffGroup

 Constants

 

Data key for storing files to send as multipart/form-data.

FILES_DATA_NAME : string
Inherited

inherited_from \kyObjectBase::FILES_DATA_NAME