Skip to content

Commit

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

chore: 🐝 Update SDK - Generate ACCOUNTING 0.2.0
  • Loading branch information
ryan-timothy-albert authored Aug 23, 2024
2 parents 76e1015 + ff85c85 commit 7d6f8e9
Show file tree
Hide file tree
Showing 62 changed files with 1,841 additions and 801 deletions.
4 changes: 2 additions & 2 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ targets:
accounting:
source: source1
sourceNamespace: source-1
sourceRevisionDigest: sha256:f1c16550b5fae5934ee128bf121cb51614ce18928c80f211b9012d904cae07e9
sourceBlobDigest: sha256:917f783532db81e8d7bd5dc27b194431fc3ff19759dfc32d740e61307c281584
sourceRevisionDigest: sha256:00d024558a05b3efdf72d1e2e3fbe7070c818b431d7f3f054b0418ba11990f53
sourceBlobDigest: sha256:7c35756702030633a8d2ebb1d378d34f883126319b06edcd798ac7bb2fddb189
outLocation: ./accounting
finance:
source: source1
Expand Down
2 changes: 2 additions & 0 deletions accounting/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/funcs
/core.*
/models
/models/errors
/types
Expand Down
23 changes: 18 additions & 5 deletions accounting/.speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,61 @@ id: de44aa14-d51e-4f37-b22e-356d78ca0ebc
management:
docChecksum: 1bdb7a6f8bf3995d4b40475228403253
docVersion: 1.0.0
speakeasyVersion: 1.335.2
generationVersion: 2.372.3
releaseVersion: 0.1.2
configChecksum: 0e5e1f858ed69ceea3f0e688bdc984ab
speakeasyVersion: 1.378.0
generationVersion: 2.404.3
releaseVersion: 0.2.0
configChecksum: 12277291f7c38a0195813d685ee064c6
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.6
core: 3.14.1
defaultEnabledRetries: 0.1.0
envVarSecurityUsage: 0.1.1
globalSecurityCallbacks: 0.1.0
globalServerURLs: 2.82.4
responseFormat: 0.2.3
retries: 2.83.0
sdkHooks: 0.1.0
generatedFiles:
- src/funcs/petsListPets.ts
- src/funcs/petsCreatePets.ts
- src/funcs/petsShowPetById.ts
- src/sdk/pets.ts
- src/sdk/sdk.ts
- .eslintrc.cjs
- .npmignore
- FUNCTIONS.md
- RUNTIMES.md
- jsr.json
- package.json
- src/core.ts
- src/index.ts
- src/lib/base64.ts
- src/lib/config.ts
- src/lib/dlv.ts
- src/lib/encodings.ts
- src/lib/http.ts
- src/lib/is-plain-object.ts
- src/lib/logger.ts
- src/lib/matchers.ts
- src/lib/primitives.ts
- src/lib/retries.ts
- src/lib/schemas.ts
- src/lib/sdks.ts
- src/lib/security.ts
- src/lib/url.ts
- src/sdk/index.ts
- src/models/errors/httpclienterrors.ts
- src/models/errors/sdkerror.ts
- src/models/errors/sdkvalidationerror.ts
- src/types/blobs.ts
- src/types/constdatetime.ts
- src/types/enums.ts
- src/types/fp.ts
- src/types/index.ts
- src/types/operations.ts
- src/types/rfcdate.ts
Expand All @@ -72,3 +84,4 @@ generatedFiles:
- src/hooks/hooks.ts
- src/hooks/types.ts
- src/hooks/index.ts
- CONTRIBUTING.md
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.1.2
version: 0.2.0
additionalDependencies:
dependencies: {}
devDependencies: {}
Expand Down
26 changes: 26 additions & 0 deletions accounting/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Contributing to This Repository

Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements.

## How to Report Issues

If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes:

- A clear and descriptive title
- Steps to reproduce the issue
- Expected and actual behavior
- Any relevant logs, screenshots, or error messages
- Information about your environment (e.g., operating system, software versions)
- For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed

## Issue Triage and Upstream Fixes

We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code.

## Contact

If you have any questions or need further assistance, please feel free to reach out by opening an issue.

Thank you for your understanding and cooperation!

The Maintainers
102 changes: 102 additions & 0 deletions accounting/FUNCTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Standalone Functions

> [!NOTE]
> This section is useful if you are using a bundler and targetting browsers and
> runtimes where the size of an application affects performance and load times.
Every method in this SDK is also available as a standalone function. This
alternative API is suitable when targetting the browser or serverless runtimes
and using a bundler to build your application since all unused functionality
will be tree-shaken away. This includes code for unused methods, Zod schemas,
encoding helpers and response handlers. The result is dramatically smaller
impact on the application's final bundle size which grows very slowly as you use
more and more functionality from this SDK.

Calling methods through the main SDK class remains a valid and generally more
more ergonomic option. Standalone functions represent an optimisation for a
specific category of applications.

## Example

```typescript
import { AccountingSDKCore } from "ryan-accounting/core.js";
import { petsListPets } from "ryan-accounting/funcs/petsListPets.js";
import { SDKValidationError } from "ryan-accounting/models/errors/sdkvalidationerror.js";

// Use `AccountingSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const accountingSDK = new AccountingSDKCore();

