Image service (#89)

This commit is contained in:
Janos Dobronszki
2021-05-05 11:15:40 +01:00
committed by GitHub
parent feb3550c7c
commit e563d6114b
15 changed files with 1133 additions and 5 deletions

View File

@@ -18,14 +18,15 @@ import (
"github.com/stoewer/go-strcase"
)
func saveMeta(service, readme, openapijson string) error {
func saveMeta(service, readme, openapijson, examplejson string) error {
client := &http.Client{}
//Encode the data
postBody, _ := json.Marshal(map[string]string{
"serviceName": service,
"readme": readme,
"openAPIJSON": openapijson,
"serviceName": service,
"readme": readme,
"openAPIJSON": openapijson,
"examplesJSON": examplejson,
})
rbody := bytes.NewBuffer(postBody)
@@ -122,7 +123,10 @@ func main() {
os.Exit(1)
}
err = saveMeta(serviceName, string(dat), string(js))
// not every service has examples
examples, _ := ioutil.ReadFile(filepath.Join(serviceDir, "examples.json"))
err = saveMeta(serviceName, string(dat), string(js), string(examples))
if err != nil {
fmt.Println("Failed to save meta to explore service", err)
os.Exit(1)