Skip to content

Commit 5a9df49

Browse files
speakeasybotconst-cloudinary
authored andcommitted
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.561.0
1 parent f579af3 commit 5a9df49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2047
-684
lines changed

.speakeasy/gen.lock

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,23 @@ id: 2cbfefb5-ef48-4650-9f21-e38c7e05b9a9
33
management:
44
docChecksum: a65fdbfaf49bb322db3e3a5170b3aff3
55
docVersion: 0.2.0
6-
speakeasyVersion: 1.551.0
7-
generationVersion: 2.610.0
8-
releaseVersion: 0.3.0
9-
configChecksum: 06c99e90b91b0d7e17234b3c63f41cae
6+
speakeasyVersion: 1.561.0
7+
generationVersion: 2.628.0
8+
releaseVersion: 0.4.0
9+
configChecksum: 6e89578a90ef051b9ed32adc6390c565
1010
repoURL: https://github.com/cloudinary/analysis-js.git
1111
installationURL: https://github.com/cloudinary/analysis-js
1212
published: true
1313
features:
1414
typescript:
1515
additionalDependencies: 0.1.0
16-
core: 3.21.9
16+
core: 3.21.11
1717
customSecuritySchemes: 0.1.1
1818
defaultEnabledRetries: 0.1.0
1919
devContainers: 2.90.0
2020
enumUnions: 0.1.0
2121
envVarSecurityUsage: 0.1.2
22+
flattening: 2.82.1
2223
globalSecurity: 2.82.13
2324
globalSecurityCallbacks: 0.1.0
2425
globalServerURLs: 2.82.5
@@ -27,8 +28,8 @@ features:
2728
nullables: 0.1.1
2829
responseFormat: 0.2.3
2930
retries: 2.83.0
30-
sdkHooks: 0.2.0
31-
unions: 2.85.8
31+
sdkHooks: 0.3.0
32+
unions: 2.85.9
3233
generatedFiles:
3334
- .devcontainer/README.md
3435
- .devcontainer/devcontainer.json
@@ -258,10 +259,12 @@ generatedFiles:
258259
- src/models/components/unidetanalysisdata.ts
259260
- src/models/components/watermarkdetectionanalysisdata.ts
260261
- src/models/errors/apierror.ts
262+
- src/models/errors/cloudinaryanalysiserror.ts
261263
- src/models/errors/errorresponse.ts
262264
- src/models/errors/httpclienterrors.ts
263265
- src/models/errors/index.ts
264266
- src/models/errors/ratelimitedresponse.ts
267+
- src/models/errors/responsevalidationerror.ts
265268
- src/models/errors/sdkvalidationerror.ts
266269
- src/models/operations/analyzeaivisiongeneral.ts
267270
- src/models/operations/analyzeaivisionmoderation.ts
@@ -739,5 +742,18 @@ examples:
739742
application/json: {"error": {"category": "user_error", "code": "MA_00001", "message": "missing parameters", "details": {}, "request_id": "17c3b70c5096df0e77e838323abb7029"}, "limits": {"items": [{"type": "ai_vision", "used_by_request": 123, "remaining": 500, "limit": 10000, "reset_time": "2024-01-20T12:34:56Z"}]}}
740743
"500":
741744
application/json: {"error": {"category": "user_error", "code": "MA_00001", "message": "missing parameters", "details": {}, "request_id": "17c3b70c5096df0e77e838323abb7029"}}
745+
speakeasy-default-get-analysis-task-status:
746+
parameters:
747+
path:
748+
task_id: "053f4bde4b933c8ecef23724ecde63b667c1ea21816d56c161c7ec1df6297da4b43109625650e9edf0f42152cc4cc32c8ad57824ac75ba8e05020f827c415559ac1248076a2d72c0a73af0479cca77eb"
749+
responses:
750+
"200":
751+
application/json: {"data": {"task_id": "053f4bde4b933c8ecef23724ecde63b667c1ea21816d56c161c7ec1df6297da4b43109625650e9edf0f42152cc4cc32c8ad57824ac75ba8e05020f827c415559ac1248076a2d72c0a73af0479cca77eb", "status": "processing"}, "request_id": "17c3b70c5096df0e77e838323abb7029"}
752+
"400":
753+
application/json: {"error": {"category": "user_error", "code": "MA_00001", "message": "missing parameters", "details": {}, "request_id": "17c3b70c5096df0e77e838323abb7029"}}
754+
"429":
755+
application/json: {"error": {"category": "user_error", "code": "MA_00001", "message": "missing parameters", "details": {}, "request_id": "17c3b70c5096df0e77e838323abb7029"}, "limits": {"items": [{"type": "ai_vision", "used_by_request": 123, "remaining": 500, "limit": 10000, "reset_time": "2024-01-20T12:34:56Z"}]}}
756+
"500":
757+
application/json: {"error": {"category": "user_error", "code": "MA_00001", "message": "missing parameters", "details": {}, "request_id": "17c3b70c5096df0e77e838323abb7029"}}
742758
examplesVersion: 1.0.2
743759
generatedTests: {}

