package alidns

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

// DescribePdnsUserInfo invokes the alidns.DescribePdnsUserInfo API synchronously
func (client *Client) DescribePdnsUserInfo(request *DescribePdnsUserInfoRequest) (response *DescribePdnsUserInfoResponse, err error) {
	response = CreateDescribePdnsUserInfoResponse()
	err = client.DoAction(request, response)
	return
}

// DescribePdnsUserInfoWithChan invokes the alidns.DescribePdnsUserInfo API asynchronously
func (client *Client) DescribePdnsUserInfoWithChan(request *DescribePdnsUserInfoRequest) (<-chan *DescribePdnsUserInfoResponse, <-chan error) {
	responseChan := make(chan *DescribePdnsUserInfoResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.DescribePdnsUserInfo(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// DescribePdnsUserInfoWithCallback invokes the alidns.DescribePdnsUserInfo API asynchronously
func (client *Client) DescribePdnsUserInfoWithCallback(request *DescribePdnsUserInfoRequest, callback func(response *DescribePdnsUserInfoResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *DescribePdnsUserInfoResponse
		var err error
		defer close(result)
		response, err = client.DescribePdnsUserInfo(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// DescribePdnsUserInfoRequest is the request struct for api DescribePdnsUserInfo
type DescribePdnsUserInfoRequest struct {
	*requests.RpcRequest
	Lang string `position:"Query" name:"Lang"`
}

// DescribePdnsUserInfoResponse is the response struct for api DescribePdnsUserInfo
type DescribePdnsUserInfoResponse struct {
	*responses.BaseResponse
	RequestId string   `json:"RequestId" xml:"RequestId"`
	UserInfo  UserInfo `json:"UserInfo" xml:"UserInfo"`
}

// CreateDescribePdnsUserInfoRequest creates a request to invoke DescribePdnsUserInfo API
func CreateDescribePdnsUserInfoRequest() (request *DescribePdnsUserInfoRequest) {
	request = &DescribePdnsUserInfoRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("Alidns", "2015-01-09", "DescribePdnsUserInfo", "alidns", "openAPI")
	request.Method = requests.POST
	return
}

// CreateDescribePdnsUserInfoResponse creates a response to parse from DescribePdnsUserInfo response
func CreateDescribePdnsUserInfoResponse() (response *DescribePdnsUserInfoResponse) {
	response = &DescribePdnsUserInfoResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}
