Skip to content
Open
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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0"
".": "0.2.0"
}
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Changelog

## [0.2.0](https://github.com/scalar/scalar-rust/compare/v0.1.0...v0.2.0) (2026-07-17)


### ⚠ BREAKING CHANGES

* **api:** 37 breaking changes to the SDK surface.
- Renamed SDK from `ScalarGalaxy` to `ScalarApi`.
- Removed server `https://galaxy.scalar.com`.
- Removed server `{protocol}://void.scalar.com/{path}`.
- URL of environment `production` changed from `https://galaxy.scalar.com` to `https://access.scalar.com`.
- Removed environment `responds_with_your_request_data`.
- Removed `bearer` auth scheme `bearerAuth`.
- Removed `basic` auth scheme `basicAuth`.
- Removed `apiKey` auth scheme `apiKeyHeader`.
- Removed `apiKey` auth scheme `apiKeyQuery`.
- Removed `apiKey` auth scheme `apiKeyCookie`.
- Removed `oauth2` auth scheme `oAuth2`.
- Removed `oauth2` auth scheme `openIdConnect`.
- Removed operation `planets.listAllData` (`GET /planets`).
- Removed operation `planets.create` (`POST /planets`).
- Removed operation `planets.retrieve` (`GET /planets/{planetId}`).
- Removed operation `planets.update` (`PUT /planets/{planetId}`).
- Removed operation `planets.delete` (`DELETE /planets/{planetId}`).
- Removed operation `planets.uploadImage` (`POST /planets/{planetId}/image`).
- Removed operation `authentication.createUser` (`POST /user/signup`).
- Removed operation `authentication.createToken` (`POST /auth/token`).
- Removed operation `authentication.listMe` (`GET /me`).
- Added required property `User.uid`.
- Added required property `User.createdAt`.
- Added required property `User.updatedAt`.
- Added required property `User.email`.
- Added required property `User.activeTeamId`.
- Added required property `User.hasGithub`.
- Added required property `User.teams`.
- Removed optional property `User.id`.
- Removed optional property `User.name`.
- Removed schema `Credentials`.
- Removed schema `Token`.
- Removed schema `Planet`.
- Removed schema `PaginatedResource`.
- Removed schema `Satellite`.
- Removed webhook `NewPlanet` (`newPlanet`).
- Removed webhook `RequestBodyCallbackUrl` (`{$request.body#/callbackUrl}`).

### Features

