/*
* GitHub's official OpenAPI spec + Octokit extension
*
* OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
*
* The version of the OpenAPI document: 16.6.0
*
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`reactions_slash_create_for_commit_comment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashCreateForCommitCommentError {
Status422(models::ValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_create_for_issue`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashCreateForIssueError {
Status422(models::ValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_create_for_issue_comment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashCreateForIssueCommentError {
Status422(models::ValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_create_for_pull_request_review_comment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashCreateForPullRequestReviewCommentError {
Status422(models::ValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_create_for_release`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashCreateForReleaseError {
Status422(models::ValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_create_for_team_discussion_comment_in_org`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashCreateForTeamDiscussionCommentInOrgError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_create_for_team_discussion_comment_legacy`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashCreateForTeamDiscussionCommentLegacyError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_create_for_team_discussion_in_org`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashCreateForTeamDiscussionInOrgError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_create_for_team_discussion_legacy`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashCreateForTeamDiscussionLegacyError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_delete_for_commit_comment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashDeleteForCommitCommentError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_delete_for_issue`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashDeleteForIssueError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_delete_for_issue_comment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashDeleteForIssueCommentError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_delete_for_pull_request_comment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashDeleteForPullRequestCommentError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_delete_for_release`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashDeleteForReleaseError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_delete_for_team_discussion`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashDeleteForTeamDiscussionError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_delete_for_team_discussion_comment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashDeleteForTeamDiscussionCommentError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_list_for_commit_comment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashListForCommitCommentError {
Status404(models::BasicError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_list_for_issue`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashListForIssueError {
Status404(models::BasicError),
Status410(models::BasicError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_list_for_issue_comment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashListForIssueCommentError {
Status404(models::BasicError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_list_for_pull_request_review_comment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashListForPullRequestReviewCommentError {
Status404(models::BasicError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_list_for_release`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashListForReleaseError {
Status404(models::BasicError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_list_for_team_discussion_comment_in_org`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashListForTeamDiscussionCommentInOrgError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_list_for_team_discussion_comment_legacy`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashListForTeamDiscussionCommentLegacyError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_list_for_team_discussion_in_org`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashListForTeamDiscussionInOrgError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reactions_slash_list_for_team_discussion_legacy`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactionsSlashListForTeamDiscussionLegacyError {
UnknownValue(serde_json::Value),
}
/// Create a reaction to a [commit comment](https://docs.github.com/rest/commits/comments#get-a-commit-comment). A response with an HTTP `200` status means that you already added the reaction type to this commit comment.
pub async fn reactions_slash_create_for_commit_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, comment_id: i32, reactions_create_for_commit_comment_request: models::ReactionsCreateForCommitCommentRequest) -> Result<models::Reaction, Error<ReactionsSlashCreateForCommitCommentError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/comments/{comment_id}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), comment_id=comment_id);
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_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());
}
local_var_req_builder = local_var_req_builder.json(&reactions_create_for_commit_comment_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashCreateForCommitCommentError> = 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))
}
}
/// Create a reaction to an [issue](https://docs.github.com/rest/issues/issues#get-an-issue). A response with an HTTP `200` status means that you already added the reaction type to this issue.
pub async fn reactions_slash_create_for_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, issue_number: i32, reactions_create_for_issue_request: models::ReactionsCreateForIssueRequest) -> Result<models::Reaction, Error<ReactionsSlashCreateForIssueError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{issue_number}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), issue_number=issue_number);
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_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());
}
local_var_req_builder = local_var_req_builder.json(&reactions_create_for_issue_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashCreateForIssueError> = 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))
}
}
/// Create a reaction to an [issue comment](https://docs.github.com/rest/issues/comments#get-an-issue-comment). A response with an HTTP `200` status means that you already added the reaction type to this issue comment.
pub async fn reactions_slash_create_for_issue_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, comment_id: i32, reactions_create_for_issue_comment_request: models::ReactionsCreateForIssueCommentRequest) -> Result<models::Reaction, Error<ReactionsSlashCreateForIssueCommentError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), comment_id=comment_id);
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_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());
}
local_var_req_builder = local_var_req_builder.json(&reactions_create_for_issue_comment_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashCreateForIssueCommentError> = 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))
}
}
/// Create a reaction to a [pull request review comment](https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request). A response with an HTTP `200` status means that you already added the reaction type to this pull request review comment.
pub async fn reactions_slash_create_for_pull_request_review_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, comment_id: i32, reactions_create_for_pull_request_review_comment_request: models::ReactionsCreateForPullRequestReviewCommentRequest) -> Result<models::Reaction, Error<ReactionsSlashCreateForPullRequestReviewCommentError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), comment_id=comment_id);
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_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());
}
local_var_req_builder = local_var_req_builder.json(&reactions_create_for_pull_request_review_comment_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashCreateForPullRequestReviewCommentError> = 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))
}
}
/// Create a reaction to a [release](https://docs.github.com/rest/releases/releases#get-a-release). A response with a `Status: 200 OK` means that you already added the reaction type to this release.
pub async fn reactions_slash_create_for_release(configuration: &configuration::Configuration, owner: &str, repo: &str, release_id: i32, reactions_create_for_release_request: models::ReactionsCreateForReleaseRequest) -> Result<models::Reaction, Error<ReactionsSlashCreateForReleaseError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/{release_id}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), release_id=release_id);
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_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());
}
local_var_req_builder = local_var_req_builder.json(&reactions_create_for_release_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashCreateForReleaseError> = 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))
}
}
/// Create a reaction to a [team discussion comment](https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment). A response with an HTTP `200` status means that you already added the reaction type to this team discussion comment. **Note:** You can also specify a team by `org_id` and `team_id` using the route `POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions`. OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
pub async fn reactions_slash_create_for_team_discussion_comment_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32, comment_number: i32, reactions_create_for_team_discussion_comment_in_org_request: models::ReactionsCreateForTeamDiscussionCommentInOrgRequest) -> Result<models::Reaction, Error<ReactionsSlashCreateForTeamDiscussionCommentInOrgError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number, comment_number=comment_number);
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_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());
}
local_var_req_builder = local_var_req_builder.json(&reactions_create_for_team_discussion_comment_in_org_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashCreateForTeamDiscussionCommentInOrgError> = 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))
}
}
/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new \"[Create reaction for a team discussion comment](https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment)\" endpoint. Create a reaction to a [team discussion comment](https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment). A response with an HTTP `200` status means that you already added the reaction type to this team discussion comment. OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
pub async fn reactions_slash_create_for_team_discussion_comment_legacy(configuration: &configuration::Configuration, team_id: i32, discussion_number: i32, comment_number: i32, reactions_create_for_team_discussion_comment_in_org_request: models::ReactionsCreateForTeamDiscussionCommentInOrgRequest) -> Result<models::Reaction, Error<ReactionsSlashCreateForTeamDiscussionCommentLegacyError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions", local_var_configuration.base_path, team_id=team_id, discussion_number=discussion_number, comment_number=comment_number);
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_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());
}
local_var_req_builder = local_var_req_builder.json(&reactions_create_for_team_discussion_comment_in_org_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashCreateForTeamDiscussionCommentLegacyError> = 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))
}
}
/// Create a reaction to a [team discussion](https://docs.github.com/rest/teams/discussions#get-a-discussion). A response with an HTTP `200` status means that you already added the reaction type to this team discussion. **Note:** You can also specify a team by `org_id` and `team_id` using the route `POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions`. OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
pub async fn reactions_slash_create_for_team_discussion_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32, reactions_create_for_team_discussion_in_org_request: models::ReactionsCreateForTeamDiscussionInOrgRequest) -> Result<models::Reaction, Error<ReactionsSlashCreateForTeamDiscussionInOrgError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number);
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_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());
}
local_var_req_builder = local_var_req_builder.json(&reactions_create_for_team_discussion_in_org_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashCreateForTeamDiscussionInOrgError> = 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))
}
}
/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`Create reaction for a team discussion`](https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion) endpoint. Create a reaction to a [team discussion](https://docs.github.com/rest/teams/discussions#get-a-discussion). A response with an HTTP `200` status means that you already added the reaction type to this team discussion. OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
pub async fn reactions_slash_create_for_team_discussion_legacy(configuration: &configuration::Configuration, team_id: i32, discussion_number: i32, reactions_create_for_team_discussion_in_org_request: models::ReactionsCreateForTeamDiscussionInOrgRequest) -> Result<models::Reaction, Error<ReactionsSlashCreateForTeamDiscussionLegacyError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/teams/{team_id}/discussions/{discussion_number}/reactions", local_var_configuration.base_path, team_id=team_id, discussion_number=discussion_number);
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_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());
}
local_var_req_builder = local_var_req_builder.json(&reactions_create_for_team_discussion_in_org_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashCreateForTeamDiscussionLegacyError> = 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))
}
}
/// **Note:** You can also specify a repository by `repository_id` using the route `DELETE /repositories/:repository_id/comments/:comment_id/reactions/:reaction_id`. Delete a reaction to a [commit comment](https://docs.github.com/rest/commits/comments#get-a-commit-comment).
pub async fn reactions_slash_delete_for_commit_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, comment_id: i32, reaction_id: i32) -> Result<(), Error<ReactionsSlashDeleteForCommitCommentError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), comment_id=comment_id, reaction_id=reaction_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());
}
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() {
Ok(())
} else {
let local_var_entity: Option<ReactionsSlashDeleteForCommitCommentError> = 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))
}
}
/// **Note:** You can also specify a repository by `repository_id` using the route `DELETE /repositories/:repository_id/issues/:issue_number/reactions/:reaction_id`. Delete a reaction to an [issue](https://docs.github.com/rest/issues/issues#get-an-issue).
pub async fn reactions_slash_delete_for_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, issue_number: i32, reaction_id: i32) -> Result<(), Error<ReactionsSlashDeleteForIssueError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), issue_number=issue_number, reaction_id=reaction_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());
}
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() {
Ok(())
} else {
let local_var_entity: Option<ReactionsSlashDeleteForIssueError> = 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))
}
}
/// **Note:** You can also specify a repository by `repository_id` using the route `DELETE delete /repositories/:repository_id/issues/comments/:comment_id/reactions/:reaction_id`. Delete a reaction to an [issue comment](https://docs.github.com/rest/issues/comments#get-an-issue-comment).
pub async fn reactions_slash_delete_for_issue_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, comment_id: i32, reaction_id: i32) -> Result<(), Error<ReactionsSlashDeleteForIssueCommentError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), comment_id=comment_id, reaction_id=reaction_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());
}
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() {
Ok(())
} else {
let local_var_entity: Option<ReactionsSlashDeleteForIssueCommentError> = 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))
}
}
/// **Note:** You can also specify a repository by `repository_id` using the route `DELETE /repositories/:repository_id/pulls/comments/:comment_id/reactions/:reaction_id.` Delete a reaction to a [pull request review comment](https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request).
pub async fn reactions_slash_delete_for_pull_request_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, comment_id: i32, reaction_id: i32) -> Result<(), Error<ReactionsSlashDeleteForPullRequestCommentError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), comment_id=comment_id, reaction_id=reaction_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());
}
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() {
Ok(())
} else {
let local_var_entity: Option<ReactionsSlashDeleteForPullRequestCommentError> = 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))
}
}
/// **Note:** You can also specify a repository by `repository_id` using the route `DELETE delete /repositories/:repository_id/releases/:release_id/reactions/:reaction_id`. Delete a reaction to a [release](https://docs.github.com/rest/releases/releases#get-a-release).
pub async fn reactions_slash_delete_for_release(configuration: &configuration::Configuration, owner: &str, repo: &str, release_id: i32, reaction_id: i32) -> Result<(), Error<ReactionsSlashDeleteForReleaseError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), release_id=release_id, reaction_id=reaction_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());
}
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() {
Ok(())
} else {
let local_var_entity: Option<ReactionsSlashDeleteForReleaseError> = 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))
}
}
/// **Note:** You can also specify a team or organization with `team_id` and `org_id` using the route `DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions/:reaction_id`. Delete a reaction to a [team discussion](https://docs.github.com/rest/teams/discussions#get-a-discussion). OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
pub async fn reactions_slash_delete_for_team_discussion(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32, reaction_id: i32) -> Result<(), Error<ReactionsSlashDeleteForTeamDiscussionError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number, reaction_id=reaction_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());
}
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() {
Ok(())
} else {
let local_var_entity: Option<ReactionsSlashDeleteForTeamDiscussionError> = 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))
}
}
/// **Note:** You can also specify a team or organization with `team_id` and `org_id` using the route `DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions/:reaction_id`. Delete a reaction to a [team discussion comment](https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment). OAuth app tokens and personal access tokens (classic) need the `write:discussion` scope to use this endpoint.
pub async fn reactions_slash_delete_for_team_discussion_comment(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32, comment_number: i32, reaction_id: i32) -> Result<(), Error<ReactionsSlashDeleteForTeamDiscussionCommentError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number, comment_number=comment_number, reaction_id=reaction_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());
}
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() {
Ok(())
} else {
let local_var_entity: Option<ReactionsSlashDeleteForTeamDiscussionCommentError> = 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))
}
}
/// List the reactions to a [commit comment](https://docs.github.com/rest/commits/comments#get-a-commit-comment).
pub async fn reactions_slash_list_for_commit_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, comment_id: i32, content: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Reaction>, Error<ReactionsSlashListForCommitCommentError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/comments/{comment_id}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), comment_id=comment_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) = content {
local_var_req_builder = local_var_req_builder.query(&[("content", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page {
local_var_req_builder = local_var_req_builder.query(&[("page", &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());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashListForCommitCommentError> = 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))
}
}
/// List the reactions to an [issue](https://docs.github.com/rest/issues/issues#get-an-issue).
pub async fn reactions_slash_list_for_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, issue_number: i32, content: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Reaction>, Error<ReactionsSlashListForIssueError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{issue_number}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), issue_number=issue_number);
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) = content {
local_var_req_builder = local_var_req_builder.query(&[("content", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page {
local_var_req_builder = local_var_req_builder.query(&[("page", &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());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashListForIssueError> = 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))
}
}
/// List the reactions to an [issue comment](https://docs.github.com/rest/issues/comments#get-an-issue-comment).
pub async fn reactions_slash_list_for_issue_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, comment_id: i32, content: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Reaction>, Error<ReactionsSlashListForIssueCommentError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), comment_id=comment_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) = content {
local_var_req_builder = local_var_req_builder.query(&[("content", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page {
local_var_req_builder = local_var_req_builder.query(&[("page", &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());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashListForIssueCommentError> = 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))
}
}
/// List the reactions to a [pull request review comment](https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request).
pub async fn reactions_slash_list_for_pull_request_review_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, comment_id: i32, content: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Reaction>, Error<ReactionsSlashListForPullRequestReviewCommentError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), comment_id=comment_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) = content {
local_var_req_builder = local_var_req_builder.query(&[("content", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page {
local_var_req_builder = local_var_req_builder.query(&[("page", &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());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashListForPullRequestReviewCommentError> = 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))
}
}
/// List the reactions to a [release](https://docs.github.com/rest/releases/releases#get-a-release).
pub async fn reactions_slash_list_for_release(configuration: &configuration::Configuration, owner: &str, repo: &str, release_id: i32, content: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Reaction>, Error<ReactionsSlashListForReleaseError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/{release_id}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), release_id=release_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) = content {
local_var_req_builder = local_var_req_builder.query(&[("content", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page {
local_var_req_builder = local_var_req_builder.query(&[("page", &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());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashListForReleaseError> = 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))
}
}
/// List the reactions to a [team discussion comment](https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment). **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions`. OAuth app tokens and personal access tokens (classic) need the `read:discussion` scope to use this endpoint.
pub async fn reactions_slash_list_for_team_discussion_comment_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32, comment_number: i32, content: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Reaction>, Error<ReactionsSlashListForTeamDiscussionCommentInOrgError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number, comment_number=comment_number);
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) = content {
local_var_req_builder = local_var_req_builder.query(&[("content", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page {
local_var_req_builder = local_var_req_builder.query(&[("page", &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());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashListForTeamDiscussionCommentInOrgError> = 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))
}
}
/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List reactions for a team discussion comment`](https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-comment) endpoint. List the reactions to a [team discussion comment](https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment). OAuth app tokens and personal access tokens (classic) need the `read:discussion` scope to use this endpoint.
pub async fn reactions_slash_list_for_team_discussion_comment_legacy(configuration: &configuration::Configuration, team_id: i32, discussion_number: i32, comment_number: i32, content: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Reaction>, Error<ReactionsSlashListForTeamDiscussionCommentLegacyError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions", local_var_configuration.base_path, team_id=team_id, discussion_number=discussion_number, comment_number=comment_number);
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) = content {
local_var_req_builder = local_var_req_builder.query(&[("content", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page {
local_var_req_builder = local_var_req_builder.query(&[("page", &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());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashListForTeamDiscussionCommentLegacyError> = 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))
}
}
/// List the reactions to a [team discussion](https://docs.github.com/rest/teams/discussions#get-a-discussion). **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions`. OAuth app tokens and personal access tokens (classic) need the `read:discussion` scope to use this endpoint.
pub async fn reactions_slash_list_for_team_discussion_in_org(configuration: &configuration::Configuration, org: &str, team_slug: &str, discussion_number: i32, content: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Reaction>, Error<ReactionsSlashListForTeamDiscussionInOrgError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions", local_var_configuration.base_path, org=crate::apis::urlencode(org), team_slug=crate::apis::urlencode(team_slug), discussion_number=discussion_number);
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) = content {
local_var_req_builder = local_var_req_builder.query(&[("content", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page {
local_var_req_builder = local_var_req_builder.query(&[("page", &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());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashListForTeamDiscussionInOrgError> = 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))
}
}
/// **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List reactions for a team discussion`](https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion) endpoint. List the reactions to a [team discussion](https://docs.github.com/rest/teams/discussions#get-a-discussion). OAuth app tokens and personal access tokens (classic) need the `read:discussion` scope to use this endpoint.
pub async fn reactions_slash_list_for_team_discussion_legacy(configuration: &configuration::Configuration, team_id: i32, discussion_number: i32, content: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Reaction>, Error<ReactionsSlashListForTeamDiscussionLegacyError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/teams/{team_id}/discussions/{discussion_number}/reactions", local_var_configuration.base_path, team_id=team_id, discussion_number=discussion_number);
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) = content {
local_var_req_builder = local_var_req_builder.query(&[("content", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page {
local_var_req_builder = local_var_req_builder.query(&[("page", &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());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ReactionsSlashListForTeamDiscussionLegacyError> = 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))
}
}