// @generated DO NOT EDIT.
//
// Generated from the CNB OpenAPI specification by `cnb-codegen`.
// Run `cargo run -p cnb-codegen --manifest-path codegen/Cargo.toml \
//      -- --spec codegen/spec/swagger.json --out src` to refresh.

#![allow(clippy::all)]
#![allow(missing_docs)]
#![allow(unused_imports)]
#![allow(unused_mut)]

use reqwest::Method;
use serde::Serialize;

use crate::error::{ApiError, Result};
use crate::http::HttpInner;
use crate::models;

// `Issues` resource client (generated, 29 operations).

/// Resource client.
#[derive(Debug, Clone)]
pub struct IssuesClient {
    inner: HttpInner,
}

impl IssuesClient {
    /// Construct a new resource client. Normally obtained
    /// via [`crate::ApiClient`] rather than directly.
    pub fn new(inner: HttpInner) -> Self {
        Self { inner }
    }

    /// 检查用户是否可以被添加到 issue 的处理人中。 Checks if a user can be assigned to an issue.
    ///
    /// `GET /{repo}/-/issues/{number}/assignees/{assignee}`
    pub async fn can_user_be_assigned_to_issue(
        &self,
        repo: String,
        number: String,
        assignee: String,
    ) -> Result<serde_json::Value> {
        let path = format!("/{}/-/issues/{}/assignees/{}", repo, number, assignee);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<serde_json::Value>(Method::GET, url)
            .await
    }

    /// 创建一个 Issue。Create an issue.
    ///
    /// `POST /{repo}/-/issues`
    pub async fn create_issue(
        &self,
        repo: String,
        body: &crate::models::PostIssueForm,
    ) -> Result<crate::models::IssueDetail> {
        let path = format!("/{}/-/issues", repo);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<crate::models::IssueDetail, _>(Method::POST, url, body)
            .await
    }

    /// 删除 issue 中的处理人。 Removes one or more assignees from an issue.
    ///
    /// `DELETE /{repo}/-/issues/{number}/assignees`
    pub async fn delete_issue_assignees(
        &self,
        repo: String,
        number: String,
        body: &crate::models::DeleteIssueAssigneesForm,
    ) -> Result<crate::models::IssueDetail> {
        let path = format!("/{}/-/issues/{}/assignees", repo, number);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<crate::models::IssueDetail, _>(Method::DELETE, url, body)
            .await
    }

    /// 删除 issue 标签。Remove a label from an issue.
    ///
    /// `DELETE /{repo}/-/issues/{number}/labels/{name}`
    pub async fn delete_issue_label(
        &self,
        repo: String,
        number: i64,
        name: String,
    ) -> Result<crate::models::Label> {
        let path = format!("/{}/-/issues/{}/labels/{}", repo, number, name);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<crate::models::Label>(Method::DELETE, url)
            .await
    }

    /// 清空 issue 标签。Remove all labels from an issue.
    ///
    /// `DELETE /{repo}/-/issues/{number}/labels`
    pub async fn delete_issue_labels(
        &self,
        repo: String,
        number: i64,
    ) -> Result<serde_json::Value> {
        let path = format!("/{}/-/issues/{}/labels", repo, number);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<serde_json::Value>(Method::DELETE, url)
            .await
    }

    /// 查询指定的 Issues。Get an issue.
    ///
    /// `GET /{repo}/-/issues/{number}`
    pub async fn get_issue(&self, repo: String, number: i64) -> Result<crate::models::IssueDetail> {
        let path = format!("/{}/-/issues/{}", repo, number);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<crate::models::IssueDetail>(Method::GET, url)
            .await
    }

    /// 获取指定 issue 评论。Get an issue comment.
    ///
    /// `GET /{repo}/-/issues/{number}/comments/{comment_id}`
    pub async fn get_issue_comment(
        &self,
        repo: String,
        number: i64,
        comment_id: i64,
    ) -> Result<crate::models::IssueComment> {
        let path = format!("/{}/-/issues/{}/comments/{}", repo, number, comment_id);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<crate::models::IssueComment>(Method::GET, url)
            .await
    }

    /// 获取 Issue 文件，返回文件二进制内容。Request to retrieve file of issues, returns binary content.
    ///
    /// `GET /{repo}/-/files/issues/{file_path}`
    pub async fn get_issue_files(
        &self,
        repo: String,
        file_path: String,
    ) -> Result<serde_json::Value> {
        let path = format!("/{}/-/files/issues/{}", repo, file_path);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<serde_json::Value>(Method::GET, url)
            .await
    }

