Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SayanKar committed Aug 29, 2024
0 parents commit c6ab558
Show file tree
Hide file tree
Showing 840 changed files with 65,715 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

<div align="center">
<a href="https://codespaces.new/ava-labs/avacloud-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

The default location for usage snippets is the `samples` directory.

## Running a Usage Sample

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.

```
ts-node root.ts
```

## Generating Additional Usage Samples

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://glacier-api.avax.network/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://glacier-api.avax.network/api-json -l typescript -n {INPUT_TAG_NAME} -o ./samples
```
45 changes: 45 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/images/tree/main/src/typescript-node
{
"name": "TypeScript",
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "sudo chmod +x ./.devcontainer/setup.sh && ./.devcontainer/setup.sh",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.vscode-typescript-tslint-plugin",
"esbenp.prettier-vscode",
"github.vscode-pull-request-github"
],
"settings": {
"files.eol": "\n",
"editor.formatOnSave": true,
"typescript.tsc.autoDetect": "on",
"typescript.updateImportsOnFileMove.enabled": "always",
"typescript.preferences.importModuleSpecifier": "relative",
"[typescript]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"[typescriptreact]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
}
},
"codespaces": {
"openFiles": [
".devcontainer/README.md"
]
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
30 changes: 30 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Install the speakeasy CLI
curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh

# Setup samples directory
rmdir samples || true
mkdir samples

npm install
npm install -g ts-node
npm link
npm link @avalabs/avacloud-sdk
TS_CONFIG_CONTENT=$(cat <<EOL
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"openapi": ["../src/index"],
"openapi/*": ["../src/*"]
}
},
"include": ["./**/*.ts"]
}
EOL
)
echo "$TS_CONFIG_CONTENT" > samples/tsconfig.json

# Generate starter usage sample with speakeasy
speakeasy generate usage -s https://glacier-api.avax.network/api-json -l typescript -o samples/root.ts
28 changes: 28 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-env node */
module.exports = {
root: true,
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
settings: {
"import/resolver": {
typescript: true,
node: true,
},
},
rules: {
// Handled by typescript compiler
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-explicit-any": "off",
"import/no-named-as-default-member": "off",

"import/no-default-export": "error",
},
};
1 change: 1 addition & 0 deletions .genignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jsr.json
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This allows generated code to be indexed correctly
*.ts linguist-generated=false
30 changes: 30 additions & 0 deletions .github/workflows/sdk_generation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Generate
permissions:
checks: write
contents: write
pull-requests: write
statuses: write
"on":
workflow_dispatch:
inputs:
force:
description: Force generation of SDKs
type: boolean
default: false
set_version:
description: optionally set a specific SDK version
type: string
schedule:
- cron: 0 0 * * *
jobs:
generate:
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
with:
force: ${{ github.event.inputs.force }}
mode: pr
set_version: ${{ github.event.inputs.set_version }}
speakeasy_version: latest
secrets:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
npm_token: ${{ secrets.NPM_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
20 changes: 20 additions & 0 deletions .github/workflows/sdk_publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Publish
permissions:
checks: write
contents: write
pull-requests: write
statuses: write
"on":
push:
branches:
- main
paths:
- RELEASES.md
- '*/RELEASES.md'
jobs:
publish:
uses: speakeasy-api/sdk-generation-action/.github/workflows/sdk-publish.yaml@v15
secrets:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
npm_token: ${{ secrets.NPM_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/models
/models/errors
/types
/node_modules
/lib
/sdk
/funcs
/hooks
/index.*
/core.*
/cjs
/esm
/dist
/.tsbuildinfo
/.tshy
/.tshy-*
9 changes: 9 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**/*
!/**/*.ts
!/**/*.js
!/**/*.map

/.eslintrc.js
/cjs
/.tshy
/.tshy-*
Loading

0 comments on commit c6ab558

Please sign in to comment.