Skip to content

Commit

Permalink
chore: 🐝 Update SDK - 1 - Generate (#52)
Browse files Browse the repository at this point in the history
* ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.310.0

* Update project file to version 1.0.1

* Manual fixups for the breaking renames.

Signed-off-by: Philip Conrad <[email protected]>

---------

Signed-off-by: Philip Conrad <[email protected]>
Co-authored-by: speakeasybot <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
Co-authored-by: Philip Conrad <[email protected]>
  • Loading branch information
4 people authored Jun 20, 2024
1 parent 7432f58 commit dc8a3f8
Show file tree
Hide file tree
Showing 29 changed files with 952 additions and 34 deletions.
26 changes: 19 additions & 7 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
lockVersion: 2.0.0
id: f1a8c321-72a7-41c5-8f5e-3d925aeafa1a
management:
docChecksum: 11b8c1e1d3f9d5dab18c36b33f81200d
docChecksum: a34bd1c885aa42eb3175940494581f67
docVersion: 0.2.0
speakeasyVersion: 1.299.7
generationVersion: 2.338.12
releaseVersion: 1.0.0
configChecksum: 9df4269ceaa81c9a0ed56676e4845fc0
speakeasyVersion: 1.310.0
generationVersion: 2.347.4
releaseVersion: 1.0.1
configChecksum: 1384ef5ea24bf80b6ac93f5d303cf1ea
repoURL: https://github.com/StyraInc/opa-csharp.git
repoSubDirectory: Styra/Opa/OpenApi/
published: true
features:
csharp:
additionalDependencies: 0.1.0
constsAndDefaults: 0.0.1
core: 3.9.3
core: 3.9.6
examples: 2.81.3
flattening: 2.81.2
globalSecurityCallbacks: 0.1.0
Expand Down Expand Up @@ -51,24 +51,36 @@ generatedFiles:
- Styra/Opa/OpenApi/Models/Requests/ExecutePolicyWithInputRequestBody.cs
- Styra/Opa/OpenApi/Models/Requests/ExecutePolicyWithInputRequest.cs
- Styra/Opa/OpenApi/Models/Requests/ExecutePolicyWithInputResponse.cs
- Styra/Opa/OpenApi/Models/Requests/ExecuteBatchPolicyWithInputRequestBody.cs
- Styra/Opa/OpenApi/Models/Requests/ExecuteBatchPolicyWithInputRequest.cs
- Styra/Opa/OpenApi/Models/Requests/ExecuteBatchPolicyWithInputResponse.cs
- Styra/Opa/OpenApi/Models/Requests/HealthRequest.cs
- Styra/Opa/OpenApi/Models/Requests/HealthResponse.cs
- Styra/Opa/OpenApi/Models/Components/Result.cs
- Styra/Opa/OpenApi/Models/Components/Input.cs
- Styra/Opa/OpenApi/Models/Components/GzipAcceptEncoding.cs
- Styra/Opa/OpenApi/Models/Components/SuccessfulPolicyEvaluation.cs
- Styra/Opa/OpenApi/Models/Components/SuccessfulPolicyResponse.cs
- Styra/Opa/OpenApi/Models/Components/Revision.cs
- Styra/Opa/OpenApi/Models/Components/Provenance.cs
- Styra/Opa/OpenApi/Models/Components/Explain.cs
- Styra/Opa/OpenApi/Models/Components/GzipContentEncoding.cs
- Styra/Opa/OpenApi/Models/Components/Location.cs
- Styra/Opa/OpenApi/Models/Components/Errors.cs
- Styra/Opa/OpenApi/Models/Components/ServerError.cs
- Styra/Opa/OpenApi/Models/Components/ResponsesSuccessfulPolicyResponse.cs
- Styra/Opa/OpenApi/Models/Components/Responses.cs
- Styra/Opa/OpenApi/Models/Components/BatchMixedResults.cs
- Styra/Opa/OpenApi/Models/Components/BatchSuccessfulPolicyEvaluation.cs
- Styra/Opa/OpenApi/Models/Components/HealthyServer.cs
- Styra/Opa/OpenApi/Models/Errors/Location.cs
- Styra/Opa/OpenApi/Models/Errors/Errors.cs
- Styra/Opa/OpenApi/Models/Errors/ClientError.cs
- Styra/Opa/OpenApi/Models/Errors/ServerErrorLocation.cs
- Styra/Opa/OpenApi/Models/Errors/ServerErrorErrors.cs
- Styra/Opa/OpenApi/Models/Errors/ServerError.cs
- Styra/Opa/OpenApi/Models/Errors/BatchServerError.cs
- Styra/Opa/OpenApi/Models/Errors/UnhealthyServer.cs
- NUGET.md
- USAGE.md
- .gitattributes
- Styra/Opa/OpenApi/Hooks/SDKHooks.cs
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: false
csharp:
version: 1.0.0
version: 1.0.1
additionalDependencies: []
author: Styra
clientServerStatusCodesAsErrors: true
Expand Down
8 changes: 4 additions & 4 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ speakeasyVersion: 1.299.7
sources:
openapi:
sourceNamespace: openapi
sourceRevisionDigest: sha256:4932d4ab7fc975b378bae8a9220a32e37ce501a414cea9555769714cdd471556
sourceBlobDigest: sha256:5e23321d0a2a70af23e824774c98915cfd7de8a9a5fd45efe5edbc3c427c5ab8
sourceRevisionDigest: sha256:eb548051373a9d8a3febd4ce2e04e732616ffe3d88391010b6d4f7c2cc662de7
sourceBlobDigest: sha256:f9d2836cdde91d2e0b91630bbbdf90e1846556c78e6cbac633467bea07057872
tags:
- latest
- main
targets:
first-target:
source: openapi
sourceNamespace: openapi
sourceRevisionDigest: sha256:4932d4ab7fc975b378bae8a9220a32e37ce501a414cea9555769714cdd471556
sourceBlobDigest: sha256:5e23321d0a2a70af23e824774c98915cfd7de8a9a5fd45efe5edbc3c427c5ab8
sourceRevisionDigest: sha256:eb548051373a9d8a3febd4ce2e04e732616ffe3d88391010b6d4f7c2cc662de7
sourceBlobDigest: sha256:f9d2836cdde91d2e0b91630bbbdf90e1846556c78e6cbac633467bea07057872
outLocation: /github/workspace/repo
workflow:
workflowVersion: 1.0.0
Expand Down
167 changes: 167 additions & 0 deletions NUGET.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# Styra.Opa.OpenApi

<div align="left">
<a href="https://speakeasyapi.dev/"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
<a href="https://opensource.org/licenses/MIT">
<img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
</a>
</div>


<!-- Start Installation [installation] -->
## Installation

```bash
dotnet add package Styra.Opa.OpenApi
```
<!-- End Installation [installation] -->

<!-- Start SDK Example Usage [usage] -->
## SDK Example Usage

### Example 1

```csharp
using Styra.Opa.OpenApi;
using Styra.Opa.OpenApi.Models.Requests;
using Styra.Opa.OpenApi.Models.Components;

var sdk = new OpaApiClient();

var res = await sdk.ExecuteDefaultPolicyWithInputAsync(
input: Input.CreateInputNumber(
8203.11D,
),
pretty: false,
acceptEncoding: GzipAcceptEncoding.Gzip);

// handle response
```

### Example 2

```csharp
using Styra.Opa.OpenApi;
using Styra.Opa.OpenApi.Models.Requests;
using Styra.Opa.OpenApi.Models.Components;

var sdk = new OpaApiClient();

ExecutePolicyWithInputRequest req = new ExecutePolicyWithInputRequest() {
Path = "app/rbac",
RequestBody = new ExecutePolicyWithInputRequestBody() {
Input = Input.CreateInputBoolean(
false,
),
},
};

var res = await sdk.ExecutePolicyWithInputAsync(req);

// handle response
```

### Example 3

```csharp
using Styra.Opa.OpenApi;
using Styra.Opa.OpenApi.Models.Requests;
using System.Collections.Generic;
using Styra.Opa.OpenApi.Models.Components;

var sdk = new OpaApiClient();

ExecuteBatchPolicyWithInputRequest req = new ExecuteBatchPolicyWithInputRequest() {
Path = "app/rbac",
RequestBody = new ExecuteBatchPolicyWithInputRequestBody() {
Inputs = new Dictionary<string, Input>() {
{ "key", Input.CreateInputStr(
"<value>",
) },
},
},
};

var res = await sdk.ExecuteBatchPolicyWithInputAsync(req);

// handle response
```
<!-- End SDK Example Usage [usage] -->

<!-- Start Available Resources and Operations [operations] -->
## Available Resources and Operations

- [OpaApiClient SDK](https:/github.com/StyraInc/opa-csharp/blob/main/Styra/Opa/OpenApi/github/workspace/repo/docs/sdks/opaapiclient/README.md#available-operations)
<!-- End Available Resources and Operations [operations] -->

<!-- Start Error Handling [errors] -->
## Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or thow an exception. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate type.

| Error Object | Status Code | Content Type |
| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- |
| Styra.Opa.OpenApi.Models.Errors.ClientError | 400,404 | application/json |
| Styra.Opa.OpenApi.Models.Errors.ServerError | 500 | application/json |
| Styra.Opa.OpenApi.Models.Errors.SDKException | 4xx-5xx | */* |

### Example

```csharp
using Styra.Opa.OpenApi;
using System;
using Styra.Opa.OpenApi.Models.Errors;
using Styra.Opa.OpenApi.Models.Requests;
using Styra.Opa.OpenApi.Models.Components;

var sdk = new OpaApiClient();

try
{
var res = await sdk.ExecuteDefaultPolicyWithInputAsync(
input: Input.CreateInputNumber(
8203.11D,
),
pretty: false,
acceptEncoding: GzipAcceptEncoding.Gzip);
// handle response
}
catch (Exception ex)
{
if (ex is ClientError)
{
// handle exception
}
else if (ex is Models.Errors.ServerError)
{
// handle exception
}
else if (ex is Styra.Opa.OpenApi.Models.Errors.SDKException)
{
// handle exception
}
}

```
<!-- End Error Handling [errors] -->

<!-- Start Server Selection [server] -->
## Server Selection

### Select Server by Index

You can override the default server globally by passing a server index to the `serverIndex: number` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:

| # | Server | Variables |
| - | ------ | --------- |
| 0 | `http://localhost:8181` | None |




### Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the `serverUrl: str` optional parameter when initializing the SDK client instance. For example:
<!-- End Server Selection [server] -->

<!-- Placeholder for Future Speakeasy SDK Sections -->
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,32 @@ ExecutePolicyWithInputRequest req = new ExecutePolicyWithInputRequest() {

var res = await sdk.ExecutePolicyWithInputAsync(req);

// handle response
```

### Example 3

```csharp
using Styra.Opa.OpenApi;
using Styra.Opa.OpenApi.Models.Requests;
using System.Collections.Generic;
using Styra.Opa.OpenApi.Models.Components;

var sdk = new OpaApiClient();

ExecuteBatchPolicyWithInputRequest req = new ExecuteBatchPolicyWithInputRequest() {
Path = "app/rbac",
RequestBody = new ExecuteBatchPolicyWithInputRequestBody() {
Inputs = new Dictionary<string, Input>() {
{ "key", Input.CreateInputStr(
"<value>",
) },
},
},
};

var res = await sdk.ExecuteBatchPolicyWithInputAsync(req);

// handle response
```
<!-- End SDK Example Usage [usage] -->
Expand All @@ -168,6 +194,7 @@ var res = await sdk.ExecutePolicyWithInputAsync(req);
* [ExecuteDefaultPolicyWithInput](docs/sdks/opaapiclient/README.md#executedefaultpolicywithinput) - Execute the default decision given an input
* [ExecutePolicy](docs/sdks/opaapiclient/README.md#executepolicy) - Execute a policy
* [ExecutePolicyWithInput](docs/sdks/opaapiclient/README.md#executepolicywithinput) - Execute a policy given an input
* [ExecuteBatchPolicyWithInput](docs/sdks/opaapiclient/README.md#executebatchpolicywithinput) - Execute a policy given a batch of inputs
* [Health](docs/sdks/opaapiclient/README.md#health) - Verify the server is operational
<!-- End Available Resources and Operations [operations] -->

Expand Down Expand Up @@ -228,7 +255,7 @@ catch (Exception ex)
{
// handle exception
}
else if (ex is ServerError)
else if (ex is Models.Errors.ServerError)
{
// handle exception
}
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,14 @@ Based on:
### Generated
- [csharp v1.0.0] .
### Releases
- [NuGet v1.0.0] https://www.nuget.org/packages/Styra.Opa.OpenApi/1.0.0 - .
- [NuGet v1.0.0] https://www.nuget.org/packages/Styra.Opa.OpenApi/1.0.0 - .

## 2024-06-20 00:03:21
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.310.0 (2.347.4) https://github.com/speakeasy-api/speakeasy
### Generated
- [csharp v1.0.1] .
### Releases
- [NuGet v1.0.1] https://www.nuget.org/packages/Styra.Opa.OpenApi/1.0.1 - .
2 changes: 1 addition & 1 deletion Styra/Opa/OpaClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public async Task<bool> check(string path, Dictionary<string, object> input)
}

// We return the default null value for type T if Result is null.
var result = res.SuccessfulPolicyEvaluation?.Result;
var result = res.SuccessfulPolicyResponse?.Result;
if (result is null)
{
return default;
Expand Down
32 changes: 32 additions & 0 deletions Styra/Opa/OpenApi/Models/Components/BatchMixedResults.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace Styra.Opa.OpenApi.Models.Components
{
using Newtonsoft.Json;
using Styra.Opa.OpenApi.Models.Components;
using Styra.Opa.OpenApi.Utils;
using System.Collections.Generic;

public class BatchMixedResults
{

[JsonProperty("batch_decision_id")]
public string? BatchDecisionId { get; set; }

/// <summary>
/// If query metrics are enabled, this field contains query performance metrics collected during the parse, compile, and evaluation steps.
/// </summary>
[JsonProperty("metrics")]
public Dictionary<string, object>? Metrics { get; set; }

[JsonProperty("responses")]
public Dictionary<string, Responses>? Responses { get; set; }
}
}
Loading

0 comments on commit dc8a3f8

Please sign in to comment.