/*
* The Jira Cloud platform REST API
*
* Jira Cloud platform REST API documentation
*
* The version of the OpenAPI document: 1001.0.0-SNAPSHOT
* Contact: ecosystem@atlassian.com
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use crate::apis::ResponseContent;
use super::{Error, configuration};
/// struct for passing parameters to the method [`change_filter_owner`]
#[derive(Clone, Debug, Default)]
pub struct ChangeFilterOwnerParams {
/// The ID of the filter to update.
pub id: i64,
/// The account ID of the new owner of the filter.
pub change_filter_owner: crate::models::ChangeFilterOwner
}
/// struct for passing parameters to the method [`create_filter`]
#[derive(Clone, Debug, Default)]
pub struct CreateFilterParams {
/// The filter to create.
pub filter: crate::models::Filter,
/// Use [expand](#expansion) to include additional information about filter in the response. This parameter accepts a comma-separated list. Expand options include: * `sharedUsers` Returns the users that the filter is shared with. This includes users that can browse projects that the filter is shared with. If you don't specify `sharedUsers`, then the `sharedUsers` object is returned but it doesn't list any users. The list of users returned is limited to 1000, to access additional users append `[start-index:end-index]` to the expand request. For example, to access the next 1000 users, use `?expand=sharedUsers[1001:2000]`. * `subscriptions` Returns the users that are subscribed to the filter. If you don't specify `subscriptions`, the `subscriptions` object is returned but it doesn't list any subscriptions. The list of subscriptions returned is limited to 1000, to access additional subscriptions append `[start-index:end-index]` to the expand request. For example, to access the next 1000 subscriptions, use `?expand=subscriptions[1001:2000]`.
pub expand: Option<String>,
/// EXPERIMENTAL: Whether share permissions are overridden to enable filters with any share permissions to be created. Available to users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
pub override_share_permissions: Option<bool>
}
/// struct for passing parameters to the method [`delete_favourite_for_filter`]
#[derive(Clone, Debug, Default)]
pub struct DeleteFavouriteForFilterParams {
/// The ID of the filter.
pub id: i64,
/// Use [expand](#expansion) to include additional information about filter in the response. This parameter accepts a comma-separated list. Expand options include: * `sharedUsers` Returns the users that the filter is shared with. This includes users that can browse projects that the filter is shared with. If you don't specify `sharedUsers`, then the `sharedUsers` object is returned but it doesn't list any users. The list of users returned is limited to 1000, to access additional users append `[start-index:end-index]` to the expand request. For example, to access the next 1000 users, use `?expand=sharedUsers[1001:2000]`. * `subscriptions` Returns the users that are subscribed to the filter. If you don't specify `subscriptions`, the `subscriptions` object is returned but it doesn't list any subscriptions. The list of subscriptions returned is limited to 1000, to access additional subscriptions append `[start-index:end-index]` to the expand request. For example, to access the next 1000 subscriptions, use `?expand=subscriptions[1001:2000]`.
pub expand: Option<String>
}
/// struct for passing parameters to the method [`delete_filter`]
#[derive(Clone, Debug, Default)]
pub struct DeleteFilterParams {
/// The ID of the filter to delete.
pub id: i64
}
/// struct for passing parameters to the method [`get_columns`]
#[derive(Clone, Debug, Default)]
pub struct GetColumnsParams {
/// The ID of the filter.
pub id: i64
}
/// struct for passing parameters to the method [`get_favourite_filters`]
#[derive(Clone, Debug, Default)]
pub struct GetFavouriteFiltersParams {
/// Use [expand](#expansion) to include additional information about filter in the response. This parameter accepts a comma-separated list. Expand options include: * `sharedUsers` Returns the users that the filter is shared with. This includes users that can browse projects that the filter is shared with. If you don't specify `sharedUsers`, then the `sharedUsers` object is returned but it doesn't list any users. The list of users returned is limited to 1000, to access additional users append `[start-index:end-index]` to the expand request. For example, to access the next 1000 users, use `?expand=sharedUsers[1001:2000]`. * `subscriptions` Returns the users that are subscribed to the filter. If you don't specify `subscriptions`, the `subscriptions` object is returned but it doesn't list any subscriptions. The list of subscriptions returned is limited to 1000, to access additional subscriptions append `[start-index:end-index]` to the expand request. For example, to access the next 1000 subscriptions, use `?expand=subscriptions[1001:2000]`.
pub expand: Option<String>
}
/// struct for passing parameters to the method [`get_filter`]
#[derive(Clone, Debug, Default)]
pub struct GetFilterParams {
/// The ID of the filter to return.
pub id: i64,
/// Use [expand](#expansion) to include additional information about filter in the response. This parameter accepts a comma-separated list. Expand options include: * `sharedUsers` Returns the users that the filter is shared with. This includes users that can browse projects that the filter is shared with. If you don't specify `sharedUsers`, then the `sharedUsers` object is returned but it doesn't list any users. The list of users returned is limited to 1000, to access additional users append `[start-index:end-index]` to the expand request. For example, to access the next 1000 users, use `?expand=sharedUsers[1001:2000]`. * `subscriptions` Returns the users that are subscribed to the filter. If you don't specify `subscriptions`, the `subscriptions` object is returned but it doesn't list any subscriptions. The list of subscriptions returned is limited to 1000, to access additional subscriptions append `[start-index:end-index]` to the expand request. For example, to access the next 1000 subscriptions, use `?expand=subscriptions[1001:2000]`.
pub expand: Option<String>,
/// EXPERIMENTAL: Whether share permissions are overridden to enable filters with any share permissions to be returned. Available to users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
pub override_share_permissions: Option<bool>
}
/// struct for passing parameters to the method [`get_filters`]
#[derive(Clone, Debug, Default)]
pub struct GetFiltersParams {
/// Use [expand](#expansion) to include additional information about filter in the response. This parameter accepts a comma-separated list. Expand options include: * `sharedUsers` Returns the users that the filter is shared with. This includes users that can browse projects that the filter is shared with. If you don't specify `sharedUsers`, then the `sharedUsers` object is returned but it doesn't list any users. The list of users returned is limited to 1000, to access additional users append `[start-index:end-index]` to the expand request. For example, to access the next 1000 users, use `?expand=sharedUsers[1001:2000]`. * `subscriptions` Returns the users that are subscribed to the filter. If you don't specify `subscriptions`, the `subscriptions` object is returned but it doesn't list any subscriptions. The list of subscriptions returned is limited to 1000, to access additional subscriptions append `[start-index:end-index]` to the expand request. For example, to access the next 1000 subscriptions, use `?expand=subscriptions[1001:2000]`.
pub expand: Option<String>
}
/// struct for passing parameters to the method [`get_filters_paginated`]
#[derive(Clone, Debug, Default)]
pub struct GetFiltersPaginatedParams {
/// String used to perform a case-insensitive partial match with `name`.
pub filter_name: Option<String>,
/// User account ID used to return filters with the matching `owner.accountId`. This parameter cannot be used with `owner`.
pub account_id: Option<String>,
/// This parameter is deprecated because of privacy changes. Use `accountId` instead. See the [migration guide](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/) for details. User name used to return filters with the matching `owner.name`. This parameter cannot be used with `accountId`.
pub owner: Option<String>,
/// Group name used to returns filters that are shared with a group that matches `sharePermissions.group.groupname`.
pub groupname: Option<String>,
/// Project ID used to returns filters that are shared with a project that matches `sharePermissions.project.id`.
pub project_id: Option<i64>,
/// The list of filter IDs. To include multiple IDs, provide an ampersand-separated list. For example, `id=10000&id=10001`.
pub id: Option<Vec<i64>>,
/// [Order](#ordering) the results by a field: * `description` Sorts by filter description. Note that this sorting works independently of whether the expand to display the description field is in use. * `favourite_count` Sorts by the count of how many users have this filter as a favorite. * `is_favourite` Sorts by whether the filter is marked as a favorite. * `id` Sorts by filter ID. * `name` Sorts by filter name. * `owner` Sorts by the ID of the filter owner. * `is_shared` Sorts by whether the filter is shared.
pub order_by: Option<String>,
/// The index of the first item to return in a page of results (page offset).
pub start_at: Option<i64>,
/// The maximum number of items to return per page.
pub max_results: Option<i32>,
/// Use [expand](#expansion) to include additional information about filter in the response. This parameter accepts a comma-separated list. Expand options include: * `description` Returns the description of the filter. * `favourite` Returns an indicator of whether the user has set the filter as a favorite. * `favouritedCount` Returns a count of how many users have set this filter as a favorite. * `jql` Returns the JQL query that the filter uses. * `owner` Returns the owner of the filter. * `searchUrl` Returns a URL to perform the filter's JQL query. * `sharePermissions` Returns the share permissions defined for the filter. * `editPermissions` Returns the edit permissions defined for the filter. * `isWritable` Returns whether the current user has permission to edit the filter. * `subscriptions` Returns the users that are subscribed to the filter. * `viewUrl` Returns a URL to view the filter.
pub expand: Option<String>,
/// EXPERIMENTAL: Whether share permissions are overridden to enable filters with any share permissions to be returned. Available to users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
pub override_share_permissions: Option<bool>
}
/// struct for passing parameters to the method [`get_my_filters`]
#[derive(Clone, Debug, Default)]
pub struct GetMyFiltersParams {
/// Use [expand](#expansion) to include additional information about filter in the response. This parameter accepts a comma-separated list. Expand options include: * `sharedUsers` Returns the users that the filter is shared with. This includes users that can browse projects that the filter is shared with. If you don't specify `sharedUsers`, then the `sharedUsers` object is returned but it doesn't list any users. The list of users returned is limited to 1000, to access additional users append `[start-index:end-index]` to the expand request. For example, to access the next 1000 users, use `?expand=sharedUsers[1001:2000]`. * `subscriptions` Returns the users that are subscribed to the filter. If you don't specify `subscriptions`, the `subscriptions` object is returned but it doesn't list any subscriptions. The list of subscriptions returned is limited to 1000, to access additional subscriptions append `[start-index:end-index]` to the expand request. For example, to access the next 1000 subscriptions, use `?expand=subscriptions[1001:2000]`.
pub expand: Option<String>,
/// Include the user's favorite filters in the response.
pub include_favourites: Option<bool>
}
/// struct for passing parameters to the method [`reset_columns`]
#[derive(Clone, Debug, Default)]
pub struct ResetColumnsParams {
/// The ID of the filter.
pub id: i64
}
/// struct for passing parameters to the method [`set_columns`]
#[derive(Clone, Debug, Default)]
pub struct SetColumnsParams {
/// The ID of the filter.
pub id: i64,
/// The IDs of the fields to set as columns. In the form data, specify each field as `columns=id`, where `id` is the *id* of a field (as seen in the response for [Get fields](#api-rest-api-<ver>-field-get)). For example, `columns=summary`.
pub request_body: Option<Vec<String>>
}
/// struct for passing parameters to the method [`set_favourite_for_filter`]
#[derive(Clone, Debug, Default)]
pub struct SetFavouriteForFilterParams {
/// The ID of the filter.
pub id: i64,
/// Use [expand](#expansion) to include additional information about filter in the response. This parameter accepts a comma-separated list. Expand options include: * `sharedUsers` Returns the users that the filter is shared with. This includes users that can browse projects that the filter is shared with. If you don't specify `sharedUsers`, then the `sharedUsers` object is returned but it doesn't list any users. The list of users returned is limited to 1000, to access additional users append `[start-index:end-index]` to the expand request. For example, to access the next 1000 users, use `?expand=sharedUsers[1001:2000]`. * `subscriptions` Returns the users that are subscribed to the filter. If you don't specify `subscriptions`, the `subscriptions` object is returned but it doesn't list any subscriptions. The list of subscriptions returned is limited to 1000, to access additional subscriptions append `[start-index:end-index]` to the expand request. For example, to access the next 1000 subscriptions, use `?expand=subscriptions[1001:2000]`.
pub expand: Option<String>
}
/// struct for passing parameters to the method [`update_filter`]
#[derive(Clone, Debug, Default)]
pub struct UpdateFilterParams {
/// The ID of the filter to update.
pub id: i64,
/// The filter to update.
pub filter: crate::models::Filter,
/// Use [expand](#expansion) to include additional information about filter in the response. This parameter accepts a comma-separated list. Expand options include: * `sharedUsers` Returns the users that the filter is shared with. This includes users that can browse projects that the filter is shared with. If you don't specify `sharedUsers`, then the `sharedUsers` object is returned but it doesn't list any users. The list of users returned is limited to 1000, to access additional users append `[start-index:end-index]` to the expand request. For example, to access the next 1000 users, use `?expand=sharedUsers[1001:2000]`. * `subscriptions` Returns the users that are subscribed to the filter. If you don't specify `subscriptions`, the `subscriptions` object is returned but it doesn't list any subscriptions. The list of subscriptions returned is limited to 1000, to access additional subscriptions append `[start-index:end-index]` to the expand request. For example, to access the next 1000 subscriptions, use `?expand=subscriptions[1001:2000]`.
pub expand: Option<String>,
/// EXPERIMENTAL: Whether share permissions are overridden to enable the addition of any share permissions to filters. Available to users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
pub override_share_permissions: Option<bool>
}
/// struct for typed successes of method [`change_filter_owner`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ChangeFilterOwnerSuccess {
Status204(serde_json::Value),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`create_filter`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateFilterSuccess {
Status200(crate::models::Filter),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`delete_favourite_for_filter`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteFavouriteForFilterSuccess {
Status200(crate::models::Filter),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`delete_filter`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteFilterSuccess {
Status204(),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_columns`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetColumnsSuccess {
Status200(Vec<crate::models::ColumnItem>),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_favourite_filters`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFavouriteFiltersSuccess {
Status200(Vec<crate::models::Filter>),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_filter`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFilterSuccess {
Status200(crate::models::Filter),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_filters`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFiltersSuccess {
Status200(Vec<crate::models::Filter>),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_filters_paginated`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFiltersPaginatedSuccess {
Status200(crate::models::PageBeanFilterDetails),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_my_filters`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetMyFiltersSuccess {
Status200(Vec<crate::models::Filter>),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`reset_columns`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ResetColumnsSuccess {
Status204(),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`set_columns`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SetColumnsSuccess {
Status200(serde_json::Value),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`set_favourite_for_filter`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SetFavouriteForFilterSuccess {
Status200(crate::models::Filter),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`update_filter`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateFilterSuccess {
Status200(crate::models::Filter),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`change_filter_owner`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ChangeFilterOwnerError {
Status400(),
Status403(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_filter`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateFilterError {
Status400(),
Status401(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_favourite_for_filter`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteFavouriteForFilterError {
Status400(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_filter`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteFilterError {
Status400(),
Status401(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_columns`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetColumnsError {
Status400(),
Status401(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_favourite_filters`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFavouriteFiltersError {
Status401(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_filter`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFilterError {
Status400(),
Status401(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_filters`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFiltersError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_filters_paginated`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFiltersPaginatedError {
Status400(crate::models::ErrorCollection),
Status401(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_my_filters`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetMyFiltersError {
Status401(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reset_columns`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ResetColumnsError {
Status400(),
Status401(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`set_columns`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SetColumnsError {
Status400(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`set_favourite_for_filter`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SetFavouriteForFilterError {
Status400(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`update_filter`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateFilterError {
Status400(),
Status401(),
UnknownValue(serde_json::Value),
}
/// Changes the owner of the filter. **[Permissions](#permissions) required:** Permission to access Jira. However, the user must own the filter or have the *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
pub async fn change_filter_owner(configuration: &configuration::Configuration, params: ChangeFilterOwnerParams) -> Result<ResponseContent<ChangeFilterOwnerSuccess>, Error<ChangeFilterOwnerError>> {
let local_var_configuration = configuration;
// unbox the parameters
let id = params.id;
let change_filter_owner = params.change_filter_owner;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter/{id}/owner", local_var_configuration.base_path, id=id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&change_filter_owner);
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() {
let local_var_entity: Option<ChangeFilterOwnerSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<ChangeFilterOwnerError> = 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 filter. The filter is shared according to the [default share scope](#api-rest-api-2-filter-post). The filter is not selected as a favorite. **[Permissions](#permissions) required:** Permission to access Jira.
pub async fn create_filter(configuration: &configuration::Configuration, params: CreateFilterParams) -> Result<ResponseContent<CreateFilterSuccess>, Error<CreateFilterError>> {
let local_var_configuration = configuration;
// unbox the parameters
let filter = params.filter;
let expand = params.expand;
let override_share_permissions = params.override_share_permissions;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_str) = expand {
local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = override_share_permissions {
local_var_req_builder = local_var_req_builder.query(&[("overrideSharePermissions", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&filter);
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() {
let local_var_entity: Option<CreateFilterSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<CreateFilterError> = 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 filter as a favorite for the user. Note that this operation only removes filters visible to the user from the user's favorites list. For example, if the user favorites a public filter that is subsequently made private (and is therefore no longer visible on their favorites list) they cannot remove it from their favorites list. **[Permissions](#permissions) required:** Permission to access Jira.
pub async fn delete_favourite_for_filter(configuration: &configuration::Configuration, params: DeleteFavouriteForFilterParams) -> Result<ResponseContent<DeleteFavouriteForFilterSuccess>, Error<DeleteFavouriteForFilterError>> {
let local_var_configuration = configuration;
// unbox the parameters
let id = params.id;
let expand = params.expand;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter/{id}/favourite", local_var_configuration.base_path, id=id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_str) = expand {
local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.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() {
let local_var_entity: Option<DeleteFavouriteForFilterSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<DeleteFavouriteForFilterError> = 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))
}
}
/// Delete a filter. **[Permissions](#permissions) required:** Permission to access Jira, however filters can only be deleted by the creator of the filter or a user with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
pub async fn delete_filter(configuration: &configuration::Configuration, params: DeleteFilterParams) -> Result<ResponseContent<DeleteFilterSuccess>, Error<DeleteFilterError>> {
let local_var_configuration = configuration;
// unbox the parameters
let id = params.id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter/{id}", local_var_configuration.base_path, id=id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.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() {
let local_var_entity: Option<DeleteFilterSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<DeleteFilterError> = 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 columns configured for a filter. The column configuration is used when the filter's results are viewed in *List View* with the *Columns* set to *Filter*. This operation can be accessed anonymously. **[Permissions](#permissions) required:** None, however, column details are only returned for: * filters owned by the user. * filters shared with a group that the user is a member of. * filters shared with a private project that the user has *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for. * filters shared with a public project. * filters shared with the public.
pub async fn get_columns(configuration: &configuration::Configuration, params: GetColumnsParams) -> Result<ResponseContent<GetColumnsSuccess>, Error<GetColumnsError>> {
let local_var_configuration = configuration;
// unbox the parameters
let id = params.id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter/{id}/columns", local_var_configuration.base_path, id=id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.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() {
let local_var_entity: Option<GetColumnsSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<GetColumnsError> = 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 visible favorite filters of the user. This operation can be accessed anonymously. **[Permissions](#permissions) required:** A favorite filter is only visible to the user where the filter is: * owned by the user. * shared with a group that the user is a member of. * shared with a private project that the user has *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for. * shared with a public project. * shared with the public. For example, if the user favorites a public filter that is subsequently made private that filter is not returned by this operation.
pub async fn get_favourite_filters(configuration: &configuration::Configuration, params: GetFavouriteFiltersParams) -> Result<ResponseContent<GetFavouriteFiltersSuccess>, Error<GetFavouriteFiltersError>> {
let local_var_configuration = configuration;
// unbox the parameters
let expand = params.expand;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter/favourite", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = expand {
local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.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() {
let local_var_entity: Option<GetFavouriteFiltersSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<GetFavouriteFiltersError> = 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 filter. This operation can be accessed anonymously. **[Permissions](#permissions) required:** None, however, the filter is only returned where it is: * owned by the user. * shared with a group that the user is a member of. * shared with a private project that the user has *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for. * shared with a public project. * shared with the public.
pub async fn get_filter(configuration: &configuration::Configuration, params: GetFilterParams) -> Result<ResponseContent<GetFilterSuccess>, Error<GetFilterError>> {
let local_var_configuration = configuration;
// unbox the parameters
let id = params.id;
let expand = params.expand;
let override_share_permissions = params.override_share_permissions;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter/{id}", local_var_configuration.base_path, id=id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = expand {
local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = override_share_permissions {
local_var_req_builder = local_var_req_builder.query(&[("overrideSharePermissions", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.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() {
let local_var_entity: Option<GetFilterSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<GetFilterError> = 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 all filters. Deprecated, use [ Search for filters](#api-rest-api-2-filter-search-get) that supports search and pagination. This operation can be accessed anonymously. **[Permissions](#permissions) required:** None, however, only the following filters are returned: * filters owned by the user. * filters shared with a group that the user is a member of. * filters shared with a private project that the user has *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for. * filters shared with a public project. * filters shared with the public.
pub async fn get_filters(configuration: &configuration::Configuration, params: GetFiltersParams) -> Result<ResponseContent<GetFiltersSuccess>, Error<GetFiltersError>> {
let local_var_configuration = configuration;
// unbox the parameters
let expand = params.expand;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = expand {
local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.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() {
let local_var_entity: Option<GetFiltersSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<GetFiltersError> = 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 [paginated](#pagination) list of filters. Use this operation to get: * specific filters, by defining `id` only. * filters that match all of the specified attributes. For example, all filters for a user with a particular word in their name. When multiple attributes are specified only filters matching all attributes are returned. This operation can be accessed anonymously. **[Permissions](#permissions) required:** None, however, only the following filters that match the query parameters are returned: * filters owned by the user. * filters shared with a group that the user is a member of. * filters shared with a private project that the user has *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for. * filters shared with a public project. * filters shared with the public.
pub async fn get_filters_paginated(configuration: &configuration::Configuration, params: GetFiltersPaginatedParams) -> Result<ResponseContent<GetFiltersPaginatedSuccess>, Error<GetFiltersPaginatedError>> {
let local_var_configuration = configuration;
// unbox the parameters
let filter_name = params.filter_name;
let account_id = params.account_id;
let owner = params.owner;
let groupname = params.groupname;
let project_id = params.project_id;
let id = params.id;
let order_by = params.order_by;
let start_at = params.start_at;
let max_results = params.max_results;
let expand = params.expand;
let override_share_permissions = params.override_share_permissions;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter/search", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = filter_name {
local_var_req_builder = local_var_req_builder.query(&[("filterName", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = account_id {
local_var_req_builder = local_var_req_builder.query(&[("accountId", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = owner {
local_var_req_builder = local_var_req_builder.query(&[("owner", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = groupname {
local_var_req_builder = local_var_req_builder.query(&[("groupname", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = project_id {
local_var_req_builder = local_var_req_builder.query(&[("projectId", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = id {
local_var_req_builder = match "multi" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("id".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("id", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_str) = order_by {
local_var_req_builder = local_var_req_builder.query(&[("orderBy", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = start_at {
local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = max_results {
local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = expand {
local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = override_share_permissions {
local_var_req_builder = local_var_req_builder.query(&[("overrideSharePermissions", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.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() {
let local_var_entity: Option<GetFiltersPaginatedSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<GetFiltersPaginatedError> = 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 filters owned by the user. If `includeFavourites` is `true`, the user's visible favorite filters are also returned. **[Permissions](#permissions) required:** Permission to access Jira, however, a favorite filters is only visible to the user where the filter is: * owned by the user. * shared with a group that the user is a member of. * shared with a private project that the user has *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for. * shared with a public project. * shared with the public. For example, if the user favorites a public filter that is subsequently made private that filter is not returned by this operation.
pub async fn get_my_filters(configuration: &configuration::Configuration, params: GetMyFiltersParams) -> Result<ResponseContent<GetMyFiltersSuccess>, Error<GetMyFiltersError>> {
let local_var_configuration = configuration;
// unbox the parameters
let expand = params.expand;
let include_favourites = params.include_favourites;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter/my", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = expand {
local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = include_favourites {
local_var_req_builder = local_var_req_builder.query(&[("includeFavourites", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.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() {
let local_var_entity: Option<GetMyFiltersSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<GetMyFiltersError> = 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))
}
}
/// Reset the user's column configuration for the filter to the default. **[Permissions](#permissions) required:** Permission to access Jira, however, columns are only reset for: * filters owned by the user. * filters shared with a group that the user is a member of. * filters shared with a private project that the user has *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for. * filters shared with a public project. * filters shared with the public.
pub async fn reset_columns(configuration: &configuration::Configuration, params: ResetColumnsParams) -> Result<ResponseContent<ResetColumnsSuccess>, Error<ResetColumnsError>> {
let local_var_configuration = configuration;
// unbox the parameters
let id = params.id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter/{id}/columns", local_var_configuration.base_path, id=id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.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() {
let local_var_entity: Option<ResetColumnsSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<ResetColumnsError> = 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))
}
}
/// Sets the columns for a filter. Only navigable fields can be set as columns. Use [Get fields](#api-rest-api-2-field-get) to get the list fields in Jira. A navigable field has `navigable` set to `true`. The parameters for this resource are expressed as HTML form data. For example, in curl: `curl -X PUT -d columns=summary -d columns=description https://your-domain.atlassian.net/rest/api/2/filter/10000/columns` **[Permissions](#permissions) required:** Permission to access Jira, however, columns are only set for: * filters owned by the user. * filters shared with a group that the user is a member of. * filters shared with a private project that the user has *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for. * filters shared with a public project. * filters shared with the public.
pub async fn set_columns(configuration: &configuration::Configuration, params: SetColumnsParams) -> Result<ResponseContent<SetColumnsSuccess>, Error<SetColumnsError>> {
let local_var_configuration = configuration;
// unbox the parameters
let id = params.id;
let request_body = params.request_body;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter/{id}/columns", local_var_configuration.base_path, id=id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&request_body);
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() {
let local_var_entity: Option<SetColumnsSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<SetColumnsError> = 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))
}
}
/// Add a filter as a favorite for the user. **[Permissions](#permissions) required:** Permission to access Jira, however, the user can only favorite: * filters owned by the user. * filters shared with a group that the user is a member of. * filters shared with a private project that the user has *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for. * filters shared with a public project. * filters shared with the public.
pub async fn set_favourite_for_filter(configuration: &configuration::Configuration, params: SetFavouriteForFilterParams) -> Result<ResponseContent<SetFavouriteForFilterSuccess>, Error<SetFavouriteForFilterError>> {
let local_var_configuration = configuration;
// unbox the parameters
let id = params.id;
let expand = params.expand;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter/{id}/favourite", local_var_configuration.base_path, id=id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
if let Some(ref local_var_str) = expand {
local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.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() {
let local_var_entity: Option<SetFavouriteForFilterSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<SetFavouriteForFilterError> = 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))
}
}
/// Updates a filter. Use this operation to update a filter's name, description, JQL, or sharing. **[Permissions](#permissions) required:** Permission to access Jira, however the user must own the filter.
pub async fn update_filter(configuration: &configuration::Configuration, params: UpdateFilterParams) -> Result<ResponseContent<UpdateFilterSuccess>, Error<UpdateFilterError>> {
let local_var_configuration = configuration;
// unbox the parameters
let id = params.id;
let filter = params.filter;
let expand = params.expand;
let override_share_permissions = params.override_share_permissions;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/filter/{id}", local_var_configuration.base_path, id=id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
if let Some(ref local_var_str) = expand {
local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = override_share_permissions {
local_var_req_builder = local_var_req_builder.query(&[("overrideSharePermissions", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_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) = local_var_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_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&filter);
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() {
let local_var_entity: Option<UpdateFilterSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<UpdateFilterError> = 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))
}
}