func (c *Client) DeclineRequest(piID, reason string) error {
	return c.service.ActionStop(piID, errors.New(reason))
}
DeclineRequest is used when the Issuer does not want to accept the request.
NOTE: For async usage.
package issuecredential
import (
	"errors"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/common/service"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/protocol/issuecredential"
)
var (
	errEmptyOffer    = errors.New("received an empty offer")
	errEmptyProposal = errors.New("received an empty proposal")
	errEmptyRequest  = errors.New("received an empty request")
)
type (
	OfferCredential issuecredential.OfferCredential
	ProposeCredential issuecredential.ProposeCredential
	RequestCredential issuecredential.RequestCredential
	IssueCredential issuecredential.IssueCredential
	Action issuecredential.Action
)
type Provider interface {
	Service(id string) (interface{}, error)
}
type ProtocolService interface {
	service.DIDComm
	Actions() ([]issuecredential.Action, error)
	ActionContinue(piID string, opt issuecredential.Opt) error
	ActionStop(piID string, err error) error
}
type Client struct {
	service.Event
	service ProtocolService
}
func New(ctx Provider) (*Client, error) {
	raw, err := ctx.Service(issuecredential.Name)
	if err != nil {
		return nil, err
	}
	svc, ok := raw.(ProtocolService)
	if !ok {
		return nil, errors.New("cast service to issuecredential service failed")
	}
	return &Client{
		Event:   svc,
		service: svc,
	}, nil
}
func (c *Client) Actions() ([]Action, error) {
	actions, err := c.service.Actions()
	if err != nil {
		return nil, err
	}
	result := make([]Action, len(actions))
	for i, action := range actions {
		result[i] = Action(action)
	}
	return result, nil
}
func (c *Client) SendOffer(offer *OfferCredential, myDID, theirDID string) (string, error) {
	if offer == nil {
		return "", errEmptyOffer
	}
	offer.Type = issuecredential.OfferCredentialMsgType
	return c.service.HandleOutbound(service.NewDIDCommMsgMap(offer), myDID, theirDID)
}
func (c *Client) SendProposal(proposal *ProposeCredential, myDID, theirDID string) (string, error) {
	if proposal == nil {
		return "", errEmptyProposal
	}
	proposal.Type = issuecredential.ProposeCredentialMsgType
	return c.service.HandleOutbound(service.NewDIDCommMsgMap(proposal), myDID, theirDID)
}
func (c *Client) SendRequest(request *RequestCredential, myDID, theirDID string) (string, error) {
	if request == nil {
		return "", errEmptyRequest
	}
	request.Type = issuecredential.RequestCredentialMsgType
	return c.service.HandleOutbound(service.NewDIDCommMsgMap(request), myDID, theirDID)
}
func (c *Client) AcceptProposal(piID string, msg *OfferCredential) error {
	return c.service.ActionContinue(piID, WithOfferCredential(msg))
}
func (c *Client) DeclineProposal(piID, reason string) error {
	return c.service.ActionStop(piID, errors.New(reason))
}
func (c *Client) AcceptOffer(piID string) error {
	return c.service.ActionContinue(piID, nil)
}
func (c *Client) DeclineOffer(piID, reason string) error {
	return c.service.ActionStop(piID, errors.New(reason))
}
func (c *Client) NegotiateProposal(piID string, msg *ProposeCredential) error {
	return c.service.ActionContinue(piID, WithProposeCredential(msg))
}
func (c *Client) AcceptRequest(piID string, msg *IssueCredential) error {
	return c.service.ActionContinue(piID, WithIssueCredential(msg))
}