Skip to content

Commit c6ab558

Browse files
committed
Initial commit
0 parents  commit c6ab558

File tree

840 files changed

+65715
-0
lines changed

Some content is hidden

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

840 files changed

+65715
-0
lines changed

.devcontainer/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
<div align="center">
3+
<a href="https://codespaces.new/ava-labs/avacloud-sdk-typescript.git/tree/main"><img src="https://github.com/codespaces/badge.svg" /></a>
4+
</div>
5+
<br>
6+
7+
> **Remember to shutdown a GitHub Codespace when it is not in use!**
8+
9+
# Dev Containers Quick Start
10+
11+
The default location for usage snippets is the `samples` directory.
12+
13+
## Running a Usage Sample
14+
15+
A sample usage example has been provided in a `root.ts` file. As you work with the SDK, it's expected that you will modify these samples to fit your needs. To execute this particular snippet, use the command below.
16+
17+
```
18+
ts-node root.ts
19+
```
20+
21+
## Generating Additional Usage Samples
22+
23+
The speakeasy CLI allows you to generate more usage snippets. Here's how:
24+
25+
- To generate a sample for a specific operation by providing an operation ID, use:
26+
27+
```
28+
speakeasy generate usage -s https://glacier-api.avax.network/api-json -l typescript -i {INPUT_OPERATION_ID} -o ./samples
29+
```
30+
31+
- To generate samples for an entire namespace (like a tag or group name), use:
32+
33+
```
34+
speakeasy generate usage -s https://glacier-api.avax.network/api-json -l typescript -n {INPUT_TAG_NAME} -o ./samples
35+
```

.devcontainer/devcontainer.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/images/tree/main/src/typescript-node
3+
{
4+
"name": "TypeScript",
5+
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
6+
// Features to add to the dev container. More info: https://containers.dev/features.
7+
// "features": {},
8+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
9+
// "forwardPorts": [],
10+
// Use 'postCreateCommand' to run commands after the container is created.
11+
"postCreateCommand": "sudo chmod +x ./.devcontainer/setup.sh && ./.devcontainer/setup.sh",
12+
"customizations": {
13+
"vscode": {
14+
"extensions": [
15+
"ms-vscode.vscode-typescript-tslint-plugin",
16+
"esbenp.prettier-vscode",
17+
"github.vscode-pull-request-github"
18+
],
19+
"settings": {
20+
"files.eol": "\n",
21+
"editor.formatOnSave": true,
22+
"typescript.tsc.autoDetect": "on",
23+
"typescript.updateImportsOnFileMove.enabled": "always",
24+
"typescript.preferences.importModuleSpecifier": "relative",
25+
"[typescript]": {
26+
"editor.codeActionsOnSave": {
27+
"source.organizeImports": true
28+
}
29+
},
30+
"[typescriptreact]": {
31+
"editor.codeActionsOnSave": {
32+
"source.organizeImports": true
33+
}
34+
}
35+
}
36+
},
37+
"codespaces": {
38+
"openFiles": [
39+
".devcontainer/README.md"
40+
]
41+
}
42+
}
43+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
44+
// "remoteUser": "root"
45+
}

.devcontainer/setup.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# Install the speakeasy CLI
4+
curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh
5+
6+
# Setup samples directory
7+
rmdir samples || true
8+
mkdir samples
9+
10+
npm install
11+
npm install -g ts-node
12+
npm link
13+
npm link @avalabs/avacloud-sdk
14+
TS_CONFIG_CONTENT=$(cat <<EOL
15+
{
16+
"compilerOptions": {
17+
"baseUrl": ".",
18+
"paths": {
19+
"openapi": ["../src/index"],
20+
"openapi/*": ["../src/*"]
21+
}
22+
},
23+
"include": ["./**/*.ts"]
24+
}
25+
EOL
26+
)
27+
echo "$TS_CONFIG_CONTENT" > samples/tsconfig.json
28+
29+
# Generate starter usage sample with speakeasy
30+
speakeasy generate usage -s https://glacier-api.avax.network/api-json -l typescript -o samples/root.ts

.eslintrc.cjs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* eslint-env node */
2+
module.exports = {
3+
root: true,
4+
extends: [
5+
"eslint:recommended",
6+
"plugin:@typescript-eslint/recommended",
7+
"plugin:import/recommended",
8+
"plugin:import/typescript",
9+
],
10+
parser: "@typescript-eslint/parser",
11+
plugins: ["@typescript-eslint"],
12+
settings: {
13+
"import/resolver": {
14+
typescript: true,
15+
node: true,
16+
},
17+
},
18+
rules: {
19+
// Handled by typescript compiler
20+
"@typescript-eslint/no-unused-vars": "off",
21+
"@typescript-eslint/ban-types": "off",
22+
"@typescript-eslint/no-namespace": "off",
23+
"@typescript-eslint/no-explicit-any": "off",
24+
"import/no-named-as-default-member": "off",
25+
26+
"import/no-default-export": "error",
27+
},
28+
};

.genignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
jsr.json

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This allows generated code to be indexed correctly
2+
*.ts linguist-generated=false

.github/workflows/sdk_generation.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Generate
2+
permissions:
3+
checks: write
4+
contents: write
5+
pull-requests: write
6+
statuses: write
7+
"on":
8+
workflow_dispatch:
9+
inputs:
10+
force:
11+
description: Force generation of SDKs
12+
type: boolean
13+
default: false
14+
set_version:
15+
description: optionally set a specific SDK version
16+
type: string
17+
schedule:
18+
- cron: 0 0 * * *
19+
jobs:
20+
generate:
21+
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
22+
with:
23+
force: ${{ github.event.inputs.force }}
24+
mode: pr
25+
set_version: ${{ github.event.inputs.set_version }}
26+
speakeasy_version: latest
27+
secrets:
28+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
29+
npm_token: ${{ secrets.NPM_TOKEN }}
30+
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}

.github/workflows/sdk_publish.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Publish
2+
permissions:
3+
checks: write
4+
contents: write
5+
pull-requests: write
6+
statuses: write
7+
"on":
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- RELEASES.md
13+
- '*/RELEASES.md'
14+
jobs:
15+
publish:
16+
uses: speakeasy-api/sdk-generation-action/.github/workflows/sdk-publish.yaml@v15
17+
secrets:
18+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
19+
npm_token: ${{ secrets.NPM_TOKEN }}
20+
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/models
2+
/models/errors
3+
/types
4+
/node_modules
5+
/lib
6+
/sdk
7+
/funcs
8+
/hooks
9+
/index.*
10+
/core.*
11+
/cjs
12+
/esm
13+
/dist
14+
/.tsbuildinfo
15+
/.tshy
16+
/.tshy-*

.npmignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
**/*
2+
!/**/*.ts
3+
!/**/*.js
4+
!/**/*.map
5+
6+
/.eslintrc.js
7+
/cjs
8+
/.tshy
9+
/.tshy-*

0 commit comments

Comments
 (0)