Skip to content

Commit 2bd9990

Browse files
committed
Added support for retrieving the data from a data store
1 parent ad6ed81 commit 2bd9990

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

capabilities-services-client/src/main/java/ai/wanaku/capabilities/sdk/services/ServicesHttpClient.java

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import jakarta.ws.rs.core.MediaType;
44

55
import ai.wanaku.api.exceptions.WanakuException;
6+
import ai.wanaku.api.types.DataStore;
67
import ai.wanaku.api.types.ForwardReference;
78
import ai.wanaku.api.types.Namespace;
89
import ai.wanaku.api.types.ResourceReference;
@@ -371,4 +372,69 @@ public void removeForward(ForwardReference forwardReference) {
371372
public WanakuResponse<List<Namespace>> listNamespaces() {
372373
return executeGet("/api/v1/namespaces/list", new TypeReference<WanakuResponse<List<Namespace>>>() {});
373374
}
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+
}
374440
}

0 commit comments

Comments
 (0)