Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gloomweaver committed Jun 18, 2024
1 parent c6ee2b7 commit 7f372b6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# Dotnet Spice SDK

Dotnet SDK for Spice.ai

## Installation

Add Spice SDK

[//]: # (update when published to nuget)
```bash
```
Dotnet SDK for Spice.ai.
- Supports .NET Standard 2.0 and .NET 6.0.
- Asynchronous I/O.

## Usage

Expand All @@ -30,7 +24,8 @@ var client = new SpiceClientBuilder().Build();
using Spice;

var client = new SpiceClientBuilder()
.WithSpiceCloud("API_KEY")
.WithApiKey("API_KEY")
.WithSpiceCloud()
.Build();
```

Expand All @@ -42,7 +37,8 @@ SQL Query
using Spice;

var client = new SpiceClientBuilder()
.WithSpiceCloud("API_KEY")
.WithApiKey("API_KEY")
.WithSpiceCloud()
.Build();

var data = await client.Query("SELECT * FROM eth.recent_blocks LIMIT 10;");
Expand Down
13 changes: 11 additions & 2 deletions Spice/src/SpiceClientBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public SpiceClientBuilder WithFlightAddress(string flightAddress)
}

/// <summary>
/// Sets the client's apiKey token and default paths flight path to Spice Cloud.
/// Sets the client's Api Key.
/// </summary>
/// <param name="apiKey">The Spice Cloud api key</param>
/// <returns>The current instance of <see cref="SpiceClientBuilder"/> for method chaining.</returns>
/// <exception cref="System.ArgumentException">Thrown when the apiKey is in wrong format.</exception>
public SpiceClientBuilder WithSpiceCloud(string apiKey)
public SpiceClientBuilder WithApiKey(string apiKey)
{
var parts = apiKey.Split('|');
if (parts.Length != 2)
Expand All @@ -55,7 +55,16 @@ public SpiceClientBuilder WithSpiceCloud(string apiKey)

_spiceClient.AppId = parts[0];
_spiceClient.ApiKey = apiKey;

return this;
}

/// <summary>
/// Sets the client's flight address to default Spice Cloud address.
/// </summary>
/// <returns>The current instance of <see cref="SpiceClientBuilder"/> for method chaining.</returns>
public SpiceClientBuilder WithSpiceCloud()
{
_spiceClient.FlightAddress = SpiceDefaultConfigCloud.FlightAddress;
return this;
}
Expand Down
3 changes: 2 additions & 1 deletion SpiceTest/FlightQueryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public void Setup()
throw new Exception("No API_KEY provided");
}
_spiceClient = new SpiceClientBuilder()
.WithSpiceCloud(ApiKey)
.WithApiKey(ApiKey)
.WithSpiceCloud()
.Build();
}

Expand Down

0 comments on commit 7f372b6

Please sign in to comment.