Fixed examples and docs.

This commit is contained in:
Erik C. Thauvin 2020-03-21 22:59:24 -07:00
parent 8138a23bc5
commit 0f08c131c6
3 changed files with 11 additions and 11 deletions

View file

@ -1,7 +1,7 @@
[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause)
[![Known Vulnerabilities](https://snyk.io/test/github/ethauvin/bitly-shorten/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/ethauvin/bitly-shorten?targetFile=pom.xml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_bitly-shorten&metric=alert_status)](https://sonarcloud.io/dashboard?id=ethauvin_bitly-shorten) [![Build Status](https://travis-ci.org/ethauvin/bitly-shorten.svg?branch=master)](https://travis-ci.org/ethauvin/bitly-shorten) [![CircleCI](https://circleci.com/gh/ethauvin/bitly-shorten/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/bitly-shorten/tree/master)
[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://opensource.org/licenses/BSD-3-Clause)
[![Known Vulnerabilities](https://snyk.io/test/github/ethauvin/bitly-shorten/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/ethauvin/bitly-shorten?targetFile=pom.xml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_bitly-shorten&metric=alert_status)](https://sonarcloud.io/dashboard?id=ethauvin_bitly-shorten) [![Build Status](https://travis-ci.com/ethauvin/bitly-shorten.svg?branch=master)](https://travis-ci.com/ethauvin/bitly-shorten) [![CircleCI](https://circleci.com/gh/ethauvin/bitly-shorten/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/bitly-shorten/tree/master)
# [Bitly](https://dev.bitly.com/v4/) Shortener for Kotlin/Java.
# [Bitly](https://dev.bitly.com/v4/) Shortener for Kotlin/Java
A simple implementation of the link shortening ([bitlinks](https://dev.bitly.com/v4/#tag/Bitlinks)) abilities of the [Bitly v4 API](https://dev.bitly.com/v4).
@ -14,16 +14,16 @@ val bitly = Bitly(/* "YOUR_API_ACCESS_TOKEN from https://bitly.is/accesstoken" *
bitly.bitlinks().shorten("https://erik.thauvin.net/blog")
// Expand
bitly.bitlinks().expand("http://bit.ly/380ojFd")
bitly.bitlinks().expand("https://bit.ly/380ojFd")
// Clicks Summary
bitly.bitlinks().clicks("http://bit.ly/380ojFd")
bitly.bitlinks().clicks("https://bit.ly/380ojFd")
// Create a bitlink
bitly.bitlinks().create(title = "Erik's Weblog", long_url = "http://erik.thauvin.net/blog/")
bitly.bitlinks().create(title = "Erik's Weblog", long_url = "https://erik.thauvin.net/blog/")
// Update a bitlink
bitly.bitlinks().update("http://bit.ly/380ojFd", title="Erik's Weblog", tags = arrayOf("blog", "weblog"))
bitly.bitlinks().update("https://bit.ly/380ojFd", title="Erik's Weblog", tags = arrayOf("blog", "weblog"))
```
- View [Kotlin](https://github.com/ethauvin/bitly-shorten/blob/master/examples/src/main/kotlin/com/example/BitlyExample.kt) or [Java](https://github.com/ethauvin/bitly-shorten/blob/master/examples/src/main/java/com/example/BitlySample.java) Examples.
@ -55,7 +55,7 @@ bitly.bitlinks().shorten("https://www.erik.thauvin.net/blog", toJson = true)
```json
{
"created_at": "2020-02-26T06:50:08+0000",
"link": "http://bit.ly/380ojFd",
"link": "https://bit.ly/380ojFd",
"id": "bit.ly/380ojFd",
"long_url": "https://erik.thauvin.net/blog"
}

View file

@ -2,8 +2,8 @@ package com.example;
import net.thauvin.erik.bitly.Bitly;
public class BitlySample {
public static void main(String[] args) {
public final class BitlySample {
public static void main(final String[] args) {
if (args.length > 0) {
final Bitly bitly = new Bitly(/* "YOUR_API_TOKEN from https://bitly.is/accesstoken" */);
for (final String arg : args) {

View file

@ -52,7 +52,7 @@ class BitlyTest {
}
}
private val longUrl = "https://erik.thauvin.net/blog"
private val shortUrl = "http://bit.ly/380ojFd"
private val shortUrl = "https://bit.ly/380ojFd"
@Before
fun before() {