Skip to content

Commit

Permalink
Merge pull request #5 from luqman7/survey
Browse files Browse the repository at this point in the history
endpoints for csat
  • Loading branch information
coolcodemy authored Dec 3, 2021
2 parents d65b6cf + 4f80e91 commit 9359c05
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class Api
* @var Client
*/
protected $client;

/**
* @internal
* @var string
Expand Down
44 changes: 44 additions & 0 deletions src/Resources/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,48 @@ public function createWithAttachment(array $data)
{
return $this->api()->requestMultipart('POST', $this->endpoint(), $data);
}

/**
* Create a satisfaction rating
*
* @param int $id The ticket id
* @param array $data
* @return mixed|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 survey($id, array $query = null)
{
return $this->api()->request('POST', $this->endpoint($id.'/satisfaction_ratings'), $query);
}

/**
* List all satisfaction ratings on ticket
*
* @param int $id The ticket id
* @param array $data
* @return mixed|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 listSurvey($id, array $query = null)
{
return $this->api()->request('GET', $this->endpoint($id.'/satisfaction_ratings'), $query);
}
}

0 comments on commit 9359c05

Please sign in to comment.