From 6822beca9c099d22cab68fd96f2bfe9d4e7f5f19 Mon Sep 17 00:00:00 2001 From: cloudpdf-sdk-bot Date: Thu, 10 Sep 2026 09:27:26 +0000 Subject: [PATCH] chore: generate CloudPDF .NET SDK 3.0.0-next.12 --- .fern/metadata.json | 6 +- cloudpdf-generation.json | 8 +- reference.md | 196 +++++++++++ .../MockServer/Doc/Annotations/FlattenTest.cs | 179 ++++++++++ .../MockServer/Doc/Pages/RemoveNameTest.cs | 177 ++++++++++ .../Unit/MockServer/Doc/Pages/SetNameTest.cs | 177 ++++++++++ src/CloudPDF/CloudPDF.csproj | 2 +- src/CloudPDF/Core/Public/Version.cs | 2 +- .../Doc/Annotations/AnnotationsClient.cs | 277 +++++++++++++++ .../Doc/Annotations/IAnnotationsClient.cs | 12 + .../ExportAppearanceAnnotationsRequest.cs | 32 ++ .../Requests/FlattenAnnotationsRequest.cs | 32 ++ src/CloudPDF/Doc/Pages/IPagesClient.cs | 12 + src/CloudPDF/Doc/Pages/PagesClient.cs | 288 +++++++++++++++ .../Pages/Requests/RemoveNamePagesRequest.cs | 29 ++ .../Doc/Pages/Requests/SetNamePagesRequest.cs | 29 ++ ...cAnnotationsExportAppearance400Response.cs | 37 ++ ...otationsExportAppearance400ResponseCode.cs | 228 ++++++++++++ ...otationsExportAppearance400ResponseName.cs | 122 +++++++ ...cAnnotationsExportAppearance404Response.cs | 37 ++ ...otationsExportAppearance404ResponseCode.cs | 228 ++++++++++++ ...otationsExportAppearance404ResponseName.cs | 122 +++++++ .../Types/DocAnnotationsFlatten200Response.cs | 30 ++ .../DocAnnotationsFlatten200ResponseMeta.cs | 32 ++ ...Flatten200ResponseMetaAffectedPagesItem.cs | 34 ++ ...00ResponseMetaAffectedPagesItemRevision.cs | 34 ++ ...etaAffectedPagesItemWeakAnnotationState.cs | 330 ++++++++++++++++++ ...fectedPagesItemWeakAnnotationStateKnown.cs | 29 ++ ...ctedPagesItemWeakAnnotationStateUnknown.cs | 26 ++ ...tationsFlatten200ResponseMetaCacheDelta.cs | 38 ++ ...atten200ResponseMetaCacheDeltaPagesItem.cs | 31 ++ ...200ResponseMetaCacheDeltaPagesItemCache.cs | 31 ++ .../Types/DocAnnotationsFlatten400Response.cs | 37 ++ .../DocAnnotationsFlatten400ResponseCode.cs | 210 +++++++++++ .../DocAnnotationsFlatten400ResponseName.cs | 118 +++++++ .../Types/DocAnnotationsFlatten404Response.cs | 37 ++ .../DocAnnotationsFlatten404ResponseCode.cs | 210 +++++++++++ .../DocAnnotationsFlatten404ResponseName.cs | 118 +++++++ .../Types/DocPagesRemoveName200Response.cs | 30 ++ .../DocPagesRemoveName200ResponseMeta.cs | 32 ++ ...oveName200ResponseMetaAffectedPagesItem.cs | 34 ++ ...00ResponseMetaAffectedPagesItemRevision.cs | 34 ++ ...etaAffectedPagesItemWeakAnnotationState.cs | 330 ++++++++++++++++++ ...fectedPagesItemWeakAnnotationStateKnown.cs | 29 ++ ...ctedPagesItemWeakAnnotationStateUnknown.cs | 26 ++ ...agesRemoveName200ResponseMetaCacheDelta.cs | 38 ++ ...eName200ResponseMetaCacheDeltaPagesItem.cs | 31 ++ ...200ResponseMetaCacheDeltaPagesItemCache.cs | 31 ++ .../Types/DocPagesRemoveName400Response.cs | 37 ++ .../DocPagesRemoveName400ResponseCode.cs | 208 +++++++++++ .../DocPagesRemoveName400ResponseName.cs | 114 ++++++ .../Types/DocPagesRemoveName404Response.cs | 37 ++ .../DocPagesRemoveName404ResponseCode.cs | 208 +++++++++++ .../DocPagesRemoveName404ResponseName.cs | 114 ++++++ .../Types/DocPagesSetName200Response.cs | 30 ++ .../Types/DocPagesSetName200ResponseMeta.cs | 32 ++ ...SetName200ResponseMetaAffectedPagesItem.cs | 34 ++ ...00ResponseMetaAffectedPagesItemRevision.cs | 34 ++ ...etaAffectedPagesItemWeakAnnotationState.cs | 330 ++++++++++++++++++ ...fectedPagesItemWeakAnnotationStateKnown.cs | 29 ++ ...ctedPagesItemWeakAnnotationStateUnknown.cs | 26 ++ ...ocPagesSetName200ResponseMetaCacheDelta.cs | 38 ++ ...tName200ResponseMetaCacheDeltaPagesItem.cs | 31 ++ ...200ResponseMetaCacheDeltaPagesItemCache.cs | 31 ++ .../Types/DocPagesSetName400Response.cs | 37 ++ .../Types/DocPagesSetName400ResponseCode.cs | 202 +++++++++++ .../Types/DocPagesSetName400ResponseName.cs | 112 ++++++ .../Types/DocPagesSetName404Response.cs | 37 ++ .../Types/DocPagesSetName404ResponseCode.cs | 202 +++++++++++ .../Types/DocPagesSetName404ResponseName.cs | 112 ++++++ 70 files changed, 6218 insertions(+), 9 deletions(-) create mode 100644 src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/FlattenTest.cs create mode 100644 src/CloudPDF.Test/Unit/MockServer/Doc/Pages/RemoveNameTest.cs create mode 100644 src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetNameTest.cs create mode 100644 src/CloudPDF/Doc/Annotations/Requests/ExportAppearanceAnnotationsRequest.cs create mode 100644 src/CloudPDF/Doc/Annotations/Requests/FlattenAnnotationsRequest.cs create mode 100644 src/CloudPDF/Doc/Pages/Requests/RemoveNamePagesRequest.cs create mode 100644 src/CloudPDF/Doc/Pages/Requests/SetNamePagesRequest.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsExportAppearance400Response.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsExportAppearance400ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsExportAppearance400ResponseName.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsExportAppearance404Response.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsExportAppearance404ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsExportAppearance404ResponseName.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten200Response.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMeta.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItem.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemRevision.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaCacheDelta.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItem.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItemCache.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten400Response.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten400ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten400ResponseName.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten404Response.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten404ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocAnnotationsFlatten404ResponseName.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName200Response.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName200ResponseMeta.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItem.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemRevision.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaCacheDelta.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItem.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItemCache.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName400Response.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName400ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName400ResponseName.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName404Response.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName404ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocPagesRemoveName404ResponseName.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName200Response.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName200ResponseMeta.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItem.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItemRevision.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName200ResponseMetaCacheDelta.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName200ResponseMetaCacheDeltaPagesItem.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName200ResponseMetaCacheDeltaPagesItemCache.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName400Response.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName400ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName400ResponseName.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName404Response.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName404ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocPagesSetName404ResponseName.cs diff --git a/.fern/metadata.json b/.fern/metadata.json index 8819ebf..4c70a72 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": "08782e4eef6cd6ccce4b6a6883408d9915a2d7c4", + "originGitCommit": "b0888bd6ca83627cb07ea05c440e35c183cebbd0", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "3.0.0-next.11", + "requestedVersion": "3.0.0-next.12", "ciProvider": "github", - "sdkVersion": "3.0.0-next.11" + "sdkVersion": "3.0.0-next.12" } \ No newline at end of file diff --git a/cloudpdf-generation.json b/cloudpdf-generation.json index db9259d..1faf5bc 100644 --- a/cloudpdf-generation.json +++ b/cloudpdf-generation.json @@ -1,12 +1,12 @@ { "language": "csharp", - "canonicalVersion": "3.0.0-next.11", - "sdkVersion": "3.0.0-next.11", + "canonicalVersion": "3.0.0-next.12", + "sdkVersion": "3.0.0-next.12", "source": { "repository": "embedpdf/embed-pdf-viewer", "openapi": "cloudpdf/contract/openapi.json", - "openapiSha256": "7bc0eea37724b3e359b0437edc3102b137e3d3f499293c89bb2b3293c6e3b614", - "gitCommit": "08782e4eef6cd6ccce4b6a6883408d9915a2d7c4", + "openapiSha256": "501ec54f2f28089dc8a3cf3a8d2ff3ade44c6c35d47977a3dfa47465fb83a049", + "gitCommit": "b0888bd6ca83627cb07ea05c440e35c183cebbd0", "gitCommitIsDirty": false }, "fern": { diff --git a/reference.md b/reference.md index ba99d57..2d21f95 100644 --- a/reference.md +++ b/reference.md @@ -1660,6 +1660,108 @@ await client.Doc.Annotations.UpdateAsync( + + + + +
client.Doc.Annotations.ExportAppearanceAsync(ExportAppearanceAnnotationsRequest { ... }) -> WithRawResponseTask<Stream> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Doc.Annotations.ExportAppearanceAsync( + new ExportAppearanceAnnotationsRequest + { + DocId = "docId", + LayerName = "layerName", + Pon = 1, + Body = new Dictionary() + { + { + "string", + new Dictionary() { { "key", "value" } } + }, + }, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ExportAppearanceAnnotationsRequest` + +
+
+
+
+ + +
+
+
+ +
client.Doc.Annotations.FlattenAsync(FlattenAnnotationsRequest { ... }) -> WithRawResponseTask<DocAnnotationsFlatten200Response> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Doc.Annotations.FlattenAsync( + new FlattenAnnotationsRequest + { + DocId = "docId", + LayerName = "layerName", + Pon = 1, + Body = new Dictionary() { { "key", "value" } }, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `FlattenAnnotationsRequest` + +
+
+
+
+ +
@@ -2254,6 +2356,100 @@ await client.Doc.Pages.MoveAsync( + + + + +
client.Doc.Pages.SetNameAsync(SetNamePagesRequest { ... }) -> WithRawResponseTask<DocPagesSetName200Response> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Doc.Pages.SetNameAsync( + new SetNamePagesRequest + { + DocId = "docId", + LayerName = "layerName", + Body = new Dictionary() { { "key", "value" } }, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `SetNamePagesRequest` + +
+
+
+
+ + +
+
+
+ +
client.Doc.Pages.RemoveNameAsync(RemoveNamePagesRequest { ... }) -> WithRawResponseTask<DocPagesRemoveName200Response> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Doc.Pages.RemoveNameAsync( + new RemoveNamePagesRequest + { + DocId = "docId", + LayerName = "layerName", + Body = new Dictionary() { { "key", "value" } }, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `RemoveNamePagesRequest` + +
+
+
+
+ +
diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/FlattenTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/FlattenTest.cs new file mode 100644 index 0000000..8f9288b --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Annotations/FlattenTest.cs @@ -0,0 +1,179 @@ +using CloudPDF.Doc; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Doc.Annotations; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class FlattenTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string requestJson = """ + { + "string": { + "key": "value" + } + } + """; + + const string mockResponse = """ + { + "meta": { + "affectedPages": [ + { + "pageObjectNumber": 1, + "revision": { + "docSessionId": "docSessionId", + "pageObjectNumber": 1, + "generation": 1 + }, + "weakAnnotationState": { + "kind": "unknown" + } + }, + { + "pageObjectNumber": 1, + "revision": { + "docSessionId": "docSessionId", + "pageObjectNumber": 1, + "generation": 1 + }, + "weakAnnotationState": { + "kind": "unknown" + } + } + ], + "cacheDelta": { + "previousDocVersion": 1, + "docVersion": 1, + "annotationsVersion": 1, + "pages": [ + { + "pageObjectNumber": 1, + "cache": { + "contentVersion": 1, + "annotationVersion": 1 + } + }, + { + "pageObjectNumber": 1, + "cache": { + "contentVersion": 1, + "annotationVersion": 1 + } + } + ] + } + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/annotations/pages/1/items/flatten") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Annotations.FlattenAsync( + new FlattenAnnotationsRequest + { + DocId = "docId", + LayerName = "layerName", + Pon = 1, + 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 = """ + { + "meta": { + "affectedPages": [ + { + "pageObjectNumber": 1, + "revision": { + "docSessionId": "docSessionId", + "pageObjectNumber": 1, + "generation": 1 + }, + "weakAnnotationState": { + "kind": "unknown" + } + } + ], + "cacheDelta": { + "previousDocVersion": 1, + "docVersion": 1, + "annotationsVersion": 1, + "pages": [ + { + "pageObjectNumber": 1, + "cache": { + "contentVersion": 1, + "annotationVersion": 1 + } + } + ] + } + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/annotations/pages/1/items/flatten") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Annotations.FlattenAsync( + new FlattenAnnotationsRequest + { + DocId = "docId", + LayerName = "layerName", + Pon = 1, + 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 new file mode 100644 index 0000000..743eeb3 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/RemoveNameTest.cs @@ -0,0 +1,177 @@ +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 RemoveNameTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string requestJson = """ + { + "string": { + "key": "value" + } + } + """; + + const string mockResponse = """ + { + "meta": { + "affectedPages": [ + { + "pageObjectNumber": 1, + "revision": { + "docSessionId": "docSessionId", + "pageObjectNumber": 1, + "generation": 1 + }, + "weakAnnotationState": { + "kind": "unknown" + } + }, + { + "pageObjectNumber": 1, + "revision": { + "docSessionId": "docSessionId", + "pageObjectNumber": 1, + "generation": 1 + }, + "weakAnnotationState": { + "kind": "unknown" + } + } + ], + "cacheDelta": { + "previousDocVersion": 1, + "docVersion": 1, + "annotationsVersion": 1, + "pages": [ + { + "pageObjectNumber": 1, + "cache": { + "contentVersion": 1, + "annotationVersion": 1 + } + }, + { + "pageObjectNumber": 1, + "cache": { + "contentVersion": 1, + "annotationVersion": 1 + } + } + ] + } + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/pages/names/delete") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Pages.RemoveNameAsync( + new RemoveNamePagesRequest + { + 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 = """ + { + "meta": { + "affectedPages": [ + { + "pageObjectNumber": 1, + "revision": { + "docSessionId": "docSessionId", + "pageObjectNumber": 1, + "generation": 1 + }, + "weakAnnotationState": { + "kind": "unknown" + } + } + ], + "cacheDelta": { + "previousDocVersion": 1, + "docVersion": 1, + "annotationsVersion": 1, + "pages": [ + { + "pageObjectNumber": 1, + "cache": { + "contentVersion": 1, + "annotationVersion": 1 + } + } + ] + } + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/pages/names/delete") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Pages.RemoveNameAsync( + new RemoveNamePagesRequest + { + 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 new file mode 100644 index 0000000..d6cff01 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetNameTest.cs @@ -0,0 +1,177 @@ +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 SetNameTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string requestJson = """ + { + "string": { + "key": "value" + } + } + """; + + const string mockResponse = """ + { + "meta": { + "affectedPages": [ + { + "pageObjectNumber": 1, + "revision": { + "docSessionId": "docSessionId", + "pageObjectNumber": 1, + "generation": 1 + }, + "weakAnnotationState": { + "kind": "unknown" + } + }, + { + "pageObjectNumber": 1, + "revision": { + "docSessionId": "docSessionId", + "pageObjectNumber": 1, + "generation": 1 + }, + "weakAnnotationState": { + "kind": "unknown" + } + } + ], + "cacheDelta": { + "previousDocVersion": 1, + "docVersion": 1, + "annotationsVersion": 1, + "pages": [ + { + "pageObjectNumber": 1, + "cache": { + "contentVersion": 1, + "annotationVersion": 1 + } + }, + { + "pageObjectNumber": 1, + "cache": { + "contentVersion": 1, + "annotationVersion": 1 + } + } + ] + } + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/pages/names") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Pages.SetNameAsync( + new SetNamePagesRequest + { + 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 = """ + { + "meta": { + "affectedPages": [ + { + "pageObjectNumber": 1, + "revision": { + "docSessionId": "docSessionId", + "pageObjectNumber": 1, + "generation": 1 + }, + "weakAnnotationState": { + "kind": "unknown" + } + } + ], + "cacheDelta": { + "previousDocVersion": 1, + "docVersion": 1, + "annotationsVersion": 1, + "pages": [ + { + "pageObjectNumber": 1, + "cache": { + "contentVersion": 1, + "annotationVersion": 1 + } + } + ] + } + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/pages/names") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Pages.SetNameAsync( + new SetNamePagesRequest + { + DocId = "docId", + LayerName = "layerName", + Body = new Dictionary() { { "key", "value" } }, + } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF/CloudPDF.csproj b/src/CloudPDF/CloudPDF.csproj index 8e5893e..d44fbe0 100644 --- a/src/CloudPDF/CloudPDF.csproj +++ b/src/CloudPDF/CloudPDF.csproj @@ -11,7 +11,7 @@ enable 12 enable - 3.0.0-next.11 + 3.0.0-next.12 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 d51f479..e88e5c3 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.11"; + public const string Current = "3.0.0-next.12"; } diff --git a/src/CloudPDF/Doc/Annotations/AnnotationsClient.cs b/src/CloudPDF/Doc/Annotations/AnnotationsClient.cs index c3ddd89..e902af9 100644 --- a/src/CloudPDF/Doc/Annotations/AnnotationsClient.cs +++ b/src/CloudPDF/Doc/Annotations/AnnotationsClient.cs @@ -609,6 +609,233 @@ private async Task> UpdateAsync } } + private async Task> ExportAppearanceAsyncCore( + ExportAppearanceAnnotationsRequest 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}/annotations/pages/{2}/items/appearance", + ValueConvert.ToPathParameterString(request.DocId), + ValueConvert.ToPathParameterString(request.LayerName), + ValueConvert.ToPathParameterString(request.Pon) + ), + 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( + FlattenAnnotationsRequest 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}/annotations/pages/{2}/items/flatten", + ValueConvert.ToPathParameterString(request.DocId), + ValueConvert.ToPathParameterString(request.LayerName), + ValueConvert.ToPathParameterString(request.Pon) + ), + 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), + } + ); + } + } + /// /// Returns one entry per page plus the audit-log cursor for reconciling subsequent document events. Page order is unspecified; join by `pageState.pageObjectNumber` when display order matters. /// @@ -718,4 +945,54 @@ public WithRawResponseTask UpdateAsync( UpdateAsyncCore(request, options, cancellationToken) ); } + + /// + /// await client.Doc.Annotations.ExportAppearanceAsync( + /// new ExportAppearanceAnnotationsRequest + /// { + /// DocId = "docId", + /// LayerName = "layerName", + /// Pon = 1, + /// Body = new Dictionary<string, object?>() + /// { + /// { + /// "string", + /// new Dictionary<object, object?>() { { "key", "value" } } + /// }, + /// }, + /// } + /// ); + /// + public WithRawResponseTask ExportAppearanceAsync( + ExportAppearanceAnnotationsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ExportAppearanceAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// await client.Doc.Annotations.FlattenAsync( + /// new FlattenAnnotationsRequest + /// { + /// DocId = "docId", + /// LayerName = "layerName", + /// Pon = 1, + /// Body = new Dictionary<string, object?>() { { "key", "value" } }, + /// } + /// ); + /// + public WithRawResponseTask FlattenAsync( + FlattenAnnotationsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + FlattenAsyncCore(request, options, cancellationToken) + ); + } } diff --git a/src/CloudPDF/Doc/Annotations/IAnnotationsClient.cs b/src/CloudPDF/Doc/Annotations/IAnnotationsClient.cs index 49888f7..f42a199 100644 --- a/src/CloudPDF/Doc/Annotations/IAnnotationsClient.cs +++ b/src/CloudPDF/Doc/Annotations/IAnnotationsClient.cs @@ -39,4 +39,16 @@ WithRawResponseTask UpdateAsync( RequestOptions? options = null, CancellationToken cancellationToken = default ); + + WithRawResponseTask ExportAppearanceAsync( + ExportAppearanceAnnotationsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask FlattenAsync( + FlattenAnnotationsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); } diff --git a/src/CloudPDF/Doc/Annotations/Requests/ExportAppearanceAnnotationsRequest.cs b/src/CloudPDF/Doc/Annotations/Requests/ExportAppearanceAnnotationsRequest.cs new file mode 100644 index 0000000..387f4c5 --- /dev/null +++ b/src/CloudPDF/Doc/Annotations/Requests/ExportAppearanceAnnotationsRequest.cs @@ -0,0 +1,32 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Doc; + +[Serializable] +public record ExportAppearanceAnnotationsRequest +{ + [JsonIgnore] + public required string DocId { get; set; } + + [JsonIgnore] + public required string LayerName { get; set; } + + [JsonIgnore] + public required int Pon { get; set; } + + /// + /// Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead. + /// + [JsonIgnore] + public string? DocumentPassword { get; set; } + + [JsonIgnore] + public Dictionary Body { get; set; } = new Dictionary(); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Doc/Annotations/Requests/FlattenAnnotationsRequest.cs b/src/CloudPDF/Doc/Annotations/Requests/FlattenAnnotationsRequest.cs new file mode 100644 index 0000000..8ab0cc0 --- /dev/null +++ b/src/CloudPDF/Doc/Annotations/Requests/FlattenAnnotationsRequest.cs @@ -0,0 +1,32 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Doc; + +[Serializable] +public record FlattenAnnotationsRequest +{ + [JsonIgnore] + public required string DocId { get; set; } + + [JsonIgnore] + public required string LayerName { get; set; } + + [JsonIgnore] + public required int Pon { get; set; } + + /// + /// Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead. + /// + [JsonIgnore] + public string? DocumentPassword { get; set; } + + [JsonIgnore] + public Dictionary Body { get; set; } = new Dictionary(); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Doc/Pages/IPagesClient.cs b/src/CloudPDF/Doc/Pages/IPagesClient.cs index d61a553..3b11e82 100644 --- a/src/CloudPDF/Doc/Pages/IPagesClient.cs +++ b/src/CloudPDF/Doc/Pages/IPagesClient.cs @@ -49,6 +49,18 @@ WithRawResponseTask MoveAsync( CancellationToken cancellationToken = default ); + WithRawResponseTask SetNameAsync( + SetNamePagesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask RemoveNameAsync( + RemoveNamePagesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + WithRawResponseTask RotateAsync( RotatePagesRequest request, RequestOptions? options = null, diff --git a/src/CloudPDF/Doc/Pages/PagesClient.cs b/src/CloudPDF/Doc/Pages/PagesClient.cs index 86eacbb..fd5d4c5 100644 --- a/src/CloudPDF/Doc/Pages/PagesClient.cs +++ b/src/CloudPDF/Doc/Pages/PagesClient.cs @@ -723,6 +723,252 @@ private async Task> MoveAsyncCore( } } + private async Task> SetNameAsyncCore( + SetNamePagesRequest 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/names", + 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> RemoveNameAsyncCore( + RemoveNamePagesRequest 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/names/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> RotateAsyncCore( RotatePagesRequest request, RequestOptions? options = null, @@ -981,6 +1227,48 @@ public WithRawResponseTask MoveAsync( ); } + /// + /// await client.Doc.Pages.SetNameAsync( + /// new SetNamePagesRequest + /// { + /// DocId = "docId", + /// LayerName = "layerName", + /// Body = new Dictionary<string, object?>() { { "key", "value" } }, + /// } + /// ); + /// + public WithRawResponseTask SetNameAsync( + SetNamePagesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + SetNameAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// await client.Doc.Pages.RemoveNameAsync( + /// new RemoveNamePagesRequest + /// { + /// DocId = "docId", + /// LayerName = "layerName", + /// Body = new Dictionary<string, object?>() { { "key", "value" } }, + /// } + /// ); + /// + public WithRawResponseTask RemoveNameAsync( + RemoveNamePagesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + RemoveNameAsyncCore(request, options, cancellationToken) + ); + } + /// /// await client.Doc.Pages.RotateAsync( /// new RotatePagesRequest diff --git a/src/CloudPDF/Doc/Pages/Requests/RemoveNamePagesRequest.cs b/src/CloudPDF/Doc/Pages/Requests/RemoveNamePagesRequest.cs new file mode 100644 index 0000000..a57376b --- /dev/null +++ b/src/CloudPDF/Doc/Pages/Requests/RemoveNamePagesRequest.cs @@ -0,0 +1,29 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Doc; + +[Serializable] +public record RemoveNamePagesRequest +{ + [JsonIgnore] + public required string DocId { get; set; } + + [JsonIgnore] + public required string LayerName { get; set; } + + /// + /// Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead. + /// + [JsonIgnore] + public string? DocumentPassword { get; set; } + + [JsonIgnore] + public Dictionary Body { get; set; } = new Dictionary(); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Doc/Pages/Requests/SetNamePagesRequest.cs b/src/CloudPDF/Doc/Pages/Requests/SetNamePagesRequest.cs new file mode 100644 index 0000000..831232c --- /dev/null +++ b/src/CloudPDF/Doc/Pages/Requests/SetNamePagesRequest.cs @@ -0,0 +1,29 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Doc; + +[Serializable] +public record SetNamePagesRequest +{ + [JsonIgnore] + public required string DocId { get; set; } + + [JsonIgnore] + public required string LayerName { get; set; } + + /// + /// Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead. + /// + [JsonIgnore] + public string? DocumentPassword { get; set; } + + [JsonIgnore] + public Dictionary Body { get; set; } = new Dictionary(); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/DocAnnotationsExportAppearance400Response.cs b/src/CloudPDF/Types/DocAnnotationsExportAppearance400Response.cs new file mode 100644 index 0000000..66ce4bf --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsExportAppearance400Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsExportAppearance400Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocAnnotationsExportAppearance400ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocAnnotationsExportAppearance400ResponseCode Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { get; set; } + + [JsonPropertyName("details")] + public Dictionary? Details { 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/DocAnnotationsExportAppearance400ResponseCode.cs b/src/CloudPDF/Types/DocAnnotationsExportAppearance400ResponseCode.cs new file mode 100644 index 0000000..66bea17 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsExportAppearance400ResponseCode.cs @@ -0,0 +1,228 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocAnnotationsExportAppearance400ResponseCode.DocAnnotationsExportAppearance400ResponseCodeSerializer) +)] +[Serializable] +public readonly record struct DocAnnotationsExportAppearance400ResponseCode : IStringEnum +{ + public static readonly DocAnnotationsExportAppearance400ResponseCode Unknown = new( + Values.Unknown + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode InvalidArg = new( + Values.InvalidArg + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode DocNotOpen = new( + Values.DocNotOpen + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode DocOpenFailed = new( + Values.DocOpenFailed + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode SharePasswordRequired = + new(Values.SharePasswordRequired); + + public static readonly DocAnnotationsExportAppearance400ResponseCode Aborted = new( + Values.Aborted + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode Network = new( + Values.Network + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode Forbidden = new( + Values.Forbidden + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode NotFound = new( + Values.NotFound + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode WireFormat = new( + Values.WireFormat + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode WeakAnnotationSessionConflict = + new(Values.WeakAnnotationSessionConflict); + + public static readonly DocAnnotationsExportAppearance400ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocAnnotationsExportAppearance400ResponseCode MalformedPdf = new( + Values.MalformedPdf + ); + + public DocAnnotationsExportAppearance400ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocAnnotationsExportAppearance400ResponseCode FromCustom(string value) + { + return new DocAnnotationsExportAppearance400ResponseCode(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 ==( + DocAnnotationsExportAppearance400ResponseCode value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + DocAnnotationsExportAppearance400ResponseCode value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(DocAnnotationsExportAppearance400ResponseCode value) => + value.Value; + + public static explicit operator DocAnnotationsExportAppearance400ResponseCode(string value) => + new(value); + + internal class DocAnnotationsExportAppearance400ResponseCodeSerializer + : JsonConverter + { + public override DocAnnotationsExportAppearance400ResponseCode 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 DocAnnotationsExportAppearance400ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocAnnotationsExportAppearance400ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocAnnotationsExportAppearance400ResponseCode 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 DocAnnotationsExportAppearance400ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocAnnotationsExportAppearance400ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Unknown = "Unknown"; + + public const string InvalidArg = "InvalidArg"; + + public const string DocNotOpen = "DocNotOpen"; + + public const string DocOpenFailed = "DocOpenFailed"; + + public const string DocPasswordRequired = "DocPasswordRequired"; + + public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + + public const string SharePasswordRequired = "SharePasswordRequired"; + + public const string Aborted = "Aborted"; + + public const string Network = "Network"; + + public const string Unauthenticated = "Unauthenticated"; + + public const string Forbidden = "Forbidden"; + + public const string NotFound = "NotFound"; + + public const string WireFormat = "WireFormat"; + + public const string RuntimeUnavailable = "RuntimeUnavailable"; + + public const string InvalidReference = "InvalidReference"; + + public const string WeakAnnotationSessionConflict = "WeakAnnotationSessionConflict"; + + public const string LayerVersionConflict = "LayerVersionConflict"; + + public const string NotImplemented = "NotImplemented"; + + public const string MalformedPdf = "MalformedPdf"; + } +} diff --git a/src/CloudPDF/Types/DocAnnotationsExportAppearance400ResponseName.cs b/src/CloudPDF/Types/DocAnnotationsExportAppearance400ResponseName.cs new file mode 100644 index 0000000..43b7a31 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsExportAppearance400ResponseName.cs @@ -0,0 +1,122 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocAnnotationsExportAppearance400ResponseName.DocAnnotationsExportAppearance400ResponseNameSerializer) +)] +[Serializable] +public readonly record struct DocAnnotationsExportAppearance400ResponseName : IStringEnum +{ + public static readonly DocAnnotationsExportAppearance400ResponseName EngineError = new( + Values.EngineError + ); + + public DocAnnotationsExportAppearance400ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocAnnotationsExportAppearance400ResponseName FromCustom(string value) + { + return new DocAnnotationsExportAppearance400ResponseName(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 ==( + DocAnnotationsExportAppearance400ResponseName value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + DocAnnotationsExportAppearance400ResponseName value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(DocAnnotationsExportAppearance400ResponseName value) => + value.Value; + + public static explicit operator DocAnnotationsExportAppearance400ResponseName(string value) => + new(value); + + internal class DocAnnotationsExportAppearance400ResponseNameSerializer + : JsonConverter + { + public override DocAnnotationsExportAppearance400ResponseName 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 DocAnnotationsExportAppearance400ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocAnnotationsExportAppearance400ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocAnnotationsExportAppearance400ResponseName 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 DocAnnotationsExportAppearance400ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocAnnotationsExportAppearance400ResponseName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string EngineError = "EngineError"; + } +} diff --git a/src/CloudPDF/Types/DocAnnotationsExportAppearance404Response.cs b/src/CloudPDF/Types/DocAnnotationsExportAppearance404Response.cs new file mode 100644 index 0000000..ba0f787 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsExportAppearance404Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsExportAppearance404Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocAnnotationsExportAppearance404ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocAnnotationsExportAppearance404ResponseCode Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { get; set; } + + [JsonPropertyName("details")] + public Dictionary? Details { 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/DocAnnotationsExportAppearance404ResponseCode.cs b/src/CloudPDF/Types/DocAnnotationsExportAppearance404ResponseCode.cs new file mode 100644 index 0000000..92f6e81 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsExportAppearance404ResponseCode.cs @@ -0,0 +1,228 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocAnnotationsExportAppearance404ResponseCode.DocAnnotationsExportAppearance404ResponseCodeSerializer) +)] +[Serializable] +public readonly record struct DocAnnotationsExportAppearance404ResponseCode : IStringEnum +{ + public static readonly DocAnnotationsExportAppearance404ResponseCode Unknown = new( + Values.Unknown + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode InvalidArg = new( + Values.InvalidArg + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode DocNotOpen = new( + Values.DocNotOpen + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode DocOpenFailed = new( + Values.DocOpenFailed + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode SharePasswordRequired = + new(Values.SharePasswordRequired); + + public static readonly DocAnnotationsExportAppearance404ResponseCode Aborted = new( + Values.Aborted + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode Network = new( + Values.Network + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode Forbidden = new( + Values.Forbidden + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode NotFound = new( + Values.NotFound + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode WireFormat = new( + Values.WireFormat + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode WeakAnnotationSessionConflict = + new(Values.WeakAnnotationSessionConflict); + + public static readonly DocAnnotationsExportAppearance404ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocAnnotationsExportAppearance404ResponseCode MalformedPdf = new( + Values.MalformedPdf + ); + + public DocAnnotationsExportAppearance404ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocAnnotationsExportAppearance404ResponseCode FromCustom(string value) + { + return new DocAnnotationsExportAppearance404ResponseCode(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 ==( + DocAnnotationsExportAppearance404ResponseCode value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + DocAnnotationsExportAppearance404ResponseCode value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(DocAnnotationsExportAppearance404ResponseCode value) => + value.Value; + + public static explicit operator DocAnnotationsExportAppearance404ResponseCode(string value) => + new(value); + + internal class DocAnnotationsExportAppearance404ResponseCodeSerializer + : JsonConverter + { + public override DocAnnotationsExportAppearance404ResponseCode 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 DocAnnotationsExportAppearance404ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocAnnotationsExportAppearance404ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocAnnotationsExportAppearance404ResponseCode 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 DocAnnotationsExportAppearance404ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocAnnotationsExportAppearance404ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Unknown = "Unknown"; + + public const string InvalidArg = "InvalidArg"; + + public const string DocNotOpen = "DocNotOpen"; + + public const string DocOpenFailed = "DocOpenFailed"; + + public const string DocPasswordRequired = "DocPasswordRequired"; + + public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + + public const string SharePasswordRequired = "SharePasswordRequired"; + + public const string Aborted = "Aborted"; + + public const string Network = "Network"; + + public const string Unauthenticated = "Unauthenticated"; + + public const string Forbidden = "Forbidden"; + + public const string NotFound = "NotFound"; + + public const string WireFormat = "WireFormat"; + + public const string RuntimeUnavailable = "RuntimeUnavailable"; + + public const string InvalidReference = "InvalidReference"; + + public const string WeakAnnotationSessionConflict = "WeakAnnotationSessionConflict"; + + public const string LayerVersionConflict = "LayerVersionConflict"; + + public const string NotImplemented = "NotImplemented"; + + public const string MalformedPdf = "MalformedPdf"; + } +} diff --git a/src/CloudPDF/Types/DocAnnotationsExportAppearance404ResponseName.cs b/src/CloudPDF/Types/DocAnnotationsExportAppearance404ResponseName.cs new file mode 100644 index 0000000..0b3ff06 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsExportAppearance404ResponseName.cs @@ -0,0 +1,122 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocAnnotationsExportAppearance404ResponseName.DocAnnotationsExportAppearance404ResponseNameSerializer) +)] +[Serializable] +public readonly record struct DocAnnotationsExportAppearance404ResponseName : IStringEnum +{ + public static readonly DocAnnotationsExportAppearance404ResponseName EngineError = new( + Values.EngineError + ); + + public DocAnnotationsExportAppearance404ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocAnnotationsExportAppearance404ResponseName FromCustom(string value) + { + return new DocAnnotationsExportAppearance404ResponseName(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 ==( + DocAnnotationsExportAppearance404ResponseName value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + DocAnnotationsExportAppearance404ResponseName value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(DocAnnotationsExportAppearance404ResponseName value) => + value.Value; + + public static explicit operator DocAnnotationsExportAppearance404ResponseName(string value) => + new(value); + + internal class DocAnnotationsExportAppearance404ResponseNameSerializer + : JsonConverter + { + public override DocAnnotationsExportAppearance404ResponseName 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 DocAnnotationsExportAppearance404ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocAnnotationsExportAppearance404ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocAnnotationsExportAppearance404ResponseName 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 DocAnnotationsExportAppearance404ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocAnnotationsExportAppearance404ResponseName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string EngineError = "EngineError"; + } +} diff --git a/src/CloudPDF/Types/DocAnnotationsFlatten200Response.cs b/src/CloudPDF/Types/DocAnnotationsFlatten200Response.cs new file mode 100644 index 0000000..9db798a --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten200Response.cs @@ -0,0 +1,30 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsFlatten200Response : IJsonOnDeserialized, IJsonOnSerializing +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("meta")] + public required DocAnnotationsFlatten200ResponseMeta Meta { get; set; } + + [JsonIgnore] + public AdditionalProperties AdditionalProperties { get; set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + void IJsonOnSerializing.OnSerializing() => + AdditionalProperties.CopyToExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMeta.cs b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMeta.cs new file mode 100644 index 0000000..3b66204 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMeta.cs @@ -0,0 +1,32 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsFlatten200ResponseMeta : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("affectedPages")] + public IEnumerable AffectedPages { get; set; } = + new List(); + + [JsonPropertyName("cacheDelta")] + public DocAnnotationsFlatten200ResponseMetaCacheDelta? CacheDelta { 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/DocAnnotationsFlatten200ResponseMetaAffectedPagesItem.cs b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItem.cs new file mode 100644 index 0000000..a7a2981 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItem.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsFlatten200ResponseMetaAffectedPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pageObjectNumber")] + public required int PageObjectNumber { get; set; } + + [JsonPropertyName("revision")] + public required DocAnnotationsFlatten200ResponseMetaAffectedPagesItemRevision Revision { get; set; } + + [JsonPropertyName("weakAnnotationState")] + public required DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState WeakAnnotationState { 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/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemRevision.cs b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemRevision.cs new file mode 100644 index 0000000..0911e99 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemRevision.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsFlatten200ResponseMetaAffectedPagesItemRevision : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("docSessionId")] + public required string DocSessionId { get; set; } + + [JsonPropertyName("pageObjectNumber")] + public required int PageObjectNumber { get; set; } + + [JsonPropertyName("generation")] + public required int Generation { 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/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.cs b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.cs new file mode 100644 index 0000000..fd972c4 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.cs @@ -0,0 +1,330 @@ +// 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(DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.JsonConverter) +)] +[Serializable] +public record DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState +{ + internal DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState( + string type, + object? value + ) + { + Kind = type; + Value = value; + } + + /// + /// Create an instance of DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState with . + /// + public DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown value + ) + { + Kind = "unknown"; + Value = value.Value; + } + + /// + /// Create an instance of DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState with . + /// + public DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.Known value + ) + { + Kind = "known"; + 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 "unknown" + /// + public bool IsUnknown => Kind == "unknown"; + + /// + /// Returns true if is "known" + /// + public bool IsKnown => Kind == "known"; + + /// + /// Returns the value as a if is 'unknown', otherwise throws an exception. + /// + /// Thrown when is not 'unknown'. + public CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown AsUnknown() => + IsUnknown + ? (CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown) + Value! + : throw new global::System.Exception( + "DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.Kind is not 'unknown'" + ); + + /// + /// Returns the value as a if is 'known', otherwise throws an exception. + /// + /// Thrown when is not 'known'. + public CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown AsKnown() => + IsKnown + ? (CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown) + Value! + : throw new global::System.Exception( + "DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.Kind is not 'known'" + ); + + public T Match( + Func< + CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown, + T + > onUnknown, + Func< + CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown, + T + > onKnown, + Func onUnknown_ + ) + { + return Kind switch + { + "unknown" => onUnknown(AsUnknown()), + "known" => onKnown(AsKnown()), + _ => onUnknown_(Kind, Value), + }; + } + + public void Visit( + Action onUnknown, + Action onKnown, + Action onUnknown_ + ) + { + switch (Kind) + { + case "unknown": + onUnknown(AsUnknown()); + break; + case "known": + onKnown(AsKnown()); + break; + default: + onUnknown_(Kind, Value); + break; + } + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsUnknown( + out CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown? value + ) + { + if (Kind == "unknown") + { + value = + (CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown) + Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsKnown( + out CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown? value + ) + { + if (Kind == "known") + { + value = + (CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown) + Value!; + return true; + } + value = null; + return false; + } + + public override string ToString() => JsonUtils.Serialize(this); + + public static implicit operator DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown value + ) => new(value); + + public static implicit operator DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.Known value + ) => new(value); + + [Serializable] + internal sealed class JsonConverter + : JsonConverter + { + public override bool CanConvert(global::System.Type typeToConvert) => + typeof(DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState).IsAssignableFrom( + typeToConvert + ); + + public override DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState 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 + { + "unknown" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown" + ), + "known" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown" + ), + _ => json.Deserialize(options), + }; + return new DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState( + discriminator, + value + ); + } + + public override void Write( + Utf8JsonWriter writer, + DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState value, + JsonSerializerOptions options + ) + { + JsonNode json = + value.Kind switch + { + "unknown" => JsonSerializer.SerializeToNode(value.Value, options), + "known" => JsonSerializer.SerializeToNode(value.Value, options), + _ => JsonSerializer.SerializeToNode(value.Value, options), + } ?? new JsonObject(); + json["kind"] = value.Kind; + json.WriteTo(writer, options); + } + + public override DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState 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 DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState( + stringValue, + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Kind); + } + } + + /// + /// Discriminated union type for unknown + /// + [Serializable] + public struct Unknown + { + public Unknown( + CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown value + ) + { + Value = value; + } + + internal CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown( + CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown value + ) => new(value); + } + + /// + /// Discriminated union type for known + /// + [Serializable] + public struct Known + { + public Known( + CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown value + ) + { + Value = value; + } + + internal CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationState.Known( + CloudPDF.DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown value + ) => new(value); + } +} diff --git a/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs new file mode 100644 index 0000000..c33604d --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs @@ -0,0 +1,29 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown + : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("hasAnyWeakAnnotations")] + public required bool HasAnyWeakAnnotations { 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/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs new file mode 100644 index 0000000..5050716 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs @@ -0,0 +1,26 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsFlatten200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown + : 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/DocAnnotationsFlatten200ResponseMetaCacheDelta.cs b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaCacheDelta.cs new file mode 100644 index 0000000..9f0b07b --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaCacheDelta.cs @@ -0,0 +1,38 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsFlatten200ResponseMetaCacheDelta : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("previousDocVersion")] + public required int PreviousDocVersion { get; set; } + + [JsonPropertyName("docVersion")] + public required int DocVersion { get; set; } + + [JsonPropertyName("annotationsVersion")] + public int? AnnotationsVersion { get; set; } + + [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/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItem.cs b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItem.cs new file mode 100644 index 0000000..e109b03 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItem.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pageObjectNumber")] + public required int PageObjectNumber { get; set; } + + [JsonPropertyName("cache")] + public required DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItemCache Cache { 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/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItemCache.cs b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItemCache.cs new file mode 100644 index 0000000..924585a --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItemCache.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsFlatten200ResponseMetaCacheDeltaPagesItemCache : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("contentVersion")] + public required int ContentVersion { get; set; } + + [JsonPropertyName("annotationVersion")] + public required int AnnotationVersion { 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/DocAnnotationsFlatten400Response.cs b/src/CloudPDF/Types/DocAnnotationsFlatten400Response.cs new file mode 100644 index 0000000..4d2c2ae --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten400Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsFlatten400Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocAnnotationsFlatten400ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocAnnotationsFlatten400ResponseCode Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { get; set; } + + [JsonPropertyName("details")] + public Dictionary? Details { 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/DocAnnotationsFlatten400ResponseCode.cs b/src/CloudPDF/Types/DocAnnotationsFlatten400ResponseCode.cs new file mode 100644 index 0000000..00cdef1 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten400ResponseCode.cs @@ -0,0 +1,210 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocAnnotationsFlatten400ResponseCode.DocAnnotationsFlatten400ResponseCodeSerializer) +)] +[Serializable] +public readonly record struct DocAnnotationsFlatten400ResponseCode : IStringEnum +{ + public static readonly DocAnnotationsFlatten400ResponseCode Unknown = new(Values.Unknown); + + public static readonly DocAnnotationsFlatten400ResponseCode InvalidArg = new(Values.InvalidArg); + + public static readonly DocAnnotationsFlatten400ResponseCode DocNotOpen = new(Values.DocNotOpen); + + public static readonly DocAnnotationsFlatten400ResponseCode DocOpenFailed = new( + Values.DocOpenFailed + ); + + public static readonly DocAnnotationsFlatten400ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocAnnotationsFlatten400ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocAnnotationsFlatten400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + + public static readonly DocAnnotationsFlatten400ResponseCode Aborted = new(Values.Aborted); + + public static readonly DocAnnotationsFlatten400ResponseCode Network = new(Values.Network); + + public static readonly DocAnnotationsFlatten400ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocAnnotationsFlatten400ResponseCode Forbidden = new(Values.Forbidden); + + public static readonly DocAnnotationsFlatten400ResponseCode NotFound = new(Values.NotFound); + + public static readonly DocAnnotationsFlatten400ResponseCode WireFormat = new(Values.WireFormat); + + public static readonly DocAnnotationsFlatten400ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocAnnotationsFlatten400ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocAnnotationsFlatten400ResponseCode WeakAnnotationSessionConflict = new( + Values.WeakAnnotationSessionConflict + ); + + public static readonly DocAnnotationsFlatten400ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocAnnotationsFlatten400ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocAnnotationsFlatten400ResponseCode MalformedPdf = new( + Values.MalformedPdf + ); + + public DocAnnotationsFlatten400ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocAnnotationsFlatten400ResponseCode FromCustom(string value) + { + return new DocAnnotationsFlatten400ResponseCode(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 ==(DocAnnotationsFlatten400ResponseCode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocAnnotationsFlatten400ResponseCode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocAnnotationsFlatten400ResponseCode value) => + value.Value; + + public static explicit operator DocAnnotationsFlatten400ResponseCode(string value) => + new(value); + + internal class DocAnnotationsFlatten400ResponseCodeSerializer + : JsonConverter + { + public override DocAnnotationsFlatten400ResponseCode 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 DocAnnotationsFlatten400ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocAnnotationsFlatten400ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocAnnotationsFlatten400ResponseCode 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 DocAnnotationsFlatten400ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocAnnotationsFlatten400ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Unknown = "Unknown"; + + public const string InvalidArg = "InvalidArg"; + + public const string DocNotOpen = "DocNotOpen"; + + public const string DocOpenFailed = "DocOpenFailed"; + + public const string DocPasswordRequired = "DocPasswordRequired"; + + public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + + public const string SharePasswordRequired = "SharePasswordRequired"; + + public const string Aborted = "Aborted"; + + public const string Network = "Network"; + + public const string Unauthenticated = "Unauthenticated"; + + public const string Forbidden = "Forbidden"; + + public const string NotFound = "NotFound"; + + public const string WireFormat = "WireFormat"; + + public const string RuntimeUnavailable = "RuntimeUnavailable"; + + public const string InvalidReference = "InvalidReference"; + + public const string WeakAnnotationSessionConflict = "WeakAnnotationSessionConflict"; + + public const string LayerVersionConflict = "LayerVersionConflict"; + + public const string NotImplemented = "NotImplemented"; + + public const string MalformedPdf = "MalformedPdf"; + } +} diff --git a/src/CloudPDF/Types/DocAnnotationsFlatten400ResponseName.cs b/src/CloudPDF/Types/DocAnnotationsFlatten400ResponseName.cs new file mode 100644 index 0000000..fc51019 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten400ResponseName.cs @@ -0,0 +1,118 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocAnnotationsFlatten400ResponseName.DocAnnotationsFlatten400ResponseNameSerializer) +)] +[Serializable] +public readonly record struct DocAnnotationsFlatten400ResponseName : IStringEnum +{ + public static readonly DocAnnotationsFlatten400ResponseName EngineError = new( + Values.EngineError + ); + + public DocAnnotationsFlatten400ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocAnnotationsFlatten400ResponseName FromCustom(string value) + { + return new DocAnnotationsFlatten400ResponseName(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 ==(DocAnnotationsFlatten400ResponseName value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocAnnotationsFlatten400ResponseName value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocAnnotationsFlatten400ResponseName value) => + value.Value; + + public static explicit operator DocAnnotationsFlatten400ResponseName(string value) => + new(value); + + internal class DocAnnotationsFlatten400ResponseNameSerializer + : JsonConverter + { + public override DocAnnotationsFlatten400ResponseName 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 DocAnnotationsFlatten400ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocAnnotationsFlatten400ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocAnnotationsFlatten400ResponseName 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 DocAnnotationsFlatten400ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocAnnotationsFlatten400ResponseName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string EngineError = "EngineError"; + } +} diff --git a/src/CloudPDF/Types/DocAnnotationsFlatten404Response.cs b/src/CloudPDF/Types/DocAnnotationsFlatten404Response.cs new file mode 100644 index 0000000..7cd7ae7 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten404Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsFlatten404Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocAnnotationsFlatten404ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocAnnotationsFlatten404ResponseCode Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { get; set; } + + [JsonPropertyName("details")] + public Dictionary? Details { 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/DocAnnotationsFlatten404ResponseCode.cs b/src/CloudPDF/Types/DocAnnotationsFlatten404ResponseCode.cs new file mode 100644 index 0000000..8cf251a --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten404ResponseCode.cs @@ -0,0 +1,210 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocAnnotationsFlatten404ResponseCode.DocAnnotationsFlatten404ResponseCodeSerializer) +)] +[Serializable] +public readonly record struct DocAnnotationsFlatten404ResponseCode : IStringEnum +{ + public static readonly DocAnnotationsFlatten404ResponseCode Unknown = new(Values.Unknown); + + public static readonly DocAnnotationsFlatten404ResponseCode InvalidArg = new(Values.InvalidArg); + + public static readonly DocAnnotationsFlatten404ResponseCode DocNotOpen = new(Values.DocNotOpen); + + public static readonly DocAnnotationsFlatten404ResponseCode DocOpenFailed = new( + Values.DocOpenFailed + ); + + public static readonly DocAnnotationsFlatten404ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocAnnotationsFlatten404ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocAnnotationsFlatten404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + + public static readonly DocAnnotationsFlatten404ResponseCode Aborted = new(Values.Aborted); + + public static readonly DocAnnotationsFlatten404ResponseCode Network = new(Values.Network); + + public static readonly DocAnnotationsFlatten404ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocAnnotationsFlatten404ResponseCode Forbidden = new(Values.Forbidden); + + public static readonly DocAnnotationsFlatten404ResponseCode NotFound = new(Values.NotFound); + + public static readonly DocAnnotationsFlatten404ResponseCode WireFormat = new(Values.WireFormat); + + public static readonly DocAnnotationsFlatten404ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocAnnotationsFlatten404ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocAnnotationsFlatten404ResponseCode WeakAnnotationSessionConflict = new( + Values.WeakAnnotationSessionConflict + ); + + public static readonly DocAnnotationsFlatten404ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocAnnotationsFlatten404ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocAnnotationsFlatten404ResponseCode MalformedPdf = new( + Values.MalformedPdf + ); + + public DocAnnotationsFlatten404ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocAnnotationsFlatten404ResponseCode FromCustom(string value) + { + return new DocAnnotationsFlatten404ResponseCode(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 ==(DocAnnotationsFlatten404ResponseCode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocAnnotationsFlatten404ResponseCode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocAnnotationsFlatten404ResponseCode value) => + value.Value; + + public static explicit operator DocAnnotationsFlatten404ResponseCode(string value) => + new(value); + + internal class DocAnnotationsFlatten404ResponseCodeSerializer + : JsonConverter + { + public override DocAnnotationsFlatten404ResponseCode 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 DocAnnotationsFlatten404ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocAnnotationsFlatten404ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocAnnotationsFlatten404ResponseCode 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 DocAnnotationsFlatten404ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocAnnotationsFlatten404ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Unknown = "Unknown"; + + public const string InvalidArg = "InvalidArg"; + + public const string DocNotOpen = "DocNotOpen"; + + public const string DocOpenFailed = "DocOpenFailed"; + + public const string DocPasswordRequired = "DocPasswordRequired"; + + public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + + public const string SharePasswordRequired = "SharePasswordRequired"; + + public const string Aborted = "Aborted"; + + public const string Network = "Network"; + + public const string Unauthenticated = "Unauthenticated"; + + public const string Forbidden = "Forbidden"; + + public const string NotFound = "NotFound"; + + public const string WireFormat = "WireFormat"; + + public const string RuntimeUnavailable = "RuntimeUnavailable"; + + public const string InvalidReference = "InvalidReference"; + + public const string WeakAnnotationSessionConflict = "WeakAnnotationSessionConflict"; + + public const string LayerVersionConflict = "LayerVersionConflict"; + + public const string NotImplemented = "NotImplemented"; + + public const string MalformedPdf = "MalformedPdf"; + } +} diff --git a/src/CloudPDF/Types/DocAnnotationsFlatten404ResponseName.cs b/src/CloudPDF/Types/DocAnnotationsFlatten404ResponseName.cs new file mode 100644 index 0000000..1de54b7 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsFlatten404ResponseName.cs @@ -0,0 +1,118 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocAnnotationsFlatten404ResponseName.DocAnnotationsFlatten404ResponseNameSerializer) +)] +[Serializable] +public readonly record struct DocAnnotationsFlatten404ResponseName : IStringEnum +{ + public static readonly DocAnnotationsFlatten404ResponseName EngineError = new( + Values.EngineError + ); + + public DocAnnotationsFlatten404ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocAnnotationsFlatten404ResponseName FromCustom(string value) + { + return new DocAnnotationsFlatten404ResponseName(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 ==(DocAnnotationsFlatten404ResponseName value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocAnnotationsFlatten404ResponseName value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocAnnotationsFlatten404ResponseName value) => + value.Value; + + public static explicit operator DocAnnotationsFlatten404ResponseName(string value) => + new(value); + + internal class DocAnnotationsFlatten404ResponseNameSerializer + : JsonConverter + { + public override DocAnnotationsFlatten404ResponseName 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 DocAnnotationsFlatten404ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocAnnotationsFlatten404ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocAnnotationsFlatten404ResponseName 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 DocAnnotationsFlatten404ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocAnnotationsFlatten404ResponseName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string EngineError = "EngineError"; + } +} diff --git a/src/CloudPDF/Types/DocPagesRemoveName200Response.cs b/src/CloudPDF/Types/DocPagesRemoveName200Response.cs new file mode 100644 index 0000000..ab0287a --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName200Response.cs @@ -0,0 +1,30 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesRemoveName200Response : IJsonOnDeserialized, IJsonOnSerializing +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("meta")] + public required DocPagesRemoveName200ResponseMeta Meta { get; set; } + + [JsonIgnore] + public AdditionalProperties AdditionalProperties { get; set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + void IJsonOnSerializing.OnSerializing() => + AdditionalProperties.CopyToExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/DocPagesRemoveName200ResponseMeta.cs b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMeta.cs new file mode 100644 index 0000000..135fd57 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMeta.cs @@ -0,0 +1,32 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesRemoveName200ResponseMeta : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("affectedPages")] + public IEnumerable AffectedPages { get; set; } = + new List(); + + [JsonPropertyName("cacheDelta")] + public DocPagesRemoveName200ResponseMetaCacheDelta? CacheDelta { 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/DocPagesRemoveName200ResponseMetaAffectedPagesItem.cs b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItem.cs new file mode 100644 index 0000000..f2fac97 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItem.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesRemoveName200ResponseMetaAffectedPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pageObjectNumber")] + public required int PageObjectNumber { get; set; } + + [JsonPropertyName("revision")] + public required DocPagesRemoveName200ResponseMetaAffectedPagesItemRevision Revision { get; set; } + + [JsonPropertyName("weakAnnotationState")] + public required DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState WeakAnnotationState { 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/DocPagesRemoveName200ResponseMetaAffectedPagesItemRevision.cs b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemRevision.cs new file mode 100644 index 0000000..4df85ac --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemRevision.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesRemoveName200ResponseMetaAffectedPagesItemRevision : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("docSessionId")] + public required string DocSessionId { get; set; } + + [JsonPropertyName("pageObjectNumber")] + public required int PageObjectNumber { get; set; } + + [JsonPropertyName("generation")] + public required int Generation { 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/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.cs b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.cs new file mode 100644 index 0000000..59af7aa --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.cs @@ -0,0 +1,330 @@ +// 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(DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.JsonConverter) +)] +[Serializable] +public record DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState +{ + internal DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState( + string type, + object? value + ) + { + Kind = type; + Value = value; + } + + /// + /// Create an instance of DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState with . + /// + public DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown value + ) + { + Kind = "unknown"; + Value = value.Value; + } + + /// + /// Create an instance of DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState with . + /// + public DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.Known value + ) + { + Kind = "known"; + 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 "unknown" + /// + public bool IsUnknown => Kind == "unknown"; + + /// + /// Returns true if is "known" + /// + public bool IsKnown => Kind == "known"; + + /// + /// Returns the value as a if is 'unknown', otherwise throws an exception. + /// + /// Thrown when is not 'unknown'. + public CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown AsUnknown() => + IsUnknown + ? (CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown) + Value! + : throw new global::System.Exception( + "DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.Kind is not 'unknown'" + ); + + /// + /// Returns the value as a if is 'known', otherwise throws an exception. + /// + /// Thrown when is not 'known'. + public CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown AsKnown() => + IsKnown + ? (CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown) + Value! + : throw new global::System.Exception( + "DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.Kind is not 'known'" + ); + + public T Match( + Func< + CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown, + T + > onUnknown, + Func< + CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown, + T + > onKnown, + Func onUnknown_ + ) + { + return Kind switch + { + "unknown" => onUnknown(AsUnknown()), + "known" => onKnown(AsKnown()), + _ => onUnknown_(Kind, Value), + }; + } + + public void Visit( + Action onUnknown, + Action onKnown, + Action onUnknown_ + ) + { + switch (Kind) + { + case "unknown": + onUnknown(AsUnknown()); + break; + case "known": + onKnown(AsKnown()); + break; + default: + onUnknown_(Kind, Value); + break; + } + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsUnknown( + out CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown? value + ) + { + if (Kind == "unknown") + { + value = + (CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown) + Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsKnown( + out CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown? value + ) + { + if (Kind == "known") + { + value = + (CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown) + Value!; + return true; + } + value = null; + return false; + } + + public override string ToString() => JsonUtils.Serialize(this); + + public static implicit operator DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown value + ) => new(value); + + public static implicit operator DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.Known value + ) => new(value); + + [Serializable] + internal sealed class JsonConverter + : JsonConverter + { + public override bool CanConvert(global::System.Type typeToConvert) => + typeof(DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState).IsAssignableFrom( + typeToConvert + ); + + public override DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState 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 + { + "unknown" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown" + ), + "known" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown" + ), + _ => json.Deserialize(options), + }; + return new DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState( + discriminator, + value + ); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState value, + JsonSerializerOptions options + ) + { + JsonNode json = + value.Kind switch + { + "unknown" => JsonSerializer.SerializeToNode(value.Value, options), + "known" => JsonSerializer.SerializeToNode(value.Value, options), + _ => JsonSerializer.SerializeToNode(value.Value, options), + } ?? new JsonObject(); + json["kind"] = value.Kind; + json.WriteTo(writer, options); + } + + public override DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState 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 DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState( + stringValue, + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Kind); + } + } + + /// + /// Discriminated union type for unknown + /// + [Serializable] + public struct Unknown + { + public Unknown( + CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown value + ) + { + Value = value; + } + + internal CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown( + CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown value + ) => new(value); + } + + /// + /// Discriminated union type for known + /// + [Serializable] + public struct Known + { + public Known( + CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown value + ) + { + Value = value; + } + + internal CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationState.Known( + CloudPDF.DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown value + ) => new(value); + } +} diff --git a/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs new file mode 100644 index 0000000..e882959 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs @@ -0,0 +1,29 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown + : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("hasAnyWeakAnnotations")] + public required bool HasAnyWeakAnnotations { 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/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs new file mode 100644 index 0000000..9f7bd55 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs @@ -0,0 +1,26 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesRemoveName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown + : 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/DocPagesRemoveName200ResponseMetaCacheDelta.cs b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaCacheDelta.cs new file mode 100644 index 0000000..cdb80b6 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaCacheDelta.cs @@ -0,0 +1,38 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesRemoveName200ResponseMetaCacheDelta : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("previousDocVersion")] + public required int PreviousDocVersion { get; set; } + + [JsonPropertyName("docVersion")] + public required int DocVersion { get; set; } + + [JsonPropertyName("annotationsVersion")] + public int? AnnotationsVersion { get; set; } + + [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/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItem.cs b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItem.cs new file mode 100644 index 0000000..316f630 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItem.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesRemoveName200ResponseMetaCacheDeltaPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pageObjectNumber")] + public required int PageObjectNumber { get; set; } + + [JsonPropertyName("cache")] + public required DocPagesRemoveName200ResponseMetaCacheDeltaPagesItemCache Cache { 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/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItemCache.cs b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItemCache.cs new file mode 100644 index 0000000..c2a93cb --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName200ResponseMetaCacheDeltaPagesItemCache.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesRemoveName200ResponseMetaCacheDeltaPagesItemCache : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("contentVersion")] + public required int ContentVersion { get; set; } + + [JsonPropertyName("annotationVersion")] + public required int AnnotationVersion { 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/DocPagesRemoveName400Response.cs b/src/CloudPDF/Types/DocPagesRemoveName400Response.cs new file mode 100644 index 0000000..4d5cd9d --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName400Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesRemoveName400Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocPagesRemoveName400ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocPagesRemoveName400ResponseCode Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { get; set; } + + [JsonPropertyName("details")] + public Dictionary? Details { 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/DocPagesRemoveName400ResponseCode.cs b/src/CloudPDF/Types/DocPagesRemoveName400ResponseCode.cs new file mode 100644 index 0000000..c72fcdf --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName400ResponseCode.cs @@ -0,0 +1,208 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocPagesRemoveName400ResponseCode.DocPagesRemoveName400ResponseCodeSerializer) +)] +[Serializable] +public readonly record struct DocPagesRemoveName400ResponseCode : IStringEnum +{ + public static readonly DocPagesRemoveName400ResponseCode Unknown = new(Values.Unknown); + + public static readonly DocPagesRemoveName400ResponseCode InvalidArg = new(Values.InvalidArg); + + public static readonly DocPagesRemoveName400ResponseCode DocNotOpen = new(Values.DocNotOpen); + + public static readonly DocPagesRemoveName400ResponseCode DocOpenFailed = new( + Values.DocOpenFailed + ); + + public static readonly DocPagesRemoveName400ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocPagesRemoveName400ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocPagesRemoveName400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + + public static readonly DocPagesRemoveName400ResponseCode Aborted = new(Values.Aborted); + + public static readonly DocPagesRemoveName400ResponseCode Network = new(Values.Network); + + public static readonly DocPagesRemoveName400ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocPagesRemoveName400ResponseCode Forbidden = new(Values.Forbidden); + + public static readonly DocPagesRemoveName400ResponseCode NotFound = new(Values.NotFound); + + public static readonly DocPagesRemoveName400ResponseCode WireFormat = new(Values.WireFormat); + + public static readonly DocPagesRemoveName400ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocPagesRemoveName400ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocPagesRemoveName400ResponseCode WeakAnnotationSessionConflict = new( + Values.WeakAnnotationSessionConflict + ); + + public static readonly DocPagesRemoveName400ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocPagesRemoveName400ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocPagesRemoveName400ResponseCode MalformedPdf = new( + Values.MalformedPdf + ); + + public DocPagesRemoveName400ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesRemoveName400ResponseCode FromCustom(string value) + { + return new DocPagesRemoveName400ResponseCode(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 ==(DocPagesRemoveName400ResponseCode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesRemoveName400ResponseCode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesRemoveName400ResponseCode value) => value.Value; + + public static explicit operator DocPagesRemoveName400ResponseCode(string value) => new(value); + + internal class DocPagesRemoveName400ResponseCodeSerializer + : JsonConverter + { + public override DocPagesRemoveName400ResponseCode 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 DocPagesRemoveName400ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesRemoveName400ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesRemoveName400ResponseCode 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 DocPagesRemoveName400ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesRemoveName400ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Unknown = "Unknown"; + + public const string InvalidArg = "InvalidArg"; + + public const string DocNotOpen = "DocNotOpen"; + + public const string DocOpenFailed = "DocOpenFailed"; + + public const string DocPasswordRequired = "DocPasswordRequired"; + + public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + + public const string SharePasswordRequired = "SharePasswordRequired"; + + public const string Aborted = "Aborted"; + + public const string Network = "Network"; + + public const string Unauthenticated = "Unauthenticated"; + + public const string Forbidden = "Forbidden"; + + public const string NotFound = "NotFound"; + + public const string WireFormat = "WireFormat"; + + public const string RuntimeUnavailable = "RuntimeUnavailable"; + + public const string InvalidReference = "InvalidReference"; + + public const string WeakAnnotationSessionConflict = "WeakAnnotationSessionConflict"; + + public const string LayerVersionConflict = "LayerVersionConflict"; + + public const string NotImplemented = "NotImplemented"; + + public const string MalformedPdf = "MalformedPdf"; + } +} diff --git a/src/CloudPDF/Types/DocPagesRemoveName400ResponseName.cs b/src/CloudPDF/Types/DocPagesRemoveName400ResponseName.cs new file mode 100644 index 0000000..9d5a467 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName400ResponseName.cs @@ -0,0 +1,114 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocPagesRemoveName400ResponseName.DocPagesRemoveName400ResponseNameSerializer) +)] +[Serializable] +public readonly record struct DocPagesRemoveName400ResponseName : IStringEnum +{ + public static readonly DocPagesRemoveName400ResponseName EngineError = new(Values.EngineError); + + public DocPagesRemoveName400ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesRemoveName400ResponseName FromCustom(string value) + { + return new DocPagesRemoveName400ResponseName(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 ==(DocPagesRemoveName400ResponseName value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesRemoveName400ResponseName value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesRemoveName400ResponseName value) => value.Value; + + public static explicit operator DocPagesRemoveName400ResponseName(string value) => new(value); + + internal class DocPagesRemoveName400ResponseNameSerializer + : JsonConverter + { + public override DocPagesRemoveName400ResponseName 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 DocPagesRemoveName400ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesRemoveName400ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesRemoveName400ResponseName 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 DocPagesRemoveName400ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesRemoveName400ResponseName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string EngineError = "EngineError"; + } +} diff --git a/src/CloudPDF/Types/DocPagesRemoveName404Response.cs b/src/CloudPDF/Types/DocPagesRemoveName404Response.cs new file mode 100644 index 0000000..b730b0f --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName404Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesRemoveName404Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocPagesRemoveName404ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocPagesRemoveName404ResponseCode Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { get; set; } + + [JsonPropertyName("details")] + public Dictionary? Details { 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/DocPagesRemoveName404ResponseCode.cs b/src/CloudPDF/Types/DocPagesRemoveName404ResponseCode.cs new file mode 100644 index 0000000..bb00e75 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName404ResponseCode.cs @@ -0,0 +1,208 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocPagesRemoveName404ResponseCode.DocPagesRemoveName404ResponseCodeSerializer) +)] +[Serializable] +public readonly record struct DocPagesRemoveName404ResponseCode : IStringEnum +{ + public static readonly DocPagesRemoveName404ResponseCode Unknown = new(Values.Unknown); + + public static readonly DocPagesRemoveName404ResponseCode InvalidArg = new(Values.InvalidArg); + + public static readonly DocPagesRemoveName404ResponseCode DocNotOpen = new(Values.DocNotOpen); + + public static readonly DocPagesRemoveName404ResponseCode DocOpenFailed = new( + Values.DocOpenFailed + ); + + public static readonly DocPagesRemoveName404ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocPagesRemoveName404ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocPagesRemoveName404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + + public static readonly DocPagesRemoveName404ResponseCode Aborted = new(Values.Aborted); + + public static readonly DocPagesRemoveName404ResponseCode Network = new(Values.Network); + + public static readonly DocPagesRemoveName404ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocPagesRemoveName404ResponseCode Forbidden = new(Values.Forbidden); + + public static readonly DocPagesRemoveName404ResponseCode NotFound = new(Values.NotFound); + + public static readonly DocPagesRemoveName404ResponseCode WireFormat = new(Values.WireFormat); + + public static readonly DocPagesRemoveName404ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocPagesRemoveName404ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocPagesRemoveName404ResponseCode WeakAnnotationSessionConflict = new( + Values.WeakAnnotationSessionConflict + ); + + public static readonly DocPagesRemoveName404ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocPagesRemoveName404ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocPagesRemoveName404ResponseCode MalformedPdf = new( + Values.MalformedPdf + ); + + public DocPagesRemoveName404ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesRemoveName404ResponseCode FromCustom(string value) + { + return new DocPagesRemoveName404ResponseCode(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 ==(DocPagesRemoveName404ResponseCode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesRemoveName404ResponseCode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesRemoveName404ResponseCode value) => value.Value; + + public static explicit operator DocPagesRemoveName404ResponseCode(string value) => new(value); + + internal class DocPagesRemoveName404ResponseCodeSerializer + : JsonConverter + { + public override DocPagesRemoveName404ResponseCode 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 DocPagesRemoveName404ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesRemoveName404ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesRemoveName404ResponseCode 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 DocPagesRemoveName404ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesRemoveName404ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Unknown = "Unknown"; + + public const string InvalidArg = "InvalidArg"; + + public const string DocNotOpen = "DocNotOpen"; + + public const string DocOpenFailed = "DocOpenFailed"; + + public const string DocPasswordRequired = "DocPasswordRequired"; + + public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + + public const string SharePasswordRequired = "SharePasswordRequired"; + + public const string Aborted = "Aborted"; + + public const string Network = "Network"; + + public const string Unauthenticated = "Unauthenticated"; + + public const string Forbidden = "Forbidden"; + + public const string NotFound = "NotFound"; + + public const string WireFormat = "WireFormat"; + + public const string RuntimeUnavailable = "RuntimeUnavailable"; + + public const string InvalidReference = "InvalidReference"; + + public const string WeakAnnotationSessionConflict = "WeakAnnotationSessionConflict"; + + public const string LayerVersionConflict = "LayerVersionConflict"; + + public const string NotImplemented = "NotImplemented"; + + public const string MalformedPdf = "MalformedPdf"; + } +} diff --git a/src/CloudPDF/Types/DocPagesRemoveName404ResponseName.cs b/src/CloudPDF/Types/DocPagesRemoveName404ResponseName.cs new file mode 100644 index 0000000..5a9c2fe --- /dev/null +++ b/src/CloudPDF/Types/DocPagesRemoveName404ResponseName.cs @@ -0,0 +1,114 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocPagesRemoveName404ResponseName.DocPagesRemoveName404ResponseNameSerializer) +)] +[Serializable] +public readonly record struct DocPagesRemoveName404ResponseName : IStringEnum +{ + public static readonly DocPagesRemoveName404ResponseName EngineError = new(Values.EngineError); + + public DocPagesRemoveName404ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesRemoveName404ResponseName FromCustom(string value) + { + return new DocPagesRemoveName404ResponseName(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 ==(DocPagesRemoveName404ResponseName value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesRemoveName404ResponseName value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesRemoveName404ResponseName value) => value.Value; + + public static explicit operator DocPagesRemoveName404ResponseName(string value) => new(value); + + internal class DocPagesRemoveName404ResponseNameSerializer + : JsonConverter + { + public override DocPagesRemoveName404ResponseName 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 DocPagesRemoveName404ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesRemoveName404ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesRemoveName404ResponseName 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 DocPagesRemoveName404ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesRemoveName404ResponseName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string EngineError = "EngineError"; + } +} diff --git a/src/CloudPDF/Types/DocPagesSetName200Response.cs b/src/CloudPDF/Types/DocPagesSetName200Response.cs new file mode 100644 index 0000000..a09e2ee --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName200Response.cs @@ -0,0 +1,30 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesSetName200Response : IJsonOnDeserialized, IJsonOnSerializing +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("meta")] + public required DocPagesSetName200ResponseMeta Meta { get; set; } + + [JsonIgnore] + public AdditionalProperties AdditionalProperties { get; set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + void IJsonOnSerializing.OnSerializing() => + AdditionalProperties.CopyToExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/DocPagesSetName200ResponseMeta.cs b/src/CloudPDF/Types/DocPagesSetName200ResponseMeta.cs new file mode 100644 index 0000000..346781e --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName200ResponseMeta.cs @@ -0,0 +1,32 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesSetName200ResponseMeta : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("affectedPages")] + public IEnumerable AffectedPages { get; set; } = + new List(); + + [JsonPropertyName("cacheDelta")] + public DocPagesSetName200ResponseMetaCacheDelta? CacheDelta { 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/DocPagesSetName200ResponseMetaAffectedPagesItem.cs b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItem.cs new file mode 100644 index 0000000..fc820b0 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItem.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesSetName200ResponseMetaAffectedPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pageObjectNumber")] + public required int PageObjectNumber { get; set; } + + [JsonPropertyName("revision")] + public required DocPagesSetName200ResponseMetaAffectedPagesItemRevision Revision { get; set; } + + [JsonPropertyName("weakAnnotationState")] + public required DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState WeakAnnotationState { 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/DocPagesSetName200ResponseMetaAffectedPagesItemRevision.cs b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItemRevision.cs new file mode 100644 index 0000000..79dface --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItemRevision.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesSetName200ResponseMetaAffectedPagesItemRevision : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("docSessionId")] + public required string DocSessionId { get; set; } + + [JsonPropertyName("pageObjectNumber")] + public required int PageObjectNumber { get; set; } + + [JsonPropertyName("generation")] + public required int Generation { 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/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.cs b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.cs new file mode 100644 index 0000000..709aaeb --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.cs @@ -0,0 +1,330 @@ +// 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(DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.JsonConverter) +)] +[Serializable] +public record DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState +{ + internal DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState( + string type, + object? value + ) + { + Kind = type; + Value = value; + } + + /// + /// Create an instance of DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState with . + /// + public DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown value + ) + { + Kind = "unknown"; + Value = value.Value; + } + + /// + /// Create an instance of DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState with . + /// + public DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.Known value + ) + { + Kind = "known"; + 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 "unknown" + /// + public bool IsUnknown => Kind == "unknown"; + + /// + /// Returns true if is "known" + /// + public bool IsKnown => Kind == "known"; + + /// + /// Returns the value as a if is 'unknown', otherwise throws an exception. + /// + /// Thrown when is not 'unknown'. + public CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown AsUnknown() => + IsUnknown + ? (CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown) + Value! + : throw new global::System.Exception( + "DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.Kind is not 'unknown'" + ); + + /// + /// Returns the value as a if is 'known', otherwise throws an exception. + /// + /// Thrown when is not 'known'. + public CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown AsKnown() => + IsKnown + ? (CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown) + Value! + : throw new global::System.Exception( + "DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.Kind is not 'known'" + ); + + public T Match( + Func< + CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown, + T + > onUnknown, + Func< + CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown, + T + > onKnown, + Func onUnknown_ + ) + { + return Kind switch + { + "unknown" => onUnknown(AsUnknown()), + "known" => onKnown(AsKnown()), + _ => onUnknown_(Kind, Value), + }; + } + + public void Visit( + Action onUnknown, + Action onKnown, + Action onUnknown_ + ) + { + switch (Kind) + { + case "unknown": + onUnknown(AsUnknown()); + break; + case "known": + onKnown(AsKnown()); + break; + default: + onUnknown_(Kind, Value); + break; + } + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsUnknown( + out CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown? value + ) + { + if (Kind == "unknown") + { + value = + (CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown) + Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsKnown( + out CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown? value + ) + { + if (Kind == "known") + { + value = + (CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown) + Value!; + return true; + } + value = null; + return false; + } + + public override string ToString() => JsonUtils.Serialize(this); + + public static implicit operator DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown value + ) => new(value); + + public static implicit operator DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.Known value + ) => new(value); + + [Serializable] + internal sealed class JsonConverter + : JsonConverter + { + public override bool CanConvert(global::System.Type typeToConvert) => + typeof(DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState).IsAssignableFrom( + typeToConvert + ); + + public override DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState 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 + { + "unknown" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown" + ), + "known" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown" + ), + _ => json.Deserialize(options), + }; + return new DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState( + discriminator, + value + ); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState value, + JsonSerializerOptions options + ) + { + JsonNode json = + value.Kind switch + { + "unknown" => JsonSerializer.SerializeToNode(value.Value, options), + "known" => JsonSerializer.SerializeToNode(value.Value, options), + _ => JsonSerializer.SerializeToNode(value.Value, options), + } ?? new JsonObject(); + json["kind"] = value.Kind; + json.WriteTo(writer, options); + } + + public override DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState 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 DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState( + stringValue, + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Kind); + } + } + + /// + /// Discriminated union type for unknown + /// + [Serializable] + public struct Unknown + { + public Unknown( + CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown value + ) + { + Value = value; + } + + internal CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown( + CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown value + ) => new(value); + } + + /// + /// Discriminated union type for known + /// + [Serializable] + public struct Known + { + public Known( + CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown value + ) + { + Value = value; + } + + internal CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationState.Known( + CloudPDF.DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown value + ) => new(value); + } +} diff --git a/src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs new file mode 100644 index 0000000..7472698 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs @@ -0,0 +1,29 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown + : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("hasAnyWeakAnnotations")] + public required bool HasAnyWeakAnnotations { 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/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs new file mode 100644 index 0000000..82971dc --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs @@ -0,0 +1,26 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesSetName200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown + : 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/DocPagesSetName200ResponseMetaCacheDelta.cs b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaCacheDelta.cs new file mode 100644 index 0000000..a478d87 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaCacheDelta.cs @@ -0,0 +1,38 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesSetName200ResponseMetaCacheDelta : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("previousDocVersion")] + public required int PreviousDocVersion { get; set; } + + [JsonPropertyName("docVersion")] + public required int DocVersion { get; set; } + + [JsonPropertyName("annotationsVersion")] + public int? AnnotationsVersion { get; set; } + + [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/DocPagesSetName200ResponseMetaCacheDeltaPagesItem.cs b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaCacheDeltaPagesItem.cs new file mode 100644 index 0000000..b226392 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaCacheDeltaPagesItem.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesSetName200ResponseMetaCacheDeltaPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pageObjectNumber")] + public required int PageObjectNumber { get; set; } + + [JsonPropertyName("cache")] + public required DocPagesSetName200ResponseMetaCacheDeltaPagesItemCache Cache { 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/DocPagesSetName200ResponseMetaCacheDeltaPagesItemCache.cs b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaCacheDeltaPagesItemCache.cs new file mode 100644 index 0000000..1f6a0e6 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName200ResponseMetaCacheDeltaPagesItemCache.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesSetName200ResponseMetaCacheDeltaPagesItemCache : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("contentVersion")] + public required int ContentVersion { get; set; } + + [JsonPropertyName("annotationVersion")] + public required int AnnotationVersion { 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/DocPagesSetName400Response.cs b/src/CloudPDF/Types/DocPagesSetName400Response.cs new file mode 100644 index 0000000..fd14646 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName400Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesSetName400Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocPagesSetName400ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocPagesSetName400ResponseCode Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { get; set; } + + [JsonPropertyName("details")] + public Dictionary? Details { 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/DocPagesSetName400ResponseCode.cs b/src/CloudPDF/Types/DocPagesSetName400ResponseCode.cs new file mode 100644 index 0000000..06b1343 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName400ResponseCode.cs @@ -0,0 +1,202 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(DocPagesSetName400ResponseCode.DocPagesSetName400ResponseCodeSerializer))] +[Serializable] +public readonly record struct DocPagesSetName400ResponseCode : IStringEnum +{ + public static readonly DocPagesSetName400ResponseCode Unknown = new(Values.Unknown); + + public static readonly DocPagesSetName400ResponseCode InvalidArg = new(Values.InvalidArg); + + public static readonly DocPagesSetName400ResponseCode DocNotOpen = new(Values.DocNotOpen); + + public static readonly DocPagesSetName400ResponseCode DocOpenFailed = new(Values.DocOpenFailed); + + public static readonly DocPagesSetName400ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocPagesSetName400ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocPagesSetName400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + + public static readonly DocPagesSetName400ResponseCode Aborted = new(Values.Aborted); + + public static readonly DocPagesSetName400ResponseCode Network = new(Values.Network); + + public static readonly DocPagesSetName400ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocPagesSetName400ResponseCode Forbidden = new(Values.Forbidden); + + public static readonly DocPagesSetName400ResponseCode NotFound = new(Values.NotFound); + + public static readonly DocPagesSetName400ResponseCode WireFormat = new(Values.WireFormat); + + public static readonly DocPagesSetName400ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocPagesSetName400ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocPagesSetName400ResponseCode WeakAnnotationSessionConflict = new( + Values.WeakAnnotationSessionConflict + ); + + public static readonly DocPagesSetName400ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocPagesSetName400ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocPagesSetName400ResponseCode MalformedPdf = new(Values.MalformedPdf); + + public DocPagesSetName400ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesSetName400ResponseCode FromCustom(string value) + { + return new DocPagesSetName400ResponseCode(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 ==(DocPagesSetName400ResponseCode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesSetName400ResponseCode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesSetName400ResponseCode value) => value.Value; + + public static explicit operator DocPagesSetName400ResponseCode(string value) => new(value); + + internal class DocPagesSetName400ResponseCodeSerializer + : JsonConverter + { + public override DocPagesSetName400ResponseCode 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 DocPagesSetName400ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesSetName400ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesSetName400ResponseCode 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 DocPagesSetName400ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesSetName400ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Unknown = "Unknown"; + + public const string InvalidArg = "InvalidArg"; + + public const string DocNotOpen = "DocNotOpen"; + + public const string DocOpenFailed = "DocOpenFailed"; + + public const string DocPasswordRequired = "DocPasswordRequired"; + + public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + + public const string SharePasswordRequired = "SharePasswordRequired"; + + public const string Aborted = "Aborted"; + + public const string Network = "Network"; + + public const string Unauthenticated = "Unauthenticated"; + + public const string Forbidden = "Forbidden"; + + public const string NotFound = "NotFound"; + + public const string WireFormat = "WireFormat"; + + public const string RuntimeUnavailable = "RuntimeUnavailable"; + + public const string InvalidReference = "InvalidReference"; + + public const string WeakAnnotationSessionConflict = "WeakAnnotationSessionConflict"; + + public const string LayerVersionConflict = "LayerVersionConflict"; + + public const string NotImplemented = "NotImplemented"; + + public const string MalformedPdf = "MalformedPdf"; + } +} diff --git a/src/CloudPDF/Types/DocPagesSetName400ResponseName.cs b/src/CloudPDF/Types/DocPagesSetName400ResponseName.cs new file mode 100644 index 0000000..9c0b700 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName400ResponseName.cs @@ -0,0 +1,112 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(DocPagesSetName400ResponseName.DocPagesSetName400ResponseNameSerializer))] +[Serializable] +public readonly record struct DocPagesSetName400ResponseName : IStringEnum +{ + public static readonly DocPagesSetName400ResponseName EngineError = new(Values.EngineError); + + public DocPagesSetName400ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesSetName400ResponseName FromCustom(string value) + { + return new DocPagesSetName400ResponseName(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 ==(DocPagesSetName400ResponseName value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesSetName400ResponseName value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesSetName400ResponseName value) => value.Value; + + public static explicit operator DocPagesSetName400ResponseName(string value) => new(value); + + internal class DocPagesSetName400ResponseNameSerializer + : JsonConverter + { + public override DocPagesSetName400ResponseName 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 DocPagesSetName400ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesSetName400ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesSetName400ResponseName 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 DocPagesSetName400ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesSetName400ResponseName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string EngineError = "EngineError"; + } +} diff --git a/src/CloudPDF/Types/DocPagesSetName404Response.cs b/src/CloudPDF/Types/DocPagesSetName404Response.cs new file mode 100644 index 0000000..6f8e1dd --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName404Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesSetName404Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocPagesSetName404ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocPagesSetName404ResponseCode Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { get; set; } + + [JsonPropertyName("details")] + public Dictionary? Details { 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/DocPagesSetName404ResponseCode.cs b/src/CloudPDF/Types/DocPagesSetName404ResponseCode.cs new file mode 100644 index 0000000..584cd63 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName404ResponseCode.cs @@ -0,0 +1,202 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(DocPagesSetName404ResponseCode.DocPagesSetName404ResponseCodeSerializer))] +[Serializable] +public readonly record struct DocPagesSetName404ResponseCode : IStringEnum +{ + public static readonly DocPagesSetName404ResponseCode Unknown = new(Values.Unknown); + + public static readonly DocPagesSetName404ResponseCode InvalidArg = new(Values.InvalidArg); + + public static readonly DocPagesSetName404ResponseCode DocNotOpen = new(Values.DocNotOpen); + + public static readonly DocPagesSetName404ResponseCode DocOpenFailed = new(Values.DocOpenFailed); + + public static readonly DocPagesSetName404ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocPagesSetName404ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocPagesSetName404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + + public static readonly DocPagesSetName404ResponseCode Aborted = new(Values.Aborted); + + public static readonly DocPagesSetName404ResponseCode Network = new(Values.Network); + + public static readonly DocPagesSetName404ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocPagesSetName404ResponseCode Forbidden = new(Values.Forbidden); + + public static readonly DocPagesSetName404ResponseCode NotFound = new(Values.NotFound); + + public static readonly DocPagesSetName404ResponseCode WireFormat = new(Values.WireFormat); + + public static readonly DocPagesSetName404ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocPagesSetName404ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocPagesSetName404ResponseCode WeakAnnotationSessionConflict = new( + Values.WeakAnnotationSessionConflict + ); + + public static readonly DocPagesSetName404ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocPagesSetName404ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocPagesSetName404ResponseCode MalformedPdf = new(Values.MalformedPdf); + + public DocPagesSetName404ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesSetName404ResponseCode FromCustom(string value) + { + return new DocPagesSetName404ResponseCode(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 ==(DocPagesSetName404ResponseCode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesSetName404ResponseCode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesSetName404ResponseCode value) => value.Value; + + public static explicit operator DocPagesSetName404ResponseCode(string value) => new(value); + + internal class DocPagesSetName404ResponseCodeSerializer + : JsonConverter + { + public override DocPagesSetName404ResponseCode 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 DocPagesSetName404ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesSetName404ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesSetName404ResponseCode 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 DocPagesSetName404ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesSetName404ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Unknown = "Unknown"; + + public const string InvalidArg = "InvalidArg"; + + public const string DocNotOpen = "DocNotOpen"; + + public const string DocOpenFailed = "DocOpenFailed"; + + public const string DocPasswordRequired = "DocPasswordRequired"; + + public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + + public const string SharePasswordRequired = "SharePasswordRequired"; + + public const string Aborted = "Aborted"; + + public const string Network = "Network"; + + public const string Unauthenticated = "Unauthenticated"; + + public const string Forbidden = "Forbidden"; + + public const string NotFound = "NotFound"; + + public const string WireFormat = "WireFormat"; + + public const string RuntimeUnavailable = "RuntimeUnavailable"; + + public const string InvalidReference = "InvalidReference"; + + public const string WeakAnnotationSessionConflict = "WeakAnnotationSessionConflict"; + + public const string LayerVersionConflict = "LayerVersionConflict"; + + public const string NotImplemented = "NotImplemented"; + + public const string MalformedPdf = "MalformedPdf"; + } +} diff --git a/src/CloudPDF/Types/DocPagesSetName404ResponseName.cs b/src/CloudPDF/Types/DocPagesSetName404ResponseName.cs new file mode 100644 index 0000000..5718992 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesSetName404ResponseName.cs @@ -0,0 +1,112 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(DocPagesSetName404ResponseName.DocPagesSetName404ResponseNameSerializer))] +[Serializable] +public readonly record struct DocPagesSetName404ResponseName : IStringEnum +{ + public static readonly DocPagesSetName404ResponseName EngineError = new(Values.EngineError); + + public DocPagesSetName404ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesSetName404ResponseName FromCustom(string value) + { + return new DocPagesSetName404ResponseName(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 ==(DocPagesSetName404ResponseName value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesSetName404ResponseName value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesSetName404ResponseName value) => value.Value; + + public static explicit operator DocPagesSetName404ResponseName(string value) => new(value); + + internal class DocPagesSetName404ResponseNameSerializer + : JsonConverter + { + public override DocPagesSetName404ResponseName 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 DocPagesSetName404ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesSetName404ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesSetName404ResponseName 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 DocPagesSetName404ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesSetName404ResponseName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string EngineError = "EngineError"; + } +}