/*
* Asana
*
* This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/developer-docs/master/defs/asana_oas.yaml).
*
* The version of the OpenAPI document: 1.0
*
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use super::{configuration, Error};
use crate::apis::ResponseContent;
/// struct for typed errors of method `add_dependencies_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AddDependenciesForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `add_dependents_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AddDependentsForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `add_followers_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AddFollowersForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `add_project_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AddProjectForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `add_tag_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AddTagForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `create_subtask_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateSubtaskForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `create_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `delete_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `duplicate_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DuplicateTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_dependencies_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetDependenciesForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_dependents_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetDependentsForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_subtasks_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSubtasksForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_tasks`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTasksError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_tasks_for_project`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTasksForProjectError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_tasks_for_section`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTasksForSectionError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_tasks_for_tag`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTasksForTagError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_tasks_for_user_task_list`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTasksForUserTaskListError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `remove_dependencies_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RemoveDependenciesForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `remove_dependents_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RemoveDependentsForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `remove_follower_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RemoveFollowerForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `remove_project_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RemoveProjectForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `remove_tag_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RemoveTagForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `search_tasks_for_workspace`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SearchTasksForWorkspaceError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `set_parent_for_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SetParentForTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `update_task`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateTaskError {
Status400(crate::models::ErrorResponse),
Status401(crate::models::ErrorResponse),
Status403(crate::models::ErrorResponse),
Status404(crate::models::ErrorResponse),
Status500(crate::models::ErrorResponse),
UnknownValue(serde_json::Value),
}
/// Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 15 dependencies*.
pub async fn add_dependencies_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object40: crate::models::InlineObject40,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2001, Error<AddDependenciesForTaskError>>
{
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/addDependencies",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object40);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<AddDependenciesForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Marks a set of tasks as dependents of this task, if they are not already dependents. *A task can have at most 30 dependents*.
pub async fn add_dependents_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object42: crate::models::InlineObject42,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse20023, Error<AddDependentsForTaskError>>
{
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/addDependents",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object42);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<AddDependentsForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Adds followers to a task. Returns an empty data block. Each task can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated task record, described above.
pub async fn add_followers_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object48: crate::models::InlineObject48,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2001, Error<AddFollowersForTaskError>>
{
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/addFollowers",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object48);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<AddFollowersForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Adds the task to the specified project, in the optional location specified. If no location arguments are given, the task will be added to the end of the project. `addProject` can also be used to reorder a task within a project or section that already contains it. At most one of `insert_before`, `insert_after`, or `section` should be specified. Inserting into a section in an non-order-dependent way can be done by specifying section, otherwise, to insert within a section in a particular place, specify `insert_before` or `insert_after` and a task within the section to anchor the position of this task. Returns an empty data block.
pub async fn add_project_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object44: crate::models::InlineObject44,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2001, Error<AddProjectForTaskError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/addProject",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object44);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<AddProjectForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Adds a tag to a task. Returns an empty data block.
pub async fn add_tag_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object46: crate::models::InlineObject46,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2001, Error<AddTagForTaskError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/addTag",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object46);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<AddTagForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Creates a new subtask and adds it to the parent task. Returns the full record for the newly created subtask.
pub async fn create_subtask_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object38: crate::models::InlineObject38,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2016, Error<CreateSubtaskForTaskError>>
{
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/subtasks",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object38);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<CreateSubtaskForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Creating a new task is as easy as POSTing to the `/tasks` endpoint with a data block containing the fields you’d like to set on the task. Any unspecified fields will take on default values. Every task is required to be created in a specific workspace, and this workspace cannot be changed once set. The workspace need not be set explicitly if you specify `projects` or a `parent` task instead.
pub async fn create_task(
configuration: &configuration::Configuration,
inline_object35: crate::models::InlineObject35,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2016, Error<CreateTaskError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/tasks", configuration.base_path);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object35);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<CreateTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// A specific, existing task can be deleted by making a DELETE request on the URL for that task. Deleted tasks go into the “trash” of the user making the delete request. Tasks can be recovered from the trash within a period of 30 days; afterward they are completely removed from the system. Returns an empty data record.
pub async fn delete_task(
configuration: &configuration::Configuration,
task_gid: &str,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2001, Error<DeleteTaskError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.delete(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<DeleteTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Creates and returns a job that will asynchronously handle the duplication.
pub async fn duplicate_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object37: crate::models::InlineObject37,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2007, Error<DuplicateTaskError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/duplicate",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object37);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<DuplicateTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Returns the compact representations of all of the dependencies of a task.
pub async fn get_dependencies_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
limit: Option<i32>,
offset: Option<&str>,
) -> Result<
crate::models::InlineResponse20023,
Error<GetDependenciesForTaskError>,
> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/dependencies",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_str) = limit {
local_var_req_builder = local_var_req_builder
.query(&[("limit", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder
.query(&[("offset", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetDependenciesForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Returns the compact representations of all of the dependents of a task.
pub async fn get_dependents_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
limit: Option<i32>,
offset: Option<&str>,
) -> Result<crate::models::InlineResponse20023, Error<GetDependentsForTaskError>>
{
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/dependents",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_str) = limit {
local_var_req_builder = local_var_req_builder
.query(&[("limit", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder
.query(&[("offset", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetDependentsForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Returns a compact representation of all of the subtasks of a task.
pub async fn get_subtasks_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
limit: Option<i32>,
offset: Option<&str>,
) -> Result<crate::models::InlineResponse20023, Error<GetSubtasksForTaskError>>
{
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/subtasks",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_str) = limit {
local_var_req_builder = local_var_req_builder
.query(&[("limit", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder
.query(&[("offset", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSubtasksForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Returns the complete task record for a single task.
pub async fn get_task(
configuration: &configuration::Configuration,
task_gid: &str,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2016, Error<GetTaskError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`. For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](/docs/search-tasks-in-a-workspace).
pub async fn get_tasks(
configuration: &configuration::Configuration,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
limit: Option<i32>,
offset: Option<&str>,
assignee: Option<&str>,
project: Option<&str>,
section: Option<&str>,
workspace: Option<&str>,
completed_since: Option<String>,
modified_since: Option<String>,
) -> Result<crate::models::InlineResponse20023, Error<GetTasksError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/tasks", configuration.base_path);
let mut local_var_req_builder =
local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_str) = limit {
local_var_req_builder = local_var_req_builder
.query(&[("limit", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder
.query(&[("offset", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = assignee {
local_var_req_builder = local_var_req_builder
.query(&[("assignee", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = project {
local_var_req_builder = local_var_req_builder
.query(&[("project", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = section {
local_var_req_builder = local_var_req_builder
.query(&[("section", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = workspace {
local_var_req_builder = local_var_req_builder
.query(&[("workspace", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = completed_since {
local_var_req_builder = local_var_req_builder
.query(&[("completed_since", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = modified_since {
local_var_req_builder = local_var_req_builder
.query(&[("modified_since", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetTasksError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Returns the compact task records for all tasks within the given project, ordered by their priority within the project. Tasks can exist in more than one project at a time.
pub async fn get_tasks_for_project(
configuration: &configuration::Configuration,
project_gid: &str,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
limit: Option<i32>,
offset: Option<&str>,
) -> Result<crate::models::InlineResponse20023, Error<GetTasksForProjectError>>
{
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/projects/{project_gid}/tasks",
configuration.base_path,
project_gid = crate::apis::urlencode(project_gid)
);
let mut local_var_req_builder =
local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_str) = limit {
local_var_req_builder = local_var_req_builder
.query(&[("limit", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder
.query(&[("offset", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetTasksForProjectError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// *Board view only*: Returns the compact section records for all tasks within the given section.
pub async fn get_tasks_for_section(
configuration: &configuration::Configuration,
section_gid: &str,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
limit: Option<i32>,
offset: Option<&str>,
) -> Result<crate::models::InlineResponse20023, Error<GetTasksForSectionError>>
{
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/sections/{section_gid}/tasks",
configuration.base_path,
section_gid = crate::apis::urlencode(section_gid)
);
let mut local_var_req_builder =
local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_str) = limit {
local_var_req_builder = local_var_req_builder
.query(&[("limit", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder
.query(&[("offset", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetTasksForSectionError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Returns the compact task records for all tasks with the given tag. Tasks can have more than one tag at a time.
pub async fn get_tasks_for_tag(
configuration: &configuration::Configuration,
tag_gid: &str,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
limit: Option<i32>,
offset: Option<&str>,
) -> Result<crate::models::InlineResponse20023, Error<GetTasksForTagError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tags/{tag_gid}/tasks",
configuration.base_path,
tag_gid = crate::apis::urlencode(tag_gid)
);
let mut local_var_req_builder =
local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_str) = limit {
local_var_req_builder = local_var_req_builder
.query(&[("limit", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder
.query(&[("offset", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetTasksForTagError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Returns the compact list of tasks in a user’s My Tasks list. *Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.* *Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)*
pub async fn get_tasks_for_user_task_list(
configuration: &configuration::Configuration,
user_task_list_gid: &str,
completed_since: Option<&str>,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
limit: Option<i32>,
offset: Option<&str>,
) -> Result<
crate::models::InlineResponse20023,
Error<GetTasksForUserTaskListError>,
> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/user_task_lists/{user_task_list_gid}/tasks",
configuration.base_path,
user_task_list_gid = crate::apis::urlencode(user_task_list_gid)
);
let mut local_var_req_builder =
local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_str) = completed_since {
local_var_req_builder = local_var_req_builder
.query(&[("completed_since", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_str) = limit {
local_var_req_builder = local_var_req_builder
.query(&[("limit", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder
.query(&[("offset", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetTasksForUserTaskListError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Unlinks a set of dependencies from this task.
pub async fn remove_dependencies_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object41: crate::models::InlineObject41,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<
crate::models::InlineResponse20024,
Error<RemoveDependenciesForTaskError>,
> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/removeDependencies",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object41);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<RemoveDependenciesForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Unlinks a set of dependents from this task.
pub async fn remove_dependents_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object43: crate::models::InlineObject43,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<
crate::models::InlineResponse20024,
Error<RemoveDependentsForTaskError>,
> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/removeDependents",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object43);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<RemoveDependentsForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Removes each of the specified followers from the task if they are following. Returns the complete, updated record for the affected task.
pub async fn remove_follower_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object49: crate::models::InlineObject49,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2001, Error<RemoveFollowerForTaskError>>
{
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/removeFollowers",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object49);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<RemoveFollowerForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Removes the task from the specified project. The task will still exist in the system, but it will not be in the project anymore. Returns an empty data block.
pub async fn remove_project_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object45: crate::models::InlineObject45,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2001, Error<RemoveProjectForTaskError>>
{
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/removeProject",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object45);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<RemoveProjectForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Removes a tag from a task. Returns an empty data block.
pub async fn remove_tag_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object47: crate::models::InlineObject47,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2001, Error<RemoveTagForTaskError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/removeTag",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object47);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<RemoveTagForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// To mirror the functionality of the Asana web app's advanced search feature, the Asana API has a task search endpoint that allows you to build complex filters to find and retrieve the exact data you need. #### Premium access Like the Asana web product's advance search feature, this search endpoint will only be available to premium Asana users. A user is premium if any of the following is true: - The workspace in which the search is being performed is a premium workspace - The user is a member of a premium team inside the workspace Even if a user is only a member of a premium team inside a non-premium workspace, search will allow them to find data anywhere in the workspace, not just inside the premium team. Making a search request using credentials of a non-premium user will result in a `402 Payment Required` error. #### Pagination Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional [pagination](https://developers.asana.com/docs/#pagination) available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the `limit` query parameter. #### Eventual consistency Changes in Asana (regardless of whether they’re made though the web product or the API) are forwarded to our search infrastructure to be indexed. This process can take between 10 and 60 seconds to complete under normal operation, and longer during some production incidents. Making a change to a task that would alter its presence in a particular search query will not be reflected immediately. This is also true of the advanced search feature in the web product. #### Rate limits You may receive a `429 Too Many Requests` response if you hit any of our [rate limits](https://developers.asana.com/docs/#rate-limits). #### Custom field parameters | Parameter name | Custom field type | Accepted type | |---|---|---| | custom_fields.{gid}.is_set | All | Boolean | | custom_fields.{gid}.value | Text | String | | custom_fields.{gid}.value | Number | Number | | custom_fields.{gid}.value | Enum | Enum option ID | | custom_fields.{gid}.starts_with | Text only | String | | custom_fields.{gid}.ends_with | Text only | String | | custom_fields.{gid}.contains | Text only | String | | custom_fields.{gid}.less_than | Number only | Number | | custom_fields.{gid}.greater_than | Number only | Number | For example, if the gid of the custom field is 12345, these query parameter to find tasks where it is set would be `custom_fields.12345.is_set=true`. To match an exact value for an enum custom field, use the gid of the desired enum option and not the name of the enum option: `custom_fields.12345.value=67890`. Searching for multiple exact matches of a custom field is not supported. *Note: If you specify `projects.any` and `sections.any`, you will receive tasks for the project **and** tasks for the section. If you're looking for only tasks in a section, omit the `projects.any` from the request.*
pub async fn search_tasks_for_workspace(
configuration: &configuration::Configuration,
workspace_gid: &str,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
text: Option<&str>,
resource_subtype: Option<&str>,
assignee_any: Option<&str>,
assignee_not: Option<&str>,
portfolios_any: Option<&str>,
projects_any: Option<&str>,
projects_not: Option<&str>,
projects_all: Option<&str>,
sections_any: Option<&str>,
sections_not: Option<&str>,
sections_all: Option<&str>,
tags_any: Option<&str>,
tags_not: Option<&str>,
tags_all: Option<&str>,
teams_any: Option<&str>,
followers_any: Option<&str>,
followers_not: Option<&str>,
created_by_any: Option<&str>,
created_by_not: Option<&str>,
assigned_by_any: Option<&str>,
assigned_by_not: Option<&str>,
liked_by_any: Option<&str>,
liked_by_not: Option<&str>,
commented_on_by_any: Option<&str>,
commented_on_by_not: Option<&str>,
due_on_before: Option<String>,
due_on_after: Option<String>,
due_on: Option<String>,
due_at_before: Option<String>,
due_at_after: Option<String>,
start_on_before: Option<String>,
start_on_after: Option<String>,
start_on: Option<String>,
created_on_before: Option<String>,
created_on_after: Option<String>,
created_on: Option<String>,
created_at_before: Option<String>,
created_at_after: Option<String>,
completed_on_before: Option<String>,
completed_on_after: Option<String>,
completed_on: Option<String>,
completed_at_before: Option<String>,
completed_at_after: Option<String>,
modified_on_before: Option<String>,
modified_on_after: Option<String>,
modified_on: Option<String>,
modified_at_before: Option<String>,
modified_at_after: Option<String>,
is_blocking: Option<bool>,
is_blocked: Option<bool>,
has_attachment: Option<bool>,
completed: Option<bool>,
is_subtask: Option<bool>,
sort_by: Option<&str>,
sort_ascending: Option<bool>,
) -> Result<
crate::models::InlineResponse20023,
Error<SearchTasksForWorkspaceError>,
> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/workspaces/{workspace_gid}/tasks/search",
configuration.base_path,
workspace_gid = crate::apis::urlencode(workspace_gid)
);
let mut local_var_req_builder =
local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_str) = text {
local_var_req_builder = local_var_req_builder
.query(&[("text", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = resource_subtype {
local_var_req_builder = local_var_req_builder
.query(&[("resource_subtype", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = assignee_any {
local_var_req_builder = local_var_req_builder
.query(&[("assignee.any", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = assignee_not {
local_var_req_builder = local_var_req_builder
.query(&[("assignee.not", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = portfolios_any {
local_var_req_builder = local_var_req_builder
.query(&[("portfolios.any", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = projects_any {
local_var_req_builder = local_var_req_builder
.query(&[("projects.any", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = projects_not {
local_var_req_builder = local_var_req_builder
.query(&[("projects.not", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = projects_all {
local_var_req_builder = local_var_req_builder
.query(&[("projects.all", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = sections_any {
local_var_req_builder = local_var_req_builder
.query(&[("sections.any", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = sections_not {
local_var_req_builder = local_var_req_builder
.query(&[("sections.not", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = sections_all {
local_var_req_builder = local_var_req_builder
.query(&[("sections.all", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = tags_any {
local_var_req_builder = local_var_req_builder
.query(&[("tags.any", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = tags_not {
local_var_req_builder = local_var_req_builder
.query(&[("tags.not", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = tags_all {
local_var_req_builder = local_var_req_builder
.query(&[("tags.all", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = teams_any {
local_var_req_builder = local_var_req_builder
.query(&[("teams.any", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = followers_any {
local_var_req_builder = local_var_req_builder
.query(&[("followers.any", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = followers_not {
local_var_req_builder = local_var_req_builder
.query(&[("followers.not", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = created_by_any {
local_var_req_builder = local_var_req_builder
.query(&[("created_by.any", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = created_by_not {
local_var_req_builder = local_var_req_builder
.query(&[("created_by.not", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = assigned_by_any {
local_var_req_builder = local_var_req_builder
.query(&[("assigned_by.any", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = assigned_by_not {
local_var_req_builder = local_var_req_builder
.query(&[("assigned_by.not", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = liked_by_any {
local_var_req_builder = local_var_req_builder
.query(&[("liked_by.any", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = liked_by_not {
local_var_req_builder = local_var_req_builder
.query(&[("liked_by.not", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = commented_on_by_any {
local_var_req_builder = local_var_req_builder
.query(&[("commented_on_by.any", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = commented_on_by_not {
local_var_req_builder = local_var_req_builder
.query(&[("commented_on_by.not", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = due_on_before {
local_var_req_builder = local_var_req_builder
.query(&[("due_on.before", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = due_on_after {
local_var_req_builder = local_var_req_builder
.query(&[("due_on.after", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = due_on {
local_var_req_builder = local_var_req_builder
.query(&[("due_on", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = due_at_before {
local_var_req_builder = local_var_req_builder
.query(&[("due_at.before", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = due_at_after {
local_var_req_builder = local_var_req_builder
.query(&[("due_at.after", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = start_on_before {
local_var_req_builder = local_var_req_builder
.query(&[("start_on.before", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = start_on_after {
local_var_req_builder = local_var_req_builder
.query(&[("start_on.after", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = start_on {
local_var_req_builder = local_var_req_builder
.query(&[("start_on", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = created_on_before {
local_var_req_builder = local_var_req_builder
.query(&[("created_on.before", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = created_on_after {
local_var_req_builder = local_var_req_builder
.query(&[("created_on.after", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = created_on {
local_var_req_builder = local_var_req_builder
.query(&[("created_on", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = created_at_before {
local_var_req_builder = local_var_req_builder
.query(&[("created_at.before", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = created_at_after {
local_var_req_builder = local_var_req_builder
.query(&[("created_at.after", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = completed_on_before {
local_var_req_builder = local_var_req_builder
.query(&[("completed_on.before", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = completed_on_after {
local_var_req_builder = local_var_req_builder
.query(&[("completed_on.after", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = completed_on {
local_var_req_builder = local_var_req_builder
.query(&[("completed_on", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = completed_at_before {
local_var_req_builder = local_var_req_builder
.query(&[("completed_at.before", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = completed_at_after {
local_var_req_builder = local_var_req_builder
.query(&[("completed_at.after", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = modified_on_before {
local_var_req_builder = local_var_req_builder
.query(&[("modified_on.before", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = modified_on_after {
local_var_req_builder = local_var_req_builder
.query(&[("modified_on.after", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = modified_on {
local_var_req_builder = local_var_req_builder
.query(&[("modified_on", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = modified_at_before {
local_var_req_builder = local_var_req_builder
.query(&[("modified_at.before", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = modified_at_after {
local_var_req_builder = local_var_req_builder
.query(&[("modified_at.after", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = is_blocking {
local_var_req_builder = local_var_req_builder
.query(&[("is_blocking", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = is_blocked {
local_var_req_builder = local_var_req_builder
.query(&[("is_blocked", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = has_attachment {
local_var_req_builder = local_var_req_builder
.query(&[("has_attachment", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = completed {
local_var_req_builder = local_var_req_builder
.query(&[("completed", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = is_subtask {
local_var_req_builder = local_var_req_builder
.query(&[("is_subtask", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = sort_by {
local_var_req_builder = local_var_req_builder
.query(&[("sort_by", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = sort_ascending {
local_var_req_builder = local_var_req_builder
.query(&[("sort_ascending", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<SearchTasksForWorkspaceError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// parent, or no parent task at all. Returns an empty data block. When using `insert_before` and `insert_after`, at most one of those two options can be specified, and they must already be subtasks of the parent.
pub async fn set_parent_for_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object39: crate::models::InlineObject39,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2016, Error<SetParentForTaskError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}/setParent",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object39);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<SetParentForTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// A specific, existing task can be updated by making a PUT request on the URL for that task. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated task record.
pub async fn update_task(
configuration: &configuration::Configuration,
task_gid: &str,
inline_object36: crate::models::InlineObject36,
opt_pretty: Option<bool>,
opt_fields: Option<Vec<String>>,
) -> Result<crate::models::InlineResponse2016, Error<UpdateTaskError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!(
"{}/tasks/{task_gid}",
configuration.base_path,
task_gid = crate::apis::urlencode(task_gid)
);
let mut local_var_req_builder =
local_var_client.put(local_var_uri_str.as_str());
if let Some(ref local_var_str) = opt_pretty {
local_var_req_builder = local_var_req_builder
.query(&[("opt_pretty", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = opt_fields {
local_var_req_builder = local_var_req_builder.query(&[(
"opt_fields",
&local_var_str
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.oauth_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder =
local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&inline_object36);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error()
&& !local_var_status.is_server_error()
{
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<UpdateTaskError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}