Skip to content

Commit 65bda3e

Browse files
jimschubertwing328
authored andcommitted
[scala] updates for client default values, required attributes (#7286)
* [scala] Fix default values in scala client This uses consistent logic for optional types with default values in the scala client. Also, uses Option(default) instead of Some(default) to guard against people defining defaultValue = null. Option(null) becomes None while Some(null) defines a null value explicitly and will break maplike operations. * [scala] Regenerate client sample * [scala] Add missing json4s import, which will be added by another PR but allows current samples to generate * [scala] Include integration tests for required attributes support * [scala] Support string types with formats This adds support for better support of type=string and format={date,date-time,binary,byte}. Previously, binary and byte were inconsistently defined as strings rather than byte arrays, while date/date-time were parsing default values into formats that did not match OpenAPI/Swagger 2.0 specifications for full-date and date-time. We may want to consider pulling in json4s-ext to support wider date formats and moving to date=LocalDate and date-time=ZonedDateTime. This will have breaking changes for consumers expecting binary/byte to be strings rather than byte arrays. * [scala] Unique parameter names in integration test, to avoid seemingly conflicting names * [scala] Regenerate client sample * Sort file listings in AssertFile.java Per File#list() javadocs: There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order. I'm unable to repro directory listing failures on OS X High Sierra or Ubuntu 16.04 under Parallels, so it's not clear to me if listing order is indeterminate per-platform or the behavior is just not defined and up to the platform's installed runtime. Sorting the array of strings prior to comparison should resolve this issue on every platform/runtime. * [scala] exclude api tests for integration test gen script Script should match options in the integration test class * [scala] Temporarily disable client integration tests CI doesn't seem to pick up template changes in integration tests. Disabling scala client integration tests, pending investigation of the issue. * [scala] Remove redundant json4s import * [scala] Regenerate integration test * [scala] Regenerate sample
1 parent e679254 commit 65bda3e

File tree

14 files changed

+943
-21
lines changed

14 files changed

+943
-21
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,9 @@ public ScalaClientCodegen() {
9494
typeMapping.put("double", "Double");
9595
typeMapping.put("object", "Any");
9696
typeMapping.put("file", "File");
97-
//TODO binary should be mapped to byte array
98-
// mapped to String as a workaround
99-
typeMapping.put("binary", "String");
100-
typeMapping.put("ByteArray", "String");
97+
typeMapping.put("binary", "Array[Byte]");
98+
typeMapping.put("ByteArray", "Array[Byte]");
10199
typeMapping.put("date-time", "Date");
102-
// typeMapping.put("date", "Date");
103-
// typeMapping.put("Date", "Date");
104100
typeMapping.put("DateTime", "Date");
105101

106102
instantiationTypes.put("array", "ListBuffer");

modules/swagger-codegen/src/main/resources/scala/api.mustache

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import javax.ws.rs.core.MediaType
1414

1515
import java.io.File
1616
import java.util.Date
17+
import java.util.TimeZone
1718

1819
import scala.collection.mutable.HashMap
1920

@@ -38,9 +39,18 @@ class {{classname}}(
3839
val defBasePath: String = "{{{basePath}}}",
3940
defApiInvoker: ApiInvoker = ApiInvoker
4041
) {
41-
42+
private lazy val dateTimeFormatter = {
43+
val formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
44+
formatter.setTimeZone(TimeZone.getTimeZone("UTC"))
45+
formatter
46+
}
47+
private val dateFormatter = {
48+
val formatter = new SimpleDateFormat("yyyy-MM-dd")
49+
formatter.setTimeZone(TimeZone.getTimeZone("UTC"))
50+
formatter
51+
}
4252
implicit val formats = new org.json4s.DefaultFormats {
43-
override def dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS+0000")
53+
override def dateFormatter = dateTimeFormatter
4454
}
4555
implicit val stringReader: ClientResponseReader[String] = ClientResponseReaders.StringReader
4656
implicit val unitReader: ClientResponseReader[Unit] = ClientResponseReaders.UnitReader
@@ -68,7 +78,7 @@ class {{classname}}(
6878
{{#allParams}} * @param {{paramName}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
6979
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
7080
*/
71-
def {{operationId}}({{#allParams}}{{paramName}}: {{#required}}{{dataType}}{{#defaultValue}} /* = {{{defaultValue}}}*/{{/defaultValue}}{{/required}}{{^required}}Option[{{dataType}}]{{#defaultValue}} = None /* = {{{defaultValue}}}*/{{/defaultValue}}{{^defaultValue}} = None{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}: Option[{{returnType}}]{{/returnType}} = {
81+
def {{operationId}}({{#allParams}}{{paramName}}: {{#required}}{{dataType}}{{#defaultValue}} = {{#isString}}"{{{defaultValue}}}"{{/isString}}{{^isString}}{{#isByteArray}}"{{/isByteArray}}{{#isDate}}dateFormatter.parse("{{/isDate}}{{#isDateTime}}dateTimeFormatter.parse("{{/isDateTime}}{{{defaultValue}}}{{#isDate}}"){{/isDate}}{{#isDateTime}}"){{/isDateTime}}{{#isByteArray}}".getBytes{{/isByteArray}}{{/isString}}{{/defaultValue}}{{/required}}{{^required}}Option[{{dataType}}]{{#defaultValue}} = Option({{#isString}}"{{{defaultValue}}}"{{/isString}}{{^isString}}{{#isByteArray}}"{{/isByteArray}}{{#isDate}}dateFormatter.parse("{{/isDate}}{{#isDateTime}}dateTimeFormatter.parse("{{/isDateTime}}{{{defaultValue}}}{{#isDate}}"){{/isDate}}{{#isDateTime}}"){{/isDateTime}}{{#isByteArray}}".getBytes{{/isByteArray}}{{/isString}}){{/defaultValue}}{{^defaultValue}} = None{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}: Option[{{returnType}}]{{/returnType}} = {
7282
val await = Try(Await.result({{operationId}}Async({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}), Duration.Inf))
7383
await match {
7484
case Success(i) => Some(await.get)
@@ -83,7 +93,7 @@ class {{classname}}(
8393
{{#allParams}} * @param {{paramName}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
8494
{{/allParams}} * @return Future({{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}})
8595
*/
86-
def {{operationId}}Async({{#allParams}}{{paramName}}: {{#required}}{{dataType}}{{#defaultValue}} /* = {{{defaultValue}}}*/{{/defaultValue}}{{/required}}{{^required}}Option[{{dataType}}]{{#defaultValue}} = None /* = {{{defaultValue}}}*/{{/defaultValue}}{{^defaultValue}} = None{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}} = {
96+
def {{operationId}}Async({{#allParams}}{{paramName}}: {{#required}}{{dataType}}{{#defaultValue}} = {{#isString}}"{{{defaultValue}}}"{{/isString}}{{^isString}}{{#isByteArray}}"{{/isByteArray}}{{#isDate}}dateFormatter.parse("{{/isDate}}{{#isDateTime}}dateTimeFormatter.parse("{{/isDateTime}}{{{defaultValue}}}{{#isDate}}"){{/isDate}}{{#isDateTime}}"){{/isDateTime}}{{#isByteArray}}".getBytes{{/isByteArray}}{{/isString}}{{/defaultValue}}{{/required}}{{^required}}Option[{{dataType}}]{{#defaultValue}} = Option({{#isString}}"{{{defaultValue}}}"{{/isString}}{{^isString}}{{#isByteArray}}"{{/isByteArray}}{{#isDate}}dateFormatter.parse("{{/isDate}}{{#isDateTime}}dateTimeFormatter.parse("{{/isDateTime}}{{{defaultValue}}}{{#isDate}}"){{/isDate}}{{#isDateTime}}"){{/isDateTime}}{{#isByteArray}}".getBytes{{/isByteArray}}{{/isString}}){{/defaultValue}}{{^defaultValue}} = None{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}} = {
8797
helper.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
8898
}
8999

@@ -93,8 +103,8 @@ class {{classname}}(
93103
class {{classname}}AsyncHelper(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
94104
95105
{{#operation}}
96-
def {{operationId}}({{#allParams}}{{^required}}{{paramName}}: Option[{{dataType}}] = {{#defaultValue}}Some({{defaultValue}}){{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{#hasMore}},{{/hasMore}}
97-
{{/required}}{{#required}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}},
106+
def {{operationId}}({{#allParams}}{{^required}}{{paramName}}: Option[{{dataType}}] = {{#defaultValue}}Option({{#isString}}"{{{defaultValue}}}"{{/isString}}{{^isString}}{{#isByteArray}}"{{/isByteArray}}{{#isDate}}dateFormatter.parse("{{/isDate}}{{#isDateTime}}dateTimeFormatter.parse("{{/isDateTime}}{{{defaultValue}}}{{#isDate}}"){{/isDate}}{{#isDateTime}}"){{/isDateTime}}{{#isByteArray}}".getBytes{{/isByteArray}}{{/isString}}){{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{#hasMore}},{{/hasMore}}
107+
{{/required}}{{#required}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{#isString}}"{{{defaultValue}}}"{{/isString}}{{^isString}}{{#isByteArray}}"{{/isByteArray}}{{#isDate}}dateFormatter.parse("{{/isDate}}{{#isDateTime}}dateTimeFormatter.parse("{{/isDateTime}}{{{defaultValue}}}{{#isDate}}"){{/isDate}}{{#isDateTime}}"){{/isDateTime}}{{#isByteArray}}".getBytes{{/isByteArray}}{{/isString}}{{/defaultValue}}{{#hasMore}},
98108
{{/hasMore}}{{/required}}{{/allParams}})(implicit reader: ClientResponseReader[{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}]{{#bodyParams}}, writer: RequestWriter[{{^required}}Option[{{dataType}}]{{/required}}{{#required}}{{dataType}}{{/required}}]{{/bodyParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}}{{^returnType}}: Future[Unit]{{/returnType}} = {
99109
// create path and map variables
100110
val path = (addFmt("{{path}}"){{#pathParams}}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package io.swagger.codegen.scala;
2+
3+
import com.google.common.collect.ImmutableMap;
4+
import io.swagger.codegen.AbstractIntegrationTest;
5+
import io.swagger.codegen.CodegenConfig;
6+
import io.swagger.codegen.CodegenConstants;
7+
import io.swagger.codegen.languages.ScalaClientCodegen;
8+
import io.swagger.codegen.testutils.IntegrationTestPathsConfig;
9+
import org.testng.annotations.Test;
10+
11+
import java.io.IOException;
12+
import java.util.HashMap;
13+
import java.util.Map;
14+
15+
public class ScalaClientRequiredAttributesIntegrationTest extends AbstractIntegrationTest {
16+
17+
public ScalaClientRequiredAttributesIntegrationTest() {
18+
generateSwaggerMetadata = false;
19+
20+
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
21+
systemPropertyOverrides = builder
22+
.put(CodegenConstants.APIS, Boolean.TRUE.toString())
23+
.put(CodegenConstants.MODELS, Boolean.TRUE.toString())
24+
.put(CodegenConstants.API_DOCS, Boolean.FALSE.toString())
25+
.put(CodegenConstants.MODEL_DOCS, Boolean.FALSE.toString())
26+
.put(CodegenConstants.API_TESTS, Boolean.FALSE.toString())
27+
.put(CodegenConstants.MODEL_TESTS, Boolean.FALSE.toString())
28+
.put(CodegenConstants.SUPPORTING_FILES, Boolean.FALSE.toString())
29+
.build();
30+
}
31+
32+
@Override
33+
protected IntegrationTestPathsConfig getIntegrationTestPathsConfig() {
34+
return new IntegrationTestPathsConfig("scala/client/required-attributes");
35+
}
36+
37+
@Override
38+
protected CodegenConfig getCodegenConfig() {
39+
return new ScalaClientCodegen();
40+
}
41+
42+
@Override
43+
protected Map<String, String> configProperties() {
44+
Map<String, String> properties = new HashMap<>();
45+
properties.put(CodegenConstants.EXCLUDE_TESTS, Boolean.TRUE.toString());
46+
return properties;
47+
}
48+
49+
// TODO: Remove this when super.generatesCorrectDirectoryStructure() is re-enabled.
50+
@Test(description = "Verify Scala client's understanding of 'required' attributes. (disabled awaiting CI fix for integration tests classpath)", enabled = false)
51+
public void test() throws IOException {
52+
this.generatesCorrectDirectoryStructure();
53+
}
54+
}

modules/swagger-codegen/src/test/java/io/swagger/codegen/testutils/AssertFile.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.nio.file.Files;
1010
import java.nio.file.Path;
1111
import java.nio.file.attribute.BasicFileAttributes;
12+
import java.util.Arrays;
1213
import java.util.List;
1314

1415
import difflib.Delta;
@@ -56,8 +57,18 @@ public FileVisitResult preVisitDirectory(Path expectedDir, BasicFileAttributes a
5657
fail(String.format("Directory '%s' is missing.", actualDir));
5758
}
5859

59-
assertEquals(expectedDir.toFile().list(),
60-
actualDir.toFile().list(),
60+
String[] expected = expectedDir.toFile().list();
61+
String[] actual = actualDir.toFile().list();
62+
63+
if (expected != null) {
64+
Arrays.sort(expected);
65+
}
66+
if (actual != null) {
67+
Arrays.sort(actual);
68+
}
69+
70+
assertEquals(expected,
71+
actual,
6172
String.format("Directory content of '%s' and '%s' differ.", expectedDir, actualDir));
6273

6374
return FileVisitResult.CONTINUE;
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
/**
2+
* Scala Client API Integration Test
3+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4+
*
5+
* OpenAPI spec version: 1
6+
*
7+
*
8+
* NOTE: This class is auto generated by the swagger code generator program.
9+
* https://github.com/swagger-api/swagger-codegen.git
10+
* Do not edit the class manually.
11+
*/
12+
13+
package io.swagger.client.api
14+
15+
import java.text.SimpleDateFormat
16+
17+
import io.swagger.client.model.ArrayByte
18+
import java.util.Date
19+
import io.swagger.client.model.Hobby
20+
import io.swagger.client.{ApiInvoker, ApiException}
21+
22+
import com.sun.jersey.multipart.FormDataMultiPart
23+
import com.sun.jersey.multipart.file.FileDataBodyPart
24+
25+
import javax.ws.rs.core.MediaType
26+
27+
import java.io.File
28+
import java.util.Date
29+
import java.util.TimeZone
30+
31+
import scala.collection.mutable.HashMap
32+
33+
import com.wordnik.swagger.client._
34+
import scala.concurrent.Future
35+
import collection.mutable
36+
37+
import java.net.URI
38+
39+
import com.wordnik.swagger.client.ClientResponseReaders.Json4sFormatsReader._
40+
import com.wordnik.swagger.client.RequestWriters.Json4sFormatsWriter._
41+
42+
import scala.concurrent.ExecutionContext.Implicits.global
43+
import scala.concurrent._
44+
import scala.concurrent.duration._
45+
import scala.util.{Failure, Success, Try}
46+
47+
import org.json4s._
48+
49+
class HobbiesApi(
50+
val defBasePath: String = "https://localhost:8080",
51+
defApiInvoker: ApiInvoker = ApiInvoker
52+
) {
53+
private lazy val dateTimeFormatter = {
54+
val formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
55+
formatter.setTimeZone(TimeZone.getTimeZone("UTC"))
56+
formatter
57+
}
58+
private val dateFormatter = {
59+
val formatter = new SimpleDateFormat("yyyy-MM-dd")
60+
formatter.setTimeZone(TimeZone.getTimeZone("UTC"))
61+
formatter
62+
}
63+
implicit val formats = new org.json4s.DefaultFormats {
64+
override def dateFormatter = dateTimeFormatter
65+
}
66+
implicit val stringReader: ClientResponseReader[String] = ClientResponseReaders.StringReader
67+
implicit val unitReader: ClientResponseReader[Unit] = ClientResponseReaders.UnitReader
68+
implicit val jvalueReader: ClientResponseReader[JValue] = ClientResponseReaders.JValueReader
69+
implicit val jsonReader: ClientResponseReader[Nothing] = JsonFormatsReader
70+
implicit val stringWriter: RequestWriter[String] = RequestWriters.StringWriter
71+
implicit val jsonWriter: RequestWriter[Nothing] = JsonFormatsWriter
72+
73+
var basePath: String = defBasePath
74+
var apiInvoker: ApiInvoker = defApiInvoker
75+
76+
def addHeader(key: String, value: String): mutable.HashMap[String, String] = {
77+
apiInvoker.defaultHeaders += key -> value
78+
}
79+
80+
val config: SwaggerConfig = SwaggerConfig.forUrl(new URI(defBasePath))
81+
val client = new RestClient(config)
82+
val helper = new HobbiesApiAsyncHelper(client, config)
83+
84+
/**
85+
* Get hobbies
86+
* Query hobbies with some additional optional meaningless parameters
87+
*
88+
* @param s a string (optional, default to some string)
89+
* @param i an integer (optional, default to 1)
90+
* @param l a long (optional, default to 2)
91+
* @param bool a bool (optional, default to true)
92+
* @param f a float (optional, default to 0.1)
93+
* @param d a double (optional, default to 10.005)
94+
* @param datetime a date time (optional, default to 2018-01-01T08:30:00Z-04:00)
95+
* @param date a date (optional, default to 2018-01-01)
96+
* @param b a base64 encoded string (optional, default to c3dhZ2dlciBjb2RlZ2Vu)
97+
* @param bin an octet string (optional, default to DEADBEEF)
98+
* @return Hobby
99+
*/
100+
def getHobbies(s: Option[String] = Option("some string"), i: Option[Integer] = Option(1), l: Option[Long] = Option(2), bool: Option[Boolean] = Option(true), f: Option[Float] = Option(0.1), d: Option[Double] = Option(10.005), datetime: Option[Date] = Option(dateTimeFormatter.parse("2018-01-01T08:30:00Z-04:00")), date: Option[Date] = Option(dateFormatter.parse("2018-01-01")), b: Option[ArrayByte] = Option("c3dhZ2dlciBjb2RlZ2Vu".getBytes), bin: Option[ArrayByte] = Option("DEADBEEF".getBytes)): Option[Hobby] = {
101+
val await = Try(Await.result(getHobbiesAsync(s, i, l, bool, f, d, datetime, date, b, bin), Duration.Inf))
102+
await match {
103+
case Success(i) => Some(await.get)
104+
case Failure(t) => None
105+
}
106+
}
107+
108+
/**
109+
* Get hobbies asynchronously
110+
* Query hobbies with some additional optional meaningless parameters
111+
*
112+
* @param s a string (optional, default to some string)
113+
* @param i an integer (optional, default to 1)
114+
* @param l a long (optional, default to 2)
115+
* @param bool a bool (optional, default to true)
116+
* @param f a float (optional, default to 0.1)
117+
* @param d a double (optional, default to 10.005)
118+
* @param datetime a date time (optional, default to 2018-01-01T08:30:00Z-04:00)
119+
* @param date a date (optional, default to 2018-01-01)
120+
* @param b a base64 encoded string (optional, default to c3dhZ2dlciBjb2RlZ2Vu)
121+
* @param bin an octet string (optional, default to DEADBEEF)
122+
* @return Future(Hobby)
123+
*/
124+
def getHobbiesAsync(s: Option[String] = Option("some string"), i: Option[Integer] = Option(1), l: Option[Long] = Option(2), bool: Option[Boolean] = Option(true), f: Option[Float] = Option(0.1), d: Option[Double] = Option(10.005), datetime: Option[Date] = Option(dateTimeFormatter.parse("2018-01-01T08:30:00Z-04:00")), date: Option[Date] = Option(dateFormatter.parse("2018-01-01")), b: Option[ArrayByte] = Option("c3dhZ2dlciBjb2RlZ2Vu".getBytes), bin: Option[ArrayByte] = Option("DEADBEEF".getBytes)): Future[Hobby] = {
125+
helper.getHobbies(s, i, l, bool, f, d, datetime, date, b, bin)
126+
}
127+
128+
}
129+
130+
class HobbiesApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
131+
132+
def getHobbies(s: Option[String] = Option("some string"),
133+
i: Option[Integer] = Option(1),
134+
l: Option[Long] = Option(2),
135+
bool: Option[Boolean] = Option(true),
136+
f: Option[Float] = Option(0.1),
137+
d: Option[Double] = Option(10.005),
138+
datetime: Option[Date] = Option(dateTimeFormatter.parse("2018-01-01T08:30:00Z-04:00")),
139+
date: Option[Date] = Option(dateFormatter.parse("2018-01-01")),
140+
b: Option[ArrayByte] = Option("c3dhZ2dlciBjb2RlZ2Vu".getBytes),
141+
bin: Option[ArrayByte] = Option("DEADBEEF".getBytes)
142+
)(implicit reader: ClientResponseReader[Hobby]): Future[Hobby] = {
143+
// create path and map variables
144+
val path = (addFmt("/hobbies"))
145+
146+
// query params
147+
val queryParams = new mutable.HashMap[String, String]
148+
val headerParams = new mutable.HashMap[String, String]
149+
150+
s match {
151+
case Some(param) => queryParams += "s" -> param.toString
152+
case _ => queryParams
153+
}
154+
i match {
155+
case Some(param) => queryParams += "i" -> param.toString
156+
case _ => queryParams
157+
}
158+
l match {
159+
case Some(param) => queryParams += "l" -> param.toString
160+
case _ => queryParams
161+
}
162+
bool match {
163+
case Some(param) => queryParams += "bool" -> param.toString
164+
case _ => queryParams
165+
}
166+
f match {
167+
case Some(param) => queryParams += "f" -> param.toString
168+
case _ => queryParams
169+
}
170+
d match {
171+
case Some(param) => queryParams += "d" -> param.toString
172+
case _ => queryParams
173+
}
174+
datetime match {
175+
case Some(param) => queryParams += "datetime" -> param.toString
176+
case _ => queryParams
177+
}
178+
date match {
179+
case Some(param) => queryParams += "date" -> param.toString
180+
case _ => queryParams
181+
}
182+
b match {
183+
case Some(param) => queryParams += "b" -> param.toString
184+
case _ => queryParams
185+
}
186+
bin match {
187+
case Some(param) => queryParams += "bin" -> param.toString
188+
case _ => queryParams
189+
}
190+
191+
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
192+
resFuture flatMap { resp =>
193+
process(reader.read(resp))
194+
}
195+
}
196+
197+
198+
}

0 commit comments

Comments
 (0)