diff --git a/.fern/metadata.json b/.fern/metadata.json index 7ce833a..e155c09 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": "a0adb9e77ef16feaef2358d71b247b4f5a98fd23", + "originGitCommit": "81e6a2097d2997ef713a3013668e5eae0e748575", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "3.0.0-next.1", + "requestedVersion": "3.0.0-next.5", "ciProvider": "github", - "sdkVersion": "3.0.0-next.1" + "sdkVersion": "3.0.0-next.5" } \ No newline at end of file diff --git a/README.md b/README.md index 4d2e6bf..ad07ad2 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Instantiate and use the client with the following: using CloudPDF; var client = new CloudPDFClient("TOKEN"); -await client.Tenants.CreateAsync(new TenantsCreateRequest { Id = "id" }); +await client.Shares.ExchangeAsync(new SharesExchangeRequest { ShareToken = "shareToken" }); ``` ## Exception Handling @@ -56,7 +56,7 @@ will be thrown. using CloudPDF; try { - var response = await client.Tenants.CreateAsync(...); + var response = await client.Shares.ExchangeAsync(...); } catch (CloudPDFApiException e) { System.Console.WriteLine(e.Body); System.Console.WriteLine(e.StatusCode); @@ -99,7 +99,7 @@ Which status codes are retried depends on the `retryStatusCodes` generator confi Use the `MaxRetries` request option to configure this behavior. ```csharp -var response = await client.Tenants.CreateAsync( +var response = await client.Shares.ExchangeAsync( ..., new RequestOptions { MaxRetries: 0 // Override MaxRetries at the request level @@ -112,7 +112,7 @@ var response = await client.Tenants.CreateAsync( The SDK defaults to a 30 second timeout. Use the `Timeout` option to configure this behavior. ```csharp -var response = await client.Tenants.CreateAsync( +var response = await client.Shares.ExchangeAsync( ..., new RequestOptions { Timeout: TimeSpan.FromSeconds(3) // Override timeout to 3s @@ -128,7 +128,7 @@ Access raw HTTP response data (status code, headers, URL) alongside parsed respo using CloudPDF; // Access raw response data (status code, headers, etc.) alongside the parsed response -var result = await client.Tenants.CreateAsync(...).WithRawResponse(); +var result = await client.Shares.ExchangeAsync(...).WithRawResponse(); // Access the parsed data var data = result.Data; @@ -145,7 +145,7 @@ if (headers.TryGetValue("X-Request-Id", out var requestId)) } // For the default behavior, simply await without .WithRawResponse() -var data = await client.Tenants.CreateAsync(...); +var data = await client.Shares.ExchangeAsync(...); // .WithRawResponse() also works on streaming endpoints (returns IAsyncEnumerable + RawResponse) // and on endpoints with no response body (returns RawResponse only). @@ -156,7 +156,7 @@ var data = await client.Tenants.CreateAsync(...); If you would like to send additional headers as part of the request, use the `AdditionalHeaders` request option. ```csharp -var response = await client.Tenants.CreateAsync( +var response = await client.Shares.ExchangeAsync( ..., new RequestOptions { AdditionalHeaders = new Dictionary @@ -172,7 +172,7 @@ var response = await client.Tenants.CreateAsync( If you would like to send additional query parameters as part of the request, use the `AdditionalQueryParameters` request option. ```csharp -var response = await client.Tenants.CreateAsync( +var response = await client.Shares.ExchangeAsync( ..., new RequestOptions { AdditionalQueryParameters = new Dictionary @@ -189,7 +189,7 @@ If you would like to send additional body properties as part of the request, use This is only applied to JSON requests. ```csharp -var response = await client.Tenants.CreateAsync( +var response = await client.Shares.ExchangeAsync( ..., new RequestOptions { AdditionalBodyProperties = new Dictionary diff --git a/cloudpdf-generation.json b/cloudpdf-generation.json index 1ffcb51..160158a 100644 --- a/cloudpdf-generation.json +++ b/cloudpdf-generation.json @@ -1,12 +1,12 @@ { "language": "csharp", - "canonicalVersion": "3.0.0-next.1", - "sdkVersion": "3.0.0-next.1", + "canonicalVersion": "3.0.0-next.5", + "sdkVersion": "3.0.0-next.5", "source": { "repository": "embedpdf/embed-pdf-viewer", "openapi": "cloudpdf/contract/openapi.json", - "openapiSha256": "6858ce7912e9063d8fb171ade95fc473db01c5971a3af241a612dda79cc05100", - "gitCommit": "a0adb9e77ef16feaef2358d71b247b4f5a98fd23", + "openapiSha256": "e86b3f1766a77c28cb782a6513b5a86998668cd4e688e5b5ac27342e58637cd7", + "gitCommit": "81e6a2097d2997ef713a3013668e5eae0e748575", "gitCommitIsDirty": false }, "fern": { diff --git a/reference.md b/reference.md index dc59e86..81781a4 100644 --- a/reference.md +++ b/reference.md @@ -250,6 +250,286 @@ await client.Doc.TextAsync( + + + + +## Shares +
client.Shares.ExchangeAsync(SharesExchangeRequest { ... }) -> WithRawResponseTask<SharesExchange200Response> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until `password` is supplied. Mounted only when the deployment can sign (HS256 mode). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Shares.ExchangeAsync(new SharesExchangeRequest { ShareToken = "shareToken" }); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `SharesExchangeRequest` + +
+
+
+
+ + +
+
+
+ +
client.Shares.ListAsync(ListSharesRequest { ... }) -> WithRawResponseTask<SharesList200Response> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Shares.ListAsync(new ListSharesRequest { TenantId = "tenantId" }); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ListSharesRequest` + +
+
+
+
+ + +
+
+
+ +
client.Shares.CreateAsync(SharesCreateRequest { ... }) -> WithRawResponseTask<SharesCreate200Response> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +The returned share id IS the public share token. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Shares.CreateAsync( + new SharesCreateRequest + { + TenantId = "tenantId", + DocId = "docId", + Scope = new List() { "scope" }, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `SharesCreateRequest` + +
+
+
+
+ + +
+
+
+ +
client.Shares.GetAsync(GetSharesRequest { ... }) -> WithRawResponseTask<SharesGet200Response> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Shares.GetAsync(new GetSharesRequest { TenantId = "tenantId", ShareId = "shareId" }); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `GetSharesRequest` + +
+
+
+
+ + +
+
+
+ +
client.Shares.DeleteAsync(DeleteSharesRequest { ... }) -> WithRawResponseTask +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Shares.DeleteAsync( + new DeleteSharesRequest { TenantId = "tenantId", ShareId = "shareId" } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `DeleteSharesRequest` + +
+
+
+
+ + +
+
+
+ +
client.Shares.UpdateAsync(SharesUpdateRequest { ... }) -> WithRawResponseTask<SharesUpdate200Response> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Shares.UpdateAsync( + new SharesUpdateRequest { TenantId = "tenantId", ShareId = "shareId" } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `SharesUpdateRequest` + +
+
+
+
+ +
@@ -425,6 +705,154 @@ await client.Tenants.DeleteAsync(new DeleteTenantsRequest { TenantId = "tenantId + + + + +
client.Tenants.ResumeAsync(ResumeTenantsRequest { ... }) -> WithRawResponseTask +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Tenants.ResumeAsync(new ResumeTenantsRequest { TenantId = "tenantId" }); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ResumeTenantsRequest` + +
+
+
+
+ + +
+
+
+ +
client.Tenants.SuspendAsync(TenantsSuspendRequest { ... }) -> WithRawResponseTask +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Instantly reversible with resume. The API token is exempt, so a suspended tenant can still be inspected, exported, resumed, or deleted. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Tenants.SuspendAsync(new TenantsSuspendRequest { TenantId = "tenantId" }); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `TenantsSuspendRequest` + +
+
+
+
+ + +
+
+
+ +
client.Tenants.UsageAsync(UsageTenantsRequest { ... }) -> WithRawResponseTask<TenantsUsage200Response> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Facts only — no limits or billing state. Views count share exchanges plus authorized /v1/access grants, deduplicated across the two. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Tenants.UsageAsync(new UsageTenantsRequest { TenantId = "tenantId" }); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `UsageTenantsRequest` + +
+
+
+
+ +
@@ -677,6 +1105,62 @@ await client.Documents.ThumbnailAsync( + + + + +
client.Documents.UploadProxyAsync(UploadProxyDocumentsRequest { ... }) -> WithRawResponseTask<DocumentsUploadProxy200Response> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Documents.UploadProxyAsync( + new UploadProxyDocumentsRequest { TenantId = "tenantId", Id = "id" } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `UploadProxyDocumentsRequest` + +
+
+
+
+ +
diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/TextTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/TextTest.cs index 4cddae8..f9f1724 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Doc/TextTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/TextTest.cs @@ -15,7 +15,25 @@ public async Task MockServerTest_1() const string mockResponse = """ { "text": "text", - "charCount": 1 + "charCount": 1, + "charMap": [ + [ + { + "key": "value" + }, + { + "key": "value" + } + ], + [ + { + "key": "value" + }, + { + "key": "value" + } + ] + ] } """; @@ -50,7 +68,14 @@ public async Task MockServerTest_2() const string mockResponse = """ { "text": "text", - "charCount": 1 + "charCount": 1, + "charMap": [ + [ + { + "key": "value" + } + ] + ] } """; diff --git a/src/CloudPDF.Test/Unit/MockServer/Documents/InitTest.cs b/src/CloudPDF.Test/Unit/MockServer/Documents/InitTest.cs index cf1b8b4..bafd8ba 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Documents/InitTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Documents/InitTest.cs @@ -83,6 +83,7 @@ public async Task MockServerTest_1() DedupMode = null, DocId = null, UploadTtlSec = null, + UploadPreference = null, } ); JsonAssert.AreEqual(response, mockResponse); diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/CreateTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/CreateTest.cs new file mode 100644 index 0000000..cff0767 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/CreateTest.cs @@ -0,0 +1,149 @@ +using CloudPDF; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Shares; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class CreateTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string requestJson = """ + { + "docId": "docId", + "scope": [ + "scope", + "scope" + ] + } + """; + + const string mockResponse = """ + { + "share": { + "id": "id", + "tenantId": "tenantId", + "docId": "docId", + "layerName": "layerName", + "scope": [ + "scope", + "scope" + ], + "origins": [ + "origins", + "origins" + ], + "passwordProtected": true, + "sessionTtlSeconds": 1.1, + "disabled": true, + "expiresAt": 1.1, + "exchangeCount": 1.1, + "lastExchangedAt": 1.1, + "createdBy": "createdBy", + "createdAt": 1.1, + "updatedAt": 1.1 + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/shares") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.CreateAsync( + new SharesCreateRequest + { + TenantId = "tenantId", + DocId = "docId", + LayerName = null, + Scope = new List() { "scope", "scope" }, + Origins = null, + Password = null, + SessionTtlSeconds = null, + ExpiresAt = null, + } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string requestJson = """ + { + "docId": "docId", + "scope": [ + "scope" + ] + } + """; + + const string mockResponse = """ + { + "share": { + "id": "id", + "tenantId": "tenantId", + "docId": "docId", + "layerName": "layerName", + "scope": [ + "scope" + ], + "origins": [ + "origins" + ], + "passwordProtected": true, + "sessionTtlSeconds": 1.1, + "disabled": true, + "expiresAt": 1.1, + "exchangeCount": 1.1, + "lastExchangedAt": 1.1, + "createdBy": "createdBy", + "createdAt": 1.1, + "updatedAt": 1.1 + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/shares") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.CreateAsync( + new SharesCreateRequest + { + TenantId = "tenantId", + DocId = "docId", + Scope = new List() { "scope" }, + } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/DeleteTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/DeleteTest.cs new file mode 100644 index 0000000..06324be --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/DeleteTest.cs @@ -0,0 +1,48 @@ +using CloudPDF; +using CloudPDF.Test.Unit.MockServer; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Shares; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class DeleteTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public void MockServerTest_1() + { + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/shares/shareId") + .UsingDelete() + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Shares.DeleteAsync( + new DeleteSharesRequest { TenantId = "tenantId", ShareId = "shareId" } + ) + ); + } + + [NUnit.Framework.Test] + public void MockServerTest_2() + { + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/shares/shareId") + .UsingDelete() + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Shares.DeleteAsync( + new DeleteSharesRequest { TenantId = "tenantId", ShareId = "shareId" } + ) + ); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/ExchangeTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/ExchangeTest.cs new file mode 100644 index 0000000..bc661c7 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/ExchangeTest.cs @@ -0,0 +1,91 @@ +using CloudPDF; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Shares; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ExchangeTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string requestJson = """ + { + "shareToken": "shareToken" + } + """; + + const string mockResponse = """ + { + "token": "token", + "docId": "docId", + "layerName": "layerName", + "expiresAt": 1.1 + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/share-sessions") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.ExchangeAsync( + new SharesExchangeRequest { ShareToken = "shareToken", Password = null } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string requestJson = """ + { + "shareToken": "shareToken" + } + """; + + const string mockResponse = """ + { + "token": "token", + "docId": "docId", + "layerName": "layerName", + "expiresAt": 1.1 + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/share-sessions") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.ExchangeAsync( + new SharesExchangeRequest { ShareToken = "shareToken" } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/GetTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/GetTest.cs new file mode 100644 index 0000000..f22d231 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/GetTest.cs @@ -0,0 +1,111 @@ +using CloudPDF; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Shares; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class GetTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string mockResponse = """ + { + "share": { + "id": "id", + "tenantId": "tenantId", + "docId": "docId", + "layerName": "layerName", + "scope": [ + "scope", + "scope" + ], + "origins": [ + "origins", + "origins" + ], + "passwordProtected": true, + "sessionTtlSeconds": 1.1, + "disabled": true, + "expiresAt": 1.1, + "exchangeCount": 1.1, + "lastExchangedAt": 1.1, + "createdBy": "createdBy", + "createdAt": 1.1, + "updatedAt": 1.1 + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/shares/shareId") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.GetAsync( + new GetSharesRequest { TenantId = "tenantId", ShareId = "shareId" } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string mockResponse = """ + { + "share": { + "id": "id", + "tenantId": "tenantId", + "docId": "docId", + "layerName": "layerName", + "scope": [ + "scope" + ], + "origins": [ + "origins" + ], + "passwordProtected": true, + "sessionTtlSeconds": 1.1, + "disabled": true, + "expiresAt": 1.1, + "exchangeCount": 1.1, + "lastExchangedAt": 1.1, + "createdBy": "createdBy", + "createdAt": 1.1, + "updatedAt": 1.1 + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/shares/shareId") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.GetAsync( + new GetSharesRequest { TenantId = "tenantId", ShareId = "shareId" } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/ListTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/ListTest.cs new file mode 100644 index 0000000..a99c494 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/ListTest.cs @@ -0,0 +1,140 @@ +using CloudPDF; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Shares; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string mockResponse = """ + { + "shares": [ + { + "id": "id", + "tenantId": "tenantId", + "docId": "docId", + "layerName": "layerName", + "scope": [ + "scope", + "scope" + ], + "origins": [ + "origins", + "origins" + ], + "passwordProtected": true, + "sessionTtlSeconds": 1.1, + "disabled": true, + "expiresAt": 1.1, + "exchangeCount": 1.1, + "lastExchangedAt": 1.1, + "createdBy": "createdBy", + "createdAt": 1.1, + "updatedAt": 1.1 + }, + { + "id": "id", + "tenantId": "tenantId", + "docId": "docId", + "layerName": "layerName", + "scope": [ + "scope", + "scope" + ], + "origins": [ + "origins", + "origins" + ], + "passwordProtected": true, + "sessionTtlSeconds": 1.1, + "disabled": true, + "expiresAt": 1.1, + "exchangeCount": 1.1, + "lastExchangedAt": 1.1, + "createdBy": "createdBy", + "createdAt": 1.1, + "updatedAt": 1.1 + } + ], + "nextCursor": "nextCursor" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/shares") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.ListAsync( + new ListSharesRequest { TenantId = "tenantId" } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string mockResponse = """ + { + "shares": [ + { + "id": "id", + "tenantId": "tenantId", + "docId": "docId", + "layerName": "layerName", + "scope": [ + "scope" + ], + "origins": [ + "origins" + ], + "passwordProtected": true, + "sessionTtlSeconds": 1.1, + "disabled": true, + "expiresAt": 1.1, + "exchangeCount": 1.1, + "lastExchangedAt": 1.1, + "createdBy": "createdBy", + "createdAt": 1.1, + "updatedAt": 1.1 + } + ], + "nextCursor": "nextCursor" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/shares") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.ListAsync( + new ListSharesRequest { TenantId = "tenantId" } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/UpdateTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/UpdateTest.cs new file mode 100644 index 0000000..be9cd0d --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/UpdateTest.cs @@ -0,0 +1,133 @@ +using CloudPDF; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Shares; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class UpdateTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string requestJson = """ + {} + """; + + const string mockResponse = """ + { + "share": { + "id": "id", + "tenantId": "tenantId", + "docId": "docId", + "layerName": "layerName", + "scope": [ + "scope", + "scope" + ], + "origins": [ + "origins", + "origins" + ], + "passwordProtected": true, + "sessionTtlSeconds": 1.1, + "disabled": true, + "expiresAt": 1.1, + "exchangeCount": 1.1, + "lastExchangedAt": 1.1, + "createdBy": "createdBy", + "createdAt": 1.1, + "updatedAt": 1.1 + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/shares/shareId") + .WithHeader("Content-Type", "application/json") + .UsingPatch() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.UpdateAsync( + new SharesUpdateRequest + { + TenantId = "tenantId", + ShareId = "shareId", + Scope = null, + Origins = null, + Password = null, + SessionTtlSeconds = null, + Disabled = null, + ExpiresAt = null, + } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string requestJson = """ + {} + """; + + const string mockResponse = """ + { + "share": { + "id": "id", + "tenantId": "tenantId", + "docId": "docId", + "layerName": "layerName", + "scope": [ + "scope" + ], + "origins": [ + "origins" + ], + "passwordProtected": true, + "sessionTtlSeconds": 1.1, + "disabled": true, + "expiresAt": 1.1, + "exchangeCount": 1.1, + "lastExchangedAt": 1.1, + "createdBy": "createdBy", + "createdAt": 1.1, + "updatedAt": 1.1 + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/shares/shareId") + .WithHeader("Content-Type", "application/json") + .UsingPatch() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.UpdateAsync( + new SharesUpdateRequest { TenantId = "tenantId", ShareId = "shareId" } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Tenants/CreateTest.cs b/src/CloudPDF.Test/Unit/MockServer/Tenants/CreateTest.cs index ef2fc05..a9ad6b2 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Tenants/CreateTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Tenants/CreateTest.cs @@ -24,6 +24,7 @@ public async Task MockServerTest_1() "id": "id", "name": "name", "autoProvisioned": true, + "status": "active", "createdAt": 1.1 }, "created": true @@ -67,6 +68,7 @@ public async Task MockServerTest_2() "id": "id", "name": "name", "autoProvisioned": true, + "status": "active", "createdAt": 1.1 }, "created": true diff --git a/src/CloudPDF.Test/Unit/MockServer/Tenants/GetTest.cs b/src/CloudPDF.Test/Unit/MockServer/Tenants/GetTest.cs index 10d43bc..a3a19db 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Tenants/GetTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Tenants/GetTest.cs @@ -18,6 +18,7 @@ public async Task MockServerTest_1() "id": "id", "name": "name", "autoProvisioned": true, + "status": "active", "createdAt": 1.1 } } @@ -52,6 +53,7 @@ public async Task MockServerTest_2() "id": "id", "name": "name", "autoProvisioned": true, + "status": "active", "createdAt": 1.1 } } diff --git a/src/CloudPDF.Test/Unit/MockServer/Tenants/ListTest.cs b/src/CloudPDF.Test/Unit/MockServer/Tenants/ListTest.cs index d535e7d..1be4912 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Tenants/ListTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Tenants/ListTest.cs @@ -19,12 +19,14 @@ public async Task MockServerTest_1() "id": "id", "name": "name", "autoProvisioned": true, + "status": "active", "createdAt": 1.1 }, { "id": "id", "name": "name", "autoProvisioned": true, + "status": "active", "createdAt": 1.1 } ], @@ -55,6 +57,7 @@ public async Task MockServerTest_2() "id": "id", "name": "name", "autoProvisioned": true, + "status": "active", "createdAt": 1.1 } ], diff --git a/src/CloudPDF.Test/Unit/MockServer/Tenants/ResumeTest.cs b/src/CloudPDF.Test/Unit/MockServer/Tenants/ResumeTest.cs new file mode 100644 index 0000000..76bd681 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Tenants/ResumeTest.cs @@ -0,0 +1,44 @@ +using CloudPDF; +using CloudPDF.Test.Unit.MockServer; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Tenants; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ResumeTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public void MockServerTest_1() + { + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/resume") + .UsingPost() + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Tenants.ResumeAsync(new ResumeTenantsRequest { TenantId = "tenantId" }) + ); + } + + [NUnit.Framework.Test] + public void MockServerTest_2() + { + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/resume") + .UsingPost() + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Tenants.ResumeAsync(new ResumeTenantsRequest { TenantId = "tenantId" }) + ); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Tenants/SuspendTest.cs b/src/CloudPDF.Test/Unit/MockServer/Tenants/SuspendTest.cs new file mode 100644 index 0000000..f7cdfd9 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Tenants/SuspendTest.cs @@ -0,0 +1,58 @@ +using CloudPDF; +using CloudPDF.Test.Unit.MockServer; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Tenants; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class SuspendTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public void MockServerTest_1() + { + const string requestJson = """ + {} + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/suspend") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Tenants.SuspendAsync( + new TenantsSuspendRequest { TenantId = "tenantId", Reason = null } + ) + ); + } + + [NUnit.Framework.Test] + public void MockServerTest_2() + { + const string requestJson = """ + {} + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/suspend") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Tenants.SuspendAsync(new TenantsSuspendRequest { TenantId = "tenantId" }) + ); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Tenants/UsageTest.cs b/src/CloudPDF.Test/Unit/MockServer/Tenants/UsageTest.cs new file mode 100644 index 0000000..e9f279b --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Tenants/UsageTest.cs @@ -0,0 +1,83 @@ +using CloudPDF; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Tenants; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class UsageTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string mockResponse = """ + { + "tenantId": "tenantId", + "periodStart": "periodStart", + "periodEnd": "periodEnd", + "metrics": { + "pdf.views": 1.1, + "pdf.uploads": 1.1, + "storage.bytes": 1.1 + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/usage") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Tenants.UsageAsync( + new UsageTenantsRequest { TenantId = "tenantId" } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string mockResponse = """ + { + "tenantId": "tenantId", + "periodStart": "periodStart", + "periodEnd": "periodEnd", + "metrics": { + "pdf.views": 1.1, + "pdf.uploads": 1.1, + "storage.bytes": 1.1 + } + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/usage") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Tenants.UsageAsync( + new UsageTenantsRequest { TenantId = "tenantId" } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Tokens/IssueTest.cs b/src/CloudPDF.Test/Unit/MockServer/Tokens/IssueTest.cs index 447119d..68701ff 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Tokens/IssueTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Tokens/IssueTest.cs @@ -65,6 +65,7 @@ public async Task MockServerTest_1() DisplayName = null, GroupId = null, Groups = null, + Origins = null, ExpiresIn = 7776000, } ) diff --git a/src/CloudPDF/CloudPDF.csproj b/src/CloudPDF/CloudPDF.csproj index 164f423..5ee7977 100644 --- a/src/CloudPDF/CloudPDF.csproj +++ b/src/CloudPDF/CloudPDF.csproj @@ -11,7 +11,7 @@ enable 12 enable - 3.0.0-next.1 + 3.0.0-next.5 3.0.0.0 3.0.0.0 README.md diff --git a/src/CloudPDF/CloudPDFClient.cs b/src/CloudPDF/CloudPDFClient.cs index 6923c4b..e72e055 100644 --- a/src/CloudPDF/CloudPDFClient.cs +++ b/src/CloudPDF/CloudPDFClient.cs @@ -6,7 +6,7 @@ public partial class CloudPDFClient : ICloudPDFClient { private readonly RawClient _client; - public CloudPDFClient(string? token = null, ClientOptions? clientOptions = null) + public CloudPDFClient(string token, ClientOptions? clientOptions = null) { clientOptions ??= new ClientOptions(); var platformHeaders = new Headers( @@ -26,7 +26,7 @@ public CloudPDFClient(string? token = null, ClientOptions? clientOptions = null) } var clientOptionsWithAuth = clientOptions.Clone(); var authHeaders = new Headers( - new Dictionary() { { "Authorization", $"Bearer {token ?? ""}" } } + new Dictionary() { { "Authorization", $"Bearer {token}" } } ); foreach (var header in authHeaders) { @@ -35,6 +35,7 @@ public CloudPDFClient(string? token = null, ClientOptions? clientOptions = null) _client = new RawClient(clientOptionsWithAuth); Deployment = new DeploymentClient(_client); Doc = new DocClient(_client); + Shares = new SharesClient(_client); Tenants = new TenantsClient(_client); Documents = new DocumentsClient(_client); Tokens = new TokensClient(_client); @@ -44,6 +45,8 @@ public CloudPDFClient(string? token = null, ClientOptions? clientOptions = null) public IDocClient Doc { get; } + public ISharesClient Shares { get; } + public ITenantsClient Tenants { get; } public IDocumentsClient Documents { get; } diff --git a/src/CloudPDF/Core/Public/Version.cs b/src/CloudPDF/Core/Public/Version.cs index feb7888..134e286 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.1"; + public const string Current = "3.0.0-next.5"; } diff --git a/src/CloudPDF/Documents/DocumentsClient.cs b/src/CloudPDF/Documents/DocumentsClient.cs index 23f95ec..f65ec8f 100644 --- a/src/CloudPDF/Documents/DocumentsClient.cs +++ b/src/CloudPDF/Documents/DocumentsClient.cs @@ -638,10 +638,8 @@ private async Task> CommitAsyncCore( } } - private async Task> UploadDirectAsyncCore( - string tenantId, - string id, - Stream request, + private async Task> UploadProxyAsyncCore( + UploadProxyDocumentsRequest request, RequestOptions? options = null, CancellationToken cancellationToken = default ) @@ -655,24 +653,21 @@ private async Task> UploadDire .Add(options?.AdditionalHeaders) .BuildAsync() .ConfigureAwait(false); + var multipartFormRequest_ = new MultipartFormRequest + { + Method = HttpMethod.Post, + Path = string.Format( + "v1/tenants/{0}/documents/{1}/upload-proxy", + ValueConvert.ToPathParameterString(request.TenantId), + ValueConvert.ToPathParameterString(request.Id) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }; + multipartFormRequest_.AddFileParameterPart("file", request.File); var response = await _client - .SendRequestAsync( - new StreamRequest - { - Method = HttpMethod.Post, - Path = string.Format( - "v1/tenants/{0}/documents/{1}/upload-direct", - ValueConvert.ToPathParameterString(tenantId), - ValueConvert.ToPathParameterString(id) - ), - Body = request, - QueryString = _queryString, - Headers = _headers, - ContentType = "application/pdf", - Options = options, - }, - cancellationToken - ) + .SendRequestAsync(multipartFormRequest_, cancellationToken) .ConfigureAwait(false); if (response.StatusCode is >= 200 and < 400) { @@ -681,10 +676,10 @@ private async Task> UploadDire .ConfigureAwait(false); try { - var responseData = JsonUtils.Deserialize( + var responseData = JsonUtils.Deserialize( responseBody )!; - return new WithRawResponse() + return new WithRawResponse() { Data = responseData, RawResponse = new CloudPDF.RawResponse() @@ -731,6 +726,18 @@ private async Task> UploadDire Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), } ); + case 409: + throw new ConflictError( + 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) @@ -952,16 +959,22 @@ public WithRawResponseTask CommitAsync( ); } - public WithRawResponseTask UploadDirectAsync( - string tenantId, - string id, - Stream request, + /// + /// This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. + /// + /// + /// await client.Documents.UploadProxyAsync( + /// new UploadProxyDocumentsRequest { TenantId = "tenantId", Id = "id" } + /// ); + /// + public WithRawResponseTask UploadProxyAsync( + UploadProxyDocumentsRequest request, RequestOptions? options = null, CancellationToken cancellationToken = default ) { - return new WithRawResponseTask( - UploadDirectAsyncCore(tenantId, id, request, options, cancellationToken) + return new WithRawResponseTask( + UploadProxyAsyncCore(request, options, cancellationToken) ); } diff --git a/src/CloudPDF/Documents/IDocumentsClient.cs b/src/CloudPDF/Documents/IDocumentsClient.cs index d3e9c62..5d49855 100644 --- a/src/CloudPDF/Documents/IDocumentsClient.cs +++ b/src/CloudPDF/Documents/IDocumentsClient.cs @@ -38,10 +38,11 @@ WithRawResponseTask CommitAsync( CancellationToken cancellationToken = default ); - WithRawResponseTask UploadDirectAsync( - string tenantId, - string id, - Stream request, + /// + /// This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. + /// + WithRawResponseTask UploadProxyAsync( + UploadProxyDocumentsRequest request, RequestOptions? options = null, CancellationToken cancellationToken = default ); diff --git a/src/CloudPDF/Documents/Requests/DocumentsInitRequest.cs b/src/CloudPDF/Documents/Requests/DocumentsInitRequest.cs index 9efa9b4..2a6f88c 100644 --- a/src/CloudPDF/Documents/Requests/DocumentsInitRequest.cs +++ b/src/CloudPDF/Documents/Requests/DocumentsInitRequest.cs @@ -30,6 +30,9 @@ public record DocumentsInitRequest [JsonPropertyName("uploadTtlSec")] public double? UploadTtlSec { get; set; } + [JsonPropertyName("uploadPreference")] + public DocumentsInitRequestUploadPreference? UploadPreference { get; set; } + /// public override string ToString() { diff --git a/src/CloudPDF/Documents/Requests/UploadProxyDocumentsRequest.cs b/src/CloudPDF/Documents/Requests/UploadProxyDocumentsRequest.cs new file mode 100644 index 0000000..f68014d --- /dev/null +++ b/src/CloudPDF/Documents/Requests/UploadProxyDocumentsRequest.cs @@ -0,0 +1,22 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record UploadProxyDocumentsRequest +{ + [JsonIgnore] + public required string TenantId { get; set; } + + [JsonIgnore] + public required string Id { get; set; } + + public required FileParameter File { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Documents/Types/DocumentsInitRequestUploadPreference.cs b/src/CloudPDF/Documents/Types/DocumentsInitRequestUploadPreference.cs new file mode 100644 index 0000000..d3a0c5c --- /dev/null +++ b/src/CloudPDF/Documents/Types/DocumentsInitRequestUploadPreference.cs @@ -0,0 +1,124 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(DocumentsInitRequestUploadPreference.DocumentsInitRequestUploadPreferenceSerializer) +)] +[Serializable] +public readonly record struct DocumentsInitRequestUploadPreference : IStringEnum +{ + public static readonly DocumentsInitRequestUploadPreference Auto = new(Values.Auto); + + public static readonly DocumentsInitRequestUploadPreference Presigned = new(Values.Presigned); + + public static readonly DocumentsInitRequestUploadPreference Proxy = new(Values.Proxy); + + public DocumentsInitRequestUploadPreference(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static DocumentsInitRequestUploadPreference FromCustom(string value) + { + return new DocumentsInitRequestUploadPreference(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 ==(DocumentsInitRequestUploadPreference value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(DocumentsInitRequestUploadPreference value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(DocumentsInitRequestUploadPreference value) => + value.Value; + + public static explicit operator DocumentsInitRequestUploadPreference(string value) => + new(value); + + internal class DocumentsInitRequestUploadPreferenceSerializer + : JsonConverter + { + public override DocumentsInitRequestUploadPreference 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 DocumentsInitRequestUploadPreference(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + DocumentsInitRequestUploadPreference value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override DocumentsInitRequestUploadPreference 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 DocumentsInitRequestUploadPreference(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + DocumentsInitRequestUploadPreference value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Auto = "auto"; + + public const string Presigned = "presigned"; + + public const string Proxy = "proxy"; + } +} diff --git a/src/CloudPDF/Exceptions/ConflictError.cs b/src/CloudPDF/Exceptions/ConflictError.cs new file mode 100644 index 0000000..4cea6f1 --- /dev/null +++ b/src/CloudPDF/Exceptions/ConflictError.cs @@ -0,0 +1,16 @@ +namespace CloudPDF; + +/// +/// This exception type will be thrown for any non-2XX API responses. +/// +[Serializable] +public class ConflictError( + DocumentsUploadProxy409Response body, + CloudPDF.RawResponse? rawResponse = null +) : CloudPDFApiException("ConflictError", 409, body, rawResponse: rawResponse) +{ + /// + /// The body of the response that triggered the exception. + /// + public new DocumentsUploadProxy409Response Body => body; +} diff --git a/src/CloudPDF/Exceptions/GoneError.cs b/src/CloudPDF/Exceptions/GoneError.cs new file mode 100644 index 0000000..fa3ade5 --- /dev/null +++ b/src/CloudPDF/Exceptions/GoneError.cs @@ -0,0 +1,14 @@ +namespace CloudPDF; + +/// +/// This exception type will be thrown for any non-2XX API responses. +/// +[Serializable] +public class GoneError(SharesExchange410Response body, CloudPDF.RawResponse? rawResponse = null) + : CloudPDFApiException("GoneError", 410, body, rawResponse: rawResponse) +{ + /// + /// The body of the response that triggered the exception. + /// + public new SharesExchange410Response Body => body; +} diff --git a/src/CloudPDF/Exceptions/UnprocessableEntityError.cs b/src/CloudPDF/Exceptions/UnprocessableEntityError.cs new file mode 100644 index 0000000..4fdc4ff --- /dev/null +++ b/src/CloudPDF/Exceptions/UnprocessableEntityError.cs @@ -0,0 +1,16 @@ +namespace CloudPDF; + +/// +/// This exception type will be thrown for any non-2XX API responses. +/// +[Serializable] +public class UnprocessableEntityError( + SharesExchange422Response body, + CloudPDF.RawResponse? rawResponse = null +) : CloudPDFApiException("UnprocessableEntityError", 422, body, rawResponse: rawResponse) +{ + /// + /// The body of the response that triggered the exception. + /// + public new SharesExchange422Response Body => body; +} diff --git a/src/CloudPDF/ICloudPDFClient.cs b/src/CloudPDF/ICloudPDFClient.cs index abedc3d..ec71076 100644 --- a/src/CloudPDF/ICloudPDFClient.cs +++ b/src/CloudPDF/ICloudPDFClient.cs @@ -4,6 +4,7 @@ public partial interface ICloudPDFClient { public IDeploymentClient Deployment { get; } public IDocClient Doc { get; } + public ISharesClient Shares { get; } public ITenantsClient Tenants { get; } public IDocumentsClient Documents { get; } public ITokensClient Tokens { get; } diff --git a/src/CloudPDF/Shares/ISharesClient.cs b/src/CloudPDF/Shares/ISharesClient.cs new file mode 100644 index 0000000..cb6449e --- /dev/null +++ b/src/CloudPDF/Shares/ISharesClient.cs @@ -0,0 +1,46 @@ +namespace CloudPDF; + +public partial interface ISharesClient +{ + /// + /// Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until `password` is supplied. Mounted only when the deployment can sign (HS256 mode). + /// + WithRawResponseTask ExchangeAsync( + SharesExchangeRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask ListAsync( + ListSharesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + /// + /// The returned share id IS the public share token. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does. + /// + WithRawResponseTask CreateAsync( + SharesCreateRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask GetAsync( + GetSharesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask DeleteAsync( + DeleteSharesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask UpdateAsync( + SharesUpdateRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/CloudPDF/Shares/Requests/DeleteSharesRequest.cs b/src/CloudPDF/Shares/Requests/DeleteSharesRequest.cs new file mode 100644 index 0000000..51b2520 --- /dev/null +++ b/src/CloudPDF/Shares/Requests/DeleteSharesRequest.cs @@ -0,0 +1,20 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DeleteSharesRequest +{ + [JsonIgnore] + public required string TenantId { get; set; } + + [JsonIgnore] + public required string ShareId { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Shares/Requests/GetSharesRequest.cs b/src/CloudPDF/Shares/Requests/GetSharesRequest.cs new file mode 100644 index 0000000..5fb1122 --- /dev/null +++ b/src/CloudPDF/Shares/Requests/GetSharesRequest.cs @@ -0,0 +1,20 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record GetSharesRequest +{ + [JsonIgnore] + public required string TenantId { get; set; } + + [JsonIgnore] + public required string ShareId { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Shares/Requests/ListSharesRequest.cs b/src/CloudPDF/Shares/Requests/ListSharesRequest.cs new file mode 100644 index 0000000..20e9e69 --- /dev/null +++ b/src/CloudPDF/Shares/Requests/ListSharesRequest.cs @@ -0,0 +1,26 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ListSharesRequest +{ + [JsonIgnore] + public required string TenantId { get; set; } + + [JsonIgnore] + public int? Limit { get; set; } + + [JsonIgnore] + public string? Cursor { get; set; } + + [JsonIgnore] + public string? DocId { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Shares/Requests/SharesCreateRequest.cs b/src/CloudPDF/Shares/Requests/SharesCreateRequest.cs new file mode 100644 index 0000000..d7fffdd --- /dev/null +++ b/src/CloudPDF/Shares/Requests/SharesCreateRequest.cs @@ -0,0 +1,38 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesCreateRequest +{ + [JsonIgnore] + public required string TenantId { get; set; } + + [JsonPropertyName("docId")] + public required string DocId { get; set; } + + [JsonPropertyName("layerName")] + public string? LayerName { get; set; } + + [JsonPropertyName("scope")] + public IEnumerable Scope { get; set; } = new List(); + + [JsonPropertyName("origins")] + public IEnumerable? Origins { get; set; } + + [JsonPropertyName("password")] + public string? Password { get; set; } + + [JsonPropertyName("sessionTtlSeconds")] + public int? SessionTtlSeconds { get; set; } + + [JsonPropertyName("expiresAt")] + public int? ExpiresAt { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Shares/Requests/SharesExchangeRequest.cs b/src/CloudPDF/Shares/Requests/SharesExchangeRequest.cs new file mode 100644 index 0000000..fb9007b --- /dev/null +++ b/src/CloudPDF/Shares/Requests/SharesExchangeRequest.cs @@ -0,0 +1,20 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchangeRequest +{ + [JsonPropertyName("shareToken")] + public required string ShareToken { get; set; } + + [JsonPropertyName("password")] + public string? Password { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Shares/Requests/SharesUpdateRequest.cs b/src/CloudPDF/Shares/Requests/SharesUpdateRequest.cs new file mode 100644 index 0000000..7b2a617 --- /dev/null +++ b/src/CloudPDF/Shares/Requests/SharesUpdateRequest.cs @@ -0,0 +1,38 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesUpdateRequest +{ + [JsonIgnore] + public required string TenantId { get; set; } + + [JsonIgnore] + public required string ShareId { get; set; } + + [JsonPropertyName("scope")] + public IEnumerable? Scope { get; set; } + + [JsonPropertyName("origins")] + public IEnumerable? Origins { get; set; } + + [JsonPropertyName("password")] + public string? Password { get; set; } + + [JsonPropertyName("sessionTtlSeconds")] + public int? SessionTtlSeconds { get; set; } + + [JsonPropertyName("disabled")] + public bool? Disabled { get; set; } + + [JsonPropertyName("expiresAt")] + public int? ExpiresAt { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Shares/SharesClient.cs b/src/CloudPDF/Shares/SharesClient.cs new file mode 100644 index 0000000..4aa6e46 --- /dev/null +++ b/src/CloudPDF/Shares/SharesClient.cs @@ -0,0 +1,816 @@ +using CloudPDF.Core; +using global::System.Text.Json; + +namespace CloudPDF; + +public partial class SharesClient : ISharesClient +{ + private readonly RawClient _client; + + internal SharesClient(RawClient client) + { + _client = client; + } + + private async Task> ExchangeAsyncCore( + SharesExchangeRequest 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(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Post, + Path = "v1/share-sessions", + 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(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 403: + throw new ForbiddenError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 410: + throw new GoneError( + 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 422: + throw new UnprocessableEntityError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + private async Task> ListAsyncCore( + ListSharesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new CloudPDF.Core.QueryStringBuilder.Builder(capacity: 3) + .Add("limit", request.Limit) + .Add("cursor", request.Cursor) + .Add("docId", request.DocId) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new CloudPDF.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "v1/tenants/{0}/shares", + ValueConvert.ToPathParameterString(request.TenantId) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize(responseBody)!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new CloudPDFApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 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), + } + ); + } + } + 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> CreateAsyncCore( + SharesCreateRequest 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(_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/tenants/{0}/shares", + ValueConvert.ToPathParameterString(request.TenantId) + ), + 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(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 403: + throw new ForbiddenError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + private async Task> GetAsyncCore( + GetSharesRequest 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(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "v1/tenants/{0}/shares/{1}", + ValueConvert.ToPathParameterString(request.TenantId), + ValueConvert.ToPathParameterString(request.ShareId) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize(responseBody)!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new CloudPDFApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + private async Task DeleteAsyncCore( + DeleteSharesRequest 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(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Delete, + Path = string.Format( + "v1/tenants/{0}/shares/{1}", + ValueConvert.ToPathParameterString(request.TenantId), + ValueConvert.ToPathParameterString(request.ShareId) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + return new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }; + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + private async Task> UpdateAsyncCore( + SharesUpdateRequest 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(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethodExtensions.Patch, + Path = string.Format( + "v1/tenants/{0}/shares/{1}", + ValueConvert.ToPathParameterString(request.TenantId), + ValueConvert.ToPathParameterString(request.ShareId) + ), + 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(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), + } + ); + } + } + + /// + /// Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until `password` is supplied. Mounted only when the deployment can sign (HS256 mode). + /// + /// + /// await client.Shares.ExchangeAsync(new SharesExchangeRequest { ShareToken = "shareToken" }); + /// + public WithRawResponseTask ExchangeAsync( + SharesExchangeRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ExchangeAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// await client.Shares.ListAsync(new ListSharesRequest { TenantId = "tenantId" }); + /// + public WithRawResponseTask ListAsync( + ListSharesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// The returned share id IS the public share token. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does. + /// + /// + /// await client.Shares.CreateAsync( + /// new SharesCreateRequest + /// { + /// TenantId = "tenantId", + /// DocId = "docId", + /// Scope = new List<string>() { "scope" }, + /// } + /// ); + /// + public WithRawResponseTask CreateAsync( + SharesCreateRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + CreateAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// await client.Shares.GetAsync(new GetSharesRequest { TenantId = "tenantId", ShareId = "shareId" }); + /// + public WithRawResponseTask GetAsync( + GetSharesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + GetAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// await client.Shares.DeleteAsync( + /// new DeleteSharesRequest { TenantId = "tenantId", ShareId = "shareId" } + /// ); + /// + public WithRawResponseTask DeleteAsync( + DeleteSharesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask(DeleteAsyncCore(request, options, cancellationToken)); + } + + /// + /// await client.Shares.UpdateAsync( + /// new SharesUpdateRequest { TenantId = "tenantId", ShareId = "shareId" } + /// ); + /// + public WithRawResponseTask UpdateAsync( + SharesUpdateRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + UpdateAsyncCore(request, options, cancellationToken) + ); + } +} diff --git a/src/CloudPDF/Tenants/ITenantsClient.cs b/src/CloudPDF/Tenants/ITenantsClient.cs index e1bbfef..374eaf0 100644 --- a/src/CloudPDF/Tenants/ITenantsClient.cs +++ b/src/CloudPDF/Tenants/ITenantsClient.cs @@ -28,4 +28,28 @@ WithRawResponseTask DeleteAsync( RequestOptions? options = null, CancellationToken cancellationToken = default ); + + WithRawResponseTask ResumeAsync( + ResumeTenantsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + /// + /// Instantly reversible with resume. The API token is exempt, so a suspended tenant can still be inspected, exported, resumed, or deleted. + /// + WithRawResponseTask SuspendAsync( + TenantsSuspendRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + /// + /// Facts only — no limits or billing state. Views count share exchanges plus authorized /v1/access grants, deduplicated across the two. + /// + WithRawResponseTask UsageAsync( + UsageTenantsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); } diff --git a/src/CloudPDF/Tenants/Requests/ResumeTenantsRequest.cs b/src/CloudPDF/Tenants/Requests/ResumeTenantsRequest.cs new file mode 100644 index 0000000..664b52f --- /dev/null +++ b/src/CloudPDF/Tenants/Requests/ResumeTenantsRequest.cs @@ -0,0 +1,17 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ResumeTenantsRequest +{ + [JsonIgnore] + public required string TenantId { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Tenants/Requests/TenantsSuspendRequest.cs b/src/CloudPDF/Tenants/Requests/TenantsSuspendRequest.cs new file mode 100644 index 0000000..0f8531e --- /dev/null +++ b/src/CloudPDF/Tenants/Requests/TenantsSuspendRequest.cs @@ -0,0 +1,20 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record TenantsSuspendRequest +{ + [JsonIgnore] + public required string TenantId { get; set; } + + [JsonPropertyName("reason")] + public string? Reason { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Tenants/Requests/UsageTenantsRequest.cs b/src/CloudPDF/Tenants/Requests/UsageTenantsRequest.cs new file mode 100644 index 0000000..9ec5e48 --- /dev/null +++ b/src/CloudPDF/Tenants/Requests/UsageTenantsRequest.cs @@ -0,0 +1,20 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record UsageTenantsRequest +{ + [JsonIgnore] + public required string TenantId { get; set; } + + [JsonIgnore] + public string? Period { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Tenants/TenantsClient.cs b/src/CloudPDF/Tenants/TenantsClient.cs index 73165e8..762fd9b 100644 --- a/src/CloudPDF/Tenants/TenantsClient.cs +++ b/src/CloudPDF/Tenants/TenantsClient.cs @@ -408,6 +408,287 @@ private async Task DeleteAsyncCore( } } + private async Task ResumeAsyncCore( + ResumeTenantsRequest 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(_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/tenants/{0}/resume", + ValueConvert.ToPathParameterString(request.TenantId) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + return new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }; + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + private async Task SuspendAsyncCore( + TenantsSuspendRequest 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(_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/tenants/{0}/suspend", + ValueConvert.ToPathParameterString(request.TenantId) + ), + Body = request, + QueryString = _queryString, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + return new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }; + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + private async Task> UsageAsyncCore( + UsageTenantsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new CloudPDF.Core.QueryStringBuilder.Builder(capacity: 1) + .Add("period", request.Period) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new CloudPDF.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "v1/tenants/{0}/usage", + ValueConvert.ToPathParameterString(request.TenantId) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize(responseBody)!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new CloudPDFApiException( + "Failed to deserialize response", + response.StatusCode, + responseBody, + e, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + /// /// await client.Tenants.ListAsync(new ListTenantsRequest()); /// @@ -464,4 +745,48 @@ public WithRawResponseTask DeleteAsync( { return new WithRawResponseTask(DeleteAsyncCore(request, options, cancellationToken)); } + + /// + /// await client.Tenants.ResumeAsync(new ResumeTenantsRequest { TenantId = "tenantId" }); + /// + public WithRawResponseTask ResumeAsync( + ResumeTenantsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask(ResumeAsyncCore(request, options, cancellationToken)); + } + + /// + /// Instantly reversible with resume. The API token is exempt, so a suspended tenant can still be inspected, exported, resumed, or deleted. + /// + /// + /// await client.Tenants.SuspendAsync(new TenantsSuspendRequest { TenantId = "tenantId" }); + /// + public WithRawResponseTask SuspendAsync( + TenantsSuspendRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask(SuspendAsyncCore(request, options, cancellationToken)); + } + + /// + /// Facts only — no limits or billing state. Views count share exchanges plus authorized /v1/access grants, deduplicated across the two. + /// + /// + /// await client.Tenants.UsageAsync(new UsageTenantsRequest { TenantId = "tenantId" }); + /// + public WithRawResponseTask UsageAsync( + UsageTenantsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + UsageAsyncCore(request, options, cancellationToken) + ); + } } diff --git a/src/CloudPDF/Types/DocAnnotationsCreate400ResponseCode.cs b/src/CloudPDF/Types/DocAnnotationsCreate400ResponseCode.cs index ebed345..c030954 100644 --- a/src/CloudPDF/Types/DocAnnotationsCreate400ResponseCode.cs +++ b/src/CloudPDF/Types/DocAnnotationsCreate400ResponseCode.cs @@ -28,6 +28,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocAnnotationsCreate400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocAnnotationsCreate400ResponseCode Aborted = new(Values.Aborted); public static readonly DocAnnotationsCreate400ResponseCode Network = new(Values.Network); @@ -176,6 +180,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocAnnotationsCreate404ResponseCode.cs b/src/CloudPDF/Types/DocAnnotationsCreate404ResponseCode.cs index 1568cc1..92e3ea8 100644 --- a/src/CloudPDF/Types/DocAnnotationsCreate404ResponseCode.cs +++ b/src/CloudPDF/Types/DocAnnotationsCreate404ResponseCode.cs @@ -28,6 +28,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocAnnotationsCreate404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocAnnotationsCreate404ResponseCode Aborted = new(Values.Aborted); public static readonly DocAnnotationsCreate404ResponseCode Network = new(Values.Network); @@ -176,6 +180,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocAnnotationsDelete404ResponseCode.cs b/src/CloudPDF/Types/DocAnnotationsDelete404ResponseCode.cs index 2fa87e9..6bf46c4 100644 --- a/src/CloudPDF/Types/DocAnnotationsDelete404ResponseCode.cs +++ b/src/CloudPDF/Types/DocAnnotationsDelete404ResponseCode.cs @@ -28,6 +28,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocAnnotationsDelete404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocAnnotationsDelete404ResponseCode Aborted = new(Values.Aborted); public static readonly DocAnnotationsDelete404ResponseCode Network = new(Values.Network); @@ -176,6 +180,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocAnnotationsList200ResponseAnnotationsItemCaret.cs b/src/CloudPDF/Types/DocAnnotationsList200ResponseAnnotationsItemCaret.cs index 4edfd37..00b189d 100644 --- a/src/CloudPDF/Types/DocAnnotationsList200ResponseAnnotationsItemCaret.cs +++ b/src/CloudPDF/Types/DocAnnotationsList200ResponseAnnotationsItemCaret.cs @@ -80,6 +80,12 @@ public record DocAnnotationsList200ResponseAnnotationsItemCaret : IJsonOnDeseria [JsonPropertyName("rectDifferences")] public DocAnnotationsList200ResponseAnnotationsItemCaretRectDifferences? RectDifferences { get; set; } + [JsonPropertyName("rotation")] + public double? Rotation { get; set; } + + [JsonPropertyName("unrotatedRect")] + public DocAnnotationsList200ResponseAnnotationsItemCaretUnrotatedRect? UnrotatedRect { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocAnnotationsList200ResponseAnnotationsItemCaretUnrotatedRect.cs b/src/CloudPDF/Types/DocAnnotationsList200ResponseAnnotationsItemCaretUnrotatedRect.cs new file mode 100644 index 0000000..3d7cb83 --- /dev/null +++ b/src/CloudPDF/Types/DocAnnotationsList200ResponseAnnotationsItemCaretUnrotatedRect.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocAnnotationsList200ResponseAnnotationsItemCaretUnrotatedRect : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("left")] + public required double Left { get; set; } + + [JsonPropertyName("bottom")] + public required double Bottom { get; set; } + + [JsonPropertyName("right")] + public required double Right { get; set; } + + [JsonPropertyName("top")] + public required double Top { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Types/DocAnnotationsList404ResponseCode.cs b/src/CloudPDF/Types/DocAnnotationsList404ResponseCode.cs index 98cfeb3..9725db1 100644 --- a/src/CloudPDF/Types/DocAnnotationsList404ResponseCode.cs +++ b/src/CloudPDF/Types/DocAnnotationsList404ResponseCode.cs @@ -28,6 +28,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocAnnotationsList404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocAnnotationsList404ResponseCode Aborted = new(Values.Aborted); public static readonly DocAnnotationsList404ResponseCode Network = new(Values.Network); @@ -175,6 +179,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocAnnotationsUpdate400ResponseCode.cs b/src/CloudPDF/Types/DocAnnotationsUpdate400ResponseCode.cs index 81fd47a..93ee881 100644 --- a/src/CloudPDF/Types/DocAnnotationsUpdate400ResponseCode.cs +++ b/src/CloudPDF/Types/DocAnnotationsUpdate400ResponseCode.cs @@ -28,6 +28,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocAnnotationsUpdate400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocAnnotationsUpdate400ResponseCode Aborted = new(Values.Aborted); public static readonly DocAnnotationsUpdate400ResponseCode Network = new(Values.Network); @@ -176,6 +180,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocAnnotationsUpdate404ResponseCode.cs b/src/CloudPDF/Types/DocAnnotationsUpdate404ResponseCode.cs index 8324206..cd7feef 100644 --- a/src/CloudPDF/Types/DocAnnotationsUpdate404ResponseCode.cs +++ b/src/CloudPDF/Types/DocAnnotationsUpdate404ResponseCode.cs @@ -28,6 +28,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocAnnotationsUpdate404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocAnnotationsUpdate404ResponseCode Aborted = new(Values.Aborted); public static readonly DocAnnotationsUpdate404ResponseCode Network = new(Values.Network); @@ -176,6 +180,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocDownloadResponseCode.cs b/src/CloudPDF/Types/DocDownloadResponseCode.cs index 82efa4e..3b99489 100644 --- a/src/CloudPDF/Types/DocDownloadResponseCode.cs +++ b/src/CloudPDF/Types/DocDownloadResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocDownloadResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocDownloadResponseCode Aborted = new(Values.Aborted); public static readonly DocDownloadResponseCode Network = new(Values.Network); @@ -162,6 +166,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocFormsExportDataResponseCode.cs b/src/CloudPDF/Types/DocFormsExportDataResponseCode.cs index c6c760e..ad558d4 100644 --- a/src/CloudPDF/Types/DocFormsExportDataResponseCode.cs +++ b/src/CloudPDF/Types/DocFormsExportDataResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocFormsExportDataResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocFormsExportDataResponseCode Aborted = new(Values.Aborted); public static readonly DocFormsExportDataResponseCode Network = new(Values.Network); @@ -169,6 +173,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocFormsGet404ResponseCode.cs b/src/CloudPDF/Types/DocFormsGet404ResponseCode.cs index 6d4817d..77e384f 100644 --- a/src/CloudPDF/Types/DocFormsGet404ResponseCode.cs +++ b/src/CloudPDF/Types/DocFormsGet404ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocFormsGet404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocFormsGet404ResponseCode Aborted = new(Values.Aborted); public static readonly DocFormsGet404ResponseCode Network = new(Values.Network); @@ -164,6 +168,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocFormsImportData400ResponseCode.cs b/src/CloudPDF/Types/DocFormsImportData400ResponseCode.cs index 769902e..addfe7c 100644 --- a/src/CloudPDF/Types/DocFormsImportData400ResponseCode.cs +++ b/src/CloudPDF/Types/DocFormsImportData400ResponseCode.cs @@ -28,6 +28,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocFormsImportData400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocFormsImportData400ResponseCode Aborted = new(Values.Aborted); public static readonly DocFormsImportData400ResponseCode Network = new(Values.Network); @@ -175,6 +179,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocFormsImportData404ResponseCode.cs b/src/CloudPDF/Types/DocFormsImportData404ResponseCode.cs index d2077b8..105ac74 100644 --- a/src/CloudPDF/Types/DocFormsImportData404ResponseCode.cs +++ b/src/CloudPDF/Types/DocFormsImportData404ResponseCode.cs @@ -28,6 +28,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocFormsImportData404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocFormsImportData404ResponseCode Aborted = new(Values.Aborted); public static readonly DocFormsImportData404ResponseCode Network = new(Values.Network); @@ -175,6 +179,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocFormsReset404ResponseCode.cs b/src/CloudPDF/Types/DocFormsReset404ResponseCode.cs index d67a2cb..471fa36 100644 --- a/src/CloudPDF/Types/DocFormsReset404ResponseCode.cs +++ b/src/CloudPDF/Types/DocFormsReset404ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocFormsReset404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocFormsReset404ResponseCode Aborted = new(Values.Aborted); public static readonly DocFormsReset404ResponseCode Network = new(Values.Network); @@ -167,6 +171,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocFormsSetValue400ResponseCode.cs b/src/CloudPDF/Types/DocFormsSetValue400ResponseCode.cs index 6df264d..c519c64 100644 --- a/src/CloudPDF/Types/DocFormsSetValue400ResponseCode.cs +++ b/src/CloudPDF/Types/DocFormsSetValue400ResponseCode.cs @@ -26,6 +26,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocFormsSetValue400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocFormsSetValue400ResponseCode Aborted = new(Values.Aborted); public static readonly DocFormsSetValue400ResponseCode Network = new(Values.Network); @@ -171,6 +175,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocFormsSetValue404ResponseCode.cs b/src/CloudPDF/Types/DocFormsSetValue404ResponseCode.cs index 0b6604d..c7837c2 100644 --- a/src/CloudPDF/Types/DocFormsSetValue404ResponseCode.cs +++ b/src/CloudPDF/Types/DocFormsSetValue404ResponseCode.cs @@ -26,6 +26,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocFormsSetValue404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocFormsSetValue404ResponseCode Aborted = new(Values.Aborted); public static readonly DocFormsSetValue404ResponseCode Network = new(Values.Network); @@ -171,6 +175,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocHead404ResponseCode.cs b/src/CloudPDF/Types/DocHead404ResponseCode.cs index d2bee14..a55c139 100644 --- a/src/CloudPDF/Types/DocHead404ResponseCode.cs +++ b/src/CloudPDF/Types/DocHead404ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocHead404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocHead404ResponseCode Aborted = new(Values.Aborted); public static readonly DocHead404ResponseCode Network = new(Values.Network); @@ -162,6 +166,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocManifest404ResponseCode.cs b/src/CloudPDF/Types/DocManifest404ResponseCode.cs index 47a6881..6c3b98b 100644 --- a/src/CloudPDF/Types/DocManifest404ResponseCode.cs +++ b/src/CloudPDF/Types/DocManifest404ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocManifest404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocManifest404ResponseCode Aborted = new(Values.Aborted); public static readonly DocManifest404ResponseCode Network = new(Values.Network); @@ -164,6 +168,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocMetadataGet404ResponseCode.cs b/src/CloudPDF/Types/DocMetadataGet404ResponseCode.cs index aeccf78..a68b3fa 100644 --- a/src/CloudPDF/Types/DocMetadataGet404ResponseCode.cs +++ b/src/CloudPDF/Types/DocMetadataGet404ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocMetadataGet404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocMetadataGet404ResponseCode Aborted = new(Values.Aborted); public static readonly DocMetadataGet404ResponseCode Network = new(Values.Network); @@ -169,6 +173,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocPagesDelete400ResponseCode.cs b/src/CloudPDF/Types/DocPagesDelete400ResponseCode.cs index 2d83df5..1d35117 100644 --- a/src/CloudPDF/Types/DocPagesDelete400ResponseCode.cs +++ b/src/CloudPDF/Types/DocPagesDelete400ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocPagesDelete400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocPagesDelete400ResponseCode Aborted = new(Values.Aborted); public static readonly DocPagesDelete400ResponseCode Network = new(Values.Network); @@ -169,6 +173,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocPagesDelete404ResponseCode.cs b/src/CloudPDF/Types/DocPagesDelete404ResponseCode.cs index 3953b8d..a1edac5 100644 --- a/src/CloudPDF/Types/DocPagesDelete404ResponseCode.cs +++ b/src/CloudPDF/Types/DocPagesDelete404ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocPagesDelete404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocPagesDelete404ResponseCode Aborted = new(Values.Aborted); public static readonly DocPagesDelete404ResponseCode Network = new(Values.Network); @@ -169,6 +173,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocPagesFlatten400ResponseCode.cs b/src/CloudPDF/Types/DocPagesFlatten400ResponseCode.cs index c3653af..e6b035a 100644 --- a/src/CloudPDF/Types/DocPagesFlatten400ResponseCode.cs +++ b/src/CloudPDF/Types/DocPagesFlatten400ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocPagesFlatten400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocPagesFlatten400ResponseCode Aborted = new(Values.Aborted); public static readonly DocPagesFlatten400ResponseCode Network = new(Values.Network); @@ -169,6 +173,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocPagesFlatten404ResponseCode.cs b/src/CloudPDF/Types/DocPagesFlatten404ResponseCode.cs index 9a71087..a4de8ec 100644 --- a/src/CloudPDF/Types/DocPagesFlatten404ResponseCode.cs +++ b/src/CloudPDF/Types/DocPagesFlatten404ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocPagesFlatten404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocPagesFlatten404ResponseCode Aborted = new(Values.Aborted); public static readonly DocPagesFlatten404ResponseCode Network = new(Values.Network); @@ -169,6 +173,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocPagesMove400ResponseCode.cs b/src/CloudPDF/Types/DocPagesMove400ResponseCode.cs index e6d4729..09a964f 100644 --- a/src/CloudPDF/Types/DocPagesMove400ResponseCode.cs +++ b/src/CloudPDF/Types/DocPagesMove400ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocPagesMove400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocPagesMove400ResponseCode Aborted = new(Values.Aborted); public static readonly DocPagesMove400ResponseCode Network = new(Values.Network); @@ -167,6 +171,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocPagesMove404ResponseCode.cs b/src/CloudPDF/Types/DocPagesMove404ResponseCode.cs index 91a4551..64905a5 100644 --- a/src/CloudPDF/Types/DocPagesMove404ResponseCode.cs +++ b/src/CloudPDF/Types/DocPagesMove404ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocPagesMove404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocPagesMove404ResponseCode Aborted = new(Values.Aborted); public static readonly DocPagesMove404ResponseCode Network = new(Values.Network); @@ -167,6 +171,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocPagesRotate400ResponseCode.cs b/src/CloudPDF/Types/DocPagesRotate400ResponseCode.cs index b0a3a15..4ec60e7 100644 --- a/src/CloudPDF/Types/DocPagesRotate400ResponseCode.cs +++ b/src/CloudPDF/Types/DocPagesRotate400ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocPagesRotate400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocPagesRotate400ResponseCode Aborted = new(Values.Aborted); public static readonly DocPagesRotate400ResponseCode Network = new(Values.Network); @@ -169,6 +173,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocPagesRotate404ResponseCode.cs b/src/CloudPDF/Types/DocPagesRotate404ResponseCode.cs index a2a075a..6992cc2 100644 --- a/src/CloudPDF/Types/DocPagesRotate404ResponseCode.cs +++ b/src/CloudPDF/Types/DocPagesRotate404ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocPagesRotate404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocPagesRotate404ResponseCode Aborted = new(Values.Aborted); public static readonly DocPagesRotate404ResponseCode Network = new(Values.Network); @@ -169,6 +173,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocRedactionsApply400ResponseCode.cs b/src/CloudPDF/Types/DocRedactionsApply400ResponseCode.cs index 214ca20..0bc54d1 100644 --- a/src/CloudPDF/Types/DocRedactionsApply400ResponseCode.cs +++ b/src/CloudPDF/Types/DocRedactionsApply400ResponseCode.cs @@ -28,6 +28,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocRedactionsApply400ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocRedactionsApply400ResponseCode Aborted = new(Values.Aborted); public static readonly DocRedactionsApply400ResponseCode Network = new(Values.Network); @@ -175,6 +179,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocRedactionsApply404ResponseCode.cs b/src/CloudPDF/Types/DocRedactionsApply404ResponseCode.cs index fdb4a9c..2e98937 100644 --- a/src/CloudPDF/Types/DocRedactionsApply404ResponseCode.cs +++ b/src/CloudPDF/Types/DocRedactionsApply404ResponseCode.cs @@ -28,6 +28,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocRedactionsApply404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocRedactionsApply404ResponseCode Aborted = new(Values.Aborted); public static readonly DocRedactionsApply404ResponseCode Network = new(Values.Network); @@ -175,6 +179,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocRenderResponseCode.cs b/src/CloudPDF/Types/DocRenderResponseCode.cs index a666a2b..2687239 100644 --- a/src/CloudPDF/Types/DocRenderResponseCode.cs +++ b/src/CloudPDF/Types/DocRenderResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocRenderResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocRenderResponseCode Aborted = new(Values.Aborted); public static readonly DocRenderResponseCode Network = new(Values.Network); @@ -162,6 +166,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocText200Response.cs b/src/CloudPDF/Types/DocText200Response.cs index 2ffa9c2..9c6a313 100644 --- a/src/CloudPDF/Types/DocText200Response.cs +++ b/src/CloudPDF/Types/DocText200Response.cs @@ -17,6 +17,9 @@ public record DocText200Response : IJsonOnDeserialized [JsonPropertyName("charCount")] public required int CharCount { get; set; } + [JsonPropertyName("charMap")] + public IEnumerable>? CharMap { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocText404ResponseCode.cs b/src/CloudPDF/Types/DocText404ResponseCode.cs index a3f3318..ce9ca0e 100644 --- a/src/CloudPDF/Types/DocText404ResponseCode.cs +++ b/src/CloudPDF/Types/DocText404ResponseCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly DocText404ResponseCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly DocText404ResponseCode Aborted = new(Values.Aborted); public static readonly DocText404ResponseCode Network = new(Values.Network); @@ -162,6 +166,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/DocumentsInit200ResponseCreatedUpload.cs b/src/CloudPDF/Types/DocumentsInit200ResponseCreatedUpload.cs index a7c7f21..58c32c1 100644 --- a/src/CloudPDF/Types/DocumentsInit200ResponseCreatedUpload.cs +++ b/src/CloudPDF/Types/DocumentsInit200ResponseCreatedUpload.cs @@ -30,11 +30,11 @@ DocumentsInit200ResponseCreatedUpload.Presigned value } /// - /// Create an instance of DocumentsInit200ResponseCreatedUpload with . + /// Create an instance of DocumentsInit200ResponseCreatedUpload with . /// - public DocumentsInit200ResponseCreatedUpload(DocumentsInit200ResponseCreatedUpload.Direct value) + public DocumentsInit200ResponseCreatedUpload(DocumentsInit200ResponseCreatedUpload.Proxy value) { - Kind = "direct"; + Kind = "proxy"; Value = value.Value; } @@ -55,9 +55,9 @@ public DocumentsInit200ResponseCreatedUpload(DocumentsInit200ResponseCreatedUplo public bool IsPresigned => Kind == "presigned"; /// - /// Returns true if is "direct" + /// Returns true if is "proxy" /// - public bool IsDirect => Kind == "direct"; + public bool IsProxy => Kind == "proxy"; /// /// Returns the value as a if is 'presigned', otherwise throws an exception. @@ -71,33 +71,33 @@ public CloudPDF.DocumentsInit200ResponseCreatedUploadPresigned AsPresigned() => ); /// - /// Returns the value as a if is 'direct', otherwise throws an exception. + /// Returns the value as a if is 'proxy', otherwise throws an exception. /// - /// Thrown when is not 'direct'. - public CloudPDF.DocumentsInit200ResponseCreatedUploadDirect AsDirect() => - IsDirect - ? (CloudPDF.DocumentsInit200ResponseCreatedUploadDirect)Value! + /// Thrown when is not 'proxy'. + public CloudPDF.DocumentsInit200ResponseCreatedUploadProxy AsProxy() => + IsProxy + ? (CloudPDF.DocumentsInit200ResponseCreatedUploadProxy)Value! : throw new global::System.Exception( - "DocumentsInit200ResponseCreatedUpload.Kind is not 'direct'" + "DocumentsInit200ResponseCreatedUpload.Kind is not 'proxy'" ); public T Match( Func onPresigned, - Func onDirect, + Func onProxy, Func onUnknown_ ) { return Kind switch { "presigned" => onPresigned(AsPresigned()), - "direct" => onDirect(AsDirect()), + "proxy" => onProxy(AsProxy()), _ => onUnknown_(Kind, Value), }; } public void Visit( Action onPresigned, - Action onDirect, + Action onProxy, Action onUnknown_ ) { @@ -106,8 +106,8 @@ public void Visit( case "presigned": onPresigned(AsPresigned()); break; - case "direct": - onDirect(AsDirect()); + case "proxy": + onProxy(AsProxy()); break; default: onUnknown_(Kind, Value); @@ -130,13 +130,13 @@ public bool TryAsPresigned(out CloudPDF.DocumentsInit200ResponseCreatedUploadPre } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// - public bool TryAsDirect(out CloudPDF.DocumentsInit200ResponseCreatedUploadDirect? value) + public bool TryAsProxy(out CloudPDF.DocumentsInit200ResponseCreatedUploadProxy? value) { - if (Kind == "direct") + if (Kind == "proxy") { - value = (CloudPDF.DocumentsInit200ResponseCreatedUploadDirect)Value!; + value = (CloudPDF.DocumentsInit200ResponseCreatedUploadProxy)Value!; return true; } value = null; @@ -150,7 +150,7 @@ DocumentsInit200ResponseCreatedUpload.Presigned value ) => new(value); public static implicit operator DocumentsInit200ResponseCreatedUpload( - DocumentsInit200ResponseCreatedUpload.Direct value + DocumentsInit200ResponseCreatedUpload.Proxy value ) => new(value); [Serializable] @@ -201,12 +201,12 @@ JsonSerializerOptions options ?? throw new JsonException( "Failed to deserialize CloudPDF.DocumentsInit200ResponseCreatedUploadPresigned" ), - "direct" => - jsonWithoutDiscriminator.Deserialize( + "proxy" => + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocumentsInit200ResponseCreatedUploadDirect" + "Failed to deserialize CloudPDF.DocumentsInit200ResponseCreatedUploadProxy" ), _ => json.Deserialize(options), }; @@ -223,7 +223,7 @@ JsonSerializerOptions options value.Kind switch { "presigned" => JsonSerializer.SerializeToNode(value.Value, options), - "direct" => JsonSerializer.SerializeToNode(value.Value, options), + "proxy" => JsonSerializer.SerializeToNode(value.Value, options), _ => JsonSerializer.SerializeToNode(value.Value, options), } ?? new JsonObject(); json["kind"] = value.Kind; @@ -273,22 +273,22 @@ CloudPDF.DocumentsInit200ResponseCreatedUploadPresigned value } /// - /// Discriminated union type for direct + /// Discriminated union type for proxy /// [Serializable] - public struct Direct + public struct Proxy { - public Direct(CloudPDF.DocumentsInit200ResponseCreatedUploadDirect value) + public Proxy(CloudPDF.DocumentsInit200ResponseCreatedUploadProxy value) { Value = value; } - internal CloudPDF.DocumentsInit200ResponseCreatedUploadDirect Value { get; set; } + internal CloudPDF.DocumentsInit200ResponseCreatedUploadProxy Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocumentsInit200ResponseCreatedUpload.Direct( - CloudPDF.DocumentsInit200ResponseCreatedUploadDirect value + public static implicit operator DocumentsInit200ResponseCreatedUpload.Proxy( + CloudPDF.DocumentsInit200ResponseCreatedUploadProxy value ) => new(value); } } diff --git a/src/CloudPDF/Types/DocumentsInit200ResponseCreatedUploadDirect.cs b/src/CloudPDF/Types/DocumentsInit200ResponseCreatedUploadProxy.cs similarity index 90% rename from src/CloudPDF/Types/DocumentsInit200ResponseCreatedUploadDirect.cs rename to src/CloudPDF/Types/DocumentsInit200ResponseCreatedUploadProxy.cs index c1066cc..5f5343c 100644 --- a/src/CloudPDF/Types/DocumentsInit200ResponseCreatedUploadDirect.cs +++ b/src/CloudPDF/Types/DocumentsInit200ResponseCreatedUploadProxy.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocumentsInit200ResponseCreatedUploadDirect : IJsonOnDeserialized +public record DocumentsInit200ResponseCreatedUploadProxy : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocumentsInit200ResponseResumedUpload.cs b/src/CloudPDF/Types/DocumentsInit200ResponseResumedUpload.cs index a1b31db..56e51d5 100644 --- a/src/CloudPDF/Types/DocumentsInit200ResponseResumedUpload.cs +++ b/src/CloudPDF/Types/DocumentsInit200ResponseResumedUpload.cs @@ -30,11 +30,11 @@ DocumentsInit200ResponseResumedUpload.Presigned value } /// - /// Create an instance of DocumentsInit200ResponseResumedUpload with . + /// Create an instance of DocumentsInit200ResponseResumedUpload with . /// - public DocumentsInit200ResponseResumedUpload(DocumentsInit200ResponseResumedUpload.Direct value) + public DocumentsInit200ResponseResumedUpload(DocumentsInit200ResponseResumedUpload.Proxy value) { - Kind = "direct"; + Kind = "proxy"; Value = value.Value; } @@ -55,9 +55,9 @@ public DocumentsInit200ResponseResumedUpload(DocumentsInit200ResponseResumedUplo public bool IsPresigned => Kind == "presigned"; /// - /// Returns true if is "direct" + /// Returns true if is "proxy" /// - public bool IsDirect => Kind == "direct"; + public bool IsProxy => Kind == "proxy"; /// /// Returns the value as a if is 'presigned', otherwise throws an exception. @@ -71,33 +71,33 @@ public CloudPDF.DocumentsInit200ResponseResumedUploadPresigned AsPresigned() => ); /// - /// Returns the value as a if is 'direct', otherwise throws an exception. + /// Returns the value as a if is 'proxy', otherwise throws an exception. /// - /// Thrown when is not 'direct'. - public CloudPDF.DocumentsInit200ResponseResumedUploadDirect AsDirect() => - IsDirect - ? (CloudPDF.DocumentsInit200ResponseResumedUploadDirect)Value! + /// Thrown when is not 'proxy'. + public CloudPDF.DocumentsInit200ResponseResumedUploadProxy AsProxy() => + IsProxy + ? (CloudPDF.DocumentsInit200ResponseResumedUploadProxy)Value! : throw new global::System.Exception( - "DocumentsInit200ResponseResumedUpload.Kind is not 'direct'" + "DocumentsInit200ResponseResumedUpload.Kind is not 'proxy'" ); public T Match( Func onPresigned, - Func onDirect, + Func onProxy, Func onUnknown_ ) { return Kind switch { "presigned" => onPresigned(AsPresigned()), - "direct" => onDirect(AsDirect()), + "proxy" => onProxy(AsProxy()), _ => onUnknown_(Kind, Value), }; } public void Visit( Action onPresigned, - Action onDirect, + Action onProxy, Action onUnknown_ ) { @@ -106,8 +106,8 @@ public void Visit( case "presigned": onPresigned(AsPresigned()); break; - case "direct": - onDirect(AsDirect()); + case "proxy": + onProxy(AsProxy()); break; default: onUnknown_(Kind, Value); @@ -130,13 +130,13 @@ public bool TryAsPresigned(out CloudPDF.DocumentsInit200ResponseResumedUploadPre } /// - /// Attempts to cast the value to a and returns true if successful. + /// Attempts to cast the value to a and returns true if successful. /// - public bool TryAsDirect(out CloudPDF.DocumentsInit200ResponseResumedUploadDirect? value) + public bool TryAsProxy(out CloudPDF.DocumentsInit200ResponseResumedUploadProxy? value) { - if (Kind == "direct") + if (Kind == "proxy") { - value = (CloudPDF.DocumentsInit200ResponseResumedUploadDirect)Value!; + value = (CloudPDF.DocumentsInit200ResponseResumedUploadProxy)Value!; return true; } value = null; @@ -150,7 +150,7 @@ DocumentsInit200ResponseResumedUpload.Presigned value ) => new(value); public static implicit operator DocumentsInit200ResponseResumedUpload( - DocumentsInit200ResponseResumedUpload.Direct value + DocumentsInit200ResponseResumedUpload.Proxy value ) => new(value); [Serializable] @@ -201,12 +201,12 @@ JsonSerializerOptions options ?? throw new JsonException( "Failed to deserialize CloudPDF.DocumentsInit200ResponseResumedUploadPresigned" ), - "direct" => - jsonWithoutDiscriminator.Deserialize( + "proxy" => + jsonWithoutDiscriminator.Deserialize( options ) ?? throw new JsonException( - "Failed to deserialize CloudPDF.DocumentsInit200ResponseResumedUploadDirect" + "Failed to deserialize CloudPDF.DocumentsInit200ResponseResumedUploadProxy" ), _ => json.Deserialize(options), }; @@ -223,7 +223,7 @@ JsonSerializerOptions options value.Kind switch { "presigned" => JsonSerializer.SerializeToNode(value.Value, options), - "direct" => JsonSerializer.SerializeToNode(value.Value, options), + "proxy" => JsonSerializer.SerializeToNode(value.Value, options), _ => JsonSerializer.SerializeToNode(value.Value, options), } ?? new JsonObject(); json["kind"] = value.Kind; @@ -273,22 +273,22 @@ CloudPDF.DocumentsInit200ResponseResumedUploadPresigned value } /// - /// Discriminated union type for direct + /// Discriminated union type for proxy /// [Serializable] - public struct Direct + public struct Proxy { - public Direct(CloudPDF.DocumentsInit200ResponseResumedUploadDirect value) + public Proxy(CloudPDF.DocumentsInit200ResponseResumedUploadProxy value) { Value = value; } - internal CloudPDF.DocumentsInit200ResponseResumedUploadDirect Value { get; set; } + internal CloudPDF.DocumentsInit200ResponseResumedUploadProxy Value { get; set; } public override string ToString() => Value.ToString() ?? "null"; - public static implicit operator DocumentsInit200ResponseResumedUpload.Direct( - CloudPDF.DocumentsInit200ResponseResumedUploadDirect value + public static implicit operator DocumentsInit200ResponseResumedUpload.Proxy( + CloudPDF.DocumentsInit200ResponseResumedUploadProxy value ) => new(value); } } diff --git a/src/CloudPDF/Types/DocumentsInit200ResponseResumedUploadDirect.cs b/src/CloudPDF/Types/DocumentsInit200ResponseResumedUploadProxy.cs similarity index 90% rename from src/CloudPDF/Types/DocumentsInit200ResponseResumedUploadDirect.cs rename to src/CloudPDF/Types/DocumentsInit200ResponseResumedUploadProxy.cs index 3fa4521..14c9f14 100644 --- a/src/CloudPDF/Types/DocumentsInit200ResponseResumedUploadDirect.cs +++ b/src/CloudPDF/Types/DocumentsInit200ResponseResumedUploadProxy.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocumentsInit200ResponseResumedUploadDirect : IJsonOnDeserialized +public record DocumentsInit200ResponseResumedUploadProxy : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocumentsUploadDirect200Response.cs b/src/CloudPDF/Types/DocumentsUploadProxy200Response.cs similarity index 91% rename from src/CloudPDF/Types/DocumentsUploadDirect200Response.cs rename to src/CloudPDF/Types/DocumentsUploadProxy200Response.cs index 94a35b5..0d0dc85 100644 --- a/src/CloudPDF/Types/DocumentsUploadDirect200Response.cs +++ b/src/CloudPDF/Types/DocumentsUploadProxy200Response.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocumentsUploadDirect200Response : IJsonOnDeserialized +public record DocumentsUploadProxy200Response : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocumentsUploadDirect400Response.cs b/src/CloudPDF/Types/DocumentsUploadProxy400Response.cs similarity index 81% rename from src/CloudPDF/Types/DocumentsUploadDirect400Response.cs rename to src/CloudPDF/Types/DocumentsUploadProxy400Response.cs index 3ca3d62..08aaf70 100644 --- a/src/CloudPDF/Types/DocumentsUploadDirect400Response.cs +++ b/src/CloudPDF/Types/DocumentsUploadProxy400Response.cs @@ -5,14 +5,14 @@ namespace CloudPDF; [Serializable] -public record DocumentsUploadDirect400Response : IJsonOnDeserialized +public record DocumentsUploadProxy400Response : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = new Dictionary(); [JsonPropertyName("error")] - public required DocumentsUploadDirect400ResponseError Error { get; set; } + public required DocumentsUploadProxy400ResponseError Error { get; set; } [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocumentsUploadDirect400ResponseError.cs b/src/CloudPDF/Types/DocumentsUploadProxy400ResponseError.cs similarity index 91% rename from src/CloudPDF/Types/DocumentsUploadDirect400ResponseError.cs rename to src/CloudPDF/Types/DocumentsUploadProxy400ResponseError.cs index 95c2644..5c0ab79 100644 --- a/src/CloudPDF/Types/DocumentsUploadDirect400ResponseError.cs +++ b/src/CloudPDF/Types/DocumentsUploadProxy400ResponseError.cs @@ -5,7 +5,7 @@ namespace CloudPDF; [Serializable] -public record DocumentsUploadDirect400ResponseError : IJsonOnDeserialized +public record DocumentsUploadProxy400ResponseError : IJsonOnDeserialized { [JsonExtensionData] private readonly IDictionary _extensionData = diff --git a/src/CloudPDF/Types/DocumentsUploadProxy409Response.cs b/src/CloudPDF/Types/DocumentsUploadProxy409Response.cs new file mode 100644 index 0000000..c68a6f5 --- /dev/null +++ b/src/CloudPDF/Types/DocumentsUploadProxy409Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocumentsUploadProxy409Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required DocumentsUploadProxy409ResponseError Error { 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/DocumentsUploadProxy409ResponseError.cs b/src/CloudPDF/Types/DocumentsUploadProxy409ResponseError.cs new file mode 100644 index 0000000..beb1219 --- /dev/null +++ b/src/CloudPDF/Types/DocumentsUploadProxy409ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocumentsUploadProxy409ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/EngineErrorPayloadCode.cs b/src/CloudPDF/Types/EngineErrorPayloadCode.cs index 4e23f94..b222462 100644 --- a/src/CloudPDF/Types/EngineErrorPayloadCode.cs +++ b/src/CloudPDF/Types/EngineErrorPayloadCode.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.DocPasswordIncorrect ); + public static readonly EngineErrorPayloadCode SharePasswordRequired = new( + Values.SharePasswordRequired + ); + public static readonly EngineErrorPayloadCode Aborted = new(Values.Aborted); public static readonly EngineErrorPayloadCode Network = new(Values.Network); @@ -162,6 +166,8 @@ public static class Values public const string DocPasswordIncorrect = "DocPasswordIncorrect"; + public const string SharePasswordRequired = "SharePasswordRequired"; + public const string Aborted = "Aborted"; public const string Network = "Network"; diff --git a/src/CloudPDF/Types/SharesCreate200Response.cs b/src/CloudPDF/Types/SharesCreate200Response.cs new file mode 100644 index 0000000..6260591 --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate200Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesCreate200Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("share")] + public required SharesCreate200ResponseShare Share { 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/SharesCreate200ResponseShare.cs b/src/CloudPDF/Types/SharesCreate200ResponseShare.cs new file mode 100644 index 0000000..676e262 --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate200ResponseShare.cs @@ -0,0 +1,70 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesCreate200ResponseShare : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("id")] + public required string Id { get; set; } + + [JsonPropertyName("tenantId")] + public required string TenantId { get; set; } + + [JsonPropertyName("docId")] + public required string DocId { get; set; } + + [JsonPropertyName("layerName")] + public required string LayerName { get; set; } + + [JsonPropertyName("scope")] + public IEnumerable Scope { get; set; } = new List(); + + [JsonPropertyName("origins")] + public IEnumerable? Origins { get; set; } + + [JsonPropertyName("passwordProtected")] + public required bool PasswordProtected { get; set; } + + [JsonPropertyName("sessionTtlSeconds")] + public required double SessionTtlSeconds { get; set; } + + [JsonPropertyName("disabled")] + public required bool Disabled { get; set; } + + [JsonPropertyName("expiresAt")] + public double? ExpiresAt { get; set; } + + [JsonPropertyName("exchangeCount")] + public required double ExchangeCount { get; set; } + + [JsonPropertyName("lastExchangedAt")] + public double? LastExchangedAt { get; set; } + + [JsonPropertyName("createdBy")] + public required string CreatedBy { get; set; } + + [JsonPropertyName("createdAt")] + public required double CreatedAt { get; set; } + + [JsonPropertyName("updatedAt")] + public required double UpdatedAt { 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/SharesCreate400Response.cs b/src/CloudPDF/Types/SharesCreate400Response.cs new file mode 100644 index 0000000..90cd87c --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate400Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesCreate400Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required SharesCreate400ResponseError Error { 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/SharesCreate400ResponseError.cs b/src/CloudPDF/Types/SharesCreate400ResponseError.cs new file mode 100644 index 0000000..efcc545 --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate400ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesCreate400ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/SharesCreate403Response.cs b/src/CloudPDF/Types/SharesCreate403Response.cs new file mode 100644 index 0000000..7aa33d8 --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate403Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesCreate403Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required SharesCreate403ResponseError Error { 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/SharesCreate403ResponseError.cs b/src/CloudPDF/Types/SharesCreate403ResponseError.cs new file mode 100644 index 0000000..7c5a98c --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate403ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesCreate403ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/SharesCreate404Response.cs b/src/CloudPDF/Types/SharesCreate404Response.cs new file mode 100644 index 0000000..8502bc1 --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate404Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesCreate404Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required SharesCreate404ResponseError Error { 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/SharesCreate404ResponseError.cs b/src/CloudPDF/Types/SharesCreate404ResponseError.cs new file mode 100644 index 0000000..bb6c369 --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate404ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesCreate404ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/SharesDeleteResponse.cs b/src/CloudPDF/Types/SharesDeleteResponse.cs new file mode 100644 index 0000000..9ba262c --- /dev/null +++ b/src/CloudPDF/Types/SharesDeleteResponse.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesDeleteResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required SharesDeleteResponseError Error { 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/SharesDeleteResponseError.cs b/src/CloudPDF/Types/SharesDeleteResponseError.cs new file mode 100644 index 0000000..fd0fd57 --- /dev/null +++ b/src/CloudPDF/Types/SharesDeleteResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesDeleteResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/SharesExchange200Response.cs b/src/CloudPDF/Types/SharesExchange200Response.cs new file mode 100644 index 0000000..99ace16 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange200Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange200Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("token")] + public required string Token { get; set; } + + [JsonPropertyName("docId")] + public required string DocId { get; set; } + + [JsonPropertyName("layerName")] + public required string LayerName { get; set; } + + [JsonPropertyName("expiresAt")] + public required double ExpiresAt { 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/SharesExchange400Response.cs b/src/CloudPDF/Types/SharesExchange400Response.cs new file mode 100644 index 0000000..b9295a0 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange400Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange400Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required SharesExchange400ResponseError Error { 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/SharesExchange400ResponseError.cs b/src/CloudPDF/Types/SharesExchange400ResponseError.cs new file mode 100644 index 0000000..33c7588 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange400ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange400ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/SharesExchange403Response.cs b/src/CloudPDF/Types/SharesExchange403Response.cs new file mode 100644 index 0000000..a969f73 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange403Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange403Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required SharesExchange403ResponseError Error { 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/SharesExchange403ResponseError.cs b/src/CloudPDF/Types/SharesExchange403ResponseError.cs new file mode 100644 index 0000000..6ac0623 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange403ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange403ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/SharesExchange404Response.cs b/src/CloudPDF/Types/SharesExchange404Response.cs new file mode 100644 index 0000000..e605a53 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange404Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange404Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required SharesExchange404ResponseError Error { 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/SharesExchange404ResponseError.cs b/src/CloudPDF/Types/SharesExchange404ResponseError.cs new file mode 100644 index 0000000..4a21e5d --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange404ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange404ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/SharesExchange410Response.cs b/src/CloudPDF/Types/SharesExchange410Response.cs new file mode 100644 index 0000000..a0ac1ea --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange410Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange410Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required SharesExchange410ResponseError Error { 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/SharesExchange410ResponseError.cs b/src/CloudPDF/Types/SharesExchange410ResponseError.cs new file mode 100644 index 0000000..bb35b8b --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange410ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange410ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/SharesExchange422Response.cs b/src/CloudPDF/Types/SharesExchange422Response.cs new file mode 100644 index 0000000..8666b18 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange422Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange422Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required SharesExchange422ResponseError Error { 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/SharesExchange422ResponseError.cs b/src/CloudPDF/Types/SharesExchange422ResponseError.cs new file mode 100644 index 0000000..1da07e7 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange422ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange422ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/SharesGet200Response.cs b/src/CloudPDF/Types/SharesGet200Response.cs new file mode 100644 index 0000000..805c3b1 --- /dev/null +++ b/src/CloudPDF/Types/SharesGet200Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesGet200Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("share")] + public required SharesGet200ResponseShare Share { 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/SharesGet200ResponseShare.cs b/src/CloudPDF/Types/SharesGet200ResponseShare.cs new file mode 100644 index 0000000..f2e47f3 --- /dev/null +++ b/src/CloudPDF/Types/SharesGet200ResponseShare.cs @@ -0,0 +1,70 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesGet200ResponseShare : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("id")] + public required string Id { get; set; } + + [JsonPropertyName("tenantId")] + public required string TenantId { get; set; } + + [JsonPropertyName("docId")] + public required string DocId { get; set; } + + [JsonPropertyName("layerName")] + public required string LayerName { get; set; } + + [JsonPropertyName("scope")] + public IEnumerable Scope { get; set; } = new List(); + + [JsonPropertyName("origins")] + public IEnumerable? Origins { get; set; } + + [JsonPropertyName("passwordProtected")] + public required bool PasswordProtected { get; set; } + + [JsonPropertyName("sessionTtlSeconds")] + public required double SessionTtlSeconds { get; set; } + + [JsonPropertyName("disabled")] + public required bool Disabled { get; set; } + + [JsonPropertyName("expiresAt")] + public double? ExpiresAt { get; set; } + + [JsonPropertyName("exchangeCount")] + public required double ExchangeCount { get; set; } + + [JsonPropertyName("lastExchangedAt")] + public double? LastExchangedAt { get; set; } + + [JsonPropertyName("createdBy")] + public required string CreatedBy { get; set; } + + [JsonPropertyName("createdAt")] + public required double CreatedAt { get; set; } + + [JsonPropertyName("updatedAt")] + public required double UpdatedAt { 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/SharesGet404Response.cs b/src/CloudPDF/Types/SharesGet404Response.cs new file mode 100644 index 0000000..538a820 --- /dev/null +++ b/src/CloudPDF/Types/SharesGet404Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesGet404Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required SharesGet404ResponseError Error { 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/SharesGet404ResponseError.cs b/src/CloudPDF/Types/SharesGet404ResponseError.cs new file mode 100644 index 0000000..57626aa --- /dev/null +++ b/src/CloudPDF/Types/SharesGet404ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesGet404ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/SharesList200Response.cs b/src/CloudPDF/Types/SharesList200Response.cs new file mode 100644 index 0000000..595e31d --- /dev/null +++ b/src/CloudPDF/Types/SharesList200Response.cs @@ -0,0 +1,32 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesList200Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("shares")] + public IEnumerable Shares { get; set; } = + new List(); + + [JsonPropertyName("nextCursor")] + public string? NextCursor { 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/SharesList200ResponseSharesItem.cs b/src/CloudPDF/Types/SharesList200ResponseSharesItem.cs new file mode 100644 index 0000000..793510e --- /dev/null +++ b/src/CloudPDF/Types/SharesList200ResponseSharesItem.cs @@ -0,0 +1,70 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesList200ResponseSharesItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("id")] + public required string Id { get; set; } + + [JsonPropertyName("tenantId")] + public required string TenantId { get; set; } + + [JsonPropertyName("docId")] + public required string DocId { get; set; } + + [JsonPropertyName("layerName")] + public required string LayerName { get; set; } + + [JsonPropertyName("scope")] + public IEnumerable Scope { get; set; } = new List(); + + [JsonPropertyName("origins")] + public IEnumerable? Origins { get; set; } + + [JsonPropertyName("passwordProtected")] + public required bool PasswordProtected { get; set; } + + [JsonPropertyName("sessionTtlSeconds")] + public required double SessionTtlSeconds { get; set; } + + [JsonPropertyName("disabled")] + public required bool Disabled { get; set; } + + [JsonPropertyName("expiresAt")] + public double? ExpiresAt { get; set; } + + [JsonPropertyName("exchangeCount")] + public required double ExchangeCount { get; set; } + + [JsonPropertyName("lastExchangedAt")] + public double? LastExchangedAt { get; set; } + + [JsonPropertyName("createdBy")] + public required string CreatedBy { get; set; } + + [JsonPropertyName("createdAt")] + public required double CreatedAt { get; set; } + + [JsonPropertyName("updatedAt")] + public required double UpdatedAt { 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/SharesList400Response.cs b/src/CloudPDF/Types/SharesList400Response.cs new file mode 100644 index 0000000..6295d81 --- /dev/null +++ b/src/CloudPDF/Types/SharesList400Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesList400Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required SharesList400ResponseError Error { 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/SharesList400ResponseError.cs b/src/CloudPDF/Types/SharesList400ResponseError.cs new file mode 100644 index 0000000..7fe85f3 --- /dev/null +++ b/src/CloudPDF/Types/SharesList400ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesList400ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/SharesUpdate200Response.cs b/src/CloudPDF/Types/SharesUpdate200Response.cs new file mode 100644 index 0000000..8b0fa42 --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate200Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesUpdate200Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("share")] + public required SharesUpdate200ResponseShare Share { 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/SharesUpdate200ResponseShare.cs b/src/CloudPDF/Types/SharesUpdate200ResponseShare.cs new file mode 100644 index 0000000..2955ab1 --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate200ResponseShare.cs @@ -0,0 +1,70 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesUpdate200ResponseShare : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("id")] + public required string Id { get; set; } + + [JsonPropertyName("tenantId")] + public required string TenantId { get; set; } + + [JsonPropertyName("docId")] + public required string DocId { get; set; } + + [JsonPropertyName("layerName")] + public required string LayerName { get; set; } + + [JsonPropertyName("scope")] + public IEnumerable Scope { get; set; } = new List(); + + [JsonPropertyName("origins")] + public IEnumerable? Origins { get; set; } + + [JsonPropertyName("passwordProtected")] + public required bool PasswordProtected { get; set; } + + [JsonPropertyName("sessionTtlSeconds")] + public required double SessionTtlSeconds { get; set; } + + [JsonPropertyName("disabled")] + public required bool Disabled { get; set; } + + [JsonPropertyName("expiresAt")] + public double? ExpiresAt { get; set; } + + [JsonPropertyName("exchangeCount")] + public required double ExchangeCount { get; set; } + + [JsonPropertyName("lastExchangedAt")] + public double? LastExchangedAt { get; set; } + + [JsonPropertyName("createdBy")] + public required string CreatedBy { get; set; } + + [JsonPropertyName("createdAt")] + public required double CreatedAt { get; set; } + + [JsonPropertyName("updatedAt")] + public required double UpdatedAt { 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/SharesUpdate400Response.cs b/src/CloudPDF/Types/SharesUpdate400Response.cs new file mode 100644 index 0000000..89666b7 --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate400Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesUpdate400Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required SharesUpdate400ResponseError Error { 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/SharesUpdate400ResponseError.cs b/src/CloudPDF/Types/SharesUpdate400ResponseError.cs new file mode 100644 index 0000000..268caaa --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate400ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesUpdate400ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/SharesUpdate404Response.cs b/src/CloudPDF/Types/SharesUpdate404Response.cs new file mode 100644 index 0000000..4f807e4 --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate404Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesUpdate404Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required SharesUpdate404ResponseError Error { 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/SharesUpdate404ResponseError.cs b/src/CloudPDF/Types/SharesUpdate404ResponseError.cs new file mode 100644 index 0000000..52b9498 --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate404ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesUpdate404ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/TenantsCreate200ResponseTenant.cs b/src/CloudPDF/Types/TenantsCreate200ResponseTenant.cs index 9f02beb..a56f675 100644 --- a/src/CloudPDF/Types/TenantsCreate200ResponseTenant.cs +++ b/src/CloudPDF/Types/TenantsCreate200ResponseTenant.cs @@ -20,6 +20,9 @@ public record TenantsCreate200ResponseTenant : IJsonOnDeserialized [JsonPropertyName("autoProvisioned")] public required bool AutoProvisioned { get; set; } + [JsonPropertyName("status")] + public TenantsCreate200ResponseTenantStatus? Status { get; set; } + [JsonPropertyName("createdAt")] public required double CreatedAt { get; set; } diff --git a/src/CloudPDF/Types/TenantsCreate200ResponseTenantStatus.cs b/src/CloudPDF/Types/TenantsCreate200ResponseTenantStatus.cs new file mode 100644 index 0000000..baa8a96 --- /dev/null +++ b/src/CloudPDF/Types/TenantsCreate200ResponseTenantStatus.cs @@ -0,0 +1,120 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(TenantsCreate200ResponseTenantStatus.TenantsCreate200ResponseTenantStatusSerializer) +)] +[Serializable] +public readonly record struct TenantsCreate200ResponseTenantStatus : IStringEnum +{ + public static readonly TenantsCreate200ResponseTenantStatus Active = new(Values.Active); + + public static readonly TenantsCreate200ResponseTenantStatus Suspended = new(Values.Suspended); + + public TenantsCreate200ResponseTenantStatus(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static TenantsCreate200ResponseTenantStatus FromCustom(string value) + { + return new TenantsCreate200ResponseTenantStatus(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 ==(TenantsCreate200ResponseTenantStatus value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(TenantsCreate200ResponseTenantStatus value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(TenantsCreate200ResponseTenantStatus value) => + value.Value; + + public static explicit operator TenantsCreate200ResponseTenantStatus(string value) => + new(value); + + internal class TenantsCreate200ResponseTenantStatusSerializer + : JsonConverter + { + public override TenantsCreate200ResponseTenantStatus 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 TenantsCreate200ResponseTenantStatus(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + TenantsCreate200ResponseTenantStatus value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override TenantsCreate200ResponseTenantStatus 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 TenantsCreate200ResponseTenantStatus(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + TenantsCreate200ResponseTenantStatus value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Active = "active"; + + public const string Suspended = "suspended"; + } +} diff --git a/src/CloudPDF/Types/TenantsGet200ResponseTenant.cs b/src/CloudPDF/Types/TenantsGet200ResponseTenant.cs index bd219f6..069a913 100644 --- a/src/CloudPDF/Types/TenantsGet200ResponseTenant.cs +++ b/src/CloudPDF/Types/TenantsGet200ResponseTenant.cs @@ -20,6 +20,9 @@ public record TenantsGet200ResponseTenant : IJsonOnDeserialized [JsonPropertyName("autoProvisioned")] public required bool AutoProvisioned { get; set; } + [JsonPropertyName("status")] + public TenantsGet200ResponseTenantStatus? Status { get; set; } + [JsonPropertyName("createdAt")] public required double CreatedAt { get; set; } diff --git a/src/CloudPDF/Types/TenantsGet200ResponseTenantStatus.cs b/src/CloudPDF/Types/TenantsGet200ResponseTenantStatus.cs new file mode 100644 index 0000000..27f69be --- /dev/null +++ b/src/CloudPDF/Types/TenantsGet200ResponseTenantStatus.cs @@ -0,0 +1,118 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(TenantsGet200ResponseTenantStatus.TenantsGet200ResponseTenantStatusSerializer) +)] +[Serializable] +public readonly record struct TenantsGet200ResponseTenantStatus : IStringEnum +{ + public static readonly TenantsGet200ResponseTenantStatus Active = new(Values.Active); + + public static readonly TenantsGet200ResponseTenantStatus Suspended = new(Values.Suspended); + + public TenantsGet200ResponseTenantStatus(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static TenantsGet200ResponseTenantStatus FromCustom(string value) + { + return new TenantsGet200ResponseTenantStatus(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 ==(TenantsGet200ResponseTenantStatus value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(TenantsGet200ResponseTenantStatus value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(TenantsGet200ResponseTenantStatus value) => value.Value; + + public static explicit operator TenantsGet200ResponseTenantStatus(string value) => new(value); + + internal class TenantsGet200ResponseTenantStatusSerializer + : JsonConverter + { + public override TenantsGet200ResponseTenantStatus 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 TenantsGet200ResponseTenantStatus(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + TenantsGet200ResponseTenantStatus value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override TenantsGet200ResponseTenantStatus 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 TenantsGet200ResponseTenantStatus(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + TenantsGet200ResponseTenantStatus value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Active = "active"; + + public const string Suspended = "suspended"; + } +} diff --git a/src/CloudPDF/Types/TenantsList200ResponseTenantsItem.cs b/src/CloudPDF/Types/TenantsList200ResponseTenantsItem.cs index 731cd6d..b28757f 100644 --- a/src/CloudPDF/Types/TenantsList200ResponseTenantsItem.cs +++ b/src/CloudPDF/Types/TenantsList200ResponseTenantsItem.cs @@ -20,6 +20,9 @@ public record TenantsList200ResponseTenantsItem : IJsonOnDeserialized [JsonPropertyName("autoProvisioned")] public required bool AutoProvisioned { get; set; } + [JsonPropertyName("status")] + public TenantsList200ResponseTenantsItemStatus? Status { get; set; } + [JsonPropertyName("createdAt")] public required double CreatedAt { get; set; } diff --git a/src/CloudPDF/Types/TenantsList200ResponseTenantsItemStatus.cs b/src/CloudPDF/Types/TenantsList200ResponseTenantsItemStatus.cs new file mode 100644 index 0000000..0c86d6b --- /dev/null +++ b/src/CloudPDF/Types/TenantsList200ResponseTenantsItemStatus.cs @@ -0,0 +1,122 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(TenantsList200ResponseTenantsItemStatus.TenantsList200ResponseTenantsItemStatusSerializer) +)] +[Serializable] +public readonly record struct TenantsList200ResponseTenantsItemStatus : IStringEnum +{ + public static readonly TenantsList200ResponseTenantsItemStatus Active = new(Values.Active); + + public static readonly TenantsList200ResponseTenantsItemStatus Suspended = new( + Values.Suspended + ); + + public TenantsList200ResponseTenantsItemStatus(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static TenantsList200ResponseTenantsItemStatus FromCustom(string value) + { + return new TenantsList200ResponseTenantsItemStatus(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 ==(TenantsList200ResponseTenantsItemStatus value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(TenantsList200ResponseTenantsItemStatus value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(TenantsList200ResponseTenantsItemStatus value) => + value.Value; + + public static explicit operator TenantsList200ResponseTenantsItemStatus(string value) => + new(value); + + internal class TenantsList200ResponseTenantsItemStatusSerializer + : JsonConverter + { + public override TenantsList200ResponseTenantsItemStatus 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 TenantsList200ResponseTenantsItemStatus(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + TenantsList200ResponseTenantsItemStatus value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override TenantsList200ResponseTenantsItemStatus 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 TenantsList200ResponseTenantsItemStatus(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + TenantsList200ResponseTenantsItemStatus value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Active = "active"; + + public const string Suspended = "suspended"; + } +} diff --git a/src/CloudPDF/Types/TenantsResumeResponse.cs b/src/CloudPDF/Types/TenantsResumeResponse.cs new file mode 100644 index 0000000..1278638 --- /dev/null +++ b/src/CloudPDF/Types/TenantsResumeResponse.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record TenantsResumeResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required TenantsResumeResponseError Error { 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/TenantsResumeResponseError.cs b/src/CloudPDF/Types/TenantsResumeResponseError.cs new file mode 100644 index 0000000..d0e66c9 --- /dev/null +++ b/src/CloudPDF/Types/TenantsResumeResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record TenantsResumeResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/TenantsSuspendResponse.cs b/src/CloudPDF/Types/TenantsSuspendResponse.cs new file mode 100644 index 0000000..7810f9d --- /dev/null +++ b/src/CloudPDF/Types/TenantsSuspendResponse.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record TenantsSuspendResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required TenantsSuspendResponseError Error { 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/TenantsSuspendResponseError.cs b/src/CloudPDF/Types/TenantsSuspendResponseError.cs new file mode 100644 index 0000000..77c0785 --- /dev/null +++ b/src/CloudPDF/Types/TenantsSuspendResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record TenantsSuspendResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/TenantsUsage200Response.cs b/src/CloudPDF/Types/TenantsUsage200Response.cs new file mode 100644 index 0000000..09b0323 --- /dev/null +++ b/src/CloudPDF/Types/TenantsUsage200Response.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record TenantsUsage200Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("tenantId")] + public required string TenantId { get; set; } + + [JsonPropertyName("periodStart")] + public required string PeriodStart { get; set; } + + [JsonPropertyName("periodEnd")] + public required string PeriodEnd { get; set; } + + [JsonPropertyName("metrics")] + public required TenantsUsage200ResponseMetrics Metrics { 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/TenantsUsage200ResponseMetrics.cs b/src/CloudPDF/Types/TenantsUsage200ResponseMetrics.cs new file mode 100644 index 0000000..6d5575a --- /dev/null +++ b/src/CloudPDF/Types/TenantsUsage200ResponseMetrics.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record TenantsUsage200ResponseMetrics : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("pdf.views")] + public required double PdfViews { get; set; } + + [JsonPropertyName("pdf.uploads")] + public required double PdfUploads { get; set; } + + [JsonPropertyName("storage.bytes")] + public required double StorageBytes { 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/TenantsUsage400Response.cs b/src/CloudPDF/Types/TenantsUsage400Response.cs new file mode 100644 index 0000000..c4af9c8 --- /dev/null +++ b/src/CloudPDF/Types/TenantsUsage400Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record TenantsUsage400Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required TenantsUsage400ResponseError Error { 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/TenantsUsage400ResponseError.cs b/src/CloudPDF/Types/TenantsUsage400ResponseError.cs new file mode 100644 index 0000000..8711f12 --- /dev/null +++ b/src/CloudPDF/Types/TenantsUsage400ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record TenantsUsage400ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/TenantsUsage404Response.cs b/src/CloudPDF/Types/TenantsUsage404Response.cs new file mode 100644 index 0000000..7d5c977 --- /dev/null +++ b/src/CloudPDF/Types/TenantsUsage404Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record TenantsUsage404Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("error")] + public required TenantsUsage404ResponseError Error { 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/TenantsUsage404ResponseError.cs b/src/CloudPDF/Types/TenantsUsage404ResponseError.cs new file mode 100644 index 0000000..a4218d6 --- /dev/null +++ b/src/CloudPDF/Types/TenantsUsage404ResponseError.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record TenantsUsage404ResponseError : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("code")] + public required string Code { get; set; } + + [JsonPropertyName("message")] + public required string Message { 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/TokensIssueRequestDoc.cs b/src/CloudPDF/Types/TokensIssueRequestDoc.cs index 126f395..862e628 100644 --- a/src/CloudPDF/Types/TokensIssueRequestDoc.cs +++ b/src/CloudPDF/Types/TokensIssueRequestDoc.cs @@ -35,6 +35,9 @@ public record TokensIssueRequestDoc : IJsonOnDeserialized [JsonPropertyName("groups")] public IEnumerable? Groups { get; set; } + [JsonPropertyName("origins")] + public IEnumerable? Origins { get; set; } + [JsonPropertyName("expiresIn")] public required int ExpiresIn { get; set; } diff --git a/src/CloudPDF/Types/TokensIssueRequestTenantScopeItemOne.cs b/src/CloudPDF/Types/TokensIssueRequestTenantScopeItemOne.cs index 64dcd26..edb53b8 100644 --- a/src/CloudPDF/Types/TokensIssueRequestTenantScopeItemOne.cs +++ b/src/CloudPDF/Types/TokensIssueRequestTenantScopeItemOne.cs @@ -24,6 +24,10 @@ namespace CloudPDF; Values.TokensRevoke ); + public static readonly TokensIssueRequestTenantScopeItemOne SharesManage = new( + Values.SharesManage + ); + public TokensIssueRequestTenantScopeItemOne(string value) { Value = value; @@ -132,5 +136,7 @@ public static class Values public const string TokensIssueDoc = "tokens.issue-doc"; public const string TokensRevoke = "tokens.revoke"; + + public const string SharesManage = "shares.manage"; } }