Skip to content

Commit

Permalink
Release v1.4.0
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Conrad <[email protected]>
  • Loading branch information
philipaconrad committed Nov 18, 2024
1 parent ff8859f commit 3e06231
Show file tree
Hide file tree
Showing 23 changed files with 357 additions and 195 deletions.
58 changes: 31 additions & 27 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ id: f1a8c321-72a7-41c5-8f5e-3d925aeafa1a
management:
docChecksum: 54d33facef3aa19f358d15ab44e34141
docVersion: 0.2.0
speakeasyVersion: 1.397.2
generationVersion: 2.415.8
releaseVersion: 1.3.7
configChecksum: 4b87e08fd57be3ea8915050d1a96f16b
repoURL: https://github.com/StyraInc/opa-csharp.git
speakeasyVersion: 1.441.0
generationVersion: 2.460.1
releaseVersion: 1.4.0
configChecksum: 2e42be5c6bac9686dc03b50dfbc95bd0
repoURL: https://github.com/StyraInc/opa-csharp
repoSubDirectory: Styra/Opa/OpenApi/
published: true
features:
csharp:
additionalDependencies: 0.1.0
constsAndDefaults: 0.0.1
core: 3.9.19
core: 3.10.5
examples: 2.81.3
flattening: 2.81.2
flattening: 2.81.3
globalSecurity: 2.83.6
globalSecurityCallbacks: 0.1.0
globalSecurityFlattening: 0.1.0
globalServerURLs: 2.82.3
intellisenseMarkdownSupport: 0.1.0
methodArguments: 0.1.0
responseFormat: 0.0.4
sdkHooks: 0.1.0
unions: 0.2.1
unions: 0.2.2
generatedFiles:
- .gitattributes
- CONTRIBUTING.md
Expand All @@ -42,9 +43,12 @@ generatedFiles:
- Styra/Opa/OpenApi/Models/Components/Location.cs
- Styra/Opa/OpenApi/Models/Components/Provenance.cs
- Styra/Opa/OpenApi/Models/Components/Responses.cs
- Styra/Opa/OpenApi/Models/Components/ResponsesErrors.cs
- Styra/Opa/OpenApi/Models/Components/ResponsesLocation.cs
- Styra/Opa/OpenApi/Models/Components/Result.cs
- Styra/Opa/OpenApi/Models/Components/Revision.cs
- Styra/Opa/OpenApi/Models/Components/Security.cs
- Styra/Opa/OpenApi/Models/Components/ServerError.cs
- Styra/Opa/OpenApi/Models/Components/ServerErrorWithStatusCode.cs
- Styra/Opa/OpenApi/Models/Components/SuccessfulPolicyResponse.cs
- Styra/Opa/OpenApi/Models/Components/SuccessfulPolicyResponseWithStatusCode.cs
Expand Down Expand Up @@ -90,6 +94,24 @@ generatedFiles:
- USAGE.md
- global.json
examples:
executeBatchPolicyWithInput:
speakeasy-default-execute-batch-policy-with-input:
parameters:
path:
path: "app/rbac"
query: {}
header: {}
requestBody:
application/json: {"inputs": {"key": []}}
responses:
"200":
application/json: {"batch_decision_id": "1bef6b7d-cd13-4890-bfe1-fd2e8de32189", "responses": {"key": {"result": "<value>"}, "key1": {"result": []}}}
"207":
application/json: {"responses": {"key": {"http_status_code": "200", "result": "<value>"}}}
"400":
application/json: {"code": "<value>", "message": "<value>"}
"500":
application/json: {"responses": {}}
executeDefaultPolicyWithInput:
speakeasy-default-execute-default-policy-with-input:
requestBody:
Expand Down Expand Up @@ -123,31 +145,13 @@ examples:
query: {}
header: {}
requestBody:
application/json: {"input": false}
application/json: {"input": true}
responses:
"200":
application/json: {"result": "<value>"}
"400":
application/json: {"code": "<value>", "message": "<value>"}
"500":
application/json: {"code": "<value>", "message": "<value>", "decision_id": "b84cf736-213c-4932-a8e4-bb5c648f1b4d"}
executeBatchPolicyWithInput:
speakeasy-default-execute-batch-policy-with-input:
parameters:
path:
path: "app/rbac"
query: {}
header: {}
requestBody:
application/json: {"inputs": {"key": []}}
responses:
"200":
application/json: {"batch_decision_id": "1bef6b7d-cd13-4890-bfe1-fd2e8de32189", "responses": {"key": {"result": {"allow": true, "user_is_admin": true, "user_is_granted": []}}, "key1": {"result": []}}}
"207":
application/json: {"responses": {"key": {"http_status_code": "200", "result": "<value>"}}}
"400":
application/json: {"code": "<value>", "message": "<value>"}
"500":
application/json: {"responses": {}}
health:
speakeasy-default-health: {}
9 changes: 7 additions & 2 deletions .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ generation:
requestResponseComponentNamesFeb2024: true
auth:
oAuth2ClientCredentialsEnabled: false
oAuth2PasswordEnabled: false
csharp:
version: 1.3.7
version: 1.4.0
additionalDependencies: []
author: Styra
clientServerStatusCodesAsErrors: true
company: Styra
defaultErrorName: SDKException
disableNamespacePascalCasingApr2024: true
dotnetVersion: net6.0
dotnetVersion: net8.0
enableSourceLink: false
flattenGlobalSecurity: true
flatteningOrder: ""
imports:
option: openapi
paths:
Expand All @@ -32,8 +35,10 @@ csharp:
includeDebugSymbols: false
inputModelSuffix: input
maxMethodParams: 4
methodArguments: infer-optional-args
outputModelSuffix: output
packageName: Styra.Opa.OpenApi
packageTags: ""
product: ""
responseFormat: envelope
sourceDirectory: ""
26 changes: 15 additions & 11 deletions .speakeasy/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
openapi:
inputs:
- location: https://raw.githubusercontent.com/StyraInc/enterprise-opa/main/openapi/openapi.yaml
registry:
location: registry.speakeasyapi.dev/styra/styra/openapi
openapi:
inputs:
- location: https://raw.githubusercontent.com/StyraInc/enterprise-opa/main/openapi/openapi.yaml
registry:
location: registry.speakeasyapi.dev/styra/styra/openapi
targets:
first-target:
target: csharp
source: openapi
publish:
nuget:
apiKey: $nuget_api_key
first-target:
target: csharp
source: openapi
publish:
nuget:
apiKey: $nuget_api_key
codeSamples:
registry:
location: registry.speakeasyapi.dev/styra/styra/openapi-code-samples
blocking: false
76 changes: 50 additions & 26 deletions NUGET.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var sdk = new OpaApiClient(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

var res = await sdk.ExecuteDefaultPolicyWithInputAsync(
input: Input.CreateNumber(
8203.11D
4963.69D
),
pretty: false,
acceptEncoding: Styra.Opa.OpenApi.Models.Components.GzipAcceptEncoding.Gzip
Expand Down Expand Up @@ -79,13 +79,24 @@ var res = await sdk.ExecuteBatchPolicyWithInputAsync(req);
<!-- 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.
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.

| 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 | */* |
By default, an API error will raise a `Styra.Opa.OpenApi.Models.Errors.SDKException` exception, which has the following properties:

| Property | Type | Description |
|---------------|-----------------------|-----------------------|
| `Message` | *string* | The error message |
| `StatusCode` | *int* | The HTTP status code |
| `RawResponse` | *HttpResponseMessage* | The raw HTTP response |
| `Body` | *string* | The response content |

When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `ExecuteDefaultPolicyWithInputAsync` method throws the following exceptions:

| Error Type | 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

Expand All @@ -103,7 +114,7 @@ try
{
var res = await sdk.ExecuteDefaultPolicyWithInputAsync(
input: Input.CreateNumber(
8203.11D
4963.69D
),
pretty: false,
acceptEncoding: Styra.Opa.OpenApi.Models.Components.GzipAcceptEncoding.Gzip
Expand All @@ -115,15 +126,18 @@ catch (Exception ex)
{
if (ex is ClientError)
{
// handle exception
// Handle exception data
throw;
}
else if (ex is ServerError)
else if (ex is Models.Errors.ServerError)
{
// handle exception
// Handle exception data
throw;
}
else if (ex is Styra.Opa.OpenApi.Models.Errors.SDKException)
{
// handle exception
// Handle default exception
throw;
}
}
```
Expand All @@ -132,20 +146,30 @@ catch (Exception ex)
<!-- 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: string` optional parameter when initializing the SDK client instance. For example:
```csharp
using Styra.Opa.OpenApi;
using Styra.Opa.OpenApi.Models.Requests;
using Styra.Opa.OpenApi.Models.Components;
using System.Collections.Generic;

var sdk = new OpaApiClient(
serverUrl: "http://localhost:8181",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>"
);

### Override Server URL Per-Client
var res = await sdk.ExecuteDefaultPolicyWithInputAsync(
input: Input.CreateNumber(
4963.69D
),
pretty: false,
acceptEncoding: Styra.Opa.OpenApi.Models.Components.GzipAcceptEncoding.Gzip
);

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:
// handle response
```
<!-- End Server Selection [server] -->

<!-- Start Authentication [security] -->
Expand All @@ -155,9 +179,9 @@ The default server can also be overridden globally by passing a URL to the `serv

This SDK supports the following security scheme globally:

| Name | Type | Scheme |
| ------------ | ------------ | ------------ |
| `BearerAuth` | http | HTTP Bearer |
| Name | Type | Scheme |
| ------------ | ---- | ----------- |
| `BearerAuth` | http | HTTP Bearer |

To authenticate with the API the `BearerAuth` parameter must be set when initializing the SDK client instance. For example:
```csharp
Expand All @@ -170,7 +194,7 @@ var sdk = new OpaApiClient(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

var res = await sdk.ExecuteDefaultPolicyWithInputAsync(
input: Input.CreateNumber(
8203.11D
4963.69D
),
pretty: false,
acceptEncoding: Styra.Opa.OpenApi.Models.Components.GzipAcceptEncoding.Gzip
Expand Down
Loading

0 comments on commit 3e06231

Please sign in to comment.