Last active
July 23, 2017 19:43
-
-
Save caseykulm/b399a87e203ee58b5de1d146c485cb7f to your computer and use it in GitHub Desktop.
Reverse before
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LibOptions(config1: String, config2: String) { | |
fun toHttpUrl(): HttpUrl { | |
httpUrlBuilder = super().newBuilder() | |
httpUrlBuilder.addQueryParameter("option_1", option1) | |
httpUrlBuilder.addQueryParameter("option_2", option2) | |
return httpUrlBuilder.build() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class UserRequest(val userName) { | |
fun toOkRequest(): okhttp3.Request { | |
val libOptions = LibOptions.getInstance() | |
val requestBuilder = okhttp3.Request.Builder() | |
.addQueryParam("config_1", libOptions.getConfig1()) | |
.addQueryParam("config_2", libOptions.getConfig2()) | |
.addQueryParam("user_name", userName) | |
return requestBuilder.build() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment