func (client *ExplicitClient) postOptionalIntegerPropertyHandleError(resp *http.Response) error {
	body, err := runtime.Payload(resp)
	if err != nil {
		return runtime.NewResponseError(err, resp)
	}
	errType := Error{raw: string(body)}
	if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
		return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
	}
	return runtime.NewResponseError(&errType, resp)
}
postOptionalIntegerPropertyHandleError handles the PostOptionalIntegerProperty error response.
package optionalgroup
import (
	"context"
	"fmt"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
	"io"
	"net/http"
	"strconv"
	"strings"
)
type ExplicitClient struct {
	con *Connection
}
func NewExplicitClient(con *Connection) *ExplicitClient {
	return &ExplicitClient{con: con}
}
func (client *ExplicitClient) PostOptionalArrayHeader(ctx context.Context, options *ExplicitPostOptionalArrayHeaderOptions) (ExplicitPostOptionalArrayHeaderResponse, error) {
	req, err := client.postOptionalArrayHeaderCreateRequest(ctx, options)
	if err != nil {
		return ExplicitPostOptionalArrayHeaderResponse{}, err
	}
	resp, err := client.con.Pipeline().Do(req)
	if err != nil {
		return ExplicitPostOptionalArrayHeaderResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK) {
		return ExplicitPostOptionalArrayHeaderResponse{}, client.postOptionalArrayHeaderHandleError(resp)
	}
	return ExplicitPostOptionalArrayHeaderResponse{RawResponse: resp}, nil
}
func (client *ExplicitClient) postOptionalArrayHeaderCreateRequest(ctx context.Context, options *ExplicitPostOptionalArrayHeaderOptions) (*policy.Request, error) {
	urlPath := "/reqopt/optional/array/header"
	req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.con.Endpoint(), urlPath))
	if err != nil {
		return nil, err
	}
	if options != nil && options.HeaderParameter != nil {
		req.Raw().Header.Set("headerParameter", strings.Join(options.HeaderParameter, ","))
	}
	req.Raw().Header.Set("Accept", "application/json")
	return req, nil
}
func (client *ExplicitClient) postOptionalArrayHeaderHandleError(resp *http.Response) error {
	body, err := runtime.Payload(resp)
	if err != nil {
		return runtime.NewResponseError(err, resp)
	}
	errType := Error{raw: string(body)}
	if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
		return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
	}
	return runtime.NewResponseError(&errType, resp)
}
func (client *ExplicitClient) PostOptionalArrayParameter(ctx context.Context, options *ExplicitPostOptionalArrayParameterOptions) (ExplicitPostOptionalArrayParameterResponse, error) {
	req, err := client.postOptionalArrayParameterCreateRequest(ctx, options)
	if err != nil {
		return ExplicitPostOptionalArrayParameterResponse{}, err
	}
	resp, err := client.con.Pipeline().Do(req)
	if err != nil {
		return ExplicitPostOptionalArrayParameterResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK) {
		return ExplicitPostOptionalArrayParameterResponse{}, client.postOptionalArrayParameterHandleError(resp)
	}
	return ExplicitPostOptionalArrayParameterResponse{RawResponse: resp}, nil
}
func (client *ExplicitClient) postOptionalArrayParameterCreateRequest(ctx context.Context, options *ExplicitPostOptionalArrayParameterOptions) (*policy.Request, error) {
	urlPath := "/reqopt/optional/array/parameter"
	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.BodyParameter != nil {
		return req, runtime.MarshalAsJSON(req, options.BodyParameter)
	}
	return req, nil
}
func (client *ExplicitClient) postOptionalArrayParameterHandleError(resp *http.Response) error {
	body, err := runtime.Payload(resp)
	if err != nil {
		return runtime.NewResponseError(err, resp)
	}
	errType := Error{raw: string(body)}
	if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
		return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
	}
	return runtime.NewResponseError(&errType, resp)
}
func (client *ExplicitClient) PostOptionalArrayProperty(ctx context.Context, options *ExplicitPostOptionalArrayPropertyOptions) (ExplicitPostOptionalArrayPropertyResponse, error) {
	req, err := client.postOptionalArrayPropertyCreateRequest(ctx, options)
	if err != nil {
		return ExplicitPostOptionalArrayPropertyResponse{}, err
	}
	resp, err := client.con.Pipeline().Do(req)
	if err != nil {
		return ExplicitPostOptionalArrayPropertyResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK) {
		return ExplicitPostOptionalArrayPropertyResponse{}, client.postOptionalArrayPropertyHandleError(resp)
	}
	return ExplicitPostOptionalArrayPropertyResponse{RawResponse: resp}, nil
}
func (client *ExplicitClient) postOptionalArrayPropertyCreateRequest(ctx context.Context, options *ExplicitPostOptionalArrayPropertyOptions) (*policy.Request, error) {
	urlPath := "/reqopt/optional/array/property"
	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.BodyParameter != nil {
		return req, runtime.MarshalAsJSON(req, *options.BodyParameter)
	}
	return req, nil
}
func (client *ExplicitClient) postOptionalArrayPropertyHandleError(resp *http.Response) error {
	body, err := runtime.Payload(resp)
	if err != nil {
		return runtime.NewResponseError(err, resp)
	}
	errType := Error{raw: string(body)}
	if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
		return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
	}
	return runtime.NewResponseError(&errType, resp)
}
func (client *ExplicitClient) PostOptionalClassParameter(ctx context.Context, options *ExplicitPostOptionalClassParameterOptions) (ExplicitPostOptionalClassParameterResponse, error) {
	req, err := client.postOptionalClassParameterCreateRequest(ctx, options)
	if err != nil {
		return ExplicitPostOptionalClassParameterResponse{}, err
	}
	resp, err := client.con.Pipeline().Do(req)
	if err != nil {
		return ExplicitPostOptionalClassParameterResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK) {
		return ExplicitPostOptionalClassParameterResponse{}, client.postOptionalClassParameterHandleError(resp)
	}
	return ExplicitPostOptionalClassParameterResponse{RawResponse: resp}, nil
}
func (client *ExplicitClient) postOptionalClassParameterCreateRequest(ctx context.Context, options *ExplicitPostOptionalClassParameterOptions) (*policy.Request, error) {
	urlPath := "/reqopt/optional/class/parameter"
	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.BodyParameter != nil {
		return req, runtime.MarshalAsJSON(req, *options.BodyParameter)
	}
	return req, nil
}
func (client *ExplicitClient) postOptionalClassParameterHandleError(resp *http.Response) error {
	body, err := runtime.Payload(resp)
	if err != nil {
		return runtime.NewResponseError(err, resp)
	}
	errType := Error{raw: string(body)}
	if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
		return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
	}
	return runtime.NewResponseError(&errType, resp)
}
func (client *ExplicitClient) PostOptionalClassProperty(ctx context.Context, options *ExplicitPostOptionalClassPropertyOptions) (ExplicitPostOptionalClassPropertyResponse, error) {
	req, err := client.postOptionalClassPropertyCreateRequest(ctx, options)
	if err != nil {
		return ExplicitPostOptionalClassPropertyResponse{}, err
	}
	resp, err := client.con.Pipeline().Do(req)
	if err != nil {
		return ExplicitPostOptionalClassPropertyResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK) {
		return ExplicitPostOptionalClassPropertyResponse{}, client.postOptionalClassPropertyHandleError(resp)
	}
	return ExplicitPostOptionalClassPropertyResponse{RawResponse: resp}, nil
}
func (client *ExplicitClient) postOptionalClassPropertyCreateRequest(ctx context.Context, options *ExplicitPostOptionalClassPropertyOptions) (*policy.Request, error) {
	urlPath := "/reqopt/optional/class/property"
	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.BodyParameter != nil {
		return req, runtime.MarshalAsJSON(req, *options.BodyParameter)
	}
	return req, nil
}
func (client *ExplicitClient) postOptionalClassPropertyHandleError(resp *http.Response) error {
	body, err := runtime.Payload(resp)
	if err != nil {
		return runtime.NewResponseError(err, resp)
	}
	errType := Error{raw: string(body)}
	if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
		return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
	}
	return runtime.NewResponseError(&errType, resp)
}
func (client *ExplicitClient) PostOptionalIntegerHeader(ctx context.Context, options *ExplicitPostOptionalIntegerHeaderOptions) (ExplicitPostOptionalIntegerHeaderResponse, error) {
	req, err := client.postOptionalIntegerHeaderCreateRequest(ctx, options)
	if err != nil {
		return ExplicitPostOptionalIntegerHeaderResponse{}, err
	}
	resp, err := client.con.Pipeline().Do(req)
	if err != nil {
		return ExplicitPostOptionalIntegerHeaderResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK) {
		return ExplicitPostOptionalIntegerHeaderResponse{}, client.postOptionalIntegerHeaderHandleError(resp)
	}
	return ExplicitPostOptionalIntegerHeaderResponse{RawResponse: resp}, nil
}
func (client *ExplicitClient) postOptionalIntegerHeaderCreateRequest(ctx context.Context, options *ExplicitPostOptionalIntegerHeaderOptions) (*policy.Request, error) {
	urlPath := "/reqopt/optional/integer/header"
	req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.con.Endpoint(), urlPath))
	if err != nil {
		return nil, err
	}
	if options != nil && options.HeaderParameter != nil {
		req.Raw().Header.Set("headerParameter", strconv.FormatInt(int64(*options.HeaderParameter), 10))
	}
	req.Raw().Header.Set("Accept", "application/json")
	return req, nil
}
func (client *ExplicitClient) postOptionalIntegerHeaderHandleError(resp *http.Response) error {
	body, err := runtime.Payload(resp)
	if err != nil {
		return runtime.NewResponseError(err, resp)
	}
	errType := Error{raw: string(body)}
	if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
		return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
	}
	return runtime.NewResponseError(&errType, resp)
}
func (client *ExplicitClient) PostOptionalIntegerParameter(ctx context.Context, options *ExplicitPostOptionalIntegerParameterOptions) (ExplicitPostOptionalIntegerParameterResponse, error) {
	req, err := client.postOptionalIntegerParameterCreateRequest(ctx, options)
	if err != nil {
		return ExplicitPostOptionalIntegerParameterResponse{}, err
	}
	resp, err := client.con.Pipeline().Do(req)
	if err != nil {
		return ExplicitPostOptionalIntegerParameterResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK) {
		return ExplicitPostOptionalIntegerParameterResponse{}, client.postOptionalIntegerParameterHandleError(resp)
	}
	return ExplicitPostOptionalIntegerParameterResponse{RawResponse: resp}, nil
}
func (client *ExplicitClient) postOptionalIntegerParameterCreateRequest(ctx context.Context, options *ExplicitPostOptionalIntegerParameterOptions) (*policy.Request, error) {
	urlPath := "/reqopt/optional/integer/parameter"
	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.BodyParameter != nil {
		return req, runtime.MarshalAsJSON(req, *options.BodyParameter)
	}
	return req, nil
}
func (client *ExplicitClient) postOptionalIntegerParameterHandleError(resp *http.Response) error {
	body, err := runtime.Payload(resp)
	if err != nil {
		return runtime.NewResponseError(err, resp)
	}
	errType := Error{raw: string(body)}
	if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
		return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
	}
	return runtime.NewResponseError(&errType, resp)
}
func (client *ExplicitClient) PostOptionalIntegerProperty(ctx context.Context, options *ExplicitPostOptionalIntegerPropertyOptions) (ExplicitPostOptionalIntegerPropertyResponse, error) {
	req, err := client.postOptionalIntegerPropertyCreateRequest(ctx, options)
	if err != nil {
		return ExplicitPostOptionalIntegerPropertyResponse{}, err
	}
	resp, err := client.con.Pipeline().Do(req)
	if err != nil {
		return ExplicitPostOptionalIntegerPropertyResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK) {
		return ExplicitPostOptionalIntegerPropertyResponse{}, client.postOptionalIntegerPropertyHandleError(resp)
	}
	return ExplicitPostOptionalIntegerPropertyResponse{RawResponse: resp}, nil
}
func (client *ExplicitClient) postOptionalIntegerPropertyCreateRequest(ctx context.Context, options *ExplicitPostOptionalIntegerPropertyOptions) (*policy.Request, error) {
	urlPath := "/reqopt/optional/integer/property"
	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.BodyParameter != nil {
		return req, runtime.MarshalAsJSON(req, *options.BodyParameter)
	}
	return req, nil
}