Skip to content

Commit

Permalink
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.390.1
Browse files Browse the repository at this point in the history
  • Loading branch information
speakeasybot committed Sep 4, 2024
1 parent 2288c2d commit bb0421f
Show file tree
Hide file tree
Showing 277 changed files with 8,995 additions and 3,517 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
63 changes: 55 additions & 8 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
lockVersion: 2.0.0
id: edadaac9-e645-4ef4-a6c7-a1f73bc19385
management:
docChecksum: 3a41efc27f0622ed34034d315390d0f6
docChecksum: 4f2a40193a1ee14be648834f76a40ec4
docVersion: v1.0.0
speakeasyVersion: 1.346.3
generationVersion: 2.379.6
releaseVersion: 4.14.2
configChecksum: 3926946790c8e7351f6d24ad3d3bae29
speakeasyVersion: 1.390.1
generationVersion: 2.409.0
releaseVersion: 4.15.0
configChecksum: b84f01af0008ac1b7a7605a35024c1b6
repoURL: https://github.com/Leonardo-Interactive/leonardo-ts-sdk.git
repoSubDirectory: .
installationURL: https://github.com/Leonardo-Interactive/leonardo-ts-sdk
published: true
features:
typescript:
additionalDependencies: 0.1.0
constsAndDefaults: 0.1.5
core: 3.11.10
constsAndDefaults: 0.1.11
core: 3.16.0
defaultEnabledRetries: 0.1.0
deprecations: 2.81.1
devContainers: 2.90.0
envVarSecurityUsage: 0.1.1
flattening: 2.81.1
globalSecurity: 2.82.9
globalSecurity: 2.82.11
globalSecurityCallbacks: 0.1.0
globalSecurityFlattening: 0.1.0
globalServerURLs: 2.82.4
Expand All @@ -29,6 +30,42 @@ features:
retries: 2.83.0
sdkHooks: 0.1.0
generatedFiles:
- src/funcs/initImagesDeleteInitImageById.ts
- src/funcs/initImagesGetInitImageById.ts
- src/funcs/initImagesUploadCanvasInitImage.ts
- src/funcs/initImagesUploadInitImage.ts
- src/funcs/datasetCreateDataset.ts
- src/funcs/datasetDeleteDatasetById.ts
- src/funcs/datasetGetDatasetById.ts
- src/funcs/datasetUploadDatasetImage.ts
- src/funcs/datasetUploadDatasetImageFromGen.ts
- src/funcs/elementsListElements.ts
- src/funcs/imageCreateGeneration.ts
- src/funcs/imageDeleteGenerationById.ts
- src/funcs/imageGetGenerationById.ts
- src/funcs/imageGetGenerationsByUserId.ts
- src/funcs/realtimeCanvasCreateLCMGeneration.ts
- src/funcs/realtimeCanvasPerformAlchemyUpscaleLCM.ts
- src/funcs/realtimeCanvasPerformInpaintingLCM.ts
- src/funcs/realtimeCanvasPerformInstantRefine.ts
- src/funcs/motionCreateSVDMotionGeneration.ts
- src/funcs/textureCreateTextureGeneration.ts
- src/funcs/textureDeleteTextureGenerationById.ts
- src/funcs/userGetUserSelf.ts
- src/funcs/modelsCreateModel.ts
- src/funcs/modelsDeleteModelById.ts
- src/funcs/modelsGetModelById.ts
- src/funcs/modelsListPlatformModels.ts
- src/funcs/threeDModelAssetsDelete3DModelById.ts
- src/funcs/threeDModelAssetsUploadModelAsset.ts
- src/funcs/pricingCalculatorPricingCalculator.ts
- src/funcs/promptPromptImprove.ts
- src/funcs/promptPromptRandom.ts
- src/funcs/variationCreateUniversalUpscalerJob.ts
- src/funcs/variationCreateVariationNoBG.ts
- src/funcs/variationCreateVariationUnzoom.ts
- src/funcs/variationCreateVariationUpscale.ts
- src/funcs/variationGetVariationById.ts
- src/sdk/initimages.ts
- src/sdk/dataset.ts
- src/sdk/elements.ts
Expand All @@ -45,29 +82,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/deleteinitimagebyid.ts
- src/sdk/models/operations/getinitimagebyid.ts
Expand Down
10 changes: 5 additions & 5 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
speakeasyVersion: 1.346.3
speakeasyVersion: 1.390.1
sources:
my-source:
sourceNamespace: my-source
sourceRevisionDigest: sha256:92acfd300c5c59ac415f8ff984266de3316dbc338743ab4989940710cc40a8b5
sourceBlobDigest: sha256:d1c8c276b2380d236351bd02a9d6243d47c810ee2260043b7ae4c443be3f77ab
sourceRevisionDigest: sha256:68e860e0700bdd24e58887950df28e1cd3e479f87591681c86693ca856b68d91
sourceBlobDigest: sha256:7795ce93c2cd2bed48f77a05eead55d73ce1d93227c230ae806913736ad38d19
tags:
- latest
- main
targets:
leonardo-ts-sdk:
source: my-source
sourceNamespace: my-source
sourceRevisionDigest: sha256:92acfd300c5c59ac415f8ff984266de3316dbc338743ab4989940710cc40a8b5
sourceBlobDigest: sha256:d1c8c276b2380d236351bd02a9d6243d47c810ee2260043b7ae4c443be3f77ab
sourceRevisionDigest: sha256:68e860e0700bdd24e58887950df28e1cd3e479f87591681c86693ca856b68d91
sourceBlobDigest: sha256:7795ce93c2cd2bed48f77a05eead55d73ce1d93227c230ae806913736ad38d19
outLocation: ./
workflow:
workflowVersion: 1.0.0
Expand Down
104 changes: 104 additions & 0 deletions FUNCTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# 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 { LeonardoCore } from "@leonardo-ai/sdk/core.js";
import { initImagesDeleteInitImageById } from "@leonardo-ai/sdk/funcs/initImagesDeleteInitImageById.js";
import { SDKValidationError } from "@leonardo-ai/sdk/sdk/models/errors/sdkvalidationerror.js";

// Use `LeonardoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const leonardo = new LeonardoCore({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
const res = await initImagesDeleteInitImageById(leonardo, "<id>");

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 bb0421f

Please sign in to comment.