Pinboard Poster for Kotlin/Java https://github.com/ethauvin/pinboard-poster
Find a file
2017-05-17 18:13:54 -07:00
.idea IDEA files updates. 2017-05-17 11:49:20 -07:00
kobalt Improved logging. 2017-05-17 18:13:54 -07:00
lib Initial commit. 2017-05-17 00:41:35 -07:00
src/main Improved logging. 2017-05-17 18:13:54 -07:00
.gitattributes Initial commit. 2017-05-17 00:41:35 -07:00
.gitignore Initial commit. 2017-05-17 00:41:35 -07:00
.travis.yml Initial commit. 2017-05-17 00:41:35 -07:00
kobaltw Initial commit. 2017-05-17 00:41:35 -07:00
kobaltw.bat Initial commit. 2017-05-17 00:41:35 -07:00
pinboard-poster.iml IDEA files updates. 2017-05-17 11:49:20 -07:00
pom.xml Improved logging. 2017-05-17 18:13:54 -07:00
README.md Improved logging. 2017-05-17 18:13:54 -07:00

Pinboard Poster for Kotlin/Java

License (3-Clause BSD) Build Status Dependency Status Download

A small Kotlin/Java library for posting to Pinboard.

Examples

Kotlin


val poster = PinboardPoster("user:TOKEN")

poster.addPin("http://www.example.com/foo", "This is a test")
poster.deletePin("http:///www.example.com/bar")

View Example

Java


final PinboardPoster poster = new PinBboardPoster("user:TOKEN");

poster.addPin("http://www.example.com/foo", "This is a test");
poster.deletePin("http:///www.example.com/bar");

View Example

Your API authentication token is available on the Pinboard settings page.

Usage with Maven, Gradle and Kobalt

Maven

To install and run from Maven, configure an artifact as follows:

<dependency>
    <groupId>net.thauvin.erik</groupId>
    <artifactId>pinboard-poster</artifactId>
    <version>0.9.1</version>
</dependency>

Gradle

To install and run from Gradle, add the following to the build.gradle file:

dependencies {
    compileOnly 'net.thauvin.erik:pinboard-poster:0.9.1'
}

Kobalt

To install and run from Kobalt, add the following to the Build.kt file:

dependencies {
    compile("net.thauvin.erik:pinboard-poster:0.9.1")
}

Adding

The addPin function support all of the Pinboard API parameters:

poster.addPin(url = "http://www.example.com",
              description = "This is the title.",
              extended = "This is the extended description.",
              tags = "tag1 tag2 tag3",
              dt = "2010-12-11T19:48:02Z",
              replace = true,
              shared = true,
              toRead = false)

url and description are required.

It returns true if the bookmark was added successfully, false otherwise.

Deleting

The deletePin function support all of the Pinboard API parameters:

poster.deletePin(url = "http://www.example.com/")

It returns true if the bookmark was deleted successfully, false otherwise.

Logging

The library used java.util.logging to log errors. Logging can be configured as follows:

Kotlin

with(poster.logger) {
    addHandler(ConsoleHandler().apply { level = Level.FINE })
    level = Level.FINE
}

Java

final ConsoleHandler consoleHandler = new ConsoleHandler();
consoleHandler.setLevel(Level.FINE);
final Logger logger = poster.getLogger();
logger.addHandler(consoleHandler);
logger.setLevel(Level.FINE);

or using a property file.

API End Point

The API end point is automatically configured to https://api.pinboard.in/v1/. Since Pinboard uses the del.ico.us API, the library could potentially be used with another compatible service. To configure the API end point, use:

poster.apiEndPoint = "https://www.example.com/v1"