    /// 获取 Issue 图片，返回图片二进制内容。Request to retrieve image of issues, returns binary content.
    ///
    /// `GET /{repo}/-/imgs/issues/{img_path}`
    pub async fn get_issue_imgs(
        &self,
        repo: String,
        img_path: String,
    ) -> Result<serde_json::Value> {
        let path = format!("/{}/-/imgs/issues/{}", repo, img_path);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<serde_json::Value>(Method::GET, url)
            .await
    }

    /// 查询指定Issue的自定义属性列表。Get issue custom properties.
    ///
    /// `GET /{repo}/-/issues/{number}/property`
    pub async fn get_issue_properties(
        &self,
        repo: String,
        number: i64,
    ) -> Result<Vec<crate::models::IssueProperty>> {
        let path = format!("/{}/-/issues/{}/property", repo, number);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<Vec<crate::models::IssueProperty>>(Method::GET, url)
            .await
    }

    /// 查询指定 Issue 的 Timeline Activity
    ///
    /// `GET /{repo}/-/issues/{number}/activities`
    pub async fn list_issue_activities(
        &self,
        repo: String,
        number: i64,
        query: &ListIssueActivitiesQuery,
    ) -> Result<Vec<crate::models::IssueActivity>> {
        let path = format!("/{}/-/issues/{}/activities", repo, number);
        let mut url = self.inner.url(&path)?;
        {
            let mut pairs = url.query_pairs_mut();
            if let Some(v) = query.page {
                pairs.append_pair("page", &v.to_string());
            }
            if let Some(v) = query.page_size {
                pairs.append_pair("page_size", &v.to_string());
            }
            drop(pairs);
        }
        self.inner
            .execute::<Vec<crate::models::IssueActivity>>(Method::GET, url)
            .await
    }

    /// 查询某一动态之后的 Issue Activity
    ///
    /// `GET /{repo}/-/issues/{number}/activities/latest/{id}`
    pub async fn list_issue_activities_latest(
        &self,
        repo: String,
        number: i64,
        id: i64,
    ) -> Result<Vec<crate::models::IssueActivity>> {
        let path = format!("/{}/-/issues/{}/activities/latest/{}", repo, number, id);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<Vec<crate::models::IssueActivity>>(Method::GET, url)
            .await
    }

    /// 查询指定 issue 的处理人。 List repository issue assignees.
    ///
    /// `GET /{repo}/-/issues/{number}/assignees`
    pub async fn list_issue_assignees(
        &self,
        repo: String,
        number: String,
    ) -> Result<Vec<crate::models::UserInfo>> {
        let path = format!("/{}/-/issues/{}/assignees", repo, number);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<Vec<crate::models::UserInfo>>(Method::GET, url)
            .await
    }

    /// 查询仓库的 issue 评论列表。List repository issue comments.
    ///
    /// `GET /{repo}/-/issues/{number}/comments`
    pub async fn list_issue_comments(
        &self,
        repo: String,
        number: i64,
        query: &ListIssueCommentsQuery,
    ) -> Result<Vec<crate::models::IssueComment>> {
        let path = format!("/{}/-/issues/{}/comments", repo, number);
        let mut url = self.inner.url(&path)?;
        {
            let mut pairs = url.query_pairs_mut();
            if let Some(ref v) = query.sort {
                pairs.append_pair("sort", v);
            }
            if let Some(v) = query.page {
                pairs.append_pair("page", &v.to_string());
            }
            if let Some(v) = query.page_size {
                pairs.append_pair("page_size", &v.to_string());
            }
            drop(pairs);
        }
        self.inner
            .execute::<Vec<crate::models::IssueComment>>(Method::GET, url)
            .await
    }

    /// 查询 issue 的标签列表。List labels for an issue.
    ///
    /// `GET /{repo}/-/issues/{number}/labels`
    pub async fn list_issue_labels(
        &self,
        repo: String,
        number: i64,
        query: &ListIssueLabelsQuery,
    ) -> Result<Vec<crate::models::Label>> {
        let path = format!("/{}/-/issues/{}/labels", repo, number);
        let mut url = self.inner.url(&path)?;
        {
            let mut pairs = url.query_pairs_mut();
            if let Some(v) = query.page {
                pairs.append_pair("page", &v.to_string());
            }
            if let Some(v) = query.page_size {
                pairs.append_pair("page_size", &v.to_string());
            }
            drop(pairs);
        }
        self.inner
            .execute::<Vec<crate::models::Label>>(Method::GET, url)
            .await
    }

    /// 查询仓库的 Issues。List issues.
    ///
    /// `GET /{repo}/-/issues`
    pub async fn list_issues(
        &self,
        repo: String,
        query: &ListIssuesQuery,
    ) -> Result<Vec<crate::models::Issue>> {
        let path = format!("/{}/-/issues", repo);
        let mut url = self.inner.url(&path)?;
        {
            let mut pairs = url.query_pairs_mut();
            if let Some(v) = query.page {
                pairs.append_pair("page", &v.to_string());
            }
            if let Some(v) = query.page_size {
                pairs.append_pair("page_size", &v.to_string());
            }
            if let Some(ref v) = query.state {
                pairs.append_pair("state", v);
            }
            if let Some(ref v) = query.keyword {
                pairs.append_pair("keyword", v);
            }
            if let Some(ref v) = query.priority {
                pairs.append_pair("priority", v);
            }
            if let Some(ref v) = query.labels {
                pairs.append_pair("labels", v);
            }
            if let Some(ref v) = query.labels_operator {
                pairs.append_pair("labels_operator", v);
            }
            if let Some(ref v) = query.authors {
                pairs.append_pair("authors", v);
            }
            if let Some(ref v) = query.assignees {
                pairs.append_pair("assignees", v);
            }
            if let Some(ref v) = query.updated_time_begin {
                pairs.append_pair("updated_time_begin", v);
            }
            if let Some(ref v) = query.updated_time_end {
                pairs.append_pair("updated_time_end", v);
            }
            if let Some(ref v) = query.close_time_begin {
                pairs.append_pair("close_time_begin", v);
            }
            if let Some(ref v) = query.close_time_end {
                pairs.append_pair("close_time_end", v);
            }
            if let Some(ref v) = query.order_by {
                pairs.append_pair("order_by", v);
            }
            drop(pairs);
        }
        self.inner
            .execute::<Vec<crate::models::Issue>>(Method::GET, url)
            .await
    }

    /// 查询仓库不可见的自定义属性列表。List repository invisible custom properties.
    ///
    /// `GET /{repo}/-/property/invisible`
    pub async fn list_repo_invisible_properties(
        &self,
        repo: String,
        query: &ListRepoInvisiblePropertiesQuery,
    ) -> Result<Vec<crate::models::RepoProperty>> {
        let path = format!("/{}/-/property/invisible", repo);
        let mut url = self.inner.url(&path)?;
        {
            let mut pairs = url.query_pairs_mut();
            if let Some(v) = query.page {
                pairs.append_pair("page", &v.to_string());
            }
            if let Some(v) = query.page_size {
                pairs.append_pair("page_size", &v.to_string());
            }
            if let Some(ref v) = query.keyword {
                pairs.append_pair("keyword", v);
            }
            drop(pairs);
        }
        self.inner
            .execute::<Vec<crate::models::RepoProperty>>(Method::GET, url)
            .await
    }

    /// 查询仓库可见的自定义属性列表。List repository visible custom properties.
    ///
    /// `GET /{repo}/-/property`
    pub async fn list_repo_visible_properties(
        &self,
        repo: String,
    ) -> Result<Vec<crate::models::RepoProperty>> {
        let path = format!("/{}/-/property", repo);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<Vec<crate::models::RepoProperty>>(Method::GET, url)
            .await
    }