.speakeasy/gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ generation:
2020
oAuth2ClientCredentialsEnabled: true
2121
oAuth2PasswordEnabled: true
2222
typescript:
23-
version: 0.3.0
23+
version: 0.4.0
2424
additionalDependencies:
2525
dependencies: {}
2626
devDependencies: {}

.speakeasy/workflow.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
speakeasyVersion: 1.551.0
1+
speakeasyVersion: 1.561.0
22
sources:
33
Analyze API (Beta):
44
sourceNamespace: analyze-api
5-
sourceRevisionDigest: sha256:be35c55d5b30e9e957895225b8c5b9b322e2b038bf6377c705186f3f45740d47
5+
sourceRevisionDigest: sha256:c5eaac5133fe2825895c06fb0dc50d8f46fd3657fc4aeda9ffa492c755efb1ee
66
sourceBlobDigest: sha256:59c600a6e3404a529ff8de08a401719e928e90d8a5a6b0e60f1ab88ae541a073
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1748287281
9+
- speakeasy-sdk-regen-1749759573
1010
- 0.2.0
1111
targets:
1212
analysis-js:
1313
source: Analyze API (Beta)
1414
sourceNamespace: analyze-api
15-
sourceRevisionDigest: sha256:be35c55d5b30e9e957895225b8c5b9b322e2b038bf6377c705186f3f45740d47
15+
sourceRevisionDigest: sha256:c5eaac5133fe2825895c06fb0dc50d8f46fd3657fc4aeda9ffa492c755efb1ee
1616
sourceBlobDigest: sha256:59c600a6e3404a529ff8de08a401719e928e90d8a5a6b0e60f1ab88ae541a073
1717
codeSamplesNamespace: analyze-api-typescript-code-samples
18-
codeSamplesRevisionDigest: sha256:dd38c5915f7d40203fcbca733daa2506a42681e125e0c3d526dd473a31648de2
18+
codeSamplesRevisionDigest: sha256:41ddae1cfe5c0b5be00531138e27511ecd38870c8ed28b1bb49c483bbbf88c10
1919
workflow:
2020
workflowVersion: 1.0.0
2121
speakeasyVersion: latest

