Implemented examples.
This commit is contained in:
parent
42348476f6
commit
5c64d4b30e
3 changed files with 26 additions and 6 deletions
|
@ -4,7 +4,18 @@ import net.thauvin.erik.bitly.Bitly;
|
|||
|
||||
public class BitlySample {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(new Bitly("YOUR_API_KEY").bitlinks().shorten("https://erik.thauvin.net/blog"));
|
||||
final Bitly bitly = new Bitly(/* "YOUR_API_TOKEN from https://bitly.is/accesstoken" */);
|
||||
if (args.length > 0) {
|
||||
for (final String arg : args) {
|
||||
if (arg.contains("bit.ly")) {
|
||||
System.out.println(arg + " <-- " + bitly.bitlinks().expand(arg));
|
||||
} else {
|
||||
System.out.println(arg + " --> " + bitly.bitlinks().shorten(arg));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.err.println("Try specifying one or more URLs as arguments.");
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue