/
types.go
88 lines (78 loc) · 2.98 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Code generated by goa v2.2.4, DO NOT EDIT.
//
// secured_service gRPC client types
//
// Command:
// $ goa gen goa.design/examples/security/design -o
// $(GOPATH)/src/goa.design/examples/security
package client
import (
secured_servicepb "goa.design/examples/security/gen/grpc/secured_service/pb"
securedservice "goa.design/examples/security/gen/secured_service"
)
// NewSigninRequest builds the gRPC request type from the payload of the
// "signin" endpoint of the "secured_service" service.
func NewSigninRequest() *secured_servicepb.SigninRequest {
message := &secured_servicepb.SigninRequest{}
return message
}
// NewSigninResult builds the result type of the "signin" endpoint of the
// "secured_service" service from the gRPC response type.
func NewSigninResult(message *secured_servicepb.SigninResponse) *securedservice.Creds {
result := &securedservice.Creds{
JWT: message.Jwt,
APIKey: message.ApiKey,
OauthToken: message.OauthToken,
}
return result
}
// NewSecureRequest builds the gRPC request type from the payload of the
// "secure" endpoint of the "secured_service" service.
func NewSecureRequest(payload *securedservice.SecurePayload) *secured_servicepb.SecureRequest {
message := &secured_servicepb.SecureRequest{}
if payload.Fail != nil {
message.Fail = *payload.Fail
}
return message
}
// NewSecureResult builds the result type of the "secure" endpoint of the
// "secured_service" service from the gRPC response type.
func NewSecureResult(message *secured_servicepb.SecureResponse) string {
result := message.Field
return result
}
// NewDoublySecureRequest builds the gRPC request type from the payload of the
// "doubly_secure" endpoint of the "secured_service" service.
func NewDoublySecureRequest(payload *securedservice.DoublySecurePayload) *secured_servicepb.DoublySecureRequest {
message := &secured_servicepb.DoublySecureRequest{
Key: payload.Key,
}
return message
}
// NewDoublySecureResult builds the result type of the "doubly_secure" endpoint
// of the "secured_service" service from the gRPC response type.
func NewDoublySecureResult(message *secured_servicepb.DoublySecureResponse) string {
result := message.Field
return result
}
// NewAlsoDoublySecureRequest builds the gRPC request type from the payload of
// the "also_doubly_secure" endpoint of the "secured_service" service.
func NewAlsoDoublySecureRequest(payload *securedservice.AlsoDoublySecurePayload) *secured_servicepb.AlsoDoublySecureRequest {
message := &secured_servicepb.AlsoDoublySecureRequest{}
if payload.Username != nil {
message.Username = *payload.Username
}
if payload.Password != nil {
message.Password = *payload.Password
}
if payload.Key != nil {
message.Key = *payload.Key
}
return message
}
// NewAlsoDoublySecureResult builds the result type of the "also_doubly_secure"
// endpoint of the "secured_service" service from the gRPC response type.
func NewAlsoDoublySecureResult(message *secured_servicepb.AlsoDoublySecureResponse) string {
result := message.Field
return result
}