FUNCTIONS.md

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ specific category of applications.
2121
```typescript
2222
import { CloudinaryAnalysisCore } from "@cloudinary/analysis/core.js";
2323
import { analyzeAiVisionGeneral } from "@cloudinary/analysis/funcs/analyzeAiVisionGeneral.js";
24-
import { SDKValidationError } from "@cloudinary/analysis/models/errors/sdkvalidationerror.js";
2524

2625
// Use `CloudinaryAnalysisCore` for best tree-shaking performance.
2726
// You can create one instance of it to use across an application.
@@ -44,28 +43,12 @@ async function run() {
4443
"Does this image contain an insect?",
4544
],
4645
});
47-
48-
switch (true) {
49-
case res.ok:
50-
// The success case will be handled outside of the switch block
51-
break;
52-
case res.error instanceof SDKValidationError:
53-
// Pretty-print validation errors.
54-
return console.log(res.error.pretty());
55-
case res.error instanceof Error:
56-
return console.log(res.error);
57-
default:
58-
// TypeScript's type checking will fail on the following line if the above
59-
// cases were not exhaustive.
60-
res.error satisfies never;
61-
throw new Error("Assertion failed: expected error checks to be exhaustive: " + res.error);
46+
if (res.ok) {
47+
const { value: result } = res;
48+
console.log(result);
49+
} else {
50+
console.log("analyzeAiVisionGeneral failed:", res.error);
6251
}
63-
64-
65-
const { value: result } = res;
66-
67-
// Handle the result
68-
console.log(result);
6952
}
7053

7154
run();

README.md

Lines changed: 43 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ async function run() {
188188
],
189189
});
190190

191-
// Handle the result
192191
console.log(result);
193192
}
194193

@@ -234,7 +233,6 @@ async function run() {
234233
],
235234
});
236235

237-
// Handle the result
238236
console.log(result);
239237
}
240238

@@ -269,7 +267,6 @@ async function run() {
269267
],
270268
});
271269

272-
// Handle the result
273270
console.log(result);
274271
}
275272

@@ -314,7 +311,6 @@ async function run() {
314311
],
315312
});
316313

317-
// Handle the result
318314
console.log(result);
319315
}
320316

@@ -430,7 +426,6 @@ async function run() {
430426
},
431427
});
432428

433-
// Handle the result
434429
console.log(result);
435430
}
436431

@@ -472,7 +467,6 @@ async function run() {
472467
],
473468
});
474469

475-
// Handle the result
476470
console.log(result);
477471
}
478472

@@ -484,24 +478,21 @@ run();
484478
<!-- Start Error Handling [errors] -->
485479
## Error Handling
486480

487-
Some methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors/errors.ts` module. The known errors for a method are documented under the *Errors* tables in SDK docs. For example, the `aiVisionGeneral` method may throw the following errors:
481+
[`CloudinaryAnalysisError`](./src/models/errors/cloudinaryanalysiserror.ts) is the base class for all HTTP error responses. It has the following properties:
488482

489-
| Error Type | Status Code | Content Type |
490-
| -------------------------- | ------------------ | ---------------- |
491-
| errors.ErrorResponse | 400, 401, 403, 404 | application/json |
492-
| errors.RateLimitedResponse | 429 | application/json |
493-
| errors.ErrorResponse | 500 | application/json |
494-
| errors.APIError | 4XX, 5XX | \*/\* |
495-
496-
If the method throws an error and it is not captured by the known errors, it will default to throwing a `APIError`.
483+
| Property | Type | Description |
484+
| ------------------- | ---------- | --------------------------------------------------------------------------------------- |
485+
| `error.message` | `string` | Error message |
486+
| `error.statusCode` | `number` | HTTP response status code eg `404` |
487+
| `error.headers` | `Headers` | HTTP response headers |
488+
| `error.body` | `string` | HTTP body. Can be empty string if no body is returned. |
489+
| `error.rawResponse` | `Response` | Raw HTTP response |
490+
| `error.data$` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
497491

