package linkwan

//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"
)

// ListNodeTransferPacketPaths invokes the linkwan.ListNodeTransferPacketPaths API synchronously
func (client *Client) ListNodeTransferPacketPaths(request *ListNodeTransferPacketPathsRequest) (response *ListNodeTransferPacketPathsResponse, err error) {
	response = CreateListNodeTransferPacketPathsResponse()
	err = client.DoAction(request, response)
	return
}

// ListNodeTransferPacketPathsWithChan invokes the linkwan.ListNodeTransferPacketPaths API asynchronously
func (client *Client) ListNodeTransferPacketPathsWithChan(request *ListNodeTransferPacketPathsRequest) (<-chan *ListNodeTransferPacketPathsResponse, <-chan error) {
	responseChan := make(chan *ListNodeTransferPacketPathsResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.ListNodeTransferPacketPaths(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// ListNodeTransferPacketPathsWithCallback invokes the linkwan.ListNodeTransferPacketPaths API asynchronously
func (client *Client) ListNodeTransferPacketPathsWithCallback(request *ListNodeTransferPacketPathsRequest, callback func(response *ListNodeTransferPacketPathsResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *ListNodeTransferPacketPathsResponse
		var err error
		defer close(result)
		response, err = client.ListNodeTransferPacketPaths(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// ListNodeTransferPacketPathsRequest is the request struct for api ListNodeTransferPacketPaths
type ListNodeTransferPacketPathsRequest struct {
	*requests.RpcRequest
	Base64EncodedMacPayload string           `position:"Query" name:"Base64EncodedMacPayload"`
	PageNumber              requests.Integer `position:"Query" name:"PageNumber"`
	IotInstanceId           string           `position:"Query" name:"IotInstanceId"`
	LogMillis               requests.Integer `position:"Query" name:"LogMillis"`
	PageSize                requests.Integer `position:"Query" name:"PageSize"`
	DevEui                  string           `position:"Query" name:"DevEui"`
	ApiProduct              string           `position:"Body" name:"ApiProduct"`
	ApiRevision             string           `position:"Body" name:"ApiRevision"`
}

// ListNodeTransferPacketPathsResponse is the response struct for api ListNodeTransferPacketPaths
type ListNodeTransferPacketPathsResponse struct {
	*responses.BaseResponse
	RequestId string                            `json:"RequestId" xml:"RequestId"`
	Success   bool                              `json:"Success" xml:"Success"`
	Data      DataInListNodeTransferPacketPaths `json:"Data" xml:"Data"`
}

// CreateListNodeTransferPacketPathsRequest creates a request to invoke ListNodeTransferPacketPaths API
func CreateListNodeTransferPacketPathsRequest() (request *ListNodeTransferPacketPathsRequest) {
	request = &ListNodeTransferPacketPathsRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("LinkWAN", "2019-03-01", "ListNodeTransferPacketPaths", "linkwan", "openAPI")
	request.Method = requests.POST
	return
}

// CreateListNodeTransferPacketPathsResponse creates a response to parse from ListNodeTransferPacketPaths response
func CreateListNodeTransferPacketPathsResponse() (response *ListNodeTransferPacketPathsResponse) {
	response = &ListNodeTransferPacketPathsResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}
