diff --git a/src/Generated/V2/Clients/Domain/DomainClient.php b/src/Generated/V2/Clients/Domain/DomainClient.php index f3bcf75b..ff4572bc 100644 --- a/src/Generated/V2/Clients/Domain/DomainClient.php +++ b/src/Generated/V2/Clients/Domain/DomainClient.php @@ -44,8 +44,6 @@ use Mittwald\ApiClient\Generated\V2\Clients\Domain\DnsUpdateRecordSet\DnsUpdateRecordSetRequest; use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetDomain\GetDomainOKResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetDomain\GetDomainRequest; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetDomainOwnership\GetDomainOwnershipOKResponse; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetDomainOwnership\GetDomainOwnershipRequest; use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetHandleFieldsV2Deprecated\GetHandleFieldsV2DeprecatedOKResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetHandleFieldsV2Deprecated\GetHandleFieldsV2DeprecatedRequest; use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetLatestScreenshot\GetLatestScreenshotOKResponse; @@ -68,8 +66,6 @@ use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressUpdateIngressPaths\IngressUpdateIngressPathsRequest; use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressUpdateIngressTls\IngressUpdateIngressTlsOKResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressUpdateIngressTls\IngressUpdateIngressTlsRequest; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\ListDomainOwnerships\ListDomainOwnershipsOKResponse; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\ListDomainOwnerships\ListDomainOwnershipsRequest; use Mittwald\ApiClient\Generated\V2\Clients\Domain\ListDomains\ListDomainsOKResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\ListDomains\ListDomainsRequest; use Mittwald\ApiClient\Generated\V2\Clients\Domain\ListDomainsV2Deprecated\ListDomainsV2DeprecatedOKResponse; @@ -85,7 +81,6 @@ use Mittwald\ApiClient\Generated\V2\Clients\Domain\UpdateDomainContact\UpdateDomainContactRequest; use Mittwald\ApiClient\Generated\V2\Clients\Domain\UpdateDomainNameservers\UpdateDomainNameserversRequest; use Mittwald\ApiClient\Generated\V2\Clients\Domain\UpdateDomainProjectId\UpdateDomainProjectIdRequest; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\VerifyDomainOwnership\VerifyDomainOwnershipRequest; /** * Client for Domain API @@ -378,16 +373,6 @@ public function deleteDomain(DeleteDomainRequest $request): DeleteDomainOKRespon * @return GetDomain\GetDomainOKResponse OK */ public function getDomain(GetDomainRequest $request): GetDomainOKResponse; - /** - * Get a DomainOwnership. - * - * @see https://developer.mittwald.de/reference/v2/#tag/Domain/operation/domain-get-domain-ownership - * @throws GuzzleException - * @throws UnexpectedResponseException - * @param GetDomainOwnership\GetDomainOwnershipRequest $request An object representing the request for this operation - * @return GetDomainOwnership\GetDomainOwnershipOKResponse OK - */ - public function getDomainOwnership(GetDomainOwnershipRequest $request): GetDomainOwnershipOKResponse; /** * Get a HandleSchema. * @@ -411,16 +396,6 @@ public function getHandleFieldsV2Deprecated(GetHandleFieldsV2DeprecatedRequest $ * @return GetLatestScreenshot\GetLatestScreenshotOKResponse OK */ public function getLatestScreenshot(GetLatestScreenshotRequest $request): GetLatestScreenshotOKResponse; - /** - * List the DomainOwnerships of a project. - * - * @see https://developer.mittwald.de/reference/v2/#tag/Domain/operation/domain-list-domain-ownerships - * @throws GuzzleException - * @throws UnexpectedResponseException - * @param ListDomainOwnerships\ListDomainOwnershipsRequest $request An object representing the request for this operation - * @return ListDomainOwnerships\ListDomainOwnershipsOKResponse OK - */ - public function listDomainOwnerships(ListDomainOwnershipsRequest $request): ListDomainOwnershipsOKResponse; /** * List Domains * @@ -520,18 +495,6 @@ public function updateDomainNameservers(UpdateDomainNameserversRequest $request) * @return EmptyResponse No Content */ public function updateDomainProjectId(UpdateDomainProjectIdRequest $request): EmptyResponse; - /** - * Verify a DomainOwnership. - * - * Verify your access to a Domain with an already set TXT Record. On success, the domain will be linked with the webserver. - * - * @see https://developer.mittwald.de/reference/v2/#tag/Domain/operation/domain-verify-domain-ownership - * @throws GuzzleException - * @throws UnexpectedResponseException - * @param VerifyDomainOwnership\VerifyDomainOwnershipRequest $request An object representing the request for this operation - * @return EmptyResponse No Content - */ - public function verifyDomainOwnership(VerifyDomainOwnershipRequest $request): EmptyResponse; /** * Create an Ingress. * diff --git a/src/Generated/V2/Clients/Domain/DomainClientImpl.php b/src/Generated/V2/Clients/Domain/DomainClientImpl.php index 4816dcd7..92868f58 100644 --- a/src/Generated/V2/Clients/Domain/DomainClientImpl.php +++ b/src/Generated/V2/Clients/Domain/DomainClientImpl.php @@ -105,11 +105,6 @@ use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetDomain\GetDomainNotFoundResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetDomain\GetDomainOKResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetDomain\GetDomainRequest; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetDomainOwnership\GetDomainOwnershipBadRequestResponse; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetDomainOwnership\GetDomainOwnershipDefaultResponse; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetDomainOwnership\GetDomainOwnershipNotFoundResponse; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetDomainOwnership\GetDomainOwnershipOKResponse; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetDomainOwnership\GetDomainOwnershipRequest; use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetHandleFieldsV2Deprecated\GetHandleFieldsV2DeprecatedDefaultResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetHandleFieldsV2Deprecated\GetHandleFieldsV2DeprecatedOKResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\GetHandleFieldsV2Deprecated\GetHandleFieldsV2DeprecatedRequest; @@ -160,10 +155,6 @@ use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressUpdateIngressTls\IngressUpdateIngressTlsNotFoundResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressUpdateIngressTls\IngressUpdateIngressTlsOKResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\IngressUpdateIngressTls\IngressUpdateIngressTlsRequest; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\ListDomainOwnerships\ListDomainOwnershipsBadRequestResponse; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\ListDomainOwnerships\ListDomainOwnershipsDefaultResponse; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\ListDomainOwnerships\ListDomainOwnershipsOKResponse; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\ListDomainOwnerships\ListDomainOwnershipsRequest; use Mittwald\ApiClient\Generated\V2\Clients\Domain\ListDomains\ListDomainsBadRequestResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\ListDomains\ListDomainsDefaultResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\ListDomains\ListDomainsOKResponse; @@ -200,10 +191,6 @@ use Mittwald\ApiClient\Generated\V2\Clients\Domain\UpdateDomainProjectId\UpdateDomainProjectIdDefaultResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\UpdateDomainProjectId\UpdateDomainProjectIdNotFoundResponse; use Mittwald\ApiClient\Generated\V2\Clients\Domain\UpdateDomainProjectId\UpdateDomainProjectIdRequest; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\VerifyDomainOwnership\VerifyDomainOwnershipBadRequestResponse; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\VerifyDomainOwnership\VerifyDomainOwnershipDefaultResponse; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\VerifyDomainOwnership\VerifyDomainOwnershipNotFoundResponse; -use Mittwald\ApiClient\Generated\V2\Clients\Domain\VerifyDomainOwnership\VerifyDomainOwnershipRequest; /** * Client for Domain API @@ -812,29 +799,6 @@ public function getDomain(GetDomainRequest $request): GetDomainOKResponse }); } - /** - * Get a DomainOwnership. - * - * @see https://developer.mittwald.de/reference/v2/#tag/Domain/operation/domain-get-domain-ownership - * @throws GuzzleException - * @throws UnexpectedResponseException - * @param GetDomainOwnership\GetDomainOwnershipRequest $request An object representing the request for this operation - * @return GetDomainOwnership\GetDomainOwnershipOKResponse OK - */ - public function getDomainOwnership(GetDomainOwnershipRequest $request): GetDomainOwnershipOKResponse - { - $httpRequest = new Request(GetDomainOwnershipRequest::method, $request->buildUrl()); - $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { - return GetDomainOwnershipOKResponse::fromResponse($httpResponse); - } - throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { - 400 => GetDomainOwnershipBadRequestResponse::fromResponse($httpResponse), - 404 => GetDomainOwnershipNotFoundResponse::fromResponse($httpResponse), - default => GetDomainOwnershipDefaultResponse::fromResponse($httpResponse), - }); - } - /** * Get a HandleSchema. * @@ -881,28 +845,6 @@ public function getLatestScreenshot(GetLatestScreenshotRequest $request): GetLat }); } - /** - * List the DomainOwnerships of a project. - * - * @see https://developer.mittwald.de/reference/v2/#tag/Domain/operation/domain-list-domain-ownerships - * @throws GuzzleException - * @throws UnexpectedResponseException - * @param ListDomainOwnerships\ListDomainOwnershipsRequest $request An object representing the request for this operation - * @return ListDomainOwnerships\ListDomainOwnershipsOKResponse OK - */ - public function listDomainOwnerships(ListDomainOwnershipsRequest $request): ListDomainOwnershipsOKResponse - { - $httpRequest = new Request(ListDomainOwnershipsRequest::method, $request->buildUrl()); - $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { - return ListDomainOwnershipsOKResponse::fromResponse($httpResponse); - } - throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { - 400 => ListDomainOwnershipsBadRequestResponse::fromResponse($httpResponse), - default => ListDomainOwnershipsDefaultResponse::fromResponse($httpResponse), - }); - } - /** * List Domains * @@ -1113,31 +1055,6 @@ public function updateDomainProjectId(UpdateDomainProjectIdRequest $request): Em }); } - /** - * Verify a DomainOwnership. - * - * Verify your access to a Domain with an already set TXT Record. On success, the domain will be linked with the webserver. - * - * @see https://developer.mittwald.de/reference/v2/#tag/Domain/operation/domain-verify-domain-ownership - * @throws GuzzleException - * @throws UnexpectedResponseException - * @param VerifyDomainOwnership\VerifyDomainOwnershipRequest $request An object representing the request for this operation - * @return EmptyResponse No Content - */ - public function verifyDomainOwnership(VerifyDomainOwnershipRequest $request): EmptyResponse - { - $httpRequest = new Request(VerifyDomainOwnershipRequest::method, $request->buildUrl()); - $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 204) { - return new EmptyResponse($httpResponse); - } - throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { - 400 => VerifyDomainOwnershipBadRequestResponse::fromResponse($httpResponse), - 404 => VerifyDomainOwnershipNotFoundResponse::fromResponse($httpResponse), - default => VerifyDomainOwnershipDefaultResponse::fromResponse($httpResponse), - }); - } - /** * Create an Ingress. * diff --git a/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipBadRequestResponse.php b/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipBadRequestResponse.php deleted file mode 100644 index e3178c35..00000000 --- a/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipBadRequestResponse.php +++ /dev/null @@ -1,142 +0,0 @@ - 'object', - 'required' => [ - 'body', - ], - 'properties' => [ - 'body' => [ - '$ref' => '#/components/schemas/de.mittwald.v1.commons.ValidationErrors', - ], - ], - ]; - - /** - * @var ValidationErrors - */ - private ValidationErrors $body; - - private ResponseInterface|null $httpResponse = null; - - /** - * @param ValidationErrors $body - */ - public function __construct(ValidationErrors $body) - { - $this->body = $body; - } - - /** - * @return ValidationErrors - */ - public function getBody(): ValidationErrors - { - return $this->body; - } - - /** - * @param ValidationErrors $body - * @return self - */ - public function withBody(ValidationErrors $body): self - { - $clone = clone $this; - $clone->body = $body; - - 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 GetDomainOwnershipBadRequestResponse Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): GetDomainOwnershipBadRequestResponse - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - $body = ValidationErrors::buildFromInput($input->{'body'}, validate: $validate); - - $obj = new self($body); - - 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['body'] = $this->body->toJson(); - - 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 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() - { - } - - public static function fromResponse(ResponseInterface $httpResponse): self - { - $parsedBody = json_decode($httpResponse->getBody()->getContents(), associative: true); - $response = static::buildFromInput(['body' => $parsedBody], validate: false); - $response->httpResponse = $httpResponse; - return $response; - } - - public function getResponse(): ResponseInterface|null - { - return $this->httpResponse; - } -} diff --git a/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipDefaultResponse.php b/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipDefaultResponse.php deleted file mode 100644 index bd2d692c..00000000 --- a/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipDefaultResponse.php +++ /dev/null @@ -1,142 +0,0 @@ - 'object', - 'required' => [ - 'body', - ], - 'properties' => [ - 'body' => [ - '$ref' => '#/components/schemas/de.mittwald.v1.commons.Error', - ], - ], - ]; - - /** - * @var Error - */ - private Error $body; - - private ResponseInterface|null $httpResponse = null; - - /** - * @param Error $body - */ - public function __construct(Error $body) - { - $this->body = $body; - } - - /** - * @return Error - */ - public function getBody(): Error - { - return $this->body; - } - - /** - * @param Error $body - * @return self - */ - public function withBody(Error $body): self - { - $clone = clone $this; - $clone->body = $body; - - 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 GetDomainOwnershipDefaultResponse Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): GetDomainOwnershipDefaultResponse - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - $body = Error::buildFromInput($input->{'body'}, validate: $validate); - - $obj = new self($body); - - 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['body'] = $this->body->toJson(); - - 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 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() - { - } - - public static function fromResponse(ResponseInterface $httpResponse): self - { - $parsedBody = json_decode($httpResponse->getBody()->getContents(), associative: true); - $response = static::buildFromInput(['body' => $parsedBody], validate: false); - $response->httpResponse = $httpResponse; - return $response; - } - - public function getResponse(): ResponseInterface|null - { - return $this->httpResponse; - } -} diff --git a/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipNotFoundResponse.php b/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipNotFoundResponse.php deleted file mode 100644 index 1c4fecd2..00000000 --- a/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipNotFoundResponse.php +++ /dev/null @@ -1,142 +0,0 @@ - 'object', - 'required' => [ - 'body', - ], - 'properties' => [ - 'body' => [ - '$ref' => '#/components/schemas/de.mittwald.v1.commons.Error', - ], - ], - ]; - - /** - * @var Error - */ - private Error $body; - - private ResponseInterface|null $httpResponse = null; - - /** - * @param Error $body - */ - public function __construct(Error $body) - { - $this->body = $body; - } - - /** - * @return Error - */ - public function getBody(): Error - { - return $this->body; - } - - /** - * @param Error $body - * @return self - */ - public function withBody(Error $body): self - { - $clone = clone $this; - $clone->body = $body; - - 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 GetDomainOwnershipNotFoundResponse Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): GetDomainOwnershipNotFoundResponse - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - $body = Error::buildFromInput($input->{'body'}, validate: $validate); - - $obj = new self($body); - - 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['body'] = $this->body->toJson(); - - 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 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() - { - } - - public static function fromResponse(ResponseInterface $httpResponse): self - { - $parsedBody = json_decode($httpResponse->getBody()->getContents(), associative: true); - $response = static::buildFromInput(['body' => $parsedBody], validate: false); - $response->httpResponse = $httpResponse; - return $response; - } - - public function getResponse(): ResponseInterface|null - { - return $this->httpResponse; - } -} diff --git a/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipOKResponse.php b/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipOKResponse.php deleted file mode 100644 index d0a301f6..00000000 --- a/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipOKResponse.php +++ /dev/null @@ -1,142 +0,0 @@ - 'object', - 'required' => [ - 'body', - ], - 'properties' => [ - 'body' => [ - '$ref' => '#/components/schemas/de.mittwald.v1.domain.DomainOwnership', - ], - ], - ]; - - /** - * @var DomainOwnership - */ - private DomainOwnership $body; - - private ResponseInterface|null $httpResponse = null; - - /** - * @param DomainOwnership $body - */ - public function __construct(DomainOwnership $body) - { - $this->body = $body; - } - - /** - * @return DomainOwnership - */ - public function getBody(): DomainOwnership - { - return $this->body; - } - - /** - * @param DomainOwnership $body - * @return self - */ - public function withBody(DomainOwnership $body): self - { - $clone = clone $this; - $clone->body = $body; - - 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 GetDomainOwnershipOKResponse Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): GetDomainOwnershipOKResponse - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - $body = DomainOwnership::buildFromInput($input->{'body'}, validate: $validate); - - $obj = new self($body); - - 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['body'] = $this->body->toJson(); - - 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 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() - { - } - - public static function fromResponse(ResponseInterface $httpResponse): self - { - $parsedBody = json_decode($httpResponse->getBody()->getContents(), associative: true); - $response = static::buildFromInput(['body' => $parsedBody], validate: false); - $response->httpResponse = $httpResponse; - return $response; - } - - public function getResponse(): ResponseInterface|null - { - return $this->httpResponse; - } -} diff --git a/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipRequest.php b/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipRequest.php deleted file mode 100644 index 6f8184ed..00000000 --- a/src/Generated/V2/Clients/Domain/GetDomainOwnership/GetDomainOwnershipRequest.php +++ /dev/null @@ -1,188 +0,0 @@ - 'object', - 'properties' => [ - 'domainOwnershipId' => [ - 'format' => 'uuid', - 'type' => 'string', - ], - ], - 'required' => [ - 'domainOwnershipId', - ], - ]; - - /** - * @var string - */ - private string $domainOwnershipId; - - private array $headers = [ - - ]; - - /** - * @param string $domainOwnershipId - */ - public function __construct(string $domainOwnershipId) - { - $this->domainOwnershipId = $domainOwnershipId; - } - - /** - * @return string - */ - public function getDomainOwnershipId(): string - { - return $this->domainOwnershipId; - } - - /** - * @param string $domainOwnershipId - * @return self - */ - public function withDomainOwnershipId(string $domainOwnershipId): self - { - $validator = new Validator(); - $validator->validate($domainOwnershipId, static::$schema['properties']['domainOwnershipId']); - if (!$validator->isValid()) { - throw new InvalidArgumentException($validator->getErrors()[0]['message']); - } - - $clone = clone $this; - $clone->domainOwnershipId = $domainOwnershipId; - - 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 GetDomainOwnershipRequest Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): GetDomainOwnershipRequest - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - $domainOwnershipId = $input->{'domainOwnershipId'}; - - $obj = new self($domainOwnershipId); - - 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['domainOwnershipId'] = $this->domainOwnershipId; - - 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 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() - { - } - - /** - * Builds the URL for this request - * - * This method is used internally by the client to build the URL for this request. - * You should not need to call this method directly. - * - * @internal - * @return string The URL for this request - */ - public function buildUrl(): string - { - $mapped = $this->toJson(); - $domainOwnershipId = urlencode($mapped['domainOwnershipId']); - return '/v2/domain-ownerships/' . $domainOwnershipId; - } - - /** - * Builds the request options for this request - * - * This method is used internally by the client to build the Guzzle request options - * for this request. You should not need to call this method directly. - * - * @internal - * @return array The Guzzle request options for this request - */ - public function buildRequestOptions(): array - { - $mapped = $this->toJson(); - $query = []; - return [ - 'query' => $query, - 'headers' => $this->headers, - ]; - } - - /** - * Adds a header to this request - * - * You can use this method to add custom HTTP headers to the request. - * - * @param string $name The name of the header to add - * @param string|array $value The value of the header to add - * @return self A clone of this request with the header added - */ - public function withHeader(string $name, string|array $value): self - { - $clone = clone $this; - $clone->headers[$name] = $value; - return $clone; - } -} diff --git a/src/Generated/V2/Clients/Domain/ListDomainOwnerships/ListDomainOwnershipsBadRequestResponse.php b/src/Generated/V2/Clients/Domain/ListDomainOwnerships/ListDomainOwnershipsBadRequestResponse.php deleted file mode 100644 index bee66655..00000000 --- a/src/Generated/V2/Clients/Domain/ListDomainOwnerships/ListDomainOwnershipsBadRequestResponse.php +++ /dev/null @@ -1,142 +0,0 @@ - 'object', - 'required' => [ - 'body', - ], - 'properties' => [ - 'body' => [ - '$ref' => '#/components/schemas/de.mittwald.v1.commons.ValidationErrors', - ], - ], - ]; - - /** - * @var ValidationErrors - */ - private ValidationErrors $body; - - private ResponseInterface|null $httpResponse = null; - - /** - * @param ValidationErrors $body - */ - public function __construct(ValidationErrors $body) - { - $this->body = $body; - } - - /** - * @return ValidationErrors - */ - public function getBody(): ValidationErrors - { - return $this->body; - } - - /** - * @param ValidationErrors $body - * @return self - */ - public function withBody(ValidationErrors $body): self - { - $clone = clone $this; - $clone->body = $body; - - 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 ListDomainOwnershipsBadRequestResponse Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): ListDomainOwnershipsBadRequestResponse - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - $body = ValidationErrors::buildFromInput($input->{'body'}, validate: $validate); - - $obj = new self($body); - - 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['body'] = $this->body->toJson(); - - 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 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() - { - } - - public static function fromResponse(ResponseInterface $httpResponse): self - { - $parsedBody = json_decode($httpResponse->getBody()->getContents(), associative: true); - $response = static::buildFromInput(['body' => $parsedBody], validate: false); - $response->httpResponse = $httpResponse; - return $response; - } - - public function getResponse(): ResponseInterface|null - { - return $this->httpResponse; - } -} diff --git a/src/Generated/V2/Clients/Domain/ListDomainOwnerships/ListDomainOwnershipsDefaultResponse.php b/src/Generated/V2/Clients/Domain/ListDomainOwnerships/ListDomainOwnershipsDefaultResponse.php deleted file mode 100644 index 7659f8bc..00000000 --- a/src/Generated/V2/Clients/Domain/ListDomainOwnerships/ListDomainOwnershipsDefaultResponse.php +++ /dev/null @@ -1,142 +0,0 @@ - 'object', - 'required' => [ - 'body', - ], - 'properties' => [ - 'body' => [ - '$ref' => '#/components/schemas/de.mittwald.v1.commons.Error', - ], - ], - ]; - - /** - * @var Error - */ - private Error $body; - - private ResponseInterface|null $httpResponse = null; - - /** - * @param Error $body - */ - public function __construct(Error $body) - { - $this->body = $body; - } - - /** - * @return Error - */ - public function getBody(): Error - { - return $this->body; - } - - /** - * @param Error $body - * @return self - */ - public function withBody(Error $body): self - { - $clone = clone $this; - $clone->body = $body; - - 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 ListDomainOwnershipsDefaultResponse Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): ListDomainOwnershipsDefaultResponse - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - $body = Error::buildFromInput($input->{'body'}, validate: $validate); - - $obj = new self($body); - - 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['body'] = $this->body->toJson(); - - 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 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() - { - } - - public static function fromResponse(ResponseInterface $httpResponse): self - { - $parsedBody = json_decode($httpResponse->getBody()->getContents(), associative: true); - $response = static::buildFromInput(['body' => $parsedBody], validate: false); - $response->httpResponse = $httpResponse; - return $response; - } - - public function getResponse(): ResponseInterface|null - { - return $this->httpResponse; - } -} diff --git a/src/Generated/V2/Clients/Domain/ListDomainOwnerships/ListDomainOwnershipsOKResponse.php b/src/Generated/V2/Clients/Domain/ListDomainOwnerships/ListDomainOwnershipsOKResponse.php deleted file mode 100644 index 1157cdaf..00000000 --- a/src/Generated/V2/Clients/Domain/ListDomainOwnerships/ListDomainOwnershipsOKResponse.php +++ /dev/null @@ -1,145 +0,0 @@ - 'object', - 'required' => [ - 'body', - ], - 'properties' => [ - 'body' => [ - 'items' => [ - '$ref' => '#/components/schemas/de.mittwald.v1.domain.DomainOwnership', - ], - 'type' => 'array', - ], - ], - ]; - - /** - * @var DomainOwnership[] - */ - private array $body; - - private ResponseInterface|null $httpResponse = null; - - /** - * @param DomainOwnership[] $body - */ - public function __construct(array $body) - { - $this->body = $body; - } - - /** - * @return DomainOwnership[] - */ - public function getBody(): array - { - return $this->body; - } - - /** - * @param DomainOwnership[] $body - * @return self - */ - public function withBody(array $body): self - { - $clone = clone $this; - $clone->body = $body; - - 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 ListDomainOwnershipsOKResponse Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): ListDomainOwnershipsOKResponse - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - $body = array_map(fn (array|object $i): DomainOwnership => DomainOwnership::buildFromInput($i, validate: $validate), $input->{'body'}); - - $obj = new self($body); - - 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['body'] = array_map(fn (DomainOwnership $i): array => $i->toJson(), $this->body); - - 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 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() - { - } - - public static function fromResponse(ResponseInterface $httpResponse): self - { - $parsedBody = json_decode($httpResponse->getBody()->getContents(), associative: true); - $response = static::buildFromInput(['body' => $parsedBody], validate: false); - $response->httpResponse = $httpResponse; - return $response; - } - - public function getResponse(): ResponseInterface|null - { - return $this->httpResponse; - } -} diff --git a/src/Generated/V2/Clients/Domain/VerifyDomainOwnership/VerifyDomainOwnershipBadRequestResponse.php b/src/Generated/V2/Clients/Domain/VerifyDomainOwnership/VerifyDomainOwnershipBadRequestResponse.php deleted file mode 100644 index e67e715e..00000000 --- a/src/Generated/V2/Clients/Domain/VerifyDomainOwnership/VerifyDomainOwnershipBadRequestResponse.php +++ /dev/null @@ -1,142 +0,0 @@ - 'object', - 'required' => [ - 'body', - ], - 'properties' => [ - 'body' => [ - '$ref' => '#/components/schemas/de.mittwald.v1.commons.ValidationErrors', - ], - ], - ]; - - /** - * @var ValidationErrors - */ - private ValidationErrors $body; - - private ResponseInterface|null $httpResponse = null; - - /** - * @param ValidationErrors $body - */ - public function __construct(ValidationErrors $body) - { - $this->body = $body; - } - - /** - * @return ValidationErrors - */ - public function getBody(): ValidationErrors - { - return $this->body; - } - - /** - * @param ValidationErrors $body - * @return self - */ - public function withBody(ValidationErrors $body): self - { - $clone = clone $this; - $clone->body = $body; - - 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 VerifyDomainOwnershipBadRequestResponse Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): VerifyDomainOwnershipBadRequestResponse - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - $body = ValidationErrors::buildFromInput($input->{'body'}, validate: $validate); - - $obj = new self($body); - - 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['body'] = $this->body->toJson(); - - 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 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() - { - } - - public static function fromResponse(ResponseInterface $httpResponse): self - { - $parsedBody = json_decode($httpResponse->getBody()->getContents(), associative: true); - $response = static::buildFromInput(['body' => $parsedBody], validate: false); - $response->httpResponse = $httpResponse; - return $response; - } - - public function getResponse(): ResponseInterface|null - { - return $this->httpResponse; - } -} diff --git a/src/Generated/V2/Clients/Domain/VerifyDomainOwnership/VerifyDomainOwnershipDefaultResponse.php b/src/Generated/V2/Clients/Domain/VerifyDomainOwnership/VerifyDomainOwnershipDefaultResponse.php deleted file mode 100644 index 81f90eec..00000000 --- a/src/Generated/V2/Clients/Domain/VerifyDomainOwnership/VerifyDomainOwnershipDefaultResponse.php +++ /dev/null @@ -1,142 +0,0 @@ - 'object', - 'required' => [ - 'body', - ], - 'properties' => [ - 'body' => [ - '$ref' => '#/components/schemas/de.mittwald.v1.commons.Error', - ], - ], - ]; - - /** - * @var Error - */ - private Error $body; - - private ResponseInterface|null $httpResponse = null; - - /** - * @param Error $body - */ - public function __construct(Error $body) - { - $this->body = $body; - } - - /** - * @return Error - */ - public function getBody(): Error - { - return $this->body; - } - - /** - * @param Error $body - * @return self - */ - public function withBody(Error $body): self - { - $clone = clone $this; - $clone->body = $body; - - 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 VerifyDomainOwnershipDefaultResponse Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): VerifyDomainOwnershipDefaultResponse - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - $body = Error::buildFromInput($input->{'body'}, validate: $validate); - - $obj = new self($body); - - 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['body'] = $this->body->toJson(); - - 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 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() - { - } - - public static function fromResponse(ResponseInterface $httpResponse): self - { - $parsedBody = json_decode($httpResponse->getBody()->getContents(), associative: true); - $response = static::buildFromInput(['body' => $parsedBody], validate: false); - $response->httpResponse = $httpResponse; - return $response; - } - - public function getResponse(): ResponseInterface|null - { - return $this->httpResponse; - } -} diff --git a/src/Generated/V2/Clients/Domain/VerifyDomainOwnership/VerifyDomainOwnershipNotFoundResponse.php b/src/Generated/V2/Clients/Domain/VerifyDomainOwnership/VerifyDomainOwnershipNotFoundResponse.php deleted file mode 100644 index c0c3384f..00000000 --- a/src/Generated/V2/Clients/Domain/VerifyDomainOwnership/VerifyDomainOwnershipNotFoundResponse.php +++ /dev/null @@ -1,142 +0,0 @@ - 'object', - 'required' => [ - 'body', - ], - 'properties' => [ - 'body' => [ - '$ref' => '#/components/schemas/de.mittwald.v1.commons.Error', - ], - ], - ]; - - /** - * @var Error - */ - private Error $body; - - private ResponseInterface|null $httpResponse = null; - - /** - * @param Error $body - */ - public function __construct(Error $body) - { - $this->body = $body; - } - - /** - * @return Error - */ - public function getBody(): Error - { - return $this->body; - } - - /** - * @param Error $body - * @return self - */ - public function withBody(Error $body): self - { - $clone = clone $this; - $clone->body = $body; - - 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 VerifyDomainOwnershipNotFoundResponse Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): VerifyDomainOwnershipNotFoundResponse - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - $body = Error::buildFromInput($input->{'body'}, validate: $validate); - - $obj = new self($body); - - 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['body'] = $this->body->toJson(); - - 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 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() - { - } - - public static function fromResponse(ResponseInterface $httpResponse): self - { - $parsedBody = json_decode($httpResponse->getBody()->getContents(), associative: true); - $response = static::buildFromInput(['body' => $parsedBody], validate: false); - $response->httpResponse = $httpResponse; - return $response; - } - - public function getResponse(): ResponseInterface|null - { - return $this->httpResponse; - } -} diff --git a/src/Generated/V2/Clients/Domain/VerifyDomainOwnership/VerifyDomainOwnershipRequest.php b/src/Generated/V2/Clients/Domain/VerifyDomainOwnership/VerifyDomainOwnershipRequest.php deleted file mode 100644 index 76b2191f..00000000 --- a/src/Generated/V2/Clients/Domain/VerifyDomainOwnership/VerifyDomainOwnershipRequest.php +++ /dev/null @@ -1,228 +0,0 @@ - 'object', - 'properties' => [ - 'domainOwnershipId' => [ - 'format' => 'uuid', - 'type' => 'string', - ], - 'body' => [ - - ], - ], - 'required' => [ - 'domainOwnershipId', - 'body', - ], - ]; - - /** - * @var string - */ - private string $domainOwnershipId; - - /** - * @var mixed - */ - private $body; - - private array $headers = [ - - ]; - - /** - * @param string $domainOwnershipId - * @param mixed $body - */ - public function __construct(string $domainOwnershipId, $body) - { - $this->domainOwnershipId = $domainOwnershipId; - $this->body = $body; - } - - /** - * @return string - */ - public function getDomainOwnershipId(): string - { - return $this->domainOwnershipId; - } - - /** - * @return mixed - */ - public function getBody() - { - return $this->body; - } - - /** - * @param string $domainOwnershipId - * @return self - */ - public function withDomainOwnershipId(string $domainOwnershipId): self - { - $validator = new Validator(); - $validator->validate($domainOwnershipId, static::$schema['properties']['domainOwnershipId']); - if (!$validator->isValid()) { - throw new InvalidArgumentException($validator->getErrors()[0]['message']); - } - - $clone = clone $this; - $clone->domainOwnershipId = $domainOwnershipId; - - return $clone; - } - - /** - * @param mixed $body - * @return self - */ - public function withBody($body): self - { - $validator = new Validator(); - $validator->validate($body, static::$schema['properties']['body']); - if (!$validator->isValid()) { - throw new InvalidArgumentException($validator->getErrors()[0]['message']); - } - - $clone = clone $this; - $clone->body = $body; - - 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 VerifyDomainOwnershipRequest Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): VerifyDomainOwnershipRequest - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - $domainOwnershipId = $input->{'domainOwnershipId'}; - $body = $input->{'body'}; - - $obj = new self($domainOwnershipId, $body); - - 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['domainOwnershipId'] = $this->domainOwnershipId; - $output['body'] = $this->body; - - 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 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() - { - } - - /** - * Builds the URL for this request - * - * This method is used internally by the client to build the URL for this request. - * You should not need to call this method directly. - * - * @internal - * @return string The URL for this request - */ - public function buildUrl(): string - { - $mapped = $this->toJson(); - $domainOwnershipId = urlencode($mapped['domainOwnershipId']); - return '/v2/domain-ownerships/' . $domainOwnershipId . '/actions/verify'; - } - - /** - * Builds the request options for this request - * - * This method is used internally by the client to build the Guzzle request options - * for this request. You should not need to call this method directly. - * - * @internal - * @return array The Guzzle request options for this request - */ - public function buildRequestOptions(): array - { - $mapped = $this->toJson(); - $query = []; - return [ - 'query' => $query, - 'headers' => $this->headers, - 'json' => $this->getBody()->toJson(), - ]; - } - - /** - * Adds a header to this request - * - * You can use this method to add custom HTTP headers to the request. - * - * @param string $name The name of the header to add - * @param string|array $value The value of the header to add - * @return self A clone of this request with the header added - */ - public function withHeader(string $name, string|array $value): self - { - $clone = clone $this; - $clone->headers[$name] = $value; - return $clone; - } -} diff --git a/src/Generated/V2/Clients/Mail/MailClientImpl.php b/src/Generated/V2/Clients/Mail/MailClientImpl.php index de23d9ce..e17465c3 100644 --- a/src/Generated/V2/Clients/Mail/MailClientImpl.php +++ b/src/Generated/V2/Clients/Mail/MailClientImpl.php @@ -288,7 +288,7 @@ public function deleteDeliveryBox(DeleteDeliveryBoxRequest $request): EmptyRespo { $httpRequest = new Request(DeleteDeliveryBoxRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { @@ -314,7 +314,7 @@ public function deleteMailAddress(DeleteMailAddressRequest $request): EmptyRespo { $httpRequest = new Request(DeleteMailAddressRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { @@ -580,7 +580,7 @@ public function updateDeliveryBoxDescription(UpdateDeliveryBoxDescriptionRequest { $httpRequest = new Request(UpdateDeliveryBoxDescriptionRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { @@ -606,7 +606,7 @@ public function updateDeliveryBoxPassword(UpdateDeliveryBoxPasswordRequest $requ { $httpRequest = new Request(UpdateDeliveryBoxPasswordRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { @@ -632,7 +632,7 @@ public function updateMailAddressAddress(UpdateMailAddressAddressRequest $reques { $httpRequest = new Request(UpdateMailAddressAddressRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { @@ -658,7 +658,7 @@ public function updateMailAddressAutoresponder(UpdateMailAddressAutoresponderReq { $httpRequest = new Request(UpdateMailAddressAutoresponderRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { @@ -711,7 +711,7 @@ public function updateMailAddressCatchAll(UpdateMailAddressCatchAllRequest $requ { $httpRequest = new Request(UpdateMailAddressCatchAllRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { @@ -764,7 +764,7 @@ public function updateMailAddressForwardAddresses(UpdateMailAddressForwardAddres { $httpRequest = new Request(UpdateMailAddressForwardAddressesRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { @@ -817,7 +817,7 @@ public function updateMailAddressPassword(UpdateMailAddressPasswordRequest $requ { $httpRequest = new Request(UpdateMailAddressPasswordRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { @@ -870,7 +870,7 @@ public function updateMailAddressQuota(UpdateMailAddressQuotaRequest $request): { $httpRequest = new Request(UpdateMailAddressQuotaRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { @@ -923,7 +923,7 @@ public function updateMailAddressSpamProtection(UpdateMailAddressSpamProtectionR { $httpRequest = new Request(UpdateMailAddressSpamProtectionRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { @@ -976,7 +976,7 @@ public function updateProjectMailSetting(UpdateProjectMailSettingRequest $reques { $httpRequest = new Request(UpdateProjectMailSettingRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { diff --git a/src/Generated/V2/Clients/Project/DeleteProject/DeleteProjectOKResponse.php b/src/Generated/V2/Clients/Project/DeleteProject/DeleteProjectOKResponse.php deleted file mode 100644 index 6f1626b7..00000000 --- a/src/Generated/V2/Clients/Project/DeleteProject/DeleteProjectOKResponse.php +++ /dev/null @@ -1,142 +0,0 @@ - 'object', - 'required' => [ - 'body', - ], - 'properties' => [ - 'body' => [ - 'type' => 'object', - ], - ], - ]; - - /** - * @var DeleteProjectOKResponseBody - */ - private DeleteProjectOKResponseBody $body; - - private ResponseInterface|null $httpResponse = null; - - /** - * @param DeleteProjectOKResponseBody $body - */ - public function __construct(DeleteProjectOKResponseBody $body) - { - $this->body = $body; - } - - /** - * @return DeleteProjectOKResponseBody - */ - public function getBody(): DeleteProjectOKResponseBody - { - return $this->body; - } - - /** - * @param DeleteProjectOKResponseBody $body - * @return self - */ - public function withBody(DeleteProjectOKResponseBody $body): self - { - $clone = clone $this; - $clone->body = $body; - - 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 DeleteProjectOKResponse Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): DeleteProjectOKResponse - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - $body = DeleteProjectOKResponseBody::buildFromInput($input->{'body'}, validate: $validate); - - $obj = new self($body); - - 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['body'] = ($this->body)->toJson(); - - 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 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() - { - $this->body = clone $this->body; - } - - public static function fromResponse(ResponseInterface $httpResponse): self - { - $parsedBody = json_decode($httpResponse->getBody()->getContents(), associative: true); - $response = static::buildFromInput(['body' => $parsedBody], validate: false); - $response->httpResponse = $httpResponse; - return $response; - } - - public function getResponse(): ResponseInterface|null - { - return $this->httpResponse; - } -} diff --git a/src/Generated/V2/Clients/Project/DeleteProject/DeleteProjectOKResponseBody.php b/src/Generated/V2/Clients/Project/DeleteProject/DeleteProjectOKResponseBody.php deleted file mode 100644 index 2d958162..00000000 --- a/src/Generated/V2/Clients/Project/DeleteProject/DeleteProjectOKResponseBody.php +++ /dev/null @@ -1,90 +0,0 @@ - 'object', - ]; - - /** - * - */ - public function __construct() - { - } - - /** - * 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 DeleteProjectOKResponseBody Created instance - * @throws InvalidArgumentException - */ - public static function buildFromInput(array|object $input, bool $validate = true): DeleteProjectOKResponseBody - { - $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; - if ($validate) { - static::validateInput($input); - } - - - - $obj = new self(); - - return $obj; - } - - /** - * Converts this object back to a simple array that can be JSON-serialized - * - * @return array Converted array - */ - public function toJson(): array - { - $output = []; - - - 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 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/Clients/Project/ProjectClient.php b/src/Generated/V2/Clients/Project/ProjectClient.php index d289f3b1..9beadbdf 100644 --- a/src/Generated/V2/Clients/Project/ProjectClient.php +++ b/src/Generated/V2/Clients/Project/ProjectClient.php @@ -11,7 +11,6 @@ use Mittwald\ApiClient\Generated\V2\Clients\Project\CreateProjectInvite\CreateProjectInviteCreatedResponse; use Mittwald\ApiClient\Generated\V2\Clients\Project\CreateProjectInvite\CreateProjectInviteRequest; use Mittwald\ApiClient\Generated\V2\Clients\Project\DeclineProjectInvite\DeclineProjectInviteRequest; -use Mittwald\ApiClient\Generated\V2\Clients\Project\DeleteProject\DeleteProjectOKResponse; use Mittwald\ApiClient\Generated\V2\Clients\Project\DeleteProject\DeleteProjectRequest; use Mittwald\ApiClient\Generated\V2\Clients\Project\DeleteProjectAvatar\DeleteProjectAvatarRequest; use Mittwald\ApiClient\Generated\V2\Clients\Project\DeleteProjectInvite\DeleteProjectInviteRequest; @@ -113,9 +112,9 @@ public function declineProjectInvite(DeclineProjectInviteRequest $request): Empt * @throws GuzzleException * @throws UnexpectedResponseException * @param DeleteProject\DeleteProjectRequest $request An object representing the request for this operation - * @return DeleteProject\DeleteProjectOKResponse OK + * @return EmptyResponse NoContent */ - public function deleteProject(DeleteProjectRequest $request): DeleteProjectOKResponse; + public function deleteProject(DeleteProjectRequest $request): EmptyResponse; /** * Delete a Project's avatar. * @@ -123,7 +122,7 @@ public function deleteProject(DeleteProjectRequest $request): DeleteProjectOKRes * @throws GuzzleException * @throws UnexpectedResponseException * @param DeleteProjectAvatar\DeleteProjectAvatarRequest $request An object representing the request for this operation - * @return EmptyResponse OK + * @return EmptyResponse NoContent */ public function deleteProjectAvatar(DeleteProjectAvatarRequest $request): EmptyResponse; /** @@ -153,7 +152,7 @@ public function deleteProjectMembership(DeleteProjectMembershipRequest $request) * @throws GuzzleException * @throws UnexpectedResponseException * @param DeleteServerAvatar\DeleteServerAvatarRequest $request An object representing the request for this operation - * @return EmptyResponse OK + * @return EmptyResponse NoContent */ public function deleteServerAvatar(DeleteServerAvatarRequest $request): EmptyResponse; /** @@ -323,7 +322,7 @@ public function resendProjectInviteMail(ResendProjectInviteMailRequest $request) * @throws GuzzleException * @throws UnexpectedResponseException * @param UpdateProjectDescription\UpdateProjectDescriptionRequest $request An object representing the request for this operation - * @return EmptyResponse OK + * @return EmptyResponse NoContent */ public function updateProjectDescription(UpdateProjectDescriptionRequest $request): EmptyResponse; /** @@ -343,7 +342,7 @@ public function updateProjectMembership(UpdateProjectMembershipRequest $request) * @throws GuzzleException * @throws UnexpectedResponseException * @param UpdateServerDescription\UpdateServerDescriptionRequest $request An object representing the request for this operation - * @return EmptyResponse OK + * @return EmptyResponse NoContent */ public function updateServerDescription(UpdateServerDescriptionRequest $request): EmptyResponse; } diff --git a/src/Generated/V2/Clients/Project/ProjectClientImpl.php b/src/Generated/V2/Clients/Project/ProjectClientImpl.php index 78856adf..538b2206 100644 --- a/src/Generated/V2/Clients/Project/ProjectClientImpl.php +++ b/src/Generated/V2/Clients/Project/ProjectClientImpl.php @@ -29,7 +29,6 @@ use Mittwald\ApiClient\Generated\V2\Clients\Project\DeleteProject\DeleteProjectDefaultResponse; use Mittwald\ApiClient\Generated\V2\Clients\Project\DeleteProject\DeleteProjectForbiddenResponse; use Mittwald\ApiClient\Generated\V2\Clients\Project\DeleteProject\DeleteProjectInternalServerErrorResponse; -use Mittwald\ApiClient\Generated\V2\Clients\Project\DeleteProject\DeleteProjectOKResponse; use Mittwald\ApiClient\Generated\V2\Clients\Project\DeleteProject\DeleteProjectPreconditionFailedResponse; use Mittwald\ApiClient\Generated\V2\Clients\Project\DeleteProject\DeleteProjectRequest; use Mittwald\ApiClient\Generated\V2\Clients\Project\DeleteProjectAvatar\DeleteProjectAvatarBadRequestResponse; @@ -241,17 +240,16 @@ public function declineProjectInvite(DeclineProjectInviteRequest $request): Empt * @throws GuzzleException * @throws UnexpectedResponseException * @param DeleteProject\DeleteProjectRequest $request An object representing the request for this operation - * @return DeleteProject\DeleteProjectOKResponse OK + * @return EmptyResponse NoContent */ - public function deleteProject(DeleteProjectRequest $request): DeleteProjectOKResponse + public function deleteProject(DeleteProjectRequest $request): EmptyResponse { $httpRequest = new Request(DeleteProjectRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { - return DeleteProjectOKResponse::fromResponse($httpResponse); + if ($httpResponse->getStatusCode() === 204) { + return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { - 204 => new EmptyResponse($httpResponse), 400 => DeleteProjectBadRequestResponse::fromResponse($httpResponse), 403 => DeleteProjectForbiddenResponse::fromResponse($httpResponse), 412 => DeleteProjectPreconditionFailedResponse::fromResponse($httpResponse), @@ -267,17 +265,16 @@ public function deleteProject(DeleteProjectRequest $request): DeleteProjectOKRes * @throws GuzzleException * @throws UnexpectedResponseException * @param DeleteProjectAvatar\DeleteProjectAvatarRequest $request An object representing the request for this operation - * @return EmptyResponse OK + * @return EmptyResponse NoContent */ public function deleteProjectAvatar(DeleteProjectAvatarRequest $request): EmptyResponse { $httpRequest = new Request(DeleteProjectAvatarRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { - 204 => new EmptyResponse($httpResponse), 400 => DeleteProjectAvatarBadRequestResponse::fromResponse($httpResponse), 403 => DeleteProjectAvatarForbiddenResponse::fromResponse($httpResponse), default => DeleteProjectAvatarDefaultResponse::fromResponse($httpResponse), @@ -333,17 +330,16 @@ public function deleteProjectMembership(DeleteProjectMembershipRequest $request) * @throws GuzzleException * @throws UnexpectedResponseException * @param DeleteServerAvatar\DeleteServerAvatarRequest $request An object representing the request for this operation - * @return EmptyResponse OK + * @return EmptyResponse NoContent */ public function deleteServerAvatar(DeleteServerAvatarRequest $request): EmptyResponse { $httpRequest = new Request(DeleteServerAvatarRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { - 204 => new EmptyResponse($httpResponse), 400 => DeleteServerAvatarBadRequestResponse::fromResponse($httpResponse), 403 => DeleteServerAvatarForbiddenResponse::fromResponse($httpResponse), default => DeleteServerAvatarDefaultResponse::fromResponse($httpResponse), @@ -712,17 +708,16 @@ public function resendProjectInviteMail(ResendProjectInviteMailRequest $request) * @throws GuzzleException * @throws UnexpectedResponseException * @param UpdateProjectDescription\UpdateProjectDescriptionRequest $request An object representing the request for this operation - * @return EmptyResponse OK + * @return EmptyResponse NoContent */ public function updateProjectDescription(UpdateProjectDescriptionRequest $request): EmptyResponse { $httpRequest = new Request(UpdateProjectDescriptionRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { - 204 => new EmptyResponse($httpResponse), 400 => UpdateProjectDescriptionBadRequestResponse::fromResponse($httpResponse), 403 => UpdateProjectDescriptionForbiddenResponse::fromResponse($httpResponse), default => UpdateProjectDescriptionDefaultResponse::fromResponse($httpResponse), @@ -757,17 +752,16 @@ public function updateProjectMembership(UpdateProjectMembershipRequest $request) * @throws GuzzleException * @throws UnexpectedResponseException * @param UpdateServerDescription\UpdateServerDescriptionRequest $request An object representing the request for this operation - * @return EmptyResponse OK + * @return EmptyResponse NoContent */ public function updateServerDescription(UpdateServerDescriptionRequest $request): EmptyResponse { $httpRequest = new Request(UpdateServerDescriptionRequest::method, $request->buildUrl()); $httpResponse = $this->client->send($httpRequest, $request->buildRequestOptions()); - if ($httpResponse->getStatusCode() === 200) { + if ($httpResponse->getStatusCode() === 204) { return new EmptyResponse($httpResponse); } throw new UnexpectedResponseException(match ($httpResponse->getStatusCode()) { - 204 => new EmptyResponse($httpResponse), 400 => UpdateServerDescriptionBadRequestResponse::fromResponse($httpResponse), 403 => UpdateServerDescriptionForbiddenResponse::fromResponse($httpResponse), default => UpdateServerDescriptionDefaultResponse::fromResponse($httpResponse), diff --git a/src/Generated/V2/Schemas/Contract/Contract.php b/src/Generated/V2/Schemas/Contract/Contract.php index 62c2bb1c..afa1ff21 100644 --- a/src/Generated/V2/Schemas/Contract/Contract.php +++ b/src/Generated/V2/Schemas/Contract/Contract.php @@ -47,15 +47,6 @@ class Contract 'example' => '3a201faa-5160-47e0-a758-325ba794b543', 'type' => 'string', ], - 'isInvoicingDeactivated' => [ - 'type' => 'boolean', - ], - 'isInvoicingPaused' => [ - 'type' => 'boolean', - ], - 'owner' => [ - '$ref' => '#/components/schemas/de.mittwald.v1.contract.Contact', - ], 'termination' => [ '$ref' => '#/components/schemas/de.mittwald.v1.contract.Termination', ], @@ -64,7 +55,6 @@ class Contract 'contractId', 'contractNumber', 'customerId', - 'owner', 'baseItem', ], 'type' => 'object', @@ -95,21 +85,6 @@ class Contract */ private string $customerId; - /** - * @var bool|null - */ - private ?bool $isInvoicingDeactivated = null; - - /** - * @var bool|null - */ - private ?bool $isInvoicingPaused = null; - - /** - * @var Contact - */ - private Contact $owner; - /** * @var Termination|null */ @@ -120,15 +95,13 @@ class Contract * @param string $contractId * @param string $contractNumber * @param string $customerId - * @param Contact $owner */ - public function __construct(ContractItem $baseItem, string $contractId, string $contractNumber, string $customerId, Contact $owner) + public function __construct(ContractItem $baseItem, string $contractId, string $contractNumber, string $customerId) { $this->baseItem = $baseItem; $this->contractId = $contractId; $this->contractNumber = $contractNumber; $this->customerId = $customerId; - $this->owner = $owner; } /** @@ -171,30 +144,6 @@ public function getCustomerId(): string return $this->customerId; } - /** - * @return bool|null - */ - public function getIsInvoicingDeactivated(): ?bool - { - return $this->isInvoicingDeactivated ?? null; - } - - /** - * @return bool|null - */ - public function getIsInvoicingPaused(): ?bool - { - return $this->isInvoicingPaused ?? null; - } - - /** - * @return Contact - */ - public function getOwner(): Contact - { - return $this->owner; - } - /** * @return Termination|null */ @@ -292,76 +241,6 @@ public function withCustomerId(string $customerId): self return $clone; } - /** - * @param bool $isInvoicingDeactivated - * @return self - */ - public function withIsInvoicingDeactivated(bool $isInvoicingDeactivated): self - { - $validator = new Validator(); - $validator->validate($isInvoicingDeactivated, static::$schema['properties']['isInvoicingDeactivated']); - if (!$validator->isValid()) { - throw new InvalidArgumentException($validator->getErrors()[0]['message']); - } - - $clone = clone $this; - $clone->isInvoicingDeactivated = $isInvoicingDeactivated; - - return $clone; - } - - /** - * @return self - */ - public function withoutIsInvoicingDeactivated(): self - { - $clone = clone $this; - unset($clone->isInvoicingDeactivated); - - return $clone; - } - - /** - * @param bool $isInvoicingPaused - * @return self - */ - public function withIsInvoicingPaused(bool $isInvoicingPaused): self - { - $validator = new Validator(); - $validator->validate($isInvoicingPaused, static::$schema['properties']['isInvoicingPaused']); - if (!$validator->isValid()) { - throw new InvalidArgumentException($validator->getErrors()[0]['message']); - } - - $clone = clone $this; - $clone->isInvoicingPaused = $isInvoicingPaused; - - return $clone; - } - - /** - * @return self - */ - public function withoutIsInvoicingPaused(): self - { - $clone = clone $this; - unset($clone->isInvoicingPaused); - - return $clone; - } - - /** - * @param Contact $owner - * @return self - */ - public function withOwner(Contact $owner): self - { - $clone = clone $this; - $clone->owner = $owner; - - return $clone; - } - /** * @param Termination $termination * @return self @@ -408,24 +287,13 @@ public static function buildFromInput(array|object $input, bool $validate = true $contractId = $input->{'contractId'}; $contractNumber = $input->{'contractNumber'}; $customerId = $input->{'customerId'}; - $isInvoicingDeactivated = null; - if (isset($input->{'isInvoicingDeactivated'})) { - $isInvoicingDeactivated = (bool)($input->{'isInvoicingDeactivated'}); - } - $isInvoicingPaused = null; - if (isset($input->{'isInvoicingPaused'})) { - $isInvoicingPaused = (bool)($input->{'isInvoicingPaused'}); - } - $owner = Contact::buildFromInput($input->{'owner'}, validate: $validate); $termination = null; if (isset($input->{'termination'})) { $termination = Termination::buildFromInput($input->{'termination'}, validate: $validate); } - $obj = new self($baseItem, $contractId, $contractNumber, $customerId, $owner); + $obj = new self($baseItem, $contractId, $contractNumber, $customerId); $obj->additionalItems = $additionalItems; - $obj->isInvoicingDeactivated = $isInvoicingDeactivated; - $obj->isInvoicingPaused = $isInvoicingPaused; $obj->termination = $termination; return $obj; } @@ -445,13 +313,6 @@ public function toJson(): array $output['contractId'] = $this->contractId; $output['contractNumber'] = $this->contractNumber; $output['customerId'] = $this->customerId; - if (isset($this->isInvoicingDeactivated)) { - $output['isInvoicingDeactivated'] = $this->isInvoicingDeactivated; - } - if (isset($this->isInvoicingPaused)) { - $output['isInvoicingPaused'] = $this->isInvoicingPaused; - } - $output['owner'] = $this->owner->toJson(); if (isset($this->termination)) { $output['termination'] = $this->termination->toJson(); } diff --git a/src/Generated/V2/Schemas/Contract/ContractItem.php b/src/Generated/V2/Schemas/Contract/ContractItem.php index 8eedec45..2c7990e2 100644 --- a/src/Generated/V2/Schemas/Contract/ContractItem.php +++ b/src/Generated/V2/Schemas/Contract/ContractItem.php @@ -59,7 +59,6 @@ class ContractItem ], 'invoicingPeriod' => [ 'example' => 1, - 'minimum' => 1, 'type' => 'number', ], 'isActivated' => [ @@ -119,13 +118,11 @@ class ContractItem 'itemId', 'orderDate', 'isActivated', - 'invoicingPeriod', 'contractPeriod', 'articles', 'totalPrice', 'description', 'isBaseItem', - 'freeTrialDays', ], 'type' => 'object', ]; @@ -156,9 +153,9 @@ class ContractItem private string $description; /** - * @var int|float + * @var int|float|null */ - private int|float $freeTrialDays; + private int|float|null $freeTrialDays = null; /** * @var string|null @@ -166,9 +163,9 @@ class ContractItem private ?string $groupByProjectId = null; /** - * @var int|float + * @var int|float|null */ - private int|float $invoicingPeriod; + private int|float|null $invoicingPeriod = null; /** * @var bool @@ -250,21 +247,17 @@ class ContractItem * @param Article[] $articles * @param int|float $contractPeriod * @param string $description - * @param int|float $freeTrialDays - * @param int|float $invoicingPeriod * @param bool $isActivated * @param bool $isBaseItem * @param string $itemId * @param DateTime $orderDate * @param Price $totalPrice */ - public function __construct(array $articles, int|float $contractPeriod, string $description, int|float $freeTrialDays, int|float $invoicingPeriod, bool $isActivated, bool $isBaseItem, string $itemId, DateTime $orderDate, Price $totalPrice) + public function __construct(array $articles, int|float $contractPeriod, string $description, bool $isActivated, bool $isBaseItem, string $itemId, DateTime $orderDate, Price $totalPrice) { $this->articles = $articles; $this->contractPeriod = $contractPeriod; $this->description = $description; - $this->freeTrialDays = $freeTrialDays; - $this->invoicingPeriod = $invoicingPeriod; $this->isActivated = $isActivated; $this->isBaseItem = $isBaseItem; $this->itemId = $itemId; @@ -314,9 +307,9 @@ public function getDescription(): string } /** - * @return int|float + * @return int|float|null */ - public function getFreeTrialDays(): int|float + public function getFreeTrialDays(): int|float|null { return $this->freeTrialDays; } @@ -330,9 +323,9 @@ public function getGroupByProjectId(): ?string } /** - * @return int|float + * @return int|float|null */ - public function getInvoicingPeriod(): int|float + public function getInvoicingPeriod(): int|float|null { return $this->invoicingPeriod; } @@ -561,6 +554,17 @@ public function withFreeTrialDays(int|float $freeTrialDays): self return $clone; } + /** + * @return self + */ + public function withoutFreeTrialDays(): self + { + $clone = clone $this; + unset($clone->freeTrialDays); + + return $clone; + } + /** * @param string $groupByProjectId * @return self @@ -608,6 +612,17 @@ public function withInvoicingPeriod(int|float $invoicingPeriod): self return $clone; } + /** + * @return self + */ + public function withoutInvoicingPeriod(): self + { + $clone = clone $this; + unset($clone->invoicingPeriod); + + return $clone; + } + /** * @param bool $isActivated * @return self @@ -943,12 +958,18 @@ public static function buildFromInput(array|object $input, bool $validate = true $articles = array_map(fn (array|object $i): Article => Article::buildFromInput($i, validate: $validate), $input->{'articles'}); $contractPeriod = str_contains($input->{'contractPeriod'}, '.') ? (float)($input->{'contractPeriod'}) : (int)($input->{'contractPeriod'}); $description = $input->{'description'}; - $freeTrialDays = str_contains($input->{'freeTrialDays'}, '.') ? (float)($input->{'freeTrialDays'}) : (int)($input->{'freeTrialDays'}); + $freeTrialDays = null; + if (isset($input->{'freeTrialDays'})) { + $freeTrialDays = str_contains($input->{'freeTrialDays'}, '.') ? (float)($input->{'freeTrialDays'}) : (int)($input->{'freeTrialDays'}); + } $groupByProjectId = null; if (isset($input->{'groupByProjectId'})) { $groupByProjectId = $input->{'groupByProjectId'}; } - $invoicingPeriod = str_contains($input->{'invoicingPeriod'}, '.') ? (float)($input->{'invoicingPeriod'}) : (int)($input->{'invoicingPeriod'}); + $invoicingPeriod = null; + if (isset($input->{'invoicingPeriod'})) { + $invoicingPeriod = str_contains($input->{'invoicingPeriod'}, '.') ? (float)($input->{'invoicingPeriod'}) : (int)($input->{'invoicingPeriod'}); + } $isActivated = (bool)($input->{'isActivated'}); $isBaseItem = (bool)($input->{'isBaseItem'}); $isInFreeTrial = null; @@ -991,10 +1012,12 @@ public static function buildFromInput(array|object $input, bool $validate = true } $totalPrice = Price::buildFromInput($input->{'totalPrice'}, validate: $validate); - $obj = new self($articles, $contractPeriod, $description, $freeTrialDays, $invoicingPeriod, $isActivated, $isBaseItem, $itemId, $orderDate, $totalPrice); + $obj = new self($articles, $contractPeriod, $description, $isActivated, $isBaseItem, $itemId, $orderDate, $totalPrice); $obj->activationDate = $activationDate; $obj->aggregateReference = $aggregateReference; + $obj->freeTrialDays = $freeTrialDays; $obj->groupByProjectId = $groupByProjectId; + $obj->invoicingPeriod = $invoicingPeriod; $obj->isInFreeTrial = $isInFreeTrial; $obj->isInclusive = $isInclusive; $obj->nextPossibleDowngradeDate = $nextPossibleDowngradeDate; @@ -1024,11 +1047,15 @@ public function toJson(): array $output['articles'] = array_map(fn (Article $i): array => $i->toJson(), $this->articles); $output['contractPeriod'] = $this->contractPeriod; $output['description'] = $this->description; - $output['freeTrialDays'] = $this->freeTrialDays; + if (isset($this->freeTrialDays)) { + $output['freeTrialDays'] = $this->freeTrialDays; + } if (isset($this->groupByProjectId)) { $output['groupByProjectId'] = $this->groupByProjectId; } - $output['invoicingPeriod'] = $this->invoicingPeriod; + if (isset($this->invoicingPeriod)) { + $output['invoicingPeriod'] = $this->invoicingPeriod; + } $output['isActivated'] = $this->isActivated; $output['isBaseItem'] = $this->isBaseItem; if (isset($this->isInFreeTrial)) { diff --git a/src/Generated/V2/Schemas/Contract/TariffChange.php b/src/Generated/V2/Schemas/Contract/TariffChange.php index acb9b55e..e241d3da 100644 --- a/src/Generated/V2/Schemas/Contract/TariffChange.php +++ b/src/Generated/V2/Schemas/Contract/TariffChange.php @@ -43,7 +43,6 @@ class TariffChange 'type' => 'string', ], 'scheduledByUserId' => [ - 'format' => 'uuid', 'type' => 'string', ], 'targetDate' => [ diff --git a/src/Generated/V2/Schemas/Contract/Termination.php b/src/Generated/V2/Schemas/Contract/Termination.php index 5374af26..61f52e9f 100644 --- a/src/Generated/V2/Schemas/Contract/Termination.php +++ b/src/Generated/V2/Schemas/Contract/Termination.php @@ -4,6 +4,7 @@ namespace Mittwald\ApiClient\Generated\V2\Schemas\Contract; +use DateTime; use InvalidArgumentException; use JsonSchema\Validator; @@ -31,15 +32,14 @@ class Termination 'type' => 'string', ], 'scheduledAtDate' => [ - 'format' => 'date', + 'format' => 'date-time', 'type' => 'string', ], 'scheduledByUserId' => [ - 'format' => 'uuid', 'type' => 'string', ], 'targetDate' => [ - 'format' => 'date', + 'format' => 'date-time', 'type' => 'string', ], ], @@ -56,9 +56,9 @@ class Termination private ?string $reason = null; /** - * @var string + * @var DateTime */ - private string $scheduledAtDate; + private DateTime $scheduledAtDate; /** * @var string|null @@ -66,15 +66,15 @@ class Termination private ?string $scheduledByUserId = null; /** - * @var string + * @var DateTime */ - private string $targetDate; + private DateTime $targetDate; /** - * @param string $scheduledAtDate - * @param string $targetDate + * @param DateTime $scheduledAtDate + * @param DateTime $targetDate */ - public function __construct(string $scheduledAtDate, string $targetDate) + public function __construct(DateTime $scheduledAtDate, DateTime $targetDate) { $this->scheduledAtDate = $scheduledAtDate; $this->targetDate = $targetDate; @@ -89,9 +89,9 @@ public function getReason(): ?string } /** - * @return string + * @return DateTime */ - public function getScheduledAtDate(): string + public function getScheduledAtDate(): DateTime { return $this->scheduledAtDate; } @@ -105,9 +105,9 @@ public function getScheduledByUserId(): ?string } /** - * @return string + * @return DateTime */ - public function getTargetDate(): string + public function getTargetDate(): DateTime { return $this->targetDate; } @@ -142,17 +142,11 @@ public function withoutReason(): self } /** - * @param string $scheduledAtDate + * @param DateTime $scheduledAtDate * @return self */ - public function withScheduledAtDate(string $scheduledAtDate): self + public function withScheduledAtDate(DateTime $scheduledAtDate): self { - $validator = new Validator(); - $validator->validate($scheduledAtDate, static::$schema['properties']['scheduledAtDate']); - if (!$validator->isValid()) { - throw new InvalidArgumentException($validator->getErrors()[0]['message']); - } - $clone = clone $this; $clone->scheduledAtDate = $scheduledAtDate; @@ -189,17 +183,11 @@ public function withoutScheduledByUserId(): self } /** - * @param string $targetDate + * @param DateTime $targetDate * @return self */ - public function withTargetDate(string $targetDate): self + public function withTargetDate(DateTime $targetDate): self { - $validator = new Validator(); - $validator->validate($targetDate, static::$schema['properties']['targetDate']); - if (!$validator->isValid()) { - throw new InvalidArgumentException($validator->getErrors()[0]['message']); - } - $clone = clone $this; $clone->targetDate = $targetDate; @@ -225,12 +213,12 @@ public static function buildFromInput(array|object $input, bool $validate = true if (isset($input->{'reason'})) { $reason = $input->{'reason'}; } - $scheduledAtDate = $input->{'scheduledAtDate'}; + $scheduledAtDate = new DateTime($input->{'scheduledAtDate'}); $scheduledByUserId = null; if (isset($input->{'scheduledByUserId'})) { $scheduledByUserId = $input->{'scheduledByUserId'}; } - $targetDate = $input->{'targetDate'}; + $targetDate = new DateTime($input->{'targetDate'}); $obj = new self($scheduledAtDate, $targetDate); $obj->reason = $reason; @@ -249,11 +237,11 @@ public function toJson(): array if (isset($this->reason)) { $output['reason'] = $this->reason; } - $output['scheduledAtDate'] = $this->scheduledAtDate; + $output['scheduledAtDate'] = ($this->scheduledAtDate)->format(DateTime::ATOM); if (isset($this->scheduledByUserId)) { $output['scheduledByUserId'] = $this->scheduledByUserId; } - $output['targetDate'] = $this->targetDate; + $output['targetDate'] = ($this->targetDate)->format(DateTime::ATOM); return $output; } @@ -284,5 +272,7 @@ public static function validateInput(array|object $input, bool $return = false): public function __clone() { + $this->scheduledAtDate = clone $this->scheduledAtDate; + $this->targetDate = clone $this->targetDate; } } diff --git a/src/Generated/V2/Schemas/Mail/DeliveryboxInternal.php b/src/Generated/V2/Schemas/Mail/DeliveryboxInternal.php new file mode 100644 index 00000000..a2cdf449 --- /dev/null +++ b/src/Generated/V2/Schemas/Mail/DeliveryboxInternal.php @@ -0,0 +1,440 @@ + [ + 'authenticationEnabled' => [ + 'type' => 'boolean', + ], + 'description' => [ + 'type' => 'string', + ], + 'id' => [ + 'format' => 'uuid', + 'type' => 'string', + ], + 'mailsystemSettings' => [ + '$ref' => '#/components/schemas/de.mittwald.v1.mail.MailsystemSettings', + ], + 'name' => [ + 'type' => 'string', + ], + 'passwordUpdatedAt' => [ + 'format' => 'date-time', + 'type' => 'string', + ], + 'projectId' => [ + 'type' => 'string', + ], + 'sendingEnabled' => [ + 'type' => 'boolean', + ], + 'updatedAt' => [ + 'format' => 'date-time', + 'type' => 'string', + ], + ], + 'required' => [ + 'id', + 'name', + 'projectId', + 'description', + 'authenticationEnabled', + 'sendingEnabled', + 'passwordUpdatedAt', + 'updatedAt', + 'mailsystemSettings', + ], + 'type' => 'object', + ]; + + /** + * @var bool + */ + private bool $authenticationEnabled; + + /** + * @var string + */ + private string $description; + + /** + * @var string + */ + private string $id; + + /** + * @var MailsystemSettings + */ + private MailsystemSettings $mailsystemSettings; + + /** + * @var string + */ + private string $name; + + /** + * @var DateTime + */ + private DateTime $passwordUpdatedAt; + + /** + * @var string + */ + private string $projectId; + + /** + * @var bool + */ + private bool $sendingEnabled; + + /** + * @var DateTime + */ + private DateTime $updatedAt; + + /** + * @param bool $authenticationEnabled + * @param string $description + * @param string $id + * @param MailsystemSettings $mailsystemSettings + * @param string $name + * @param DateTime $passwordUpdatedAt + * @param string $projectId + * @param bool $sendingEnabled + * @param DateTime $updatedAt + */ + public function __construct(bool $authenticationEnabled, string $description, string $id, MailsystemSettings $mailsystemSettings, string $name, DateTime $passwordUpdatedAt, string $projectId, bool $sendingEnabled, DateTime $updatedAt) + { + $this->authenticationEnabled = $authenticationEnabled; + $this->description = $description; + $this->id = $id; + $this->mailsystemSettings = $mailsystemSettings; + $this->name = $name; + $this->passwordUpdatedAt = $passwordUpdatedAt; + $this->projectId = $projectId; + $this->sendingEnabled = $sendingEnabled; + $this->updatedAt = $updatedAt; + } + + /** + * @return bool + */ + public function getAuthenticationEnabled(): bool + { + return $this->authenticationEnabled; + } + + /** + * @return string + */ + public function getDescription(): string + { + return $this->description; + } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @return MailsystemSettings + */ + public function getMailsystemSettings(): MailsystemSettings + { + return $this->mailsystemSettings; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @return DateTime + */ + public function getPasswordUpdatedAt(): DateTime + { + return $this->passwordUpdatedAt; + } + + /** + * @return string + */ + public function getProjectId(): string + { + return $this->projectId; + } + + /** + * @return bool + */ + public function getSendingEnabled(): bool + { + return $this->sendingEnabled; + } + + /** + * @return DateTime + */ + public function getUpdatedAt(): DateTime + { + return $this->updatedAt; + } + + /** + * @param bool $authenticationEnabled + * @return self + */ + public function withAuthenticationEnabled(bool $authenticationEnabled): self + { + $validator = new Validator(); + $validator->validate($authenticationEnabled, static::$schema['properties']['authenticationEnabled']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->authenticationEnabled = $authenticationEnabled; + + return $clone; + } + + /** + * @param string $description + * @return self + */ + public function withDescription(string $description): self + { + $validator = new Validator(); + $validator->validate($description, static::$schema['properties']['description']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->description = $description; + + return $clone; + } + + /** + * @param string $id + * @return self + */ + 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; + } + + /** + * @param MailsystemSettings $mailsystemSettings + * @return self + */ + public function withMailsystemSettings(MailsystemSettings $mailsystemSettings): self + { + $clone = clone $this; + $clone->mailsystemSettings = $mailsystemSettings; + + return $clone; + } + + /** + * @param string $name + * @return self + */ + public function withName(string $name): self + { + $validator = new Validator(); + $validator->validate($name, static::$schema['properties']['name']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->name = $name; + + return $clone; + } + + /** + * @param DateTime $passwordUpdatedAt + * @return self + */ + public function withPasswordUpdatedAt(DateTime $passwordUpdatedAt): self + { + $clone = clone $this; + $clone->passwordUpdatedAt = $passwordUpdatedAt; + + return $clone; + } + + /** + * @param string $projectId + * @return self + */ + public function withProjectId(string $projectId): self + { + $validator = new Validator(); + $validator->validate($projectId, static::$schema['properties']['projectId']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->projectId = $projectId; + + return $clone; + } + + /** + * @param bool $sendingEnabled + * @return self + */ + public function withSendingEnabled(bool $sendingEnabled): self + { + $validator = new Validator(); + $validator->validate($sendingEnabled, static::$schema['properties']['sendingEnabled']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->sendingEnabled = $sendingEnabled; + + return $clone; + } + + /** + * @param DateTime $updatedAt + * @return self + */ + public function withUpdatedAt(DateTime $updatedAt): self + { + $clone = clone $this; + $clone->updatedAt = $updatedAt; + + 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 DeliveryboxInternal Created instance + * @throws InvalidArgumentException + */ + public static function buildFromInput(array|object $input, bool $validate = true): DeliveryboxInternal + { + $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; + if ($validate) { + static::validateInput($input); + } + + $authenticationEnabled = (bool)($input->{'authenticationEnabled'}); + $description = $input->{'description'}; + $id = $input->{'id'}; + $mailsystemSettings = MailsystemSettings::buildFromInput($input->{'mailsystemSettings'}, validate: $validate); + $name = $input->{'name'}; + $passwordUpdatedAt = new DateTime($input->{'passwordUpdatedAt'}); + $projectId = $input->{'projectId'}; + $sendingEnabled = (bool)($input->{'sendingEnabled'}); + $updatedAt = new DateTime($input->{'updatedAt'}); + + $obj = new self($authenticationEnabled, $description, $id, $mailsystemSettings, $name, $passwordUpdatedAt, $projectId, $sendingEnabled, $updatedAt); + + 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['authenticationEnabled'] = $this->authenticationEnabled; + $output['description'] = $this->description; + $output['id'] = $this->id; + $output['mailsystemSettings'] = $this->mailsystemSettings->toJson(); + $output['name'] = $this->name; + $output['passwordUpdatedAt'] = ($this->passwordUpdatedAt)->format(DateTime::ATOM); + $output['projectId'] = $this->projectId; + $output['sendingEnabled'] = $this->sendingEnabled; + $output['updatedAt'] = ($this->updatedAt)->format(DateTime::ATOM); + + 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 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() + { + $this->passwordUpdatedAt = clone $this->passwordUpdatedAt; + $this->updatedAt = clone $this->updatedAt; + } +} diff --git a/src/Generated/V2/Schemas/Mail/MailAddress.php b/src/Generated/V2/Schemas/Mail/MailAddress.php index f93c996b..87351d14 100644 --- a/src/Generated/V2/Schemas/Mail/MailAddress.php +++ b/src/Generated/V2/Schemas/Mail/MailAddress.php @@ -41,7 +41,6 @@ class MailAddress 'type' => 'string', ], 'message' => [ - 'minLength' => 1, 'type' => 'string', ], 'startsAt' => [ @@ -51,7 +50,6 @@ class MailAddress ], 'required' => [ 'active', - 'message', ], 'type' => 'object', ], @@ -74,6 +72,9 @@ class MailAddress ], 'mailbox' => [ 'properties' => [ + 'name' => [ + 'type' => 'string', + ], 'passwordUpdatedAt' => [ 'format' => 'date-time', 'type' => 'string', @@ -139,6 +140,7 @@ class MailAddress ], ], 'required' => [ + 'name', 'sendingEnabled', 'spamProtection', 'storageInBytes', diff --git a/src/Generated/V2/Schemas/Mail/MailAddressAutoResponder.php b/src/Generated/V2/Schemas/Mail/MailAddressAutoResponder.php index 7d62ae70..5ed0d9d5 100644 --- a/src/Generated/V2/Schemas/Mail/MailAddressAutoResponder.php +++ b/src/Generated/V2/Schemas/Mail/MailAddressAutoResponder.php @@ -35,7 +35,6 @@ class MailAddressAutoResponder 'type' => 'string', ], 'message' => [ - 'minLength' => 1, 'type' => 'string', ], 'startsAt' => [ @@ -45,7 +44,6 @@ class MailAddressAutoResponder ], 'required' => [ 'active', - 'message', ], 'type' => 'object', ]; @@ -61,9 +59,9 @@ class MailAddressAutoResponder private ?DateTime $expiresAt = null; /** - * @var string + * @var string|null */ - private string $message; + private ?string $message = null; /** * @var DateTime|null @@ -72,12 +70,10 @@ class MailAddressAutoResponder /** * @param bool $active - * @param string $message */ - public function __construct(bool $active, string $message) + public function __construct(bool $active) { $this->active = $active; - $this->message = $message; } /** @@ -97,11 +93,11 @@ public function getExpiresAt(): ?DateTime } /** - * @return string + * @return string|null */ - public function getMessage(): string + public function getMessage(): ?string { - return $this->message; + return $this->message ?? null; } /** @@ -171,6 +167,17 @@ public function withMessage(string $message): self return $clone; } + /** + * @return self + */ + public function withoutMessage(): self + { + $clone = clone $this; + unset($clone->message); + + return $clone; + } + /** * @param DateTime $startsAt * @return self @@ -214,14 +221,18 @@ public static function buildFromInput(array|object $input, bool $validate = true if (isset($input->{'expiresAt'})) { $expiresAt = new DateTime($input->{'expiresAt'}); } - $message = $input->{'message'}; + $message = null; + if (isset($input->{'message'})) { + $message = $input->{'message'}; + } $startsAt = null; if (isset($input->{'startsAt'})) { $startsAt = new DateTime($input->{'startsAt'}); } - $obj = new self($active, $message); + $obj = new self($active); $obj->expiresAt = $expiresAt; + $obj->message = $message; $obj->startsAt = $startsAt; return $obj; } @@ -238,7 +249,9 @@ public function toJson(): array if (isset($this->expiresAt)) { $output['expiresAt'] = ($this->expiresAt)->format(DateTime::ATOM); } - $output['message'] = $this->message; + if (isset($this->message)) { + $output['message'] = $this->message; + } if (isset($this->startsAt)) { $output['startsAt'] = ($this->startsAt)->format(DateTime::ATOM); } diff --git a/src/Generated/V2/Schemas/Mail/MailAddressInternal.php b/src/Generated/V2/Schemas/Mail/MailAddressInternal.php new file mode 100644 index 00000000..76262c3b --- /dev/null +++ b/src/Generated/V2/Schemas/Mail/MailAddressInternal.php @@ -0,0 +1,597 @@ + [ + 'address' => [ + 'format' => 'email', + 'type' => 'string', + ], + 'autoResponder' => [ + 'properties' => [ + 'active' => [ + 'type' => 'boolean', + ], + 'expiresAt' => [ + 'format' => 'date-time', + 'type' => 'string', + ], + 'message' => [ + 'type' => 'string', + ], + 'startsAt' => [ + 'format' => 'date-time', + 'type' => 'string', + ], + ], + 'required' => [ + 'active', + ], + 'type' => 'object', + ], + 'forwardAddresses' => [ + 'items' => [ + 'format' => 'email', + 'type' => 'string', + ], + 'type' => 'array', + ], + 'id' => [ + 'format' => 'uuid', + 'type' => 'string', + ], + 'isArchived' => [ + 'type' => 'boolean', + ], + 'isCatchAll' => [ + 'type' => 'boolean', + ], + 'mailbox' => [ + 'properties' => [ + 'mailsystemSettings' => [ + '$ref' => '#/components/schemas/de.mittwald.v1.mail.MailsystemSettings', + ], + 'name' => [ + 'type' => 'string', + ], + 'passwordUpdatedAt' => [ + 'format' => 'date-time', + 'type' => 'string', + ], + 'sendingEnabled' => [ + 'type' => 'boolean', + ], + 'spamProtection' => [ + 'properties' => [ + 'active' => [ + 'type' => 'boolean', + ], + 'autoDeleteSpam' => [ + 'type' => 'boolean', + ], + 'folder' => [ + 'enum' => [ + 'spam', + 'inbox', + ], + 'type' => 'string', + ], + 'relocationMinSpamScore' => [ + 'maximum' => 10, + 'type' => 'integer', + ], + ], + 'required' => [ + 'active', + 'folder', + 'relocationMinSpamScore', + 'autoDeleteSpam', + ], + 'type' => 'object', + ], + 'storageInBytes' => [ + 'properties' => [ + 'current' => [ + 'properties' => [ + 'updatedAt' => [ + 'format' => 'date-time', + 'type' => 'string', + ], + 'value' => [ + 'type' => 'number', + ], + ], + 'required' => [ + 'value', + 'updatedAt', + ], + 'type' => 'object', + ], + 'limit' => [ + 'type' => 'number', + ], + ], + 'required' => [ + 'limit', + 'current', + ], + 'type' => 'object', + ], + ], + 'required' => [ + 'name', + 'sendingEnabled', + 'spamProtection', + 'storageInBytes', + 'passwordUpdatedAt', + 'mailsystemSettings', + ], + 'type' => 'object', + ], + 'projectId' => [ + 'type' => 'string', + ], + 'receivingDisabled' => [ + 'type' => 'boolean', + ], + 'updatedAt' => [ + 'format' => 'date-time', + 'type' => 'string', + ], + ], + 'required' => [ + 'id', + 'receivingDisabled', + 'address', + 'isCatchAll', + 'projectId', + 'forwardAddresses', + 'updatedAt', + 'autoResponder', + 'isArchived', + ], + 'type' => 'object', + ]; + + /** + * @var string + */ + private string $address; + + /** + * @var MailAddressInternalAutoResponder + */ + private MailAddressInternalAutoResponder $autoResponder; + + /** + * @var string[] + */ + private array $forwardAddresses; + + /** + * @var string + */ + private string $id; + + /** + * @var bool + */ + private bool $isArchived; + + /** + * @var bool + */ + private bool $isCatchAll; + + /** + * @var MailAddressInternalMailbox|null + */ + private ?MailAddressInternalMailbox $mailbox = null; + + /** + * @var string + */ + private string $projectId; + + /** + * @var bool + */ + private bool $receivingDisabled; + + /** + * @var DateTime + */ + private DateTime $updatedAt; + + /** + * @param string $address + * @param MailAddressInternalAutoResponder $autoResponder + * @param string[] $forwardAddresses + * @param string $id + * @param bool $isArchived + * @param bool $isCatchAll + * @param string $projectId + * @param bool $receivingDisabled + * @param DateTime $updatedAt + */ + public function __construct(string $address, MailAddressInternalAutoResponder $autoResponder, array $forwardAddresses, string $id, bool $isArchived, bool $isCatchAll, string $projectId, bool $receivingDisabled, DateTime $updatedAt) + { + $this->address = $address; + $this->autoResponder = $autoResponder; + $this->forwardAddresses = $forwardAddresses; + $this->id = $id; + $this->isArchived = $isArchived; + $this->isCatchAll = $isCatchAll; + $this->projectId = $projectId; + $this->receivingDisabled = $receivingDisabled; + $this->updatedAt = $updatedAt; + } + + /** + * @return string + */ + public function getAddress(): string + { + return $this->address; + } + + /** + * @return MailAddressInternalAutoResponder + */ + public function getAutoResponder(): MailAddressInternalAutoResponder + { + return $this->autoResponder; + } + + /** + * @return string[] + */ + public function getForwardAddresses(): array + { + return $this->forwardAddresses; + } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @return bool + */ + public function getIsArchived(): bool + { + return $this->isArchived; + } + + /** + * @return bool + */ + public function getIsCatchAll(): bool + { + return $this->isCatchAll; + } + + /** + * @return MailAddressInternalMailbox|null + */ + public function getMailbox(): ?MailAddressInternalMailbox + { + return $this->mailbox ?? null; + } + + /** + * @return string + */ + public function getProjectId(): string + { + return $this->projectId; + } + + /** + * @return bool + */ + public function getReceivingDisabled(): bool + { + return $this->receivingDisabled; + } + + /** + * @return DateTime + */ + public function getUpdatedAt(): DateTime + { + return $this->updatedAt; + } + + /** + * @param string $address + * @return self + */ + public function withAddress(string $address): self + { + $validator = new Validator(); + $validator->validate($address, static::$schema['properties']['address']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->address = $address; + + return $clone; + } + + /** + * @param MailAddressInternalAutoResponder $autoResponder + * @return self + */ + public function withAutoResponder(MailAddressInternalAutoResponder $autoResponder): self + { + $clone = clone $this; + $clone->autoResponder = $autoResponder; + + return $clone; + } + + /** + * @param string[] $forwardAddresses + * @return self + */ + public function withForwardAddresses(array $forwardAddresses): self + { + $validator = new Validator(); + $validator->validate($forwardAddresses, static::$schema['properties']['forwardAddresses']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->forwardAddresses = $forwardAddresses; + + return $clone; + } + + /** + * @param string $id + * @return self + */ + 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; + } + + /** + * @param bool $isArchived + * @return self + */ + public function withIsArchived(bool $isArchived): self + { + $validator = new Validator(); + $validator->validate($isArchived, static::$schema['properties']['isArchived']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->isArchived = $isArchived; + + return $clone; + } + + /** + * @param bool $isCatchAll + * @return self + */ + public function withIsCatchAll(bool $isCatchAll): self + { + $validator = new Validator(); + $validator->validate($isCatchAll, static::$schema['properties']['isCatchAll']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->isCatchAll = $isCatchAll; + + return $clone; + } + + /** + * @param MailAddressInternalMailbox $mailbox + * @return self + */ + public function withMailbox(MailAddressInternalMailbox $mailbox): self + { + $clone = clone $this; + $clone->mailbox = $mailbox; + + return $clone; + } + + /** + * @return self + */ + public function withoutMailbox(): self + { + $clone = clone $this; + unset($clone->mailbox); + + return $clone; + } + + /** + * @param string $projectId + * @return self + */ + public function withProjectId(string $projectId): self + { + $validator = new Validator(); + $validator->validate($projectId, static::$schema['properties']['projectId']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->projectId = $projectId; + + return $clone; + } + + /** + * @param bool $receivingDisabled + * @return self + */ + public function withReceivingDisabled(bool $receivingDisabled): self + { + $validator = new Validator(); + $validator->validate($receivingDisabled, static::$schema['properties']['receivingDisabled']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->receivingDisabled = $receivingDisabled; + + return $clone; + } + + /** + * @param DateTime $updatedAt + * @return self + */ + public function withUpdatedAt(DateTime $updatedAt): self + { + $clone = clone $this; + $clone->updatedAt = $updatedAt; + + 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 MailAddressInternal Created instance + * @throws InvalidArgumentException + */ + public static function buildFromInput(array|object $input, bool $validate = true): MailAddressInternal + { + $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; + if ($validate) { + static::validateInput($input); + } + + $address = $input->{'address'}; + $autoResponder = MailAddressInternalAutoResponder::buildFromInput($input->{'autoResponder'}, validate: $validate); + $forwardAddresses = $input->{'forwardAddresses'}; + $id = $input->{'id'}; + $isArchived = (bool)($input->{'isArchived'}); + $isCatchAll = (bool)($input->{'isCatchAll'}); + $mailbox = null; + if (isset($input->{'mailbox'})) { + $mailbox = MailAddressInternalMailbox::buildFromInput($input->{'mailbox'}, validate: $validate); + } + $projectId = $input->{'projectId'}; + $receivingDisabled = (bool)($input->{'receivingDisabled'}); + $updatedAt = new DateTime($input->{'updatedAt'}); + + $obj = new self($address, $autoResponder, $forwardAddresses, $id, $isArchived, $isCatchAll, $projectId, $receivingDisabled, $updatedAt); + $obj->mailbox = $mailbox; + 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['address'] = $this->address; + $output['autoResponder'] = ($this->autoResponder)->toJson(); + $output['forwardAddresses'] = $this->forwardAddresses; + $output['id'] = $this->id; + $output['isArchived'] = $this->isArchived; + $output['isCatchAll'] = $this->isCatchAll; + if (isset($this->mailbox)) { + $output['mailbox'] = ($this->mailbox)->toJson(); + } + $output['projectId'] = $this->projectId; + $output['receivingDisabled'] = $this->receivingDisabled; + $output['updatedAt'] = ($this->updatedAt)->format(DateTime::ATOM); + + 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 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() + { + $this->autoResponder = clone $this->autoResponder; + if (isset($this->mailbox)) { + $this->mailbox = clone $this->mailbox; + } + $this->updatedAt = clone $this->updatedAt; + } +} diff --git a/src/Generated/V2/Schemas/Mail/MailAddressInternalAutoResponder.php b/src/Generated/V2/Schemas/Mail/MailAddressInternalAutoResponder.php new file mode 100644 index 00000000..de12a90e --- /dev/null +++ b/src/Generated/V2/Schemas/Mail/MailAddressInternalAutoResponder.php @@ -0,0 +1,295 @@ + [ + 'active' => [ + 'type' => 'boolean', + ], + 'expiresAt' => [ + 'format' => 'date-time', + 'type' => 'string', + ], + 'message' => [ + 'type' => 'string', + ], + 'startsAt' => [ + 'format' => 'date-time', + 'type' => 'string', + ], + ], + 'required' => [ + 'active', + ], + 'type' => 'object', + ]; + + /** + * @var bool + */ + private bool $active; + + /** + * @var DateTime|null + */ + private ?DateTime $expiresAt = null; + + /** + * @var string|null + */ + private ?string $message = null; + + /** + * @var DateTime|null + */ + private ?DateTime $startsAt = null; + + /** + * @param bool $active + */ + public function __construct(bool $active) + { + $this->active = $active; + } + + /** + * @return bool + */ + public function getActive(): bool + { + return $this->active; + } + + /** + * @return DateTime|null + */ + public function getExpiresAt(): ?DateTime + { + return $this->expiresAt ?? null; + } + + /** + * @return string|null + */ + public function getMessage(): ?string + { + return $this->message ?? null; + } + + /** + * @return DateTime|null + */ + public function getStartsAt(): ?DateTime + { + return $this->startsAt ?? null; + } + + /** + * @param bool $active + * @return self + */ + public function withActive(bool $active): self + { + $validator = new Validator(); + $validator->validate($active, static::$schema['properties']['active']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->active = $active; + + return $clone; + } + + /** + * @param DateTime $expiresAt + * @return self + */ + public function withExpiresAt(DateTime $expiresAt): self + { + $clone = clone $this; + $clone->expiresAt = $expiresAt; + + return $clone; + } + + /** + * @return self + */ + public function withoutExpiresAt(): self + { + $clone = clone $this; + unset($clone->expiresAt); + + return $clone; + } + + /** + * @param string $message + * @return self + */ + public function withMessage(string $message): self + { + $validator = new Validator(); + $validator->validate($message, static::$schema['properties']['message']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->message = $message; + + return $clone; + } + + /** + * @return self + */ + public function withoutMessage(): self + { + $clone = clone $this; + unset($clone->message); + + return $clone; + } + + /** + * @param DateTime $startsAt + * @return self + */ + public function withStartsAt(DateTime $startsAt): self + { + $clone = clone $this; + $clone->startsAt = $startsAt; + + return $clone; + } + + /** + * @return self + */ + public function withoutStartsAt(): self + { + $clone = clone $this; + unset($clone->startsAt); + + 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 MailAddressInternalAutoResponder Created instance + * @throws InvalidArgumentException + */ + public static function buildFromInput(array|object $input, bool $validate = true): MailAddressInternalAutoResponder + { + $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; + if ($validate) { + static::validateInput($input); + } + + $active = (bool)($input->{'active'}); + $expiresAt = null; + if (isset($input->{'expiresAt'})) { + $expiresAt = new DateTime($input->{'expiresAt'}); + } + $message = null; + if (isset($input->{'message'})) { + $message = $input->{'message'}; + } + $startsAt = null; + if (isset($input->{'startsAt'})) { + $startsAt = new DateTime($input->{'startsAt'}); + } + + $obj = new self($active); + $obj->expiresAt = $expiresAt; + $obj->message = $message; + $obj->startsAt = $startsAt; + 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['active'] = $this->active; + if (isset($this->expiresAt)) { + $output['expiresAt'] = ($this->expiresAt)->format(DateTime::ATOM); + } + if (isset($this->message)) { + $output['message'] = $this->message; + } + if (isset($this->startsAt)) { + $output['startsAt'] = ($this->startsAt)->format(DateTime::ATOM); + } + + 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 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() + { + if (isset($this->expiresAt)) { + $this->expiresAt = clone $this->expiresAt; + } + if (isset($this->startsAt)) { + $this->startsAt = clone $this->startsAt; + } + } +} diff --git a/src/Generated/V2/Schemas/Mail/MailAddressInternalMailbox.php b/src/Generated/V2/Schemas/Mail/MailAddressInternalMailbox.php new file mode 100644 index 00000000..fea7619d --- /dev/null +++ b/src/Generated/V2/Schemas/Mail/MailAddressInternalMailbox.php @@ -0,0 +1,366 @@ + [ + 'mailsystemSettings' => [ + '$ref' => '#/components/schemas/de.mittwald.v1.mail.MailsystemSettings', + ], + 'name' => [ + 'type' => 'string', + ], + 'passwordUpdatedAt' => [ + 'format' => 'date-time', + 'type' => 'string', + ], + 'sendingEnabled' => [ + 'type' => 'boolean', + ], + 'spamProtection' => [ + 'properties' => [ + 'active' => [ + 'type' => 'boolean', + ], + 'autoDeleteSpam' => [ + 'type' => 'boolean', + ], + 'folder' => [ + 'enum' => [ + 'spam', + 'inbox', + ], + 'type' => 'string', + ], + 'relocationMinSpamScore' => [ + 'maximum' => 10, + 'type' => 'integer', + ], + ], + 'required' => [ + 'active', + 'folder', + 'relocationMinSpamScore', + 'autoDeleteSpam', + ], + 'type' => 'object', + ], + 'storageInBytes' => [ + 'properties' => [ + 'current' => [ + 'properties' => [ + 'updatedAt' => [ + 'format' => 'date-time', + 'type' => 'string', + ], + 'value' => [ + 'type' => 'number', + ], + ], + 'required' => [ + 'value', + 'updatedAt', + ], + 'type' => 'object', + ], + 'limit' => [ + 'type' => 'number', + ], + ], + 'required' => [ + 'limit', + 'current', + ], + 'type' => 'object', + ], + ], + 'required' => [ + 'name', + 'sendingEnabled', + 'spamProtection', + 'storageInBytes', + 'passwordUpdatedAt', + 'mailsystemSettings', + ], + 'type' => 'object', + ]; + + /** + * @var MailsystemSettings + */ + private MailsystemSettings $mailsystemSettings; + + /** + * @var string + */ + private string $name; + + /** + * @var DateTime + */ + private DateTime $passwordUpdatedAt; + + /** + * @var bool + */ + private bool $sendingEnabled; + + /** + * @var MailAddressInternalMailboxSpamProtection + */ + private MailAddressInternalMailboxSpamProtection $spamProtection; + + /** + * @var MailAddressInternalMailboxStorageInBytes + */ + private MailAddressInternalMailboxStorageInBytes $storageInBytes; + + /** + * @param MailsystemSettings $mailsystemSettings + * @param string $name + * @param DateTime $passwordUpdatedAt + * @param bool $sendingEnabled + * @param MailAddressInternalMailboxSpamProtection $spamProtection + * @param MailAddressInternalMailboxStorageInBytes $storageInBytes + */ + public function __construct(MailsystemSettings $mailsystemSettings, string $name, DateTime $passwordUpdatedAt, bool $sendingEnabled, MailAddressInternalMailboxSpamProtection $spamProtection, MailAddressInternalMailboxStorageInBytes $storageInBytes) + { + $this->mailsystemSettings = $mailsystemSettings; + $this->name = $name; + $this->passwordUpdatedAt = $passwordUpdatedAt; + $this->sendingEnabled = $sendingEnabled; + $this->spamProtection = $spamProtection; + $this->storageInBytes = $storageInBytes; + } + + /** + * @return MailsystemSettings + */ + public function getMailsystemSettings(): MailsystemSettings + { + return $this->mailsystemSettings; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @return DateTime + */ + public function getPasswordUpdatedAt(): DateTime + { + return $this->passwordUpdatedAt; + } + + /** + * @return bool + */ + public function getSendingEnabled(): bool + { + return $this->sendingEnabled; + } + + /** + * @return MailAddressInternalMailboxSpamProtection + */ + public function getSpamProtection(): MailAddressInternalMailboxSpamProtection + { + return $this->spamProtection; + } + + /** + * @return MailAddressInternalMailboxStorageInBytes + */ + public function getStorageInBytes(): MailAddressInternalMailboxStorageInBytes + { + return $this->storageInBytes; + } + + /** + * @param MailsystemSettings $mailsystemSettings + * @return self + */ + public function withMailsystemSettings(MailsystemSettings $mailsystemSettings): self + { + $clone = clone $this; + $clone->mailsystemSettings = $mailsystemSettings; + + return $clone; + } + + /** + * @param string $name + * @return self + */ + public function withName(string $name): self + { + $validator = new Validator(); + $validator->validate($name, static::$schema['properties']['name']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->name = $name; + + return $clone; + } + + /** + * @param DateTime $passwordUpdatedAt + * @return self + */ + public function withPasswordUpdatedAt(DateTime $passwordUpdatedAt): self + { + $clone = clone $this; + $clone->passwordUpdatedAt = $passwordUpdatedAt; + + return $clone; + } + + /** + * @param bool $sendingEnabled + * @return self + */ + public function withSendingEnabled(bool $sendingEnabled): self + { + $validator = new Validator(); + $validator->validate($sendingEnabled, static::$schema['properties']['sendingEnabled']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->sendingEnabled = $sendingEnabled; + + return $clone; + } + + /** + * @param MailAddressInternalMailboxSpamProtection $spamProtection + * @return self + */ + public function withSpamProtection(MailAddressInternalMailboxSpamProtection $spamProtection): self + { + $clone = clone $this; + $clone->spamProtection = $spamProtection; + + return $clone; + } + + /** + * @param MailAddressInternalMailboxStorageInBytes $storageInBytes + * @return self + */ + public function withStorageInBytes(MailAddressInternalMailboxStorageInBytes $storageInBytes): self + { + $clone = clone $this; + $clone->storageInBytes = $storageInBytes; + + 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 MailAddressInternalMailbox Created instance + * @throws InvalidArgumentException + */ + public static function buildFromInput(array|object $input, bool $validate = true): MailAddressInternalMailbox + { + $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; + if ($validate) { + static::validateInput($input); + } + + $mailsystemSettings = MailsystemSettings::buildFromInput($input->{'mailsystemSettings'}, validate: $validate); + $name = $input->{'name'}; + $passwordUpdatedAt = new DateTime($input->{'passwordUpdatedAt'}); + $sendingEnabled = (bool)($input->{'sendingEnabled'}); + $spamProtection = MailAddressInternalMailboxSpamProtection::buildFromInput($input->{'spamProtection'}, validate: $validate); + $storageInBytes = MailAddressInternalMailboxStorageInBytes::buildFromInput($input->{'storageInBytes'}, validate: $validate); + + $obj = new self($mailsystemSettings, $name, $passwordUpdatedAt, $sendingEnabled, $spamProtection, $storageInBytes); + + 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['mailsystemSettings'] = $this->mailsystemSettings->toJson(); + $output['name'] = $this->name; + $output['passwordUpdatedAt'] = ($this->passwordUpdatedAt)->format(DateTime::ATOM); + $output['sendingEnabled'] = $this->sendingEnabled; + $output['spamProtection'] = ($this->spamProtection)->toJson(); + $output['storageInBytes'] = ($this->storageInBytes)->toJson(); + + 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 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() + { + $this->passwordUpdatedAt = clone $this->passwordUpdatedAt; + $this->spamProtection = clone $this->spamProtection; + $this->storageInBytes = clone $this->storageInBytes; + } +} diff --git a/src/Generated/V2/Schemas/Mail/MailAddressInternalMailboxSpamProtection.php b/src/Generated/V2/Schemas/Mail/MailAddressInternalMailboxSpamProtection.php new file mode 100644 index 00000000..fbaddd48 --- /dev/null +++ b/src/Generated/V2/Schemas/Mail/MailAddressInternalMailboxSpamProtection.php @@ -0,0 +1,256 @@ + [ + 'active' => [ + 'type' => 'boolean', + ], + 'autoDeleteSpam' => [ + 'type' => 'boolean', + ], + 'folder' => [ + 'enum' => [ + 'spam', + 'inbox', + ], + 'type' => 'string', + ], + 'relocationMinSpamScore' => [ + 'maximum' => 10, + 'type' => 'integer', + ], + ], + 'required' => [ + 'active', + 'folder', + 'relocationMinSpamScore', + 'autoDeleteSpam', + ], + 'type' => 'object', + ]; + + /** + * @var bool + */ + private bool $active; + + /** + * @var bool + */ + private bool $autoDeleteSpam; + + /** + * @var MailAddressInternalMailboxSpamProtectionFolder + */ + private MailAddressInternalMailboxSpamProtectionFolder $folder; + + /** + * @var int + */ + private int $relocationMinSpamScore; + + /** + * @param bool $active + * @param bool $autoDeleteSpam + * @param MailAddressInternalMailboxSpamProtectionFolder $folder + * @param int $relocationMinSpamScore + */ + public function __construct(bool $active, bool $autoDeleteSpam, MailAddressInternalMailboxSpamProtectionFolder $folder, int $relocationMinSpamScore) + { + $this->active = $active; + $this->autoDeleteSpam = $autoDeleteSpam; + $this->folder = $folder; + $this->relocationMinSpamScore = $relocationMinSpamScore; + } + + /** + * @return bool + */ + public function getActive(): bool + { + return $this->active; + } + + /** + * @return bool + */ + public function getAutoDeleteSpam(): bool + { + return $this->autoDeleteSpam; + } + + /** + * @return MailAddressInternalMailboxSpamProtectionFolder + */ + public function getFolder(): MailAddressInternalMailboxSpamProtectionFolder + { + return $this->folder; + } + + /** + * @return int + */ + public function getRelocationMinSpamScore(): int + { + return $this->relocationMinSpamScore; + } + + /** + * @param bool $active + * @return self + */ + public function withActive(bool $active): self + { + $validator = new Validator(); + $validator->validate($active, static::$schema['properties']['active']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->active = $active; + + return $clone; + } + + /** + * @param bool $autoDeleteSpam + * @return self + */ + public function withAutoDeleteSpam(bool $autoDeleteSpam): self + { + $validator = new Validator(); + $validator->validate($autoDeleteSpam, static::$schema['properties']['autoDeleteSpam']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->autoDeleteSpam = $autoDeleteSpam; + + return $clone; + } + + /** + * @param MailAddressInternalMailboxSpamProtectionFolder $folder + * @return self + */ + public function withFolder(MailAddressInternalMailboxSpamProtectionFolder $folder): self + { + $clone = clone $this; + $clone->folder = $folder; + + return $clone; + } + + /** + * @param int $relocationMinSpamScore + * @return self + */ + public function withRelocationMinSpamScore(int $relocationMinSpamScore): self + { + $validator = new Validator(); + $validator->validate($relocationMinSpamScore, static::$schema['properties']['relocationMinSpamScore']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->relocationMinSpamScore = $relocationMinSpamScore; + + 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 MailAddressInternalMailboxSpamProtection Created instance + * @throws InvalidArgumentException + */ + public static function buildFromInput(array|object $input, bool $validate = true): MailAddressInternalMailboxSpamProtection + { + $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; + if ($validate) { + static::validateInput($input); + } + + $active = (bool)($input->{'active'}); + $autoDeleteSpam = (bool)($input->{'autoDeleteSpam'}); + $folder = MailAddressInternalMailboxSpamProtectionFolder::from($input->{'folder'}); + $relocationMinSpamScore = (int)($input->{'relocationMinSpamScore'}); + + $obj = new self($active, $autoDeleteSpam, $folder, $relocationMinSpamScore); + + 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['active'] = $this->active; + $output['autoDeleteSpam'] = $this->autoDeleteSpam; + $output['folder'] = ($this->folder)->value; + $output['relocationMinSpamScore'] = $this->relocationMinSpamScore; + + 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 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/Mail/MailAddressInternalMailboxSpamProtectionFolder.php b/src/Generated/V2/Schemas/Mail/MailAddressInternalMailboxSpamProtectionFolder.php new file mode 100644 index 00000000..f91fec84 --- /dev/null +++ b/src/Generated/V2/Schemas/Mail/MailAddressInternalMailboxSpamProtectionFolder.php @@ -0,0 +1,9 @@ + [ + 'current' => [ + 'properties' => [ + 'updatedAt' => [ + 'format' => 'date-time', + 'type' => 'string', + ], + 'value' => [ + 'type' => 'number', + ], + ], + 'required' => [ + 'value', + 'updatedAt', + ], + 'type' => 'object', + ], + 'limit' => [ + 'type' => 'number', + ], + ], + 'required' => [ + 'limit', + 'current', + ], + 'type' => 'object', + ]; + + /** + * @var MailAddressInternalMailboxStorageInBytesCurrent + */ + private MailAddressInternalMailboxStorageInBytesCurrent $current; + + /** + * @var int|float + */ + private int|float $limit; + + /** + * @param MailAddressInternalMailboxStorageInBytesCurrent $current + * @param int|float $limit + */ + public function __construct(MailAddressInternalMailboxStorageInBytesCurrent $current, int|float $limit) + { + $this->current = $current; + $this->limit = $limit; + } + + /** + * @return MailAddressInternalMailboxStorageInBytesCurrent + */ + public function getCurrent(): MailAddressInternalMailboxStorageInBytesCurrent + { + return $this->current; + } + + /** + * @return int|float + */ + public function getLimit(): int|float + { + return $this->limit; + } + + /** + * @param MailAddressInternalMailboxStorageInBytesCurrent $current + * @return self + */ + public function withCurrent(MailAddressInternalMailboxStorageInBytesCurrent $current): self + { + $clone = clone $this; + $clone->current = $current; + + return $clone; + } + + /** + * @param int|float $limit + * @return self + */ + public function withLimit(int|float $limit): self + { + $validator = new Validator(); + $validator->validate($limit, static::$schema['properties']['limit']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->limit = $limit; + + 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 MailAddressInternalMailboxStorageInBytes Created instance + * @throws InvalidArgumentException + */ + public static function buildFromInput(array|object $input, bool $validate = true): MailAddressInternalMailboxStorageInBytes + { + $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; + if ($validate) { + static::validateInput($input); + } + + $current = MailAddressInternalMailboxStorageInBytesCurrent::buildFromInput($input->{'current'}, validate: $validate); + $limit = str_contains($input->{'limit'}, '.') ? (float)($input->{'limit'}) : (int)($input->{'limit'}); + + $obj = new self($current, $limit); + + 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['current'] = ($this->current)->toJson(); + $output['limit'] = $this->limit; + + 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 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() + { + $this->current = clone $this->current; + } +} diff --git a/src/Generated/V2/Clients/Domain/ListDomainOwnerships/ListDomainOwnershipsRequest.php b/src/Generated/V2/Schemas/Mail/MailAddressInternalMailboxStorageInBytesCurrent.php similarity index 51% rename from src/Generated/V2/Clients/Domain/ListDomainOwnerships/ListDomainOwnershipsRequest.php rename to src/Generated/V2/Schemas/Mail/MailAddressInternalMailboxStorageInBytesCurrent.php index 3a436103..719964ce 100644 --- a/src/Generated/V2/Clients/Domain/ListDomainOwnerships/ListDomainOwnershipsRequest.php +++ b/src/Generated/V2/Schemas/Mail/MailAddressInternalMailboxStorageInBytesCurrent.php @@ -2,72 +2,108 @@ declare(strict_types=1); -namespace Mittwald\ApiClient\Generated\V2\Clients\Domain\ListDomainOwnerships; +namespace Mittwald\ApiClient\Generated\V2\Schemas\Mail; +use DateTime; use InvalidArgumentException; use JsonSchema\Validator; -class ListDomainOwnershipsRequest +/** + * Auto-generated class for de.mittwald.v1.mail.MailAddressInternal. + * + * DO NOT EDIT; this class was generated by the mittwald/api-client-builder package + * (https://github.com/mittwald/api-client-php-builder). Please make any changes + * there. + * + * @generated + * @see https://github.com/mittwald/api-client-php-builder + */ +class MailAddressInternalMailboxStorageInBytesCurrent { - public const method = 'get'; - /** * Schema used to validate input for creating instances of this class * * @var array */ private static array $schema = [ - 'type' => 'object', 'properties' => [ - 'projectId' => [ - 'format' => 'uuid', + 'updatedAt' => [ + 'format' => 'date-time', 'type' => 'string', ], + 'value' => [ + 'type' => 'number', + ], ], 'required' => [ - 'projectId', + 'value', + 'updatedAt', ], + 'type' => 'object', ]; /** - * @var string + * @var DateTime */ - private string $projectId; + private DateTime $updatedAt; - private array $headers = [ + /** + * @var int|float + */ + private int|float $value; - ]; + /** + * @param DateTime $updatedAt + * @param int|float $value + */ + public function __construct(DateTime $updatedAt, int|float $value) + { + $this->updatedAt = $updatedAt; + $this->value = $value; + } /** - * @param string $projectId + * @return DateTime */ - public function __construct(string $projectId) + public function getUpdatedAt(): DateTime { - $this->projectId = $projectId; + return $this->updatedAt; } /** - * @return string + * @return int|float */ - public function getProjectId(): string + public function getValue(): int|float { - return $this->projectId; + return $this->value; } /** - * @param string $projectId + * @param DateTime $updatedAt * @return self */ - public function withProjectId(string $projectId): self + public function withUpdatedAt(DateTime $updatedAt): self + { + $clone = clone $this; + $clone->updatedAt = $updatedAt; + + return $clone; + } + + /** + * @param int|float $value + * @return self + */ + public function withValue(int|float $value): self { $validator = new Validator(); - $validator->validate($projectId, static::$schema['properties']['projectId']); + $validator->validate($value, static::$schema['properties']['value']); if (!$validator->isValid()) { throw new InvalidArgumentException($validator->getErrors()[0]['message']); } $clone = clone $this; - $clone->projectId = $projectId; + $clone->value = $value; return $clone; } @@ -77,19 +113,20 @@ public function withProjectId(string $projectId): self * * @param array|object $input Input data * @param bool $validate Set this to false to skip validation; use at own risk - * @return ListDomainOwnershipsRequest Created instance + * @return MailAddressInternalMailboxStorageInBytesCurrent Created instance * @throws InvalidArgumentException */ - public static function buildFromInput(array|object $input, bool $validate = true): ListDomainOwnershipsRequest + public static function buildFromInput(array|object $input, bool $validate = true): MailAddressInternalMailboxStorageInBytesCurrent { $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; if ($validate) { static::validateInput($input); } - $projectId = $input->{'projectId'}; + $updatedAt = new DateTime($input->{'updatedAt'}); + $value = str_contains($input->{'value'}, '.') ? (float)($input->{'value'}) : (int)($input->{'value'}); - $obj = new self($projectId); + $obj = new self($updatedAt, $value); return $obj; } @@ -102,7 +139,8 @@ public static function buildFromInput(array|object $input, bool $validate = true public function toJson(): array { $output = []; - $output['projectId'] = $this->projectId; + $output['updatedAt'] = ($this->updatedAt)->format(DateTime::ATOM); + $output['value'] = $this->value; return $output; } @@ -133,56 +171,6 @@ public static function validateInput(array|object $input, bool $return = false): public function __clone() { - } - - /** - * Builds the URL for this request - * - * This method is used internally by the client to build the URL for this request. - * You should not need to call this method directly. - * - * @internal - * @return string The URL for this request - */ - public function buildUrl(): string - { - $mapped = $this->toJson(); - $projectId = urlencode($mapped['projectId']); - return '/v2/projects/' . $projectId . '/domain-ownerships'; - } - - /** - * Builds the request options for this request - * - * This method is used internally by the client to build the Guzzle request options - * for this request. You should not need to call this method directly. - * - * @internal - * @return array The Guzzle request options for this request - */ - public function buildRequestOptions(): array - { - $mapped = $this->toJson(); - $query = []; - return [ - 'query' => $query, - 'headers' => $this->headers, - ]; - } - - /** - * Adds a header to this request - * - * You can use this method to add custom HTTP headers to the request. - * - * @param string $name The name of the header to add - * @param string|array $value The value of the header to add - * @return self A clone of this request with the header added - */ - public function withHeader(string $name, string|array $value): self - { - $clone = clone $this; - $clone->headers[$name] = $value; - return $clone; + $this->updatedAt = clone $this->updatedAt; } } diff --git a/src/Generated/V2/Schemas/Mail/MailAddressMailbox.php b/src/Generated/V2/Schemas/Mail/MailAddressMailbox.php index 2be5ff08..97660c68 100644 --- a/src/Generated/V2/Schemas/Mail/MailAddressMailbox.php +++ b/src/Generated/V2/Schemas/Mail/MailAddressMailbox.php @@ -27,6 +27,9 @@ class MailAddressMailbox */ private static array $schema = [ 'properties' => [ + 'name' => [ + 'type' => 'string', + ], 'passwordUpdatedAt' => [ 'format' => 'date-time', 'type' => 'string', @@ -92,6 +95,7 @@ class MailAddressMailbox ], ], 'required' => [ + 'name', 'sendingEnabled', 'spamProtection', 'storageInBytes', @@ -100,6 +104,11 @@ class MailAddressMailbox 'type' => 'object', ]; + /** + * @var string + */ + private string $name; + /** * @var DateTime */ @@ -121,19 +130,29 @@ class MailAddressMailbox private MailAddressMailboxStorageInBytes $storageInBytes; /** + * @param string $name * @param DateTime $passwordUpdatedAt * @param bool $sendingEnabled * @param MailAddressMailboxSpamProtection $spamProtection * @param MailAddressMailboxStorageInBytes $storageInBytes */ - public function __construct(DateTime $passwordUpdatedAt, bool $sendingEnabled, MailAddressMailboxSpamProtection $spamProtection, MailAddressMailboxStorageInBytes $storageInBytes) + public function __construct(string $name, DateTime $passwordUpdatedAt, bool $sendingEnabled, MailAddressMailboxSpamProtection $spamProtection, MailAddressMailboxStorageInBytes $storageInBytes) { + $this->name = $name; $this->passwordUpdatedAt = $passwordUpdatedAt; $this->sendingEnabled = $sendingEnabled; $this->spamProtection = $spamProtection; $this->storageInBytes = $storageInBytes; } + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + /** * @return DateTime */ @@ -166,6 +185,24 @@ public function getStorageInBytes(): MailAddressMailboxStorageInBytes return $this->storageInBytes; } + /** + * @param string $name + * @return self + */ + public function withName(string $name): self + { + $validator = new Validator(); + $validator->validate($name, static::$schema['properties']['name']); + if (!$validator->isValid()) { + throw new InvalidArgumentException($validator->getErrors()[0]['message']); + } + + $clone = clone $this; + $clone->name = $name; + + return $clone; + } + /** * @param DateTime $passwordUpdatedAt * @return self @@ -235,12 +272,13 @@ public static function buildFromInput(array|object $input, bool $validate = true static::validateInput($input); } + $name = $input->{'name'}; $passwordUpdatedAt = new DateTime($input->{'passwordUpdatedAt'}); $sendingEnabled = (bool)($input->{'sendingEnabled'}); $spamProtection = MailAddressMailboxSpamProtection::buildFromInput($input->{'spamProtection'}, validate: $validate); $storageInBytes = MailAddressMailboxStorageInBytes::buildFromInput($input->{'storageInBytes'}, validate: $validate); - $obj = new self($passwordUpdatedAt, $sendingEnabled, $spamProtection, $storageInBytes); + $obj = new self($name, $passwordUpdatedAt, $sendingEnabled, $spamProtection, $storageInBytes); return $obj; } @@ -253,6 +291,7 @@ public static function buildFromInput(array|object $input, bool $validate = true public function toJson(): array { $output = []; + $output['name'] = $this->name; $output['passwordUpdatedAt'] = ($this->passwordUpdatedAt)->format(DateTime::ATOM); $output['sendingEnabled'] = $this->sendingEnabled; $output['spamProtection'] = ($this->spamProtection)->toJson(); diff --git a/src/Generated/V2/Schemas/Domain/DomainOwnership.php b/src/Generated/V2/Schemas/Mail/MailsystemSettings.php similarity index 54% rename from src/Generated/V2/Schemas/Domain/DomainOwnership.php rename to src/Generated/V2/Schemas/Mail/MailsystemSettings.php index 0bd746e9..cbc08f9a 100644 --- a/src/Generated/V2/Schemas/Domain/DomainOwnership.php +++ b/src/Generated/V2/Schemas/Mail/MailsystemSettings.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Mittwald\ApiClient\Generated\V2\Schemas\Domain; +namespace Mittwald\ApiClient\Generated\V2\Schemas\Mail; use InvalidArgumentException; use JsonSchema\Validator; /** - * Auto-generated class for de.mittwald.v1.domain.DomainOwnership. + * Auto-generated class for de.mittwald.v1.mail.MailsystemSettings. * * DO NOT EDIT; this class was generated by the mittwald/api-client-builder package * (https://github.com/mittwald/api-client-php-builder). Please make any changes @@ -17,7 +17,7 @@ * @generated * @see https://github.com/mittwald/api-client-php-builder */ -class DomainOwnership +class MailsystemSettings { /** * Schema used to validate input for creating instances of this class @@ -26,27 +26,20 @@ class DomainOwnership */ private static array $schema = [ 'properties' => [ - 'domain' => [ - 'format' => 'hostname', + 'imapClusterId' => [ 'type' => 'string', ], - 'id' => [ - 'format' => 'uuid', + 'mailDirectory' => [ 'type' => 'string', ], - 'projectId' => [ - 'format' => 'uuid', - 'type' => 'string', - ], - 'txtRecord' => [ + 'rateLimitId' => [ 'type' => 'string', ], ], 'required' => [ - 'id', - 'domain', - 'txtRecord', - 'projectId', + 'imapClusterId', + 'mailDirectory', + 'rateLimitId', ], 'type' => 'object', ]; @@ -54,137 +47,104 @@ class DomainOwnership /** * @var string */ - private string $domain; + private string $imapClusterId; /** * @var string */ - private string $id; + private string $mailDirectory; /** * @var string */ - private string $projectId; + private string $rateLimitId; /** - * @var string + * @param string $imapClusterId + * @param string $mailDirectory + * @param string $rateLimitId */ - private string $txtRecord; - - /** - * @param string $domain - * @param string $id - * @param string $projectId - * @param string $txtRecord - */ - public function __construct(string $domain, string $id, string $projectId, string $txtRecord) + public function __construct(string $imapClusterId, string $mailDirectory, string $rateLimitId) { - $this->domain = $domain; - $this->id = $id; - $this->projectId = $projectId; - $this->txtRecord = $txtRecord; + $this->imapClusterId = $imapClusterId; + $this->mailDirectory = $mailDirectory; + $this->rateLimitId = $rateLimitId; } /** * @return string */ - public function getDomain(): string + public function getImapClusterId(): string { - return $this->domain; + return $this->imapClusterId; } /** * @return string */ - public function getId(): string + public function getMailDirectory(): string { - return $this->id; + return $this->mailDirectory; } /** * @return string */ - public function getProjectId(): string - { - return $this->projectId; - } - - /** - * @return string - */ - public function getTxtRecord(): string - { - return $this->txtRecord; - } - - /** - * @param string $domain - * @return self - */ - public function withDomain(string $domain): self + public function getRateLimitId(): string { - $validator = new Validator(); - $validator->validate($domain, static::$schema['properties']['domain']); - if (!$validator->isValid()) { - throw new InvalidArgumentException($validator->getErrors()[0]['message']); - } - - $clone = clone $this; - $clone->domain = $domain; - - return $clone; + return $this->rateLimitId; } /** - * @param string $id + * @param string $imapClusterId * @return self */ - public function withId(string $id): self + public function withImapClusterId(string $imapClusterId): self { $validator = new Validator(); - $validator->validate($id, static::$schema['properties']['id']); + $validator->validate($imapClusterId, static::$schema['properties']['imapClusterId']); if (!$validator->isValid()) { throw new InvalidArgumentException($validator->getErrors()[0]['message']); } $clone = clone $this; - $clone->id = $id; + $clone->imapClusterId = $imapClusterId; return $clone; } /** - * @param string $projectId + * @param string $mailDirectory * @return self */ - public function withProjectId(string $projectId): self + public function withMailDirectory(string $mailDirectory): self { $validator = new Validator(); - $validator->validate($projectId, static::$schema['properties']['projectId']); + $validator->validate($mailDirectory, static::$schema['properties']['mailDirectory']); if (!$validator->isValid()) { throw new InvalidArgumentException($validator->getErrors()[0]['message']); } $clone = clone $this; - $clone->projectId = $projectId; + $clone->mailDirectory = $mailDirectory; return $clone; } /** - * @param string $txtRecord + * @param string $rateLimitId * @return self */ - public function withTxtRecord(string $txtRecord): self + public function withRateLimitId(string $rateLimitId): self { $validator = new Validator(); - $validator->validate($txtRecord, static::$schema['properties']['txtRecord']); + $validator->validate($rateLimitId, static::$schema['properties']['rateLimitId']); if (!$validator->isValid()) { throw new InvalidArgumentException($validator->getErrors()[0]['message']); } $clone = clone $this; - $clone->txtRecord = $txtRecord; + $clone->rateLimitId = $rateLimitId; return $clone; } @@ -194,22 +154,21 @@ public function withTxtRecord(string $txtRecord): self * * @param array|object $input Input data * @param bool $validate Set this to false to skip validation; use at own risk - * @return DomainOwnership Created instance + * @return MailsystemSettings Created instance * @throws InvalidArgumentException */ - public static function buildFromInput(array|object $input, bool $validate = true): DomainOwnership + public static function buildFromInput(array|object $input, bool $validate = true): MailsystemSettings { $input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; if ($validate) { static::validateInput($input); } - $domain = $input->{'domain'}; - $id = $input->{'id'}; - $projectId = $input->{'projectId'}; - $txtRecord = $input->{'txtRecord'}; + $imapClusterId = $input->{'imapClusterId'}; + $mailDirectory = $input->{'mailDirectory'}; + $rateLimitId = $input->{'rateLimitId'}; - $obj = new self($domain, $id, $projectId, $txtRecord); + $obj = new self($imapClusterId, $mailDirectory, $rateLimitId); return $obj; } @@ -222,10 +181,9 @@ public static function buildFromInput(array|object $input, bool $validate = true public function toJson(): array { $output = []; - $output['domain'] = $this->domain; - $output['id'] = $this->id; - $output['projectId'] = $this->projectId; - $output['txtRecord'] = $this->txtRecord; + $output['imapClusterId'] = $this->imapClusterId; + $output['mailDirectory'] = $this->mailDirectory; + $output['rateLimitId'] = $this->rateLimitId; return $output; }