Skip to content

Commit 5e09f6d

Browse files
committed
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.563.1
1 parent 3bab7b3 commit 5e09f6d

File tree

436 files changed

+9736
-8329
lines changed

Some content is hidden

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

436 files changed

+9736
-8329
lines changed

.speakeasy/gen.lock

Lines changed: 2922 additions & 539 deletions
Large diffs are not rendered by default.

.speakeasy/gen.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ generation:
2020
oAuth2ClientCredentialsEnabled: false
2121
oAuth2PasswordEnabled: false
2222
typescript:
23-
version: 0.12.1
23+
version: 0.12.2
2424
additionalDependencies:
2525
dependencies:
2626
json-canonicalize: ^1.0.6
@@ -31,6 +31,7 @@ typescript:
3131
homepage: https://developer.avacloud.io/avacloud-sdk/getting-started
3232
license: SEE LICENSE
3333
author: AvaCloud
34+
baseErrorName: AvaCloudSDKError
3435
clientServerStatusCodesAsErrors: true
3536
defaultErrorName: SDKError
3637
enableCustomCodeRegions: false

.speakeasy/workflow.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
speakeasyVersion: 1.555.0
1+
speakeasyVersion: 1.563.1
22
sources:
33
AvaCloudSDK-OAS:
44
sourceNamespace: avacloud-sdk-oas
5-
sourceRevisionDigest: sha256:442cc3ce513718c1686efed1b4ec323982e49b2ea2fd111a02c4fc07da855c43
6-
sourceBlobDigest: sha256:46ea12e8708a5d254d41034432ee7b7f1985478cc9de3ddcfe6f6f3046f93b25
5+
sourceRevisionDigest: sha256:31f8da12f86c2d62f17221a4778c46288b862d4abbbaa8d13f683be009ef2b87
6+
sourceBlobDigest: sha256:b99c9804e12a5f0bfd8428e995e8be1638c6f57de29b83b0bb67d5fdc62a862c
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1748900446
9+
- speakeasy-sdk-regen-1749255134
1010
- 1.0.0
1111
AvalancheSDK-OAS:
1212
sourceNamespace: avalanche-sdk-oas
@@ -19,10 +19,10 @@ targets:
1919
avacloud-sdk:
2020
source: AvaCloudSDK-OAS
2121
sourceNamespace: avacloud-sdk-oas
22-
sourceRevisionDigest: sha256:442cc3ce513718c1686efed1b4ec323982e49b2ea2fd111a02c4fc07da855c43
23-
sourceBlobDigest: sha256:46ea12e8708a5d254d41034432ee7b7f1985478cc9de3ddcfe6f6f3046f93b25
22+
sourceRevisionDigest: sha256:31f8da12f86c2d62f17221a4778c46288b862d4abbbaa8d13f683be009ef2b87
23+
sourceBlobDigest: sha256:b99c9804e12a5f0bfd8428e995e8be1638c6f57de29b83b0bb67d5fdc62a862c
2424
codeSamplesNamespace: avacloud-sdk-ts-code-samples
25-
codeSamplesRevisionDigest: sha256:876348a888a52d549ea50086546f2c2465129e9e012fc65ba9074db6fe222aaa
25+
codeSamplesRevisionDigest: sha256:7883f1c4fd7d84882c7f9074e782b7feb70228b65f3e388773e3859593e8fe03
2626
avalanche-sdk:
2727
source: AvalancheSDK-OAS
2828
sourceNamespace: avalanche-sdk-oas

