Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add archived ticket feature #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ $new = $api->tickets->create($data);
$updated = $api->tickets->update($data);
$api->tickets->delete($id);
$existing = $api->tickets->view($id);
$archived = $api->archivedTickets->view($id);

//Responses are simple arrays, e.g.:
$id = $existing['id'];
Expand Down
5 changes: 5 additions & 0 deletions docs/Freshdesk-Api.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ Group resources

Ticket resources

### $archivedtickets

public \Freshdesk\Resources\ArchivedTicket $archivedTickets

Archived Ticket resources


* Visibility: **public**
Expand Down
10 changes: 10 additions & 0 deletions src/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Freshdesk\Resources\Product;
use Freshdesk\Resources\SLAPolicy;
use Freshdesk\Resources\Ticket;
use Freshdesk\Resources\ArchivedTicket;
use Freshdesk\Resources\TimeEntry;
use Freshdesk\Resources\Topic;
use GuzzleHttp\Client;
Expand Down Expand Up @@ -82,6 +83,14 @@ class Api
* @var Ticket
*/
public $tickets;

/**
* Archived ticket resources
*
* @api
* @var AchivedTicket
*/
public $archivedTickets;

/**
* TimeEntry resources
Expand Down Expand Up @@ -326,6 +335,7 @@ private function setupResources()

//Tickets
$this->tickets = new Ticket($this);
$this->archivedTickets = new ArchivedTicket($this);
$this->timeEntries = new TimeEntry($this);
$this->conversations = new Conversation($this);

Expand Down
31 changes: 31 additions & 0 deletions src/Resources/ArchivedTicket.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* User: Max84 @Vaisonet
* Date: 09/11/2022
*/

namespace Freshdesk\Resources;

use Freshdesk\Resources\Traits\AllTrait;
use Freshdesk\Resources\Traits\CreateTrait;
use Freshdesk\Resources\Traits\DeleteTrait;
use Freshdesk\Resources\Traits\UpdateTrait;
use Freshdesk\Resources\Traits\ViewTrait;

/**
* Archived ticket resource
*
* Provides access to Archived ticket resources
*
* @package Api\Resources
*/
class ArchivedTicket extends Ticket
{

/**
* The resource endpoint
*
* @var string
*/
protected $endpoint = '/tickets/archived';
}