{"id":19335069,"url":"https://github.com/sasa-b/hetznerkloud","last_synced_at":"2025-08-02T14:06:59.383Z","repository":{"id":260969334,"uuid":"881969724","full_name":"sasa-b/hetznerkloud","owner":"sasa-b","description":"Hetzner Cloud API Kotlin library","archived":false,"fork":false,"pushed_at":"2025-03-26T13:15:30.000Z","size":384,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-22T17:56:24.112Z","etag":null,"topics":["hcloud","hetzner","hetzner-api","hetzner-cloud","kotlin","library"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sasa-b.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-01T15:48:22.000Z","updated_at":"2025-03-26T13:09:06.000Z","dependencies_parsed_at":"2024-12-06T00:22:16.154Z","dependency_job_id":"cd46fa4a-4bb1-4906-b341-3ae78c050681","html_url":"https://github.com/sasa-b/hetznerkloud","commit_stats":null,"previous_names":["sasa-b/hetznerkloud"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/sasa-b/hetznerkloud","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasa-b%2Fhetznerkloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasa-b%2Fhetznerkloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasa-b%2Fhetznerkloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasa-b%2Fhetznerkloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sasa-b","download_url":"https://codeload.github.com/sasa-b/hetznerkloud/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasa-b%2Fhetznerkloud/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268401594,"owners_count":24244464,"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-02T02:00:12.353Z","response_time":74,"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":["hcloud","hetzner","hetzner-api","hetzner-cloud","kotlin","library"],"created_at":"2024-11-10T03:04:46.590Z","updated_at":"2025-08-02T14:06:59.327Z","avatar_url":"https://github.com/sasa-b.png","language":"Kotlin","funding_links":[],"categories":["Libraries"],"sub_categories":["Kotlin"],"readme":"# Getting Started\n\n## Installing the package\n\nAdd to `build.gradle.kt` dependencies block.\n\n```Kotlin\ndependencies {\n    implementation(\"tech.s-co.hetznerkloud:0.1.+\")\n    // or if you always want the latest version\n    implementation(\"tech.s-co.hetznerkloud:latest.release\")\n}\n```\n\n## Usage\n```kotlin\nimport tech.sco.hetznerkloud.CloudApiClient\nimport tech.sco.hetznerkloud.ApiToken\nimport tech.sco.hetznerkloud.request.FilterFields\nimport tech.sco.hetznerkloud.request.SortingFields\nimport tech.sco.hetznerkloud.request.SortingDirection\n\nfun main() {\n    \n    runBlocking {\n        val apiToken = ApiToken.load(Path(\"/some/path/token.txt\"))\n\n        val client = CloudApiClient(apiToken)\n        \n        client.servers.all(\n            filter = setOf(Pair(FilterFields.Server.STATUS, \"running\")), \n            sorting = setOf(Pair(SortingFields.Server.CREATED, SortingDirection.DESC))\n        ).map {\n            println(\"Id: ${it.id}\")\n            println(\"Name: ${it.name}\")\n        }\n    }\n}\n\n```\n\n## Error handling\nYou can find all the various errors in the `src/kotlin/tech/sco/hetznerkloud/model/Error.kt` file.\n\nAll errors are wrapped in the `Failure` throwable object which will also hold the request object that caused the error, that should help you in debugging potential issues.\n\n```Kotlin\nimport tech.sco.hetznerkloud.CloudApiClient\nimport tech.sco.hetznerkloud.ApiToken\nimport tech.sco.hetznerkloud.request.CreateSSHKey\n\nfun main() {\n    \n    runBlocking {\n        val apiToken = ApiToken.load(Path(\"/some/path/token.txt\"))\n\n        val client = CloudApiClient(apiToken)\n\n        try {\n            client.sshKeys.create(CreateSSHKey(name = \"login key\", labels = emptyMap()))\n        } catch (f: Failure) {\n            when {\n                f.error is UnauthorizedError -\u003e println(f.request!!.headers)\n            }\n        }\n        \n    }\n}\n```\n\n## Ktor client plugins\nYou can extend the behaviour of the Ktor client used under the hood by adding official or custom plugins.\n\nBy default, the following ones are installed and used by this library:\n* Auth\n* Content Negotiation\n* Kotlinx Serialization\n\nFor example let's add retry behaviour with a plugin:\n```kotlin\nval client = CloudApiClient(ApiToken(\"xxx-xxx-xxx\")) {\n    install(HttpRequestRetry) {\n        retryOnServerErrors(maxRetries = 5)\n    }\n}\n```\n\n# Contributing\n\n## Running integration tests\n\nYou need to provide a Hetzner API token either in an env variable `API_TEST_TOKEN=` or in a file `src/test/resources/token.txt`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsasa-b%2Fhetznerkloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsasa-b%2Fhetznerkloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsasa-b%2Fhetznerkloud/lists"}