|
- /*
- * 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 OrganizationApiClient<C: hyper::client::Connect> {
- configuration: Rc<configuration::Configuration<C>>,
- }
-
- impl<C: hyper::client::Connect> OrganizationApiClient<C> {
- pub fn new(configuration: Rc<configuration::Configuration<C>>) -> OrganizationApiClient<C> {
- OrganizationApiClient {
- configuration: configuration,
- }
- }
- }
-
- pub trait OrganizationApi {
- fn create_org_repo(&self, org: &str, body: ::models::CreateRepoOption) -> Box<Future<Item = ::models::Repository, Error = Error<serde_json::Value>>>;
- fn org_add_team_member(&self, id: i64, username: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn org_add_team_repository(&self, id: i64, org: &str, repo: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn org_conceal_member(&self, org: &str, username: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn org_create(&self, organization: ::models::CreateOrgOption) -> Box<Future<Item = ::models::Organization, Error = Error<serde_json::Value>>>;
- fn org_create_hook(&self, org: &str, body: ::models::CreateHookOption) -> Box<Future<Item = ::models::Hook, Error = Error<serde_json::Value>>>;
- fn org_create_team(&self, org: &str, body: ::models::CreateTeamOption) -> Box<Future<Item = ::models::Team, Error = Error<serde_json::Value>>>;
- fn org_delete(&self, org: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn org_delete_hook(&self, org: &str, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn org_delete_member(&self, org: &str, username: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn org_delete_team(&self, id: i64) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn org_edit(&self, org: &str, body: ::models::EditOrgOption) -> Box<Future<Item = ::models::Organization, Error = Error<serde_json::Value>>>;
- fn org_edit_hook(&self, org: &str, id: i64, body: ::models::EditHookOption) -> Box<Future<Item = ::models::Hook, Error = Error<serde_json::Value>>>;
- fn org_edit_team(&self, id: i32, body: ::models::EditTeamOption) -> Box<Future<Item = ::models::Team, Error = Error<serde_json::Value>>>;
- fn org_get(&self, org: &str) -> Box<Future<Item = ::models::Organization, Error = Error<serde_json::Value>>>;
- fn org_get_hook(&self, org: &str, id: i64) -> Box<Future<Item = ::models::Hook, Error = Error<serde_json::Value>>>;
- fn org_get_team(&self, id: i64) -> Box<Future<Item = ::models::Team, Error = Error<serde_json::Value>>>;
- fn org_is_member(&self, org: &str, username: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn org_is_public_member(&self, org: &str, username: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn org_list_current_user_orgs(&self, ) -> Box<Future<Item = Vec<::models::Organization>, Error = Error<serde_json::Value>>>;
- fn org_list_hooks(&self, org: &str) -> Box<Future<Item = Vec<::models::Hook>, Error = Error<serde_json::Value>>>;
- fn org_list_members(&self, org: &str) -> Box<Future<Item = Vec<::models::User>, Error = Error<serde_json::Value>>>;
- fn org_list_public_members(&self, org: &str) -> Box<Future<Item = Vec<::models::User>, Error = Error<serde_json::Value>>>;
- fn org_list_repos(&self, org: &str) -> Box<Future<Item = Vec<::models::Repository>, Error = Error<serde_json::Value>>>;
- fn org_list_team_member(&self, id: i64, username: &str) -> Box<Future<Item = ::models::User, Error = Error<serde_json::Value>>>;
- fn org_list_team_members(&self, id: i64) -> Box<Future<Item = Vec<::models::User>, Error = Error<serde_json::Value>>>;
- fn org_list_team_repos(&self, id: i64) -> Box<Future<Item = Vec<::models::Repository>, Error = Error<serde_json::Value>>>;
- fn org_list_teams(&self, org: &str) -> Box<Future<Item = Vec<::models::Team>, Error = Error<serde_json::Value>>>;
- fn org_list_user_orgs(&self, username: &str) -> Box<Future<Item = Vec<::models::Organization>, Error = Error<serde_json::Value>>>;
- fn org_publicize_member(&self, org: &str, username: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn org_remove_team_member(&self, id: i64, username: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn org_remove_team_repository(&self, id: i64, org: &str, repo: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
- fn team_search(&self, org: &str, q: &str, include_desc: bool, limit: i32, page: i32) -> Box<Future<Item = ::models::InlineResponse200, Error = Error<serde_json::Value>>>;
- }
-
-
- impl<C: hyper::client::Connect>OrganizationApi for OrganizationApiClient<C> {
- fn create_org_repo(&self, org: &str, body: ::models::CreateRepoOption) -> Box<Future<Item = ::models::Repository, 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!("{}/org/{org}/repos?{}", configuration.base_path, query_string, org=org);
-
- // 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::Repository, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_add_team_member(&self, id: i64, username: &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!("{}/teams/{id}/members/{username}?{}", configuration.base_path, query_string, id=id, username=username);
-
- // 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 org_add_team_repository(&self, id: i64, org: &str, repo: &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!("{}/teams/{id}/repos/{org}/{repo}?{}", configuration.base_path, query_string, id=id, org=org, 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(|_| futures::future::ok(()))
- )
- }
-
- fn org_conceal_member(&self, org: &str, username: &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!("{}/orgs/{org}/public_members/{username}?{}", configuration.base_path, query_string, org=org, username=username);
-
- // 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 org_create(&self, organization: ::models::CreateOrgOption) -> Box<Future<Item = ::models::Organization, 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!("{}/orgs?{}", 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);
- }
-
- let serialized = serde_json::to_string(&organization).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::Organization, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_create_hook(&self, org: &str, body: ::models::CreateHookOption) -> Box<Future<Item = ::models::Hook, 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!("{}/orgs/{org}/hooks/?{}", configuration.base_path, query_string, org=org);
-
- // 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::Hook, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_create_team(&self, org: &str, body: ::models::CreateTeamOption) -> Box<Future<Item = ::models::Team, 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!("{}/orgs/{org}/teams?{}", configuration.base_path, query_string, org=org);
-
- // 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::Team, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_delete(&self, org: &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!("{}/orgs/{org}?{}", configuration.base_path, query_string, org=org);
-
- // 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 org_delete_hook(&self, org: &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!("{}/orgs/{org}/hooks/{id}?{}", configuration.base_path, query_string, org=org, 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 org_delete_member(&self, org: &str, username: &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!("{}/orgs/{org}/members/{username}?{}", configuration.base_path, query_string, org=org, username=username);
-
- // 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 org_delete_team(&self, 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!("{}/teams/{id}?{}", configuration.base_path, query_string, 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 org_edit(&self, org: &str, body: ::models::EditOrgOption) -> Box<Future<Item = ::models::Organization, 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!("{}/orgs/{org}?{}", configuration.base_path, query_string, org=org);
-
- // 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::Organization, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_edit_hook(&self, org: &str, id: i64, body: ::models::EditHookOption) -> Box<Future<Item = ::models::Hook, 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!("{}/orgs/{org}/hooks/{id}?{}", configuration.base_path, query_string, org=org, 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::Hook, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_edit_team(&self, id: i32, body: ::models::EditTeamOption) -> Box<Future<Item = ::models::Team, 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!("{}/teams/{id}?{}", configuration.base_path, query_string, 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::Team, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_get(&self, org: &str) -> Box<Future<Item = ::models::Organization, 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!("{}/orgs/{org}?{}", configuration.base_path, query_string, org=org);
-
- // 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::Organization, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_get_hook(&self, org: &str, id: i64) -> Box<Future<Item = ::models::Hook, 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!("{}/orgs/{org}/hooks/{id}?{}", configuration.base_path, query_string, org=org, 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::Hook, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_get_team(&self, id: i64) -> Box<Future<Item = ::models::Team, 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!("{}/teams/{id}?{}", configuration.base_path, query_string, 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::Team, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_is_member(&self, org: &str, username: &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::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!("{}/orgs/{org}/members/{username}?{}", configuration.base_path, query_string, org=org, username=username);
-
- // 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 org_is_public_member(&self, org: &str, username: &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::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!("{}/orgs/{org}/public_members/{username}?{}", configuration.base_path, query_string, org=org, username=username);
-
- // 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 org_list_current_user_orgs(&self, ) -> Box<Future<Item = Vec<::models::Organization>, 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!("{}/user/orgs?{}", 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::Organization>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_list_hooks(&self, org: &str) -> Box<Future<Item = Vec<::models::Hook>, 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!("{}/orgs/{org}/hooks?{}", configuration.base_path, query_string, org=org);
-
- // 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::Hook>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_list_members(&self, org: &str) -> 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!("{}/orgs/{org}/members?{}", configuration.base_path, query_string, org=org);
-
- // 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 org_list_public_members(&self, org: &str) -> 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!("{}/orgs/{org}/public_members?{}", configuration.base_path, query_string, org=org);
-
- // 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 org_list_repos(&self, org: &str) -> Box<Future<Item = Vec<::models::Repository>, 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!("{}/orgs/{org}/repos?{}", configuration.base_path, query_string, org=org);
-
- // 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::Repository>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_list_team_member(&self, id: i64, username: &str) -> Box<Future<Item = ::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!("{}/teams/{id}/members/{username}?{}", configuration.base_path, query_string, id=id, username=username);
-
- // 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::User, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_list_team_members(&self, id: 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!("{}/teams/{id}/members?{}", configuration.base_path, query_string, 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::User>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_list_team_repos(&self, id: i64) -> Box<Future<Item = Vec<::models::Repository>, 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!("{}/teams/{id}/repos?{}", configuration.base_path, query_string, 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::Repository>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_list_teams(&self, org: &str) -> Box<Future<Item = Vec<::models::Team>, 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!("{}/orgs/{org}/teams?{}", configuration.base_path, query_string, org=org);
-
- // 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::Team>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_list_user_orgs(&self, username: &str) -> Box<Future<Item = Vec<::models::Organization>, 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!("{}/users/{username}/orgs?{}", configuration.base_path, query_string, username=username);
-
- // 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::Organization>, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- fn org_publicize_member(&self, org: &str, username: &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!("{}/orgs/{org}/public_members/{username}?{}", configuration.base_path, query_string, org=org, username=username);
-
- // 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 org_remove_team_member(&self, id: i64, username: &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!("{}/teams/{id}/members/{username}?{}", configuration.base_path, query_string, id=id, username=username);
-
- // 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 org_remove_team_repository(&self, id: i64, org: &str, repo: &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!("{}/teams/{id}/repos/{org}/{repo}?{}", configuration.base_path, query_string, id=id, org=org, 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(|_| futures::future::ok(()))
- )
- }
-
- fn team_search(&self, org: &str, q: &str, include_desc: bool, limit: i32, page: i32) -> Box<Future<Item = ::models::InlineResponse200, 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("q", &q.to_string());
- query.append_pair("include_desc", &include_desc.to_string());
- query.append_pair("limit", &limit.to_string());
- query.append_pair("page", &page.to_string());
- for (key, val) in &auth_query {
- query.append_pair(key, val);
- }
- query.finish()
- };
- let uri_str = format!("{}/orgs/{org}/teams/search?{}", configuration.base_path, query_string, org=org);
-
- // 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::InlineResponse200, _> = serde_json::from_slice(&body);
- parsed.map_err(|e| Error::from(e))
- })
- )
- }
-
- }
|