package api

import (
	"github.com/alibabacloud-go/darabonba-openapi/client"
	dyplsapiclient "github.com/alibabacloud-go/dyplsapi-20170525/client"
	dyvmsapiclient "github.com/alibabacloud-go/dyvmsapi-20170525-2.0.2/client"
	"github.com/alibabacloud-go/tea/tea"
	beego "github.com/astaxie/beego/server/web"
)

var (
	aliKey    = tea.String(beego.AppConfig.DefaultString("aliKey", ""))
	aliSecret = tea.String(beego.AppConfig.DefaultString("aliSecret", ""))
)

var (
	VoiceClient, _     = CreateClientVoice(aliKey, aliSecret, "dyvmsapi.aliyuncs.com")     //语音服务
	SecretNumClient, _ = CreateClientSecretNum(aliKey, aliSecret, "dyplsapi.aliyuncs.com") //号码隐私
)

func CreateClientVoice(accessKeyId *string, accessKeySecret *string, url string) (_result *dyvmsapiclient.Client, _err error) {
	config := &client.Config{}
	// 您的AccessKey ID
	config.AccessKeyId = accessKeyId
	// 您的AccessKey Secret
	config.AccessKeySecret = accessKeySecret
	config.Endpoint = tea.String(url)
	_result = &dyvmsapiclient.Client{}
	_result, _err = dyvmsapiclient.NewClient(config)
	return _result, _err
}

func CreateClientSecretNum(accessKeyId *string, accessKeySecret *string, url string) (_result *dyplsapiclient.Client, _err error) {
	config := &client.Config{}
	// 您的AccessKey ID
	config.AccessKeyId = accessKeyId
	// 您的AccessKey Secret
	config.AccessKeySecret = accessKeySecret
	config.Endpoint = tea.String(url)
	_result = &dyplsapiclient.Client{}
	_result, _err = dyplsapiclient.NewClient(config)
	return _result, _err
}