    /// 查询当前用户相关的 Issues。List issues for the authenticated user across all repositories.
    ///
    /// `GET /user/issues`
    pub async fn list_user_issues(
        &self,
        query: &ListUserIssuesQuery,
    ) -> Result<Vec<crate::models::UserIssue>> {
        let path = "/user/issues".to_string();
        let mut url = self.inner.url(&path)?;
        {
            let mut pairs = url.query_pairs_mut();
            if let Some(v) = query.page {
                pairs.append_pair("page", &v.to_string());
            }
            if let Some(v) = query.page_size {
                pairs.append_pair("page_size", &v.to_string());
            }
            if let Some(ref v) = query.filter {
                pairs.append_pair("filter", v);
            }
            if let Some(ref v) = query.state {
                pairs.append_pair("state", v);
            }
            if let Some(ref v) = query.priority {
                pairs.append_pair("priority", v);
            }
            if let Some(ref v) = query.labels {
                pairs.append_pair("labels", v);
            }
            if let Some(ref v) = query.labels_operator {
                pairs.append_pair("labels_operator", v);
            }
            if let Some(ref v) = query.updated_time_begin {
                pairs.append_pair("updated_time_begin", v);
            }
            if let Some(ref v) = query.updated_time_end {
                pairs.append_pair("updated_time_end", v);
            }
            if let Some(ref v) = query.close_time_begin {
                pairs.append_pair("close_time_begin", v);
            }
            if let Some(ref v) = query.close_time_end {
                pairs.append_pair("close_time_end", v);
            }
            if let Some(ref v) = query.order_by {
                pairs.append_pair("order_by", v);
            }
            drop(pairs);
        }
        self.inner
            .execute::<Vec<crate::models::UserIssue>>(Method::GET, url)
            .await
    }

    /// 更新 issue 中的处理人。 Updates the assignees of an issue.
    ///
    /// `PATCH /{repo}/-/issues/{number}/assignees`
    pub async fn patch_issue_assignees(
        &self,
        repo: String,
        number: String,
        body: &crate::models::PatchIssueAssigneesForm,
    ) -> Result<crate::models::IssueDetail> {
        let path = format!("/{}/-/issues/{}/assignees", repo, number);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<crate::models::IssueDetail, _>(Method::PATCH, url, body)
            .await
    }

    /// 修改一个 issue 评论。Update an issue comment.
    ///
    /// `PATCH /{repo}/-/issues/{number}/comments/{comment_id}`
    pub async fn patch_issue_comment(
        &self,
        repo: String,
        number: i64,
        comment_id: i64,
        body: &crate::models::PatchIssueCommentForm,
    ) -> Result<crate::models::IssueComment> {
        let path = format!("/{}/-/issues/{}/comments/{}", repo, number, comment_id);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<crate::models::IssueComment, _>(Method::PATCH, url, body)
            .await
    }

    /// 添加处理人到指定的 issue。  Adds up to assignees to a issue, Users already assigned to an issue are not replaced.
    ///
    /// `POST /{repo}/-/issues/{number}/assignees`
    pub async fn post_issue_assignees(
        &self,
        repo: String,
        number: String,
        body: &crate::models::PostIssueAssigneesForm,
    ) -> Result<crate::models::IssueDetail> {
        let path = format!("/{}/-/issues/{}/assignees", repo, number);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<crate::models::IssueDetail, _>(Method::POST, url, body)
            .await
    }

    /// 创建一个 issue 评论。Create an issue comment.
    ///
    /// `POST /{repo}/-/issues/{number}/comments`
    pub async fn post_issue_comment(
        &self,
        repo: String,
        number: i64,
        body: &crate::models::PostIssueCommentForm,
    ) -> Result<crate::models::IssueComment> {
        let path = format!("/{}/-/issues/{}/comments", repo, number);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<crate::models::IssueComment, _>(Method::POST, url, body)
            .await
    }

    /// 创建一个 Issue 评论的文件上传 url。请使用 put 发起流式上传到 upload_url 地址。上传完成后将 asset_link 添加到创建评论请求的 body 中。 Create a file upload URL for an Issue comment. Please use put to initiate a stream upload to the upload_url address. After uploading, add the asset_link to the body of the create comment request.
    ///
    /// `POST /{repo}/-/issues/{number}/comment-file-asset-upload-url`
    pub async fn post_issue_comment_file_asset_upload_url(
        &self,
        repo: String,
        number: i64,
        body: &crate::models::PostIssueAssetUploadUrlForm,
    ) -> Result<crate::models::IssueAssetUploadUrl> {
        let path = format!(
            "/{}/-/issues/{}/comment-file-asset-upload-url",
            repo, number
        );
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<crate::models::IssueAssetUploadUrl, _>(Method::POST, url, body)
            .await
    }

    /// 创建一个 Issue 评论的图片上传 url。请使用 put 发起流式上传到 upload_url 地址。上传完成后将 asset_link 添加到创建评论请求的 body 中。Create an image upload URL for an Issue comment. Please use put to initiate a stream upload to the upload_url address. After uploading, add the asset_link to the body of the create comment request.
    ///
    /// `POST /{repo}/-/issues/{number}/comment-image-asset-upload-url`
    pub async fn post_issue_comment_image_asset_upload_url(
        &self,
        repo: String,
        number: i64,
        body: &crate::models::PostIssueAssetUploadUrlForm,
    ) -> Result<crate::models::IssueAssetUploadUrl> {
        let path = format!(
            "/{}/-/issues/{}/comment-image-asset-upload-url",
            repo, number
        );
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<crate::models::IssueAssetUploadUrl, _>(Method::POST, url, body)
            .await
    }

