-
-
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.
- Loading branch information
Showing
11 changed files
with
396 additions
and
1 deletion.
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,32 @@ | ||
<?php | ||
|
||
namespace Westy92\HolidayEventApi\Model; | ||
|
||
use Symfony\Component\Serializer\Annotation\SerializedName; | ||
|
||
/** | ||
* Information about an Event's Alternate Name | ||
*/ | ||
final class AlternateName | ||
{ | ||
/** | ||
* An Event's Alternate Name | ||
*/ | ||
public string $name; | ||
/** | ||
* The first year this Alternate Name was in effect (null implies none or unknown) | ||
*/ | ||
#[SerializedName('first_year')] | ||
public ?int $firstYear; | ||
/** | ||
* The last year this Alternate Name was in effect (null implies none or unknown) | ||
*/ | ||
#[SerializedName('last_year')] | ||
public ?int $lastYear; | ||
|
||
public function __construct(string $name, ?int $firstYear, ?int $lastYear) { | ||
$this->name = $name; | ||
$this->firstYear = $firstYear; | ||
$this->lastYear = $lastYear; | ||
} | ||
} |
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,73 @@ | ||
<?php | ||
|
||
namespace Westy92\HolidayEventApi\Model; | ||
|
||
use Symfony\Component\Serializer\Annotation\SerializedName; | ||
/** | ||
* Information about an Event | ||
*/ | ||
final class EventInfo extends EventSummary | ||
{ | ||
/** | ||
* Whether this Event is unsafe for children or viewing at work | ||
*/ | ||
public bool $adult; | ||
/** | ||
* The Event's Alternate Names | ||
* @var AlternateName[] | ||
*/ | ||
#[SerializedName('alternate_names')] | ||
public array $alternateNames; | ||
/** | ||
* The Event's hashtags | ||
* @var ?string[] | ||
*/ | ||
public ?array $hashtags; | ||
/** | ||
* The Event's images | ||
*/ | ||
public ?ImageInfo $image; | ||
/** | ||
* The Event's sources | ||
* @var ?string[] | ||
*/ | ||
public ?array $sources; | ||
/** | ||
* The Event's description | ||
*/ | ||
public ?RichText $description; | ||
/** | ||
* How to observe the Event | ||
*/ | ||
#[SerializedName('how_to_observe')] | ||
public ?RichText $howToObserve; | ||
/** | ||
* Patterns defining when the Event is observed | ||
* @var ?Pattern[] | ||
*/ | ||
public ?array $patterns; | ||
/** | ||
* The Event's founders | ||
* @var ?FounderInfo[] | ||
*/ | ||
public ?array $founders; | ||
/** | ||
* The Event Occurrences (when it occurs) | ||
* @var ?Occurrence[] | ||
*/ | ||
public ?array $occurrences; | ||
|
||
public function __construct(bool $adult, array $alternateNames, ?array $hashtags, ?ImageInfo $image, ?array $sources, ?RichText $description, ?RichText $howToObserve, ?array $patterns, ?array $founders, ?array $occurrences, string $id, string $name, string $url) { | ||
$this->adult = $adult; | ||
$this->alternateNames = $alternateNames; | ||
$this->hashtags = $hashtags; | ||
$this->image = $image; | ||
$this->sources = $sources; | ||
$this->description = $description; | ||
$this->howToObserve = $howToObserve; | ||
$this->patterns = $patterns; | ||
$this->founders = $founders; | ||
$this->occurrences = $occurrences; | ||
parent::__construct(id: $id, name: $name, url: $url); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
/** | ||
* A summary of an Event | ||
*/ | ||
final class EventSummary | ||
class EventSummary | ||
{ | ||
/** | ||
* The Event Id | ||
|
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,28 @@ | ||
<?php | ||
|
||
namespace Westy92\HolidayEventApi\Model; | ||
|
||
/** | ||
* Information about an Event Founder | ||
*/ | ||
final class FounderInfo | ||
{ | ||
/** | ||
* The Founder's name | ||
*/ | ||
public string $name; | ||
/** | ||
* A link to the Founder | ||
*/ | ||
public ?string $url; | ||
/** | ||
* The date the Event was founded | ||
*/ | ||
public ?string $date; | ||
|
||
public function __construct(string $name, ?string $url, ?string $date) { | ||
$this->name = $name; | ||
$this->url = $url; | ||
$this->date = $date; | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace Westy92\HolidayEventApi\Model; | ||
/** | ||
* The Response returned by getEventInfo | ||
*/ | ||
final class GetEventInfoResponse extends StandardResponse | ||
{ | ||
/** | ||
* The Event Info | ||
*/ | ||
public EventInfo $event; | ||
|
||
public function __construct(EventInfo $event, ?RateLimit $rateLimit = null) { | ||
$this->event = $event; | ||
parent::__construct($rateLimit); | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
namespace Westy92\HolidayEventApi\Model; | ||
|
||
/** | ||
* Information about an Event image | ||
*/ | ||
final class ImageInfo | ||
{ | ||
/** | ||
* A small image | ||
*/ | ||
public string $small; | ||
/** | ||
* A medium image | ||
*/ | ||
public string $medium; | ||
/** | ||
* A large image | ||
*/ | ||
public string $large; | ||
|
||
public function __construct(string $small, string $medium, string $large) { | ||
$this->small = $small; | ||
$this->medium = $medium; | ||
$this->large = $large; | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
namespace Westy92\HolidayEventApi\Model; | ||
|
||
/** | ||
* Information about an Event's Occurrence | ||
*/ | ||
final class Occurrence | ||
{ | ||
/** | ||
* The date or timestamp the Event occurs | ||
*/ | ||
public string $date; | ||
/** | ||
* The length (in days) of the Event occurrence | ||
*/ | ||
public int $length; | ||
|
||
public function __construct(string $date, int $length) { | ||
$this->date = $date; | ||
$this->length = $length; | ||
} | ||
} |
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,49 @@ | ||
<?php | ||
|
||
namespace Westy92\HolidayEventApi\Model; | ||
|
||
use Symfony\Component\Serializer\Annotation\SerializedName; | ||
|
||
/** | ||
* Information about an Event's Pattern | ||
*/ | ||
final class Pattern | ||
{ | ||
/** | ||
* The first year this event is observed (null implies none or unknown) | ||
*/ | ||
#[SerializedName('first_year')] | ||
public ?int $firstYear; | ||
/** | ||
* The last year this event is observed (null implies none or unknown) | ||
*/ | ||
#[SerializedName('last_year')] | ||
public ?int $lastYear; | ||
/** | ||
* A description of how this event is observed (formatted as plain text) | ||
*/ | ||
public string $observed; | ||
/** | ||
* A description of how this event is observed (formatted as HTML) | ||
*/ | ||
#[SerializedName('observed_html')] | ||
public string $observedHtml; | ||
/** | ||
* A description of how this event is observed (formatted as Markdown) | ||
*/ | ||
#[SerializedName('observed_markdown')] | ||
public string $observedMarkdown; | ||
/** | ||
* For how many days this event is celebrated | ||
*/ | ||
public int $length; | ||
|
||
public function __construct(?int $firstYear, ?int $lastYear, string $observed, string $observedHtml, string $observedMarkdown, int $length) { | ||
$this->firstYear = $firstYear; | ||
$this->lastYear = $lastYear; | ||
$this->observed = $observed; | ||
$this->observedHtml = $observedHtml; | ||
$this->observedMarkdown = $observedMarkdown; | ||
$this->length = $length; | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
namespace Westy92\HolidayEventApi\Model; | ||
|
||
/** | ||
* Formatted Text | ||
*/ | ||
final class RichText | ||
{ | ||
/** | ||
* Formatted as plain text | ||
*/ | ||
public ?string $text; | ||
/** | ||
* Formatted as HTML | ||
*/ | ||
public ?string $html; | ||
/** | ||
* Formatted as Markdown | ||
*/ | ||
public ?string $markdown; | ||
|
||
public function __construct(?string $text, ?string $html, ?string $markdown) { | ||
$this->text = $text; | ||
$this->html = $html; | ||
$this->markdown = $markdown; | ||
} | ||
} |
Oops, something went wrong.