{"id":48684047,"url":"https://github.com/klauern/unifi-network-go","last_synced_at":"2026-04-11T03:47:43.441Z","repository":{"id":278677131,"uuid":"936419066","full_name":"klauern/unifi-network-go","owner":"klauern","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-10T14:23:52.000Z","size":64,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-11T03:47:40.846Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":false,"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/klauern.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":"2025-02-21T03:47:40.000Z","updated_at":"2025-10-08T23:53:42.000Z","dependencies_parsed_at":"2025-02-21T04:29:11.635Z","dependency_job_id":"f7112ef0-fd8d-495f-8b20-04dbbc336a10","html_url":"https://github.com/klauern/unifi-network-go","commit_stats":null,"previous_names":["klauern/unifi-network-go"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/klauern/unifi-network-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klauern%2Funifi-network-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klauern%2Funifi-network-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klauern%2Funifi-network-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klauern%2Funifi-network-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klauern","download_url":"https://codeload.github.com/klauern/unifi-network-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klauern%2Funifi-network-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31668050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"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":[],"created_at":"2026-04-11T03:47:42.761Z","updated_at":"2026-04-11T03:47:43.433Z","avatar_url":"https://github.com/klauern.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unifi-network-go\n\nA Go client library for interacting with the UniFi Network Controller API. This library provides a simple and intuitive way to manage UniFi network devices, clients, sites, and hotspot vouchers.\n\n## Features\n\n- Site Management\n- Device Management\n- Network Client Management\n- Hotspot Voucher Management\n- Pagination Support\n- Error Handling\n- Customizable HTTP Client\n\n## Installation\n\n```bash\ngo get github.com/klauern/unifi-network-go\n```\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"log\"\n\n    unifi \"github.com/klauern/unifi-network-go\"\n)\n\nfunc main() {\n    // Create a new client\n    client, err := unifi.NewClient(\"https://192.168.1.1:8443\")\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // Get application info\n    info, err := client.GetApplicationInfo(context.Background())\n    if err != nil {\n        log.Fatal(err)\n    }\n    fmt.Printf(\"UniFi Network Version: %s\\n\", info.ApplicationVersion)\n}\n```\n\n## Usage Examples\n\n### Site Management\n\n```go\n// List all sites\nsites, err := client.ListSites(context.Background(), \u0026unifi.ListSitesParams{\n    Limit: 100,\n})\n\n// Get a specific site\nsite, err := client.GetSite(context.Background(), \"site-id\")\n```\n\n### Device Management\n\n```go\n// List devices in a site\ndevices, err := client.ListDevices(context.Background(), \"site-id\", \u0026unifi.ListDevicesParams{\n    Limit: 100,\n})\n\n// Get a specific device\ndevice, err := client.GetDevice(context.Background(), \"site-id\", \"device-id\")\n\n// Get device statistics\nstats, err := client.GetDeviceStatistics(context.Background(), \"site-id\", \"device-id\")\n\n// Execute device action (restart, adopt, forget)\nerr := client.ExecuteDeviceAction(context.Background(), \"site-id\", \"device-id\", \u0026unifi.DeviceAction{\n    Action: \"restart\",\n})\n```\n\n### Network Client Management\n\n```go\n// List network clients\nclients, err := client.ListNetworkClients(context.Background(), \"site-id\", \u0026unifi.ListNetworkClientsParams{\n    Type: \"all\",\n    WithinHours: 24,\n})\n\n// Get a specific client\nclient, err := client.GetNetworkClient(context.Background(), \"site-id\", \"client-id\")\n\n// Block/Unblock a client\nerr := client.BlockNetworkClient(context.Background(), \"site-id\", \"client-id\")\nerr := client.UnblockNetworkClient(context.Background(), \"site-id\", \"client-id\")\n```\n\n### Hotspot Voucher Management\n\n```go\n// Generate vouchers\nvouchers, err := client.GenerateHotspotVouchers(context.Background(), \"site-id\", \u0026unifi.GenerateHotspotVouchersRequest{\n    Count: 5,\n    Name: \"1-Day Pass\",\n    TimeLimitMinutes: 1440, // 24 hours\n})\n\n// List vouchers\nvoucherList, err := client.ListHotspotVouchers(context.Background(), \"site-id\", \u0026unifi.ListHotspotVouchersParams{\n    Limit: 100,\n})\n\n// Get voucher details\nvoucher, err := client.GetVoucherDetails(context.Background(), \"site-id\", \"voucher-id\")\n\n// Delete a voucher\nerr := client.DeleteHotspotVoucher(context.Background(), \"site-id\", \"voucher-id\")\n```\n\n## Customization\n\n### Custom HTTP Client\n\nYou can provide your own HTTP client with custom settings:\n\n```go\nhttpClient := \u0026http.Client{\n    Timeout: time.Second * 30,\n    // Add other customizations...\n}\n\nclient, err := unifi.NewClient(\n    \"https://192.168.1.1:8443\",\n    unifi.WithHTTPClient(httpClient),\n)\n```\n\n## Error Handling\n\nThe library provides detailed error information through the `unifi.Error` type:\n\n```go\nif err != nil {\n    if apiErr, ok := err.(*unifi.Error); ok {\n        fmt.Printf(\"API Error: %s (Status: %d)\\n\", apiErr.Message, apiErr.Status)\n    }\n}\n```\n\n## Pagination\n\nMost list operations support pagination through the `Offset` and `Limit` parameters:\n\n```go\nresponse, err := client.ListDevices(context.Background(), \"site-id\", \u0026unifi.ListDevicesParams{\n    Offset: 0,\n    Limit: 100,\n})\n\nfmt.Printf(\"Total Count: %d\\n\", response.TotalCount)\nfmt.Printf(\"Current Page Count: %d\\n\", response.Count)\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis library is distributed under the MIT license. See the LICENSE file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklauern%2Funifi-network-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklauern%2Funifi-network-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklauern%2Funifi-network-go/lists"}