    /// 新增 issue 标签。Add labels to an issue.
    ///
    /// `POST /{repo}/-/issues/{number}/labels`
    pub async fn post_issue_labels(
        &self,
        repo: String,
        number: i64,
        body: &crate::models::PostIssueLabelsForm,
    ) -> Result<crate::models::Label> {
        let path = format!("/{}/-/issues/{}/labels", repo, number);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<crate::models::Label, _>(Method::POST, url, body)
            .await
    }

    /// 设置 issue 标签。 Set the new labels for an issue.
    ///
    /// `PUT /{repo}/-/issues/{number}/labels`
    pub async fn put_issue_labels(
        &self,
        repo: String,
        number: i64,
        body: &crate::models::PutIssueLabelsForm,
    ) -> Result<crate::models::Label> {
        let path = format!("/{}/-/issues/{}/labels", repo, number);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<crate::models::Label, _>(Method::PUT, url, body)
            .await
    }

    /// 更新一个 Issue。Update an issue.
    ///
    /// `PATCH /{repo}/-/issues/{number}`
    pub async fn update_issue(
        &self,
        repo: String,
        number: i64,
        body: &crate::models::PatchIssueForm,
    ) -> Result<crate::models::IssueDetail> {
        let path = format!("/{}/-/issues/{}", repo, number);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<crate::models::IssueDetail, _>(Method::PATCH, url, body)
            .await
    }

    /// 批量更新Issue自定义属性值
    ///
    /// `PATCH /{repo}/-/issues/{number}/property`
    pub async fn update_issue_properties(
        &self,
        repo: String,
        number: i64,
        body: &crate::models::IssuePropertiesForm,
    ) -> Result<crate::models::IssuePropertyUpdateResult> {
        let path = format!("/{}/-/issues/{}/property", repo, number);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<crate::models::IssuePropertyUpdateResult, _>(
                Method::PATCH,
                url,
                body,
            )
            .await
    }
}

/// Query parameters for the matching method on the resource client.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ListIssueActivitiesQuery {
    /// 分页页码。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    /// 分页页大小。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page_size: Option<i64>,
}

impl ListIssueActivitiesQuery {
    /// Construct an empty query.
    pub fn new() -> Self {
        Self::default()
    }
    /// Set `page` query parameter.
    pub fn page(mut self, v: impl Into<i64>) -> Self {
        self.page = Some(v.into());
        self
    }
    /// Set `page_size` query parameter.
    pub fn page_size(mut self, v: impl Into<i64>) -> Self {
        self.page_size = Some(v.into());
        self
    }
}

/// Query parameters for the matching method on the resource client.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ListIssueCommentsQuery {
    /// 排序方式。支持 created, updated 升序; -created, -updated 降序
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub sort: Option<String>,
    /// 分页页码。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    /// 分页页大小。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page_size: Option<i64>,
}

impl ListIssueCommentsQuery {
    /// Construct an empty query.
    pub fn new() -> Self {
        Self::default()
    }
    /// Set `sort` query parameter.
    pub fn sort(mut self, v: impl Into<String>) -> Self {
        self.sort = Some(v.into());
        self
    }
    /// Set `page` query parameter.
    pub fn page(mut self, v: impl Into<i64>) -> Self {
        self.page = Some(v.into());
        self
    }
    /// Set `page_size` query parameter.
    pub fn page_size(mut self, v: impl Into<i64>) -> Self {
        self.page_size = Some(v.into());
        self
    }
}

/// Query parameters for the matching method on the resource client.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ListIssueLabelsQuery {
    /// 分页页码。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    /// 分页页大小。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page_size: Option<i64>,
}

impl ListIssueLabelsQuery {
    /// Construct an empty query.
    pub fn new() -> Self {
        Self::default()
    }
    /// Set `page` query parameter.
    pub fn page(mut self, v: impl Into<i64>) -> Self {
        self.page = Some(v.into());
        self
    }
    /// Set `page_size` query parameter.
    pub fn page_size(mut self, v: impl Into<i64>) -> Self {
        self.page_size = Some(v.into());
        self
    }
}