async function run() {
const res = await petsListPets(accountingSDK, {});

switch (true) {
case res.ok:
// The success case will be handled outside of the switch block
break;
case res.error instanceof SDKValidationError:
// Pretty-print validation errors.
return console.log(res.error.pretty());
case res.error instanceof Error:
return console.log(res.error);
default:
// TypeScript's type checking will fail on the following line if the above
// cases were not exhaustive.
res.error satisfies never;
throw new Error("Assertion failed: expected error checks to be exhaustive: " + res.error);
}


const { value: result } = res;

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

run();
```

## Result types

Standalone functions differ from SDK methods in that they return a
`Result<Value, Error>` type to capture _known errors_ and document them using
the type system. By avoiding throwing errors, application code maintains clear
control flow and error-handling become part of the regular flow of application
code.

> We use the term "known errors" because standalone functions, and JavaScript
> code in general, can still throw unexpected errors such as `TypeError`s,
> `RangeError`s and `DOMException`s. Exhaustively catching all errors may be
> something this SDK addresses in the future. Nevertheless, there is still a lot
> of benefit from capturing most errors and turning them into values.
The second reason for this style of programming is because these functions will
typically be used in front-end applications where exception throwing is
sometimes discouraged or considered unidiomatic. React and similar ecosystems
and libraries tend to promote this style of programming so that components
render useful content under all states (loading, success, error and so on).

The general pattern when calling standalone functions looks like this:

```typescript
import { Core } from "<sdk-package-name>";
import { fetchSomething } from "<sdk-package-name>/funcs/fetchSomething.js";

const client = new Core();

async function run() {
const result = await fetchSomething(client, { id: "123" });
if (!result.ok) {
// You can throw the error or handle it. It's your choice now.
throw result.error;
}

console.log(result.value);
}

run();
```

Notably, `result.error` above will have an explicit type compared to a try-catch
variation where the error in the catch block can only be of type `unknown` (or
`any` depending on your TypeScript settings).
40 changes: 40 additions & 0 deletions accounting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,46 @@ run();
```
<!-- End Retries [retries] -->

<!-- Start Standalone functions [standalone-funcs] -->
## Standalone functions

All the methods listed above are available as standalone functions. These
functions are ideal for use in applications running in the browser, serverless
runtimes or other environments where application bundle size is a primary
concern. When using a bundler to build your application, all unused
functionality will be either excluded from the final bundle or tree-shaken away.

To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).

<details>

<summary>Available standalone functions</summary>

- [petsCreatePets](docs/sdks/pets/README.md#createpets)
- [petsListPets](docs/sdks/pets/README.md#listpets)
- [petsShowPetById](docs/sdks/pets/README.md#showpetbyid)


</details>
<!-- End Standalone functions [standalone-funcs] -->

<!-- Start Debugging [debug] -->
## Debugging

You can setup your SDK to emit debug logs for SDK requests and responses.

You can pass a logger that matches `console`'s interface as an SDK option.

> [!WARNING]
> Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
```typescript
import { AccountingSDK } from "ryan-accounting";

const sdk = new AccountingSDK({ debugLogger: console });
```
<!-- End Debugging [debug] -->

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

# Development
Expand Down
12 changes: 11 additions & 1 deletion accounting/RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,14 @@ Based on:
### Generated
- [typescript v0.1.2] accounting
### Releases
- [NPM v0.1.2] https://www.npmjs.com/package/ryan-accounting/v/0.1.2 - accounting
- [NPM v0.1.2] https://www.npmjs.com/package/ryan-accounting/v/0.1.2 - accounting

## 2024-08-23 16:11:01
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.378.0 (2.404.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.2.0] accounting
### Releases
- [NPM v0.2.0] https://www.npmjs.com/package/ryan-accounting/v/0.2.0 - accounting
10 changes: 10 additions & 0 deletions accounting/docs/models/components/errort.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# ErrorT

## Example Usage

```typescript
import { ErrorT } from "ryan-accounting/models/components";

let value: ErrorT = {
code: 847252,
message: "<value>",
};
```

## Fields

Expand Down
10 changes: 10 additions & 0 deletions accounting/docs/models/components/pet.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Pet

## Example Usage

```typescript
import { Pet } from "ryan-accounting/models/components";

let value: Pet = {
id: 544883,
name: "<value>",
};
```

## Fields

Expand Down
7 changes: 7 additions & 0 deletions accounting/docs/models/operations/listpetsrequest.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ListPetsRequest

## Example Usage

```typescript
import { ListPetsRequest } from "ryan-accounting/models/operations";

let value: ListPetsRequest = {};
```

## Fields

Expand Down
15 changes: 15 additions & 0 deletions accounting/docs/models/operations/listpetsresponse.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# ListPetsResponse

## Example Usage

```typescript
import { ListPetsResponse } from "ryan-accounting/models/operations";

let value: ListPetsResponse = {
headers: {
key: ["<value>"],
},
result: {
code: 844266,
message: "<value>",
},
};
```

## Fields

Expand Down
10 changes: 10 additions & 0 deletions accounting/docs/models/operations/listpetsresponseresult.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# ListPetsResponseResult

## Example Usage

```typescript
import { ListPetsResponseResult } from "ryan-accounting/models/operations";

let value: ListPetsResponseResult = {
code: 592845,
message: "<value>",
};
```

## Supported Types

Expand Down
9 changes: 9 additions & 0 deletions accounting/docs/models/operations/showpetbyidrequest.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# ShowPetByIdRequest

## Example Usage

```typescript
import { ShowPetByIdRequest } from "ryan-accounting/models/operations";

let value: ShowPetByIdRequest = {
petId: "<value>",
};
```

## Fields

Expand Down
Loading

0 comments on commit 7d6f8e9

Please sign in to comment.