@@ -1448,10 +1448,18 @@ type GetMediaInfoResult struct {
14481448// 媒体信息接口 https://cloud.tencent.com/document/product/436/55672
14491449func (s * CIService ) GetMediaInfo (ctx context.Context , name string , opt * ObjectGetOptions , id ... string ) (* GetMediaInfoResult , * Response , error ) {
14501450 var u string
1451+
1452+ // 兼容 name 以 / 开头的情况
1453+ if strings .HasPrefix (name , "/" ) {
1454+ name = encodeURIComponent ("/" ) + encodeURIComponent (name [1 :], []byte {'/' })
1455+ } else {
1456+ name = encodeURIComponent (name , []byte {'/' })
1457+ }
1458+
14511459 if len (id ) == 1 {
1452- u = fmt .Sprintf ("/%s?versionId=%s&ci-process=videoinfo" , encodeURIComponent ( name , [] byte { '/' }) , id [0 ])
1460+ u = fmt .Sprintf ("/%s?versionId=%s&ci-process=videoinfo" , name , id [0 ])
14531461 } else if len (id ) == 0 {
1454- u = fmt .Sprintf ("/%s?ci-process=videoinfo" , encodeURIComponent ( name , [] byte { '/' }) )
1462+ u = fmt .Sprintf ("/%s?ci-process=videoinfo" , name )
14551463 } else {
14561464 return nil , nil , fmt .Errorf ("wrong params" )
14571465 }
@@ -4184,3 +4192,139 @@ func (s *CIService) CreateMultiGeneratePlayListJobs(ctx context.Context, opt *Cr
41844192 resp , err := s .client .send (ctx , & sendOpt )
41854193 return & res , resp , err
41864194}
4195+
4196+ type VocabularyWeight struct {
4197+ Vocabulary string `xml:"Vocabulary,omitempty"`
4198+ Weight int `xml:"Weight,omitempty"`
4199+ }
4200+
4201+ // CreateAsrVocabularyTableOptions TODO
4202+ type CreateAsrVocabularyTableOptions struct {
4203+ XMLName xml.Name `xml:"Request"`
4204+ TableName string `xml:"TableName,omitempty"`
4205+ TableDescription string `xml:"TableDescription,omitempty"`
4206+ VocabularyWeights []VocabularyWeight `xml:"VocabularyWeights,omitempty"`
4207+ VocabularyWeightStr string `xml:"VocabularyWeightStr,omitempty"`
4208+ }
4209+
4210+ // CreateAsrVocabularyTableResult TODO
4211+ type CreateAsrVocabularyTableResult struct {
4212+ XMLName xml.Name `xml:"Response"`
4213+ Code string `xml:"Code,omitempty"`
4214+ Message string `xml:"Message,omitempty"`
4215+ TableId string `xml:"TableId,omitempty"`
4216+ RequestId string `xml:"RequestId,omitempty"`
4217+ }
4218+
4219+ func (s * CIService ) CreateAsrVocabularyTable (ctx context.Context , opt * CreateAsrVocabularyTableOptions ) (* CreateAsrVocabularyTableResult , * Response , error ) {
4220+ var res CreateAsrVocabularyTableResult
4221+ sendOpt := sendOptions {
4222+ baseURL : s .client .BaseURL .CIURL ,
4223+ uri : "/asrhotvocabtable" ,
4224+ method : http .MethodPost ,
4225+ body : opt ,
4226+ result : & res ,
4227+ }
4228+ resp , err := s .client .send (ctx , & sendOpt )
4229+ return & res , resp , err
4230+ }
4231+
4232+ // DeleteAsrVocabularyTable TODO
4233+ func (s * CIService ) DeleteAsrVocabularyTable (ctx context.Context , tableId string ) (* Response , error ) {
4234+ sendOpt := sendOptions {
4235+ baseURL : s .client .BaseURL .CIURL ,
4236+ uri : "/asrhotvocabtable/" + tableId ,
4237+ method : http .MethodDelete ,
4238+ }
4239+ resp , err := s .client .send (ctx , & sendOpt )
4240+ return resp , err
4241+ }
4242+
4243+ // CreateAsrVocabularyTableOptions TODO
4244+ type UpdateAsrVocabularyTableOptions struct {
4245+ XMLName xml.Name `xml:"Request"`
4246+ TableId string `xml:"TableId,omitempty"`
4247+ TableName string `xml:"TableName,omitempty"`
4248+ TableDescription string `xml:"TableDescription,omitempty"`
4249+ VocabularyWeights []VocabularyWeight `xml:"VocabularyWeights,omitempty"`
4250+ VocabularyWeightStr string `xml:"VocabularyWeightStr,omitempty"`
4251+ }
4252+
4253+ type UpdateAsrVocabularyTableResult CreateAsrVocabularyTableResult
4254+
4255+ // UpdateAsrVocabularyTable TODO
4256+ func (s * CIService ) UpdateAsrVocabularyTable (ctx context.Context , opt * UpdateAsrVocabularyTableOptions ) (* UpdateAsrVocabularyTableResult , * Response , error ) {
4257+ var res UpdateAsrVocabularyTableResult
4258+ sendOpt := sendOptions {
4259+ baseURL : s .client .BaseURL .CIURL ,
4260+ uri : "/asrhotvocabtable" ,
4261+ method : http .MethodPut ,
4262+ body : opt ,
4263+ result : & res ,
4264+ }
4265+ resp , err := s .client .send (ctx , & sendOpt )
4266+ return & res , resp , err
4267+ }
4268+
4269+ type VocabularyTable struct {
4270+ TableId string `xml:"TableId,omitempty"`
4271+ TableName string `xml:"TableName,omitempty"`
4272+ TableDescription string `xml:"TableDescription,omitempty"`
4273+ VocabularyWeights []VocabularyWeight `xml:"VocabularyWeights,omitempty"`
4274+ VocabularyWeightStr string `xml:"VocabularyWeightStr,omitempty"`
4275+ CreateTime string `xml:"CreateTime,omitempty"`
4276+ UpdateTime string `xml:"UpdateTime,omitempty"`
4277+ }
4278+
4279+ // DescribeAsrVocabularyTableResult TODO
4280+ type DescribeAsrVocabularyTableResult struct {
4281+ XMLName xml.Name `xml:"Response"`
4282+ RequestId string `xml:"RequestId,omitempty"`
4283+ TableId string `xml:"TableId,omitempty"`
4284+ TableName string `xml:"TableName,omitempty"`
4285+ TableDescription string `xml:"TableDescription,omitempty"`
4286+ VocabularyWeights []VocabularyWeight `xml:"VocabularyWeights,omitempty"`
4287+ VocabularyWeightStr string `xml:"VocabularyWeightStr,omitempty"`
4288+ CreateTime string `xml:"CreateTime,omitempty"`
4289+ UpdateTime string `xml:"UpdateTime,omitempty"`
4290+ }
4291+
4292+ // DescribeAsrVocabularyTable 查询指定的语音识别热词表
4293+ func (s * CIService ) DescribeAsrVocabularyTable (ctx context.Context , tableId string ) (* DescribeAsrVocabularyTableResult , * Response , error ) {
4294+ var res DescribeAsrVocabularyTableResult
4295+ sendOpt := sendOptions {
4296+ baseURL : s .client .BaseURL .CIURL ,
4297+ uri : "/asrhotvocabtable/" + tableId ,
4298+ method : http .MethodGet ,
4299+ result : & res ,
4300+ }
4301+ resp , err := s .client .send (ctx , & sendOpt )
4302+ return & res , resp , err
4303+ }
4304+
4305+ // DescribeAsrVocabularyTablesOptions TODO
4306+ type DescribeAsrVocabularyTablesOptions struct {
4307+ Offset int `url:"offset,omitempty"`
4308+ Limit int `url:"limit,omitempty"`
4309+ }
4310+
4311+ type DescribeAsrVocabularyTablesResult struct {
4312+ XMLName xml.Name `xml:"Response"`
4313+ RequestId string `xml:"RequestId,omitempty"`
4314+ TotalCount string `xml:"TotalCount,omitempty"`
4315+ VocabularyTable []VocabularyTable `xml:"VocabularyTable,omitempty"`
4316+ }
4317+
4318+ // DescribeAsrVocabularyTables 查询语音识别热词表列表
4319+ func (s * CIService ) DescribeAsrVocabularyTables (ctx context.Context , opt * DescribeAsrVocabularyTablesOptions ) (* DescribeAsrVocabularyTablesResult , * Response , error ) {
4320+ var res DescribeAsrVocabularyTablesResult
4321+ sendOpt := sendOptions {
4322+ baseURL : s .client .BaseURL .CIURL ,
4323+ uri : "/asrhotvocabtable" ,
4324+ optQuery : opt ,
4325+ method : http .MethodGet ,
4326+ result : & res ,
4327+ }
4328+ resp , err := s .client .send (ctx , & sendOpt )
4329+ return & res , resp , err
4330+ }
0 commit comments