/*
* Hanzo Cloud API
*
* The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
*
* The version of the OpenAPI document: v1
*
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
/// struct for typed errors of method [`delete_todo_projects_by_key`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteTodoProjectsByKeyError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_todo_board`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTodoBoardError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_todo_issues`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTodoIssuesError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_todo_projects`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTodoProjectsError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_todo_projects_by_key`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTodoProjectsByKeyError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_todo_projects_by_key_issues`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTodoProjectsByKeyIssuesError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_todo_projects_by_key_issues_by_num`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTodoProjectsByKeyIssuesByNumError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_todo_rooms_by_room`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTodoRoomsByRoomError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`patch_todo_projects_by_key`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PatchTodoProjectsByKeyError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`patch_todo_projects_by_key_issues_by_num`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PatchTodoProjectsByKeyIssuesByNumError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`post_todo_projects`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostTodoProjectsError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`post_todo_projects_by_key_issues`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostTodoProjectsByKeyIssuesError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`post_todo_projects_by_key_issues_by_num_claim`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostTodoProjectsByKeyIssuesByNumClaimError {
UnknownValue(serde_json::Value),
}
/// Answers 405. A todo board IS a repository on this deployment's forge, so creating, renaming and deleting one is a FORGE operation carried out with FORGE permissions. Offering it here would put a second endpoint on the same object, guarded by this surface instead of by the forge — a weaker guard on the same thing. So the route exists and refuses, rather than 404ing: \"not this service's job\" and \"no such thing\" are different facts, and the body names the forge so a caller knows where the job IS done. What this surface DOES own is the work on a board: list the boards you can see, read and file their issues, move a card between columns, and read the schedule a milestone is. Those are the routes beside this one.
pub async fn delete_todo_projects_by_key(configuration: &configuration::Configuration, key: &str) -> Result<(), Error<DeleteTodoProjectsByKeyError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_key = key;
let uri_str = format!("{}/v1/todo/projects/{key}", configuration.base_path, key=crate::apis::urlencode(p_key));
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<DeleteTodoProjectsByKeyError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns a board's issues — work items with their column, priority, assignee, labels and schedule. WHICH board is a filter, not an address. Bound to a repository (the key from the path) it is that project's board; left unbound it is the org's whole board; narrowed by label it is a board smaller than any repository — which is the only way an app that lives as a directory inside a shared repository can have one. Every combination is the same rows through the same projection, so no two boards can disagree about what a column means. The column is a LABEL on the forge, so the board and the forge web UI are the same object seen twice: relabelling in either moves the card in both. A closed issue reads as done whatever its labels say.
pub async fn get_todo_board(configuration: &configuration::Configuration, key: Option<&str>, status: Option<&str>, kind: Option<&str>, repo: Option<&str>, label: Option<&str>, source: Option<&str>, scheduled: Option<bool>) -> Result<Vec<models::IssueView>, Error<GetTodoBoardError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_key = key;
let p_status = status;
let p_kind = kind;
let p_repo = repo;
let p_label = label;
let p_source = source;
let p_scheduled = scheduled;
let uri_str = format!("{}/v1/todo/board", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_key {
req_builder = req_builder.query(&[("key", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_status {
req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_kind {
req_builder = req_builder.query(&[("kind", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_repo {
req_builder = req_builder.query(&[("repo", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_label {
req_builder = req_builder.query(&[("label", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_source {
req_builder = req_builder.query(&[("source", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_scheduled {
req_builder = req_builder.query(&[("scheduled", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::IssueView>`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::IssueView>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetTodoBoardError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Answers across every project in the org. The org comes from the validated principal and never from the request: a caller able to name the org could read another tenant's backlog, and a search is exactly the shape that would quietly return it.
pub async fn get_todo_issues(configuration: &configuration::Configuration, q: Option<&str>, project: Option<&str>, status: Option<&str>, kind: Option<&str>, repo: Option<&str>, room: Option<&str>, source: Option<&str>, assignee: Option<&str>, limit: Option<i32>) -> Result<models::IssueHits, Error<GetTodoIssuesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_q = q;
let p_project = project;
let p_status = status;
let p_kind = kind;
let p_repo = repo;
let p_room = room;
let p_source = source;
let p_assignee = assignee;
let p_limit = limit;
let uri_str = format!("{}/v1/todo/issues", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_q {
req_builder = req_builder.query(&[("q", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_project {
req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_status {
req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_kind {
req_builder = req_builder.query(&[("kind", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_repo {
req_builder = req_builder.query(&[("repo", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_room {
req_builder = req_builder.query(&[("room", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_source {
req_builder = req_builder.query(&[("source", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_assignee {
req_builder = req_builder.query(&[("assignee", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssueHits`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IssueHits`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetTodoIssuesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns the boards of your org — the places your work actually is. The key addresses the board's issues. A BOARD IS A PLACE WORK IS, not an object somebody provisioned. So the list is assembled from the work itself: the repositories your org has filed issues on, plus the boards the index holds. A repository with nothing on it is not in the list and is still perfectly addressable — GET /projects/<name> reads it and a create files into it — so nothing is lost by leaving it out. Measured, which is why: reading the forge's whole repository inventory put 745 boards here, of which all but a handful were vendored forks and mirrors (.github, .profile, DOMPurify, BoatAttack) that will never carry this org's work. A list that long is not a list — the estate's real roadmap was in it somewhere and no one could see it. The forge half is the FORGE's answer for your own account, so two people in one org can legitimately see different boards.
pub async fn get_todo_projects(configuration: &configuration::Configuration, ) -> Result<Vec<models::TodoProject>, Error<GetTodoProjectsError>> {
let uri_str = format!("{}/v1/todo/projects", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TodoProject>`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::TodoProject>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetTodoProjectsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns one board of your org by its key — the repository name. 404 when your org has no repository under that key, or when your own forge account cannot see it.
pub async fn get_todo_projects_by_key(configuration: &configuration::Configuration, key: &str) -> Result<models::TodoProject, Error<GetTodoProjectsByKeyError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_key = key;
let uri_str = format!("{}/v1/todo/projects/{key}", configuration.base_path, key=crate::apis::urlencode(p_key));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TodoProject`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TodoProject`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetTodoProjectsByKeyError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns a board's issues — work items with their column, priority, assignee, labels and schedule. WHICH board is a filter, not an address. Bound to a repository (the key from the path) it is that project's board; left unbound it is the org's whole board; narrowed by label it is a board smaller than any repository — which is the only way an app that lives as a directory inside a shared repository can have one. Every combination is the same rows through the same projection, so no two boards can disagree about what a column means. The column is a LABEL on the forge, so the board and the forge web UI are the same object seen twice: relabelling in either moves the card in both. A closed issue reads as done whatever its labels say.
pub async fn get_todo_projects_by_key_issues(configuration: &configuration::Configuration, key: &str, status: Option<&str>, kind: Option<&str>, repo: Option<&str>, label: Option<&str>, source: Option<&str>, scheduled: Option<bool>) -> Result<Vec<models::IssueView>, Error<GetTodoProjectsByKeyIssuesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_key = key;
let p_status = status;
let p_kind = kind;
let p_repo = repo;
let p_label = label;
let p_source = source;
let p_scheduled = scheduled;
let uri_str = format!("{}/v1/todo/projects/{key}/issues", configuration.base_path, key=crate::apis::urlencode(p_key));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_status {
req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_kind {
req_builder = req_builder.query(&[("kind", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_repo {
req_builder = req_builder.query(&[("repo", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_label {
req_builder = req_builder.query(&[("label", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_source {
req_builder = req_builder.query(&[("source", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_scheduled {
req_builder = req_builder.query(&[("scheduled", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::IssueView>`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::IssueView>`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetTodoProjectsByKeyIssuesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns ONE work item in full — its description included. The list reads answer a board, and a board is a summary: the description is where the actual content of a work item lives — what an issue asks for, what an epic's acceptance criteria are — and no read on this surface returned it. The address is the one PATCH already accepts, so an item you can move is now an item you can read. It reads the forge directly rather than filtering the org fan-out, then falls back to the index for a board the forge has never heard of — the same order, and the same reason, as GetProject: a row is one kind of thing however it came to exist, so a caller does not have to know which store it is in to fetch it.
pub async fn get_todo_projects_by_key_issues_by_num(configuration: &configuration::Configuration, key: &str, num: i32) -> Result<models::IssueView, Error<GetTodoProjectsByKeyIssuesByNumError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_key = key;
let p_num = num;
let uri_str = format!("{}/v1/todo/projects/{key}/issues/{num}", configuration.base_path, key=crate::apis::urlencode(p_key), num=p_num);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssueView`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IssueView`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetTodoProjectsByKeyIssuesByNumError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Summarises one room's work. The room is opaque here and is deliberately not resolved: this package cannot say whether a room exists — apps/team owns that document — so an unknown room answers an EMPTY board rather than a 404. That is the honest answer and the useful one: a channel that has never had an item filed in it and a channel id that was mistyped both have no work, and inventing a distinction would require this surface to hold a second copy of the room list (HIP-0523 §2 forbids it, and it would drift the first time a room was renamed). Tenancy is the validated principal's org and nothing else, so a caller cannot read another tenant's channel by naming its room.
pub async fn get_todo_rooms_by_room(configuration: &configuration::Configuration, room: &str) -> Result<models::RoomWork, Error<GetTodoRoomsByRoomError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_room = room;
let uri_str = format!("{}/v1/todo/rooms/{room}", configuration.base_path, room=crate::apis::urlencode(p_room));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RoomWork`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RoomWork`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetTodoRoomsByRoomError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Answers 405. A todo board IS a repository on this deployment's forge, so creating, renaming and deleting one is a FORGE operation carried out with FORGE permissions. Offering it here would put a second endpoint on the same object, guarded by this surface instead of by the forge — a weaker guard on the same thing. So the route exists and refuses, rather than 404ing: \"not this service's job\" and \"no such thing\" are different facts, and the body names the forge so a caller knows where the job IS done. What this surface DOES own is the work on a board: list the boards you can see, read and file their issues, move a card between columns, and read the schedule a milestone is. Those are the routes beside this one.
pub async fn patch_todo_projects_by_key(configuration: &configuration::Configuration, key: &str) -> Result<(), Error<PatchTodoProjectsByKeyError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_key = key;
let uri_str = format!("{}/v1/todo/projects/{key}", configuration.base_path, key=crate::apis::urlencode(p_key));
let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<PatchTodoProjectsByKeyError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Edits a work item — rename it, rewrite it, move it to another column, or re-prioritise it. Absent fields are left alone. MOVING A CARD IS A RELABEL. The column lives in the forge's label set, so the move replaces that set rather than writing a status column here that a forge-side change could contradict. Moving to `done` also CLOSES the issue on the forge, because a done card and an open issue are a contradiction.
pub async fn patch_todo_projects_by_key_issues_by_num(configuration: &configuration::Configuration, key: &str, num: i32, issue_edit: models::IssueEdit) -> Result<models::IssueView, Error<PatchTodoProjectsByKeyIssuesByNumError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_key = key;
let p_num = num;
let p_issue_edit = issue_edit;
let uri_str = format!("{}/v1/todo/projects/{key}/issues/{num}", configuration.base_path, key=crate::apis::urlencode(p_key), num=p_num);
let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_issue_edit);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssueView`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IssueView`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PatchTodoProjectsByKeyIssuesByNumError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Answers 405. A todo board IS a repository on this deployment's forge, so creating, renaming and deleting one is a FORGE operation carried out with FORGE permissions. Offering it here would put a second endpoint on the same object, guarded by this surface instead of by the forge — a weaker guard on the same thing. So the route exists and refuses, rather than 404ing: \"not this service's job\" and \"no such thing\" are different facts, and the body names the forge so a caller knows where the job IS done. What this surface DOES own is the work on a board: list the boards you can see, read and file their issues, move a card between columns, and read the schedule a milestone is. Those are the routes beside this one.
pub async fn post_todo_projects(configuration: &configuration::Configuration, ) -> Result<(), Error<PostTodoProjectsError>> {
let uri_str = format!("{}/v1/todo/projects", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<PostTodoProjectsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Opens a work item on the board — an issue on that repository on the deployment's forge, filed as YOU. The column and priority are written as LABELS, which is what makes the card and the forge issue the same object: someone relabelling in the forge web UI has moved your card.
pub async fn post_todo_projects_by_key_issues(configuration: &configuration::Configuration, key: &str, new_issue: models::NewIssue) -> Result<models::IssueView, Error<PostTodoProjectsByKeyIssuesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_key = key;
let p_new_issue = new_issue;
let uri_str = format!("{}/v1/todo/projects/{key}/issues", configuration.base_path, key=crate::apis::urlencode(p_key));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_new_issue);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssueView`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IssueView`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostTodoProjectsByKeyIssuesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Takes an issue: it becomes yours and it moves to in_progress. The holder is the CALLER, never an argument. \"Assign this to someone else\" is a different act with different authority, and it already exists as a PATCH; conflating them would let anyone hand work to anyone by naming them. Claiming something already held by someone else is refused rather than silently taken — two agents on one issue is the failure this prevents, and a claim that quietly wins a race is worse than one that says no.
pub async fn post_todo_projects_by_key_issues_by_num_claim(configuration: &configuration::Configuration, key: &str, num: i32) -> Result<models::IssueHit, Error<PostTodoProjectsByKeyIssuesByNumClaimError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_key = key;
let p_num = num;
let uri_str = format!("{}/v1/todo/projects/{key}/issues/{num}/claim", configuration.base_path, key=crate::apis::urlencode(p_key), num=p_num);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssueHit`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IssueHit`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostTodoProjectsByKeyIssuesByNumClaimError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}