Bitlinks

open class Bitlinks(accessToken: String)(source)

High‑level operations for creating, expanding, updating, and inspecting Bitlinks.

Each method updates lastCallResponse with the raw HTTP result, allowing callers to inspect status codes, headers, and the full response body when needed.

All operations accept either simple parameters or strongly‑typed request objects for full control over Bitly API features.

See the Bitly API for more information.

Author

Erik C. Thauvin

Since

1.0

Constructors

Link copied to clipboard
constructor(accessToken: String)

Properties

Link copied to clipboard

The most recent API call response, including status code, headers, and raw JSON body.

Functions

Link copied to clipboard
fun clicks(bitlink: String, unit: Units = Units.DAY, units: Int = -1, unitReference: String = Constants.EMPTY, toJson: Boolean = false): String

Returns the total click count for the specified Bitlink.

Link copied to clipboard
fun create(request: CreateRequest): String

Creates a new Bitlink using the provided request object.

fun create(longUrl: String, domain: String = Constants.EMPTY, groupGuid: String = Constants.EMPTY, title: String = Constants.EMPTY, tags: List<String> = emptyList(), deeplinks: List<Deeplink> = emptyList(), toJson: Boolean = false): String

Convenience overload for creating a Bitlink without a request object.

Link copied to clipboard
fun expand(bitlinkId: String, toJson: Boolean = false): String

Expands a Bitlink into its original long URL.

Link copied to clipboard
fun shorten(longUrl: String, domain: String = Constants.EMPTY, groupGuid: String = Constants.EMPTY, toJson: Boolean = false): String

Shortens a long URL using the Bitly /shorten endpoint.

Link copied to clipboard
fun update(request: UpdateRequest): String

Updates an existing Bitlink using the provided request object.

fun update(bitlink: String, title: String = Constants.EMPTY, archived: Boolean? = null, tags: List<String>? = null, deeplinks: List<Deeplink> = emptyList(), toJson: Boolean = false): String

Convenience overload for updating a Bitlink without a request object.

Link copied to clipboard
fun updateCustom(customBitlink: String, bitlinkId: String, toJson: Boolean = false): String

Moves a custom keyword to a different Bitlink.