-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement GetOrCreateCollection. (#17)
- Loading branch information
1 parent
2730ca3
commit f23dabc
Showing
8 changed files
with
78 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 3 additions & 9 deletions
12
ChromaDB.Client/Models/Requests/DBCreateCollectionRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,6 @@ | ||
using System.Text.Json.Serialization; | ||
namespace ChromaDB.Client.Models.Requests; | ||
|
||
namespace ChromaDB.Client.Models.Requests; | ||
|
||
public class DBCreateCollectionRequest | ||
public class DBCreateCollectionRequest : DBGetOrCreateCollectionRequestBase | ||
{ | ||
[JsonPropertyName("name")] | ||
public required string Name { get; init; } | ||
|
||
[JsonPropertyName("metadata")] | ||
public IDictionary<string, object>? Metadata { get; init; } | ||
protected override bool GetOrCreate { get; } = false; | ||
} |
6 changes: 6 additions & 0 deletions
6
ChromaDB.Client/Models/Requests/DBGetOrCreateCollectionRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace ChromaDB.Client.Models.Requests; | ||
|
||
public class DBGetOrCreateCollectionRequest : DBGetOrCreateCollectionRequestBase | ||
{ | ||
protected override bool GetOrCreate { get; } = true; | ||
} |
16 changes: 16 additions & 0 deletions
16
ChromaDB.Client/Models/Requests/DBGetOrCreateCollectionRequestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace ChromaDB.Client.Models.Requests; | ||
|
||
public abstract class DBGetOrCreateCollectionRequestBase | ||
{ | ||
[JsonPropertyName("name")] | ||
public required string Name { get; init; } | ||
|
||
[JsonPropertyName("metadata")] | ||
public IDictionary<string, object>? Metadata { get; init; } | ||
|
||
[JsonInclude] | ||
[JsonPropertyName("get_or_create")] | ||
protected abstract bool GetOrCreate { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters