package imm

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

// GetFaceDetail invokes the imm.GetFaceDetail API synchronously
// api document: https://help.aliyun.com/api/imm/getfacedetail.html
func (client *Client) GetFaceDetail(request *GetFaceDetailRequest) (response *GetFaceDetailResponse, err error) {
	response = CreateGetFaceDetailResponse()
	err = client.DoAction(request, response)
	return
}

// GetFaceDetailWithChan invokes the imm.GetFaceDetail API asynchronously
// api document: https://help.aliyun.com/api/imm/getfacedetail.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) GetFaceDetailWithChan(request *GetFaceDetailRequest) (<-chan *GetFaceDetailResponse, <-chan error) {
	responseChan := make(chan *GetFaceDetailResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.GetFaceDetail(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

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

// GetFaceDetailRequest is the request struct for api GetFaceDetail
type GetFaceDetailRequest struct {
	*requests.RpcRequest
	Project string `position:"Query" name:"Project"`
	SetId   string `position:"Query" name:"SetId"`
	FaceId  string `position:"Query" name:"FaceId"`
}

// GetFaceDetailResponse is the response struct for api GetFaceDetail
type GetFaceDetailResponse struct {
	*responses.BaseResponse
	SetId         string        `json:"SetId" xml:"SetId"`
	FaceId        string        `json:"FaceId" xml:"FaceId"`
	PhotoId       string        `json:"PhotoId" xml:"PhotoId"`
	PhotoUrl      string        `json:"PhotoUrl" xml:"PhotoUrl"`
	GroupId       string        `json:"GroupId" xml:"GroupId"`
	RequestId     string        `json:"RequestId" xml:"RequestId"`
	FaceRectangle FaceRectangle `json:"FaceRectangle" xml:"FaceRectangle"`
	FaceAttribute FaceAttribute `json:"FaceAttribute" xml:"FaceAttribute"`
}

// CreateGetFaceDetailRequest creates a request to invoke GetFaceDetail API
func CreateGetFaceDetailRequest() (request *GetFaceDetailRequest) {
	request = &GetFaceDetailRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("imm", "2017-09-06", "GetFaceDetail", "imm", "openAPI")
	return
}

// CreateGetFaceDetailResponse creates a response to parse from GetFaceDetail response
func CreateGetFaceDetailResponse() (response *GetFaceDetailResponse) {
	response = &GetFaceDetailResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}
