diff --git a/src/Generated/V2/Clients/Conversation/CreateConversation/CreateConversationRequestBody.php b/src/Generated/V2/Clients/Conversation/CreateConversation/CreateConversationRequestBody.php index ef108003..34c992a1 100644 --- a/src/Generated/V2/Clients/Conversation/CreateConversation/CreateConversationRequestBody.php +++ b/src/Generated/V2/Clients/Conversation/CreateConversation/CreateConversationRequestBody.php @@ -12,6 +12,7 @@ use Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative3; use Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative4; use Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative5; +use Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative6; class CreateConversationRequestBody { @@ -46,7 +47,7 @@ class CreateConversationRequestBody private ?AggregateReference $relatedTo = null; - private ShareableAggregateReferenceAlternative1|ShareableAggregateReferenceAlternative2|ShareableAggregateReferenceAlternative3|ShareableAggregateReferenceAlternative4|ShareableAggregateReferenceAlternative5|null $sharedWith = null; + private ShareableAggregateReferenceAlternative1|ShareableAggregateReferenceAlternative2|ShareableAggregateReferenceAlternative3|ShareableAggregateReferenceAlternative4|ShareableAggregateReferenceAlternative5|ShareableAggregateReferenceAlternative6|null $sharedWith = null; private ?string $title = null; @@ -78,9 +79,9 @@ public function getRelatedTo(): ?AggregateReference /** * @return - * \Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative1|\Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative2|\Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative3|\Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative4|\Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative5|null + * \Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative1|\Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative2|\Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative3|\Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative4|\Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative5|\Mittwald\ApiClient\Generated\V2\Schemas\Conversation\ShareableAggregateReferenceAlternative6|null */ - public function getSharedWith(): ShareableAggregateReferenceAlternative1|ShareableAggregateReferenceAlternative2|ShareableAggregateReferenceAlternative3|ShareableAggregateReferenceAlternative4|ShareableAggregateReferenceAlternative5|null + public function getSharedWith(): ShareableAggregateReferenceAlternative1|ShareableAggregateReferenceAlternative2|ShareableAggregateReferenceAlternative3|ShareableAggregateReferenceAlternative4|ShareableAggregateReferenceAlternative5|ShareableAggregateReferenceAlternative6|null { return $this->sharedWith; } @@ -151,9 +152,9 @@ public function withoutRelatedTo(): self } /** - * @param ShareableAggregateReferenceAlternative1|ShareableAggregateReferenceAlternative2|ShareableAggregateReferenceAlternative3|ShareableAggregateReferenceAlternative4|ShareableAggregateReferenceAlternative5 $sharedWith + * @param ShareableAggregateReferenceAlternative1|ShareableAggregateReferenceAlternative2|ShareableAggregateReferenceAlternative3|ShareableAggregateReferenceAlternative4|ShareableAggregateReferenceAlternative5|ShareableAggregateReferenceAlternative6 $sharedWith */ - public function withSharedWith(ShareableAggregateReferenceAlternative1|ShareableAggregateReferenceAlternative2|ShareableAggregateReferenceAlternative3|ShareableAggregateReferenceAlternative4|ShareableAggregateReferenceAlternative5 $sharedWith): self + public function withSharedWith(ShareableAggregateReferenceAlternative1|ShareableAggregateReferenceAlternative2|ShareableAggregateReferenceAlternative3|ShareableAggregateReferenceAlternative4|ShareableAggregateReferenceAlternative5|ShareableAggregateReferenceAlternative6 $sharedWith): self { $clone = clone $this; $clone->sharedWith = $sharedWith; @@ -227,6 +228,7 @@ public static function buildFromInput(array|object $input, bool $validate = true ShareableAggregateReferenceAlternative3::validateInput($input->{'sharedWith'}, true) => ShareableAggregateReferenceAlternative3::buildFromInput($input->{'sharedWith'}, validate: $validate), ShareableAggregateReferenceAlternative4::validateInput($input->{'sharedWith'}, true) => ShareableAggregateReferenceAlternative4::buildFromInput($input->{'sharedWith'}, validate: $validate), ShareableAggregateReferenceAlternative5::validateInput($input->{'sharedWith'}, true) => ShareableAggregateReferenceAlternative5::buildFromInput($input->{'sharedWith'}, validate: $validate), + ShareableAggregateReferenceAlternative6::validateInput($input->{'sharedWith'}, true) => ShareableAggregateReferenceAlternative6::buildFromInput($input->{'sharedWith'}, validate: $validate), }; } $title = null; @@ -263,7 +265,7 @@ public function toJson(): array if (isset($this->sharedWith)) { $output['sharedWith'] = match (true) { default => throw new InvalidArgumentException("input cannot be mapped to any valid type"), - ($this->sharedWith) instanceof ShareableAggregateReferenceAlternative1, ($this->sharedWith) instanceof ShareableAggregateReferenceAlternative2, ($this->sharedWith) instanceof ShareableAggregateReferenceAlternative3, ($this->sharedWith) instanceof ShareableAggregateReferenceAlternative4, ($this->sharedWith) instanceof ShareableAggregateReferenceAlternative5 => $this->sharedWith->toJson(), + ($this->sharedWith) instanceof ShareableAggregateReferenceAlternative1, ($this->sharedWith) instanceof ShareableAggregateReferenceAlternative2, ($this->sharedWith) instanceof ShareableAggregateReferenceAlternative3, ($this->sharedWith) instanceof ShareableAggregateReferenceAlternative4, ($this->sharedWith) instanceof ShareableAggregateReferenceAlternative5, ($this->sharedWith) instanceof ShareableAggregateReferenceAlternative6 => $this->sharedWith->toJson(), }; } if (isset($this->title)) { diff --git a/src/Generated/V2/Schemas/Conversation/ShareableAggregateReferenceAlternative6.php b/src/Generated/V2/Schemas/Conversation/ShareableAggregateReferenceAlternative6.php new file mode 100644 index 00000000..9f5384f3 --- /dev/null +++ b/src/Generated/V2/Schemas/Conversation/ShareableAggregateReferenceAlternative6.php @@ -0,0 +1,176 @@ + [ + 'aggregate' => [ + 'enum' => [ + 'extensionInstance', + ], + 'type' => 'string', + ], + 'domain' => [ + 'enum' => [ + 'extension', + ], + 'type' => 'string', + ], + 'id' => [ + 'type' => 'string', + ], + ], + 'required' => [ + 'id', + 'aggregate', + 'domain', + ], + 'type' => 'object', + ]; + + private ShareableAggregateReferenceAlternative6Aggregate $aggregate; + + private ShareableAggregateReferenceAlternative6Domain $domain; + + private string $id; + + public function __construct(ShareableAggregateReferenceAlternative6Aggregate $aggregate, ShareableAggregateReferenceAlternative6Domain $domain, string $id) + { + $this->aggregate = $aggregate; + $this->domain = $domain; + $this->id = $id; + } + + public function getAggregate(): ShareableAggregateReferenceAlternative6Aggregate + { + return $this->aggregate; + } + + public function getDomain(): ShareableAggregateReferenceAlternative6Domain + { + return $this->domain; + } + + public function getId(): string + { + return $this->id; + } + + public function withAggregate(ShareableAggregateReferenceAlternative6Aggregate $aggregate): self + { + $clone = clone $this; + $clone->aggregate = $aggregate; + + return $clone; + } + + public function withDomain(ShareableAggregateReferenceAlternative6Domain $domain): self + { + $clone = clone $this; + $clone->domain = $domain; + + return $clone; + } + + public function withId(string $id): self + { + $validator = new Validator(); + $validator->validate($id, static::$schema['properties']['id']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->id = $id; + + return $clone; + } + + /** + * Builds a new instance from an input array + * + * @param array|object $input Input data + * @param bool $validate Set this to false to skip validation; use at own risk + * @return ShareableAggregateReferenceAlternative6 Created instance + * @throws InvalidArgumentException + */ + public static function buildFromInput(array|object $input, bool $validate = true): ShareableAggregateReferenceAlternative6 + { + $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; + if ($validate) { + static::validateInput($input); + } + + $aggregate = ShareableAggregateReferenceAlternative6Aggregate::from($input->{'aggregate'}); + $domain = ShareableAggregateReferenceAlternative6Domain::from($input->{'domain'}); + $id = $input->{'id'}; + + $obj = new self($aggregate, $domain, $id); + + return $obj; + } + + /** + * Converts this object back to a simple array that can be JSON-serialized + * + * @return array Converted array + */ + public function toJson(): array + { + $output = []; + $output['aggregate'] = ($this->aggregate)->value; + $output['domain'] = ($this->domain)->value; + $output['id'] = $this->id; + + return $output; + } + + /** + * Validates an input array + * + * @param array|object $input Input data + * @param bool $return Return instead of throwing errors + * @return bool Validation result + * @throws InvalidArgumentException + */ + public static function validateInput(array|object $input, bool $return = false): bool + { + $validator = new \Mittwald\ApiClient\Validator\Validator(); + $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; + $validator->validate($input, static::$schema); + + if (!$validator->isValid() && !$return) { + $errors = array_map(function (array $e): string { + return $e["property"] . ": " . $e["message"]; + }, $validator->getErrors()); + throw new InvalidArgumentException(join(", ", $errors)); + } + + return $validator->isValid(); + } + + public function __clone() + { + } +} diff --git a/src/Generated/V2/Schemas/Conversation/ShareableAggregateReferenceAlternative6Aggregate.php b/src/Generated/V2/Schemas/Conversation/ShareableAggregateReferenceAlternative6Aggregate.php new file mode 100644 index 00000000..838dc9fb --- /dev/null +++ b/src/Generated/V2/Schemas/Conversation/ShareableAggregateReferenceAlternative6Aggregate.php @@ -0,0 +1,10 @@ +