/// Query parameters for the matching method on the resource client.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ListIssuesQuery {
    /// 分页页码，输入值小于1，则调整为1。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    /// 分页页大小，输入值小于0，则调整为10;输入值大于100，则调整为100。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page_size: Option<i64>,
    /// Issue状态过滤。可选值：`open`、`closed`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub state: Option<String>,
    /// Issue搜索关键词，支持在标题和内容中模糊搜索。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub keyword: Option<String>,
    /// Issue优先级过滤。示例：`-2P,-1P,P0,P1,P2,P3`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub priority: Option<String>,
    /// Issue标签过滤。示例：`git,bug,feature`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub labels: Option<String>,
    /// 标签过滤操作符。可选值：`contains_any`,`contains_all`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub labels_operator: Option<String>,
    /// Issue创建者过滤，多个作者用英文逗号分隔。示例：`张三,李四`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub authors: Option<String>,
    /// Issue处理人过滤，多个处理人用英文逗号分隔，-表示未分配处理人。示例：`张三,李四`,`-`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub assignees: Option<String>,
    /// Issue更新时间范围开始。示例：`2022-01-31`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub updated_time_begin: Option<String>,
    /// Issue更新时间范围结束。示例：`2022-02-16`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub updated_time_end: Option<String>,
    /// Issue关闭时间范围开始。示例：`2022-01-31`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub close_time_begin: Option<String>,
    /// Issue关闭时间范围结束。示例：`2022-02-16`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub close_time_end: Option<String>,
    /// Issue排序字段，-前缀表示倒序。可选值：`created_at`,`-created_at`,`-updated_at`,`-last_acted_at`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub order_by: Option<String>,
}

impl ListIssuesQuery {
    /// Construct an empty query.
    pub fn new() -> Self {
        Self::default()
    }
    /// Set `page` query parameter.
    pub fn page(mut self, v: impl Into<i64>) -> Self {
        self.page = Some(v.into());
        self
    }
    /// Set `page_size` query parameter.
    pub fn page_size(mut self, v: impl Into<i64>) -> Self {
        self.page_size = Some(v.into());
        self
    }
    /// Set `state` query parameter.
    pub fn state(mut self, v: impl Into<String>) -> Self {
        self.state = Some(v.into());
        self
    }
    /// Set `keyword` query parameter.
    pub fn keyword(mut self, v: impl Into<String>) -> Self {
        self.keyword = Some(v.into());
        self
    }
    /// Set `priority` query parameter.
    pub fn priority(mut self, v: impl Into<String>) -> Self {
        self.priority = Some(v.into());
        self
    }
    /// Set `labels` query parameter.
    pub fn labels(mut self, v: impl Into<String>) -> Self {
        self.labels = Some(v.into());
        self
    }
    /// Set `labels_operator` query parameter.
    pub fn labels_operator(mut self, v: impl Into<String>) -> Self {
        self.labels_operator = Some(v.into());
        self
    }
    /// Set `authors` query parameter.
    pub fn authors(mut self, v: impl Into<String>) -> Self {
        self.authors = Some(v.into());
        self
    }
    /// Set `assignees` query parameter.
    pub fn assignees(mut self, v: impl Into<String>) -> Self {
        self.assignees = Some(v.into());
        self
    }
    /// Set `updated_time_begin` query parameter.
    pub fn updated_time_begin(mut self, v: impl Into<String>) -> Self {
        self.updated_time_begin = Some(v.into());
        self
    }
    /// Set `updated_time_end` query parameter.
    pub fn updated_time_end(mut self, v: impl Into<String>) -> Self {
        self.updated_time_end = Some(v.into());
        self
    }
    /// Set `close_time_begin` query parameter.
    pub fn close_time_begin(mut self, v: impl Into<String>) -> Self {
        self.close_time_begin = Some(v.into());
        self
    }
    /// Set `close_time_end` query parameter.
    pub fn close_time_end(mut self, v: impl Into<String>) -> Self {
        self.close_time_end = Some(v.into());
        self
    }
    /// Set `order_by` query parameter.
    pub fn order_by(mut self, v: impl Into<String>) -> Self {
        self.order_by = Some(v.into());
        self
    }
}

