Compare commits

..

No commits in common. "bca19736cf55a17ce707f1ced2cfa27bf2129dc7" and "9036a3223944ca60c93bf6cff75cca623bcda35b" have entirely different histories.

4 changed files with 35 additions and 24 deletions

View file

@ -1,6 +1,6 @@
bld.downloadExtensionJavadoc=false bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true bld.downloadExtensionSources=true
bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.8 bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.7
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation= bld.downloadLocation=
bld.sourceDirectories= bld.sourceDirectories=

View file

@ -1,7 +1,7 @@
bld.downloadExtensionJavadoc=false bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true bld.downloadExtensionSources=true
bld.extension.jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.5 bld.extension.jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.5
bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.8 bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.7
bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.4 bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.4
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation= bld.downloadLocation=

View file

@ -18,19 +18,19 @@
<dependency> <dependency>
<groupId>org.jetbrains.kotlin</groupId> <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId> <artifactId>kotlin-stdlib</artifactId>
<version>2.0.0</version> <version>1.9.24</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jetbrains.kotlin</groupId> <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId> <artifactId>kotlin-stdlib-common</artifactId>
<version>2.0.0</version> <version>1.9.24</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jetbrains.kotlin</groupId> <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId> <artifactId>kotlin-stdlib-jdk8</artifactId>
<version>2.0.0</version> <version>1.9.24</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View file

@ -37,17 +37,28 @@ import java.time.ZonedDateTime
* Provides a builder to add a pin. * Provides a builder to add a pin.
* *
* Supports of all the [Pinboard API Parameters](https://pinboard.in/api/#posts_add). * Supports of all the [Pinboard API Parameters](https://pinboard.in/api/#posts_add).
*
* @param url The URL of the bookmark.
* @param description The title of the bookmark.
*/ */
class PinConfig private constructor(builder: Builder) { class PinConfig @JvmOverloads constructor(
val url: String = builder.url var url: String,
val description: String = builder.description var description: String,
val extended = builder.extended var extended: String = "",
val tags = builder.tags var tags: Array<out String> = emptyArray(),
val dt = builder.dt var dt: ZonedDateTime = ZonedDateTime.now(),
val replace = builder.replace var replace: Boolean = true,
val shared = builder.shared var shared: Boolean = true,
val toRead = builder.toRead var toRead: Boolean = false
) {
constructor(builder: Builder) : this(builder.url, builder.description) {
extended = builder.extended
tags = builder.tags
dt = builder.dt
replace = builder.replace
shared = builder.shared
toRead = builder.toRead
}
/** /**
* Configures the parameters to add a pin. * Configures the parameters to add a pin.
* *
@ -65,45 +76,45 @@ class PinConfig private constructor(builder: Builder) {
/** /**
* The URL of the bookmark. * The URL of the bookmark.
*/ */
fun url(url: String): Builder = apply { this.url = url } fun url(url: String) = apply { this.url = url }
/** /**
* The title of the bookmark. * The title of the bookmark.
*/ */
fun description(description: String): Builder = apply { this.description = description } fun description(description: String) = apply { this.description = description }
/** /**
* The description of the bookmark. * The description of the bookmark.
*/ */
fun extended(extended: String): Builder = apply { this.extended = extended } fun extended(extended: String) = apply { this.extended = extended }
/** /**
* A list of up to 100 tags. * A list of up to 100 tags.
*/ */
fun tags(vararg tag: String): Builder = apply { this.tags = tag } fun tags(vararg tag: String) = apply { this.tags = tag }
/** /**
* The creation time of the bookmark. * The creation time of the bookmark.
*/ */
fun dt(datetime: ZonedDateTime): Builder = apply { this.dt = datetime } fun dt(datetime: ZonedDateTime) = apply { this.dt = datetime }
/** /**
* Replace any existing bookmark with the specified URL. Default `true`. * Replace any existing bookmark with the specified URL. Default `true`.
*/ */
fun replace(replace: Boolean): Builder = apply { this.replace = replace } fun replace(replace: Boolean) = apply { this.replace = replace }
/** /**
* Make bookmark public. Default is `true`. * Make bookmark public. Default is `true`.
*/ */
fun shared(shared: Boolean): Builder = apply { this.shared = shared } fun shared(shared: Boolean) = apply { this.shared = shared }
/** /**
* Mark the bookmark as unread. Default is `false`. * Mark the bookmark as unread. Default is `false`.
*/ */
fun toRead(toRead: Boolean): Builder = apply { this.toRead = toRead } fun toRead(toRead: Boolean) = apply { this.toRead = toRead }
/** /**
* Builds a new configuration. * Builds a new comment configuration.
*/ */
fun build() = PinConfig(this) fun build() = PinConfig(this)