FUNCTIONS.md

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,40 +21,21 @@ specific category of applications.
2121
```typescript
2222
import { AvaCloudSDKCore } from "@avalabs/avacloud-sdk/core.js";
2323
import { metricsHealthCheck } from "@avalabs/avacloud-sdk/funcs/metricsHealthCheck.js";
24-
import { SDKValidationError } from "@avalabs/avacloud-sdk/models/errors/sdkvalidationerror.js";
2524

2625
// Use `AvaCloudSDKCore` for best tree-shaking performance.
2726
// You can create one instance of it to use across an application.
2827
const avaCloudSDK = new AvaCloudSDKCore({
2928
serverURL: "https://api.example.com",
30-
chainId: "43114",
31-
network: "mainnet",
3229
});
3330

3431
async function run() {
3532
const res = await metricsHealthCheck(avaCloudSDK);
36-
37-
switch (true) {
38-
case res.ok:
39-
// The success case will be handled outside of the switch block
40-
break;
41-
case res.error instanceof SDKValidationError:
42-
// Pretty-print validation errors.
43-
return console.log(res.error.pretty());
44-
case res.error instanceof Error:
45-
return console.log(res.error);
46-
default:
47-
// TypeScript's type checking will fail on the following line if the above
48-
// cases were not exhaustive.
49-
res.error satisfies never;
50-
throw new Error("Assertion failed: expected error checks to be exhaustive: " + res.error);
33+
if (res.ok) {
34+
const { value: result } = res;
35+
console.log(result);
36+
} else {
37+
console.log("metricsHealthCheck failed:", res.error);
5138
}
52-
53-
54-
const { value: result } = res;
55-
56-
// Handle the result
57-
console.log(result);
5839
}
5940

6041
run();

README.md

Lines changed: 61 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
150150

151151
const avaCloudSDK = new AvaCloudSDK({
152152
serverURL: "https://api.example.com",
153-
chainId: "43114",
154-
network: "mainnet",
155153
});
156154

157155
async function run() {
@@ -550,6 +548,13 @@ run();
550548
* [listTokenHoldersAboveThreshold](docs/sdks/chains/README.md#listtokenholdersabovethreshold) - Get addresses by balance over time
551549
* [listBTCbBridgersAboveThreshold](docs/sdks/chains/README.md#listbtcbbridgersabovethreshold) - Get addresses by BTCb bridged balance
552550

551+
#### [metrics.l1Validators](docs/sdks/l1validators/README.md)
552+
553+
* [listMetrics](docs/sdks/l1validators/README.md#listmetrics) - Get given metric for all validators
554+
* [getMetricsByValidationId](docs/sdks/l1validators/README.md#getmetricsbyvalidationid) - Get metric values with given validation id and timestamp range
555+
* [getMetricsByNodeId](docs/sdks/l1validators/README.md#getmetricsbynodeid) - Get metric values with given node id and timestamp range
556+
* [getMetricsBySubnetId](docs/sdks/l1validators/README.md#getmetricsbysubnetid) - Get metric values with given subnet ID and timestamp range
557+
553558
#### [metrics.networks](docs/sdks/networks/README.md)
554559

555560
* [getStakingMetrics](docs/sdks/networks/README.md#getstakingmetrics) - Get staking metrics for a given subnet
@@ -666,6 +671,10 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
666671
- [`metricsChainsListNftHolders`](docs/sdks/chains/README.md#listnftholders) - Get NFT holders by contract address
667672
- [`metricsChainsListTokenHoldersAboveThreshold`](docs/sdks/chains/README.md#listtokenholdersabovethreshold) - Get addresses by balance over time
668673
- [`metricsHealthCheck`](docs/sdks/metrics/README.md#healthcheck) - Get the health of the service
674+
- [`metricsL1ValidatorsGetMetricsByNodeId`](docs/sdks/l1validators/README.md#getmetricsbynodeid) - Get metric values with given node id and timestamp range
675+
- [`metricsL1ValidatorsGetMetricsBySubnetId`](docs/sdks/l1validators/README.md#getmetricsbysubnetid) - Get metric values with given subnet ID and timestamp range
676+
- [`metricsL1ValidatorsGetMetricsByValidationId`](docs/sdks/l1validators/README.md#getmetricsbyvalidationid) - Get metric values with given validation id and timestamp range
677+
- [`metricsL1ValidatorsListMetrics`](docs/sdks/l1validators/README.md#listmetrics) - Get given metric for all validators
669678
- [`metricsNetworksGetStakingMetrics`](docs/sdks/networks/README.md#getstakingmetrics) - Get staking metrics for a given subnet
670679
- [`metricsSubnetsGetValidators`](docs/sdks/subnets/README.md#getvalidators) - Get addresses running validators during a given time frame
671680
- [`webhooksAddressesAdd`](docs/sdks/addresses/README.md#add) - Add addresses to EVM activity webhook
@@ -737,7 +746,6 @@ async function run() {
737746
});
738747

739748
for await (const page of result) {
740-
// Handle the page
741749
console.log(page);
742750
}
743751
}
@@ -764,8 +772,6 @@ import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
764772

765773
const avaCloudSDK = new AvaCloudSDK({
766774
serverURL: "https://api.example.com",
767-
chainId: "43114",
768-
network: "mainnet",
769775
});
770776

771777
async function run() {
@@ -774,7 +780,6 @@ async function run() {
774780
});
775781

776782
for await (const page of result) {
777-
// Handle the page
778783
console.log(page);
779784
}
780785
}
@@ -795,8 +800,6 @@ import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
795800

796801
const avaCloudSDK = new AvaCloudSDK({
797802
serverURL: "https://api.example.com",
798-
chainId: "43114",
799-
network: "mainnet",
800803
});
801804

802805
async function run() {
@@ -813,7 +816,6 @@ async function run() {
813816
},
814817
});
815818

816-
// Handle the result
817819
console.log(result);
818820
}
819821

@@ -837,14 +839,11 @@ const avaCloudSDK = new AvaCloudSDK({
837839
},
838840
retryConnectionErrors: false,
839841
},
840-
chainId: "43114",
841-
network: "mainnet",
842842
});
843843

844844
async function run() {
845845
const result = await avaCloudSDK.metrics.healthCheck();
846846

847-
// Handle the result
848847
console.log(result);
849848
}
850849

@@ -856,102 +855,46 @@ run();
856855
<!-- Start Error Handling [errors] -->
857856
## Error Handling
858857

859-
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 `reindex` method may throw the following errors:
858+
[`AvaCloudSDKError`](./src/models/errors/avacloudsdkerror.ts) is the base class for all HTTP error responses. It has the following properties:
860859

861-
| Error Type | Status Code | Content Type |
862-
| -------------------------- | ----------- | ---------------- |
863-
| errors.BadRequest | 400 | application/json |
864-
| errors.Unauthorized | 401 | application/json |
865-
| errors.Forbidden | 403 | application/json |
866-
| errors.NotFound | 404 | application/json |
867-
| errors.TooManyRequests | 429 | application/json |
868-
| errors.InternalServerError | 500 | application/json |
869-
| errors.BadGateway | 502 | application/json |
870-
| errors.ServiceUnavailable | 503 | application/json |
871-
| errors.SDKError | 4XX, 5XX | \*/\* |
872-
873-
If the method throws an error and it is not captured by the known errors, it will default to throwing a `SDKError`.
860+
| Property | Type | Description |
861+
| ------------------- | ---------- | --------------------------------------------------------------------------------------- |
862+
| `error.message` | `string` | Error message |
863+
| `error.statusCode` | `number` | HTTP response status code eg `404` |
864+
| `error.headers` | `Headers` | HTTP response headers |
865+
| `error.body` | `string` | HTTP body. Can be empty string if no body is returned. |
866+
| `error.rawResponse` | `Response` | Raw HTTP response |
867+
| `error.data$` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
874868

869+
### Example
875870
```typescript
876871
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
877-
import {
878-
BadGateway,
879-
BadRequest,
880-
Forbidden,
881-
InternalServerError,
882-
NotFound,
883-
SDKValidationError,
884-
ServiceUnavailable,
885-
TooManyRequests,
886-
Unauthorized,
887-
} from "@avalabs/avacloud-sdk/models/errors";
872+
import * as errors from "@avalabs/avacloud-sdk/models/errors";
888873

