{"id":15297584,"url":"https://github.com/peter-szrnka/firebase-hosting-api-java","last_synced_at":"2026-05-02T15:33:31.101Z","repository":{"id":42153658,"uuid":"323309823","full_name":"peter-szrnka/firebase-hosting-api-java","owner":"peter-szrnka","description":"A simple Java library for Firebase Hosting REST API","archived":false,"fork":false,"pushed_at":"2024-10-20T20:46:56.000Z","size":735,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T12:46:44.926Z","etag":null,"topics":["client-library","firebase","firebase-hosting","java","java8"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peter-szrnka.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":"peter-szrnka"}},"created_at":"2020-12-21T11:00:29.000Z","updated_at":"2024-10-20T20:47:00.000Z","dependencies_parsed_at":"2024-09-17T18:23:15.629Z","dependency_job_id":"a96fbd79-68a1-4340-9f08-3dbe88abf879","html_url":"https://github.com/peter-szrnka/firebase-hosting-api-java","commit_stats":null,"previous_names":["szrnka-peter/firebase-hosting-api-java"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-szrnka%2Ffirebase-hosting-api-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-szrnka%2Ffirebase-hosting-api-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-szrnka%2Ffirebase-hosting-api-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-szrnka%2Ffirebase-hosting-api-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peter-szrnka","download_url":"https://codeload.github.com/peter-szrnka/firebase-hosting-api-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245474471,"owners_count":20621415,"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","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":["client-library","firebase","firebase-hosting","java","java8"],"created_at":"2024-09-30T19:18:22.489Z","updated_at":"2026-05-02T15:33:31.074Z","avatar_url":"https://github.com/peter-szrnka.png","language":"Java","funding_links":["https://github.com/sponsors/peter-szrnka","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=7YEPKTQRNK5YA"],"categories":[],"sub_categories":[],"readme":"# firebase-hosting-api-java\nA simple Java client library for Firebase Hosting REST API (https://firebase.google.com/docs/reference/hosting/rest).\n\n**IMPORTANT: This library is compatible only with V1BETA1 services!!**\n\n## Current status\n\n| Build                                                        | Code coverage                                                | Code quality                                                 |\n| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |\n| [![CodeQL](https://github.com/peter-szrnka/firebase-hosting-api-java/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/peter-szrnka/firebase-hosting-api-java/actions/workflows/github-code-scanning/codeql) | ![Code coverage](https://sonarcloud.io/api/project_badges/measure?project=peter-szrnka_firebase-hosting-api-java\u0026metric=coverage) | [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=peter-szrnka_firebase-hosting-api-java\u0026metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=peter-szrnka_firebase-hosting-api-java) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=peter-szrnka_firebase-hosting-api-java\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=peter-szrnka_firebase-hosting-api-java) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=peter-szrnka_firebase-hosting-api-java\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=peter-szrnka_firebase-hosting-api-java) |\n\n# Used technologies\n\n- Java 17\n- Maven\n\n# Implemented services\n\n| resource name                               | Resource name                                                |\n| ------------------------------------------- | ------------------------------------------------------------ |\n| v1beta1.sites.releases.list                 | Lists all releases                                           |\n| v1beta1.sites.versions.files.list           | Lists all files relating to the given version                |\n| v1beta1.sites.versions.create               | Creates a new deployment version                             |\n| v1beta1.sites.versions.populateFiles        | Sets the files should be downloaded with the upload function |\n| v1beta1.sites.versions.uploadRequiredHashes | Uploads the required files populated by populateFiles        |\n| v1beta1.sites.versions.patch                | Finalizes a given deploymentversion                          |\n| v1beta1.sites.releases.create               | Creates a new release                                        |\n| v1beta1.sites.versions.delete               | Deletes a deployment version                                 |\n\n# Configuration\n\n## Maven\n\nAdd the following dependency to your Maven pom.xml:\n\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003eio.github.peter-szrnka\u003c/groupId\u003e\n\t\u003cartifactId\u003efirebase-hosting-api-java\u003c/artifactId\u003e\n\t\u003cversion\u003e0.9\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n**IMPORTANT: In case version \u003c 0.9, please use \"io.github.szrnka-peter\" as groupId!**\n\n## Object serializers\n\nYou have to create your own Serializer by implementing the io.github.szrnkapeter.firebase.hosting.serializer.Serializer interface. For further details, please check https://github.com/peter-szrnka/firebase-hosting-api-java/wiki/Serializers\n\n## Input parameters\n\n| Name                        | Type                                                         | Mandatory? | Description                                                  |\n| --------------------------- | ------------------------------------------------------------ | ---------- | ------------------------------------------------------------ |\n| siteId                      | String                                                       | Yes        | Unique identifier of the Firebase Hosting website            |\n| serializer                  | io.github.szrnkapeter.firebase.hosting.serializer.Serializer | Yes        | JSON serializer class                                        |\n| service account file stream | InputStream                                                  | Yes        | Firebase service account JSON file                           |\n| default connection timeout  | int (default 30000)                                          | No         | Connection timeout                                           |\n| default read timeout        | int (default 30000)                                          | No         | Read timeout                                                 |\n| httpResponseCallback        | io.github.szrnkapeter.firebase.hosting.callback.HttpResponseCallback | No         | Callback function that returns with the value of the HTTP response for the give service |\n| serviceResponseCallback     | io.github.szrnkapeter.firebase.hosting.callback.ServiceResponseCallback | No         | Callback function that returns with the value of the given service |\n| disableAsync                | boolean                                                      | No         | Async file upload can be turned off with this flag           |\n\n**IMPORTANT: If you do not set the:**\n- **httpResponseCallback**\n- **serviceResponseCallback**\n\n**parameters then you will not see any response codes or messages!**\n\n## Firebase configuration\n\u003cu\u003eDetailed guide can be found [here](https://github.com/peter-szrnka/firebase-hosting-api-java/wiki/Firebase-project-setup)\u003c/u\u003e\n\n# Usage\n\n**IMPORTANT:** Library does not catch all exceptions. The purpose of this approach is to give the control to your application instead of hiding and wrapping it.\n\n## Samples\n\nYou can find samples under \"examples\" folder!\n\n## New deployment\n\nA new deployment can be started by calling **client.createDeploy()**. The **cleanDeploy** is an important parameter that determines the new deployment should remove the existing files or not.\n\n```java\nFirebaseHostingApiConfig config = FirebaseHostingApiConfigBuilder.builder()\n\t.withServiceAccountFileStream(new FileInputStream(\"service-account-iam.json\"))\n\t.withDefaultConnectionTimeout(90000).withDefaultReadTimeout(90000)\n    .withSerializer(new GsonSerializer())\n\t.withHttpResponseCallback(new HttpResponseCallback() {\n\t\t\t\t\t\t\n\t\t@Override\n\t\tpublic void getResponseInfo(String function, int code, String responseMessage) {\n\t\t\tSystem.out.println(function + \" / \" + code + \" / \" + responseMessage);\n\t\t}\n\t})\n\t.withServiceResponseCallback(new ServiceResponseCallback() {\n\t\t\t\t\t\t\n\t\t@Override\n\t\tpublic void getResponse(String function, Object response) {\n\t\t\tSystem.out.println(function + \" / \" + response);\n\t\t}\n\t})\n\t.withSiteId(\"my-site-name\") //\n\t.build();\n\t\nFirebaseHostingApiClient client = FirebaseHostingApiClient.newClient(config);\n\t\n// COMPLETE, WORKING DEPLOYMENT\nDeployRequest request = new DeployRequest();\nrequest.setCleanDeploy(false);\nDeployItem di1 = new DeployItem();\ndi1.setName(\"test0.txt\");\ndi1.setContent(Files.readAllBytes(new File(\"test0.txt\").toPath()));\n\t\nSet\u003cDeployItem\u003e fileList = new HashSet\u003c\u003e();\nfileList.add(di1);\nrequest.setFiles(fileList);\nclient.createDeploy(request);\n```\n## Get Releases\n\n```java\nFirebaseHostingApiConfig config = FirebaseHostingApiConfigBuilder.builder()\n\t.withServiceAccountFileStream(new FileInputStream(\"service-account-iam.json\"))\n\t.withSerializer(new GsonSerializer())\n\t.withSiteId(\"my-site-name\")\n    .build();\n\nFirebaseHostingApiClient client = new FirebaseHostingApiClient(config);\n\n// Call getReleases\nGetReleasesResponse response = client.getReleases();\nSystem.out.println(\"Response = \" + response);\n\t\t\nSystem.out.println(\"\\r\\n\");\n\t\t\nGetVersionFilesResponse files = client.getVersionFiles(response.getReleases().get(0).getVersion().getName());\nSystem.out.println(\"Files response = \" + files);\n```\n\n## Custom timeouts\n\n```java\nFirebaseHostingApiConfig config = FirebaseHostingApiConfigBuilder.builder()\n\t.withServiceAccountFileStream(new FileInputStream(\"service-account-iam.json\"))\n\t.withSiteId(\"my-site-name\")\n\t.withSerializer(new GsonSerializer())\n    .withDefaultConnectionTimeout(90000)\n\t.withDefaultReadTimeout(90000)\n    .build();\n\nFirebaseHostingApiClient client = new FirebaseHostingApiClient(config);\n\n// Call getReleases\nGetReleasesResponse response = client.getReleases();\nSystem.out.println(\"Response = \" + response);\n\t\t\nSystem.out.println(\"\\r\\n\");\n\t\t\nGetVersionFilesResponse files = client.getVersionFiles(response.getReleases().get(0).getVersion().getName());\nSystem.out.println(\"Files response = \" + files);\n```\n\n## Adding response callbacks\n\nIf you need the HTTP sub service responses of createDeploy() method, you can add callbacks, which'll returns with the HTTP return codes, messages, and service response objects. In the example below, you'll get all HTTP responses, and service response objects.\n\n```java\n...\nFirebaseHostingApiConfig config = FirebaseHostingApiConfigBuilder.builder()\n...\n\t.withHttpResponseCallback(new HttpResponseCallback() {\n\t\t@Override\n\t\tpublic void getResponseInfo(String function, int code, String responseMessage) {\n\t\t\tSystem.out.println(function + \" / \" + code + \" / \" + responseMessage);\n\t\t}\n\t})\n\t...\n\t.withServiceResponseCallback(new ServiceResponseCallback() {\n\t\t\t\t\t\t\n\t\t@Override\n\t\tpublic void getResponse(String function, Object response) {\n\t\t\tSystem.out.println(function + \" / \" + response);\n\t\t}\n\t})\n```\n**Example log**\n\n```\ncreateVersion / 200 / OK\ncreateVersion / Version [name=sites/\u003csite-name\u003e/versions/\u003cversion-name\u003e, status=CREATED, config={}, labels=null, createTime=null, createUser=null, finalizeTime=null, finalizeUser=null, fileCount=null, versionBytes=null, deleteUser=null, deleteTime=null, preview=null]\npopulateFiles / 200 / OK\npopulateFiles / PopulateFilesResponse [uploadRequiredHashes=null, uploadUrl=https://upload-firebasehosting.googleapis.com/upload/sites/\u003csite-name\u003e/versions/\u003cversion-name\u003e/files]\nuploadFile / 200 / OK\nuploadFile / 200 / OK\nuploadFile / 200 / OK\nuploadFile / 200 / OK\nuploadFile / 200 / OK\nfinalizeVersion / 200 / OK\nfinalizeVersion / Version [name=sites/\u003csite-name\u003e/versions/\u003cversion-name\u003e, status=FINALIZED, config={}, labels=null, createTime=Mon Dec 28 17:20:18 CET 2020, createUser=User [email=firebase-adminsdk-to1iz@\u003csite-name\u003e.iam.gserviceaccount.com, imageUrl=null], finalizeTime=Mon Dec 28 17:20:29 CET 2020, finalizeUser=User [email=firebase-adminsdk-to1iz@\u003csite-name\u003e.iam.gserviceaccount.com, imageUrl=null], fileCount=null, versionBytes=null, deleteUser=null, deleteTime=null, preview=null]\ncreateRelease / 200 / OK\ncreateRelease / Release [name=sites/\u003csite-name\u003e/releases/\u003crelease-id\u003e, type=DEPLOY, releaseTime=Mon Dec 28 17:20:29 CET 2020, releaseUser=User [email=firebase-adminsdk-to1iz@\u003csite-name\u003e.iam.gserviceaccount.com, imageUrl=null], version=Version [name=sites/\u003csite-name\u003e/versions/\u003cversion-name\u003e, status=FINALIZED, config={}, labels=null, createTime=Mon Dec 28 17:20:18 CET 2020, createUser=User [email=firebase-adminsdk-to1iz@\u003csite-name\u003e.iam.gserviceaccount.com, imageUrl=null], finalizeTime=Mon Dec 28 17:20:29 CET 2020, finalizeUser=User [email=firebase-adminsdk-to1iz@\u003csite-name\u003e.iam.gserviceaccount.com, imageUrl=null], fileCount=null, versionBytes=null, deleteUser=null, deleteTime=null, preview={}]]\n```\n\n# Donate\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=7YEPKTQRNK5YA)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-szrnka%2Ffirebase-hosting-api-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeter-szrnka%2Ffirebase-hosting-api-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-szrnka%2Ffirebase-hosting-api-java/lists"}