diff --git a/.fern/metadata.json b/.fern/metadata.json index 3765a34f..5a79a16f 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": "c6f87eecf9636e7ef367946a7fd7f3729401ce90", + "originGitCommit": "7ded7de29f4cc0dc9da18042fca6afd5c9557bfc", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "3.0.0-next.15", + "requestedVersion": "3.0.0-next.16", "ciProvider": "github", - "sdkVersion": "3.0.0-next.15" + "sdkVersion": "3.0.0-next.16" } \ No newline at end of file diff --git a/cloudpdf-generation.json b/cloudpdf-generation.json index 754064ae..d87ef92b 100644 --- a/cloudpdf-generation.json +++ b/cloudpdf-generation.json @@ -1,12 +1,12 @@ { "language": "csharp", - "canonicalVersion": "3.0.0-next.15", - "sdkVersion": "3.0.0-next.15", + "canonicalVersion": "3.0.0-next.16", + "sdkVersion": "3.0.0-next.16", "source": { "repository": "embedpdf/embed-pdf-viewer", "openapi": "cloudpdf/contract/openapi.json", - "openapiSha256": "9d70deca638cc7a80b0e670ec47fc45710d6603eb8f493d5fac95a38d7e5f8b3", - "gitCommit": "c6f87eecf9636e7ef367946a7fd7f3729401ce90", + "openapiSha256": "06543c26918bd79d426bf242c5a3091cdb7d298d3ac3296addabee2be80edb15", + "gitCommit": "7ded7de29f4cc0dc9da18042fca6afd5c9557bfc", "gitCommitIsDirty": false }, "fern": { diff --git a/reference.md b/reference.md index 4616173a..190f32ad 100644 --- a/reference.md +++ b/reference.md @@ -78,7 +78,7 @@ await client.Doc.HeadAsync(new HeadDocRequest { DocId = "docId" });
-Each change stands on its own and names itself by `opId`: a refused change rolls back alone, and the answer lists every change in order, applied with its result or refused with its error. Asked again under its `opId`, a change gets the same answer, refusals included; a different change under an answered `opId` is refused (IdempotencyKeyReused). `{ opId, undoOf }` undoes an earlier change of the caller, here or in an earlier request; an undo leaves alone what was changed since, and the undo of an undo redoes. A redaction, a flatten, a form repair or a completed signature ends undo for the changes before it (UndoUnavailable). Each op is checked against its own capability: annotation ops need `doc.annotate.modify`, form values `doc.forms.fill`, form structure `doc.forms.modify`, metadata `doc.metadata.modify`. Bytes (a stamp's drawing, an attached file, a signature's artwork) travel as multipart: a JSON `body` part, each op naming its files by role as `resources: { : '' }`, and each file as the part `resource:`. At most 64 changes per request and 512 ops per change. +Each change stands on its own and names itself by `opId`: a refused change rolls back alone, and the answer lists every change in order, applied with its result or refused with its error. Asked again under its `opId`, a change gets the same answer, refusals included; a different change under an answered `opId` is refused (IdempotencyKeyReused). `{ opId, undoOf }` undoes an earlier change of the caller, here or in an earlier request; an undo leaves alone what was changed since, and the undo of an undo redoes. A redaction, a flatten, a form repair or a completed signature ends undo for the changes before it (UndoUnavailable). Each op is checked against its own capability: annotation ops need `doc.annotate.modify`, form values `doc.forms.fill`, form structure `doc.forms.modify`, metadata `doc.metadata.modify`, outline `doc.outline.modify`, pages `doc.pages.assemble`, embedded files `doc.attachments.modify`. Bytes (a stamp's drawing, an attached file, a signature's artwork, a PDF whose pages come in) travel as multipart: a JSON `body` part, each op naming its files by role as `resources: { : '' }`, and each file as the part `resource:`. At most 64 changes per request and 512 ops per change.
@@ -1772,6 +1772,68 @@ await client.Doc.Annotations.ReadAppearanceAsync( + + + + +
client.Doc.Annotations.ReadFileAsync(ReadFileAnnotationsRequest { ... }) -> WithRawResponseTask<Stream> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +A file that decodes past the server's limit is refused (PayloadTooLarge). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Doc.Annotations.ReadFileAsync( + new ReadFileAnnotationsRequest + { + DocId = "docId", + LayerName = "layerName", + PageKey = "pageKey", + AnnotKey = "annotKey", + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ReadFileAnnotationsRequest` + +
+
+
+
+ +
@@ -1938,28 +2000,12 @@ await client.Doc.Annotations.ReorderAsync( -## Doc Forms -
client.Doc.Forms.ListAsync(ListFormsRequest { ... }) -> WithRawResponseTask<DocFormsList200Response> -
-
- -#### 🔌 Usage - -
-
- +## Doc Attachments +
client.Doc.Attachments.DownloadAsync(DownloadAttachmentsRequest { ... }) -> WithRawResponseTask<Stream>
-```csharp -await client.Doc.Forms.ListAsync(new ListFormsRequest { DocId = "docId", LayerName = "layerName" }); -``` -
-
-
-
- -#### ⚙️ Parameters +#### 📝 Description
@@ -1967,22 +2013,12 @@ await client.Doc.Forms.ListAsync(new ListFormsRequest { DocId = "docId", LayerNa
-**request:** `ListFormsRequest` - +A file that decodes past the server's limit is refused (PayloadTooLarge).
- -
-
-
- -
client.Doc.Forms.ReorderCalculationsAsync(DocFormsReorderCalculationsRequest { ... }) -> WithRawResponseTask<DocFormsReorderCalculations200Response> -
-
- #### 🔌 Usage
@@ -1992,18 +2028,12 @@ await client.Doc.Forms.ListAsync(new ListFormsRequest { DocId = "docId", LayerNa
```csharp -await client.Doc.Forms.ReorderCalculationsAsync( - new DocFormsReorderCalculationsRequest +await client.Doc.Attachments.DownloadAsync( + new DownloadAttachmentsRequest { DocId = "docId", LayerName = "layerName", - Fields = new List() - { - new FormFieldRef( - new FormFieldRef.ObjectNumber(new FormFieldRefObjectNumber { ObjectNumber = 1 }) - ), - }, - Position = FieldPositionZero.Start, + FileKey = "fileKey", } ); ``` @@ -2020,7 +2050,7 @@ await client.Doc.Forms.ReorderCalculationsAsync(
-**request:** `DocFormsReorderCalculationsRequest` +**request:** `DownloadAttachmentsRequest`
@@ -2032,35 +2062,11 @@ await client.Doc.Forms.ReorderCalculationsAsync(
-
client.Doc.Forms.SetValueAsync(SetValueFormsRequest { ... }) -> WithRawResponseTask<DocFormsSetValue200Response> -
-
- -#### 🔌 Usage - -
-
- +
client.Doc.Attachments.ListAsync(ListAttachmentsRequest { ... }) -> WithRawResponseTask<AttachmentList>
-```csharp -await client.Doc.Forms.SetValueAsync( - new SetValueFormsRequest - { - DocId = "docId", - LayerName = "layerName", - FieldKey = "fieldKey", - Body = new Dictionary() { { "key", "value" } }, - } -); -``` -
-
-
-
- -#### ⚙️ Parameters +#### 📝 Description
@@ -2068,22 +2074,12 @@ await client.Doc.Forms.SetValueAsync(
-**request:** `SetValueFormsRequest` - +A file-attachment annotation's file is listed with the annotation; read its bytes with `doc.annotations.readFile`.
- -
-
-
- -
client.Doc.Forms.ResetAsync(DocFormsResetRequest { ... }) -> WithRawResponseTask<DocFormsReset200Response> -
-
- #### 🔌 Usage
@@ -2093,8 +2089,8 @@ await client.Doc.Forms.SetValueAsync(
```csharp -await client.Doc.Forms.ResetAsync( - new DocFormsResetRequest { DocId = "docId", LayerName = "layerName" } +await client.Doc.Attachments.ListAsync( + new ListAttachmentsRequest { DocId = "docId", LayerName = "layerName" } ); ```
@@ -2110,7 +2106,7 @@ await client.Doc.Forms.ResetAsync(
-**request:** `DocFormsResetRequest` +**request:** `ListAttachmentsRequest`
@@ -2122,7 +2118,8 @@ await client.Doc.Forms.ResetAsync(
-
client.Doc.Forms.DeleteWidgetAsync(DeleteWidgetFormsRequest { ... }) -> WithRawResponseTask<DocFormsDeleteWidget200Response> +## Doc Forms +
client.Doc.Forms.ListAsync(ListFormsRequest { ... }) -> WithRawResponseTask<DocFormsList200Response>
@@ -2135,15 +2132,7 @@ await client.Doc.Forms.ResetAsync(
```csharp -await client.Doc.Forms.DeleteWidgetAsync( - new DeleteWidgetFormsRequest - { - DocId = "docId", - LayerName = "layerName", - PageKey = "pageKey", - AnnotKey = "annotKey", - } -); +await client.Doc.Forms.ListAsync(new ListFormsRequest { DocId = "docId", LayerName = "layerName" }); ```
@@ -2158,7 +2147,7 @@ await client.Doc.Forms.DeleteWidgetAsync(
-**request:** `DeleteWidgetFormsRequest` +**request:** `ListFormsRequest`
@@ -2170,7 +2159,7 @@ await client.Doc.Forms.DeleteWidgetAsync(
-
client.Doc.Forms.UpdateWidgetAsync(DocFormsUpdateWidgetRequest { ... }) -> WithRawResponseTask<DocFormsUpdateWidget200Response> +
client.Doc.Forms.ReorderCalculationsAsync(DocFormsReorderCalculationsRequest { ... }) -> WithRawResponseTask<DocFormsReorderCalculations200Response>
@@ -2183,14 +2172,18 @@ await client.Doc.Forms.DeleteWidgetAsync(
```csharp -await client.Doc.Forms.UpdateWidgetAsync( - new DocFormsUpdateWidgetRequest +await client.Doc.Forms.ReorderCalculationsAsync( + new DocFormsReorderCalculationsRequest { DocId = "docId", LayerName = "layerName", - PageKey = "pageKey", - AnnotKey = "annotKey", - Patch = new WidgetPatch(), + Fields = new List() + { + new FormFieldRef( + new FormFieldRef.ObjectNumber(new FormFieldRefObjectNumber { ObjectNumber = 1 }) + ), + }, + Position = FieldPositionZero.Start, } ); ``` @@ -2207,7 +2200,7 @@ await client.Doc.Forms.UpdateWidgetAsync(
-**request:** `DocFormsUpdateWidgetRequest` +**request:** `DocFormsReorderCalculationsRequest`
@@ -2219,7 +2212,7 @@ await client.Doc.Forms.UpdateWidgetAsync(
-
client.Doc.Forms.ReorderWidgetsAsync(DocFormsReorderWidgetsRequest { ... }) -> WithRawResponseTask<DocFormsReorderWidgets200Response> +
client.Doc.Forms.SetValueAsync(SetValueFormsRequest { ... }) -> WithRawResponseTask<DocFormsSetValue200Response>
@@ -2232,25 +2225,13 @@ await client.Doc.Forms.UpdateWidgetAsync(
```csharp -await client.Doc.Forms.ReorderWidgetsAsync( - new DocFormsReorderWidgetsRequest +await client.Doc.Forms.SetValueAsync( + new SetValueFormsRequest { DocId = "docId", LayerName = "layerName", - PageKey = "pageKey", - Widgets = new List() - { - new AnnotationRef( - new AnnotationRef.ObjectNumber( - new AnnotationRefObjectNumber - { - Page = new PageRef { Kind = PageRefKind.ObjectNumber, ObjectNumber = 1 }, - ObjectNumber = 1, - } - ) - ), - }, - Position = AnnotationPositionZero.Start, + FieldKey = "fieldKey", + Body = new Dictionary() { { "key", "value" } }, } ); ``` @@ -2267,7 +2248,7 @@ await client.Doc.Forms.ReorderWidgetsAsync(
-**request:** `DocFormsReorderWidgetsRequest` +**request:** `SetValueFormsRequest`
@@ -2279,8 +2260,7 @@ await client.Doc.Forms.ReorderWidgetsAsync(
-## Doc Metadata -
client.Doc.Metadata.GetAsync(GetMetadataRequest { ... }) -> WithRawResponseTask<DocumentMetadata> +
client.Doc.Forms.ResetAsync(DocFormsResetRequest { ... }) -> WithRawResponseTask<DocFormsReset200Response>
@@ -2293,8 +2273,8 @@ await client.Doc.Forms.ReorderWidgetsAsync(
```csharp -await client.Doc.Metadata.GetAsync( - new GetMetadataRequest { DocId = "docId", LayerName = "layerName" } +await client.Doc.Forms.ResetAsync( + new DocFormsResetRequest { DocId = "docId", LayerName = "layerName" } ); ```
@@ -2310,7 +2290,7 @@ await client.Doc.Metadata.GetAsync(
-**request:** `GetMetadataRequest` +**request:** `DocFormsResetRequest`
@@ -2322,8 +2302,7 @@ await client.Doc.Metadata.GetAsync(
-## Doc Pages -
client.Doc.Pages.SetScaleAsync(DocPagesSetScaleRequest { ... }) -> WithRawResponseTask<DocPagesSetScale200Response> +
client.Doc.Forms.DeleteWidgetAsync(DeleteWidgetFormsRequest { ... }) -> WithRawResponseTask<DocFormsDeleteWidget200Response>
@@ -2336,12 +2315,13 @@ await client.Doc.Metadata.GetAsync(
```csharp -await client.Doc.Pages.SetScaleAsync( - new DocPagesSetScaleRequest +await client.Doc.Forms.DeleteWidgetAsync( + new DeleteWidgetFormsRequest { DocId = "docId", LayerName = "layerName", PageKey = "pageKey", + AnnotKey = "annotKey", } ); ``` @@ -2358,7 +2338,7 @@ await client.Doc.Pages.SetScaleAsync(
-**request:** `DocPagesSetScaleRequest` +**request:** `DeleteWidgetFormsRequest`
@@ -2370,7 +2350,7 @@ await client.Doc.Pages.SetScaleAsync(
-
client.Doc.Pages.ViewportsAsync(ViewportsPagesRequest { ... }) -> WithRawResponseTask<DocPagesViewports200Response> +
client.Doc.Forms.UpdateWidgetAsync(DocFormsUpdateWidgetRequest { ... }) -> WithRawResponseTask<DocFormsUpdateWidget200Response>
@@ -2383,12 +2363,14 @@ await client.Doc.Pages.SetScaleAsync(
```csharp -await client.Doc.Pages.ViewportsAsync( - new ViewportsPagesRequest +await client.Doc.Forms.UpdateWidgetAsync( + new DocFormsUpdateWidgetRequest { DocId = "docId", LayerName = "layerName", PageKey = "pageKey", + AnnotKey = "annotKey", + Patch = new WidgetPatch(), } ); ``` @@ -2405,7 +2387,7 @@ await client.Doc.Pages.ViewportsAsync(
-**request:** `ViewportsPagesRequest` +**request:** `DocFormsUpdateWidgetRequest`
@@ -2417,7 +2399,7 @@ await client.Doc.Pages.ViewportsAsync(
-
client.Doc.Pages.DeleteAsync(DeletePagesRequest { ... }) -> WithRawResponseTask<DocPagesDelete200Response> +
client.Doc.Forms.ReorderWidgetsAsync(DocFormsReorderWidgetsRequest { ... }) -> WithRawResponseTask<DocFormsReorderWidgets200Response>
@@ -2430,12 +2412,25 @@ await client.Doc.Pages.ViewportsAsync(
```csharp -await client.Doc.Pages.DeleteAsync( - new DeletePagesRequest +await client.Doc.Forms.ReorderWidgetsAsync( + new DocFormsReorderWidgetsRequest { DocId = "docId", LayerName = "layerName", - Body = new Dictionary() { { "key", "value" } }, + PageKey = "pageKey", + Widgets = new List() + { + new AnnotationRef( + new AnnotationRef.ObjectNumber( + new AnnotationRefObjectNumber + { + Page = new PageRef { Kind = PageRefKind.ObjectNumber, ObjectNumber = 1 }, + ObjectNumber = 1, + } + ) + ), + }, + Position = AnnotationPositionZero.Start, } ); ``` @@ -2452,7 +2447,7 @@ await client.Doc.Pages.DeleteAsync(
-**request:** `DeletePagesRequest` +**request:** `DocFormsReorderWidgetsRequest`
@@ -2464,24 +2459,11 @@ await client.Doc.Pages.DeleteAsync(
-
client.Doc.Pages.ExtractAsync(ExtractPagesRequest { ... }) -> WithRawResponseTask<Stream> -
-
- -#### 📝 Description - -
-
- +## Doc Metadata +
client.Doc.Metadata.GetAsync(GetMetadataRequest { ... }) -> WithRawResponseTask<DocumentMetadata>
-A read, not a mutation: the source document is untouched and no event is published. Body is `{"pages": PageRef[]}`; the response body is the new PDF. -
-
-
-
- #### 🔌 Usage
@@ -2491,19 +2473,8 @@ A read, not a mutation: the source document is untouched and no event is publish
```csharp -await client.Doc.Pages.ExtractAsync( - new ExtractPagesRequest - { - DocId = "docId", - LayerName = "layerName", - Body = new Dictionary() - { - { - "string", - new Dictionary() { { "key", "value" } } - }, - }, - } +await client.Doc.Metadata.GetAsync( + new GetMetadataRequest { DocId = "docId", LayerName = "layerName" } ); ```
@@ -2519,7 +2490,7 @@ await client.Doc.Pages.ExtractAsync(
-**request:** `ExtractPagesRequest` +**request:** `GetMetadataRequest`
@@ -2531,7 +2502,8 @@ await client.Doc.Pages.ExtractAsync(
-
client.Doc.Pages.FlattenAsync(FlattenPagesRequest { ... }) -> WithRawResponseTask<DocPagesFlatten200Response> +## Doc Outline +
client.Doc.Outline.GetAsync(GetOutlineRequest { ... }) -> WithRawResponseTask<DocumentOutline>
@@ -2544,13 +2516,8 @@ await client.Doc.Pages.ExtractAsync(
```csharp -await client.Doc.Pages.FlattenAsync( - new FlattenPagesRequest - { - DocId = "docId", - LayerName = "layerName", - Body = new Dictionary() { { "key", "value" } }, - } +await client.Doc.Outline.GetAsync( + new GetOutlineRequest { DocId = "docId", LayerName = "layerName" } ); ```
@@ -2566,7 +2533,7 @@ await client.Doc.Pages.FlattenAsync(
-**request:** `FlattenPagesRequest` +**request:** `GetOutlineRequest`
@@ -2578,24 +2545,11 @@ await client.Doc.Pages.FlattenAsync(
-
client.Doc.Pages.InsertAsync(InsertPagesRequest { ... }) -> WithRawResponseTask<DocPagesInsert200Response> -
-
- -#### 📝 Description - -
-
- +## Doc Pages +
client.Doc.Pages.SetScaleAsync(DocPagesSetScaleRequest { ... }) -> WithRawResponseTask<DocPagesSetScale200Response>
-Multipart: a JSON `body` part `{"position"?: PagePosition, "resources": {"source": ""}}` (position omitted → the end), and the standalone PDF whose pages are copied in as the part `resource:`. The inserted copies get fresh page object numbers, returned in insertion order. -
-
-
-
- #### 🔌 Usage
@@ -2605,8 +2559,13 @@ Multipart: a JSON `body` part `{"position"?: PagePosition, "resources": {"source
```csharp -await client.Doc.Pages.InsertAsync( - new InsertPagesRequest { DocId = "docId", LayerName = "layerName" } +await client.Doc.Pages.SetScaleAsync( + new DocPagesSetScaleRequest + { + DocId = "docId", + LayerName = "layerName", + PageKey = "pageKey", + } ); ```
@@ -2622,7 +2581,7 @@ await client.Doc.Pages.InsertAsync(
-**request:** `InsertPagesRequest` +**request:** `DocPagesSetScaleRequest`
@@ -2634,24 +2593,10 @@ await client.Doc.Pages.InsertAsync(
-
client.Doc.Pages.InsertBlankAsync(InsertBlankPagesRequest { ... }) -> WithRawResponseTask<DocPagesInsertBlank200Response> -
-
- -#### 📝 Description - -
-
- +
client.Doc.Pages.ViewportsAsync(ViewportsPagesRequest { ... }) -> WithRawResponseTask<DocPagesViewports200Response>
-Body is `{"size": {"width", "height"}, "count"?, "position"?}` — size in PDF points, count in [1, 100], `position` a `PagePosition` (omitted → the end). -
-
-
-
- #### 🔌 Usage
@@ -2661,12 +2606,12 @@ Body is `{"size": {"width", "height"}, "count"?, "position"?}` — size in PDF p
```csharp -await client.Doc.Pages.InsertBlankAsync( - new InsertBlankPagesRequest +await client.Doc.Pages.ViewportsAsync( + new ViewportsPagesRequest { DocId = "docId", LayerName = "layerName", - Body = new Dictionary() { { "key", "value" } }, + PageKey = "pageKey", } ); ``` @@ -2683,7 +2628,7 @@ await client.Doc.Pages.InsertBlankAsync(
-**request:** `InsertBlankPagesRequest` +**request:** `ViewportsPagesRequest`
@@ -2695,10 +2640,24 @@ await client.Doc.Pages.InsertBlankAsync(
-
client.Doc.Pages.SetNameAsync(SetNamePagesRequest { ... }) -> WithRawResponseTask<DocPagesSetName200Response> +
client.Doc.Pages.ExtractAsync(ExtractPagesRequest { ... }) -> WithRawResponseTask<Stream> +
+
+ +#### 📝 Description +
+
+
+ +A read, not a mutation: the source document is untouched and no event is published. Body is `{"pages": PageRef[], "flatten"?: {"usage"?: "display" | "print"}, "includeAnnotations"?: boolean, "includeFormFields"?: boolean}`; the response body is the new PDF. With `flatten` the copy is the pages as they draw for `usage` (`"print"`: a print copy): the annotations and form fields painted in, nothing interactive left, layers in their state for the usage. A flattened copy takes `doc.download` or `doc.download.flattened`, and paints only what the caller may read; `includeAnnotations` and `includeFormFields` choose what it paints, and are refused without `flatten`. +
+
+
+
+ #### 🔌 Usage
@@ -2708,12 +2667,18 @@ await client.Doc.Pages.InsertBlankAsync(
```csharp -await client.Doc.Pages.SetNameAsync( - new SetNamePagesRequest +await client.Doc.Pages.ExtractAsync( + new ExtractPagesRequest { DocId = "docId", LayerName = "layerName", - Body = new Dictionary() { { "key", "value" } }, + Body = new Dictionary() + { + { + "string", + new Dictionary() { { "key", "value" } } + }, + }, } ); ``` @@ -2730,7 +2695,7 @@ await client.Doc.Pages.SetNameAsync(
-**request:** `SetNamePagesRequest` +**request:** `ExtractPagesRequest`
@@ -2742,7 +2707,7 @@ await client.Doc.Pages.SetNameAsync(
-
client.Doc.Pages.RemoveNameAsync(RemoveNamePagesRequest { ... }) -> WithRawResponseTask<DocPagesRemoveName200Response> +
client.Doc.Pages.FlattenAsync(FlattenPagesRequest { ... }) -> WithRawResponseTask<DocPagesFlatten200Response>
@@ -2755,8 +2720,8 @@ await client.Doc.Pages.SetNameAsync(
```csharp -await client.Doc.Pages.RemoveNameAsync( - new RemoveNamePagesRequest +await client.Doc.Pages.FlattenAsync( + new FlattenPagesRequest { DocId = "docId", LayerName = "layerName", @@ -2777,7 +2742,7 @@ await client.Doc.Pages.RemoveNameAsync(
-**request:** `RemoveNamePagesRequest` +**request:** `FlattenPagesRequest`
@@ -2789,7 +2754,7 @@ await client.Doc.Pages.RemoveNameAsync(
-
client.Doc.Pages.ReorderAsync(DocPagesReorderRequest { ... }) -> WithRawResponseTask<DocPagesReorder200Response> +
client.Doc.Pages.SetNameAsync(SetNamePagesRequest { ... }) -> WithRawResponseTask<DocPagesSetName200Response>
@@ -2802,16 +2767,12 @@ await client.Doc.Pages.RemoveNameAsync(
```csharp -await client.Doc.Pages.ReorderAsync( - new DocPagesReorderRequest +await client.Doc.Pages.SetNameAsync( + new SetNamePagesRequest { DocId = "docId", LayerName = "layerName", - Pages = new List() - { - new PageRef { Kind = PageRefKind.ObjectNumber, ObjectNumber = 1 }, - }, - Position = PagePositionZero.Start, + Body = new Dictionary() { { "key", "value" } }, } ); ``` @@ -2828,7 +2789,7 @@ await client.Doc.Pages.ReorderAsync(
-**request:** `DocPagesReorderRequest` +**request:** `SetNamePagesRequest`
@@ -2840,7 +2801,7 @@ await client.Doc.Pages.ReorderAsync(
-
client.Doc.Pages.RotateAsync(RotatePagesRequest { ... }) -> WithRawResponseTask<DocPagesRotate200Response> +
client.Doc.Pages.RemoveNameAsync(RemoveNamePagesRequest { ... }) -> WithRawResponseTask<DocPagesRemoveName200Response>
@@ -2853,8 +2814,8 @@ await client.Doc.Pages.ReorderAsync(
```csharp -await client.Doc.Pages.RotateAsync( - new RotatePagesRequest +await client.Doc.Pages.RemoveNameAsync( + new RemoveNamePagesRequest { DocId = "docId", LayerName = "layerName", @@ -2875,7 +2836,7 @@ await client.Doc.Pages.RotateAsync(
-**request:** `RotatePagesRequest` +**request:** `RemoveNamePagesRequest`
diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/CreateTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/CreateTest.cs index f9553eca..9d057813 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/CreateTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/CreateTest.cs @@ -378,6 +378,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -654,6 +655,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/DeleteTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/DeleteTest.cs index d73680ad..9b49b021 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/DeleteTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/DeleteTest.cs @@ -33,6 +33,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -132,6 +133,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/FlattenTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/FlattenTest.cs index 2b4c5f74..7e8f8a15 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/FlattenTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/FlattenTest.cs @@ -70,6 +70,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -183,6 +184,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ReorderTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ReorderTest.cs index 4cc46430..ee705605 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ReorderTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/ReorderTest.cs @@ -76,6 +76,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -232,6 +233,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/UpdateTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/UpdateTest.cs index cc7d516e..fc6ac4db 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/UpdateTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/UpdateTest.cs @@ -382,6 +382,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -665,6 +666,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Attachments/ListTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Attachments/ListTest.cs new file mode 100644 index 00000000..a25d8597 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Attachments/ListTest.cs @@ -0,0 +1,113 @@ +using CloudPDF.Doc; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Doc.Attachments; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string mockResponse = """ + { + "attachments": [ + { + "ref": { + "kind": "key", + "key": "key" + }, + "name": "name", + "mimeType": "mimeType", + "description": "description", + "size": 1, + "checksum": "checksum", + "createdAt": "2024-01-15T09:30:00.000Z", + "modifiedAt": "2024-01-15T09:30:00.000Z", + "index": 1 + }, + { + "ref": { + "kind": "key", + "key": "key" + }, + "name": "name", + "mimeType": "mimeType", + "description": "description", + "size": 1, + "checksum": "checksum", + "createdAt": "2024-01-15T09:30:00.000Z", + "modifiedAt": "2024-01-15T09:30:00.000Z", + "index": 1 + } + ] + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/attachments") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Attachments.ListAsync( + new ListAttachmentsRequest { DocId = "docId", LayerName = "layerName" } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string mockResponse = """ + { + "attachments": [ + { + "ref": { + "kind": "key", + "key": "key" + }, + "name": "name", + "mimeType": "mimeType", + "description": "description", + "size": 1, + "checksum": "checksum", + "createdAt": "2024-01-15T09:30:00.000Z", + "modifiedAt": "2024-01-15T09:30:00.000Z", + "index": 1 + } + ] + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/attachments") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Attachments.ListAsync( + new ListAttachmentsRequest { DocId = "docId", LayerName = "layerName" } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/ChangesTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/ChangesTest.cs index 759ec9f2..581445c4 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/ChangesTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/ChangesTest.cs @@ -55,6 +55,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [] @@ -85,6 +86,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [] @@ -113,6 +115,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -172,6 +175,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [] @@ -202,6 +206,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [] @@ -230,6 +235,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/DeleteWidgetTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/DeleteWidgetTest.cs index c9f150bc..236c4be8 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/DeleteWidgetTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/DeleteWidgetTest.cs @@ -196,6 +196,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -429,6 +430,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderCalculationsTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderCalculationsTest.cs index 576fd9e7..08cfd451 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderCalculationsTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderCalculationsTest.cs @@ -60,6 +60,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -245,6 +246,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderWidgetsTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderWidgetsTest.cs index f4db6781..9d22e2ba 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderWidgetsTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ReorderWidgetsTest.cs @@ -80,6 +80,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -294,6 +295,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ResetTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ResetTest.cs index b7560c6f..3ffbc26b 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ResetTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/ResetTest.cs @@ -989,6 +989,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -1279,6 +1280,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/SetValueTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/SetValueTest.cs index 6cabaeab..7042156c 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/SetValueTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/SetValueTest.cs @@ -840,6 +840,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -1167,6 +1168,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/UpdateWidgetTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/UpdateWidgetTest.cs index c79531d9..2cb21577 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/UpdateWidgetTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Forms/UpdateWidgetTest.cs @@ -367,6 +367,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -749,6 +750,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/ManifestTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/ManifestTest.cs index c4a0ede4..3b5ecd88 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/ManifestTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/ManifestTest.cs @@ -21,6 +21,7 @@ public async Task MockServerTest_1() "attachmentsVersion": 1, "annotationsVersion": 1, "formsVersion": 1, + "outlineVersion": 1, "auditHead": 1, "baseSha": "baseSha", "layerVersion": 1, @@ -33,7 +34,8 @@ public async Task MockServerTest_1() "layout": "base", "attachments": "base", "metadata": "base", - "actions": "base" + "actions": "base", + "outline": "base" }, "protection": { "enforced": "none", @@ -129,6 +131,7 @@ public async Task MockServerTest_2() "attachmentsVersion": 1, "annotationsVersion": 1, "formsVersion": 1, + "outlineVersion": 1, "auditHead": 1, "baseSha": "baseSha", "layerVersion": 1, @@ -141,7 +144,8 @@ public async Task MockServerTest_2() "layout": "base", "attachments": "base", "metadata": "base", - "actions": "base" + "actions": "base", + "outline": "base" }, "protection": { "enforced": "none", diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Outline/GetTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Outline/GetTest.cs new file mode 100644 index 00000000..df070836 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Outline/GetTest.cs @@ -0,0 +1,203 @@ +using CloudPDF.Doc; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Doc.Outline; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class GetTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string mockResponse = """ + { + "items": [ + { + "ref": { + "kind": "objectNumber", + "objectNumber": 1 + }, + "parent": { + "kind": "objectNumber", + "objectNumber": 1 + }, + "title": "title", + "target": { + "kind": "goto", + "destination": { + "kind": "xyz", + "page": { + "kind": "objectNumber", + "objectNumber": 1 + }, + "x": 1.1, + "y": 1.1, + "zoom": 1.1 + } + }, + "action": { + "root": { + "type": "javascript", + "subtype": "subtype", + "next": [ + { + "key": "value" + }, + { + "key": "value" + } + ], + "script": "script" + }, + "incomplete": true, + "warningFlags": 1, + "warnings": [ + "cycle-dropped", + "cycle-dropped" + ] + }, + "open": true, + "color": "color", + "bold": true, + "italic": true + }, + { + "ref": { + "kind": "objectNumber", + "objectNumber": 1 + }, + "parent": { + "kind": "objectNumber", + "objectNumber": 1 + }, + "title": "title", + "target": { + "kind": "goto", + "destination": { + "kind": "xyz", + "page": { + "kind": "objectNumber", + "objectNumber": 1 + }, + "x": 1.1, + "y": 1.1, + "zoom": 1.1 + } + }, + "action": { + "root": { + "type": "javascript", + "subtype": "subtype", + "next": [ + { + "key": "value" + }, + { + "key": "value" + } + ], + "script": "script" + }, + "incomplete": true, + "warningFlags": 1, + "warnings": [ + "cycle-dropped", + "cycle-dropped" + ] + }, + "open": true, + "color": "color", + "bold": true, + "italic": true + } + ], + "incomplete": true + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/outline") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Outline.GetAsync( + new GetOutlineRequest { DocId = "docId", LayerName = "layerName" } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string mockResponse = """ + { + "items": [ + { + "ref": { + "kind": "objectNumber", + "objectNumber": 1 + }, + "parent": { + "kind": "objectNumber", + "objectNumber": 1 + }, + "title": "title", + "target": { + "kind": "goto", + "destination": { + "kind": "xyz", + "page": { + "kind": "objectNumber", + "objectNumber": 1 + } + } + }, + "action": { + "incomplete": true, + "warningFlags": 1, + "warnings": [ + "cycle-dropped" + ] + }, + "open": true, + "color": "color", + "bold": true, + "italic": true + } + ], + "incomplete": true + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/outline") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Outline.GetAsync( + new GetOutlineRequest { DocId = "docId", LayerName = "layerName" } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/DeleteTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/DeleteTest.cs deleted file mode 100644 index d1d0462c..00000000 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/DeleteTest.cs +++ /dev/null @@ -1,445 +0,0 @@ -using CloudPDF.Doc; -using CloudPDF.Test.Unit.MockServer; -using CloudPDF.Test.Utils; -using NUnit.Framework; - -namespace CloudPDF.Test.Unit.MockServer.Doc.Pages; - -[TestFixture] -[Parallelizable(ParallelScope.Self)] -public class DeleteTest : BaseMockServerTest -{ - [NUnit.Framework.Test] - public async Task MockServerTest_1() - { - const string requestJson = """ - { - "string": { - "key": "value" - } - } - """; - - const string mockResponse = """ - { - "layout": { - "pageCount": 1, - "pages": [ - { - "index": 1, - "ref": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "label": "label", - "size": { - "width": 1.1, - "height": 1.1 - }, - "rotation": 1.1, - "userUnit": 1.1, - "tabOrder": "rows", - "boxes": { - "media": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "crop": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "bleed": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "trim": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "art": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - } - }, - "pdfCropBox": { - "left": 1.1, - "bottom": 1.1, - "right": 1.1, - "top": 1.1 - }, - "actions": { - "open": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - }, - "close": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - } - } - }, - { - "index": 1, - "ref": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "label": "label", - "size": { - "width": 1.1, - "height": 1.1 - }, - "rotation": 1.1, - "userUnit": 1.1, - "tabOrder": "rows", - "boxes": { - "media": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "crop": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "bleed": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "trim": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "art": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - } - }, - "pdfCropBox": { - "left": 1.1, - "bottom": 1.1, - "right": 1.1, - "top": 1.1 - }, - "actions": { - "open": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - }, - "close": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - } - } - } - ], - "namedPages": [ - { - "name": "name", - "target": { - "kind": "page", - "page": { - "kind": "objectNumber", - "objectNumber": 1 - } - } - }, - { - "name": "name", - "target": { - "kind": "page", - "page": { - "kind": "objectNumber", - "objectNumber": 1 - } - } - } - ] - }, - "meta": { - "affectedPages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - }, - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "cacheDelta": { - "previousDocVersion": 1, - "docVersion": 1, - "annotationsVersion": 1, - "formsVersion": 1, - "layoutVersion": 1, - "metadataVersion": 1, - "attachmentsVersion": 1, - "layerVersion": 1, - "working": true, - "pages": [ - { - "page": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "cache": { - "contentVersion": 1, - "annotationVersion": 1, - "widgetVersion": 1 - } - }, - { - "page": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "cache": { - "contentVersion": 1, - "annotationVersion": 1, - "widgetVersion": 1 - } - } - ] - }, - "opId": "opId", - "undoable": true - } - } - """; - - Server - .Given( - WireMock - .RequestBuilders.Request.Create() - .WithPath("/v1/docs/docId/layers/layerName/pages/delete") - .WithHeader("Content-Type", "application/json") - .UsingPost() - .WithBodyAsJson(requestJson) - ) - .RespondWith( - WireMock - .ResponseBuilders.Response.Create() - .WithStatusCode(200) - .WithBody(mockResponse) - ); - - var response = await Client.Doc.Pages.DeleteAsync( - new DeletePagesRequest - { - DocId = "docId", - LayerName = "layerName", - Body = new Dictionary() - { - { - "string", - new Dictionary() { { "key", "value" } } - }, - }, - } - ); - JsonAssert.AreEqual(response, mockResponse); - } - - [NUnit.Framework.Test] - public async Task MockServerTest_2() - { - const string requestJson = """ - { - "key": "value" - } - """; - - const string mockResponse = """ - { - "layout": { - "pageCount": 1, - "pages": [ - { - "index": 1, - "ref": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "size": { - "width": 1.1, - "height": 1.1 - }, - "rotation": 1.1, - "userUnit": 1.1, - "boxes": { - "media": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "crop": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "bleed": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "trim": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "art": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - } - }, - "pdfCropBox": { - "left": 1.1, - "bottom": 1.1, - "right": 1.1, - "top": 1.1 - } - } - ], - "namedPages": [ - { - "name": "name", - "target": { - "kind": "page", - "page": { - "kind": "objectNumber", - "objectNumber": 1 - } - } - } - ] - }, - "meta": { - "affectedPages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "cacheDelta": { - "previousDocVersion": 1, - "docVersion": 1, - "annotationsVersion": 1, - "formsVersion": 1, - "layoutVersion": 1, - "metadataVersion": 1, - "attachmentsVersion": 1, - "layerVersion": 1, - "working": true, - "pages": [ - { - "page": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "cache": { - "contentVersion": 1, - "annotationVersion": 1, - "widgetVersion": 1 - } - } - ] - }, - "opId": "opId", - "undoable": true - } - } - """; - - Server - .Given( - WireMock - .RequestBuilders.Request.Create() - .WithPath("/v1/docs/docId/layers/layerName/pages/delete") - .WithHeader("Content-Type", "application/json") - .UsingPost() - .WithBodyAsJson(requestJson) - ) - .RespondWith( - WireMock - .ResponseBuilders.Response.Create() - .WithStatusCode(200) - .WithBody(mockResponse) - ); - - var response = await Client.Doc.Pages.DeleteAsync( - new DeletePagesRequest - { - DocId = "docId", - LayerName = "layerName", - Body = new Dictionary() { { "key", "value" } }, - } - ); - JsonAssert.AreEqual(response, mockResponse); - } -} diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/FlattenTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/FlattenTest.cs index e2573242..d0be61b0 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/FlattenTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/FlattenTest.cs @@ -68,6 +68,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -176,6 +177,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/InsertBlankTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/InsertBlankTest.cs deleted file mode 100644 index 4b503aae..00000000 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/InsertBlankTest.cs +++ /dev/null @@ -1,461 +0,0 @@ -using CloudPDF.Doc; -using CloudPDF.Test.Unit.MockServer; -using CloudPDF.Test.Utils; -using NUnit.Framework; - -namespace CloudPDF.Test.Unit.MockServer.Doc.Pages; - -[TestFixture] -[Parallelizable(ParallelScope.Self)] -public class InsertBlankTest : BaseMockServerTest -{ - [NUnit.Framework.Test] - public async Task MockServerTest_1() - { - const string requestJson = """ - { - "string": { - "key": "value" - } - } - """; - - const string mockResponse = """ - { - "insertedPages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - }, - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "layout": { - "pageCount": 1, - "pages": [ - { - "index": 1, - "ref": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "label": "label", - "size": { - "width": 1.1, - "height": 1.1 - }, - "rotation": 1.1, - "userUnit": 1.1, - "tabOrder": "rows", - "boxes": { - "media": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "crop": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "bleed": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "trim": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "art": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - } - }, - "pdfCropBox": { - "left": 1.1, - "bottom": 1.1, - "right": 1.1, - "top": 1.1 - }, - "actions": { - "open": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - }, - "close": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - } - } - }, - { - "index": 1, - "ref": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "label": "label", - "size": { - "width": 1.1, - "height": 1.1 - }, - "rotation": 1.1, - "userUnit": 1.1, - "tabOrder": "rows", - "boxes": { - "media": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "crop": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "bleed": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "trim": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "art": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - } - }, - "pdfCropBox": { - "left": 1.1, - "bottom": 1.1, - "right": 1.1, - "top": 1.1 - }, - "actions": { - "open": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - }, - "close": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - } - } - } - ], - "namedPages": [ - { - "name": "name", - "target": { - "kind": "page", - "page": { - "kind": "objectNumber", - "objectNumber": 1 - } - } - }, - { - "name": "name", - "target": { - "kind": "page", - "page": { - "kind": "objectNumber", - "objectNumber": 1 - } - } - } - ] - }, - "meta": { - "affectedPages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - }, - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "cacheDelta": { - "previousDocVersion": 1, - "docVersion": 1, - "annotationsVersion": 1, - "formsVersion": 1, - "layoutVersion": 1, - "metadataVersion": 1, - "attachmentsVersion": 1, - "layerVersion": 1, - "working": true, - "pages": [ - { - "page": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "cache": { - "contentVersion": 1, - "annotationVersion": 1, - "widgetVersion": 1 - } - }, - { - "page": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "cache": { - "contentVersion": 1, - "annotationVersion": 1, - "widgetVersion": 1 - } - } - ] - }, - "opId": "opId", - "undoable": true - } - } - """; - - Server - .Given( - WireMock - .RequestBuilders.Request.Create() - .WithPath("/v1/docs/docId/layers/layerName/pages/insert-blank") - .WithHeader("Content-Type", "application/json") - .UsingPost() - .WithBodyAsJson(requestJson) - ) - .RespondWith( - WireMock - .ResponseBuilders.Response.Create() - .WithStatusCode(200) - .WithBody(mockResponse) - ); - - var response = await Client.Doc.Pages.InsertBlankAsync( - new InsertBlankPagesRequest - { - DocId = "docId", - LayerName = "layerName", - Body = new Dictionary() - { - { - "string", - new Dictionary() { { "key", "value" } } - }, - }, - } - ); - JsonAssert.AreEqual(response, mockResponse); - } - - [NUnit.Framework.Test] - public async Task MockServerTest_2() - { - const string requestJson = """ - { - "key": "value" - } - """; - - const string mockResponse = """ - { - "insertedPages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "layout": { - "pageCount": 1, - "pages": [ - { - "index": 1, - "ref": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "size": { - "width": 1.1, - "height": 1.1 - }, - "rotation": 1.1, - "userUnit": 1.1, - "boxes": { - "media": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "crop": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "bleed": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "trim": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "art": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - } - }, - "pdfCropBox": { - "left": 1.1, - "bottom": 1.1, - "right": 1.1, - "top": 1.1 - } - } - ], - "namedPages": [ - { - "name": "name", - "target": { - "kind": "page", - "page": { - "kind": "objectNumber", - "objectNumber": 1 - } - } - } - ] - }, - "meta": { - "affectedPages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "cacheDelta": { - "previousDocVersion": 1, - "docVersion": 1, - "annotationsVersion": 1, - "formsVersion": 1, - "layoutVersion": 1, - "metadataVersion": 1, - "attachmentsVersion": 1, - "layerVersion": 1, - "working": true, - "pages": [ - { - "page": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "cache": { - "contentVersion": 1, - "annotationVersion": 1, - "widgetVersion": 1 - } - } - ] - }, - "opId": "opId", - "undoable": true - } - } - """; - - Server - .Given( - WireMock - .RequestBuilders.Request.Create() - .WithPath("/v1/docs/docId/layers/layerName/pages/insert-blank") - .WithHeader("Content-Type", "application/json") - .UsingPost() - .WithBodyAsJson(requestJson) - ) - .RespondWith( - WireMock - .ResponseBuilders.Response.Create() - .WithStatusCode(200) - .WithBody(mockResponse) - ); - - var response = await Client.Doc.Pages.InsertBlankAsync( - new InsertBlankPagesRequest - { - DocId = "docId", - LayerName = "layerName", - Body = new Dictionary() { { "key", "value" } }, - } - ); - JsonAssert.AreEqual(response, mockResponse); - } -} diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/RemoveNameTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/RemoveNameTest.cs index 86fbaa1b..bf59a2ed 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/RemoveNameTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/RemoveNameTest.cs @@ -234,6 +234,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -394,6 +395,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/ReorderTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/ReorderTest.cs deleted file mode 100644 index 6f70a74b..00000000 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/ReorderTest.cs +++ /dev/null @@ -1,479 +0,0 @@ -using CloudPDF; -using CloudPDF.Doc; -using CloudPDF.Test.Unit.MockServer; -using CloudPDF.Test.Utils; -using NUnit.Framework; - -namespace CloudPDF.Test.Unit.MockServer.Doc.Pages; - -[TestFixture] -[Parallelizable(ParallelScope.Self)] -public class ReorderTest : BaseMockServerTest -{ - [NUnit.Framework.Test] - public async Task MockServerTest_1() - { - const string requestJson = """ - { - "pages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - }, - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "position": "start" - } - """; - - const string mockResponse = """ - { - "pages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - }, - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "layout": { - "pageCount": 1, - "pages": [ - { - "index": 1, - "ref": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "label": "label", - "size": { - "width": 1.1, - "height": 1.1 - }, - "rotation": 1.1, - "userUnit": 1.1, - "tabOrder": "rows", - "boxes": { - "media": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "crop": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "bleed": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "trim": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "art": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - } - }, - "pdfCropBox": { - "left": 1.1, - "bottom": 1.1, - "right": 1.1, - "top": 1.1 - }, - "actions": { - "open": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - }, - "close": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - } - } - }, - { - "index": 1, - "ref": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "label": "label", - "size": { - "width": 1.1, - "height": 1.1 - }, - "rotation": 1.1, - "userUnit": 1.1, - "tabOrder": "rows", - "boxes": { - "media": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "crop": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "bleed": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "trim": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "art": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - } - }, - "pdfCropBox": { - "left": 1.1, - "bottom": 1.1, - "right": 1.1, - "top": 1.1 - }, - "actions": { - "open": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - }, - "close": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - } - } - } - ], - "namedPages": [ - { - "name": "name", - "target": { - "kind": "page", - "page": { - "kind": "objectNumber", - "objectNumber": 1 - } - } - }, - { - "name": "name", - "target": { - "kind": "page", - "page": { - "kind": "objectNumber", - "objectNumber": 1 - } - } - } - ] - }, - "meta": { - "affectedPages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - }, - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "cacheDelta": { - "previousDocVersion": 1, - "docVersion": 1, - "annotationsVersion": 1, - "formsVersion": 1, - "layoutVersion": 1, - "metadataVersion": 1, - "attachmentsVersion": 1, - "layerVersion": 1, - "working": true, - "pages": [ - { - "page": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "cache": { - "contentVersion": 1, - "annotationVersion": 1, - "widgetVersion": 1 - } - }, - { - "page": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "cache": { - "contentVersion": 1, - "annotationVersion": 1, - "widgetVersion": 1 - } - } - ] - }, - "opId": "opId", - "undoable": true - } - } - """; - - Server - .Given( - WireMock - .RequestBuilders.Request.Create() - .WithPath("/v1/docs/docId/layers/layerName/pages/reorder") - .WithHeader("Content-Type", "application/json") - .UsingPost() - .WithBodyAsJson(requestJson) - ) - .RespondWith( - WireMock - .ResponseBuilders.Response.Create() - .WithStatusCode(200) - .WithBody(mockResponse) - ); - - var response = await Client.Doc.Pages.ReorderAsync( - new DocPagesReorderRequest - { - DocId = "docId", - LayerName = "layerName", - Pages = new List() - { - new PageRef { Kind = PageRefKind.ObjectNumber, ObjectNumber = 1 }, - new PageRef { Kind = PageRefKind.ObjectNumber, ObjectNumber = 1 }, - }, - Position = PagePositionZero.Start, - } - ); - JsonAssert.AreEqual(response, mockResponse); - } - - [NUnit.Framework.Test] - public async Task MockServerTest_2() - { - const string requestJson = """ - { - "pages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "position": "start" - } - """; - - const string mockResponse = """ - { - "pages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "layout": { - "pageCount": 1, - "pages": [ - { - "index": 1, - "ref": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "size": { - "width": 1.1, - "height": 1.1 - }, - "rotation": 1.1, - "userUnit": 1.1, - "boxes": { - "media": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "crop": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "bleed": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "trim": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "art": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - } - }, - "pdfCropBox": { - "left": 1.1, - "bottom": 1.1, - "right": 1.1, - "top": 1.1 - } - } - ], - "namedPages": [ - { - "name": "name", - "target": { - "kind": "page", - "page": { - "kind": "objectNumber", - "objectNumber": 1 - } - } - } - ] - }, - "meta": { - "affectedPages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "cacheDelta": { - "previousDocVersion": 1, - "docVersion": 1, - "annotationsVersion": 1, - "formsVersion": 1, - "layoutVersion": 1, - "metadataVersion": 1, - "attachmentsVersion": 1, - "layerVersion": 1, - "working": true, - "pages": [ - { - "page": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "cache": { - "contentVersion": 1, - "annotationVersion": 1, - "widgetVersion": 1 - } - } - ] - }, - "opId": "opId", - "undoable": true - } - } - """; - - Server - .Given( - WireMock - .RequestBuilders.Request.Create() - .WithPath("/v1/docs/docId/layers/layerName/pages/reorder") - .WithHeader("Content-Type", "application/json") - .UsingPost() - .WithBodyAsJson(requestJson) - ) - .RespondWith( - WireMock - .ResponseBuilders.Response.Create() - .WithStatusCode(200) - .WithBody(mockResponse) - ); - - var response = await Client.Doc.Pages.ReorderAsync( - new DocPagesReorderRequest - { - DocId = "docId", - LayerName = "layerName", - Pages = new List() - { - new PageRef { Kind = PageRefKind.ObjectNumber, ObjectNumber = 1 }, - }, - Position = PagePositionZero.Start, - } - ); - JsonAssert.AreEqual(response, mockResponse); - } -} diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/RotateTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/RotateTest.cs deleted file mode 100644 index 32135c03..00000000 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/RotateTest.cs +++ /dev/null @@ -1,445 +0,0 @@ -using CloudPDF.Doc; -using CloudPDF.Test.Unit.MockServer; -using CloudPDF.Test.Utils; -using NUnit.Framework; - -namespace CloudPDF.Test.Unit.MockServer.Doc.Pages; - -[TestFixture] -[Parallelizable(ParallelScope.Self)] -public class RotateTest : BaseMockServerTest -{ - [NUnit.Framework.Test] - public async Task MockServerTest_1() - { - const string requestJson = """ - { - "string": { - "key": "value" - } - } - """; - - const string mockResponse = """ - { - "layout": { - "pageCount": 1, - "pages": [ - { - "index": 1, - "ref": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "label": "label", - "size": { - "width": 1.1, - "height": 1.1 - }, - "rotation": 1.1, - "userUnit": 1.1, - "tabOrder": "rows", - "boxes": { - "media": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "crop": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "bleed": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "trim": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "art": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - } - }, - "pdfCropBox": { - "left": 1.1, - "bottom": 1.1, - "right": 1.1, - "top": 1.1 - }, - "actions": { - "open": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - }, - "close": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - } - } - }, - { - "index": 1, - "ref": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "label": "label", - "size": { - "width": 1.1, - "height": 1.1 - }, - "rotation": 1.1, - "userUnit": 1.1, - "tabOrder": "rows", - "boxes": { - "media": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "crop": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "bleed": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "trim": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "art": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - } - }, - "pdfCropBox": { - "left": 1.1, - "bottom": 1.1, - "right": 1.1, - "top": 1.1 - }, - "actions": { - "open": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - }, - "close": { - "root": { - "type": "javascript", - "subtype": "subtype", - "next": [], - "script": "script" - }, - "incomplete": true, - "warningFlags": 1, - "warnings": [ - "cycle-dropped", - "cycle-dropped" - ] - } - } - } - ], - "namedPages": [ - { - "name": "name", - "target": { - "kind": "page", - "page": { - "kind": "objectNumber", - "objectNumber": 1 - } - } - }, - { - "name": "name", - "target": { - "kind": "page", - "page": { - "kind": "objectNumber", - "objectNumber": 1 - } - } - } - ] - }, - "meta": { - "affectedPages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - }, - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "cacheDelta": { - "previousDocVersion": 1, - "docVersion": 1, - "annotationsVersion": 1, - "formsVersion": 1, - "layoutVersion": 1, - "metadataVersion": 1, - "attachmentsVersion": 1, - "layerVersion": 1, - "working": true, - "pages": [ - { - "page": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "cache": { - "contentVersion": 1, - "annotationVersion": 1, - "widgetVersion": 1 - } - }, - { - "page": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "cache": { - "contentVersion": 1, - "annotationVersion": 1, - "widgetVersion": 1 - } - } - ] - }, - "opId": "opId", - "undoable": true - } - } - """; - - Server - .Given( - WireMock - .RequestBuilders.Request.Create() - .WithPath("/v1/docs/docId/layers/layerName/pages/rotate") - .WithHeader("Content-Type", "application/json") - .UsingPost() - .WithBodyAsJson(requestJson) - ) - .RespondWith( - WireMock - .ResponseBuilders.Response.Create() - .WithStatusCode(200) - .WithBody(mockResponse) - ); - - var response = await Client.Doc.Pages.RotateAsync( - new RotatePagesRequest - { - DocId = "docId", - LayerName = "layerName", - Body = new Dictionary() - { - { - "string", - new Dictionary() { { "key", "value" } } - }, - }, - } - ); - JsonAssert.AreEqual(response, mockResponse); - } - - [NUnit.Framework.Test] - public async Task MockServerTest_2() - { - const string requestJson = """ - { - "key": "value" - } - """; - - const string mockResponse = """ - { - "layout": { - "pageCount": 1, - "pages": [ - { - "index": 1, - "ref": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "size": { - "width": 1.1, - "height": 1.1 - }, - "rotation": 1.1, - "userUnit": 1.1, - "boxes": { - "media": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "crop": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "bleed": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "trim": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - }, - "art": { - "x": 1.1, - "y": 1.1, - "width": 1.1, - "height": 1.1 - } - }, - "pdfCropBox": { - "left": 1.1, - "bottom": 1.1, - "right": 1.1, - "top": 1.1 - } - } - ], - "namedPages": [ - { - "name": "name", - "target": { - "kind": "page", - "page": { - "kind": "objectNumber", - "objectNumber": 1 - } - } - } - ] - }, - "meta": { - "affectedPages": [ - { - "kind": "objectNumber", - "objectNumber": 1 - } - ], - "cacheDelta": { - "previousDocVersion": 1, - "docVersion": 1, - "annotationsVersion": 1, - "formsVersion": 1, - "layoutVersion": 1, - "metadataVersion": 1, - "attachmentsVersion": 1, - "layerVersion": 1, - "working": true, - "pages": [ - { - "page": { - "kind": "objectNumber", - "objectNumber": 1 - }, - "cache": { - "contentVersion": 1, - "annotationVersion": 1, - "widgetVersion": 1 - } - } - ] - }, - "opId": "opId", - "undoable": true - } - } - """; - - Server - .Given( - WireMock - .RequestBuilders.Request.Create() - .WithPath("/v1/docs/docId/layers/layerName/pages/rotate") - .WithHeader("Content-Type", "application/json") - .UsingPost() - .WithBodyAsJson(requestJson) - ) - .RespondWith( - WireMock - .ResponseBuilders.Response.Create() - .WithStatusCode(200) - .WithBody(mockResponse) - ); - - var response = await Client.Doc.Pages.RotateAsync( - new RotatePagesRequest - { - DocId = "docId", - LayerName = "layerName", - Body = new Dictionary() { { "key", "value" } }, - } - ); - JsonAssert.AreEqual(response, mockResponse); - } -} diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetNameTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetNameTest.cs index f880a3f4..1a0faf43 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetNameTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetNameTest.cs @@ -234,6 +234,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -394,6 +395,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetScaleTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetScaleTest.cs index 5c1264b4..06551368 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetScaleTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetScaleTest.cs @@ -41,6 +41,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -130,6 +131,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Redactions/ApplyTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Redactions/ApplyTest.cs index e3c6e1c8..de9c2312 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Redactions/ApplyTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Redactions/ApplyTest.cs @@ -86,6 +86,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -200,6 +201,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Signatures/CompleteTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Signatures/CompleteTest.cs index 543202fb..b0b42370 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/Signatures/CompleteTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Signatures/CompleteTest.cs @@ -170,6 +170,7 @@ public async Task MockServerTest_1() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ @@ -365,6 +366,7 @@ public async Task MockServerTest_2() "layoutVersion": 1, "metadataVersion": 1, "attachmentsVersion": 1, + "outlineVersion": 1, "layerVersion": 1, "working": true, "pages": [ diff --git a/src/CloudPDF/CloudPDF.csproj b/src/CloudPDF/CloudPDF.csproj index 938ecc1f..0631730a 100644 --- a/src/CloudPDF/CloudPDF.csproj +++ b/src/CloudPDF/CloudPDF.csproj @@ -11,7 +11,7 @@ enable 12 enable - 3.0.0-next.15 + 3.0.0-next.16 3.0.0.0 3.0.0.0 README.md diff --git a/src/CloudPDF/Core/Public/Version.cs b/src/CloudPDF/Core/Public/Version.cs index 7a05053c..d8d2bd10 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.15"; + public const string Current = "3.0.0-next.16"; } diff --git a/src/CloudPDF/Doc/Annotations/AnnotationsClient.cs b/src/CloudPDF/Doc/Annotations/AnnotationsClient.cs index 254bc531..5e974e21 100644 --- a/src/CloudPDF/Doc/Annotations/AnnotationsClient.cs +++ b/src/CloudPDF/Doc/Annotations/AnnotationsClient.cs @@ -709,6 +709,119 @@ private async Task> UpdateAsync } } + private async Task> ReadFileAsyncCore( + ReadFileAnnotationsRequest 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}/annotations/pages/{2}/items/{3}/resources/file", + ValueConvert.ToPathParameterString(request.DocId), + ValueConvert.ToPathParameterString(request.LayerName), + ValueConvert.ToPathParameterString(request.PageKey), + ValueConvert.ToPathParameterString(request.AnnotKey) + ), + 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 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), + } + ); + case 413: + throw new ContentTooLargeError( + 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> ExportAppearanceAsyncCore( ExportAppearanceAnnotationsRequest request, RequestOptions? options = null, @@ -1195,6 +1308,31 @@ public WithRawResponseTask UpdateAsync( ); } + /// + /// A file that decodes past the server's limit is refused (PayloadTooLarge). + /// + /// + /// await client.Doc.Annotations.ReadFileAsync( + /// new ReadFileAnnotationsRequest + /// { + /// DocId = "docId", + /// LayerName = "layerName", + /// PageKey = "pageKey", + /// AnnotKey = "annotKey", + /// } + /// ); + /// + public WithRawResponseTask ReadFileAsync( + ReadFileAnnotationsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ReadFileAsyncCore(request, options, cancellationToken) + ); + } + /// /// await client.Doc.Annotations.ExportAppearanceAsync( /// new ExportAppearanceAnnotationsRequest diff --git a/src/CloudPDF/Doc/Annotations/IAnnotationsClient.cs b/src/CloudPDF/Doc/Annotations/IAnnotationsClient.cs index 85155785..f87535e1 100644 --- a/src/CloudPDF/Doc/Annotations/IAnnotationsClient.cs +++ b/src/CloudPDF/Doc/Annotations/IAnnotationsClient.cs @@ -46,6 +46,15 @@ WithRawResponseTask UpdateAsync( CancellationToken cancellationToken = default ); + /// + /// A file that decodes past the server's limit is refused (PayloadTooLarge). + /// + WithRawResponseTask ReadFileAsync( + ReadFileAnnotationsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + WithRawResponseTask ExportAppearanceAsync( ExportAppearanceAnnotationsRequest request, RequestOptions? options = null, diff --git a/src/CloudPDF/Doc/Pages/Requests/InsertBlankPagesRequest.cs b/src/CloudPDF/Doc/Annotations/Requests/ReadFileAnnotationsRequest.cs similarity index 55% rename from src/CloudPDF/Doc/Pages/Requests/InsertBlankPagesRequest.cs rename to src/CloudPDF/Doc/Annotations/Requests/ReadFileAnnotationsRequest.cs index a9075f2b..56b176f9 100644 --- a/src/CloudPDF/Doc/Pages/Requests/InsertBlankPagesRequest.cs +++ b/src/CloudPDF/Doc/Annotations/Requests/ReadFileAnnotationsRequest.cs @@ -4,7 +4,7 @@ namespace CloudPDF.Doc; [Serializable] -public record InsertBlankPagesRequest +public record ReadFileAnnotationsRequest { [JsonIgnore] public required string DocId { get; set; } @@ -13,19 +13,22 @@ public record InsertBlankPagesRequest 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. + /// The page's address, `obj:N`: the page's indirect object number, the durable identity every `PageLayout.ref` carries. Mirrors `annotKey` and `fieldKey`. /// [JsonIgnore] - public string? DocumentPassword { get; set; } + public required string PageKey { get; set; } /// - /// Names the change: 1 to 255 printable ASCII characters. A retry under the same key on the same layer answers with what the first request committed, and changes nothing. + /// The annotation's address on the page: `obj:N`, its indirect object number, or `base:N` for an annotation the uploaded file stored inline (without an object number of its own), the position it was born at in the page's /Annots. The name the annotation's `ref` carries for life. /// [JsonIgnore] - public string? IdempotencyKey { get; set; } + public required string AnnotKey { 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 Dictionary Body { get; set; } = new Dictionary(); + public string? DocumentPassword { get; set; } /// public override string ToString() diff --git a/src/CloudPDF/Doc/Attachments/AttachmentsClient.cs b/src/CloudPDF/Doc/Attachments/AttachmentsClient.cs new file mode 100644 index 00000000..38226fbb --- /dev/null +++ b/src/CloudPDF/Doc/Attachments/AttachmentsClient.cs @@ -0,0 +1,278 @@ +using CloudPDF; +using CloudPDF.Core; +using global::System.Text.Json; + +namespace CloudPDF.Doc; + +public partial class AttachmentsClient : IAttachmentsClient +{ + private readonly RawClient _client; + + internal AttachmentsClient(RawClient client) + { + _client = client; + } + + private async Task> DownloadAsyncCore( + DownloadAttachmentsRequest 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}/attachment-files/{2}/data", + ValueConvert.ToPathParameterString(request.DocId), + ValueConvert.ToPathParameterString(request.LayerName), + ValueConvert.ToPathParameterString(request.FileKey) + ), + 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 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), + } + ); + case 413: + throw new ContentTooLargeError( + 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> ListAsyncCore( + ListAttachmentsRequest 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}/attachments", + 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), + } + ); + } + } + + /// + /// A file that decodes past the server's limit is refused (PayloadTooLarge). + /// + /// + /// await client.Doc.Attachments.DownloadAsync( + /// new DownloadAttachmentsRequest + /// { + /// DocId = "docId", + /// LayerName = "layerName", + /// FileKey = "fileKey", + /// } + /// ); + /// + public WithRawResponseTask DownloadAsync( + DownloadAttachmentsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + DownloadAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// A file-attachment annotation's file is listed with the annotation; read its bytes with `doc.annotations.readFile`. + /// + /// + /// await client.Doc.Attachments.ListAsync( + /// new ListAttachmentsRequest { DocId = "docId", LayerName = "layerName" } + /// ); + /// + public WithRawResponseTask ListAsync( + ListAttachmentsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListAsyncCore(request, options, cancellationToken) + ); + } +} diff --git a/src/CloudPDF/Doc/Attachments/IAttachmentsClient.cs b/src/CloudPDF/Doc/Attachments/IAttachmentsClient.cs new file mode 100644 index 00000000..ba2c377f --- /dev/null +++ b/src/CloudPDF/Doc/Attachments/IAttachmentsClient.cs @@ -0,0 +1,24 @@ +using CloudPDF; + +namespace CloudPDF.Doc; + +public partial interface IAttachmentsClient +{ + /// + /// A file that decodes past the server's limit is refused (PayloadTooLarge). + /// + WithRawResponseTask DownloadAsync( + DownloadAttachmentsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + /// + /// A file-attachment annotation's file is listed with the annotation; read its bytes with `doc.annotations.readFile`. + /// + WithRawResponseTask ListAsync( + ListAttachmentsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/CloudPDF/Doc/Pages/Requests/InsertPagesRequest.cs b/src/CloudPDF/Doc/Attachments/Requests/DownloadAttachmentsRequest.cs similarity index 70% rename from src/CloudPDF/Doc/Pages/Requests/InsertPagesRequest.cs rename to src/CloudPDF/Doc/Attachments/Requests/DownloadAttachmentsRequest.cs index 1fb4c0f1..571b81bb 100644 --- a/src/CloudPDF/Doc/Pages/Requests/InsertPagesRequest.cs +++ b/src/CloudPDF/Doc/Attachments/Requests/DownloadAttachmentsRequest.cs @@ -1,11 +1,10 @@ -using CloudPDF; using CloudPDF.Core; using global::System.Text.Json.Serialization; namespace CloudPDF.Doc; [Serializable] -public record InsertPagesRequest +public record DownloadAttachmentsRequest { [JsonIgnore] public required string DocId { get; set; } @@ -14,18 +13,16 @@ public record InsertPagesRequest 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. + /// The embedded file's name-tree key (its `ref.key`), token-text encoded, as `fieldKey` is. /// [JsonIgnore] - public string? DocumentPassword { get; set; } + public required string FileKey { get; set; } /// - /// Names the change: 1 to 255 printable ASCII characters. A retry under the same key on the same layer answers with what the first request committed, and changes nothing. + /// 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? IdempotencyKey { get; set; } - - public required FileParameter File { get; set; } + public string? DocumentPassword { get; set; } /// public override string ToString() diff --git a/src/CloudPDF/Doc/Pages/Requests/DeletePagesRequest.cs b/src/CloudPDF/Doc/Attachments/Requests/ListAttachmentsRequest.cs similarity index 62% rename from src/CloudPDF/Doc/Pages/Requests/DeletePagesRequest.cs rename to src/CloudPDF/Doc/Attachments/Requests/ListAttachmentsRequest.cs index 4da44749..f1862f0d 100644 --- a/src/CloudPDF/Doc/Pages/Requests/DeletePagesRequest.cs +++ b/src/CloudPDF/Doc/Attachments/Requests/ListAttachmentsRequest.cs @@ -4,7 +4,7 @@ namespace CloudPDF.Doc; [Serializable] -public record DeletePagesRequest +public record ListAttachmentsRequest { [JsonIgnore] public required string DocId { get; set; } @@ -18,15 +18,6 @@ public record DeletePagesRequest [JsonIgnore] public string? DocumentPassword { get; set; } - /// - /// Names the change: 1 to 255 printable ASCII characters. A retry under the same key on the same layer answers with what the first request committed, and changes nothing. - /// - [JsonIgnore] - public string? IdempotencyKey { get; set; } - - [JsonIgnore] - public Dictionary Body { get; set; } = new Dictionary(); - /// public override string ToString() { diff --git a/src/CloudPDF/Doc/DocClient.cs b/src/CloudPDF/Doc/DocClient.cs index 15f5dabd..cc305990 100644 --- a/src/CloudPDF/Doc/DocClient.cs +++ b/src/CloudPDF/Doc/DocClient.cs @@ -12,8 +12,10 @@ internal DocClient(RawClient client) { _client = client; Annotations = new AnnotationsClient(_client); + Attachments = new AttachmentsClient(_client); Forms = new FormsClient(_client); Metadata = new MetadataClient(_client); + Outline = new OutlineClient(_client); Pages = new PagesClient(_client); Redactions = new RedactionsClient(_client); Signatures = new SignaturesClient(_client); @@ -22,10 +24,14 @@ internal DocClient(RawClient client) public IAnnotationsClient Annotations { get; } + public IAttachmentsClient Attachments { get; } + public IFormsClient Forms { get; } public IMetadataClient Metadata { get; } + public IOutlineClient Outline { get; } + public IPagesClient Pages { get; } public IRedactionsClient Redactions { get; } @@ -257,7 +263,7 @@ private async Task> ChangesAsyncCore( ); case 413: throw new ContentTooLargeError( - JsonUtils.Deserialize(responseBody), + JsonUtils.Deserialize(responseBody), rawResponse: new CloudPDF.RawResponse() { StatusCode = response.Raw.StatusCode, @@ -694,7 +700,7 @@ public WithRawResponseTask HeadAsync( } /// - /// Each change stands on its own and names itself by `opId`: a refused change rolls back alone, and the answer lists every change in order, applied with its result or refused with its error. Asked again under its `opId`, a change gets the same answer, refusals included; a different change under an answered `opId` is refused (IdempotencyKeyReused). `{ opId, undoOf }` undoes an earlier change of the caller, here or in an earlier request; an undo leaves alone what was changed since, and the undo of an undo redoes. A redaction, a flatten, a form repair or a completed signature ends undo for the changes before it (UndoUnavailable). Each op is checked against its own capability: annotation ops need `doc.annotate.modify`, form values `doc.forms.fill`, form structure `doc.forms.modify`, metadata `doc.metadata.modify`. Bytes (a stamp's drawing, an attached file, a signature's artwork) travel as multipart: a JSON `body` part, each op naming its files by role as `resources: { <role>: '<key>' }`, and each file as the part `resource:<key>`. At most 64 changes per request and 512 ops per change. + /// Each change stands on its own and names itself by `opId`: a refused change rolls back alone, and the answer lists every change in order, applied with its result or refused with its error. Asked again under its `opId`, a change gets the same answer, refusals included; a different change under an answered `opId` is refused (IdempotencyKeyReused). `{ opId, undoOf }` undoes an earlier change of the caller, here or in an earlier request; an undo leaves alone what was changed since, and the undo of an undo redoes. A redaction, a flatten, a form repair or a completed signature ends undo for the changes before it (UndoUnavailable). Each op is checked against its own capability: annotation ops need `doc.annotate.modify`, form values `doc.forms.fill`, form structure `doc.forms.modify`, metadata `doc.metadata.modify`, outline `doc.outline.modify`, pages `doc.pages.assemble`, embedded files `doc.attachments.modify`. Bytes (a stamp's drawing, an attached file, a signature's artwork, a PDF whose pages come in) travel as multipart: a JSON `body` part, each op naming its files by role as `resources: { <role>: '<key>' }`, and each file as the part `resource:<key>`. At most 64 changes per request and 512 ops per change. /// /// /// await client.Doc.ChangesAsync( diff --git a/src/CloudPDF/Doc/IDocClient.cs b/src/CloudPDF/Doc/IDocClient.cs index bdbd4ff5..adb59c71 100644 --- a/src/CloudPDF/Doc/IDocClient.cs +++ b/src/CloudPDF/Doc/IDocClient.cs @@ -5,8 +5,10 @@ namespace CloudPDF; public partial interface IDocClient { public IAnnotationsClient Annotations { get; } + public IAttachmentsClient Attachments { get; } public IFormsClient Forms { get; } public IMetadataClient Metadata { get; } + public IOutlineClient Outline { get; } public IPagesClient Pages { get; } public IRedactionsClient Redactions { get; } public ISignaturesClient Signatures { get; } @@ -18,7 +20,7 @@ WithRawResponseTask HeadAsync( ); /// - /// Each change stands on its own and names itself by `opId`: a refused change rolls back alone, and the answer lists every change in order, applied with its result or refused with its error. Asked again under its `opId`, a change gets the same answer, refusals included; a different change under an answered `opId` is refused (IdempotencyKeyReused). `{ opId, undoOf }` undoes an earlier change of the caller, here or in an earlier request; an undo leaves alone what was changed since, and the undo of an undo redoes. A redaction, a flatten, a form repair or a completed signature ends undo for the changes before it (UndoUnavailable). Each op is checked against its own capability: annotation ops need `doc.annotate.modify`, form values `doc.forms.fill`, form structure `doc.forms.modify`, metadata `doc.metadata.modify`. Bytes (a stamp's drawing, an attached file, a signature's artwork) travel as multipart: a JSON `body` part, each op naming its files by role as `resources: { <role>: '<key>' }`, and each file as the part `resource:<key>`. At most 64 changes per request and 512 ops per change. + /// Each change stands on its own and names itself by `opId`: a refused change rolls back alone, and the answer lists every change in order, applied with its result or refused with its error. Asked again under its `opId`, a change gets the same answer, refusals included; a different change under an answered `opId` is refused (IdempotencyKeyReused). `{ opId, undoOf }` undoes an earlier change of the caller, here or in an earlier request; an undo leaves alone what was changed since, and the undo of an undo redoes. A redaction, a flatten, a form repair or a completed signature ends undo for the changes before it (UndoUnavailable). Each op is checked against its own capability: annotation ops need `doc.annotate.modify`, form values `doc.forms.fill`, form structure `doc.forms.modify`, metadata `doc.metadata.modify`, outline `doc.outline.modify`, pages `doc.pages.assemble`, embedded files `doc.attachments.modify`. Bytes (a stamp's drawing, an attached file, a signature's artwork, a PDF whose pages come in) travel as multipart: a JSON `body` part, each op naming its files by role as `resources: { <role>: '<key>' }`, and each file as the part `resource:<key>`. At most 64 changes per request and 512 ops per change. /// WithRawResponseTask ChangesAsync( DocChangesRequest request, diff --git a/src/CloudPDF/Doc/Outline/IOutlineClient.cs b/src/CloudPDF/Doc/Outline/IOutlineClient.cs new file mode 100644 index 00000000..40f8eb28 --- /dev/null +++ b/src/CloudPDF/Doc/Outline/IOutlineClient.cs @@ -0,0 +1,12 @@ +using CloudPDF; + +namespace CloudPDF.Doc; + +public partial interface IOutlineClient +{ + WithRawResponseTask GetAsync( + GetOutlineRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/CloudPDF/Doc/Outline/OutlineClient.cs b/src/CloudPDF/Doc/Outline/OutlineClient.cs new file mode 100644 index 00000000..dad14fea --- /dev/null +++ b/src/CloudPDF/Doc/Outline/OutlineClient.cs @@ -0,0 +1,139 @@ +using CloudPDF; +using CloudPDF.Core; +using global::System.Text.Json; + +namespace CloudPDF.Doc; + +public partial class OutlineClient : IOutlineClient +{ + private readonly RawClient _client; + + internal OutlineClient(RawClient client) + { + _client = client; + } + + private async Task> GetAsyncCore( + GetOutlineRequest 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}/outline", + 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), + } + ); + } + } + + /// + /// await client.Doc.Outline.GetAsync( + /// new GetOutlineRequest { DocId = "docId", LayerName = "layerName" } + /// ); + /// + public WithRawResponseTask GetAsync( + GetOutlineRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + GetAsyncCore(request, options, cancellationToken) + ); + } +} diff --git a/src/CloudPDF/Doc/Pages/Requests/RotatePagesRequest.cs b/src/CloudPDF/Doc/Outline/Requests/GetOutlineRequest.cs similarity index 62% rename from src/CloudPDF/Doc/Pages/Requests/RotatePagesRequest.cs rename to src/CloudPDF/Doc/Outline/Requests/GetOutlineRequest.cs index f5293eed..793ce484 100644 --- a/src/CloudPDF/Doc/Pages/Requests/RotatePagesRequest.cs +++ b/src/CloudPDF/Doc/Outline/Requests/GetOutlineRequest.cs @@ -4,7 +4,7 @@ namespace CloudPDF.Doc; [Serializable] -public record RotatePagesRequest +public record GetOutlineRequest { [JsonIgnore] public required string DocId { get; set; } @@ -18,15 +18,6 @@ public record RotatePagesRequest [JsonIgnore] public string? DocumentPassword { get; set; } - /// - /// Names the change: 1 to 255 printable ASCII characters. A retry under the same key on the same layer answers with what the first request committed, and changes nothing. - /// - [JsonIgnore] - public string? IdempotencyKey { get; set; } - - [JsonIgnore] - public Dictionary Body { get; set; } = new Dictionary(); - /// public override string ToString() { diff --git a/src/CloudPDF/Doc/Pages/IPagesClient.cs b/src/CloudPDF/Doc/Pages/IPagesClient.cs index faac9251..5b813312 100644 --- a/src/CloudPDF/Doc/Pages/IPagesClient.cs +++ b/src/CloudPDF/Doc/Pages/IPagesClient.cs @@ -16,14 +16,8 @@ WithRawResponseTask ViewportsAsync( CancellationToken cancellationToken = default ); - WithRawResponseTask DeleteAsync( - DeletePagesRequest request, - RequestOptions? options = null, - CancellationToken cancellationToken = default - ); - /// - /// A read, not a mutation: the source document is untouched and no event is published. Body is `{"pages": PageRef[]}`; the response body is the new PDF. + /// A read, not a mutation: the source document is untouched and no event is published. Body is `{"pages": PageRef[], "flatten"?: {"usage"?: "display" | "print"}, "includeAnnotations"?: boolean, "includeFormFields"?: boolean}`; the response body is the new PDF. With `flatten` the copy is the pages as they draw for `usage` (`"print"`: a print copy): the annotations and form fields painted in, nothing interactive left, layers in their state for the usage. A flattened copy takes `doc.download` or `doc.download.flattened`, and paints only what the caller may read; `includeAnnotations` and `includeFormFields` choose what it paints, and are refused without `flatten`. /// WithRawResponseTask ExtractAsync( ExtractPagesRequest request, @@ -37,24 +31,6 @@ WithRawResponseTask FlattenAsync( CancellationToken cancellationToken = default ); - /// - /// Multipart: a JSON `body` part `{"position"?: PagePosition, "resources": {"source": "<key>"}}` (position omitted → the end), and the standalone PDF whose pages are copied in as the part `resource:<key>`. The inserted copies get fresh page object numbers, returned in insertion order. - /// - WithRawResponseTask InsertAsync( - InsertPagesRequest request, - RequestOptions? options = null, - CancellationToken cancellationToken = default - ); - - /// - /// Body is `{"size": {"width", "height"}, "count"?, "position"?}` — size in PDF points, count in [1, 100], `position` a `PagePosition` (omitted → the end). - /// - WithRawResponseTask InsertBlankAsync( - InsertBlankPagesRequest request, - RequestOptions? options = null, - CancellationToken cancellationToken = default - ); - WithRawResponseTask SetNameAsync( SetNamePagesRequest request, RequestOptions? options = null, @@ -66,16 +42,4 @@ WithRawResponseTask RemoveNameAsync( RequestOptions? options = null, CancellationToken cancellationToken = default ); - - WithRawResponseTask ReorderAsync( - DocPagesReorderRequest request, - RequestOptions? options = null, - CancellationToken cancellationToken = default - ); - - WithRawResponseTask RotateAsync( - RotatePagesRequest request, - RequestOptions? options = null, - CancellationToken cancellationToken = default - ); } diff --git a/src/CloudPDF/Doc/Pages/PagesClient.cs b/src/CloudPDF/Doc/Pages/PagesClient.cs index 20b68a14..dcad154f 100644 --- a/src/CloudPDF/Doc/Pages/PagesClient.cs +++ b/src/CloudPDF/Doc/Pages/PagesClient.cs @@ -250,600 +250,8 @@ private async Task> ViewportsAsync } } - private async Task> DeleteAsyncCore( - DeletePagesRequest 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("Idempotency-Key", request.IdempotencyKey) - .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}/pages/delete", - 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), - } - ); - } - } - - private async Task> ExtractAsyncCore( - ExtractPagesRequest 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}/pages/extract", - 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 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 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), - } - ); - } - } - - private async Task> FlattenAsyncCore( - FlattenPagesRequest 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("Idempotency-Key", request.IdempotencyKey) - .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}/pages/flatten", - 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), - } - ); - } - } - - private async Task> InsertAsyncCore( - InsertPagesRequest 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("Idempotency-Key", request.IdempotencyKey) - .Add(_client.Options.Headers) - .Add(_client.Options.AdditionalHeaders) - .Add(options?.AdditionalHeaders) - .BuildAsync() - .ConfigureAwait(false); - var multipartFormRequest_ = new MultipartFormRequest - { - Method = HttpMethod.Post, - Path = string.Format( - "v1/docs/{0}/layers/{1}/pages/insert", - ValueConvert.ToPathParameterString(request.DocId), - ValueConvert.ToPathParameterString(request.LayerName) - ), - QueryString = _queryString, - Headers = _headers, - Options = options, - }; - multipartFormRequest_.AddFileParameterPart("file", request.File); - var response = await _client - .SendRequestAsync(multipartFormRequest_, 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), - } - ); - } - } - - private async Task> InsertBlankAsyncCore( - InsertBlankPagesRequest 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("Idempotency-Key", request.IdempotencyKey) - .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}/pages/insert-blank", - 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), - } - ); - } - } - - private async Task> SetNameAsyncCore( - SetNamePagesRequest request, + private async Task> ExtractAsyncCore( + ExtractPagesRequest request, RequestOptions? options = null, CancellationToken cancellationToken = default ) @@ -853,7 +261,6 @@ private async Task> SetNameAsyncCore .Build(); var _headers = await new CloudPDF.Core.HeadersBuilder.Builder() .Add("X-Document-Password", request.DocumentPassword) - .Add("Idempotency-Key", request.IdempotencyKey) .Add(_client.Options.Headers) .Add(_client.Options.AdditionalHeaders) .Add(options?.AdditionalHeaders) @@ -865,7 +272,7 @@ private async Task> SetNameAsyncCore { Method = HttpMethod.Post, Path = string.Format( - "v1/docs/{0}/layers/{1}/pages/names", + "v1/docs/{0}/layers/{1}/pages/extract", ValueConvert.ToPathParameterString(request.DocId), ValueConvert.ToPathParameterString(request.LayerName) ), @@ -880,38 +287,17 @@ private async Task> SetNameAsyncCore .ConfigureAwait(false); if (response.StatusCode is >= 200 and < 400) { - var responseBody = await response - .Raw.Content.ReadAsStringAsync(cancellationToken) - .ConfigureAwait(false); - try + var stream = await response.Raw.Content.ReadAsStreamAsync(); + return new WithRawResponse() { - var responseData = JsonUtils.Deserialize(responseBody)!; - return new WithRawResponse() + Data = stream, + RawResponse = new CloudPDF.RawResponse() { - 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), - } - ); - } + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; } { var responseBody = await response @@ -965,8 +351,8 @@ private async Task> SetNameAsyncCore } } - private async Task> RemoveNameAsyncCore( - RemoveNamePagesRequest request, + private async Task> FlattenAsyncCore( + FlattenPagesRequest request, RequestOptions? options = null, CancellationToken cancellationToken = default ) @@ -988,7 +374,7 @@ private async Task> RemoveNameAsy { Method = HttpMethod.Post, Path = string.Format( - "v1/docs/{0}/layers/{1}/pages/names/delete", + "v1/docs/{0}/layers/{1}/pages/flatten", ValueConvert.ToPathParameterString(request.DocId), ValueConvert.ToPathParameterString(request.LayerName) ), @@ -1008,10 +394,8 @@ private async Task> RemoveNameAsy .ConfigureAwait(false); try { - var responseData = JsonUtils.Deserialize( - responseBody - )!; - return new WithRawResponse() + var responseData = JsonUtils.Deserialize(responseBody)!; + return new WithRawResponse() { Data = responseData, RawResponse = new CloudPDF.RawResponse() @@ -1090,8 +474,8 @@ private async Task> RemoveNameAsy } } - private async Task> ReorderAsyncCore( - DocPagesReorderRequest request, + private async Task> SetNameAsyncCore( + SetNamePagesRequest request, RequestOptions? options = null, CancellationToken cancellationToken = default ) @@ -1113,11 +497,11 @@ private async Task> ReorderAsyncCore { Method = HttpMethod.Post, Path = string.Format( - "v1/docs/{0}/layers/{1}/pages/reorder", + "v1/docs/{0}/layers/{1}/pages/names", ValueConvert.ToPathParameterString(request.DocId), ValueConvert.ToPathParameterString(request.LayerName) ), - Body = request, + Body = request.Body, QueryString = _queryString, Headers = _headers, ContentType = "application/json", @@ -1133,8 +517,8 @@ private async Task> ReorderAsyncCore .ConfigureAwait(false); try { - var responseData = JsonUtils.Deserialize(responseBody)!; - return new WithRawResponse() + var responseData = JsonUtils.Deserialize(responseBody)!; + return new WithRawResponse() { Data = responseData, RawResponse = new CloudPDF.RawResponse() @@ -1213,8 +597,8 @@ private async Task> ReorderAsyncCore } } - private async Task> RotateAsyncCore( - RotatePagesRequest request, + private async Task> RemoveNameAsyncCore( + RemoveNamePagesRequest request, RequestOptions? options = null, CancellationToken cancellationToken = default ) @@ -1236,7 +620,7 @@ private async Task> RotateAsyncCore( { Method = HttpMethod.Post, Path = string.Format( - "v1/docs/{0}/layers/{1}/pages/rotate", + "v1/docs/{0}/layers/{1}/pages/names/delete", ValueConvert.ToPathParameterString(request.DocId), ValueConvert.ToPathParameterString(request.LayerName) ), @@ -1256,8 +640,10 @@ private async Task> RotateAsyncCore( .ConfigureAwait(false); try { - var responseData = JsonUtils.Deserialize(responseBody)!; - return new WithRawResponse() + var responseData = JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() { Data = responseData, RawResponse = new CloudPDF.RawResponse() @@ -1378,29 +764,8 @@ public WithRawResponseTask ViewportsAsync( ); } - /// - /// await client.Doc.Pages.DeleteAsync( - /// new DeletePagesRequest - /// { - /// DocId = "docId", - /// LayerName = "layerName", - /// Body = new Dictionary<string, object?>() { { "key", "value" } }, - /// } - /// ); - /// - public WithRawResponseTask DeleteAsync( - DeletePagesRequest request, - RequestOptions? options = null, - CancellationToken cancellationToken = default - ) - { - return new WithRawResponseTask( - DeleteAsyncCore(request, options, cancellationToken) - ); - } - /// - /// A read, not a mutation: the source document is untouched and no event is published. Body is `{"pages": PageRef[]}`; the response body is the new PDF. + /// A read, not a mutation: the source document is untouched and no event is published. Body is `{"pages": PageRef[], "flatten"?: {"usage"?: "display" | "print"}, "includeAnnotations"?: boolean, "includeFormFields"?: boolean}`; the response body is the new PDF. With `flatten` the copy is the pages as they draw for `usage` (`"print"`: a print copy): the annotations and form fields painted in, nothing interactive left, layers in their state for the usage. A flattened copy takes `doc.download` or `doc.download.flattened`, and paints only what the caller may read; `includeAnnotations` and `includeFormFields` choose what it paints, and are refused without `flatten`. /// /// /// await client.Doc.Pages.ExtractAsync( @@ -1450,49 +815,6 @@ public WithRawResponseTask FlattenAsync( ); } - /// - /// Multipart: a JSON `body` part `{"position"?: PagePosition, "resources": {"source": "<key>"}}` (position omitted → the end), and the standalone PDF whose pages are copied in as the part `resource:<key>`. The inserted copies get fresh page object numbers, returned in insertion order. - /// - /// - /// await client.Doc.Pages.InsertAsync( - /// new InsertPagesRequest { DocId = "docId", LayerName = "layerName" } - /// ); - /// - public WithRawResponseTask InsertAsync( - InsertPagesRequest request, - RequestOptions? options = null, - CancellationToken cancellationToken = default - ) - { - return new WithRawResponseTask( - InsertAsyncCore(request, options, cancellationToken) - ); - } - - /// - /// Body is `{"size": {"width", "height"}, "count"?, "position"?}` — size in PDF points, count in [1, 100], `position` a `PagePosition` (omitted → the end). - /// - /// - /// await client.Doc.Pages.InsertBlankAsync( - /// new InsertBlankPagesRequest - /// { - /// DocId = "docId", - /// LayerName = "layerName", - /// Body = new Dictionary<string, object?>() { { "key", "value" } }, - /// } - /// ); - /// - public WithRawResponseTask InsertBlankAsync( - InsertBlankPagesRequest request, - RequestOptions? options = null, - CancellationToken cancellationToken = default - ) - { - return new WithRawResponseTask( - InsertBlankAsyncCore(request, options, cancellationToken) - ); - } - /// /// await client.Doc.Pages.SetNameAsync( /// new SetNamePagesRequest @@ -1534,50 +856,4 @@ public WithRawResponseTask RemoveNameAsync( RemoveNameAsyncCore(request, options, cancellationToken) ); } - - /// - /// await client.Doc.Pages.ReorderAsync( - /// new DocPagesReorderRequest - /// { - /// DocId = "docId", - /// LayerName = "layerName", - /// Pages = new List<PageRef>() - /// { - /// new PageRef { Kind = PageRefKind.ObjectNumber, ObjectNumber = 1 }, - /// }, - /// Position = PagePositionZero.Start, - /// } - /// ); - /// - public WithRawResponseTask ReorderAsync( - DocPagesReorderRequest request, - RequestOptions? options = null, - CancellationToken cancellationToken = default - ) - { - return new WithRawResponseTask( - ReorderAsyncCore(request, options, cancellationToken) - ); - } - - /// - /// await client.Doc.Pages.RotateAsync( - /// new RotatePagesRequest - /// { - /// DocId = "docId", - /// LayerName = "layerName", - /// Body = new Dictionary<string, object?>() { { "key", "value" } }, - /// } - /// ); - /// - public WithRawResponseTask RotateAsync( - RotatePagesRequest request, - RequestOptions? options = null, - CancellationToken cancellationToken = default - ) - { - return new WithRawResponseTask( - RotateAsyncCore(request, options, cancellationToken) - ); - } } diff --git a/src/CloudPDF/Doc/Pages/Requests/DocPagesReorderRequest.cs b/src/CloudPDF/Doc/Pages/Requests/DocPagesReorderRequest.cs deleted file mode 100644 index 55fd5ab5..00000000 --- a/src/CloudPDF/Doc/Pages/Requests/DocPagesReorderRequest.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CloudPDF; -using CloudPDF.Core; -using global::System.Text.Json.Serialization; -using OneOf; - -namespace CloudPDF.Doc; - -[Serializable] -public record DocPagesReorderRequest -{ - [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; } - - /// - /// Names the change: 1 to 255 printable ASCII characters. A retry under the same key on the same layer answers with what the first request committed, and changes nothing. - /// - [JsonIgnore] - public string? IdempotencyKey { get; set; } - - [JsonPropertyName("pages")] - public IEnumerable Pages { get; set; } = new List(); - - [JsonPropertyName("position")] - public required OneOf Position { get; set; } - - /// - public override string ToString() - { - return JsonUtils.Serialize(this); - } -} diff --git a/src/CloudPDF/Exceptions/ContentTooLargeError.cs b/src/CloudPDF/Exceptions/ContentTooLargeError.cs index df782576..4559ac0f 100644 --- a/src/CloudPDF/Exceptions/ContentTooLargeError.cs +++ b/src/CloudPDF/Exceptions/ContentTooLargeError.cs @@ -4,11 +4,5 @@ namespace CloudPDF; /// This exception type will be thrown for any non-2XX API responses. /// [Serializable] -public class ContentTooLargeError(EngineErrorPayload body, CloudPDF.RawResponse? rawResponse = null) - : CloudPDFApiException("ContentTooLargeError", 413, body, rawResponse: rawResponse) -{ - /// - /// The body of the response that triggered the exception. - /// - public new EngineErrorPayload Body => body; -} +public class ContentTooLargeError(object body, CloudPDF.RawResponse? rawResponse = null) + : CloudPDFApiException("ContentTooLargeError", 413, body, rawResponse: rawResponse); diff --git a/src/CloudPDF/Types/AnnotationFileAttachment.cs b/src/CloudPDF/Types/AnnotationFileAttachment.cs index 2fdab3c0..d122f6a6 100644 --- a/src/CloudPDF/Types/AnnotationFileAttachment.cs +++ b/src/CloudPDF/Types/AnnotationFileAttachment.cs @@ -111,7 +111,7 @@ public record AnnotationFileAttachment : IJsonOnDeserialized public required AnnotationFileAttachmentIcon Icon { get; set; } [JsonPropertyName("file")] - public AnnotationFileAttachmentFile? File { get; set; } + public AttachmentFileInfo? File { get; set; } [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/Attachment.cs b/src/CloudPDF/Types/Attachment.cs new file mode 100644 index 00000000..7ce637e5 --- /dev/null +++ b/src/CloudPDF/Types/Attachment.cs @@ -0,0 +1,52 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record Attachment : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("ref")] + public required AttachmentRef Ref { get; set; } + + [JsonPropertyName("name")] + public required string Name { get; set; } + + [JsonPropertyName("mimeType")] + public string? MimeType { get; set; } + + [JsonPropertyName("description")] + public string? Description { get; set; } + + [JsonPropertyName("size")] + public int? Size { get; set; } + + [JsonPropertyName("checksum")] + public string? Checksum { get; set; } + + [JsonPropertyName("createdAt")] + public DateTime? CreatedAt { get; set; } + + [JsonPropertyName("modifiedAt")] + public DateTime? ModifiedAt { get; set; } + + [JsonPropertyName("index")] + public required int Index { 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/AttachmentFileBase.cs b/src/CloudPDF/Types/AttachmentFileBase.cs new file mode 100644 index 00000000..56c55bff --- /dev/null +++ b/src/CloudPDF/Types/AttachmentFileBase.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record AttachmentFileBase : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required string Name { get; set; } + + [JsonPropertyName("mimeType")] + public string? MimeType { get; set; } + + [JsonPropertyName("description")] + public string? Description { 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/AnnotationFileAttachmentFile.cs b/src/CloudPDF/Types/AttachmentFileInfo.cs similarity index 94% rename from src/CloudPDF/Types/AnnotationFileAttachmentFile.cs rename to src/CloudPDF/Types/AttachmentFileInfo.cs index a50c1a52..1e4476b0 100644 --- a/src/CloudPDF/Types/AnnotationFileAttachmentFile.cs +++ b/src/CloudPDF/Types/AttachmentFileInfo.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record AnnotationFileAttachmentFile : IJsonOnDeserialized +public record AttachmentFileInfo : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetPage.cs b/src/CloudPDF/Types/AttachmentList.cs similarity index 78% rename from src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetPage.cs rename to src/CloudPDF/Types/AttachmentList.cs index 960e7e77..bb397e06 100644 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetPage.cs +++ b/src/CloudPDF/Types/AttachmentList.cs @@ -5,14 +5,14 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetPage : IJsonOnDeserialized +public record AttachmentList : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = new Dictionary(); - [JsonPropertyName("page")] - public required PageRef Page { get; set; } + [JsonPropertyName("attachments")] + public IEnumerable Attachments { get; set; } = new List(); [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/AttachmentMutationMeta.cs b/src/CloudPDF/Types/AttachmentMutationMeta.cs new file mode 100644 index 00000000..d66ebcb8 --- /dev/null +++ b/src/CloudPDF/Types/AttachmentMutationMeta.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record AttachmentMutationMeta : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("affectedPages")] + public IEnumerable AffectedPages { get; set; } = new List(); + + [JsonPropertyName("cacheDelta")] + public CacheDelta? CacheDelta { get; set; } + + [JsonPropertyName("opId")] + public required string OpId { get; set; } + + [JsonPropertyName("undoable")] + public required bool Undoable { get; set; } + + [JsonPropertyName("changed")] + public IEnumerable Changed { 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/AttachmentRef.cs b/src/CloudPDF/Types/AttachmentRef.cs new file mode 100644 index 00000000..b6fe0ef5 --- /dev/null +++ b/src/CloudPDF/Types/AttachmentRef.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record AttachmentRef : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("kind")] + public required AttachmentRefKind Kind { get; set; } + + [JsonPropertyName("key")] + public required string Key { 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/AttachmentRefKind.cs b/src/CloudPDF/Types/AttachmentRefKind.cs new file mode 100644 index 00000000..71ce4245 --- /dev/null +++ b/src/CloudPDF/Types/AttachmentRefKind.cs @@ -0,0 +1,111 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(AttachmentRefKind.AttachmentRefKindSerializer))] +[Serializable] +public readonly record struct AttachmentRefKind : IStringEnum +{ + public static readonly AttachmentRefKind Key = new(Values.Key); + + public AttachmentRefKind(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static AttachmentRefKind FromCustom(string value) + { + return new AttachmentRefKind(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 ==(AttachmentRefKind value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(AttachmentRefKind value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(AttachmentRefKind value) => value.Value; + + public static explicit operator AttachmentRefKind(string value) => new(value); + + internal class AttachmentRefKindSerializer : JsonConverter + { + public override AttachmentRefKind 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 AttachmentRefKind(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + AttachmentRefKind value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override AttachmentRefKind 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 AttachmentRefKind(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + AttachmentRefKind value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Key = "key"; + } +} diff --git a/src/CloudPDF/Types/CacheDelta.cs b/src/CloudPDF/Types/CacheDelta.cs index a4614b35..f1583de1 100644 --- a/src/CloudPDF/Types/CacheDelta.cs +++ b/src/CloudPDF/Types/CacheDelta.cs @@ -32,6 +32,9 @@ public record CacheDelta : IJsonOnDeserialized [JsonPropertyName("attachmentsVersion")] public int? AttachmentsVersion { get; set; } + [JsonPropertyName("outlineVersion")] + public int? OutlineVersion { get; set; } + [JsonPropertyName("layerVersion")] public int? LayerVersion { get; set; } diff --git a/src/CloudPDF/Types/ChangeItem.cs b/src/CloudPDF/Types/ChangeItem.cs index e09f4daf..219f15cc 100644 --- a/src/CloudPDF/Types/ChangeItem.cs +++ b/src/CloudPDF/Types/ChangeItem.cs @@ -234,6 +234,132 @@ public ChangeItem(ChangeItem.MetadataUpdateCustom value) Value = value.Value; } + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.OutlineCreate value) + { + Type = "outline.create"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.OutlineUpdate value) + { + Type = "outline.update"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.OutlineMove value) + { + Type = "outline.move"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.OutlineDelete value) + { + Type = "outline.delete"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.OutlineRestore value) + { + Type = "outline.restore"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.PagesRotate value) + { + Type = "pages.rotate"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.PagesReorder value) + { + Type = "pages.reorder"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.PagesDelete value) + { + Type = "pages.delete"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.PagesInsertBlank value) + { + Type = "pages.insertBlank"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.PagesInsert value) + { + Type = "pages.insert"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.PagesRestore value) + { + Type = "pages.restore"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.AttachmentsCreate value) + { + Type = "attachments.create"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.AttachmentsDelete value) + { + Type = "attachments.delete"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItem with . + /// + public ChangeItem(ChangeItem.AttachmentsRestore value) + { + Type = "attachments.restore"; + Value = value.Value; + } + /// /// Discriminant value /// @@ -365,6 +491,76 @@ public ChangeItem(ChangeItem.MetadataUpdateCustom value) /// public bool IsMetadataUpdateCustom => Type == "metadata.updateCustom"; + /// + /// Returns true if is "outline.create" + /// + public bool IsOutlineCreate => Type == "outline.create"; + + /// + /// Returns true if is "outline.update" + /// + public bool IsOutlineUpdate => Type == "outline.update"; + + /// + /// Returns true if is "outline.move" + /// + public bool IsOutlineMove => Type == "outline.move"; + + /// + /// Returns true if is "outline.delete" + /// + public bool IsOutlineDelete => Type == "outline.delete"; + + /// + /// Returns true if is "outline.restore" + /// + public bool IsOutlineRestore => Type == "outline.restore"; + + /// + /// Returns true if is "pages.rotate" + /// + public bool IsPagesRotate => Type == "pages.rotate"; + + /// + /// Returns true if is "pages.reorder" + /// + public bool IsPagesReorder => Type == "pages.reorder"; + + /// + /// Returns true if is "pages.delete" + /// + public bool IsPagesDelete => Type == "pages.delete"; + + /// + /// Returns true if is "pages.insertBlank" + /// + public bool IsPagesInsertBlank => Type == "pages.insertBlank"; + + /// + /// Returns true if is "pages.insert" + /// + public bool IsPagesInsert => Type == "pages.insert"; + + /// + /// Returns true if is "pages.restore" + /// + public bool IsPagesRestore => Type == "pages.restore"; + + /// + /// Returns true if is "attachments.create" + /// + public bool IsAttachmentsCreate => Type == "attachments.create"; + + /// + /// Returns true if is "attachments.delete" + /// + public bool IsAttachmentsDelete => Type == "attachments.delete"; + + /// + /// Returns true if is "attachments.restore" + /// + public bool IsAttachmentsRestore => Type == "attachments.restore"; + /// /// Returns the value as a if is 'skipped', otherwise throws an exception. /// @@ -587,6 +783,132 @@ public CloudPDF.ChangeItemMetadataUpdateCustom AsMetadataUpdateCustom() => ? (CloudPDF.ChangeItemMetadataUpdateCustom)Value! : throw new global::System.Exception("ChangeItem.Type is not 'metadata.updateCustom'"); + /// + /// Returns the value as a if is 'outline.create', otherwise throws an exception. + /// + /// Thrown when is not 'outline.create'. + public CloudPDF.ChangeItemOutlineCreate AsOutlineCreate() => + IsOutlineCreate + ? (CloudPDF.ChangeItemOutlineCreate)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'outline.create'"); + + /// + /// Returns the value as a if is 'outline.update', otherwise throws an exception. + /// + /// Thrown when is not 'outline.update'. + public CloudPDF.ChangeItemOutlineUpdate AsOutlineUpdate() => + IsOutlineUpdate + ? (CloudPDF.ChangeItemOutlineUpdate)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'outline.update'"); + + /// + /// Returns the value as a if is 'outline.move', otherwise throws an exception. + /// + /// Thrown when is not 'outline.move'. + public CloudPDF.ChangeItemOutlineMove AsOutlineMove() => + IsOutlineMove + ? (CloudPDF.ChangeItemOutlineMove)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'outline.move'"); + + /// + /// Returns the value as a if is 'outline.delete', otherwise throws an exception. + /// + /// Thrown when is not 'outline.delete'. + public CloudPDF.ChangeItemOutlineDelete AsOutlineDelete() => + IsOutlineDelete + ? (CloudPDF.ChangeItemOutlineDelete)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'outline.delete'"); + + /// + /// Returns the value as a if is 'outline.restore', otherwise throws an exception. + /// + /// Thrown when is not 'outline.restore'. + public CloudPDF.ChangeItemOutlineRestore AsOutlineRestore() => + IsOutlineRestore + ? (CloudPDF.ChangeItemOutlineRestore)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'outline.restore'"); + + /// + /// Returns the value as a if is 'pages.rotate', otherwise throws an exception. + /// + /// Thrown when is not 'pages.rotate'. + public CloudPDF.ChangeItemPagesRotate AsPagesRotate() => + IsPagesRotate + ? (CloudPDF.ChangeItemPagesRotate)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'pages.rotate'"); + + /// + /// Returns the value as a if is 'pages.reorder', otherwise throws an exception. + /// + /// Thrown when is not 'pages.reorder'. + public CloudPDF.ChangeItemPagesReorder AsPagesReorder() => + IsPagesReorder + ? (CloudPDF.ChangeItemPagesReorder)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'pages.reorder'"); + + /// + /// Returns the value as a if is 'pages.delete', otherwise throws an exception. + /// + /// Thrown when is not 'pages.delete'. + public CloudPDF.ChangeItemPagesDelete AsPagesDelete() => + IsPagesDelete + ? (CloudPDF.ChangeItemPagesDelete)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'pages.delete'"); + + /// + /// Returns the value as a if is 'pages.insertBlank', otherwise throws an exception. + /// + /// Thrown when is not 'pages.insertBlank'. + public CloudPDF.ChangeItemPagesInsertBlank AsPagesInsertBlank() => + IsPagesInsertBlank + ? (CloudPDF.ChangeItemPagesInsertBlank)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'pages.insertBlank'"); + + /// + /// Returns the value as a if is 'pages.insert', otherwise throws an exception. + /// + /// Thrown when is not 'pages.insert'. + public CloudPDF.ChangeItemPagesInsert AsPagesInsert() => + IsPagesInsert + ? (CloudPDF.ChangeItemPagesInsert)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'pages.insert'"); + + /// + /// Returns the value as a if is 'pages.restore', otherwise throws an exception. + /// + /// Thrown when is not 'pages.restore'. + public CloudPDF.ChangeItemPagesRestore AsPagesRestore() => + IsPagesRestore + ? (CloudPDF.ChangeItemPagesRestore)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'pages.restore'"); + + /// + /// Returns the value as a if is 'attachments.create', otherwise throws an exception. + /// + /// Thrown when is not 'attachments.create'. + public CloudPDF.ChangeItemAttachmentsCreate AsAttachmentsCreate() => + IsAttachmentsCreate + ? (CloudPDF.ChangeItemAttachmentsCreate)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'attachments.create'"); + + /// + /// Returns the value as a if is 'attachments.delete', otherwise throws an exception. + /// + /// Thrown when is not 'attachments.delete'. + public CloudPDF.ChangeItemAttachmentsDelete AsAttachmentsDelete() => + IsAttachmentsDelete + ? (CloudPDF.ChangeItemAttachmentsDelete)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'attachments.delete'"); + + /// + /// Returns the value as a if is 'attachments.restore', otherwise throws an exception. + /// + /// Thrown when is not 'attachments.restore'. + public CloudPDF.ChangeItemAttachmentsRestore AsAttachmentsRestore() => + IsAttachmentsRestore + ? (CloudPDF.ChangeItemAttachmentsRestore)Value! + : throw new global::System.Exception("ChangeItem.Type is not 'attachments.restore'"); + public T Match( Func onSkipped, Func onAnnotationsCreate, @@ -612,6 +934,20 @@ public T Match( Func onFormsUpdateWidget, Func onMetadataUpdate, Func onMetadataUpdateCustom, + Func onOutlineCreate, + Func onOutlineUpdate, + Func onOutlineMove, + Func onOutlineDelete, + Func onOutlineRestore, + Func onPagesRotate, + Func onPagesReorder, + Func onPagesDelete, + Func onPagesInsertBlank, + Func onPagesInsert, + Func onPagesRestore, + Func onAttachmentsCreate, + Func onAttachmentsDelete, + Func onAttachmentsRestore, Func onUnknown_ ) { @@ -643,6 +979,20 @@ public T Match( "forms.updateWidget" => onFormsUpdateWidget(AsFormsUpdateWidget()), "metadata.update" => onMetadataUpdate(AsMetadataUpdate()), "metadata.updateCustom" => onMetadataUpdateCustom(AsMetadataUpdateCustom()), + "outline.create" => onOutlineCreate(AsOutlineCreate()), + "outline.update" => onOutlineUpdate(AsOutlineUpdate()), + "outline.move" => onOutlineMove(AsOutlineMove()), + "outline.delete" => onOutlineDelete(AsOutlineDelete()), + "outline.restore" => onOutlineRestore(AsOutlineRestore()), + "pages.rotate" => onPagesRotate(AsPagesRotate()), + "pages.reorder" => onPagesReorder(AsPagesReorder()), + "pages.delete" => onPagesDelete(AsPagesDelete()), + "pages.insertBlank" => onPagesInsertBlank(AsPagesInsertBlank()), + "pages.insert" => onPagesInsert(AsPagesInsert()), + "pages.restore" => onPagesRestore(AsPagesRestore()), + "attachments.create" => onAttachmentsCreate(AsAttachmentsCreate()), + "attachments.delete" => onAttachmentsDelete(AsAttachmentsDelete()), + "attachments.restore" => onAttachmentsRestore(AsAttachmentsRestore()), _ => onUnknown_(Type, Value), }; } @@ -672,6 +1022,20 @@ public void Visit( Action onFormsUpdateWidget, Action onMetadataUpdate, Action onMetadataUpdateCustom, + Action onOutlineCreate, + Action onOutlineUpdate, + Action onOutlineMove, + Action onOutlineDelete, + Action onOutlineRestore, + Action onPagesRotate, + Action onPagesReorder, + Action onPagesDelete, + Action onPagesInsertBlank, + Action onPagesInsert, + Action onPagesRestore, + Action onAttachmentsCreate, + Action onAttachmentsDelete, + Action onAttachmentsRestore, Action onUnknown_ ) { @@ -749,6 +1113,48 @@ public void Visit( case "metadata.updateCustom": onMetadataUpdateCustom(AsMetadataUpdateCustom()); break; + case "outline.create": + onOutlineCreate(AsOutlineCreate()); + break; + case "outline.update": + onOutlineUpdate(AsOutlineUpdate()); + break; + case "outline.move": + onOutlineMove(AsOutlineMove()); + break; + case "outline.delete": + onOutlineDelete(AsOutlineDelete()); + break; + case "outline.restore": + onOutlineRestore(AsOutlineRestore()); + break; + case "pages.rotate": + onPagesRotate(AsPagesRotate()); + break; + case "pages.reorder": + onPagesReorder(AsPagesReorder()); + break; + case "pages.delete": + onPagesDelete(AsPagesDelete()); + break; + case "pages.insertBlank": + onPagesInsertBlank(AsPagesInsertBlank()); + break; + case "pages.insert": + onPagesInsert(AsPagesInsert()); + break; + case "pages.restore": + onPagesRestore(AsPagesRestore()); + break; + case "attachments.create": + onAttachmentsCreate(AsAttachmentsCreate()); + break; + case "attachments.delete": + onAttachmentsDelete(AsAttachmentsDelete()); + break; + case "attachments.restore": + onAttachmentsRestore(AsAttachmentsRestore()); + break; default: onUnknown_(Type, Value); break; @@ -1095,23 +1501,219 @@ public bool TryAsMetadataUpdateCustom(out CloudPDF.ChangeItemMetadataUpdateCusto return false; } - public override string ToString() => JsonUtils.Serialize(this); - - public static implicit operator ChangeItem(ChangeItem.Skipped value) => new(value); - - public static implicit operator ChangeItem(ChangeItem.AnnotationsCreate value) => new(value); + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsOutlineCreate(out CloudPDF.ChangeItemOutlineCreate? value) + { + if (Type == "outline.create") + { + value = (CloudPDF.ChangeItemOutlineCreate)Value!; + return true; + } + value = null; + return false; + } - public static implicit operator ChangeItem(ChangeItem.AnnotationsUpdate value) => new(value); + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsOutlineUpdate(out CloudPDF.ChangeItemOutlineUpdate? value) + { + if (Type == "outline.update") + { + value = (CloudPDF.ChangeItemOutlineUpdate)Value!; + return true; + } + value = null; + return false; + } - public static implicit operator ChangeItem(ChangeItem.AnnotationsDelete value) => new(value); + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsOutlineMove(out CloudPDF.ChangeItemOutlineMove? value) + { + if (Type == "outline.move") + { + value = (CloudPDF.ChangeItemOutlineMove)Value!; + return true; + } + value = null; + return false; + } - public static implicit operator ChangeItem(ChangeItem.AnnotationsReorder value) => new(value); + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsOutlineDelete(out CloudPDF.ChangeItemOutlineDelete? value) + { + if (Type == "outline.delete") + { + value = (CloudPDF.ChangeItemOutlineDelete)Value!; + return true; + } + value = null; + return false; + } - public static implicit operator ChangeItem(ChangeItem.AnnotationsRestore value) => new(value); + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsOutlineRestore(out CloudPDF.ChangeItemOutlineRestore? value) + { + if (Type == "outline.restore") + { + value = (CloudPDF.ChangeItemOutlineRestore)Value!; + return true; + } + value = null; + return false; + } - public static implicit operator ChangeItem(ChangeItem.FormsSetValue value) => new(value); + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPagesRotate(out CloudPDF.ChangeItemPagesRotate? value) + { + if (Type == "pages.rotate") + { + value = (CloudPDF.ChangeItemPagesRotate)Value!; + return true; + } + value = null; + return false; + } - public static implicit operator ChangeItem(ChangeItem.FormsSetDisplay value) => new(value); + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPagesReorder(out CloudPDF.ChangeItemPagesReorder? value) + { + if (Type == "pages.reorder") + { + value = (CloudPDF.ChangeItemPagesReorder)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPagesDelete(out CloudPDF.ChangeItemPagesDelete? value) + { + if (Type == "pages.delete") + { + value = (CloudPDF.ChangeItemPagesDelete)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPagesInsertBlank(out CloudPDF.ChangeItemPagesInsertBlank? value) + { + if (Type == "pages.insertBlank") + { + value = (CloudPDF.ChangeItemPagesInsertBlank)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPagesInsert(out CloudPDF.ChangeItemPagesInsert? value) + { + if (Type == "pages.insert") + { + value = (CloudPDF.ChangeItemPagesInsert)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPagesRestore(out CloudPDF.ChangeItemPagesRestore? value) + { + if (Type == "pages.restore") + { + value = (CloudPDF.ChangeItemPagesRestore)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsAttachmentsCreate(out CloudPDF.ChangeItemAttachmentsCreate? value) + { + if (Type == "attachments.create") + { + value = (CloudPDF.ChangeItemAttachmentsCreate)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsAttachmentsDelete(out CloudPDF.ChangeItemAttachmentsDelete? value) + { + if (Type == "attachments.delete") + { + value = (CloudPDF.ChangeItemAttachmentsDelete)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsAttachmentsRestore(out CloudPDF.ChangeItemAttachmentsRestore? value) + { + if (Type == "attachments.restore") + { + value = (CloudPDF.ChangeItemAttachmentsRestore)Value!; + return true; + } + value = null; + return false; + } + + public override string ToString() => JsonUtils.Serialize(this); + + public static implicit operator ChangeItem(ChangeItem.Skipped value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.AnnotationsCreate value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.AnnotationsUpdate value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.AnnotationsDelete value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.AnnotationsReorder value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.AnnotationsRestore value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.FormsSetValue value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.FormsSetDisplay value) => new(value); public static implicit operator ChangeItem(ChangeItem.FormsSetAppearanceText value) => new(value); @@ -1148,6 +1750,34 @@ public static implicit operator ChangeItem(ChangeItem.FormsReorderCalculations v public static implicit operator ChangeItem(ChangeItem.MetadataUpdateCustom value) => new(value); + public static implicit operator ChangeItem(ChangeItem.OutlineCreate value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.OutlineUpdate value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.OutlineMove value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.OutlineDelete value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.OutlineRestore value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.PagesRotate value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.PagesReorder value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.PagesDelete value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.PagesInsertBlank value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.PagesInsert value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.PagesRestore value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.AttachmentsCreate value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.AttachmentsDelete value) => new(value); + + public static implicit operator ChangeItem(ChangeItem.AttachmentsRestore value) => new(value); + [Serializable] internal sealed class JsonConverter : JsonConverter { @@ -1341,6 +1971,86 @@ JsonSerializerOptions options ?? throw new JsonException( "Failed to deserialize CloudPDF.ChangeItemMetadataUpdateCustom" ), + "outline.create" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemOutlineCreate" + ), + "outline.update" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemOutlineUpdate" + ), + "outline.move" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemOutlineMove" + ), + "outline.delete" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemOutlineDelete" + ), + "outline.restore" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemOutlineRestore" + ), + "pages.rotate" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemPagesRotate" + ), + "pages.reorder" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemPagesReorder" + ), + "pages.delete" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemPagesDelete" + ), + "pages.insertBlank" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemPagesInsertBlank" + ), + "pages.insert" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemPagesInsert" + ), + "pages.restore" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemPagesRestore" + ), + "attachments.create" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemAttachmentsCreate" + ), + "attachments.delete" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemAttachmentsDelete" + ), + "attachments.restore" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemAttachmentsRestore" + ), _ => json.Deserialize(options), }; return new ChangeItem(discriminator, value); @@ -1388,6 +2098,20 @@ JsonSerializerOptions options "forms.updateWidget" => JsonSerializer.SerializeToNode(value.Value, options), "metadata.update" => JsonSerializer.SerializeToNode(value.Value, options), "metadata.updateCustom" => JsonSerializer.SerializeToNode(value.Value, options), + "outline.create" => JsonSerializer.SerializeToNode(value.Value, options), + "outline.update" => JsonSerializer.SerializeToNode(value.Value, options), + "outline.move" => JsonSerializer.SerializeToNode(value.Value, options), + "outline.delete" => JsonSerializer.SerializeToNode(value.Value, options), + "outline.restore" => JsonSerializer.SerializeToNode(value.Value, options), + "pages.rotate" => JsonSerializer.SerializeToNode(value.Value, options), + "pages.reorder" => JsonSerializer.SerializeToNode(value.Value, options), + "pages.delete" => JsonSerializer.SerializeToNode(value.Value, options), + "pages.insertBlank" => JsonSerializer.SerializeToNode(value.Value, options), + "pages.insert" => 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), + "attachments.restore" => JsonSerializer.SerializeToNode(value.Value, options), _ => JsonSerializer.SerializeToNode(value.Value, options), } ?? new JsonObject(); json["type"] = value.Type; @@ -1894,4 +2618,284 @@ public static implicit operator ChangeItem.MetadataUpdateCustom( CloudPDF.ChangeItemMetadataUpdateCustom value ) => new(value); } + + /// + /// Discriminated union type for outline.create + /// + [Serializable] + public struct OutlineCreate + { + public OutlineCreate(CloudPDF.ChangeItemOutlineCreate value) + { + Value = value; + } + + internal CloudPDF.ChangeItemOutlineCreate Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.OutlineCreate( + CloudPDF.ChangeItemOutlineCreate value + ) => new(value); + } + + /// + /// Discriminated union type for outline.update + /// + [Serializable] + public struct OutlineUpdate + { + public OutlineUpdate(CloudPDF.ChangeItemOutlineUpdate value) + { + Value = value; + } + + internal CloudPDF.ChangeItemOutlineUpdate Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.OutlineUpdate( + CloudPDF.ChangeItemOutlineUpdate value + ) => new(value); + } + + /// + /// Discriminated union type for outline.move + /// + [Serializable] + public struct OutlineMove + { + public OutlineMove(CloudPDF.ChangeItemOutlineMove value) + { + Value = value; + } + + internal CloudPDF.ChangeItemOutlineMove Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.OutlineMove( + CloudPDF.ChangeItemOutlineMove value + ) => new(value); + } + + /// + /// Discriminated union type for outline.delete + /// + [Serializable] + public struct OutlineDelete + { + public OutlineDelete(CloudPDF.ChangeItemOutlineDelete value) + { + Value = value; + } + + internal CloudPDF.ChangeItemOutlineDelete Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.OutlineDelete( + CloudPDF.ChangeItemOutlineDelete value + ) => new(value); + } + + /// + /// Discriminated union type for outline.restore + /// + [Serializable] + public struct OutlineRestore + { + public OutlineRestore(CloudPDF.ChangeItemOutlineRestore value) + { + Value = value; + } + + internal CloudPDF.ChangeItemOutlineRestore Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.OutlineRestore( + CloudPDF.ChangeItemOutlineRestore value + ) => new(value); + } + + /// + /// Discriminated union type for pages.rotate + /// + [Serializable] + public struct PagesRotate + { + public PagesRotate(CloudPDF.ChangeItemPagesRotate value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesRotate Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.PagesRotate( + CloudPDF.ChangeItemPagesRotate value + ) => new(value); + } + + /// + /// Discriminated union type for pages.reorder + /// + [Serializable] + public struct PagesReorder + { + public PagesReorder(CloudPDF.ChangeItemPagesReorder value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesReorder Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.PagesReorder( + CloudPDF.ChangeItemPagesReorder value + ) => new(value); + } + + /// + /// Discriminated union type for pages.delete + /// + [Serializable] + public struct PagesDelete + { + public PagesDelete(CloudPDF.ChangeItemPagesDelete value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesDelete Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.PagesDelete( + CloudPDF.ChangeItemPagesDelete value + ) => new(value); + } + + /// + /// Discriminated union type for pages.insertBlank + /// + [Serializable] + public struct PagesInsertBlank + { + public PagesInsertBlank(CloudPDF.ChangeItemPagesInsertBlank value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesInsertBlank Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.PagesInsertBlank( + CloudPDF.ChangeItemPagesInsertBlank value + ) => new(value); + } + + /// + /// Discriminated union type for pages.insert + /// + [Serializable] + public struct PagesInsert + { + public PagesInsert(CloudPDF.ChangeItemPagesInsert value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesInsert Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.PagesInsert( + CloudPDF.ChangeItemPagesInsert value + ) => new(value); + } + + /// + /// Discriminated union type for pages.restore + /// + [Serializable] + public struct PagesRestore + { + public PagesRestore(CloudPDF.ChangeItemPagesRestore value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesRestore Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.PagesRestore( + CloudPDF.ChangeItemPagesRestore value + ) => new(value); + } + + /// + /// Discriminated union type for attachments.create + /// + [Serializable] + public struct AttachmentsCreate + { + public AttachmentsCreate(CloudPDF.ChangeItemAttachmentsCreate value) + { + Value = value; + } + + internal CloudPDF.ChangeItemAttachmentsCreate Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.AttachmentsCreate( + CloudPDF.ChangeItemAttachmentsCreate value + ) => new(value); + } + + /// + /// Discriminated union type for attachments.delete + /// + [Serializable] + public struct AttachmentsDelete + { + public AttachmentsDelete(CloudPDF.ChangeItemAttachmentsDelete value) + { + Value = value; + } + + internal CloudPDF.ChangeItemAttachmentsDelete Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.AttachmentsDelete( + CloudPDF.ChangeItemAttachmentsDelete value + ) => new(value); + } + + /// + /// Discriminated union type for attachments.restore + /// + [Serializable] + public struct AttachmentsRestore + { + public AttachmentsRestore(CloudPDF.ChangeItemAttachmentsRestore value) + { + Value = value; + } + + internal CloudPDF.ChangeItemAttachmentsRestore Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItem.AttachmentsRestore( + CloudPDF.ChangeItemAttachmentsRestore value + ) => new(value); + } } diff --git a/src/CloudPDF/Types/ChangeItemAttachmentsCreate.cs b/src/CloudPDF/Types/ChangeItemAttachmentsCreate.cs new file mode 100644 index 00000000..2b05aa7c --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemAttachmentsCreate.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemAttachmentsCreate : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("attachment")] + public required Attachment Attachment { get; set; } + + [JsonPropertyName("meta")] + public required AttachmentMutationMeta 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/ChangeItemAttachmentsDelete.cs b/src/CloudPDF/Types/ChangeItemAttachmentsDelete.cs new file mode 100644 index 00000000..72d69687 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemAttachmentsDelete.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemAttachmentsDelete : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("meta")] + public required AttachmentMutationMeta 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/ChangeItemAttachmentsRestore.cs b/src/CloudPDF/Types/ChangeItemAttachmentsRestore.cs new file mode 100644 index 00000000..261d5afc --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemAttachmentsRestore.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemAttachmentsRestore : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("attachment")] + public required Attachment Attachment { get; set; } + + [JsonPropertyName("meta")] + public required AttachmentMutationMeta 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/ChangeItemOutlineCreate.cs b/src/CloudPDF/Types/ChangeItemOutlineCreate.cs new file mode 100644 index 00000000..7cfa10fd --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemOutlineCreate.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemOutlineCreate : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("item")] + public required OutlineItem Item { get; set; } + + [JsonPropertyName("order")] + public required OutlineOrder Order { get; set; } + + [JsonPropertyName("meta")] + public required OutlineMutationMeta 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/ChangeItemOutlineDelete.cs b/src/CloudPDF/Types/ChangeItemOutlineDelete.cs new file mode 100644 index 00000000..d90ce974 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemOutlineDelete.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemOutlineDelete : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("meta")] + public required OutlineMutationMeta 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/ChangeItemOutlineMove.cs b/src/CloudPDF/Types/ChangeItemOutlineMove.cs new file mode 100644 index 00000000..2f468be1 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemOutlineMove.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemOutlineMove : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("orders")] + public IEnumerable Orders { get; set; } = new List(); + + [JsonPropertyName("meta")] + public required OutlineMutationMeta 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/ChangeItemOutlineRestore.cs b/src/CloudPDF/Types/ChangeItemOutlineRestore.cs new file mode 100644 index 00000000..abd64045 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemOutlineRestore.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemOutlineRestore : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("items")] + public IEnumerable Items { get; set; } = new List(); + + [JsonPropertyName("order")] + public required OutlineOrder Order { get; set; } + + [JsonPropertyName("meta")] + public required OutlineMutationMeta 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/ChangeItemOutlineUpdate.cs b/src/CloudPDF/Types/ChangeItemOutlineUpdate.cs new file mode 100644 index 00000000..1c3e5fdb --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemOutlineUpdate.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemOutlineUpdate : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("skipped")] + public IEnumerable? Skipped { get; set; } + + [JsonPropertyName("item")] + public required OutlineItem Item { get; set; } + + [JsonPropertyName("meta")] + public required OutlineMutationMeta 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/DocPagesReorder200Response.cs b/src/CloudPDF/Types/ChangeItemPagesDelete.cs similarity index 86% rename from src/CloudPDF/Types/DocPagesReorder200Response.cs rename to src/CloudPDF/Types/ChangeItemPagesDelete.cs index 5161039f..b504fcf6 100644 --- a/src/CloudPDF/Types/DocPagesReorder200Response.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDelete.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesReorder200Response : IJsonOnDeserialized +public record ChangeItemPagesDelete : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -15,7 +15,7 @@ public record DocPagesReorder200Response : IJsonOnDeserialized public IEnumerable Pages { get; set; } = new List(); [JsonPropertyName("layout")] - public required DocPagesReorder200ResponseLayout Layout { get; set; } + public required ChangeItemPagesDeleteLayout Layout { get; set; } [JsonPropertyName("meta")] public required MutationMeta Meta { get; set; } diff --git a/src/CloudPDF/Types/DocPagesInsert200ResponseLayout.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayout.cs similarity index 67% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayout.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayout.cs index 1be39a80..033a9cfc 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayout.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayout.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsert200ResponseLayout : IJsonOnDeserialized +public record ChangeItemPagesDeleteLayout : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -15,12 +15,12 @@ public record DocPagesInsert200ResponseLayout : IJsonOnDeserialized public required int PageCount { get; set; } [JsonPropertyName("pages")] - public IEnumerable Pages { get; set; } = - new List(); + public IEnumerable Pages { get; set; } = + new List(); [JsonPropertyName("namedPages")] - public IEnumerable NamedPages { get; set; } = - new List(); + public IEnumerable NamedPages { get; set; } = + new List(); [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItem.cs similarity index 80% rename from src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItem.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItem.cs index bde89293..89126af1 100644 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItem.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItem.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesRotate200ResponseLayoutNamedPagesItem : IJsonOnDeserialized +public record ChangeItemPagesDeleteLayoutNamedPagesItem : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -15,7 +15,7 @@ public record DocPagesRotate200ResponseLayoutNamedPagesItem : IJsonOnDeserialize public required string Name { get; set; } [JsonPropertyName("target")] - public required DocPagesRotate200ResponseLayoutNamedPagesItemTarget Target { get; set; } + public required ChangeItemPagesDeleteLayoutNamedPagesItemTarget Target { get; set; } [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItemTarget.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItemTarget.cs similarity index 53% rename from src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItemTarget.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItemTarget.cs index 2f49b26f..51b4c6ca 100644 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItemTarget.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItemTarget.cs @@ -8,21 +8,21 @@ namespace CloudPDF; -[JsonConverter(typeof(DocPagesRotate200ResponseLayoutNamedPagesItemTarget.JsonConverter))] +[JsonConverter(typeof(ChangeItemPagesDeleteLayoutNamedPagesItemTarget.JsonConverter))] [Serializable] -public record DocPagesRotate200ResponseLayoutNamedPagesItemTarget +public record ChangeItemPagesDeleteLayoutNamedPagesItemTarget { - internal DocPagesRotate200ResponseLayoutNamedPagesItemTarget(string type, object? value) + internal ChangeItemPagesDeleteLayoutNamedPagesItemTarget(string type, object? value) { Kind = type; Value = value; } /// - /// Create an instance of DocPagesRotate200ResponseLayoutNamedPagesItemTarget with . + /// Create an instance of ChangeItemPagesDeleteLayoutNamedPagesItemTarget with . /// - public DocPagesRotate200ResponseLayoutNamedPagesItemTarget( - DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Page value + public ChangeItemPagesDeleteLayoutNamedPagesItemTarget( + ChangeItemPagesDeleteLayoutNamedPagesItemTarget.Page value ) { Kind = "page"; @@ -30,10 +30,10 @@ DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Page value } /// - /// Create an instance of DocPagesRotate200ResponseLayoutNamedPagesItemTarget with . + /// Create an instance of ChangeItemPagesDeleteLayoutNamedPagesItemTarget with . /// - public DocPagesRotate200ResponseLayoutNamedPagesItemTarget( - DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Template value + public ChangeItemPagesDeleteLayoutNamedPagesItemTarget( + ChangeItemPagesDeleteLayoutNamedPagesItemTarget.Template value ) { Kind = "template"; @@ -41,10 +41,10 @@ DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Template value } /// - /// Create an instance of DocPagesRotate200ResponseLayoutNamedPagesItemTarget with . + /// Create an instance of ChangeItemPagesDeleteLayoutNamedPagesItemTarget with . /// - public DocPagesRotate200ResponseLayoutNamedPagesItemTarget( - DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Dangling value + public ChangeItemPagesDeleteLayoutNamedPagesItemTarget( + ChangeItemPagesDeleteLayoutNamedPagesItemTarget.Dangling value ) { Kind = "dangling"; @@ -78,42 +78,42 @@ DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Dangling value public bool IsDangling => Kind == "dangling"; /// - /// Returns the value as a if is 'page', otherwise throws an exception. + /// Returns the value as a if is 'page', otherwise throws an exception. /// /// Thrown when is not 'page'. - public CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage AsPage() => + public CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetPage AsPage() => IsPage - ? (CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage)Value! + ? (CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetPage)Value! : throw new global::System.Exception( - "DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Kind is not 'page'" + "ChangeItemPagesDeleteLayoutNamedPagesItemTarget.Kind is not 'page'" ); /// - /// Returns the value as a if is 'template', otherwise throws an exception. + /// Returns the value as a if is 'template', otherwise throws an exception. /// /// Thrown when is not 'template'. - public CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate AsTemplate() => + public CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetTemplate AsTemplate() => IsTemplate - ? (CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate)Value! + ? (CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetTemplate)Value! : throw new global::System.Exception( - "DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Kind is not 'template'" + "ChangeItemPagesDeleteLayoutNamedPagesItemTarget.Kind is not 'template'" ); /// - /// Returns the value as a if is 'dangling', otherwise throws an exception. + /// Returns the value as a if is 'dangling', otherwise throws an exception. /// /// Thrown when is not 'dangling'. - public CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetDangling AsDangling() => + public CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetDangling AsDangling() => IsDangling - ? (CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetDangling)Value! + ? (CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetDangling)Value! : throw new global::System.Exception( - "DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Kind is not 'dangling'" + "ChangeItemPagesDeleteLayoutNamedPagesItemTarget.Kind is not 'dangling'" ); public T Match( - Func onPage, - Func onTemplate, - Func onDangling, + Func onPage, + Func onTemplate, + Func onDangling, Func onUnknown_ ) { @@ -127,9 +127,9 @@ public T Match( } public void Visit( - Action onPage, - Action onTemplate, - Action onDangling, + Action onPage, + Action onTemplate, + Action onDangling, Action onUnknown_ ) { @@ -151,15 +151,13 @@ public void Visit( } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// - public bool TryAsPage( - out CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage? value - ) + public bool TryAsPage(out CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetPage? value) { if (Kind == "page") { - value = (CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage)Value!; + value = (CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetPage)Value!; return true; } value = null; @@ -167,15 +165,15 @@ out CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage? value } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// public bool TryAsTemplate( - out CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate? value + out CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetTemplate? value ) { if (Kind == "template") { - value = (CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate)Value!; + value = (CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetTemplate)Value!; return true; } value = null; @@ -183,15 +181,15 @@ out CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate? value } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// public bool TryAsDangling( - out CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetDangling? value + out CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetDangling? value ) { if (Kind == "dangling") { - value = (CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetDangling)Value!; + value = (CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetDangling)Value!; return true; } value = null; @@ -200,28 +198,26 @@ out CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetDangling? value public override string ToString() => JsonUtils.Serialize(this); - public static implicit operator DocPagesRotate200ResponseLayoutNamedPagesItemTarget( - DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Page value + public static implicit operator ChangeItemPagesDeleteLayoutNamedPagesItemTarget( + ChangeItemPagesDeleteLayoutNamedPagesItemTarget.Page value ) => new(value); - public static implicit operator DocPagesRotate200ResponseLayoutNamedPagesItemTarget( - DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Template value + public static implicit operator ChangeItemPagesDeleteLayoutNamedPagesItemTarget( + ChangeItemPagesDeleteLayoutNamedPagesItemTarget.Template value ) => new(value); - public static implicit operator DocPagesRotate200ResponseLayoutNamedPagesItemTarget( - DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Dangling value + public static implicit operator ChangeItemPagesDeleteLayoutNamedPagesItemTarget( + ChangeItemPagesDeleteLayoutNamedPagesItemTarget.Dangling value ) => new(value); [Serializable] internal sealed class JsonConverter - : JsonConverter + : JsonConverter { public override bool CanConvert(global::System.Type typeToConvert) => - typeof(DocPagesRotate200ResponseLayoutNamedPagesItemTarget).IsAssignableFrom( - typeToConvert - ); + typeof(ChangeItemPagesDeleteLayoutNamedPagesItemTarget).IsAssignableFrom(typeToConvert); - public override DocPagesRotate200ResponseLayoutNamedPagesItemTarget Read( + public override ChangeItemPagesDeleteLayoutNamedPagesItemTarget Read( ref Utf8JsonReader reader, global::System.Type typeToConvert, JsonSerializerOptions options @@ -257,34 +253,34 @@ JsonSerializerOptions options var value = discriminator switch { "page" => - jsonWithoutDiscriminator.Deserialize( + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage" + "Failed to deserialize CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetPage" ), "template" => - jsonWithoutDiscriminator.Deserialize( + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate" + "Failed to deserialize CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetTemplate" ), "dangling" => - jsonWithoutDiscriminator.Deserialize( + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetDangling" + "Failed to deserialize CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetDangling" ), _ => json.Deserialize(options), }; - return new DocPagesRotate200ResponseLayoutNamedPagesItemTarget(discriminator, value); + return new ChangeItemPagesDeleteLayoutNamedPagesItemTarget(discriminator, value); } public override void Write( Utf8JsonWriter writer, - DocPagesRotate200ResponseLayoutNamedPagesItemTarget value, + ChangeItemPagesDeleteLayoutNamedPagesItemTarget value, JsonSerializerOptions options ) { @@ -300,7 +296,7 @@ JsonSerializerOptions options json.WriteTo(writer, options); } - public override DocPagesRotate200ResponseLayoutNamedPagesItemTarget ReadAsPropertyName( + public override ChangeItemPagesDeleteLayoutNamedPagesItemTarget ReadAsPropertyName( ref Utf8JsonReader reader, global::System.Type typeToConvert, JsonSerializerOptions options @@ -309,15 +305,12 @@ JsonSerializerOptions options var stringValue = reader.GetString() ?? throw new JsonException("The JSON property name could not be read as a string."); - return new DocPagesRotate200ResponseLayoutNamedPagesItemTarget( - stringValue, - stringValue - ); + return new ChangeItemPagesDeleteLayoutNamedPagesItemTarget(stringValue, stringValue); } public override void WriteAsPropertyName( Utf8JsonWriter writer, - DocPagesRotate200ResponseLayoutNamedPagesItemTarget value, + ChangeItemPagesDeleteLayoutNamedPagesItemTarget value, JsonSerializerOptions options ) { @@ -331,17 +324,17 @@ JsonSerializerOptions options [Serializable] public struct Page { - public Page(CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage value) + public Page(CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetPage value) { Value = value; } - internal CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage Value { get; set; } + internal CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetPage Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Page( - CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage value + public static implicit operator ChangeItemPagesDeleteLayoutNamedPagesItemTarget.Page( + CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetPage value ) => new(value); } @@ -351,17 +344,17 @@ CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage value [Serializable] public struct Template { - public Template(CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate value) + public Template(CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetTemplate value) { Value = value; } - internal CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate Value { get; set; } + internal CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetTemplate Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Template( - CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate value + public static implicit operator ChangeItemPagesDeleteLayoutNamedPagesItemTarget.Template( + CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetTemplate value ) => new(value); } @@ -371,17 +364,17 @@ CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate value [Serializable] public struct Dangling { - public Dangling(CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetDangling value) + public Dangling(CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetDangling value) { Value = value; } - internal CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetDangling Value { get; set; } + internal CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetDangling Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocPagesRotate200ResponseLayoutNamedPagesItemTarget.Dangling( - CloudPDF.DocPagesRotate200ResponseLayoutNamedPagesItemTargetDangling value + public static implicit operator ChangeItemPagesDeleteLayoutNamedPagesItemTarget.Dangling( + CloudPDF.ChangeItemPagesDeleteLayoutNamedPagesItemTargetDangling value ) => new(value); } } diff --git a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItemTargetDangling.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItemTargetDangling.cs similarity index 86% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItemTargetDangling.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItemTargetDangling.cs index e235db5a..9ef71ee5 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItemTargetDangling.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItemTargetDangling.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsert200ResponseLayoutNamedPagesItemTargetDangling : IJsonOnDeserialized +public record ChangeItemPagesDeleteLayoutNamedPagesItemTargetDangling : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItemTargetPage.cs similarity index 88% rename from src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItemTargetPage.cs index 56724db3..758c94c8 100644 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItemTargetPage.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesRotate200ResponseLayoutNamedPagesItemTargetPage : IJsonOnDeserialized +public record ChangeItemPagesDeleteLayoutNamedPagesItemTargetPage : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItemTargetTemplate.cs similarity index 88% rename from src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItemTargetTemplate.cs index 8a4d17b3..1ad8531a 100644 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutNamedPagesItemTargetTemplate.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesRotate200ResponseLayoutNamedPagesItemTargetTemplate : IJsonOnDeserialized +public record ChangeItemPagesDeleteLayoutNamedPagesItemTargetTemplate : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItem.cs similarity index 74% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItem.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItem.cs index e05e69bf..7cf728ca 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItem.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItem.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesDelete200ResponseLayoutPagesItem : IJsonOnDeserialized +public record ChangeItemPagesDeleteLayoutPagesItem : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -21,7 +21,7 @@ public record DocPagesDelete200ResponseLayoutPagesItem : IJsonOnDeserialized public string? Label { get; set; } [JsonPropertyName("size")] - public required DocPagesDelete200ResponseLayoutPagesItemSize Size { get; set; } + public required ChangeItemPagesDeleteLayoutPagesItemSize Size { get; set; } [JsonPropertyName("rotation")] public required double Rotation { get; set; } @@ -30,13 +30,13 @@ public record DocPagesDelete200ResponseLayoutPagesItem : IJsonOnDeserialized public required double UserUnit { get; set; } [JsonPropertyName("tabOrder")] - public DocPagesDelete200ResponseLayoutPagesItemTabOrder? TabOrder { get; set; } + public ChangeItemPagesDeleteLayoutPagesItemTabOrder? TabOrder { get; set; } [JsonPropertyName("boxes")] - public required DocPagesDelete200ResponseLayoutPagesItemBoxes Boxes { get; set; } + public required ChangeItemPagesDeleteLayoutPagesItemBoxes Boxes { get; set; } [JsonPropertyName("pdfCropBox")] - public required DocPagesDelete200ResponseLayoutPagesItemPdfCropBox PdfCropBox { get; set; } + public required ChangeItemPagesDeleteLayoutPagesItemPdfCropBox PdfCropBox { get; set; } [JsonPropertyName("actions")] public PdfPageActions? Actions { get; set; } diff --git a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxes.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxes.cs similarity index 59% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxes.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxes.cs index 43433b9f..283de973 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxes.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxes.cs @@ -5,26 +5,26 @@ namespace CloudPDF; [Serializable] -public record DocPagesDelete200ResponseLayoutPagesItemBoxes : IJsonOnDeserialized +public record ChangeItemPagesDeleteLayoutPagesItemBoxes : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = new Dictionary(); [JsonPropertyName("media")] - public required DocPagesDelete200ResponseLayoutPagesItemBoxesMedia Media { get; set; } + public required ChangeItemPagesDeleteLayoutPagesItemBoxesMedia Media { get; set; } [JsonPropertyName("crop")] - public required DocPagesDelete200ResponseLayoutPagesItemBoxesCrop Crop { get; set; } + public required ChangeItemPagesDeleteLayoutPagesItemBoxesCrop Crop { get; set; } [JsonPropertyName("bleed")] - public required DocPagesDelete200ResponseLayoutPagesItemBoxesBleed Bleed { get; set; } + public required ChangeItemPagesDeleteLayoutPagesItemBoxesBleed Bleed { get; set; } [JsonPropertyName("trim")] - public required DocPagesDelete200ResponseLayoutPagesItemBoxesTrim Trim { get; set; } + public required ChangeItemPagesDeleteLayoutPagesItemBoxesTrim Trim { get; set; } [JsonPropertyName("art")] - public required DocPagesDelete200ResponseLayoutPagesItemBoxesArt Art { get; set; } + public required ChangeItemPagesDeleteLayoutPagesItemBoxesArt Art { get; set; } [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxesArt.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesArt.cs similarity index 91% rename from src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxesArt.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesArt.cs index e6486122..d404ac23 100644 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxesArt.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesArt.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesRotate200ResponseLayoutPagesItemBoxesArt : IJsonOnDeserialized +public record ChangeItemPagesDeleteLayoutPagesItemBoxesArt : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesArt.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesBleed.cs similarity index 91% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesArt.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesBleed.cs index 084a7caf..7cd7ded6 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesArt.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesBleed.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesDelete200ResponseLayoutPagesItemBoxesArt : IJsonOnDeserialized +public record ChangeItemPagesDeleteLayoutPagesItemBoxesBleed : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxesArt.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesCrop.cs similarity index 91% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxesArt.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesCrop.cs index 58a4ffdc..8e41f895 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxesArt.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesCrop.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsert200ResponseLayoutPagesItemBoxesArt : IJsonOnDeserialized +public record ChangeItemPagesDeleteLayoutPagesItemBoxesCrop : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesTrim.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesMedia.cs similarity index 91% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesTrim.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesMedia.cs index 18d8a9a0..2920f891 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesTrim.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesMedia.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesDelete200ResponseLayoutPagesItemBoxesTrim : IJsonOnDeserialized +public record ChangeItemPagesDeleteLayoutPagesItemBoxesMedia : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesTrim.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesTrim.cs new file mode 100644 index 00000000..363823b0 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemBoxesTrim.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesDeleteLayoutPagesItemBoxesTrim : 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/DocPagesDelete200ResponseLayoutPagesItemPdfCropBox.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemPdfCropBox.cs similarity index 91% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemPdfCropBox.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemPdfCropBox.cs index 9837a7ca..8a904135 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemPdfCropBox.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemPdfCropBox.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesDelete200ResponseLayoutPagesItemPdfCropBox : IJsonOnDeserialized +public record ChangeItemPagesDeleteLayoutPagesItemPdfCropBox : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemSize.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemSize.cs similarity index 90% rename from src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemSize.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemSize.cs index 3f610b10..416a3069 100644 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemSize.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemSize.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesRotate200ResponseLayoutPagesItemSize : IJsonOnDeserialized +public record ChangeItemPagesDeleteLayoutPagesItemSize : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemTabOrder.cs b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemTabOrder.cs similarity index 56% rename from src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemTabOrder.cs rename to src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemTabOrder.cs index fa1aa8ac..2e62aa94 100644 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemTabOrder.cs +++ b/src/CloudPDF/Types/ChangeItemPagesDeleteLayoutPagesItemTabOrder.cs @@ -5,30 +5,30 @@ namespace CloudPDF; [JsonConverter( - typeof(DocPagesRotate200ResponseLayoutPagesItemTabOrder.DocPagesRotate200ResponseLayoutPagesItemTabOrderSerializer) + typeof(ChangeItemPagesDeleteLayoutPagesItemTabOrder.ChangeItemPagesDeleteLayoutPagesItemTabOrderSerializer) )] [Serializable] -public readonly record struct DocPagesRotate200ResponseLayoutPagesItemTabOrder : IStringEnum +public readonly record struct ChangeItemPagesDeleteLayoutPagesItemTabOrder : IStringEnum { - public static readonly DocPagesRotate200ResponseLayoutPagesItemTabOrder Rows = new(Values.Rows); + public static readonly ChangeItemPagesDeleteLayoutPagesItemTabOrder Rows = new(Values.Rows); - public static readonly DocPagesRotate200ResponseLayoutPagesItemTabOrder Columns = new( + public static readonly ChangeItemPagesDeleteLayoutPagesItemTabOrder Columns = new( Values.Columns ); - public static readonly DocPagesRotate200ResponseLayoutPagesItemTabOrder Structure = new( + public static readonly ChangeItemPagesDeleteLayoutPagesItemTabOrder Structure = new( Values.Structure ); - public static readonly DocPagesRotate200ResponseLayoutPagesItemTabOrder Annotations = new( + public static readonly ChangeItemPagesDeleteLayoutPagesItemTabOrder Annotations = new( Values.Annotations ); - public static readonly DocPagesRotate200ResponseLayoutPagesItemTabOrder Widgets = new( + public static readonly ChangeItemPagesDeleteLayoutPagesItemTabOrder Widgets = new( Values.Widgets ); - public DocPagesRotate200ResponseLayoutPagesItemTabOrder(string value) + public ChangeItemPagesDeleteLayoutPagesItemTabOrder(string value) { Value = value; } @@ -41,9 +41,9 @@ public DocPagesRotate200ResponseLayoutPagesItemTabOrder(string value) /// /// Create a string enum with the given value. /// - public static DocPagesRotate200ResponseLayoutPagesItemTabOrder FromCustom(string value) + public static ChangeItemPagesDeleteLayoutPagesItemTabOrder FromCustom(string value) { - return new DocPagesRotate200ResponseLayoutPagesItemTabOrder(value); + return new ChangeItemPagesDeleteLayoutPagesItemTabOrder(value); } public bool Equals(string? other) @@ -60,27 +60,25 @@ public override string ToString() } public static bool operator ==( - DocPagesRotate200ResponseLayoutPagesItemTabOrder value1, + ChangeItemPagesDeleteLayoutPagesItemTabOrder value1, string value2 ) => value1.Value.Equals(value2); public static bool operator !=( - DocPagesRotate200ResponseLayoutPagesItemTabOrder value1, + ChangeItemPagesDeleteLayoutPagesItemTabOrder value1, string value2 ) => !value1.Value.Equals(value2); - public static explicit operator string( - DocPagesRotate200ResponseLayoutPagesItemTabOrder value - ) => value.Value; + public static explicit operator string(ChangeItemPagesDeleteLayoutPagesItemTabOrder value) => + value.Value; - public static explicit operator DocPagesRotate200ResponseLayoutPagesItemTabOrder( - string value - ) => new(value); + public static explicit operator ChangeItemPagesDeleteLayoutPagesItemTabOrder(string value) => + new(value); - internal class DocPagesRotate200ResponseLayoutPagesItemTabOrderSerializer - : JsonConverter + internal class ChangeItemPagesDeleteLayoutPagesItemTabOrderSerializer + : JsonConverter { - public override DocPagesRotate200ResponseLayoutPagesItemTabOrder Read( + public override ChangeItemPagesDeleteLayoutPagesItemTabOrder Read( ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options @@ -91,19 +89,19 @@ JsonSerializerOptions options ?? throw new global::System.Exception( "The JSON value could not be read as a string." ); - return new DocPagesRotate200ResponseLayoutPagesItemTabOrder(stringValue); + return new ChangeItemPagesDeleteLayoutPagesItemTabOrder(stringValue); } public override void Write( Utf8JsonWriter writer, - DocPagesRotate200ResponseLayoutPagesItemTabOrder value, + ChangeItemPagesDeleteLayoutPagesItemTabOrder value, JsonSerializerOptions options ) { writer.WriteStringValue(value.Value); } - public override DocPagesRotate200ResponseLayoutPagesItemTabOrder ReadAsPropertyName( + public override ChangeItemPagesDeleteLayoutPagesItemTabOrder ReadAsPropertyName( ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options @@ -114,12 +112,12 @@ JsonSerializerOptions options ?? throw new global::System.Exception( "The JSON property name could not be read as a string." ); - return new DocPagesRotate200ResponseLayoutPagesItemTabOrder(stringValue); + return new ChangeItemPagesDeleteLayoutPagesItemTabOrder(stringValue); } public override void WriteAsPropertyName( Utf8JsonWriter writer, - DocPagesRotate200ResponseLayoutPagesItemTabOrder value, + ChangeItemPagesDeleteLayoutPagesItemTabOrder value, JsonSerializerOptions options ) { diff --git a/src/CloudPDF/Types/DocPagesInsert200Response.cs b/src/CloudPDF/Types/ChangeItemPagesInsert.cs similarity index 86% rename from src/CloudPDF/Types/DocPagesInsert200Response.cs rename to src/CloudPDF/Types/ChangeItemPagesInsert.cs index 4a09e993..60ee69d1 100644 --- a/src/CloudPDF/Types/DocPagesInsert200Response.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsert.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsert200Response : IJsonOnDeserialized +public record ChangeItemPagesInsert : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -15,7 +15,7 @@ public record DocPagesInsert200Response : IJsonOnDeserialized public IEnumerable InsertedPages { get; set; } = new List(); [JsonPropertyName("layout")] - public required DocPagesInsert200ResponseLayout Layout { get; set; } + public required ChangeItemPagesInsertLayout Layout { get; set; } [JsonPropertyName("meta")] public required MutationMeta Meta { get; set; } diff --git a/src/CloudPDF/Types/DocPagesInsertBlank200Response.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlank.cs similarity index 85% rename from src/CloudPDF/Types/DocPagesInsertBlank200Response.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlank.cs index 6ea5ccb3..6b784b45 100644 --- a/src/CloudPDF/Types/DocPagesInsertBlank200Response.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlank.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsertBlank200Response : IJsonOnDeserialized +public record ChangeItemPagesInsertBlank : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -15,7 +15,7 @@ public record DocPagesInsertBlank200Response : IJsonOnDeserialized public IEnumerable InsertedPages { get; set; } = new List(); [JsonPropertyName("layout")] - public required DocPagesInsertBlank200ResponseLayout Layout { get; set; } + public required ChangeItemPagesInsertBlankLayout Layout { get; set; } [JsonPropertyName("meta")] public required MutationMeta Meta { get; set; } diff --git a/src/CloudPDF/Types/DocPagesReorder200ResponseLayout.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayout.cs similarity index 72% rename from src/CloudPDF/Types/DocPagesReorder200ResponseLayout.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayout.cs index 3a03188c..3a43363b 100644 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayout.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayout.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesReorder200ResponseLayout : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayout : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -15,12 +15,12 @@ public record DocPagesReorder200ResponseLayout : IJsonOnDeserialized public required int PageCount { get; set; } [JsonPropertyName("pages")] - public IEnumerable Pages { get; set; } = - new List(); + public IEnumerable Pages { get; set; } = + new List(); [JsonPropertyName("namedPages")] - public IEnumerable NamedPages { get; set; } = - new List(); + public IEnumerable NamedPages { get; set; } = + new List(); [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItem.cs similarity index 86% rename from src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItem.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItem.cs index ab3efb25..16431fe8 100644 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItem.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItem.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesReorder200ResponseLayoutNamedPagesItem : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayoutNamedPagesItem : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -15,7 +15,7 @@ public record DocPagesReorder200ResponseLayoutNamedPagesItem : IJsonOnDeserializ public required string Name { get; set; } [JsonPropertyName("target")] - public required DocPagesReorder200ResponseLayoutNamedPagesItemTarget Target { get; set; } + public required ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget Target { get; set; } [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItemTarget.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.cs similarity index 64% rename from src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItemTarget.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.cs index 9b7788f3..eb08e98d 100644 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItemTarget.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.cs @@ -8,21 +8,21 @@ namespace CloudPDF; -[JsonConverter(typeof(DocPagesReorder200ResponseLayoutNamedPagesItemTarget.JsonConverter))] +[JsonConverter(typeof(ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.JsonConverter))] [Serializable] -public record DocPagesReorder200ResponseLayoutNamedPagesItemTarget +public record ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget { - internal DocPagesReorder200ResponseLayoutNamedPagesItemTarget(string type, object? value) + internal ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget(string type, object? value) { Kind = type; Value = value; } /// - /// Create an instance of DocPagesReorder200ResponseLayoutNamedPagesItemTarget with . + /// Create an instance of ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget with . /// - public DocPagesReorder200ResponseLayoutNamedPagesItemTarget( - DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Page value + public ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget( + ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.Page value ) { Kind = "page"; @@ -30,10 +30,10 @@ DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Page value } /// - /// Create an instance of DocPagesReorder200ResponseLayoutNamedPagesItemTarget with . + /// Create an instance of ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget with . /// - public DocPagesReorder200ResponseLayoutNamedPagesItemTarget( - DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Template value + public ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget( + ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.Template value ) { Kind = "template"; @@ -41,10 +41,10 @@ DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Template value } /// - /// Create an instance of DocPagesReorder200ResponseLayoutNamedPagesItemTarget with . + /// Create an instance of ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget with . /// - public DocPagesReorder200ResponseLayoutNamedPagesItemTarget( - DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Dangling value + public ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget( + ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.Dangling value ) { Kind = "dangling"; @@ -78,42 +78,42 @@ DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Dangling value public bool IsDangling => Kind == "dangling"; /// - /// Returns the value as a if is 'page', otherwise throws an exception. + /// Returns the value as a if is 'page', otherwise throws an exception. /// /// Thrown when is not 'page'. - public CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage AsPage() => + public CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetPage AsPage() => IsPage - ? (CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage)Value! + ? (CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetPage)Value! : throw new global::System.Exception( - "DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Kind is not 'page'" + "ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.Kind is not 'page'" ); /// - /// Returns the value as a if is 'template', otherwise throws an exception. + /// Returns the value as a if is 'template', otherwise throws an exception. /// /// Thrown when is not 'template'. - public CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate AsTemplate() => + public CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetTemplate AsTemplate() => IsTemplate - ? (CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate)Value! + ? (CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetTemplate)Value! : throw new global::System.Exception( - "DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Kind is not 'template'" + "ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.Kind is not 'template'" ); /// - /// Returns the value as a if is 'dangling', otherwise throws an exception. + /// Returns the value as a if is 'dangling', otherwise throws an exception. /// /// Thrown when is not 'dangling'. - public CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetDangling AsDangling() => + public CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetDangling AsDangling() => IsDangling - ? (CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetDangling)Value! + ? (CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetDangling)Value! : throw new global::System.Exception( - "DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Kind is not 'dangling'" + "ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.Kind is not 'dangling'" ); public T Match( - Func onPage, - Func onTemplate, - Func onDangling, + Func onPage, + Func onTemplate, + Func onDangling, Func onUnknown_ ) { @@ -127,9 +127,9 @@ public T Match( } public void Visit( - Action onPage, - Action onTemplate, - Action onDangling, + Action onPage, + Action onTemplate, + Action onDangling, Action onUnknown_ ) { @@ -151,15 +151,15 @@ public void Visit( } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// public bool TryAsPage( - out CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage? value + out CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetPage? value ) { if (Kind == "page") { - value = (CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage)Value!; + value = (CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetPage)Value!; return true; } value = null; @@ -167,15 +167,15 @@ out CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage? value } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// public bool TryAsTemplate( - out CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate? value + out CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetTemplate? value ) { if (Kind == "template") { - value = (CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate)Value!; + value = (CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetTemplate)Value!; return true; } value = null; @@ -183,15 +183,15 @@ out CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate? value } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// public bool TryAsDangling( - out CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetDangling? value + out CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetDangling? value ) { if (Kind == "dangling") { - value = (CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetDangling)Value!; + value = (CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetDangling)Value!; return true; } value = null; @@ -200,28 +200,28 @@ out CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetDangling? value public override string ToString() => JsonUtils.Serialize(this); - public static implicit operator DocPagesReorder200ResponseLayoutNamedPagesItemTarget( - DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Page value + public static implicit operator ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget( + ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.Page value ) => new(value); - public static implicit operator DocPagesReorder200ResponseLayoutNamedPagesItemTarget( - DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Template value + public static implicit operator ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget( + ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.Template value ) => new(value); - public static implicit operator DocPagesReorder200ResponseLayoutNamedPagesItemTarget( - DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Dangling value + public static implicit operator ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget( + ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.Dangling value ) => new(value); [Serializable] internal sealed class JsonConverter - : JsonConverter + : JsonConverter { public override bool CanConvert(global::System.Type typeToConvert) => - typeof(DocPagesReorder200ResponseLayoutNamedPagesItemTarget).IsAssignableFrom( + typeof(ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget).IsAssignableFrom( typeToConvert ); - public override DocPagesReorder200ResponseLayoutNamedPagesItemTarget Read( + public override ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget Read( ref Utf8JsonReader reader, global::System.Type typeToConvert, JsonSerializerOptions options @@ -257,34 +257,34 @@ JsonSerializerOptions options var value = discriminator switch { "page" => - jsonWithoutDiscriminator.Deserialize( + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage" + "Failed to deserialize CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetPage" ), "template" => - jsonWithoutDiscriminator.Deserialize( + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate" + "Failed to deserialize CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetTemplate" ), "dangling" => - jsonWithoutDiscriminator.Deserialize( + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetDangling" + "Failed to deserialize CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetDangling" ), _ => json.Deserialize(options), }; - return new DocPagesReorder200ResponseLayoutNamedPagesItemTarget(discriminator, value); + return new ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget(discriminator, value); } public override void Write( Utf8JsonWriter writer, - DocPagesReorder200ResponseLayoutNamedPagesItemTarget value, + ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget value, JsonSerializerOptions options ) { @@ -300,7 +300,7 @@ JsonSerializerOptions options json.WriteTo(writer, options); } - public override DocPagesReorder200ResponseLayoutNamedPagesItemTarget ReadAsPropertyName( + public override ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget ReadAsPropertyName( ref Utf8JsonReader reader, global::System.Type typeToConvert, JsonSerializerOptions options @@ -309,7 +309,7 @@ JsonSerializerOptions options var stringValue = reader.GetString() ?? throw new JsonException("The JSON property name could not be read as a string."); - return new DocPagesReorder200ResponseLayoutNamedPagesItemTarget( + return new ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget( stringValue, stringValue ); @@ -317,7 +317,7 @@ JsonSerializerOptions options public override void WriteAsPropertyName( Utf8JsonWriter writer, - DocPagesReorder200ResponseLayoutNamedPagesItemTarget value, + ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget value, JsonSerializerOptions options ) { @@ -331,17 +331,17 @@ JsonSerializerOptions options [Serializable] public struct Page { - public Page(CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage value) + public Page(CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetPage value) { Value = value; } - internal CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage Value { get; set; } + internal CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetPage Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Page( - CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage value + public static implicit operator ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.Page( + CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetPage value ) => new(value); } @@ -351,17 +351,17 @@ CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage value [Serializable] public struct Template { - public Template(CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate value) + public Template(CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetTemplate value) { Value = value; } - internal CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate Value { get; set; } + internal CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetTemplate Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Template( - CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate value + public static implicit operator ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.Template( + CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetTemplate value ) => new(value); } @@ -371,17 +371,17 @@ CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate value [Serializable] public struct Dangling { - public Dangling(CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetDangling value) + public Dangling(CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetDangling value) { Value = value; } - internal CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetDangling Value { get; set; } + internal CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetDangling Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocPagesReorder200ResponseLayoutNamedPagesItemTarget.Dangling( - CloudPDF.DocPagesReorder200ResponseLayoutNamedPagesItemTargetDangling value + public static implicit operator ChangeItemPagesInsertBlankLayoutNamedPagesItemTarget.Dangling( + CloudPDF.ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetDangling value ) => new(value); } } diff --git a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItemTargetDangling.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetDangling.cs similarity index 91% rename from src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItemTargetDangling.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetDangling.cs index 1c43c2f5..7030582c 100644 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItemTargetDangling.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetDangling.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesReorder200ResponseLayoutNamedPagesItemTargetDangling : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetDangling : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetPage.cs similarity index 91% rename from src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetPage.cs index b6a1f998..e47b9db1 100644 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetPage.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesReorder200ResponseLayoutNamedPagesItemTargetPage : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetPage : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetTemplate.cs similarity index 92% rename from src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetTemplate.cs index c3424f2b..da4feef9 100644 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetTemplate.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesReorder200ResponseLayoutNamedPagesItemTargetTemplate : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayoutNamedPagesItemTargetTemplate : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItem.cs similarity index 80% rename from src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItem.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItem.cs index b5af7ce2..95667f00 100644 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItem.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItem.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesReorder200ResponseLayoutPagesItem : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayoutPagesItem : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -21,7 +21,7 @@ public record DocPagesReorder200ResponseLayoutPagesItem : IJsonOnDeserialized public string? Label { get; set; } [JsonPropertyName("size")] - public required DocPagesReorder200ResponseLayoutPagesItemSize Size { get; set; } + public required ChangeItemPagesInsertBlankLayoutPagesItemSize Size { get; set; } [JsonPropertyName("rotation")] public required double Rotation { get; set; } @@ -30,13 +30,13 @@ public record DocPagesReorder200ResponseLayoutPagesItem : IJsonOnDeserialized public required double UserUnit { get; set; } [JsonPropertyName("tabOrder")] - public DocPagesReorder200ResponseLayoutPagesItemTabOrder? TabOrder { get; set; } + public ChangeItemPagesInsertBlankLayoutPagesItemTabOrder? TabOrder { get; set; } [JsonPropertyName("boxes")] - public required DocPagesReorder200ResponseLayoutPagesItemBoxes Boxes { get; set; } + public required ChangeItemPagesInsertBlankLayoutPagesItemBoxes Boxes { get; set; } [JsonPropertyName("pdfCropBox")] - public required DocPagesReorder200ResponseLayoutPagesItemPdfCropBox PdfCropBox { get; set; } + public required ChangeItemPagesInsertBlankLayoutPagesItemPdfCropBox PdfCropBox { get; set; } [JsonPropertyName("actions")] public PdfPageActions? Actions { get; set; } diff --git a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxes.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxes.cs similarity index 70% rename from src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxes.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxes.cs index 68b7b205..2069fab3 100644 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxes.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxes.cs @@ -5,26 +5,26 @@ namespace CloudPDF; [Serializable] -public record DocPagesReorder200ResponseLayoutPagesItemBoxes : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayoutPagesItemBoxes : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = new Dictionary(); [JsonPropertyName("media")] - public required DocPagesReorder200ResponseLayoutPagesItemBoxesMedia Media { get; set; } + public required ChangeItemPagesInsertBlankLayoutPagesItemBoxesMedia Media { get; set; } [JsonPropertyName("crop")] - public required DocPagesReorder200ResponseLayoutPagesItemBoxesCrop Crop { get; set; } + public required ChangeItemPagesInsertBlankLayoutPagesItemBoxesCrop Crop { get; set; } [JsonPropertyName("bleed")] - public required DocPagesReorder200ResponseLayoutPagesItemBoxesBleed Bleed { get; set; } + public required ChangeItemPagesInsertBlankLayoutPagesItemBoxesBleed Bleed { get; set; } [JsonPropertyName("trim")] - public required DocPagesReorder200ResponseLayoutPagesItemBoxesTrim Trim { get; set; } + public required ChangeItemPagesInsertBlankLayoutPagesItemBoxesTrim Trim { get; set; } [JsonPropertyName("art")] - public required DocPagesReorder200ResponseLayoutPagesItemBoxesArt Art { get; set; } + public required ChangeItemPagesInsertBlankLayoutPagesItemBoxesArt Art { get; set; } [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesCrop.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesArt.cs similarity index 93% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesCrop.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesArt.cs index 107eed46..12a57e49 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesCrop.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesArt.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesDelete200ResponseLayoutPagesItemBoxesCrop : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayoutPagesItemBoxesArt : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxesBleed.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesBleed.cs similarity index 93% rename from src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxesBleed.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesBleed.cs index 1c810b62..92038945 100644 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxesBleed.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesBleed.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesReorder200ResponseLayoutPagesItemBoxesBleed : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayoutPagesItemBoxesBleed : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxesBleed.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesCrop.cs similarity index 93% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxesBleed.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesCrop.cs index b534e6e5..5c978d04 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxesBleed.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesCrop.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsert200ResponseLayoutPagesItemBoxesBleed : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayoutPagesItemBoxesCrop : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxesMedia.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesMedia.cs similarity index 93% rename from src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxesMedia.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesMedia.cs index fb12e973..15328fa0 100644 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxesMedia.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesMedia.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesReorder200ResponseLayoutPagesItemBoxesMedia : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayoutPagesItemBoxesMedia : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxesMedia.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesTrim.cs similarity index 93% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxesMedia.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesTrim.cs index 2f5e33af..0b4a5002 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxesMedia.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemBoxesTrim.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsert200ResponseLayoutPagesItemBoxesMedia : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayoutPagesItemBoxesTrim : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemPdfCropBox.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemPdfCropBox.cs similarity index 93% rename from src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemPdfCropBox.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemPdfCropBox.cs index a54e7aa7..35acc32a 100644 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemPdfCropBox.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemPdfCropBox.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesReorder200ResponseLayoutPagesItemPdfCropBox : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayoutPagesItemPdfCropBox : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemSize.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemSize.cs similarity index 92% rename from src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemSize.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemSize.cs index bbfb07d7..40f367dd 100644 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemSize.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemSize.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesReorder200ResponseLayoutPagesItemSize : IJsonOnDeserialized +public record ChangeItemPagesInsertBlankLayoutPagesItemSize : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemTabOrder.cs b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemTabOrder.cs similarity index 67% rename from src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemTabOrder.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemTabOrder.cs index 8a89e0bf..29cddb77 100644 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemTabOrder.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertBlankLayoutPagesItemTabOrder.cs @@ -5,32 +5,32 @@ namespace CloudPDF; [JsonConverter( - typeof(DocPagesReorder200ResponseLayoutPagesItemTabOrder.DocPagesReorder200ResponseLayoutPagesItemTabOrderSerializer) + typeof(ChangeItemPagesInsertBlankLayoutPagesItemTabOrder.ChangeItemPagesInsertBlankLayoutPagesItemTabOrderSerializer) )] [Serializable] -public readonly record struct DocPagesReorder200ResponseLayoutPagesItemTabOrder : IStringEnum +public readonly record struct ChangeItemPagesInsertBlankLayoutPagesItemTabOrder : IStringEnum { - public static readonly DocPagesReorder200ResponseLayoutPagesItemTabOrder Rows = new( + public static readonly ChangeItemPagesInsertBlankLayoutPagesItemTabOrder Rows = new( Values.Rows ); - public static readonly DocPagesReorder200ResponseLayoutPagesItemTabOrder Columns = new( + public static readonly ChangeItemPagesInsertBlankLayoutPagesItemTabOrder Columns = new( Values.Columns ); - public static readonly DocPagesReorder200ResponseLayoutPagesItemTabOrder Structure = new( + public static readonly ChangeItemPagesInsertBlankLayoutPagesItemTabOrder Structure = new( Values.Structure ); - public static readonly DocPagesReorder200ResponseLayoutPagesItemTabOrder Annotations = new( + public static readonly ChangeItemPagesInsertBlankLayoutPagesItemTabOrder Annotations = new( Values.Annotations ); - public static readonly DocPagesReorder200ResponseLayoutPagesItemTabOrder Widgets = new( + public static readonly ChangeItemPagesInsertBlankLayoutPagesItemTabOrder Widgets = new( Values.Widgets ); - public DocPagesReorder200ResponseLayoutPagesItemTabOrder(string value) + public ChangeItemPagesInsertBlankLayoutPagesItemTabOrder(string value) { Value = value; } @@ -43,9 +43,9 @@ public DocPagesReorder200ResponseLayoutPagesItemTabOrder(string value) /// /// Create a string enum with the given value. /// - public static DocPagesReorder200ResponseLayoutPagesItemTabOrder FromCustom(string value) + public static ChangeItemPagesInsertBlankLayoutPagesItemTabOrder FromCustom(string value) { - return new DocPagesReorder200ResponseLayoutPagesItemTabOrder(value); + return new ChangeItemPagesInsertBlankLayoutPagesItemTabOrder(value); } public bool Equals(string? other) @@ -62,27 +62,27 @@ public override string ToString() } public static bool operator ==( - DocPagesReorder200ResponseLayoutPagesItemTabOrder value1, + ChangeItemPagesInsertBlankLayoutPagesItemTabOrder value1, string value2 ) => value1.Value.Equals(value2); public static bool operator !=( - DocPagesReorder200ResponseLayoutPagesItemTabOrder value1, + ChangeItemPagesInsertBlankLayoutPagesItemTabOrder value1, string value2 ) => !value1.Value.Equals(value2); public static explicit operator string( - DocPagesReorder200ResponseLayoutPagesItemTabOrder value + ChangeItemPagesInsertBlankLayoutPagesItemTabOrder value ) => value.Value; - public static explicit operator DocPagesReorder200ResponseLayoutPagesItemTabOrder( + public static explicit operator ChangeItemPagesInsertBlankLayoutPagesItemTabOrder( string value ) => new(value); - internal class DocPagesReorder200ResponseLayoutPagesItemTabOrderSerializer - : JsonConverter + internal class ChangeItemPagesInsertBlankLayoutPagesItemTabOrderSerializer + : JsonConverter { - public override DocPagesReorder200ResponseLayoutPagesItemTabOrder Read( + public override ChangeItemPagesInsertBlankLayoutPagesItemTabOrder Read( ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options @@ -93,19 +93,19 @@ JsonSerializerOptions options ?? throw new global::System.Exception( "The JSON value could not be read as a string." ); - return new DocPagesReorder200ResponseLayoutPagesItemTabOrder(stringValue); + return new ChangeItemPagesInsertBlankLayoutPagesItemTabOrder(stringValue); } public override void Write( Utf8JsonWriter writer, - DocPagesReorder200ResponseLayoutPagesItemTabOrder value, + ChangeItemPagesInsertBlankLayoutPagesItemTabOrder value, JsonSerializerOptions options ) { writer.WriteStringValue(value.Value); } - public override DocPagesReorder200ResponseLayoutPagesItemTabOrder ReadAsPropertyName( + public override ChangeItemPagesInsertBlankLayoutPagesItemTabOrder ReadAsPropertyName( ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options @@ -116,12 +116,12 @@ JsonSerializerOptions options ?? throw new global::System.Exception( "The JSON property name could not be read as a string." ); - return new DocPagesReorder200ResponseLayoutPagesItemTabOrder(stringValue); + return new ChangeItemPagesInsertBlankLayoutPagesItemTabOrder(stringValue); } public override void WriteAsPropertyName( Utf8JsonWriter writer, - DocPagesReorder200ResponseLayoutPagesItemTabOrder value, + ChangeItemPagesInsertBlankLayoutPagesItemTabOrder value, JsonSerializerOptions options ) { diff --git a/src/CloudPDF/Types/DocPagesRotate200ResponseLayout.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayout.cs similarity index 67% rename from src/CloudPDF/Types/DocPagesRotate200ResponseLayout.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertLayout.cs index eb91043e..cbe48896 100644 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayout.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayout.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesRotate200ResponseLayout : IJsonOnDeserialized +public record ChangeItemPagesInsertLayout : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -15,12 +15,12 @@ public record DocPagesRotate200ResponseLayout : IJsonOnDeserialized public required int PageCount { get; set; } [JsonPropertyName("pages")] - public IEnumerable Pages { get; set; } = - new List(); + public IEnumerable Pages { get; set; } = + new List(); [JsonPropertyName("namedPages")] - public IEnumerable NamedPages { get; set; } = - new List(); + public IEnumerable NamedPages { get; set; } = + new List(); [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItem.cs similarity index 80% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItem.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItem.cs index a214f095..4cbc902f 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItem.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItem.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsert200ResponseLayoutNamedPagesItem : IJsonOnDeserialized +public record ChangeItemPagesInsertLayoutNamedPagesItem : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -15,7 +15,7 @@ public record DocPagesInsert200ResponseLayoutNamedPagesItem : IJsonOnDeserialize public required string Name { get; set; } [JsonPropertyName("target")] - public required DocPagesInsert200ResponseLayoutNamedPagesItemTarget Target { get; set; } + public required ChangeItemPagesInsertLayoutNamedPagesItemTarget Target { get; set; } [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItemTarget.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItemTarget.cs new file mode 100644 index 00000000..44afe988 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItemTarget.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(ChangeItemPagesInsertLayoutNamedPagesItemTarget.JsonConverter))] +[Serializable] +public record ChangeItemPagesInsertLayoutNamedPagesItemTarget +{ + internal ChangeItemPagesInsertLayoutNamedPagesItemTarget(string type, object? value) + { + Kind = type; + Value = value; + } + + /// + /// Create an instance of ChangeItemPagesInsertLayoutNamedPagesItemTarget with . + /// + public ChangeItemPagesInsertLayoutNamedPagesItemTarget( + ChangeItemPagesInsertLayoutNamedPagesItemTarget.Page value + ) + { + Kind = "page"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItemPagesInsertLayoutNamedPagesItemTarget with . + /// + public ChangeItemPagesInsertLayoutNamedPagesItemTarget( + ChangeItemPagesInsertLayoutNamedPagesItemTarget.Template value + ) + { + Kind = "template"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItemPagesInsertLayoutNamedPagesItemTarget with . + /// + public ChangeItemPagesInsertLayoutNamedPagesItemTarget( + ChangeItemPagesInsertLayoutNamedPagesItemTarget.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.ChangeItemPagesInsertLayoutNamedPagesItemTargetPage AsPage() => + IsPage + ? (CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetPage)Value! + : throw new global::System.Exception( + "ChangeItemPagesInsertLayoutNamedPagesItemTarget.Kind is not 'page'" + ); + + /// + /// Returns the value as a if is 'template', otherwise throws an exception. + /// + /// Thrown when is not 'template'. + public CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetTemplate AsTemplate() => + IsTemplate + ? (CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetTemplate)Value! + : throw new global::System.Exception( + "ChangeItemPagesInsertLayoutNamedPagesItemTarget.Kind is not 'template'" + ); + + /// + /// Returns the value as a if is 'dangling', otherwise throws an exception. + /// + /// Thrown when is not 'dangling'. + public CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetDangling AsDangling() => + IsDangling + ? (CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetDangling)Value! + : throw new global::System.Exception( + "ChangeItemPagesInsertLayoutNamedPagesItemTarget.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.ChangeItemPagesInsertLayoutNamedPagesItemTargetPage? value) + { + if (Kind == "page") + { + value = (CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetPage)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsTemplate( + out CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetTemplate? value + ) + { + if (Kind == "template") + { + value = (CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetTemplate)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsDangling( + out CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetDangling? value + ) + { + if (Kind == "dangling") + { + value = (CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetDangling)Value!; + return true; + } + value = null; + return false; + } + + public override string ToString() => JsonUtils.Serialize(this); + + public static implicit operator ChangeItemPagesInsertLayoutNamedPagesItemTarget( + ChangeItemPagesInsertLayoutNamedPagesItemTarget.Page value + ) => new(value); + + public static implicit operator ChangeItemPagesInsertLayoutNamedPagesItemTarget( + ChangeItemPagesInsertLayoutNamedPagesItemTarget.Template value + ) => new(value); + + public static implicit operator ChangeItemPagesInsertLayoutNamedPagesItemTarget( + ChangeItemPagesInsertLayoutNamedPagesItemTarget.Dangling value + ) => new(value); + + [Serializable] + internal sealed class JsonConverter + : JsonConverter + { + public override bool CanConvert(global::System.Type typeToConvert) => + typeof(ChangeItemPagesInsertLayoutNamedPagesItemTarget).IsAssignableFrom(typeToConvert); + + public override ChangeItemPagesInsertLayoutNamedPagesItemTarget 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.ChangeItemPagesInsertLayoutNamedPagesItemTargetPage" + ), + "template" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetTemplate" + ), + "dangling" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetDangling" + ), + _ => json.Deserialize(options), + }; + return new ChangeItemPagesInsertLayoutNamedPagesItemTarget(discriminator, value); + } + + public override void Write( + Utf8JsonWriter writer, + ChangeItemPagesInsertLayoutNamedPagesItemTarget 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 ChangeItemPagesInsertLayoutNamedPagesItemTarget 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 ChangeItemPagesInsertLayoutNamedPagesItemTarget(stringValue, stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ChangeItemPagesInsertLayoutNamedPagesItemTarget value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Kind); + } + } + + /// + /// Discriminated union type for page + /// + [Serializable] + public struct Page + { + public Page(CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetPage value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetPage Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItemPagesInsertLayoutNamedPagesItemTarget.Page( + CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetPage value + ) => new(value); + } + + /// + /// Discriminated union type for template + /// + [Serializable] + public struct Template + { + public Template(CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetTemplate value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetTemplate Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItemPagesInsertLayoutNamedPagesItemTarget.Template( + CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetTemplate value + ) => new(value); + } + + /// + /// Discriminated union type for dangling + /// + [Serializable] + public struct Dangling + { + public Dangling(CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetDangling value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetDangling Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItemPagesInsertLayoutNamedPagesItemTarget.Dangling( + CloudPDF.ChangeItemPagesInsertLayoutNamedPagesItemTargetDangling value + ) => new(value); + } +} diff --git a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItemTargetDangling.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItemTargetDangling.cs similarity index 86% rename from src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItemTargetDangling.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItemTargetDangling.cs index 8d207535..8967560a 100644 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutNamedPagesItemTargetDangling.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItemTargetDangling.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesRotate200ResponseLayoutNamedPagesItemTargetDangling : IJsonOnDeserialized +public record ChangeItemPagesInsertLayoutNamedPagesItemTargetDangling : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItemTargetPage.cs similarity index 88% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItemTargetPage.cs index 697074e4..de44ec3c 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItemTargetPage.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage : IJsonOnDeserialized +public record ChangeItemPagesInsertLayoutNamedPagesItemTargetPage : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItemTargetTemplate.cs similarity index 88% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItemTargetTemplate.cs index f1042b2a..d1760592 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutNamedPagesItemTargetTemplate.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate : IJsonOnDeserialized +public record ChangeItemPagesInsertLayoutNamedPagesItemTargetTemplate : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItem.cs similarity index 74% rename from src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItem.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItem.cs index 4c35c839..709fe2aa 100644 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItem.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItem.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesRotate200ResponseLayoutPagesItem : IJsonOnDeserialized +public record ChangeItemPagesInsertLayoutPagesItem : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -21,7 +21,7 @@ public record DocPagesRotate200ResponseLayoutPagesItem : IJsonOnDeserialized public string? Label { get; set; } [JsonPropertyName("size")] - public required DocPagesRotate200ResponseLayoutPagesItemSize Size { get; set; } + public required ChangeItemPagesInsertLayoutPagesItemSize Size { get; set; } [JsonPropertyName("rotation")] public required double Rotation { get; set; } @@ -30,13 +30,13 @@ public record DocPagesRotate200ResponseLayoutPagesItem : IJsonOnDeserialized public required double UserUnit { get; set; } [JsonPropertyName("tabOrder")] - public DocPagesRotate200ResponseLayoutPagesItemTabOrder? TabOrder { get; set; } + public ChangeItemPagesInsertLayoutPagesItemTabOrder? TabOrder { get; set; } [JsonPropertyName("boxes")] - public required DocPagesRotate200ResponseLayoutPagesItemBoxes Boxes { get; set; } + public required ChangeItemPagesInsertLayoutPagesItemBoxes Boxes { get; set; } [JsonPropertyName("pdfCropBox")] - public required DocPagesRotate200ResponseLayoutPagesItemPdfCropBox PdfCropBox { get; set; } + public required ChangeItemPagesInsertLayoutPagesItemPdfCropBox PdfCropBox { get; set; } [JsonPropertyName("actions")] public PdfPageActions? Actions { get; set; } diff --git a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxes.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxes.cs similarity index 59% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxes.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxes.cs index 77b94fb3..8fb83d8c 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxes.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxes.cs @@ -5,26 +5,26 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsert200ResponseLayoutPagesItemBoxes : IJsonOnDeserialized +public record ChangeItemPagesInsertLayoutPagesItemBoxes : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = new Dictionary(); [JsonPropertyName("media")] - public required DocPagesInsert200ResponseLayoutPagesItemBoxesMedia Media { get; set; } + public required ChangeItemPagesInsertLayoutPagesItemBoxesMedia Media { get; set; } [JsonPropertyName("crop")] - public required DocPagesInsert200ResponseLayoutPagesItemBoxesCrop Crop { get; set; } + public required ChangeItemPagesInsertLayoutPagesItemBoxesCrop Crop { get; set; } [JsonPropertyName("bleed")] - public required DocPagesInsert200ResponseLayoutPagesItemBoxesBleed Bleed { get; set; } + public required ChangeItemPagesInsertLayoutPagesItemBoxesBleed Bleed { get; set; } [JsonPropertyName("trim")] - public required DocPagesInsert200ResponseLayoutPagesItemBoxesTrim Trim { get; set; } + public required ChangeItemPagesInsertLayoutPagesItemBoxesTrim Trim { get; set; } [JsonPropertyName("art")] - public required DocPagesInsert200ResponseLayoutPagesItemBoxesArt Art { get; set; } + public required ChangeItemPagesInsertLayoutPagesItemBoxesArt Art { get; set; } [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxesArt.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxesArt.cs new file mode 100644 index 00000000..1459624b --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxesArt.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesInsertLayoutPagesItemBoxesArt : 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/ChangeItemPagesInsertLayoutPagesItemBoxesBleed.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxesBleed.cs new file mode 100644 index 00000000..2e7e4169 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxesBleed.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesInsertLayoutPagesItemBoxesBleed : 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/ChangeItemPagesInsertLayoutPagesItemBoxesCrop.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxesCrop.cs new file mode 100644 index 00000000..f12f701e --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxesCrop.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesInsertLayoutPagesItemBoxesCrop : 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/ChangeItemPagesInsertLayoutPagesItemBoxesMedia.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxesMedia.cs new file mode 100644 index 00000000..fa6cf63a --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxesMedia.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesInsertLayoutPagesItemBoxesMedia : 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/ChangeItemPagesInsertLayoutPagesItemBoxesTrim.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxesTrim.cs new file mode 100644 index 00000000..18432264 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemBoxesTrim.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesInsertLayoutPagesItemBoxesTrim : 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/DocPagesInsert200ResponseLayoutPagesItemPdfCropBox.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemPdfCropBox.cs similarity index 91% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemPdfCropBox.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemPdfCropBox.cs index 47d52672..95aace79 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemPdfCropBox.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemPdfCropBox.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsert200ResponseLayoutPagesItemPdfCropBox : IJsonOnDeserialized +public record ChangeItemPagesInsertLayoutPagesItemPdfCropBox : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemSize.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemSize.cs similarity index 90% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemSize.cs rename to src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemSize.cs index ee5cdc75..a82b5d0b 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemSize.cs +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemSize.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsert200ResponseLayoutPagesItemSize : IJsonOnDeserialized +public record ChangeItemPagesInsertLayoutPagesItemSize : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemTabOrder.cs b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemTabOrder.cs new file mode 100644 index 00000000..92d94861 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesInsertLayoutPagesItemTabOrder.cs @@ -0,0 +1,144 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(ChangeItemPagesInsertLayoutPagesItemTabOrder.ChangeItemPagesInsertLayoutPagesItemTabOrderSerializer) +)] +[Serializable] +public readonly record struct ChangeItemPagesInsertLayoutPagesItemTabOrder : IStringEnum +{ + public static readonly ChangeItemPagesInsertLayoutPagesItemTabOrder Rows = new(Values.Rows); + + public static readonly ChangeItemPagesInsertLayoutPagesItemTabOrder Columns = new( + Values.Columns + ); + + public static readonly ChangeItemPagesInsertLayoutPagesItemTabOrder Structure = new( + Values.Structure + ); + + public static readonly ChangeItemPagesInsertLayoutPagesItemTabOrder Annotations = new( + Values.Annotations + ); + + public static readonly ChangeItemPagesInsertLayoutPagesItemTabOrder Widgets = new( + Values.Widgets + ); + + public ChangeItemPagesInsertLayoutPagesItemTabOrder(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ChangeItemPagesInsertLayoutPagesItemTabOrder FromCustom(string value) + { + return new ChangeItemPagesInsertLayoutPagesItemTabOrder(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 ==( + ChangeItemPagesInsertLayoutPagesItemTabOrder value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + ChangeItemPagesInsertLayoutPagesItemTabOrder value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(ChangeItemPagesInsertLayoutPagesItemTabOrder value) => + value.Value; + + public static explicit operator ChangeItemPagesInsertLayoutPagesItemTabOrder(string value) => + new(value); + + internal class ChangeItemPagesInsertLayoutPagesItemTabOrderSerializer + : JsonConverter + { + public override ChangeItemPagesInsertLayoutPagesItemTabOrder 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 ChangeItemPagesInsertLayoutPagesItemTabOrder(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ChangeItemPagesInsertLayoutPagesItemTabOrder value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override ChangeItemPagesInsertLayoutPagesItemTabOrder 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 ChangeItemPagesInsertLayoutPagesItemTabOrder(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ChangeItemPagesInsertLayoutPagesItemTabOrder 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/DocPagesRotate200Response.cs b/src/CloudPDF/Types/ChangeItemPagesReorder.cs similarity index 75% rename from src/CloudPDF/Types/DocPagesRotate200Response.cs rename to src/CloudPDF/Types/ChangeItemPagesReorder.cs index 56101758..44cbfefa 100644 --- a/src/CloudPDF/Types/DocPagesRotate200Response.cs +++ b/src/CloudPDF/Types/ChangeItemPagesReorder.cs @@ -5,14 +5,17 @@ namespace CloudPDF; [Serializable] -public record DocPagesRotate200Response : IJsonOnDeserialized +public record ChangeItemPagesReorder : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = new Dictionary(); + [JsonPropertyName("pages")] + public IEnumerable Pages { get; set; } = new List(); + [JsonPropertyName("layout")] - public required DocPagesRotate200ResponseLayout Layout { get; set; } + public required ChangeItemPagesReorderLayout Layout { get; set; } [JsonPropertyName("meta")] public required MutationMeta Meta { get; set; } diff --git a/src/CloudPDF/Types/DocPagesDelete200ResponseLayout.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayout.cs similarity index 67% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayout.cs rename to src/CloudPDF/Types/ChangeItemPagesReorderLayout.cs index 80be8fde..e199a675 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayout.cs +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayout.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesDelete200ResponseLayout : IJsonOnDeserialized +public record ChangeItemPagesReorderLayout : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -15,12 +15,12 @@ public record DocPagesDelete200ResponseLayout : IJsonOnDeserialized public required int PageCount { get; set; } [JsonPropertyName("pages")] - public IEnumerable Pages { get; set; } = - new List(); + public IEnumerable Pages { get; set; } = + new List(); [JsonPropertyName("namedPages")] - public IEnumerable NamedPages { get; set; } = - new List(); + public IEnumerable NamedPages { get; set; } = + new List(); [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItem.cs similarity index 80% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItem.cs rename to src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItem.cs index 084d2f2d..9ec8619c 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItem.cs +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItem.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesDelete200ResponseLayoutNamedPagesItem : IJsonOnDeserialized +public record ChangeItemPagesReorderLayoutNamedPagesItem : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -15,7 +15,7 @@ public record DocPagesDelete200ResponseLayoutNamedPagesItem : IJsonOnDeserialize public required string Name { get; set; } [JsonPropertyName("target")] - public required DocPagesDelete200ResponseLayoutNamedPagesItemTarget Target { get; set; } + public required ChangeItemPagesReorderLayoutNamedPagesItemTarget Target { get; set; } [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItemTarget.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItemTarget.cs similarity index 53% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItemTarget.cs rename to src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItemTarget.cs index 414158b4..10c4cdcd 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItemTarget.cs +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItemTarget.cs @@ -8,21 +8,21 @@ namespace CloudPDF; -[JsonConverter(typeof(DocPagesInsert200ResponseLayoutNamedPagesItemTarget.JsonConverter))] +[JsonConverter(typeof(ChangeItemPagesReorderLayoutNamedPagesItemTarget.JsonConverter))] [Serializable] -public record DocPagesInsert200ResponseLayoutNamedPagesItemTarget +public record ChangeItemPagesReorderLayoutNamedPagesItemTarget { - internal DocPagesInsert200ResponseLayoutNamedPagesItemTarget(string type, object? value) + internal ChangeItemPagesReorderLayoutNamedPagesItemTarget(string type, object? value) { Kind = type; Value = value; } /// - /// Create an instance of DocPagesInsert200ResponseLayoutNamedPagesItemTarget with . + /// Create an instance of ChangeItemPagesReorderLayoutNamedPagesItemTarget with . /// - public DocPagesInsert200ResponseLayoutNamedPagesItemTarget( - DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Page value + public ChangeItemPagesReorderLayoutNamedPagesItemTarget( + ChangeItemPagesReorderLayoutNamedPagesItemTarget.Page value ) { Kind = "page"; @@ -30,10 +30,10 @@ DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Page value } /// - /// Create an instance of DocPagesInsert200ResponseLayoutNamedPagesItemTarget with . + /// Create an instance of ChangeItemPagesReorderLayoutNamedPagesItemTarget with . /// - public DocPagesInsert200ResponseLayoutNamedPagesItemTarget( - DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Template value + public ChangeItemPagesReorderLayoutNamedPagesItemTarget( + ChangeItemPagesReorderLayoutNamedPagesItemTarget.Template value ) { Kind = "template"; @@ -41,10 +41,10 @@ DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Template value } /// - /// Create an instance of DocPagesInsert200ResponseLayoutNamedPagesItemTarget with . + /// Create an instance of ChangeItemPagesReorderLayoutNamedPagesItemTarget with . /// - public DocPagesInsert200ResponseLayoutNamedPagesItemTarget( - DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Dangling value + public ChangeItemPagesReorderLayoutNamedPagesItemTarget( + ChangeItemPagesReorderLayoutNamedPagesItemTarget.Dangling value ) { Kind = "dangling"; @@ -78,42 +78,42 @@ DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Dangling value public bool IsDangling => Kind == "dangling"; /// - /// Returns the value as a if is 'page', otherwise throws an exception. + /// Returns the value as a if is 'page', otherwise throws an exception. /// /// Thrown when is not 'page'. - public CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage AsPage() => + public CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetPage AsPage() => IsPage - ? (CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage)Value! + ? (CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetPage)Value! : throw new global::System.Exception( - "DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Kind is not 'page'" + "ChangeItemPagesReorderLayoutNamedPagesItemTarget.Kind is not 'page'" ); /// - /// Returns the value as a if is 'template', otherwise throws an exception. + /// Returns the value as a if is 'template', otherwise throws an exception. /// /// Thrown when is not 'template'. - public CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate AsTemplate() => + public CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetTemplate AsTemplate() => IsTemplate - ? (CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate)Value! + ? (CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetTemplate)Value! : throw new global::System.Exception( - "DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Kind is not 'template'" + "ChangeItemPagesReorderLayoutNamedPagesItemTarget.Kind is not 'template'" ); /// - /// Returns the value as a if is 'dangling', otherwise throws an exception. + /// Returns the value as a if is 'dangling', otherwise throws an exception. /// /// Thrown when is not 'dangling'. - public CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetDangling AsDangling() => + public CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetDangling AsDangling() => IsDangling - ? (CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetDangling)Value! + ? (CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetDangling)Value! : throw new global::System.Exception( - "DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Kind is not 'dangling'" + "ChangeItemPagesReorderLayoutNamedPagesItemTarget.Kind is not 'dangling'" ); public T Match( - Func onPage, - Func onTemplate, - Func onDangling, + Func onPage, + Func onTemplate, + Func onDangling, Func onUnknown_ ) { @@ -127,9 +127,9 @@ public T Match( } public void Visit( - Action onPage, - Action onTemplate, - Action onDangling, + Action onPage, + Action onTemplate, + Action onDangling, Action onUnknown_ ) { @@ -151,15 +151,13 @@ public void Visit( } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// - public bool TryAsPage( - out CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage? value - ) + public bool TryAsPage(out CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetPage? value) { if (Kind == "page") { - value = (CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage)Value!; + value = (CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetPage)Value!; return true; } value = null; @@ -167,15 +165,15 @@ out CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage? value } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// public bool TryAsTemplate( - out CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate? value + out CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetTemplate? value ) { if (Kind == "template") { - value = (CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate)Value!; + value = (CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetTemplate)Value!; return true; } value = null; @@ -183,15 +181,15 @@ out CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate? value } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// public bool TryAsDangling( - out CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetDangling? value + out CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetDangling? value ) { if (Kind == "dangling") { - value = (CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetDangling)Value!; + value = (CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetDangling)Value!; return true; } value = null; @@ -200,28 +198,28 @@ out CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetDangling? value public override string ToString() => JsonUtils.Serialize(this); - public static implicit operator DocPagesInsert200ResponseLayoutNamedPagesItemTarget( - DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Page value + public static implicit operator ChangeItemPagesReorderLayoutNamedPagesItemTarget( + ChangeItemPagesReorderLayoutNamedPagesItemTarget.Page value ) => new(value); - public static implicit operator DocPagesInsert200ResponseLayoutNamedPagesItemTarget( - DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Template value + public static implicit operator ChangeItemPagesReorderLayoutNamedPagesItemTarget( + ChangeItemPagesReorderLayoutNamedPagesItemTarget.Template value ) => new(value); - public static implicit operator DocPagesInsert200ResponseLayoutNamedPagesItemTarget( - DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Dangling value + public static implicit operator ChangeItemPagesReorderLayoutNamedPagesItemTarget( + ChangeItemPagesReorderLayoutNamedPagesItemTarget.Dangling value ) => new(value); [Serializable] internal sealed class JsonConverter - : JsonConverter + : JsonConverter { public override bool CanConvert(global::System.Type typeToConvert) => - typeof(DocPagesInsert200ResponseLayoutNamedPagesItemTarget).IsAssignableFrom( + typeof(ChangeItemPagesReorderLayoutNamedPagesItemTarget).IsAssignableFrom( typeToConvert ); - public override DocPagesInsert200ResponseLayoutNamedPagesItemTarget Read( + public override ChangeItemPagesReorderLayoutNamedPagesItemTarget Read( ref Utf8JsonReader reader, global::System.Type typeToConvert, JsonSerializerOptions options @@ -257,34 +255,34 @@ JsonSerializerOptions options var value = discriminator switch { "page" => - jsonWithoutDiscriminator.Deserialize( + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage" + "Failed to deserialize CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetPage" ), "template" => - jsonWithoutDiscriminator.Deserialize( + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate" + "Failed to deserialize CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetTemplate" ), "dangling" => - jsonWithoutDiscriminator.Deserialize( + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetDangling" + "Failed to deserialize CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetDangling" ), _ => json.Deserialize(options), }; - return new DocPagesInsert200ResponseLayoutNamedPagesItemTarget(discriminator, value); + return new ChangeItemPagesReorderLayoutNamedPagesItemTarget(discriminator, value); } public override void Write( Utf8JsonWriter writer, - DocPagesInsert200ResponseLayoutNamedPagesItemTarget value, + ChangeItemPagesReorderLayoutNamedPagesItemTarget value, JsonSerializerOptions options ) { @@ -300,7 +298,7 @@ JsonSerializerOptions options json.WriteTo(writer, options); } - public override DocPagesInsert200ResponseLayoutNamedPagesItemTarget ReadAsPropertyName( + public override ChangeItemPagesReorderLayoutNamedPagesItemTarget ReadAsPropertyName( ref Utf8JsonReader reader, global::System.Type typeToConvert, JsonSerializerOptions options @@ -309,15 +307,12 @@ JsonSerializerOptions options var stringValue = reader.GetString() ?? throw new JsonException("The JSON property name could not be read as a string."); - return new DocPagesInsert200ResponseLayoutNamedPagesItemTarget( - stringValue, - stringValue - ); + return new ChangeItemPagesReorderLayoutNamedPagesItemTarget(stringValue, stringValue); } public override void WriteAsPropertyName( Utf8JsonWriter writer, - DocPagesInsert200ResponseLayoutNamedPagesItemTarget value, + ChangeItemPagesReorderLayoutNamedPagesItemTarget value, JsonSerializerOptions options ) { @@ -331,17 +326,17 @@ JsonSerializerOptions options [Serializable] public struct Page { - public Page(CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage value) + public Page(CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetPage value) { Value = value; } - internal CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage Value { get; set; } + internal CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetPage Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Page( - CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage value + public static implicit operator ChangeItemPagesReorderLayoutNamedPagesItemTarget.Page( + CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetPage value ) => new(value); } @@ -351,17 +346,17 @@ CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage value [Serializable] public struct Template { - public Template(CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate value) + public Template(CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetTemplate value) { Value = value; } - internal CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate Value { get; set; } + internal CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetTemplate Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Template( - CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate value + public static implicit operator ChangeItemPagesReorderLayoutNamedPagesItemTarget.Template( + CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetTemplate value ) => new(value); } @@ -371,17 +366,17 @@ CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetTemplate value [Serializable] public struct Dangling { - public Dangling(CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetDangling value) + public Dangling(CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetDangling value) { Value = value; } - internal CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetDangling Value { get; set; } + internal CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetDangling Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocPagesInsert200ResponseLayoutNamedPagesItemTarget.Dangling( - CloudPDF.DocPagesInsert200ResponseLayoutNamedPagesItemTargetDangling value + public static implicit operator ChangeItemPagesReorderLayoutNamedPagesItemTarget.Dangling( + CloudPDF.ChangeItemPagesReorderLayoutNamedPagesItemTargetDangling value ) => new(value); } } diff --git a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItemTargetDangling.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItemTargetDangling.cs similarity index 86% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItemTargetDangling.cs rename to src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItemTargetDangling.cs index 069b734b..2fdad56e 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItemTargetDangling.cs +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItemTargetDangling.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesDelete200ResponseLayoutNamedPagesItemTargetDangling : IJsonOnDeserialized +public record ChangeItemPagesReorderLayoutNamedPagesItemTargetDangling : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItemTargetPage.cs similarity index 88% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage.cs rename to src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItemTargetPage.cs index 3d885ca4..1c3ea73d 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage.cs +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItemTargetPage.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsert200ResponseLayoutNamedPagesItemTargetPage : IJsonOnDeserialized +public record ChangeItemPagesReorderLayoutNamedPagesItemTargetPage : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItemTargetTemplate.cs similarity index 88% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate.cs rename to src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItemTargetTemplate.cs index 6c4ac06e..555e078e 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate.cs +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutNamedPagesItemTargetTemplate.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate : IJsonOnDeserialized +public record ChangeItemPagesReorderLayoutNamedPagesItemTargetTemplate : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItem.cs similarity index 74% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItem.cs rename to src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItem.cs index f971747c..e2dea924 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItem.cs +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItem.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsert200ResponseLayoutPagesItem : IJsonOnDeserialized +public record ChangeItemPagesReorderLayoutPagesItem : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = @@ -21,7 +21,7 @@ public record DocPagesInsert200ResponseLayoutPagesItem : IJsonOnDeserialized public string? Label { get; set; } [JsonPropertyName("size")] - public required DocPagesInsert200ResponseLayoutPagesItemSize Size { get; set; } + public required ChangeItemPagesReorderLayoutPagesItemSize Size { get; set; } [JsonPropertyName("rotation")] public required double Rotation { get; set; } @@ -30,13 +30,13 @@ public record DocPagesInsert200ResponseLayoutPagesItem : IJsonOnDeserialized public required double UserUnit { get; set; } [JsonPropertyName("tabOrder")] - public DocPagesInsert200ResponseLayoutPagesItemTabOrder? TabOrder { get; set; } + public ChangeItemPagesReorderLayoutPagesItemTabOrder? TabOrder { get; set; } [JsonPropertyName("boxes")] - public required DocPagesInsert200ResponseLayoutPagesItemBoxes Boxes { get; set; } + public required ChangeItemPagesReorderLayoutPagesItemBoxes Boxes { get; set; } [JsonPropertyName("pdfCropBox")] - public required DocPagesInsert200ResponseLayoutPagesItemPdfCropBox PdfCropBox { get; set; } + public required ChangeItemPagesReorderLayoutPagesItemPdfCropBox PdfCropBox { get; set; } [JsonPropertyName("actions")] public PdfPageActions? Actions { get; set; } diff --git a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxes.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxes.cs similarity index 59% rename from src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxes.cs rename to src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxes.cs index 9efc3433..dab34ac5 100644 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxes.cs +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxes.cs @@ -5,26 +5,26 @@ namespace CloudPDF; [Serializable] -public record DocPagesRotate200ResponseLayoutPagesItemBoxes : IJsonOnDeserialized +public record ChangeItemPagesReorderLayoutPagesItemBoxes : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = new Dictionary(); [JsonPropertyName("media")] - public required DocPagesRotate200ResponseLayoutPagesItemBoxesMedia Media { get; set; } + public required ChangeItemPagesReorderLayoutPagesItemBoxesMedia Media { get; set; } [JsonPropertyName("crop")] - public required DocPagesRotate200ResponseLayoutPagesItemBoxesCrop Crop { get; set; } + public required ChangeItemPagesReorderLayoutPagesItemBoxesCrop Crop { get; set; } [JsonPropertyName("bleed")] - public required DocPagesRotate200ResponseLayoutPagesItemBoxesBleed Bleed { get; set; } + public required ChangeItemPagesReorderLayoutPagesItemBoxesBleed Bleed { get; set; } [JsonPropertyName("trim")] - public required DocPagesRotate200ResponseLayoutPagesItemBoxesTrim Trim { get; set; } + public required ChangeItemPagesReorderLayoutPagesItemBoxesTrim Trim { get; set; } [JsonPropertyName("art")] - public required DocPagesRotate200ResponseLayoutPagesItemBoxesArt Art { get; set; } + public required ChangeItemPagesReorderLayoutPagesItemBoxesArt Art { get; set; } [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxesArt.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxesArt.cs new file mode 100644 index 00000000..e3443335 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxesArt.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesReorderLayoutPagesItemBoxesArt : 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/ChangeItemPagesReorderLayoutPagesItemBoxesBleed.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxesBleed.cs new file mode 100644 index 00000000..2de2649b --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxesBleed.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesReorderLayoutPagesItemBoxesBleed : 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/ChangeItemPagesReorderLayoutPagesItemBoxesCrop.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxesCrop.cs new file mode 100644 index 00000000..8d1fe255 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxesCrop.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesReorderLayoutPagesItemBoxesCrop : 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/ChangeItemPagesReorderLayoutPagesItemBoxesMedia.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxesMedia.cs new file mode 100644 index 00000000..1c58a27a --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxesMedia.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesReorderLayoutPagesItemBoxesMedia : 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/ChangeItemPagesReorderLayoutPagesItemBoxesTrim.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxesTrim.cs new file mode 100644 index 00000000..8b464b42 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemBoxesTrim.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesReorderLayoutPagesItemBoxesTrim : 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/DocPagesRotate200ResponseLayoutPagesItemPdfCropBox.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemPdfCropBox.cs similarity index 91% rename from src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemPdfCropBox.cs rename to src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemPdfCropBox.cs index 0fa4e5d3..e313e7fb 100644 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemPdfCropBox.cs +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemPdfCropBox.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesRotate200ResponseLayoutPagesItemPdfCropBox : IJsonOnDeserialized +public record ChangeItemPagesReorderLayoutPagesItemPdfCropBox : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemSize.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemSize.cs similarity index 90% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemSize.cs rename to src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemSize.cs index ea6c6754..08757555 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemSize.cs +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemSize.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocPagesDelete200ResponseLayoutPagesItemSize : IJsonOnDeserialized +public record ChangeItemPagesReorderLayoutPagesItemSize : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemTabOrder.cs b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemTabOrder.cs similarity index 56% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemTabOrder.cs rename to src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemTabOrder.cs index a3125fac..cb10003b 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemTabOrder.cs +++ b/src/CloudPDF/Types/ChangeItemPagesReorderLayoutPagesItemTabOrder.cs @@ -5,30 +5,30 @@ namespace CloudPDF; [JsonConverter( - typeof(DocPagesDelete200ResponseLayoutPagesItemTabOrder.DocPagesDelete200ResponseLayoutPagesItemTabOrderSerializer) + typeof(ChangeItemPagesReorderLayoutPagesItemTabOrder.ChangeItemPagesReorderLayoutPagesItemTabOrderSerializer) )] [Serializable] -public readonly record struct DocPagesDelete200ResponseLayoutPagesItemTabOrder : IStringEnum +public readonly record struct ChangeItemPagesReorderLayoutPagesItemTabOrder : IStringEnum { - public static readonly DocPagesDelete200ResponseLayoutPagesItemTabOrder Rows = new(Values.Rows); + public static readonly ChangeItemPagesReorderLayoutPagesItemTabOrder Rows = new(Values.Rows); - public static readonly DocPagesDelete200ResponseLayoutPagesItemTabOrder Columns = new( + public static readonly ChangeItemPagesReorderLayoutPagesItemTabOrder Columns = new( Values.Columns ); - public static readonly DocPagesDelete200ResponseLayoutPagesItemTabOrder Structure = new( + public static readonly ChangeItemPagesReorderLayoutPagesItemTabOrder Structure = new( Values.Structure ); - public static readonly DocPagesDelete200ResponseLayoutPagesItemTabOrder Annotations = new( + public static readonly ChangeItemPagesReorderLayoutPagesItemTabOrder Annotations = new( Values.Annotations ); - public static readonly DocPagesDelete200ResponseLayoutPagesItemTabOrder Widgets = new( + public static readonly ChangeItemPagesReorderLayoutPagesItemTabOrder Widgets = new( Values.Widgets ); - public DocPagesDelete200ResponseLayoutPagesItemTabOrder(string value) + public ChangeItemPagesReorderLayoutPagesItemTabOrder(string value) { Value = value; } @@ -41,9 +41,9 @@ public DocPagesDelete200ResponseLayoutPagesItemTabOrder(string value) /// /// Create a string enum with the given value. /// - public static DocPagesDelete200ResponseLayoutPagesItemTabOrder FromCustom(string value) + public static ChangeItemPagesReorderLayoutPagesItemTabOrder FromCustom(string value) { - return new DocPagesDelete200ResponseLayoutPagesItemTabOrder(value); + return new ChangeItemPagesReorderLayoutPagesItemTabOrder(value); } public bool Equals(string? other) @@ -60,27 +60,25 @@ public override string ToString() } public static bool operator ==( - DocPagesDelete200ResponseLayoutPagesItemTabOrder value1, + ChangeItemPagesReorderLayoutPagesItemTabOrder value1, string value2 ) => value1.Value.Equals(value2); public static bool operator !=( - DocPagesDelete200ResponseLayoutPagesItemTabOrder value1, + ChangeItemPagesReorderLayoutPagesItemTabOrder value1, string value2 ) => !value1.Value.Equals(value2); - public static explicit operator string( - DocPagesDelete200ResponseLayoutPagesItemTabOrder value - ) => value.Value; + public static explicit operator string(ChangeItemPagesReorderLayoutPagesItemTabOrder value) => + value.Value; - public static explicit operator DocPagesDelete200ResponseLayoutPagesItemTabOrder( - string value - ) => new(value); + public static explicit operator ChangeItemPagesReorderLayoutPagesItemTabOrder(string value) => + new(value); - internal class DocPagesDelete200ResponseLayoutPagesItemTabOrderSerializer - : JsonConverter + internal class ChangeItemPagesReorderLayoutPagesItemTabOrderSerializer + : JsonConverter { - public override DocPagesDelete200ResponseLayoutPagesItemTabOrder Read( + public override ChangeItemPagesReorderLayoutPagesItemTabOrder Read( ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options @@ -91,19 +89,19 @@ JsonSerializerOptions options ?? throw new global::System.Exception( "The JSON value could not be read as a string." ); - return new DocPagesDelete200ResponseLayoutPagesItemTabOrder(stringValue); + return new ChangeItemPagesReorderLayoutPagesItemTabOrder(stringValue); } public override void Write( Utf8JsonWriter writer, - DocPagesDelete200ResponseLayoutPagesItemTabOrder value, + ChangeItemPagesReorderLayoutPagesItemTabOrder value, JsonSerializerOptions options ) { writer.WriteStringValue(value.Value); } - public override DocPagesDelete200ResponseLayoutPagesItemTabOrder ReadAsPropertyName( + public override ChangeItemPagesReorderLayoutPagesItemTabOrder ReadAsPropertyName( ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options @@ -114,12 +112,12 @@ JsonSerializerOptions options ?? throw new global::System.Exception( "The JSON property name could not be read as a string." ); - return new DocPagesDelete200ResponseLayoutPagesItemTabOrder(stringValue); + return new ChangeItemPagesReorderLayoutPagesItemTabOrder(stringValue); } public override void WriteAsPropertyName( Utf8JsonWriter writer, - DocPagesDelete200ResponseLayoutPagesItemTabOrder value, + ChangeItemPagesReorderLayoutPagesItemTabOrder value, JsonSerializerOptions options ) { diff --git a/src/CloudPDF/Types/DocPagesDelete200Response.cs b/src/CloudPDF/Types/ChangeItemPagesRestore.cs similarity index 75% rename from src/CloudPDF/Types/DocPagesDelete200Response.cs rename to src/CloudPDF/Types/ChangeItemPagesRestore.cs index 949e80f4..57bbf1f4 100644 --- a/src/CloudPDF/Types/DocPagesDelete200Response.cs +++ b/src/CloudPDF/Types/ChangeItemPagesRestore.cs @@ -5,14 +5,17 @@ namespace CloudPDF; [Serializable] -public record DocPagesDelete200Response : IJsonOnDeserialized +public record ChangeItemPagesRestore : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = new Dictionary(); + [JsonPropertyName("pages")] + public IEnumerable Pages { get; set; } = new List(); + [JsonPropertyName("layout")] - public required DocPagesDelete200ResponseLayout Layout { get; set; } + public required ChangeItemPagesRestoreLayout Layout { get; set; } [JsonPropertyName("meta")] public required MutationMeta Meta { get; set; } diff --git a/src/CloudPDF/Types/ChangeItemPagesRestoreLayout.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayout.cs new file mode 100644 index 00000000..a0681bee --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayout.cs @@ -0,0 +1,36 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayout : 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("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/ChangeItemPagesRestoreLayoutNamedPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutNamedPagesItem.cs new file mode 100644 index 00000000..2d9c1c06 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutNamedPagesItem.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutNamedPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required string Name { get; set; } + + [JsonPropertyName("target")] + public required ChangeItemPagesRestoreLayoutNamedPagesItemTarget 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/DocPagesDelete200ResponseLayoutNamedPagesItemTarget.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutNamedPagesItemTarget.cs similarity index 53% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItemTarget.cs rename to src/CloudPDF/Types/ChangeItemPagesRestoreLayoutNamedPagesItemTarget.cs index 1b821713..778ab41b 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutNamedPagesItemTarget.cs +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutNamedPagesItemTarget.cs @@ -8,21 +8,21 @@ namespace CloudPDF; -[JsonConverter(typeof(DocPagesDelete200ResponseLayoutNamedPagesItemTarget.JsonConverter))] +[JsonConverter(typeof(ChangeItemPagesRestoreLayoutNamedPagesItemTarget.JsonConverter))] [Serializable] -public record DocPagesDelete200ResponseLayoutNamedPagesItemTarget +public record ChangeItemPagesRestoreLayoutNamedPagesItemTarget { - internal DocPagesDelete200ResponseLayoutNamedPagesItemTarget(string type, object? value) + internal ChangeItemPagesRestoreLayoutNamedPagesItemTarget(string type, object? value) { Kind = type; Value = value; } /// - /// Create an instance of DocPagesDelete200ResponseLayoutNamedPagesItemTarget with . + /// Create an instance of ChangeItemPagesRestoreLayoutNamedPagesItemTarget with . /// - public DocPagesDelete200ResponseLayoutNamedPagesItemTarget( - DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Page value + public ChangeItemPagesRestoreLayoutNamedPagesItemTarget( + ChangeItemPagesRestoreLayoutNamedPagesItemTarget.Page value ) { Kind = "page"; @@ -30,10 +30,10 @@ DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Page value } /// - /// Create an instance of DocPagesDelete200ResponseLayoutNamedPagesItemTarget with . + /// Create an instance of ChangeItemPagesRestoreLayoutNamedPagesItemTarget with . /// - public DocPagesDelete200ResponseLayoutNamedPagesItemTarget( - DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Template value + public ChangeItemPagesRestoreLayoutNamedPagesItemTarget( + ChangeItemPagesRestoreLayoutNamedPagesItemTarget.Template value ) { Kind = "template"; @@ -41,10 +41,10 @@ DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Template value } /// - /// Create an instance of DocPagesDelete200ResponseLayoutNamedPagesItemTarget with . + /// Create an instance of ChangeItemPagesRestoreLayoutNamedPagesItemTarget with . /// - public DocPagesDelete200ResponseLayoutNamedPagesItemTarget( - DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Dangling value + public ChangeItemPagesRestoreLayoutNamedPagesItemTarget( + ChangeItemPagesRestoreLayoutNamedPagesItemTarget.Dangling value ) { Kind = "dangling"; @@ -78,42 +78,42 @@ DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Dangling value public bool IsDangling => Kind == "dangling"; /// - /// Returns the value as a if is 'page', otherwise throws an exception. + /// Returns the value as a if is 'page', otherwise throws an exception. /// /// Thrown when is not 'page'. - public CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage AsPage() => + public CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetPage AsPage() => IsPage - ? (CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage)Value! + ? (CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetPage)Value! : throw new global::System.Exception( - "DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Kind is not 'page'" + "ChangeItemPagesRestoreLayoutNamedPagesItemTarget.Kind is not 'page'" ); /// - /// Returns the value as a if is 'template', otherwise throws an exception. + /// Returns the value as a if is 'template', otherwise throws an exception. /// /// Thrown when is not 'template'. - public CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate AsTemplate() => + public CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetTemplate AsTemplate() => IsTemplate - ? (CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate)Value! + ? (CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetTemplate)Value! : throw new global::System.Exception( - "DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Kind is not 'template'" + "ChangeItemPagesRestoreLayoutNamedPagesItemTarget.Kind is not 'template'" ); /// - /// Returns the value as a if is 'dangling', otherwise throws an exception. + /// Returns the value as a if is 'dangling', otherwise throws an exception. /// /// Thrown when is not 'dangling'. - public CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetDangling AsDangling() => + public CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetDangling AsDangling() => IsDangling - ? (CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetDangling)Value! + ? (CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetDangling)Value! : throw new global::System.Exception( - "DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Kind is not 'dangling'" + "ChangeItemPagesRestoreLayoutNamedPagesItemTarget.Kind is not 'dangling'" ); public T Match( - Func onPage, - Func onTemplate, - Func onDangling, + Func onPage, + Func onTemplate, + Func onDangling, Func onUnknown_ ) { @@ -127,9 +127,9 @@ public T Match( } public void Visit( - Action onPage, - Action onTemplate, - Action onDangling, + Action onPage, + Action onTemplate, + Action onDangling, Action onUnknown_ ) { @@ -151,15 +151,13 @@ public void Visit( } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// - public bool TryAsPage( - out CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage? value - ) + public bool TryAsPage(out CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetPage? value) { if (Kind == "page") { - value = (CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage)Value!; + value = (CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetPage)Value!; return true; } value = null; @@ -167,15 +165,15 @@ out CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage? value } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// public bool TryAsTemplate( - out CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate? value + out CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetTemplate? value ) { if (Kind == "template") { - value = (CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate)Value!; + value = (CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetTemplate)Value!; return true; } value = null; @@ -183,15 +181,15 @@ out CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate? value } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// public bool TryAsDangling( - out CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetDangling? value + out CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetDangling? value ) { if (Kind == "dangling") { - value = (CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetDangling)Value!; + value = (CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetDangling)Value!; return true; } value = null; @@ -200,28 +198,28 @@ out CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetDangling? value public override string ToString() => JsonUtils.Serialize(this); - public static implicit operator DocPagesDelete200ResponseLayoutNamedPagesItemTarget( - DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Page value + public static implicit operator ChangeItemPagesRestoreLayoutNamedPagesItemTarget( + ChangeItemPagesRestoreLayoutNamedPagesItemTarget.Page value ) => new(value); - public static implicit operator DocPagesDelete200ResponseLayoutNamedPagesItemTarget( - DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Template value + public static implicit operator ChangeItemPagesRestoreLayoutNamedPagesItemTarget( + ChangeItemPagesRestoreLayoutNamedPagesItemTarget.Template value ) => new(value); - public static implicit operator DocPagesDelete200ResponseLayoutNamedPagesItemTarget( - DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Dangling value + public static implicit operator ChangeItemPagesRestoreLayoutNamedPagesItemTarget( + ChangeItemPagesRestoreLayoutNamedPagesItemTarget.Dangling value ) => new(value); [Serializable] internal sealed class JsonConverter - : JsonConverter + : JsonConverter { public override bool CanConvert(global::System.Type typeToConvert) => - typeof(DocPagesDelete200ResponseLayoutNamedPagesItemTarget).IsAssignableFrom( + typeof(ChangeItemPagesRestoreLayoutNamedPagesItemTarget).IsAssignableFrom( typeToConvert ); - public override DocPagesDelete200ResponseLayoutNamedPagesItemTarget Read( + public override ChangeItemPagesRestoreLayoutNamedPagesItemTarget Read( ref Utf8JsonReader reader, global::System.Type typeToConvert, JsonSerializerOptions options @@ -257,34 +255,34 @@ JsonSerializerOptions options var value = discriminator switch { "page" => - jsonWithoutDiscriminator.Deserialize( + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage" + "Failed to deserialize CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetPage" ), "template" => - jsonWithoutDiscriminator.Deserialize( + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate" + "Failed to deserialize CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetTemplate" ), "dangling" => - jsonWithoutDiscriminator.Deserialize( + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetDangling" + "Failed to deserialize CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetDangling" ), _ => json.Deserialize(options), }; - return new DocPagesDelete200ResponseLayoutNamedPagesItemTarget(discriminator, value); + return new ChangeItemPagesRestoreLayoutNamedPagesItemTarget(discriminator, value); } public override void Write( Utf8JsonWriter writer, - DocPagesDelete200ResponseLayoutNamedPagesItemTarget value, + ChangeItemPagesRestoreLayoutNamedPagesItemTarget value, JsonSerializerOptions options ) { @@ -300,7 +298,7 @@ JsonSerializerOptions options json.WriteTo(writer, options); } - public override DocPagesDelete200ResponseLayoutNamedPagesItemTarget ReadAsPropertyName( + public override ChangeItemPagesRestoreLayoutNamedPagesItemTarget ReadAsPropertyName( ref Utf8JsonReader reader, global::System.Type typeToConvert, JsonSerializerOptions options @@ -309,15 +307,12 @@ JsonSerializerOptions options var stringValue = reader.GetString() ?? throw new JsonException("The JSON property name could not be read as a string."); - return new DocPagesDelete200ResponseLayoutNamedPagesItemTarget( - stringValue, - stringValue - ); + return new ChangeItemPagesRestoreLayoutNamedPagesItemTarget(stringValue, stringValue); } public override void WriteAsPropertyName( Utf8JsonWriter writer, - DocPagesDelete200ResponseLayoutNamedPagesItemTarget value, + ChangeItemPagesRestoreLayoutNamedPagesItemTarget value, JsonSerializerOptions options ) { @@ -331,17 +326,17 @@ JsonSerializerOptions options [Serializable] public struct Page { - public Page(CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage value) + public Page(CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetPage value) { Value = value; } - internal CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage Value { get; set; } + internal CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetPage Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Page( - CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage value + public static implicit operator ChangeItemPagesRestoreLayoutNamedPagesItemTarget.Page( + CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetPage value ) => new(value); } @@ -351,17 +346,17 @@ CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetPage value [Serializable] public struct Template { - public Template(CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate value) + public Template(CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetTemplate value) { Value = value; } - internal CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate Value { get; set; } + internal CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetTemplate Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Template( - CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate value + public static implicit operator ChangeItemPagesRestoreLayoutNamedPagesItemTarget.Template( + CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetTemplate value ) => new(value); } @@ -371,17 +366,17 @@ CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetTemplate value [Serializable] public struct Dangling { - public Dangling(CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetDangling value) + public Dangling(CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetDangling value) { Value = value; } - internal CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetDangling Value { get; set; } + internal CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetDangling Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocPagesDelete200ResponseLayoutNamedPagesItemTarget.Dangling( - CloudPDF.DocPagesDelete200ResponseLayoutNamedPagesItemTargetDangling value + public static implicit operator ChangeItemPagesRestoreLayoutNamedPagesItemTarget.Dangling( + CloudPDF.ChangeItemPagesRestoreLayoutNamedPagesItemTargetDangling value ) => new(value); } } diff --git a/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutNamedPagesItemTargetDangling.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutNamedPagesItemTargetDangling.cs new file mode 100644 index 00000000..0973da5d --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutNamedPagesItemTargetDangling.cs @@ -0,0 +1,25 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutNamedPagesItemTargetDangling : 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/ChangeItemPagesRestoreLayoutNamedPagesItemTargetPage.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutNamedPagesItemTargetPage.cs new file mode 100644 index 00000000..485580b6 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutNamedPagesItemTargetPage.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutNamedPagesItemTargetPage : 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/ChangeItemPagesRestoreLayoutNamedPagesItemTargetTemplate.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutNamedPagesItemTargetTemplate.cs new file mode 100644 index 00000000..74b0e450 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutNamedPagesItemTargetTemplate.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutNamedPagesItemTargetTemplate : 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/ChangeItemPagesRestoreLayoutPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItem.cs new file mode 100644 index 00000000..29d01df8 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItem.cs @@ -0,0 +1,55 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutPagesItem : 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 ChangeItemPagesRestoreLayoutPagesItemSize Size { get; set; } + + [JsonPropertyName("rotation")] + public required double Rotation { get; set; } + + [JsonPropertyName("userUnit")] + public required double UserUnit { get; set; } + + [JsonPropertyName("tabOrder")] + public ChangeItemPagesRestoreLayoutPagesItemTabOrder? TabOrder { get; set; } + + [JsonPropertyName("boxes")] + public required ChangeItemPagesRestoreLayoutPagesItemBoxes Boxes { get; set; } + + [JsonPropertyName("pdfCropBox")] + public required ChangeItemPagesRestoreLayoutPagesItemPdfCropBox 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/ChangeItemPagesRestoreLayoutPagesItemBoxes.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemBoxes.cs new file mode 100644 index 00000000..31150586 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemBoxes.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutPagesItemBoxes : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("media")] + public required ChangeItemPagesRestoreLayoutPagesItemBoxesMedia Media { get; set; } + + [JsonPropertyName("crop")] + public required ChangeItemPagesRestoreLayoutPagesItemBoxesCrop Crop { get; set; } + + [JsonPropertyName("bleed")] + public required ChangeItemPagesRestoreLayoutPagesItemBoxesBleed Bleed { get; set; } + + [JsonPropertyName("trim")] + public required ChangeItemPagesRestoreLayoutPagesItemBoxesTrim Trim { get; set; } + + [JsonPropertyName("art")] + public required ChangeItemPagesRestoreLayoutPagesItemBoxesArt 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/ChangeItemPagesRestoreLayoutPagesItemBoxesArt.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemBoxesArt.cs new file mode 100644 index 00000000..13ca46f0 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemBoxesArt.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutPagesItemBoxesArt : 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/ChangeItemPagesRestoreLayoutPagesItemBoxesBleed.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemBoxesBleed.cs new file mode 100644 index 00000000..e005062a --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemBoxesBleed.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutPagesItemBoxesBleed : 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/ChangeItemPagesRestoreLayoutPagesItemBoxesCrop.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemBoxesCrop.cs new file mode 100644 index 00000000..4a70a492 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemBoxesCrop.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutPagesItemBoxesCrop : 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/ChangeItemPagesRestoreLayoutPagesItemBoxesMedia.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemBoxesMedia.cs new file mode 100644 index 00000000..abf1d4b1 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemBoxesMedia.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutPagesItemBoxesMedia : 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/ChangeItemPagesRestoreLayoutPagesItemBoxesTrim.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemBoxesTrim.cs new file mode 100644 index 00000000..ec3a331d --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemBoxesTrim.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutPagesItemBoxesTrim : 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/ChangeItemPagesRestoreLayoutPagesItemPdfCropBox.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemPdfCropBox.cs new file mode 100644 index 00000000..0624d923 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemPdfCropBox.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutPagesItemPdfCropBox : 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/ChangeItemPagesRestoreLayoutPagesItemSize.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemSize.cs new file mode 100644 index 00000000..67e81163 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemSize.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRestoreLayoutPagesItemSize : 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/DocPagesInsert200ResponseLayoutPagesItemTabOrder.cs b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemTabOrder.cs similarity index 56% rename from src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemTabOrder.cs rename to src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemTabOrder.cs index 6b9a61c9..4abca7f9 100644 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemTabOrder.cs +++ b/src/CloudPDF/Types/ChangeItemPagesRestoreLayoutPagesItemTabOrder.cs @@ -5,30 +5,30 @@ namespace CloudPDF; [JsonConverter( - typeof(DocPagesInsert200ResponseLayoutPagesItemTabOrder.DocPagesInsert200ResponseLayoutPagesItemTabOrderSerializer) + typeof(ChangeItemPagesRestoreLayoutPagesItemTabOrder.ChangeItemPagesRestoreLayoutPagesItemTabOrderSerializer) )] [Serializable] -public readonly record struct DocPagesInsert200ResponseLayoutPagesItemTabOrder : IStringEnum +public readonly record struct ChangeItemPagesRestoreLayoutPagesItemTabOrder : IStringEnum { - public static readonly DocPagesInsert200ResponseLayoutPagesItemTabOrder Rows = new(Values.Rows); + public static readonly ChangeItemPagesRestoreLayoutPagesItemTabOrder Rows = new(Values.Rows); - public static readonly DocPagesInsert200ResponseLayoutPagesItemTabOrder Columns = new( + public static readonly ChangeItemPagesRestoreLayoutPagesItemTabOrder Columns = new( Values.Columns ); - public static readonly DocPagesInsert200ResponseLayoutPagesItemTabOrder Structure = new( + public static readonly ChangeItemPagesRestoreLayoutPagesItemTabOrder Structure = new( Values.Structure ); - public static readonly DocPagesInsert200ResponseLayoutPagesItemTabOrder Annotations = new( + public static readonly ChangeItemPagesRestoreLayoutPagesItemTabOrder Annotations = new( Values.Annotations ); - public static readonly DocPagesInsert200ResponseLayoutPagesItemTabOrder Widgets = new( + public static readonly ChangeItemPagesRestoreLayoutPagesItemTabOrder Widgets = new( Values.Widgets ); - public DocPagesInsert200ResponseLayoutPagesItemTabOrder(string value) + public ChangeItemPagesRestoreLayoutPagesItemTabOrder(string value) { Value = value; } @@ -41,9 +41,9 @@ public DocPagesInsert200ResponseLayoutPagesItemTabOrder(string value) /// /// Create a string enum with the given value. /// - public static DocPagesInsert200ResponseLayoutPagesItemTabOrder FromCustom(string value) + public static ChangeItemPagesRestoreLayoutPagesItemTabOrder FromCustom(string value) { - return new DocPagesInsert200ResponseLayoutPagesItemTabOrder(value); + return new ChangeItemPagesRestoreLayoutPagesItemTabOrder(value); } public bool Equals(string? other) @@ -60,27 +60,25 @@ public override string ToString() } public static bool operator ==( - DocPagesInsert200ResponseLayoutPagesItemTabOrder value1, + ChangeItemPagesRestoreLayoutPagesItemTabOrder value1, string value2 ) => value1.Value.Equals(value2); public static bool operator !=( - DocPagesInsert200ResponseLayoutPagesItemTabOrder value1, + ChangeItemPagesRestoreLayoutPagesItemTabOrder value1, string value2 ) => !value1.Value.Equals(value2); - public static explicit operator string( - DocPagesInsert200ResponseLayoutPagesItemTabOrder value - ) => value.Value; + public static explicit operator string(ChangeItemPagesRestoreLayoutPagesItemTabOrder value) => + value.Value; - public static explicit operator DocPagesInsert200ResponseLayoutPagesItemTabOrder( - string value - ) => new(value); + public static explicit operator ChangeItemPagesRestoreLayoutPagesItemTabOrder(string value) => + new(value); - internal class DocPagesInsert200ResponseLayoutPagesItemTabOrderSerializer - : JsonConverter + internal class ChangeItemPagesRestoreLayoutPagesItemTabOrderSerializer + : JsonConverter { - public override DocPagesInsert200ResponseLayoutPagesItemTabOrder Read( + public override ChangeItemPagesRestoreLayoutPagesItemTabOrder Read( ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options @@ -91,19 +89,19 @@ JsonSerializerOptions options ?? throw new global::System.Exception( "The JSON value could not be read as a string." ); - return new DocPagesInsert200ResponseLayoutPagesItemTabOrder(stringValue); + return new ChangeItemPagesRestoreLayoutPagesItemTabOrder(stringValue); } public override void Write( Utf8JsonWriter writer, - DocPagesInsert200ResponseLayoutPagesItemTabOrder value, + ChangeItemPagesRestoreLayoutPagesItemTabOrder value, JsonSerializerOptions options ) { writer.WriteStringValue(value.Value); } - public override DocPagesInsert200ResponseLayoutPagesItemTabOrder ReadAsPropertyName( + public override ChangeItemPagesRestoreLayoutPagesItemTabOrder ReadAsPropertyName( ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options @@ -114,12 +112,12 @@ JsonSerializerOptions options ?? throw new global::System.Exception( "The JSON property name could not be read as a string." ); - return new DocPagesInsert200ResponseLayoutPagesItemTabOrder(stringValue); + return new ChangeItemPagesRestoreLayoutPagesItemTabOrder(stringValue); } public override void WriteAsPropertyName( Utf8JsonWriter writer, - DocPagesInsert200ResponseLayoutPagesItemTabOrder value, + ChangeItemPagesRestoreLayoutPagesItemTabOrder value, JsonSerializerOptions options ) { diff --git a/src/CloudPDF/Types/ChangeItemPagesRotate.cs b/src/CloudPDF/Types/ChangeItemPagesRotate.cs new file mode 100644 index 00000000..c0af07e6 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotate.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotate : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pages")] + public IEnumerable Pages { get; set; } = new List(); + + [JsonPropertyName("rotation")] + public required double Rotation { get; set; } + + [JsonPropertyName("layout")] + public required ChangeItemPagesRotateLayout 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/ChangeItemPagesRotateLayout.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayout.cs new file mode 100644 index 00000000..44576ac6 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayout.cs @@ -0,0 +1,36 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayout : 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("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/ChangeItemPagesRotateLayoutNamedPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutNamedPagesItem.cs new file mode 100644 index 00000000..71cd910a --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutNamedPagesItem.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutNamedPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required string Name { get; set; } + + [JsonPropertyName("target")] + public required ChangeItemPagesRotateLayoutNamedPagesItemTarget 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/ChangeItemPagesRotateLayoutNamedPagesItemTarget.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutNamedPagesItemTarget.cs new file mode 100644 index 00000000..83fad61a --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutNamedPagesItemTarget.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(ChangeItemPagesRotateLayoutNamedPagesItemTarget.JsonConverter))] +[Serializable] +public record ChangeItemPagesRotateLayoutNamedPagesItemTarget +{ + internal ChangeItemPagesRotateLayoutNamedPagesItemTarget(string type, object? value) + { + Kind = type; + Value = value; + } + + /// + /// Create an instance of ChangeItemPagesRotateLayoutNamedPagesItemTarget with . + /// + public ChangeItemPagesRotateLayoutNamedPagesItemTarget( + ChangeItemPagesRotateLayoutNamedPagesItemTarget.Page value + ) + { + Kind = "page"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItemPagesRotateLayoutNamedPagesItemTarget with . + /// + public ChangeItemPagesRotateLayoutNamedPagesItemTarget( + ChangeItemPagesRotateLayoutNamedPagesItemTarget.Template value + ) + { + Kind = "template"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeItemPagesRotateLayoutNamedPagesItemTarget with . + /// + public ChangeItemPagesRotateLayoutNamedPagesItemTarget( + ChangeItemPagesRotateLayoutNamedPagesItemTarget.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.ChangeItemPagesRotateLayoutNamedPagesItemTargetPage AsPage() => + IsPage + ? (CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetPage)Value! + : throw new global::System.Exception( + "ChangeItemPagesRotateLayoutNamedPagesItemTarget.Kind is not 'page'" + ); + + /// + /// Returns the value as a if is 'template', otherwise throws an exception. + /// + /// Thrown when is not 'template'. + public CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetTemplate AsTemplate() => + IsTemplate + ? (CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetTemplate)Value! + : throw new global::System.Exception( + "ChangeItemPagesRotateLayoutNamedPagesItemTarget.Kind is not 'template'" + ); + + /// + /// Returns the value as a if is 'dangling', otherwise throws an exception. + /// + /// Thrown when is not 'dangling'. + public CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetDangling AsDangling() => + IsDangling + ? (CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetDangling)Value! + : throw new global::System.Exception( + "ChangeItemPagesRotateLayoutNamedPagesItemTarget.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.ChangeItemPagesRotateLayoutNamedPagesItemTargetPage? value) + { + if (Kind == "page") + { + value = (CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetPage)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsTemplate( + out CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetTemplate? value + ) + { + if (Kind == "template") + { + value = (CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetTemplate)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsDangling( + out CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetDangling? value + ) + { + if (Kind == "dangling") + { + value = (CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetDangling)Value!; + return true; + } + value = null; + return false; + } + + public override string ToString() => JsonUtils.Serialize(this); + + public static implicit operator ChangeItemPagesRotateLayoutNamedPagesItemTarget( + ChangeItemPagesRotateLayoutNamedPagesItemTarget.Page value + ) => new(value); + + public static implicit operator ChangeItemPagesRotateLayoutNamedPagesItemTarget( + ChangeItemPagesRotateLayoutNamedPagesItemTarget.Template value + ) => new(value); + + public static implicit operator ChangeItemPagesRotateLayoutNamedPagesItemTarget( + ChangeItemPagesRotateLayoutNamedPagesItemTarget.Dangling value + ) => new(value); + + [Serializable] + internal sealed class JsonConverter + : JsonConverter + { + public override bool CanConvert(global::System.Type typeToConvert) => + typeof(ChangeItemPagesRotateLayoutNamedPagesItemTarget).IsAssignableFrom(typeToConvert); + + public override ChangeItemPagesRotateLayoutNamedPagesItemTarget 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.ChangeItemPagesRotateLayoutNamedPagesItemTargetPage" + ), + "template" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetTemplate" + ), + "dangling" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetDangling" + ), + _ => json.Deserialize(options), + }; + return new ChangeItemPagesRotateLayoutNamedPagesItemTarget(discriminator, value); + } + + public override void Write( + Utf8JsonWriter writer, + ChangeItemPagesRotateLayoutNamedPagesItemTarget 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 ChangeItemPagesRotateLayoutNamedPagesItemTarget 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 ChangeItemPagesRotateLayoutNamedPagesItemTarget(stringValue, stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ChangeItemPagesRotateLayoutNamedPagesItemTarget value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Kind); + } + } + + /// + /// Discriminated union type for page + /// + [Serializable] + public struct Page + { + public Page(CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetPage value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetPage Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItemPagesRotateLayoutNamedPagesItemTarget.Page( + CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetPage value + ) => new(value); + } + + /// + /// Discriminated union type for template + /// + [Serializable] + public struct Template + { + public Template(CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetTemplate value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetTemplate Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItemPagesRotateLayoutNamedPagesItemTarget.Template( + CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetTemplate value + ) => new(value); + } + + /// + /// Discriminated union type for dangling + /// + [Serializable] + public struct Dangling + { + public Dangling(CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetDangling value) + { + Value = value; + } + + internal CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetDangling Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeItemPagesRotateLayoutNamedPagesItemTarget.Dangling( + CloudPDF.ChangeItemPagesRotateLayoutNamedPagesItemTargetDangling value + ) => new(value); + } +} diff --git a/src/CloudPDF/Types/ChangeItemPagesRotateLayoutNamedPagesItemTargetDangling.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutNamedPagesItemTargetDangling.cs new file mode 100644 index 00000000..7fc20274 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutNamedPagesItemTargetDangling.cs @@ -0,0 +1,25 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutNamedPagesItemTargetDangling : 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/ChangeItemPagesRotateLayoutNamedPagesItemTargetPage.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutNamedPagesItemTargetPage.cs new file mode 100644 index 00000000..b6b3e6e2 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutNamedPagesItemTargetPage.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutNamedPagesItemTargetPage : 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/ChangeItemPagesRotateLayoutNamedPagesItemTargetTemplate.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutNamedPagesItemTargetTemplate.cs new file mode 100644 index 00000000..7ab71e1e --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutNamedPagesItemTargetTemplate.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutNamedPagesItemTargetTemplate : 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/ChangeItemPagesRotateLayoutPagesItem.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItem.cs new file mode 100644 index 00000000..58203e1a --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItem.cs @@ -0,0 +1,55 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutPagesItem : 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 ChangeItemPagesRotateLayoutPagesItemSize Size { get; set; } + + [JsonPropertyName("rotation")] + public required double Rotation { get; set; } + + [JsonPropertyName("userUnit")] + public required double UserUnit { get; set; } + + [JsonPropertyName("tabOrder")] + public ChangeItemPagesRotateLayoutPagesItemTabOrder? TabOrder { get; set; } + + [JsonPropertyName("boxes")] + public required ChangeItemPagesRotateLayoutPagesItemBoxes Boxes { get; set; } + + [JsonPropertyName("pdfCropBox")] + public required ChangeItemPagesRotateLayoutPagesItemPdfCropBox 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/ChangeItemPagesRotateLayoutPagesItemBoxes.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemBoxes.cs new file mode 100644 index 00000000..14c64017 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemBoxes.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutPagesItemBoxes : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("media")] + public required ChangeItemPagesRotateLayoutPagesItemBoxesMedia Media { get; set; } + + [JsonPropertyName("crop")] + public required ChangeItemPagesRotateLayoutPagesItemBoxesCrop Crop { get; set; } + + [JsonPropertyName("bleed")] + public required ChangeItemPagesRotateLayoutPagesItemBoxesBleed Bleed { get; set; } + + [JsonPropertyName("trim")] + public required ChangeItemPagesRotateLayoutPagesItemBoxesTrim Trim { get; set; } + + [JsonPropertyName("art")] + public required ChangeItemPagesRotateLayoutPagesItemBoxesArt 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/ChangeItemPagesRotateLayoutPagesItemBoxesArt.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemBoxesArt.cs new file mode 100644 index 00000000..cfcca6d8 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemBoxesArt.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutPagesItemBoxesArt : 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/ChangeItemPagesRotateLayoutPagesItemBoxesBleed.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemBoxesBleed.cs new file mode 100644 index 00000000..11b8f607 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemBoxesBleed.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutPagesItemBoxesBleed : 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/ChangeItemPagesRotateLayoutPagesItemBoxesCrop.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemBoxesCrop.cs new file mode 100644 index 00000000..3aa6f66b --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemBoxesCrop.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutPagesItemBoxesCrop : 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/ChangeItemPagesRotateLayoutPagesItemBoxesMedia.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemBoxesMedia.cs new file mode 100644 index 00000000..b7ed34d1 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemBoxesMedia.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutPagesItemBoxesMedia : 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/ChangeItemPagesRotateLayoutPagesItemBoxesTrim.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemBoxesTrim.cs new file mode 100644 index 00000000..fb2a66db --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemBoxesTrim.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutPagesItemBoxesTrim : 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/ChangeItemPagesRotateLayoutPagesItemPdfCropBox.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemPdfCropBox.cs new file mode 100644 index 00000000..f0ef58e8 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemPdfCropBox.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutPagesItemPdfCropBox : 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/ChangeItemPagesRotateLayoutPagesItemSize.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemSize.cs new file mode 100644 index 00000000..ac0f6e77 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemSize.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeItemPagesRotateLayoutPagesItemSize : 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/ChangeItemPagesRotateLayoutPagesItemTabOrder.cs b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemTabOrder.cs new file mode 100644 index 00000000..99051e30 --- /dev/null +++ b/src/CloudPDF/Types/ChangeItemPagesRotateLayoutPagesItemTabOrder.cs @@ -0,0 +1,144 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(ChangeItemPagesRotateLayoutPagesItemTabOrder.ChangeItemPagesRotateLayoutPagesItemTabOrderSerializer) +)] +[Serializable] +public readonly record struct ChangeItemPagesRotateLayoutPagesItemTabOrder : IStringEnum +{ + public static readonly ChangeItemPagesRotateLayoutPagesItemTabOrder Rows = new(Values.Rows); + + public static readonly ChangeItemPagesRotateLayoutPagesItemTabOrder Columns = new( + Values.Columns + ); + + public static readonly ChangeItemPagesRotateLayoutPagesItemTabOrder Structure = new( + Values.Structure + ); + + public static readonly ChangeItemPagesRotateLayoutPagesItemTabOrder Annotations = new( + Values.Annotations + ); + + public static readonly ChangeItemPagesRotateLayoutPagesItemTabOrder Widgets = new( + Values.Widgets + ); + + public ChangeItemPagesRotateLayoutPagesItemTabOrder(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ChangeItemPagesRotateLayoutPagesItemTabOrder FromCustom(string value) + { + return new ChangeItemPagesRotateLayoutPagesItemTabOrder(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 ==( + ChangeItemPagesRotateLayoutPagesItemTabOrder value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + ChangeItemPagesRotateLayoutPagesItemTabOrder value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(ChangeItemPagesRotateLayoutPagesItemTabOrder value) => + value.Value; + + public static explicit operator ChangeItemPagesRotateLayoutPagesItemTabOrder(string value) => + new(value); + + internal class ChangeItemPagesRotateLayoutPagesItemTabOrderSerializer + : JsonConverter + { + public override ChangeItemPagesRotateLayoutPagesItemTabOrder 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 ChangeItemPagesRotateLayoutPagesItemTabOrder(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ChangeItemPagesRotateLayoutPagesItemTabOrder value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override ChangeItemPagesRotateLayoutPagesItemTabOrder 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 ChangeItemPagesRotateLayoutPagesItemTabOrder(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ChangeItemPagesRotateLayoutPagesItemTabOrder 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/ChangeItemSkippedOp.cs b/src/CloudPDF/Types/ChangeItemSkippedOp.cs index 6ed83894..6a40f80e 100644 --- a/src/CloudPDF/Types/ChangeItemSkippedOp.cs +++ b/src/CloudPDF/Types/ChangeItemSkippedOp.cs @@ -58,10 +58,40 @@ namespace CloudPDF; Values.MetadataUpdateCustom ); + public static readonly ChangeItemSkippedOp OutlineCreate = new(Values.OutlineCreate); + + public static readonly ChangeItemSkippedOp OutlineUpdate = new(Values.OutlineUpdate); + + public static readonly ChangeItemSkippedOp OutlineMove = new(Values.OutlineMove); + + public static readonly ChangeItemSkippedOp OutlineDelete = new(Values.OutlineDelete); + + public static readonly ChangeItemSkippedOp PagesRotate = new(Values.PagesRotate); + + public static readonly ChangeItemSkippedOp PagesReorder = new(Values.PagesReorder); + + public static readonly ChangeItemSkippedOp PagesDelete = new(Values.PagesDelete); + + public static readonly ChangeItemSkippedOp PagesInsertBlank = new(Values.PagesInsertBlank); + + public static readonly ChangeItemSkippedOp PagesInsert = new(Values.PagesInsert); + + public static readonly ChangeItemSkippedOp AttachmentsCreate = new(Values.AttachmentsCreate); + + public static readonly ChangeItemSkippedOp AttachmentsDelete = new(Values.AttachmentsDelete); + public static readonly ChangeItemSkippedOp AnnotationsRestore = new(Values.AnnotationsRestore); public static readonly ChangeItemSkippedOp FormsRestore = new(Values.FormsRestore); + public static readonly ChangeItemSkippedOp FormsRestoreWidget = new(Values.FormsRestoreWidget); + + public static readonly ChangeItemSkippedOp OutlineRestore = new(Values.OutlineRestore); + + public static readonly ChangeItemSkippedOp PagesRestore = new(Values.PagesRestore); + + public static readonly ChangeItemSkippedOp AttachmentsRestore = new(Values.AttachmentsRestore); + public ChangeItemSkippedOp(string value) { Value = value; @@ -198,8 +228,38 @@ public static class Values public const string MetadataUpdateCustom = "metadata.updateCustom"; + public const string OutlineCreate = "outline.create"; + + public const string OutlineUpdate = "outline.update"; + + public const string OutlineMove = "outline.move"; + + public const string OutlineDelete = "outline.delete"; + + public const string PagesRotate = "pages.rotate"; + + public const string PagesReorder = "pages.reorder"; + + public const string PagesDelete = "pages.delete"; + + public const string PagesInsertBlank = "pages.insertBlank"; + + public const string PagesInsert = "pages.insert"; + + public const string AttachmentsCreate = "attachments.create"; + + public const string AttachmentsDelete = "attachments.delete"; + public const string AnnotationsRestore = "annotations.restore"; public const string FormsRestore = "forms.restore"; + + public const string FormsRestoreWidget = "forms.restoreWidget"; + + public const string OutlineRestore = "outline.restore"; + + public const string PagesRestore = "pages.restore"; + + public const string AttachmentsRestore = "attachments.restore"; } } diff --git a/src/CloudPDF/Types/ChangeOp.cs b/src/CloudPDF/Types/ChangeOp.cs index 371ad973..5356311c 100644 --- a/src/CloudPDF/Types/ChangeOp.cs +++ b/src/CloudPDF/Types/ChangeOp.cs @@ -198,6 +198,105 @@ public ChangeOp(ChangeOp.MetadataUpdateCustom value) Value = value.Value; } + /// + /// Create an instance of ChangeOp with . + /// + public ChangeOp(ChangeOp.OutlineCreate value) + { + Type = "outline.create"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeOp with . + /// + public ChangeOp(ChangeOp.OutlineUpdate value) + { + Type = "outline.update"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeOp with . + /// + public ChangeOp(ChangeOp.OutlineMove value) + { + Type = "outline.move"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeOp with . + /// + public ChangeOp(ChangeOp.OutlineDelete value) + { + Type = "outline.delete"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeOp with . + /// + public ChangeOp(ChangeOp.PagesRotate value) + { + Type = "pages.rotate"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeOp with . + /// + public ChangeOp(ChangeOp.PagesReorder value) + { + Type = "pages.reorder"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeOp with . + /// + public ChangeOp(ChangeOp.PagesDelete value) + { + Type = "pages.delete"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeOp with . + /// + public ChangeOp(ChangeOp.PagesInsertBlank value) + { + Type = "pages.insertBlank"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeOp with . + /// + public ChangeOp(ChangeOp.PagesInsert value) + { + Type = "pages.insert"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeOp with . + /// + public ChangeOp(ChangeOp.AttachmentsCreate value) + { + Type = "attachments.create"; + Value = value.Value; + } + + /// + /// Create an instance of ChangeOp with . + /// + public ChangeOp(ChangeOp.AttachmentsDelete value) + { + Type = "attachments.delete"; + Value = value.Value; + } + /// /// Discriminant value /// @@ -309,6 +408,61 @@ public ChangeOp(ChangeOp.MetadataUpdateCustom value) /// public bool IsMetadataUpdateCustom => Type == "metadata.updateCustom"; + /// + /// Returns true if is "outline.create" + /// + public bool IsOutlineCreate => Type == "outline.create"; + + /// + /// Returns true if is "outline.update" + /// + public bool IsOutlineUpdate => Type == "outline.update"; + + /// + /// Returns true if is "outline.move" + /// + public bool IsOutlineMove => Type == "outline.move"; + + /// + /// Returns true if is "outline.delete" + /// + public bool IsOutlineDelete => Type == "outline.delete"; + + /// + /// Returns true if is "pages.rotate" + /// + public bool IsPagesRotate => Type == "pages.rotate"; + + /// + /// Returns true if is "pages.reorder" + /// + public bool IsPagesReorder => Type == "pages.reorder"; + + /// + /// Returns true if is "pages.delete" + /// + public bool IsPagesDelete => Type == "pages.delete"; + + /// + /// Returns true if is "pages.insertBlank" + /// + public bool IsPagesInsertBlank => Type == "pages.insertBlank"; + + /// + /// Returns true if is "pages.insert" + /// + public bool IsPagesInsert => Type == "pages.insert"; + + /// + /// Returns true if is "attachments.create" + /// + public bool IsAttachmentsCreate => Type == "attachments.create"; + + /// + /// Returns true if is "attachments.delete" + /// + public bool IsAttachmentsDelete => Type == "attachments.delete"; + /// /// Returns the value as a if is 'annotations.create', otherwise throws an exception. /// @@ -493,6 +647,105 @@ public CloudPDF.ChangeOpMetadataUpdateCustom AsMetadataUpdateCustom() => ? (CloudPDF.ChangeOpMetadataUpdateCustom)Value! : throw new global::System.Exception("ChangeOp.Type is not 'metadata.updateCustom'"); + /// + /// Returns the value as a if is 'outline.create', otherwise throws an exception. + /// + /// Thrown when is not 'outline.create'. + public CloudPDF.ChangeOpOutlineCreate AsOutlineCreate() => + IsOutlineCreate + ? (CloudPDF.ChangeOpOutlineCreate)Value! + : throw new global::System.Exception("ChangeOp.Type is not 'outline.create'"); + + /// + /// Returns the value as a if is 'outline.update', otherwise throws an exception. + /// + /// Thrown when is not 'outline.update'. + public CloudPDF.ChangeOpOutlineUpdate AsOutlineUpdate() => + IsOutlineUpdate + ? (CloudPDF.ChangeOpOutlineUpdate)Value! + : throw new global::System.Exception("ChangeOp.Type is not 'outline.update'"); + + /// + /// Returns the value as a if is 'outline.move', otherwise throws an exception. + /// + /// Thrown when is not 'outline.move'. + public CloudPDF.ChangeOpOutlineMove AsOutlineMove() => + IsOutlineMove + ? (CloudPDF.ChangeOpOutlineMove)Value! + : throw new global::System.Exception("ChangeOp.Type is not 'outline.move'"); + + /// + /// Returns the value as a if is 'outline.delete', otherwise throws an exception. + /// + /// Thrown when is not 'outline.delete'. + public CloudPDF.ChangeOpOutlineDelete AsOutlineDelete() => + IsOutlineDelete + ? (CloudPDF.ChangeOpOutlineDelete)Value! + : throw new global::System.Exception("ChangeOp.Type is not 'outline.delete'"); + + /// + /// Returns the value as a if is 'pages.rotate', otherwise throws an exception. + /// + /// Thrown when is not 'pages.rotate'. + public CloudPDF.ChangeOpPagesRotate AsPagesRotate() => + IsPagesRotate + ? (CloudPDF.ChangeOpPagesRotate)Value! + : throw new global::System.Exception("ChangeOp.Type is not 'pages.rotate'"); + + /// + /// Returns the value as a if is 'pages.reorder', otherwise throws an exception. + /// + /// Thrown when is not 'pages.reorder'. + public CloudPDF.ChangeOpPagesReorder AsPagesReorder() => + IsPagesReorder + ? (CloudPDF.ChangeOpPagesReorder)Value! + : throw new global::System.Exception("ChangeOp.Type is not 'pages.reorder'"); + + /// + /// Returns the value as a if is 'pages.delete', otherwise throws an exception. + /// + /// Thrown when is not 'pages.delete'. + public CloudPDF.ChangeOpPagesDelete AsPagesDelete() => + IsPagesDelete + ? (CloudPDF.ChangeOpPagesDelete)Value! + : throw new global::System.Exception("ChangeOp.Type is not 'pages.delete'"); + + /// + /// Returns the value as a if is 'pages.insertBlank', otherwise throws an exception. + /// + /// Thrown when is not 'pages.insertBlank'. + public CloudPDF.ChangeOpPagesInsertBlank AsPagesInsertBlank() => + IsPagesInsertBlank + ? (CloudPDF.ChangeOpPagesInsertBlank)Value! + : throw new global::System.Exception("ChangeOp.Type is not 'pages.insertBlank'"); + + /// + /// Returns the value as a if is 'pages.insert', otherwise throws an exception. + /// + /// Thrown when is not 'pages.insert'. + public CloudPDF.ChangeOpPagesInsert AsPagesInsert() => + IsPagesInsert + ? (CloudPDF.ChangeOpPagesInsert)Value! + : throw new global::System.Exception("ChangeOp.Type is not 'pages.insert'"); + + /// + /// Returns the value as a if is 'attachments.create', otherwise throws an exception. + /// + /// Thrown when is not 'attachments.create'. + public CloudPDF.ChangeOpAttachmentsCreate AsAttachmentsCreate() => + IsAttachmentsCreate + ? (CloudPDF.ChangeOpAttachmentsCreate)Value! + : throw new global::System.Exception("ChangeOp.Type is not 'attachments.create'"); + + /// + /// Returns the value as a if is 'attachments.delete', otherwise throws an exception. + /// + /// Thrown when is not 'attachments.delete'. + public CloudPDF.ChangeOpAttachmentsDelete AsAttachmentsDelete() => + IsAttachmentsDelete + ? (CloudPDF.ChangeOpAttachmentsDelete)Value! + : throw new global::System.Exception("ChangeOp.Type is not 'attachments.delete'"); + public T Match( Func onAnnotationsCreate, Func onAnnotationsUpdate, @@ -514,6 +767,17 @@ public T Match( Func onFormsSetSignatureAppearance, Func onMetadataUpdate, Func onMetadataUpdateCustom, + Func onOutlineCreate, + Func onOutlineUpdate, + Func onOutlineMove, + Func onOutlineDelete, + Func onPagesRotate, + Func onPagesReorder, + Func onPagesDelete, + Func onPagesInsertBlank, + Func onPagesInsert, + Func onAttachmentsCreate, + Func onAttachmentsDelete, Func onUnknown_ ) { @@ -541,6 +805,17 @@ public T Match( ), "metadata.update" => onMetadataUpdate(AsMetadataUpdate()), "metadata.updateCustom" => onMetadataUpdateCustom(AsMetadataUpdateCustom()), + "outline.create" => onOutlineCreate(AsOutlineCreate()), + "outline.update" => onOutlineUpdate(AsOutlineUpdate()), + "outline.move" => onOutlineMove(AsOutlineMove()), + "outline.delete" => onOutlineDelete(AsOutlineDelete()), + "pages.rotate" => onPagesRotate(AsPagesRotate()), + "pages.reorder" => onPagesReorder(AsPagesReorder()), + "pages.delete" => onPagesDelete(AsPagesDelete()), + "pages.insertBlank" => onPagesInsertBlank(AsPagesInsertBlank()), + "pages.insert" => onPagesInsert(AsPagesInsert()), + "attachments.create" => onAttachmentsCreate(AsAttachmentsCreate()), + "attachments.delete" => onAttachmentsDelete(AsAttachmentsDelete()), _ => onUnknown_(Type, Value), }; } @@ -566,6 +841,17 @@ public void Visit( Action onFormsSetSignatureAppearance, Action onMetadataUpdate, Action onMetadataUpdateCustom, + Action onOutlineCreate, + Action onOutlineUpdate, + Action onOutlineMove, + Action onOutlineDelete, + Action onPagesRotate, + Action onPagesReorder, + Action onPagesDelete, + Action onPagesInsertBlank, + Action onPagesInsert, + Action onAttachmentsCreate, + Action onAttachmentsDelete, Action onUnknown_ ) { @@ -631,6 +917,39 @@ public void Visit( case "metadata.updateCustom": onMetadataUpdateCustom(AsMetadataUpdateCustom()); break; + case "outline.create": + onOutlineCreate(AsOutlineCreate()); + break; + case "outline.update": + onOutlineUpdate(AsOutlineUpdate()); + break; + case "outline.move": + onOutlineMove(AsOutlineMove()); + break; + case "outline.delete": + onOutlineDelete(AsOutlineDelete()); + break; + case "pages.rotate": + onPagesRotate(AsPagesRotate()); + break; + case "pages.reorder": + onPagesReorder(AsPagesReorder()); + break; + case "pages.delete": + onPagesDelete(AsPagesDelete()); + break; + case "pages.insertBlank": + onPagesInsertBlank(AsPagesInsertBlank()); + break; + case "pages.insert": + onPagesInsert(AsPagesInsert()); + break; + case "attachments.create": + onAttachmentsCreate(AsAttachmentsCreate()); + break; + case "attachments.delete": + onAttachmentsDelete(AsAttachmentsDelete()); + break; default: onUnknown_(Type, Value); break; @@ -919,6 +1238,160 @@ public bool TryAsMetadataUpdateCustom(out CloudPDF.ChangeOpMetadataUpdateCustom? return false; } + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsOutlineCreate(out CloudPDF.ChangeOpOutlineCreate? value) + { + if (Type == "outline.create") + { + value = (CloudPDF.ChangeOpOutlineCreate)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsOutlineUpdate(out CloudPDF.ChangeOpOutlineUpdate? value) + { + if (Type == "outline.update") + { + value = (CloudPDF.ChangeOpOutlineUpdate)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsOutlineMove(out CloudPDF.ChangeOpOutlineMove? value) + { + if (Type == "outline.move") + { + value = (CloudPDF.ChangeOpOutlineMove)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsOutlineDelete(out CloudPDF.ChangeOpOutlineDelete? value) + { + if (Type == "outline.delete") + { + value = (CloudPDF.ChangeOpOutlineDelete)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPagesRotate(out CloudPDF.ChangeOpPagesRotate? value) + { + if (Type == "pages.rotate") + { + value = (CloudPDF.ChangeOpPagesRotate)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPagesReorder(out CloudPDF.ChangeOpPagesReorder? value) + { + if (Type == "pages.reorder") + { + value = (CloudPDF.ChangeOpPagesReorder)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPagesDelete(out CloudPDF.ChangeOpPagesDelete? value) + { + if (Type == "pages.delete") + { + value = (CloudPDF.ChangeOpPagesDelete)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPagesInsertBlank(out CloudPDF.ChangeOpPagesInsertBlank? value) + { + if (Type == "pages.insertBlank") + { + value = (CloudPDF.ChangeOpPagesInsertBlank)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsPagesInsert(out CloudPDF.ChangeOpPagesInsert? value) + { + if (Type == "pages.insert") + { + value = (CloudPDF.ChangeOpPagesInsert)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsAttachmentsCreate(out CloudPDF.ChangeOpAttachmentsCreate? value) + { + if (Type == "attachments.create") + { + value = (CloudPDF.ChangeOpAttachmentsCreate)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsAttachmentsDelete(out CloudPDF.ChangeOpAttachmentsDelete? value) + { + if (Type == "attachments.delete") + { + value = (CloudPDF.ChangeOpAttachmentsDelete)Value!; + return true; + } + value = null; + return false; + } + public override string ToString() => JsonUtils.Serialize(this); public static implicit operator ChangeOp(ChangeOp.AnnotationsCreate value) => new(value); @@ -962,6 +1435,28 @@ public static implicit operator ChangeOp(ChangeOp.FormsSetSignatureAppearance va public static implicit operator ChangeOp(ChangeOp.MetadataUpdateCustom value) => new(value); + public static implicit operator ChangeOp(ChangeOp.OutlineCreate value) => new(value); + + public static implicit operator ChangeOp(ChangeOp.OutlineUpdate value) => new(value); + + public static implicit operator ChangeOp(ChangeOp.OutlineMove value) => new(value); + + public static implicit operator ChangeOp(ChangeOp.OutlineDelete value) => new(value); + + public static implicit operator ChangeOp(ChangeOp.PagesRotate value) => new(value); + + public static implicit operator ChangeOp(ChangeOp.PagesReorder value) => new(value); + + public static implicit operator ChangeOp(ChangeOp.PagesDelete value) => new(value); + + public static implicit operator ChangeOp(ChangeOp.PagesInsertBlank value) => new(value); + + public static implicit operator ChangeOp(ChangeOp.PagesInsert value) => new(value); + + public static implicit operator ChangeOp(ChangeOp.AttachmentsCreate value) => new(value); + + public static implicit operator ChangeOp(ChangeOp.AttachmentsDelete value) => new(value); + [Serializable] internal sealed class JsonConverter : JsonConverter { @@ -1125,6 +1620,67 @@ JsonSerializerOptions options ?? throw new JsonException( "Failed to deserialize CloudPDF.ChangeOpMetadataUpdateCustom" ), + "outline.create" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeOpOutlineCreate" + ), + "outline.update" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeOpOutlineUpdate" + ), + "outline.move" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeOpOutlineMove" + ), + "outline.delete" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeOpOutlineDelete" + ), + "pages.rotate" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeOpPagesRotate" + ), + "pages.reorder" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeOpPagesReorder" + ), + "pages.delete" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeOpPagesDelete" + ), + "pages.insertBlank" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeOpPagesInsertBlank" + ), + "pages.insert" => + jsonWithoutDiscriminator.Deserialize(options) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeOpPagesInsert" + ), + "attachments.create" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeOpAttachmentsCreate" + ), + "attachments.delete" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.ChangeOpAttachmentsDelete" + ), _ => json.Deserialize(options), }; return new ChangeOp(discriminator, value); @@ -1168,6 +1724,17 @@ JsonSerializerOptions options ), "metadata.update" => JsonSerializer.SerializeToNode(value.Value, options), "metadata.updateCustom" => JsonSerializer.SerializeToNode(value.Value, options), + "outline.create" => JsonSerializer.SerializeToNode(value.Value, options), + "outline.update" => JsonSerializer.SerializeToNode(value.Value, options), + "outline.move" => JsonSerializer.SerializeToNode(value.Value, options), + "outline.delete" => JsonSerializer.SerializeToNode(value.Value, options), + "pages.rotate" => JsonSerializer.SerializeToNode(value.Value, options), + "pages.reorder" => JsonSerializer.SerializeToNode(value.Value, options), + "pages.delete" => JsonSerializer.SerializeToNode(value.Value, options), + "pages.insertBlank" => JsonSerializer.SerializeToNode(value.Value, options), + "pages.insert" => JsonSerializer.SerializeToNode(value.Value, options), + "attachments.create" => JsonSerializer.SerializeToNode(value.Value, options), + "attachments.delete" => JsonSerializer.SerializeToNode(value.Value, options), _ => JsonSerializer.SerializeToNode(value.Value, options), } ?? new JsonObject(); json["type"] = value.Type; @@ -1591,4 +2158,220 @@ public static implicit operator ChangeOp.MetadataUpdateCustom( CloudPDF.ChangeOpMetadataUpdateCustom value ) => new(value); } + + /// + /// Discriminated union type for outline.create + /// + [Serializable] + public struct OutlineCreate + { + public OutlineCreate(CloudPDF.ChangeOpOutlineCreate value) + { + Value = value; + } + + internal CloudPDF.ChangeOpOutlineCreate Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeOp.OutlineCreate( + CloudPDF.ChangeOpOutlineCreate value + ) => new(value); + } + + /// + /// Discriminated union type for outline.update + /// + [Serializable] + public struct OutlineUpdate + { + public OutlineUpdate(CloudPDF.ChangeOpOutlineUpdate value) + { + Value = value; + } + + internal CloudPDF.ChangeOpOutlineUpdate Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeOp.OutlineUpdate( + CloudPDF.ChangeOpOutlineUpdate value + ) => new(value); + } + + /// + /// Discriminated union type for outline.move + /// + [Serializable] + public struct OutlineMove + { + public OutlineMove(CloudPDF.ChangeOpOutlineMove value) + { + Value = value; + } + + internal CloudPDF.ChangeOpOutlineMove Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeOp.OutlineMove(CloudPDF.ChangeOpOutlineMove value) => + new(value); + } + + /// + /// Discriminated union type for outline.delete + /// + [Serializable] + public struct OutlineDelete + { + public OutlineDelete(CloudPDF.ChangeOpOutlineDelete value) + { + Value = value; + } + + internal CloudPDF.ChangeOpOutlineDelete Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeOp.OutlineDelete( + CloudPDF.ChangeOpOutlineDelete value + ) => new(value); + } + + /// + /// Discriminated union type for pages.rotate + /// + [Serializable] + public struct PagesRotate + { + public PagesRotate(CloudPDF.ChangeOpPagesRotate value) + { + Value = value; + } + + internal CloudPDF.ChangeOpPagesRotate Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeOp.PagesRotate(CloudPDF.ChangeOpPagesRotate value) => + new(value); + } + + /// + /// Discriminated union type for pages.reorder + /// + [Serializable] + public struct PagesReorder + { + public PagesReorder(CloudPDF.ChangeOpPagesReorder value) + { + Value = value; + } + + internal CloudPDF.ChangeOpPagesReorder Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeOp.PagesReorder( + CloudPDF.ChangeOpPagesReorder value + ) => new(value); + } + + /// + /// Discriminated union type for pages.delete + /// + [Serializable] + public struct PagesDelete + { + public PagesDelete(CloudPDF.ChangeOpPagesDelete value) + { + Value = value; + } + + internal CloudPDF.ChangeOpPagesDelete Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeOp.PagesDelete(CloudPDF.ChangeOpPagesDelete value) => + new(value); + } + + /// + /// Discriminated union type for pages.insertBlank + /// + [Serializable] + public struct PagesInsertBlank + { + public PagesInsertBlank(CloudPDF.ChangeOpPagesInsertBlank value) + { + Value = value; + } + + internal CloudPDF.ChangeOpPagesInsertBlank Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeOp.PagesInsertBlank( + CloudPDF.ChangeOpPagesInsertBlank value + ) => new(value); + } + + /// + /// Discriminated union type for pages.insert + /// + [Serializable] + public struct PagesInsert + { + public PagesInsert(CloudPDF.ChangeOpPagesInsert value) + { + Value = value; + } + + internal CloudPDF.ChangeOpPagesInsert Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeOp.PagesInsert(CloudPDF.ChangeOpPagesInsert value) => + new(value); + } + + /// + /// Discriminated union type for attachments.create + /// + [Serializable] + public struct AttachmentsCreate + { + public AttachmentsCreate(CloudPDF.ChangeOpAttachmentsCreate value) + { + Value = value; + } + + internal CloudPDF.ChangeOpAttachmentsCreate Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeOp.AttachmentsCreate( + CloudPDF.ChangeOpAttachmentsCreate value + ) => new(value); + } + + /// + /// Discriminated union type for attachments.delete + /// + [Serializable] + public struct AttachmentsDelete + { + public AttachmentsDelete(CloudPDF.ChangeOpAttachmentsDelete value) + { + Value = value; + } + + internal CloudPDF.ChangeOpAttachmentsDelete Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator ChangeOp.AttachmentsDelete( + CloudPDF.ChangeOpAttachmentsDelete value + ) => new(value); + } } diff --git a/src/CloudPDF/Types/ChangeOpAttachmentsCreate.cs b/src/CloudPDF/Types/ChangeOpAttachmentsCreate.cs new file mode 100644 index 00000000..ed0ea5e9 --- /dev/null +++ b/src/CloudPDF/Types/ChangeOpAttachmentsCreate.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeOpAttachmentsCreate : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("file")] + public required AttachmentFileBase File { get; set; } + + [JsonPropertyName("resources")] + public required ChangeOpAttachmentsCreateResources Resources { 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/ChangeOpAttachmentsCreateResources.cs b/src/CloudPDF/Types/ChangeOpAttachmentsCreateResources.cs new file mode 100644 index 00000000..fa5f9dde --- /dev/null +++ b/src/CloudPDF/Types/ChangeOpAttachmentsCreateResources.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeOpAttachmentsCreateResources : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("file")] + public required string File { 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/DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetDangling.cs b/src/CloudPDF/Types/ChangeOpAttachmentsDelete.cs similarity index 81% rename from src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetDangling.cs rename to src/CloudPDF/Types/ChangeOpAttachmentsDelete.cs index 8bfa8d27..c7616f8a 100644 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetDangling.cs +++ b/src/CloudPDF/Types/ChangeOpAttachmentsDelete.cs @@ -5,12 +5,15 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetDangling : IJsonOnDeserialized +public record ChangeOpAttachmentsDelete : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = new Dictionary(); + [JsonPropertyName("ref")] + public required AttachmentRef Ref { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/ChangeOpOutlineCreate.cs b/src/CloudPDF/Types/ChangeOpOutlineCreate.cs new file mode 100644 index 00000000..9a132f05 --- /dev/null +++ b/src/CloudPDF/Types/ChangeOpOutlineCreate.cs @@ -0,0 +1,38 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using OneOf; + +namespace CloudPDF; + +[Serializable] +public record ChangeOpOutlineCreate : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("parent")] + public OutlineItemRef? Parent { get; set; } + + [JsonPropertyName("position")] + public OneOf? Position { get; set; } + + [JsonPropertyName("data")] + public required OutlineItemDraft Data { get; set; } + + [JsonPropertyName("objectNumber")] + public 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/ChangeOpOutlineDelete.cs b/src/CloudPDF/Types/ChangeOpOutlineDelete.cs new file mode 100644 index 00000000..9b20ea79 --- /dev/null +++ b/src/CloudPDF/Types/ChangeOpOutlineDelete.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeOpOutlineDelete : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("ref")] + public required OutlineItemRef Ref { get; set; } + + [JsonPropertyName("expect")] + public OutlineItemPatch? Expect { 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/DocPagesDelete200ResponseLayoutPagesItemBoxesMedia.cs b/src/CloudPDF/Types/ChangeOpOutlineMove.cs similarity index 61% rename from src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesMedia.cs rename to src/CloudPDF/Types/ChangeOpOutlineMove.cs index 82d10de2..468d3105 100644 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesMedia.cs +++ b/src/CloudPDF/Types/ChangeOpOutlineMove.cs @@ -1,27 +1,25 @@ using CloudPDF.Core; using global::System.Text.Json; using global::System.Text.Json.Serialization; +using OneOf; namespace CloudPDF; [Serializable] -public record DocPagesDelete200ResponseLayoutPagesItemBoxesMedia : IJsonOnDeserialized +public record ChangeOpOutlineMove : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = new Dictionary(); - [JsonPropertyName("x")] - public required double X { get; set; } + [JsonPropertyName("refs")] + public IEnumerable Refs { get; set; } = new List(); - [JsonPropertyName("y")] - public required double Y { get; set; } + [JsonPropertyName("parent")] + public OutlineItemRef? Parent { get; set; } - [JsonPropertyName("width")] - public required double Width { get; set; } - - [JsonPropertyName("height")] - public required double Height { get; set; } + [JsonPropertyName("position")] + public required OneOf Position { get; set; } [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/ChangeOpOutlineUpdate.cs b/src/CloudPDF/Types/ChangeOpOutlineUpdate.cs new file mode 100644 index 00000000..abc062ee --- /dev/null +++ b/src/CloudPDF/Types/ChangeOpOutlineUpdate.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeOpOutlineUpdate : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("ref")] + public required OutlineItemRef Ref { get; set; } + + [JsonPropertyName("patch")] + public required OutlineItemPatch Patch { get; set; } + + [JsonPropertyName("expect")] + public OutlineItemPatch? Expect { 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/ChangeOpPagesDelete.cs b/src/CloudPDF/Types/ChangeOpPagesDelete.cs new file mode 100644 index 00000000..68471f17 --- /dev/null +++ b/src/CloudPDF/Types/ChangeOpPagesDelete.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeOpPagesDelete : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pages")] + public IEnumerable Pages { 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/ChangeOpPagesInsert.cs b/src/CloudPDF/Types/ChangeOpPagesInsert.cs new file mode 100644 index 00000000..04572629 --- /dev/null +++ b/src/CloudPDF/Types/ChangeOpPagesInsert.cs @@ -0,0 +1,32 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using OneOf; + +namespace CloudPDF; + +[Serializable] +public record ChangeOpPagesInsert : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("resources")] + public required ChangeOpPagesInsertResources Resources { get; set; } + + [JsonPropertyName("position")] + public OneOf? Position { 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/ChangeOpPagesInsertBlank.cs b/src/CloudPDF/Types/ChangeOpPagesInsertBlank.cs new file mode 100644 index 00000000..2c6d465f --- /dev/null +++ b/src/CloudPDF/Types/ChangeOpPagesInsertBlank.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 ChangeOpPagesInsertBlank : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("spec")] + public required ChangeOpPagesInsertBlankSpec Spec { get; set; } + + [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/ChangeOpPagesInsertBlankSpec.cs b/src/CloudPDF/Types/ChangeOpPagesInsertBlankSpec.cs new file mode 100644 index 00000000..8dfbffd6 --- /dev/null +++ b/src/CloudPDF/Types/ChangeOpPagesInsertBlankSpec.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeOpPagesInsertBlankSpec : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("size")] + public required ChangeOpPagesInsertBlankSpecSize Size { get; set; } + + [JsonPropertyName("count")] + public 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/ChangeOpPagesInsertBlankSpecSize.cs b/src/CloudPDF/Types/ChangeOpPagesInsertBlankSpecSize.cs new file mode 100644 index 00000000..2bacb9e6 --- /dev/null +++ b/src/CloudPDF/Types/ChangeOpPagesInsertBlankSpecSize.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeOpPagesInsertBlankSpecSize : 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/ChangeOpPagesInsertResources.cs b/src/CloudPDF/Types/ChangeOpPagesInsertResources.cs new file mode 100644 index 00000000..253bef12 --- /dev/null +++ b/src/CloudPDF/Types/ChangeOpPagesInsertResources.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ChangeOpPagesInsertResources : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("source")] + public required string Source { 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/ChangeOpPagesReorder.cs b/src/CloudPDF/Types/ChangeOpPagesReorder.cs new file mode 100644 index 00000000..e3ad8d06 --- /dev/null +++ b/src/CloudPDF/Types/ChangeOpPagesReorder.cs @@ -0,0 +1,32 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; +using OneOf; + +namespace CloudPDF; + +[Serializable] +public record ChangeOpPagesReorder : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pages")] + public IEnumerable Pages { get; set; } = new List(); + + [JsonPropertyName("position")] + public required OneOf Position { 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/DocPagesInsertBlank200ResponseLayoutPagesItemSize.cs b/src/CloudPDF/Types/ChangeOpPagesRotate.cs similarity index 71% rename from src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemSize.cs rename to src/CloudPDF/Types/ChangeOpPagesRotate.cs index 720d0749..00497d21 100644 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemSize.cs +++ b/src/CloudPDF/Types/ChangeOpPagesRotate.cs @@ -5,17 +5,17 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsertBlank200ResponseLayoutPagesItemSize : IJsonOnDeserialized +public record ChangeOpPagesRotate : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = new Dictionary(); - [JsonPropertyName("width")] - public required double Width { get; set; } + [JsonPropertyName("pages")] + public IEnumerable Pages { get; set; } = new List(); - [JsonPropertyName("height")] - public required double Height { get; set; } + [JsonPropertyName("rotation")] + public required double Rotation { 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 33ae9cbd..620b0a97 100644 --- a/src/CloudPDF/Types/DocManifest200Response.cs +++ b/src/CloudPDF/Types/DocManifest200Response.cs @@ -32,6 +32,9 @@ public record DocManifest200Response : IJsonOnDeserialized [JsonPropertyName("formsVersion")] public int? FormsVersion { get; set; } + [JsonPropertyName("outlineVersion")] + public int? OutlineVersion { get; set; } + [JsonPropertyName("auditHead")] public required int AuditHead { get; set; } diff --git a/src/CloudPDF/Types/DocManifest200ResponseScopes.cs b/src/CloudPDF/Types/DocManifest200ResponseScopes.cs index 0ea3ae32..2ea69a5d 100644 --- a/src/CloudPDF/Types/DocManifest200ResponseScopes.cs +++ b/src/CloudPDF/Types/DocManifest200ResponseScopes.cs @@ -32,6 +32,9 @@ public record DocManifest200ResponseScopes : IJsonOnDeserialized [JsonPropertyName("actions")] public required DocManifest200ResponseScopesActions Actions { get; set; } + [JsonPropertyName("outline")] + public required DocManifest200ResponseScopesOutline Outline { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocManifest200ResponseScopesOutline.cs b/src/CloudPDF/Types/DocManifest200ResponseScopesOutline.cs new file mode 100644 index 00000000..b26c11ee --- /dev/null +++ b/src/CloudPDF/Types/DocManifest200ResponseScopesOutline.cs @@ -0,0 +1,119 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocManifest200ResponseScopesOutline.DocManifest200ResponseScopesOutlineSerializer) +)] +[Serializable] +public readonly record struct DocManifest200ResponseScopesOutline : IStringEnum +{ + public static readonly DocManifest200ResponseScopesOutline Base = new(Values.Base); + + public static readonly DocManifest200ResponseScopesOutline Layer = new(Values.Layer); + + public DocManifest200ResponseScopesOutline(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocManifest200ResponseScopesOutline FromCustom(string value) + { + return new DocManifest200ResponseScopesOutline(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 ==(DocManifest200ResponseScopesOutline value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocManifest200ResponseScopesOutline value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocManifest200ResponseScopesOutline value) => + value.Value; + + public static explicit operator DocManifest200ResponseScopesOutline(string value) => new(value); + + internal class DocManifest200ResponseScopesOutlineSerializer + : JsonConverter + { + public override DocManifest200ResponseScopesOutline 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 DocManifest200ResponseScopesOutline(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocManifest200ResponseScopesOutline value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocManifest200ResponseScopesOutline 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 DocManifest200ResponseScopesOutline(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocManifest200ResponseScopesOutline value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Base = "base"; + + public const string Layer = "layer"; + } +} diff --git a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesBleed.cs b/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesBleed.cs deleted file mode 100644 index 12bb7dc9..00000000 --- a/src/CloudPDF/Types/DocPagesDelete200ResponseLayoutPagesItemBoxesBleed.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesDelete200ResponseLayoutPagesItemBoxesBleed : 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/DocPagesInsert200ResponseLayoutPagesItemBoxesCrop.cs b/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxesCrop.cs deleted file mode 100644 index 3c7c75fd..00000000 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxesCrop.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesInsert200ResponseLayoutPagesItemBoxesCrop : 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/DocPagesInsert200ResponseLayoutPagesItemBoxesTrim.cs b/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxesTrim.cs deleted file mode 100644 index 4d29b868..00000000 --- a/src/CloudPDF/Types/DocPagesInsert200ResponseLayoutPagesItemBoxesTrim.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesInsert200ResponseLayoutPagesItemBoxesTrim : 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/DocPagesInsertBlank200ResponseLayout.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayout.cs deleted file mode 100644 index 2f39a826..00000000 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayout.cs +++ /dev/null @@ -1,36 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesInsertBlank200ResponseLayout : 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("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/DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.cs deleted file mode 100644 index 3f8836fa..00000000 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.cs +++ /dev/null @@ -1,402 +0,0 @@ -// 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(DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.JsonConverter))] -[Serializable] -public record DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget -{ - internal DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget(string type, object? value) - { - Kind = type; - Value = value; - } - - /// - /// Create an instance of DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget with . - /// - public DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget( - DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.Page value - ) - { - Kind = "page"; - Value = value.Value; - } - - /// - /// Create an instance of DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget with . - /// - public DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget( - DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.Template value - ) - { - Kind = "template"; - Value = value.Value; - } - - /// - /// Create an instance of DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget with . - /// - public DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget( - DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.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.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetPage AsPage() => - IsPage - ? (CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetPage)Value! - : throw new global::System.Exception( - "DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.Kind is not 'page'" - ); - - /// - /// Returns the value as a if is 'template', otherwise throws an exception. - /// - /// Thrown when is not 'template'. - public CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetTemplate AsTemplate() => - IsTemplate - ? (CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetTemplate)Value! - : throw new global::System.Exception( - "DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.Kind is not 'template'" - ); - - /// - /// Returns the value as a if is 'dangling', otherwise throws an exception. - /// - /// Thrown when is not 'dangling'. - public CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetDangling AsDangling() => - IsDangling - ? (CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetDangling)Value! - : throw new global::System.Exception( - "DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.Kind is not 'dangling'" - ); - - public T Match( - Func onPage, - Func< - CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetTemplate, - T - > onTemplate, - Func< - CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetDangling, - T - > 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.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetPage? value - ) - { - if (Kind == "page") - { - value = (CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetPage)Value!; - return true; - } - value = null; - return false; - } - - /// - /// Attempts to cast the value to a and returns true if successful. - /// - public bool TryAsTemplate( - out CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetTemplate? value - ) - { - if (Kind == "template") - { - value = (CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetTemplate) - Value!; - return true; - } - value = null; - return false; - } - - /// - /// Attempts to cast the value to a and returns true if successful. - /// - public bool TryAsDangling( - out CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetDangling? value - ) - { - if (Kind == "dangling") - { - value = (CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetDangling) - Value!; - return true; - } - value = null; - return false; - } - - public override string ToString() => JsonUtils.Serialize(this); - - public static implicit operator DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget( - DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.Page value - ) => new(value); - - public static implicit operator DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget( - DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.Template value - ) => new(value); - - public static implicit operator DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget( - DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.Dangling value - ) => new(value); - - [Serializable] - internal sealed class JsonConverter - : JsonConverter - { - public override bool CanConvert(global::System.Type typeToConvert) => - typeof(DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget).IsAssignableFrom( - typeToConvert - ); - - public override DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget 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.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetPage" - ), - "template" => - jsonWithoutDiscriminator.Deserialize( - options - ) - ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetTemplate" - ), - "dangling" => - jsonWithoutDiscriminator.Deserialize( - options - ) - ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetDangling" - ), - _ => json.Deserialize(options), - }; - return new DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget( - discriminator, - value - ); - } - - public override void Write( - Utf8JsonWriter writer, - DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget 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 DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget 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 DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget( - stringValue, - stringValue - ); - } - - public override void WriteAsPropertyName( - Utf8JsonWriter writer, - DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget value, - JsonSerializerOptions options - ) - { - writer.WritePropertyName(value.Kind); - } - } - - /// - /// Discriminated union type for page - /// - [Serializable] - public struct Page - { - public Page(CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetPage value) - { - Value = value; - } - - internal CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetPage Value { get; set; } - - public override string ToString() => Value.ToString() ?? "null"; - - public static implicit operator DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.Page( - CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetPage value - ) => new(value); - } - - /// - /// Discriminated union type for template - /// - [Serializable] - public struct Template - { - public Template( - CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetTemplate value - ) - { - Value = value; - } - - internal CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetTemplate Value { get; set; } - - public override string ToString() => Value.ToString() ?? "null"; - - public static implicit operator DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.Template( - CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetTemplate value - ) => new(value); - } - - /// - /// Discriminated union type for dangling - /// - [Serializable] - public struct Dangling - { - public Dangling( - CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetDangling value - ) - { - Value = value; - } - - internal CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetDangling Value { get; set; } - - public override string ToString() => Value.ToString() ?? "null"; - - public static implicit operator DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget.Dangling( - CloudPDF.DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetDangling value - ) => new(value); - } -} diff --git a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItem.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItem.cs deleted file mode 100644 index f581e9dd..00000000 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItem.cs +++ /dev/null @@ -1,55 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesInsertBlank200ResponseLayoutPagesItem : 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 DocPagesInsertBlank200ResponseLayoutPagesItemSize Size { get; set; } - - [JsonPropertyName("rotation")] - public required double Rotation { get; set; } - - [JsonPropertyName("userUnit")] - public required double UserUnit { get; set; } - - [JsonPropertyName("tabOrder")] - public DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder? TabOrder { get; set; } - - [JsonPropertyName("boxes")] - public required DocPagesInsertBlank200ResponseLayoutPagesItemBoxes Boxes { get; set; } - - [JsonPropertyName("pdfCropBox")] - public required DocPagesInsertBlank200ResponseLayoutPagesItemPdfCropBox 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/DocPagesInsertBlank200ResponseLayoutPagesItemBoxes.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemBoxes.cs deleted file mode 100644 index 1a551873..00000000 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemBoxes.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesInsertBlank200ResponseLayoutPagesItemBoxes : IJsonOnDeserialized -{ - [JsonExtensionData] - private readonly IDictionary _extensionData = - new Dictionary(); - - [JsonPropertyName("media")] - public required DocPagesInsertBlank200ResponseLayoutPagesItemBoxesMedia Media { get; set; } - - [JsonPropertyName("crop")] - public required DocPagesInsertBlank200ResponseLayoutPagesItemBoxesCrop Crop { get; set; } - - [JsonPropertyName("bleed")] - public required DocPagesInsertBlank200ResponseLayoutPagesItemBoxesBleed Bleed { get; set; } - - [JsonPropertyName("trim")] - public required DocPagesInsertBlank200ResponseLayoutPagesItemBoxesTrim Trim { get; set; } - - [JsonPropertyName("art")] - public required DocPagesInsertBlank200ResponseLayoutPagesItemBoxesArt 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/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesArt.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesArt.cs deleted file mode 100644 index 5ad30779..00000000 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesArt.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesInsertBlank200ResponseLayoutPagesItemBoxesArt : 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/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesBleed.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesBleed.cs deleted file mode 100644 index da508402..00000000 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesBleed.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesInsertBlank200ResponseLayoutPagesItemBoxesBleed : 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/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesCrop.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesCrop.cs deleted file mode 100644 index 43d05eeb..00000000 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesCrop.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesInsertBlank200ResponseLayoutPagesItemBoxesCrop : 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/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesMedia.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesMedia.cs deleted file mode 100644 index 4e383109..00000000 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesMedia.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesInsertBlank200ResponseLayoutPagesItemBoxesMedia : 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/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesTrim.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesTrim.cs deleted file mode 100644 index 7b465a10..00000000 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemBoxesTrim.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesInsertBlank200ResponseLayoutPagesItemBoxesTrim : 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/DocPagesInsertBlank200ResponseLayoutPagesItemPdfCropBox.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemPdfCropBox.cs deleted file mode 100644 index 17d56dbf..00000000 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemPdfCropBox.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesInsertBlank200ResponseLayoutPagesItemPdfCropBox : 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/DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder.cs deleted file mode 100644 index 35e3f77e..00000000 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder.cs +++ /dev/null @@ -1,148 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[JsonConverter( - typeof(DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder.DocPagesInsertBlank200ResponseLayoutPagesItemTabOrderSerializer) -)] -[Serializable] -public readonly record struct DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder : IStringEnum -{ - public static readonly DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder Rows = new( - Values.Rows - ); - - public static readonly DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder Columns = new( - Values.Columns - ); - - public static readonly DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder Structure = new( - Values.Structure - ); - - public static readonly DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder Annotations = new( - Values.Annotations - ); - - public static readonly DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder Widgets = new( - Values.Widgets - ); - - public DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder(string value) - { - Value = value; - } - - /// - /// The string value of the enum. - /// - public string Value { get; } - - /// - /// Create a string enum with the given value. - /// - public static DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder FromCustom(string value) - { - return new DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder(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 ==( - DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder value1, - string value2 - ) => value1.Value.Equals(value2); - - public static bool operator !=( - DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder value1, - string value2 - ) => !value1.Value.Equals(value2); - - public static explicit operator string( - DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder value - ) => value.Value; - - public static explicit operator DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder( - string value - ) => new(value); - - internal class DocPagesInsertBlank200ResponseLayoutPagesItemTabOrderSerializer - : JsonConverter - { - public override DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder 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 DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder(stringValue); - } - - public override void Write( - Utf8JsonWriter writer, - DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder value, - JsonSerializerOptions options - ) - { - writer.WriteStringValue(value.Value); - } - - public override DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder 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 DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder(stringValue); - } - - public override void WriteAsPropertyName( - Utf8JsonWriter writer, - DocPagesInsertBlank200ResponseLayoutPagesItemTabOrder 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/DocPagesReorder200ResponseLayoutPagesItemBoxesArt.cs b/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxesArt.cs deleted file mode 100644 index fe5f90ce..00000000 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxesArt.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesReorder200ResponseLayoutPagesItemBoxesArt : 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/DocPagesReorder200ResponseLayoutPagesItemBoxesCrop.cs b/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxesCrop.cs deleted file mode 100644 index e17cedce..00000000 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxesCrop.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesReorder200ResponseLayoutPagesItemBoxesCrop : 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/DocPagesReorder200ResponseLayoutPagesItemBoxesTrim.cs b/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxesTrim.cs deleted file mode 100644 index f0034864..00000000 --- a/src/CloudPDF/Types/DocPagesReorder200ResponseLayoutPagesItemBoxesTrim.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesReorder200ResponseLayoutPagesItemBoxesTrim : 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/DocPagesRotate200ResponseLayoutPagesItemBoxesBleed.cs b/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxesBleed.cs deleted file mode 100644 index ad81400f..00000000 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxesBleed.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesRotate200ResponseLayoutPagesItemBoxesBleed : 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/DocPagesRotate200ResponseLayoutPagesItemBoxesCrop.cs b/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxesCrop.cs deleted file mode 100644 index f3de8b2e..00000000 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxesCrop.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesRotate200ResponseLayoutPagesItemBoxesCrop : 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/DocPagesRotate200ResponseLayoutPagesItemBoxesMedia.cs b/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxesMedia.cs deleted file mode 100644 index e1a0fabb..00000000 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxesMedia.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesRotate200ResponseLayoutPagesItemBoxesMedia : 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/DocPagesRotate200ResponseLayoutPagesItemBoxesTrim.cs b/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxesTrim.cs deleted file mode 100644 index 55563748..00000000 --- a/src/CloudPDF/Types/DocPagesRotate200ResponseLayoutPagesItemBoxesTrim.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CloudPDF.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace CloudPDF; - -[Serializable] -public record DocPagesRotate200ResponseLayoutPagesItemBoxesTrim : 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/DocumentOutline.cs b/src/CloudPDF/Types/DocumentOutline.cs new file mode 100644 index 00000000..b0a88d09 --- /dev/null +++ b/src/CloudPDF/Types/DocumentOutline.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocumentOutline : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("items")] + public IEnumerable Items { get; set; } = new List(); + + [JsonPropertyName("incomplete")] + public required bool Incomplete { 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/OutlineItem.cs b/src/CloudPDF/Types/OutlineItem.cs new file mode 100644 index 00000000..d4dee1f5 --- /dev/null +++ b/src/CloudPDF/Types/OutlineItem.cs @@ -0,0 +1,52 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record OutlineItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("ref")] + public required OutlineItemRef Ref { get; set; } + + [JsonPropertyName("parent")] + public OutlineItemRef? Parent { get; set; } + + [JsonPropertyName("title")] + public required string Title { get; set; } + + [JsonPropertyName("target")] + public PdfLinkTarget? Target { get; set; } + + [JsonPropertyName("action")] + public PdfActionTree? Action { get; set; } + + [JsonPropertyName("open")] + public required bool Open { get; set; } + + [JsonPropertyName("color")] + public string? Color { get; set; } + + [JsonPropertyName("bold")] + public required bool Bold { get; set; } + + [JsonPropertyName("italic")] + public required 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/DocPagesInsertBlank200ResponseLayoutNamedPagesItem.cs b/src/CloudPDF/Types/OutlineItemDraft.cs similarity index 62% rename from src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutNamedPagesItem.cs rename to src/CloudPDF/Types/OutlineItemDraft.cs index f5d3ec04..85d7d0af 100644 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutNamedPagesItem.cs +++ b/src/CloudPDF/Types/OutlineItemDraft.cs @@ -5,17 +5,26 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsertBlank200ResponseLayoutNamedPagesItem : IJsonOnDeserialized +public record OutlineItemDraft : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = new Dictionary(); - [JsonPropertyName("name")] - public required string Name { get; set; } + [JsonPropertyName("title")] + public required string Title { get; set; } [JsonPropertyName("target")] - public required DocPagesInsertBlank200ResponseLayoutNamedPagesItemTarget Target { get; set; } + public PdfLinkTargetWritable? Target { get; set; } + + [JsonPropertyName("color")] + public string? Color { get; set; } + + [JsonPropertyName("bold")] + public bool? Bold { get; set; } + + [JsonPropertyName("italic")] + public bool? Italic { get; set; } [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/OutlineItemPatch.cs b/src/CloudPDF/Types/OutlineItemPatch.cs new file mode 100644 index 00000000..e6e1c58a --- /dev/null +++ b/src/CloudPDF/Types/OutlineItemPatch.cs @@ -0,0 +1,43 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record OutlineItemPatch : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("title")] + public string? Title { get; set; } + + [JsonPropertyName("target")] + public PdfLinkTargetWritable? Target { get; set; } + + [JsonPropertyName("color")] + public string? Color { get; set; } + + [JsonPropertyName("bold")] + public bool? Bold { get; set; } + + [JsonPropertyName("italic")] + public bool? Italic { get; set; } + + [JsonPropertyName("open")] + public bool? Open { 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/DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetTemplate.cs b/src/CloudPDF/Types/OutlineItemRef.cs similarity index 83% rename from src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetTemplate.cs rename to src/CloudPDF/Types/OutlineItemRef.cs index d7e8fb4b..7012266b 100644 --- a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetTemplate.cs +++ b/src/CloudPDF/Types/OutlineItemRef.cs @@ -5,12 +5,15 @@ namespace CloudPDF; [Serializable] -public record DocPagesInsertBlank200ResponseLayoutNamedPagesItemTargetTemplate : IJsonOnDeserialized +public record OutlineItemRef : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = new Dictionary(); + [JsonPropertyName("kind")] + public required OutlineItemRefKind Kind { get; set; } + [JsonPropertyName("objectNumber")] public required int ObjectNumber { get; set; } diff --git a/src/CloudPDF/Types/OutlineItemRefKind.cs b/src/CloudPDF/Types/OutlineItemRefKind.cs new file mode 100644 index 00000000..a66207fa --- /dev/null +++ b/src/CloudPDF/Types/OutlineItemRefKind.cs @@ -0,0 +1,111 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(OutlineItemRefKind.OutlineItemRefKindSerializer))] +[Serializable] +public readonly record struct OutlineItemRefKind : IStringEnum +{ + public static readonly OutlineItemRefKind ObjectNumber = new(Values.ObjectNumber); + + public OutlineItemRefKind(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static OutlineItemRefKind FromCustom(string value) + { + return new OutlineItemRefKind(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 ==(OutlineItemRefKind value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(OutlineItemRefKind value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(OutlineItemRefKind value) => value.Value; + + public static explicit operator OutlineItemRefKind(string value) => new(value); + + internal class OutlineItemRefKindSerializer : JsonConverter + { + public override OutlineItemRefKind 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 OutlineItemRefKind(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + OutlineItemRefKind value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override OutlineItemRefKind 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 OutlineItemRefKind(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + OutlineItemRefKind value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string ObjectNumber = "objectNumber"; + } +} diff --git a/src/CloudPDF/Types/OutlineMutationMeta.cs b/src/CloudPDF/Types/OutlineMutationMeta.cs new file mode 100644 index 00000000..69fd0a23 --- /dev/null +++ b/src/CloudPDF/Types/OutlineMutationMeta.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record OutlineMutationMeta : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("affectedPages")] + public IEnumerable AffectedPages { get; set; } = new List(); + + [JsonPropertyName("cacheDelta")] + public CacheDelta? CacheDelta { get; set; } + + [JsonPropertyName("opId")] + public required string OpId { get; set; } + + [JsonPropertyName("undoable")] + public required bool Undoable { get; set; } + + [JsonPropertyName("changed")] + public IEnumerable Changed { 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/OutlineOrder.cs b/src/CloudPDF/Types/OutlineOrder.cs new file mode 100644 index 00000000..4e7d1e2f --- /dev/null +++ b/src/CloudPDF/Types/OutlineOrder.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record OutlineOrder : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("parent")] + public OutlineItemRef? Parent { get; set; } + + [JsonPropertyName("children")] + public IEnumerable Children { 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/OutlinePositionAfter.cs b/src/CloudPDF/Types/OutlinePositionAfter.cs new file mode 100644 index 00000000..101ce998 --- /dev/null +++ b/src/CloudPDF/Types/OutlinePositionAfter.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record OutlinePositionAfter : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("before")] + public OutlineItemRef? Before { get; set; } + + [JsonPropertyName("after")] + public OutlineItemRef? After { 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/OutlinePositionZero.cs b/src/CloudPDF/Types/OutlinePositionZero.cs new file mode 100644 index 00000000..c034a2d3 --- /dev/null +++ b/src/CloudPDF/Types/OutlinePositionZero.cs @@ -0,0 +1,115 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(OutlinePositionZero.OutlinePositionZeroSerializer))] +[Serializable] +public readonly record struct OutlinePositionZero : IStringEnum +{ + public static readonly OutlinePositionZero Start = new(Values.Start); + + public static readonly OutlinePositionZero End = new(Values.End); + + public OutlinePositionZero(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static OutlinePositionZero FromCustom(string value) + { + return new OutlinePositionZero(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 ==(OutlinePositionZero value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(OutlinePositionZero value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(OutlinePositionZero value) => value.Value; + + public static explicit operator OutlinePositionZero(string value) => new(value); + + internal class OutlinePositionZeroSerializer : JsonConverter + { + public override OutlinePositionZero 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 OutlinePositionZero(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + OutlinePositionZero value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override OutlinePositionZero 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 OutlinePositionZero(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + OutlinePositionZero value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Start = "start"; + + public const string End = "end"; + } +}