This repository has been archived by the owner on Mar 5, 2024. It is now read-only.
forked from lesstif/php-jira-rest-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement service desk attachments API
- Loading branch information
1 parent
9988852
commit dd61c75
Showing
15 changed files
with
478 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
namespace JiraRestApi\ServiceDesk\Attachment; | ||
|
||
use JiraRestApi\ServiceDesk\Date\DateInterface; | ||
use JiraRestApi\ServiceDesk\User\UserInterface; | ||
|
||
/** | ||
* Attachment in a customer request. AttachmentDTO from the JIRA Service Desk API. | ||
*/ | ||
class Attachment implements AttachmentInterface | ||
{ | ||
/** @var string */ | ||
protected $fileName; | ||
|
||
/** @var UserInterface */ | ||
protected $author; | ||
|
||
/** @var DateInterface */ | ||
protected $created; | ||
|
||
/** @var int */ | ||
protected $size; | ||
|
||
/** @var string */ | ||
protected $mimeType; | ||
|
||
public function getFileName(): string | ||
{ | ||
return $this->fileName; | ||
} | ||
|
||
public function setFilename(string $fileName): void | ||
{ | ||
$this->fileName = $fileName; | ||
} | ||
|
||
public function getAuthor(): UserInterface | ||
{ | ||
return $this->author; | ||
} | ||
|
||
public function setAuthor(UserInterface $author): void | ||
{ | ||
$this->author = $author; | ||
} | ||
|
||
public function getCreated(): DateInterface | ||
{ | ||
return $this->created; | ||
} | ||
|
||
public function setCreated(DateInterface $created): void | ||
{ | ||
$this->created = $created; | ||
} | ||
|
||
public function getSize(): int | ||
{ | ||
return $this->size; | ||
} | ||
|
||
public function setSize(int $size): void | ||
{ | ||
$this->size = $size; | ||
} | ||
|
||
public function getMimeType(): string | ||
{ | ||
return $this->mimeType; | ||
} | ||
|
||
public function setMimeType(string $mimeType): void | ||
{ | ||
$this->mimeType = $mimeType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace JiraRestApi\ServiceDesk\Attachment; | ||
|
||
use JiraRestApi\Pagination\PaginatedQueryInterface; | ||
use JiraRestApi\ServiceDesk\Comment\CommentInterface; | ||
|
||
/** | ||
* Info about a comment with attachments. AttachmentCreateResultDTO from the JIRA Service Desk API. | ||
*/ | ||
class AttachmentCreationResult implements AttachmentCreationResultInterface | ||
{ | ||
/** @var CommentInterface */ | ||
protected $comment; | ||
|
||
/** @var PaginatedQueryInterface<AttachmentInterface> */ | ||
protected $attachmentsQuery; | ||
|
||
/** | ||
* @param CommentInterface $comment | ||
* @param PaginatedQueryInterface<AttachmentInterface> $attachmentsQuery | ||
*/ | ||
public function __construct(CommentInterface $comment, PaginatedQueryInterface $attachmentsQuery) | ||
{ | ||
$this->comment = $comment; | ||
$this->attachmentsQuery = $attachmentsQuery; | ||
} | ||
|
||
public function getComment(): CommentInterface | ||
{ | ||
return $this->comment; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
* @return PaginatedQueryInterface<AttachmentInterface> | ||
*/ | ||
public function getAttachmentsQuery(): PaginatedQueryInterface | ||
{ | ||
return $this->attachmentsQuery; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/ServiceDesk/Attachment/AttachmentCreationResultInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace JiraRestApi\ServiceDesk\Attachment; | ||
|
||
use JiraRestApi\Pagination\PaginatedQueryInterface; | ||
use JiraRestApi\ServiceDesk\Comment\CommentInterface; | ||
|
||
/** | ||
* Info about a comment with attachments. AttachmentCreateResultDTO from the JIRA Service Desk API. | ||
*/ | ||
interface AttachmentCreationResultInterface | ||
{ | ||
/** | ||
* Returns the comment included with the attachments. | ||
* @return CommentInterface | ||
*/ | ||
public function getComment(): CommentInterface; | ||
|
||
/** | ||
* Returns paginated query allowing to retrieve info about all attachments. | ||
* @return PaginatedQueryInterface<AttachmentInterface> | ||
*/ | ||
public function getAttachmentsQuery(): PaginatedQueryInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace JiraRestApi\ServiceDesk\Attachment; | ||
|
||
use JiraRestApi\ServiceDesk\Date\DateInterface; | ||
use JiraRestApi\ServiceDesk\User\UserInterface; | ||
|
||
/** | ||
* Attachment in a customer request. AttachmentDTO from the JIRA Service Desk API. | ||
*/ | ||
interface AttachmentInterface | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function getFileName(): string; | ||
|
||
/** | ||
* @return UserInterface | ||
*/ | ||
public function getAuthor(): UserInterface; | ||
|
||
/** | ||
* Returns date the attachment was added. | ||
* @return DateInterface | ||
*/ | ||
public function getCreated(): DateInterface; | ||
|
||
/** | ||
* Returns size of the attachment in bytes. | ||
* @return int | ||
*/ | ||
public function getSize(): int; | ||
|
||
/** | ||
* Returns MIME type of the attachment. | ||
* @return string | ||
*/ | ||
public function getMimeType(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace JiraRestApi\ServiceDesk\Attachment; | ||
|
||
use JiraRestApi\ServiceDesk\Date\DateInterface; | ||
use JiraRestApi\ServiceDesk\User\UserInterface; | ||
|
||
/** | ||
* Temporary file that was uploaded and can be used for attachments. | ||
*/ | ||
class TemporaryFile implements TemporaryFileInterface | ||
{ | ||
/** @var string */ | ||
protected $temporaryAttachmentId; | ||
|
||
/** @var string */ | ||
protected $fileName; | ||
|
||
public function getTemporaryAttachmentId(): string | ||
{ | ||
return $this->temporaryAttachmentId; | ||
} | ||
|
||
public function setTemporaryAttachmentId(string $temporaryAttachmentId): void | ||
{ | ||
$this->temporaryAttachmentId = $temporaryAttachmentId; | ||
} | ||
|
||
public function getFileName(): string | ||
{ | ||
return $this->fileName; | ||
} | ||
|
||
public function setFileName(string $fileName): void | ||
{ | ||
$this->fileName = $fileName; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace JiraRestApi\ServiceDesk\Attachment; | ||
|
||
/** | ||
* Temporary file that was uploaded and can be used for attachments. | ||
*/ | ||
interface TemporaryFileInterface | ||
{ | ||
public function getTemporaryAttachmentId(): string; | ||
|
||
public function getFileName(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.