diff --git a/.fern/metadata.json b/.fern/metadata.json index 8add504..1aab95e 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -11,10 +11,10 @@ "homepage": "https://www.cloudpdf.com" } }, - "originGitCommit": "08782e4eef6cd6ccce4b6a6883408d9915a2d7c4", + "originGitCommit": "b0888bd6ca83627cb07ea05c440e35c183cebbd0", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "3.0.0-alpha.11", + "requestedVersion": "3.0.0-alpha.12", "ciProvider": "github", - "sdkVersion": "3.0.0-alpha.11" + "sdkVersion": "3.0.0-alpha.12" } \ No newline at end of file diff --git a/cloudpdf-generation.json b/cloudpdf-generation.json index 9a01b90..ff8c23e 100644 --- a/cloudpdf-generation.json +++ b/cloudpdf-generation.json @@ -1,12 +1,12 @@ { "language": "php", - "canonicalVersion": "3.0.0-next.11", - "sdkVersion": "3.0.0-alpha.11", + "canonicalVersion": "3.0.0-next.12", + "sdkVersion": "3.0.0-alpha.12", "source": { "repository": "embedpdf/embed-pdf-viewer", "openapi": "cloudpdf/contract/openapi.json", - "openapiSha256": "7bc0eea37724b3e359b0437edc3102b137e3d3f499293c89bb2b3293c6e3b614", - "gitCommit": "08782e4eef6cd6ccce4b6a6883408d9915a2d7c4", + "openapiSha256": "501ec54f2f28089dc8a3cf3a8d2ff3ade44c6c35d47977a3dfa47465fb83a049", + "gitCommit": "b0888bd6ca83627cb07ea05c440e35c183cebbd0", "gitCommitIsDirty": false }, "fern": { diff --git a/reference.md b/reference.md index 97af96e..6f07775 100644 --- a/reference.md +++ b/reference.md @@ -2365,6 +2365,170 @@ $client->doc->annotations->update( + + + + +
$client->doc->annotations->exportAppearance($docId, $layerName, $pon, $request) -> string +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```php +$client->doc->annotations->exportAppearance( + 'docId', + 'layerName', + 1, + new ExportAppearanceAnnotationsRequest([ + 'body' => [ + 'string' => [ + 'key' => "value", + ], + ], + ]), +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**$docId:** `string` + +
+
+ +
+
+ +**$layerName:** `string` + +
+
+ +
+
+ +**$pon:** `int` + +
+
+ +
+
+ +**$documentPassword:** `?string` — Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead. + +
+
+ +
+
+ +**$request:** `array` + +
+
+
+
+ + +
+
+
+ +
$client->doc->annotations->flatten($docId, $layerName, $pon, $request) -> ?DocAnnotationsFlatten200Response +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```php +$client->doc->annotations->flatten( + 'docId', + 'layerName', + 1, + new FlattenAnnotationsRequest([ + 'body' => [ + 'key' => "value", + ], + ]), +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**$docId:** `string` + +
+
+ +
+
+ +**$layerName:** `string` + +
+
+ +
+
+ +**$pon:** `int` + +
+
+ +
+
+ +**$documentPassword:** `?string` — Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead. + +
+
+ +
+
+ +**$request:** `array` + +
+
+
+
+ +
@@ -3244,6 +3408,150 @@ $client->doc->pages->move( + + + + +
$client->doc->pages->setName($docId, $layerName, $request) -> ?DocPagesSetName200Response +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```php +$client->doc->pages->setName( + 'docId', + 'layerName', + new SetNamePagesRequest([ + 'body' => [ + 'key' => "value", + ], + ]), +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**$docId:** `string` + +
+
+ +
+
+ +**$layerName:** `string` + +
+
+ +
+
+ +**$documentPassword:** `?string` — Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead. + +
+
+ +
+
+ +**$request:** `array` + +
+
+
+
+ + +
+
+
+ +
$client->doc->pages->removeName($docId, $layerName, $request) -> ?DocPagesRemoveName200Response +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```php +$client->doc->pages->removeName( + 'docId', + 'layerName', + new RemoveNamePagesRequest([ + 'body' => [ + 'key' => "value", + ], + ]), +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**$docId:** `string` + +
+
+ +
+
+ +**$layerName:** `string` + +
+
+ +
+
+ +**$documentPassword:** `?string` — Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead. + +
+
+ +
+
+ +**$request:** `array` + +
+
+
+
+ +
diff --git a/src/CloudPDFClient.php b/src/CloudPDFClient.php index f7e0db4..1b232d4 100644 --- a/src/CloudPDFClient.php +++ b/src/CloudPDFClient.php @@ -76,8 +76,8 @@ public function __construct( $defaultHeaders = [ 'X-Fern-Language' => 'PHP', 'X-Fern-SDK-Name' => 'CloudPDF', - 'X-Fern-SDK-Version' => '3.0.0-alpha.11', - 'User-Agent' => 'cloudpdf/sdk/3.0.0-alpha.11', + 'X-Fern-SDK-Version' => '3.0.0-alpha.12', + 'User-Agent' => 'cloudpdf/sdk/3.0.0-alpha.12', ]; if ($token != null) { $defaultHeaders['Authorization'] = "Bearer $token"; diff --git a/src/Doc/Annotations/AnnotationsClient.php b/src/Doc/Annotations/AnnotationsClient.php index 97964c2..171b0e9 100644 --- a/src/Doc/Annotations/AnnotationsClient.php +++ b/src/Doc/Annotations/AnnotationsClient.php @@ -20,6 +20,9 @@ use CloudPDF\Types\DocAnnotationsDelete200Response; use CloudPDF\Doc\Annotations\Requests\UpdateAnnotationsRequest; use CloudPDF\Types\DocAnnotationsUpdate200Response; +use CloudPDF\Doc\Annotations\Requests\ExportAppearanceAnnotationsRequest; +use CloudPDF\Doc\Annotations\Requests\FlattenAnnotationsRequest; +use CloudPDF\Types\DocAnnotationsFlatten200Response; class AnnotationsClient { @@ -392,4 +395,138 @@ public function update(string $docId, string $layerName, int $pon, string $annot body: $response->getBody()->getContents(), ); } + + /** + * Example: + * ```php + * $client->doc->annotations->exportAppearance( + * 'docId', + * 'layerName', + * 1, + * new ExportAppearanceAnnotationsRequest([ + * 'body' => [ + * 'string' => [ + * 'key' => "value", + * ], + * ], + * ]), + * ); + * ``` + * + * @param string $docId + * @param string $layerName + * @param int $pon + * @param ExportAppearanceAnnotationsRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return string + * @throws CloudPDFException + * @throws CloudPDFApiException + */ + public function exportAppearance(string $docId, string $layerName, int $pon, ExportAppearanceAnnotationsRequest $request, ?array $options = null): string + { + $options = array_merge($this->options, $options ?? []); + $headers = []; + if ($request->documentPassword != null) { + $headers['X-Document-Password'] = $request->documentPassword; + } + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? '', + path: "v1/docs/{$docId}/layers/{$layerName}/annotations/pages/{$pon}/items/appearance", + method: HttpMethod::POST, + headers: $headers, + body: $request->body, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + return $response->getBody()->getContents(); + } + } catch (ClientExceptionInterface $e) { + throw new CloudPDFException(message: $e->getMessage(), previous: $e); + } + throw new CloudPDFApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + + /** + * Example: + * ```php + * $client->doc->annotations->flatten( + * 'docId', + * 'layerName', + * 1, + * new FlattenAnnotationsRequest([ + * 'body' => [ + * 'key' => "value", + * ], + * ]), + * ); + * ``` + * + * @param string $docId + * @param string $layerName + * @param int $pon + * @param FlattenAnnotationsRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return ?DocAnnotationsFlatten200Response + * @throws CloudPDFException + * @throws CloudPDFApiException + */ + public function flatten(string $docId, string $layerName, int $pon, FlattenAnnotationsRequest $request, ?array $options = null): ?DocAnnotationsFlatten200Response + { + $options = array_merge($this->options, $options ?? []); + $headers = []; + if ($request->documentPassword != null) { + $headers['X-Document-Password'] = $request->documentPassword; + } + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? '', + path: "v1/docs/{$docId}/layers/{$layerName}/annotations/pages/{$pon}/items/flatten", + method: HttpMethod::POST, + headers: $headers, + body: $request->body, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + if (empty($json)) { + return null; + } + return DocAnnotationsFlatten200Response::fromJson($json); + } + } catch (JsonException $e) { + throw new CloudPDFException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (ClientExceptionInterface $e) { + throw new CloudPDFException(message: $e->getMessage(), previous: $e); + } + throw new CloudPDFApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } } diff --git a/src/Doc/Annotations/Requests/ExportAppearanceAnnotationsRequest.php b/src/Doc/Annotations/Requests/ExportAppearanceAnnotationsRequest.php new file mode 100644 index 0000000..a3c58f6 --- /dev/null +++ b/src/Doc/Annotations/Requests/ExportAppearanceAnnotationsRequest.php @@ -0,0 +1,31 @@ + $body + */ + public array $body; + + /** + * @param array{ + * body: array, + * documentPassword?: ?string, + * } $values + */ + public function __construct( + array $values, + ) { + $this->documentPassword = $values['documentPassword'] ?? null; + $this->body = $values['body']; + } +} diff --git a/src/Doc/Annotations/Requests/FlattenAnnotationsRequest.php b/src/Doc/Annotations/Requests/FlattenAnnotationsRequest.php new file mode 100644 index 0000000..463a4d9 --- /dev/null +++ b/src/Doc/Annotations/Requests/FlattenAnnotationsRequest.php @@ -0,0 +1,31 @@ + $body + */ + public array $body; + + /** + * @param array{ + * body: array, + * documentPassword?: ?string, + * } $values + */ + public function __construct( + array $values, + ) { + $this->documentPassword = $values['documentPassword'] ?? null; + $this->body = $values['body']; + } +} diff --git a/src/Doc/Pages/PagesClient.php b/src/Doc/Pages/PagesClient.php index 9762169..1b674a4 100644 --- a/src/Doc/Pages/PagesClient.php +++ b/src/Doc/Pages/PagesClient.php @@ -23,6 +23,10 @@ use CloudPDF\Types\DocPagesInsertBlank200Response; use CloudPDF\Doc\Pages\Requests\MovePagesRequest; use CloudPDF\Types\DocPagesMove200Response; +use CloudPDF\Doc\Pages\Requests\SetNamePagesRequest; +use CloudPDF\Types\DocPagesSetName200Response; +use CloudPDF\Doc\Pages\Requests\RemoveNamePagesRequest; +use CloudPDF\Types\DocPagesRemoveName200Response; use CloudPDF\Doc\Pages\Requests\RotatePagesRequest; use CloudPDF\Types\DocPagesRotate200Response; @@ -465,6 +469,140 @@ public function move(string $docId, string $layerName, MovePagesRequest $request ); } + /** + * Example: + * ```php + * $client->doc->pages->setName( + * 'docId', + * 'layerName', + * new SetNamePagesRequest([ + * 'body' => [ + * 'key' => "value", + * ], + * ]), + * ); + * ``` + * + * @param string $docId + * @param string $layerName + * @param SetNamePagesRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return ?DocPagesSetName200Response + * @throws CloudPDFException + * @throws CloudPDFApiException + */ + public function setName(string $docId, string $layerName, SetNamePagesRequest $request, ?array $options = null): ?DocPagesSetName200Response + { + $options = array_merge($this->options, $options ?? []); + $headers = []; + if ($request->documentPassword != null) { + $headers['X-Document-Password'] = $request->documentPassword; + } + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? '', + path: "v1/docs/{$docId}/layers/{$layerName}/pages/names", + method: HttpMethod::POST, + headers: $headers, + body: $request->body, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + if (empty($json)) { + return null; + } + return DocPagesSetName200Response::fromJson($json); + } + } catch (JsonException $e) { + throw new CloudPDFException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (ClientExceptionInterface $e) { + throw new CloudPDFException(message: $e->getMessage(), previous: $e); + } + throw new CloudPDFApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + + /** + * Example: + * ```php + * $client->doc->pages->removeName( + * 'docId', + * 'layerName', + * new RemoveNamePagesRequest([ + * 'body' => [ + * 'key' => "value", + * ], + * ]), + * ); + * ``` + * + * @param string $docId + * @param string $layerName + * @param RemoveNamePagesRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return ?DocPagesRemoveName200Response + * @throws CloudPDFException + * @throws CloudPDFApiException + */ + public function removeName(string $docId, string $layerName, RemoveNamePagesRequest $request, ?array $options = null): ?DocPagesRemoveName200Response + { + $options = array_merge($this->options, $options ?? []); + $headers = []; + if ($request->documentPassword != null) { + $headers['X-Document-Password'] = $request->documentPassword; + } + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? '', + path: "v1/docs/{$docId}/layers/{$layerName}/pages/names/delete", + method: HttpMethod::POST, + headers: $headers, + body: $request->body, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + if (empty($json)) { + return null; + } + return DocPagesRemoveName200Response::fromJson($json); + } + } catch (JsonException $e) { + throw new CloudPDFException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (ClientExceptionInterface $e) { + throw new CloudPDFException(message: $e->getMessage(), previous: $e); + } + throw new CloudPDFApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + /** * Example: * ```php diff --git a/src/Doc/Pages/Requests/RemoveNamePagesRequest.php b/src/Doc/Pages/Requests/RemoveNamePagesRequest.php new file mode 100644 index 0000000..a7e11dd --- /dev/null +++ b/src/Doc/Pages/Requests/RemoveNamePagesRequest.php @@ -0,0 +1,31 @@ + $body + */ + public array $body; + + /** + * @param array{ + * body: array, + * documentPassword?: ?string, + * } $values + */ + public function __construct( + array $values, + ) { + $this->documentPassword = $values['documentPassword'] ?? null; + $this->body = $values['body']; + } +} diff --git a/src/Doc/Pages/Requests/SetNamePagesRequest.php b/src/Doc/Pages/Requests/SetNamePagesRequest.php new file mode 100644 index 0000000..58bc596 --- /dev/null +++ b/src/Doc/Pages/Requests/SetNamePagesRequest.php @@ -0,0 +1,31 @@ + $body + */ + public array $body; + + /** + * @param array{ + * body: array, + * documentPassword?: ?string, + * } $values + */ + public function __construct( + array $values, + ) { + $this->documentPassword = $values['documentPassword'] ?? null; + $this->body = $values['body']; + } +} diff --git a/src/Types/DocAnnotationsExportAppearance400Response.php b/src/Types/DocAnnotationsExportAppearance400Response.php new file mode 100644 index 0000000..2791106 --- /dev/null +++ b/src/Types/DocAnnotationsExportAppearance400Response.php @@ -0,0 +1,59 @@ + $name + */ + #[JsonProperty('name')] + public string $name; + + /** + * @var value-of $code + */ + #[JsonProperty('code')] + public string $code; + + /** + * @var string $message + */ + #[JsonProperty('message')] + public string $message; + + /** + * @var ?array $details + */ + #[JsonProperty('details'), ArrayType(['string' => 'mixed'])] + public ?array $details; + + /** + * @param array{ + * name: value-of, + * code: value-of, + * message: string, + * details?: ?array, + * } $values + */ + public function __construct( + array $values, + ) { + $this->name = $values['name']; + $this->code = $values['code']; + $this->message = $values['message']; + $this->details = $values['details'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocAnnotationsExportAppearance400ResponseCode.php b/src/Types/DocAnnotationsExportAppearance400ResponseCode.php new file mode 100644 index 0000000..8fc77c6 --- /dev/null +++ b/src/Types/DocAnnotationsExportAppearance400ResponseCode.php @@ -0,0 +1,26 @@ + $name + */ + #[JsonProperty('name')] + public string $name; + + /** + * @var value-of $code + */ + #[JsonProperty('code')] + public string $code; + + /** + * @var string $message + */ + #[JsonProperty('message')] + public string $message; + + /** + * @var ?array $details + */ + #[JsonProperty('details'), ArrayType(['string' => 'mixed'])] + public ?array $details; + + /** + * @param array{ + * name: value-of, + * code: value-of, + * message: string, + * details?: ?array, + * } $values + */ + public function __construct( + array $values, + ) { + $this->name = $values['name']; + $this->code = $values['code']; + $this->message = $values['message']; + $this->details = $values['details'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocAnnotationsExportAppearance404ResponseCode.php b/src/Types/DocAnnotationsExportAppearance404ResponseCode.php new file mode 100644 index 0000000..395e061 --- /dev/null +++ b/src/Types/DocAnnotationsExportAppearance404ResponseCode.php @@ -0,0 +1,26 @@ +meta = $values['meta']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocAnnotationsFlatten200ResponseMeta.php b/src/Types/DocAnnotationsFlatten200ResponseMeta.php new file mode 100644 index 0000000..dc13f50 --- /dev/null +++ b/src/Types/DocAnnotationsFlatten200ResponseMeta.php @@ -0,0 +1,43 @@ + $affectedPages + */ + #[JsonProperty('affectedPages'), ArrayType([DocAnnotationsFlatten200ResponseMetaAffectedPagesItem::class])] + public array $affectedPages; + + /** + * @var ?DocAnnotationsFlatten200ResponseMetaCacheDelta $cacheDelta + */ + #[JsonProperty('cacheDelta')] + public ?DocAnnotationsFlatten200ResponseMetaCacheDelta $cacheDelta; + + /** + * @param array{ + * affectedPages: array, + * cacheDelta?: ?DocAnnotationsFlatten200ResponseMetaCacheDelta, + * } $values + */ + public function __construct( + array $values, + ) { + $this->affectedPages = $values['affectedPages']; + $this->cacheDelta = $values['cacheDelta'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItem.php b/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItem.php new file mode 100644 index 0000000..73e01bd --- /dev/null +++ b/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItem.php @@ -0,0 +1,50 @@ +pageObjectNumber = $values['pageObjectNumber']; + $this->revision = $values['revision']; + $this->weakAnnotationState = $values['weakAnnotationState']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemRevision.php b/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemRevision.php new file mode 100644 index 0000000..f87c2e9 --- /dev/null +++ b/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemRevision.php @@ -0,0 +1,50 @@ +docSessionId = $values['docSessionId']; + $this->pageObjectNumber = $values['pageObjectNumber']; + $this->generation = $values['generation']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.php b/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.php new file mode 100644 index 0000000..a94feb2 --- /dev/null +++ b/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.php @@ -0,0 +1,196 @@ +kind = $values['kind']; + $this->value = $values['value']; + } + + /** + * @param DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown $unknown + * @return DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState + */ + public static function unknown(DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown $unknown): DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState + { + return new DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState([ + 'kind' => 'unknown', + 'value' => $unknown, + ]); + } + + /** + * @param DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown $known + * @return DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState + */ + public static function known(DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown $known): DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState + { + return new DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState([ + 'kind' => 'known', + 'value' => $known, + ]); + } + + /** + * @return bool + */ + public function isUnknown(): bool + { + return $this->value instanceof DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown && $this->kind === 'unknown'; + } + + /** + * @return DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown + */ + public function asUnknown(): DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown + { + if (!($this->value instanceof DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown && $this->kind === 'unknown')) { + throw new Exception( + "Expected unknown; got " . $this->kind . " with value of type " . get_debug_type($this->value), + ); + } + + return $this->value; + } + + /** + * @return bool + */ + public function isKnown(): bool + { + return $this->value instanceof DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown && $this->kind === 'known'; + } + + /** + * @return DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown + */ + public function asKnown(): DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown + { + if (!($this->value instanceof DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown && $this->kind === 'known')) { + throw new Exception( + "Expected known; got " . $this->kind . " with value of type " . get_debug_type($this->value), + ); + } + + return $this->value; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } + + /** + * @return array + */ + public function jsonSerialize(): array + { + $result = []; + $result['kind'] = $this->kind; + + $base = parent::jsonSerialize(); + $result = array_merge($base, $result); + + switch ($this->kind) { + case 'unknown': + $value = $this->asUnknown()->jsonSerialize(); + $result = array_merge($value, $result); + break; + case 'known': + $value = $this->asKnown()->jsonSerialize(); + $result = array_merge($value, $result); + break; + case '_unknown': + default: + if (is_null($this->value)) { + break; + } + if ($this->value instanceof JsonSerializableType) { + $value = $this->value->jsonSerialize(); + $result = array_merge($value, $result); + } elseif (is_array($this->value)) { + $result = array_merge($this->value, $result); + } + } + + return $result; + } + + /** + * @param array $data + */ + public static function jsonDeserialize(array $data): static + { + $args = []; + if (!array_key_exists('kind', $data)) { + throw new Exception( + "JSON data is missing property 'kind'", + ); + } + $kind = $data['kind']; + if (!(is_string($kind))) { + throw new Exception( + "Expected property 'kind' in JSON data to be string, instead received " . get_debug_type($data['kind']), + ); + } + + $args['kind'] = $kind; + switch ($kind) { + case 'unknown': + $args['value'] = DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown::jsonDeserialize($data); + break; + case 'known': + $args['value'] = DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown::jsonDeserialize($data); + break; + case '_unknown': + default: + $args['kind'] = '_unknown'; + $args['value'] = $data; + } + + // @phpstan-ignore-next-line + return new static($args); + } +} diff --git a/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.php b/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.php new file mode 100644 index 0000000..af6ef8d --- /dev/null +++ b/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.php @@ -0,0 +1,34 @@ +hasAnyWeakAnnotations = $values['hasAnyWeakAnnotations']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.php b/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.php new file mode 100644 index 0000000..4caa93c --- /dev/null +++ b/src/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.php @@ -0,0 +1,26 @@ +toJson(); + } +} diff --git a/src/Types/DocAnnotationsFlatten200ResponseMetaCacheDelta.php b/src/Types/DocAnnotationsFlatten200ResponseMetaCacheDelta.php new file mode 100644 index 0000000..5217ccf --- /dev/null +++ b/src/Types/DocAnnotationsFlatten200ResponseMetaCacheDelta.php @@ -0,0 +1,59 @@ + $pages + */ + #[JsonProperty('pages'), ArrayType([DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItem::class])] + public array $pages; + + /** + * @param array{ + * previousDocVersion: int, + * docVersion: int, + * pages: array, + * annotationsVersion?: ?int, + * } $values + */ + public function __construct( + array $values, + ) { + $this->previousDocVersion = $values['previousDocVersion']; + $this->docVersion = $values['docVersion']; + $this->annotationsVersion = $values['annotationsVersion'] ?? null; + $this->pages = $values['pages']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItem.php b/src/Types/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItem.php new file mode 100644 index 0000000..e238ebb --- /dev/null +++ b/src/Types/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItem.php @@ -0,0 +1,42 @@ +pageObjectNumber = $values['pageObjectNumber']; + $this->cache = $values['cache']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItemCache.php b/src/Types/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItemCache.php new file mode 100644 index 0000000..f67f17c --- /dev/null +++ b/src/Types/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItemCache.php @@ -0,0 +1,42 @@ +contentVersion = $values['contentVersion']; + $this->annotationVersion = $values['annotationVersion']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocAnnotationsFlatten400Response.php b/src/Types/DocAnnotationsFlatten400Response.php new file mode 100644 index 0000000..55f4f64 --- /dev/null +++ b/src/Types/DocAnnotationsFlatten400Response.php @@ -0,0 +1,59 @@ + $name + */ + #[JsonProperty('name')] + public string $name; + + /** + * @var value-of $code + */ + #[JsonProperty('code')] + public string $code; + + /** + * @var string $message + */ + #[JsonProperty('message')] + public string $message; + + /** + * @var ?array $details + */ + #[JsonProperty('details'), ArrayType(['string' => 'mixed'])] + public ?array $details; + + /** + * @param array{ + * name: value-of, + * code: value-of, + * message: string, + * details?: ?array, + * } $values + */ + public function __construct( + array $values, + ) { + $this->name = $values['name']; + $this->code = $values['code']; + $this->message = $values['message']; + $this->details = $values['details'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocAnnotationsFlatten400ResponseCode.php b/src/Types/DocAnnotationsFlatten400ResponseCode.php new file mode 100644 index 0000000..4239896 --- /dev/null +++ b/src/Types/DocAnnotationsFlatten400ResponseCode.php @@ -0,0 +1,26 @@ + $name + */ + #[JsonProperty('name')] + public string $name; + + /** + * @var value-of $code + */ + #[JsonProperty('code')] + public string $code; + + /** + * @var string $message + */ + #[JsonProperty('message')] + public string $message; + + /** + * @var ?array $details + */ + #[JsonProperty('details'), ArrayType(['string' => 'mixed'])] + public ?array $details; + + /** + * @param array{ + * name: value-of, + * code: value-of, + * message: string, + * details?: ?array, + * } $values + */ + public function __construct( + array $values, + ) { + $this->name = $values['name']; + $this->code = $values['code']; + $this->message = $values['message']; + $this->details = $values['details'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocAnnotationsFlatten404ResponseCode.php b/src/Types/DocAnnotationsFlatten404ResponseCode.php new file mode 100644 index 0000000..8651012 --- /dev/null +++ b/src/Types/DocAnnotationsFlatten404ResponseCode.php @@ -0,0 +1,26 @@ +meta = $values['meta']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesRemoveName200ResponseMeta.php b/src/Types/DocPagesRemoveName200ResponseMeta.php new file mode 100644 index 0000000..098b43c --- /dev/null +++ b/src/Types/DocPagesRemoveName200ResponseMeta.php @@ -0,0 +1,43 @@ + $affectedPages + */ + #[JsonProperty('affectedPages'), ArrayType([DocPagesRemoveName200ResponseMetaAffectedPagesItem::class])] + public array $affectedPages; + + /** + * @var ?DocPagesRemoveName200ResponseMetaCacheDelta $cacheDelta + */ + #[JsonProperty('cacheDelta')] + public ?DocPagesRemoveName200ResponseMetaCacheDelta $cacheDelta; + + /** + * @param array{ + * affectedPages: array, + * cacheDelta?: ?DocPagesRemoveName200ResponseMetaCacheDelta, + * } $values + */ + public function __construct( + array $values, + ) { + $this->affectedPages = $values['affectedPages']; + $this->cacheDelta = $values['cacheDelta'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItem.php b/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItem.php new file mode 100644 index 0000000..08ed266 --- /dev/null +++ b/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItem.php @@ -0,0 +1,50 @@ +pageObjectNumber = $values['pageObjectNumber']; + $this->revision = $values['revision']; + $this->weakAnnotationState = $values['weakAnnotationState']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemRevision.php b/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemRevision.php new file mode 100644 index 0000000..56913b9 --- /dev/null +++ b/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemRevision.php @@ -0,0 +1,50 @@ +docSessionId = $values['docSessionId']; + $this->pageObjectNumber = $values['pageObjectNumber']; + $this->generation = $values['generation']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.php b/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.php new file mode 100644 index 0000000..5467233 --- /dev/null +++ b/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.php @@ -0,0 +1,196 @@ +kind = $values['kind']; + $this->value = $values['value']; + } + + /** + * @param DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown $unknown + * @return DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState + */ + public static function unknown(DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown $unknown): DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState + { + return new DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState([ + 'kind' => 'unknown', + 'value' => $unknown, + ]); + } + + /** + * @param DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown $known + * @return DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState + */ + public static function known(DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown $known): DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState + { + return new DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState([ + 'kind' => 'known', + 'value' => $known, + ]); + } + + /** + * @return bool + */ + public function isUnknown(): bool + { + return $this->value instanceof DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown && $this->kind === 'unknown'; + } + + /** + * @return DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown + */ + public function asUnknown(): DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown + { + if (!($this->value instanceof DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown && $this->kind === 'unknown')) { + throw new Exception( + "Expected unknown; got " . $this->kind . " with value of type " . get_debug_type($this->value), + ); + } + + return $this->value; + } + + /** + * @return bool + */ + public function isKnown(): bool + { + return $this->value instanceof DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown && $this->kind === 'known'; + } + + /** + * @return DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown + */ + public function asKnown(): DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown + { + if (!($this->value instanceof DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown && $this->kind === 'known')) { + throw new Exception( + "Expected known; got " . $this->kind . " with value of type " . get_debug_type($this->value), + ); + } + + return $this->value; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } + + /** + * @return array + */ + public function jsonSerialize(): array + { + $result = []; + $result['kind'] = $this->kind; + + $base = parent::jsonSerialize(); + $result = array_merge($base, $result); + + switch ($this->kind) { + case 'unknown': + $value = $this->asUnknown()->jsonSerialize(); + $result = array_merge($value, $result); + break; + case 'known': + $value = $this->asKnown()->jsonSerialize(); + $result = array_merge($value, $result); + break; + case '_unknown': + default: + if (is_null($this->value)) { + break; + } + if ($this->value instanceof JsonSerializableType) { + $value = $this->value->jsonSerialize(); + $result = array_merge($value, $result); + } elseif (is_array($this->value)) { + $result = array_merge($this->value, $result); + } + } + + return $result; + } + + /** + * @param array $data + */ + public static function jsonDeserialize(array $data): static + { + $args = []; + if (!array_key_exists('kind', $data)) { + throw new Exception( + "JSON data is missing property 'kind'", + ); + } + $kind = $data['kind']; + if (!(is_string($kind))) { + throw new Exception( + "Expected property 'kind' in JSON data to be string, instead received " . get_debug_type($data['kind']), + ); + } + + $args['kind'] = $kind; + switch ($kind) { + case 'unknown': + $args['value'] = DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown::jsonDeserialize($data); + break; + case 'known': + $args['value'] = DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown::jsonDeserialize($data); + break; + case '_unknown': + default: + $args['kind'] = '_unknown'; + $args['value'] = $data; + } + + // @phpstan-ignore-next-line + return new static($args); + } +} diff --git a/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.php b/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.php new file mode 100644 index 0000000..b219cc9 --- /dev/null +++ b/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.php @@ -0,0 +1,34 @@ +hasAnyWeakAnnotations = $values['hasAnyWeakAnnotations']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.php b/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.php new file mode 100644 index 0000000..6217bf3 --- /dev/null +++ b/src/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.php @@ -0,0 +1,26 @@ +toJson(); + } +} diff --git a/src/Types/DocPagesRemoveName200ResponseMetaCacheDelta.php b/src/Types/DocPagesRemoveName200ResponseMetaCacheDelta.php new file mode 100644 index 0000000..0f20bc2 --- /dev/null +++ b/src/Types/DocPagesRemoveName200ResponseMetaCacheDelta.php @@ -0,0 +1,59 @@ + $pages + */ + #[JsonProperty('pages'), ArrayType([DocPagesRemoveName200ResponseMetaCacheDeltaPagesItem::class])] + public array $pages; + + /** + * @param array{ + * previousDocVersion: int, + * docVersion: int, + * pages: array, + * annotationsVersion?: ?int, + * } $values + */ + public function __construct( + array $values, + ) { + $this->previousDocVersion = $values['previousDocVersion']; + $this->docVersion = $values['docVersion']; + $this->annotationsVersion = $values['annotationsVersion'] ?? null; + $this->pages = $values['pages']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItem.php b/src/Types/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItem.php new file mode 100644 index 0000000..b7a47f4 --- /dev/null +++ b/src/Types/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItem.php @@ -0,0 +1,42 @@ +pageObjectNumber = $values['pageObjectNumber']; + $this->cache = $values['cache']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItemCache.php b/src/Types/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItemCache.php new file mode 100644 index 0000000..847818e --- /dev/null +++ b/src/Types/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItemCache.php @@ -0,0 +1,42 @@ +contentVersion = $values['contentVersion']; + $this->annotationVersion = $values['annotationVersion']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesRemoveName400Response.php b/src/Types/DocPagesRemoveName400Response.php new file mode 100644 index 0000000..773d1ad --- /dev/null +++ b/src/Types/DocPagesRemoveName400Response.php @@ -0,0 +1,59 @@ + $name + */ + #[JsonProperty('name')] + public string $name; + + /** + * @var value-of $code + */ + #[JsonProperty('code')] + public string $code; + + /** + * @var string $message + */ + #[JsonProperty('message')] + public string $message; + + /** + * @var ?array $details + */ + #[JsonProperty('details'), ArrayType(['string' => 'mixed'])] + public ?array $details; + + /** + * @param array{ + * name: value-of, + * code: value-of, + * message: string, + * details?: ?array, + * } $values + */ + public function __construct( + array $values, + ) { + $this->name = $values['name']; + $this->code = $values['code']; + $this->message = $values['message']; + $this->details = $values['details'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesRemoveName400ResponseCode.php b/src/Types/DocPagesRemoveName400ResponseCode.php new file mode 100644 index 0000000..99e6755 --- /dev/null +++ b/src/Types/DocPagesRemoveName400ResponseCode.php @@ -0,0 +1,26 @@ + $name + */ + #[JsonProperty('name')] + public string $name; + + /** + * @var value-of $code + */ + #[JsonProperty('code')] + public string $code; + + /** + * @var string $message + */ + #[JsonProperty('message')] + public string $message; + + /** + * @var ?array $details + */ + #[JsonProperty('details'), ArrayType(['string' => 'mixed'])] + public ?array $details; + + /** + * @param array{ + * name: value-of, + * code: value-of, + * message: string, + * details?: ?array, + * } $values + */ + public function __construct( + array $values, + ) { + $this->name = $values['name']; + $this->code = $values['code']; + $this->message = $values['message']; + $this->details = $values['details'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesRemoveName404ResponseCode.php b/src/Types/DocPagesRemoveName404ResponseCode.php new file mode 100644 index 0000000..2922aad --- /dev/null +++ b/src/Types/DocPagesRemoveName404ResponseCode.php @@ -0,0 +1,26 @@ +meta = $values['meta']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesSetName200ResponseMeta.php b/src/Types/DocPagesSetName200ResponseMeta.php new file mode 100644 index 0000000..8c833b1 --- /dev/null +++ b/src/Types/DocPagesSetName200ResponseMeta.php @@ -0,0 +1,43 @@ + $affectedPages + */ + #[JsonProperty('affectedPages'), ArrayType([DocPagesSetName200ResponseMetaAffectedPagesItem::class])] + public array $affectedPages; + + /** + * @var ?DocPagesSetName200ResponseMetaCacheDelta $cacheDelta + */ + #[JsonProperty('cacheDelta')] + public ?DocPagesSetName200ResponseMetaCacheDelta $cacheDelta; + + /** + * @param array{ + * affectedPages: array, + * cacheDelta?: ?DocPagesSetName200ResponseMetaCacheDelta, + * } $values + */ + public function __construct( + array $values, + ) { + $this->affectedPages = $values['affectedPages']; + $this->cacheDelta = $values['cacheDelta'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItem.php b/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItem.php new file mode 100644 index 0000000..75a1660 --- /dev/null +++ b/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItem.php @@ -0,0 +1,50 @@ +pageObjectNumber = $values['pageObjectNumber']; + $this->revision = $values['revision']; + $this->weakAnnotationState = $values['weakAnnotationState']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItemRevision.php b/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItemRevision.php new file mode 100644 index 0000000..b7c3763 --- /dev/null +++ b/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItemRevision.php @@ -0,0 +1,50 @@ +docSessionId = $values['docSessionId']; + $this->pageObjectNumber = $values['pageObjectNumber']; + $this->generation = $values['generation']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.php b/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.php new file mode 100644 index 0000000..e43d5b5 --- /dev/null +++ b/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.php @@ -0,0 +1,196 @@ +kind = $values['kind']; + $this->value = $values['value']; + } + + /** + * @param DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown $unknown + * @return DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState + */ + public static function unknown(DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown $unknown): DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState + { + return new DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState([ + 'kind' => 'unknown', + 'value' => $unknown, + ]); + } + + /** + * @param DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown $known + * @return DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState + */ + public static function known(DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown $known): DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState + { + return new DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState([ + 'kind' => 'known', + 'value' => $known, + ]); + } + + /** + * @return bool + */ + public function isUnknown(): bool + { + return $this->value instanceof DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown && $this->kind === 'unknown'; + } + + /** + * @return DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown + */ + public function asUnknown(): DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown + { + if (!($this->value instanceof DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown && $this->kind === 'unknown')) { + throw new Exception( + "Expected unknown; got " . $this->kind . " with value of type " . get_debug_type($this->value), + ); + } + + return $this->value; + } + + /** + * @return bool + */ + public function isKnown(): bool + { + return $this->value instanceof DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown && $this->kind === 'known'; + } + + /** + * @return DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown + */ + public function asKnown(): DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown + { + if (!($this->value instanceof DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown && $this->kind === 'known')) { + throw new Exception( + "Expected known; got " . $this->kind . " with value of type " . get_debug_type($this->value), + ); + } + + return $this->value; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } + + /** + * @return array + */ + public function jsonSerialize(): array + { + $result = []; + $result['kind'] = $this->kind; + + $base = parent::jsonSerialize(); + $result = array_merge($base, $result); + + switch ($this->kind) { + case 'unknown': + $value = $this->asUnknown()->jsonSerialize(); + $result = array_merge($value, $result); + break; + case 'known': + $value = $this->asKnown()->jsonSerialize(); + $result = array_merge($value, $result); + break; + case '_unknown': + default: + if (is_null($this->value)) { + break; + } + if ($this->value instanceof JsonSerializableType) { + $value = $this->value->jsonSerialize(); + $result = array_merge($value, $result); + } elseif (is_array($this->value)) { + $result = array_merge($this->value, $result); + } + } + + return $result; + } + + /** + * @param array $data + */ + public static function jsonDeserialize(array $data): static + { + $args = []; + if (!array_key_exists('kind', $data)) { + throw new Exception( + "JSON data is missing property 'kind'", + ); + } + $kind = $data['kind']; + if (!(is_string($kind))) { + throw new Exception( + "Expected property 'kind' in JSON data to be string, instead received " . get_debug_type($data['kind']), + ); + } + + $args['kind'] = $kind; + switch ($kind) { + case 'unknown': + $args['value'] = DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown::jsonDeserialize($data); + break; + case 'known': + $args['value'] = DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown::jsonDeserialize($data); + break; + case '_unknown': + default: + $args['kind'] = '_unknown'; + $args['value'] = $data; + } + + // @phpstan-ignore-next-line + return new static($args); + } +} diff --git a/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.php b/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.php new file mode 100644 index 0000000..8881422 --- /dev/null +++ b/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.php @@ -0,0 +1,34 @@ +hasAnyWeakAnnotations = $values['hasAnyWeakAnnotations']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.php b/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.php new file mode 100644 index 0000000..9675ee7 --- /dev/null +++ b/src/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.php @@ -0,0 +1,26 @@ +toJson(); + } +} diff --git a/src/Types/DocPagesSetName200ResponseMetaCacheDelta.php b/src/Types/DocPagesSetName200ResponseMetaCacheDelta.php new file mode 100644 index 0000000..03d8ebd --- /dev/null +++ b/src/Types/DocPagesSetName200ResponseMetaCacheDelta.php @@ -0,0 +1,59 @@ + $pages + */ + #[JsonProperty('pages'), ArrayType([DocPagesSetName200ResponseMetaCacheDeltaPagesItem::class])] + public array $pages; + + /** + * @param array{ + * previousDocVersion: int, + * docVersion: int, + * pages: array, + * annotationsVersion?: ?int, + * } $values + */ + public function __construct( + array $values, + ) { + $this->previousDocVersion = $values['previousDocVersion']; + $this->docVersion = $values['docVersion']; + $this->annotationsVersion = $values['annotationsVersion'] ?? null; + $this->pages = $values['pages']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesSetName200ResponseMetaCacheDeltaPagesItem.php b/src/Types/DocPagesSetName200ResponseMetaCacheDeltaPagesItem.php new file mode 100644 index 0000000..a50efa4 --- /dev/null +++ b/src/Types/DocPagesSetName200ResponseMetaCacheDeltaPagesItem.php @@ -0,0 +1,42 @@ +pageObjectNumber = $values['pageObjectNumber']; + $this->cache = $values['cache']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesSetName200ResponseMetaCacheDeltaPagesItemCache.php b/src/Types/DocPagesSetName200ResponseMetaCacheDeltaPagesItemCache.php new file mode 100644 index 0000000..47c0e07 --- /dev/null +++ b/src/Types/DocPagesSetName200ResponseMetaCacheDeltaPagesItemCache.php @@ -0,0 +1,42 @@ +contentVersion = $values['contentVersion']; + $this->annotationVersion = $values['annotationVersion']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesSetName400Response.php b/src/Types/DocPagesSetName400Response.php new file mode 100644 index 0000000..b155a4c --- /dev/null +++ b/src/Types/DocPagesSetName400Response.php @@ -0,0 +1,59 @@ + $name + */ + #[JsonProperty('name')] + public string $name; + + /** + * @var value-of $code + */ + #[JsonProperty('code')] + public string $code; + + /** + * @var string $message + */ + #[JsonProperty('message')] + public string $message; + + /** + * @var ?array $details + */ + #[JsonProperty('details'), ArrayType(['string' => 'mixed'])] + public ?array $details; + + /** + * @param array{ + * name: value-of, + * code: value-of, + * message: string, + * details?: ?array, + * } $values + */ + public function __construct( + array $values, + ) { + $this->name = $values['name']; + $this->code = $values['code']; + $this->message = $values['message']; + $this->details = $values['details'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesSetName400ResponseCode.php b/src/Types/DocPagesSetName400ResponseCode.php new file mode 100644 index 0000000..c1393e6 --- /dev/null +++ b/src/Types/DocPagesSetName400ResponseCode.php @@ -0,0 +1,26 @@ + $name + */ + #[JsonProperty('name')] + public string $name; + + /** + * @var value-of $code + */ + #[JsonProperty('code')] + public string $code; + + /** + * @var string $message + */ + #[JsonProperty('message')] + public string $message; + + /** + * @var ?array $details + */ + #[JsonProperty('details'), ArrayType(['string' => 'mixed'])] + public ?array $details; + + /** + * @param array{ + * name: value-of, + * code: value-of, + * message: string, + * details?: ?array, + * } $values + */ + public function __construct( + array $values, + ) { + $this->name = $values['name']; + $this->code = $values['code']; + $this->message = $values['message']; + $this->details = $values['details'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DocPagesSetName404ResponseCode.php b/src/Types/DocPagesSetName404ResponseCode.php new file mode 100644 index 0000000..7ffdb06 --- /dev/null +++ b/src/Types/DocPagesSetName404ResponseCode.php @@ -0,0 +1,26 @@ +