Added update config builder example.

This commit is contained in:
Erik C. Thauvin 2023-01-29 14:02:01 -08:00
parent 31f5aac584
commit c2e22f84b8

View file

@ -1,10 +1,16 @@
[![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) [![Release](https://img.shields.io/github/release/ethauvin/bitly-shorten.svg)](https://github.com/ethauvin/bitly-shorten/releases/latest) [![Maven Central](https://img.shields.io/maven-central/v/net.thauvin.erik/bitly-shorten.svg?label=maven%20central)](https://search.maven.org/search?q=g:%22net.thauvin.erik%22%20AND%20a:%22bitly-shorten%22)
[![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)
[![Kotlin](https://img.shields.io/badge/kotlin-1.8.0-blue)](https://kotlinlang.org/)
[![Nexus Snapshot](https://img.shields.io/nexus/s/net.thauvin.erik/bitly-shorten?label=snapshot&server=https%3A%2F%2Foss.sonatype.org%2F)](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/bitly-shorten/)
[![Release](https://img.shields.io/github/release/ethauvin/bitly-shorten.svg)](https://github.com/ethauvin/bitly-shorten/releases/latest)
[![Maven Central](https://img.shields.io/maven-central/v/net.thauvin.erik/bitly-shorten.svg?label=maven%20central)](https://search.maven.org/search?q=g:%22net.thauvin.erik%22%20AND%20a:%22bitly-shorten%22)
[![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) [![GitHub CI](https://github.com/ethauvin/bitly-shorten/actions/workflows/gradle.yml/badge.svg)](https://github.com/ethauvin/bitly-shorten/actions/workflows/gradle.yml) [![CircleCI](https://circleci.com/gh/ethauvin/bitly-shorten/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/bitly-shorten/tree/master)
[![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)
[![GitHub CI](https://github.com/ethauvin/bitly-shorten/actions/workflows/gradle.yml/badge.svg)](https://github.com/ethauvin/bitly-shorten/actions/workflows/gradle.yml)
[![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/Android
# [Bitly](https://dev.bitly.com/v4/) Shortener for Kotlin, Java & Android
A simple implementation of the link shortening (Bitlinks) abilities of the [Bitly v4 API](https://dev.bitly.com/api-reference).
A simple implementation of the [Bitly](https://bit.ly/) link shortening (Bitlinks) [API v4](https://dev.bitly.com/api-reference).
## Examples (TL;DR)
@ -53,6 +59,7 @@ To use with [Gradle](https://gradle.org/), include the following dependency in y
```gradle
repositories {
mavenCentral()
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } // only needed for SNAPSHOT
}
dependencies {
@ -62,6 +69,19 @@ dependencies {
Instructions for using with Maven, Ivy, etc. can be found on [Maven Central](https://search.maven.org/artifact/net.thauvin.erik/bitly-shorten/0.9.3/jar).
## Java
To make it easier to use the library with Java, an update configuration builder is available:
```java
var config = new UpdateConfig.Builder()
.bitlink("https://bit.ly/380ojFd")
.title("Erik's Weblog")
.tags(new String[] { "blog", "weblog"})
.build();
bitly.bitlinks().update(config);
```
### JSON
All implemented API calls can return the full JSON responses: