Skip to content

Commit

Permalink
Merge pull request mpclarkson#12 from gtapps/filter-tickets
Browse files Browse the repository at this point in the history
Added ability to filter tickets
  • Loading branch information
mpclarkson authored Nov 12, 2017
2 parents ef608c0 + b65ae21 commit 9247ef4
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ vendor
docs/phpdoc-cache-*
node_modules
composer.lock
/nbproject/private/
7 changes: 7 additions & 0 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include.path=${php.global.include.path}
php.version=PHP_70
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=false
web.root=.
9 changes: 9 additions & 0 deletions nbproject/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>freshdesk-php-sdk</name>
</data>
</configuration>
</project>
28 changes: 28 additions & 0 deletions src/Resources/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,32 @@ public function timeEntries($id, array $query = null)

return $this->api()->request('GET', $this->endpoint($end), null, $query);
}

/**
* Filters by ticket fields
*
* Make sure to pass a valid $filtersQuery string example: "type:question"
*
* @api
* @param string $filtersQuery
* @return array|null
* @throws \Freshdesk\Exceptions\AccessDeniedException
* @throws \Freshdesk\Exceptions\ApiException
* @throws \Freshdesk\Exceptions\AuthenticationException
* @throws \Freshdesk\Exceptions\ConflictingStateException
* @throws \Freshdesk\Exceptions\NotFoundException
* @throws \Freshdesk\Exceptions\RateLimitExceededException
* @throws \Freshdesk\Exceptions\UnsupportedContentTypeException
* @throws \Freshdesk\Exceptions\MethodNotAllowedException
* @throws \Freshdesk\Exceptions\UnsupportedAcceptHeaderException
* @throws \Freshdesk\Exceptions\ValidationException
*/
public function search(string $filtersQuery)
{
$end = '/search'.$this->endpoint();
$query = [
'query' => '"'.$filtersQuery.'"',
];
return $this->api()->request('GET', $end, null, $query);
}
}
1 change: 1 addition & 0 deletions tests/Resources/TicketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function methodsThatShouldExist()
['fields'],
['conversations'],
['timeEntries'],
['search']
];
}

Expand Down

0 comments on commit 9247ef4

Please sign in to comment.