* **api:** initial SDK generation ([ffade80](https://github.com/scalar/scalar-rust/commit/ffade8030ce6b907245816d7cfc7b144ddd2a92d))
* **api:** update SDK name (+117 more changes) ([c4fcf91](https://github.com/scalar/scalar-rust/commit/c4fcf91636ce0a996dd806a7ac7ab03d9a617b4e))


### Chores

* **api:** update generated SDK content ([5c6ae97](https://github.com/scalar/scalar-rust/commit/5c6ae97bbb949e1bffdc5a2e915c9053bead39c7))
9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
[package]
name = "scalargalaxy-rust"
version = "0.1.0" # x-release-please-version
name = "scalar-api"
version = "0.2.0" # x-release-please-version
edition = "2024"
rust-version = "1.85"
description = "The Scalar Galaxy is an example OpenAPI specification to test OpenAPI tools and libraries. It’s a fictional universe with fictional planets and fictional data. Get all the data for [all planets](#tag/planets/GET/planets)."
description = "API for managing Scalar platform resources."
license = "Apache-2.0"

[dependencies]
reqwest = { version = "0.12", default-features = false, features = ["json", "stream", "rustls-tls", "multipart"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "stream", "rustls-tls"] }
serde = { version = "1.0.181", features = ["derive"] }
serde_json = "1"
thiserror = "2"
futures = "0.3"
bytes = "1"
url = "2"
tokio = { version = "1", features = ["time"] }
chrono = { version = "0.4", features = ["serde"] }

[dev-dependencies]
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
Expand Down
109 changes: 59 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,78 @@
# Scalar Galaxy
# Scalar API

The Scalar Galaxy is an example OpenAPI specification to test OpenAPI tools and libraries. It’s a fictional universe with fictional planets and fictional data. Get all the data for [all planets](#tag/planets/GET/planets).
API for managing Scalar platform resources.

## Resources
## TypeScript SDK

* https://github.com/scalar/scalar
* https://github.com/OAI/OpenAPI-Specification
* https://scalar.com
For TypeScript, we provide a SDK that makes using our API even easier.

## Markdown Support
### Install

All descriptions *can* contain ~~tons of text~~ **Markdown**. [If GitHub supports the syntax](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax), chances are we’re supporting it, too. You can even create [internal links to reference endpoints](#tag/authentication/POST/user/signup).
```bash
npm add @scalar/sdk
```

### Get a Scalar API key

Create an API key in your Scalar account:

<details>
<summary>Examples</summary>
- Dashboard: https://dashboard.scalar.com/account
- Store it in `.env`, for example:

**Blockquotes**
```bash
SCALAR_API_KEY=your_personal_token
```

### Exchange your API key for an access token

> I love OpenAPI. <3
The personal token is not an access token. Exchange it first with `postv1AuthExchange`.

**Tables**
If you use the personal token directly for authenticated API calls, the API returns `401 Invalid authentication token`.

| Feature | Availability |
| ---------------- | ------------ |
| Markdown Support | ✓ |
```ts
import { Scalar } from '@scalar/sdk'

**Accordion**
const scalar = new Scalar()

```html
<details>
<summary>Using Details Tags</summary>
<p>HTML Example</p>
</details>
```
const exchange = await scalar.auth.postv1AuthExchange({
personalToken: process.env.SCALAR_API_KEY!,
})

**Images**
const accessToken = exchange.accessToken
```

Yes, there’s support for images, too!
### Use the access token

![Empty placeholder image showing the width/height](https://images.placeholders.dev/?width=1280&height=720)
Construct a second client with bearer auth. Use this authenticated client for API calls.

```ts
import { Scalar } from '@scalar/sdk'

const scalar = new Scalar()

const exchange = await scalar.auth.postv1AuthExchange({
personalToken: process.env.SCALAR_API_KEY!,
})

const authedScalar = new Scalar({
bearerAuth: exchange.accessToken,
})
```

**Alerts**
### Notes

> [!tip]
> You can now use markdown alerts in your descriptions.
- The exchange request itself can be made from a client constructed with no arguments (`new Scalar()`).
- The exchanged access token is valid for 12 hours.
- Timestamps are Unix seconds.

</details>
### Read more

- [@scalar/sdk on npm](https://www.npmjs.com/package/@scalar/sdk)

## Installation

```sh
cargo add scalargalaxy-rust
cargo add scalar-api
cargo add tokio --features full
```

Expand All @@ -61,21 +82,15 @@ The client is asynchronous and built on `tokio` + `reqwest`. Construct it
with the builder, or read credentials from the environment:

```rust,no_run
use scalargalaxy_rust::ScalarGalaxyClient;
use scalar_api::Scalar;

async fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = ScalarGalaxyClient::builder()
let client = Scalar::builder()
.bearer_token("…")
.username("…")
.password("…")
.api_key_header("…")
.api_key_query("…")
.api_key_cookie("…")
.access_token("…")
.build()?;

// Or, reading credentials from the environment:
let client = ScalarGalaxyClient::from_env()?;
let client = Scalar::from_env()?;
let _ = client;
Ok(())
}
Expand All @@ -85,30 +100,24 @@ Every operation returns a request builder; set optional parameters fluently
and finish with `.send().await`:

```rust,ignore
let response = client.planets().list_all_data().send().await?;
let response = client.registry().list_all_api_documents().send().await?;
```

## Authentication

Credentials can be set on the builder or read from the environment by
`from_env`:

- `bearer_token` — environment variable `HARNESS_BEARER_TOKEN`
- `username` — environment variable `HARNESS_USERNAME`
- `password` — environment variable `HARNESS_PASSWORD`
- `api_key_header` — environment variable `HARNESS_API_KEY_HEADER`
- `api_key_query` — environment variable `HARNESS_API_KEY_QUERY`
- `api_key_cookie` — environment variable `HARNESS_API_KEY_COOKIE`
- `access_token` — environment variable `HARNESS_ACCESS_TOKEN`
- `bearer_token` — environment variable `SCALAR_API_BEARER_TOKEN`

## Error handling

Fallible operations return [`scalargalaxy_rust::Error`]. Match on the
Fallible operations return [`scalar_api::Error`]. Match on the
result of `send().await` to distinguish API errors (with status and decoded
body) from transport and decoding failures:

```rust,ignore
use scalargalaxy_rust::Error;
use scalar_api::Error;

match result {
Ok(value) => { /* … */ }
Expand Down
Loading
Loading