{"id":26067470,"url":"https://github.com/agoraio-community/agora-rest-client-go","last_synced_at":"2025-09-08T13:34:53.641Z","repository":{"id":214600412,"uuid":"736838723","full_name":"AgoraIO-Community/agora-rest-client-go","owner":"AgoraIO-Community","description":"A Go library for integrating with Agora's REST API. This open-source project provides wrappers and implementations for Agora's official REST API, making it easier for developers to integrate Agora's server-side services into their Go applications.","archived":false,"fork":false,"pushed_at":"2025-03-21T09:32:21.000Z","size":250,"stargazers_count":12,"open_issues_count":0,"forks_count":4,"subscribers_count":27,"default_branch":"main","last_synced_at":"2025-03-24T21:03:19.459Z","etag":null,"topics":["go","rest-client"],"latest_commit_sha":null,"homepage":"","language":"Go","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/AgoraIO-Community.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":"2023-12-29T03:06:05.000Z","updated_at":"2025-03-21T09:30:38.000Z","dependencies_parsed_at":"2023-12-29T09:45:43.241Z","dependency_job_id":"f4b49a1c-fc24-4614-9836-2df7b7bc1f39","html_url":"https://github.com/AgoraIO-Community/agora-rest-client-go","commit_stats":null,"previous_names":["agoraio/agora-rest-client-go","agoraio-community/agora-rest-client-go"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgoraIO-Community%2Fagora-rest-client-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgoraIO-Community%2Fagora-rest-client-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgoraIO-Community%2Fagora-rest-client-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgoraIO-Community%2Fagora-rest-client-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AgoraIO-Community","download_url":"https://codeload.github.com/AgoraIO-Community/agora-rest-client-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248448325,"owners_count":21105279,"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":["go","rest-client"],"created_at":"2025-03-08T21:44:49.502Z","updated_at":"2025-09-08T13:34:53.628Z","avatar_url":"https://github.com/AgoraIO-Community.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Agora REST Client for Go\n\n\u003cp\u003e\n\u003cimg alt=\"GitHub License\" src=\"https://img.shields.io/github/license/AgoraIO-Community/agora-rest-client-go\"\u003e\n\u003ca href=\"https://pkg.go.dev/github.com/AgoraIO-Community/agora-rest-client-go\"\u003e\u003cimg src=\"https://pkg.go.dev/badge/github.com/AgoraIO-Community/agora-rest-client-go.svg\" alt=\"Go Reference\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/AgoraIO-Community/agora-rest-client-go/actions/workflows/go.yml\"\u003e\u003cimg src=\"https://github.com/AgoraIO-Community/agora-rest-client-go/actions/workflows/go.yml/badge.svg\" alt=\"Go Actions\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/AgoraIO-Community/agora-rest-client-go/actions/workflows/gitee-sync.yml\"\u003e\u003cimg alt=\"gitee-sync\" src=\"https://github.com/AgoraIO-Community/agora-rest-client-go/actions/workflows/gitee-sync.yml/badge.svg?branch=main\"\u003e\u003c/a\u003e\n\u003cimg alt=\"GitHub go.mod Go version\" src=\"https://img.shields.io/github/go-mod/go-version/AgoraIO-Community/agora-rest-client-go\"\u003e\n\u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/v/release/AgoraIO-Community/agora-rest-client-go\"\u003e\n\u003cimg alt=\"GitHub Issues or Pull Requests\" src=\"https://img.shields.io/github/issues-pr/AgoraIO-Community/agora-rest-client-go\"\u003e\n\u003c/p\u003e\n\nEnglish | [简体中文](./README_ZH.md)\n\n`agora-rest-client-go` is an open-source project written in Go, specifically designed for the Agora REST API. It includes wrappers and internal implementations of the official Agora REST API interfaces, making it easier for developers to integrate the server-side Agora REST API.\n\n\u003e [!IMPORTANT]\n\u003e This SDK has undergone some testing to ensure its basic functionality works correctly. However, due to the complexity of software development, we cannot guarantee it is completely free of defects. We encourage community developers and users to actively participate and help improve this project.\n\n## Features\n\n-   Encapsulates the request and response handling of the Agora REST API, simplifying the communication process with the Agora REST API.\n-   Provides automatic switching to the best domain in case of DNS resolution failure, network errors, or request timeouts, ensuring the availability of the REST API service.\n-   Offers easy-to-use APIs to easily implement common functions of the Agora REST API, such as starting and stopping cloud recording.\n-   Based on Go language, it is efficient, concurrent, and scalable.\n\n## Supported Services\n\n-   [Cloud Recording](./services/cloudrecording/README.md)\n-   [Cloud Transcoder](./services/cloudtranscoder/README.md)\n-   [Conversational AI Engine](./services/convoai/README.md)\n\n## Environment Setup\n\n-   [Go 1.18 or later](https://go.dev/)\n-   App ID and App Certificate obtained from the [Agora Console](https://console.agora.io/v2)\n-   Basic Auth credentials from the [Agora Console](https://console.agora.io/v2)\n-   Enable the relevant service capabilities on the [Agora Console](https://console.agora.io/v2)\n\n## Installation\n\nInstall the dependency from GitHub using the following command:\n\n```shell\ngo get -u github.com/AgoraIO-Community/agora-rest-client-go\n```\n\n## Usage Example\n\nHere is an example of calling the cloud recording service:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/AgoraIO-Community/agora-rest-client-go/agora/auth\"\n\t\"github.com/AgoraIO-Community/agora-rest-client-go/agora/domain\"\n\tagoraLogger \"github.com/AgoraIO-Community/agora-rest-client-go/agora/log\"\n\t\"github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording\"\n\tcloudRecordingAPI \"github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/api\"\n\t\"github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/req\"\n)\n\nconst (\n\tappId    = \"\u003cyour appId\u003e\"\n\tcname    = \"\u003cyour cname\u003e\"\n\tuid      = \"\u003cyour uid\u003e\"\n\tusername = \"\u003cthe username of basic auth credential\u003e\"\n\tpassword = \"\u003cthe password of basic auth credential\u003e\"\n\ttoken    = \"\u003cyour token\u003e\"\n)\n\nvar storageConfig = \u0026cloudRecordingAPI.StorageConfig{\n\tVendor:    0,\n\tRegion:    0,\n\tBucket:    \"\",\n\tAccessKey: \"\",\n\tSecretKey: \"\",\n\tFileNamePrefix: []string{\n\t\t\"recordings\",\n\t},\n}\n\nfunc main() {\n\t// Initialize Cloud Recording Config\n\tconfig := \u0026cloudrecording.Config{\n\t\tAppID:      appId,\n\t\tCredential: auth.NewBasicAuthCredential(username, password),\n\t\t// Specify the region where the server is located. Options include CN, EU, AP, US.\n\t\t// The client will automatically switch to use the best domain based on the configured region.\n\t\tDomainArea: domain.CN,\n\t\t// Specify the log output level. Options include DebugLevel, InfoLevel, WarningLevel, ErrLevel.\n\t\t// To disable log output, set logger to DiscardLogger.\n\t\tLogger: agoraLogger.NewDefaultLogger(agoraLogger.DebugLevel),\n\t}\n\n\t// Initialize the cloud recording service client\n\tcloudRecordingClient, err := cloudrecording.NewClient(config)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Call the Acquire API of the cloud recording service client\n\tacquireResp, err := cloudRecordingClient.MixRecording().\n\t\tAcquire(context.TODO(), cname, uid, \u0026req.AcquireMixRecodingClientRequest{})\n\t\t// Handle non-business errors\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Handle business response\n\tif acquireResp.IsSuccess() {\n\t\tlog.Printf(\"acquire success:%+v\\n\", acquireResp)\n\t} else {\n\t\tlog.Fatalf(\"acquire failed:%+v\\n\", acquireResp)\n\t}\n\n\t// Call the Start API of the cloud recording service client\n\tresourceId := acquireResp.SuccessRes.ResourceId\n\tstartResp, err := cloudRecordingClient.MixRecording().\n\t\tStart(context.TODO(), resourceId, cname, uid, \u0026req.StartMixRecordingClientRequest{\n\t\t\tToken: token,\n\t\t\tRecordingConfig: \u0026cloudRecordingAPI.RecordingConfig{\n\t\t\t\tChannelType:  1,\n\t\t\t\tStreamTypes:  2,\n\t\t\t\tMaxIdleTime:  30,\n\t\t\t\tAudioProfile: 2,\n\t\t\t\tTranscodingConfig: \u0026cloudRecordingAPI.TranscodingConfig{\n\t\t\t\t\tWidth:            640,\n\t\t\t\t\tHeight:           640,\n\t\t\t\t\tFPS:              15,\n\t\t\t\t\tBitRate:          800,\n\t\t\t\t\tMixedVideoLayout: 0,\n\t\t\t\t\tBackgroundColor:  \"#000000\",\n\t\t\t\t},\n\t\t\t\tSubscribeAudioUIDs: []string{\n\t\t\t\t\t\"#allstream#\",\n\t\t\t\t},\n\t\t\t\tSubscribeVideoUIDs: []string{\n\t\t\t\t\t\"#allstream#\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tRecordingFileConfig: \u0026cloudRecordingAPI.RecordingFileConfig{\n\t\t\t\tAvFileType: []string{\n\t\t\t\t\t\"hls\",\n\t\t\t\t\t\"mp4\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tStorageConfig: storageConfig,\n\t\t})\n\t\t// Handle non-business errors\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Handle business response\n\tif startResp.IsSuccess() {\n\t\tlog.Printf(\"start success:%+v\\n\", startResp)\n\t} else {\n\t\tlog.Fatalf(\"start failed:%+v\\n\", startResp)\n\t}\n\n\tsid := startResp.SuccessResponse.Sid\n\t// Query\n\tfor i := 0; i \u003c 6; i++ {\n\t\tqueryResp, err := cloudRecordingClient.MixRecording().\n\t\t\tQueryHLSAndMP4(context.TODO(), resourceId, sid)\n\t\t\t// Handle non-business errors\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// Handle business response\n\t\tif queryResp.IsSuccess() {\n\t\t\tlog.Printf(\"query success:%+v\\n\", queryResp)\n\t\t} else {\n\t\t\tlog.Printf(\"query failed:%+v\\n\", queryResp)\n\t\t}\n\t\ttime.Sleep(time.Second * 10)\n\t}\n\n\t// Call the Stop API of the cloud recording service client\n\tstopResp, err := cloudRecordingClient.MixRecording().\n\t\tStop(context.TODO(), resourceId, sid, cname, uid, true)\n\t\t// Handle non-business errors\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Handle business response\n\tif stopResp.IsSuccess() {\n\t\tlog.Printf(\"stop success:%+v\\n\", stopResp)\n\t} else {\n\t\tlog.Printf(\"stop failed:%+v\\n\", stopResp)\n\t}\n}\n\n\n```\n\nFor more examples, see [Example](./examples).\n\n## Contribution\n\nThis project welcomes and accepts contributions. If you encounter any issues or have suggestions for improvements, please open an issue or submit a Pull Request.\n\n# SemVer Versioning\n\nThis project uses Semantic Versioning (SemVer) to manage versions. The format is MAJOR.MINOR.PATCH.\n\n-   MAJOR version indicates incompatible changes.\n-   MINOR version indicates backward-compatible new features or enhancements.\n-   PATCH version indicates backward-compatible bug fixes and maintenance.\n    For more details, please refer to the [Semantic Versioning](https://semver.org) specification.\n\n## References\n\n-   [Agora API Documentation](https://docs.agora.io/en/)\n\n## License\n\nThis project is licensed under the MIT License. For more details, please refer to the LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagoraio-community%2Fagora-rest-client-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagoraio-community%2Fagora-rest-client-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagoraio-community%2Fagora-rest-client-go/lists"}