add goa examples
This commit is contained in:
55
go/goa_example/gen/http/service1/client/cli.go
Normal file
55
go/goa_example/gen/http/service1/client/cli.go
Normal file
@@ -0,0 +1,55 @@
|
||||
// Code generated by goa v3.6.0, DO NOT EDIT.
|
||||
//
|
||||
// Service1 HTTP client CLI support package
|
||||
//
|
||||
// Command:
|
||||
// $ goa gen goa_example/design
|
||||
|
||||
package client
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
service1 "goa_example/gen/service1"
|
||||
)
|
||||
|
||||
// BuildSigninPayload builds the payload for the Service1 signin endpoint from
|
||||
// CLI flags.
|
||||
func BuildSigninPayload(service1SigninUsername string, service1SigninPassword string) (*service1.SigninPayload, error) {
|
||||
var username string
|
||||
{
|
||||
username = service1SigninUsername
|
||||
}
|
||||
var password string
|
||||
{
|
||||
password = service1SigninPassword
|
||||
}
|
||||
v := &service1.SigninPayload{}
|
||||
v.Username = username
|
||||
v.Password = password
|
||||
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// BuildSecurePayload builds the payload for the Service1 secure endpoint from
|
||||
// CLI flags.
|
||||
func BuildSecurePayload(service1SecureBody string, service1SecureToken string) (*service1.SecurePayload, error) {
|
||||
var err error
|
||||
var body SecureRequestBody
|
||||
{
|
||||
err = json.Unmarshal([]byte(service1SecureBody), &body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid JSON for body, \nerror: %s, \nexample of valid JSON:\n%s", err, "'{\n \"fail\": true\n }'")
|
||||
}
|
||||
}
|
||||
var token string
|
||||
{
|
||||
token = service1SecureToken
|
||||
}
|
||||
v := &service1.SecurePayload{
|
||||
Fail: body.Fail,
|
||||
}
|
||||
v.Token = token
|
||||
|
||||
return v, nil
|
||||
}
|
||||
Reference in New Issue
Block a user