Added EMPTY_JSON constant.
This commit is contained in:
parent
0f3315905d
commit
98fec5a987
4 changed files with 8 additions and 5 deletions
|
@ -6,6 +6,7 @@
|
|||
<ID>FunctionParameterNaming:Bitlinks.kt$Bitlinks$bitlink_id: String</ID>
|
||||
<ID>FunctionParameterNaming:Bitlinks.kt$Bitlinks$group_guid: String = Constants.EMPTY</ID>
|
||||
<ID>FunctionParameterNaming:Bitlinks.kt$Bitlinks$long_url: String</ID>
|
||||
<ID>FunctionParameterNaming:Bitlinks.kt$Bitlinks.Clicks$unit_reference: String = Constants.EMPTY</ID>
|
||||
<ID>NestedBlockDepth:Utils.kt$Utils.Companion$call</ID>
|
||||
<ID>NestedBlockDepth:Utils.kt$Utils.Companion$parseBody</ID>
|
||||
</Whitelist>
|
||||
|
|
|
@ -51,7 +51,7 @@ open class Bitlinks(val accessToken: String) {
|
|||
unit_reference: String = Constants.EMPTY,
|
||||
isJson: Boolean = false
|
||||
): String {
|
||||
var clicks = if (isJson) "{}" else Constants.EMPTY
|
||||
var clicks = if (isJson) Constants.EMPTY_JSON else Constants.EMPTY
|
||||
if (bitlink.isNotBlank()) {
|
||||
val response = Utils.call(
|
||||
accessToken,
|
||||
|
@ -81,7 +81,7 @@ open class Bitlinks(val accessToken: String) {
|
|||
*/
|
||||
@JvmOverloads
|
||||
fun expand(bitlink_id: String, isJson: Boolean = false): String {
|
||||
var longUrl = if (isJson) "{}" else Constants.EMPTY
|
||||
var longUrl = if (isJson) Constants.EMPTY_JSON else Constants.EMPTY
|
||||
if (bitlink_id.isNotBlank()) {
|
||||
val response = Utils.call(
|
||||
accessToken,
|
||||
|
@ -140,7 +140,7 @@ open class Bitlinks(val accessToken: String) {
|
|||
domain: String = Constants.EMPTY,
|
||||
isJson: Boolean = false
|
||||
): String {
|
||||
var bitlink = if (isJson) "{}" else long_url
|
||||
var bitlink = if (isJson) Constants.EMPTY_JSON else long_url
|
||||
if (!Utils.validateUrl(long_url)) {
|
||||
Utils.logger.severe("Please specify a valid URL to shorten.")
|
||||
} else {
|
||||
|
|
|
@ -43,5 +43,8 @@ open class Constants private constructor() {
|
|||
|
||||
/** Empty String **/
|
||||
const val EMPTY = ""
|
||||
|
||||
/** Empty JSON Object **/
|
||||
const val EMPTY_JSON = "{}"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
|||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.RequestBody.Companion.create
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import okhttp3.Response
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue