Skip to content

Commit

Permalink
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.390.2
Browse files Browse the repository at this point in the history
  • Loading branch information
speakeasybot committed Sep 4, 2024
1 parent ce4fdde commit 79e7716
Show file tree
Hide file tree
Showing 121 changed files with 3,001 additions and 1,420 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/funcs
/core.*
/esm
/dist
/.tshy
Expand Down
35 changes: 25 additions & 10 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ id: 906577a1-c369-4ae0-9074-3e1b5123889d
management:
docChecksum: 936f0ff0f6ac9e56df38e51b2591854f
docVersion: 1.0.0
speakeasyVersion: 1.345.1
generationVersion: 2.378.1
releaseVersion: 3.0.0-alpha.3
configChecksum: cebc642ac2f745eea63dbe6ff7652744
speakeasyVersion: 1.390.2
generationVersion: 2.409.0
releaseVersion: 3.0.0-alpha.4
configChecksum: 6dade758c80b0089295c521f395a6935
repoURL: https://github.com/speakeasy-sdks/bar-typescript.git
repoSubDirectory: .
installationURL: https://github.com/speakeasy-sdks/bar-typescript
Expand All @@ -15,22 +15,29 @@ features:
typescript:
additionalDependencies: 0.1.0
callbacks: 1.0.0
core: 3.11.8
core: 3.16.0
defaultEnabledRetries: 0.1.0
errors: 2.81.12
envVarSecurityUsage: 0.1.1
errors: 2.82.2
examples: 2.81.4
flattening: 2.81.1
globalSecurity: 2.82.9
globalSecurity: 2.82.11
globalSecurityCallbacks: 0.1.0
globalServerURLs: 2.82.4
inputOutputModels: 2.82.0
oauth2ClientCredentials: 0.1.4
oauth2ClientCredentials: 0.2.0
responseFormat: 0.2.3
retries: 2.83.0
sdkHooks: 0.1.0
serverIDs: 2.81.2
webhooks: 1.0.0
generatedFiles:
- src/funcs/authenticationAuthenticate.ts
- src/funcs/drinksGetDrink.ts
- src/funcs/drinksListDrinks.ts
- src/funcs/ingredientsListIngredients.ts
- src/funcs/ordersCreateOrder.ts
- src/funcs/configSubscribeToWebhooks.ts
- src/sdk/authentication.ts
- src/sdk/drinks.ts
- src/sdk/ingredients.ts
Expand All @@ -39,29 +46,39 @@ generatedFiles:
- 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/files.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/sdk/models/errors/httpclienterrors.ts
- src/sdk/models/errors/sdkerror.ts
- src/sdk/models/errors/sdkvalidationerror.ts
- src/sdk/types/blobs.ts
- src/sdk/types/constdatetime.ts
- src/sdk/types/enums.ts
- src/sdk/types/fp.ts
- src/sdk/types/index.ts
- src/sdk/types/operations.ts
- src/sdk/types/rfcdate.ts
- src/sdk/types/streams.ts
- tsconfig.json
- src/sdk/models/operations/authenticate.ts
- src/sdk/models/operations/getdrink.ts
Expand Down Expand Up @@ -110,12 +127,10 @@ generatedFiles:
- docs/sdk/models/shared/status.md
- docs/sdk/models/shared/order.md
- docs/sdk/models/shared/ordertype.md
- docs/sdk/models/shared/orderinput.md
- docs/sdk/models/shared/security.md
- docs/sdk/models/shared/schemeclientcredentials.md
- docs/sdk/models/shared/ingredient.md
- docs/sdk/models/shared/ingredienttype.md
- docs/sdk/models/shared/drinkinput.md
- docs/sdk/models/errors/apierror.md
- docs/sdk/models/callbacks/createorderorderupdateresponse.md
- docs/sdk/models/callbacks/createorderorderupdaterequestbody.md
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: true
typescript:
version: 3.0.0-alpha.3
version: 3.0.0-alpha.4
additionalDependencies:
dependencies: {}
devDependencies: {}
Expand Down
8 changes: 4 additions & 4 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
speakeasyVersion: 1.345.1
speakeasyVersion: 1.390.2
sources:
bar-api:
sourceNamespace: bar-api
sourceRevisionDigest: sha256:c0f425f6e60dd28c12f8bc8b1afe6a571208e4134a68cb18e81d22d36f08c141
sourceRevisionDigest: sha256:4c6416e76a74c28ffc1e8b232db51bc8f97b856f43e92fdc4ea1b02819c2f87a
sourceBlobDigest: sha256:2b4f4ee668d9bf6ba862927bef3aeabcdb101f163915ec8a1736b274d3152a5f
tags:
- latest
Expand All @@ -11,10 +11,10 @@ targets:
bar-typescript:
source: bar-api
sourceNamespace: bar-api
sourceRevisionDigest: sha256:c0f425f6e60dd28c12f8bc8b1afe6a571208e4134a68cb18e81d22d36f08c141
sourceRevisionDigest: sha256:4c6416e76a74c28ffc1e8b232db51bc8f97b856f43e92fdc4ea1b02819c2f87a
sourceBlobDigest: sha256:2b4f4ee668d9bf6ba862927bef3aeabcdb101f163915ec8a1736b274d3152a5f
codeSamplesNamespace: code-samples-typescript-bar-typescript
codeSamplesRevisionDigest: sha256:eead1e63d1101fa618f1e0ccf7726f3d8c2231a72b9c35d7d19d68dc034456d0
codeSamplesRevisionDigest: sha256:b47c99f1d5ca3c8f0d44477b5ba55c2064cf073e568e83cdd80563f768624b8e
outLocation: /github/workspace/repo
workflow:
workflowVersion: 1.0.0
Expand Down
106 changes: 106 additions & 0 deletions FUNCTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# 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 { BarSDKCore } from "@speakeasy-sdks/speakeasy-bar/core.js";
import { drinksListDrinks } from "@speakeasy-sdks/speakeasy-bar/funcs/drinksListDrinks.js";
import { SDKValidationError } from "@speakeasy-sdks/speakeasy-bar/sdk/models/errors/sdkvalidationerror.js";

// Use `BarSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const barSDK = new BarSDKCore({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});

async function run() {
const res = await drinksListDrinks(barSDK);

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).
Loading

0 comments on commit 79e7716

Please sign in to comment.