Skip to content

Commit

Permalink
Added group type model, request and request builder
Browse files Browse the repository at this point in the history
  • Loading branch information
stollr committed Jan 6, 2024
1 parent f95a10a commit 2466061
Show file tree
Hide file tree
Showing 3 changed files with 189 additions and 0 deletions.
138 changes: 138 additions & 0 deletions src/Models/Groups/Group/GroupType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?php

namespace CTApi\Models\Groups\Group;

use CTApi\Models\AbstractModel;
use CTApi\Models\Common\Domain\Meta;
use CTApi\Models\Common\File\FileRequest;
use CTApi\Models\Common\File\FileRequestBuilder;
use CTApi\Models\Groups\GroupMeeting\GroupMeetingRequestBuilder;
use CTApi\Models\Groups\GroupMember\GroupMemberRequestBuilder;
use CTApi\Models\Groups\Person\Person;
use CTApi\Traits\Model\FillWithData;
use CTApi\Traits\Model\MetaAttribute;

class GroupType extends AbstractModel
{
use FillWithData, MetaAttribute;


protected ?bool $availableForNewPerson = null;
protected ?bool $isLeaderNecessary = null;
protected ?string $name = null;
protected ?string $namePlural = null;
protected ?string $namePluralTranslated = null;
protected ?string $nameTranslated = null;
protected ?int $permissionDepth = null;
protected ?string $shorty = null;
protected ?int $sortKey = null;

/**
* @param string|null $id
* @return Group
*/
public function setId(?string $id): Group
{
$this->id = $id;
return $this;

Check failure on line 37 in src/Models/Groups/Group/GroupType.php

View workflow job for this annotation

GitHub Actions / build

Method CTApi\Models\Groups\Group\GroupType::setId() should return CTApi\Models\Groups\Group\Group but returns $this(CTApi\Models\Groups\Group\GroupType).
}

public function getAvailableForNewPerson(): ?bool
{
return $this->availableForNewPerson;
}

public function setAvailableForNewPerson(?bool $availableForNewPerson): static
{
$this->availableForNewPerson = $availableForNewPerson;
return $this;
}

public function getIsLeaderNecessary(): ?bool
{
return $this->isLeaderNecessary;
}

public function setIsLeaderNecessary(?bool $isLeaderNecessary): static
{
$this->isLeaderNecessary = $isLeaderNecessary;
return $this;
}

public function getName(): ?string
{
return $this->name;
}

public function setName(?string $name): static
{
$this->name = $name;
return $this;
}

public function getNamePlural(): ?string
{
return $this->namePlural;
}

public function setNamePlural(?string $namePlural): static
{
$this->namePlural = $namePlural;
return $this;
}

public function getNamePluralTranslated(): ?string
{
return $this->namePluralTranslated;
}

public function setNamePluralTranslated(?string $namePluralTranslated): static
{
$this->namePluralTranslated = $namePluralTranslated;
return $this;
}

public function getNameTranslated(): ?string
{
return $this->nameTranslated;
}

public function setNameTranslated(?string $nameTranslated): static
{
$this->nameTranslated = $nameTranslated;
return $this;
}

public function getPermissionDepth(): ?int
{
return $this->permissionDepth;
}

public function setPermissionDepth(?int $permissionDepth): static
{
$this->permissionDepth = $permissionDepth;
return $this;
}

public function getShorty(): ?string
{
return $this->shorty;
}

public function setShorty(?string $shorty): static
{
$this->shorty = $shorty;
return $this;
}

public function getSortKey(): ?int
{
return $this->sortKey;
}

public function setSortKey(?int $sortKey): static
{
$this->sortKey = $sortKey;
return $this;
}
}
33 changes: 33 additions & 0 deletions src/Models/Groups/Group/GroupTypeRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace CTApi\Models\Groups\Group;


class GroupTypeRequest
{
public static function all(): array
{
return (new GroupTypeRequestBuilder())->all();
}

public static function where(string $key, $value): GroupTypeRequestBuilder
{
return (new GroupTypeRequestBuilder())->where($key, $value);
}

public static function orderBy(string $key, $orderAscending = true): GroupTypeRequestBuilder
{
return (new GroupTypeRequestBuilder())->orderBy($key, $orderAscending);
}

public static function findOrFail(int $id): GroupType
{
return (new GroupTypeRequestBuilder())->findOrFail($id);
}

public static function find(int $id): ?GroupType
{
return (new GroupTypeRequestBuilder())->find($id);
}

}
18 changes: 18 additions & 0 deletions src/Models/Groups/Group/GroupTypeRequestBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace CTApi\Models\Groups\Group;

use CTApi\Models\AbstractRequestBuilder;

class GroupTypeRequestBuilder extends AbstractRequestBuilder
{
protected function getApiEndpoint(): string
{
return '/api/group/grouptypes';
}

protected function getModelClass(): string
{
return GroupType::class;
}
}

0 comments on commit 2466061

Please sign in to comment.