{"id":27876904,"url":"https://github.com/ethauvin/bitly-shorten","last_synced_at":"2025-08-16T11:09:04.820Z","repository":{"id":37988055,"uuid":"243108332","full_name":"ethauvin/bitly-shorten","owner":"ethauvin","description":"Bitly Shortener for Kotlin, Java \u0026 Android","archived":false,"fork":false,"pushed_at":"2025-06-30T23:45:44.000Z","size":1875,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-01T00:33:39.204Z","etag":null,"topics":["android","bitlink","bitlinks","bitly","bitly-api","bitly-v4","java","kotlin","library","shorten","shorten-urls","shortener","shortener-rest","shortener-service","shortens-links","shorturl","url-shortener"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethauvin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-02-25T21:41:04.000Z","updated_at":"2025-06-30T23:45:47.000Z","dependencies_parsed_at":"2023-02-16T17:01:20.272Z","dependency_job_id":"37590f31-b77e-4310-ac0d-2a2a7058d994","html_url":"https://github.com/ethauvin/bitly-shorten","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/ethauvin/bitly-shorten","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethauvin%2Fbitly-shorten","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethauvin%2Fbitly-shorten/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethauvin%2Fbitly-shorten/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethauvin%2Fbitly-shorten/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethauvin","download_url":"https://codeload.github.com/ethauvin/bitly-shorten/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethauvin%2Fbitly-shorten/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270702562,"owners_count":24630877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","bitlink","bitlinks","bitly","bitly-api","bitly-v4","java","kotlin","library","shorten","shorten-urls","shortener","shortener-rest","shortener-service","shortens-links","shorturl","url-shortener"],"created_at":"2025-05-05T02:53:45.076Z","updated_at":"2025-08-16T11:09:04.807Z","avatar_url":"https://github.com/ethauvin.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![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)\n[![Kotlin](https://img.shields.io/badge/kotlin-2.2.0-7f52ff)](https://kotlinlang.org/)\n[![bld](https://img.shields.io/badge/2.3.0-FA9052?label=bld\u0026labelColor=2392FF)](https://rife2.com/bld)\n[![Release](https://img.shields.io/github/release/ethauvin/bitly-shorten.svg)](https://github.com/ethauvin/bitly-shorten/releases/latest)\n[![Maven Central](https://img.shields.io/maven-central/v/net.thauvin.erik/bitly-shorten.svg?color=blue)](https://central.sonatype.com/artifact/net.thauvin.erik/bitly-shorten)\n[![Maven metadata URL](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fcentral.sonatype.com%2Frepository%2Fmaven-snapshots%2Fnet%2Fthauvin%2Ferik%2Fbitly-shorten%2Fmaven-metadata.xml\u0026label=snapshot)](https://github.com/ethauvin/bitly-shorten/packages/2260734/versions)\n\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_bitly-shorten\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=ethauvin_bitly-shorten)\n[![GitHub CI](https://github.com/ethauvin/bitly-shorten/actions/workflows/bld.yml/badge.svg)](https://github.com/ethauvin/bitly-shorten/actions/workflows/bld.yml)\n[![CircleCI](https://circleci.com/gh/ethauvin/bitly-shorten/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/bitly-shorten/tree/master)\n\n# [Bitly](https://dev.bitly.com/v4/) Shortener for Kotlin, Java \u0026 Android\n\nA simple implementation of the [Bitly](https://bit.ly/) link shortening (Bitlinks) [API v4](https://dev.bitly.com/api-reference).\n\n## Examples (TL;DR)\n\n```kotlin\nval bitly = Bitly(/* \"YOUR_API_ACCESS_TOKEN from https://bitly.is/accesstoken\" */)\n\n// Shorten\nbitly.bitlinks().shorten(\"https://erik.thauvin.net/blog\")\n\n// Expand\nbitly.bitlinks().expand(\"https://bit.ly/380ojFd\")\n\n// Clicks Summary\nbitly.bitlinks().clicks(\"https://bit.ly/380ojFd\")\n\n// Create a bitlink\nbitly.bitlinks().create(title=\"Erik's Weblog\", long_url = \"https://erik.thauvin.net/blog/\")\n\n// Update a bitlink\nbitly.bitlinks().update(\"https://bit.ly/380ojFd\", title = \"Erik's Weblog\", tags = arrayOf(\"blog\", \"weblog\"))\n```\n\n- View [bld](https://github.com/ethauvin/bitly-shorten/blob/master/examples/bld) or [Gradle](https://github.com/ethauvin/bitly-shorten/blob/master/examples/gradle) Examples.\n\n## API Access Token\n\nThe Bitly API [Access Token](https://bitly.is/accesstoken) can be specified directly as well as via the `BITLY_ACCESS_TOKEN` environment variable or properties key.\n\n```kotlin\n// Env Variable or System Property\nval bitly = Bitly()\n\n// Properties file path\nval bitly = Bitly(File(\"my.properties\"))\n\n```\n\n```ini\n# my.properties\nBITLY_ACCESS_TOKEN=abc123def456ghi789jkl0\n```\n\n## bld\n\nTo use with [bld](https://rife2.com/bld), include the following dependency in your [build](https://github.com/ethauvin/bitly-shorten/blob/master/examples/bld/src/bld/java/com/example/ExampleBuild.java) file:\n\n```java\nrepositories = List.of(MAVEN_CENTRAL, CENTRAL_SNAPSHOTS);\n\nscope(compile)\n    .include(dependency(\"net.thauvin.erik:bitly-shorten:2.0.0\"));\n```\n\nBe sure to use the [bld Kotlin extension](https://github.com/rife2/bld-kotlin) in your project.\n\n## Gradle, Maven, etc…\n\nTo use with [Gradle](https://gradle.org/), include the following dependency in your [build](https://github.com/ethauvin/bitly-shorten/blob/master/examples/gradle/build.gradle.kts) file:\n\n```gradle\nrepositories {\n    maven {\n        name = 'Central Portal Snapshots'\n        url = 'https://central.sonatype.com/repository/maven-snapshots/'\n    }\n    mavenCentral()\n}\n\ndependencies {\n    implementation(\"net.thauvin.erik:bitly-shorten:2.0.0\")\n}\n```\n\nInstructions for using with Maven, Ivy, etc. can be found on [Maven Central](https://central.sonatype.com/artifact/net.thauvin.erik/bitly-shorten).\n\n## Java\n\nTo make it easier to use the library with Java, configuration builders are available:\n\n```java\nvar config = new CreateConfig.Builder(\"https://erik.thauvin.net/blog\")\n        .title(\"Erik's Weblog\")\n        .tags(new String[] { \"blog\", \"weblog\"})\n        .build();\n\nbitly.bitlinks().create(config);\n```\n\n```java\nvar config = new UpdateConfig.Builder(\"https://bit.ly/380ojFd\")\n        .title(\"Erik's Weblog\")\n        .tags(new String[] { \"blog\", \"weblog\"})\n        .build();\n\nbitly.bitlinks().update(config);\n```\n\n## JSON\n\nAll implemented API calls can return the full JSON responses:\n\n```kotlin\nbitly.bitlinks().shorten(\"https://www.erik.thauvin.net/blog\", toJson = true)\n```\n\n```json\n{\n    \"created_at\": \"2020-02-26T06:50:08+0000\",\n    \"link\": \"https://bit.ly/380ojFd\",\n    \"id\": \"bit.ly/380ojFd\",\n    \"long_url\": \"https://erik.thauvin.net/blog\"\n}\n```\n\n## API Response \u0026 Endpoints\n\nYou can also access the last response from implemented API calls using:\n\n```kotlin\nval bitlinks = Bitlinks(apikey)\nval shortUrl = bitlinks.shorten(longUrl)\nval response = bitlinks.lastCallResponse\n\nif (response.isSuccessful) {\n    println(response.body)\n} else {\n    println(\"${response.message}: ${response.description} (${response.statusCode})\")\n}\n```\n\nNon-implemented API endpoints can also be called directly:\n\n```kotlin\nval response = bitly.call(\"/user\", method = Methods.GET)\nif (response.isSuccessful) {\n    println(response.body)\n}\n```\n\n```json\n{\n    \"created\": \"2009-06-12T19:00:45+0000\",\n    \"modified\": \"2016-11-11T19:50:33+0000\",\n    \"login\": \"johndoe\",\n    \"is_active\": true,\n    \"is_2fa_enabled\": true,\n    \"name\": \"John Doe\",\n    \"emails\": [\n        {\n            \"email\": \"john@doe.com\",\n            \"is_primary\": true,\n            \"is_verified\": true\n        }\n    ],\n    \"is_sso_user\": false,\n    \"default_group_guid\": \"ABCde1f23gh\"\n}\n```\n\n- View [Example](https://github.com/ethauvin/bitly-shorten/blob/master/examples/bld/src/main/kotlin/com/example/BitlyRetrieve.kt)\n\n## Contributing\n\nIf you want to contribute to this project, all you have to do is clone the GitHub\nrepository:\n\n```console\ngit clone git@github.com:ethauvin/bitly-shorten.git\n```\n\nThen use [bld](https://rife2.com/bld) to build:\n\n```console\ncd bitly-shorten\n./bld compile\n```\n\nThe project has an [IntelliJ IDEA](https://www.jetbrains.com/idea/) project structure. You can just open it after all\nthe dependencies were downloaded and peruse the code.\n\n## More…\n\nIf all else fails, there's always more [Documentation](https://ethauvin.github.io/bitly-shorten/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethauvin%2Fbitly-shorten","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethauvin%2Fbitly-shorten","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethauvin%2Fbitly-shorten/lists"}