492+
### Example
498493
```typescript
499494
import { CloudinaryAnalysis } from "@cloudinary/analysis";
500-
import {
501-
ErrorResponse,
502-
RateLimitedResponse,
503-
SDKValidationError,
504-
} from "@cloudinary/analysis/models/errors";
495+
import * as errors from "@cloudinary/analysis/models/errors";
505496

506497
const cloudinaryAnalysis = new CloudinaryAnalysis({
507498
security: {
@@ -513,9 +504,8 @@ const cloudinaryAnalysis = new CloudinaryAnalysis({
513504
});
514505

515506
async function run() {
516-
let result;
517507
try {
518-
result = await cloudinaryAnalysis.analyze.aiVisionGeneral({
508+
const result = await cloudinaryAnalysis.analyze.aiVisionGeneral({
519509
source: {
520510
uri: "https://res.cloudinary.com/demo/image/upload/sample.jpg",
521511
},
@@ -525,36 +515,18 @@ async function run() {
525515
],
526516
});
527517

528-
// Handle the result
529518
console.log(result);
530-
} catch (err) {
531-
switch (true) {
532-
// The server response does not match the expected SDK schema
533-
case (err instanceof SDKValidationError): {
534-
// Pretty-print will provide a human-readable multi-line error message
535-
console.error(err.pretty());
536-
// Raw value may also be inspected
537-
console.error(err.rawValue);
538-
return;
539-
}
540-
case (err instanceof ErrorResponse): {
541-
// Handle err.data$: ErrorResponseData
542-
console.error(err);
543-
return;
544-
}
545-
case (err instanceof RateLimitedResponse): {
546-
// Handle err.data$: RateLimitedResponseData
547-
console.error(err);
548-
return;
549-
}
550-
case (err instanceof ErrorResponse): {
551-
// Handle err.data$: ErrorResponseData
552-
console.error(err);
553-
return;
554-
}
555-
default: {
556-
// Other errors such as network errors, see HTTPClientErrors for more details
557-
throw err;
519+
} catch (error) {
520+
// The base class for HTTP error responses
521+
if (error instanceof errors.CloudinaryAnalysisError) {
522+
console.log(error.message);
523+
console.log(error.statusCode);
524+
console.log(error.body);
525+
console.log(error.headers);
526+
527+
// Depending on the method different errors may be thrown
528+
if (error instanceof errors.ErrorResponse) {
529+
console.log(error.data$.error); // components.ErrorObject
558530
}
559531
}
560532
}
@@ -564,17 +536,28 @@ run();
564536

565537
```
566538

567-
Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.
539+
### Error Classes
540+
**Primary errors:**
541+
* [`CloudinaryAnalysisError`](./src/models/errors/cloudinaryanalysiserror.ts): The base class for HTTP error responses.
542+
* [`ErrorResponse`](docs/models/errors/errorresponse.md): Bad request.
543+
* [`RateLimitedResponse`](docs/models/errors/ratelimitedresponse.md): Rate limited. Status code `429`.
568544

569-
In some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the `models/errors/httpclienterrors.ts` module:
545+
<details><summary>Less common errors (6)</summary>
570546

571-
| HTTP Client Error | Description |
572-
| ---------------------------------------------------- | ---------------------------------------------------- |
573-
| RequestAbortedError | HTTP request was aborted by the client |
574-
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
575-
| ConnectionError | HTTP client was unable to make a request to a server |
576-
| InvalidRequestError | Any input used to create a request is invalid |
577-
| UnexpectedClientError | Unrecognised or unexpected error |
547+
<br />
548+
549+
**Network errors:**
550+
* [`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.
551+
* [`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
552+
* [`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.
553+
* [`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.
554+
* [`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.
555+
556+
557+
**Inherit from [`CloudinaryAnalysisError`](./src/models/errors/cloudinaryanalysiserror.ts)**:
558+
* [`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.
559+
560+
</details>
578561
<!-- End Error Handling [errors] -->
579562

580563
<!-- Start Custom HTTP Client [http-client] -->

RELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,14 @@ Based on:
88
### Generated
99
- [typescript v0.3.0] .
1010
### Releases
11-
- [NPM v0.3.0] https://www.npmjs.com/package/@cloudinary/analysis/v/0.3.0 - .
11+
- [NPM v0.3.0] https://www.npmjs.com/package/@cloudinary/analysis/v/0.3.0 - .
12+
13+
## 2025-06-12 20:19:17
14+
### Changes
15+
Based on:
16+
- OpenAPI Doc
17+
- Speakeasy CLI 1.561.0 (2.628.0) https://github.com/speakeasy-api/speakeasy
18+
### Generated
19+
- [typescript v0.4.0] .
20+
### Releases
21+
- [NPM v0.4.0] https://www.npmjs.com/package/@cloudinary/analysis/v/0.4.0 - .

USAGE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ async function run() {
2222
],
2323
});
2424

25-
// Handle the result
2625
console.log(result);
2726
}
2827

0 commit comments

Comments
 (0)