* New top-level groups, each with full CRUD where the API supports it: - release: list/view/create/edit/delete/upload/download - label: list/create/edit/delete - run: workflow runs (list/view/rerun/cancel) - secret + variable: Actions secrets/vars (list/set/delete) - search: cross-cutting (repos/issues/prs/users) - browse: open repo/path on the web - status: notifications inbox + mark-all-read - org: list/view/teams - ssh-key, gpg-key: list/add/delete on your account - alias: user-defined shortcuts (e.g. `fj alias set co "pr checkout"`) - config: local prefs (editor, pager, browser, etc.) - extension: discover and run `fj-<name>` plugin binaries on PATH - gist: thin wrapper over `gist-*` repos * main.rs now expands aliases before clap and dispatches to plugins for unknown subcommands (matching gh). * New API modules: release, label, notification, search, org, workflow, with the corresponding strongly-typed wrappers. * Release asset upload uses reqwest multipart (feature flag added). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
45 lines
1.1 KiB
Rust
45 lines
1.1 KiB
Rust
use anyhow::Result;
|
|
use reqwest::Method;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::client::Client;
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Organization {
|
|
pub id: u64,
|
|
pub username: String,
|
|
#[serde(default)]
|
|
pub full_name: String,
|
|
#[serde(default)]
|
|
pub description: String,
|
|
#[serde(default)]
|
|
pub visibility: String,
|
|
pub avatar_url: String,
|
|
}
|
|
|
|
pub async fn list_for_user(client: &Client) -> Result<Vec<Organization>> {
|
|
client
|
|
.json(Method::GET, "/api/v1/user/orgs", &[], None::<&()>)
|
|
.await
|
|
}
|
|
|
|
pub async fn get(client: &Client, org: &str) -> Result<Organization> {
|
|
let path = format!("/api/v1/orgs/{org}");
|
|
client.json(Method::GET, &path, &[], None::<&()>).await
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Team {
|
|
pub id: u64,
|
|
pub name: String,
|
|
#[serde(default)]
|
|
pub description: String,
|
|
#[serde(default)]
|
|
pub permission: String,
|
|
}
|
|
|
|
pub async fn list_teams(client: &Client, org: &str) -> Result<Vec<Team>> {
|
|
let path = format!("/api/v1/orgs/{org}/teams");
|
|
client.json(Method::GET, &path, &[], None::<&()>).await
|
|
}
|