{"id":14960651,"url":"https://github.com/edricwilliem/unity-firebase-realtime-database","last_synced_at":"2025-05-02T13:30:27.146Z","repository":{"id":43494889,"uuid":"194699981","full_name":"edricwilliem/unity-firebase-realtime-database","owner":"edricwilliem","description":"Unity Firebase Realtime Database REST","archived":false,"fork":false,"pushed_at":"2023-11-06T15:28:48.000Z","size":99,"stargazers_count":44,"open_issues_count":3,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-07T02:09:17.027Z","etag":null,"topics":["csharp","firebase","firebase-database","firebase-realtime-database","firebase-rest","firebase-rest-api","rest","rest-api","unity","unity-3d","unity-asset","unity-plugin","unity-scripts","unity3d","unity3d-plugin"],"latest_commit_sha":null,"homepage":"https://edricwilliem.github.io/unity-firebase-realtime-database/","language":"C#","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/edricwilliem.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-01T15:34:43.000Z","updated_at":"2025-02-18T19:33:58.000Z","dependencies_parsed_at":"2024-09-29T06:19:07.899Z","dependency_job_id":null,"html_url":"https://github.com/edricwilliem/unity-firebase-realtime-database","commit_stats":{"total_commits":9,"total_committers":3,"mean_commits":3.0,"dds":"0.33333333333333337","last_synced_commit":"2a5d881ea36c8122d529df41b81107b8a526aa87"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edricwilliem%2Funity-firebase-realtime-database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edricwilliem%2Funity-firebase-realtime-database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edricwilliem%2Funity-firebase-realtime-database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edricwilliem%2Funity-firebase-realtime-database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edricwilliem","download_url":"https://codeload.github.com/edricwilliem/unity-firebase-realtime-database/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252045995,"owners_count":21685932,"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":["csharp","firebase","firebase-database","firebase-realtime-database","firebase-rest","firebase-rest-api","rest","rest-api","unity","unity-3d","unity-asset","unity-plugin","unity-scripts","unity3d","unity3d-plugin"],"created_at":"2024-09-24T13:22:40.672Z","updated_at":"2025-05-02T13:30:26.787Z","avatar_url":"https://github.com/edricwilliem.png","language":"C#","readme":"# Unity Firebase Realtime Database REST API\nWrite, Read, Remove and Streaming data using [Firebase's database REST API](https://firebase.google.com/docs/reference/rest/database)\n\nThis is not firebase's official plugins library.\n\nTested on Android and WebGL platform. should work well on other platforms too since most of the implementation is only a simple http REST request.\n\nContributions to this project are welcome!.\n\n## Sample Usage\n\n### Setting Firebase\n\nBefore using the library you need to setup some settings in `FirebaseSettings.cs`\n```\nDATABASE_URL = \"https://example.firebaseio.com/\";\nWEB_API = \"[WEB_API_KEY]\";\n```\n\n### Write Data\nSet Value:\n```\nDatabaseReference reference = FirebaseDatabase.Instance.GetReference(\"path/to/save\");\nreference.SetValueAsync(\"mydata\", 10,(res) =\u003e \n{\n    if (res.success)\n    {\n        Debug.Log(\"Write success\");\n    }\n    else\n    {\n        Debug.Log(\"Write failed : \" + res.message);\n    }\n});\n\nreference.SetRawJsonValueAsync(\"{\\\"key\\\":\\\"value\\\"}\", 10,(res) =\u003e \n{\n    if (res.success)\n    {\n        Debug.Log(\"Write success\");\n    }\n    else\n    {\n        Debug.Log(\"Write failed : \" + res.message);\n    }\n});\n```\nUpdate Child Value:\n```\nDatabaseReference reference = FirebaseDatabase.Instance.GetReference(\"path/to/save\");\nreference.UpdateValueAsync(new Dictionary\u003cstring, object\u003e(){\n    {\"child1\",\"value1\"},{\"child2\",\"value2\"}\n}, 10, (res) =\u003e\n{\n    if (res.success)\n    {\n        Debug.Log(\"Write success\");\n    }\n    else\n    {\n        Debug.Log(\"Write failed : \" + res.message);\n    }\n});\n```\nPush Value:\n```\nDatabaseReference reference = FirebaseDatabase.Instance.GetReference(\"path/to/save\");\nreference.Push(\"mydata, 10, (res)=\u003e{\n    if(res.success){\n        Debug.Log(\"Pushed with id: \" + res.data);\n    }\n    else{\n        Debug.Log(\"Push failed : \" + res.message);\n    }\n});\n```\n\n### Read Data\nGet Value:\n```\nDatabaseReference reference = FirebaseDatabase.Instance.GetReference(\"path/to/query\");\nreference.GetValueAsync(10, (res) =\u003e\n{\n    if (res.success)\n    {\n        Debug.Log(\"Success fetched data : \" + res.data.GetRawJsonValue());\n    }\n    else\n    {\n        Debug.Log(\"Fetch data failed : \" + res.message);\n    }\n});\n```\nQuery \u0026 Order :\n\n* OrderByChild\n* OrderByKey\n* OrderByValue\n* StartAt\n* EndAt\n* LimitAtFirst\n* LimitAtLast\n```\nDatabaseReference reference = FirebaseDatabase.Instance.GetReference(\"path/to/query\");\nreference.OrderByChild(\"age\").StartAt(12).EndAt(20).LimitAtFirst(5).GetValueAsync(10,(res)=\u003e{\n        if (res.success)\n        {\n            Debug.Log(\"Success fetched data : \" +res.data.GetRawJsonValue());\n        }\n        else\n        {\n            Debug.Log(\"Fetch data failed : \" + res.message);\n        }\n});\n```\n\n### Delete Data\n```\nDatabaseReference reference = FirebaseDatabase.Instance.GetReference(\"path/to/delete\");\nreference.RemoveValueAsync(10, (e) =\u003e\n{\n    if (e.success)\n    {\n        Debug.Log(\"Delete data success\");\n    }\n    else{\n        Debug.Log(\"Delete data failed : \" + res.message);\n    }\n});\n```\n\n### Streaming Data\n```\nDatabaseReference reference = FirebaseDatabase.Instance.GetReference(\"path/to/stream\");\nreference.ValueChanged += (sender, e) =\u003e\n{\n    Debug.Log(e.Snapshot.GetRawJsonValue());\n};\nreference.DatabaseError += (sender,e)=\u003e{\n    Debug.Log(e.DatabaseError.Message);\n    Debug.Log(\"Streaming connection closed\");\n};\n```\n\n### Authentication\nSet the credential using saved tokens\n\n```\nFirebaseAuth.Instance.TokenData = new TokenData()\n{\n    refreshToken = savedRefreshToken,\n    idToken = savedAccessToken\n};\n```\n\nor Sign In\n```\nFirebaseAuth.Instance.SignInWithEmail(\"example@example.com\", \"example\", 10, (res) =\u003e\n{\n    if (res.success)\n    {\n        Debug.Log(\"Access token : \" + res.data.idToken);\n    }\n    else\n    {\n        Debug.Log(\"Signed Failed\");\n    }\n});\n```\nafter signed in, the `FirebaseAuth.Instance.TokenData` will be automatically set \n\n\n`FirebaseAuth.Instance.TokenData`  will be used for authentication on every database's request.\n\n## License\nMIT","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedricwilliem%2Funity-firebase-realtime-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedricwilliem%2Funity-firebase-realtime-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedricwilliem%2Funity-firebase-realtime-database/lists"}