func (client *PetClient) addPetHandleError(resp *http.Response) error {
	body, err := runtime.Payload(resp)
	if err != nil {
		return runtime.NewResponseError(err, resp)
	}
	if len(body) == 0 {
		return runtime.NewResponseError(errors.New(resp.Status), resp)
	}
	return runtime.NewResponseError(errors.New(string(body)), resp)
}
addPetHandleError handles the AddPet error response.
package extenumsgroup
import (
	"context"
	"errors"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
	"net/http"
	"net/url"
	"strings"
)
type PetClient struct {
	con *Connection
}
func NewPetClient(con *Connection) *PetClient {
	return &PetClient{con: con}
}
func (client *PetClient) AddPet(ctx context.Context, options *PetAddPetOptions) (PetAddPetResponse, error) {
	req, err := client.addPetCreateRequest(ctx, options)
	if err != nil {
		return PetAddPetResponse{}, err
	}
	resp, err := client.con.Pipeline().Do(req)
	if err != nil {
		return PetAddPetResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK) {
		return PetAddPetResponse{}, client.addPetHandleError(resp)
	}
	return client.addPetHandleResponse(resp)
}
func (client *PetClient) addPetCreateRequest(ctx context.Context, options *PetAddPetOptions) (*policy.Request, error) {
	urlPath := "/extensibleenums/pet/addPet"
	req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.con.Endpoint(), urlPath))
	if err != nil {
		return nil, err
	}
	req.Raw().Header.Set("Accept", "application/json")
	if options != nil && options.PetParam != nil {
		return req, runtime.MarshalAsJSON(req, *options.PetParam)
	}
	return req, nil
}
func (client *PetClient) addPetHandleResponse(resp *http.Response) (PetAddPetResponse, error) {
	result := PetAddPetResponse{RawResponse: resp}
	if err := runtime.UnmarshalAsJSON(resp, &result.Pet); err != nil {
		return PetAddPetResponse{}, runtime.NewResponseError(err, resp)
	}
	return result, nil
}