Skip to content

Commit

Permalink
Recreated sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
SayanKar committed Aug 13, 2024
1 parent da16a4a commit a32e5f1
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 137 deletions.
9 changes: 2 additions & 7 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

<div align="center">
<a href="https://codespaces.new/ava-labs/avalanche-sdk-typescript.git/tree/main"><img src="https://github.com/codespaces/badge.svg" /></a>
</div>
<br>

> **Remember to shutdown a GitHub Codespace when it is not in use!**
# Dev Containers Quick Start
Expand All @@ -25,11 +20,11 @@ The speakeasy CLI allows you to generate more usage snippets. Here's how:
- To generate a sample for a specific operation by providing an operation ID, use:

```
speakeasy generate usage -s https://ad39-2405-201-3027-2887-d9b-fc28-c7ec-5133.ngrok-free.app/api-json -l typescript -i {INPUT_OPERATION_ID} -o ./samples
speakeasy generate usage -s https://1573-2405-201-3027-2887-ada2-ca7a-fa63-8ab5.ngrok-free.app/api-json -l typescript -i {INPUT_OPERATION_ID} -o ./samples
```

- To generate samples for an entire namespace (like a tag or group name), use:

```
speakeasy generate usage -s https://ad39-2405-201-3027-2887-d9b-fc28-c7ec-5133.ngrok-free.app/api-json -l typescript -n {INPUT_TAG_NAME} -o ./samples
speakeasy generate usage -s https://1573-2405-201-3027-2887-ada2-ca7a-fa63-8ab5.ngrok-free.app/api-json -l typescript -n {INPUT_TAG_NAME} -o ./samples
```
2 changes: 1 addition & 1 deletion .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ EOL
echo "$TS_CONFIG_CONTENT" > samples/tsconfig.json

# Generate starter usage sample with speakeasy
speakeasy generate usage -s https://ad39-2405-201-3027-2887-d9b-fc28-c7ec-5133.ngrok-free.app/api-json -l typescript -o samples/root.ts
speakeasy generate usage -s https://1573-2405-201-3027-2887-ada2-ca7a-fa63-8ab5.ngrok-free.app/api-json -l typescript -o samples/root.ts
11 changes: 4 additions & 7 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
lockVersion: 2.0.0
id: 87cc6b1a-13e6-4501-a0d7-2da24669a204
id: d92d2248-44a7-4f20-939b-4f5a23e38b07
management:
docChecksum: 216841ffd9a1defdd89e16a73e33178f
docChecksum: 220c1ffbe0b2bf1cd15b2d1575d4672f
docVersion: Beta
speakeasyVersion: 1.363.1
generationVersion: 2.396.0
releaseVersion: 0.5.0
configChecksum: 28bc2c234c5dadf029b3d2fe8a97e020
repoURL: https://github.com/ava-labs/avalanche-sdk-typescript.git
installationURL: https://github.com/ava-labs/avalanche-sdk-typescript
published: true
releaseVersion: 0.1.0
configChecksum: c0c67af710ca750216d343337f758691
features:
typescript:
additionalDependencies: 0.1.0
Expand Down
4 changes: 2 additions & 2 deletions .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ configVersion: 2.0.0
generation:
devContainers:
enabled: true
schemaPath: https://ad39-2405-201-3027-2887-d9b-fc28-c7ec-5133.ngrok-free.app/api-json
schemaPath: https://1573-2405-201-3027-2887-ada2-ca7a-fa63-8ab5.ngrok-free.app/api-json
sdkClassName: AvalancheSdk
maintainOpenAPIOrder: true
usageSnippets:
Expand All @@ -15,7 +15,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: false
typescript:
version: 0.5.0
version: 0.1.0
additionalDependencies:
dependencies: {}
devDependencies: {}
Expand Down
13 changes: 5 additions & 8 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
speakeasyVersion: 1.361.1
speakeasyVersion: 1.354.1
sources:
AvalancheSDK-OAS:
sourceNamespace: avalanche-sdk-oas
sourceRevisionDigest: sha256:df5ede97c87fa9ae15088257f01d3ea7f03a491aa924f3c0476150ad78da77bc
sourceBlobDigest: sha256:19288be87bfa93e83d436d3165f4d3599a0053d7b114aba0b38a35775c43df5f
sourceRevisionDigest: sha256:19c414a56967df33cbf409cce182bde24b3dc711adc130dc5b8c66a0dc340dd0
sourceBlobDigest: sha256:678f76fcf9d681c0c1940d0f09d8d9d77a5d9c44eca1d37c7bf9528bedb70d29
tags:
- latest
targets:
avalanche-sdk:
source: AvalancheSDK-OAS
sourceNamespace: avalanche-sdk-oas
sourceRevisionDigest: sha256:df5ede97c87fa9ae15088257f01d3ea7f03a491aa924f3c0476150ad78da77bc
sourceBlobDigest: sha256:19288be87bfa93e83d436d3165f4d3599a0053d7b114aba0b38a35775c43df5f
sourceRevisionDigest: sha256:19c414a56967df33cbf409cce182bde24b3dc711adc130dc5b8c66a0dc340dd0
sourceBlobDigest: sha256:678f76fcf9d681c0c1940d0f09d8d9d77a5d9c44eca1d37c7bf9528bedb70d29
outLocation: /Users/sayan.kar/avalabs/avalanche-sdk-typescript
workflow:
workflowVersion: 1.0.0
Expand All @@ -27,6 +27,3 @@ workflow:
avalanche-sdk:
target: typescript
source: AvalancheSDK-OAS
publish:
npm:
token: $npm_token
118 changes: 59 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ It has been generated successfully based on your OpenAPI spec. However, it is no
### NPM

