Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"base-exception-class-name": "CloudPDFException",
"base-api-exception-class-name": "CloudPDFApiException"
},
"originGitCommit": "622018abaf6e4578d1f4d8377982c48b92c9ced3",
"originGitCommit": "3283147ded32fc15c426768f75557a4d95943d84",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
"requestedVersion": "3.0.0-next.20",
"requestedVersion": "3.0.0-next.21",
"ciProvider": "github",
"sdkVersion": "3.0.0-next.20"
"sdkVersion": "3.0.0-next.21"
}
8 changes: 4 additions & 4 deletions cloudpdf-generation.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"language": "csharp",
"canonicalVersion": "3.0.0-next.20",
"sdkVersion": "3.0.0-next.20",
"canonicalVersion": "3.0.0-next.21",
"sdkVersion": "3.0.0-next.21",
"source": {
"repository": "embedpdf/embed-pdf-viewer",
"openapi": "cloudpdf/contract/openapi.json",
"openapiSha256": "47d739acb956ce8ba0c3990117e505be2e9406038d9e0cd1729608921a40b2d9",
"gitCommit": "622018abaf6e4578d1f4d8377982c48b92c9ced3",
"openapiSha256": "f85648401f5c683a32e2b50acc3d753df9f4ce06df8492e5d2b599beceb0e788",
"gitCommit": "3283147ded32fc15c426768f75557a4d95943d84",
"gitCommitIsDirty": false
},
"fern": {
Expand Down
60 changes: 60 additions & 0 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,66 @@ await client.Tenants.DeleteAsync(new DeleteTenantsRequest { TenantId = "tenantId
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.Tenants.<a href="/src/CloudPDF/Tenants/TenantsClient.cs">UpdateAsync</a>(TenantsUpdateRequest { ... }) -> WithRawResponseTask&lt;TenantsUpdate200Response&gt;</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

A feature names an installed module; any other id is a 400. A module route answers a tenant without its feature 403 FeatureNotEnabled, and one whose feature is stopped 402 FeatureStopped (details.feature, details.stopped). Other replicas apply a change within 30 seconds.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```csharp
await client.Tenants.UpdateAsync(
new TenantsUpdateRequest
{
TenantId = "tenantId",
Features = new List<TenantFeature>() { new TenantFeature { Id = "id" } },
}
);
```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `TenantsUpdateRequest`

</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>
Expand Down
15 changes: 15 additions & 0 deletions src/CloudPDF.Test/Unit/MockServer/Tenants/CreateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ public async Task MockServerTest_1()
"name": "name",
"autoProvisioned": true,
"status": "active",
"features": [
{
"id": "id",
"stopped": "cap"
},
{
"id": "id",
"stopped": "cap"
}
],
"createdAt": 1.1
},
"created": true
Expand Down Expand Up @@ -69,6 +79,11 @@ public async Task MockServerTest_2()
"name": "name",
"autoProvisioned": true,
"status": "active",
"features": [
{
"id": "id"
}
],
"createdAt": 1.1
},
"created": true
Expand Down
15 changes: 15 additions & 0 deletions src/CloudPDF.Test/Unit/MockServer/Tenants/GetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ public async Task MockServerTest_1()
"name": "name",
"autoProvisioned": true,
"status": "active",
"features": [
{
"id": "id",
"stopped": "cap"
},
{
"id": "id",
"stopped": "cap"
}
],
"createdAt": 1.1
}
}
Expand Down Expand Up @@ -54,6 +64,11 @@ public async Task MockServerTest_2()
"name": "name",
"autoProvisioned": true,
"status": "active",
"features": [
{
"id": "id"
}
],
"createdAt": 1.1
}
}
Expand Down
25 changes: 25 additions & 0 deletions src/CloudPDF.Test/Unit/MockServer/Tenants/ListTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,33 @@ public async Task MockServerTest_1()
"name": "name",
"autoProvisioned": true,
"status": "active",
"features": [
{
"id": "id",
"stopped": "cap"
},
{
"id": "id",
"stopped": "cap"
}
],
"createdAt": 1.1
},
{
"id": "id",
"name": "name",
"autoProvisioned": true,
"status": "active",
"features": [
{
"id": "id",
"stopped": "cap"
},
{
"id": "id",
"stopped": "cap"
}
],
"createdAt": 1.1
}
],
Expand Down Expand Up @@ -58,6 +78,11 @@ public async Task MockServerTest_2()
"name": "name",
"autoProvisioned": true,
"status": "active",
"features": [
{
"id": "id"
}
],
"createdAt": 1.1
}
],
Expand Down
135 changes: 135 additions & 0 deletions src/CloudPDF.Test/Unit/MockServer/Tenants/UpdateTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
using CloudPDF;
using CloudPDF.Test.Unit.MockServer;
using CloudPDF.Test.Utils;
using NUnit.Framework;