/// Query parameters for the matching method on the resource client.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ListRepoInvisiblePropertiesQuery {
    /// 页码，默认1。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    /// 每页数量，默认10。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page_size: Option<i64>,
    /// 搜索关键字。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub keyword: Option<String>,
}

impl ListRepoInvisiblePropertiesQuery {
    /// Construct an empty query.
    pub fn new() -> Self {
        Self::default()
    }
    /// Set `page` query parameter.
    pub fn page(mut self, v: impl Into<i64>) -> Self {
        self.page = Some(v.into());
        self
    }
    /// Set `page_size` query parameter.
    pub fn page_size(mut self, v: impl Into<i64>) -> Self {
        self.page_size = Some(v.into());
        self
    }
    /// Set `keyword` query parameter.
    pub fn keyword(mut self, v: impl Into<String>) -> Self {
        self.keyword = Some(v.into());
        self
    }
}

/// Query parameters for the matching method on the resource client.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ListUserIssuesQuery {
    /// 分页页码，输入值小于1，则调整为1。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    /// 分页页大小，输入值小于0，则调整为10;输入值大于100，则调整为100。
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page_size: Option<i64>,
    /// Issue筛选类型。可选值：`created`（我创建的）、`assigned`（分配给我的）
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub filter: Option<String>,
    /// Issue状态过滤。可选值：`open`、`closed`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub state: Option<String>,
    /// Issue优先级过滤。示例：`-2P,-1P,P0,P1,P2,P3`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub priority: Option<String>,
    /// Issue标签过滤。示例：`git,bug,feature`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub labels: Option<String>,
    /// 标签过滤操作符。可选值：`contains_any`,`contains_all`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub labels_operator: Option<String>,
    /// Issue更新时间范围开始。示例：`2022-01-31`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub updated_time_begin: Option<String>,
    /// Issue更新时间范围结束。示例：`2022-02-16`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub updated_time_end: Option<String>,
    /// Issue关闭时间范围开始。示例：`2022-01-31`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub close_time_begin: Option<String>,
    /// Issue关闭时间范围结束。示例：`2022-02-16`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub close_time_end: Option<String>,
    /// Issue排序字段，-前缀表示倒序。可选值：`created_at`,`-created_at`,`-updated_at`
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub order_by: Option<String>,
}

impl ListUserIssuesQuery {
    /// Construct an empty query.
    pub fn new() -> Self {
        Self::default()
    }
    /// Set `page` query parameter.
    pub fn page(mut self, v: impl Into<i64>) -> Self {
        self.page = Some(v.into());
        self
    }
    /// Set `page_size` query parameter.
    pub fn page_size(mut self, v: impl Into<i64>) -> Self {
        self.page_size = Some(v.into());
        self
    }
    /// Set `filter` query parameter.
    pub fn filter(mut self, v: impl Into<String>) -> Self {
        self.filter = Some(v.into());
        self
    }
    /// Set `state` query parameter.
    pub fn state(mut self, v: impl Into<String>) -> Self {
        self.state = Some(v.into());
        self
    }
    /// Set `priority` query parameter.
    pub fn priority(mut self, v: impl Into<String>) -> Self {
        self.priority = Some(v.into());
        self
    }
    /// Set `labels` query parameter.
    pub fn labels(mut self, v: impl Into<String>) -> Self {
        self.labels = Some(v.into());
        self
    }
    /// Set `labels_operator` query parameter.
    pub fn labels_operator(mut self, v: impl Into<String>) -> Self {
        self.labels_operator = Some(v.into());
        self
    }
    /// Set `updated_time_begin` query parameter.
    pub fn updated_time_begin(mut self, v: impl Into<String>) -> Self {
        self.updated_time_begin = Some(v.into());
        self
    }
    /// Set `updated_time_end` query parameter.
    pub fn updated_time_end(mut self, v: impl Into<String>) -> Self {
        self.updated_time_end = Some(v.into());
        self
    }
    /// Set `close_time_begin` query parameter.
    pub fn close_time_begin(mut self, v: impl Into<String>) -> Self {
        self.close_time_begin = Some(v.into());
        self
    }
    /// Set `close_time_end` query parameter.
    pub fn close_time_end(mut self, v: impl Into<String>) -> Self {
        self.close_time_end = Some(v.into());
        self
    }
    /// Set `order_by` query parameter.
    pub fn order_by(mut self, v: impl Into<String>) -> Self {
        self.order_by = Some(v.into());
        self
    }
}
