Skip to content

Commit

Permalink
Merge branch 'hotfix/update' into 'main'
Browse files Browse the repository at this point in the history
chore: generate models

See merge request internal/api-models-php!1
  • Loading branch information
lkm committed Aug 25, 2022
2 parents 4574bdb + 52add62 commit 7adf56d
Show file tree
Hide file tree
Showing 32 changed files with 106 additions and 35 deletions.
1 change: 1 addition & 0 deletions ApiModels/AcademicBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v1/books')]
class AcademicBook extends Book
{
}
2 changes: 2 additions & 0 deletions ApiModels/Advert.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '')]
class Advert
{
#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: '_id')]
protected string $id = '';
protected ?string $link = null;
protected string $thumbnail = '';
Expand Down
1 change: 1 addition & 0 deletions ApiModels/Answer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '')]
class Answer
{
protected string $id = '';
Expand Down
1 change: 1 addition & 0 deletions ApiModels/AttributeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '')]
class AttributeRequest
{
protected string $name = '';
Expand Down
1 change: 1 addition & 0 deletions ApiModels/AudioBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v1/books')]
class AudioBook extends Book
{
}
1 change: 1 addition & 0 deletions ApiModels/AudioTalkBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v1/books')]
class AudioTalkBook extends Book
{
}
2 changes: 2 additions & 0 deletions ApiModels/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v1/authors')]
class Author
{
#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: '_id')]
protected string $id = '';

/** @var Book[]|null $books */
Expand Down
24 changes: 18 additions & 6 deletions ApiModels/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v1/books')]
class Book
{
#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: '_id')]
protected string $id = '';

#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: '_slug')]
protected string $slug = '';

#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: '_type')]
protected string $type = '';
protected ?string $abstract = null;
protected ?string $authors = null;
Expand All @@ -24,13 +30,13 @@ class Book
protected ?array $formats = null;
protected ?string $homepage = null;
protected ?string $isbn = null;
protected ?Language $language = null;
protected Language $language;
protected ?\DateTime $liveUtcTime = null;
protected ?int $pages = null;
protected ?bool $premium = null;
protected ?int $premiumLevel = null;
protected string $priceLevel = '';
protected ?\DateTime $published = null;
protected \DateTime $published;
protected ?Rating $rating = null;

/** @var Review[]|null $reviews */
Expand Down Expand Up @@ -205,12 +211,12 @@ public function getIsbn(): ?string
return $this->isbn;
}

public function setLanguage(?Language $language): void
public function setLanguage(Language $language): void
{
$this->language = $language;
}

public function getLanguage(): ?Language
public function getLanguage(): Language
{
return $this->language;
}
Expand Down Expand Up @@ -265,12 +271,12 @@ public function getPriceLevel(): string
return $this->priceLevel;
}

public function setPublished(?\DateTime $published): void
public function setPublished(\DateTime $published): void
{
$this->published = $published;
}

public function getPublished(): ?\DateTime
public function getPublished(): \DateTime
{
return $this->published;
}
Expand Down Expand Up @@ -382,4 +388,10 @@ public function getVersion(): ?int
{
return $this->version;
}

public function __construct()
{
$this->language = new Language();
$this->published = new \DateTime();
}
}
2 changes: 2 additions & 0 deletions ApiModels/BookChapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v1/books/{bookId}/chapters')]
class BookChapter
{
#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: '_id')]
protected string $id = '';
protected int $duration = 0;
protected int $position = 0;
Expand Down
1 change: 1 addition & 0 deletions ApiModels/BookDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '')]
class BookDetail
{
protected string $body = '';
Expand Down
2 changes: 2 additions & 0 deletions ApiModels/BookTimeTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v1/books/{bookId}/timetags')]
class BookTimeTag
{
#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: '_id')]
protected string $id = '';
protected string $name = '';
protected int $offset = 0;
Expand Down
4 changes: 4 additions & 0 deletions ApiModels/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v1/categories')]
class Category
{
#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: '_id')]
protected string $id = '';

#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: '_slug')]
protected string $slug = '';

/** @var Book[] $books */
Expand Down
1 change: 1 addition & 0 deletions ApiModels/Chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '')]
class Chat
{
protected string $roomPassword = '';
Expand Down
1 change: 1 addition & 0 deletions ApiModels/ClassroomBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v1/books')]
class ClassroomBook extends Book
{
}
20 changes: 14 additions & 6 deletions ApiModels/Exam.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v1/exams')]
class Exam
{
#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: '_id')]
protected string $id = '';
protected ?Book $book = null;
protected ?Language $language = null;
protected Book $book;
protected Language $language;
protected int $passScore = 0;
protected int $questionsCount = 0;
protected int $timeSeconds = 0;
Expand All @@ -22,22 +24,22 @@ public function getId(): string
return $this->id;
}

public function setBook(?Book $book): void
public function setBook(Book $book): void
{
$this->book = $book;
}

public function getBook(): ?Book
public function getBook(): Book
{
return $this->book;
}

public function setLanguage(?Language $language): void
public function setLanguage(Language $language): void
{
$this->language = $language;
}

public function getLanguage(): ?Language
public function getLanguage(): Language
{
return $this->language;
}
Expand Down Expand Up @@ -81,4 +83,10 @@ public function getTitle(): string
{
return $this->title;
}

public function __construct()
{
$this->book = new Book();
$this->language = new Language();
}
}
2 changes: 2 additions & 0 deletions ApiModels/FrontPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v1/frontpage')]
class FrontPage
{
#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: '_slug')]
protected string $slug = '';

/** @var Book[] $books */
Expand Down
22 changes: 16 additions & 6 deletions ApiModels/Journey.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v1/journeys')]
class Journey
{
#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: '_id')]
protected string $id = '';
protected string $abstract = '';

/** @var string[] $books */
protected array $books = [];
protected string $description = '';

#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: 'isFeatured')]
protected bool $featured = false;
protected ?Language $language = null;
protected ?\DateTime $published = null;
protected Language $language;
protected \DateTime $published;

/** @var Thumbnail[] $thumbnail */
protected array $thumbnail = [];
Expand Down Expand Up @@ -74,22 +78,22 @@ public function isFeatured(): bool
return $this->featured;
}

public function setLanguage(?Language $language): void
public function setLanguage(Language $language): void
{
$this->language = $language;
}

public function getLanguage(): ?Language
public function getLanguage(): Language
{
return $this->language;
}

public function setPublished(?\DateTime $published): void
public function setPublished(\DateTime $published): void
{
$this->published = $published;
}

public function getPublished(): ?\DateTime
public function getPublished(): \DateTime
{
return $this->published;
}
Expand Down Expand Up @@ -119,4 +123,10 @@ public function getTitle(): string
{
return $this->title;
}

public function __construct()
{
$this->language = new Language();
$this->published = new \DateTime();
}
}
2 changes: 2 additions & 0 deletions ApiModels/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v1/languages')]
class Language
{
#[\Bookboon\JsonLDClient\Attributes\JsonLDProperty(mappedName: '_slug')]
protected ?string $slug = null;
protected string $code = '';
protected ?string $id = null;
Expand Down
1 change: 1 addition & 0 deletions ApiModels/MetricsHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '')]
class MetricsHeader
{
protected ?string $name = null;
Expand Down
21 changes: 7 additions & 14 deletions ApiModels/MetricsResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

namespace Bookboon\ApiModels;

#[\Bookboon\JsonLDClient\Attributes\JsonLDEntity(url: '/v2/metrics/query', singleton: true)]
class MetricsResult
{
/** @var MetricsHeader[]|null $headers */
protected ?array $headers = null;

/** @var object[]|null $parameters */
protected ?array $parameters = null;
protected ?string $query = null;
protected array $parameters = [];
protected string $query = '';

/** @var object[]|null $results */
protected ?array $results = null;
Expand All @@ -30,28 +29,22 @@ public function getHeaders(): ?array
return $this->headers;
}

/**
* @param object[]|null $parameters
*/
public function setParameters(?array $parameters): void
public function setParameters(array $parameters): void
{
$this->parameters = $parameters;
}

/**
* @return object[]|null
*/
public function getParameters(): ?array
public function getParameters(): array
{
return $this->parameters;
}

public function setQuery(?string $query): void
public function setQuery(string $query): void
{
$this->query = $query;
}

public function getQuery(): ?string
public function getQuery(): string
{
return $this->query;
}
Expand Down
Loading

0 comments on commit 7adf56d

Please sign in to comment.