Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
update unit-test
  • Loading branch information
DumbergerL committed Jan 15, 2024
1 parent c6e41f9 commit 2d8fcdc
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 25 deletions.
14 changes: 12 additions & 2 deletions docs/out/EventAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@
var_dump( $christmasService->getName());
// Output: "Sunday Service"

var_dump( $christmasService->getDescription());
// getDescription is deprecated. Use getNote instead.
var_dump( $christmasService->getNote());
// Output: "Service Description"

var_dump( $christmasService->getAppointmentId());
// Output: "221"

var_dump( $christmasService->getIsCanceled());
// Output: false

var_dump( $christmasService->getStartDate());
// Output: "2021-09-02 20:15:00"

Expand All @@ -48,7 +55,7 @@
// Output: "2021-09-02 22:00:00"

var_dump( $christmasService->getChatStatus());
// Output: false
// Output: "NOT_STARTED"

var_dump( $christmasService->getPermissions());
// Output: null
Expand All @@ -59,6 +66,9 @@
var_dump( $christmasService->getEventServices());
// Output: []

var_dump( $christmasService->getAdminIds());
// Output: []


/**
* Update Attachments -> see FileAPI
Expand Down
54 changes: 37 additions & 17 deletions src/Models/Events/Event/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ class Event extends AbstractModel

protected ?string $guid = null;
protected ?string $name = null;
/**
* @deprecated use note instead
*/
protected ?string $description = null;
protected ?string $appointmentId = null;
protected ?string $note = null;
protected ?string $startDate = null;
protected ?string $endDate = null;
protected ?bool $chatStatus = null;
protected ?bool $isCanceled = null;
protected ?string $chatStatus = null;
protected ?array $permissions = null;
protected ?DomainAttributeModel $calendar = null;
protected ?EventAgenda $agenda = null;
Expand All @@ -40,7 +45,7 @@ protected function fillArrayType(string $key, array $data): void
$this->setCalendar(DomainAttributeModel::createModelFromData($data));
break;
case "domainAttributes":
if(key_exists("startDate", $data)) {
if (key_exists("startDate", $data)) {
$this->setStartDate($data["startDate"]);
}
break;
Expand Down Expand Up @@ -128,6 +133,28 @@ public function setGuid(?string $guid): Event
return $this;
}

public function getAppointmentId(): ?string
{
return $this->appointmentId;
}

public function setAppointmentId(?string $appointmentId): Event
{
$this->appointmentId = $appointmentId;
return $this;
}

public function getIsCanceled(): ?bool
{
return $this->isCanceled;
}

public function setIsCanceled(?bool $isCanceled): Event
{
$this->isCanceled = $isCanceled;
return $this;
}

/**
* @return string|null
*/
Expand All @@ -147,33 +174,33 @@ public function setName(?string $name): Event
}

/**
* @deprecated use "note"
* @return string|null
* @deprecated use "note" instead
*/
public function getDescription(): ?string
{
return $this->description;
}

/**
* @deprecated use "note"
* @param string|null $description
* @return Event
* @deprecated use "note" instead
*/
public function setDescription(?string $description): Event
{
$this->description = $description;
return $this;
}

/**
* @return string|null
*/
public function getNote(): ?string
{
return $this->note;
}

/**
* @param string|null $note
* @return Event
Expand Down Expand Up @@ -220,19 +247,12 @@ public function setEndDate(?string $endDate): Event
return $this;
}

/**
* @return bool|null
*/
public function getChatStatus(): ?bool
public function getChatStatus(): ?string
{
return $this->chatStatus;
}

/**
* @param bool|null $chatStatus
* @return Event
*/
public function setChatStatus(?bool $chatStatus): Event
public function setChatStatus(?string $chatStatus): Event
{
$this->chatStatus = $chatStatus;
return $this;
Expand Down Expand Up @@ -309,15 +329,15 @@ public function setEventServices(?array $eventServices): Event
$this->eventServices = $eventServices;
return $this;
}

/**
* @return array|null
*/
public function getAdminIds(): ?array
{
return $this->adminIds;
}

/**
* @param array|null $adminIds
* @return Event
Expand Down
8 changes: 6 additions & 2 deletions tests/Unit/Docs/EventRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@ public function testEventRequestDocExample()
$this->assertEquals(21, $christmasService->getId());
$this->assertEquals("guid21", $christmasService->getGuid());
$this->assertEquals("Sunday Service", $christmasService->getName());
$this->assertEquals("Service Description", $christmasService->getDescription());
// getDescription is deprecated. Use getNote instead.
$this->assertEquals("Service Description", $christmasService->getNote());
$this->assertEquals("221", $christmasService->getAppointmentId());
$this->assertEquals(false, $christmasService->getIsCanceled());
$this->assertEquals("2021-09-02 20:15:00", $christmasService->getStartDate());
$this->assertEquals("2021-09-02 22:00:00", $christmasService->getEndDate());
$this->assertEquals("2021-09-02 20:15:00", $christmasService->getStartDateAsDateTime()?->format("Y-m-d H:i:s"));
$this->assertEquals("2021-09-02 22:00:00", $christmasService->getEndDateAsDateTime()?->format("Y-m-d H:i:s"));
$this->assertEquals(false, $christmasService->getChatStatus());
$this->assertEquals("NOT_STARTED", $christmasService->getChatStatus());
$this->assertEquals(null, $christmasService->getPermissions());
$this->assertEquals(null, $christmasService->getCalendar());
$this->assertEquals([], $christmasService->getEventServices());
$this->assertEquals([], $christmasService->getAdminIds());

/**
* Update Attachments -> see FileAPI
Expand Down
12 changes: 9 additions & 3 deletions tests/Unit/HttpMock/data/api_events.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,36 @@
"data": [
{
"id": 21,
"appointmentId": 221,
"guid": "guid21",
"name": "Sunday Service",
"description": "Service Description",
"note": "Service Description",
"startDate": "2021-09-02 20:15:00",
"endDate": "2021-09-02 22:00:00",
"chatStatus": false
"chatStatus": "NOT_STARTED"
},
{
"id": 22,
"appointmentId": 222,
"guid": "guid22",
"name": "Sunday Service",
"description": "Service Description",
"note": "Service Description",
"startDate": "2021-09-08 20:15:00",
"endDate": "2021-09-08 22:00:00",
"chatStatus": true
"chatStatus": "NOT_STARTED"
},
{
"id": 23,
"appointmentId": 223,
"guid": "guid23",
"name": "Sunday Service",
"description": "Service Description",
"note": "Service Description",
"startDate": "2021-09-21 20:15:00",
"endDate": "2021-09-21 22:00:00",
"chatStatus": false
"chatStatus": "NOT_STARTED"
}
],
"meta": {
Expand Down
6 changes: 5 additions & 1 deletion tests/Unit/HttpMock/data/api_events_21.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
"guid": "guid21",
"name": "Sunday Service",
"description": "Service Description",
"note": "Service Description",
"appointmentId": 1,
"startDate": "2021-09-02 20:15:00",
"endDate": "2021-09-02 22:00:00",
"chatStatus": "false",
"chatStatus": "NOT_STARTED",
"isCanceled": false,
"adminIds": [],
"permissions": [],
"calendar": [],
"agenda": {
Expand Down

0 comments on commit 2d8fcdc

Please sign in to comment.