Skip to content

Commit

Permalink
fix(mvp): list repos and users
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderBrevig committed Mar 2, 2024
1 parent f8f84b5 commit 0ab50a2
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,42 @@ impl Backend {
self.client
.log_message(MessageType::INFO, format!("search_repo: {}", needle))
.await;
let repos = self
.octocrab
.current()
.list_repos_for_authenticated_user()
.affiliation("organization_member")
.sort("updated")
.per_page(100)
.send()
.await
.map_err(|_| {
tower_lsp::jsonrpc::Error::new(tower_lsp::jsonrpc::ErrorCode::MethodNotFound)
})?;

for repo in repos {
println!("{}", repo.name);
}
Ok(vec![])
}

pub(crate) async fn search_owner(&self, needle: &str) -> Result<Vec<CompletionItem>> {
self.client
.log_message(MessageType::INFO, format!("search_owner: {}", needle))
.await;
let users = octocrab::instance()
.search()
.users(needle)
// .sort("followers")
// .order("desc")
.send()
.await
.map_err(|_| {
tower_lsp::jsonrpc::Error::new(tower_lsp::jsonrpc::ErrorCode::MethodNotFound)
})?;
for user in users {
println!("{}", user.login);
}
Ok(vec![])
}

Expand Down

0 comments on commit 0ab50a2

Please sign in to comment.