889874
const avaCloudSDK = new AvaCloudSDK({
890875
serverURL: "https://api.example.com",
891876
chainId: "43114",
892-
network: "mainnet",
893877
});
894878

895879
async function run() {
896880
try {
897881
await avaCloudSDK.data.nfts.reindex({
898-
chainId: "43114",
899882
address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
900883
tokenId: "145",
901884
});
902-
} catch (err) {
903-
switch (true) {
904-
// The server response does not match the expected SDK schema
905-
case (err instanceof SDKValidationError): {
906-
// Pretty-print will provide a human-readable multi-line error message
907-
console.error(err.pretty());
908-
// Raw value may also be inspected
909-
console.error(err.rawValue);
910-
return;
911-
}
912-
case (err instanceof BadRequest): {
913-
// Handle err.data$: BadRequestData
914-
console.error(err);
915-
return;
916-
}
917-
case (err instanceof Unauthorized): {
918-
// Handle err.data$: UnauthorizedData
919-
console.error(err);
920-
return;
921-
}
922-
case (err instanceof Forbidden): {
923-
// Handle err.data$: ForbiddenData
924-
console.error(err);
925-
return;
926-
}
927-
case (err instanceof NotFound): {
928-
// Handle err.data$: NotFoundData
929-
console.error(err);
930-
return;
931-
}
932-
case (err instanceof TooManyRequests): {
933-
// Handle err.data$: TooManyRequestsData
934-
console.error(err);
935-
return;
936-
}
937-
case (err instanceof InternalServerError): {
938-
// Handle err.data$: InternalServerErrorData
939-
console.error(err);
940-
return;
941-
}
942-
case (err instanceof BadGateway): {
943-
// Handle err.data$: BadGatewayData
944-
console.error(err);
945-
return;
946-
}
947-
case (err instanceof ServiceUnavailable): {
948-
// Handle err.data$: ServiceUnavailableData
949-
console.error(err);
950-
return;
951-
}
952-
default: {
953-
// Other errors such as network errors, see HTTPClientErrors for more details
954-
throw err;
885+
} catch (error) {
886+
// The base class for HTTP error responses
887+
if (error instanceof errors.AvaCloudSDKError) {
888+
console.log(error.message);
889+
console.log(error.statusCode);
890+
console.log(error.body);
891+
console.log(error.headers);
892+
893+
// Depending on the method different errors may be thrown
894+
if (error instanceof errors.BadRequest) {
895+
console.log(error.data$.message); // errors.Message
896+
console.log(error.data$.statusCode); // number
897+
console.log(error.data$.error); // string
955898
}
956899
}
957900
}
@@ -961,17 +904,34 @@ run();
961904

962905
```
963906

964-
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.
907+
### Error Classes
908+
**Primary errors:**
909+
* [`AvaCloudSDKError`](./src/models/errors/avacloudsdkerror.ts): The base class for HTTP error responses.
910+
* [`BadRequest`](docs/models/errors/badrequest.md): Bad requests generally mean the client has passed invalid or malformed parameters. Error messages in the response could help in evaluating the error. Status code `400`.
911+
* [`Unauthorized`](docs/models/errors/unauthorized.md): When a client attempts to access resources that require authorization credentials but the client lacks proper authentication in the request, the server responds with 401. Status code `401`.
912+
* [`Forbidden`](docs/models/errors/forbidden.md): When a client attempts to access resources with valid credentials but doesn't have the privilege to perform that action, the server responds with 403. Status code `403`.
913+
* [`NotFound`](docs/models/errors/notfound.md): The error is mostly returned when the client requests with either mistyped URL, or the passed resource is moved or deleted, or the resource doesn't exist. Status code `404`.
914+
* [`TooManyRequests`](docs/models/errors/toomanyrequests.md): This error is returned when the client has sent too many, and has hit the rate limit. Status code `429`.
915+
* [`InternalServerError`](docs/models/errors/internalservererror.md): The error is a generic server side error that is returned for any uncaught and unexpected issues on the server side. This should be very rare, and you may reach out to us if the problem persists for a longer duration. Status code `500`.
916+
* [`BadGateway`](docs/models/errors/badgateway.md): This is an internal error indicating invalid response received by the client-facing proxy or gateway from the upstream server. Status code `502`.
917+
* [`ServiceUnavailable`](docs/models/errors/serviceunavailable.md): The error is returned for certain routes on a particular Subnet. This indicates an internal problem with our Subnet node, and may not necessarily mean the Subnet is down or affected. Status code `503`.
965918

966-
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:
919+
<details><summary>Less common errors (6)</summary>
967920

968-
| HTTP Client Error | Description |
969-
| ---------------------------------------------------- | ---------------------------------------------------- |
970-
| RequestAbortedError | HTTP request was aborted by the client |
971-
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
972-
| ConnectionError | HTTP client was unable to make a request to a server |
973-
| InvalidRequestError | Any input used to create a request is invalid |
974-
| UnexpectedClientError | Unrecognised or unexpected error |
921+
<br />
922+
923+
**Network errors:**
924+
* [`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.
925+
* [`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
926+
* [`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.
927+
* [`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.
928+
* [`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.
929+
930+
931+
**Inherit from [`AvaCloudSDKError`](./src/models/errors/avacloudsdkerror.ts)**:
932+
* [`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.
933+
934+
</details>
975935
<!-- End Error Handling [errors] -->
976936

977937
<!-- Start Custom HTTP Client [http-client] -->
@@ -1041,14 +1001,11 @@ import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
10411001
const avaCloudSDK = new AvaCloudSDK({
10421002
serverURL: "https://api.example.com",
10431003
apiKey: "<YOUR_API_KEY_HERE>",
1044-
chainId: "43114",
1045-
network: "mainnet",
10461004
});
10471005

10481006
async function run() {
10491007
const result = await avaCloudSDK.metrics.healthCheck();
10501008

1051-
// Handle the result
10521009
console.log(result);
10531010
}
10541011

RELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,4 +289,14 @@ Based on:
289289
### Generated
290290
- [typescript v0.12.1] .
291291
### Releases
292-
- [NPM v0.12.1] https://www.npmjs.com/package/@avalabs/avacloud-sdk/v/0.12.1 - .
292+
- [NPM v0.12.1] https://www.npmjs.com/package/@avalabs/avacloud-sdk/v/0.12.1 - .
293+
294+
## 2025-06-16 00:12:35
295+
### Changes
296+
Based on:
297+
- OpenAPI Doc
298+
- Speakeasy CLI 1.563.1 (2.629.1) https://github.com/speakeasy-api/speakeasy
299+
### Generated
300+
- [typescript v0.12.2] .
301+
### Releases
302+
- [NPM v0.12.2] https://www.npmjs.com/package/@avalabs/avacloud-sdk/v/0.12.2 - .

0 commit comments

Comments
 (0)