summaryrefslogtreecommitdiff
path: root/makima/src/daemon/api/contract.rs
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/daemon/api/contract.rs')
-rw-r--r--makima/src/daemon/api/contract.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/makima/src/daemon/api/contract.rs b/makima/src/daemon/api/contract.rs
index 955fe41..50fd64f 100644
--- a/makima/src/daemon/api/contract.rs
+++ b/makima/src/daemon/api/contract.rs
@@ -224,4 +224,27 @@ impl ApiClient {
self.get(&format!("/api/v1/mesh/tasks/{}/output", task_id))
.await
}
+
+ /// Get repository suggestions for autocomplete.
+ /// Returns recently used repositories sorted by usage frequency and recency.
+ pub async fn get_repository_suggestions(
+ &self,
+ source_type: Option<&str>,
+ limit: Option<i32>,
+ ) -> Result<JsonValue, ApiError> {
+ let mut params = Vec::new();
+ if let Some(st) = source_type {
+ params.push(format!("source_type={}", st));
+ }
+ if let Some(l) = limit {
+ params.push(format!("limit={}", l));
+ }
+ let query_string = if params.is_empty() {
+ String::new()
+ } else {
+ format!("?{}", params.join("&"))
+ };
+ self.get(&format!("/api/v1/settings/repository-history/suggestions{}", query_string))
+ .await
+ }
}