Skip to content
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
3 changes: 3 additions & 0 deletions src/Core/Repository/RepositoryRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use ZammadAPIClient\Endpoints\Groups\GroupRepository;
use ZammadAPIClient\Endpoints\Links\LinkDTO;
use ZammadAPIClient\Endpoints\Links\LinkRepository;
use ZammadAPIClient\Endpoints\Roles\RoleDTO;
use ZammadAPIClient\Endpoints\Roles\RoleRepository;
use ZammadAPIClient\Endpoints\Tags\TagDTO;
use ZammadAPIClient\Endpoints\Tags\TagRepository;
use ZammadAPIClient\Endpoints\TextModules\TextModuleDTO;
Expand Down Expand Up @@ -45,6 +47,7 @@ final class RepositoryRegistry
OrganizationRepository::class => ['path' => 'organizations', 'dto' => OrganizationDTO::class],
GroupRepository::class => ['path' => 'groups', 'dto' => GroupDTO::class],
LinkRepository::class => ['path' => 'links', 'dto' => LinkDTO::class],
RoleRepository::class => ['path' => 'roles', 'dto' => RoleDTO::class],
TicketArticleRepository::class => ['path' => 'ticket_articles', 'dto' => TicketArticleDTO::class],
TicketStateRepository::class => ['path' => 'ticket_states', 'dto' => TicketStateDTO::class],
TicketPriorityRepository::class => ['path' => 'ticket_priorities', 'dto' => TicketPriorityDTO::class],
Expand Down
6 changes: 6 additions & 0 deletions src/Core/Traits/RepositoryAccessors.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use ZammadAPIClient\Endpoints\Groups\GroupRepository;
use ZammadAPIClient\Endpoints\Links\LinkRepository;
use ZammadAPIClient\Endpoints\Organizations\OrganizationRepository;
use ZammadAPIClient\Endpoints\Roles\RoleRepository;
use ZammadAPIClient\Endpoints\Tags\TagRepository;
use ZammadAPIClient\Endpoints\TextModules\TextModuleRepository;
use ZammadAPIClient\Endpoints\TicketArticles\TicketArticleRepository;
Expand Down Expand Up @@ -43,6 +44,11 @@ public function group(): GroupRepository
return $this->repo(GroupRepository::class);
}

public function role(): RoleRepository
{
return $this->repo(RoleRepository::class);
}

public function ticketArticle(): TicketArticleRepository
{
return $this->repo(TicketArticleRepository::class);
Expand Down
28 changes: 28 additions & 0 deletions src/Endpoints/Roles/RoleDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace ZammadAPIClient\Endpoints\Roles;

use ZammadAPIClient\Core\Contracts\DTOInterface;
use ZammadAPIClient\Core\Traits\HasTimestamps;
use ZammadAPIClient\Core\Traits\HydratesFromArray;
use ZammadAPIClient\Core\Traits\SerializesToArray;

/**
* Represents a Zammad role resource (`/api/v1/roles`).
*/
final class RoleDTO implements DTOInterface
{
use HasTimestamps;
use HydratesFromArray;
use SerializesToArray;

public function __construct(
public readonly string $name,
public readonly ?string $note = null,
public readonly ?bool $active = null,
public readonly ?int $id = null,
) {
}
}
14 changes: 14 additions & 0 deletions src/Endpoints/Roles/RoleRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace ZammadAPIClient\Endpoints\Roles;

use ZammadAPIClient\Core\Repository\AbstractRepository;

/**
* Repository for the `/api/v1/roles` endpoint.
*/
final class RoleRepository extends AbstractRepository
{
}