github.com/vchain-us/vcn@v0.9.11-0.20210921212052-a2484d23c0b3/pkg/cmd/serve/lc_inspect.go (about) 1 /* 2 * Copyright (c) 2018-2020 vChain, Inc. All Rights Reserved. 3 * This software is released under GPL3. 4 * The full license information can be found under: 5 * https://www.gnu.org/licenses/gpl-3.0.en.html 6 * 7 */ 8 9 package serve 10 11 import ( 12 "fmt" 13 "github.com/vchain-us/vcn/pkg/api" 14 insp "github.com/vchain-us/vcn/pkg/cmd/inspect" 15 "net/http" 16 ) 17 18 func lcInspect(user *api.LcUser, hash, signerID string, w http.ResponseWriter) { 19 if user.Client.ApiKey == "" { 20 writeError(w, http.StatusUnauthorized, fmt.Errorf("api key not provided")) 21 return 22 } 23 err := user.Client.Connect() 24 if err != nil { 25 writeError(w, http.StatusBadGateway, err) 26 return 27 } 28 29 results, err := insp.GetLcResults(hash, signerID, user, 0, 0, "", "") 30 if err != nil { 31 writeError(w, http.StatusBadGateway, err) 32 return 33 } 34 35 writeLcResults(w, http.StatusOK, results) 36 }