-
Notifications
You must be signed in to change notification settings - Fork 0
/
bind.lug.pb.go
152 lines (146 loc) · 5.04 KB
/
bind.lug.pb.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// Code generated by protoc-gen-lug. DO NOT EDIT.
// versions:
// - protoc-gen-lug v0.1.0
// - protoc v3.17.3
// source: proto/login/bind.proto
package login
import (
fiber "github.com/pubgo/lug/pkg/builder/fiber"
grpcc "github.com/pubgo/lug/plugins/grpcc"
xgen "github.com/pubgo/lug/xgen"
xerror "github.com/pubgo/xerror"
grpc "google.golang.org/grpc"
reflect "reflect"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
func GetBindTelephoneClient(srv string, opts ...func(cfg *grpcc.Cfg)) func(func(cli BindTelephoneClient)) error {
client := grpcc.GetClient(srv, opts...)
return func(fn func(cli BindTelephoneClient)) (err error) {
defer xerror.RespErr(&err)
c, err := client.Get()
if err != nil {
return xerror.WrapF(err, "srv: %s", srv)
}
fn(&bindTelephoneClient{c})
return
}
}
func init() {
var mthList []xgen.GrpcRestHandler
mthList = append(mthList, xgen.GrpcRestHandler{
Input: &CheckRequest{},
Output: &CheckResponse{},
Service: "login.BindTelephone",
Name: "Check",
Method: "POST",
Path: "/user/bind-telephone/check",
DefaultUrl: false,
ClientStream: false,
ServerStream: false,
})
mthList = append(mthList, xgen.GrpcRestHandler{
Input: &BindVerifyRequest{},
Output: &BindVerifyResponse{},
Service: "login.BindTelephone",
Name: "BindVerify",
Method: "POST",
Path: "/user/bind-telephone/bind-verify",
DefaultUrl: false,
ClientStream: false,
ServerStream: false,
})
mthList = append(mthList, xgen.GrpcRestHandler{
Input: &BindChangeRequest{},
Output: &BindChangeResponse{},
Service: "login.BindTelephone",
Name: "BindChange",
Method: "POST",
Path: "/user/bind-telephone/bind-change",
DefaultUrl: false,
ClientStream: false,
ServerStream: false,
})
mthList = append(mthList, xgen.GrpcRestHandler{
Input: &AutomaticBindRequest{},
Output: &AutomaticBindResponse{},
Service: "login.BindTelephone",
Name: "AutomaticBind",
Method: "POST",
Path: "/user/bind-telephone/automatic-bind",
DefaultUrl: false,
ClientStream: false,
ServerStream: false,
})
mthList = append(mthList, xgen.GrpcRestHandler{
Input: &BindPhoneParseRequest{},
Output: &BindPhoneParseResponse{},
Service: "login.BindTelephone",
Name: "BindPhoneParse",
Method: "POST",
Path: "/user/bind-telephone/bind-phone-parse",
DefaultUrl: false,
ClientStream: false,
ServerStream: false,
})
mthList = append(mthList, xgen.GrpcRestHandler{
Input: &BindPhoneParseByOneClickRequest{},
Output: &BindPhoneParseByOneClickResponse{},
Service: "login.BindTelephone",
Name: "BindPhoneParseByOneClick",
Method: "POST",
Path: "/user/bind-telephone/bind-phone-parse-by-one-click",
DefaultUrl: false,
ClientStream: false,
ServerStream: false,
})
xgen.Add(reflect.ValueOf(RegisterBindTelephoneServer), mthList)
xgen.Add(reflect.ValueOf(RegisterBindTelephoneHandlerServer), nil)
}
func RegisterBindTelephoneRestServer(app fiber.Router, server BindTelephoneServer) {
xerror.Assert(app == nil || server == nil, "app is nil or server is nil")
app.Add("POST", "/user/bind-telephone/check", func(ctx *fiber.Ctx) error {
var req = new(CheckRequest)
xerror.Panic(ctx.BodyParser(req))
var resp, err = server.Check(ctx.UserContext(), req)
xerror.Panic(err)
return xerror.Wrap(ctx.JSON(resp))
})
app.Add("POST", "/user/bind-telephone/bind-verify", func(ctx *fiber.Ctx) error {
var req = new(BindVerifyRequest)
xerror.Panic(ctx.BodyParser(req))
var resp, err = server.BindVerify(ctx.UserContext(), req)
xerror.Panic(err)
return xerror.Wrap(ctx.JSON(resp))
})
app.Add("POST", "/user/bind-telephone/bind-change", func(ctx *fiber.Ctx) error {
var req = new(BindChangeRequest)
xerror.Panic(ctx.BodyParser(req))
var resp, err = server.BindChange(ctx.UserContext(), req)
xerror.Panic(err)
return xerror.Wrap(ctx.JSON(resp))
})
app.Add("POST", "/user/bind-telephone/automatic-bind", func(ctx *fiber.Ctx) error {
var req = new(AutomaticBindRequest)
xerror.Panic(ctx.BodyParser(req))
var resp, err = server.AutomaticBind(ctx.UserContext(), req)
xerror.Panic(err)
return xerror.Wrap(ctx.JSON(resp))
})
app.Add("POST", "/user/bind-telephone/bind-phone-parse", func(ctx *fiber.Ctx) error {
var req = new(BindPhoneParseRequest)
xerror.Panic(ctx.BodyParser(req))
var resp, err = server.BindPhoneParse(ctx.UserContext(), req)
xerror.Panic(err)
return xerror.Wrap(ctx.JSON(resp))
})
app.Add("POST", "/user/bind-telephone/bind-phone-parse-by-one-click", func(ctx *fiber.Ctx) error {
var req = new(BindPhoneParseByOneClickRequest)
xerror.Panic(ctx.BodyParser(req))
var resp, err = server.BindPhoneParseByOneClick(ctx.UserContext(), req)
xerror.Panic(err)
return xerror.Wrap(ctx.JSON(resp))
})
}