|
- /*
- * Gitea API.
- *
- * This documentation describes the Gitea API.
- *
- * OpenAPI spec version: 1.1.1
- *
- * Generated by: https://github.com/swagger-api/swagger-codegen.git
- */
-
- use std::rc::Rc;
- use std::borrow::Borrow;
- use std::borrow::Cow;
- use std::collections::HashMap;
-
- use hyper;
- use serde_json;
- use futures;
- use futures::{Future, Stream};
-
- use hyper::header::UserAgent;
-
- use super::{Error, configuration};
-
- pub struct IssueApiClient<C: hyper::client::Connect> {
- configuration: Rc<configuration::Configuration<C>>,
- }
-
- impl<C: hyper::client::Connect> IssueApiClient<C> {
- pub fn new(configuration: Rc<configuration::Configuration<C>>) -> IssueApiClient<C> {
- IssueApiClient {
- configuration: configuration,
- }
- }
- }
-
- pub trait IssueApi {
- fn issue_add_label(&self, owner: &str, repo: &str, index: i64, body: ::models::IssueLabelsOption) -> Box<Future<Item = Vec<::models::Label>, Error = Error<serde_json::Value>>>;
- fn issue_add_subscription(&self, owner: &str, repo: &str, index: i64, user: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_add_time(&self, owner: &str, repo: &str, index: i64, body: ::models::AddTimeOption) -> Box<Future<Item = ::models::TrackedTime, Error = Error<serde_json::Value>>>;
- fn issue_clear_labels(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_create_comment(&self, owner: &str, repo: &str, index: i64, body: ::models::CreateIssueCommentOption) -> Box<Future<Item = ::models::Comment, Error = Error<serde_json::Value>>>;
- fn issue_create_issue(&self, owner: &str, repo: &str, body: ::models::CreateIssueOption) -> Box<Future<Item = ::models::Issue, Error = Error<serde_json::Value>>>;
- fn issue_create_label(&self, owner: &str, repo: &str, body: ::models::CreateLabelOption) -> Box<Future<Item = ::models::Label, Error = Error<serde_json::Value>>>;
- fn issue_create_milestone(&self, owner: &str, repo: &str, body: ::models::CreateMilestoneOption) -> Box<Future<Item = ::models::Milestone, Error = Error<serde_json::Value>>>;
- fn issue_delete_comment(&self, owner: &str, repo: &str, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_delete_comment_deprecated(&self, owner: &str, repo: &str, index: i32, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_delete_comment_reaction(&self, owner: &str, repo: &str, id: i64, content: ::models::EditReactionOption) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_delete_issue_reaction(&self, owner: &str, repo: &str, index: i64, content: ::models::EditReactionOption) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_delete_label(&self, owner: &str, repo: &str, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_delete_milestone(&self, owner: &str, repo: &str, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_delete_stop_watch(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_delete_subscription(&self, owner: &str, repo: &str, index: i64, user: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_delete_time(&self, owner: &str, repo: &str, index: i64, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_edit_comment(&self, owner: &str, repo: &str, id: i64, body: ::models::EditIssueCommentOption) -> Box<Future<Item = ::models::Comment, Error = Error<serde_json::Value>>>;
- fn issue_edit_comment_deprecated(&self, owner: &str, repo: &str, index: i32, id: i64, body: ::models::EditIssueCommentOption) -> Box<Future<Item = ::models::Comment, Error = Error<serde_json::Value>>>;
- fn issue_edit_issue(&self, owner: &str, repo: &str, index: i64, body: ::models::EditIssueOption) -> Box<Future<Item = ::models::Issue, Error = Error<serde_json::Value>>>;
- fn issue_edit_issue_deadline(&self, owner: &str, repo: &str, index: i64, body: ::models::EditDeadlineOption) -> Box<Future<Item = ::models::IssueDeadline, Error = Error<serde_json::Value>>>;
- fn issue_edit_label(&self, owner: &str, repo: &str, id: i64, body: ::models::EditLabelOption) -> Box<Future<Item = ::models::Label, Error = Error<serde_json::Value>>>;
- fn issue_edit_milestone(&self, owner: &str, repo: &str, id: i64, body: ::models::EditMilestoneOption) -> Box<Future<Item = ::models::Milestone, Error = Error<serde_json::Value>>>;
- fn issue_get_comment_reactions(&self, owner: &str, repo: &str, id: i64) -> Box<Future<Item = Vec<::models::Reaction>, Error = Error<serde_json::Value>>>;
- fn issue_get_comments(&self, owner: &str, repo: &str, index: i64, since: &str) -> Box<Future<Item = Vec<::models::Comment>, Error = Error<serde_json::Value>>>;
- fn issue_get_issue(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = ::models::Issue, Error = Error<serde_json::Value>>>;
- fn issue_get_issue_reactions(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = Vec<::models::Reaction>, Error = Error<serde_json::Value>>>;
- fn issue_get_label(&self, owner: &str, repo: &str, id: i64) -> Box<Future<Item = ::models::Label, Error = Error<serde_json::Value>>>;
- fn issue_get_labels(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = Vec<::models::Label>, Error = Error<serde_json::Value>>>;
- fn issue_get_milestone(&self, owner: &str, repo: &str, id: i64) -> Box<Future<Item = ::models::Milestone, Error = Error<serde_json::Value>>>;
- fn issue_get_milestones_list(&self, owner: &str, repo: &str, state: &str) -> Box<Future<Item = Vec<::models::Milestone>, Error = Error<serde_json::Value>>>;
- fn issue_get_repo_comments(&self, owner: &str, repo: &str, since: &str) -> Box<Future<Item = Vec<::models::Comment>, Error = Error<serde_json::Value>>>;
- fn issue_list_issues(&self, owner: &str, repo: &str, state: &str, labels: &str, page: i32, q: &str, _type: &str) -> Box<Future<Item = Vec<::models::Issue>, Error = Error<serde_json::Value>>>;
- fn issue_list_labels(&self, owner: &str, repo: &str) -> Box<Future<Item = Vec<::models::Label>, Error = Error<serde_json::Value>>>;
- fn issue_post_comment_reaction(&self, owner: &str, repo: &str, id: i64, content: ::models::EditReactionOption) -> Box<Future<Item = ::models::Reaction, Error = Error<serde_json::Value>>>;
- fn issue_post_issue_reaction(&self, owner: &str, repo: &str, index: i64, content: ::models::EditReactionOption) -> Box<Future<Item = ::models::Reaction, Error = Error<serde_json::Value>>>;
- fn issue_remove_label(&self, owner: &str, repo: &str, index: i64, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_replace_labels(&self, owner: &str, repo: &str, index: i64, body: ::models::IssueLabelsOption) -> Box<Future<Item = Vec<::models::Label>, Error = Error<serde_json::Value>>>;
- fn issue_reset_time(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_search_issues(&self, state: &str, labels: &str, page: i32, q: &str, priority_repo_id: i64, _type: &str) -> Box<Future<Item = Vec<::models::Issue>, Error = Error<serde_json::Value>>>;
- fn issue_start_stop_watch(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_stop_stop_watch(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn issue_subscriptions(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = Vec<::models::User>, Error = Error<serde_json::Value>>>;
- fn issue_tracked_times(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = Vec<::models::TrackedTime>, Error = Error<serde_json::Value>>>;
- }
-
-
- impl<C: hyper::client::Connect>IssueApi for IssueApiClient<C> {
- fn issue_add_label(&self, owner: &str, repo: &str, index: i64, body: ::models::IssueLabelsOption) -> Box<Future<Item = Vec<::models::Label>, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Post;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&body).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<Vec<::models::Label>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_add_subscription(&self, owner: &str, repo: &str, index: i64, user: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Put;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions/{user}?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index, user=user);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_add_time(&self, owner: &str, repo: &str, index: i64, body: ::models::AddTimeOption) -> Box<Future<Item = ::models::TrackedTime, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Post;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&body).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::TrackedTime, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_clear_labels(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Delete;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_create_comment(&self, owner: &str, repo: &str, index: i64, body: ::models::CreateIssueCommentOption) -> Box<Future<Item = ::models::Comment, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Post;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&body).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Comment, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_create_issue(&self, owner: &str, repo: &str, body: ::models::CreateIssueOption) -> Box<Future<Item = ::models::Issue, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Post;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues?{}", configuration.base_path, query_string, owner=owner, repo=repo);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&body).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Issue, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_create_label(&self, owner: &str, repo: &str, body: ::models::CreateLabelOption) -> Box<Future<Item = ::models::Label, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Post;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/labels?{}", configuration.base_path, query_string, owner=owner, repo=repo);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&body).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Label, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_create_milestone(&self, owner: &str, repo: &str, body: ::models::CreateMilestoneOption) -> Box<Future<Item = ::models::Milestone, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Post;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/milestones?{}", configuration.base_path, query_string, owner=owner, repo=repo);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&body).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Milestone, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_delete_comment(&self, owner: &str, repo: &str, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Delete;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}?{}", configuration.base_path, query_string, owner=owner, repo=repo, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_delete_comment_deprecated(&self, owner: &str, repo: &str, index: i32, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Delete;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments/{id}?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_delete_comment_reaction(&self, owner: &str, repo: &str, id: i64, content: ::models::EditReactionOption) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Delete;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/reactions?{}", configuration.base_path, query_string, owner=owner, repo=repo, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&content).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_delete_issue_reaction(&self, owner: &str, repo: &str, index: i64, content: ::models::EditReactionOption) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Delete;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/reactions?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&content).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_delete_label(&self, owner: &str, repo: &str, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Delete;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/labels/{id}?{}", configuration.base_path, query_string, owner=owner, repo=repo, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_delete_milestone(&self, owner: &str, repo: &str, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Delete;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/milestones/{id}?{}", configuration.base_path, query_string, owner=owner, repo=repo, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_delete_stop_watch(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Delete;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/stopwatch/delete?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_delete_subscription(&self, owner: &str, repo: &str, index: i64, user: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Delete;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions/{user}?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index, user=user);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_delete_time(&self, owner: &str, repo: &str, index: i64, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Delete;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times/{id}?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_edit_comment(&self, owner: &str, repo: &str, id: i64, body: ::models::EditIssueCommentOption) -> Box<Future<Item = ::models::Comment, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Patch;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}?{}", configuration.base_path, query_string, owner=owner, repo=repo, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&body).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Comment, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_edit_comment_deprecated(&self, owner: &str, repo: &str, index: i32, id: i64, body: ::models::EditIssueCommentOption) -> Box<Future<Item = ::models::Comment, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Patch;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments/{id}?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&body).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Comment, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_edit_issue(&self, owner: &str, repo: &str, index: i64, body: ::models::EditIssueOption) -> Box<Future<Item = ::models::Issue, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Patch;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&body).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Issue, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_edit_issue_deadline(&self, owner: &str, repo: &str, index: i64, body: ::models::EditDeadlineOption) -> Box<Future<Item = ::models::IssueDeadline, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Post;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/deadline?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&body).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::IssueDeadline, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_edit_label(&self, owner: &str, repo: &str, id: i64, body: ::models::EditLabelOption) -> Box<Future<Item = ::models::Label, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Patch;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/labels/{id}?{}", configuration.base_path, query_string, owner=owner, repo=repo, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&body).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Label, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_edit_milestone(&self, owner: &str, repo: &str, id: i64, body: ::models::EditMilestoneOption) -> Box<Future<Item = ::models::Milestone, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Patch;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/milestones/{id}?{}", configuration.base_path, query_string, owner=owner, repo=repo, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&body).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Milestone, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_get_comment_reactions(&self, owner: &str, repo: &str, id: i64) -> Box<Future<Item = Vec<::models::Reaction>, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/reactions?{}", configuration.base_path, query_string, owner=owner, repo=repo, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<Vec<::models::Reaction>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_get_comments(&self, owner: &str, repo: &str, index: i64, since: &str) -> Box<Future<Item = Vec<::models::Comment>, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- query.append_pair("since", &since.to_string());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<Vec<::models::Comment>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_get_issue(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = ::models::Issue, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Issue, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_get_issue_reactions(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = Vec<::models::Reaction>, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/reactions?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<Vec<::models::Reaction>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_get_label(&self, owner: &str, repo: &str, id: i64) -> Box<Future<Item = ::models::Label, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/labels/{id}?{}", configuration.base_path, query_string, owner=owner, repo=repo, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Label, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_get_labels(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = Vec<::models::Label>, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<Vec<::models::Label>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_get_milestone(&self, owner: &str, repo: &str, id: i64) -> Box<Future<Item = ::models::Milestone, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/milestones/{id}?{}", configuration.base_path, query_string, owner=owner, repo=repo, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Milestone, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_get_milestones_list(&self, owner: &str, repo: &str, state: &str) -> Box<Future<Item = Vec<::models::Milestone>, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- query.append_pair("state", &state.to_string());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/milestones?{}", configuration.base_path, query_string, owner=owner, repo=repo);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<Vec<::models::Milestone>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_get_repo_comments(&self, owner: &str, repo: &str, since: &str) -> Box<Future<Item = Vec<::models::Comment>, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- query.append_pair("since", &since.to_string());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments?{}", configuration.base_path, query_string, owner=owner, repo=repo);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<Vec<::models::Comment>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_list_issues(&self, owner: &str, repo: &str, state: &str, labels: &str, page: i32, q: &str, _type: &str) -> Box<Future<Item = Vec<::models::Issue>, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- query.append_pair("state", &state.to_string());
- query.append_pair("labels", &labels.to_string());
- query.append_pair("page", &page.to_string());
- query.append_pair("q", &q.to_string());
- query.append_pair("type", &_type.to_string());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues?{}", configuration.base_path, query_string, owner=owner, repo=repo);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<Vec<::models::Issue>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_list_labels(&self, owner: &str, repo: &str) -> Box<Future<Item = Vec<::models::Label>, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/labels?{}", configuration.base_path, query_string, owner=owner, repo=repo);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<Vec<::models::Label>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_post_comment_reaction(&self, owner: &str, repo: &str, id: i64, content: ::models::EditReactionOption) -> Box<Future<Item = ::models::Reaction, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Post;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/reactions?{}", configuration.base_path, query_string, owner=owner, repo=repo, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&content).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Reaction, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_post_issue_reaction(&self, owner: &str, repo: &str, index: i64, content: ::models::EditReactionOption) -> Box<Future<Item = ::models::Reaction, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Post;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/reactions?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&content).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<::models::Reaction, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_remove_label(&self, owner: &str, repo: &str, index: i64, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Delete;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels/{id}?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index, id=id);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_replace_labels(&self, owner: &str, repo: &str, index: i64, body: ::models::IssueLabelsOption) -> Box<Future<Item = Vec<::models::Label>, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Put;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
- let serialized = serde_json::to_string(&body).unwrap();
- req.headers_mut().set(hyper::header::ContentType::json());
- req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
- req.set_body(serialized);
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<Vec<::models::Label>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_reset_time(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Delete;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_search_issues(&self, state: &str, labels: &str, page: i32, q: &str, priority_repo_id: i64, _type: &str) -> Box<Future<Item = Vec<::models::Issue>, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- query.append_pair("state", &state.to_string());
- query.append_pair("labels", &labels.to_string());
- query.append_pair("page", &page.to_string());
- query.append_pair("q", &q.to_string());
- query.append_pair("priority_repo_id", &priority_repo_id.to_string());
- query.append_pair("type", &_type.to_string());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/issues/search?{}", configuration.base_path, query_string);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<Vec<::models::Issue>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_start_stop_watch(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Post;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/stopwatch/start?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_stop_stop_watch(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Post;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/stopwatch/stop?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|_| futures::future::ok(()))
- )
- }
-
- fn issue_subscriptions(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = Vec<::models::User>, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<Vec<::models::User>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn issue_tracked_times(&self, owner: &str, repo: &str, index: i64) -> Box<Future<Item = Vec<::models::TrackedTime>, Error = Error<serde_json::Value>>> {
- let configuration: &configuration::Configuration<C> = self.configuration.borrow();
-
- let mut auth_headers = HashMap::<String, String>::new();
- let mut auth_query = HashMap::<String, String>::new();
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("access_token".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Authorization".to_owned(), val);
- };
- if let Some(ref auth_conf) = configuration.basic_auth {
- let auth = hyper::header::Authorization(
- hyper::header::Basic {
- username: auth_conf.0.to_owned(),
- password: auth_conf.1.to_owned(),
- }
- );
- auth_headers.insert("Authorization".to_owned(), auth.to_string());
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_headers.insert("Sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("sudo".to_owned(), val);
- };
- if let Some(ref apikey) = configuration.api_key {
- let key = apikey.key.clone();
- let val = match apikey.prefix {
- Some(ref prefix) => format!("{} {}", prefix, key),
- None => key,
- };
- auth_query.insert("token".to_owned(), val);
- };
- let method = hyper::Method::Get;
-
- let query_string = {
- let mut query = ::url::form_urlencoded::Serializer::new(String::new());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times?{}", configuration.base_path, query_string, owner=owner, repo=repo, index=index);
-
- // TODO(farcaller): handle error
- // if let Err(e) = uri {
- // return Box::new(futures::future::err(e));
- // }
- let mut uri: hyper::Uri = uri_str.parse().unwrap();
-
- let mut req = hyper::Request::new(method, uri);
-
- if let Some(ref user_agent) = configuration.user_agent {
- req.headers_mut().set(UserAgent::new(Cow::Owned(user_agent.clone())));
- }
-
-
- for (key, val) in auth_headers {
- req.headers_mut().set_raw(key, val);
- }
-
-
- // send request
- Box::new(
- configuration.client.request(req)
- .map_err(|e| Error::from(e))
- .and_then(|resp| {
- let status = resp.status();
- resp.body().concat2()
- .and_then(move |body| Ok((status, body)))
- .map_err(|e| Error::from(e))
- })
- .and_then(|(status, body)| {
- if status.is_success() {
- Ok(body)
- } else {
- Err(Error::from((status, &*body)))
- }
- })
- .and_then(|body| {
- let parsed: Result<Vec<::models::TrackedTime>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- }
|