diff --git a/.github/workflows/generate-node-client.yml b/.github/workflows/generate-node-client.yml new file mode 100644 index 000000000..0bfaba7d7 --- /dev/null +++ b/.github/workflows/generate-node-client.yml @@ -0,0 +1,19 @@ +name: Upload OpenAPI spec to Stainless + +on: + pull_request: # testing only + push: + branches: [main] + +jobs: + stainless: + concurrency: upload-openapi-spec-action + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: stainless-api/upload-openapi-spec-action@main + with: + stainless_api_key: ${{ secrets.STAINLESS_API_KEY }} + input_path: "crates/jstz_node/openapi.json" + config_path: "crates/jstz_node/stainless.yml" + project_name: "jstz-client" diff --git a/crates/jstz_node/stainless.yml b/crates/jstz_node/stainless.yml new file mode 100644 index 000000000..736d8fa6f --- /dev/null +++ b/crates/jstz_node/stainless.yml @@ -0,0 +1,119 @@ +# yaml-language-server: $schema=https://app.stainlessapi.com/config.schema.json + +organization: + # Name of your organization or company, used to determine the name of the client + # and headings. + name: Trilitech + docs: https://docs.jstz.com + contact: contact@trili.tech + +# `targets` define the output targets and their customization options, such as +# whether to emit the Node SDK and what it's package name should be. +targets: + node: + package_name: jstz-client + production_repo: null + publish: + npm: false + +# `client_settings` define settings for the API client, such as extra constructor +# arguments (used for authentication), retry behavior, idempotency, etc. +client_settings: + opts: {} + +# `environments` are a map of the name of the environment (e.g. "sandbox", +# "production") to the corresponding url to use. +environments: + production: https://localhost:8933 + +# `pagination` defines [pagination schemes] which provides a template to match +# endpoints and generate next-page and auto-pagination helpers in the SDKs. +pagination: [] + +# `resources` define the structure and organziation for your API, such as how +# methods and models are grouped together and accessed. See the [configuration +# guide] for more information. +# +# [configuration guide]: +# https://app.stainlessapi.com/docs/guides/configure#resources +resources: + accounts: + # Subresources define resources that are nested within another for more powerful + # logical groupings, e.g. `cards.payments`. + subresources: + balance: + # Configure the methods defined in this resource. Each key in the object is the + # name of the method and the value is either an endpoint (for example, `get /foo`) + # or an object with more detail. + # + # [reference]: https://app.stainlessapi.com/docs/reference/config#method + methods: + retrieve: get /accounts/{address}/balance + code: + # Configure the models--named types--defined in the resource. Each key in the + # object is the name of the model and the value is either the name of a schema in + # `#/components/schemas` or an object with more detail. + # + # [reference]: https://app.stainlessapi.com/docs/reference/config#model + models: + parsedCode: ParsedCode + methods: + retrieve: get /accounts/{address}/code + kv: + models: + kvValue: KvValue + methods: + retrieve: get /accounts/{address}/kv + subresources: + subkeys: + methods: + list: get /accounts/{address}/kv/subkeys + nonce: + models: + nonce: Nonce + methods: + retrieve: get /accounts/{address}/nonce + + logs: + models: + logRecord: LogRecord + methods: + stream: get /logs/{address}/stream + subresources: + persistent_requests: + methods: + list: get /logs/{address}/persistent/requests + retrieve: get /logs/{address}/persistent/requests/{request_id} + + operations: + methods: + create: post /operations + subresources: + receipt: + models: + receipt: Receipt + methods: + retrieve: get /operations/{operation_hash}/receipt + +settings: + license: Apache-2.0 + +# `readme` is used to configure the code snippets that will be rendered in the +# README.md of various SDKs. In particular, you can change the `headline` +# snippet's endpoint and the arguments to call it with. +readme: + example_requests: + default: + type: request + endpoint: get /accounts/{address}/code + params: &ref_0 + address: REPLACE_ME + headline: + type: request + endpoint: get /accounts/{address}/code + params: *ref_0 + pagination: + type: request + endpoint: get /accounts/{address}/kv/subkeys + params: + address: REPLACE_ME