Skip to content

Commit

Permalink
Merge pull request #7 from ryan-timothy-albert/speakeasy-sdk-regen-17…
Browse files Browse the repository at this point in the history
…21072282

chore: 🐝 Update SDK - Generate ACCOUNTING
  • Loading branch information
ryan-timothy-albert committed Jul 15, 2024
2 parents e974d9f + b0ac630 commit 44f68ba
Show file tree
Hide file tree
Showing 18 changed files with 491 additions and 179 deletions.
10 changes: 5 additions & 5 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ speakeasyVersion: 1.335.2
sources:
source1:
sourceNamespace: source-1
sourceRevisionDigest: sha256:70427d8936519bbb31834da18b6a64ce50e62c8caa39ab27fadf1279d25bb412
sourceBlobDigest: sha256:41d6992001501dc4f8757117e3902f01178807fd20fbd9ce3a0b33ac2a99e283
sourceRevisionDigest: sha256:eabb4a6af01606d6e6fb07e6381921ecc0b25e031e2d172afa497a17aa8d4e1b
sourceBlobDigest: sha256:614ef27789e2ab0d262263d1dbf21398cb6240c4c4173bddad2fa3fcff4cada0
tags:
- latest
- main
targets:
accounting:
source: source1
sourceNamespace: source-1
sourceRevisionDigest: sha256:43d9d3d838fac17eddc84d2acb5dcb0b499fd6e5bff338951c547b24d496da97
sourceBlobDigest: sha256:5ac74c70fd06c09876fd12094a844951d898b9c3aead02a8d50b3db56ed4f135
outLocation: accounting
sourceRevisionDigest: sha256:eabb4a6af01606d6e6fb07e6381921ecc0b25e031e2d172afa497a17aa8d4e1b
sourceBlobDigest: sha256:614ef27789e2ab0d262263d1dbf21398cb6240c4c4173bddad2fa3fcff4cada0
outLocation: ./accounting
finance:
source: source1
sourceNamespace: source-1
Expand Down
17 changes: 12 additions & 5 deletions accounting/.speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@ id: de44aa14-d51e-4f37-b22e-356d78ca0ebc
management:
docChecksum: 1bdb7a6f8bf3995d4b40475228403253
docVersion: 1.0.0
speakeasyVersion: 1.326.0
generationVersion: 2.359.0
releaseVersion: 0.0.1
configChecksum: a855a32d4cdc76e6341a97559e3b249f
speakeasyVersion: 1.335.2
generationVersion: 2.372.3
releaseVersion: 0.1.0
configChecksum: e98d0a9ce123c36dd6a76567c68850cf
repoURL: https://github.com/ryan-timothy-albert/sample-ts-monorepo.git
repoSubDirectory: accounting
installationURL: https://gitpkg.now.sh/ryan-timothy-albert/sample-ts-monorepo/accounting
published: true
features:
typescript:
additionalDependencies: 0.1.0
core: 3.11.0
core: 3.11.6
defaultEnabledRetries: 0.1.0
globalSecurityCallbacks: 0.1.0
globalServerURLs: 2.82.4
responseFormat: 0.2.3
retries: 2.83.0
sdkHooks: 0.1.0
generatedFiles:
- src/sdk/pets.ts
Expand Down Expand Up @@ -59,6 +65,7 @@ generatedFiles:
- docs/models/components/pet.md
- docs/models/components/errort.md
- docs/sdks/accountingsdk/README.md
- docs/lib/utils/retryconfig.md
- docs/sdks/pets/README.md
- USAGE.md
- .gitattributes
Expand Down
2 changes: 1 addition & 1 deletion accounting/.speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: true
typescript:
version: 0.0.1
version: 0.1.0
additionalDependencies:
dependencies: {}
devDependencies: {}
Expand Down
73 changes: 69 additions & 4 deletions accounting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ It has been generated successfully based on your OpenAPI spec. However, it is no
### NPM

```bash
npm add <UNSET>
npm add ryan-accounting
```

### PNPM

```bash
pnpm add <UNSET>
pnpm add ryan-accounting
```

### Bun

```bash
bun add <UNSET>
bun add ryan-accounting
```

### Yarn

```bash
yarn add <UNSET> zod
yarn add ryan-accounting zod

# Note that Yarn does not install peer dependencies automatically. You will need
# to install zod as shown above.
Expand Down Expand Up @@ -233,6 +233,71 @@ const sdk = new AccountingSDK({ httpClient });
```
<!-- End Custom HTTP Client [http-client] -->

<!-- Start Retries [retries] -->
## Retries

Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.

