diff --git a/.fern/metadata.json b/.fern/metadata.json
index 71a452b..f898346 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": "5f2d480665034420df58c19fd1328b0823104e0f",
+ "originGitCommit": "b7dddfba5011349a40db7878b5cbc8685b2d42cf",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
- "requestedVersion": "3.0.0-next.13",
+ "requestedVersion": "3.0.0-next.14",
"ciProvider": "github",
- "sdkVersion": "3.0.0-next.13"
+ "sdkVersion": "3.0.0-next.14"
}
\ No newline at end of file
diff --git a/cloudpdf-generation.json b/cloudpdf-generation.json
index 8711044..de21a51 100644
--- a/cloudpdf-generation.json
+++ b/cloudpdf-generation.json
@@ -1,12 +1,12 @@
{
"language": "csharp",
- "canonicalVersion": "3.0.0-next.13",
- "sdkVersion": "3.0.0-next.13",
+ "canonicalVersion": "3.0.0-next.14",
+ "sdkVersion": "3.0.0-next.14",
"source": {
"repository": "embedpdf/embed-pdf-viewer",
"openapi": "cloudpdf/contract/openapi.json",
- "openapiSha256": "a472da9c7aed5db7f2b6b1f67f1b6268a9407afe9e7cf879ac04b878b4fc9dc7",
- "gitCommit": "5f2d480665034420df58c19fd1328b0823104e0f",
+ "openapiSha256": "188ea071e3534971638ee3d1fb1f19c77f36e04b2a783f5eefdbe67326527ea6",
+ "gitCommit": "b7dddfba5011349a40db7878b5cbc8685b2d42cf",
"gitCommitIsDirty": false
},
"fern": {
diff --git a/reference.md b/reference.md
index 4d3691a..b23a5aa 100644
--- a/reference.md
+++ b/reference.md
@@ -2035,6 +2035,100 @@ await client.Doc.Metadata.GetAsync(
## Doc Pages
+client.Doc.Pages.SetScaleAsync(DocPagesSetScaleRequest { ... }) -> WithRawResponseTask<DocPagesSetScale200Response>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Doc.Pages.SetScaleAsync(
+ new DocPagesSetScaleRequest
+ {
+ DocId = "docId",
+ LayerName = "layerName",
+ Pon = 1,
+ }
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DocPagesSetScaleRequest`
+
+
+
+
+
+
+
+
+
+
+
+client.Doc.Pages.ViewportsAsync(ViewportsPagesRequest { ... }) -> WithRawResponseTask<IEnumerable<DocPagesViewports200ResponseItem>>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```csharp
+await client.Doc.Pages.ViewportsAsync(
+ new ViewportsPagesRequest
+ {
+ DocId = "docId",
+ LayerName = "layerName",
+ Pon = 1,
+ }
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `ViewportsPagesRequest`
+
+
+
+
+
+
+
+
+
+
+
client.Doc.Pages.DeleteAsync(DeletePagesRequest { ... }) -> WithRawResponseTask<DocPagesDelete200Response>
-
diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetScaleTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetScaleTest.cs
new file mode 100644
index 0000000..480620f
--- /dev/null
+++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/SetScaleTest.cs
@@ -0,0 +1,172 @@
+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 SetScaleTest : BaseMockServerTest
+{
+ [NUnit.Framework.Test]
+ public async Task MockServerTest_1()
+ {
+ const string requestJson = """
+ {}
+ """;
+
+ const string mockResponse = """
+ {
+ "pageObjectNumber": 1,
+ "meta": {
+ "affectedPages": [
+ {
+ "pageObjectNumber": 1,
+ "revision": {
+ "docSessionId": "docSessionId",
+ "pageObjectNumber": 1,
+ "generation": 1
+ },
+ "weakAnnotationState": {
+ "kind": "unknown"
+ }
+ },
+ {
+ "pageObjectNumber": 1,
+ "revision": {
+ "docSessionId": "docSessionId",
+ "pageObjectNumber": 1,
+ "generation": 1
+ },
+ "weakAnnotationState": {
+ "kind": "unknown"
+ }
+ }
+ ],
+ "cacheDelta": {
+ "previousDocVersion": 1,
+ "docVersion": 1,
+ "annotationsVersion": 1,
+ "layerVersion": 1,
+ "working": true,
+ "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/1/scale")
+ .WithHeader("Content-Type", "application/json")
+ .UsingPut()
+ .WithBodyAsJson(requestJson)
+ )
+ .RespondWith(
+ WireMock
+ .ResponseBuilders.Response.Create()
+ .WithStatusCode(200)
+ .WithBody(mockResponse)
+ );
+
+ var response = await Client.Doc.Pages.SetScaleAsync(
+ new DocPagesSetScaleRequest
+ {
+ DocId = "docId",
+ LayerName = "layerName",
+ Pon = 1,
+ Measure = null,
+ }
+ );
+ JsonAssert.AreEqual(response, mockResponse);
+ }
+
+ [NUnit.Framework.Test]
+ public async Task MockServerTest_2()
+ {
+ const string requestJson = """
+ {}
+ """;
+
+ const string mockResponse = """
+ {
+ "pageObjectNumber": 1,
+ "meta": {
+ "affectedPages": [
+ {
+ "pageObjectNumber": 1,
+ "revision": {
+ "docSessionId": "docSessionId",
+ "pageObjectNumber": 1,
+ "generation": 1
+ },
+ "weakAnnotationState": {
+ "kind": "unknown"
+ }
+ }
+ ],
+ "cacheDelta": {
+ "previousDocVersion": 1,
+ "docVersion": 1,
+ "annotationsVersion": 1,
+ "layerVersion": 1,
+ "working": true,
+ "pages": [
+ {
+ "pageObjectNumber": 1,
+ "cache": {
+ "contentVersion": 1,
+ "annotationVersion": 1
+ }
+ }
+ ]
+ }
+ }
+ }
+ """;
+
+ Server
+ .Given(
+ WireMock
+ .RequestBuilders.Request.Create()
+ .WithPath("/v1/docs/docId/layers/layerName/pages/1/scale")
+ .WithHeader("Content-Type", "application/json")
+ .UsingPut()
+ .WithBodyAsJson(requestJson)
+ )
+ .RespondWith(
+ WireMock
+ .ResponseBuilders.Response.Create()
+ .WithStatusCode(200)
+ .WithBody(mockResponse)
+ );
+
+ var response = await Client.Doc.Pages.SetScaleAsync(
+ new DocPagesSetScaleRequest
+ {
+ DocId = "docId",
+ LayerName = "layerName",
+ Pon = 1,
+ }
+ );
+ JsonAssert.AreEqual(response, mockResponse);
+ }
+}
diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/ViewportsTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/ViewportsTest.cs
new file mode 100644
index 0000000..c44fa34
--- /dev/null
+++ b/src/CloudPDF.Test/Unit/MockServer/Doc/Pages/ViewportsTest.cs
@@ -0,0 +1,476 @@
+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 ViewportsTest : BaseMockServerTest
+{
+ [NUnit.Framework.Test]
+ public async Task MockServerTest_1()
+ {
+ const string mockResponse = """
+ [
+ {
+ "bbox": {
+ "left": 1.1,
+ "bottom": 1.1,
+ "right": 1.1,
+ "top": 1.1
+ },
+ "name": "name",
+ "measure": {
+ "subtype": "RL",
+ "ratio": "ratio",
+ "x": [
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ },
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ }
+ ],
+ "y": [
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ },
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ }
+ ],
+ "distance": [
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ },
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ }
+ ],
+ "area": [
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ },
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ }
+ ],
+ "angle": [
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ },
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ }
+ ],
+ "slope": [
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ },
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ }
+ ],
+ "origin": {
+ "x": 1.1,
+ "y": 1.1
+ },
+ "cyx": 1.1
+ },
+ "owned": true
+ },
+ {
+ "bbox": {
+ "left": 1.1,
+ "bottom": 1.1,
+ "right": 1.1,
+ "top": 1.1
+ },
+ "name": "name",
+ "measure": {
+ "subtype": "RL",
+ "ratio": "ratio",
+ "x": [
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ },
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ }
+ ],
+ "y": [
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ },
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ }
+ ],
+ "distance": [
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ },
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ }
+ ],
+ "area": [
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ },
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ }
+ ],
+ "angle": [
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ },
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ }
+ ],
+ "slope": [
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ },
+ {
+ "unit": "unit",
+ "conversion": 1.1,
+ "fraction": "decimal",
+ "precision": 1,
+ "fixed": true,
+ "thousands": "thousands",
+ "decimal": "decimal",
+ "prefixSpacing": "prefixSpacing",
+ "suffixSpacing": "suffixSpacing",
+ "labelPosition": "suffix"
+ }
+ ],
+ "origin": {
+ "x": 1.1,
+ "y": 1.1
+ },
+ "cyx": 1.1
+ },
+ "owned": true
+ }
+ ]
+ """;
+
+ Server
+ .Given(
+ WireMock
+ .RequestBuilders.Request.Create()
+ .WithPath("/v1/docs/docId/layers/layerName/pages/1/viewports")
+ .UsingGet()
+ )
+ .RespondWith(
+ WireMock
+ .ResponseBuilders.Response.Create()
+ .WithStatusCode(200)
+ .WithBody(mockResponse)
+ );
+
+ var response = await Client.Doc.Pages.ViewportsAsync(
+ new ViewportsPagesRequest
+ {
+ DocId = "docId",
+ LayerName = "layerName",
+ Pon = 1,
+ }
+ );
+ JsonAssert.AreEqual(response, mockResponse);
+ }
+
+ [NUnit.Framework.Test]
+ public async Task MockServerTest_2()
+ {
+ const string mockResponse = """
+ [
+ {
+ "bbox": {
+ "left": 1.1,
+ "bottom": 1.1,
+ "right": 1.1,
+ "top": 1.1
+ },
+ "name": "name",
+ "measure": {
+ "subtype": "RL",
+ "ratio": "ratio",
+ "x": [
+ {
+ "unit": "unit"
+ }
+ ],
+ "y": [
+ {
+ "unit": "unit"
+ }
+ ],
+ "distance": [
+ {
+ "unit": "unit"
+ }
+ ],
+ "area": [
+ {
+ "unit": "unit"
+ }
+ ],
+ "angle": [
+ {
+ "unit": "unit"
+ }
+ ],
+ "slope": [
+ {
+ "unit": "unit"
+ }
+ ],
+ "origin": {
+ "x": 1.1,
+ "y": 1.1
+ },
+ "cyx": 1.1
+ },
+ "owned": true
+ }
+ ]
+ """;
+
+ Server
+ .Given(
+ WireMock
+ .RequestBuilders.Request.Create()
+ .WithPath("/v1/docs/docId/layers/layerName/pages/1/viewports")
+ .UsingGet()
+ )
+ .RespondWith(
+ WireMock
+ .ResponseBuilders.Response.Create()
+ .WithStatusCode(200)
+ .WithBody(mockResponse)
+ );
+
+ var response = await Client.Doc.Pages.ViewportsAsync(
+ new ViewportsPagesRequest
+ {
+ DocId = "docId",
+ LayerName = "layerName",
+ Pon = 1,
+ }
+ );
+ JsonAssert.AreEqual(response, mockResponse);
+ }
+}
diff --git a/src/CloudPDF/CloudPDF.csproj b/src/CloudPDF/CloudPDF.csproj
index afa16aa..8bbfe6a 100644
--- a/src/CloudPDF/CloudPDF.csproj
+++ b/src/CloudPDF/CloudPDF.csproj
@@ -11,7 +11,7 @@
enable
12
enable
- 3.0.0-next.13
+ 3.0.0-next.14
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 a9cfc6d..47e3fa9 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.13";
+ public const string Current = "3.0.0-next.14";
}
diff --git a/src/CloudPDF/Doc/Pages/IPagesClient.cs b/src/CloudPDF/Doc/Pages/IPagesClient.cs
index 3b11e82..f4d6628 100644
--- a/src/CloudPDF/Doc/Pages/IPagesClient.cs
+++ b/src/CloudPDF/Doc/Pages/IPagesClient.cs
@@ -4,6 +4,18 @@ namespace CloudPDF.Doc;
public partial interface IPagesClient
{
+ WithRawResponseTask SetScaleAsync(
+ DocPagesSetScaleRequest request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
+ WithRawResponseTask> ViewportsAsync(
+ ViewportsPagesRequest request,
+ RequestOptions? options = null,
+ CancellationToken cancellationToken = default
+ );
+
WithRawResponseTask DeleteAsync(
DeletePagesRequest request,
RequestOptions? options = null,
diff --git a/src/CloudPDF/Doc/Pages/PagesClient.cs b/src/CloudPDF/Doc/Pages/PagesClient.cs
index fd5d4c5..9bbb3c1 100644
--- a/src/CloudPDF/Doc/Pages/PagesClient.cs
+++ b/src/CloudPDF/Doc/Pages/PagesClient.cs
@@ -13,6 +13,244 @@ internal PagesClient(RawClient client)
_client = client;
}
+ private async Task> SetScaleAsyncCore(
+ DocPagesSetScaleRequest 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.Put,
+ Path = string.Format(
+ "v1/docs/{0}/layers/{1}/pages/{2}/scale",
+ ValueConvert.ToPathParameterString(request.DocId),
+ ValueConvert.ToPathParameterString(request.LayerName),
+ ValueConvert.ToPathParameterString(request.Pon)
+ ),
+ Body = request,
+ 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