Voice.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package lib
  2. import (
  3. openapi "github.com/alibabacloud-go/darabonba-openapi/client"
  4. dyvmsapi20170525 "github.com/alibabacloud-go/dyvmsapi-20170525/v2/client"
  5. "github.com/alibabacloud-go/tea/tea"
  6. )
  7. /**
  8. * 使用AK&SK初始化账号Client
  9. * @param accessKeyId
  10. * @param accessKeySecret
  11. * @return Client
  12. * @throws Exception
  13. */
  14. func CreateClient(accessKeyId *string, accessKeySecret *string) (_result *dyvmsapi20170525.Client, _err error) {
  15. config := &openapi.Config{
  16. // 您的AccessKey ID
  17. AccessKeyId: accessKeyId,
  18. // 您的AccessKey Secret
  19. AccessKeySecret: accessKeySecret,
  20. }
  21. // 访问的域名
  22. config.Endpoint = tea.String("dyvmsapi.aliyuncs.com")
  23. _result = &dyvmsapi20170525.Client{}
  24. _result, _err = dyvmsapi20170525.NewClient(config)
  25. return _result, _err
  26. }
  27. func M_main(args []*string) (_err error) {
  28. accessKeyId := ""
  29. accessKeySecret := ""
  30. client, _err := CreateClient(&accessKeyId, &accessKeySecret)
  31. if _err != nil {
  32. return _err
  33. }
  34. addRtcAccountRequest := &dyvmsapi20170525.AddRtcAccountRequest{
  35. ResourceOwnerAccount: tea.String("test"),
  36. ResourceOwnerId: tea.Int64(1),
  37. DeviceId: tea.String("test"),
  38. }
  39. // 复制代码运行请自行打印 API 的返回值
  40. _, _err = client.AddRtcAccount(addRtcAccountRequest)
  41. if _err != nil {
  42. return _err
  43. }
  44. return _err
  45. }