add_template.go 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. package mts
  2. //Licensed under the Apache License, Version 2.0 (the "License");
  3. //you may not use this file except in compliance with the License.
  4. //You may obtain a copy of the License at
  5. //
  6. //http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. //Unless required by applicable law or agreed to in writing, software
  9. //distributed under the License is distributed on an "AS IS" BASIS,
  10. //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. //See the License for the specific language governing permissions and
  12. //limitations under the License.
  13. //
  14. // Code generated by Alibaba Cloud SDK Code Generator.
  15. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
  16. import (
  17. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
  18. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
  19. )
  20. func (client *Client) AddTemplate(request *AddTemplateRequest) (response *AddTemplateResponse, err error) {
  21. response = CreateAddTemplateResponse()
  22. err = client.DoAction(request, response)
  23. return
  24. }
  25. func (client *Client) AddTemplateWithChan(request *AddTemplateRequest) (<-chan *AddTemplateResponse, <-chan error) {
  26. responseChan := make(chan *AddTemplateResponse, 1)
  27. errChan := make(chan error, 1)
  28. err := client.AddAsyncTask(func() {
  29. defer close(responseChan)
  30. defer close(errChan)
  31. response, err := client.AddTemplate(request)
  32. responseChan <- response
  33. errChan <- err
  34. })
  35. if err != nil {
  36. errChan <- err
  37. close(responseChan)
  38. close(errChan)
  39. }
  40. return responseChan, errChan
  41. }
  42. func (client *Client) AddTemplateWithCallback(request *AddTemplateRequest, callback func(response *AddTemplateResponse, err error)) <-chan int {
  43. result := make(chan int, 1)
  44. err := client.AddAsyncTask(func() {
  45. var response *AddTemplateResponse
  46. var err error
  47. defer close(result)
  48. response, err = client.AddTemplate(request)
  49. callback(response, err)
  50. result <- 1
  51. })
  52. if err != nil {
  53. defer close(result)
  54. callback(nil, err)
  55. result <- 0
  56. }
  57. return result
  58. }
  59. type AddTemplateRequest struct {
  60. *requests.RpcRequest
  61. Container string `position:"Query" name:"Container"`
  62. ResourceOwnerId string `position:"Query" name:"ResourceOwnerId"`
  63. ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
  64. OwnerAccount string `position:"Query" name:"OwnerAccount"`
  65. Name string `position:"Query" name:"Name"`
  66. Action string `position:"Query" name:"Action"`
  67. TransConfig string `position:"Query" name:"TransConfig"`
  68. MuxConfig string `position:"Query" name:"MuxConfig"`
  69. Video string `position:"Query" name:"Video"`
  70. Audio string `position:"Query" name:"Audio"`
  71. OwnerId string `position:"Query" name:"OwnerId"`
  72. AccessKeyId string `position:"Query" name:"AccessKeyId"`
  73. }
  74. type AddTemplateResponse struct {
  75. *responses.BaseResponse
  76. RequestId string `json:"RequestId"`
  77. Template struct {
  78. Id string `json:"Id"`
  79. Name string `json:"Name"`
  80. State string `json:"State"`
  81. Container struct {
  82. Format string `json:"Format"`
  83. } `json:"Container"`
  84. Video struct {
  85. Codec string `json:"Codec"`
  86. Profile string `json:"Profile"`
  87. Bitrate string `json:"Bitrate"`
  88. Crf string `json:"Crf"`
  89. Width string `json:"Width"`
  90. Height string `json:"Height"`
  91. Fps string `json:"Fps"`
  92. Gop string `json:"Gop"`
  93. Preset string `json:"Preset"`
  94. ScanMode string `json:"ScanMode"`
  95. Bufsize string `json:"Bufsize"`
  96. Maxrate string `json:"Maxrate"`
  97. PixFmt string `json:"PixFmt"`
  98. Degrain string `json:"Degrain"`
  99. Qscale string `json:"Qscale"`
  100. Remove string `json:"Remove"`
  101. Crop string `json:"Crop"`
  102. Pad string `json:"Pad"`
  103. MaxFps string `json:"MaxFps"`
  104. BitrateBnd struct {
  105. Max string `json:"Max"`
  106. Min string `json:"Min"`
  107. } `json:"BitrateBnd"`
  108. } `json:"Video"`
  109. Audio struct {
  110. Codec string `json:"Codec"`
  111. Profile string `json:"Profile"`
  112. Samplerate string `json:"Samplerate"`
  113. Bitrate string `json:"Bitrate"`
  114. Channels string `json:"Channels"`
  115. Qscale string `json:"Qscale"`
  116. Remove string `json:"Remove"`
  117. Volume struct {
  118. Level string `json:"Level"`
  119. Method string `json:"Method"`
  120. } `json:"Volume"`
  121. } `json:"Audio"`
  122. TransConfig struct {
  123. TransMode string `json:"TransMode"`
  124. IsCheckReso string `json:"IsCheckReso"`
  125. IsCheckResoFail string `json:"IsCheckResoFail"`
  126. IsCheckVideoBitrate string `json:"IsCheckVideoBitrate"`
  127. IsCheckAudioBitrate string `json:"IsCheckAudioBitrate"`
  128. AdjDarMethod string `json:"AdjDarMethod"`
  129. IsCheckVideoBitrateFail string `json:"IsCheckVideoBitrateFail"`
  130. IsCheckAudioBitrateFail string `json:"IsCheckAudioBitrateFail"`
  131. } `json:"TransConfig"`
  132. MuxConfig struct {
  133. Segment struct {
  134. Duration string `json:"Duration"`
  135. } `json:"Segment"`
  136. Gif struct {
  137. Loop string `json:"Loop"`
  138. FinalDelay string `json:"FinalDelay"`
  139. IsCustomPalette string `json:"IsCustomPalette"`
  140. DitherMode string `json:"DitherMode"`
  141. } `json:"Gif"`
  142. } `json:"MuxConfig"`
  143. } `json:"Template"`
  144. }
  145. func CreateAddTemplateRequest() (request *AddTemplateRequest) {
  146. request = &AddTemplateRequest{
  147. RpcRequest: &requests.RpcRequest{},
  148. }
  149. request.InitWithApiInfo("Mts", "2014-06-18", "AddTemplate", "", "")
  150. return
  151. }
  152. func CreateAddTemplateResponse() (response *AddTemplateResponse) {
  153. response = &AddTemplateResponse{
  154. BaseResponse: &responses.BaseResponse{},
  155. }
  156. return
  157. }