Added pin config builder. Closes #10
This commit is contained in:
parent
045ad0f276
commit
fc77b73399
7 changed files with 225 additions and 31 deletions
|
@ -31,6 +31,7 @@
|
|||
*/
|
||||
package net.thauvin.erik.pinboard.samples;
|
||||
|
||||
import net.thauvin.erik.pinboard.PinConfig;
|
||||
import net.thauvin.erik.pinboard.PinboardPoster;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
@ -40,7 +41,7 @@ import java.util.logging.Logger;
|
|||
|
||||
public class JavaExample {
|
||||
public static void main(String[] args) {
|
||||
final String url = "http://www.example.com/pinboard";
|
||||
final String url = "httpz://example.com/pinboard";
|
||||
final PinboardPoster poster;
|
||||
|
||||
if (args.length == 1) {
|
||||
|
@ -59,7 +60,12 @@ public class JavaExample {
|
|||
logger.setLevel(Level.FINE);
|
||||
|
||||
// Add Pin
|
||||
if (poster.addPin(url, "Testing", "Extended test", "test java")) {
|
||||
if (poster.addPin(new PinConfig.Builder()
|
||||
.url(url)
|
||||
.description("Testing")
|
||||
.extended("Extra")
|
||||
.tags("test", "java")
|
||||
.build())) {
|
||||
System.out.println("Added: " + url);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.logging.ConsoleHandler
|
|||
import java.util.logging.Level
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val url = "http://www.example.com/pinboard"
|
||||
val url = "httpz://example.com/pinboard"
|
||||
|
||||
val poster = if (args.size == 1) {
|
||||
// API Token is an argument
|
||||
|
@ -54,7 +54,7 @@ fun main(args: Array<String>) {
|
|||
}
|
||||
|
||||
// Add Pin
|
||||
if (poster.addPin(url, "Testing", "Extended test", "test kotlin")) {
|
||||
if (poster.addPin(url, "Testing", "Extended test", tags = arrayOf("test", "kotlin"))) {
|
||||
println("Added: $url")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue