|
3 | 3 | import jakarta.ws.rs.core.MediaType; |
4 | 4 |
|
5 | 5 | import ai.wanaku.api.exceptions.WanakuException; |
| 6 | +import ai.wanaku.api.types.DataStore; |
6 | 7 | import ai.wanaku.api.types.ForwardReference; |
7 | 8 | import ai.wanaku.api.types.Namespace; |
8 | 9 | import ai.wanaku.api.types.ResourceReference; |
@@ -371,4 +372,69 @@ public void removeForward(ForwardReference forwardReference) { |
371 | 372 | public WanakuResponse<List<Namespace>> listNamespaces() { |
372 | 373 | return executeGet("/api/v1/namespaces/list", new TypeReference<WanakuResponse<List<Namespace>>>() {}); |
373 | 374 | } |
| 375 | + |
| 376 | + // ==================== DataStores API Methods ==================== |
| 377 | + |
| 378 | + /** |
| 379 | + * Adds a new data store entry. |
| 380 | + * |
| 381 | + * @param dataStore The {@link DataStore} to add. |
| 382 | + * @return The response containing the added data store. |
| 383 | + * @throws WanakuException If an error occurs during the request. |
| 384 | + */ |
| 385 | + public WanakuResponse<DataStore> addDataStore(DataStore dataStore) { |
| 386 | + return executePost("/api/v1/data-store/add", dataStore, new TypeReference<WanakuResponse<DataStore>>() {}); |
| 387 | + } |
| 388 | + |
| 389 | + /** |
| 390 | + * Lists all data stores. |
| 391 | + * |
| 392 | + * @return The response containing the list of all data stores. |
| 393 | + * @throws WanakuException If an error occurs during the request. |
| 394 | + */ |
| 395 | + public WanakuResponse<List<DataStore>> listDataStores() { |
| 396 | + return executeGet("/api/v1/data-store/list", new TypeReference<WanakuResponse<List<DataStore>>>() {}); |
| 397 | + } |
| 398 | + |
| 399 | + /** |
| 400 | + * Gets a data store by ID. |
| 401 | + * |
| 402 | + * @param id The ID of the data store to retrieve. |
| 403 | + * @return The response containing the data store. |
| 404 | + * @throws WanakuException If an error occurs during the request. |
| 405 | + */ |
| 406 | + public WanakuResponse<DataStore> getDataStoreById(String id) { |
| 407 | + return executeGet("/api/v1/data-store/get?id=" + id, new TypeReference<WanakuResponse<DataStore>>() {}); |
| 408 | + } |
| 409 | + |
| 410 | + /** |
| 411 | + * Gets data stores by name. |
| 412 | + * |
| 413 | + * @param name The name of the data stores to retrieve. |
| 414 | + * @return The response containing the list of data stores. |
| 415 | + * @throws WanakuException If an error occurs during the request. |
| 416 | + */ |
| 417 | + public WanakuResponse<List<DataStore>> getDataStoresByName(String name) { |
| 418 | + return executeGet("/api/v1/data-store/get?name=" + name, new TypeReference<WanakuResponse<List<DataStore>>>() {}); |
| 419 | + } |
| 420 | + |
| 421 | + /** |
| 422 | + * Removes a data store by ID. |
| 423 | + * |
| 424 | + * @param id The ID of the data store to remove. |
| 425 | + * @throws WanakuException If an error occurs during the request. |
| 426 | + */ |
| 427 | + public void removeDataStore(String id) { |
| 428 | + executeDelete("/api/v1/data-store/remove?id=" + id); |
| 429 | + } |
| 430 | + |
| 431 | + /** |
| 432 | + * Removes data stores by name. |
| 433 | + * |
| 434 | + * @param name The name of the data stores to remove. |
| 435 | + * @throws WanakuException If an error occurs during the request. |
| 436 | + */ |
| 437 | + public void removeDataStoresByName(String name) { |
| 438 | + executeDelete("/api/v1/data-store/remove?name=" + name); |
| 439 | + } |
374 | 440 | } |
0 commit comments