\Whups_Api

Whups external API interface.

This file defines Whups' external API interface. Other applications can interact with Whups through this API.

Summary

Methods
Properties
Constants
browse()
addQueue()
getAssignedTicketIds()
getRequestedTicketIds()
addTicket()
updateTicket()
addComment()
addAttachment()
setTicketAttributes()
getListTypes()
listAs()
listQueues()
listSlugs()
getQueueDetails()
listVersions()
addVersion()
getVersionDetails()
getTicketDetails()
listCostObjects()
listTimeObjectCategories()
listTimeObjects()
No public properties found
No constants found
No protected methods found
$_links
N/A
_sortVersions()
No private properties found
N/A

Properties

$_links

$_links : array

Links.

Type

array

Methods

browse()

browse(string  $path = '') : array

Browse through Whups' object tree.

Parameters

string $path

The level of the tree to browse.

Returns

array —

The contents of $path

addQueue()

addQueue(string  $name) : integer

Create a new queue.

Parameters

string $name

The queue's name.

Returns

integer —

The new queue id.

getAssignedTicketIds()

getAssignedTicketIds() : array

Return the ids of all open tickets assigned to the current user.

Returns

array —

Array of ticket ids.

getRequestedTicketIds()

getRequestedTicketIds() : array

Return the ids of all open tickets that the current user created.

Returns

array —

Array of ticket ids.

addTicket()

addTicket(array  $ticket_info) : integer

Create a new ticket.

Parameters

array $ticket_info

An array of form variables representing all of the data collected by CreateStep1Form, CreateStep2Form, CreateStep3Form, and optionally CreateStep4Form.

Returns

integer —

The new ticket id.

updateTicket()

updateTicket(integer  $ticket_id, array  $ticket_info) : boolean

Update a ticket's properties.

Parameters

integer $ticket_id

The id of the id to changes.

array $ticket_info

The attributes to set, from Whups_Form_Ticket_Edit.

Returns

boolean —

True

addComment()

addComment(integer  $ticket_id, string  $comment, string  $group = null) : boolean

Add a comment to a ticket.

Parameters

integer $ticket_id

The id of the ticket to comment on.

string $comment

The comment text to add.

string $group

(optional) Restrict this comment to a specific group.

Returns

boolean —

True

addAttachment()

addAttachment(integer  $ticket_id, string  $name, string  $data) 

Adds an attachment to a ticket.

Parameters

integer $ticket_id

The ticket number.

string $name

The name of the attachment.

string $data

The attachment data.

Throws

\Whups_Exception

setTicketAttributes()

setTicketAttributes(  $info) 

Set attributes for a ticket

Parameters

$info

getListTypes()

getListTypes() : array

Get the types that Whups items can be listed as.

Returns

array —

Array of list types.

listAs()

listAs(string  $type) : array

Get a list of items from whups as type $type.

Parameters

string $type

The list type to use (@see getListTypes). Currently supported: 'taskHash'

Returns

array —

An array of tickets.

listQueues()

listQueues() : array

Return a list of queues that the current user has read permissions for

Returns

array —

Array of queue details

listSlugs()

listSlugs() : array

Return a list of slugs that the current user has read permissions for

Returns

array —

Array of queue details

getQueueDetails()

getQueueDetails(  $queue) : array

Get details for a queue

Parameters

$queue

Returns

array —

An array of queue information (or an array of arrays, if multiple queues were passed).

listVersions()

listVersions(integer  $queue) : array

List the versions associated with a queue

Parameters

integer $queue

The queue id to get versions for.

Returns

array —

Array of queue versions

addVersion()

addVersion(integer  $queue, string  $name, string  $description, boolean  $active = true) 

Add a version to a queue

Parameters

integer $queue

The queue id to add the version to.

string $name

The name of the new version.

string $description

The descriptive text for the new version.

boolean $active

Whether the version is still active.

getVersionDetails()

getVersionDetails(integer  $version_id) : array

Return the details for a queue version

Parameters

integer $version_id

The version to fetch

Returns

array —

Array of version details

getTicketDetails()

getTicketDetails(integer  $queue_id, string  $state = null) : array

Get the all tickets for a queue, optionally with a specific state.

Parameters

integer $queue_id

The queue to get tickets for

string $state

The state filter, if any.

Returns

array —

Array of tickets

listCostObjects()

listCostObjects(array  $criteria) : array

List cost objects

Parameters

array $criteria

The list criteria

Returns

array —

Tickets (as cost objects) matching $criteria

listTimeObjectCategories()

listTimeObjectCategories() : array

List the ways that tickets can be treated as time objects

Returns

array —

Array of time object types

listTimeObjects()

listTimeObjects(array  $categories, mixed  $start, mixed  $end) 

Lists tickets with due dates as time objects.

Parameters

array $categories

The time categories (from listTimeObjectCategories) to list.

mixed $start

The start date of the period.

mixed $end

The end date of the period.

_sortVersions()

_sortVersions(  $a,   $b) 

Parameters

$a
$b