diff --git a/.fern/metadata.json b/.fern/metadata.json index 5a79a16f..6d470d4f 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": "7ded7de29f4cc0dc9da18042fca6afd5c9557bfc", + "originGitCommit": "07aa3f26c82243b36a5ec94f7072130c7298d977", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "3.0.0-next.16", + "requestedVersion": "3.0.0-next.17", "ciProvider": "github", - "sdkVersion": "3.0.0-next.16" + "sdkVersion": "3.0.0-next.17" } \ No newline at end of file diff --git a/README.md b/README.md index 28542c12..b023833c 100644 --- a/README.md +++ b/README.md @@ -218,25 +218,25 @@ This SDK uses forward-compatible enums that can handle unknown values gracefully using CloudPDF; // Using a built-in value -var listDocumentsRequestState = ListDocumentsRequestState.Pending; +var sharesCreateRequestLayerMode = SharesCreateRequestLayerMode.Shared; // Using a custom value -var customListDocumentsRequestState = ListDocumentsRequestState.FromCustom("custom-value"); +var customSharesCreateRequestLayerMode = SharesCreateRequestLayerMode.FromCustom("custom-value"); // Using in a switch statement -switch (listDocumentsRequestState.Value) +switch (sharesCreateRequestLayerMode.Value) { - case ListDocumentsRequestState.Values.Pending: - Console.WriteLine("Pending"); + case SharesCreateRequestLayerMode.Values.Shared: + Console.WriteLine("Shared"); break; default: - Console.WriteLine($"Unknown value: {listDocumentsRequestState.Value}"); + Console.WriteLine($"Unknown value: {sharesCreateRequestLayerMode.Value}"); break; } // Explicit casting -string listDocumentsRequestStateString = (string)ListDocumentsRequestState.Pending; -ListDocumentsRequestState listDocumentsRequestStateFromString = (ListDocumentsRequestState)"pending"; +string sharesCreateRequestLayerModeString = (string)SharesCreateRequestLayerMode.Shared; +SharesCreateRequestLayerMode sharesCreateRequestLayerModeFromString = (SharesCreateRequestLayerMode)"shared"; ``` ## Contributing diff --git a/cloudpdf-generation.json b/cloudpdf-generation.json index d87ef92b..895c80f4 100644 --- a/cloudpdf-generation.json +++ b/cloudpdf-generation.json @@ -1,12 +1,12 @@ { "language": "csharp", - "canonicalVersion": "3.0.0-next.16", - "sdkVersion": "3.0.0-next.16", + "canonicalVersion": "3.0.0-next.17", + "sdkVersion": "3.0.0-next.17", "source": { "repository": "embedpdf/embed-pdf-viewer", "openapi": "cloudpdf/contract/openapi.json", - "openapiSha256": "06543c26918bd79d426bf242c5a3091cdb7d298d3ac3296addabee2be80edb15", - "gitCommit": "7ded7de29f4cc0dc9da18042fca6afd5c9557bfc", + "openapiSha256": "8fa53cef2776eb0de9ec50c263aa547b309a04d1a2ecb6ee54b6338d6698dc00", + "gitCommit": "07aa3f26c82243b36a5ec94f7072130c7298d977", "gitCommitIsDirty": false }, "fern": { diff --git a/reference.md b/reference.md index 190f32ad..3121487f 100644 --- a/reference.md +++ b/reference.md @@ -166,6 +166,62 @@ await client.Doc.DownloadAsync(new DownloadDocRequest { DocId = "docId", LayerNa + + + + +
client.Doc.DownloadLinkAsync(DocDownloadLinkRequest { ... }) -> WithRawResponseTask<DocDownloadLink200Response> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with `layer_name`, a `download: { docVersion, mode: "incremental" }` claim and a short `exp`, passed as `link` on the versioned download URL. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Doc.DownloadLinkAsync( + new DocDownloadLinkRequest { DocId = "docId", LayerName = "layerName" } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `DocDownloadLinkRequest` + +
+
+
+
+ +
@@ -331,7 +387,7 @@ await client.Doc.TextAsync(
-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). +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. A link that asks its visitors who they are on open returns 422 VisitorIdentityRequired until the required answers are given; `error.details` carries `fields` (what the link asks), `missing`, `invalid`, `purpose` and `privacyUrl`. A link that asks before the first change issues the session at once with `visitor.identityRequest`, and writes answer 403 VisitorIdentityRequired with the same details until the visitor exchanges again with their answers. Answers that can not be taken answer 422 on any link. Mounted only when the deployment can sign (HS256 mode).
@@ -594,6 +650,62 @@ await client.Shares.UpdateAsync( + + + + +
client.Shares.ArchiveAsync(ArchiveSharesRequest { ... }) -> WithRawResponseTask<SharesArchive200Response> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (`disabled`) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Shares.ArchiveAsync( + new ArchiveSharesRequest { TenantId = "tenantId", ShareId = "shareId" } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ArchiveSharesRequest` + +
+
+
+
+ +
@@ -3582,3 +3694,209 @@ await client.Doc.Metadata.Custom.GetAsync( +## Documents Layers +
client.Documents.Layers.ListAsync(ListLayersRequest { ... }) -> WithRawResponseTask<DocumentsLayersList200Response> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Documents.Layers.ListAsync(new ListLayersRequest { TenantId = "tenantId", Id = "id" }); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ListLayersRequest` + +
+
+
+
+ + +
+
+
+ +
client.Documents.Layers.DeleteAsync(DeleteLayersRequest { ... }) -> WithRawResponseTask +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Documents.Layers.DeleteAsync( + new DeleteLayersRequest + { + TenantId = "tenantId", + Id = "id", + LayerName = "layerName", + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `DeleteLayersRequest` + +
+
+
+
+ + +
+
+
+ +## Shares Visitors +
client.Shares.Visitors.ListAsync(ListVisitorsRequest { ... }) -> WithRawResponseTask<SharesVisitorsList200Response> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +An archived link's visitors are listed too. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Shares.Visitors.ListAsync( + new ListVisitorsRequest { TenantId = "tenantId", ShareId = "shareId" } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ListVisitorsRequest` + +
+
+
+
+ + +
+
+
+ +
client.Shares.Visitors.DeleteAsync(DeleteVisitorsRequest { ... }) -> WithRawResponseTask +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Their handle brings them back as a new visitor, who is asked again. Deleting a visitor already deleted changes nothing. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Shares.Visitors.DeleteAsync( + new DeleteVisitorsRequest + { + TenantId = "tenantId", + ShareId = "shareId", + VisitorId = "visitorId", + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `DeleteVisitorsRequest` + +
+
+
+
+ + +
+
+
+ diff --git a/src/CloudPDF.Test/Unit/MockServer/Doc/DownloadLinkTest.cs b/src/CloudPDF.Test/Unit/MockServer/Doc/DownloadLinkTest.cs new file mode 100644 index 00000000..4d0c37d4 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Doc/DownloadLinkTest.cs @@ -0,0 +1,88 @@ +using CloudPDF; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Doc; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class DownloadLinkTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string requestJson = """ + {} + """; + + const string mockResponse = """ + { + "url": "url", + "expiresAt": 1.1 + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/download-link") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.DownloadLinkAsync( + new DocDownloadLinkRequest + { + DocId = "docId", + LayerName = "layerName", + ExpiresIn = null, + } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string requestJson = """ + {} + """; + + const string mockResponse = """ + { + "url": "url", + "expiresAt": 1.1 + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/docs/docId/layers/layerName/download-link") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Doc.DownloadLinkAsync( + new DocDownloadLinkRequest { DocId = "docId", LayerName = "layerName" } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Documents/Layers/DeleteTest.cs b/src/CloudPDF.Test/Unit/MockServer/Documents/Layers/DeleteTest.cs new file mode 100644 index 00000000..39b78f3d --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Documents/Layers/DeleteTest.cs @@ -0,0 +1,58 @@ +using CloudPDF.Documents; +using CloudPDF.Test.Unit.MockServer; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Documents.Layers; + +[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/documents/id/layers/layerName") + .UsingDelete() + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Documents.Layers.DeleteAsync( + new DeleteLayersRequest + { + TenantId = "tenantId", + Id = "id", + LayerName = "layerName", + } + ) + ); + } + + [NUnit.Framework.Test] + public void MockServerTest_2() + { + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/documents/id/layers/layerName") + .UsingDelete() + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Documents.Layers.DeleteAsync( + new DeleteLayersRequest + { + TenantId = "tenantId", + Id = "id", + LayerName = "layerName", + } + ) + ); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Documents/Layers/ListTest.cs b/src/CloudPDF.Test/Unit/MockServer/Documents/Layers/ListTest.cs new file mode 100644 index 00000000..242f791c --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Documents/Layers/ListTest.cs @@ -0,0 +1,103 @@ +using CloudPDF.Documents; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Documents.Layers; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string mockResponse = """ + { + "layers": [ + { + "docId": "docId", + "layerName": "layerName", + "shareId": "shareId", + "visitorId": "visitorId", + "storageSizeBytes": 1.1, + "createdAt": 1.1, + "updatedAt": 1.1, + "lastSeenAt": 1.1 + }, + { + "docId": "docId", + "layerName": "layerName", + "shareId": "shareId", + "visitorId": "visitorId", + "storageSizeBytes": 1.1, + "createdAt": 1.1, + "updatedAt": 1.1, + "lastSeenAt": 1.1 + } + ], + "nextCursor": "nextCursor" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/documents/id/layers") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Documents.Layers.ListAsync( + new ListLayersRequest { TenantId = "tenantId", Id = "id" } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string mockResponse = """ + { + "layers": [ + { + "docId": "docId", + "layerName": "layerName", + "shareId": "shareId", + "visitorId": "visitorId", + "storageSizeBytes": 1.1, + "createdAt": 1.1, + "updatedAt": 1.1, + "lastSeenAt": 1.1 + } + ], + "nextCursor": "nextCursor" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/documents/id/layers") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Documents.Layers.ListAsync( + new ListLayersRequest { TenantId = "tenantId", Id = "id" } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/ArchiveTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/ArchiveTest.cs new file mode 100644 index 00000000..c56a7db0 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/ArchiveTest.cs @@ -0,0 +1,137 @@ +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 ArchiveTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string mockResponse = """ + { + "share": { + "id": "id", + "tenantId": "tenantId", + "docId": "docId", + "layerMode": "shared", + "layerName": "layerName", + "keepVisitorLayers": true, + "visitorIdleSeconds": 1.1, + "visitorIdentity": { + "fields": { + "displayName": "required", + "email": "required", + "title": "required", + "organization": "required", + "organizationalUnit": "required" + }, + "ask": "on-open", + "purpose": "x", + "privacyUrl": "privacyUrl" + }, + "scope": [ + "scope", + "scope" + ], + "origins": [ + "origins", + "origins" + ], + "passwordProtected": true, + "sessionTtlSeconds": 1.1, + "disabled": true, + "archivedAt": 1.1, + "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/archive") + .UsingPost() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.ArchiveAsync( + new ArchiveSharesRequest { 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", + "layerMode": "shared", + "layerName": "layerName", + "keepVisitorLayers": true, + "visitorIdleSeconds": 1.1, + "visitorIdentity": { + "fields": {}, + "ask": "on-open", + "purpose": "purpose", + "privacyUrl": "privacyUrl" + }, + "scope": [ + "scope" + ], + "origins": [ + "origins" + ], + "passwordProtected": true, + "sessionTtlSeconds": 1.1, + "disabled": true, + "archivedAt": 1.1, + "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/archive") + .UsingPost() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.ArchiveAsync( + new ArchiveSharesRequest { TenantId = "tenantId", ShareId = "shareId" } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/CreateTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/CreateTest.cs index cff0767b..9aaaadec 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Shares/CreateTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/CreateTest.cs @@ -28,7 +28,22 @@ public async Task MockServerTest_1() "id": "id", "tenantId": "tenantId", "docId": "docId", + "layerMode": "shared", "layerName": "layerName", + "keepVisitorLayers": true, + "visitorIdleSeconds": 1.1, + "visitorIdentity": { + "fields": { + "displayName": "required", + "email": "required", + "title": "required", + "organization": "required", + "organizationalUnit": "required" + }, + "ask": "on-open", + "purpose": "x", + "privacyUrl": "privacyUrl" + }, "scope": [ "scope", "scope" @@ -40,6 +55,7 @@ public async Task MockServerTest_1() "passwordProtected": true, "sessionTtlSeconds": 1.1, "disabled": true, + "archivedAt": 1.1, "expiresAt": 1.1, "exchangeCount": 1.1, "lastExchangedAt": 1.1, @@ -71,7 +87,11 @@ public async Task MockServerTest_1() { TenantId = "tenantId", DocId = "docId", + LayerMode = null, LayerName = null, + KeepVisitorLayers = null, + VisitorIdleSeconds = null, + VisitorIdentity = null, Scope = new List() { "scope", "scope" }, Origins = null, Password = null, @@ -100,7 +120,16 @@ public async Task MockServerTest_2() "id": "id", "tenantId": "tenantId", "docId": "docId", + "layerMode": "shared", "layerName": "layerName", + "keepVisitorLayers": true, + "visitorIdleSeconds": 1.1, + "visitorIdentity": { + "fields": {}, + "ask": "on-open", + "purpose": "purpose", + "privacyUrl": "privacyUrl" + }, "scope": [ "scope" ], @@ -110,6 +139,7 @@ public async Task MockServerTest_2() "passwordProtected": true, "sessionTtlSeconds": 1.1, "disabled": true, + "archivedAt": 1.1, "expiresAt": 1.1, "exchangeCount": 1.1, "lastExchangedAt": 1.1, diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/ExchangeTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/ExchangeTest.cs index bc661c7d..379d25f9 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Shares/ExchangeTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/ExchangeTest.cs @@ -23,6 +23,30 @@ public async Task MockServerTest_1() "token": "token", "docId": "docId", "layerName": "layerName", + "layerMode": "shared", + "visitor": { + "handle": "handle", + "keep": true, + "identityRequest": { + "fields": { + "displayName": "required", + "email": "required", + "title": "required", + "organization": "required", + "organizationalUnit": "required" + }, + "missing": [ + "displayName", + "displayName" + ], + "invalid": [ + "displayName", + "displayName" + ], + "purpose": "purpose", + "privacyUrl": "privacyUrl" + } + }, "expiresAt": 1.1 } """; @@ -44,7 +68,14 @@ public async Task MockServerTest_1() ); var response = await Client.Shares.ExchangeAsync( - new SharesExchangeRequest { ShareToken = "shareToken", Password = null } + new SharesExchangeRequest + { + ShareToken = "shareToken", + Password = null, + VisitorHandle = null, + Restart = null, + VisitorIdentity = null, + } ); JsonAssert.AreEqual(response, mockResponse); } @@ -63,6 +94,22 @@ public async Task MockServerTest_2() "token": "token", "docId": "docId", "layerName": "layerName", + "layerMode": "shared", + "visitor": { + "handle": "handle", + "keep": true, + "identityRequest": { + "fields": {}, + "missing": [ + "displayName" + ], + "invalid": [ + "displayName" + ], + "purpose": "purpose", + "privacyUrl": "privacyUrl" + } + }, "expiresAt": 1.1 } """; diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/GetTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/GetTest.cs index f22d231c..aa775808 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Shares/GetTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/GetTest.cs @@ -18,7 +18,22 @@ public async Task MockServerTest_1() "id": "id", "tenantId": "tenantId", "docId": "docId", + "layerMode": "shared", "layerName": "layerName", + "keepVisitorLayers": true, + "visitorIdleSeconds": 1.1, + "visitorIdentity": { + "fields": { + "displayName": "required", + "email": "required", + "title": "required", + "organization": "required", + "organizationalUnit": "required" + }, + "ask": "on-open", + "purpose": "x", + "privacyUrl": "privacyUrl" + }, "scope": [ "scope", "scope" @@ -30,6 +45,7 @@ public async Task MockServerTest_1() "passwordProtected": true, "sessionTtlSeconds": 1.1, "disabled": true, + "archivedAt": 1.1, "expiresAt": 1.1, "exchangeCount": 1.1, "lastExchangedAt": 1.1, @@ -69,7 +85,16 @@ public async Task MockServerTest_2() "id": "id", "tenantId": "tenantId", "docId": "docId", + "layerMode": "shared", "layerName": "layerName", + "keepVisitorLayers": true, + "visitorIdleSeconds": 1.1, + "visitorIdentity": { + "fields": {}, + "ask": "on-open", + "purpose": "purpose", + "privacyUrl": "privacyUrl" + }, "scope": [ "scope" ], @@ -79,6 +104,7 @@ public async Task MockServerTest_2() "passwordProtected": true, "sessionTtlSeconds": 1.1, "disabled": true, + "archivedAt": 1.1, "expiresAt": 1.1, "exchangeCount": 1.1, "lastExchangedAt": 1.1, diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/ListTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/ListTest.cs index a99c494d..6372ef0c 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Shares/ListTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/ListTest.cs @@ -19,7 +19,22 @@ public async Task MockServerTest_1() "id": "id", "tenantId": "tenantId", "docId": "docId", + "layerMode": "shared", "layerName": "layerName", + "keepVisitorLayers": true, + "visitorIdleSeconds": 1.1, + "visitorIdentity": { + "fields": { + "displayName": "required", + "email": "required", + "title": "required", + "organization": "required", + "organizationalUnit": "required" + }, + "ask": "on-open", + "purpose": "x", + "privacyUrl": "privacyUrl" + }, "scope": [ "scope", "scope" @@ -31,6 +46,7 @@ public async Task MockServerTest_1() "passwordProtected": true, "sessionTtlSeconds": 1.1, "disabled": true, + "archivedAt": 1.1, "expiresAt": 1.1, "exchangeCount": 1.1, "lastExchangedAt": 1.1, @@ -42,7 +58,22 @@ public async Task MockServerTest_1() "id": "id", "tenantId": "tenantId", "docId": "docId", + "layerMode": "shared", "layerName": "layerName", + "keepVisitorLayers": true, + "visitorIdleSeconds": 1.1, + "visitorIdentity": { + "fields": { + "displayName": "required", + "email": "required", + "title": "required", + "organization": "required", + "organizationalUnit": "required" + }, + "ask": "on-open", + "purpose": "x", + "privacyUrl": "privacyUrl" + }, "scope": [ "scope", "scope" @@ -54,6 +85,7 @@ public async Task MockServerTest_1() "passwordProtected": true, "sessionTtlSeconds": 1.1, "disabled": true, + "archivedAt": 1.1, "expiresAt": 1.1, "exchangeCount": 1.1, "lastExchangedAt": 1.1, @@ -96,7 +128,14 @@ public async Task MockServerTest_2() "id": "id", "tenantId": "tenantId", "docId": "docId", + "layerMode": "shared", "layerName": "layerName", + "keepVisitorLayers": true, + "visitorIdleSeconds": 1.1, + "visitorIdentity": { + "fields": {}, + "ask": "on-open" + }, "scope": [ "scope" ], @@ -106,6 +145,7 @@ public async Task MockServerTest_2() "passwordProtected": true, "sessionTtlSeconds": 1.1, "disabled": true, + "archivedAt": 1.1, "expiresAt": 1.1, "exchangeCount": 1.1, "lastExchangedAt": 1.1, diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/UpdateTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/UpdateTest.cs index be9cd0dd..29c7f130 100644 --- a/src/CloudPDF.Test/Unit/MockServer/Shares/UpdateTest.cs +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/UpdateTest.cs @@ -22,7 +22,22 @@ public async Task MockServerTest_1() "id": "id", "tenantId": "tenantId", "docId": "docId", + "layerMode": "shared", "layerName": "layerName", + "keepVisitorLayers": true, + "visitorIdleSeconds": 1.1, + "visitorIdentity": { + "fields": { + "displayName": "required", + "email": "required", + "title": "required", + "organization": "required", + "organizationalUnit": "required" + }, + "ask": "on-open", + "purpose": "x", + "privacyUrl": "privacyUrl" + }, "scope": [ "scope", "scope" @@ -34,6 +49,7 @@ public async Task MockServerTest_1() "passwordProtected": true, "sessionTtlSeconds": 1.1, "disabled": true, + "archivedAt": 1.1, "expiresAt": 1.1, "exchangeCount": 1.1, "lastExchangedAt": 1.1, @@ -65,6 +81,11 @@ public async Task MockServerTest_1() { TenantId = "tenantId", ShareId = "shareId", + LayerMode = null, + LayerName = null, + KeepVisitorLayers = null, + VisitorIdleSeconds = null, + VisitorIdentity = null, Scope = null, Origins = null, Password = null, @@ -89,7 +110,16 @@ public async Task MockServerTest_2() "id": "id", "tenantId": "tenantId", "docId": "docId", + "layerMode": "shared", "layerName": "layerName", + "keepVisitorLayers": true, + "visitorIdleSeconds": 1.1, + "visitorIdentity": { + "fields": {}, + "ask": "on-open", + "purpose": "purpose", + "privacyUrl": "privacyUrl" + }, "scope": [ "scope" ], @@ -99,6 +129,7 @@ public async Task MockServerTest_2() "passwordProtected": true, "sessionTtlSeconds": 1.1, "disabled": true, + "archivedAt": 1.1, "expiresAt": 1.1, "exchangeCount": 1.1, "lastExchangedAt": 1.1, diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/Visitors/DeleteTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/Visitors/DeleteTest.cs new file mode 100644 index 00000000..2e7f3f89 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/Visitors/DeleteTest.cs @@ -0,0 +1,58 @@ +using CloudPDF.Shares; +using CloudPDF.Test.Unit.MockServer; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Shares.Visitors; + +[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/visitors/visitorId") + .UsingDelete() + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Shares.Visitors.DeleteAsync( + new DeleteVisitorsRequest + { + TenantId = "tenantId", + ShareId = "shareId", + VisitorId = "visitorId", + } + ) + ); + } + + [NUnit.Framework.Test] + public void MockServerTest_2() + { + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/shares/shareId/visitors/visitorId") + .UsingDelete() + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Shares.Visitors.DeleteAsync( + new DeleteVisitorsRequest + { + TenantId = "tenantId", + ShareId = "shareId", + VisitorId = "visitorId", + } + ) + ); + } +} diff --git a/src/CloudPDF.Test/Unit/MockServer/Shares/Visitors/ListTest.cs b/src/CloudPDF.Test/Unit/MockServer/Shares/Visitors/ListTest.cs new file mode 100644 index 00000000..1580e3f2 --- /dev/null +++ b/src/CloudPDF.Test/Unit/MockServer/Shares/Visitors/ListTest.cs @@ -0,0 +1,120 @@ +using CloudPDF.Shares; +using CloudPDF.Test.Unit.MockServer; +using CloudPDF.Test.Utils; +using NUnit.Framework; + +namespace CloudPDF.Test.Unit.MockServer.Shares.Visitors; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest_1() + { + const string mockResponse = """ + { + "visitors": [ + { + "visitorId": "visitorId", + "answers": { + "displayName": "displayName", + "email": "email", + "title": "title", + "organization": "organization", + "organizationalUnit": "organizationalUnit" + }, + "emailVerified": true, + "consentedAt": 1.1, + "firstSeenAt": 1.1, + "lastSeenAt": 1.1, + "layer": { + "layerName": "layerName", + "storageSizeBytes": 1.1 + } + }, + { + "visitorId": "visitorId", + "answers": { + "displayName": "displayName", + "email": "email", + "title": "title", + "organization": "organization", + "organizationalUnit": "organizationalUnit" + }, + "emailVerified": true, + "consentedAt": 1.1, + "firstSeenAt": 1.1, + "lastSeenAt": 1.1, + "layer": { + "layerName": "layerName", + "storageSizeBytes": 1.1 + } + } + ], + "nextCursor": "nextCursor" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/shares/shareId/visitors") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.Visitors.ListAsync( + new ListVisitorsRequest { TenantId = "tenantId", ShareId = "shareId" } + ); + JsonAssert.AreEqual(response, mockResponse); + } + + [NUnit.Framework.Test] + public async Task MockServerTest_2() + { + const string mockResponse = """ + { + "visitors": [ + { + "visitorId": "visitorId", + "answers": {}, + "emailVerified": true, + "consentedAt": 1.1, + "firstSeenAt": 1.1, + "lastSeenAt": 1.1, + "layer": { + "layerName": "layerName" + } + } + ], + "nextCursor": "nextCursor" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/v1/tenants/tenantId/shares/shareId/visitors") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.Shares.Visitors.ListAsync( + new ListVisitorsRequest { TenantId = "tenantId", ShareId = "shareId" } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/src/CloudPDF/CloudPDF.csproj b/src/CloudPDF/CloudPDF.csproj index 0631730a..22ce4f5f 100644 --- a/src/CloudPDF/CloudPDF.csproj +++ b/src/CloudPDF/CloudPDF.csproj @@ -11,7 +11,7 @@ enable 12 enable - 3.0.0-next.16 + 3.0.0-next.17 3.0.0.0 3.0.0.0 README.md diff --git a/src/CloudPDF/Core/Public/Version.cs b/src/CloudPDF/Core/Public/Version.cs index d8d2bd10..71b8d06b 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.16"; + public const string Current = "3.0.0-next.17"; } diff --git a/src/CloudPDF/Doc/DocClient.cs b/src/CloudPDF/Doc/DocClient.cs index cc305990..6b75ec17 100644 --- a/src/CloudPDF/Doc/DocClient.cs +++ b/src/CloudPDF/Doc/DocClient.cs @@ -380,6 +380,128 @@ private async Task> ChangesAsyncCore( } } + private async Task> DownloadLinkAsyncCore( + DocDownloadLinkRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new CloudPDF.Core.QueryStringBuilder.Builder(capacity: 0) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new CloudPDF.Core.HeadersBuilder.Builder() + .Add("X-Document-Password", request.DocumentPassword) + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Post, + Path = string.Format( + "v1/docs/{0}/layers/{1}/download-link", + ValueConvert.ToPathParameterString(request.DocId), + ValueConvert.ToPathParameterString(request.LayerName) + ), + 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 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 501: + throw new NotImplementedError( + 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> ManifestAsyncCore( ManifestDocRequest request, RequestOptions? options = null, @@ -740,6 +862,25 @@ public WithRawResponseTask ChangesAsync( ); } + /// + /// The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with `layer_name`, a `download: { docVersion, mode: "incremental" }` claim and a short `exp`, passed as `link` on the versioned download URL. + /// + /// + /// await client.Doc.DownloadLinkAsync( + /// new DocDownloadLinkRequest { DocId = "docId", LayerName = "layerName" } + /// ); + /// + public WithRawResponseTask DownloadLinkAsync( + DocDownloadLinkRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + DownloadLinkAsyncCore(request, options, cancellationToken) + ); + } + /// /// await client.Doc.ManifestAsync(new ManifestDocRequest { DocId = "docId", LayerName = "layerName" }); /// diff --git a/src/CloudPDF/Doc/IDocClient.cs b/src/CloudPDF/Doc/IDocClient.cs index adb59c71..88e89616 100644 --- a/src/CloudPDF/Doc/IDocClient.cs +++ b/src/CloudPDF/Doc/IDocClient.cs @@ -34,6 +34,15 @@ WithRawResponseTask ChangesAsync( CancellationToken cancellationToken = default ); + /// + /// The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with `layer_name`, a `download: { docVersion, mode: "incremental" }` claim and a short `exp`, passed as `link` on the versioned download URL. + /// + WithRawResponseTask DownloadLinkAsync( + DocDownloadLinkRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + WithRawResponseTask ManifestAsync( ManifestDocRequest request, RequestOptions? options = null, diff --git a/src/CloudPDF/Doc/Requests/DocDownloadLinkRequest.cs b/src/CloudPDF/Doc/Requests/DocDownloadLinkRequest.cs new file mode 100644 index 00000000..5fa6b9ee --- /dev/null +++ b/src/CloudPDF/Doc/Requests/DocDownloadLinkRequest.cs @@ -0,0 +1,29 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocDownloadLinkRequest +{ + [JsonIgnore] + public required string DocId { get; set; } + + [JsonIgnore] + public required string LayerName { get; set; } + + /// + /// Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead. + /// + [JsonIgnore] + public string? DocumentPassword { get; set; } + + [JsonPropertyName("expiresIn")] + public int? ExpiresIn { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Documents/DocumentsClient.cs b/src/CloudPDF/Documents/DocumentsClient.cs index e03977b8..ec13898d 100644 --- a/src/CloudPDF/Documents/DocumentsClient.cs +++ b/src/CloudPDF/Documents/DocumentsClient.cs @@ -1,4 +1,5 @@ using CloudPDF.Core; +using CloudPDF.Documents; using global::System.Text.Json; namespace CloudPDF; @@ -10,8 +11,11 @@ public partial class DocumentsClient : IDocumentsClient internal DocumentsClient(RawClient client) { _client = client; + Layers = new LayersClient(_client); } + public ILayersClient Layers { get; } + private async Task> ListAsyncCore( ListDocumentsRequest request, RequestOptions? options = null, diff --git a/src/CloudPDF/Documents/IDocumentsClient.cs b/src/CloudPDF/Documents/IDocumentsClient.cs index 65cd821f..88f17ee2 100644 --- a/src/CloudPDF/Documents/IDocumentsClient.cs +++ b/src/CloudPDF/Documents/IDocumentsClient.cs @@ -1,7 +1,10 @@ +using CloudPDF.Documents; + namespace CloudPDF; public partial interface IDocumentsClient { + public ILayersClient Layers { get; } WithRawResponseTask ListAsync( ListDocumentsRequest request, RequestOptions? options = null, diff --git a/src/CloudPDF/Documents/Layers/ILayersClient.cs b/src/CloudPDF/Documents/Layers/ILayersClient.cs new file mode 100644 index 00000000..917075ee --- /dev/null +++ b/src/CloudPDF/Documents/Layers/ILayersClient.cs @@ -0,0 +1,18 @@ +using CloudPDF; + +namespace CloudPDF.Documents; + +public partial interface ILayersClient +{ + WithRawResponseTask ListAsync( + ListLayersRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask DeleteAsync( + DeleteLayersRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/CloudPDF/Documents/Layers/LayersClient.cs b/src/CloudPDF/Documents/Layers/LayersClient.cs new file mode 100644 index 00000000..cc340cf6 --- /dev/null +++ b/src/CloudPDF/Documents/Layers/LayersClient.cs @@ -0,0 +1,290 @@ +using CloudPDF; +using CloudPDF.Core; +using global::System.Text.Json; + +namespace CloudPDF.Documents; + +public partial class LayersClient : ILayersClient +{ + private readonly RawClient _client; + + internal LayersClient(RawClient client) + { + _client = client; + } + + private async Task> ListAsyncCore( + ListLayersRequest 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("shareId", request.ShareId) + .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}/documents/{1}/layers", + ValueConvert.ToPathParameterString(request.TenantId), + ValueConvert.ToPathParameterString(request.Id) + ), + 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 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 DeleteAsyncCore( + DeleteLayersRequest 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}/documents/{1}/layers/{2}", + ValueConvert.ToPathParameterString(request.TenantId), + ValueConvert.ToPathParameterString(request.Id), + ValueConvert.ToPathParameterString(request.LayerName) + ), + 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 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 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) + { + // 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.Documents.Layers.ListAsync(new ListLayersRequest { TenantId = "tenantId", Id = "id" }); + /// + public WithRawResponseTask ListAsync( + ListLayersRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// await client.Documents.Layers.DeleteAsync( + /// new DeleteLayersRequest + /// { + /// TenantId = "tenantId", + /// Id = "id", + /// LayerName = "layerName", + /// } + /// ); + /// + public WithRawResponseTask DeleteAsync( + DeleteLayersRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask(DeleteAsyncCore(request, options, cancellationToken)); + } +} diff --git a/src/CloudPDF/Documents/Layers/Requests/DeleteLayersRequest.cs b/src/CloudPDF/Documents/Layers/Requests/DeleteLayersRequest.cs new file mode 100644 index 00000000..5b3eabdb --- /dev/null +++ b/src/CloudPDF/Documents/Layers/Requests/DeleteLayersRequest.cs @@ -0,0 +1,23 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Documents; + +[Serializable] +public record DeleteLayersRequest +{ + [JsonIgnore] + public required string TenantId { get; set; } + + [JsonIgnore] + public required string Id { get; set; } + + [JsonIgnore] + public required string LayerName { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Documents/Layers/Requests/ListLayersRequest.cs b/src/CloudPDF/Documents/Layers/Requests/ListLayersRequest.cs new file mode 100644 index 00000000..97f0ea68 --- /dev/null +++ b/src/CloudPDF/Documents/Layers/Requests/ListLayersRequest.cs @@ -0,0 +1,29 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Documents; + +[Serializable] +public record ListLayersRequest +{ + [JsonIgnore] + public required string TenantId { get; set; } + + [JsonIgnore] + public required string Id { get; set; } + + [JsonIgnore] + public int? Limit { get; set; } + + [JsonIgnore] + public string? Cursor { get; set; } + + [JsonIgnore] + public string? ShareId { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Exceptions/NotImplementedError.cs b/src/CloudPDF/Exceptions/NotImplementedError.cs new file mode 100644 index 00000000..92e33319 --- /dev/null +++ b/src/CloudPDF/Exceptions/NotImplementedError.cs @@ -0,0 +1,14 @@ +namespace CloudPDF; + +/// +/// This exception type will be thrown for any non-2XX API responses. +/// +[Serializable] +public class NotImplementedError(EngineErrorPayload body, CloudPDF.RawResponse? rawResponse = null) + : CloudPDFApiException("NotImplementedError", 501, body, rawResponse: rawResponse) +{ + /// + /// The body of the response that triggered the exception. + /// + public new EngineErrorPayload Body => body; +} diff --git a/src/CloudPDF/Shares/ISharesClient.cs b/src/CloudPDF/Shares/ISharesClient.cs index dedd5e71..8a10f8cf 100644 --- a/src/CloudPDF/Shares/ISharesClient.cs +++ b/src/CloudPDF/Shares/ISharesClient.cs @@ -1,9 +1,13 @@ +using CloudPDF.Shares; + namespace CloudPDF; public partial interface ISharesClient { + public IVisitorsClient Visitors { get; } + /// - /// 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). + /// 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. A link that asks its visitors who they are on open returns 422 VisitorIdentityRequired until the required answers are given; `error.details` carries `fields` (what the link asks), `missing`, `invalid`, `purpose` and `privacyUrl`. A link that asks before the first change issues the session at once with `visitor.identityRequest`, and writes answer 403 VisitorIdentityRequired with the same details until the visitor exchanges again with their answers. Answers that can not be taken answer 422 on any link. Mounted only when the deployment can sign (HS256 mode). /// WithRawResponseTask ExchangeAsync( SharesExchangeRequest request, @@ -43,4 +47,13 @@ WithRawResponseTask UpdateAsync( RequestOptions? options = null, CancellationToken cancellationToken = default ); + + /// + /// Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (`disabled`) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted. + /// + WithRawResponseTask ArchiveAsync( + ArchiveSharesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); } diff --git a/src/CloudPDF/Shares/Requests/ArchiveSharesRequest.cs b/src/CloudPDF/Shares/Requests/ArchiveSharesRequest.cs new file mode 100644 index 00000000..7f8042ce --- /dev/null +++ b/src/CloudPDF/Shares/Requests/ArchiveSharesRequest.cs @@ -0,0 +1,20 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record ArchiveSharesRequest +{ + [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 index 20e9e690..91b3c084 100644 --- a/src/CloudPDF/Shares/Requests/ListSharesRequest.cs +++ b/src/CloudPDF/Shares/Requests/ListSharesRequest.cs @@ -18,6 +18,9 @@ public record ListSharesRequest [JsonIgnore] public string? DocId { get; set; } + [JsonIgnore] + public bool? Archived { get; set; } + /// public override string ToString() { diff --git a/src/CloudPDF/Shares/Requests/SharesCreateRequest.cs b/src/CloudPDF/Shares/Requests/SharesCreateRequest.cs index d7fffddb..9a99cfff 100644 --- a/src/CloudPDF/Shares/Requests/SharesCreateRequest.cs +++ b/src/CloudPDF/Shares/Requests/SharesCreateRequest.cs @@ -12,9 +12,21 @@ public record SharesCreateRequest [JsonPropertyName("docId")] public required string DocId { get; set; } + [JsonPropertyName("layerMode")] + public SharesCreateRequestLayerMode? LayerMode { get; set; } + [JsonPropertyName("layerName")] public string? LayerName { get; set; } + [JsonPropertyName("keepVisitorLayers")] + public bool? KeepVisitorLayers { get; set; } + + [JsonPropertyName("visitorIdleSeconds")] + public int? VisitorIdleSeconds { get; set; } + + [JsonPropertyName("visitorIdentity")] + public SharesCreateRequestVisitorIdentity? VisitorIdentity { get; set; } + [JsonPropertyName("scope")] public IEnumerable Scope { get; set; } = new List(); diff --git a/src/CloudPDF/Shares/Requests/SharesExchangeRequest.cs b/src/CloudPDF/Shares/Requests/SharesExchangeRequest.cs index fb9007ba..be029018 100644 --- a/src/CloudPDF/Shares/Requests/SharesExchangeRequest.cs +++ b/src/CloudPDF/Shares/Requests/SharesExchangeRequest.cs @@ -12,6 +12,15 @@ public record SharesExchangeRequest [JsonPropertyName("password")] public string? Password { get; set; } + [JsonPropertyName("visitorHandle")] + public string? VisitorHandle { get; set; } + + [JsonPropertyName("restart")] + public bool? Restart { get; set; } + + [JsonPropertyName("visitorIdentity")] + public SharesExchangeRequestVisitorIdentity? VisitorIdentity { get; set; } + /// public override string ToString() { diff --git a/src/CloudPDF/Shares/Requests/SharesUpdateRequest.cs b/src/CloudPDF/Shares/Requests/SharesUpdateRequest.cs index 7b2a617f..04307e40 100644 --- a/src/CloudPDF/Shares/Requests/SharesUpdateRequest.cs +++ b/src/CloudPDF/Shares/Requests/SharesUpdateRequest.cs @@ -12,6 +12,21 @@ public record SharesUpdateRequest [JsonIgnore] public required string ShareId { get; set; } + [JsonPropertyName("layerMode")] + public SharesUpdateRequestLayerMode? LayerMode { get; set; } + + [JsonPropertyName("layerName")] + public string? LayerName { get; set; } + + [JsonPropertyName("keepVisitorLayers")] + public bool? KeepVisitorLayers { get; set; } + + [JsonPropertyName("visitorIdleSeconds")] + public int? VisitorIdleSeconds { get; set; } + + [JsonPropertyName("visitorIdentity")] + public SharesUpdateRequestVisitorIdentity? VisitorIdentity { get; set; } + [JsonPropertyName("scope")] public IEnumerable? Scope { get; set; } diff --git a/src/CloudPDF/Shares/SharesClient.cs b/src/CloudPDF/Shares/SharesClient.cs index 015484bc..3203606e 100644 --- a/src/CloudPDF/Shares/SharesClient.cs +++ b/src/CloudPDF/Shares/SharesClient.cs @@ -1,4 +1,5 @@ using CloudPDF.Core; +using CloudPDF.Shares; using global::System.Text.Json; namespace CloudPDF; @@ -10,8 +11,11 @@ public partial class SharesClient : ISharesClient internal SharesClient(RawClient client) { _client = client; + Visitors = new VisitorsClient(_client); } + public IVisitorsClient Visitors { get; } + private async Task> ExchangeAsyncCore( SharesExchangeRequest request, RequestOptions? options = null, @@ -171,10 +175,11 @@ private async Task> ListAsyncCore( CancellationToken cancellationToken = default ) { - var _queryString = new CloudPDF.Core.QueryStringBuilder.Builder(capacity: 3) + var _queryString = new CloudPDF.Core.QueryStringBuilder.Builder(capacity: 4) .Add("limit", request.Limit) .Add("cursor", request.Cursor) .Add("docId", request.DocId) + .Add("archived", request.Archived) .MergeAdditional(options?.AdditionalQueryParameters) .Build(); var _headers = await new CloudPDF.Core.HeadersBuilder.Builder() @@ -574,6 +579,18 @@ private async Task DeleteAsyncCore( 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) @@ -695,6 +712,125 @@ private async Task> UpdateAsyncCore( 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) + { + // 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> ArchiveAsyncCore( + ArchiveSharesRequest 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/{1}/archive", + 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) @@ -716,7 +852,7 @@ private async Task> UpdateAsyncCore( } /// - /// 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). + /// 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. A link that asks its visitors who they are on open returns 422 VisitorIdentityRequired until the required answers are given; `error.details` carries `fields` (what the link asks), `missing`, `invalid`, `purpose` and `privacyUrl`. A link that asks before the first change issues the session at once with `visitor.identityRequest`, and writes answer 403 VisitorIdentityRequired with the same details until the visitor exchanges again with their answers. Answers that can not be taken answer 422 on any link. Mounted only when the deployment can sign (HS256 mode). /// /// /// await client.Shares.ExchangeAsync(new SharesExchangeRequest { ShareToken = "shareToken" }); @@ -813,4 +949,23 @@ public WithRawResponseTask UpdateAsync( UpdateAsyncCore(request, options, cancellationToken) ); } + + /// + /// Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (`disabled`) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted. + /// + /// + /// await client.Shares.ArchiveAsync( + /// new ArchiveSharesRequest { TenantId = "tenantId", ShareId = "shareId" } + /// ); + /// + public WithRawResponseTask ArchiveAsync( + ArchiveSharesRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ArchiveAsyncCore(request, options, cancellationToken) + ); + } } diff --git a/src/CloudPDF/Shares/Types/SharesCreateRequestLayerMode.cs b/src/CloudPDF/Shares/Types/SharesCreateRequestLayerMode.cs new file mode 100644 index 00000000..e3b98ce4 --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesCreateRequestLayerMode.cs @@ -0,0 +1,116 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(SharesCreateRequestLayerMode.SharesCreateRequestLayerModeSerializer))] +[Serializable] +public readonly record struct SharesCreateRequestLayerMode : IStringEnum +{ + public static readonly SharesCreateRequestLayerMode Shared = new(Values.Shared); + + public static readonly SharesCreateRequestLayerMode PerVisitor = new(Values.PerVisitor); + + public SharesCreateRequestLayerMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreateRequestLayerMode FromCustom(string value) + { + return new SharesCreateRequestLayerMode(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 ==(SharesCreateRequestLayerMode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(SharesCreateRequestLayerMode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(SharesCreateRequestLayerMode value) => value.Value; + + public static explicit operator SharesCreateRequestLayerMode(string value) => new(value); + + internal class SharesCreateRequestLayerModeSerializer + : JsonConverter + { + public override SharesCreateRequestLayerMode 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 SharesCreateRequestLayerMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreateRequestLayerMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreateRequestLayerMode 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 SharesCreateRequestLayerMode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreateRequestLayerMode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Shared = "shared"; + + public const string PerVisitor = "per-visitor"; + } +} diff --git a/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentity.cs b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentity.cs new file mode 100644 index 00000000..ff8bc1f3 --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentity.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesCreateRequestVisitorIdentity : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("fields")] + public required SharesCreateRequestVisitorIdentityFields Fields { get; set; } + + [JsonPropertyName("ask")] + public required SharesCreateRequestVisitorIdentityAsk Ask { get; set; } + + [JsonPropertyName("purpose")] + public string? Purpose { get; set; } + + [JsonPropertyName("privacyUrl")] + public string? PrivacyUrl { 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/Shares/Types/SharesCreateRequestVisitorIdentityAsk.cs b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityAsk.cs new file mode 100644 index 00000000..c09b8fca --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityAsk.cs @@ -0,0 +1,122 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesCreateRequestVisitorIdentityAsk.SharesCreateRequestVisitorIdentityAskSerializer) +)] +[Serializable] +public readonly record struct SharesCreateRequestVisitorIdentityAsk : IStringEnum +{ + public static readonly SharesCreateRequestVisitorIdentityAsk OnOpen = new(Values.OnOpen); + + public static readonly SharesCreateRequestVisitorIdentityAsk BeforeFirstChange = new( + Values.BeforeFirstChange + ); + + public SharesCreateRequestVisitorIdentityAsk(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreateRequestVisitorIdentityAsk FromCustom(string value) + { + return new SharesCreateRequestVisitorIdentityAsk(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 ==(SharesCreateRequestVisitorIdentityAsk value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(SharesCreateRequestVisitorIdentityAsk value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(SharesCreateRequestVisitorIdentityAsk value) => + value.Value; + + public static explicit operator SharesCreateRequestVisitorIdentityAsk(string value) => + new(value); + + internal class SharesCreateRequestVisitorIdentityAskSerializer + : JsonConverter + { + public override SharesCreateRequestVisitorIdentityAsk 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 SharesCreateRequestVisitorIdentityAsk(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreateRequestVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreateRequestVisitorIdentityAsk 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 SharesCreateRequestVisitorIdentityAsk(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreateRequestVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string OnOpen = "on-open"; + + public const string BeforeFirstChange = "before-first-change"; + } +} diff --git a/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFields.cs b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFields.cs new file mode 100644 index 00000000..3679aa11 --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFields.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesCreateRequestVisitorIdentityFields : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("displayName")] + public SharesCreateRequestVisitorIdentityFieldsDisplayName? DisplayName { get; set; } + + [JsonPropertyName("email")] + public SharesCreateRequestVisitorIdentityFieldsEmail? Email { get; set; } + + [JsonPropertyName("title")] + public SharesCreateRequestVisitorIdentityFieldsTitle? Title { get; set; } + + [JsonPropertyName("organization")] + public SharesCreateRequestVisitorIdentityFieldsOrganization? Organization { get; set; } + + [JsonPropertyName("organizationalUnit")] + public SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit? OrganizationalUnit { 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/Shares/Types/SharesCreateRequestVisitorIdentityFieldsDisplayName.cs b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsDisplayName.cs new file mode 100644 index 00000000..91e9d2be --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsDisplayName.cs @@ -0,0 +1,130 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesCreateRequestVisitorIdentityFieldsDisplayName.SharesCreateRequestVisitorIdentityFieldsDisplayNameSerializer) +)] +[Serializable] +public readonly record struct SharesCreateRequestVisitorIdentityFieldsDisplayName : IStringEnum +{ + public static readonly SharesCreateRequestVisitorIdentityFieldsDisplayName Required = new( + Values.Required + ); + + public static readonly SharesCreateRequestVisitorIdentityFieldsDisplayName Optional = new( + Values.Optional + ); + + public SharesCreateRequestVisitorIdentityFieldsDisplayName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreateRequestVisitorIdentityFieldsDisplayName FromCustom(string value) + { + return new SharesCreateRequestVisitorIdentityFieldsDisplayName(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 ==( + SharesCreateRequestVisitorIdentityFieldsDisplayName value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesCreateRequestVisitorIdentityFieldsDisplayName value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesCreateRequestVisitorIdentityFieldsDisplayName value + ) => value.Value; + + public static explicit operator SharesCreateRequestVisitorIdentityFieldsDisplayName( + string value + ) => new(value); + + internal class SharesCreateRequestVisitorIdentityFieldsDisplayNameSerializer + : JsonConverter + { + public override SharesCreateRequestVisitorIdentityFieldsDisplayName 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 SharesCreateRequestVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreateRequestVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreateRequestVisitorIdentityFieldsDisplayName 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 SharesCreateRequestVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreateRequestVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsEmail.cs b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsEmail.cs new file mode 100644 index 00000000..a82d1a4f --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsEmail.cs @@ -0,0 +1,128 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesCreateRequestVisitorIdentityFieldsEmail.SharesCreateRequestVisitorIdentityFieldsEmailSerializer) +)] +[Serializable] +public readonly record struct SharesCreateRequestVisitorIdentityFieldsEmail : IStringEnum +{ + public static readonly SharesCreateRequestVisitorIdentityFieldsEmail Required = new( + Values.Required + ); + + public static readonly SharesCreateRequestVisitorIdentityFieldsEmail Optional = new( + Values.Optional + ); + + public SharesCreateRequestVisitorIdentityFieldsEmail(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreateRequestVisitorIdentityFieldsEmail FromCustom(string value) + { + return new SharesCreateRequestVisitorIdentityFieldsEmail(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 ==( + SharesCreateRequestVisitorIdentityFieldsEmail value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesCreateRequestVisitorIdentityFieldsEmail value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(SharesCreateRequestVisitorIdentityFieldsEmail value) => + value.Value; + + public static explicit operator SharesCreateRequestVisitorIdentityFieldsEmail(string value) => + new(value); + + internal class SharesCreateRequestVisitorIdentityFieldsEmailSerializer + : JsonConverter + { + public override SharesCreateRequestVisitorIdentityFieldsEmail 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 SharesCreateRequestVisitorIdentityFieldsEmail(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreateRequestVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreateRequestVisitorIdentityFieldsEmail 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 SharesCreateRequestVisitorIdentityFieldsEmail(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreateRequestVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsOrganization.cs b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsOrganization.cs new file mode 100644 index 00000000..f4c7438c --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsOrganization.cs @@ -0,0 +1,130 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesCreateRequestVisitorIdentityFieldsOrganization.SharesCreateRequestVisitorIdentityFieldsOrganizationSerializer) +)] +[Serializable] +public readonly record struct SharesCreateRequestVisitorIdentityFieldsOrganization : IStringEnum +{ + public static readonly SharesCreateRequestVisitorIdentityFieldsOrganization Required = new( + Values.Required + ); + + public static readonly SharesCreateRequestVisitorIdentityFieldsOrganization Optional = new( + Values.Optional + ); + + public SharesCreateRequestVisitorIdentityFieldsOrganization(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreateRequestVisitorIdentityFieldsOrganization FromCustom(string value) + { + return new SharesCreateRequestVisitorIdentityFieldsOrganization(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 ==( + SharesCreateRequestVisitorIdentityFieldsOrganization value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesCreateRequestVisitorIdentityFieldsOrganization value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesCreateRequestVisitorIdentityFieldsOrganization value + ) => value.Value; + + public static explicit operator SharesCreateRequestVisitorIdentityFieldsOrganization( + string value + ) => new(value); + + internal class SharesCreateRequestVisitorIdentityFieldsOrganizationSerializer + : JsonConverter + { + public override SharesCreateRequestVisitorIdentityFieldsOrganization 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 SharesCreateRequestVisitorIdentityFieldsOrganization(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreateRequestVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreateRequestVisitorIdentityFieldsOrganization 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 SharesCreateRequestVisitorIdentityFieldsOrganization(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreateRequestVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit.cs b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit.cs new file mode 100644 index 00000000..2173b1b5 --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit.SharesCreateRequestVisitorIdentityFieldsOrganizationalUnitSerializer) +)] +[Serializable] +public readonly record struct SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit + : IStringEnum +{ + public static readonly SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit Required = + new(Values.Required); + + public static readonly SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit Optional = + new(Values.Optional); + + public SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit FromCustom( + string value + ) + { + return new SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit(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 ==( + SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit value + ) => value.Value; + + public static explicit operator SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit( + string value + ) => new(value); + + internal class SharesCreateRequestVisitorIdentityFieldsOrganizationalUnitSerializer + : JsonConverter + { + public override SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit 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 SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit 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 SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreateRequestVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsTitle.cs b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsTitle.cs new file mode 100644 index 00000000..a4eaf892 --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesCreateRequestVisitorIdentityFieldsTitle.cs @@ -0,0 +1,128 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesCreateRequestVisitorIdentityFieldsTitle.SharesCreateRequestVisitorIdentityFieldsTitleSerializer) +)] +[Serializable] +public readonly record struct SharesCreateRequestVisitorIdentityFieldsTitle : IStringEnum +{ + public static readonly SharesCreateRequestVisitorIdentityFieldsTitle Required = new( + Values.Required + ); + + public static readonly SharesCreateRequestVisitorIdentityFieldsTitle Optional = new( + Values.Optional + ); + + public SharesCreateRequestVisitorIdentityFieldsTitle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreateRequestVisitorIdentityFieldsTitle FromCustom(string value) + { + return new SharesCreateRequestVisitorIdentityFieldsTitle(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 ==( + SharesCreateRequestVisitorIdentityFieldsTitle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesCreateRequestVisitorIdentityFieldsTitle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(SharesCreateRequestVisitorIdentityFieldsTitle value) => + value.Value; + + public static explicit operator SharesCreateRequestVisitorIdentityFieldsTitle(string value) => + new(value); + + internal class SharesCreateRequestVisitorIdentityFieldsTitleSerializer + : JsonConverter + { + public override SharesCreateRequestVisitorIdentityFieldsTitle 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 SharesCreateRequestVisitorIdentityFieldsTitle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreateRequestVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreateRequestVisitorIdentityFieldsTitle 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 SharesCreateRequestVisitorIdentityFieldsTitle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreateRequestVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Shares/Types/SharesExchangeRequestVisitorIdentity.cs b/src/CloudPDF/Shares/Types/SharesExchangeRequestVisitorIdentity.cs new file mode 100644 index 00000000..dc3867e8 --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesExchangeRequestVisitorIdentity.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchangeRequestVisitorIdentity : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("displayName")] + public string? DisplayName { get; set; } + + [JsonPropertyName("email")] + public string? Email { get; set; } + + [JsonPropertyName("title")] + public string? Title { get; set; } + + [JsonPropertyName("organization")] + public string? Organization { get; set; } + + [JsonPropertyName("organizationalUnit")] + public string? OrganizationalUnit { 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/Shares/Types/SharesUpdateRequestLayerMode.cs b/src/CloudPDF/Shares/Types/SharesUpdateRequestLayerMode.cs new file mode 100644 index 00000000..f3db257c --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesUpdateRequestLayerMode.cs @@ -0,0 +1,116 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter(typeof(SharesUpdateRequestLayerMode.SharesUpdateRequestLayerModeSerializer))] +[Serializable] +public readonly record struct SharesUpdateRequestLayerMode : IStringEnum +{ + public static readonly SharesUpdateRequestLayerMode Shared = new(Values.Shared); + + public static readonly SharesUpdateRequestLayerMode PerVisitor = new(Values.PerVisitor); + + public SharesUpdateRequestLayerMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdateRequestLayerMode FromCustom(string value) + { + return new SharesUpdateRequestLayerMode(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 ==(SharesUpdateRequestLayerMode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(SharesUpdateRequestLayerMode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(SharesUpdateRequestLayerMode value) => value.Value; + + public static explicit operator SharesUpdateRequestLayerMode(string value) => new(value); + + internal class SharesUpdateRequestLayerModeSerializer + : JsonConverter + { + public override SharesUpdateRequestLayerMode 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 SharesUpdateRequestLayerMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdateRequestLayerMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdateRequestLayerMode 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 SharesUpdateRequestLayerMode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdateRequestLayerMode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Shared = "shared"; + + public const string PerVisitor = "per-visitor"; + } +} diff --git a/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentity.cs b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentity.cs new file mode 100644 index 00000000..ae663cd6 --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentity.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesUpdateRequestVisitorIdentity : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("fields")] + public required SharesUpdateRequestVisitorIdentityFields Fields { get; set; } + + [JsonPropertyName("ask")] + public required SharesUpdateRequestVisitorIdentityAsk Ask { get; set; } + + [JsonPropertyName("purpose")] + public string? Purpose { get; set; } + + [JsonPropertyName("privacyUrl")] + public string? PrivacyUrl { 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/Shares/Types/SharesUpdateRequestVisitorIdentityAsk.cs b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityAsk.cs new file mode 100644 index 00000000..78119c75 --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityAsk.cs @@ -0,0 +1,122 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesUpdateRequestVisitorIdentityAsk.SharesUpdateRequestVisitorIdentityAskSerializer) +)] +[Serializable] +public readonly record struct SharesUpdateRequestVisitorIdentityAsk : IStringEnum +{ + public static readonly SharesUpdateRequestVisitorIdentityAsk OnOpen = new(Values.OnOpen); + + public static readonly SharesUpdateRequestVisitorIdentityAsk BeforeFirstChange = new( + Values.BeforeFirstChange + ); + + public SharesUpdateRequestVisitorIdentityAsk(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdateRequestVisitorIdentityAsk FromCustom(string value) + { + return new SharesUpdateRequestVisitorIdentityAsk(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 ==(SharesUpdateRequestVisitorIdentityAsk value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(SharesUpdateRequestVisitorIdentityAsk value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(SharesUpdateRequestVisitorIdentityAsk value) => + value.Value; + + public static explicit operator SharesUpdateRequestVisitorIdentityAsk(string value) => + new(value); + + internal class SharesUpdateRequestVisitorIdentityAskSerializer + : JsonConverter + { + public override SharesUpdateRequestVisitorIdentityAsk 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 SharesUpdateRequestVisitorIdentityAsk(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdateRequestVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdateRequestVisitorIdentityAsk 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 SharesUpdateRequestVisitorIdentityAsk(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdateRequestVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string OnOpen = "on-open"; + + public const string BeforeFirstChange = "before-first-change"; + } +} diff --git a/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFields.cs b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFields.cs new file mode 100644 index 00000000..d9dc7d28 --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFields.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesUpdateRequestVisitorIdentityFields : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("displayName")] + public SharesUpdateRequestVisitorIdentityFieldsDisplayName? DisplayName { get; set; } + + [JsonPropertyName("email")] + public SharesUpdateRequestVisitorIdentityFieldsEmail? Email { get; set; } + + [JsonPropertyName("title")] + public SharesUpdateRequestVisitorIdentityFieldsTitle? Title { get; set; } + + [JsonPropertyName("organization")] + public SharesUpdateRequestVisitorIdentityFieldsOrganization? Organization { get; set; } + + [JsonPropertyName("organizationalUnit")] + public SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit? OrganizationalUnit { 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/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsDisplayName.cs b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsDisplayName.cs new file mode 100644 index 00000000..04f8c149 --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsDisplayName.cs @@ -0,0 +1,130 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesUpdateRequestVisitorIdentityFieldsDisplayName.SharesUpdateRequestVisitorIdentityFieldsDisplayNameSerializer) +)] +[Serializable] +public readonly record struct SharesUpdateRequestVisitorIdentityFieldsDisplayName : IStringEnum +{ + public static readonly SharesUpdateRequestVisitorIdentityFieldsDisplayName Required = new( + Values.Required + ); + + public static readonly SharesUpdateRequestVisitorIdentityFieldsDisplayName Optional = new( + Values.Optional + ); + + public SharesUpdateRequestVisitorIdentityFieldsDisplayName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdateRequestVisitorIdentityFieldsDisplayName FromCustom(string value) + { + return new SharesUpdateRequestVisitorIdentityFieldsDisplayName(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 ==( + SharesUpdateRequestVisitorIdentityFieldsDisplayName value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesUpdateRequestVisitorIdentityFieldsDisplayName value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesUpdateRequestVisitorIdentityFieldsDisplayName value + ) => value.Value; + + public static explicit operator SharesUpdateRequestVisitorIdentityFieldsDisplayName( + string value + ) => new(value); + + internal class SharesUpdateRequestVisitorIdentityFieldsDisplayNameSerializer + : JsonConverter + { + public override SharesUpdateRequestVisitorIdentityFieldsDisplayName 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 SharesUpdateRequestVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdateRequestVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdateRequestVisitorIdentityFieldsDisplayName 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 SharesUpdateRequestVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdateRequestVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsEmail.cs b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsEmail.cs new file mode 100644 index 00000000..50d88642 --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsEmail.cs @@ -0,0 +1,128 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesUpdateRequestVisitorIdentityFieldsEmail.SharesUpdateRequestVisitorIdentityFieldsEmailSerializer) +)] +[Serializable] +public readonly record struct SharesUpdateRequestVisitorIdentityFieldsEmail : IStringEnum +{ + public static readonly SharesUpdateRequestVisitorIdentityFieldsEmail Required = new( + Values.Required + ); + + public static readonly SharesUpdateRequestVisitorIdentityFieldsEmail Optional = new( + Values.Optional + ); + + public SharesUpdateRequestVisitorIdentityFieldsEmail(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdateRequestVisitorIdentityFieldsEmail FromCustom(string value) + { + return new SharesUpdateRequestVisitorIdentityFieldsEmail(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 ==( + SharesUpdateRequestVisitorIdentityFieldsEmail value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesUpdateRequestVisitorIdentityFieldsEmail value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(SharesUpdateRequestVisitorIdentityFieldsEmail value) => + value.Value; + + public static explicit operator SharesUpdateRequestVisitorIdentityFieldsEmail(string value) => + new(value); + + internal class SharesUpdateRequestVisitorIdentityFieldsEmailSerializer + : JsonConverter + { + public override SharesUpdateRequestVisitorIdentityFieldsEmail 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 SharesUpdateRequestVisitorIdentityFieldsEmail(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdateRequestVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdateRequestVisitorIdentityFieldsEmail 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 SharesUpdateRequestVisitorIdentityFieldsEmail(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdateRequestVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsOrganization.cs b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsOrganization.cs new file mode 100644 index 00000000..8d39516f --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsOrganization.cs @@ -0,0 +1,130 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesUpdateRequestVisitorIdentityFieldsOrganization.SharesUpdateRequestVisitorIdentityFieldsOrganizationSerializer) +)] +[Serializable] +public readonly record struct SharesUpdateRequestVisitorIdentityFieldsOrganization : IStringEnum +{ + public static readonly SharesUpdateRequestVisitorIdentityFieldsOrganization Required = new( + Values.Required + ); + + public static readonly SharesUpdateRequestVisitorIdentityFieldsOrganization Optional = new( + Values.Optional + ); + + public SharesUpdateRequestVisitorIdentityFieldsOrganization(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdateRequestVisitorIdentityFieldsOrganization FromCustom(string value) + { + return new SharesUpdateRequestVisitorIdentityFieldsOrganization(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 ==( + SharesUpdateRequestVisitorIdentityFieldsOrganization value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesUpdateRequestVisitorIdentityFieldsOrganization value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesUpdateRequestVisitorIdentityFieldsOrganization value + ) => value.Value; + + public static explicit operator SharesUpdateRequestVisitorIdentityFieldsOrganization( + string value + ) => new(value); + + internal class SharesUpdateRequestVisitorIdentityFieldsOrganizationSerializer + : JsonConverter + { + public override SharesUpdateRequestVisitorIdentityFieldsOrganization 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 SharesUpdateRequestVisitorIdentityFieldsOrganization(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdateRequestVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdateRequestVisitorIdentityFieldsOrganization 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 SharesUpdateRequestVisitorIdentityFieldsOrganization(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdateRequestVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit.cs b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit.cs new file mode 100644 index 00000000..7f1625bd --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit.SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnitSerializer) +)] +[Serializable] +public readonly record struct SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit + : IStringEnum +{ + public static readonly SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit Required = + new(Values.Required); + + public static readonly SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit Optional = + new(Values.Optional); + + public SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit FromCustom( + string value + ) + { + return new SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit(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 ==( + SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit value + ) => value.Value; + + public static explicit operator SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit( + string value + ) => new(value); + + internal class SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnitSerializer + : JsonConverter + { + public override SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit 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 SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit 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 SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdateRequestVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsTitle.cs b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsTitle.cs new file mode 100644 index 00000000..67e6c1b3 --- /dev/null +++ b/src/CloudPDF/Shares/Types/SharesUpdateRequestVisitorIdentityFieldsTitle.cs @@ -0,0 +1,128 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesUpdateRequestVisitorIdentityFieldsTitle.SharesUpdateRequestVisitorIdentityFieldsTitleSerializer) +)] +[Serializable] +public readonly record struct SharesUpdateRequestVisitorIdentityFieldsTitle : IStringEnum +{ + public static readonly SharesUpdateRequestVisitorIdentityFieldsTitle Required = new( + Values.Required + ); + + public static readonly SharesUpdateRequestVisitorIdentityFieldsTitle Optional = new( + Values.Optional + ); + + public SharesUpdateRequestVisitorIdentityFieldsTitle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdateRequestVisitorIdentityFieldsTitle FromCustom(string value) + { + return new SharesUpdateRequestVisitorIdentityFieldsTitle(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 ==( + SharesUpdateRequestVisitorIdentityFieldsTitle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesUpdateRequestVisitorIdentityFieldsTitle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(SharesUpdateRequestVisitorIdentityFieldsTitle value) => + value.Value; + + public static explicit operator SharesUpdateRequestVisitorIdentityFieldsTitle(string value) => + new(value); + + internal class SharesUpdateRequestVisitorIdentityFieldsTitleSerializer + : JsonConverter + { + public override SharesUpdateRequestVisitorIdentityFieldsTitle 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 SharesUpdateRequestVisitorIdentityFieldsTitle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdateRequestVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdateRequestVisitorIdentityFieldsTitle 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 SharesUpdateRequestVisitorIdentityFieldsTitle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdateRequestVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Shares/Visitors/IVisitorsClient.cs b/src/CloudPDF/Shares/Visitors/IVisitorsClient.cs new file mode 100644 index 00000000..1190dae5 --- /dev/null +++ b/src/CloudPDF/Shares/Visitors/IVisitorsClient.cs @@ -0,0 +1,24 @@ +using CloudPDF; + +namespace CloudPDF.Shares; + +public partial interface IVisitorsClient +{ + /// + /// An archived link's visitors are listed too. + /// + WithRawResponseTask ListAsync( + ListVisitorsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + /// + /// Their handle brings them back as a new visitor, who is asked again. Deleting a visitor already deleted changes nothing. + /// + WithRawResponseTask DeleteAsync( + DeleteVisitorsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/CloudPDF/Shares/Visitors/Requests/DeleteVisitorsRequest.cs b/src/CloudPDF/Shares/Visitors/Requests/DeleteVisitorsRequest.cs new file mode 100644 index 00000000..7ba939c7 --- /dev/null +++ b/src/CloudPDF/Shares/Visitors/Requests/DeleteVisitorsRequest.cs @@ -0,0 +1,23 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Shares; + +[Serializable] +public record DeleteVisitorsRequest +{ + [JsonIgnore] + public required string TenantId { get; set; } + + [JsonIgnore] + public required string ShareId { get; set; } + + [JsonIgnore] + public required string VisitorId { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Shares/Visitors/Requests/ListVisitorsRequest.cs b/src/CloudPDF/Shares/Visitors/Requests/ListVisitorsRequest.cs new file mode 100644 index 00000000..6bda3031 --- /dev/null +++ b/src/CloudPDF/Shares/Visitors/Requests/ListVisitorsRequest.cs @@ -0,0 +1,26 @@ +using CloudPDF.Core; +using global::System.Text.Json.Serialization; + +namespace CloudPDF.Shares; + +[Serializable] +public record ListVisitorsRequest +{ + [JsonIgnore] + public required string TenantId { get; set; } + + [JsonIgnore] + public required string ShareId { get; set; } + + [JsonIgnore] + public int? Limit { get; set; } + + [JsonIgnore] + public string? Cursor { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/CloudPDF/Shares/Visitors/VisitorsClient.cs b/src/CloudPDF/Shares/Visitors/VisitorsClient.cs new file mode 100644 index 00000000..5c373b49 --- /dev/null +++ b/src/CloudPDF/Shares/Visitors/VisitorsClient.cs @@ -0,0 +1,261 @@ +using CloudPDF; +using CloudPDF.Core; +using global::System.Text.Json; + +namespace CloudPDF.Shares; + +public partial class VisitorsClient : IVisitorsClient +{ + private readonly RawClient _client; + + internal VisitorsClient(RawClient client) + { + _client = client; + } + + private async Task> ListAsyncCore( + ListVisitorsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new CloudPDF.Core.QueryStringBuilder.Builder(capacity: 2) + .Add("limit", request.Limit) + .Add("cursor", request.Cursor) + .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}/visitors", + 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 400: + throw new BadRequestError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + case 404: + throw new NotFoundError( + JsonUtils.Deserialize(responseBody), + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = + response.Raw.RequestMessage?.RequestUri + ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new CloudPDFApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody, + rawResponse: new CloudPDF.RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + } + ); + } + } + + private async Task DeleteAsyncCore( + DeleteVisitorsRequest 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}/visitors/{2}", + ValueConvert.ToPathParameterString(request.TenantId), + ValueConvert.ToPathParameterString(request.ShareId), + ValueConvert.ToPathParameterString(request.VisitorId) + ), + 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), + } + ); + } + } + + /// + /// An archived link's visitors are listed too. + /// + /// + /// await client.Shares.Visitors.ListAsync( + /// new ListVisitorsRequest { TenantId = "tenantId", ShareId = "shareId" } + /// ); + /// + public WithRawResponseTask ListAsync( + ListVisitorsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// Their handle brings them back as a new visitor, who is asked again. Deleting a visitor already deleted changes nothing. + /// + /// + /// await client.Shares.Visitors.DeleteAsync( + /// new DeleteVisitorsRequest + /// { + /// TenantId = "tenantId", + /// ShareId = "shareId", + /// VisitorId = "visitorId", + /// } + /// ); + /// + public WithRawResponseTask DeleteAsync( + DeleteVisitorsRequest request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask(DeleteAsyncCore(request, options, cancellationToken)); + } +} diff --git a/src/CloudPDF/Types/AdminErrorPayloadError.cs b/src/CloudPDF/Types/AdminErrorPayloadError.cs index d721ada9..f8878b57 100644 --- a/src/CloudPDF/Types/AdminErrorPayloadError.cs +++ b/src/CloudPDF/Types/AdminErrorPayloadError.cs @@ -17,6 +17,9 @@ public record AdminErrorPayloadError : IJsonOnDeserialized [JsonPropertyName("message")] public required string Message { get; set; } + [JsonPropertyName("details")] + public Dictionary? Details { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/CloudPDF/Types/DocDownloadLink200Response.cs b/src/CloudPDF/Types/DocDownloadLink200Response.cs new file mode 100644 index 00000000..b74501c3 --- /dev/null +++ b/src/CloudPDF/Types/DocDownloadLink200Response.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocDownloadLink200Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("url")] + public required string Url { 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/DocumentsLayersList200Response.cs b/src/CloudPDF/Types/DocumentsLayersList200Response.cs new file mode 100644 index 00000000..773076c3 --- /dev/null +++ b/src/CloudPDF/Types/DocumentsLayersList200Response.cs @@ -0,0 +1,32 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocumentsLayersList200Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("layers")] + public IEnumerable Layers { 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/DocumentsLayersList200ResponseLayersItem.cs b/src/CloudPDF/Types/DocumentsLayersList200ResponseLayersItem.cs new file mode 100644 index 00000000..b2759021 --- /dev/null +++ b/src/CloudPDF/Types/DocumentsLayersList200ResponseLayersItem.cs @@ -0,0 +1,49 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record DocumentsLayersList200ResponseLayersItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("docId")] + public required string DocId { get; set; } + + [JsonPropertyName("layerName")] + public required string LayerName { get; set; } + + [JsonPropertyName("shareId")] + public string? ShareId { get; set; } + + [JsonPropertyName("visitorId")] + public string? VisitorId { get; set; } + + [JsonPropertyName("storageSizeBytes")] + public double? StorageSizeBytes { get; set; } + + [JsonPropertyName("createdAt")] + public required double CreatedAt { get; set; } + + [JsonPropertyName("updatedAt")] + public required double UpdatedAt { get; set; } + + [JsonPropertyName("lastSeenAt")] + public double? LastSeenAt { 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 f60cb61c..671ba7b1 100644 --- a/src/CloudPDF/Types/EngineErrorPayloadCode.cs +++ b/src/CloudPDF/Types/EngineErrorPayloadCode.cs @@ -82,6 +82,12 @@ namespace CloudPDF; Values.IdempotencyKeyReused ); + public static readonly EngineErrorPayloadCode LayerDeleted = new(Values.LayerDeleted); + + public static readonly EngineErrorPayloadCode VisitorIdentityRequired = new( + Values.VisitorIdentityRequired + ); + public EngineErrorPayloadCode(string value) { Value = value; @@ -235,5 +241,9 @@ public static class Values public const string UndoUnavailable = "UndoUnavailable"; public const string IdempotencyKeyReused = "IdempotencyKeyReused"; + + public const string LayerDeleted = "LayerDeleted"; + + public const string VisitorIdentityRequired = "VisitorIdentityRequired"; } } diff --git a/src/CloudPDF/Types/SharesArchive200Response.cs b/src/CloudPDF/Types/SharesArchive200Response.cs new file mode 100644 index 00000000..c4106886 --- /dev/null +++ b/src/CloudPDF/Types/SharesArchive200Response.cs @@ -0,0 +1,28 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesArchive200Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("share")] + public required SharesArchive200ResponseShare 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/SharesArchive200ResponseShare.cs b/src/CloudPDF/Types/SharesArchive200ResponseShare.cs new file mode 100644 index 00000000..d3fd2d77 --- /dev/null +++ b/src/CloudPDF/Types/SharesArchive200ResponseShare.cs @@ -0,0 +1,85 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesArchive200ResponseShare : 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("layerMode")] + public required SharesArchive200ResponseShareLayerMode LayerMode { get; set; } + + [JsonPropertyName("layerName")] + public string? LayerName { get; set; } + + [JsonPropertyName("keepVisitorLayers")] + public required bool KeepVisitorLayers { get; set; } + + [JsonPropertyName("visitorIdleSeconds")] + public double? VisitorIdleSeconds { get; set; } + + [JsonPropertyName("visitorIdentity")] + public SharesArchive200ResponseShareVisitorIdentity? VisitorIdentity { 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("archivedAt")] + public double? ArchivedAt { 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/SharesArchive200ResponseShareLayerMode.cs b/src/CloudPDF/Types/SharesArchive200ResponseShareLayerMode.cs new file mode 100644 index 00000000..af98ce0e --- /dev/null +++ b/src/CloudPDF/Types/SharesArchive200ResponseShareLayerMode.cs @@ -0,0 +1,122 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesArchive200ResponseShareLayerMode.SharesArchive200ResponseShareLayerModeSerializer) +)] +[Serializable] +public readonly record struct SharesArchive200ResponseShareLayerMode : IStringEnum +{ + public static readonly SharesArchive200ResponseShareLayerMode Shared = new(Values.Shared); + + public static readonly SharesArchive200ResponseShareLayerMode PerVisitor = new( + Values.PerVisitor + ); + + public SharesArchive200ResponseShareLayerMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesArchive200ResponseShareLayerMode FromCustom(string value) + { + return new SharesArchive200ResponseShareLayerMode(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 ==(SharesArchive200ResponseShareLayerMode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(SharesArchive200ResponseShareLayerMode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(SharesArchive200ResponseShareLayerMode value) => + value.Value; + + public static explicit operator SharesArchive200ResponseShareLayerMode(string value) => + new(value); + + internal class SharesArchive200ResponseShareLayerModeSerializer + : JsonConverter + { + public override SharesArchive200ResponseShareLayerMode 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 SharesArchive200ResponseShareLayerMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesArchive200ResponseShareLayerMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesArchive200ResponseShareLayerMode 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 SharesArchive200ResponseShareLayerMode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesArchive200ResponseShareLayerMode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Shared = "shared"; + + public const string PerVisitor = "per-visitor"; + } +} diff --git a/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentity.cs b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentity.cs new file mode 100644 index 00000000..edbe73e3 --- /dev/null +++ b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentity.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesArchive200ResponseShareVisitorIdentity : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("fields")] + public required SharesArchive200ResponseShareVisitorIdentityFields Fields { get; set; } + + [JsonPropertyName("ask")] + public required SharesArchive200ResponseShareVisitorIdentityAsk Ask { get; set; } + + [JsonPropertyName("purpose")] + public string? Purpose { get; set; } + + [JsonPropertyName("privacyUrl")] + public string? PrivacyUrl { 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/SharesArchive200ResponseShareVisitorIdentityAsk.cs b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityAsk.cs new file mode 100644 index 00000000..d8ad5f70 --- /dev/null +++ b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityAsk.cs @@ -0,0 +1,128 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesArchive200ResponseShareVisitorIdentityAsk.SharesArchive200ResponseShareVisitorIdentityAskSerializer) +)] +[Serializable] +public readonly record struct SharesArchive200ResponseShareVisitorIdentityAsk : IStringEnum +{ + public static readonly SharesArchive200ResponseShareVisitorIdentityAsk OnOpen = new( + Values.OnOpen + ); + + public static readonly SharesArchive200ResponseShareVisitorIdentityAsk BeforeFirstChange = new( + Values.BeforeFirstChange + ); + + public SharesArchive200ResponseShareVisitorIdentityAsk(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesArchive200ResponseShareVisitorIdentityAsk FromCustom(string value) + { + return new SharesArchive200ResponseShareVisitorIdentityAsk(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 ==( + SharesArchive200ResponseShareVisitorIdentityAsk value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesArchive200ResponseShareVisitorIdentityAsk value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(SharesArchive200ResponseShareVisitorIdentityAsk value) => + value.Value; + + public static explicit operator SharesArchive200ResponseShareVisitorIdentityAsk(string value) => + new(value); + + internal class SharesArchive200ResponseShareVisitorIdentityAskSerializer + : JsonConverter + { + public override SharesArchive200ResponseShareVisitorIdentityAsk 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 SharesArchive200ResponseShareVisitorIdentityAsk(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesArchive200ResponseShareVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesArchive200ResponseShareVisitorIdentityAsk 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 SharesArchive200ResponseShareVisitorIdentityAsk(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesArchive200ResponseShareVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string OnOpen = "on-open"; + + public const string BeforeFirstChange = "before-first-change"; + } +} diff --git a/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFields.cs b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFields.cs new file mode 100644 index 00000000..e1222b2d --- /dev/null +++ b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFields.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesArchive200ResponseShareVisitorIdentityFields : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("displayName")] + public SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName? DisplayName { get; set; } + + [JsonPropertyName("email")] + public SharesArchive200ResponseShareVisitorIdentityFieldsEmail? Email { get; set; } + + [JsonPropertyName("title")] + public SharesArchive200ResponseShareVisitorIdentityFieldsTitle? Title { get; set; } + + [JsonPropertyName("organization")] + public SharesArchive200ResponseShareVisitorIdentityFieldsOrganization? Organization { get; set; } + + [JsonPropertyName("organizationalUnit")] + public SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit? OrganizationalUnit { 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/SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName.cs b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName.cs new file mode 100644 index 00000000..165246a0 --- /dev/null +++ b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName.SharesArchive200ResponseShareVisitorIdentityFieldsDisplayNameSerializer) +)] +[Serializable] +public readonly record struct SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName + : IStringEnum +{ + public static readonly SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName Required = + new(Values.Required); + + public static readonly SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName Optional = + new(Values.Optional); + + public SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName FromCustom( + string value + ) + { + return new SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName(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 ==( + SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName value + ) => value.Value; + + public static explicit operator SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName( + string value + ) => new(value); + + internal class SharesArchive200ResponseShareVisitorIdentityFieldsDisplayNameSerializer + : JsonConverter + { + public override SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName 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 SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName 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 SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesArchive200ResponseShareVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsEmail.cs b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsEmail.cs new file mode 100644 index 00000000..e162dcd1 --- /dev/null +++ b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsEmail.cs @@ -0,0 +1,130 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesArchive200ResponseShareVisitorIdentityFieldsEmail.SharesArchive200ResponseShareVisitorIdentityFieldsEmailSerializer) +)] +[Serializable] +public readonly record struct SharesArchive200ResponseShareVisitorIdentityFieldsEmail : IStringEnum +{ + public static readonly SharesArchive200ResponseShareVisitorIdentityFieldsEmail Required = new( + Values.Required + ); + + public static readonly SharesArchive200ResponseShareVisitorIdentityFieldsEmail Optional = new( + Values.Optional + ); + + public SharesArchive200ResponseShareVisitorIdentityFieldsEmail(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesArchive200ResponseShareVisitorIdentityFieldsEmail FromCustom(string value) + { + return new SharesArchive200ResponseShareVisitorIdentityFieldsEmail(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 ==( + SharesArchive200ResponseShareVisitorIdentityFieldsEmail value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesArchive200ResponseShareVisitorIdentityFieldsEmail value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesArchive200ResponseShareVisitorIdentityFieldsEmail value + ) => value.Value; + + public static explicit operator SharesArchive200ResponseShareVisitorIdentityFieldsEmail( + string value + ) => new(value); + + internal class SharesArchive200ResponseShareVisitorIdentityFieldsEmailSerializer + : JsonConverter + { + public override SharesArchive200ResponseShareVisitorIdentityFieldsEmail 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 SharesArchive200ResponseShareVisitorIdentityFieldsEmail(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesArchive200ResponseShareVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesArchive200ResponseShareVisitorIdentityFieldsEmail 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 SharesArchive200ResponseShareVisitorIdentityFieldsEmail(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesArchive200ResponseShareVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsOrganization.cs b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsOrganization.cs new file mode 100644 index 00000000..0205c4e7 --- /dev/null +++ b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsOrganization.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesArchive200ResponseShareVisitorIdentityFieldsOrganization.SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationSerializer) +)] +[Serializable] +public readonly record struct SharesArchive200ResponseShareVisitorIdentityFieldsOrganization + : IStringEnum +{ + public static readonly SharesArchive200ResponseShareVisitorIdentityFieldsOrganization Required = + new(Values.Required); + + public static readonly SharesArchive200ResponseShareVisitorIdentityFieldsOrganization Optional = + new(Values.Optional); + + public SharesArchive200ResponseShareVisitorIdentityFieldsOrganization(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesArchive200ResponseShareVisitorIdentityFieldsOrganization FromCustom( + string value + ) + { + return new SharesArchive200ResponseShareVisitorIdentityFieldsOrganization(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 ==( + SharesArchive200ResponseShareVisitorIdentityFieldsOrganization value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesArchive200ResponseShareVisitorIdentityFieldsOrganization value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesArchive200ResponseShareVisitorIdentityFieldsOrganization value + ) => value.Value; + + public static explicit operator SharesArchive200ResponseShareVisitorIdentityFieldsOrganization( + string value + ) => new(value); + + internal class SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationSerializer + : JsonConverter + { + public override SharesArchive200ResponseShareVisitorIdentityFieldsOrganization 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 SharesArchive200ResponseShareVisitorIdentityFieldsOrganization(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesArchive200ResponseShareVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesArchive200ResponseShareVisitorIdentityFieldsOrganization 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 SharesArchive200ResponseShareVisitorIdentityFieldsOrganization(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesArchive200ResponseShareVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit.cs b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit.cs new file mode 100644 index 00000000..cd3b09be --- /dev/null +++ b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit.cs @@ -0,0 +1,135 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit.SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnitSerializer) +)] +[Serializable] +public readonly record struct SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit + : IStringEnum +{ + public static readonly SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit Required = + new(Values.Required); + + public static readonly SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit Optional = + new(Values.Optional); + + public SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit FromCustom( + string value + ) + { + return new SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit(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 ==( + SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit value + ) => value.Value; + + public static explicit operator SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit( + string value + ) => new(value); + + internal class SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnitSerializer + : JsonConverter + { + public override SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit 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 SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit( + stringValue + ); + } + + public override void Write( + Utf8JsonWriter writer, + SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit 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 SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit( + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesArchive200ResponseShareVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsTitle.cs b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsTitle.cs new file mode 100644 index 00000000..fd7ff50c --- /dev/null +++ b/src/CloudPDF/Types/SharesArchive200ResponseShareVisitorIdentityFieldsTitle.cs @@ -0,0 +1,130 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesArchive200ResponseShareVisitorIdentityFieldsTitle.SharesArchive200ResponseShareVisitorIdentityFieldsTitleSerializer) +)] +[Serializable] +public readonly record struct SharesArchive200ResponseShareVisitorIdentityFieldsTitle : IStringEnum +{ + public static readonly SharesArchive200ResponseShareVisitorIdentityFieldsTitle Required = new( + Values.Required + ); + + public static readonly SharesArchive200ResponseShareVisitorIdentityFieldsTitle Optional = new( + Values.Optional + ); + + public SharesArchive200ResponseShareVisitorIdentityFieldsTitle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesArchive200ResponseShareVisitorIdentityFieldsTitle FromCustom(string value) + { + return new SharesArchive200ResponseShareVisitorIdentityFieldsTitle(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 ==( + SharesArchive200ResponseShareVisitorIdentityFieldsTitle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesArchive200ResponseShareVisitorIdentityFieldsTitle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesArchive200ResponseShareVisitorIdentityFieldsTitle value + ) => value.Value; + + public static explicit operator SharesArchive200ResponseShareVisitorIdentityFieldsTitle( + string value + ) => new(value); + + internal class SharesArchive200ResponseShareVisitorIdentityFieldsTitleSerializer + : JsonConverter + { + public override SharesArchive200ResponseShareVisitorIdentityFieldsTitle 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 SharesArchive200ResponseShareVisitorIdentityFieldsTitle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesArchive200ResponseShareVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesArchive200ResponseShareVisitorIdentityFieldsTitle 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 SharesArchive200ResponseShareVisitorIdentityFieldsTitle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesArchive200ResponseShareVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesCreate200ResponseShare.cs b/src/CloudPDF/Types/SharesCreate200ResponseShare.cs index 676e2627..b4b2d0cd 100644 --- a/src/CloudPDF/Types/SharesCreate200ResponseShare.cs +++ b/src/CloudPDF/Types/SharesCreate200ResponseShare.cs @@ -20,8 +20,20 @@ public record SharesCreate200ResponseShare : IJsonOnDeserialized [JsonPropertyName("docId")] public required string DocId { get; set; } + [JsonPropertyName("layerMode")] + public required SharesCreate200ResponseShareLayerMode LayerMode { get; set; } + [JsonPropertyName("layerName")] - public required string LayerName { get; set; } + public string? LayerName { get; set; } + + [JsonPropertyName("keepVisitorLayers")] + public required bool KeepVisitorLayers { get; set; } + + [JsonPropertyName("visitorIdleSeconds")] + public double? VisitorIdleSeconds { get; set; } + + [JsonPropertyName("visitorIdentity")] + public SharesCreate200ResponseShareVisitorIdentity? VisitorIdentity { get; set; } [JsonPropertyName("scope")] public IEnumerable Scope { get; set; } = new List(); @@ -38,6 +50,9 @@ public record SharesCreate200ResponseShare : IJsonOnDeserialized [JsonPropertyName("disabled")] public required bool Disabled { get; set; } + [JsonPropertyName("archivedAt")] + public double? ArchivedAt { get; set; } + [JsonPropertyName("expiresAt")] public double? ExpiresAt { get; set; } diff --git a/src/CloudPDF/Types/SharesCreate200ResponseShareLayerMode.cs b/src/CloudPDF/Types/SharesCreate200ResponseShareLayerMode.cs new file mode 100644 index 00000000..6abdbb52 --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate200ResponseShareLayerMode.cs @@ -0,0 +1,122 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesCreate200ResponseShareLayerMode.SharesCreate200ResponseShareLayerModeSerializer) +)] +[Serializable] +public readonly record struct SharesCreate200ResponseShareLayerMode : IStringEnum +{ + public static readonly SharesCreate200ResponseShareLayerMode Shared = new(Values.Shared); + + public static readonly SharesCreate200ResponseShareLayerMode PerVisitor = new( + Values.PerVisitor + ); + + public SharesCreate200ResponseShareLayerMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreate200ResponseShareLayerMode FromCustom(string value) + { + return new SharesCreate200ResponseShareLayerMode(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 ==(SharesCreate200ResponseShareLayerMode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(SharesCreate200ResponseShareLayerMode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(SharesCreate200ResponseShareLayerMode value) => + value.Value; + + public static explicit operator SharesCreate200ResponseShareLayerMode(string value) => + new(value); + + internal class SharesCreate200ResponseShareLayerModeSerializer + : JsonConverter + { + public override SharesCreate200ResponseShareLayerMode 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 SharesCreate200ResponseShareLayerMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreate200ResponseShareLayerMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreate200ResponseShareLayerMode 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 SharesCreate200ResponseShareLayerMode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreate200ResponseShareLayerMode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Shared = "shared"; + + public const string PerVisitor = "per-visitor"; + } +} diff --git a/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentity.cs b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentity.cs new file mode 100644 index 00000000..1907e86a --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentity.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesCreate200ResponseShareVisitorIdentity : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("fields")] + public required SharesCreate200ResponseShareVisitorIdentityFields Fields { get; set; } + + [JsonPropertyName("ask")] + public required SharesCreate200ResponseShareVisitorIdentityAsk Ask { get; set; } + + [JsonPropertyName("purpose")] + public string? Purpose { get; set; } + + [JsonPropertyName("privacyUrl")] + public string? PrivacyUrl { 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/SharesCreate200ResponseShareVisitorIdentityAsk.cs b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityAsk.cs new file mode 100644 index 00000000..3d89bea1 --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityAsk.cs @@ -0,0 +1,128 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesCreate200ResponseShareVisitorIdentityAsk.SharesCreate200ResponseShareVisitorIdentityAskSerializer) +)] +[Serializable] +public readonly record struct SharesCreate200ResponseShareVisitorIdentityAsk : IStringEnum +{ + public static readonly SharesCreate200ResponseShareVisitorIdentityAsk OnOpen = new( + Values.OnOpen + ); + + public static readonly SharesCreate200ResponseShareVisitorIdentityAsk BeforeFirstChange = new( + Values.BeforeFirstChange + ); + + public SharesCreate200ResponseShareVisitorIdentityAsk(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreate200ResponseShareVisitorIdentityAsk FromCustom(string value) + { + return new SharesCreate200ResponseShareVisitorIdentityAsk(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 ==( + SharesCreate200ResponseShareVisitorIdentityAsk value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesCreate200ResponseShareVisitorIdentityAsk value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(SharesCreate200ResponseShareVisitorIdentityAsk value) => + value.Value; + + public static explicit operator SharesCreate200ResponseShareVisitorIdentityAsk(string value) => + new(value); + + internal class SharesCreate200ResponseShareVisitorIdentityAskSerializer + : JsonConverter + { + public override SharesCreate200ResponseShareVisitorIdentityAsk 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 SharesCreate200ResponseShareVisitorIdentityAsk(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreate200ResponseShareVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreate200ResponseShareVisitorIdentityAsk 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 SharesCreate200ResponseShareVisitorIdentityAsk(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreate200ResponseShareVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string OnOpen = "on-open"; + + public const string BeforeFirstChange = "before-first-change"; + } +} diff --git a/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFields.cs b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFields.cs new file mode 100644 index 00000000..c7792778 --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFields.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesCreate200ResponseShareVisitorIdentityFields : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("displayName")] + public SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName? DisplayName { get; set; } + + [JsonPropertyName("email")] + public SharesCreate200ResponseShareVisitorIdentityFieldsEmail? Email { get; set; } + + [JsonPropertyName("title")] + public SharesCreate200ResponseShareVisitorIdentityFieldsTitle? Title { get; set; } + + [JsonPropertyName("organization")] + public SharesCreate200ResponseShareVisitorIdentityFieldsOrganization? Organization { get; set; } + + [JsonPropertyName("organizationalUnit")] + public SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit? OrganizationalUnit { 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/SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName.cs b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName.cs new file mode 100644 index 00000000..332e71cf --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName.SharesCreate200ResponseShareVisitorIdentityFieldsDisplayNameSerializer) +)] +[Serializable] +public readonly record struct SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName + : IStringEnum +{ + public static readonly SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName Required = + new(Values.Required); + + public static readonly SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName Optional = + new(Values.Optional); + + public SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName FromCustom( + string value + ) + { + return new SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName(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 ==( + SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName value + ) => value.Value; + + public static explicit operator SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName( + string value + ) => new(value); + + internal class SharesCreate200ResponseShareVisitorIdentityFieldsDisplayNameSerializer + : JsonConverter + { + public override SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName 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 SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName 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 SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreate200ResponseShareVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsEmail.cs b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsEmail.cs new file mode 100644 index 00000000..885171c8 --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsEmail.cs @@ -0,0 +1,130 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesCreate200ResponseShareVisitorIdentityFieldsEmail.SharesCreate200ResponseShareVisitorIdentityFieldsEmailSerializer) +)] +[Serializable] +public readonly record struct SharesCreate200ResponseShareVisitorIdentityFieldsEmail : IStringEnum +{ + public static readonly SharesCreate200ResponseShareVisitorIdentityFieldsEmail Required = new( + Values.Required + ); + + public static readonly SharesCreate200ResponseShareVisitorIdentityFieldsEmail Optional = new( + Values.Optional + ); + + public SharesCreate200ResponseShareVisitorIdentityFieldsEmail(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreate200ResponseShareVisitorIdentityFieldsEmail FromCustom(string value) + { + return new SharesCreate200ResponseShareVisitorIdentityFieldsEmail(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 ==( + SharesCreate200ResponseShareVisitorIdentityFieldsEmail value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesCreate200ResponseShareVisitorIdentityFieldsEmail value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesCreate200ResponseShareVisitorIdentityFieldsEmail value + ) => value.Value; + + public static explicit operator SharesCreate200ResponseShareVisitorIdentityFieldsEmail( + string value + ) => new(value); + + internal class SharesCreate200ResponseShareVisitorIdentityFieldsEmailSerializer + : JsonConverter + { + public override SharesCreate200ResponseShareVisitorIdentityFieldsEmail 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 SharesCreate200ResponseShareVisitorIdentityFieldsEmail(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreate200ResponseShareVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreate200ResponseShareVisitorIdentityFieldsEmail 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 SharesCreate200ResponseShareVisitorIdentityFieldsEmail(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreate200ResponseShareVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsOrganization.cs b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsOrganization.cs new file mode 100644 index 00000000..45315b47 --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsOrganization.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesCreate200ResponseShareVisitorIdentityFieldsOrganization.SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationSerializer) +)] +[Serializable] +public readonly record struct SharesCreate200ResponseShareVisitorIdentityFieldsOrganization + : IStringEnum +{ + public static readonly SharesCreate200ResponseShareVisitorIdentityFieldsOrganization Required = + new(Values.Required); + + public static readonly SharesCreate200ResponseShareVisitorIdentityFieldsOrganization Optional = + new(Values.Optional); + + public SharesCreate200ResponseShareVisitorIdentityFieldsOrganization(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreate200ResponseShareVisitorIdentityFieldsOrganization FromCustom( + string value + ) + { + return new SharesCreate200ResponseShareVisitorIdentityFieldsOrganization(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 ==( + SharesCreate200ResponseShareVisitorIdentityFieldsOrganization value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesCreate200ResponseShareVisitorIdentityFieldsOrganization value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesCreate200ResponseShareVisitorIdentityFieldsOrganization value + ) => value.Value; + + public static explicit operator SharesCreate200ResponseShareVisitorIdentityFieldsOrganization( + string value + ) => new(value); + + internal class SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationSerializer + : JsonConverter + { + public override SharesCreate200ResponseShareVisitorIdentityFieldsOrganization 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 SharesCreate200ResponseShareVisitorIdentityFieldsOrganization(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreate200ResponseShareVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreate200ResponseShareVisitorIdentityFieldsOrganization 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 SharesCreate200ResponseShareVisitorIdentityFieldsOrganization(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreate200ResponseShareVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit.cs b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit.cs new file mode 100644 index 00000000..a53b2ac7 --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit.cs @@ -0,0 +1,135 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit.SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnitSerializer) +)] +[Serializable] +public readonly record struct SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit + : IStringEnum +{ + public static readonly SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit Required = + new(Values.Required); + + public static readonly SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit Optional = + new(Values.Optional); + + public SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit FromCustom( + string value + ) + { + return new SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit(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 ==( + SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit value + ) => value.Value; + + public static explicit operator SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit( + string value + ) => new(value); + + internal class SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnitSerializer + : JsonConverter + { + public override SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit 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 SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit( + stringValue + ); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit 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 SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit( + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreate200ResponseShareVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsTitle.cs b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsTitle.cs new file mode 100644 index 00000000..9350b96d --- /dev/null +++ b/src/CloudPDF/Types/SharesCreate200ResponseShareVisitorIdentityFieldsTitle.cs @@ -0,0 +1,130 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesCreate200ResponseShareVisitorIdentityFieldsTitle.SharesCreate200ResponseShareVisitorIdentityFieldsTitleSerializer) +)] +[Serializable] +public readonly record struct SharesCreate200ResponseShareVisitorIdentityFieldsTitle : IStringEnum +{ + public static readonly SharesCreate200ResponseShareVisitorIdentityFieldsTitle Required = new( + Values.Required + ); + + public static readonly SharesCreate200ResponseShareVisitorIdentityFieldsTitle Optional = new( + Values.Optional + ); + + public SharesCreate200ResponseShareVisitorIdentityFieldsTitle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesCreate200ResponseShareVisitorIdentityFieldsTitle FromCustom(string value) + { + return new SharesCreate200ResponseShareVisitorIdentityFieldsTitle(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 ==( + SharesCreate200ResponseShareVisitorIdentityFieldsTitle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesCreate200ResponseShareVisitorIdentityFieldsTitle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesCreate200ResponseShareVisitorIdentityFieldsTitle value + ) => value.Value; + + public static explicit operator SharesCreate200ResponseShareVisitorIdentityFieldsTitle( + string value + ) => new(value); + + internal class SharesCreate200ResponseShareVisitorIdentityFieldsTitleSerializer + : JsonConverter + { + public override SharesCreate200ResponseShareVisitorIdentityFieldsTitle 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 SharesCreate200ResponseShareVisitorIdentityFieldsTitle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesCreate200ResponseShareVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesCreate200ResponseShareVisitorIdentityFieldsTitle 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 SharesCreate200ResponseShareVisitorIdentityFieldsTitle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesCreate200ResponseShareVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesExchange200Response.cs b/src/CloudPDF/Types/SharesExchange200Response.cs index 99ace16a..8fdd4bfa 100644 --- a/src/CloudPDF/Types/SharesExchange200Response.cs +++ b/src/CloudPDF/Types/SharesExchange200Response.cs @@ -20,6 +20,12 @@ public record SharesExchange200Response : IJsonOnDeserialized [JsonPropertyName("layerName")] public required string LayerName { get; set; } + [JsonPropertyName("layerMode")] + public required SharesExchange200ResponseLayerMode LayerMode { get; set; } + + [JsonPropertyName("visitor")] + public required SharesExchange200ResponseVisitor Visitor { get; set; } + [JsonPropertyName("expiresAt")] public required double ExpiresAt { get; set; } diff --git a/src/CloudPDF/Types/SharesExchange200ResponseLayerMode.cs b/src/CloudPDF/Types/SharesExchange200ResponseLayerMode.cs new file mode 100644 index 00000000..524522d4 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange200ResponseLayerMode.cs @@ -0,0 +1,118 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesExchange200ResponseLayerMode.SharesExchange200ResponseLayerModeSerializer) +)] +[Serializable] +public readonly record struct SharesExchange200ResponseLayerMode : IStringEnum +{ + public static readonly SharesExchange200ResponseLayerMode Shared = new(Values.Shared); + + public static readonly SharesExchange200ResponseLayerMode PerVisitor = new(Values.PerVisitor); + + public SharesExchange200ResponseLayerMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesExchange200ResponseLayerMode FromCustom(string value) + { + return new SharesExchange200ResponseLayerMode(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 ==(SharesExchange200ResponseLayerMode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(SharesExchange200ResponseLayerMode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(SharesExchange200ResponseLayerMode value) => value.Value; + + public static explicit operator SharesExchange200ResponseLayerMode(string value) => new(value); + + internal class SharesExchange200ResponseLayerModeSerializer + : JsonConverter + { + public override SharesExchange200ResponseLayerMode 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 SharesExchange200ResponseLayerMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesExchange200ResponseLayerMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesExchange200ResponseLayerMode 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 SharesExchange200ResponseLayerMode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesExchange200ResponseLayerMode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Shared = "shared"; + + public const string PerVisitor = "per-visitor"; + } +} diff --git a/src/CloudPDF/Types/SharesExchange200ResponseVisitor.cs b/src/CloudPDF/Types/SharesExchange200ResponseVisitor.cs new file mode 100644 index 00000000..d05cbadc --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange200ResponseVisitor.cs @@ -0,0 +1,34 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange200ResponseVisitor : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("handle")] + public required string Handle { get; set; } + + [JsonPropertyName("keep")] + public required bool Keep { get; set; } + + [JsonPropertyName("identityRequest")] + public SharesExchange200ResponseVisitorIdentityRequest? IdentityRequest { 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/SharesExchange200ResponseVisitorIdentityRequest.cs b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequest.cs new file mode 100644 index 00000000..568c8c9f --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequest.cs @@ -0,0 +1,42 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange200ResponseVisitorIdentityRequest : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("fields")] + public required SharesExchange200ResponseVisitorIdentityRequestFields Fields { get; set; } + + [JsonPropertyName("missing")] + public IEnumerable Missing { get; set; } = + new List(); + + [JsonPropertyName("invalid")] + public IEnumerable Invalid { get; set; } = + new List(); + + [JsonPropertyName("purpose")] + public string? Purpose { get; set; } + + [JsonPropertyName("privacyUrl")] + public string? PrivacyUrl { 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/SharesExchange200ResponseVisitorIdentityRequestFields.cs b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFields.cs new file mode 100644 index 00000000..11d47a5a --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFields.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesExchange200ResponseVisitorIdentityRequestFields : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("displayName")] + public SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName? DisplayName { get; set; } + + [JsonPropertyName("email")] + public SharesExchange200ResponseVisitorIdentityRequestFieldsEmail? Email { get; set; } + + [JsonPropertyName("title")] + public SharesExchange200ResponseVisitorIdentityRequestFieldsTitle? Title { get; set; } + + [JsonPropertyName("organization")] + public SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization? Organization { get; set; } + + [JsonPropertyName("organizationalUnit")] + public SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit? OrganizationalUnit { 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/SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName.cs b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName.cs new file mode 100644 index 00000000..f13054c7 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName.cs @@ -0,0 +1,135 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName.SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayNameSerializer) +)] +[Serializable] +public readonly record struct SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName + : IStringEnum +{ + public static readonly SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName Required = + new(Values.Required); + + public static readonly SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName Optional = + new(Values.Optional); + + public SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName FromCustom( + string value + ) + { + return new SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName(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 ==( + SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName value + ) => value.Value; + + public static explicit operator SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName( + string value + ) => new(value); + + internal class SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayNameSerializer + : JsonConverter + { + public override SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName 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 SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName( + stringValue + ); + } + + public override void Write( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName 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 SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName( + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsEmail.cs b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsEmail.cs new file mode 100644 index 00000000..61cf56a9 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsEmail.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesExchange200ResponseVisitorIdentityRequestFieldsEmail.SharesExchange200ResponseVisitorIdentityRequestFieldsEmailSerializer) +)] +[Serializable] +public readonly record struct SharesExchange200ResponseVisitorIdentityRequestFieldsEmail + : IStringEnum +{ + public static readonly SharesExchange200ResponseVisitorIdentityRequestFieldsEmail Required = + new(Values.Required); + + public static readonly SharesExchange200ResponseVisitorIdentityRequestFieldsEmail Optional = + new(Values.Optional); + + public SharesExchange200ResponseVisitorIdentityRequestFieldsEmail(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesExchange200ResponseVisitorIdentityRequestFieldsEmail FromCustom( + string value + ) + { + return new SharesExchange200ResponseVisitorIdentityRequestFieldsEmail(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 ==( + SharesExchange200ResponseVisitorIdentityRequestFieldsEmail value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesExchange200ResponseVisitorIdentityRequestFieldsEmail value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesExchange200ResponseVisitorIdentityRequestFieldsEmail value + ) => value.Value; + + public static explicit operator SharesExchange200ResponseVisitorIdentityRequestFieldsEmail( + string value + ) => new(value); + + internal class SharesExchange200ResponseVisitorIdentityRequestFieldsEmailSerializer + : JsonConverter + { + public override SharesExchange200ResponseVisitorIdentityRequestFieldsEmail 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 SharesExchange200ResponseVisitorIdentityRequestFieldsEmail(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesExchange200ResponseVisitorIdentityRequestFieldsEmail 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 SharesExchange200ResponseVisitorIdentityRequestFieldsEmail(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization.cs b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization.cs new file mode 100644 index 00000000..5d2d49bc --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization.cs @@ -0,0 +1,135 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization.SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationSerializer) +)] +[Serializable] +public readonly record struct SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization + : IStringEnum +{ + public static readonly SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization Required = + new(Values.Required); + + public static readonly SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization Optional = + new(Values.Optional); + + public SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization FromCustom( + string value + ) + { + return new SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization(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 ==( + SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization value + ) => value.Value; + + public static explicit operator SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization( + string value + ) => new(value); + + internal class SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationSerializer + : JsonConverter + { + public override SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization 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 SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization( + stringValue + ); + } + + public override void Write( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization 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 SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization( + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit.cs b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit.cs new file mode 100644 index 00000000..fbed0583 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit.cs @@ -0,0 +1,135 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit.SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnitSerializer) +)] +[Serializable] +public readonly record struct SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit + : IStringEnum +{ + public static readonly SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit Required = + new(Values.Required); + + public static readonly SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit Optional = + new(Values.Optional); + + public SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit FromCustom( + string value + ) + { + return new SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit(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 ==( + SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit value + ) => value.Value; + + public static explicit operator SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit( + string value + ) => new(value); + + internal class SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnitSerializer + : JsonConverter + { + public override SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit 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 SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit( + stringValue + ); + } + + public override void Write( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit 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 SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit( + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsTitle.cs b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsTitle.cs new file mode 100644 index 00000000..6a9d3e64 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestFieldsTitle.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesExchange200ResponseVisitorIdentityRequestFieldsTitle.SharesExchange200ResponseVisitorIdentityRequestFieldsTitleSerializer) +)] +[Serializable] +public readonly record struct SharesExchange200ResponseVisitorIdentityRequestFieldsTitle + : IStringEnum +{ + public static readonly SharesExchange200ResponseVisitorIdentityRequestFieldsTitle Required = + new(Values.Required); + + public static readonly SharesExchange200ResponseVisitorIdentityRequestFieldsTitle Optional = + new(Values.Optional); + + public SharesExchange200ResponseVisitorIdentityRequestFieldsTitle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesExchange200ResponseVisitorIdentityRequestFieldsTitle FromCustom( + string value + ) + { + return new SharesExchange200ResponseVisitorIdentityRequestFieldsTitle(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 ==( + SharesExchange200ResponseVisitorIdentityRequestFieldsTitle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesExchange200ResponseVisitorIdentityRequestFieldsTitle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesExchange200ResponseVisitorIdentityRequestFieldsTitle value + ) => value.Value; + + public static explicit operator SharesExchange200ResponseVisitorIdentityRequestFieldsTitle( + string value + ) => new(value); + + internal class SharesExchange200ResponseVisitorIdentityRequestFieldsTitleSerializer + : JsonConverter + { + public override SharesExchange200ResponseVisitorIdentityRequestFieldsTitle 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 SharesExchange200ResponseVisitorIdentityRequestFieldsTitle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesExchange200ResponseVisitorIdentityRequestFieldsTitle 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 SharesExchange200ResponseVisitorIdentityRequestFieldsTitle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestInvalidItem.cs b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestInvalidItem.cs new file mode 100644 index 00000000..838ac540 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestInvalidItem.cs @@ -0,0 +1,148 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesExchange200ResponseVisitorIdentityRequestInvalidItem.SharesExchange200ResponseVisitorIdentityRequestInvalidItemSerializer) +)] +[Serializable] +public readonly record struct SharesExchange200ResponseVisitorIdentityRequestInvalidItem + : IStringEnum +{ + public static readonly SharesExchange200ResponseVisitorIdentityRequestInvalidItem DisplayName = + new(Values.DisplayName); + + public static readonly SharesExchange200ResponseVisitorIdentityRequestInvalidItem Email = new( + Values.Email + ); + + public static readonly SharesExchange200ResponseVisitorIdentityRequestInvalidItem Title = new( + Values.Title + ); + + public static readonly SharesExchange200ResponseVisitorIdentityRequestInvalidItem Organization = + new(Values.Organization); + + public static readonly SharesExchange200ResponseVisitorIdentityRequestInvalidItem OrganizationalUnit = + new(Values.OrganizationalUnit); + + public SharesExchange200ResponseVisitorIdentityRequestInvalidItem(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesExchange200ResponseVisitorIdentityRequestInvalidItem FromCustom( + string value + ) + { + return new SharesExchange200ResponseVisitorIdentityRequestInvalidItem(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 ==( + SharesExchange200ResponseVisitorIdentityRequestInvalidItem value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesExchange200ResponseVisitorIdentityRequestInvalidItem value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesExchange200ResponseVisitorIdentityRequestInvalidItem value + ) => value.Value; + + public static explicit operator SharesExchange200ResponseVisitorIdentityRequestInvalidItem( + string value + ) => new(value); + + internal class SharesExchange200ResponseVisitorIdentityRequestInvalidItemSerializer + : JsonConverter + { + public override SharesExchange200ResponseVisitorIdentityRequestInvalidItem 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 SharesExchange200ResponseVisitorIdentityRequestInvalidItem(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestInvalidItem value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesExchange200ResponseVisitorIdentityRequestInvalidItem 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 SharesExchange200ResponseVisitorIdentityRequestInvalidItem(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestInvalidItem value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string DisplayName = "displayName"; + + public const string Email = "email"; + + public const string Title = "title"; + + public const string Organization = "organization"; + + public const string OrganizationalUnit = "organizationalUnit"; + } +} diff --git a/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestMissingItem.cs b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestMissingItem.cs new file mode 100644 index 00000000..2d46ce73 --- /dev/null +++ b/src/CloudPDF/Types/SharesExchange200ResponseVisitorIdentityRequestMissingItem.cs @@ -0,0 +1,148 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesExchange200ResponseVisitorIdentityRequestMissingItem.SharesExchange200ResponseVisitorIdentityRequestMissingItemSerializer) +)] +[Serializable] +public readonly record struct SharesExchange200ResponseVisitorIdentityRequestMissingItem + : IStringEnum +{ + public static readonly SharesExchange200ResponseVisitorIdentityRequestMissingItem DisplayName = + new(Values.DisplayName); + + public static readonly SharesExchange200ResponseVisitorIdentityRequestMissingItem Email = new( + Values.Email + ); + + public static readonly SharesExchange200ResponseVisitorIdentityRequestMissingItem Title = new( + Values.Title + ); + + public static readonly SharesExchange200ResponseVisitorIdentityRequestMissingItem Organization = + new(Values.Organization); + + public static readonly SharesExchange200ResponseVisitorIdentityRequestMissingItem OrganizationalUnit = + new(Values.OrganizationalUnit); + + public SharesExchange200ResponseVisitorIdentityRequestMissingItem(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesExchange200ResponseVisitorIdentityRequestMissingItem FromCustom( + string value + ) + { + return new SharesExchange200ResponseVisitorIdentityRequestMissingItem(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 ==( + SharesExchange200ResponseVisitorIdentityRequestMissingItem value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesExchange200ResponseVisitorIdentityRequestMissingItem value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesExchange200ResponseVisitorIdentityRequestMissingItem value + ) => value.Value; + + public static explicit operator SharesExchange200ResponseVisitorIdentityRequestMissingItem( + string value + ) => new(value); + + internal class SharesExchange200ResponseVisitorIdentityRequestMissingItemSerializer + : JsonConverter + { + public override SharesExchange200ResponseVisitorIdentityRequestMissingItem 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 SharesExchange200ResponseVisitorIdentityRequestMissingItem(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestMissingItem value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesExchange200ResponseVisitorIdentityRequestMissingItem 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 SharesExchange200ResponseVisitorIdentityRequestMissingItem(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesExchange200ResponseVisitorIdentityRequestMissingItem value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string DisplayName = "displayName"; + + public const string Email = "email"; + + public const string Title = "title"; + + public const string Organization = "organization"; + + public const string OrganizationalUnit = "organizationalUnit"; + } +} diff --git a/src/CloudPDF/Types/SharesGet200ResponseShare.cs b/src/CloudPDF/Types/SharesGet200ResponseShare.cs index f2e47f32..c18ac3c4 100644 --- a/src/CloudPDF/Types/SharesGet200ResponseShare.cs +++ b/src/CloudPDF/Types/SharesGet200ResponseShare.cs @@ -20,8 +20,20 @@ public record SharesGet200ResponseShare : IJsonOnDeserialized [JsonPropertyName("docId")] public required string DocId { get; set; } + [JsonPropertyName("layerMode")] + public required SharesGet200ResponseShareLayerMode LayerMode { get; set; } + [JsonPropertyName("layerName")] - public required string LayerName { get; set; } + public string? LayerName { get; set; } + + [JsonPropertyName("keepVisitorLayers")] + public required bool KeepVisitorLayers { get; set; } + + [JsonPropertyName("visitorIdleSeconds")] + public double? VisitorIdleSeconds { get; set; } + + [JsonPropertyName("visitorIdentity")] + public SharesGet200ResponseShareVisitorIdentity? VisitorIdentity { get; set; } [JsonPropertyName("scope")] public IEnumerable Scope { get; set; } = new List(); @@ -38,6 +50,9 @@ public record SharesGet200ResponseShare : IJsonOnDeserialized [JsonPropertyName("disabled")] public required bool Disabled { get; set; } + [JsonPropertyName("archivedAt")] + public double? ArchivedAt { get; set; } + [JsonPropertyName("expiresAt")] public double? ExpiresAt { get; set; } diff --git a/src/CloudPDF/Types/SharesGet200ResponseShareLayerMode.cs b/src/CloudPDF/Types/SharesGet200ResponseShareLayerMode.cs new file mode 100644 index 00000000..83dc85d3 --- /dev/null +++ b/src/CloudPDF/Types/SharesGet200ResponseShareLayerMode.cs @@ -0,0 +1,118 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesGet200ResponseShareLayerMode.SharesGet200ResponseShareLayerModeSerializer) +)] +[Serializable] +public readonly record struct SharesGet200ResponseShareLayerMode : IStringEnum +{ + public static readonly SharesGet200ResponseShareLayerMode Shared = new(Values.Shared); + + public static readonly SharesGet200ResponseShareLayerMode PerVisitor = new(Values.PerVisitor); + + public SharesGet200ResponseShareLayerMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesGet200ResponseShareLayerMode FromCustom(string value) + { + return new SharesGet200ResponseShareLayerMode(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 ==(SharesGet200ResponseShareLayerMode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(SharesGet200ResponseShareLayerMode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(SharesGet200ResponseShareLayerMode value) => value.Value; + + public static explicit operator SharesGet200ResponseShareLayerMode(string value) => new(value); + + internal class SharesGet200ResponseShareLayerModeSerializer + : JsonConverter + { + public override SharesGet200ResponseShareLayerMode 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 SharesGet200ResponseShareLayerMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesGet200ResponseShareLayerMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesGet200ResponseShareLayerMode 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 SharesGet200ResponseShareLayerMode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesGet200ResponseShareLayerMode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Shared = "shared"; + + public const string PerVisitor = "per-visitor"; + } +} diff --git a/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentity.cs b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentity.cs new file mode 100644 index 00000000..49a1b1b7 --- /dev/null +++ b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentity.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesGet200ResponseShareVisitorIdentity : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("fields")] + public required SharesGet200ResponseShareVisitorIdentityFields Fields { get; set; } + + [JsonPropertyName("ask")] + public required SharesGet200ResponseShareVisitorIdentityAsk Ask { get; set; } + + [JsonPropertyName("purpose")] + public string? Purpose { get; set; } + + [JsonPropertyName("privacyUrl")] + public string? PrivacyUrl { 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/SharesGet200ResponseShareVisitorIdentityAsk.cs b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityAsk.cs new file mode 100644 index 00000000..b3974a46 --- /dev/null +++ b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityAsk.cs @@ -0,0 +1,126 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesGet200ResponseShareVisitorIdentityAsk.SharesGet200ResponseShareVisitorIdentityAskSerializer) +)] +[Serializable] +public readonly record struct SharesGet200ResponseShareVisitorIdentityAsk : IStringEnum +{ + public static readonly SharesGet200ResponseShareVisitorIdentityAsk OnOpen = new(Values.OnOpen); + + public static readonly SharesGet200ResponseShareVisitorIdentityAsk BeforeFirstChange = new( + Values.BeforeFirstChange + ); + + public SharesGet200ResponseShareVisitorIdentityAsk(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesGet200ResponseShareVisitorIdentityAsk FromCustom(string value) + { + return new SharesGet200ResponseShareVisitorIdentityAsk(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 ==( + SharesGet200ResponseShareVisitorIdentityAsk value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesGet200ResponseShareVisitorIdentityAsk value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(SharesGet200ResponseShareVisitorIdentityAsk value) => + value.Value; + + public static explicit operator SharesGet200ResponseShareVisitorIdentityAsk(string value) => + new(value); + + internal class SharesGet200ResponseShareVisitorIdentityAskSerializer + : JsonConverter + { + public override SharesGet200ResponseShareVisitorIdentityAsk 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 SharesGet200ResponseShareVisitorIdentityAsk(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesGet200ResponseShareVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesGet200ResponseShareVisitorIdentityAsk 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 SharesGet200ResponseShareVisitorIdentityAsk(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesGet200ResponseShareVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string OnOpen = "on-open"; + + public const string BeforeFirstChange = "before-first-change"; + } +} diff --git a/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFields.cs b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFields.cs new file mode 100644 index 00000000..bd96d1f5 --- /dev/null +++ b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFields.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesGet200ResponseShareVisitorIdentityFields : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("displayName")] + public SharesGet200ResponseShareVisitorIdentityFieldsDisplayName? DisplayName { get; set; } + + [JsonPropertyName("email")] + public SharesGet200ResponseShareVisitorIdentityFieldsEmail? Email { get; set; } + + [JsonPropertyName("title")] + public SharesGet200ResponseShareVisitorIdentityFieldsTitle? Title { get; set; } + + [JsonPropertyName("organization")] + public SharesGet200ResponseShareVisitorIdentityFieldsOrganization? Organization { get; set; } + + [JsonPropertyName("organizationalUnit")] + public SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit? OrganizationalUnit { 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/SharesGet200ResponseShareVisitorIdentityFieldsDisplayName.cs b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsDisplayName.cs new file mode 100644 index 00000000..a8c5359e --- /dev/null +++ b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsDisplayName.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesGet200ResponseShareVisitorIdentityFieldsDisplayName.SharesGet200ResponseShareVisitorIdentityFieldsDisplayNameSerializer) +)] +[Serializable] +public readonly record struct SharesGet200ResponseShareVisitorIdentityFieldsDisplayName + : IStringEnum +{ + public static readonly SharesGet200ResponseShareVisitorIdentityFieldsDisplayName Required = new( + Values.Required + ); + + public static readonly SharesGet200ResponseShareVisitorIdentityFieldsDisplayName Optional = new( + Values.Optional + ); + + public SharesGet200ResponseShareVisitorIdentityFieldsDisplayName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesGet200ResponseShareVisitorIdentityFieldsDisplayName FromCustom(string value) + { + return new SharesGet200ResponseShareVisitorIdentityFieldsDisplayName(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 ==( + SharesGet200ResponseShareVisitorIdentityFieldsDisplayName value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesGet200ResponseShareVisitorIdentityFieldsDisplayName value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesGet200ResponseShareVisitorIdentityFieldsDisplayName value + ) => value.Value; + + public static explicit operator SharesGet200ResponseShareVisitorIdentityFieldsDisplayName( + string value + ) => new(value); + + internal class SharesGet200ResponseShareVisitorIdentityFieldsDisplayNameSerializer + : JsonConverter + { + public override SharesGet200ResponseShareVisitorIdentityFieldsDisplayName 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 SharesGet200ResponseShareVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesGet200ResponseShareVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesGet200ResponseShareVisitorIdentityFieldsDisplayName 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 SharesGet200ResponseShareVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesGet200ResponseShareVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsEmail.cs b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsEmail.cs new file mode 100644 index 00000000..1ae7f1cf --- /dev/null +++ b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsEmail.cs @@ -0,0 +1,130 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesGet200ResponseShareVisitorIdentityFieldsEmail.SharesGet200ResponseShareVisitorIdentityFieldsEmailSerializer) +)] +[Serializable] +public readonly record struct SharesGet200ResponseShareVisitorIdentityFieldsEmail : IStringEnum +{ + public static readonly SharesGet200ResponseShareVisitorIdentityFieldsEmail Required = new( + Values.Required + ); + + public static readonly SharesGet200ResponseShareVisitorIdentityFieldsEmail Optional = new( + Values.Optional + ); + + public SharesGet200ResponseShareVisitorIdentityFieldsEmail(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesGet200ResponseShareVisitorIdentityFieldsEmail FromCustom(string value) + { + return new SharesGet200ResponseShareVisitorIdentityFieldsEmail(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 ==( + SharesGet200ResponseShareVisitorIdentityFieldsEmail value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesGet200ResponseShareVisitorIdentityFieldsEmail value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesGet200ResponseShareVisitorIdentityFieldsEmail value + ) => value.Value; + + public static explicit operator SharesGet200ResponseShareVisitorIdentityFieldsEmail( + string value + ) => new(value); + + internal class SharesGet200ResponseShareVisitorIdentityFieldsEmailSerializer + : JsonConverter + { + public override SharesGet200ResponseShareVisitorIdentityFieldsEmail 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 SharesGet200ResponseShareVisitorIdentityFieldsEmail(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesGet200ResponseShareVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesGet200ResponseShareVisitorIdentityFieldsEmail 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 SharesGet200ResponseShareVisitorIdentityFieldsEmail(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesGet200ResponseShareVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsOrganization.cs b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsOrganization.cs new file mode 100644 index 00000000..859ab554 --- /dev/null +++ b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsOrganization.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesGet200ResponseShareVisitorIdentityFieldsOrganization.SharesGet200ResponseShareVisitorIdentityFieldsOrganizationSerializer) +)] +[Serializable] +public readonly record struct SharesGet200ResponseShareVisitorIdentityFieldsOrganization + : IStringEnum +{ + public static readonly SharesGet200ResponseShareVisitorIdentityFieldsOrganization Required = + new(Values.Required); + + public static readonly SharesGet200ResponseShareVisitorIdentityFieldsOrganization Optional = + new(Values.Optional); + + public SharesGet200ResponseShareVisitorIdentityFieldsOrganization(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesGet200ResponseShareVisitorIdentityFieldsOrganization FromCustom( + string value + ) + { + return new SharesGet200ResponseShareVisitorIdentityFieldsOrganization(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 ==( + SharesGet200ResponseShareVisitorIdentityFieldsOrganization value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesGet200ResponseShareVisitorIdentityFieldsOrganization value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesGet200ResponseShareVisitorIdentityFieldsOrganization value + ) => value.Value; + + public static explicit operator SharesGet200ResponseShareVisitorIdentityFieldsOrganization( + string value + ) => new(value); + + internal class SharesGet200ResponseShareVisitorIdentityFieldsOrganizationSerializer + : JsonConverter + { + public override SharesGet200ResponseShareVisitorIdentityFieldsOrganization 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 SharesGet200ResponseShareVisitorIdentityFieldsOrganization(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesGet200ResponseShareVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesGet200ResponseShareVisitorIdentityFieldsOrganization 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 SharesGet200ResponseShareVisitorIdentityFieldsOrganization(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesGet200ResponseShareVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit.cs b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit.cs new file mode 100644 index 00000000..0ebd2c60 --- /dev/null +++ b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit.cs @@ -0,0 +1,135 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit.SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnitSerializer) +)] +[Serializable] +public readonly record struct SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit + : IStringEnum +{ + public static readonly SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit Required = + new(Values.Required); + + public static readonly SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit Optional = + new(Values.Optional); + + public SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit FromCustom( + string value + ) + { + return new SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit(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 ==( + SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit value + ) => value.Value; + + public static explicit operator SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit( + string value + ) => new(value); + + internal class SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnitSerializer + : JsonConverter + { + public override SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit 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 SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit( + stringValue + ); + } + + public override void Write( + Utf8JsonWriter writer, + SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit 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 SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit( + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesGet200ResponseShareVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsTitle.cs b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsTitle.cs new file mode 100644 index 00000000..2ab1cd94 --- /dev/null +++ b/src/CloudPDF/Types/SharesGet200ResponseShareVisitorIdentityFieldsTitle.cs @@ -0,0 +1,130 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesGet200ResponseShareVisitorIdentityFieldsTitle.SharesGet200ResponseShareVisitorIdentityFieldsTitleSerializer) +)] +[Serializable] +public readonly record struct SharesGet200ResponseShareVisitorIdentityFieldsTitle : IStringEnum +{ + public static readonly SharesGet200ResponseShareVisitorIdentityFieldsTitle Required = new( + Values.Required + ); + + public static readonly SharesGet200ResponseShareVisitorIdentityFieldsTitle Optional = new( + Values.Optional + ); + + public SharesGet200ResponseShareVisitorIdentityFieldsTitle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesGet200ResponseShareVisitorIdentityFieldsTitle FromCustom(string value) + { + return new SharesGet200ResponseShareVisitorIdentityFieldsTitle(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 ==( + SharesGet200ResponseShareVisitorIdentityFieldsTitle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesGet200ResponseShareVisitorIdentityFieldsTitle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesGet200ResponseShareVisitorIdentityFieldsTitle value + ) => value.Value; + + public static explicit operator SharesGet200ResponseShareVisitorIdentityFieldsTitle( + string value + ) => new(value); + + internal class SharesGet200ResponseShareVisitorIdentityFieldsTitleSerializer + : JsonConverter + { + public override SharesGet200ResponseShareVisitorIdentityFieldsTitle 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 SharesGet200ResponseShareVisitorIdentityFieldsTitle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesGet200ResponseShareVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesGet200ResponseShareVisitorIdentityFieldsTitle 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 SharesGet200ResponseShareVisitorIdentityFieldsTitle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesGet200ResponseShareVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesList200ResponseSharesItem.cs b/src/CloudPDF/Types/SharesList200ResponseSharesItem.cs index 793510ec..4c9f91f0 100644 --- a/src/CloudPDF/Types/SharesList200ResponseSharesItem.cs +++ b/src/CloudPDF/Types/SharesList200ResponseSharesItem.cs @@ -20,8 +20,20 @@ public record SharesList200ResponseSharesItem : IJsonOnDeserialized [JsonPropertyName("docId")] public required string DocId { get; set; } + [JsonPropertyName("layerMode")] + public required SharesList200ResponseSharesItemLayerMode LayerMode { get; set; } + [JsonPropertyName("layerName")] - public required string LayerName { get; set; } + public string? LayerName { get; set; } + + [JsonPropertyName("keepVisitorLayers")] + public required bool KeepVisitorLayers { get; set; } + + [JsonPropertyName("visitorIdleSeconds")] + public double? VisitorIdleSeconds { get; set; } + + [JsonPropertyName("visitorIdentity")] + public SharesList200ResponseSharesItemVisitorIdentity? VisitorIdentity { get; set; } [JsonPropertyName("scope")] public IEnumerable Scope { get; set; } = new List(); @@ -38,6 +50,9 @@ public record SharesList200ResponseSharesItem : IJsonOnDeserialized [JsonPropertyName("disabled")] public required bool Disabled { get; set; } + [JsonPropertyName("archivedAt")] + public double? ArchivedAt { get; set; } + [JsonPropertyName("expiresAt")] public double? ExpiresAt { get; set; } diff --git a/src/CloudPDF/Types/SharesList200ResponseSharesItemLayerMode.cs b/src/CloudPDF/Types/SharesList200ResponseSharesItemLayerMode.cs new file mode 100644 index 00000000..e0d4e443 --- /dev/null +++ b/src/CloudPDF/Types/SharesList200ResponseSharesItemLayerMode.cs @@ -0,0 +1,126 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesList200ResponseSharesItemLayerMode.SharesList200ResponseSharesItemLayerModeSerializer) +)] +[Serializable] +public readonly record struct SharesList200ResponseSharesItemLayerMode : IStringEnum +{ + public static readonly SharesList200ResponseSharesItemLayerMode Shared = new(Values.Shared); + + public static readonly SharesList200ResponseSharesItemLayerMode PerVisitor = new( + Values.PerVisitor + ); + + public SharesList200ResponseSharesItemLayerMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesList200ResponseSharesItemLayerMode FromCustom(string value) + { + return new SharesList200ResponseSharesItemLayerMode(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 ==( + SharesList200ResponseSharesItemLayerMode value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesList200ResponseSharesItemLayerMode value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(SharesList200ResponseSharesItemLayerMode value) => + value.Value; + + public static explicit operator SharesList200ResponseSharesItemLayerMode(string value) => + new(value); + + internal class SharesList200ResponseSharesItemLayerModeSerializer + : JsonConverter + { + public override SharesList200ResponseSharesItemLayerMode 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 SharesList200ResponseSharesItemLayerMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemLayerMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesList200ResponseSharesItemLayerMode 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 SharesList200ResponseSharesItemLayerMode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemLayerMode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Shared = "shared"; + + public const string PerVisitor = "per-visitor"; + } +} diff --git a/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentity.cs b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentity.cs new file mode 100644 index 00000000..6ba23960 --- /dev/null +++ b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentity.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesList200ResponseSharesItemVisitorIdentity : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("fields")] + public required SharesList200ResponseSharesItemVisitorIdentityFields Fields { get; set; } + + [JsonPropertyName("ask")] + public required SharesList200ResponseSharesItemVisitorIdentityAsk Ask { get; set; } + + [JsonPropertyName("purpose")] + public string? Purpose { get; set; } + + [JsonPropertyName("privacyUrl")] + public string? PrivacyUrl { 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/SharesList200ResponseSharesItemVisitorIdentityAsk.cs b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityAsk.cs new file mode 100644 index 00000000..8ee4f21c --- /dev/null +++ b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityAsk.cs @@ -0,0 +1,129 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesList200ResponseSharesItemVisitorIdentityAsk.SharesList200ResponseSharesItemVisitorIdentityAskSerializer) +)] +[Serializable] +public readonly record struct SharesList200ResponseSharesItemVisitorIdentityAsk : IStringEnum +{ + public static readonly SharesList200ResponseSharesItemVisitorIdentityAsk OnOpen = new( + Values.OnOpen + ); + + public static readonly SharesList200ResponseSharesItemVisitorIdentityAsk BeforeFirstChange = + new(Values.BeforeFirstChange); + + public SharesList200ResponseSharesItemVisitorIdentityAsk(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesList200ResponseSharesItemVisitorIdentityAsk FromCustom(string value) + { + return new SharesList200ResponseSharesItemVisitorIdentityAsk(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 ==( + SharesList200ResponseSharesItemVisitorIdentityAsk value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesList200ResponseSharesItemVisitorIdentityAsk value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesList200ResponseSharesItemVisitorIdentityAsk value + ) => value.Value; + + public static explicit operator SharesList200ResponseSharesItemVisitorIdentityAsk( + string value + ) => new(value); + + internal class SharesList200ResponseSharesItemVisitorIdentityAskSerializer + : JsonConverter + { + public override SharesList200ResponseSharesItemVisitorIdentityAsk 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 SharesList200ResponseSharesItemVisitorIdentityAsk(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesList200ResponseSharesItemVisitorIdentityAsk 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 SharesList200ResponseSharesItemVisitorIdentityAsk(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string OnOpen = "on-open"; + + public const string BeforeFirstChange = "before-first-change"; + } +} diff --git a/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFields.cs b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFields.cs new file mode 100644 index 00000000..8d7e142f --- /dev/null +++ b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFields.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesList200ResponseSharesItemVisitorIdentityFields : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("displayName")] + public SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName? DisplayName { get; set; } + + [JsonPropertyName("email")] + public SharesList200ResponseSharesItemVisitorIdentityFieldsEmail? Email { get; set; } + + [JsonPropertyName("title")] + public SharesList200ResponseSharesItemVisitorIdentityFieldsTitle? Title { get; set; } + + [JsonPropertyName("organization")] + public SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization? Organization { get; set; } + + [JsonPropertyName("organizationalUnit")] + public SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit? OrganizationalUnit { 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/SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName.cs b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName.cs new file mode 100644 index 00000000..74ad6b4f --- /dev/null +++ b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName.SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayNameSerializer) +)] +[Serializable] +public readonly record struct SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName + : IStringEnum +{ + public static readonly SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName Required = + new(Values.Required); + + public static readonly SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName Optional = + new(Values.Optional); + + public SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName FromCustom( + string value + ) + { + return new SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName(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 ==( + SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName value + ) => value.Value; + + public static explicit operator SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName( + string value + ) => new(value); + + internal class SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayNameSerializer + : JsonConverter + { + public override SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName 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 SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName 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 SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsEmail.cs b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsEmail.cs new file mode 100644 index 00000000..49902eb7 --- /dev/null +++ b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsEmail.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesList200ResponseSharesItemVisitorIdentityFieldsEmail.SharesList200ResponseSharesItemVisitorIdentityFieldsEmailSerializer) +)] +[Serializable] +public readonly record struct SharesList200ResponseSharesItemVisitorIdentityFieldsEmail + : IStringEnum +{ + public static readonly SharesList200ResponseSharesItemVisitorIdentityFieldsEmail Required = new( + Values.Required + ); + + public static readonly SharesList200ResponseSharesItemVisitorIdentityFieldsEmail Optional = new( + Values.Optional + ); + + public SharesList200ResponseSharesItemVisitorIdentityFieldsEmail(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesList200ResponseSharesItemVisitorIdentityFieldsEmail FromCustom(string value) + { + return new SharesList200ResponseSharesItemVisitorIdentityFieldsEmail(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 ==( + SharesList200ResponseSharesItemVisitorIdentityFieldsEmail value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesList200ResponseSharesItemVisitorIdentityFieldsEmail value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesList200ResponseSharesItemVisitorIdentityFieldsEmail value + ) => value.Value; + + public static explicit operator SharesList200ResponseSharesItemVisitorIdentityFieldsEmail( + string value + ) => new(value); + + internal class SharesList200ResponseSharesItemVisitorIdentityFieldsEmailSerializer + : JsonConverter + { + public override SharesList200ResponseSharesItemVisitorIdentityFieldsEmail 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 SharesList200ResponseSharesItemVisitorIdentityFieldsEmail(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesList200ResponseSharesItemVisitorIdentityFieldsEmail 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 SharesList200ResponseSharesItemVisitorIdentityFieldsEmail(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization.cs b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization.cs new file mode 100644 index 00000000..6cbc214a --- /dev/null +++ b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization.cs @@ -0,0 +1,135 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization.SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationSerializer) +)] +[Serializable] +public readonly record struct SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization + : IStringEnum +{ + public static readonly SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization Required = + new(Values.Required); + + public static readonly SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization Optional = + new(Values.Optional); + + public SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization FromCustom( + string value + ) + { + return new SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization(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 ==( + SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization value + ) => value.Value; + + public static explicit operator SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization( + string value + ) => new(value); + + internal class SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationSerializer + : JsonConverter + { + public override SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization 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 SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization( + stringValue + ); + } + + public override void Write( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization 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 SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization( + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit.cs b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit.cs new file mode 100644 index 00000000..93f7305b --- /dev/null +++ b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit.cs @@ -0,0 +1,135 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit.SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnitSerializer) +)] +[Serializable] +public readonly record struct SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit + : IStringEnum +{ + public static readonly SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit Required = + new(Values.Required); + + public static readonly SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit Optional = + new(Values.Optional); + + public SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit FromCustom( + string value + ) + { + return new SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit(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 ==( + SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit value + ) => value.Value; + + public static explicit operator SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit( + string value + ) => new(value); + + internal class SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnitSerializer + : JsonConverter + { + public override SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit 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 SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit( + stringValue + ); + } + + public override void Write( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit 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 SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit( + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsTitle.cs b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsTitle.cs new file mode 100644 index 00000000..bf0352dc --- /dev/null +++ b/src/CloudPDF/Types/SharesList200ResponseSharesItemVisitorIdentityFieldsTitle.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesList200ResponseSharesItemVisitorIdentityFieldsTitle.SharesList200ResponseSharesItemVisitorIdentityFieldsTitleSerializer) +)] +[Serializable] +public readonly record struct SharesList200ResponseSharesItemVisitorIdentityFieldsTitle + : IStringEnum +{ + public static readonly SharesList200ResponseSharesItemVisitorIdentityFieldsTitle Required = new( + Values.Required + ); + + public static readonly SharesList200ResponseSharesItemVisitorIdentityFieldsTitle Optional = new( + Values.Optional + ); + + public SharesList200ResponseSharesItemVisitorIdentityFieldsTitle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesList200ResponseSharesItemVisitorIdentityFieldsTitle FromCustom(string value) + { + return new SharesList200ResponseSharesItemVisitorIdentityFieldsTitle(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 ==( + SharesList200ResponseSharesItemVisitorIdentityFieldsTitle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesList200ResponseSharesItemVisitorIdentityFieldsTitle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesList200ResponseSharesItemVisitorIdentityFieldsTitle value + ) => value.Value; + + public static explicit operator SharesList200ResponseSharesItemVisitorIdentityFieldsTitle( + string value + ) => new(value); + + internal class SharesList200ResponseSharesItemVisitorIdentityFieldsTitleSerializer + : JsonConverter + { + public override SharesList200ResponseSharesItemVisitorIdentityFieldsTitle 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 SharesList200ResponseSharesItemVisitorIdentityFieldsTitle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesList200ResponseSharesItemVisitorIdentityFieldsTitle 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 SharesList200ResponseSharesItemVisitorIdentityFieldsTitle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesList200ResponseSharesItemVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesUpdate200ResponseShare.cs b/src/CloudPDF/Types/SharesUpdate200ResponseShare.cs index 2955ab17..16813204 100644 --- a/src/CloudPDF/Types/SharesUpdate200ResponseShare.cs +++ b/src/CloudPDF/Types/SharesUpdate200ResponseShare.cs @@ -20,8 +20,20 @@ public record SharesUpdate200ResponseShare : IJsonOnDeserialized [JsonPropertyName("docId")] public required string DocId { get; set; } + [JsonPropertyName("layerMode")] + public required SharesUpdate200ResponseShareLayerMode LayerMode { get; set; } + [JsonPropertyName("layerName")] - public required string LayerName { get; set; } + public string? LayerName { get; set; } + + [JsonPropertyName("keepVisitorLayers")] + public required bool KeepVisitorLayers { get; set; } + + [JsonPropertyName("visitorIdleSeconds")] + public double? VisitorIdleSeconds { get; set; } + + [JsonPropertyName("visitorIdentity")] + public SharesUpdate200ResponseShareVisitorIdentity? VisitorIdentity { get; set; } [JsonPropertyName("scope")] public IEnumerable Scope { get; set; } = new List(); @@ -38,6 +50,9 @@ public record SharesUpdate200ResponseShare : IJsonOnDeserialized [JsonPropertyName("disabled")] public required bool Disabled { get; set; } + [JsonPropertyName("archivedAt")] + public double? ArchivedAt { get; set; } + [JsonPropertyName("expiresAt")] public double? ExpiresAt { get; set; } diff --git a/src/CloudPDF/Types/SharesUpdate200ResponseShareLayerMode.cs b/src/CloudPDF/Types/SharesUpdate200ResponseShareLayerMode.cs new file mode 100644 index 00000000..daea5115 --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate200ResponseShareLayerMode.cs @@ -0,0 +1,122 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesUpdate200ResponseShareLayerMode.SharesUpdate200ResponseShareLayerModeSerializer) +)] +[Serializable] +public readonly record struct SharesUpdate200ResponseShareLayerMode : IStringEnum +{ + public static readonly SharesUpdate200ResponseShareLayerMode Shared = new(Values.Shared); + + public static readonly SharesUpdate200ResponseShareLayerMode PerVisitor = new( + Values.PerVisitor + ); + + public SharesUpdate200ResponseShareLayerMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdate200ResponseShareLayerMode FromCustom(string value) + { + return new SharesUpdate200ResponseShareLayerMode(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 ==(SharesUpdate200ResponseShareLayerMode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(SharesUpdate200ResponseShareLayerMode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(SharesUpdate200ResponseShareLayerMode value) => + value.Value; + + public static explicit operator SharesUpdate200ResponseShareLayerMode(string value) => + new(value); + + internal class SharesUpdate200ResponseShareLayerModeSerializer + : JsonConverter + { + public override SharesUpdate200ResponseShareLayerMode 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 SharesUpdate200ResponseShareLayerMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareLayerMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdate200ResponseShareLayerMode 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 SharesUpdate200ResponseShareLayerMode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareLayerMode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Shared = "shared"; + + public const string PerVisitor = "per-visitor"; + } +} diff --git a/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentity.cs b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentity.cs new file mode 100644 index 00000000..c008c642 --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentity.cs @@ -0,0 +1,37 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesUpdate200ResponseShareVisitorIdentity : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("fields")] + public required SharesUpdate200ResponseShareVisitorIdentityFields Fields { get; set; } + + [JsonPropertyName("ask")] + public required SharesUpdate200ResponseShareVisitorIdentityAsk Ask { get; set; } + + [JsonPropertyName("purpose")] + public string? Purpose { get; set; } + + [JsonPropertyName("privacyUrl")] + public string? PrivacyUrl { 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/SharesUpdate200ResponseShareVisitorIdentityAsk.cs b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityAsk.cs new file mode 100644 index 00000000..bbd7f4b1 --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityAsk.cs @@ -0,0 +1,128 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesUpdate200ResponseShareVisitorIdentityAsk.SharesUpdate200ResponseShareVisitorIdentityAskSerializer) +)] +[Serializable] +public readonly record struct SharesUpdate200ResponseShareVisitorIdentityAsk : IStringEnum +{ + public static readonly SharesUpdate200ResponseShareVisitorIdentityAsk OnOpen = new( + Values.OnOpen + ); + + public static readonly SharesUpdate200ResponseShareVisitorIdentityAsk BeforeFirstChange = new( + Values.BeforeFirstChange + ); + + public SharesUpdate200ResponseShareVisitorIdentityAsk(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdate200ResponseShareVisitorIdentityAsk FromCustom(string value) + { + return new SharesUpdate200ResponseShareVisitorIdentityAsk(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 ==( + SharesUpdate200ResponseShareVisitorIdentityAsk value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesUpdate200ResponseShareVisitorIdentityAsk value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(SharesUpdate200ResponseShareVisitorIdentityAsk value) => + value.Value; + + public static explicit operator SharesUpdate200ResponseShareVisitorIdentityAsk(string value) => + new(value); + + internal class SharesUpdate200ResponseShareVisitorIdentityAskSerializer + : JsonConverter + { + public override SharesUpdate200ResponseShareVisitorIdentityAsk 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 SharesUpdate200ResponseShareVisitorIdentityAsk(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdate200ResponseShareVisitorIdentityAsk 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 SharesUpdate200ResponseShareVisitorIdentityAsk(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareVisitorIdentityAsk value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string OnOpen = "on-open"; + + public const string BeforeFirstChange = "before-first-change"; + } +} diff --git a/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFields.cs b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFields.cs new file mode 100644 index 00000000..2195b4be --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFields.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesUpdate200ResponseShareVisitorIdentityFields : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("displayName")] + public SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName? DisplayName { get; set; } + + [JsonPropertyName("email")] + public SharesUpdate200ResponseShareVisitorIdentityFieldsEmail? Email { get; set; } + + [JsonPropertyName("title")] + public SharesUpdate200ResponseShareVisitorIdentityFieldsTitle? Title { get; set; } + + [JsonPropertyName("organization")] + public SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization? Organization { get; set; } + + [JsonPropertyName("organizationalUnit")] + public SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit? OrganizationalUnit { 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/SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName.cs b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName.cs new file mode 100644 index 00000000..dde6e73a --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName.SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayNameSerializer) +)] +[Serializable] +public readonly record struct SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName + : IStringEnum +{ + public static readonly SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName Required = + new(Values.Required); + + public static readonly SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName Optional = + new(Values.Optional); + + public SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName FromCustom( + string value + ) + { + return new SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName(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 ==( + SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName value + ) => value.Value; + + public static explicit operator SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName( + string value + ) => new(value); + + internal class SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayNameSerializer + : JsonConverter + { + public override SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName 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 SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName 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 SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareVisitorIdentityFieldsDisplayName value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsEmail.cs b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsEmail.cs new file mode 100644 index 00000000..6376012a --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsEmail.cs @@ -0,0 +1,130 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesUpdate200ResponseShareVisitorIdentityFieldsEmail.SharesUpdate200ResponseShareVisitorIdentityFieldsEmailSerializer) +)] +[Serializable] +public readonly record struct SharesUpdate200ResponseShareVisitorIdentityFieldsEmail : IStringEnum +{ + public static readonly SharesUpdate200ResponseShareVisitorIdentityFieldsEmail Required = new( + Values.Required + ); + + public static readonly SharesUpdate200ResponseShareVisitorIdentityFieldsEmail Optional = new( + Values.Optional + ); + + public SharesUpdate200ResponseShareVisitorIdentityFieldsEmail(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdate200ResponseShareVisitorIdentityFieldsEmail FromCustom(string value) + { + return new SharesUpdate200ResponseShareVisitorIdentityFieldsEmail(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 ==( + SharesUpdate200ResponseShareVisitorIdentityFieldsEmail value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesUpdate200ResponseShareVisitorIdentityFieldsEmail value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesUpdate200ResponseShareVisitorIdentityFieldsEmail value + ) => value.Value; + + public static explicit operator SharesUpdate200ResponseShareVisitorIdentityFieldsEmail( + string value + ) => new(value); + + internal class SharesUpdate200ResponseShareVisitorIdentityFieldsEmailSerializer + : JsonConverter + { + public override SharesUpdate200ResponseShareVisitorIdentityFieldsEmail 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 SharesUpdate200ResponseShareVisitorIdentityFieldsEmail(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdate200ResponseShareVisitorIdentityFieldsEmail 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 SharesUpdate200ResponseShareVisitorIdentityFieldsEmail(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareVisitorIdentityFieldsEmail value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization.cs b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization.cs new file mode 100644 index 00000000..357163b7 --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization.cs @@ -0,0 +1,131 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization.SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationSerializer) +)] +[Serializable] +public readonly record struct SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization + : IStringEnum +{ + public static readonly SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization Required = + new(Values.Required); + + public static readonly SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization Optional = + new(Values.Optional); + + public SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization FromCustom( + string value + ) + { + return new SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization(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 ==( + SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization value + ) => value.Value; + + public static explicit operator SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization( + string value + ) => new(value); + + internal class SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationSerializer + : JsonConverter + { + public override SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization 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 SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization 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 SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareVisitorIdentityFieldsOrganization value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit.cs b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit.cs new file mode 100644 index 00000000..dad8f28f --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit.cs @@ -0,0 +1,135 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit.SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnitSerializer) +)] +[Serializable] +public readonly record struct SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit + : IStringEnum +{ + public static readonly SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit Required = + new(Values.Required); + + public static readonly SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit Optional = + new(Values.Optional); + + public SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit FromCustom( + string value + ) + { + return new SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit(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 ==( + SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit value + ) => value.Value; + + public static explicit operator SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit( + string value + ) => new(value); + + internal class SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnitSerializer + : JsonConverter + { + public override SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit 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 SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit( + stringValue + ); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit 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 SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit( + stringValue + ); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareVisitorIdentityFieldsOrganizationalUnit value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsTitle.cs b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsTitle.cs new file mode 100644 index 00000000..e4e733f8 --- /dev/null +++ b/src/CloudPDF/Types/SharesUpdate200ResponseShareVisitorIdentityFieldsTitle.cs @@ -0,0 +1,130 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[JsonConverter( + typeof(SharesUpdate200ResponseShareVisitorIdentityFieldsTitle.SharesUpdate200ResponseShareVisitorIdentityFieldsTitleSerializer) +)] +[Serializable] +public readonly record struct SharesUpdate200ResponseShareVisitorIdentityFieldsTitle : IStringEnum +{ + public static readonly SharesUpdate200ResponseShareVisitorIdentityFieldsTitle Required = new( + Values.Required + ); + + public static readonly SharesUpdate200ResponseShareVisitorIdentityFieldsTitle Optional = new( + Values.Optional + ); + + public SharesUpdate200ResponseShareVisitorIdentityFieldsTitle(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static SharesUpdate200ResponseShareVisitorIdentityFieldsTitle FromCustom(string value) + { + return new SharesUpdate200ResponseShareVisitorIdentityFieldsTitle(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 ==( + SharesUpdate200ResponseShareVisitorIdentityFieldsTitle value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + SharesUpdate200ResponseShareVisitorIdentityFieldsTitle value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + SharesUpdate200ResponseShareVisitorIdentityFieldsTitle value + ) => value.Value; + + public static explicit operator SharesUpdate200ResponseShareVisitorIdentityFieldsTitle( + string value + ) => new(value); + + internal class SharesUpdate200ResponseShareVisitorIdentityFieldsTitleSerializer + : JsonConverter + { + public override SharesUpdate200ResponseShareVisitorIdentityFieldsTitle 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 SharesUpdate200ResponseShareVisitorIdentityFieldsTitle(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override SharesUpdate200ResponseShareVisitorIdentityFieldsTitle 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 SharesUpdate200ResponseShareVisitorIdentityFieldsTitle(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + SharesUpdate200ResponseShareVisitorIdentityFieldsTitle value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Required = "required"; + + public const string Optional = "optional"; + } +} diff --git a/src/CloudPDF/Types/SharesVisitorsList200Response.cs b/src/CloudPDF/Types/SharesVisitorsList200Response.cs new file mode 100644 index 00000000..74b90619 --- /dev/null +++ b/src/CloudPDF/Types/SharesVisitorsList200Response.cs @@ -0,0 +1,32 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesVisitorsList200Response : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("visitors")] + public IEnumerable Visitors { 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/SharesVisitorsList200ResponseVisitorsItem.cs b/src/CloudPDF/Types/SharesVisitorsList200ResponseVisitorsItem.cs new file mode 100644 index 00000000..7904d2fd --- /dev/null +++ b/src/CloudPDF/Types/SharesVisitorsList200ResponseVisitorsItem.cs @@ -0,0 +1,46 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesVisitorsList200ResponseVisitorsItem : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("visitorId")] + public required string VisitorId { get; set; } + + [JsonPropertyName("answers")] + public required SharesVisitorsList200ResponseVisitorsItemAnswers Answers { get; set; } + + [JsonPropertyName("emailVerified")] + public required bool EmailVerified { get; set; } + + [JsonPropertyName("consentedAt")] + public double? ConsentedAt { get; set; } + + [JsonPropertyName("firstSeenAt")] + public required double FirstSeenAt { get; set; } + + [JsonPropertyName("lastSeenAt")] + public required double LastSeenAt { get; set; } + + [JsonPropertyName("layer")] + public SharesVisitorsList200ResponseVisitorsItemLayer? Layer { 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/SharesVisitorsList200ResponseVisitorsItemAnswers.cs b/src/CloudPDF/Types/SharesVisitorsList200ResponseVisitorsItemAnswers.cs new file mode 100644 index 00000000..78b46c73 --- /dev/null +++ b/src/CloudPDF/Types/SharesVisitorsList200ResponseVisitorsItemAnswers.cs @@ -0,0 +1,40 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesVisitorsList200ResponseVisitorsItemAnswers : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("displayName")] + public string? DisplayName { get; set; } + + [JsonPropertyName("email")] + public string? Email { get; set; } + + [JsonPropertyName("title")] + public string? Title { get; set; } + + [JsonPropertyName("organization")] + public string? Organization { get; set; } + + [JsonPropertyName("organizationalUnit")] + public string? OrganizationalUnit { 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/SharesVisitorsList200ResponseVisitorsItemLayer.cs b/src/CloudPDF/Types/SharesVisitorsList200ResponseVisitorsItemLayer.cs new file mode 100644 index 00000000..a2cd9727 --- /dev/null +++ b/src/CloudPDF/Types/SharesVisitorsList200ResponseVisitorsItemLayer.cs @@ -0,0 +1,31 @@ +using CloudPDF.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace CloudPDF; + +[Serializable] +public record SharesVisitorsList200ResponseVisitorsItemLayer : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("layerName")] + public required string LayerName { get; set; } + + [JsonPropertyName("storageSizeBytes")] + public double? StorageSizeBytes { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +}