Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.
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
11 changes: 5 additions & 6 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ id: 2f8b2839-3001-46b4-b5e0-cec0aad583ed
management:
docChecksum: 2401c7030f847f72ab31c8f75de58a66
docVersion: 0.2.0
speakeasyVersion: 1.245.0
generationVersion: 2.301.3
releaseVersion: 0.2.2
configChecksum: 803675afb1d98123e2574559539201e5
speakeasyVersion: 1.250.0
generationVersion: 2.304.1
releaseVersion: 0.2.3
configChecksum: 191f7a8d3ea477752ba4f1cf7facee4b
repoURL: https://github.com/StyraInc/opa-typescript.git
installationURL: https://github.com/StyraInc/opa-typescript
features:
Expand All @@ -20,7 +20,6 @@ features:
unions: 2.85.3
generatedFiles:
- src/sdk/sdk.ts
- .eslintrc.js
- .npmignore
- RUNTIMES.md
- package.json
Expand Down Expand Up @@ -83,7 +82,7 @@ generatedFiles:
- docs/models/errors/servererrorerrors.md
- docs/models/errors/servererror.md
- docs/models/errors/unhealthyserver.md
- docs/sdks/opa/README.md
- docs/sdks/opaapiclient/README.md
- USAGE.md
- .gitattributes
- src/hooks/hooks.ts
Expand Down
5 changes: 3 additions & 2 deletions .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: false
typescript:
version: 0.2.2
version: 0.2.3
additionalDependencies:
dependencies: {}
devDependencies:
Expand All @@ -25,6 +25,7 @@ typescript:
peerDependencies: {}
author: Styra
clientServerStatusCodesAsErrors: true
enumFormat: enum
flattenGlobalSecurity: true
imports:
option: openapi
Expand All @@ -37,6 +38,6 @@ typescript:
inputModelSuffix: input
maxMethodParams: 4
outputModelSuffix: output
packageName: "@styra/opa"
packageName: '@styra/opa'
responseFormat: envelope-http
templateVersion: v2
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ console.log(allowed ? "allowed!" : "denied!");
### Example

```typescript
import { Opa } from "opa";
import { OpaApiClient } from "@styra/opa";

async function run() {
const sdk = new Opa();
const sdk = new OpaApiClient();

const result = await sdk.executePolicyWithInput({
path: "app/rbac",
Expand All @@ -230,11 +230,11 @@ run();
<!-- Start Available Resources and Operations [operations] -->
## Available Resources and Operations

### [Opa SDK](docs/sdks/opa/README.md)
### [OpaApiClient SDK](docs/sdks/opaapiclient/README.md)

* [executePolicy](docs/sdks/opa/README.md#executepolicy) - Execute a policy
* [executePolicyWithInput](docs/sdks/opa/README.md#executepolicywithinput) - Execute a policy given an input
* [health](docs/sdks/opa/README.md#health) - Verify the server is operational
* [executePolicy](docs/sdks/opaapiclient/README.md#executepolicy) - Execute a policy
* [executePolicyWithInput](docs/sdks/opaapiclient/README.md#executepolicywithinput) - Execute a policy given an input
* [health](docs/sdks/opaapiclient/README.md#health) - Verify the server is operational
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll need to fix those in the typedoc replacements TODO

<!-- End Available Resources and Operations [operations] -->

<!-- Start Error Handling [errors] -->
Expand All @@ -252,11 +252,11 @@ Validation errors can also occur when either method arguments or data returned f


```typescript
import { Opa } from "opa";
import * as errors from "opa/models/errors";
import { OpaApiClient } from "@styra/opa";
import * as errors from "@styra/opa/models/errors";

async function run() {
const sdk = new Opa();
const sdk = new OpaApiClient();

let result;
try {
Expand Down Expand Up @@ -307,10 +307,10 @@ You can override the default server globally by passing a server index to the `s
| 0 | `http://localhost:8181` | None |

```typescript
import { Opa } from "opa";
import { OpaApiClient } from "@styra/opa";

async function run() {
const sdk = new Opa({
const sdk = new OpaApiClient({
serverIdx: 0,
});

Expand All @@ -332,10 +332,10 @@ run();
The default server can also be overridden globally by passing a URL to the `serverURL` optional parameter when initializing the SDK client instance. For example:

```typescript
import { Opa } from "opa";
import { OpaApiClient } from "@styra/opa";

async function run() {
const sdk = new Opa({
const sdk = new OpaApiClient({
serverURL: "http://localhost:8181",
});

Expand Down Expand Up @@ -370,8 +370,8 @@ custom header and a timeout to requests and how to use the `"requestError"` hook
to log errors:

```typescript
import { Opa } from "opa";
import { HTTPClient } from "opa/lib/http";
import { OpaApiClient } from "@styra/opa";
import { HTTPClient } from "@styra/opa/lib/http";

const httpClient = new HTTPClient({
// fetcher takes a function that has the same signature as native `fetch`.
Expand All @@ -397,7 +397,7 @@ httpClient.addHook("requestError", (error, request) => {
console.groupEnd();
});

const sdk = new Opa({ httpClient });
const sdk = new OpaApiClient({ httpClient });
```
<!-- End Custom HTTP Client [http-client] -->

Expand Down
10 changes: 9 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,12 @@ Based on:
- OpenAPI Doc
- Speakeasy CLI 1.245.0 (2.301.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.2.2] .
- [typescript v0.2.2] .

## 2024-04-11 18:30:10
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.250.0 (2.304.1) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.2.3] .
4 changes: 2 additions & 2 deletions USAGE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!-- Start SDK Example Usage [usage] -->
```typescript
import { Opa } from "opa";
import { OpaApiClient } from "@styra/opa";

async function run() {
const sdk = new Opa();
const sdk = new OpaApiClient();

const result = await sdk.executePolicyWithInput({
path: "app/rbac",
Expand Down
14 changes: 7 additions & 7 deletions docs/sdks/opa/README.md → docs/sdks/opaapiclient/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Opa SDK
# OpaApiClient SDK


## Overview
Expand All @@ -18,10 +18,10 @@ Execute a policy
### Example Usage

```typescript
import { Opa } from "opa";
import { OpaApiClient } from "@styra/opa";

async function run() {
const sdk = new Opa();
const sdk = new OpaApiClient();

const result = await sdk.executePolicy({
path: "app/rbac",
Expand Down Expand Up @@ -61,10 +61,10 @@ Execute a policy given an input
### Example Usage

```typescript
import { Opa } from "opa";
import { OpaApiClient } from "@styra/opa";

async function run() {
const sdk = new Opa();
const sdk = new OpaApiClient();

const result = await sdk.executePolicyWithInput({
path: "app/rbac",
Expand Down Expand Up @@ -112,10 +112,10 @@ The health API endpoint executes a simple built-in policy query to verify that t
### Example Usage

```typescript
import { Opa } from "opa";
import { OpaApiClient } from "@styra/opa";

async function run() {
const sdk = new Opa();
const sdk = new OpaApiClient();

const bundles = false;
const plugins = false;
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opa",
"version": "0.2.2",
"name": "@styra/opa",
"version": "0.2.3",
"author": "Styra",
"main": "./index.js",
"sideEffects": false,
Expand Down
6 changes: 3 additions & 3 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
export const SDK_METADATA = Object.freeze({
language: "typescript",
openapiDocVersion: "0.2.0",
sdkVersion: "0.2.2",
genVersion: "2.301.3",
userAgent: "speakeasy-sdk/typescript 0.2.2 2.301.3 0.2.0 opa",
sdkVersion: "0.2.3",
genVersion: "2.304.1",
userAgent: "speakeasy-sdk/typescript 0.2.3 2.304.1 0.2.0 @styra/opa",
});
2 changes: 1 addition & 1 deletion src/sdk/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ClientSDK, RequestOptions } from "../lib/sdks";
import * as errors from "../models/errors";
import * as operations from "../models/operations";

export class Opa extends ClientSDK {
export class OpaApiClient extends ClientSDK {
private readonly options$: SDKOptions & { hooks?: SDKHooks };

constructor(options: SDKOptions = {}) {
Expand Down