Skip to content
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
80 changes: 80 additions & 0 deletions Cargo.lock

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

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ rust-embed = { version = "8", features = ["mime-guess"] }
mime_guess = "2"
async-stream = "0.3"

# OpenAPI / utoipa
utoipa = { version = "5", features = ["axum_extras", "chrono", "uuid"] }
utoipa-axum = "0.2"
utoipa-swagger-ui = { version = "9", features = ["axum"] }

# Indoc for test fixtures
indoc = "2"
arrow-array = "57.3.0"
Expand Down Expand Up @@ -175,6 +180,10 @@ parking_lot = "0.12"
[target.'cfg(target_os = "macos")'.dependencies]
security-framework = "3"

[[bin]]
name = "openapi-spec"
path = "src/bin/openapi_spec.rs"

[profile.release]
lto = "thin"
strip = true
58 changes: 57 additions & 1 deletion interface/bun.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"graphology-layout-forceatlas2": "^0.10.1",
"graphology-types": "^0.24.8",
"ogl": "^1.0.11",
"openapi-fetch": "^0.17",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-hook-form": "^7.71.1",
Expand All @@ -68,6 +69,7 @@
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^4.3.4",
"autoprefixer": "^10.4.18",
"openapi-typescript": "^7",
"postcss": "^8.4.36",
"sass": "^1.72.0",
"tailwindcss": "^3.4.1",
Expand Down
24 changes: 24 additions & 0 deletions interface/src/api/client-typed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import createClient from "openapi-fetch";
Comment thread
jamiepine marked this conversation as resolved.
import type { paths } from "./schema";
Comment thread
jamiepine marked this conversation as resolved.

let baseUrl = "";

export function setServerUrl(url: string) {
baseUrl = url;
}

function getClient() {
return createClient<paths>({
baseUrl: baseUrl ? `${baseUrl}/api` : "/api",
headers: getAuthHeaders(),
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

function getAuthHeaders(): Record<string, string> {
const token = localStorage.getItem("spacebot_auth_token");
return token ? { Authorization: `Bearer ${token}` } : {};
}

// Re-export the typed client for direct use
export { getClient };
export type { paths };
Loading
Loading