To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
```typescript
import { AccountingSDK } from "ryan-accounting";

const accountingSDK = new AccountingSDK();

async function run() {
const result = await accountingSDK.pets.listPets(
{},
{
retries: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
}
);

// Handle the result
console.log(result);
}

run();

```

If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
```typescript
import { AccountingSDK } from "ryan-accounting";

const accountingSDK = new AccountingSDK({
retryConfig: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
});

async function run() {
const result = await accountingSDK.pets.listPets({});

// Handle the result
console.log(result);
}

run();

```
<!-- End Retries [retries] -->

<!-- Placeholder for Future Speakeasy SDK Sections -->

# Development
Expand Down
11 changes: 11 additions & 0 deletions accounting/RELEASES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@


## 2024-07-15 19:38:00
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.335.2 (2.372.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.1.0] accounting
### Releases
- [NPM v0.1.0] https://www.npmjs.com/package/ryan-accounting/v/0.1.0 - accounting
2 changes: 1 addition & 1 deletion accounting/RUNTIMES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This SDK is intended to be used in JavaScript runtimes that support the following features:

* [Web Fetch API][web-fetch]
* [Web Streams API](web-streams) and in particular `ReadableStream`
* [Web Streams API][web-streams] and in particular `ReadableStream`
* [Async iterables][async-iter] using `Symbol.asyncIterator`

[web-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
Expand Down
24 changes: 24 additions & 0 deletions accounting/docs/lib/utils/retryconfig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# RetryConfig

Allows customizing the default retry configuration. It is only permitted in methods that accept retry policies.

## Fields

| Name | Type | Description | Example |
| ------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------ | ----------- |
| `strategy` | `"backoff" | "none"` | The retry strategy to use. | `"backoff"` |
| `backoff` | [BackoffStrategy](#backoffstrategy) | When strategy is "backoff", this configurates for the backoff parameters. | |
| `retryConnectionErrors` | `*boolean*` | When strategy is "backoff", this determines whether or not to retry on connection errors. | `true` |

## BackoffStrategy

The backoff strategy allows retrying a request with an exponential backoff between each retry.

### Fields

| Name | Type | Description | Example |
| ------------------ | ------------ | ----------------------------------------- | -------- |
| `initialInterval` | `*number*` | The initial interval in milliseconds. | `500` |
| `maxInterval` | `*number*` | The maximum interval in milliseconds. | `60000` |
| `exponent` | `*number*` | The exponent to use for the backoff. | `1.5` |
| `maxElapsedTime` | `*number*` | The maximum elapsed time in milliseconds. | `300000` |
3 changes: 3 additions & 0 deletions accounting/docs/sdks/pets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ run();
| `request` | [operations.ListPetsRequest](../../models/operations/listpetsrequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |


### Response
Expand Down Expand Up @@ -77,6 +78,7 @@ run();
| `request` | [components.Pet](../../models/components/pet.md) | :heavy_check_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |


### Response
Expand Down Expand Up @@ -118,6 +120,7 @@ run();
| `request` | [operations.ShowPetByIdRequest](../../models/operations/showpetbyidrequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |


### Response
Expand Down
2 changes: 1 addition & 1 deletion accounting/jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "ryan-accounting",
"version": "0.0.1",
"version": "0.1.0",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
Expand Down
17 changes: 2 additions & 15 deletions accounting/package-lock.json

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

8 changes: 6 additions & 2 deletions accounting/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"name": "ryan-accounting",
"version": "0.0.1",
"version": "0.1.0",
"author": "ryan-timothy-albert",
"main": "./index.js",
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/ryan-timothy-albert/sample-ts-monorepo.git",
"directory": "accounting"
},
"scripts": {
"lint": "eslint --max-warnings=0 src",
"build": "tsc",
Expand All @@ -13,7 +18,6 @@
"zod": ">= 3"
},
"devDependencies": {
"@types/jsonpath": "^0.2.4",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"eslint": "^8.57.0",
Expand Down
7 changes: 4 additions & 3 deletions accounting/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type SDKOptions = {
* Allows overriding the default retry config used by the SDK
*/
retryConfig?: RetryConfig;
timeoutMs?: number;
};

export function serverURLFromOptions(options: SDKOptions): URL | null {
Expand All @@ -47,7 +48,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
export const SDK_METADATA = {
language: "typescript",
openapiDocVersion: "1.0.0",
sdkVersion: "0.0.1",
genVersion: "2.359.0",
userAgent: "speakeasy-sdk/typescript 0.0.1 2.359.0 1.0.0 ryan-accounting",
sdkVersion: "0.1.0",
genVersion: "2.372.3",
userAgent: "speakeasy-sdk/typescript 0.1.0 2.372.3 1.0.0 ryan-accounting",
} as const;
Loading

0 comments on commit 44f68ba

Please sign in to comment.