@@ -40,7 +40,7 @@ private val REQUEST_ID_CHARACTERS = ('a'..'z') + ('A'..'Z') + ('0'..'9')
4040
4141class ApiClientHelper private constructor(
4242 private val apiServerDomain : ApiServerDomain ,
43- private val credentials : ApiCredentials ,
43+ private val credentials : ApiCredentials ? ,
4444 private val loggingSettings : LoggingSettings ,
4545 val httpTransport : HttpTransport ,
4646 val jsonTransformer : JsonTransformer ,
@@ -51,7 +51,7 @@ class ApiClientHelper private constructor(
5151
5252 constructor (
5353 apiServerDomain: ApiServerDomain ,
54- storeCredentials: ApiStoreCredentials ,
54+ storeCredentials: ApiStoreCredentials ? ,
5555 loggingSettings: LoggingSettings ,
5656 httpTransport: HttpTransport ,
5757 jsonTransformerProvider: JsonTransformerProvider
@@ -65,7 +65,7 @@ class ApiClientHelper private constructor(
6565
6666 constructor (
6767 apiServerDomain: ApiServerDomain ,
68- credentials: ApiCredentials ,
68+ credentials: ApiCredentials ? ,
6969 loggingSettings: LoggingSettings ,
7070 httpTransport: HttpTransport ,
7171 jsonTransformerProvider: JsonTransformerProvider
@@ -79,7 +79,7 @@ class ApiClientHelper private constructor(
7979
8080 constructor (
8181 apiServerDomain: ApiServerDomain ,
82- credentials: ApiCredentials ,
82+ credentials: ApiCredentials ? ,
8383 loggingSettings: LoggingSettings ,
8484 httpTransport: HttpTransport ,
8585 jsonTransformerProvider: JsonTransformerProvider ,
@@ -281,7 +281,11 @@ class ApiClientHelper private constructor(
281281 if (requestKind != null ) {
282282 it.withRequestKind(requestKind)
283283 } else {
284- it.withCredentials(credentials)
284+ if (credentials != null ) {
285+ it.withCredentials(credentials)
286+ } else {
287+ it
288+ }
285289 }
286290 }
287291 return when (method) {
@@ -328,7 +332,7 @@ class ApiClientHelper private constructor(
328332 val encodedPath = if (requestKind != null ) {
329333 requestKind.buildBaseEndpointPath() + " /" + buildEndpointPath(pathSegments)
330334 } else {
331- buildBaseEndpointPath(credentials) + " /" + buildEndpointPath(pathSegments)
335+ credentials?. let { buildBaseEndpointPath(it) } + " /" + buildEndpointPath(pathSegments)
332336 }
333337 return uri.toString() + encodedPath
334338 }
0 commit comments