From 898324ec58111548d5270c5843dbfc925e48f3d6 Mon Sep 17 00:00:00 2001 From: Alex Herrera Date: Tue, 26 Mar 2019 11:50:23 -0700 Subject: [PATCH] Added API Key auth to rust-server --- .../codegen/languages/RustServerCodegen.java | 8 + .../resources/rust-server/client-mod.mustache | 28 +- .../src/client/mod.rs | 297 ++++++++++++++++-- .../output/rust-server-test/src/client/mod.rs | 45 +++ 4 files changed, 348 insertions(+), 30 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java index 27af253ed2a1..bc3c43969042 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java @@ -732,6 +732,14 @@ public Map postProcessOperationsWithModels(Map o } header.nameInCamelCase = toModelName(header.baseName); } + + if (op.authMethods != null) { + for (CodegenSecurity s : op.authMethods) { + if (s.isApiKey && s.isKeyInHeader) { + s.vendorExtensions.put("x-apiKeyName", toModelName(s.keyParamName)); + } + } + } } return objs; diff --git a/modules/openapi-generator/src/main/resources/rust-server/client-mod.mustache b/modules/openapi-generator/src/main/resources/rust-server/client-mod.mustache index 3bba307bea08..e9c41acc73bd 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/client-mod.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/client-mod.mustache @@ -251,20 +251,23 @@ impl Api for Client where "{}{{{basePathWithoutHost}}}{{path}}", self.base_path{{#pathParams}}, {{{baseName}}}=utf8_percent_encode(¶m_{{{paramName}}}.to_string(), ID_ENCODE_SET){{/pathParams}} ); -{{#queryParams}}{{#-first}} - // Query parameters + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); -{{/-first}}{{#required}} query_string.append_pair("{{{baseName}}}", ¶m_{{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}{{^isListContainer}}.to_string(){{/isListContainer}}); -{{/required}}{{^required}} if let Some({{{paramName}}}) = param_{{{paramName}}} { +{{#queryParams}}{{#required}} query_string.append_pair("{{{baseName}}}", ¶m_{{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}{{^isListContainer}}.to_string(){{/isListContainer}});{{/required}} +{{^required}} if let Some({{{paramName}}}) = param_{{{paramName}}} { query_string.append_pair("{{{baseName}}}", &{{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}{{^isListContainer}}.to_string(){{/isListContainer}}); - } -{{/required}}{{#-last}} + }{{/required}}{{/queryParams}} +{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}} if let Some(auth_data) = (context as &Has>).get().as_ref() { + if let AuthData::ApiKey(ref api_key) = *auth_data { + query_string.append_pair("{{keyParamName}}", api_key); + } + }{{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}} let query_string_str = query_string.finish(); if !query_string_str.is_empty() { uri += "?"; uri += &query_string_str; } -{{/-last}}{{/queryParams}} + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -305,13 +308,18 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::{{#vendorExtensions}}{{{uppercase_operation_id}}}{{/vendorExtensions}}.clone())); {{/bodyParam}} request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); -{{#authMethods}}{{#isBasic}} (context as &Has>).get().as_ref().map(|auth_data| { - if let &AuthData::Basic(ref basic_header) = auth_data { +{{#authMethods}}{{#isBasic}} if let Some(auth_data) = (context as &Has>).get().as_ref() { + if let AuthData::Basic(ref basic_header) = *auth_data { request.headers_mut().set(hyper::header::Authorization( basic_header.clone(), )) } - });{{/isBasic}}{{/authMethods}}{{#headerParams}}{{#-first}} + }{{/isBasic}}{{#isApiKey}}{{#isKeyInHeader}} header! { ({{#vendorExtensions}}{{x-apiKeyName}}{{/vendorExtensions}}, "{{keyParamName}}") => [String] } + if let Some(auth_data) = (context as &Has>).get().as_ref() { + if let AuthData::ApiKey(ref api_key) = *auth_data { + request.headers_mut().set({{#vendorExtensions}}{{x-apiKeyName}}{{/vendorExtensions}}(api_key.to_string())); + } + }{{/isKeyInHeader}}{{/isApiKey}}{{/authMethods}}{{#headerParams}}{{#-first}} // Header parameters {{/-first}}{{^isMapContainer}} header! { (Request{{vendorExtensions.typeName}}, "{{{baseName}}}") => {{#isListContainer}}({{{baseType}}})*{{/isListContainer}}{{^isListContainer}}[{{{dataType}}}]{{/isListContainer}} } {{#required}} request.headers_mut().set(Request{{vendorExtensions.typeName}}(param_{{{paramName}}}{{#isListContainer}}.clone(){{/isListContainer}})); diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs index 32e2db969d9e..2e4f176ff8d2 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs @@ -283,6 +283,15 @@ impl Api for Client where self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -356,6 +365,15 @@ impl Api for Client where self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -431,6 +449,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -504,6 +531,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -577,6 +613,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -649,11 +694,11 @@ if let Some(body) = body { "{}/v2/fake/body-with-query-params", self.base_path ); - - // Query parameters + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); query_string.append_pair("query", ¶m_query.to_string()); - + + let query_string_str = query_string.finish(); if !query_string_str.is_empty() { uri += "?"; @@ -721,6 +766,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -792,6 +846,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -821,13 +884,13 @@ if let Some(body) = body { request.set_body(body.into_bytes()); request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); - (context as &Has>).get().as_ref().map(|auth_data| { - if let &AuthData::Basic(ref basic_header) = auth_data { + if let Some(auth_data) = (context as &Has>).get().as_ref() { + if let AuthData::Basic(ref basic_header) = *auth_data { request.headers_mut().set(hyper::header::Authorization( basic_header.clone(), )) } - }); + } Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) @@ -880,9 +943,9 @@ if let Some(body) = body { "{}/v2/fake", self.base_path ); - - // Query parameters + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + if let Some(enum_query_string_array) = param_enum_query_string_array { query_string.append_pair("enum_query_string_array", &enum_query_string_array.join(",")); } @@ -895,7 +958,7 @@ if let Some(body) = body { if let Some(enum_query_double) = param_enum_query_double { query_string.append_pair("enum_query_double", &enum_query_double.to_string()); } - + let query_string_str = query_string.finish(); if !query_string_str.is_empty() { uri += "?"; @@ -978,6 +1041,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -1039,6 +1111,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -1101,6 +1182,19 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + if let Some(auth_data) = (context as &Has>).get().as_ref() { + if let AuthData::ApiKey(ref api_key) = *auth_data { + query_string.append_pair("api_key_query", api_key); + } + } + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -1174,6 +1268,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -1237,6 +1340,15 @@ if let Some(body) = body { self.base_path, petId=utf8_percent_encode(¶m_pet_id.to_string(), ID_ENCODE_SET) ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -1295,11 +1407,11 @@ if let Some(body) = body { "{}/v2/pet/findByStatus", self.base_path ); - - // Query parameters + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); query_string.append_pair("status", ¶m_status.join(",")); - + + let query_string_str = query_string.finish(); if !query_string_str.is_empty() { uri += "?"; @@ -1381,11 +1493,11 @@ if let Some(body) = body { "{}/v2/pet/findByTags", self.base_path ); - - // Query parameters + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); query_string.append_pair("tags", ¶m_tags.join(",")); - + + let query_string_str = query_string.finish(); if !query_string_str.is_empty() { uri += "?"; @@ -1468,6 +1580,15 @@ if let Some(body) = body { self.base_path, petId=utf8_percent_encode(¶m_pet_id.to_string(), ID_ENCODE_SET) ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -1478,7 +1599,12 @@ if let Some(body) = body { request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); - + header! { (ApiKey, "api_key") => [String] } + if let Some(auth_data) = (context as &Has>).get().as_ref() { + if let AuthData::ApiKey(ref api_key) = *auth_data { + request.headers_mut().set(ApiKey(api_key.to_string())); + } + } Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) @@ -1553,6 +1679,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -1632,6 +1767,15 @@ if let Some(body) = body { self.base_path, petId=utf8_percent_encode(¶m_pet_id.to_string(), ID_ENCODE_SET) ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -1694,6 +1838,15 @@ if let Some(body) = body { self.base_path, petId=utf8_percent_encode(¶m_pet_id.to_string(), ID_ENCODE_SET) ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -1766,6 +1919,15 @@ if let Some(body) = body { self.base_path, order_id=utf8_percent_encode(¶m_order_id.to_string(), ID_ENCODE_SET) ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -1830,6 +1992,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -1840,7 +2011,12 @@ if let Some(body) = body { request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); - + header! { (ApiKey, "api_key") => [String] } + if let Some(auth_data) = (context as &Has>).get().as_ref() { + if let AuthData::ApiKey(ref api_key) = *auth_data { + request.headers_mut().set(ApiKey(api_key.to_string())); + } + } Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) @@ -1895,6 +2071,15 @@ if let Some(body) = body { self.base_path, order_id=utf8_percent_encode(¶m_order_id.to_string(), ID_ENCODE_SET) ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -1980,6 +2165,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -2062,6 +2256,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -2125,6 +2328,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -2186,6 +2398,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -2247,6 +2468,15 @@ if let Some(body) = body { self.base_path, username=utf8_percent_encode(¶m_username.to_string(), ID_ENCODE_SET) ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -2311,6 +2541,15 @@ if let Some(body) = body { self.base_path, username=utf8_percent_encode(¶m_username.to_string(), ID_ENCODE_SET) ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -2395,12 +2634,12 @@ if let Some(body) = body { "{}/v2/user/login", self.base_path ); - - // Query parameters + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); query_string.append_pair("username", ¶m_username.to_string()); query_string.append_pair("password", ¶m_password.to_string()); - + + let query_string_str = query_string.finish(); if !query_string_str.is_empty() { uri += "?"; @@ -2493,6 +2732,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -2548,6 +2796,15 @@ if let Some(body) = body { self.base_path, username=utf8_percent_encode(¶m_username.to_string(), ID_ENCODE_SET) ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs index 8c1d19610916..9de6297a0439 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs @@ -256,6 +256,15 @@ impl Api for Client where self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -311,6 +320,15 @@ impl Api for Client where self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -372,6 +390,15 @@ impl Api for Client where self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -437,6 +464,15 @@ impl Api for Client where self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -506,6 +542,15 @@ impl Api for Client where self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))),