Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jstz_node): rename client->jstz-client, add query param to openapi #796

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions crates/jstz_node/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@
"description": "Get KV value under a given key path for an account. If `key` is not provided,\nthe empty key path will be used.",
"operationId": "get_kv_value",
"parameters": [
{
"name": "key",
"in": "query",
"required": false,
"schema": {
"type": [
"string",
"null"
]
}
},
{
"name": "address",
"in": "path",
Expand Down Expand Up @@ -177,6 +188,17 @@
"description": "Get array of KV subkeys under a given key path for an account. If `key` is not provided,\nthe empty key path will be used.",
"operationId": "get_kv_subkeys",
"parameters": [
{
"name": "key",
"in": "query",
"required": false,
"schema": {
"type": [
"string",
"null"
]
}
},
{
"name": "address",
"in": "path",
Expand Down
5 changes: 4 additions & 1 deletion crates/jstz_node/src/services/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use jstz_proto::{
},
};
use serde::Deserialize;
use utoipa::IntoParams;
use utoipa_axum::{router::OpenApiRouter, routes};

use super::{
Expand All @@ -37,7 +38,7 @@ fn construct_accounts_key(address: &str) -> String {
format!("{}/{}", ACCOUNTS_PATH_PREFIX, address)
}

#[derive(Deserialize)]
#[derive(Deserialize, IntoParams)]
struct KvQuery {
key: Option<String>,
}
Expand Down Expand Up @@ -164,6 +165,7 @@ async fn get_balance(
/// the empty key path will be used.
#[utoipa::path(
get,
params(KvQuery),
path = "/{address}/kv",
tag = ACCOUNTS_TAG,
responses(
Expand Down Expand Up @@ -193,6 +195,7 @@ async fn get_kv_value(
/// the empty key path will be used.
#[utoipa::path(
get,
params(KvQuery),
path = "/{address}/kv/subkeys",
tag = ACCOUNTS_TAG,
responses(
Expand Down
2 changes: 1 addition & 1 deletion crates/jstz_node/stainless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ organization:
targets:
node:
readme_title: Jstz Client
package_name: "@jstz-dev/client"
package_name: "@jstz-dev/jstz-client"
production_repo: "jstz-dev/jstz-client"
publish:
npm: false
Expand Down