PHP Class Kimai_Remote_Api

Every public method in here, will be available for SOAP/JSON Requests and auto-discovered for WSDL queries.
Mostrar archivo Open project: kimai/kimai

Public Methods

Method Description
__construct ( )
authenticate ( string $username, string $password ) : array Authenticates a user and returns the API key.
getActiveRecording ( string $apiKey ) : array Returns an array with values of the currently active recording.
getCustomers ( string $apiKey ) : array | boolean Return a list of customers. A customer can only see himself.
getExpenseRecord ( string $apiKey, integer $id ) : array
getExpenses ( string $apiKey, integer $from, integer $to, integer $refundable, integer $cleared, integer $start, integer $limit ) : array Returns a list of expenses.
getProjects ( string $apiKey, $includeTasks = false ) : array | boolean Return a list of projects. Customers are only shown their projects.
getTasks ( string $apiKey, integer | array $projectId = null ) : array | boolean Return a list of tasks. Customers are only shown tasks which are used for them. If a project is set as filter via the project parameter only tasks for that project are shown.
getTimesheet ( string $apiKey, integer $from, integer $to, integer $cleared, integer $start, integer $limit ) : array Returns a list of recorded times.
getTimesheetRecord ( string $apiKey, integer $id ) : array
getUsers ( string $apiKey ) : array | boolean Return a list of users. Customers are not shown any users. The type of the current user decides which users are shown to him.
removeExpenseRecord ( string $apiKey, integer $id ) : array
removeTimesheetRecord ( string $apiKey, integer $id ) : array
setExpenseRecord ( string $apiKey, array $record, boolean $doUpdate ) : array
setTimesheetRecord ( string $apiKey, array $record, boolean $doUpdate ) : array
startRecord ( string $apiKey, integer $projectId, integer $activityId ) : array The user started the recording of an activity via the buzzer. If this method is called while another recording is running the first one will be stopped.
stopRecord ( string $apiKey, integer $entryId ) : boolean Stops the currently running recording. If $entryId is empty the current activity will be stopped.

Protected Methods

Method Description
getAuthErrorResult ( ) : array Returns the result array for failed authentication.
getAuthenticator ( ) : Kimai_Auth_Abstract Returns the configured Authenticator for Kimai.
getDebugResult ( array $items, array $debugItems ) : array Returns the array for success responses.
getErrorResult ( string $msg = null ) : array Returns the array for failure messages.
getSuccessResult ( array $items, integer $total ) : array Returns the array for success responses.

Private Methods

Method Description
getBackend ( ) : Kimai_Remote_Database Returns the database object to access Kimais system.
getKimaiEnv ( ) : integer | null Returns the current kimai environment.
getTasksByProjectId ( string $projectId, array $user ) : array Returns an array of tasks for the given projectId.
getUser ( ) : array Returns the current users config array.
init ( string $apiKey, string $permission = null, $allowCustomer = false ) : boolean Checks if the given $apiKey is allowed to fetch data from this system.

Method Details

__construct() public method

public __construct ( )

authenticate() public method

The result is either an empty string (not allowed or need to login first via web-interface) or a string with max 30 character, representing the users API key.
public authenticate ( string $username, string $password ) : array
$username string
$password string
return array

getActiveRecording() public method

Returns an array with values of the currently active recording.
public getActiveRecording ( string $apiKey ) : array
$apiKey string
return array

getAuthErrorResult() protected method

Returns the result array for failed authentication.
protected getAuthErrorResult ( ) : array
return array

getAuthenticator() protected method

Returns the configured Authenticator for Kimai.
protected getAuthenticator ( ) : Kimai_Auth_Abstract
return Kimai_Auth_Abstract

getCustomers() public method

Return a list of customers. A customer can only see himself.
public getCustomers ( string $apiKey ) : array | boolean
$apiKey string
return array | boolean

getDebugResult() protected method

Returns the array for success responses.
protected getDebugResult ( array $items, array $debugItems ) : array
$items array
$debugItems array
return array

getErrorResult() protected method

Returned messages will always be a string, but might be empty!
protected getErrorResult ( string $msg = null ) : array
$msg string
return array

getExpenseRecord() public method

public getExpenseRecord ( string $apiKey, integer $id ) : array
$apiKey string
$id integer
return array

getExpenses() public method

Returns a list of expenses.
public getExpenses ( string $apiKey, integer $from, integer $to, integer $refundable, integer $cleared, integer $start, integer $limit ) : array
$apiKey string
$from integer a MySQL DATE/DATETIME/TIMESTAMP
$to integer a MySQL DATE/DATETIME/TIMESTAMP
$refundable integer -1 all, 0 only refundable
$cleared integer -1 no filtering, 0 uncleared only, 1 cleared only
$start integer limit start
$limit integer count rows to select
return array

getProjects() public method

Return a list of projects. Customers are only shown their projects.
public getProjects ( string $apiKey, $includeTasks = false ) : array | boolean
$apiKey string
return array | boolean

getSuccessResult() protected method

Returns the array for success responses.
protected getSuccessResult ( array $items, integer $total ) : array
$items array
$total integer = 0
return array

getTasks() public method

Return a list of tasks. Customers are only shown tasks which are used for them. If a project is set as filter via the project parameter only tasks for that project are shown.
public getTasks ( string $apiKey, integer | array $projectId = null ) : array | boolean
$apiKey string
$projectId integer | array
return array | boolean

getTimesheet() public method

Returns a list of recorded times.
public getTimesheet ( string $apiKey, integer $from, integer $to, integer $cleared, integer $start, integer $limit ) : array
$apiKey string
$from integer a MySQL DATE/DATETIME/TIMESTAMP
$to integer a MySQL DATE/DATETIME/TIMESTAMP
$cleared integer -1 no filtering, 0 uncleared only, 1 cleared only
$start integer limit start
$limit integer count rows to select
return array

getTimesheetRecord() public method

public getTimesheetRecord ( string $apiKey, integer $id ) : array
$apiKey string
$id integer
return array

getUsers() public method

Returns false if the call could not be executed, null if no users could be found or an array of users.
See also: get_watchable_users
public getUsers ( string $apiKey ) : array | boolean
$apiKey string
return array | boolean

removeExpenseRecord() public method

public removeExpenseRecord ( string $apiKey, integer $id ) : array
$apiKey string
$id integer
return array

removeTimesheetRecord() public method

public removeTimesheetRecord ( string $apiKey, integer $id ) : array
$apiKey string
$id integer
return array

setExpenseRecord() public method

public setExpenseRecord ( string $apiKey, array $record, boolean $doUpdate ) : array
$apiKey string
$record array
$doUpdate boolean
return array

setTimesheetRecord() public method

public setTimesheetRecord ( string $apiKey, array $record, boolean $doUpdate ) : array
$apiKey string
$record array
$doUpdate boolean
return array

startRecord() public method

If $projectId and $activityId are empty the last activity will be restarted.
public startRecord ( string $apiKey, integer $projectId, integer $activityId ) : array
$apiKey string
$projectId integer
$activityId integer
return array

stopRecord() public method

Stops the currently running recording. If $entryId is empty the current activity will be stopped.
public stopRecord ( string $apiKey, integer $entryId ) : boolean
$apiKey string
$entryId integer
return boolean