func (c *Operation) registerHandler() {
	c.handlers = []Handler{
		support.NewHTTPHandler(createVaultEndpoint, http.MethodPost, c.createDataVaultHandler),
		support.NewHTTPHandler(queryVaultEndpoint, http.MethodPost, c.queryVaultHandler),
		support.NewHTTPHandler(createDocumentEndpoint, http.MethodPost, c.createDocumentHandler),
		support.NewHTTPHandler(readDocumentEndpoint, http.MethodGet, c.readDocumentHandler),
		support.NewHTTPHandler(updateDocumentEndpoint, http.MethodPost, c.updateDocumentHandler),
		support.NewHTTPHandler(deleteDocumentEndpoint, http.MethodDelete, c.deleteDocumentHandler),
	}
	if c.enabledExtensions != nil {
		if c.enabledExtensions.Batch {
			c.handlers = append(c.handlers,
				support.NewHTTPHandler(batchEndpoint, http.MethodPost, c.batchHandler))
		}
	}
}
registerHandler register handlers to be exposed from this service as REST API endpoints.
package operation
import (
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
	"github.com/gorilla/mux"
	"github.com/hyperledger/aries-framework-go/spi/storage"
	"github.com/trustbloc/edge-core/pkg/log"
	"github.com/trustbloc/edv/pkg/edvprovider"
	"github.com/trustbloc/edv/pkg/edvutils"
	"github.com/trustbloc/edv/pkg/internal/common/support"
	"github.com/trustbloc/edv/pkg/restapi/messages"
	"github.com/trustbloc/edv/pkg/restapi/models"
)
const (
	logModuleName = "restapi"
	edvCommonEndpointPathRoot = "/encrypted-data-vaults"
	vaultIDPathVariable       = "vaultID"
	docIDPathVariable         = "docID"
	createVaultEndpoint = edvCommonEndpointPathRoot
	queryVaultEndpoint     = edvCommonEndpointPathRoot + "/{" + vaultIDPathVariable + "}/query"
	createDocumentEndpoint = edvCommonEndpointPathRoot + "/{" + vaultIDPathVariable + "}/documents"
	batchEndpoint          = edvCommonEndpointPathRoot + "/{" + vaultIDPathVariable + "}/batch"
	readDocumentEndpoint   = edvCommonEndpointPathRoot + "/{" + vaultIDPathVariable + "}/documents/{" +
		docIDPathVariable + "}"
	updateDocumentEndpoint = edvCommonEndpointPathRoot + "/{" + vaultIDPathVariable + "}/documents/{" +
		docIDPathVariable + "}"
	deleteDocumentEndpoint = edvCommonEndpointPathRoot + "/{" + vaultIDPathVariable + "}/documents/{" +
		docIDPathVariable + "}"
)
var logger = log.New(logModuleName)
type Operation struct {
	handlers          []Handler
	vaultCollection   VaultCollection
	authEnable        bool
	authService       authService
	enabledExtensions *EnabledExtensions
}
type authService interface {
	Create(resourceID, verificationMethod string) ([]byte, error)
}
type VaultCollection struct {
	provider *edvprovider.Provider
}
type Handler interface {
	Path() string
	Method() string
	Handle() http.HandlerFunc
}
type EnabledExtensions struct {
	ReturnFullDocumentsOnQuery bool
	ReadAllDocumentsEndpoint   bool
	Batch                      bool
}
type Config struct {
	Provider          *edvprovider.Provider
	AuthService       authService
	AuthEnable        bool
	EnabledExtensions *EnabledExtensions
}
func New(config *Config) *Operation {
	svc := &Operation{
		vaultCollection: VaultCollection{
			provider: config.Provider,
		}, authEnable: config.AuthEnable, authService: config.AuthService, enabledExtensions: config.EnabledExtensions,
	}
	svc.registerHandler()
	return svc
}