Skip to content

Commit c934b59

Browse files
authored
Merge pull request #5 from codebar-ag/feature-tickets
Feature Tickets
2 parents 305f09a + ff6c98d commit c934b59

27 files changed

+496
-28
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
blank_issues_enabled: false
22
contact_links:
33
- name: Ask a question
4-
url: https://github.com/codebar-ag/laravel-zendesk/discussions/new?category=q-a
4+
url: https://github.com/codebar-ag/laravel-zendesk/issues/new
55
about: Ask the community for help
66
- name: Request a feature
7-
url: https://github.com/codebar-ag/laravel-zendesk/discussions/new?category=ideas
7+
url: https://github.com/codebar-ag/laravel-zendesk/issues/new
88
about: Share ideas for new features
99
- name: Report a bug
1010
url: https://github.com/codebar-ag/laravel-zendesk/issues/new

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ composer require codebar-ag/laravel-zendesk
3939
Optionally, you can publish the config file with:
4040

4141
```bash
42-
php artisan vendor:publish --provider="CodebarAg\Zendesk\ZendeskServiceProvider" --tag="config"
42+
php artisan vendor:publish --provider="CodebarAg\Zendesk\ZendeskServiceProvider"
4343
```
4444

4545
You can add the following env variables to your `.env` file:
@@ -207,6 +207,8 @@ $uploadResponse = $connector->send(
207207

208208
$token = $uploadResponse->dto()->token;
209209

210+
// And to pass to your ticket request
211+
210212
$ticketResponse = $connector->send(
211213
new CreateSingleTicketRequest(
212214
SingleTicketDTO::fromArray([

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"allow-plugins": {
6161
"composer/package-versions-deprecated": false,
6262
"pestphp/pest-plugin": true,
63-
"phpstan/extension-installer": true
63+
"phpstan/extension-installer": true,
64+
"dealerdirect/phpcodesniffer-composer-installer": true
6465
}
6566
},
6667
"extra": {

src/Dto/Tickets/AllTicketsDTO.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace CodebarAg\Zendesk\Dto\Tickets;
44

5-
use Illuminate\Support\Collection;
65
use Saloon\Http\Response;
76
use Spatie\LaravelData\Data;
87

@@ -20,7 +19,7 @@ public static function fromResponse(Response $response): self
2019
{
2120
$data = $response->json();
2221

23-
return new static(
22+
return new self(
2423
tickets: collect($data['tickets'])->map(function (array $ticket) {
2524
return SingleTicketDTO::fromArray($ticket);
2625
})->toArray(),

src/Dto/Tickets/Attachments/AttachmentDTO.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
namespace CodebarAg\Zendesk\Dto\Tickets\Attachments;
44

55
use CodebarAg\Zendesk\Enums\MalwareScanResult;
6-
use Illuminate\Support\Carbon;
7-
use Saloon\Http\Response;
86
use Spatie\LaravelData\Data;
97

108
class AttachmentDTO extends Data
@@ -37,7 +35,7 @@ public static function fromArray(array $data): self
3735
}
3836
}
3937

40-
return new static(
38+
return new self(
4139
content_type: $data['content_type'] ?? null,
4240
content_url: $data['content_url'] ?? null,
4341
deleted: $data['deleted'] ?? null,

src/Dto/Tickets/Attachments/ThumbnailDTO.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct(
2626

2727
public static function fromArray(array $data): self
2828
{
29-
return new static(
29+
return new self(
3030
content_type: $data['content_type'] ?? null,
3131
content_url: $data['content_url'] ?? null,
3232
deleted: $data['deleted'] ?? null,

src/Dto/Tickets/Attachments/UploadDTO.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace CodebarAg\Zendesk\Dto\Tickets\Attachments;
44

5-
use CodebarAg\Zendesk\Enums\MalwareScanResult;
65
use Illuminate\Support\Carbon;
76
use Saloon\Http\Response;
87
use Spatie\LaravelData\Data;
@@ -34,7 +33,7 @@ public static function fromArray(array $data): self
3433
}
3534
}
3635

37-
return new static(
36+
return new self(
3837
token: $data['token'] ?? null,
3938
expires_at: Carbon::parse($data['expires_at'] ?? null),
4039
attachments: $attachments,

src/Dto/Tickets/Comments/CommentDTO.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace CodebarAg\Zendesk\Dto\Tickets\Comments;
44

5-
use CodebarAg\Zendesk\Dto\Tickets\Attachments\AttachmentDTO;
6-
use CodebarAg\Zendesk\Dto\Tickets\SingleTicketDTO;
75
use Illuminate\Support\Carbon;
86
use Spatie\LaravelData\Data;
97

@@ -28,7 +26,7 @@ public function __construct(
2826

2927
public static function fromArray(array $data): self
3028
{
31-
return new static(
29+
return new self(
3230
attachments: $data['attachments'] ?? null,
3331
audit_id: $data['audit_id'] ?? null,
3432
author_id: $data['author_id'] ?? null,

src/Dto/Tickets/CountTicketsDTO.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static function fromResponse(Response $response): self
1818
{
1919
$data = $response->json()['count'];
2020

21-
return new static(
21+
return new self(
2222
value: $data['value'],
2323
refreshed_at: Carbon::parse($data['refreshed_at']),
2424
);

src/Dto/Tickets/SingleTicketDTO.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Illuminate\Support\Carbon;
99
use Saloon\Http\Response;
1010
use Spatie\LaravelData\Data;
11-
use function Pest\Laravel\instance;
1211

1312
class SingleTicketDTO extends Data
1413
{
@@ -82,19 +81,19 @@ public static function fromArray(array $data): self
8281
$comment = CommentDTO::fromArray($comment);
8382
}
8483

85-
$priority = array_key_exists('priority', $data) ? $data['priority'] : null;
84+
$priority = array_key_exists('priority', $data) ? $data['priority'] : null;
8685

8786
if ($priority && ! $priority instanceof TicketPriority) {
8887
$priority = TicketPriority::tryFrom($priority);
8988
}
9089

91-
$type = array_key_exists('type', $data) ? $data['type'] : null;
90+
$type = array_key_exists('type', $data) ? $data['type'] : null;
9291

9392
if ($type && ! $type instanceof TicketType) {
9493
$type = TicketType::tryFrom($type);
9594
}
9695

97-
return new static(
96+
return new self(
9897
allow_attachments: $data['allow_attachments'] ?? null,
9998
allow_channelback: $data['allow_channelback'] ?? null,
10099
assignee_email: $data['assignee_email'] ?? null,

0 commit comments

Comments
 (0)