{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v0.6.1-preview","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package rest\n\n## Variables\n\n```go\nvar (\n\t// Pre-defined errors and messages.\n\tParseError     = \u0026rpcError{Code: -32700, Message: \"Parse error\", Data: \"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.\"}\n\tInvalidRequest = \u0026rpcError{Code: -32600, Message: \"Invalid request\", Data: \"The JSON sent is not a valid Request object.\"}\n\tMethodNotFound = \u0026rpcError{Code: -32601, Message: \"Method not found\", Data: \"The method does not exist / is not available.\"}\n\tInvalidParams  = \u0026rpcError{Code: -32602, Message: \"Invalid params\", Data: \"Invalid method parameter(s).\"}\n\tInternalError  = \u0026rpcError{Code: -32603, Message: \"Internal error\", Data: \"Internal JSON-RPC error.\"}\n\n\t// -32000 to -32099\t - Server error. Reserved for implementation-defined server-errors.\n\tMissingRegistrationError = \u0026rpcError{Code: -32000, Message: \"Registration missing\", Data: \"User not logged in. Use the '/registrar' endpoint to obtain a security token.\"}\n\tChaincodeDeployError     = \u0026rpcError{Code: -32001, Message: \"Deployment failure\", Data: \"Chaincode deployment has failed.\"}\n\tChaincodeInvokeError     = \u0026rpcError{Code: -32002, Message: \"Invocation failure\", Data: \"Chaincode invocation has failed.\"}\n\tChaincodeQueryError      = \u0026rpcError{Code: -32003, Message: \"Query failure\", Data: \"Chaincode query has failed.\"}\n)\n```\nJSON RPC 2.0 errors and messages.\n\n```go\nvar (\n\t// ErrNotFound is returned if a requested resource does not exist\n\tErrNotFound = errors.New(\"openchain: resource not found\")\n)\n```\n\n## Functions\n\n```go\nfunc StartOpenchainRESTServer(server *ServerOpenchain, devops *core.Devops)\n```\nStartOpenchainRESTServer initializes the REST service and adds the required middleware and routes.\n\n## Types\n\n```go\ntype PeerInfo interface {\n\tGetPeers() (*pb.PeersMessage, error)\n\tGetPeerEndpoint() (*pb.PeerEndpoint, error)\n}\n```\nPeerInfo defines API to peer info data\n\n```go\ntype ServerOpenchain struct {\n\t// contains filtered or unexported fields\n}\n```\nServerOpenchain defines the Openchain server object, which holds the Ledger data structure and the pointer to the peerServer.\n\n```go\nfunc NewOpenchainServer() (*ServerOpenchain, error)\n```\nNewOpenchainServer creates a new instance of the ServerOpenchain.\n\n```go\nfunc NewOpenchainServerWithPeerInfo(peerServer PeerInfo) (*ServerOpenchain, error)\n```\nNewOpenchainServerWithPeerInfo creates a new instance of the ServerOpenchain.\n\n```go\nfunc (s *ServerOpenchain) GetBlockByNumber(ctx context.Context, num *pb.BlockNumber) (*pb.Block, error)\n```\nGetBlockByNumber returns the data contained within a specific block in the blockchain. The genesis block is block zero.\n\n```go\nfunc (s *ServerOpenchain) GetBlockCount(ctx context.Context, e *empty.Empty) (*pb.BlockCount, error)\n```\nGetBlockCount returns the current number of blocks in the blockchain data structure.\n\n```go\nfunc (s *ServerOpenchain) GetBlockchainInfo(ctx context.Context, e *empty.Empty) (*pb.BlockchainInfo, error)\n```\nGetBlockchainInfo returns information about the blockchain ledger such as height, current block hash, and previous block hash.\n\n```go\nfunc (s *ServerOpenchain) GetPeerEndpoint(ctx context.Context, e *empty.Empty) (*pb.PeersMessage, error)\n```\nGetPeerEndpoint returns PeerEndpoint info of target peer.\n\n```go\nfunc (s *ServerOpenchain) GetPeers(ctx context.Context, e *empty.Empty) (*pb.PeersMessage, error)\n```\nGetPeers returns a list of all peer nodes currently connected to the target peer.\n\n```go\nfunc (s *ServerOpenchain) GetState(ctx context.Context, chaincodeID, key string) ([]byte, error)\n```\nGetState returns the value for a particular chaincode ID and key\n\n```go\nfunc (s *ServerOpenchain) GetTransactionByID(ctx context.Context, txID string) (*pb.Transaction, error)\n```\nGetTransactionByID returns a transaction matching the specified ID\n\n```go\ntype ServerOpenchainREST struct {\n\t// contains filtered or unexported fields\n}\n```\nServerOpenchainREST defines the Openchain REST service object. It exposes the methods available on the ServerOpenchain service and the Devops service through a REST API.\n\n```go\nfunc (s *ServerOpenchainREST) DeleteEnrollmentID(rw web.ResponseWriter, req *web.Request)\n```\nDeleteEnrollmentID removes the login token of the specified user from the Devops server. Once the login token is removed, the specified user will no longer be able to transact without logging in again. On the REST interface, this method may be used as a means of logging out an active client.\n\n```go\nfunc (s *ServerOpenchainREST) Deploy(rw web.ResponseWriter, req *web.Request)\n```\nDeploy first builds the chaincode package and subsequently deploys it to the blockchain.\n\nDeprecated: use the /chaincode endpoint instead (routes to ProcessChaincode)\n\n```go\nfunc (s *ServerOpenchainREST) GetBlockByNumber(rw web.ResponseWriter, req *web.Request)\n```\nGetBlockByNumber returns the data contained within a specific block in the blockchain. The genesis block is block zero.\n\n```go\nfunc (s *ServerOpenchainREST) GetBlockchainInfo(rw web.ResponseWriter, req *web.Request)\n```\nGetBlockchainInfo returns information about the blockchain ledger such as height, current block hash, and previous block hash.\n\n```go\nfunc (s *ServerOpenchainREST) GetEnrollmentCert(rw web.ResponseWriter, req *web.Request)\n```\nGetEnrollmentCert retrieves the enrollment certificate for a given user.\n\n```go\nfunc (s *ServerOpenchainREST) GetEnrollmentID(rw web.ResponseWriter, req *web.Request)\n```\nGetEnrollmentID checks whether a given user has already registered with the Devops server.\n\n```go\nfunc (s *ServerOpenchainREST) GetPeers(rw web.ResponseWriter, req *web.Request)\n```\nGetPeers returns a list of all peer nodes currently connected to the target peer, including itself\n\n```go\nfunc (s *ServerOpenchainREST) GetTransactionByID(rw web.ResponseWriter, req *web.Request)\n```\nGetTransactionByID returns a transaction matching the specified ID\n\n```go\nfunc (s *ServerOpenchainREST) GetTransactionCert(rw web.ResponseWriter, req *web.Request)\n```\nGetTransactionCert retrieves the transaction certificate(s) for a given user.\n\n```go\nfunc (s *ServerOpenchainREST) Invoke(rw web.ResponseWriter, req *web.Request)\n```\nInvoke executes a specified function within a target Chaincode.\n\nDeprecated: use the /chaincode endpoint instead (routes to ProcessChaincode)\n\n```go\nfunc (s *ServerOpenchainREST) NotFound(rw web.ResponseWriter, r *web.Request)\n```\nNotFound returns a custom landing page when a given hyperledger end point had not been defined.\n\n```go\nfunc (s *ServerOpenchainREST) ProcessChaincode(rw web.ResponseWriter, req *web.Request)\n```\nProcessChaincode implements JSON RPC 2.0 specification for chaincode deploy, invoke, and query.\n\n```go\nfunc (s *ServerOpenchainREST) Query(rw web.ResponseWriter, req *web.Request)\n```\nQuery performs the requested query on the target Chaincode.\n\nDeprecated: use the /chaincode endpoint instead (routes to ProcessChaincode)\n\n```go\nfunc (s *ServerOpenchainREST) Register(rw web.ResponseWriter, req *web.Request)\n```\nRegister confirms the enrollmentID and secret password of the client with the CA and stores the enrollment certificate and key in the Devops server.\n\n```go\nfunc (s *ServerOpenchainREST) SetOpenchainServer(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)\n```\nSetOpenchainServer is a middleware function that sets the pointer to the underlying ServerOpenchain object and the undeflying Devops object.\n\n```go\nfunc (s *ServerOpenchainREST) SetResponseType(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)\n```\nSetResponseType is a middleware function that sets the appropriate response headers. Currently, it is setting the \"Content-Type\" to \"application/json\" as well as the necessary headers in order to enable CORS for Swagger usage.\n\n","path":"github.com/eric-erki/https-hyperledger.org/core/rest","name":"rest","synopsis":"","isRedistributable":true}
