Skip to content

Commit

Permalink
spice_rs -> spiceai
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekim committed Mar 21, 2024
1 parent 042ab05 commit 36be913
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,26 @@ spice-rs = { git = "https://github.com/spiceai/spice-rs", tag = "v1.0.2" }
```

## Usage

<!-- NOTE: If you're changing the code examples below, make sure you update `tests/readme_test.rs`. -->

### New client

```rust
use spice_rs::Client;
use spiceai::Client;

#[tokio::main]
async fn main() {
let mut client = Client::new("API_KEY").await.unwrap();
}
```

### Arrow Query

SQL Query

```rust
use spice_rs::Client;
use spiceai::Client;

#[tokio::main]
async fn main() {
Expand All @@ -35,11 +40,13 @@ async fn main() {
}

```

### Firecache Query

Firecache SQL Query

```rust
use spice_rs::Client;
use spiceai::Client;

#[tokio::main]
async fn main() {
Expand All @@ -48,13 +55,15 @@ async fn main() {
}

```

### HTTP API

#### Prices

Get the supported pairs:

```rust
use spice_rs::Client;
use spiceai::Client;

#[tokio::main]
async fn main() {
Expand All @@ -66,7 +75,7 @@ async fn main() {
Get the latest price for a token pair:

```rust
use spice_rs::Client;
use spiceai::Client;

#[tokio::main]
async fn main() {
Expand All @@ -78,7 +87,7 @@ async fn main() {
Get historical data:

```rust
use spice_rs::Client;
use spiceai::Client;
use chrono::Utc;
use chrono::Duration;
use std::ops::Sub;
Expand All @@ -96,4 +105,5 @@ async fn main() {
```

## Documentation

Check out our [Documentation](https://docs.spice.ai/sdks/rust-sdk) to learn more about how to use the Rust SDK.
12 changes: 6 additions & 6 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub struct SpiceClient {
impl SpiceClient {
/// Creates a new SpiceClient with the given API key.
/// ```
/// use spice_rs::Client;
/// use spiceai::Client;
///
/// #[tokio::main]
/// async fn main() {
Expand All @@ -71,7 +71,7 @@ impl SpiceClient {

/// Queries the Spice Flight endpoint with the given SQL query.
/// ```
/// # use spice_rs::Client;
/// # use spiceai::Client;
/// #
/// # #[tokio::main]
/// # async fn main() {
Expand All @@ -85,7 +85,7 @@ impl SpiceClient {

/// Queries the Spice Firecache endpoint with the given SQL query.
/// ```
/// # use spice_rs::Client;
/// # use spiceai::Client;
/// #
/// # #[tokio::main]
/// # async fn main() {
Expand All @@ -102,7 +102,7 @@ impl SpiceClient {

/// Get the supported pairs:
/// ```rust
/// # use spice_rs::Client;
/// # use spiceai::Client;
/// #
/// # #[tokio::main]
/// # async fn main() {
Expand All @@ -116,7 +116,7 @@ impl SpiceClient {

/// Get the latest price for a token pair:
/// ```rust
/// # use spice_rs::Client;
/// # use spiceai::Client;
/// #
/// # #[tokio::main]
/// # async fn main() {
Expand All @@ -130,7 +130,7 @@ impl SpiceClient {

/// Get historical data:
/// ```rust
/// # use spice_rs::Client;
/// # use spiceai::Client;
/// # use chrono::Utc;
/// # use chrono::Duration;
/// # use std::ops::Sub;
Expand Down
2 changes: 1 addition & 1 deletion tests/client_test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(test)]
mod tests {
use futures::stream::StreamExt;
use spice_rs::Client;
use spiceai::Client;
use std::env;
use std::path::Path;

Expand Down
2 changes: 1 addition & 1 deletion tests/price_test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(test)]
mod tests {
use chrono::{TimeZone, Utc};
use spice_rs::Client;
use spiceai::Client;
use std::env;
use std::path::Path;

Expand Down
2 changes: 1 addition & 1 deletion tests/readme_test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(test)]
mod tests {
use chrono::{Duration, Utc};
use spice_rs::*;
use spiceai::*;
use std::env;
use std::ops::Sub;
use std::path::Path;
Expand Down

0 comments on commit 36be913

Please sign in to comment.