package vod

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// ListLiveRecordVideo invokes the vod.ListLiveRecordVideo API synchronously
// api document: https://help.aliyun.com/api/vod/listliverecordvideo.html
func (client *Client) ListLiveRecordVideo(request *ListLiveRecordVideoRequest) (response *ListLiveRecordVideoResponse, err error) {
	response = CreateListLiveRecordVideoResponse()
	err = client.DoAction(request, response)
	return
}

// ListLiveRecordVideoWithChan invokes the vod.ListLiveRecordVideo API asynchronously
// api document: https://help.aliyun.com/api/vod/listliverecordvideo.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) ListLiveRecordVideoWithChan(request *ListLiveRecordVideoRequest) (<-chan *ListLiveRecordVideoResponse, <-chan error) {
	responseChan := make(chan *ListLiveRecordVideoResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.ListLiveRecordVideo(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// ListLiveRecordVideoWithCallback invokes the vod.ListLiveRecordVideo API asynchronously
// api document: https://help.aliyun.com/api/vod/listliverecordvideo.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) ListLiveRecordVideoWithCallback(request *ListLiveRecordVideoRequest, callback func(response *ListLiveRecordVideoResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *ListLiveRecordVideoResponse
		var err error
		defer close(result)
		response, err = client.ListLiveRecordVideo(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// ListLiveRecordVideoRequest is the request struct for api ListLiveRecordVideo
type ListLiveRecordVideoRequest struct {
	*requests.RpcRequest
	ResourceOwnerId      requests.Integer `position:"Query" name:"ResourceOwnerId"`
	ResourceOwnerAccount string           `position:"Query" name:"ResourceOwnerAccount"`
	DomainName           string           `position:"Query" name:"DomainName"`
	EndTime              string           `position:"Query" name:"EndTime"`
	StartTime            string           `position:"Query" name:"StartTime"`
	OwnerId              requests.Integer `position:"Query" name:"OwnerId"`
	AppName              string           `position:"Query" name:"AppName"`
	PageNo               requests.Integer `position:"Query" name:"PageNo"`
	PageSize             requests.Integer `position:"Query" name:"PageSize"`
	SortBy               string           `position:"Query" name:"SortBy"`
	StreamName           string           `position:"Query" name:"StreamName"`
	QueryType            string           `position:"Query" name:"QueryType"`
}

// ListLiveRecordVideoResponse is the response struct for api ListLiveRecordVideo
type ListLiveRecordVideoResponse struct {
	*responses.BaseResponse
	RequestId           string              `json:"RequestId" xml:"RequestId"`
	Total               int                 `json:"Total" xml:"Total"`
	LiveRecordVideoList LiveRecordVideoList `json:"LiveRecordVideoList" xml:"LiveRecordVideoList"`
}

// CreateListLiveRecordVideoRequest creates a request to invoke ListLiveRecordVideo API
func CreateListLiveRecordVideoRequest() (request *ListLiveRecordVideoRequest) {
	request = &ListLiveRecordVideoRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("vod", "2017-03-21", "ListLiveRecordVideo", "vod", "openAPI")
	return
}

// CreateListLiveRecordVideoResponse creates a response to parse from ListLiveRecordVideo response
func CreateListLiveRecordVideoResponse() (response *ListLiveRecordVideoResponse) {
	response = &ListLiveRecordVideoResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}