```bash
npm add @avalabs/avalanche-sdk
npm add <UNSET>
```

### PNPM

```bash
pnpm add @avalabs/avalanche-sdk
pnpm add <UNSET>
```

### Bun

```bash
bun add @avalabs/avalanche-sdk
bun add <UNSET>
```

### Yarn

```bash
yarn add @avalabs/avalanche-sdk zod
yarn add <UNSET> zod

# Note that Yarn does not install peer dependencies automatically. You will need
# to install zod as shown above.
Expand Down Expand Up @@ -239,6 +239,46 @@ run();
* [getChainInfo](docs/sdks/chains/README.md#getchaininfo) - Get chain information
<!-- End Available Resources and Operations [operations] -->

<!-- Start Global Parameters [global-parameters] -->
## Global Parameters

Certain parameters are configured globally. These parameters may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, These global values will be used as defaults on the operations that use them. When such operations are called, there is a place in each to override the global value, if needed.

For example, you can set `chainId` to `"<value>"` at SDK initialization and then you do not have to pass the same value on calls to operations like `listChains`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.


### Available Globals

The following global parameters are available.

| Name | Type | Required | Description |
| ---- | ---- |:--------:| ----------- |
| chainId | string | | The chainId parameter. |
| network | string | | The network parameter. |


### Example

```typescript
import { AvalancheSDK } from "@avalabs/avalanche-sdk";

const avalancheSDK = new AvalancheSDK();

async function run() {
const result = await avalancheSDK.metrics.evm.chains.listChains({
network: "mainnet",
});

for await (const page of result) {
// handle page
}
}

run();

```
<!-- End Global Parameters [global-parameters] -->

<!-- Start Pagination [pagination] -->
## Pagination

Expand Down Expand Up @@ -480,61 +520,6 @@ const sdk = new AvalancheSDK({ httpClient });
```
<!-- End Custom HTTP Client [http-client] -->

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

To log HTTP 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 { AvalancheSDK } from "@avalabs/avalanche-sdk";

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

<!-- Start Global Parameters [global-parameters] -->
## Global Parameters

Certain parameters are configured globally. These parameters may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, These global values will be used as defaults on the operations that use them. When such operations are called, there is a place in each to override the global value, if needed.

For example, you can set `chainId` to `"<value>"` at SDK initialization and then you do not have to pass the same value on calls to operations like `listChains`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.


### Available Globals

The following global parameters are available.

| Name | Type | Required | Description |
| ---- | ---- |:--------:| ----------- |
| chainId | string | | The chainId parameter. |
| network | string | | The network parameter. |


### Example

```typescript
import { AvalancheSDK } from "@avalabs/avalanche-sdk";

const avalancheSDK = new AvalancheSDK();

async function run() {
const result = await avalancheSDK.metrics.evm.chains.listChains({
network: "mainnet",
});

for await (const page of result) {
// handle page
}
}

run();

```
<!-- End Global Parameters [global-parameters] -->

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

Expand Down Expand Up @@ -645,6 +630,21 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
</details>
<!-- End Standalone functions [standalone-funcs] -->

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

To log HTTP 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 { AvalancheSDK } from "@avalabs/avalanche-sdk";

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

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

# Development
Expand Down
11 changes: 0 additions & 11 deletions RELEASES.md

This file was deleted.

10 changes: 0 additions & 10 deletions core.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion core.d.ts.map

This file was deleted.

17 changes: 0 additions & 17 deletions core.js

This file was deleted.

1 change: 0 additions & 1 deletion core.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "@avalabs/avalanche-sdk",
"version": "0.5.0",
"version": "0.1.0",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{
"name": "@avalabs/avalanche-sdk",
"version": "0.5.0",
"version": "0.1.0",
"author": "Speakeasy",
"main": "./index.js",
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/ava-labs/avalanche-sdk-typescript.git"
},
"scripts": {
"lint": "eslint --max-warnings=0 src",
"build": "tsc",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
export const SDK_METADATA = {
language: "typescript",
openapiDocVersion: "Beta",
sdkVersion: "0.5.0",
sdkVersion: "0.1.0",
genVersion: "2.396.0",
userAgent: "speakeasy-sdk/typescript 0.5.0 2.396.0 Beta @avalabs/avalanche-sdk",
userAgent: "speakeasy-sdk/typescript 0.1.0 2.396.0 Beta @avalabs/avalanche-sdk",
} as const;

0 comments on commit a32e5f1

Please sign in to comment.