namespace CloudPDF.Test.Unit.MockServer.Tenants;

[TestFixture]
[Parallelizable(ParallelScope.Self)]
public class UpdateTest : BaseMockServerTest
{
[NUnit.Framework.Test]
public async Task MockServerTest_1()
{
const string requestJson = """
{
"features": [
{
"id": "id"
},
{
"id": "id"
}
]
}
""";

const string mockResponse = """
{
"tenant": {
"id": "id",
"name": "name",
"autoProvisioned": true,
"status": "active",
"features": [
{
"id": "id",
"stopped": "cap"
},
{
"id": "id",
"stopped": "cap"
}
],
"createdAt": 1.1
}
}
""";

Server
.Given(
WireMock
.RequestBuilders.Request.Create()
.WithPath("/v1/tenants/tenantId")
.WithHeader("Content-Type", "application/json")
.UsingPatch()
.WithBodyAsJson(requestJson)
)
.RespondWith(
WireMock
.ResponseBuilders.Response.Create()
.WithStatusCode(200)
.WithBody(mockResponse)
);

var response = await Client.Tenants.UpdateAsync(
new TenantsUpdateRequest
{
TenantId = "tenantId",
Features = new List<TenantFeature>()
{
new TenantFeature { Id = "id", Stopped = null },
new TenantFeature { Id = "id", Stopped = null },
},
}
);
JsonAssert.AreEqual(response, mockResponse);
}

[NUnit.Framework.Test]
public async Task MockServerTest_2()
{
const string requestJson = """
{
"features": [
{
"id": "id"
}
]
}
""";

const string mockResponse = """
{
"tenant": {
"id": "id",
"name": "name",
"autoProvisioned": true,
"status": "active",
"features": [
{
"id": "id"
}
],
"createdAt": 1.1
}
}
""";

Server
.Given(
WireMock
.RequestBuilders.Request.Create()
.WithPath("/v1/tenants/tenantId")
.WithHeader("Content-Type", "application/json")
.UsingPatch()
.WithBodyAsJson(requestJson)
)
.RespondWith(
WireMock
.ResponseBuilders.Response.Create()
.WithStatusCode(200)
.WithBody(mockResponse)
);

var response = await Client.Tenants.UpdateAsync(
new TenantsUpdateRequest
{
TenantId = "tenantId",
Features = new List<TenantFeature>() { new TenantFeature { Id = "id" } },
}
);
JsonAssert.AreEqual(response, mockResponse);
}
}
2 changes: 1 addition & 1 deletion src/CloudPDF/CloudPDF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>12</LangVersion>
<Nullable>enable</Nullable>
<Version>3.0.0-next.20</Version>
<Version>3.0.0-next.21</Version>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
<PackageReadmeFile Condition="Exists('..\..\README.md')">README.md</PackageReadmeFile>
Expand Down
2 changes: 1 addition & 1 deletion src/CloudPDF/Core/Public/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ namespace CloudPDF;
[Serializable]
internal class Version
{
public const string Current = "3.0.0-next.20";
public const string Current = "3.0.0-next.21";
}
9 changes: 9 additions & 0 deletions src/CloudPDF/Tenants/ITenantsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ WithRawResponseTask DeleteAsync(
CancellationToken cancellationToken = default
);

/// <summary>
/// A feature names an installed module; any other id is a 400. A module route answers a tenant without its feature 403 FeatureNotEnabled, and one whose feature is stopped 402 FeatureStopped (details.feature, details.stopped). Other replicas apply a change within 30 seconds.
/// </summary>
WithRawResponseTask<TenantsUpdate200Response> UpdateAsync(
TenantsUpdateRequest request,
RequestOptions? options = null,
CancellationToken cancellationToken = default
);

WithRawResponseTask ResumeAsync(
ResumeTenantsRequest request,
RequestOptions? options = null,
Expand Down
20 changes: 20 additions & 0 deletions src/CloudPDF/Tenants/Requests/TenantsUpdateRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using CloudPDF.Core;
using global::System.Text.Json.Serialization;

namespace CloudPDF;

[Serializable]
public record TenantsUpdateRequest
{
[JsonIgnore]
public required string TenantId { get; set; }

[JsonPropertyName("features")]
public IEnumerable<TenantFeature> Features { get; set; } = new List<TenantFeature>();

/// <inheritdoc />
public override string ToString()
{
return JsonUtils.Serialize(this);
}
}
Loading
Loading