package lib import ( openapi "github.com/alibabacloud-go/darabonba-openapi/client" dyvmsapi20170525 "github.com/alibabacloud-go/dyvmsapi-20170525/v2/client" "github.com/alibabacloud-go/tea/tea" ) /** * 使用AK&SK初始化账号Client * @param accessKeyId * @param accessKeySecret * @return Client * @throws Exception */ func CreateClient(accessKeyId *string, accessKeySecret *string) (_result *dyvmsapi20170525.Client, _err error) { config := &openapi.Config{ // 您的AccessKey ID AccessKeyId: accessKeyId, // 您的AccessKey Secret AccessKeySecret: accessKeySecret, } // 访问的域名 config.Endpoint = tea.String("dyvmsapi.aliyuncs.com") _result = &dyvmsapi20170525.Client{} _result, _err = dyvmsapi20170525.NewClient(config) return _result, _err } func M_main(args []*string) (_err error) { accessKeyId := "" accessKeySecret := "" client, _err := CreateClient(&accessKeyId, &accessKeySecret) if _err != nil { return _err } addRtcAccountRequest := &dyvmsapi20170525.AddRtcAccountRequest{ ResourceOwnerAccount: tea.String("test"), ResourceOwnerId: tea.Int64(1), DeviceId: tea.String("test"), } // 复制代码运行请自行打印 API 的返回值 _, _err = client.AddRtcAccount(addRtcAccountRequest) if _err != nil { return _err } return _err }