Compare commits
No commits in common. "30a3e9022d52e087ed814015ca588393826e9f8b" and "fcf4f437e0e9c56291f1d8cf28c2a98360325c50" have entirely different histories.
30a3e9022d
...
fcf4f437e0
7 changed files with 56 additions and 33 deletions
5
.idea/misc.xml
generated
5
.idea/misc.xml
generated
|
@ -8,7 +8,10 @@
|
||||||
<pattern value="net.thauvin.erik.bitly.BitlyShortenBuild" method="detekt" />
|
<pattern value="net.thauvin.erik.bitly.BitlyShortenBuild" method="detekt" />
|
||||||
<pattern value="net.thauvin.erik.bitly.BitlyShortenBuild" method="detektBaseline" />
|
<pattern value="net.thauvin.erik.bitly.BitlyShortenBuild" method="detektBaseline" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="PDMPlugin">
|
||||||
|
<option name="skipTestSources" value="false" />
|
||||||
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build" />
|
<output url="file://$PROJECT_DIR$/build" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -1,3 +1,5 @@
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("application")
|
id("application")
|
||||||
id("com.github.ben-manes.versions") version "0.51.0"
|
id("com.github.ben-manes.versions") version "0.51.0"
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
* in the user manual at https://docs.gradle.org/6.2/userguide/multi_project_builds.html
|
* in the user manual at https://docs.gradle.org/6.2/userguide/multi_project_builds.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rootProject.name = "bitly-examples-gradle"
|
rootProject.name = "bitly-examples"
|
||||||
|
|
|
@ -40,14 +40,23 @@ import net.thauvin.erik.bitly.config.deeplinks.CreateDeeplinks
|
||||||
* See the [Bit.ly API](https://dev.bitly.com/api-reference#createFullBitlink) for more information.
|
* See the [Bit.ly API](https://dev.bitly.com/api-reference#createFullBitlink) for more information.
|
||||||
*/
|
*/
|
||||||
@Suppress("LocalVariableName", "PropertyName")
|
@Suppress("LocalVariableName", "PropertyName")
|
||||||
class CreateConfig private constructor(builder: Builder) {
|
class CreateConfig @JvmOverloads constructor(
|
||||||
val long_url = builder.long_url
|
var long_url: String,
|
||||||
val domain = builder.domain
|
var domain: String = Constants.EMPTY,
|
||||||
val group_guid = builder.group_guid
|
var group_guid: String = Constants.EMPTY,
|
||||||
val title = builder.title
|
var title: String = Constants.EMPTY,
|
||||||
val tags = builder.tags
|
var tags: Array<String> = emptyArray(),
|
||||||
val deeplinks = builder.deeplinks
|
var deeplinks: CreateDeeplinks = CreateDeeplinks(),
|
||||||
val toJson = builder.toJson
|
var toJson: Boolean = false
|
||||||
|
) {
|
||||||
|
constructor(builder: Builder) : this(builder.long_url) {
|
||||||
|
domain = builder.domain
|
||||||
|
group_guid = builder.group_guid
|
||||||
|
title = builder.title
|
||||||
|
tags = builder.tags
|
||||||
|
deeplinks = builder.deeplinks
|
||||||
|
toJson = builder.toJson
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the creation parameters of a Bitlink.
|
* Configures the creation parameters of a Bitlink.
|
||||||
|
|
|
@ -39,13 +39,21 @@ import net.thauvin.erik.bitly.config.deeplinks.UpdateDeeplinks
|
||||||
*
|
*
|
||||||
* See the [Bit.ly API](https://dev.bitly.com/api-reference#updateBitlink) for more information.
|
* See the [Bit.ly API](https://dev.bitly.com/api-reference#updateBitlink) for more information.
|
||||||
*/
|
*/
|
||||||
class UpdateConfig private constructor(builder: Builder) {
|
class UpdateConfig @JvmOverloads constructor(
|
||||||
val bitlink = builder.bitlink
|
var bitlink: String,
|
||||||
val title = builder.title
|
var title: String = Constants.EMPTY,
|
||||||
val archived = builder.archived
|
var archived: Boolean = false,
|
||||||
val tags = builder.tags
|
var tags: Array<String> = emptyArray(),
|
||||||
val deeplinks = builder.deeplinks
|
var deeplinks: UpdateDeeplinks = UpdateDeeplinks(),
|
||||||
val toJson = builder.toJson
|
var toJson: Boolean = false
|
||||||
|
) {
|
||||||
|
constructor(builder: Builder) : this(builder.bitlink) {
|
||||||
|
title = builder.title
|
||||||
|
archived = builder.archived
|
||||||
|
tags = builder.tags
|
||||||
|
deeplinks = builder.deeplinks
|
||||||
|
toJson = builder.toJson
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the update parameters of a Bitlink.
|
* Configures the update parameters of a Bitlink.
|
||||||
|
|
|
@ -41,9 +41,9 @@ import net.thauvin.erik.bitly.Utils.toEndPoint
|
||||||
import net.thauvin.erik.bitly.config.CreateConfig
|
import net.thauvin.erik.bitly.config.CreateConfig
|
||||||
import net.thauvin.erik.bitly.config.UpdateConfig
|
import net.thauvin.erik.bitly.config.UpdateConfig
|
||||||
import net.thauvin.erik.bitly.config.deeplinks.CreateDeeplinks
|
import net.thauvin.erik.bitly.config.deeplinks.CreateDeeplinks
|
||||||
import net.thauvin.erik.bitly.config.deeplinks.UpdateDeeplinks
|
|
||||||
import net.thauvin.erik.bitly.config.deeplinks.enums.InstallType
|
import net.thauvin.erik.bitly.config.deeplinks.enums.InstallType
|
||||||
import net.thauvin.erik.bitly.config.deeplinks.enums.Os
|
import net.thauvin.erik.bitly.config.deeplinks.enums.Os
|
||||||
|
import net.thauvin.erik.bitly.config.deeplinks.UpdateDeeplinks
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.BeforeAll
|
import org.junit.jupiter.api.BeforeAll
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
|
@ -34,9 +34,9 @@ package net.thauvin.erik.bitly.config
|
||||||
import assertk.assertThat
|
import assertk.assertThat
|
||||||
import assertk.assertions.isEqualTo
|
import assertk.assertions.isEqualTo
|
||||||
import net.thauvin.erik.bitly.config.deeplinks.CreateDeeplinks
|
import net.thauvin.erik.bitly.config.deeplinks.CreateDeeplinks
|
||||||
import net.thauvin.erik.bitly.config.deeplinks.UpdateDeeplinks
|
|
||||||
import net.thauvin.erik.bitly.config.deeplinks.enums.InstallType
|
import net.thauvin.erik.bitly.config.deeplinks.enums.InstallType
|
||||||
import net.thauvin.erik.bitly.config.deeplinks.enums.Os
|
import net.thauvin.erik.bitly.config.deeplinks.enums.Os
|
||||||
|
import net.thauvin.erik.bitly.config.deeplinks.UpdateDeeplinks
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
|
@ -48,13 +48,14 @@ class ConfigTest {
|
||||||
install_type(InstallType.AUTO_INSTALL)
|
install_type(InstallType.AUTO_INSTALL)
|
||||||
}
|
}
|
||||||
|
|
||||||
val config = CreateConfig.Builder("long_url")
|
val config = CreateConfig(
|
||||||
.domain("domain")
|
"long_url",
|
||||||
.groupGuid("group_guid")
|
"domain",
|
||||||
.title("title")
|
"group_guid",
|
||||||
.tags(arrayOf("tag", "tag2"))
|
"title",
|
||||||
.deeplinks(deeplinks)
|
arrayOf("tag", "tag2"),
|
||||||
.build()
|
deeplinks,
|
||||||
|
)
|
||||||
|
|
||||||
val map = mapOf(
|
val map = mapOf(
|
||||||
"long_url" to config.long_url,
|
"long_url" to config.long_url,
|
||||||
|
@ -80,13 +81,13 @@ class ConfigTest {
|
||||||
app_guid("app_guid")
|
app_guid("app_guid")
|
||||||
}
|
}
|
||||||
|
|
||||||
val config = UpdateConfig.Builder("blink")
|
val config = UpdateConfig(
|
||||||
.title("title")
|
"blink",
|
||||||
.archived(true)
|
"title",
|
||||||
.tags(arrayOf("tag", "tag2"))
|
true,
|
||||||
.deeplinks(deeplinks)
|
arrayOf("tag", "tag2"),
|
||||||
.build()
|
deeplinks
|
||||||
|
)
|
||||||
val map = mapOf(
|
val map = mapOf(
|
||||||
"bitlink" to config.bitlink,
|
"bitlink" to config.bitlink,
|
||||||
"title" to config.title,
|
"title" to config.title,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue