From 7e08b6900204f09c76e5e33f23f3e0f5091ee04e Mon Sep 17 00:00:00 2001 From: cloudpdf-sdk-bot Date: Mon, 2 Nov 2026 21:09:09 +0000 Subject: [PATCH] chore: generate CloudPDF .NET SDK 3.0.0-next.20 --- .fern/metadata.json | 6 +- README.md | 14 + cloudpdf-generation.json | 8 +- reference.md | 234 ++++++++++- .../MockServer/Doc/Annotations/CreateTest.cs | 16 + .../MockServer/Doc/Annotations/DeleteTest.cs | 9 + .../MockServer/Doc/Annotations/FlattenTest.cs | 13 +- .../MockServer/Doc/Annotations/ListAllTest.cs | 11 + .../MockServer/Doc/Annotations/ListTest.cs | 11 + .../MockServer/Doc/Annotations/ReorderTest.cs | 9 + .../MockServer/Doc/Annotations/UpdateTest.cs | 16 + .../Unit/MockServer/Doc/ChangesTest.cs | 42 +- .../Unit/MockServer/Doc/Fonts/ListTest.cs | 174 ++++++++ .../MockServer/Doc/Fonts/Programs/GetTest.cs | 109 +++++ .../Unit/MockServer/Doc/Fonts/ResolveTest.cs | 173 ++++++++ .../MockServer/Doc/Forms/DeleteWidgetTest.cs | 9 + .../Unit/MockServer/Doc/Forms/ListTest.cs | 11 + .../Doc/Forms/ReorderCalculationsTest.cs | 9 + .../Doc/Forms/ReorderWidgetsTest.cs | 9 + .../Unit/MockServer/Doc/Forms/ResetTest.cs | 20 + .../Unit/MockServer/Doc/Forms/SetValueTest.cs | 20 + .../MockServer/Doc/Forms/UpdateWidgetTest.cs | 17 + .../Unit/MockServer/Doc/ManifestTest.cs | 4 + .../Unit/MockServer/Doc/Pages/FlattenTest.cs | 13 +- .../MockServer/Doc/Pages/RemoveNameTest.cs | 34 +- .../Unit/MockServer/Doc/Pages/SetNameTest.cs | 34 +- .../Unit/MockServer/Doc/Pages/SetScaleTest.cs | 13 +- .../MockServer/Doc/Redactions/ApplyTest.cs | 13 +- .../MockServer/Doc/Signatures/CompleteTest.cs | 13 +- src/CloudPDF/CloudPDF.csproj | 2 +- src/CloudPDF/Core/Public/ClientOptions.cs | 2 +- .../Core/Public/CloudPDFEnvironment.cs | 7 + src/CloudPDF/Core/Public/Version.cs | 2 +- src/CloudPDF/Doc/DocClient.cs | 3 + src/CloudPDF/Doc/Fonts/FontsClient.cs | 287 +++++++++++++ src/CloudPDF/Doc/Fonts/IFontsClient.cs | 20 + .../Doc/Fonts/Programs/IProgramsClient.cs | 21 + .../Doc/Fonts/Programs/ProgramsClient.cs | 269 +++++++++++++ .../Requests/DownloadProgramsRequest.cs | 29 ++ .../Programs/Requests/GetProgramsRequest.cs | 29 ++ .../Doc/Fonts/Requests/ListFontsRequest.cs | 26 ++ .../Doc/Fonts/Requests/ResolveFontsRequest.cs | 30 ++ src/CloudPDF/Doc/IDocClient.cs | 1 + src/CloudPDF/Documents/DocumentsClient.cs | 32 +- src/CloudPDF/Documents/IDocumentsClient.cs | 8 +- src/CloudPDF/Grants/GrantsClient.cs | 14 +- src/CloudPDF/Grants/IGrantsClient.cs | 2 +- src/CloudPDF/Tokens/ITokensClient.cs | 2 +- src/CloudPDF/Tokens/TokensClient.cs | 2 +- src/CloudPDF/Types/AnnotationCaret.cs | 3 + src/CloudPDF/Types/AnnotationCircle.cs | 3 + src/CloudPDF/Types/AnnotationDraftCaret.cs | 3 + src/CloudPDF/Types/AnnotationDraftCircle.cs | 3 + .../Types/AnnotationDraftFileAttachment.cs | 3 + src/CloudPDF/Types/AnnotationDraftFreeText.cs | 3 + .../Types/AnnotationDraftHighlight.cs | 3 + src/CloudPDF/Types/AnnotationDraftInk.cs | 3 + src/CloudPDF/Types/AnnotationDraftLine.cs | 3 + src/CloudPDF/Types/AnnotationDraftLink.cs | 3 + src/CloudPDF/Types/AnnotationDraftPolygon.cs | 3 + src/CloudPDF/Types/AnnotationDraftPolyline.cs | 3 + src/CloudPDF/Types/AnnotationDraftPopup.cs | 3 + src/CloudPDF/Types/AnnotationDraftRedact.cs | 3 + src/CloudPDF/Types/AnnotationDraftSquare.cs | 3 + src/CloudPDF/Types/AnnotationDraftSquiggly.cs | 3 + src/CloudPDF/Types/AnnotationDraftStamp.cs | 3 + .../Types/AnnotationDraftStrikeout.cs | 3 + src/CloudPDF/Types/AnnotationDraftText.cs | 3 + .../Types/AnnotationDraftUnderline.cs | 3 + src/CloudPDF/Types/AnnotationDraftWidget.cs | 3 + .../Types/AnnotationFileAttachment.cs | 3 + src/CloudPDF/Types/AnnotationFreeText.cs | 3 + src/CloudPDF/Types/AnnotationHighlight.cs | 3 + src/CloudPDF/Types/AnnotationInk.cs | 3 + src/CloudPDF/Types/AnnotationLine.cs | 3 + src/CloudPDF/Types/AnnotationLink.cs | 3 + src/CloudPDF/Types/AnnotationMutationMeta.cs | 3 + src/CloudPDF/Types/AnnotationPatchCaret.cs | 3 + src/CloudPDF/Types/AnnotationPatchCircle.cs | 3 + .../Types/AnnotationPatchFileAttachment.cs | 3 + src/CloudPDF/Types/AnnotationPatchFreeText.cs | 3 + .../Types/AnnotationPatchHighlight.cs | 3 + src/CloudPDF/Types/AnnotationPatchInk.cs | 3 + src/CloudPDF/Types/AnnotationPatchLine.cs | 3 + src/CloudPDF/Types/AnnotationPatchLink.cs | 3 + src/CloudPDF/Types/AnnotationPatchPolygon.cs | 3 + src/CloudPDF/Types/AnnotationPatchPolyline.cs | 3 + src/CloudPDF/Types/AnnotationPatchPopup.cs | 3 + src/CloudPDF/Types/AnnotationPatchRedact.cs | 3 + src/CloudPDF/Types/AnnotationPatchSquare.cs | 3 + src/CloudPDF/Types/AnnotationPatchSquiggly.cs | 3 + src/CloudPDF/Types/AnnotationPatchStamp.cs | 3 + .../Types/AnnotationPatchStrikeout.cs | 3 + src/CloudPDF/Types/AnnotationPatchText.cs | 3 + .../Types/AnnotationPatchUnderline.cs | 3 + src/CloudPDF/Types/AnnotationPolygon.cs | 3 + src/CloudPDF/Types/AnnotationPolyline.cs | 3 + src/CloudPDF/Types/AnnotationPopup.cs | 3 + src/CloudPDF/Types/AnnotationRedact.cs | 3 + src/CloudPDF/Types/AnnotationSquare.cs | 3 + src/CloudPDF/Types/AnnotationSquiggly.cs | 3 + src/CloudPDF/Types/AnnotationStamp.cs | 3 + src/CloudPDF/Types/AnnotationStrikeout.cs | 3 + src/CloudPDF/Types/AnnotationText.cs | 3 + src/CloudPDF/Types/AnnotationUnderline.cs | 3 + src/CloudPDF/Types/AnnotationUnsupported.cs | 3 + src/CloudPDF/Types/AttachmentMutationMeta.cs | 3 + src/CloudPDF/Types/CacheDelta.cs | 3 + src/CloudPDF/Types/ChangeItem.cs | 68 ++++ src/CloudPDF/Types/ChangeItemPagesCopy.cs | 34 ++ .../Types/ChangeItemPagesCopyLayout.cs | 40 ++ .../ChangeItemPagesCopyLayoutLabelsItem.cs | 37 ++ ...hangeItemPagesCopyLayoutLabelsItemStyle.cs | 144 +++++++ ...ChangeItemPagesCopyLayoutNamedPagesItem.cs | 31 ++ ...ItemPagesCopyLayoutNamedPagesItemTarget.cs | 380 ++++++++++++++++++ ...sCopyLayoutNamedPagesItemTargetDangling.cs | 25 ++ ...PagesCopyLayoutNamedPagesItemTargetPage.cs | 28 ++ ...sCopyLayoutNamedPagesItemTargetTemplate.cs | 28 ++ .../ChangeItemPagesCopyLayoutPagesItem.cs | 55 +++ ...ChangeItemPagesCopyLayoutPagesItemBoxes.cs | 40 ++ ...ngeItemPagesCopyLayoutPagesItemBoxesArt.cs | 37 ++ ...eItemPagesCopyLayoutPagesItemBoxesBleed.cs | 37 ++ ...geItemPagesCopyLayoutPagesItemBoxesCrop.cs | 37 ++ ...eItemPagesCopyLayoutPagesItemBoxesMedia.cs | 37 ++ ...geItemPagesCopyLayoutPagesItemBoxesTrim.cs | 37 ++ ...eItemPagesCopyLayoutPagesItemPdfCropBox.cs | 37 ++ .../ChangeItemPagesCopyLayoutPagesItemSize.cs | 31 ++ ...ngeItemPagesCopyLayoutPagesItemTabOrder.cs | 140 +++++++ .../Types/ChangeItemPagesDeleteLayout.cs | 4 + .../ChangeItemPagesDeleteLayoutLabelsItem.cs | 37 ++ ...ngeItemPagesDeleteLayoutLabelsItemStyle.cs | 144 +++++++ .../Types/ChangeItemPagesInsertBlankLayout.cs | 4 + ...ngeItemPagesInsertBlankLayoutLabelsItem.cs | 37 ++ ...emPagesInsertBlankLayoutLabelsItemStyle.cs | 146 +++++++ .../Types/ChangeItemPagesInsertLayout.cs | 4 + .../ChangeItemPagesInsertLayoutLabelsItem.cs | 37 ++ ...ngeItemPagesInsertLayoutLabelsItemStyle.cs | 144 +++++++ .../Types/ChangeItemPagesReorderLayout.cs | 4 + .../ChangeItemPagesReorderLayoutLabelsItem.cs | 37 ++ ...geItemPagesReorderLayoutLabelsItemStyle.cs | 146 +++++++ .../Types/ChangeItemPagesRestoreLayout.cs | 4 + .../ChangeItemPagesRestoreLayoutLabelsItem.cs | 37 ++ ...geItemPagesRestoreLayoutLabelsItemStyle.cs | 146 +++++++ .../Types/ChangeItemPagesRotateLayout.cs | 4 + .../ChangeItemPagesRotateLayoutLabelsItem.cs | 37 ++ ...ngeItemPagesRotateLayoutLabelsItemStyle.cs | 144 +++++++ src/CloudPDF/Types/ChangeItemSkippedOp.cs | 4 + src/CloudPDF/Types/ChangeOp.cs | 68 ++++ src/CloudPDF/Types/ChangeOpPagesCopy.cs | 35 ++ src/CloudPDF/Types/ChangeOpPagesInsert.cs | 3 + src/CloudPDF/Types/DocManifest200Response.cs | 6 + .../DocPagesRemoveName200ResponseLayout.cs | 4 + ...esRemoveName200ResponseLayoutLabelsItem.cs | 37 ++ ...oveName200ResponseLayoutLabelsItemStyle.cs | 148 +++++++ .../Types/DocPagesSetName200ResponseLayout.cs | 4 + ...PagesSetName200ResponseLayoutLabelsItem.cs | 37 ++ ...SetName200ResponseLayoutLabelsItemStyle.cs | 146 +++++++ src/CloudPDF/Types/Font.cs | 53 +++ src/CloudPDF/Types/FontList.cs | 34 ++ src/CloudPDF/Types/FontProgram.cs | 43 ++ src/CloudPDF/Types/FontProgramEmbedded.cs | 119 ++++++ .../Types/FontProgramEmbeddingPermission.cs | 122 ++++++ src/CloudPDF/Types/FontProgramFormat.cs | 127 ++++++ src/CloudPDF/Types/FontProgramInfo.cs | 53 +++ .../Types/FontProgramInfoCoversItem.cs | 31 ++ src/CloudPDF/Types/FontProgramInfoEmbedded.cs | 119 ++++++ .../FontProgramInfoEmbeddingPermission.cs | 124 ++++++ src/CloudPDF/Types/FontProgramInfoFormat.cs | 127 ++++++ src/CloudPDF/Types/FontResolution.cs | 31 ++ src/CloudPDF/Types/FontResolveRequest.cs | 31 ++ src/CloudPDF/Types/FontResolveRun.cs | 40 ++ src/CloudPDF/Types/FontRestrictionsItem.cs | 131 ++++++ src/CloudPDF/Types/FontSource.cs | 118 ++++++ src/CloudPDF/Types/FormMutationMeta.cs | 3 + src/CloudPDF/Types/MutationMeta.cs | 3 + src/CloudPDF/Types/OutlineMutationMeta.cs | 3 + src/CloudPDF/Types/ResolvedFontRun.cs | 43 ++ src/CloudPDF/Types/TokensIssueRequest.cs | 74 ++++ .../Types/TokensIssueRequestUpload.cs | 49 +++ src/CloudPDF/Types/WidgetAnnotation.cs | 3 + src/CloudPDF/Types/WidgetPatch.cs | 3 + 181 files changed, 6385 insertions(+), 39 deletions(-) create mode 100644 src/CloudPDF.Test/Unit/MockServer/Doc/Fonts/ListTest.cs create mode 100644 src/CloudPDF.Test/Unit/MockServer/Doc/Fonts/Programs/GetTest.cs create mode 100644 src/CloudPDF.Test/Unit/MockServer/Doc/Fonts/ResolveTest.cs create mode 100644 src/CloudPDF/Core/Public/CloudPDFEnvironment.cs create mode 100644 src/CloudPDF/Doc/Fonts/FontsClient.cs create mode 100644 src/CloudPDF/Doc/Fonts/IFontsClient.cs create mode 100644 src/CloudPDF/Doc/Fonts/Programs/IProgramsClient.cs create mode 100644 src/CloudPDF/Doc/Fonts/Programs/ProgramsClient.cs create mode 100644 src/CloudPDF/Doc/Fonts/Programs/Requests/DownloadProgramsRequest.cs create mode 100644 src/CloudPDF/Doc/Fonts/Programs/Requests/GetProgramsRequest.cs create mode 100644 src/CloudPDF/Doc/Fonts/Requests/ListFontsRequest.cs create mode 100644 src/CloudPDF/Doc/Fonts/Requests/ResolveFontsRequest.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopy.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayout.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutLabelsItem.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutLabelsItemStyle.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItem.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTarget.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTargetDangling.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTargetPage.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTargetTemplate.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItem.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxes.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesArt.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesBleed.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesCrop.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesMedia.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesTrim.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemPdfCropBox.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemSize.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemTabOrder.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesDeleteLayoutLabelsItem.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesDeleteLayoutLabelsItemStyle.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutLabelsItem.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutLabelsItemStyle.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesInsertLayoutLabelsItem.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesInsertLayoutLabelsItemStyle.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesReorderLayoutLabelsItem.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesReorderLayoutLabelsItemStyle.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesRestoreLayoutLabelsItem.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesRestoreLayoutLabelsItemStyle.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesRotateLayoutLabelsItem.cs create mode 100644 src/CloudPDF/Types/ChangeItemPagesRotateLayoutLabelsItemStyle.cs create mode 100644 src/CloudPDF/Types/ChangeOpPagesCopy.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName200ResponseLayoutLabelsItem.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName200ResponseLayoutLabelsItemStyle.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName200ResponseLayoutLabelsItem.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName200ResponseLayoutLabelsItemStyle.cs create mode 100644 src/CloudPDF/Types/Font.cs create mode 100644 src/CloudPDF/Types/FontList.cs create mode 100644 src/CloudPDF/Types/FontProgram.cs create mode 100644 src/CloudPDF/Types/FontProgramEmbedded.cs create mode 100644 src/CloudPDF/Types/FontProgramEmbeddingPermission.cs create mode 100644 src/CloudPDF/Types/FontProgramFormat.cs create mode 100644 src/CloudPDF/Types/FontProgramInfo.cs create mode 100644 src/CloudPDF/Types/FontProgramInfoCoversItem.cs create mode 100644 src/CloudPDF/Types/FontProgramInfoEmbedded.cs create mode 100644 src/CloudPDF/Types/FontProgramInfoEmbeddingPermission.cs create mode 100644 src/CloudPDF/Types/FontProgramInfoFormat.cs create mode 100644 src/CloudPDF/Types/FontResolution.cs create mode 100644 src/CloudPDF/Types/FontResolveRequest.cs create mode 100644 src/CloudPDF/Types/FontResolveRun.cs create mode 100644 src/CloudPDF/Types/FontRestrictionsItem.cs create mode 100644 src/CloudPDF/Types/FontSource.cs create mode 100644 src/CloudPDF/Types/ResolvedFontRun.cs create mode 100644 src/CloudPDF/Types/TokensIssueRequestUpload.cs diff --git a/.fern/metadata.json b/.fern/metadata.json index 9073a338..11def20c 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -10,10 +10,10 @@ "base-exception-class-name": "CloudPDFException", "base-api-exception-class-name": "CloudPDFApiException" }, - "originGitCommit": "0606e988ebff3773183ef02e0a820c36b3a25f8d", + "originGitCommit": "622018abaf6e4578d1f4d8377982c48b92c9ced3", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "3.0.0-next.19", + "requestedVersion": "3.0.0-next.20", "ciProvider": "github", - "sdkVersion": "3.0.0-next.19" + "sdkVersion": "3.0.0-next.20" } \ No newline at end of file diff --git a/README.md b/README.md index c1f632e6..b2416bbd 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ The official .NET SDK for the CloudPDF API. - [Installation](#installation) - [Reference](#reference) - [Usage](#usage) +- [Environments](#environments) - [Exception Handling](#exception-handling) - [Advanced](#advanced) - [Retries](#retries) @@ -57,6 +58,19 @@ await client.Doc.ChangesAsync( ); ``` +## Environments + +This SDK allows you to configure different environments for API requests. + +```csharp +using CloudPDF; + +var client = new CloudPDFClient(clientOptions: new ClientOptions +{ + BaseUrl = CloudPDFEnvironment.Saas +}); +``` + ## Exception Handling When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error diff --git a/cloudpdf-generation.json b/cloudpdf-generation.json index 0e3b5750..ae205dc0 100644 --- a/cloudpdf-generation.json +++ b/cloudpdf-generation.json @@ -1,12 +1,12 @@ { "language": "csharp", - "canonicalVersion": "3.0.0-next.19", - "sdkVersion": "3.0.0-next.19", + "canonicalVersion": "3.0.0-next.20", + "sdkVersion": "3.0.0-next.20", "source": { "repository": "embedpdf/embed-pdf-viewer", "openapi": "cloudpdf/contract/openapi.json", - "openapiSha256": "e88e02ed71f422ad08b2393abeda474e8dcf6707b6e753af74ba2f40da8e7d6b", - "gitCommit": "0606e988ebff3773183ef02e0a820c36b3a25f8d", + "openapiSha256": "47d739acb956ce8ba0c3990117e505be2e9406038d9e0cd1729608921a40b2d9", + "gitCommit": "622018abaf6e4578d1f4d8377982c48b92c9ced3", "gitCommitIsDirty": false }, "fern": { diff --git a/reference.md b/reference.md index 9446c30d..16a10b76 100644 --- a/reference.md +++ b/reference.md @@ -481,7 +481,7 @@ await client.Grants.ListAsync(new ListGrantsRequest { TenantId = "tenantId" });
-The returned id is what a link page or an embed opens. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does. +The returned id is what a link page or an embed opens. Its scope gives only document permissions the caller holds itself, as tokens.issue does. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
@@ -1219,6 +1219,20 @@ await client.Documents.UpdateAsync(
+#### 📝 Description + +
+
+ +
+
+ +An upload token commits only the documents it started; any other document answers 404. +
+
+
+
+ #### 🔌 Usage
@@ -1358,7 +1372,7 @@ await client.Documents.ThumbnailAsync(
-This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. +This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. An upload token sends files only to the documents it started.
@@ -1470,6 +1484,20 @@ await client.Documents.ImportFromAsync(
+#### 📝 Description + +
+
+ +
+
+ +With an upload token, the document goes into the token's folder with the token's metadata, whatever the request says; contentLength must be within the token's maxBytes, and the token makes at most maxFiles documents (403 after). docId, idempotencyKey and dedupMode reuse-existing are refused (400): each could reach a document the token didn't make. +
+
+
+
+ #### 🔌 Usage
@@ -1836,7 +1864,7 @@ await client.Folders.MoveIntoAsync(
-kind "tenant" requires the API token — authority mints only downward. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key. +Authority mints only downward: kind "doc" gives only document permissions the caller holds itself, kind "tenant" requires the API token, and kind "upload" requires docs.create instead of tokens.issue-doc, since an upload token can do only what docs.create allows. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
@@ -2597,6 +2625,97 @@ await client.Doc.Attachments.ListAsync(
+ +
+ + +## Doc Fonts +
client.Doc.Fonts.ListAsync(ListFontsRequest { ... }) -> WithRawResponseTask<FontList> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Doc.Fonts.ListAsync(new ListFontsRequest { DocId = "docId", LayerName = "layerName" }); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ListFontsRequest` + +
+
+
+
+ + +
+
+
+ +
client.Doc.Fonts.ResolveAsync(ResolveFontsRequest { ... }) -> WithRawResponseTask<FontResolution> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Doc.Fonts.ResolveAsync( + new ResolveFontsRequest + { + DocId = "docId", + LayerName = "layerName", + Body = new FontResolveRequest + { + Runs = new List() { new FontResolveRun { Text = "text" } }, + }, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ResolveFontsRequest` + +
+
+
+
+ +
@@ -4038,6 +4157,115 @@ await client.Doc.Versions.SignatureDigestAsync( + + + + +## Doc Fonts Programs +
client.Doc.Fonts.Programs.DownloadAsync(DownloadProgramsRequest { ... }) -> WithRawResponseTask<Stream> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (`canDownload: false`) is not found. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Doc.Fonts.Programs.DownloadAsync( + new DownloadProgramsRequest + { + DocId = "docId", + LayerName = "layerName", + DisplayHash = "displayHash", + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `DownloadProgramsRequest` + +
+
+
+
+ + +
+
+
+ +
client.Doc.Fonts.Programs.GetAsync(GetProgramsRequest { ... }) -> WithRawResponseTask<FontProgramInfo> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Doc.Fonts.Programs.GetAsync( + new GetProgramsRequest + { + DocId = "docId", + LayerName = "layerName", + DisplayHash = "displayHash", + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `GetProgramsRequest` + +
+
+
+
+ +
diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/CreateTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/CreateTest.cs index 9d057813..8890c119 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/CreateTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/CreateTest.cs @@ -38,6 +38,10 @@ public async Task MockServerTest_1() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1, + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -379,6 +383,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -408,6 +413,10 @@ public async Task MockServerTest_1() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ], "changed": [ { "kind": "objectNumber", @@ -491,6 +500,9 @@ public async Task MockServerTest_2() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -656,6 +668,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -674,6 +687,9 @@ public async Task MockServerTest_2() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters" + ], "changed": [ { "kind": "objectNumber", diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/DeleteTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/DeleteTest.cs index 9b49b021..79f25c9d 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/DeleteTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/DeleteTest.cs @@ -34,6 +34,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -63,6 +64,10 @@ public async Task MockServerTest_1() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ], "changed": [ { "kind": "objectNumber", @@ -134,6 +139,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -152,6 +158,9 @@ public async Task MockServerTest_2() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters" + ], "changed": [ { "kind": "objectNumber", diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/FlattenTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/FlattenTest.cs index 7e8f8a15..81087ede 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/FlattenTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/FlattenTest.cs @@ -71,6 +71,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -99,7 +100,11 @@ public async Task MockServerTest_1() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] } } """; @@ -185,6 +190,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -202,7 +208,10 @@ public async Task MockServerTest_2() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters" + ] } } """; diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ListAllTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ListAllTest.cs index 896a6176..7f74296c 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ListAllTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ListAllTest.cs @@ -31,6 +31,10 @@ public async Task MockServerTest_1() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1, + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -368,6 +372,10 @@ public async Task MockServerTest_1() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1, + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -746,6 +754,9 @@ public async Task MockServerTest_2() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1 + ], "nm": "nm", "rect": { "x": 1.1, diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ListTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ListTest.cs index 3b83f718..87bcc1c4 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ListTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ListTest.cs @@ -31,6 +31,10 @@ public async Task MockServerTest_1() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1, + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -368,6 +372,10 @@ public async Task MockServerTest_1() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1, + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -751,6 +759,9 @@ public async Task MockServerTest_2() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1 + ], "nm": "nm", "rect": { "x": 1.1, diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ReorderTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ReorderTest.cs index ee705605..e7e732ce 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ReorderTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ReorderTest.cs @@ -77,6 +77,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -106,6 +107,10 @@ public async Task MockServerTest_1() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ], "changed": [ { "kind": "objectNumber", @@ -234,6 +239,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -252,6 +258,9 @@ public async Task MockServerTest_2() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters" + ], "changed": [ { "kind": "objectNumber", diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/UpdateTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/UpdateTest.cs index fc6ac4db..ba398c51 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/UpdateTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/UpdateTest.cs @@ -38,6 +38,10 @@ public async Task MockServerTest_1() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1, + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -383,6 +387,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -412,6 +417,10 @@ public async Task MockServerTest_1() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ], "changed": [ { "kind": "objectNumber", @@ -498,6 +507,9 @@ public async Task MockServerTest_2() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -667,6 +679,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -685,6 +698,9 @@ public async Task MockServerTest_2() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters" + ], "changed": [ { "kind": "objectNumber", diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/ChangesTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/ChangesTest.cs index 581445c4..9946df93 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/ChangesTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/ChangesTest.cs @@ -56,12 +56,17 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] } }, { @@ -87,12 +92,17 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] } } ], @@ -116,6 +126,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -144,7 +155,11 @@ public async Task MockServerTest_1() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] } } }, @@ -176,12 +191,17 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] } }, { @@ -207,12 +227,17 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] } } ], @@ -236,6 +261,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -264,7 +290,11 @@ public async Task MockServerTest_1() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] } } } diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Fonts/ListTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Fonts/ListTest.cs new file mode 100644 index 00000000..cdb0f5b2 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Fonts/ListTest.cs @@ -0,0 +1,174 @@ +using CloudPDF.Doc; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Doc.Fonts; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string mockResponse = """ + { + "fonts": [ + { + "name": "name", + "source": "standard", + "familyName": "familyName", + "weight": 1, + "italic": true, + "postScriptName": "postScriptName", + "canChoose": true, + "restrictions": [ + "subset", + "subset" + ], + "programs": [ + { + "displayHash": "displayHash", + "sourceHash": "sourceHash", + "embedded": "whole", + "format": "truetype", + "embeddingPermission": "installable", + "canDownload": true + }, + { + "displayHash": "displayHash", + "sourceHash": "sourceHash", + "embedded": "whole", + "format": "truetype", + "embeddingPermission": "installable", + "canDownload": true + } + ] + }, + { + "name": "name", + "source": "standard", + "familyName": "familyName", + "weight": 1, + "italic": true, + "postScriptName": "postScriptName", + "canChoose": true, + "restrictions": [ + "subset", + "subset" + ], + "programs": [ + { + "displayHash": "displayHash", + "sourceHash": "sourceHash", + "embedded": "whole", + "format": "truetype", + "embeddingPermission": "installable", + "canDownload": true + }, + { + "displayHash": "displayHash", + "sourceHash": "sourceHash", + "embedded": "whole", + "format": "truetype", + "embeddingPermission": "installable", + "canDownload": true + } + ] + } + ], + "fallbacks": [ + "fallbacks", + "fallbacks" + ], + "lastResort": { + "displayHash": "displayHash", + "sourceHash": "sourceHash", + "embedded": "whole", + "format": "truetype", + "embeddingPermission": "installable", + "canDownload": true + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/fonts") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Fonts.ListAsync( + new ListFontsRequest { DocId = "docId", LayerName = "layerName" } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string mockResponse = """ + { + "fonts": [ + { + "name": "name", + "source": "standard", + "familyName": "familyName", + "weight": 1, + "italic": true, + "postScriptName": "postScriptName", + "canChoose": true, + "restrictions": [ + "subset" + ], + "programs": [ + { + "embedded": "whole", + "canDownload": true + } + ] + } + ], + "fallbacks": [ + "fallbacks" + ], + "lastResort": { + "displayHash": "displayHash", + "sourceHash": "sourceHash", + "embedded": "whole", + "format": "truetype", + "embeddingPermission": "installable", + "canDownload": true + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/fonts") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Fonts.ListAsync( + new ListFontsRequest { DocId = "docId", LayerName = "layerName" } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Fonts/Programs/GetTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Fonts/Programs/GetTest.cs new file mode 100644 index 00000000..b2f07867 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Fonts/Programs/GetTest.cs @@ -0,0 +1,109 @@ +using CloudPDF.Doc.Fonts; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Doc.Fonts.Programs; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class GetTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string mockResponse = """ + { + "displayHash": "displayHash", + "sourceHash": "sourceHash", + "embedded": "whole", + "format": "truetype", + "embeddingPermission": "installable", + "canDownload": true, + "covers": [ + { + "start": 1, + "count": 1 + }, + { + "start": 1, + "count": 1 + } + ], + "ascent": 1.1, + "descent": 1.1 + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/font-programs/displayHash") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Fonts.Programs.GetAsync( + new GetProgramsRequest + { + DocId = "docId", + LayerName = "layerName", + DisplayHash = "displayHash", + } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string mockResponse = """ + { + "displayHash": "displayHash", + "sourceHash": "sourceHash", + "embedded": "whole", + "format": "truetype", + "embeddingPermission": "installable", + "canDownload": true, + "covers": [ + { + "start": 1, + "count": 1 + } + ], + "ascent": 1.1, + "descent": 1.1 + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/font-programs/displayHash") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Fonts.Programs.GetAsync( + new GetProgramsRequest + { + DocId = "docId", + LayerName = "layerName", + DisplayHash = "displayHash", + } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Fonts/ResolveTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Fonts/ResolveTest.cs new file mode 100644 index 00000000..1ab7cabf --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Fonts/ResolveTest.cs @@ -0,0 +1,173 @@ +using CloudPDF; +using CloudPDF.Doc; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Doc.Fonts; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ResolveTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string requestJson = """ + { + "runs": [ + { + "text": "text" + }, + { + "text": "text" + } + ] + } + """; + + const string mockResponse = """ + { + "runs": [ + { + "font": "font", + "weight": 1.1, + "italic": true, + "substituted": true, + "program": "program", + "fallbacks": [ + "fallbacks", + "fallbacks" + ] + }, + { + "font": "font", + "weight": 1.1, + "italic": true, + "substituted": true, + "program": "program", + "fallbacks": [ + "fallbacks", + "fallbacks" + ] + } + ], + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/fonts/resolve") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Fonts.ResolveAsync( + new ResolveFontsRequest + { + DocId = "docId", + LayerName = "layerName", + Body = new FontResolveRequest + { + Annotation = null, + Runs = new List() + { + new FontResolveRun + { + Text = "text", + FontFamily = null, + Family = null, + Weight = null, + Italic = null, + }, + new FontResolveRun + { + Text = "text", + FontFamily = null, + Family = null, + Weight = null, + Italic = null, + }, + }, + }, + } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string requestJson = """ + { + "runs": [ + { + "text": "text" + } + ] + } + """; + + const string mockResponse = """ + { + "runs": [ + { + "font": "font", + "weight": 1.1, + "italic": true, + "substituted": true, + "program": "program", + "fallbacks": [ + "fallbacks" + ] + } + ], + "missingCharacters": [ + "missingCharacters" + ] + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/fonts/resolve") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Fonts.ResolveAsync( + new ResolveFontsRequest + { + DocId = "docId", + LayerName = "layerName", + Body = new FontResolveRequest + { + Runs = new List() { new FontResolveRun { Text = "text" } }, + }, + } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/DeleteWidgetTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/DeleteWidgetTest.cs index 236c4be8..01d52725 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/DeleteWidgetTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/DeleteWidgetTest.cs @@ -197,6 +197,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -226,6 +227,10 @@ public async Task MockServerTest_1() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ], "changedFields": [ { "kind": "objectNumber", @@ -431,6 +436,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -449,6 +455,9 @@ public async Task MockServerTest_2() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters" + ], "changedFields": [ { "kind": "objectNumber", diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ListTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ListTest.cs index b3501a86..353987cd 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ListTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ListTest.cs @@ -337,6 +337,10 @@ public async Task MockServerTest_1() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1, + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -660,6 +664,10 @@ public async Task MockServerTest_1() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1, + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -1065,6 +1073,9 @@ public async Task MockServerTest_2() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1 + ], "nm": "nm", "rect": { "x": 1.1, diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderCalculationsTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderCalculationsTest.cs index 08cfd451..555c3cb2 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderCalculationsTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderCalculationsTest.cs @@ -61,6 +61,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -90,6 +91,10 @@ public async Task MockServerTest_1() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ], "changedFields": [ { "kind": "objectNumber", @@ -247,6 +252,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -265,6 +271,9 @@ public async Task MockServerTest_2() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters" + ], "changedFields": [ { "kind": "objectNumber", diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderWidgetsTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderWidgetsTest.cs index 9d22e2ba..2eab6bc2 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderWidgetsTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderWidgetsTest.cs @@ -81,6 +81,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -110,6 +111,10 @@ public async Task MockServerTest_1() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ], "changedFields": [ { "kind": "objectNumber", @@ -296,6 +301,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -314,6 +320,9 @@ public async Task MockServerTest_2() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters" + ], "changedFields": [ { "kind": "objectNumber", diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ResetTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ResetTest.cs index 3ffbc26b..bd984b87 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ResetTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ResetTest.cs @@ -339,6 +339,10 @@ public async Task MockServerTest_1() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1, + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -662,6 +666,10 @@ public async Task MockServerTest_1() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1, + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -990,6 +998,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -1019,6 +1028,10 @@ public async Task MockServerTest_1() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ], "changedFields": [ { "kind": "objectNumber", @@ -1190,6 +1203,9 @@ public async Task MockServerTest_2() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -1281,6 +1297,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -1299,6 +1316,9 @@ public async Task MockServerTest_2() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters" + ], "changedFields": [ { "kind": "objectNumber", diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/SetValueTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/SetValueTest.cs index 7042156c..74f2d0de 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/SetValueTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/SetValueTest.cs @@ -190,6 +190,10 @@ public async Task MockServerTest_1() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1, + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -513,6 +517,10 @@ public async Task MockServerTest_1() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1, + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -841,6 +849,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -870,6 +879,10 @@ public async Task MockServerTest_1() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ], "changedFields": [ { "kind": "objectNumber", @@ -1078,6 +1091,9 @@ public async Task MockServerTest_2() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -1169,6 +1185,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -1187,6 +1204,9 @@ public async Task MockServerTest_2() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters" + ], "changedFields": [ { "kind": "objectNumber", diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/UpdateWidgetTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/UpdateWidgetTest.cs index 2cb21577..aab1539d 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/UpdateWidgetTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/UpdateWidgetTest.cs @@ -37,6 +37,10 @@ public async Task MockServerTest_1() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1, + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -368,6 +372,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -397,6 +402,10 @@ public async Task MockServerTest_1() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ], "changedFields": [ { "kind": "objectNumber", @@ -505,6 +514,7 @@ public async Task MockServerTest_1() Page = null, HasAppearance = null, AppearanceState = null, + StructurePosition = null, Nm = null, Rect = null, Contents = null, @@ -579,6 +589,9 @@ public async Task MockServerTest_2() }, "hasAppearance": true, "appearanceState": "appearanceState", + "structurePosition": [ + 1 + ], "nm": "nm", "rect": { "x": 1.1, @@ -751,6 +764,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -769,6 +783,9 @@ public async Task MockServerTest_2() }, "opId": "opId", "undoable": true, + "missingCharacters": [ + "missingCharacters" + ], "changedFields": [ { "kind": "objectNumber", diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/ManifestTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/ManifestTest.cs index 3b5ecd88..b5e4884f 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/ManifestTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/ManifestTest.cs @@ -22,6 +22,8 @@ public async Task MockServerTest_1() "annotationsVersion": 1, "formsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, + "serverFonts": "serverFonts", "auditHead": 1, "baseSha": "baseSha", "layerVersion": 1, @@ -132,6 +134,8 @@ public async Task MockServerTest_2() "annotationsVersion": 1, "formsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, + "serverFonts": "serverFonts", "auditHead": 1, "baseSha": "baseSha", "layerVersion": 1, diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/FlattenTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/FlattenTest.cs index d0be61b0..298ef6df 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/FlattenTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/FlattenTest.cs @@ -69,6 +69,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -97,7 +98,11 @@ public async Task MockServerTest_1() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] } } """; @@ -178,6 +183,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -195,7 +201,10 @@ public async Task MockServerTest_2() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters" + ] } } """; diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/RemoveNameTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/RemoveNameTest.cs index bf59a2ed..d4de44c0 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/RemoveNameTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/RemoveNameTest.cs @@ -192,6 +192,20 @@ public async Task MockServerTest_1() } } ], + "labels": [ + { + "firstPage": 1, + "style": "decimal", + "firstNumber": 1, + "prefix": "prefix" + }, + { + "firstPage": 1, + "style": "decimal", + "firstNumber": 1, + "prefix": "prefix" + } + ], "namedPages": [ { "name": "name", @@ -235,6 +249,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -263,7 +278,11 @@ public async Task MockServerTest_1() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] } } """; @@ -367,6 +386,13 @@ public async Task MockServerTest_2() } } ], + "labels": [ + { + "firstPage": 1, + "firstNumber": 1, + "prefix": "prefix" + } + ], "namedPages": [ { "name": "name", @@ -396,6 +422,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -413,7 +440,10 @@ public async Task MockServerTest_2() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters" + ] } } """; diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetNameTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetNameTest.cs index 1a0faf43..27de7925 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetNameTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetNameTest.cs @@ -192,6 +192,20 @@ public async Task MockServerTest_1() } } ], + "labels": [ + { + "firstPage": 1, + "style": "decimal", + "firstNumber": 1, + "prefix": "prefix" + }, + { + "firstPage": 1, + "style": "decimal", + "firstNumber": 1, + "prefix": "prefix" + } + ], "namedPages": [ { "name": "name", @@ -235,6 +249,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -263,7 +278,11 @@ public async Task MockServerTest_1() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] } } """; @@ -367,6 +386,13 @@ public async Task MockServerTest_2() } } ], + "labels": [ + { + "firstPage": 1, + "firstNumber": 1, + "prefix": "prefix" + } + ], "namedPages": [ { "name": "name", @@ -396,6 +422,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -413,7 +440,10 @@ public async Task MockServerTest_2() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters" + ] } } """; diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetScaleTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetScaleTest.cs index 06551368..a4402d1c 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetScaleTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetScaleTest.cs @@ -42,6 +42,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -70,7 +71,11 @@ public async Task MockServerTest_1() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] } } """; @@ -132,6 +137,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -149,7 +155,10 @@ public async Task MockServerTest_2() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters" + ] } } """; diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Redactions/ApplyTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Redactions/ApplyTest.cs index de9c2312..686a0d3f 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Redactions/ApplyTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Redactions/ApplyTest.cs @@ -87,6 +87,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -115,7 +116,11 @@ public async Task MockServerTest_1() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] } } """; @@ -202,6 +207,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -219,7 +225,10 @@ public async Task MockServerTest_2() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters" + ] } } """; diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Signatures/CompleteTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Signatures/CompleteTest.cs index b0b42370..ea9c1142 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Signatures/CompleteTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Signatures/CompleteTest.cs @@ -171,6 +171,7 @@ public async Task MockServerTest_1() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -199,7 +200,11 @@ public async Task MockServerTest_1() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters", + "missingCharacters" + ] } } """; @@ -367,6 +372,7 @@ public async Task MockServerTest_2() "metadataVersion": 1, "attachmentsVersion": 1, "outlineVersion": 1, + "fontsVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -384,7 +390,10 @@ public async Task MockServerTest_2() ] }, "opId": "opId", - "undoable": true + "undoable": true, + "missingCharacters": [ + "missingCharacters" + ] } } """; diff --git a/src/CloudPDF/CloudPDF.csproj b/src/CloudPDF/CloudPDF.csproj index a4f47a7a..89e839ef 100644 --- a/src/CloudPDF/CloudPDF.csproj +++ b/src/CloudPDF/CloudPDF.csproj @@ -11,7 +11,7 @@ enable 12 enable - 3.0.0-next.19 + 3.0.0-next.20 3.0.0.0 3.0.0.0 README.md diff --git a/src/CloudPDF/Core/Public/ClientOptions.cs b/src/CloudPDF/Core/Public/ClientOptions.cs index 77f891f9..f7eb49b4 100644 --- a/src/CloudPDF/Core/Public/ClientOptions.cs +++ b/src/CloudPDF/Core/Public/ClientOptions.cs @@ -19,7 +19,7 @@ public partial class ClientOptions #else set; #endif - } = ""; + } = CloudPDFEnvironment.Saas; /// /// The http client used to make requests. diff --git a/src/CloudPDF/Core/Public/CloudPDFEnvironment.cs b/src/CloudPDF/Core/Public/CloudPDFEnvironment.cs new file mode 100644 index 00000000..d351f384 --- /dev/null +++ b/src/CloudPDF/Core/Public/CloudPDFEnvironment.cs @@ -0,0 +1,7 @@ +namespace CloudPDF; + +[Serializable] +public class CloudPDFEnvironment +{ + public const string Saas = "https://engine.cloudpdf.com"; +} diff --git a/src/CloudPDF/Core/Public/Version.cs b/src/CloudPDF/Core/Public/Version.cs index ea3b2e41..62cb9f6d 100644 --- a/src/CloudPDF/Core/Public/Version.cs +++ b/src/CloudPDF/Core/Public/Version.cs @@ -3,5 +3,5 @@ namespace CloudPDF; [Serializable] internal class Version { - public const string Current = "3.0.0-next.19"; + public const string Current = "3.0.0-next.20"; } diff --git a/src/CloudPDF/Doc/DocClient.cs b/src/CloudPDF/Doc/DocClient.cs index 6b75ec17..26c18c41 100644 --- a/src/CloudPDF/Doc/DocClient.cs +++ b/src/CloudPDF/Doc/DocClient.cs @@ -13,6 +13,7 @@ internal DocClient(RawClient client) _client = client; Annotations = new AnnotationsClient(_client); Attachments = new AttachmentsClient(_client); + Fonts = new FontsClient(_client); Forms = new FormsClient(_client); Metadata = new MetadataClient(_client); Outline = new OutlineClient(_client); @@ -26,6 +27,8 @@ internal DocClient(RawClient client) public IAttachmentsClient Attachments { get; } + public IFontsClient Fonts { get; } + public IFormsClient Forms { get; } public IMetadataClient Metadata { get; } diff --git a/src/CloudPDF/Doc/Fonts/FontsClient.cs b/src/CloudPDF/Doc/Fonts/FontsClient.cs new file mode 100644 index 00000000..b0531c3a --- /dev/null +++ b/src/CloudPDF/Doc/Fonts/FontsClient.cs @@ -0,0 +1,287 @@ +using CloudPDF; +using CloudPDF.Core; +using CloudPDF.Doc.Fonts; +using global::System.Text.Json; + +namespace CloudPDF.Doc; + +public partial class FontsClient : IFontsClient +{ + private readonly RawClient _client; + + internal FontsClient(RawClient client) + { + _client = client; + Programs = new ProgramsClient(_client); + } + + public IProgramsClient Programs { get; } + + private async Task> ListAsyncCore( + ListFontsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new CloudPDF.Core.QueryStringBuilder.Builder(capacity: 0) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new CloudPDF.Core.HeadersBuilder.Builder() + .Add("X-Document-Password", request.DocumentPassword) + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "v1/docs/{0}/layers/{1}/fonts", + ValueConvert.ToPathParameterString(request.DocId), + ValueConvert.ToPathParameterString(request.LayerName) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize(responseBody)!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new CloudPDFApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + private async Task> ResolveAsyncCore( + ResolveFontsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new CloudPDF.Core.QueryStringBuilder.Builder(capacity: 0) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new CloudPDF.Core.HeadersBuilder.Builder() + .Add("X-Document-Password", request.DocumentPassword) + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Post, + Path = string.Format( + "v1/docs/{0}/layers/{1}/fonts/resolve", + ValueConvert.ToPathParameterString(request.DocId), + ValueConvert.ToPathParameterString(request.LayerName) + ), + Body = request.Body, + QueryString = _queryString, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize(responseBody)!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new CloudPDFApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + /// + /// await client.Doc.Fonts.ListAsync(new ListFontsRequest { DocId = "docId", LayerName = "layerName" }); + /// + public WithRawResponseTask ListAsync( + ListFontsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// await client.Doc.Fonts.ResolveAsync( + /// new ResolveFontsRequest + /// { + /// DocId = "docId", + /// LayerName = "layerName", + /// Body = new FontResolveRequest + /// { + /// Runs = new List<FontResolveRun>() { new FontResolveRun { Text = "text" } }, + /// }, + /// } + /// ); + /// + public WithRawResponseTask ResolveAsync( + ResolveFontsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ResolveAsyncCore(request, options, cancellationToken) + ); + } +} diff --git a/src/CloudPDF/Doc/Fonts/IFontsClient.cs b/src/CloudPDF/Doc/Fonts/IFontsClient.cs new file mode 100644 index 00000000..4e95ca2d --- /dev/null +++ b/src/CloudPDF/Doc/Fonts/IFontsClient.cs @@ -0,0 +1,20 @@ +using CloudPDF; +using CloudPDF.Doc.Fonts; + +namespace CloudPDF.Doc; + +public partial interface IFontsClient +{ + public IProgramsClient Programs { get; } + WithRawResponseTask ListAsync( + ListFontsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask ResolveAsync( + ResolveFontsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/CloudPDF/Doc/Fonts/Programs/IProgramsClient.cs b/src/CloudPDF/Doc/Fonts/Programs/IProgramsClient.cs new file mode 100644 index 00000000..87140491 --- /dev/null +++ b/src/CloudPDF/Doc/Fonts/Programs/IProgramsClient.cs @@ -0,0 +1,21 @@ +using CloudPDF; + +namespace CloudPDF.Doc.Fonts; + +public partial interface IProgramsClient +{ + /// + /// A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (`canDownload: false`) is not found. + /// + WithRawResponseTask DownloadAsync( + DownloadProgramsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask GetAsync( + GetProgramsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/CloudPDF/Doc/Fonts/Programs/ProgramsClient.cs b/src/CloudPDF/Doc/Fonts/Programs/ProgramsClient.cs new file mode 100644 index 00000000..e57e35b7 --- /dev/null +++ b/src/CloudPDF/Doc/Fonts/Programs/ProgramsClient.cs @@ -0,0 +1,269 @@ +using CloudPDF; +using CloudPDF.Core; +using global::System.Text.Json; + +namespace CloudPDF.Doc.Fonts; + +public partial class ProgramsClient : IProgramsClient +{ + private readonly RawClient _client; + + internal ProgramsClient(RawClient client) + { + _client = client; + } + + private async Task> DownloadAsyncCore( + DownloadProgramsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new CloudPDF.Core.QueryStringBuilder.Builder(capacity: 0) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new CloudPDF.Core.HeadersBuilder.Builder() + .Add("X-Document-Password", request.DocumentPassword) + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "v1/docs/{0}/layers/{1}/font-program-files/{2}", + ValueConvert.ToPathParameterString(request.DocId), + ValueConvert.ToPathParameterString(request.LayerName), + ValueConvert.ToPathParameterString(request.DisplayHash) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var stream = await response.Raw.Content.ReadAsStreamAsync(); + return new WithRawResponse() + { + Data = stream, + RawResponse = new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 403: + throw new ForbiddenError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + private async Task> GetAsyncCore( + GetProgramsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new CloudPDF.Core.QueryStringBuilder.Builder(capacity: 0) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new CloudPDF.Core.HeadersBuilder.Builder() + .Add("X-Document-Password", request.DocumentPassword) + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "v1/docs/{0}/layers/{1}/font-programs/{2}", + ValueConvert.ToPathParameterString(request.DocId), + ValueConvert.ToPathParameterString(request.LayerName), + ValueConvert.ToPathParameterString(request.DisplayHash) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize(responseBody)!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new CloudPDFApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + /// + /// A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (`canDownload: false`) is not found. + /// + /// + /// await client.Doc.Fonts.Programs.DownloadAsync( + /// new DownloadProgramsRequest + /// { + /// DocId = "docId", + /// LayerName = "layerName", + /// DisplayHash = "displayHash", + /// } + /// ); + /// + public WithRawResponseTask DownloadAsync( + DownloadProgramsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + DownloadAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// await client.Doc.Fonts.Programs.GetAsync( + /// new GetProgramsRequest + /// { + /// DocId = "docId", + /// LayerName = "layerName", + /// DisplayHash = "displayHash", + /// } + /// ); + /// + public WithRawResponseTask GetAsync( + GetProgramsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + GetAsyncCore(request, options, cancellationToken) + ); + } +} diff --git a/src/CloudPDF/Doc/Fonts/Programs/Requests/DownloadProgramsRequest.cs b/src/CloudPDF/Doc/Fonts/Programs/Requests/DownloadProgramsRequest.cs new file mode 100644 index 00000000..abda9af7 --- /dev/null +++ b/src/CloudPDF/Doc/Fonts/Programs/Requests/DownloadProgramsRequest.cs @@ -0,0 +1,29 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Doc.Fonts; + +[Serializable] +public record DownloadProgramsRequest +{ + [JsonIgnore] + public required string DocId { get; set; } + + [JsonIgnore] + public required string LayerName { get; set; } + + [JsonIgnore] + public required string DisplayHash { get; set; } + + /// + /// 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. + /// + [JsonIgnore] + public string? DocumentPassword { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Doc/Fonts/Programs/Requests/GetProgramsRequest.cs b/src/CloudPDF/Doc/Fonts/Programs/Requests/GetProgramsRequest.cs new file mode 100644 index 00000000..71740100 --- /dev/null +++ b/src/CloudPDF/Doc/Fonts/Programs/Requests/GetProgramsRequest.cs @@ -0,0 +1,29 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Doc.Fonts; + +[Serializable] +public record GetProgramsRequest +{ + [JsonIgnore] + public required string DocId { get; set; } + + [JsonIgnore] + public required string LayerName { get; set; } + + [JsonIgnore] + public required string DisplayHash { get; set; } + + /// + /// 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. + /// + [JsonIgnore] + public string? DocumentPassword { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Doc/Fonts/Requests/ListFontsRequest.cs b/src/CloudPDF/Doc/Fonts/Requests/ListFontsRequest.cs new file mode 100644 index 00000000..fd94f1ea --- /dev/null +++ b/src/CloudPDF/Doc/Fonts/Requests/ListFontsRequest.cs @@ -0,0 +1,26 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Doc; + +[Serializable] +public record ListFontsRequest +{ + [JsonIgnore] + public required string DocId { get; set; } + + [JsonIgnore] + public required string LayerName { get; set; } + + /// + /// 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. + /// + [JsonIgnore] + public string? DocumentPassword { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Doc/Fonts/Requests/ResolveFontsRequest.cs b/src/CloudPDF/Doc/Fonts/Requests/ResolveFontsRequest.cs new file mode 100644 index 00000000..777a6bbf --- /dev/null +++ b/src/CloudPDF/Doc/Fonts/Requests/ResolveFontsRequest.cs @@ -0,0 +1,30 @@ +using CloudPDF; +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Doc; + +[Serializable] +public record ResolveFontsRequest +{ + [JsonIgnore] + public required string DocId { get; set; } + + [JsonIgnore] + public required string LayerName { get; set; } + + /// + /// 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. + /// + [JsonIgnore] + public string? DocumentPassword { get; set; } + + [JsonIgnore] + public required FontResolveRequest Body { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Doc/IDocClient.cs b/src/CloudPDF/Doc/IDocClient.cs index 88e89616..f66f2c22 100644 --- a/src/CloudPDF/Doc/IDocClient.cs +++ b/src/CloudPDF/Doc/IDocClient.cs @@ -6,6 +6,7 @@ public partial interface IDocClient { public IAnnotationsClient Annotations { get; } public IAttachmentsClient Attachments { get; } + public IFontsClient Fonts { get; } public IFormsClient Forms { get; } public IMetadataClient Metadata { get; } public IOutlineClient Outline { get; } diff --git a/src/CloudPDF/Documents/DocumentsClient.cs b/src/CloudPDF/Documents/DocumentsClient.cs index b5eac5fc..a755ca46 100644 --- a/src/CloudPDF/Documents/DocumentsClient.cs +++ b/src/CloudPDF/Documents/DocumentsClient.cs @@ -867,6 +867,18 @@ private async Task> UploadProxy Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), } ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); case 409: throw new ConflictError( JsonUtils.Deserialize(responseBody), @@ -1121,6 +1133,18 @@ private async Task> InitAsyncCore( Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), } ); + case 403: + throw new ForbiddenError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); } } catch (JsonException) @@ -1205,6 +1229,9 @@ public WithRawResponseTask UpdateAsync( ); } + /// + /// An upload token commits only the documents it started; any other document answers 404. + /// /// /// await client.Documents.CommitAsync( /// new DocumentsCommitRequest @@ -1259,7 +1286,7 @@ public WithRawResponseTask CommitAsync( } /// - /// This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. + /// This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. An upload token sends files only to the documents it started. /// /// /// await client.Documents.UploadProxyAsync( @@ -1304,6 +1331,9 @@ public WithRawResponseTask ImportFromAsync( ); } + /// + /// With an upload token, the document goes into the token's folder with the token's metadata, whatever the request says; contentLength must be within the token's maxBytes, and the token makes at most maxFiles documents (403 after). docId, idempotencyKey and dedupMode reuse-existing are refused (400): each could reach a document the token didn't make. + /// /// /// await client.Documents.InitAsync( /// new DocumentsInitRequest diff --git a/src/CloudPDF/Documents/IDocumentsClient.cs b/src/CloudPDF/Documents/IDocumentsClient.cs index f23e41bb..f6b1cbe9 100644 --- a/src/CloudPDF/Documents/IDocumentsClient.cs +++ b/src/CloudPDF/Documents/IDocumentsClient.cs @@ -32,6 +32,9 @@ WithRawResponseTask UpdateAsync( CancellationToken cancellationToken = default ); + /// + /// An upload token commits only the documents it started; any other document answers 404. + /// WithRawResponseTask CommitAsync( DocumentsCommitRequest request, RequestOptions? options = null, @@ -51,7 +54,7 @@ WithRawResponseTask CommitAsync( ); /// - /// This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. + /// This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. An upload token sends files only to the documents it started. /// WithRawResponseTask UploadProxyAsync( UploadProxyDocumentsRequest request, @@ -68,6 +71,9 @@ WithRawResponseTask ImportFromAsync( CancellationToken cancellationToken = default ); + /// + /// With an upload token, the document goes into the token's folder with the token's metadata, whatever the request says; contentLength must be within the token's maxBytes, and the token makes at most maxFiles documents (403 after). docId, idempotencyKey and dedupMode reuse-existing are refused (400): each could reach a document the token didn't make. + /// WithRawResponseTask InitAsync( DocumentsInitRequest request, RequestOptions? options = null, diff --git a/src/CloudPDF/Grants/GrantsClient.cs b/src/CloudPDF/Grants/GrantsClient.cs index 41f137e4..5585d1cf 100644 --- a/src/CloudPDF/Grants/GrantsClient.cs +++ b/src/CloudPDF/Grants/GrantsClient.cs @@ -700,6 +700,18 @@ private async Task> UpdateAsyncCore( Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), } ); + case 403: + throw new ForbiddenError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); case 404: throw new NotFoundError( JsonUtils.Deserialize(responseBody), @@ -883,7 +895,7 @@ public WithRawResponseTask ListAsync( } /// - /// The returned id is what a link page or an embed opens. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does. + /// The returned id is what a link page or an embed opens. Its scope gives only document permissions the caller holds itself, as tokens.issue does. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does. /// /// /// await client.Grants.CreateAsync( diff --git a/src/CloudPDF/Grants/IGrantsClient.cs b/src/CloudPDF/Grants/IGrantsClient.cs index 34132cbd..d2cd586b 100644 --- a/src/CloudPDF/Grants/IGrantsClient.cs +++ b/src/CloudPDF/Grants/IGrantsClient.cs @@ -22,7 +22,7 @@ WithRawResponseTask ListAsync( ); /// - /// The returned id is what a link page or an embed opens. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does. + /// The returned id is what a link page or an embed opens. Its scope gives only document permissions the caller holds itself, as tokens.issue does. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does. /// WithRawResponseTask CreateAsync( GrantsCreateRequest request, diff --git a/src/CloudPDF/Tokens/ITokensClient.cs b/src/CloudPDF/Tokens/ITokensClient.cs index 9f4074b2..90cf4c22 100644 --- a/src/CloudPDF/Tokens/ITokensClient.cs +++ b/src/CloudPDF/Tokens/ITokensClient.cs @@ -3,7 +3,7 @@ namespace CloudPDF; public partial interface ITokensClient { /// - /// kind "tenant" requires the API token — authority mints only downward. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key. + /// Authority mints only downward: kind "doc" gives only document permissions the caller holds itself, kind "tenant" requires the API token, and kind "upload" requires docs.create instead of tokens.issue-doc, since an upload token can do only what docs.create allows. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key. /// WithRawResponseTask IssueAsync( IssueTokensRequest request, diff --git a/src/CloudPDF/Tokens/TokensClient.cs b/src/CloudPDF/Tokens/TokensClient.cs index f4e113b9..f803bd34 100644 --- a/src/CloudPDF/Tokens/TokensClient.cs +++ b/src/CloudPDF/Tokens/TokensClient.cs @@ -228,7 +228,7 @@ private async Task RevokeAsyncCore( } /// - /// kind "tenant" requires the API token — authority mints only downward. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key. + /// Authority mints only downward: kind "doc" gives only document permissions the caller holds itself, kind "tenant" requires the API token, and kind "upload" requires docs.create instead of tokens.issue-doc, since an upload token can do only what docs.create allows. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key. /// /// /// await client.Tokens.IssueAsync( diff --git a/src/CloudPDF/Types/AnnotationCaret.cs b/src/CloudPDF/Types/AnnotationCaret.cs index f8607bac..a1cf6ea7 100644 --- a/src/CloudPDF/Types/AnnotationCaret.cs +++ b/src/CloudPDF/Types/AnnotationCaret.cs @@ -23,6 +23,9 @@ public record AnnotationCaret : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationCircle.cs b/src/CloudPDF/Types/AnnotationCircle.cs index 3c5742ba..adebd03f 100644 --- a/src/CloudPDF/Types/AnnotationCircle.cs +++ b/src/CloudPDF/Types/AnnotationCircle.cs @@ -23,6 +23,9 @@ public record AnnotationCircle : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftCaret.cs b/src/CloudPDF/Types/AnnotationDraftCaret.cs index 617453cd..e0cbce40 100644 --- a/src/CloudPDF/Types/AnnotationDraftCaret.cs +++ b/src/CloudPDF/Types/AnnotationDraftCaret.cs @@ -23,6 +23,9 @@ public record AnnotationDraftCaret : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftCircle.cs b/src/CloudPDF/Types/AnnotationDraftCircle.cs index 8f33e77c..2869f30d 100644 --- a/src/CloudPDF/Types/AnnotationDraftCircle.cs +++ b/src/CloudPDF/Types/AnnotationDraftCircle.cs @@ -23,6 +23,9 @@ public record AnnotationDraftCircle : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftFileAttachment.cs b/src/CloudPDF/Types/AnnotationDraftFileAttachment.cs index 403808d3..0408492b 100644 --- a/src/CloudPDF/Types/AnnotationDraftFileAttachment.cs +++ b/src/CloudPDF/Types/AnnotationDraftFileAttachment.cs @@ -23,6 +23,9 @@ public record AnnotationDraftFileAttachment : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftFreeText.cs b/src/CloudPDF/Types/AnnotationDraftFreeText.cs index b1de2df5..fb38bdcf 100644 --- a/src/CloudPDF/Types/AnnotationDraftFreeText.cs +++ b/src/CloudPDF/Types/AnnotationDraftFreeText.cs @@ -23,6 +23,9 @@ public record AnnotationDraftFreeText : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftHighlight.cs b/src/CloudPDF/Types/AnnotationDraftHighlight.cs index 1da0ad6a..61137039 100644 --- a/src/CloudPDF/Types/AnnotationDraftHighlight.cs +++ b/src/CloudPDF/Types/AnnotationDraftHighlight.cs @@ -23,6 +23,9 @@ public record AnnotationDraftHighlight : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftInk.cs b/src/CloudPDF/Types/AnnotationDraftInk.cs index fc4b9a32..de6f3ac1 100644 --- a/src/CloudPDF/Types/AnnotationDraftInk.cs +++ b/src/CloudPDF/Types/AnnotationDraftInk.cs @@ -23,6 +23,9 @@ public record AnnotationDraftInk : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftLine.cs b/src/CloudPDF/Types/AnnotationDraftLine.cs index cdf3f8bc..f9c456a6 100644 --- a/src/CloudPDF/Types/AnnotationDraftLine.cs +++ b/src/CloudPDF/Types/AnnotationDraftLine.cs @@ -23,6 +23,9 @@ public record AnnotationDraftLine : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftLink.cs b/src/CloudPDF/Types/AnnotationDraftLink.cs index ac913d96..c8fcbee0 100644 --- a/src/CloudPDF/Types/AnnotationDraftLink.cs +++ b/src/CloudPDF/Types/AnnotationDraftLink.cs @@ -23,6 +23,9 @@ public record AnnotationDraftLink : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftPolygon.cs b/src/CloudPDF/Types/AnnotationDraftPolygon.cs index c64d3acf..52335787 100644 --- a/src/CloudPDF/Types/AnnotationDraftPolygon.cs +++ b/src/CloudPDF/Types/AnnotationDraftPolygon.cs @@ -23,6 +23,9 @@ public record AnnotationDraftPolygon : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftPolyline.cs b/src/CloudPDF/Types/AnnotationDraftPolyline.cs index f847441a..125d8fe8 100644 --- a/src/CloudPDF/Types/AnnotationDraftPolyline.cs +++ b/src/CloudPDF/Types/AnnotationDraftPolyline.cs @@ -23,6 +23,9 @@ public record AnnotationDraftPolyline : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftPopup.cs b/src/CloudPDF/Types/AnnotationDraftPopup.cs index 72628f6b..ae7c12f8 100644 --- a/src/CloudPDF/Types/AnnotationDraftPopup.cs +++ b/src/CloudPDF/Types/AnnotationDraftPopup.cs @@ -23,6 +23,9 @@ public record AnnotationDraftPopup : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftRedact.cs b/src/CloudPDF/Types/AnnotationDraftRedact.cs index 94ea26e6..728899e4 100644 --- a/src/CloudPDF/Types/AnnotationDraftRedact.cs +++ b/src/CloudPDF/Types/AnnotationDraftRedact.cs @@ -23,6 +23,9 @@ public record AnnotationDraftRedact : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftSquare.cs b/src/CloudPDF/Types/AnnotationDraftSquare.cs index 354b5cb0..9f7840c6 100644 --- a/src/CloudPDF/Types/AnnotationDraftSquare.cs +++ b/src/CloudPDF/Types/AnnotationDraftSquare.cs @@ -23,6 +23,9 @@ public record AnnotationDraftSquare : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftSquiggly.cs b/src/CloudPDF/Types/AnnotationDraftSquiggly.cs index f57a2749..ec6a54e2 100644 --- a/src/CloudPDF/Types/AnnotationDraftSquiggly.cs +++ b/src/CloudPDF/Types/AnnotationDraftSquiggly.cs @@ -23,6 +23,9 @@ public record AnnotationDraftSquiggly : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftStamp.cs b/src/CloudPDF/Types/AnnotationDraftStamp.cs index fde14926..dabbfefc 100644 --- a/src/CloudPDF/Types/AnnotationDraftStamp.cs +++ b/src/CloudPDF/Types/AnnotationDraftStamp.cs @@ -23,6 +23,9 @@ public record AnnotationDraftStamp : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftStrikeout.cs b/src/CloudPDF/Types/AnnotationDraftStrikeout.cs index 4c2bf4fe..1f34fee5 100644 --- a/src/CloudPDF/Types/AnnotationDraftStrikeout.cs +++ b/src/CloudPDF/Types/AnnotationDraftStrikeout.cs @@ -23,6 +23,9 @@ public record AnnotationDraftStrikeout : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftText.cs b/src/CloudPDF/Types/AnnotationDraftText.cs index 0837a723..498e0e36 100644 --- a/src/CloudPDF/Types/AnnotationDraftText.cs +++ b/src/CloudPDF/Types/AnnotationDraftText.cs @@ -23,6 +23,9 @@ public record AnnotationDraftText : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftUnderline.cs b/src/CloudPDF/Types/AnnotationDraftUnderline.cs index 54763033..48890acf 100644 --- a/src/CloudPDF/Types/AnnotationDraftUnderline.cs +++ b/src/CloudPDF/Types/AnnotationDraftUnderline.cs @@ -23,6 +23,9 @@ public record AnnotationDraftUnderline : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationDraftWidget.cs b/src/CloudPDF/Types/AnnotationDraftWidget.cs index 30e46159..df820c05 100644 --- a/src/CloudPDF/Types/AnnotationDraftWidget.cs +++ b/src/CloudPDF/Types/AnnotationDraftWidget.cs @@ -23,6 +23,9 @@ public record AnnotationDraftWidget : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationFileAttachment.cs b/src/CloudPDF/Types/AnnotationFileAttachment.cs index d122f6a6..9bffe55d 100644 --- a/src/CloudPDF/Types/AnnotationFileAttachment.cs +++ b/src/CloudPDF/Types/AnnotationFileAttachment.cs @@ -23,6 +23,9 @@ public record AnnotationFileAttachment : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationFreeText.cs b/src/CloudPDF/Types/AnnotationFreeText.cs index 86388aea..e8d54883 100644 --- a/src/CloudPDF/Types/AnnotationFreeText.cs +++ b/src/CloudPDF/Types/AnnotationFreeText.cs @@ -23,6 +23,9 @@ public record AnnotationFreeText : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationHighlight.cs b/src/CloudPDF/Types/AnnotationHighlight.cs index 30d4b063..de0574e9 100644 --- a/src/CloudPDF/Types/AnnotationHighlight.cs +++ b/src/CloudPDF/Types/AnnotationHighlight.cs @@ -23,6 +23,9 @@ public record AnnotationHighlight : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationInk.cs b/src/CloudPDF/Types/AnnotationInk.cs index f27dea76..731388f2 100644 --- a/src/CloudPDF/Types/AnnotationInk.cs +++ b/src/CloudPDF/Types/AnnotationInk.cs @@ -23,6 +23,9 @@ public record AnnotationInk : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationLine.cs b/src/CloudPDF/Types/AnnotationLine.cs index 3a48bf07..cb6fa5a1 100644 --- a/src/CloudPDF/Types/AnnotationLine.cs +++ b/src/CloudPDF/Types/AnnotationLine.cs @@ -23,6 +23,9 @@ public record AnnotationLine : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationLink.cs b/src/CloudPDF/Types/AnnotationLink.cs index d24f6656..53e0bc18 100644 --- a/src/CloudPDF/Types/AnnotationLink.cs +++ b/src/CloudPDF/Types/AnnotationLink.cs @@ -23,6 +23,9 @@ public record AnnotationLink : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationMutationMeta.cs b/src/CloudPDF/Types/AnnotationMutationMeta.cs index ea22589f..e301a792 100644 --- a/src/CloudPDF/Types/AnnotationMutationMeta.cs +++ b/src/CloudPDF/Types/AnnotationMutationMeta.cs @@ -23,6 +23,9 @@ public record AnnotationMutationMeta : IJsonOnDeserialized [JsonPropertyName("undoable")] public required bool Undoable { get; set; } + [JsonPropertyName("missingCharacters")] + public IEnumerable? MissingCharacters { get; set; } + [JsonPropertyName("changed")] public IEnumerable Changed { get; set; } = new List(); diff --git a/src/CloudPDF/Types/AnnotationPatchCaret.cs b/src/CloudPDF/Types/AnnotationPatchCaret.cs index eadb119e..f6a8bfa2 100644 --- a/src/CloudPDF/Types/AnnotationPatchCaret.cs +++ b/src/CloudPDF/Types/AnnotationPatchCaret.cs @@ -23,6 +23,9 @@ public record AnnotationPatchCaret : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchCircle.cs b/src/CloudPDF/Types/AnnotationPatchCircle.cs index c6802415..0dbd5053 100644 --- a/src/CloudPDF/Types/AnnotationPatchCircle.cs +++ b/src/CloudPDF/Types/AnnotationPatchCircle.cs @@ -24,6 +24,9 @@ public record AnnotationPatchCircle : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchFileAttachment.cs b/src/CloudPDF/Types/AnnotationPatchFileAttachment.cs index 2ff2739b..6ee68714 100644 --- a/src/CloudPDF/Types/AnnotationPatchFileAttachment.cs +++ b/src/CloudPDF/Types/AnnotationPatchFileAttachment.cs @@ -23,6 +23,9 @@ public record AnnotationPatchFileAttachment : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchFreeText.cs b/src/CloudPDF/Types/AnnotationPatchFreeText.cs index db213ba6..e20c19f2 100644 --- a/src/CloudPDF/Types/AnnotationPatchFreeText.cs +++ b/src/CloudPDF/Types/AnnotationPatchFreeText.cs @@ -24,6 +24,9 @@ public record AnnotationPatchFreeText : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchHighlight.cs b/src/CloudPDF/Types/AnnotationPatchHighlight.cs index 2d9c1ff4..5f8de0d5 100644 --- a/src/CloudPDF/Types/AnnotationPatchHighlight.cs +++ b/src/CloudPDF/Types/AnnotationPatchHighlight.cs @@ -23,6 +23,9 @@ public record AnnotationPatchHighlight : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchInk.cs b/src/CloudPDF/Types/AnnotationPatchInk.cs index 329a5749..6e9db727 100644 --- a/src/CloudPDF/Types/AnnotationPatchInk.cs +++ b/src/CloudPDF/Types/AnnotationPatchInk.cs @@ -24,6 +24,9 @@ public record AnnotationPatchInk : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchLine.cs b/src/CloudPDF/Types/AnnotationPatchLine.cs index 32b88d07..2dbcf7a6 100644 --- a/src/CloudPDF/Types/AnnotationPatchLine.cs +++ b/src/CloudPDF/Types/AnnotationPatchLine.cs @@ -24,6 +24,9 @@ public record AnnotationPatchLine : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchLink.cs b/src/CloudPDF/Types/AnnotationPatchLink.cs index 75d94498..3caaf8c7 100644 --- a/src/CloudPDF/Types/AnnotationPatchLink.cs +++ b/src/CloudPDF/Types/AnnotationPatchLink.cs @@ -24,6 +24,9 @@ public record AnnotationPatchLink : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchPolygon.cs b/src/CloudPDF/Types/AnnotationPatchPolygon.cs index 3eab0677..49919c3e 100644 --- a/src/CloudPDF/Types/AnnotationPatchPolygon.cs +++ b/src/CloudPDF/Types/AnnotationPatchPolygon.cs @@ -24,6 +24,9 @@ public record AnnotationPatchPolygon : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchPolyline.cs b/src/CloudPDF/Types/AnnotationPatchPolyline.cs index dbdd7994..be12cc45 100644 --- a/src/CloudPDF/Types/AnnotationPatchPolyline.cs +++ b/src/CloudPDF/Types/AnnotationPatchPolyline.cs @@ -24,6 +24,9 @@ public record AnnotationPatchPolyline : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchPopup.cs b/src/CloudPDF/Types/AnnotationPatchPopup.cs index 9e8791c8..ff70e22a 100644 --- a/src/CloudPDF/Types/AnnotationPatchPopup.cs +++ b/src/CloudPDF/Types/AnnotationPatchPopup.cs @@ -23,6 +23,9 @@ public record AnnotationPatchPopup : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchRedact.cs b/src/CloudPDF/Types/AnnotationPatchRedact.cs index ab6e2750..0d01218e 100644 --- a/src/CloudPDF/Types/AnnotationPatchRedact.cs +++ b/src/CloudPDF/Types/AnnotationPatchRedact.cs @@ -23,6 +23,9 @@ public record AnnotationPatchRedact : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchSquare.cs b/src/CloudPDF/Types/AnnotationPatchSquare.cs index 34c4ded4..ca76c966 100644 --- a/src/CloudPDF/Types/AnnotationPatchSquare.cs +++ b/src/CloudPDF/Types/AnnotationPatchSquare.cs @@ -24,6 +24,9 @@ public record AnnotationPatchSquare : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchSquiggly.cs b/src/CloudPDF/Types/AnnotationPatchSquiggly.cs index a8a98859..dd380efa 100644 --- a/src/CloudPDF/Types/AnnotationPatchSquiggly.cs +++ b/src/CloudPDF/Types/AnnotationPatchSquiggly.cs @@ -23,6 +23,9 @@ public record AnnotationPatchSquiggly : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchStamp.cs b/src/CloudPDF/Types/AnnotationPatchStamp.cs index 78fd0421..1d0ed331 100644 --- a/src/CloudPDF/Types/AnnotationPatchStamp.cs +++ b/src/CloudPDF/Types/AnnotationPatchStamp.cs @@ -23,6 +23,9 @@ public record AnnotationPatchStamp : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchStrikeout.cs b/src/CloudPDF/Types/AnnotationPatchStrikeout.cs index 8291f4b6..782b8df0 100644 --- a/src/CloudPDF/Types/AnnotationPatchStrikeout.cs +++ b/src/CloudPDF/Types/AnnotationPatchStrikeout.cs @@ -23,6 +23,9 @@ public record AnnotationPatchStrikeout : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchText.cs b/src/CloudPDF/Types/AnnotationPatchText.cs index 7ad269d5..af865df8 100644 --- a/src/CloudPDF/Types/AnnotationPatchText.cs +++ b/src/CloudPDF/Types/AnnotationPatchText.cs @@ -23,6 +23,9 @@ public record AnnotationPatchText : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPatchUnderline.cs b/src/CloudPDF/Types/AnnotationPatchUnderline.cs index 9a745ab9..9716d8e3 100644 --- a/src/CloudPDF/Types/AnnotationPatchUnderline.cs +++ b/src/CloudPDF/Types/AnnotationPatchUnderline.cs @@ -23,6 +23,9 @@ public record AnnotationPatchUnderline : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPolygon.cs b/src/CloudPDF/Types/AnnotationPolygon.cs index 5547c200..015bbe64 100644 --- a/src/CloudPDF/Types/AnnotationPolygon.cs +++ b/src/CloudPDF/Types/AnnotationPolygon.cs @@ -23,6 +23,9 @@ public record AnnotationPolygon : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPolyline.cs b/src/CloudPDF/Types/AnnotationPolyline.cs index ea8c2eb3..4da14bb5 100644 --- a/src/CloudPDF/Types/AnnotationPolyline.cs +++ b/src/CloudPDF/Types/AnnotationPolyline.cs @@ -23,6 +23,9 @@ public record AnnotationPolyline : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationPopup.cs b/src/CloudPDF/Types/AnnotationPopup.cs index 1c556a34..93b04697 100644 --- a/src/CloudPDF/Types/AnnotationPopup.cs +++ b/src/CloudPDF/Types/AnnotationPopup.cs @@ -23,6 +23,9 @@ public record AnnotationPopup : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationRedact.cs b/src/CloudPDF/Types/AnnotationRedact.cs index 1adc9a77..ee12765c 100644 --- a/src/CloudPDF/Types/AnnotationRedact.cs +++ b/src/CloudPDF/Types/AnnotationRedact.cs @@ -23,6 +23,9 @@ public record AnnotationRedact : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationSquare.cs b/src/CloudPDF/Types/AnnotationSquare.cs index d78a2d5f..7f5524be 100644 --- a/src/CloudPDF/Types/AnnotationSquare.cs +++ b/src/CloudPDF/Types/AnnotationSquare.cs @@ -23,6 +23,9 @@ public record AnnotationSquare : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationSquiggly.cs b/src/CloudPDF/Types/AnnotationSquiggly.cs index 38753247..144a4098 100644 --- a/src/CloudPDF/Types/AnnotationSquiggly.cs +++ b/src/CloudPDF/Types/AnnotationSquiggly.cs @@ -23,6 +23,9 @@ public record AnnotationSquiggly : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationStamp.cs b/src/CloudPDF/Types/AnnotationStamp.cs index 1a87fe75..69cb4337 100644 --- a/src/CloudPDF/Types/AnnotationStamp.cs +++ b/src/CloudPDF/Types/AnnotationStamp.cs @@ -23,6 +23,9 @@ public record AnnotationStamp : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationStrikeout.cs b/src/CloudPDF/Types/AnnotationStrikeout.cs index 51c7906a..593c3f1d 100644 --- a/src/CloudPDF/Types/AnnotationStrikeout.cs +++ b/src/CloudPDF/Types/AnnotationStrikeout.cs @@ -23,6 +23,9 @@ public record AnnotationStrikeout : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationText.cs b/src/CloudPDF/Types/AnnotationText.cs index d7d69af6..c21c302c 100644 --- a/src/CloudPDF/Types/AnnotationText.cs +++ b/src/CloudPDF/Types/AnnotationText.cs @@ -23,6 +23,9 @@ public record AnnotationText : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationUnderline.cs b/src/CloudPDF/Types/AnnotationUnderline.cs index 1e5b04f0..bd978117 100644 --- a/src/CloudPDF/Types/AnnotationUnderline.cs +++ b/src/CloudPDF/Types/AnnotationUnderline.cs @@ -23,6 +23,9 @@ public record AnnotationUnderline : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AnnotationUnsupported.cs b/src/CloudPDF/Types/AnnotationUnsupported.cs index a7f4fd30..4778d429 100644 --- a/src/CloudPDF/Types/AnnotationUnsupported.cs +++ b/src/CloudPDF/Types/AnnotationUnsupported.cs @@ -23,6 +23,9 @@ public record AnnotationUnsupported : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/AttachmentMutationMeta.cs b/src/CloudPDF/Types/AttachmentMutationMeta.cs index d66ebcb8..7e62f799 100644 --- a/src/CloudPDF/Types/AttachmentMutationMeta.cs +++ b/src/CloudPDF/Types/AttachmentMutationMeta.cs @@ -23,6 +23,9 @@ public record AttachmentMutationMeta : IJsonOnDeserialized [JsonPropertyName("undoable")] public required bool Undoable { get; set; } + [JsonPropertyName("missingCharacters")] + public IEnumerable? MissingCharacters { get; set; } + [JsonPropertyName("changed")] public IEnumerable Changed { get; set; } = new List(); diff --git a/src/CloudPDF/Types/CacheDelta.cs b/src/CloudPDF/Types/CacheDelta.cs index f1583de1..0e5c9db4 100644 --- a/src/CloudPDF/Types/CacheDelta.cs +++ b/src/CloudPDF/Types/CacheDelta.cs @@ -35,6 +35,9 @@ public record CacheDelta : IJsonOnDeserialized [JsonPropertyName("outlineVersion")] public int? OutlineVersion { get; set; } + [JsonPropertyName("fontsVersion")] + public int? FontsVersion { get; set; } + [JsonPropertyName("layerVersion")] public int? LayerVersion { get; set; } diff --git a/src/CloudPDF/Types/ChangeItem.cs b/src/CloudPDF/Types/ChangeItem.cs index 219f15cc..6331bd0d 100644 --- a/src/CloudPDF/Types/ChangeItem.cs +++ b/src/CloudPDF/Types/ChangeItem.cs @@ -324,6 +324,15 @@ public ChangeItem(ChangeItem.PagesInsert value) Value = value.Value; } + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.PagesCopy value) + { + Type = "pages.copy"; + Value = value.Value; + } + /// /// Create an instance of ChangeItem with . /// @@ -541,6 +550,11 @@ public ChangeItem(ChangeItem.AttachmentsRestore value) /// public bool IsPagesInsert => Type == "pages.insert"; + /// + /// Returns true if is "pages.copy" + /// + public bool IsPagesCopy => Type == "pages.copy"; + /// /// Returns true if is "pages.restore" /// @@ -873,6 +887,15 @@ public CloudPDF.ChangeItemPagesInsert AsPagesInsert() => ? (CloudPDF.ChangeItemPagesInsert)Value! : throw new global::System.Exception("ChangeItem.Type is not 'pages.insert'"); + /// + /// Returns the value as a if is 'pages.copy', otherwise throws an exception. + /// + /// Thrown when is not 'pages.copy'. + public CloudPDF.ChangeItemPagesCopy AsPagesCopy() => + IsPagesCopy + ? (CloudPDF.ChangeItemPagesCopy)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'pages.copy'"); + /// /// Returns the value as a if is 'pages.restore', otherwise throws an exception. /// @@ -944,6 +967,7 @@ public T Match( Func onPagesDelete, Func onPagesInsertBlank, Func onPagesInsert, + Func onPagesCopy, Func onPagesRestore, Func onAttachmentsCreate, Func onAttachmentsDelete, @@ -989,6 +1013,7 @@ public T Match( "pages.delete" => onPagesDelete(AsPagesDelete()), "pages.insertBlank" => onPagesInsertBlank(AsPagesInsertBlank()), "pages.insert" => onPagesInsert(AsPagesInsert()), + "pages.copy" => onPagesCopy(AsPagesCopy()), "pages.restore" => onPagesRestore(AsPagesRestore()), "attachments.create" => onAttachmentsCreate(AsAttachmentsCreate()), "attachments.delete" => onAttachmentsDelete(AsAttachmentsDelete()), @@ -1032,6 +1057,7 @@ public void Visit( Action onPagesDelete, Action onPagesInsertBlank, Action onPagesInsert, + Action onPagesCopy, Action onPagesRestore, Action onAttachmentsCreate, Action onAttachmentsDelete, @@ -1143,6 +1169,9 @@ public void Visit( case "pages.insert": onPagesInsert(AsPagesInsert()); break; + case "pages.copy": + onPagesCopy(AsPagesCopy()); + break; case "pages.restore": onPagesRestore(AsPagesRestore()); break; @@ -1641,6 +1670,20 @@ public bool TryAsPagesInsert(out CloudPDF.ChangeItemPagesInsert? value) return false; } + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPagesCopy(out CloudPDF.ChangeItemPagesCopy? value) + { + if (Type == "pages.copy") + { + value = (CloudPDF.ChangeItemPagesCopy)Value!; + return true; + } + value = null; + return false; + } + /// /// Attempts to cast the value to a and returns true if successful. /// @@ -1770,6 +1813,8 @@ public static implicit operator ChangeItem(ChangeItem.FormsReorderCalculations v public static implicit operator ChangeItem(ChangeItem.PagesInsert value) => new(value); + public static implicit operator ChangeItem(ChangeItem.PagesCopy value) => new(value); + public static implicit operator ChangeItem(ChangeItem.PagesRestore value) => new(value); public static implicit operator ChangeItem(ChangeItem.AttachmentsCreate value) => new(value); @@ -2025,6 +2070,9 @@ JsonSerializerOptions options ?? throw new JsonException( "Failed to deserialize CloudPDF.ChangeItemPagesInsert" ), + "pages.copy" => jsonWithoutDiscriminator.Deserialize( + options + ) ?? throw new JsonException("Failed to deserialize CloudPDF.ChangeItemPagesCopy"), "pages.restore" => jsonWithoutDiscriminator.Deserialize(options) ?? throw new JsonException( @@ -2108,6 +2156,7 @@ JsonSerializerOptions options "pages.delete" => JsonSerializer.SerializeToNode(value.Value, options), "pages.insertBlank" => JsonSerializer.SerializeToNode(value.Value, options), "pages.insert" => JsonSerializer.SerializeToNode(value.Value, options), + "pages.copy" => JsonSerializer.SerializeToNode(value.Value, options), "pages.restore" => JsonSerializer.SerializeToNode(value.Value, options), "attachments.create" => JsonSerializer.SerializeToNode(value.Value, options), "attachments.delete" => JsonSerializer.SerializeToNode(value.Value, options), @@ -2819,6 +2868,25 @@ CloudPDF.ChangeItemPagesInsert value ) => new(value); } + /// + /// Discriminated union type for pages.copy + /// + [Serializable] + public struct PagesCopy + { + public PagesCopy(CloudPDF.ChangeItemPagesCopy value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesCopy Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.PagesCopy(CloudPDF.ChangeItemPagesCopy value) => + new(value); + } + /// /// Discriminated union type for pages.restore /// diff --git a/src/CloudPDF/Types/ChangeItemPagesCopy.cs b/src/CloudPDF/Types/ChangeItemPagesCopy.cs new file mode 100644 index 00000000..b8ada5e4 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopy.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopy : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("insertedPages")] + public IEnumerable InsertedPages { get; set; } = new List(); + + [JsonPropertyName("layout")] + public required ChangeItemPagesCopyLayout Layout { get; set; } + + [JsonPropertyName("meta")] + public required MutationMeta Meta { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayout.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayout.cs new file mode 100644 index 00000000..4ce54092 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayout.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayout : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pageCount")] + public required int PageCount { get; set; } + + [JsonPropertyName("pages")] + public IEnumerable Pages { get; set; } = + new List(); + + [JsonPropertyName("labels")] + public IEnumerable Labels { get; set; } = + new List(); + + [JsonPropertyName("namedPages")] + public IEnumerable NamedPages { get; set; } = + new List(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutLabelsItem.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutLabelsItem.cs new file mode 100644 index 00000000..bcdba300 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutLabelsItem.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutLabelsItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("firstPage")] + public required int FirstPage { get; set; } + + [JsonPropertyName("style")] + public ChangeItemPagesCopyLayoutLabelsItemStyle? Style { get; set; } + + [JsonPropertyName("firstNumber")] + public required int FirstNumber { get; set; } + + [JsonPropertyName("prefix")] + public required string Prefix { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutLabelsItemStyle.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutLabelsItemStyle.cs new file mode 100644 index 00000000..ee803644 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutLabelsItemStyle.cs @@ -0,0 +1,144 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(ChangeItemPagesCopyLayoutLabelsItemStyle.ChangeItemPagesCopyLayoutLabelsItemStyleSerializer) +)] +[Serializable] +public readonly record struct ChangeItemPagesCopyLayoutLabelsItemStyle : IStringEnum +{ + public static readonly ChangeItemPagesCopyLayoutLabelsItemStyle Decimal = new(Values.Decimal); + + public static readonly ChangeItemPagesCopyLayoutLabelsItemStyle UpperRoman = new( + Values.UpperRoman + ); + + public static readonly ChangeItemPagesCopyLayoutLabelsItemStyle LowerRoman = new( + Values.LowerRoman + ); + + public static readonly ChangeItemPagesCopyLayoutLabelsItemStyle UpperLetters = new( + Values.UpperLetters + ); + + public static readonly ChangeItemPagesCopyLayoutLabelsItemStyle LowerLetters = new( + Values.LowerLetters + ); + + public ChangeItemPagesCopyLayoutLabelsItemStyle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ChangeItemPagesCopyLayoutLabelsItemStyle FromCustom(string value) + { + return new ChangeItemPagesCopyLayoutLabelsItemStyle(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==( + ChangeItemPagesCopyLayoutLabelsItemStyle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + ChangeItemPagesCopyLayoutLabelsItemStyle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(ChangeItemPagesCopyLayoutLabelsItemStyle value) => + value.Value; + + public static explicit operator ChangeItemPagesCopyLayoutLabelsItemStyle(string value) => + new(value); + + internal class ChangeItemPagesCopyLayoutLabelsItemStyleSerializer + : JsonConverter + { + public override ChangeItemPagesCopyLayoutLabelsItemStyle Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ChangeItemPagesCopyLayoutLabelsItemStyle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ChangeItemPagesCopyLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override ChangeItemPagesCopyLayoutLabelsItemStyle ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new ChangeItemPagesCopyLayoutLabelsItemStyle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ChangeItemPagesCopyLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Decimal = "decimal"; + + public const string UpperRoman = "upperRoman"; + + public const string LowerRoman = "lowerRoman"; + + public const string UpperLetters = "upperLetters"; + + public const string LowerLetters = "lowerLetters"; + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItem.cs new file mode 100644 index 00000000..0f5e4c80 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItem.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutNamedPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required string Name { get; set; } + + [JsonPropertyName("target")] + public required ChangeItemPagesCopyLayoutNamedPagesItemTarget Target { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTarget.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTarget.cs new file mode 100644 index 00000000..b61e3654 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTarget.cs @@ -0,0 +1,380 @@ +// ReSharper disable NullableWarningSuppressionIsUsed +// ReSharper disable InconsistentNaming + +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Nodes; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(ChangeItemPagesCopyLayoutNamedPagesItemTarget.JsonConverter))] +[Serializable] +public record ChangeItemPagesCopyLayoutNamedPagesItemTarget +{ + internal ChangeItemPagesCopyLayoutNamedPagesItemTarget(string type, object? value) + { + Kind = type; + Value = value; + } + + /// + /// Create an instance of ChangeItemPagesCopyLayoutNamedPagesItemTarget with . + /// + public ChangeItemPagesCopyLayoutNamedPagesItemTarget( + ChangeItemPagesCopyLayoutNamedPagesItemTarget.Page value + ) + { + Kind = "page"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItemPagesCopyLayoutNamedPagesItemTarget with . + /// + public ChangeItemPagesCopyLayoutNamedPagesItemTarget( + ChangeItemPagesCopyLayoutNamedPagesItemTarget.Template value + ) + { + Kind = "template"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItemPagesCopyLayoutNamedPagesItemTarget with . + /// + public ChangeItemPagesCopyLayoutNamedPagesItemTarget( + ChangeItemPagesCopyLayoutNamedPagesItemTarget.Dangling value + ) + { + Kind = "dangling"; + Value = value.Value; + } + + /// + /// Discriminant value + /// + [JsonPropertyName("kind")] + public string Kind { get; internal set; } + + /// + /// Discriminated union value + /// + public object? Value { get; internal set; } + + /// + /// Returns true if is "page" + /// + public bool IsPage => Kind == "page"; + + /// + /// Returns true if is "template" + /// + public bool IsTemplate => Kind == "template"; + + /// + /// Returns true if is "dangling" + /// + public bool IsDangling => Kind == "dangling"; + + /// + /// Returns the value as a if is 'page', otherwise throws an exception. + /// + /// Thrown when is not 'page'. + public CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetPage AsPage() => + IsPage + ? (CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetPage)Value! + : throw new global::System.Exception( + "ChangeItemPagesCopyLayoutNamedPagesItemTarget.Kind is not 'page'" + ); + + /// + /// Returns the value as a if is 'template', otherwise throws an exception. + /// + /// Thrown when is not 'template'. + public CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetTemplate AsTemplate() => + IsTemplate + ? (CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetTemplate)Value! + : throw new global::System.Exception( + "ChangeItemPagesCopyLayoutNamedPagesItemTarget.Kind is not 'template'" + ); + + /// + /// Returns the value as a if is 'dangling', otherwise throws an exception. + /// + /// Thrown when is not 'dangling'. + public CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetDangling AsDangling() => + IsDangling + ? (CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetDangling)Value! + : throw new global::System.Exception( + "ChangeItemPagesCopyLayoutNamedPagesItemTarget.Kind is not 'dangling'" + ); + + public T Match( + Func onPage, + Func onTemplate, + Func onDangling, + Func onUnknown_ + ) + { + return Kind switch + { + "page" => onPage(AsPage()), + "template" => onTemplate(AsTemplate()), + "dangling" => onDangling(AsDangling()), + _ => onUnknown_(Kind, Value), + }; + } + + public void Visit( + Action onPage, + Action onTemplate, + Action onDangling, + Action onUnknown_ + ) + { + switch (Kind) + { + case "page": + onPage(AsPage()); + break; + case "template": + onTemplate(AsTemplate()); + break; + case "dangling": + onDangling(AsDangling()); + break; + default: + onUnknown_(Kind, Value); + break; + } + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPage(out CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetPage? value) + { + if (Kind == "page") + { + value = (CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetPage)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsTemplate( + out CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetTemplate? value + ) + { + if (Kind == "template") + { + value = (CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetTemplate)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsDangling( + out CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetDangling? value + ) + { + if (Kind == "dangling") + { + value = (CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetDangling)Value!; + return true; + } + value = null; + return false; + } + + public override string ToString() => JsonUtils.Serialize(this); + + public static implicit operator ChangeItemPagesCopyLayoutNamedPagesItemTarget( + ChangeItemPagesCopyLayoutNamedPagesItemTarget.Page value + ) => new(value); + + public static implicit operator ChangeItemPagesCopyLayoutNamedPagesItemTarget( + ChangeItemPagesCopyLayoutNamedPagesItemTarget.Template value + ) => new(value); + + public static implicit operator ChangeItemPagesCopyLayoutNamedPagesItemTarget( + ChangeItemPagesCopyLayoutNamedPagesItemTarget.Dangling value + ) => new(value); + + [Serializable] + internal sealed class JsonConverter + : JsonConverter + { + public override bool CanConvert(global::System.Type typeToConvert) => + typeof(ChangeItemPagesCopyLayoutNamedPagesItemTarget).IsAssignableFrom(typeToConvert); + + public override ChangeItemPagesCopyLayoutNamedPagesItemTarget Read( + ref Utf8JsonReader reader, + global::System.Type typeToConvert, + JsonSerializerOptions options + ) + { + var json = JsonElement.ParseValue(ref reader); + if (!json.TryGetProperty("kind", out var discriminatorElement)) + { + throw new JsonException("Missing discriminator property 'kind'"); + } + if (discriminatorElement.ValueKind != JsonValueKind.String) + { + if (discriminatorElement.ValueKind == JsonValueKind.Null) + { + throw new JsonException("Discriminator property 'kind' is null"); + } + + throw new JsonException( + $"Discriminator property 'kind' is not a string, instead is {discriminatorElement.ToString()}" + ); + } + + var discriminator = + discriminatorElement.GetString() + ?? throw new JsonException("Discriminator property 'kind' is null"); + + // Strip the discriminant property to prevent it from leaking into AdditionalProperties + var jsonObject = System.Text.Json.Nodes.JsonObject.Create(json); + jsonObject?.Remove("kind"); + var jsonWithoutDiscriminator = + jsonObject != null ? JsonSerializer.SerializeToElement(jsonObject, options) : json; + + var value = discriminator switch + { + "page" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetPage" + ), + "template" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetTemplate" + ), + "dangling" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetDangling" + ), + _ => json.Deserialize(options), + }; + return new ChangeItemPagesCopyLayoutNamedPagesItemTarget(discriminator, value); + } + + public override void Write( + Utf8JsonWriter writer, + ChangeItemPagesCopyLayoutNamedPagesItemTarget value, + JsonSerializerOptions options + ) + { + JsonNode json = + value.Kind switch + { + "page" => JsonSerializer.SerializeToNode(value.Value, options), + "template" => JsonSerializer.SerializeToNode(value.Value, options), + "dangling" => JsonSerializer.SerializeToNode(value.Value, options), + _ => JsonSerializer.SerializeToNode(value.Value, options), + } ?? new JsonObject(); + json["kind"] = value.Kind; + json.WriteTo(writer, options); + } + + public override ChangeItemPagesCopyLayoutNamedPagesItemTarget ReadAsPropertyName( + ref Utf8JsonReader reader, + global::System.Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new JsonException("The JSON property name could not be read as a string."); + return new ChangeItemPagesCopyLayoutNamedPagesItemTarget(stringValue, stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ChangeItemPagesCopyLayoutNamedPagesItemTarget value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Kind); + } + } + + /// + /// Discriminated union type for page + /// + [Serializable] + public struct Page + { + public Page(CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetPage value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetPage Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItemPagesCopyLayoutNamedPagesItemTarget.Page( + CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetPage value + ) => new(value); + } + + /// + /// Discriminated union type for template + /// + [Serializable] + public struct Template + { + public Template(CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetTemplate value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetTemplate Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItemPagesCopyLayoutNamedPagesItemTarget.Template( + CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetTemplate value + ) => new(value); + } + + /// + /// Discriminated union type for dangling + /// + [Serializable] + public struct Dangling + { + public Dangling(CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetDangling value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetDangling Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItemPagesCopyLayoutNamedPagesItemTarget.Dangling( + CloudPDF.ChangeItemPagesCopyLayoutNamedPagesItemTargetDangling value + ) => new(value); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTargetDangling.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTargetDangling.cs new file mode 100644 index 00000000..eb919462 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTargetDangling.cs @@ -0,0 +1,25 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutNamedPagesItemTargetDangling : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTargetPage.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTargetPage.cs new file mode 100644 index 00000000..ce4ff0e4 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTargetPage.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutNamedPagesItemTargetPage : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("page")] + public required PageRef Page { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTargetTemplate.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTargetTemplate.cs new file mode 100644 index 00000000..b876d3ae --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutNamedPagesItemTargetTemplate.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutNamedPagesItemTargetTemplate : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("objectNumber")] + public required int ObjectNumber { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItem.cs new file mode 100644 index 00000000..7057b8c6 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItem.cs @@ -0,0 +1,55 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("index")] + public required int Index { get; set; } + + [JsonPropertyName("ref")] + public required PageRef Ref { get; set; } + + [JsonPropertyName("label")] + public string? Label { get; set; } + + [JsonPropertyName("size")] + public required ChangeItemPagesCopyLayoutPagesItemSize Size { get; set; } + + [JsonPropertyName("rotation")] + public required double Rotation { get; set; } + + [JsonPropertyName("userUnit")] + public required double UserUnit { get; set; } + + [JsonPropertyName("tabOrder")] + public ChangeItemPagesCopyLayoutPagesItemTabOrder? TabOrder { get; set; } + + [JsonPropertyName("boxes")] + public required ChangeItemPagesCopyLayoutPagesItemBoxes Boxes { get; set; } + + [JsonPropertyName("pdfCropBox")] + public required ChangeItemPagesCopyLayoutPagesItemPdfCropBox PdfCropBox { get; set; } + + [JsonPropertyName("actions")] + public PdfPageActions? Actions { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxes.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxes.cs new file mode 100644 index 00000000..917f69cf --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxes.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutPagesItemBoxes : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("media")] + public required ChangeItemPagesCopyLayoutPagesItemBoxesMedia Media { get; set; } + + [JsonPropertyName("crop")] + public required ChangeItemPagesCopyLayoutPagesItemBoxesCrop Crop { get; set; } + + [JsonPropertyName("bleed")] + public required ChangeItemPagesCopyLayoutPagesItemBoxesBleed Bleed { get; set; } + + [JsonPropertyName("trim")] + public required ChangeItemPagesCopyLayoutPagesItemBoxesTrim Trim { get; set; } + + [JsonPropertyName("art")] + public required ChangeItemPagesCopyLayoutPagesItemBoxesArt Art { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesArt.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesArt.cs new file mode 100644 index 00000000..eb0fe115 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesArt.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutPagesItemBoxesArt : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("x")] + public required double X { get; set; } + + [JsonPropertyName("y")] + public required double Y { get; set; } + + [JsonPropertyName("width")] + public required double Width { get; set; } + + [JsonPropertyName("height")] + public required double Height { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesBleed.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesBleed.cs new file mode 100644 index 00000000..84ae1c75 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesBleed.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutPagesItemBoxesBleed : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("x")] + public required double X { get; set; } + + [JsonPropertyName("y")] + public required double Y { get; set; } + + [JsonPropertyName("width")] + public required double Width { get; set; } + + [JsonPropertyName("height")] + public required double Height { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesCrop.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesCrop.cs new file mode 100644 index 00000000..579a38f4 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesCrop.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutPagesItemBoxesCrop : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("x")] + public required double X { get; set; } + + [JsonPropertyName("y")] + public required double Y { get; set; } + + [JsonPropertyName("width")] + public required double Width { get; set; } + + [JsonPropertyName("height")] + public required double Height { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesMedia.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesMedia.cs new file mode 100644 index 00000000..8e671b70 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesMedia.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutPagesItemBoxesMedia : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("x")] + public required double X { get; set; } + + [JsonPropertyName("y")] + public required double Y { get; set; } + + [JsonPropertyName("width")] + public required double Width { get; set; } + + [JsonPropertyName("height")] + public required double Height { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesTrim.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesTrim.cs new file mode 100644 index 00000000..fc12c8cd --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemBoxesTrim.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutPagesItemBoxesTrim : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("x")] + public required double X { get; set; } + + [JsonPropertyName("y")] + public required double Y { get; set; } + + [JsonPropertyName("width")] + public required double Width { get; set; } + + [JsonPropertyName("height")] + public required double Height { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemPdfCropBox.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemPdfCropBox.cs new file mode 100644 index 00000000..68dda06f --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemPdfCropBox.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutPagesItemPdfCropBox : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("left")] + public required double Left { get; set; } + + [JsonPropertyName("bottom")] + public required double Bottom { get; set; } + + [JsonPropertyName("right")] + public required double Right { get; set; } + + [JsonPropertyName("top")] + public required double Top { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemSize.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemSize.cs new file mode 100644 index 00000000..710443a1 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemSize.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesCopyLayoutPagesItemSize : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("width")] + public required double Width { get; set; } + + [JsonPropertyName("height")] + public required double Height { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemTabOrder.cs b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemTabOrder.cs new file mode 100644 index 00000000..9f1f7c24 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesCopyLayoutPagesItemTabOrder.cs @@ -0,0 +1,140 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(ChangeItemPagesCopyLayoutPagesItemTabOrder.ChangeItemPagesCopyLayoutPagesItemTabOrderSerializer) +)] +[Serializable] +public readonly record struct ChangeItemPagesCopyLayoutPagesItemTabOrder : IStringEnum +{ + public static readonly ChangeItemPagesCopyLayoutPagesItemTabOrder Rows = new(Values.Rows); + + public static readonly ChangeItemPagesCopyLayoutPagesItemTabOrder Columns = new(Values.Columns); + + public static readonly ChangeItemPagesCopyLayoutPagesItemTabOrder Structure = new( + Values.Structure + ); + + public static readonly ChangeItemPagesCopyLayoutPagesItemTabOrder Annotations = new( + Values.Annotations + ); + + public static readonly ChangeItemPagesCopyLayoutPagesItemTabOrder Widgets = new(Values.Widgets); + + public ChangeItemPagesCopyLayoutPagesItemTabOrder(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ChangeItemPagesCopyLayoutPagesItemTabOrder FromCustom(string value) + { + return new ChangeItemPagesCopyLayoutPagesItemTabOrder(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==( + ChangeItemPagesCopyLayoutPagesItemTabOrder value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + ChangeItemPagesCopyLayoutPagesItemTabOrder value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(ChangeItemPagesCopyLayoutPagesItemTabOrder value) => + value.Value; + + public static explicit operator ChangeItemPagesCopyLayoutPagesItemTabOrder(string value) => + new(value); + + internal class ChangeItemPagesCopyLayoutPagesItemTabOrderSerializer + : JsonConverter + { + public override ChangeItemPagesCopyLayoutPagesItemTabOrder Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ChangeItemPagesCopyLayoutPagesItemTabOrder(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ChangeItemPagesCopyLayoutPagesItemTabOrder value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override ChangeItemPagesCopyLayoutPagesItemTabOrder ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new ChangeItemPagesCopyLayoutPagesItemTabOrder(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ChangeItemPagesCopyLayoutPagesItemTabOrder value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Rows = "rows"; + + public const string Columns = "columns"; + + public const string Structure = "structure"; + + public const string Annotations = "annotations"; + + public const string Widgets = "widgets"; + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesDeleteLayout.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayout.cs index 033a9cfc..b4c41081 100644 --- a/src/CloudPDF/Types/ChangeItemPagesDeleteLayout.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayout.cs @@ -18,6 +18,10 @@ public record ChangeItemPagesDeleteLayout : IJsonOnDeserialized public IEnumerable Pages { get; set; } = new List(); + [JsonPropertyName("labels")] + public IEnumerable Labels { get; set; } = + new List(); + [JsonPropertyName("namedPages")] public IEnumerable NamedPages { get; set; } = new List(); diff --git a/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutLabelsItem.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutLabelsItem.cs new file mode 100644 index 00000000..4b380d9c --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutLabelsItem.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesDeleteLayoutLabelsItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("firstPage")] + public required int FirstPage { get; set; } + + [JsonPropertyName("style")] + public ChangeItemPagesDeleteLayoutLabelsItemStyle? Style { get; set; } + + [JsonPropertyName("firstNumber")] + public required int FirstNumber { get; set; } + + [JsonPropertyName("prefix")] + public required string Prefix { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutLabelsItemStyle.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutLabelsItemStyle.cs new file mode 100644 index 00000000..e98fd495 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutLabelsItemStyle.cs @@ -0,0 +1,144 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(ChangeItemPagesDeleteLayoutLabelsItemStyle.ChangeItemPagesDeleteLayoutLabelsItemStyleSerializer) +)] +[Serializable] +public readonly record struct ChangeItemPagesDeleteLayoutLabelsItemStyle : IStringEnum +{ + public static readonly ChangeItemPagesDeleteLayoutLabelsItemStyle Decimal = new(Values.Decimal); + + public static readonly ChangeItemPagesDeleteLayoutLabelsItemStyle UpperRoman = new( + Values.UpperRoman + ); + + public static readonly ChangeItemPagesDeleteLayoutLabelsItemStyle LowerRoman = new( + Values.LowerRoman + ); + + public static readonly ChangeItemPagesDeleteLayoutLabelsItemStyle UpperLetters = new( + Values.UpperLetters + ); + + public static readonly ChangeItemPagesDeleteLayoutLabelsItemStyle LowerLetters = new( + Values.LowerLetters + ); + + public ChangeItemPagesDeleteLayoutLabelsItemStyle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ChangeItemPagesDeleteLayoutLabelsItemStyle FromCustom(string value) + { + return new ChangeItemPagesDeleteLayoutLabelsItemStyle(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==( + ChangeItemPagesDeleteLayoutLabelsItemStyle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + ChangeItemPagesDeleteLayoutLabelsItemStyle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(ChangeItemPagesDeleteLayoutLabelsItemStyle value) => + value.Value; + + public static explicit operator ChangeItemPagesDeleteLayoutLabelsItemStyle(string value) => + new(value); + + internal class ChangeItemPagesDeleteLayoutLabelsItemStyleSerializer + : JsonConverter + { + public override ChangeItemPagesDeleteLayoutLabelsItemStyle Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ChangeItemPagesDeleteLayoutLabelsItemStyle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ChangeItemPagesDeleteLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override ChangeItemPagesDeleteLayoutLabelsItemStyle ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new ChangeItemPagesDeleteLayoutLabelsItemStyle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ChangeItemPagesDeleteLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Decimal = "decimal"; + + public const string UpperRoman = "upperRoman"; + + public const string LowerRoman = "lowerRoman"; + + public const string UpperLetters = "upperLetters"; + + public const string LowerLetters = "lowerLetters"; + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayout.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayout.cs index 3a43363b..463a36ca 100644 --- a/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayout.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayout.cs @@ -18,6 +18,10 @@ public record ChangeItemPagesInsertBlankLayout : IJsonOnDeserialized public IEnumerable Pages { get; set; } = new List(); + [JsonPropertyName("labels")] + public IEnumerable Labels { get; set; } = + new List(); + [JsonPropertyName("namedPages")] public IEnumerable NamedPages { get; set; } = new List(); diff --git a/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutLabelsItem.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutLabelsItem.cs new file mode 100644 index 00000000..813eda3b --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutLabelsItem.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesInsertBlankLayoutLabelsItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("firstPage")] + public required int FirstPage { get; set; } + + [JsonPropertyName("style")] + public ChangeItemPagesInsertBlankLayoutLabelsItemStyle? Style { get; set; } + + [JsonPropertyName("firstNumber")] + public required int FirstNumber { get; set; } + + [JsonPropertyName("prefix")] + public required string Prefix { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutLabelsItemStyle.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutLabelsItemStyle.cs new file mode 100644 index 00000000..19e16045 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutLabelsItemStyle.cs @@ -0,0 +1,146 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(ChangeItemPagesInsertBlankLayoutLabelsItemStyle.ChangeItemPagesInsertBlankLayoutLabelsItemStyleSerializer) +)] +[Serializable] +public readonly record struct ChangeItemPagesInsertBlankLayoutLabelsItemStyle : IStringEnum +{ + public static readonly ChangeItemPagesInsertBlankLayoutLabelsItemStyle Decimal = new( + Values.Decimal + ); + + public static readonly ChangeItemPagesInsertBlankLayoutLabelsItemStyle UpperRoman = new( + Values.UpperRoman + ); + + public static readonly ChangeItemPagesInsertBlankLayoutLabelsItemStyle LowerRoman = new( + Values.LowerRoman + ); + + public static readonly ChangeItemPagesInsertBlankLayoutLabelsItemStyle UpperLetters = new( + Values.UpperLetters + ); + + public static readonly ChangeItemPagesInsertBlankLayoutLabelsItemStyle LowerLetters = new( + Values.LowerLetters + ); + + public ChangeItemPagesInsertBlankLayoutLabelsItemStyle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ChangeItemPagesInsertBlankLayoutLabelsItemStyle FromCustom(string value) + { + return new ChangeItemPagesInsertBlankLayoutLabelsItemStyle(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==( + ChangeItemPagesInsertBlankLayoutLabelsItemStyle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + ChangeItemPagesInsertBlankLayoutLabelsItemStyle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(ChangeItemPagesInsertBlankLayoutLabelsItemStyle value) => + value.Value; + + public static explicit operator ChangeItemPagesInsertBlankLayoutLabelsItemStyle(string value) => + new(value); + + internal class ChangeItemPagesInsertBlankLayoutLabelsItemStyleSerializer + : JsonConverter + { + public override ChangeItemPagesInsertBlankLayoutLabelsItemStyle Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ChangeItemPagesInsertBlankLayoutLabelsItemStyle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ChangeItemPagesInsertBlankLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override ChangeItemPagesInsertBlankLayoutLabelsItemStyle ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new ChangeItemPagesInsertBlankLayoutLabelsItemStyle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ChangeItemPagesInsertBlankLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Decimal = "decimal"; + + public const string UpperRoman = "upperRoman"; + + public const string LowerRoman = "lowerRoman"; + + public const string UpperLetters = "upperLetters"; + + public const string LowerLetters = "lowerLetters"; + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesInsertLayout.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayout.cs index cbe48896..621c1905 100644 --- a/src/CloudPDF/Types/ChangeItemPagesInsertLayout.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayout.cs @@ -18,6 +18,10 @@ public record ChangeItemPagesInsertLayout : IJsonOnDeserialized public IEnumerable Pages { get; set; } = new List(); + [JsonPropertyName("labels")] + public IEnumerable Labels { get; set; } = + new List(); + [JsonPropertyName("namedPages")] public IEnumerable NamedPages { get; set; } = new List(); diff --git a/src/CloudPDF/Types/ChangeItemPagesInsertLayoutLabelsItem.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutLabelsItem.cs new file mode 100644 index 00000000..44dda364 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutLabelsItem.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesInsertLayoutLabelsItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("firstPage")] + public required int FirstPage { get; set; } + + [JsonPropertyName("style")] + public ChangeItemPagesInsertLayoutLabelsItemStyle? Style { get; set; } + + [JsonPropertyName("firstNumber")] + public required int FirstNumber { get; set; } + + [JsonPropertyName("prefix")] + public required string Prefix { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesInsertLayoutLabelsItemStyle.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutLabelsItemStyle.cs new file mode 100644 index 00000000..1eadb15d --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutLabelsItemStyle.cs @@ -0,0 +1,144 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(ChangeItemPagesInsertLayoutLabelsItemStyle.ChangeItemPagesInsertLayoutLabelsItemStyleSerializer) +)] +[Serializable] +public readonly record struct ChangeItemPagesInsertLayoutLabelsItemStyle : IStringEnum +{ + public static readonly ChangeItemPagesInsertLayoutLabelsItemStyle Decimal = new(Values.Decimal); + + public static readonly ChangeItemPagesInsertLayoutLabelsItemStyle UpperRoman = new( + Values.UpperRoman + ); + + public static readonly ChangeItemPagesInsertLayoutLabelsItemStyle LowerRoman = new( + Values.LowerRoman + ); + + public static readonly ChangeItemPagesInsertLayoutLabelsItemStyle UpperLetters = new( + Values.UpperLetters + ); + + public static readonly ChangeItemPagesInsertLayoutLabelsItemStyle LowerLetters = new( + Values.LowerLetters + ); + + public ChangeItemPagesInsertLayoutLabelsItemStyle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ChangeItemPagesInsertLayoutLabelsItemStyle FromCustom(string value) + { + return new ChangeItemPagesInsertLayoutLabelsItemStyle(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==( + ChangeItemPagesInsertLayoutLabelsItemStyle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + ChangeItemPagesInsertLayoutLabelsItemStyle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(ChangeItemPagesInsertLayoutLabelsItemStyle value) => + value.Value; + + public static explicit operator ChangeItemPagesInsertLayoutLabelsItemStyle(string value) => + new(value); + + internal class ChangeItemPagesInsertLayoutLabelsItemStyleSerializer + : JsonConverter + { + public override ChangeItemPagesInsertLayoutLabelsItemStyle Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ChangeItemPagesInsertLayoutLabelsItemStyle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ChangeItemPagesInsertLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override ChangeItemPagesInsertLayoutLabelsItemStyle ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new ChangeItemPagesInsertLayoutLabelsItemStyle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ChangeItemPagesInsertLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Decimal = "decimal"; + + public const string UpperRoman = "upperRoman"; + + public const string LowerRoman = "lowerRoman"; + + public const string UpperLetters = "upperLetters"; + + public const string LowerLetters = "lowerLetters"; + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesReorderLayout.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayout.cs index e199a675..e5d51da1 100644 --- a/src/CloudPDF/Types/ChangeItemPagesReorderLayout.cs +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayout.cs @@ -18,6 +18,10 @@ public record ChangeItemPagesReorderLayout : IJsonOnDeserialized public IEnumerable Pages { get; set; } = new List(); + [JsonPropertyName("labels")] + public IEnumerable Labels { get; set; } = + new List(); + [JsonPropertyName("namedPages")] public IEnumerable NamedPages { get; set; } = new List(); diff --git a/src/CloudPDF/Types/ChangeItemPagesReorderLayoutLabelsItem.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutLabelsItem.cs new file mode 100644 index 00000000..0d3f1bbd --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutLabelsItem.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesReorderLayoutLabelsItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("firstPage")] + public required int FirstPage { get; set; } + + [JsonPropertyName("style")] + public ChangeItemPagesReorderLayoutLabelsItemStyle? Style { get; set; } + + [JsonPropertyName("firstNumber")] + public required int FirstNumber { get; set; } + + [JsonPropertyName("prefix")] + public required string Prefix { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesReorderLayoutLabelsItemStyle.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutLabelsItemStyle.cs new file mode 100644 index 00000000..e1d9f3d0 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutLabelsItemStyle.cs @@ -0,0 +1,146 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(ChangeItemPagesReorderLayoutLabelsItemStyle.ChangeItemPagesReorderLayoutLabelsItemStyleSerializer) +)] +[Serializable] +public readonly record struct ChangeItemPagesReorderLayoutLabelsItemStyle : IStringEnum +{ + public static readonly ChangeItemPagesReorderLayoutLabelsItemStyle Decimal = new( + Values.Decimal + ); + + public static readonly ChangeItemPagesReorderLayoutLabelsItemStyle UpperRoman = new( + Values.UpperRoman + ); + + public static readonly ChangeItemPagesReorderLayoutLabelsItemStyle LowerRoman = new( + Values.LowerRoman + ); + + public static readonly ChangeItemPagesReorderLayoutLabelsItemStyle UpperLetters = new( + Values.UpperLetters + ); + + public static readonly ChangeItemPagesReorderLayoutLabelsItemStyle LowerLetters = new( + Values.LowerLetters + ); + + public ChangeItemPagesReorderLayoutLabelsItemStyle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ChangeItemPagesReorderLayoutLabelsItemStyle FromCustom(string value) + { + return new ChangeItemPagesReorderLayoutLabelsItemStyle(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==( + ChangeItemPagesReorderLayoutLabelsItemStyle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + ChangeItemPagesReorderLayoutLabelsItemStyle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(ChangeItemPagesReorderLayoutLabelsItemStyle value) => + value.Value; + + public static explicit operator ChangeItemPagesReorderLayoutLabelsItemStyle(string value) => + new(value); + + internal class ChangeItemPagesReorderLayoutLabelsItemStyleSerializer + : JsonConverter + { + public override ChangeItemPagesReorderLayoutLabelsItemStyle Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ChangeItemPagesReorderLayoutLabelsItemStyle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ChangeItemPagesReorderLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override ChangeItemPagesReorderLayoutLabelsItemStyle ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new ChangeItemPagesReorderLayoutLabelsItemStyle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ChangeItemPagesReorderLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Decimal = "decimal"; + + public const string UpperRoman = "upperRoman"; + + public const string LowerRoman = "lowerRoman"; + + public const string UpperLetters = "upperLetters"; + + public const string LowerLetters = "lowerLetters"; + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesRestoreLayout.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayout.cs index a0681bee..0024c9d0 100644 --- a/src/CloudPDF/Types/ChangeItemPagesRestoreLayout.cs +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayout.cs @@ -18,6 +18,10 @@ public record ChangeItemPagesRestoreLayout : IJsonOnDeserialized public IEnumerable Pages { get; set; } = new List(); + [JsonPropertyName("labels")] + public IEnumerable Labels { get; set; } = + new List(); + [JsonPropertyName("namedPages")] public IEnumerable NamedPages { get; set; } = new List(); diff --git a/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutLabelsItem.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutLabelsItem.cs new file mode 100644 index 00000000..684af196 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutLabelsItem.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutLabelsItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("firstPage")] + public required int FirstPage { get; set; } + + [JsonPropertyName("style")] + public ChangeItemPagesRestoreLayoutLabelsItemStyle? Style { get; set; } + + [JsonPropertyName("firstNumber")] + public required int FirstNumber { get; set; } + + [JsonPropertyName("prefix")] + public required string Prefix { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutLabelsItemStyle.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutLabelsItemStyle.cs new file mode 100644 index 00000000..0f954302 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutLabelsItemStyle.cs @@ -0,0 +1,146 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(ChangeItemPagesRestoreLayoutLabelsItemStyle.ChangeItemPagesRestoreLayoutLabelsItemStyleSerializer) +)] +[Serializable] +public readonly record struct ChangeItemPagesRestoreLayoutLabelsItemStyle : IStringEnum +{ + public static readonly ChangeItemPagesRestoreLayoutLabelsItemStyle Decimal = new( + Values.Decimal + ); + + public static readonly ChangeItemPagesRestoreLayoutLabelsItemStyle UpperRoman = new( + Values.UpperRoman + ); + + public static readonly ChangeItemPagesRestoreLayoutLabelsItemStyle LowerRoman = new( + Values.LowerRoman + ); + + public static readonly ChangeItemPagesRestoreLayoutLabelsItemStyle UpperLetters = new( + Values.UpperLetters + ); + + public static readonly ChangeItemPagesRestoreLayoutLabelsItemStyle LowerLetters = new( + Values.LowerLetters + ); + + public ChangeItemPagesRestoreLayoutLabelsItemStyle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ChangeItemPagesRestoreLayoutLabelsItemStyle FromCustom(string value) + { + return new ChangeItemPagesRestoreLayoutLabelsItemStyle(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==( + ChangeItemPagesRestoreLayoutLabelsItemStyle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + ChangeItemPagesRestoreLayoutLabelsItemStyle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(ChangeItemPagesRestoreLayoutLabelsItemStyle value) => + value.Value; + + public static explicit operator ChangeItemPagesRestoreLayoutLabelsItemStyle(string value) => + new(value); + + internal class ChangeItemPagesRestoreLayoutLabelsItemStyleSerializer + : JsonConverter + { + public override ChangeItemPagesRestoreLayoutLabelsItemStyle Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ChangeItemPagesRestoreLayoutLabelsItemStyle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ChangeItemPagesRestoreLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override ChangeItemPagesRestoreLayoutLabelsItemStyle ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new ChangeItemPagesRestoreLayoutLabelsItemStyle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ChangeItemPagesRestoreLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Decimal = "decimal"; + + public const string UpperRoman = "upperRoman"; + + public const string LowerRoman = "lowerRoman"; + + public const string UpperLetters = "upperLetters"; + + public const string LowerLetters = "lowerLetters"; + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesRotateLayout.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayout.cs index 44576ac6..aa747a8f 100644 --- a/src/CloudPDF/Types/ChangeItemPagesRotateLayout.cs +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayout.cs @@ -18,6 +18,10 @@ public record ChangeItemPagesRotateLayout : IJsonOnDeserialized public IEnumerable Pages { get; set; } = new List(); + [JsonPropertyName("labels")] + public IEnumerable Labels { get; set; } = + new List(); + [JsonPropertyName("namedPages")] public IEnumerable NamedPages { get; set; } = new List(); diff --git a/src/CloudPDF/Types/ChangeItemPagesRotateLayoutLabelsItem.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutLabelsItem.cs new file mode 100644 index 00000000..0bd3e0d0 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutLabelsItem.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutLabelsItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("firstPage")] + public required int FirstPage { get; set; } + + [JsonPropertyName("style")] + public ChangeItemPagesRotateLayoutLabelsItemStyle? Style { get; set; } + + [JsonPropertyName("firstNumber")] + public required int FirstNumber { get; set; } + + [JsonPropertyName("prefix")] + public required string Prefix { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesRotateLayoutLabelsItemStyle.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutLabelsItemStyle.cs new file mode 100644 index 00000000..1f569a52 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutLabelsItemStyle.cs @@ -0,0 +1,144 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(ChangeItemPagesRotateLayoutLabelsItemStyle.ChangeItemPagesRotateLayoutLabelsItemStyleSerializer) +)] +[Serializable] +public readonly record struct ChangeItemPagesRotateLayoutLabelsItemStyle : IStringEnum +{ + public static readonly ChangeItemPagesRotateLayoutLabelsItemStyle Decimal = new(Values.Decimal); + + public static readonly ChangeItemPagesRotateLayoutLabelsItemStyle UpperRoman = new( + Values.UpperRoman + ); + + public static readonly ChangeItemPagesRotateLayoutLabelsItemStyle LowerRoman = new( + Values.LowerRoman + ); + + public static readonly ChangeItemPagesRotateLayoutLabelsItemStyle UpperLetters = new( + Values.UpperLetters + ); + + public static readonly ChangeItemPagesRotateLayoutLabelsItemStyle LowerLetters = new( + Values.LowerLetters + ); + + public ChangeItemPagesRotateLayoutLabelsItemStyle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ChangeItemPagesRotateLayoutLabelsItemStyle FromCustom(string value) + { + return new ChangeItemPagesRotateLayoutLabelsItemStyle(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==( + ChangeItemPagesRotateLayoutLabelsItemStyle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + ChangeItemPagesRotateLayoutLabelsItemStyle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(ChangeItemPagesRotateLayoutLabelsItemStyle value) => + value.Value; + + public static explicit operator ChangeItemPagesRotateLayoutLabelsItemStyle(string value) => + new(value); + + internal class ChangeItemPagesRotateLayoutLabelsItemStyleSerializer + : JsonConverter + { + public override ChangeItemPagesRotateLayoutLabelsItemStyle Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ChangeItemPagesRotateLayoutLabelsItemStyle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ChangeItemPagesRotateLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override ChangeItemPagesRotateLayoutLabelsItemStyle ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new ChangeItemPagesRotateLayoutLabelsItemStyle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ChangeItemPagesRotateLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Decimal = "decimal"; + + public const string UpperRoman = "upperRoman"; + + public const string LowerRoman = "lowerRoman"; + + public const string UpperLetters = "upperLetters"; + + public const string LowerLetters = "lowerLetters"; + } +} diff --git a/src/CloudPDF/Types/ChangeItemSkippedOp.cs b/src/CloudPDF/Types/ChangeItemSkippedOp.cs index 6a40f80e..25c40ab1 100644 --- a/src/CloudPDF/Types/ChangeItemSkippedOp.cs +++ b/src/CloudPDF/Types/ChangeItemSkippedOp.cs @@ -76,6 +76,8 @@ namespace CloudPDF; public static readonly ChangeItemSkippedOp PagesInsert = new(Values.PagesInsert); + public static readonly ChangeItemSkippedOp PagesCopy = new(Values.PagesCopy); + public static readonly ChangeItemSkippedOp AttachmentsCreate = new(Values.AttachmentsCreate); public static readonly ChangeItemSkippedOp AttachmentsDelete = new(Values.AttachmentsDelete); @@ -246,6 +248,8 @@ public static class Values public const string PagesInsert = "pages.insert"; + public const string PagesCopy = "pages.copy"; + public const string AttachmentsCreate = "attachments.create"; public const string AttachmentsDelete = "attachments.delete"; diff --git a/src/CloudPDF/Types/ChangeOp.cs b/src/CloudPDF/Types/ChangeOp.cs index 5356311c..6bce1a65 100644 --- a/src/CloudPDF/Types/ChangeOp.cs +++ b/src/CloudPDF/Types/ChangeOp.cs @@ -279,6 +279,15 @@ public ChangeOp(ChangeOp.PagesInsert value) Value = value.Value; } + /// + /// Create an instance of ChangeOp with . + /// + public ChangeOp(ChangeOp.PagesCopy value) + { + Type = "pages.copy"; + Value = value.Value; + } + /// /// Create an instance of ChangeOp with . /// @@ -453,6 +462,11 @@ public ChangeOp(ChangeOp.AttachmentsDelete value) /// public bool IsPagesInsert => Type == "pages.insert"; + /// + /// Returns true if is "pages.copy" + /// + public bool IsPagesCopy => Type == "pages.copy"; + /// /// Returns true if is "attachments.create" /// @@ -728,6 +742,15 @@ public CloudPDF.ChangeOpPagesInsert AsPagesInsert() => ? (CloudPDF.ChangeOpPagesInsert)Value! : throw new global::System.Exception("ChangeOp.Type is not 'pages.insert'"); + /// + /// Returns the value as a if is 'pages.copy', otherwise throws an exception. + /// + /// Thrown when is not 'pages.copy'. + public CloudPDF.ChangeOpPagesCopy AsPagesCopy() => + IsPagesCopy + ? (CloudPDF.ChangeOpPagesCopy)Value! + : throw new global::System.Exception("ChangeOp.Type is not 'pages.copy'"); + /// /// Returns the value as a if is 'attachments.create', otherwise throws an exception. /// @@ -776,6 +799,7 @@ public T Match( Func onPagesDelete, Func onPagesInsertBlank, Func onPagesInsert, + Func onPagesCopy, Func onAttachmentsCreate, Func onAttachmentsDelete, Func onUnknown_ @@ -814,6 +838,7 @@ public T Match( "pages.delete" => onPagesDelete(AsPagesDelete()), "pages.insertBlank" => onPagesInsertBlank(AsPagesInsertBlank()), "pages.insert" => onPagesInsert(AsPagesInsert()), + "pages.copy" => onPagesCopy(AsPagesCopy()), "attachments.create" => onAttachmentsCreate(AsAttachmentsCreate()), "attachments.delete" => onAttachmentsDelete(AsAttachmentsDelete()), _ => onUnknown_(Type, Value), @@ -850,6 +875,7 @@ public void Visit( Action onPagesDelete, Action onPagesInsertBlank, Action onPagesInsert, + Action onPagesCopy, Action onAttachmentsCreate, Action onAttachmentsDelete, Action onUnknown_ @@ -944,6 +970,9 @@ public void Visit( case "pages.insert": onPagesInsert(AsPagesInsert()); break; + case "pages.copy": + onPagesCopy(AsPagesCopy()); + break; case "attachments.create": onAttachmentsCreate(AsAttachmentsCreate()); break; @@ -1364,6 +1393,20 @@ public bool TryAsPagesInsert(out CloudPDF.ChangeOpPagesInsert? value) return false; } + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPagesCopy(out CloudPDF.ChangeOpPagesCopy? value) + { + if (Type == "pages.copy") + { + value = (CloudPDF.ChangeOpPagesCopy)Value!; + return true; + } + value = null; + return false; + } + /// /// Attempts to cast the value to a and returns true if successful. /// @@ -1453,6 +1496,8 @@ public static implicit operator ChangeOp(ChangeOp.FormsSetSignatureAppearance va public static implicit operator ChangeOp(ChangeOp.PagesInsert value) => new(value); + public static implicit operator ChangeOp(ChangeOp.PagesCopy value) => new(value); + public static implicit operator ChangeOp(ChangeOp.AttachmentsCreate value) => new(value); public static implicit operator ChangeOp(ChangeOp.AttachmentsDelete value) => new(value); @@ -1667,6 +1712,9 @@ JsonSerializerOptions options ?? throw new JsonException( "Failed to deserialize CloudPDF.ChangeOpPagesInsert" ), + "pages.copy" => jsonWithoutDiscriminator.Deserialize( + options + ) ?? throw new JsonException("Failed to deserialize CloudPDF.ChangeOpPagesCopy"), "attachments.create" => jsonWithoutDiscriminator.Deserialize( options @@ -1733,6 +1781,7 @@ JsonSerializerOptions options "pages.delete" => JsonSerializer.SerializeToNode(value.Value, options), "pages.insertBlank" => JsonSerializer.SerializeToNode(value.Value, options), "pages.insert" => JsonSerializer.SerializeToNode(value.Value, options), + "pages.copy" => JsonSerializer.SerializeToNode(value.Value, options), "attachments.create" => JsonSerializer.SerializeToNode(value.Value, options), "attachments.delete" => JsonSerializer.SerializeToNode(value.Value, options), _ => JsonSerializer.SerializeToNode(value.Value, options), @@ -2335,6 +2384,25 @@ public static implicit operator ChangeOp.PagesInsert(CloudPDF.ChangeOpPagesInser new(value); } + /// + /// Discriminated union type for pages.copy + /// + [Serializable] + public struct PagesCopy + { + public PagesCopy(CloudPDF.ChangeOpPagesCopy value) + { + Value = value; + } + + internal CloudPDF.ChangeOpPagesCopy Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeOp.PagesCopy(CloudPDF.ChangeOpPagesCopy value) => + new(value); + } + /// /// Discriminated union type for attachments.create /// diff --git a/src/CloudPDF/Types/ChangeOpPagesCopy.cs b/src/CloudPDF/Types/ChangeOpPagesCopy.cs new file mode 100644 index 00000000..9de66003 --- /dev/null +++ b/src/CloudPDF/Types/ChangeOpPagesCopy.cs @@ -0,0 +1,35 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using OneOf; + +namespace CloudPDF; + +[Serializable] +public record ChangeOpPagesCopy : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pages")] + public IEnumerable Pages { get; set; } = new List(); + + [JsonPropertyName("position")] + public OneOf? Position { get; set; } + + [JsonPropertyName("objectNumbers")] + public IEnumerable? ObjectNumbers { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/ChangeOpPagesInsert.cs b/src/CloudPDF/Types/ChangeOpPagesInsert.cs index 04572629..002594ae 100644 --- a/src/CloudPDF/Types/ChangeOpPagesInsert.cs +++ b/src/CloudPDF/Types/ChangeOpPagesInsert.cs @@ -18,6 +18,9 @@ public record ChangeOpPagesInsert : IJsonOnDeserialized [JsonPropertyName("position")] public OneOf? Position { get; set; } + [JsonPropertyName("objectNumbers")] + public IEnumerable? ObjectNumbers { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocManifest200Response.cs b/src/CloudPDF/Types/DocManifest200Response.cs index 620b0a97..d044a523 100644 --- a/src/CloudPDF/Types/DocManifest200Response.cs +++ b/src/CloudPDF/Types/DocManifest200Response.cs @@ -35,6 +35,12 @@ public record DocManifest200Response : IJsonOnDeserialized [JsonPropertyName("outlineVersion")] public int? OutlineVersion { get; set; } + [JsonPropertyName("fontsVersion")] + public int? FontsVersion { get; set; } + + [JsonPropertyName("serverFonts")] + public required string ServerFonts { get; set; } + [JsonPropertyName("auditHead")] public required int AuditHead { get; set; } diff --git a/src/CloudPDF/Types/DocPagesRemoveName200ResponseLayout.cs b/src/CloudPDF/Types/DocPagesRemoveName200ResponseLayout.cs index 20954a17..7a84426e 100644 --- a/src/CloudPDF/Types/DocPagesRemoveName200ResponseLayout.cs +++ b/src/CloudPDF/Types/DocPagesRemoveName200ResponseLayout.cs @@ -18,6 +18,10 @@ public record DocPagesRemoveName200ResponseLayout : IJsonOnDeserialized public IEnumerable Pages { get; set; } = new List(); + [JsonPropertyName("labels")] + public IEnumerable Labels { get; set; } = + new List(); + [JsonPropertyName("namedPages")] public IEnumerable NamedPages { get; set; } = new List(); diff --git a/src/CloudPDF/Types/DocPagesRemoveName200ResponseLayoutLabelsItem.cs b/src/CloudPDF/Types/DocPagesRemoveName200ResponseLayoutLabelsItem.cs new file mode 100644 index 00000000..6700cb62 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName200ResponseLayoutLabelsItem.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesRemoveName200ResponseLayoutLabelsItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("firstPage")] + public required int FirstPage { get; set; } + + [JsonPropertyName("style")] + public DocPagesRemoveName200ResponseLayoutLabelsItemStyle? Style { get; set; } + + [JsonPropertyName("firstNumber")] + public required int FirstNumber { get; set; } + + [JsonPropertyName("prefix")] + public required string Prefix { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/DocPagesRemoveName200ResponseLayoutLabelsItemStyle.cs b/src/CloudPDF/Types/DocPagesRemoveName200ResponseLayoutLabelsItemStyle.cs new file mode 100644 index 00000000..59225728 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName200ResponseLayoutLabelsItemStyle.cs @@ -0,0 +1,148 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocPagesRemoveName200ResponseLayoutLabelsItemStyle.DocPagesRemoveName200ResponseLayoutLabelsItemStyleSerializer) +)] +[Serializable] +public readonly record struct DocPagesRemoveName200ResponseLayoutLabelsItemStyle : IStringEnum +{ + public static readonly DocPagesRemoveName200ResponseLayoutLabelsItemStyle Decimal = new( + Values.Decimal + ); + + public static readonly DocPagesRemoveName200ResponseLayoutLabelsItemStyle UpperRoman = new( + Values.UpperRoman + ); + + public static readonly DocPagesRemoveName200ResponseLayoutLabelsItemStyle LowerRoman = new( + Values.LowerRoman + ); + + public static readonly DocPagesRemoveName200ResponseLayoutLabelsItemStyle UpperLetters = new( + Values.UpperLetters + ); + + public static readonly DocPagesRemoveName200ResponseLayoutLabelsItemStyle LowerLetters = new( + Values.LowerLetters + ); + + public DocPagesRemoveName200ResponseLayoutLabelsItemStyle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesRemoveName200ResponseLayoutLabelsItemStyle FromCustom(string value) + { + return new DocPagesRemoveName200ResponseLayoutLabelsItemStyle(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==( + DocPagesRemoveName200ResponseLayoutLabelsItemStyle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + DocPagesRemoveName200ResponseLayoutLabelsItemStyle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + DocPagesRemoveName200ResponseLayoutLabelsItemStyle value + ) => value.Value; + + public static explicit operator DocPagesRemoveName200ResponseLayoutLabelsItemStyle( + string value + ) => new(value); + + internal class DocPagesRemoveName200ResponseLayoutLabelsItemStyleSerializer + : JsonConverter + { + public override DocPagesRemoveName200ResponseLayoutLabelsItemStyle Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new DocPagesRemoveName200ResponseLayoutLabelsItemStyle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesRemoveName200ResponseLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesRemoveName200ResponseLayoutLabelsItemStyle ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new DocPagesRemoveName200ResponseLayoutLabelsItemStyle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesRemoveName200ResponseLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Decimal = "decimal"; + + public const string UpperRoman = "upperRoman"; + + public const string LowerRoman = "lowerRoman"; + + public const string UpperLetters = "upperLetters"; + + public const string LowerLetters = "lowerLetters"; + } +} diff --git a/src/CloudPDF/Types/DocPagesSetName200ResponseLayout.cs b/src/CloudPDF/Types/DocPagesSetName200ResponseLayout.cs index 8d488b18..211ef614 100644 --- a/src/CloudPDF/Types/DocPagesSetName200ResponseLayout.cs +++ b/src/CloudPDF/Types/DocPagesSetName200ResponseLayout.cs @@ -18,6 +18,10 @@ public record DocPagesSetName200ResponseLayout : IJsonOnDeserialized public IEnumerable Pages { get; set; } = new List(); + [JsonPropertyName("labels")] + public IEnumerable Labels { get; set; } = + new List(); + [JsonPropertyName("namedPages")] public IEnumerable NamedPages { get; set; } = new List(); diff --git a/src/CloudPDF/Types/DocPagesSetName200ResponseLayoutLabelsItem.cs b/src/CloudPDF/Types/DocPagesSetName200ResponseLayoutLabelsItem.cs new file mode 100644 index 00000000..6a63db44 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName200ResponseLayoutLabelsItem.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesSetName200ResponseLayoutLabelsItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("firstPage")] + public required int FirstPage { get; set; } + + [JsonPropertyName("style")] + public DocPagesSetName200ResponseLayoutLabelsItemStyle? Style { get; set; } + + [JsonPropertyName("firstNumber")] + public required int FirstNumber { get; set; } + + [JsonPropertyName("prefix")] + public required string Prefix { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/DocPagesSetName200ResponseLayoutLabelsItemStyle.cs b/src/CloudPDF/Types/DocPagesSetName200ResponseLayoutLabelsItemStyle.cs new file mode 100644 index 00000000..d97d1299 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName200ResponseLayoutLabelsItemStyle.cs @@ -0,0 +1,146 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocPagesSetName200ResponseLayoutLabelsItemStyle.DocPagesSetName200ResponseLayoutLabelsItemStyleSerializer) +)] +[Serializable] +public readonly record struct DocPagesSetName200ResponseLayoutLabelsItemStyle : IStringEnum +{ + public static readonly DocPagesSetName200ResponseLayoutLabelsItemStyle Decimal = new( + Values.Decimal + ); + + public static readonly DocPagesSetName200ResponseLayoutLabelsItemStyle UpperRoman = new( + Values.UpperRoman + ); + + public static readonly DocPagesSetName200ResponseLayoutLabelsItemStyle LowerRoman = new( + Values.LowerRoman + ); + + public static readonly DocPagesSetName200ResponseLayoutLabelsItemStyle UpperLetters = new( + Values.UpperLetters + ); + + public static readonly DocPagesSetName200ResponseLayoutLabelsItemStyle LowerLetters = new( + Values.LowerLetters + ); + + public DocPagesSetName200ResponseLayoutLabelsItemStyle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesSetName200ResponseLayoutLabelsItemStyle FromCustom(string value) + { + return new DocPagesSetName200ResponseLayoutLabelsItemStyle(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==( + DocPagesSetName200ResponseLayoutLabelsItemStyle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + DocPagesSetName200ResponseLayoutLabelsItemStyle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesSetName200ResponseLayoutLabelsItemStyle value) => + value.Value; + + public static explicit operator DocPagesSetName200ResponseLayoutLabelsItemStyle(string value) => + new(value); + + internal class DocPagesSetName200ResponseLayoutLabelsItemStyleSerializer + : JsonConverter + { + public override DocPagesSetName200ResponseLayoutLabelsItemStyle Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new DocPagesSetName200ResponseLayoutLabelsItemStyle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesSetName200ResponseLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesSetName200ResponseLayoutLabelsItemStyle ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new DocPagesSetName200ResponseLayoutLabelsItemStyle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesSetName200ResponseLayoutLabelsItemStyle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Decimal = "decimal"; + + public const string UpperRoman = "upperRoman"; + + public const string LowerRoman = "lowerRoman"; + + public const string UpperLetters = "upperLetters"; + + public const string LowerLetters = "lowerLetters"; + } +} diff --git a/src/CloudPDF/Types/Font.cs b/src/CloudPDF/Types/Font.cs new file mode 100644 index 00000000..cc47c3da --- /dev/null +++ b/src/CloudPDF/Types/Font.cs @@ -0,0 +1,53 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record Font : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required string Name { get; set; } + + [JsonPropertyName("source")] + public required FontSource Source { get; set; } + + [JsonPropertyName("familyName")] + public required string FamilyName { get; set; } + + [JsonPropertyName("weight")] + public required int Weight { get; set; } + + [JsonPropertyName("italic")] + public required bool Italic { get; set; } + + [JsonPropertyName("postScriptName")] + public string? PostScriptName { get; set; } + + [JsonPropertyName("canChoose")] + public required bool CanChoose { get; set; } + + [JsonPropertyName("restrictions")] + public IEnumerable Restrictions { get; set; } = + new List(); + + [JsonPropertyName("programs")] + public IEnumerable Programs { get; set; } = new List(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/FontList.cs b/src/CloudPDF/Types/FontList.cs new file mode 100644 index 00000000..b6e1052a --- /dev/null +++ b/src/CloudPDF/Types/FontList.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record FontList : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("fonts")] + public IEnumerable Fonts { get; set; } = new List(); + + [JsonPropertyName("fallbacks")] + public IEnumerable Fallbacks { get; set; } = new List(); + + [JsonPropertyName("lastResort")] + public required FontProgram LastResort { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/FontProgram.cs b/src/CloudPDF/Types/FontProgram.cs new file mode 100644 index 00000000..6fd92b09 --- /dev/null +++ b/src/CloudPDF/Types/FontProgram.cs @@ -0,0 +1,43 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record FontProgram : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("displayHash")] + public string? DisplayHash { get; set; } + + [JsonPropertyName("sourceHash")] + public string? SourceHash { get; set; } + + [JsonPropertyName("embedded")] + public required FontProgramEmbedded Embedded { get; set; } + + [JsonPropertyName("format")] + public FontProgramFormat? Format { get; set; } + + [JsonPropertyName("embeddingPermission")] + public FontProgramEmbeddingPermission? EmbeddingPermission { get; set; } + + [JsonPropertyName("canDownload")] + public required bool CanDownload { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/FontProgramEmbedded.cs b/src/CloudPDF/Types/FontProgramEmbedded.cs new file mode 100644 index 00000000..738848a8 --- /dev/null +++ b/src/CloudPDF/Types/FontProgramEmbedded.cs @@ -0,0 +1,119 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(FontProgramEmbedded.FontProgramEmbeddedSerializer))] +[Serializable] +public readonly record struct FontProgramEmbedded : IStringEnum +{ + public static readonly FontProgramEmbedded Whole = new(Values.Whole); + + public static readonly FontProgramEmbedded Subset = new(Values.Subset); + + public static readonly FontProgramEmbedded None = new(Values.None); + + public FontProgramEmbedded(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static FontProgramEmbedded FromCustom(string value) + { + return new FontProgramEmbedded(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(FontProgramEmbedded value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(FontProgramEmbedded value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(FontProgramEmbedded value) => value.Value; + + public static explicit operator FontProgramEmbedded(string value) => new(value); + + internal class FontProgramEmbeddedSerializer : JsonConverter + { + public override FontProgramEmbedded Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new FontProgramEmbedded(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + FontProgramEmbedded value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override FontProgramEmbedded ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new FontProgramEmbedded(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + FontProgramEmbedded value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Whole = "whole"; + + public const string Subset = "subset"; + + public const string None = "none"; + } +} diff --git a/src/CloudPDF/Types/FontProgramEmbeddingPermission.cs b/src/CloudPDF/Types/FontProgramEmbeddingPermission.cs new file mode 100644 index 00000000..70b27588 --- /dev/null +++ b/src/CloudPDF/Types/FontProgramEmbeddingPermission.cs @@ -0,0 +1,122 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(FontProgramEmbeddingPermission.FontProgramEmbeddingPermissionSerializer))] +[Serializable] +public readonly record struct FontProgramEmbeddingPermission : IStringEnum +{ + public static readonly FontProgramEmbeddingPermission Installable = new(Values.Installable); + + public static readonly FontProgramEmbeddingPermission Editable = new(Values.Editable); + + public static readonly FontProgramEmbeddingPermission PreviewAndPrint = new( + Values.PreviewAndPrint + ); + + public FontProgramEmbeddingPermission(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static FontProgramEmbeddingPermission FromCustom(string value) + { + return new FontProgramEmbeddingPermission(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(FontProgramEmbeddingPermission value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(FontProgramEmbeddingPermission value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(FontProgramEmbeddingPermission value) => value.Value; + + public static explicit operator FontProgramEmbeddingPermission(string value) => new(value); + + internal class FontProgramEmbeddingPermissionSerializer + : JsonConverter + { + public override FontProgramEmbeddingPermission Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new FontProgramEmbeddingPermission(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + FontProgramEmbeddingPermission value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override FontProgramEmbeddingPermission ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new FontProgramEmbeddingPermission(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + FontProgramEmbeddingPermission value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Installable = "installable"; + + public const string Editable = "editable"; + + public const string PreviewAndPrint = "preview-and-print"; + } +} diff --git a/src/CloudPDF/Types/FontProgramFormat.cs b/src/CloudPDF/Types/FontProgramFormat.cs new file mode 100644 index 00000000..753f1015 --- /dev/null +++ b/src/CloudPDF/Types/FontProgramFormat.cs @@ -0,0 +1,127 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(FontProgramFormat.FontProgramFormatSerializer))] +[Serializable] +public readonly record struct FontProgramFormat : IStringEnum +{ + public static readonly FontProgramFormat Truetype = new(Values.Truetype); + + public static readonly FontProgramFormat Opentype = new(Values.Opentype); + + public static readonly FontProgramFormat Cff = new(Values.Cff); + + public static readonly FontProgramFormat Type1 = new(Values.Type1); + + public static readonly FontProgramFormat Type3 = new(Values.Type3); + + public FontProgramFormat(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static FontProgramFormat FromCustom(string value) + { + return new FontProgramFormat(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(FontProgramFormat value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(FontProgramFormat value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(FontProgramFormat value) => value.Value; + + public static explicit operator FontProgramFormat(string value) => new(value); + + internal class FontProgramFormatSerializer : JsonConverter + { + public override FontProgramFormat Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new FontProgramFormat(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + FontProgramFormat value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override FontProgramFormat ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new FontProgramFormat(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + FontProgramFormat value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Truetype = "truetype"; + + public const string Opentype = "opentype"; + + public const string Cff = "cff"; + + public const string Type1 = "type1"; + + public const string Type3 = "type3"; + } +} diff --git a/src/CloudPDF/Types/FontProgramInfo.cs b/src/CloudPDF/Types/FontProgramInfo.cs new file mode 100644 index 00000000..8e79123d --- /dev/null +++ b/src/CloudPDF/Types/FontProgramInfo.cs @@ -0,0 +1,53 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record FontProgramInfo : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("displayHash")] + public string? DisplayHash { get; set; } + + [JsonPropertyName("sourceHash")] + public string? SourceHash { get; set; } + + [JsonPropertyName("embedded")] + public required FontProgramInfoEmbedded Embedded { get; set; } + + [JsonPropertyName("format")] + public FontProgramInfoFormat? Format { get; set; } + + [JsonPropertyName("embeddingPermission")] + public FontProgramInfoEmbeddingPermission? EmbeddingPermission { get; set; } + + [JsonPropertyName("canDownload")] + public required bool CanDownload { get; set; } + + [JsonPropertyName("covers")] + public IEnumerable Covers { get; set; } = + new List(); + + [JsonPropertyName("ascent")] + public required double Ascent { get; set; } + + [JsonPropertyName("descent")] + public required double Descent { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/FontProgramInfoCoversItem.cs b/src/CloudPDF/Types/FontProgramInfoCoversItem.cs new file mode 100644 index 00000000..6d0a43e8 --- /dev/null +++ b/src/CloudPDF/Types/FontProgramInfoCoversItem.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record FontProgramInfoCoversItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("start")] + public required int Start { get; set; } + + [JsonPropertyName("count")] + public required int Count { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/FontProgramInfoEmbedded.cs b/src/CloudPDF/Types/FontProgramInfoEmbedded.cs new file mode 100644 index 00000000..ff77646a --- /dev/null +++ b/src/CloudPDF/Types/FontProgramInfoEmbedded.cs @@ -0,0 +1,119 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(FontProgramInfoEmbedded.FontProgramInfoEmbeddedSerializer))] +[Serializable] +public readonly record struct FontProgramInfoEmbedded : IStringEnum +{ + public static readonly FontProgramInfoEmbedded Whole = new(Values.Whole); + + public static readonly FontProgramInfoEmbedded Subset = new(Values.Subset); + + public static readonly FontProgramInfoEmbedded None = new(Values.None); + + public FontProgramInfoEmbedded(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static FontProgramInfoEmbedded FromCustom(string value) + { + return new FontProgramInfoEmbedded(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(FontProgramInfoEmbedded value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(FontProgramInfoEmbedded value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(FontProgramInfoEmbedded value) => value.Value; + + public static explicit operator FontProgramInfoEmbedded(string value) => new(value); + + internal class FontProgramInfoEmbeddedSerializer : JsonConverter + { + public override FontProgramInfoEmbedded Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new FontProgramInfoEmbedded(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + FontProgramInfoEmbedded value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override FontProgramInfoEmbedded ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new FontProgramInfoEmbedded(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + FontProgramInfoEmbedded value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Whole = "whole"; + + public const string Subset = "subset"; + + public const string None = "none"; + } +} diff --git a/src/CloudPDF/Types/FontProgramInfoEmbeddingPermission.cs b/src/CloudPDF/Types/FontProgramInfoEmbeddingPermission.cs new file mode 100644 index 00000000..a0eee360 --- /dev/null +++ b/src/CloudPDF/Types/FontProgramInfoEmbeddingPermission.cs @@ -0,0 +1,124 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(FontProgramInfoEmbeddingPermission.FontProgramInfoEmbeddingPermissionSerializer) +)] +[Serializable] +public readonly record struct FontProgramInfoEmbeddingPermission : IStringEnum +{ + public static readonly FontProgramInfoEmbeddingPermission Installable = new(Values.Installable); + + public static readonly FontProgramInfoEmbeddingPermission Editable = new(Values.Editable); + + public static readonly FontProgramInfoEmbeddingPermission PreviewAndPrint = new( + Values.PreviewAndPrint + ); + + public FontProgramInfoEmbeddingPermission(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static FontProgramInfoEmbeddingPermission FromCustom(string value) + { + return new FontProgramInfoEmbeddingPermission(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(FontProgramInfoEmbeddingPermission value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(FontProgramInfoEmbeddingPermission value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(FontProgramInfoEmbeddingPermission value) => value.Value; + + public static explicit operator FontProgramInfoEmbeddingPermission(string value) => new(value); + + internal class FontProgramInfoEmbeddingPermissionSerializer + : JsonConverter + { + public override FontProgramInfoEmbeddingPermission Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new FontProgramInfoEmbeddingPermission(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + FontProgramInfoEmbeddingPermission value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override FontProgramInfoEmbeddingPermission ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new FontProgramInfoEmbeddingPermission(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + FontProgramInfoEmbeddingPermission value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Installable = "installable"; + + public const string Editable = "editable"; + + public const string PreviewAndPrint = "preview-and-print"; + } +} diff --git a/src/CloudPDF/Types/FontProgramInfoFormat.cs b/src/CloudPDF/Types/FontProgramInfoFormat.cs new file mode 100644 index 00000000..c2c12ec3 --- /dev/null +++ b/src/CloudPDF/Types/FontProgramInfoFormat.cs @@ -0,0 +1,127 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(FontProgramInfoFormat.FontProgramInfoFormatSerializer))] +[Serializable] +public readonly record struct FontProgramInfoFormat : IStringEnum +{ + public static readonly FontProgramInfoFormat Truetype = new(Values.Truetype); + + public static readonly FontProgramInfoFormat Opentype = new(Values.Opentype); + + public static readonly FontProgramInfoFormat Cff = new(Values.Cff); + + public static readonly FontProgramInfoFormat Type1 = new(Values.Type1); + + public static readonly FontProgramInfoFormat Type3 = new(Values.Type3); + + public FontProgramInfoFormat(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static FontProgramInfoFormat FromCustom(string value) + { + return new FontProgramInfoFormat(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(FontProgramInfoFormat value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(FontProgramInfoFormat value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(FontProgramInfoFormat value) => value.Value; + + public static explicit operator FontProgramInfoFormat(string value) => new(value); + + internal class FontProgramInfoFormatSerializer : JsonConverter + { + public override FontProgramInfoFormat Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new FontProgramInfoFormat(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + FontProgramInfoFormat value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override FontProgramInfoFormat ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new FontProgramInfoFormat(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + FontProgramInfoFormat value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Truetype = "truetype"; + + public const string Opentype = "opentype"; + + public const string Cff = "cff"; + + public const string Type1 = "type1"; + + public const string Type3 = "type3"; + } +} diff --git a/src/CloudPDF/Types/FontResolution.cs b/src/CloudPDF/Types/FontResolution.cs new file mode 100644 index 00000000..8d34c2e3 --- /dev/null +++ b/src/CloudPDF/Types/FontResolution.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record FontResolution : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("runs")] + public IEnumerable Runs { get; set; } = new List(); + + [JsonPropertyName("missingCharacters")] + public IEnumerable MissingCharacters { get; set; } = new List(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/FontResolveRequest.cs b/src/CloudPDF/Types/FontResolveRequest.cs new file mode 100644 index 00000000..873915a6 --- /dev/null +++ b/src/CloudPDF/Types/FontResolveRequest.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record FontResolveRequest : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("annotation")] + public AnnotationRef? Annotation { get; set; } + + [JsonPropertyName("runs")] + public IEnumerable Runs { get; set; } = new List(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/FontResolveRun.cs b/src/CloudPDF/Types/FontResolveRun.cs new file mode 100644 index 00000000..bd186688 --- /dev/null +++ b/src/CloudPDF/Types/FontResolveRun.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record FontResolveRun : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("text")] + public required string Text { get; set; } + + [JsonPropertyName("fontFamily")] + public string? FontFamily { get; set; } + + [JsonPropertyName("family")] + public string? Family { get; set; } + + [JsonPropertyName("weight")] + public double? Weight { get; set; } + + [JsonPropertyName("italic")] + public bool? Italic { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/FontRestrictionsItem.cs b/src/CloudPDF/Types/FontRestrictionsItem.cs new file mode 100644 index 00000000..e1393d1e --- /dev/null +++ b/src/CloudPDF/Types/FontRestrictionsItem.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(FontRestrictionsItem.FontRestrictionsItemSerializer))] +[Serializable] +public readonly record struct FontRestrictionsItem : IStringEnum +{ + public static readonly FontRestrictionsItem Subset = new(Values.Subset); + + public static readonly FontRestrictionsItem NotEmbedded = new(Values.NotEmbedded); + + public static readonly FontRestrictionsItem PreviewAndPrint = new(Values.PreviewAndPrint); + + public static readonly FontRestrictionsItem UnsupportedFormat = new(Values.UnsupportedFormat); + + public static readonly FontRestrictionsItem NoUnicodeMap = new(Values.NoUnicodeMap); + + public static readonly FontRestrictionsItem NotServed = new(Values.NotServed); + + public FontRestrictionsItem(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static FontRestrictionsItem FromCustom(string value) + { + return new FontRestrictionsItem(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(FontRestrictionsItem value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(FontRestrictionsItem value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(FontRestrictionsItem value) => value.Value; + + public static explicit operator FontRestrictionsItem(string value) => new(value); + + internal class FontRestrictionsItemSerializer : JsonConverter + { + public override FontRestrictionsItem Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new FontRestrictionsItem(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + FontRestrictionsItem value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override FontRestrictionsItem ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new FontRestrictionsItem(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + FontRestrictionsItem value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Subset = "subset"; + + public const string NotEmbedded = "not-embedded"; + + public const string PreviewAndPrint = "preview-and-print"; + + public const string UnsupportedFormat = "unsupported-format"; + + public const string NoUnicodeMap = "no-unicode-map"; + + public const string NotServed = "not-served"; + } +} diff --git a/src/CloudPDF/Types/FontSource.cs b/src/CloudPDF/Types/FontSource.cs new file mode 100644 index 00000000..3f33bc8b --- /dev/null +++ b/src/CloudPDF/Types/FontSource.cs @@ -0,0 +1,118 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(FontSource.FontSourceSerializer))] +[Serializable] +public readonly record struct FontSource : IStringEnum +{ + public static readonly FontSource Standard = new(Values.Standard); + + public static readonly FontSource Engine = new(Values.Engine); + + public static readonly FontSource Document = new(Values.Document); + + public FontSource(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static FontSource FromCustom(string value) + { + return new FontSource(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(FontSource value1, string value2) => value1.Value.Equals(value2); + + public static bool operator !=(FontSource value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(FontSource value) => value.Value; + + public static explicit operator FontSource(string value) => new(value); + + internal class FontSourceSerializer : JsonConverter + { + public override FontSource Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new FontSource(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + FontSource value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override FontSource ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new FontSource(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + FontSource value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Standard = "standard"; + + public const string Engine = "engine"; + + public const string Document = "document"; + } +} diff --git a/src/CloudPDF/Types/FormMutationMeta.cs b/src/CloudPDF/Types/FormMutationMeta.cs index d1c71627..6faf8675 100644 --- a/src/CloudPDF/Types/FormMutationMeta.cs +++ b/src/CloudPDF/Types/FormMutationMeta.cs @@ -23,6 +23,9 @@ public record FormMutationMeta : IJsonOnDeserialized [JsonPropertyName("undoable")] public required bool Undoable { get; set; } + [JsonPropertyName("missingCharacters")] + public IEnumerable? MissingCharacters { get; set; } + [JsonPropertyName("changedFields")] public IEnumerable ChangedFields { get; set; } = new List(); diff --git a/src/CloudPDF/Types/MutationMeta.cs b/src/CloudPDF/Types/MutationMeta.cs index 4c038eb3..610d9de0 100644 --- a/src/CloudPDF/Types/MutationMeta.cs +++ b/src/CloudPDF/Types/MutationMeta.cs @@ -23,6 +23,9 @@ public record MutationMeta : IJsonOnDeserialized [JsonPropertyName("undoable")] public required bool Undoable { get; set; } + [JsonPropertyName("missingCharacters")] + public IEnumerable? MissingCharacters { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/OutlineMutationMeta.cs b/src/CloudPDF/Types/OutlineMutationMeta.cs index 69fd0a23..c816cf53 100644 --- a/src/CloudPDF/Types/OutlineMutationMeta.cs +++ b/src/CloudPDF/Types/OutlineMutationMeta.cs @@ -23,6 +23,9 @@ public record OutlineMutationMeta : IJsonOnDeserialized [JsonPropertyName("undoable")] public required bool Undoable { get; set; } + [JsonPropertyName("missingCharacters")] + public IEnumerable? MissingCharacters { get; set; } + [JsonPropertyName("changed")] public IEnumerable Changed { get; set; } = new List(); diff --git a/src/CloudPDF/Types/ResolvedFontRun.cs b/src/CloudPDF/Types/ResolvedFontRun.cs new file mode 100644 index 00000000..3d4aa461 --- /dev/null +++ b/src/CloudPDF/Types/ResolvedFontRun.cs @@ -0,0 +1,43 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ResolvedFontRun : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("font")] + public required string Font { get; set; } + + [JsonPropertyName("weight")] + public required double Weight { get; set; } + + [JsonPropertyName("italic")] + public required bool Italic { get; set; } + + [JsonPropertyName("substituted")] + public required bool Substituted { get; set; } + + [JsonPropertyName("program")] + public string? Program { get; set; } + + [JsonPropertyName("fallbacks")] + public IEnumerable Fallbacks { get; set; } = new List(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/TokensIssueRequest.cs b/src/CloudPDF/Types/TokensIssueRequest.cs index e7288060..032711b7 100644 --- a/src/CloudPDF/Types/TokensIssueRequest.cs +++ b/src/CloudPDF/Types/TokensIssueRequest.cs @@ -36,6 +36,15 @@ public TokensIssueRequest(TokensIssueRequest.Tenant value) Value = value.Value; } + /// + /// Create an instance of TokensIssueRequest with . + /// + public TokensIssueRequest(TokensIssueRequest.Upload value) + { + Kind = "upload"; + Value = value.Value; + } + /// /// Discriminant value /// @@ -57,6 +66,11 @@ public TokensIssueRequest(TokensIssueRequest.Tenant value) /// public bool IsTenant => Kind == "tenant"; + /// + /// Returns true if is "upload" + /// + public bool IsUpload => Kind == "upload"; + /// /// Returns the value as a if is 'doc', otherwise throws an exception. /// @@ -75,9 +89,19 @@ public CloudPDF.TokensIssueRequestTenant AsTenant() => ? (CloudPDF.TokensIssueRequestTenant)Value! : throw new global::System.Exception("TokensIssueRequest.Kind is not 'tenant'"); + /// + /// Returns the value as a if is 'upload', otherwise throws an exception. + /// + /// Thrown when is not 'upload'. + public CloudPDF.TokensIssueRequestUpload AsUpload() => + IsUpload + ? (CloudPDF.TokensIssueRequestUpload)Value! + : throw new global::System.Exception("TokensIssueRequest.Kind is not 'upload'"); + public T Match( Func onDoc, Func onTenant, + Func onUpload, Func onUnknown_ ) { @@ -85,6 +109,7 @@ public T Match( { "doc" => onDoc(AsDoc()), "tenant" => onTenant(AsTenant()), + "upload" => onUpload(AsUpload()), _ => onUnknown_(Kind, Value), }; } @@ -92,6 +117,7 @@ public T Match( public void Visit( Action onDoc, Action onTenant, + Action onUpload, Action onUnknown_ ) { @@ -103,6 +129,9 @@ public void Visit( case "tenant": onTenant(AsTenant()); break; + case "upload": + onUpload(AsUpload()); + break; default: onUnknown_(Kind, Value); break; @@ -137,6 +166,20 @@ public bool TryAsTenant(out CloudPDF.TokensIssueRequestTenant? value) return false; } + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsUpload(out CloudPDF.TokensIssueRequestUpload? value) + { + if (Kind == "upload") + { + value = (CloudPDF.TokensIssueRequestUpload)Value!; + return true; + } + value = null; + return false; + } + public override string ToString() => JsonUtils.Serialize(this); public static implicit operator TokensIssueRequest(TokensIssueRequest.Doc value) => new(value); @@ -144,6 +187,9 @@ public bool TryAsTenant(out CloudPDF.TokensIssueRequestTenant? value) public static implicit operator TokensIssueRequest(TokensIssueRequest.Tenant value) => new(value); + public static implicit operator TokensIssueRequest(TokensIssueRequest.Upload value) => + new(value); + [Serializable] internal sealed class JsonConverter : JsonConverter { @@ -198,6 +244,13 @@ JsonSerializerOptions options ?? throw new JsonException( "Failed to deserialize CloudPDF.TokensIssueRequestTenant" ), + "upload" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.TokensIssueRequestUpload" + ), _ => json.Deserialize(options), }; return new TokensIssueRequest(discriminator, value); @@ -214,6 +267,7 @@ JsonSerializerOptions options { "doc" => JsonSerializer.SerializeToNode(value.Value, options), "tenant" => JsonSerializer.SerializeToNode(value.Value, options), + "upload" => JsonSerializer.SerializeToNode(value.Value, options), _ => JsonSerializer.SerializeToNode(value.Value, options), } ?? new JsonObject(); json["kind"] = value.Kind; @@ -281,4 +335,24 @@ public static implicit operator TokensIssueRequest.Tenant( CloudPDF.TokensIssueRequestTenant value ) => new(value); } + + /// + /// Discriminated union type for upload + /// + [Serializable] + public struct Upload + { + public Upload(CloudPDF.TokensIssueRequestUpload value) + { + Value = value; + } + + internal CloudPDF.TokensIssueRequestUpload Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator TokensIssueRequest.Upload( + CloudPDF.TokensIssueRequestUpload value + ) => new(value); + } } diff --git a/src/CloudPDF/Types/TokensIssueRequestUpload.cs b/src/CloudPDF/Types/TokensIssueRequestUpload.cs new file mode 100644 index 00000000..7b9edd26 --- /dev/null +++ b/src/CloudPDF/Types/TokensIssueRequestUpload.cs @@ -0,0 +1,49 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record TokensIssueRequestUpload : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("sub")] + public required string Sub { get; set; } + + /// + /// A folder id, or root for the top level. + /// + [JsonPropertyName("folderId")] + public string? FolderId { get; set; } + + [JsonPropertyName("metadata")] + public Dictionary? Metadata { get; set; } + + [JsonPropertyName("maxFiles")] + public int? MaxFiles { get; set; } + + [JsonPropertyName("maxBytes")] + public int? MaxBytes { get; set; } + + [JsonPropertyName("origins")] + public IEnumerable? Origins { get; set; } + + [JsonPropertyName("expiresIn")] + public required int ExpiresIn { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/WidgetAnnotation.cs b/src/CloudPDF/Types/WidgetAnnotation.cs index 1759dec5..8b5e46ee 100644 --- a/src/CloudPDF/Types/WidgetAnnotation.cs +++ b/src/CloudPDF/Types/WidgetAnnotation.cs @@ -26,6 +26,9 @@ public record WidgetAnnotation : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public string? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public IEnumerable? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; } diff --git a/src/CloudPDF/Types/WidgetPatch.cs b/src/CloudPDF/Types/WidgetPatch.cs index 8faea7f6..b56efbfc 100644 --- a/src/CloudPDF/Types/WidgetPatch.cs +++ b/src/CloudPDF/Types/WidgetPatch.cs @@ -27,6 +27,9 @@ public record WidgetPatch : IJsonOnDeserialized [JsonPropertyName("appearanceState")] public object? AppearanceState { get; set; } + [JsonPropertyName("structurePosition")] + public object? StructurePosition { get; set; } + [JsonPropertyName("nm")] public string? Nm { get; set; }