From 889b11ced80b33f93605b74e2c00cf0b5f636fa5 Mon Sep 17 00:00:00 2001 From: cloudpdf-sdk-bot Date: Thu, 27 Aug 2026 19:44:35 +0000 Subject: [PATCH] chore: generate CloudPDF .NET SDK 3.0.0-next.9 --- .fern/metadata.json | 6 +- cloudpdf-generation.json | 8 +- reference.md | 184 ++++++++ .../MockServer/Doc/Pages/InsertBlankTest.cs | 175 ++++++++ src/CloudPDF/CloudPDF.csproj | 2 +- src/CloudPDF/Core/Public/Version.cs | 2 +- src/CloudPDF/Doc/Pages/IPagesClient.cs | 27 ++ src/CloudPDF/Doc/Pages/PagesClient.cs | 417 ++++++++++++++++++ .../Doc/Pages/Requests/ExtractPagesRequest.cs | 29 ++ .../Pages/Requests/InsertBlankPagesRequest.cs | 29 ++ .../Doc/Pages/Requests/InsertPagesRequest.cs | 29 ++ .../Types/DocPagesExtract400Response.cs | 37 ++ .../Types/DocPagesExtract400ResponseCode.cs | 202 +++++++++ .../Types/DocPagesExtract400ResponseName.cs | 112 +++++ .../Types/DocPagesExtract404Response.cs | 37 ++ .../Types/DocPagesExtract404ResponseCode.cs | 202 +++++++++ .../Types/DocPagesExtract404ResponseName.cs | 112 +++++ .../Types/DocPagesInsert200Response.cs | 30 ++ .../Types/DocPagesInsert200ResponseMeta.cs | 32 ++ ...sInsert200ResponseMetaAffectedPagesItem.cs | 34 ++ ...00ResponseMetaAffectedPagesItemRevision.cs | 34 ++ ...etaAffectedPagesItemWeakAnnotationState.cs | 330 ++++++++++++++ ...fectedPagesItemWeakAnnotationStateKnown.cs | 29 ++ ...ctedPagesItemWeakAnnotationStateUnknown.cs | 26 ++ ...DocPagesInsert200ResponseMetaCacheDelta.cs | 35 ++ ...nsert200ResponseMetaCacheDeltaPagesItem.cs | 31 ++ ...200ResponseMetaCacheDeltaPagesItemCache.cs | 31 ++ .../Types/DocPagesInsert400Response.cs | 37 ++ .../Types/DocPagesInsert400ResponseCode.cs | 202 +++++++++ .../Types/DocPagesInsert400ResponseName.cs | 112 +++++ .../Types/DocPagesInsert404Response.cs | 37 ++ .../Types/DocPagesInsert404ResponseCode.cs | 202 +++++++++ .../Types/DocPagesInsert404ResponseName.cs | 112 +++++ .../Types/DocPagesInsertBlank200Response.cs | 30 ++ .../DocPagesInsertBlank200ResponseMeta.cs | 32 ++ ...rtBlank200ResponseMetaAffectedPagesItem.cs | 34 ++ ...00ResponseMetaAffectedPagesItemRevision.cs | 34 ++ ...etaAffectedPagesItemWeakAnnotationState.cs | 330 ++++++++++++++ ...fectedPagesItemWeakAnnotationStateKnown.cs | 29 ++ ...ctedPagesItemWeakAnnotationStateUnknown.cs | 26 ++ ...gesInsertBlank200ResponseMetaCacheDelta.cs | 35 ++ ...Blank200ResponseMetaCacheDeltaPagesItem.cs | 31 ++ ...200ResponseMetaCacheDeltaPagesItemCache.cs | 31 ++ .../Types/DocPagesInsertBlank400Response.cs | 37 ++ .../DocPagesInsertBlank400ResponseCode.cs | 208 +++++++++ .../DocPagesInsertBlank400ResponseName.cs | 114 +++++ .../Types/DocPagesInsertBlank404Response.cs | 37 ++ .../DocPagesInsertBlank404ResponseCode.cs | 208 +++++++++ .../DocPagesInsertBlank404ResponseName.cs | 114 +++++ 49 files changed, 4245 insertions(+), 9 deletions(-) create mode 100644 src/CloudPDF.Test/Unit/MockServer/Doc/Pages/InsertBlankTest.cs create mode 100644 src/CloudPDF/Doc/Pages/Requests/ExtractPagesRequest.cs create mode 100644 src/CloudPDF/Doc/Pages/Requests/InsertBlankPagesRequest.cs create mode 100644 src/CloudPDF/Doc/Pages/Requests/InsertPagesRequest.cs create mode 100644 src/CloudPDF/Types/DocPagesExtract400Response.cs create mode 100644 src/CloudPDF/Types/DocPagesExtract400ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocPagesExtract400ResponseName.cs create mode 100644 src/CloudPDF/Types/DocPagesExtract404Response.cs create mode 100644 src/CloudPDF/Types/DocPagesExtract404ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocPagesExtract404ResponseName.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert200Response.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert200ResponseMeta.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItem.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItemRevision.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert200ResponseMetaCacheDelta.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert200ResponseMetaCacheDeltaPagesItem.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert200ResponseMetaCacheDeltaPagesItemCache.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert400Response.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert400ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert400ResponseName.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert404Response.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert404ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocPagesInsert404ResponseName.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank200Response.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank200ResponseMeta.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItem.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItemRevision.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaCacheDelta.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaCacheDeltaPagesItem.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaCacheDeltaPagesItemCache.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank400Response.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank400ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank400ResponseName.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank404Response.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank404ResponseCode.cs create mode 100644 src/CloudPDF/Types/DocPagesInsertBlank404ResponseName.cs diff --git a/.fern/metadata.json b/.fern/metadata.json index 97bccad..24eedb9 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": "20cebe429411ef5019c9e31fc7841d72b7fb98a8", + "originGitCommit": "e5cd0731cb3a1f2ed5821f8d60191bd58934c3dd", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "3.0.0-next.8", + "requestedVersion": "3.0.0-next.9", "ciProvider": "github", - "sdkVersion": "3.0.0-next.8" + "sdkVersion": "3.0.0-next.9" } \ No newline at end of file diff --git a/cloudpdf-generation.json b/cloudpdf-generation.json index ba7ffb2..2fadc6f 100644 --- a/cloudpdf-generation.json +++ b/cloudpdf-generation.json @@ -1,12 +1,12 @@ { "language": "csharp", - "canonicalVersion": "3.0.0-next.8", - "sdkVersion": "3.0.0-next.8", + "canonicalVersion": "3.0.0-next.9", + "sdkVersion": "3.0.0-next.9", "source": { "repository": "embedpdf/embed-pdf-viewer", "openapi": "cloudpdf/contract/openapi.json", - "openapiSha256": "e997d51317662fe0666e6582916ded9b17a8bcd225c178548e1ff226e4d01c6d", - "gitCommit": "20cebe429411ef5019c9e31fc7841d72b7fb98a8", + "openapiSha256": "4ee27900dbb0b13408ce00a0e80d606444ab81e9d5a76186fa984c8c8dfe09fe", + "gitCommit": "e5cd0731cb3a1f2ed5821f8d60191bd58934c3dd", "gitCommitIsDirty": false }, "fern": { diff --git a/reference.md b/reference.md index 45b49fa..0159a9d 100644 --- a/reference.md +++ b/reference.md @@ -1920,6 +1920,73 @@ await client.Doc.Pages.DeleteAsync( + + + + +
client.Doc.Pages.ExtractAsync(ExtractPagesRequest { ... }) -> WithRawResponseTask<Stream> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +A read, not a mutation: the source document is untouched and no event is published. Body is `{"pageObjectNumbers": number[]}`; the response body is the new PDF. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Doc.Pages.ExtractAsync( + new ExtractPagesRequest + { + DocId = "docId", + LayerName = "layerName", + Body = new Dictionary() + { + { + "string", + new Dictionary() { { "key", "value" } } + }, + }, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ExtractPagesRequest` + +
+
+
+
+ +
@@ -1967,6 +2034,123 @@ await client.Doc.Pages.FlattenAsync( + + + + +
client.Doc.Pages.InsertAsync(InsertPagesRequest { ... }) -> WithRawResponseTask<DocPagesInsert200Response> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Multipart mutation envelope: a `body` field holding `{"destIndex"?: number}` (omitted → append) plus a `resource:source` file part carrying the standalone PDF whose pages are copied in. The inserted copies get fresh page object numbers, returned in insertion order. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Doc.Pages.InsertAsync( + new InsertPagesRequest { DocId = "docId", LayerName = "layerName" } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `InsertPagesRequest` + +
+
+
+
+ + +
+
+
+ +
client.Doc.Pages.InsertBlankAsync(InsertBlankPagesRequest { ... }) -> WithRawResponseTask<DocPagesInsertBlank200Response> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Body is `{"size": {"width", "height"}, "count"?, "destIndex"?}` — size in PDF points, count in [1, 100], destIndex omitted → append. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Doc.Pages.InsertBlankAsync( + new InsertBlankPagesRequest + { + DocId = "docId", + LayerName = "layerName", + Body = new Dictionary() { { "key", "value" } }, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `InsertBlankPagesRequest` + +
+
+
+
+ +
diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/InsertBlankTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/InsertBlankTest.cs new file mode 100644 index 0000000..91cc789 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/InsertBlankTest.cs @@ -0,0 +1,175 @@ +using CloudPDF.Doc; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Doc.Pages; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class InsertBlankTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string requestJson = """ + { + "string": { + "key": "value" + } + } + """; + + const string mockResponse = """ + { + "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, + "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/insert-blank") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Pages.InsertBlankAsync( + new InsertBlankPagesRequest + { + DocId = "docId", + LayerName = "layerName", + Body = new Dictionary() + { + { + "string", + new Dictionary() { { "key", "value" } } + }, + }, + } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string requestJson = """ + { + "key": "value" + } + """; + + const string mockResponse = """ + { + "meta": { + "affectedPages": [ + { + "pageObjectNumber": 1, + "revision": { + "docSessionId": "docSessionId", + "pageObjectNumber": 1, + "generation": 1 + }, + "weakAnnotationState": { + "kind": "unknown" + } + } + ], + "cacheDelta": { + "previousDocVersion": 1, + "docVersion": 1, + "pages": [ + { + "pageObjectNumber": 1, + "cache": { + "contentVersion": 1, + "annotationVersion": 1 + } + } + ] + } + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/pages/insert-blank") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.Pages.InsertBlankAsync( + new InsertBlankPagesRequest + { + DocId = "docId", + LayerName = "layerName", + Body = new Dictionary() { { "key", "value" } }, + } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF/CloudPDF.csproj b/src/CloudPDF/CloudPDF.csproj index 5781671..08da019 100644 --- a/src/CloudPDF/CloudPDF.csproj +++ b/src/CloudPDF/CloudPDF.csproj @@ -11,7 +11,7 @@ enable 12 enable - 3.0.0-next.8 + 3.0.0-next.9 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 8f40262..44fbbb3 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.8"; + public const string Current = "3.0.0-next.9"; } diff --git a/src/CloudPDF/Doc/Pages/IPagesClient.cs b/src/CloudPDF/Doc/Pages/IPagesClient.cs index 678ba13..d61a553 100644 --- a/src/CloudPDF/Doc/Pages/IPagesClient.cs +++ b/src/CloudPDF/Doc/Pages/IPagesClient.cs @@ -10,12 +10,39 @@ WithRawResponseTask DeleteAsync( CancellationToken cancellationToken = default ); + /// + /// A read, not a mutation: the source document is untouched and no event is published. Body is `{"pageObjectNumbers": number[]}`; the response body is the new PDF. + /// + WithRawResponseTask ExtractAsync( + ExtractPagesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + WithRawResponseTask FlattenAsync( FlattenPagesRequest request, RequestOptions? options = null, CancellationToken cancellationToken = default ); + /// + /// Multipart mutation envelope: a `body` field holding `{"destIndex"?: number}` (omitted → append) plus a `resource:source` file part carrying the standalone PDF whose pages are copied in. The inserted copies get fresh page object numbers, returned in insertion order. + /// + WithRawResponseTask InsertAsync( + InsertPagesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + /// + /// Body is `{"size": {"width", "height"}, "count"?, "destIndex"?}` — size in PDF points, count in [1, 100], destIndex omitted → append. + /// + WithRawResponseTask InsertBlankAsync( + InsertBlankPagesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + WithRawResponseTask MoveAsync( MovePagesRequest request, RequestOptions? options = null, diff --git a/src/CloudPDF/Doc/Pages/PagesClient.cs b/src/CloudPDF/Doc/Pages/PagesClient.cs index 7e8d30c..86eacbb 100644 --- a/src/CloudPDF/Doc/Pages/PagesClient.cs +++ b/src/CloudPDF/Doc/Pages/PagesClient.cs @@ -135,6 +135,107 @@ private async Task> DeleteAsyncCore( } } + private async Task> ExtractAsyncCore( + ExtractPagesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new CloudPDF.Core.QueryStringBuilder.Builder(capacity: 0) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new CloudPDF.Core.HeadersBuilder.Builder() + .Add("X-Document-Password", request.DocumentPassword) + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Post, + Path = string.Format( + "v1/docs/{0}/layers/{1}/pages/extract", + ValueConvert.ToPathParameterString(request.DocId), + ValueConvert.ToPathParameterString(request.LayerName) + ), + Body = request.Body, + QueryString = _queryString, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var stream = await response.Raw.Content.ReadAsStreamAsync(); + return new WithRawResponse() + { + Data = stream, + RawResponse = new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + private async Task> FlattenAsyncCore( FlattenPagesRequest request, RequestOptions? options = null, @@ -257,6 +358,249 @@ private async Task> FlattenAsyncCore } } + private async Task> InsertAsyncCore( + InsertPagesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new CloudPDF.Core.QueryStringBuilder.Builder(capacity: 0) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new CloudPDF.Core.HeadersBuilder.Builder() + .Add("X-Document-Password", request.DocumentPassword) + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var multipartFormRequest_ = new MultipartFormRequest + { + Method = HttpMethod.Post, + Path = string.Format( + "v1/docs/{0}/layers/{1}/pages/insert", + ValueConvert.ToPathParameterString(request.DocId), + ValueConvert.ToPathParameterString(request.LayerName) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }; + multipartFormRequest_.AddFileParameterPart("file", request.File); + var response = await _client + .SendRequestAsync(multipartFormRequest_, cancellationToken) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize(responseBody)!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new CloudPDFApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + private async Task> InsertBlankAsyncCore( + InsertBlankPagesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new CloudPDF.Core.QueryStringBuilder.Builder(capacity: 0) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new CloudPDF.Core.HeadersBuilder.Builder() + .Add("X-Document-Password", request.DocumentPassword) + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Post, + Path = string.Format( + "v1/docs/{0}/layers/{1}/pages/insert-blank", + ValueConvert.ToPathParameterString(request.DocId), + ValueConvert.ToPathParameterString(request.LayerName) + ), + Body = request.Body, + QueryString = _queryString, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new CloudPDFApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + private async Task> MoveAsyncCore( MovePagesRequest request, RequestOptions? options = null, @@ -522,6 +866,36 @@ public WithRawResponseTask DeleteAsync( ); } + /// + /// A read, not a mutation: the source document is untouched and no event is published. Body is `{"pageObjectNumbers": number[]}`; the response body is the new PDF. + /// + /// + /// await client.Doc.Pages.ExtractAsync( + /// new ExtractPagesRequest + /// { + /// DocId = "docId", + /// LayerName = "layerName", + /// Body = new Dictionary<string, object?>() + /// { + /// { + /// "string", + /// new Dictionary<object, object?>() { { "key", "value" } } + /// }, + /// }, + /// } + /// ); + /// + public WithRawResponseTask ExtractAsync( + ExtractPagesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ExtractAsyncCore(request, options, cancellationToken) + ); + } + /// /// await client.Doc.Pages.FlattenAsync( /// new FlattenPagesRequest @@ -543,6 +917,49 @@ public WithRawResponseTask FlattenAsync( ); } + /// + /// Multipart mutation envelope: a `body` field holding `{"destIndex"?: number}` (omitted → append) plus a `resource:source` file part carrying the standalone PDF whose pages are copied in. The inserted copies get fresh page object numbers, returned in insertion order. + /// + /// + /// await client.Doc.Pages.InsertAsync( + /// new InsertPagesRequest { DocId = "docId", LayerName = "layerName" } + /// ); + /// + public WithRawResponseTask InsertAsync( + InsertPagesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + InsertAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// Body is `{"size": {"width", "height"}, "count"?, "destIndex"?}` — size in PDF points, count in [1, 100], destIndex omitted → append. + /// + /// + /// await client.Doc.Pages.InsertBlankAsync( + /// new InsertBlankPagesRequest + /// { + /// DocId = "docId", + /// LayerName = "layerName", + /// Body = new Dictionary<string, object?>() { { "key", "value" } }, + /// } + /// ); + /// + public WithRawResponseTask InsertBlankAsync( + InsertBlankPagesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + InsertBlankAsyncCore(request, options, cancellationToken) + ); + } + /// /// await client.Doc.Pages.MoveAsync( /// new MovePagesRequest diff --git a/src/CloudPDF/Doc/Pages/Requests/ExtractPagesRequest.cs b/src/CloudPDF/Doc/Pages/Requests/ExtractPagesRequest.cs new file mode 100644 index 0000000..00ea46a --- /dev/null +++ b/src/CloudPDF/Doc/Pages/Requests/ExtractPagesRequest.cs @@ -0,0 +1,29 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Doc; + +[Serializable] +public record ExtractPagesRequest +{ + [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/InsertBlankPagesRequest.cs b/src/CloudPDF/Doc/Pages/Requests/InsertBlankPagesRequest.cs new file mode 100644 index 0000000..3ee7127 --- /dev/null +++ b/src/CloudPDF/Doc/Pages/Requests/InsertBlankPagesRequest.cs @@ -0,0 +1,29 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Doc; + +[Serializable] +public record InsertBlankPagesRequest +{ + [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/InsertPagesRequest.cs b/src/CloudPDF/Doc/Pages/Requests/InsertPagesRequest.cs new file mode 100644 index 0000000..6498fa4 --- /dev/null +++ b/src/CloudPDF/Doc/Pages/Requests/InsertPagesRequest.cs @@ -0,0 +1,29 @@ +using CloudPDF; +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Doc; + +[Serializable] +public record InsertPagesRequest +{ + [JsonIgnore] + public required string DocId { get; set; } + + [JsonIgnore] + public required string LayerName { get; set; } + + /// + /// Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead. + /// + [JsonIgnore] + public string? DocumentPassword { get; set; } + + public required FileParameter File { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/DocPagesExtract400Response.cs b/src/CloudPDF/Types/DocPagesExtract400Response.cs new file mode 100644 index 0000000..f741a31 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesExtract400Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesExtract400Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocPagesExtract400ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocPagesExtract400ResponseCode 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/DocPagesExtract400ResponseCode.cs b/src/CloudPDF/Types/DocPagesExtract400ResponseCode.cs new file mode 100644 index 0000000..e2dcabf --- /dev/null +++ b/src/CloudPDF/Types/DocPagesExtract400ResponseCode.cs @@ -0,0 +1,202 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(DocPagesExtract400ResponseCode.DocPagesExtract400ResponseCodeSerializer))] +[Serializable] +public readonly record struct DocPagesExtract400ResponseCode : IStringEnum +{ + public static readonly DocPagesExtract400ResponseCode Unknown = new(Values.Unknown); + + public static readonly DocPagesExtract400ResponseCode InvalidArg = new(Values.InvalidArg); + + public static readonly DocPagesExtract400ResponseCode DocNotOpen = new(Values.DocNotOpen); + + public static readonly DocPagesExtract400ResponseCode DocOpenFailed = new(Values.DocOpenFailed); + + public static readonly DocPagesExtract400ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocPagesExtract400ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocPagesExtract400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + + public static readonly DocPagesExtract400ResponseCode Aborted = new(Values.Aborted); + + public static readonly DocPagesExtract400ResponseCode Network = new(Values.Network); + + public static readonly DocPagesExtract400ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocPagesExtract400ResponseCode Forbidden = new(Values.Forbidden); + + public static readonly DocPagesExtract400ResponseCode NotFound = new(Values.NotFound); + + public static readonly DocPagesExtract400ResponseCode WireFormat = new(Values.WireFormat); + + public static readonly DocPagesExtract400ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocPagesExtract400ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocPagesExtract400ResponseCode WeakAnnotationSessionConflict = new( + Values.WeakAnnotationSessionConflict + ); + + public static readonly DocPagesExtract400ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocPagesExtract400ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocPagesExtract400ResponseCode MalformedPdf = new(Values.MalformedPdf); + + public DocPagesExtract400ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesExtract400ResponseCode FromCustom(string value) + { + return new DocPagesExtract400ResponseCode(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 ==(DocPagesExtract400ResponseCode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesExtract400ResponseCode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesExtract400ResponseCode value) => value.Value; + + public static explicit operator DocPagesExtract400ResponseCode(string value) => new(value); + + internal class DocPagesExtract400ResponseCodeSerializer + : JsonConverter + { + public override DocPagesExtract400ResponseCode 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 DocPagesExtract400ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesExtract400ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesExtract400ResponseCode 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 DocPagesExtract400ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesExtract400ResponseCode 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/DocPagesExtract400ResponseName.cs b/src/CloudPDF/Types/DocPagesExtract400ResponseName.cs new file mode 100644 index 0000000..068e7fa --- /dev/null +++ b/src/CloudPDF/Types/DocPagesExtract400ResponseName.cs @@ -0,0 +1,112 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(DocPagesExtract400ResponseName.DocPagesExtract400ResponseNameSerializer))] +[Serializable] +public readonly record struct DocPagesExtract400ResponseName : IStringEnum +{ + public static readonly DocPagesExtract400ResponseName EngineError = new(Values.EngineError); + + public DocPagesExtract400ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesExtract400ResponseName FromCustom(string value) + { + return new DocPagesExtract400ResponseName(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 ==(DocPagesExtract400ResponseName value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesExtract400ResponseName value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesExtract400ResponseName value) => value.Value; + + public static explicit operator DocPagesExtract400ResponseName(string value) => new(value); + + internal class DocPagesExtract400ResponseNameSerializer + : JsonConverter + { + public override DocPagesExtract400ResponseName 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 DocPagesExtract400ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesExtract400ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesExtract400ResponseName 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 DocPagesExtract400ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesExtract400ResponseName 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/DocPagesExtract404Response.cs b/src/CloudPDF/Types/DocPagesExtract404Response.cs new file mode 100644 index 0000000..7527d9a --- /dev/null +++ b/src/CloudPDF/Types/DocPagesExtract404Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesExtract404Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocPagesExtract404ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocPagesExtract404ResponseCode 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/DocPagesExtract404ResponseCode.cs b/src/CloudPDF/Types/DocPagesExtract404ResponseCode.cs new file mode 100644 index 0000000..2d92d4f --- /dev/null +++ b/src/CloudPDF/Types/DocPagesExtract404ResponseCode.cs @@ -0,0 +1,202 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(DocPagesExtract404ResponseCode.DocPagesExtract404ResponseCodeSerializer))] +[Serializable] +public readonly record struct DocPagesExtract404ResponseCode : IStringEnum +{ + public static readonly DocPagesExtract404ResponseCode Unknown = new(Values.Unknown); + + public static readonly DocPagesExtract404ResponseCode InvalidArg = new(Values.InvalidArg); + + public static readonly DocPagesExtract404ResponseCode DocNotOpen = new(Values.DocNotOpen); + + public static readonly DocPagesExtract404ResponseCode DocOpenFailed = new(Values.DocOpenFailed); + + public static readonly DocPagesExtract404ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocPagesExtract404ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocPagesExtract404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + + public static readonly DocPagesExtract404ResponseCode Aborted = new(Values.Aborted); + + public static readonly DocPagesExtract404ResponseCode Network = new(Values.Network); + + public static readonly DocPagesExtract404ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocPagesExtract404ResponseCode Forbidden = new(Values.Forbidden); + + public static readonly DocPagesExtract404ResponseCode NotFound = new(Values.NotFound); + + public static readonly DocPagesExtract404ResponseCode WireFormat = new(Values.WireFormat); + + public static readonly DocPagesExtract404ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocPagesExtract404ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocPagesExtract404ResponseCode WeakAnnotationSessionConflict = new( + Values.WeakAnnotationSessionConflict + ); + + public static readonly DocPagesExtract404ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocPagesExtract404ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocPagesExtract404ResponseCode MalformedPdf = new(Values.MalformedPdf); + + public DocPagesExtract404ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesExtract404ResponseCode FromCustom(string value) + { + return new DocPagesExtract404ResponseCode(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 ==(DocPagesExtract404ResponseCode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesExtract404ResponseCode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesExtract404ResponseCode value) => value.Value; + + public static explicit operator DocPagesExtract404ResponseCode(string value) => new(value); + + internal class DocPagesExtract404ResponseCodeSerializer + : JsonConverter + { + public override DocPagesExtract404ResponseCode 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 DocPagesExtract404ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesExtract404ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesExtract404ResponseCode 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 DocPagesExtract404ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesExtract404ResponseCode 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/DocPagesExtract404ResponseName.cs b/src/CloudPDF/Types/DocPagesExtract404ResponseName.cs new file mode 100644 index 0000000..809275f --- /dev/null +++ b/src/CloudPDF/Types/DocPagesExtract404ResponseName.cs @@ -0,0 +1,112 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(DocPagesExtract404ResponseName.DocPagesExtract404ResponseNameSerializer))] +[Serializable] +public readonly record struct DocPagesExtract404ResponseName : IStringEnum +{ + public static readonly DocPagesExtract404ResponseName EngineError = new(Values.EngineError); + + public DocPagesExtract404ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesExtract404ResponseName FromCustom(string value) + { + return new DocPagesExtract404ResponseName(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 ==(DocPagesExtract404ResponseName value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesExtract404ResponseName value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesExtract404ResponseName value) => value.Value; + + public static explicit operator DocPagesExtract404ResponseName(string value) => new(value); + + internal class DocPagesExtract404ResponseNameSerializer + : JsonConverter + { + public override DocPagesExtract404ResponseName 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 DocPagesExtract404ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesExtract404ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesExtract404ResponseName 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 DocPagesExtract404ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesExtract404ResponseName 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/DocPagesInsert200Response.cs b/src/CloudPDF/Types/DocPagesInsert200Response.cs new file mode 100644 index 0000000..976d89f --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert200Response.cs @@ -0,0 +1,30 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsert200Response : IJsonOnDeserialized, IJsonOnSerializing +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("meta")] + public required DocPagesInsert200ResponseMeta 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/DocPagesInsert200ResponseMeta.cs b/src/CloudPDF/Types/DocPagesInsert200ResponseMeta.cs new file mode 100644 index 0000000..d06db6c --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert200ResponseMeta.cs @@ -0,0 +1,32 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsert200ResponseMeta : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("affectedPages")] + public IEnumerable AffectedPages { get; set; } = + new List(); + + [JsonPropertyName("cacheDelta")] + public DocPagesInsert200ResponseMetaCacheDelta? 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/DocPagesInsert200ResponseMetaAffectedPagesItem.cs b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItem.cs new file mode 100644 index 0000000..10bbaee --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItem.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsert200ResponseMetaAffectedPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pageObjectNumber")] + public required int PageObjectNumber { get; set; } + + [JsonPropertyName("revision")] + public required DocPagesInsert200ResponseMetaAffectedPagesItemRevision Revision { get; set; } + + [JsonPropertyName("weakAnnotationState")] + public required DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState 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/DocPagesInsert200ResponseMetaAffectedPagesItemRevision.cs b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItemRevision.cs new file mode 100644 index 0000000..8988d94 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItemRevision.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsert200ResponseMetaAffectedPagesItemRevision : 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/DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState.cs b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState.cs new file mode 100644 index 0000000..c144186 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState.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(DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState.JsonConverter) +)] +[Serializable] +public record DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState +{ + internal DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState( + string type, + object? value + ) + { + Kind = type; + Value = value; + } + + /// + /// Create an instance of DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState with . + /// + public DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown value + ) + { + Kind = "unknown"; + Value = value.Value; + } + + /// + /// Create an instance of DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState with . + /// + public DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState.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.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown AsUnknown() => + IsUnknown + ? (CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown) + Value! + : throw new global::System.Exception( + "DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState.Kind is not 'unknown'" + ); + + /// + /// Returns the value as a if is 'known', otherwise throws an exception. + /// + /// Thrown when is not 'known'. + public CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown AsKnown() => + IsKnown + ? (CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown) + Value! + : throw new global::System.Exception( + "DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState.Kind is not 'known'" + ); + + public T Match( + Func< + CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown, + T + > onUnknown, + Func< + CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown, + 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.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown? value + ) + { + if (Kind == "unknown") + { + value = + (CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown) + Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsKnown( + out CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown? value + ) + { + if (Kind == "known") + { + value = + (CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown) + Value!; + return true; + } + value = null; + return false; + } + + public override string ToString() => JsonUtils.Serialize(this); + + public static implicit operator DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown value + ) => new(value); + + public static implicit operator DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState.Known value + ) => new(value); + + [Serializable] + internal sealed class JsonConverter + : JsonConverter + { + public override bool CanConvert(global::System.Type typeToConvert) => + typeof(DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState).IsAssignableFrom( + typeToConvert + ); + + public override DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState 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.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown" + ), + "known" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown" + ), + _ => json.Deserialize(options), + }; + return new DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState( + discriminator, + value + ); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState 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 DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState 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 DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState( + stringValue, + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Kind); + } + } + + /// + /// Discriminated union type for unknown + /// + [Serializable] + public struct Unknown + { + public Unknown( + CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown value + ) + { + Value = value; + } + + internal CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown( + CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown value + ) => new(value); + } + + /// + /// Discriminated union type for known + /// + [Serializable] + public struct Known + { + public Known( + CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown value + ) + { + Value = value; + } + + internal CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationState.Known( + CloudPDF.DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown value + ) => new(value); + } +} diff --git a/src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs new file mode 100644 index 0000000..e22ac3e --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs @@ -0,0 +1,29 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown + : 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/DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs new file mode 100644 index 0000000..a49b3a2 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs @@ -0,0 +1,26 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsert200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown + : 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/DocPagesInsert200ResponseMetaCacheDelta.cs b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaCacheDelta.cs new file mode 100644 index 0000000..d74d156 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaCacheDelta.cs @@ -0,0 +1,35 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsert200ResponseMetaCacheDelta : 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("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/DocPagesInsert200ResponseMetaCacheDeltaPagesItem.cs b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaCacheDeltaPagesItem.cs new file mode 100644 index 0000000..9db8e48 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaCacheDeltaPagesItem.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsert200ResponseMetaCacheDeltaPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pageObjectNumber")] + public required int PageObjectNumber { get; set; } + + [JsonPropertyName("cache")] + public required DocPagesInsert200ResponseMetaCacheDeltaPagesItemCache 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/DocPagesInsert200ResponseMetaCacheDeltaPagesItemCache.cs b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaCacheDeltaPagesItemCache.cs new file mode 100644 index 0000000..ff77c3e --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert200ResponseMetaCacheDeltaPagesItemCache.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsert200ResponseMetaCacheDeltaPagesItemCache : 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/DocPagesInsert400Response.cs b/src/CloudPDF/Types/DocPagesInsert400Response.cs new file mode 100644 index 0000000..2982527 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert400Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsert400Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocPagesInsert400ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocPagesInsert400ResponseCode 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/DocPagesInsert400ResponseCode.cs b/src/CloudPDF/Types/DocPagesInsert400ResponseCode.cs new file mode 100644 index 0000000..f23800d --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert400ResponseCode.cs @@ -0,0 +1,202 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(DocPagesInsert400ResponseCode.DocPagesInsert400ResponseCodeSerializer))] +[Serializable] +public readonly record struct DocPagesInsert400ResponseCode : IStringEnum +{ + public static readonly DocPagesInsert400ResponseCode Unknown = new(Values.Unknown); + + public static readonly DocPagesInsert400ResponseCode InvalidArg = new(Values.InvalidArg); + + public static readonly DocPagesInsert400ResponseCode DocNotOpen = new(Values.DocNotOpen); + + public static readonly DocPagesInsert400ResponseCode DocOpenFailed = new(Values.DocOpenFailed); + + public static readonly DocPagesInsert400ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocPagesInsert400ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocPagesInsert400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + + public static readonly DocPagesInsert400ResponseCode Aborted = new(Values.Aborted); + + public static readonly DocPagesInsert400ResponseCode Network = new(Values.Network); + + public static readonly DocPagesInsert400ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocPagesInsert400ResponseCode Forbidden = new(Values.Forbidden); + + public static readonly DocPagesInsert400ResponseCode NotFound = new(Values.NotFound); + + public static readonly DocPagesInsert400ResponseCode WireFormat = new(Values.WireFormat); + + public static readonly DocPagesInsert400ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocPagesInsert400ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocPagesInsert400ResponseCode WeakAnnotationSessionConflict = new( + Values.WeakAnnotationSessionConflict + ); + + public static readonly DocPagesInsert400ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocPagesInsert400ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocPagesInsert400ResponseCode MalformedPdf = new(Values.MalformedPdf); + + public DocPagesInsert400ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesInsert400ResponseCode FromCustom(string value) + { + return new DocPagesInsert400ResponseCode(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 ==(DocPagesInsert400ResponseCode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesInsert400ResponseCode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesInsert400ResponseCode value) => value.Value; + + public static explicit operator DocPagesInsert400ResponseCode(string value) => new(value); + + internal class DocPagesInsert400ResponseCodeSerializer + : JsonConverter + { + public override DocPagesInsert400ResponseCode 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 DocPagesInsert400ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesInsert400ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesInsert400ResponseCode 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 DocPagesInsert400ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesInsert400ResponseCode 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/DocPagesInsert400ResponseName.cs b/src/CloudPDF/Types/DocPagesInsert400ResponseName.cs new file mode 100644 index 0000000..4d9eabc --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert400ResponseName.cs @@ -0,0 +1,112 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(DocPagesInsert400ResponseName.DocPagesInsert400ResponseNameSerializer))] +[Serializable] +public readonly record struct DocPagesInsert400ResponseName : IStringEnum +{ + public static readonly DocPagesInsert400ResponseName EngineError = new(Values.EngineError); + + public DocPagesInsert400ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesInsert400ResponseName FromCustom(string value) + { + return new DocPagesInsert400ResponseName(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 ==(DocPagesInsert400ResponseName value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesInsert400ResponseName value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesInsert400ResponseName value) => value.Value; + + public static explicit operator DocPagesInsert400ResponseName(string value) => new(value); + + internal class DocPagesInsert400ResponseNameSerializer + : JsonConverter + { + public override DocPagesInsert400ResponseName 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 DocPagesInsert400ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesInsert400ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesInsert400ResponseName 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 DocPagesInsert400ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesInsert400ResponseName 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/DocPagesInsert404Response.cs b/src/CloudPDF/Types/DocPagesInsert404Response.cs new file mode 100644 index 0000000..42a6b88 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert404Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsert404Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocPagesInsert404ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocPagesInsert404ResponseCode 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/DocPagesInsert404ResponseCode.cs b/src/CloudPDF/Types/DocPagesInsert404ResponseCode.cs new file mode 100644 index 0000000..01ba2c6 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert404ResponseCode.cs @@ -0,0 +1,202 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(DocPagesInsert404ResponseCode.DocPagesInsert404ResponseCodeSerializer))] +[Serializable] +public readonly record struct DocPagesInsert404ResponseCode : IStringEnum +{ + public static readonly DocPagesInsert404ResponseCode Unknown = new(Values.Unknown); + + public static readonly DocPagesInsert404ResponseCode InvalidArg = new(Values.InvalidArg); + + public static readonly DocPagesInsert404ResponseCode DocNotOpen = new(Values.DocNotOpen); + + public static readonly DocPagesInsert404ResponseCode DocOpenFailed = new(Values.DocOpenFailed); + + public static readonly DocPagesInsert404ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocPagesInsert404ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocPagesInsert404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + + public static readonly DocPagesInsert404ResponseCode Aborted = new(Values.Aborted); + + public static readonly DocPagesInsert404ResponseCode Network = new(Values.Network); + + public static readonly DocPagesInsert404ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocPagesInsert404ResponseCode Forbidden = new(Values.Forbidden); + + public static readonly DocPagesInsert404ResponseCode NotFound = new(Values.NotFound); + + public static readonly DocPagesInsert404ResponseCode WireFormat = new(Values.WireFormat); + + public static readonly DocPagesInsert404ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocPagesInsert404ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocPagesInsert404ResponseCode WeakAnnotationSessionConflict = new( + Values.WeakAnnotationSessionConflict + ); + + public static readonly DocPagesInsert404ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocPagesInsert404ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocPagesInsert404ResponseCode MalformedPdf = new(Values.MalformedPdf); + + public DocPagesInsert404ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesInsert404ResponseCode FromCustom(string value) + { + return new DocPagesInsert404ResponseCode(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 ==(DocPagesInsert404ResponseCode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesInsert404ResponseCode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesInsert404ResponseCode value) => value.Value; + + public static explicit operator DocPagesInsert404ResponseCode(string value) => new(value); + + internal class DocPagesInsert404ResponseCodeSerializer + : JsonConverter + { + public override DocPagesInsert404ResponseCode 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 DocPagesInsert404ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesInsert404ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesInsert404ResponseCode 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 DocPagesInsert404ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesInsert404ResponseCode 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/DocPagesInsert404ResponseName.cs b/src/CloudPDF/Types/DocPagesInsert404ResponseName.cs new file mode 100644 index 0000000..1d2859f --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsert404ResponseName.cs @@ -0,0 +1,112 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(DocPagesInsert404ResponseName.DocPagesInsert404ResponseNameSerializer))] +[Serializable] +public readonly record struct DocPagesInsert404ResponseName : IStringEnum +{ + public static readonly DocPagesInsert404ResponseName EngineError = new(Values.EngineError); + + public DocPagesInsert404ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesInsert404ResponseName FromCustom(string value) + { + return new DocPagesInsert404ResponseName(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 ==(DocPagesInsert404ResponseName value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesInsert404ResponseName value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesInsert404ResponseName value) => value.Value; + + public static explicit operator DocPagesInsert404ResponseName(string value) => new(value); + + internal class DocPagesInsert404ResponseNameSerializer + : JsonConverter + { + public override DocPagesInsert404ResponseName 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 DocPagesInsert404ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesInsert404ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesInsert404ResponseName 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 DocPagesInsert404ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesInsert404ResponseName 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/DocPagesInsertBlank200Response.cs b/src/CloudPDF/Types/DocPagesInsertBlank200Response.cs new file mode 100644 index 0000000..494140c --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank200Response.cs @@ -0,0 +1,30 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsertBlank200Response : IJsonOnDeserialized, IJsonOnSerializing +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("meta")] + public required DocPagesInsertBlank200ResponseMeta 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/DocPagesInsertBlank200ResponseMeta.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMeta.cs new file mode 100644 index 0000000..3fd0f7c --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMeta.cs @@ -0,0 +1,32 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsertBlank200ResponseMeta : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("affectedPages")] + public IEnumerable AffectedPages { get; set; } = + new List(); + + [JsonPropertyName("cacheDelta")] + public DocPagesInsertBlank200ResponseMetaCacheDelta? 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/DocPagesInsertBlank200ResponseMetaAffectedPagesItem.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItem.cs new file mode 100644 index 0000000..5d84708 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItem.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsertBlank200ResponseMetaAffectedPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pageObjectNumber")] + public required int PageObjectNumber { get; set; } + + [JsonPropertyName("revision")] + public required DocPagesInsertBlank200ResponseMetaAffectedPagesItemRevision Revision { get; set; } + + [JsonPropertyName("weakAnnotationState")] + public required DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState 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/DocPagesInsertBlank200ResponseMetaAffectedPagesItemRevision.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItemRevision.cs new file mode 100644 index 0000000..f883056 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItemRevision.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsertBlank200ResponseMetaAffectedPagesItemRevision : 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/DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState.cs new file mode 100644 index 0000000..7f4e83e --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState.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(DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState.JsonConverter) +)] +[Serializable] +public record DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState +{ + internal DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState( + string type, + object? value + ) + { + Kind = type; + Value = value; + } + + /// + /// Create an instance of DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState with . + /// + public DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown value + ) + { + Kind = "unknown"; + Value = value.Value; + } + + /// + /// Create an instance of DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState with . + /// + public DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState.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.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown AsUnknown() => + IsUnknown + ? (CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown) + Value! + : throw new global::System.Exception( + "DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState.Kind is not 'unknown'" + ); + + /// + /// Returns the value as a if is 'known', otherwise throws an exception. + /// + /// Thrown when is not 'known'. + public CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown AsKnown() => + IsKnown + ? (CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown) + Value! + : throw new global::System.Exception( + "DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState.Kind is not 'known'" + ); + + public T Match( + Func< + CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown, + T + > onUnknown, + Func< + CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown, + 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.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown? value + ) + { + if (Kind == "unknown") + { + value = + (CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown) + Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryAsKnown( + out CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown? value + ) + { + if (Kind == "known") + { + value = + (CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown) + Value!; + return true; + } + value = null; + return false; + } + + public override string ToString() => JsonUtils.Serialize(this); + + public static implicit operator DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown value + ) => new(value); + + public static implicit operator DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState( + DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState.Known value + ) => new(value); + + [Serializable] + internal sealed class JsonConverter + : JsonConverter + { + public override bool CanConvert(global::System.Type typeToConvert) => + typeof(DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState).IsAssignableFrom( + typeToConvert + ); + + public override DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState 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.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown" + ), + "known" => + jsonWithoutDiscriminator.Deserialize( + options + ) + ?? throw new JsonException( + "Failed to deserialize CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown" + ), + _ => json.Deserialize(options), + }; + return new DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState( + discriminator, + value + ); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState 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 DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState 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 DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState( + stringValue, + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Kind); + } + } + + /// + /// Discriminated union type for unknown + /// + [Serializable] + public struct Unknown + { + public Unknown( + CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown value + ) + { + Value = value; + } + + internal CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState.Unknown( + CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown value + ) => new(value); + } + + /// + /// Discriminated union type for known + /// + [Serializable] + public struct Known + { + public Known( + CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown value + ) + { + Value = value; + } + + internal CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown Value { get; set; } + + public override string ToString() => Value.ToString() ?? "null"; + + public static implicit operator DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationState.Known( + CloudPDF.DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown value + ) => new(value); + } +} diff --git a/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs new file mode 100644 index 0000000..3cc6417 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown.cs @@ -0,0 +1,29 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateKnown + : 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/DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs new file mode 100644 index 0000000..b088fdd --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown.cs @@ -0,0 +1,26 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsertBlank200ResponseMetaAffectedPagesItemWeakAnnotationStateUnknown + : 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/DocPagesInsertBlank200ResponseMetaCacheDelta.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaCacheDelta.cs new file mode 100644 index 0000000..b7da230 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaCacheDelta.cs @@ -0,0 +1,35 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsertBlank200ResponseMetaCacheDelta : 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("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/DocPagesInsertBlank200ResponseMetaCacheDeltaPagesItem.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaCacheDeltaPagesItem.cs new file mode 100644 index 0000000..917ae5b --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaCacheDeltaPagesItem.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsertBlank200ResponseMetaCacheDeltaPagesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pageObjectNumber")] + public required int PageObjectNumber { get; set; } + + [JsonPropertyName("cache")] + public required DocPagesInsertBlank200ResponseMetaCacheDeltaPagesItemCache 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/DocPagesInsertBlank200ResponseMetaCacheDeltaPagesItemCache.cs b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaCacheDeltaPagesItemCache.cs new file mode 100644 index 0000000..d1aa55f --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank200ResponseMetaCacheDeltaPagesItemCache.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsertBlank200ResponseMetaCacheDeltaPagesItemCache : 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/DocPagesInsertBlank400Response.cs b/src/CloudPDF/Types/DocPagesInsertBlank400Response.cs new file mode 100644 index 0000000..8097014 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank400Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsertBlank400Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocPagesInsertBlank400ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocPagesInsertBlank400ResponseCode 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/DocPagesInsertBlank400ResponseCode.cs b/src/CloudPDF/Types/DocPagesInsertBlank400ResponseCode.cs new file mode 100644 index 0000000..731fee8 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank400ResponseCode.cs @@ -0,0 +1,208 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocPagesInsertBlank400ResponseCode.DocPagesInsertBlank400ResponseCodeSerializer) +)] +[Serializable] +public readonly record struct DocPagesInsertBlank400ResponseCode : IStringEnum +{ + public static readonly DocPagesInsertBlank400ResponseCode Unknown = new(Values.Unknown); + + public static readonly DocPagesInsertBlank400ResponseCode InvalidArg = new(Values.InvalidArg); + + public static readonly DocPagesInsertBlank400ResponseCode DocNotOpen = new(Values.DocNotOpen); + + public static readonly DocPagesInsertBlank400ResponseCode DocOpenFailed = new( + Values.DocOpenFailed + ); + + public static readonly DocPagesInsertBlank400ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocPagesInsertBlank400ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocPagesInsertBlank400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + + public static readonly DocPagesInsertBlank400ResponseCode Aborted = new(Values.Aborted); + + public static readonly DocPagesInsertBlank400ResponseCode Network = new(Values.Network); + + public static readonly DocPagesInsertBlank400ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocPagesInsertBlank400ResponseCode Forbidden = new(Values.Forbidden); + + public static readonly DocPagesInsertBlank400ResponseCode NotFound = new(Values.NotFound); + + public static readonly DocPagesInsertBlank400ResponseCode WireFormat = new(Values.WireFormat); + + public static readonly DocPagesInsertBlank400ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocPagesInsertBlank400ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocPagesInsertBlank400ResponseCode WeakAnnotationSessionConflict = new( + Values.WeakAnnotationSessionConflict + ); + + public static readonly DocPagesInsertBlank400ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocPagesInsertBlank400ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocPagesInsertBlank400ResponseCode MalformedPdf = new( + Values.MalformedPdf + ); + + public DocPagesInsertBlank400ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesInsertBlank400ResponseCode FromCustom(string value) + { + return new DocPagesInsertBlank400ResponseCode(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 ==(DocPagesInsertBlank400ResponseCode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesInsertBlank400ResponseCode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesInsertBlank400ResponseCode value) => value.Value; + + public static explicit operator DocPagesInsertBlank400ResponseCode(string value) => new(value); + + internal class DocPagesInsertBlank400ResponseCodeSerializer + : JsonConverter + { + public override DocPagesInsertBlank400ResponseCode 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 DocPagesInsertBlank400ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesInsertBlank400ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesInsertBlank400ResponseCode 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 DocPagesInsertBlank400ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesInsertBlank400ResponseCode 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/DocPagesInsertBlank400ResponseName.cs b/src/CloudPDF/Types/DocPagesInsertBlank400ResponseName.cs new file mode 100644 index 0000000..ad2a7b8 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank400ResponseName.cs @@ -0,0 +1,114 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocPagesInsertBlank400ResponseName.DocPagesInsertBlank400ResponseNameSerializer) +)] +[Serializable] +public readonly record struct DocPagesInsertBlank400ResponseName : IStringEnum +{ + public static readonly DocPagesInsertBlank400ResponseName EngineError = new(Values.EngineError); + + public DocPagesInsertBlank400ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesInsertBlank400ResponseName FromCustom(string value) + { + return new DocPagesInsertBlank400ResponseName(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 ==(DocPagesInsertBlank400ResponseName value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesInsertBlank400ResponseName value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesInsertBlank400ResponseName value) => value.Value; + + public static explicit operator DocPagesInsertBlank400ResponseName(string value) => new(value); + + internal class DocPagesInsertBlank400ResponseNameSerializer + : JsonConverter + { + public override DocPagesInsertBlank400ResponseName 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 DocPagesInsertBlank400ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesInsertBlank400ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesInsertBlank400ResponseName 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 DocPagesInsertBlank400ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesInsertBlank400ResponseName 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/DocPagesInsertBlank404Response.cs b/src/CloudPDF/Types/DocPagesInsertBlank404Response.cs new file mode 100644 index 0000000..020a05a --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank404Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocPagesInsertBlank404Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("name")] + public required DocPagesInsertBlank404ResponseName Name { get; set; } + + [JsonPropertyName("code")] + public required DocPagesInsertBlank404ResponseCode 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/DocPagesInsertBlank404ResponseCode.cs b/src/CloudPDF/Types/DocPagesInsertBlank404ResponseCode.cs new file mode 100644 index 0000000..ac40dc5 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank404ResponseCode.cs @@ -0,0 +1,208 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocPagesInsertBlank404ResponseCode.DocPagesInsertBlank404ResponseCodeSerializer) +)] +[Serializable] +public readonly record struct DocPagesInsertBlank404ResponseCode : IStringEnum +{ + public static readonly DocPagesInsertBlank404ResponseCode Unknown = new(Values.Unknown); + + public static readonly DocPagesInsertBlank404ResponseCode InvalidArg = new(Values.InvalidArg); + + public static readonly DocPagesInsertBlank404ResponseCode DocNotOpen = new(Values.DocNotOpen); + + public static readonly DocPagesInsertBlank404ResponseCode DocOpenFailed = new( + Values.DocOpenFailed + ); + + public static readonly DocPagesInsertBlank404ResponseCode DocPasswordRequired = new( + Values.DocPasswordRequired + ); + + public static readonly DocPagesInsertBlank404ResponseCode DocPasswordIncorrect = new( + Values.DocPasswordIncorrect + ); + + public static readonly DocPagesInsertBlank404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + + public static readonly DocPagesInsertBlank404ResponseCode Aborted = new(Values.Aborted); + + public static readonly DocPagesInsertBlank404ResponseCode Network = new(Values.Network); + + public static readonly DocPagesInsertBlank404ResponseCode Unauthenticated = new( + Values.Unauthenticated + ); + + public static readonly DocPagesInsertBlank404ResponseCode Forbidden = new(Values.Forbidden); + + public static readonly DocPagesInsertBlank404ResponseCode NotFound = new(Values.NotFound); + + public static readonly DocPagesInsertBlank404ResponseCode WireFormat = new(Values.WireFormat); + + public static readonly DocPagesInsertBlank404ResponseCode RuntimeUnavailable = new( + Values.RuntimeUnavailable + ); + + public static readonly DocPagesInsertBlank404ResponseCode InvalidReference = new( + Values.InvalidReference + ); + + public static readonly DocPagesInsertBlank404ResponseCode WeakAnnotationSessionConflict = new( + Values.WeakAnnotationSessionConflict + ); + + public static readonly DocPagesInsertBlank404ResponseCode LayerVersionConflict = new( + Values.LayerVersionConflict + ); + + public static readonly DocPagesInsertBlank404ResponseCode NotImplemented = new( + Values.NotImplemented + ); + + public static readonly DocPagesInsertBlank404ResponseCode MalformedPdf = new( + Values.MalformedPdf + ); + + public DocPagesInsertBlank404ResponseCode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesInsertBlank404ResponseCode FromCustom(string value) + { + return new DocPagesInsertBlank404ResponseCode(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 ==(DocPagesInsertBlank404ResponseCode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesInsertBlank404ResponseCode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesInsertBlank404ResponseCode value) => value.Value; + + public static explicit operator DocPagesInsertBlank404ResponseCode(string value) => new(value); + + internal class DocPagesInsertBlank404ResponseCodeSerializer + : JsonConverter + { + public override DocPagesInsertBlank404ResponseCode 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 DocPagesInsertBlank404ResponseCode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesInsertBlank404ResponseCode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesInsertBlank404ResponseCode 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 DocPagesInsertBlank404ResponseCode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesInsertBlank404ResponseCode 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/DocPagesInsertBlank404ResponseName.cs b/src/CloudPDF/Types/DocPagesInsertBlank404ResponseName.cs new file mode 100644 index 0000000..2c09069 --- /dev/null +++ b/src/CloudPDF/Types/DocPagesInsertBlank404ResponseName.cs @@ -0,0 +1,114 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocPagesInsertBlank404ResponseName.DocPagesInsertBlank404ResponseNameSerializer) +)] +[Serializable] +public readonly record struct DocPagesInsertBlank404ResponseName : IStringEnum +{ + public static readonly DocPagesInsertBlank404ResponseName EngineError = new(Values.EngineError); + + public DocPagesInsertBlank404ResponseName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocPagesInsertBlank404ResponseName FromCustom(string value) + { + return new DocPagesInsertBlank404ResponseName(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 ==(DocPagesInsertBlank404ResponseName value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocPagesInsertBlank404ResponseName value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocPagesInsertBlank404ResponseName value) => value.Value; + + public static explicit operator DocPagesInsertBlank404ResponseName(string value) => new(value); + + internal class DocPagesInsertBlank404ResponseNameSerializer + : JsonConverter + { + public override DocPagesInsertBlank404ResponseName 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 DocPagesInsertBlank404ResponseName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocPagesInsertBlank404ResponseName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocPagesInsertBlank404ResponseName 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 DocPagesInsertBlank404ResponseName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocPagesInsertBlank404ResponseName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string EngineError = "EngineError"; + } +}