@sa2-movie-ticket/testing 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,67 +4,183 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
- workflow_dispatch:
8
7
 
9
8
  permissions:
10
9
  contents: write
11
10
 
12
11
  jobs:
13
- generate-and-publish:
12
+ publish:
14
13
  runs-on: ubuntu-latest
15
14
 
16
15
  steps:
17
- - name: Checkout Repo
18
- uses: actions/checkout@v4
19
- with:
20
- fetch-depth: 0
16
+ - uses: actions/checkout@v4
21
17
 
22
- # Setup Node (needed for npm publish)
23
- - name: Setup Node
24
- uses: actions/setup-node@v4
18
+ - uses: actions/setup-node@v4
25
19
  with:
26
20
  node-version: 20
27
21
  registry-url: https://registry.npmjs.org/
28
22
 
29
- # Setup Bun
30
- - name: Setup Bun
31
- uses: oven-sh/setup-bun@v2
23
+ - uses: oven-sh/setup-bun@v2
32
24
  with:
33
25
  bun-version: latest
34
26
 
35
- # Install protoc
27
+ - uses: actions/setup-go@v5
28
+ with:
29
+ go-version: "1.22"
30
+
36
31
  - name: Install Protoc
37
32
  run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
38
33
 
39
- # Install dependencies
34
+ - name: Install Go Plugins
35
+ run: |
36
+ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
37
+ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
38
+ echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
39
+
40
40
  - name: Install Dependencies
41
41
  run: bun install --frozen-lockfile
42
42
 
43
- # Generate TypeScript from proto
44
43
  - name: Generate Code
45
- run: bun run generate
44
+ run: bun run gen
46
45
 
47
- # Build (ONLY if your package needs dist output)
48
46
  # - name: Build
49
47
  # run: bun run build
50
48
 
51
- # Configure git
52
- - name: Configure Git
53
- run: |
54
- git config user.name "github-actions"
55
- git config user.email "github-actions@github.com"
56
-
57
- # Bump version + commit
58
49
  - name: Bump Version
59
- run: |
60
- npm version patch -m "chore: bump version to %s"
61
-
62
- # Push version commit
63
- - name: Push Changes
64
- run: git push --follow-tags
50
+ run: npm version patch --no-git-tag-version
65
51
 
66
- # Publish to npm
67
- - name: Publish Package
52
+ - name: Publish
68
53
  run: npm publish --access public
69
54
  env:
70
55
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
56
+
57
+
58
+
59
+
60
+
61
+ # name: Generate Code & Publish
62
+
63
+ # on:
64
+ # push:
65
+ # branches:
66
+ # - main
67
+ # workflow_dispatch:
68
+
69
+ # permissions:
70
+ # contents: write
71
+
72
+ # jobs:
73
+ # generate-and-publish:
74
+ # runs-on: ubuntu-latest
75
+
76
+ # steps:
77
+ # # ---------------------------
78
+ # # Checkout
79
+ # # ---------------------------
80
+ # - name: Checkout Repo
81
+ # uses: actions/checkout@v4
82
+ # with:
83
+ # fetch-depth: 0
84
+
85
+ # # ---------------------------
86
+ # # Setup Node (for npm publish)
87
+ # # ---------------------------
88
+ # - name: Setup Node
89
+ # uses: actions/setup-node@v4
90
+ # with:
91
+ # node-version: 20
92
+ # registry-url: https://registry.npmjs.org/
93
+
94
+ # # ---------------------------
95
+ # # Setup Bun
96
+ # # ---------------------------
97
+ # - name: Setup Bun
98
+ # uses: oven-sh/setup-bun@v2
99
+ # with:
100
+ # bun-version: latest
101
+
102
+ # # ---------------------------
103
+ # # Setup Go
104
+ # # ---------------------------
105
+ # - name: Setup Go
106
+ # uses: actions/setup-go@v5
107
+ # with:
108
+ # go-version: "1.22"
109
+
110
+ # # ---------------------------
111
+ # # Install protoc
112
+ # # ---------------------------
113
+ # - name: Install Protoc
114
+ # run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
115
+
116
+ # # ---------------------------
117
+ # # Install Go protoc plugins
118
+ # # ---------------------------
119
+ # - name: Install Go Protobuf Plugins
120
+ # run: |
121
+ # go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
122
+ # go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
123
+ # echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
124
+
125
+ # # ---------------------------
126
+ # # Install dependencies (ts-proto local)
127
+ # # ---------------------------
128
+ # - name: Install Dependencies
129
+ # run: bun install --frozen-lockfile
130
+
131
+ # # ---------------------------
132
+ # # Create output folders
133
+ # # ---------------------------
134
+ # - name: Prepare Output Directories
135
+ # run: mkdir -p gen/ts gen/go
136
+
137
+ # # ---------------------------
138
+ # # Generate TS + Go code
139
+ # # ---------------------------
140
+ # - name: Generate Code
141
+ # run: bun run gen
142
+
143
+ # # ---------------------------
144
+ # # Build TS package (if needed)
145
+ # # ---------------------------
146
+ # # - name: Build
147
+ # # run: bun run build
148
+
149
+ # # ---------------------------
150
+ # # Configure Git
151
+ # # ---------------------------
152
+ # - name: Configure Git
153
+ # run: |
154
+ # git config user.name "github-actions"
155
+ # git config user.email "github-actions@github.com"
156
+
157
+ # # ---------------------------
158
+ # # Commit generated files (optional but recommended)
159
+ # # ---------------------------
160
+ # - name: Commit Generated Code
161
+ # run: |
162
+ # git add gen
163
+ # git diff --cached --quiet || git commit -m "chore: update generated code"
164
+
165
+ # # ---------------------------
166
+ # # Bump version
167
+ # # ---------------------------
168
+ # # - name: Bump Version
169
+ # # run: npm version patch -m "chore: bump version to %s"
170
+
171
+ # # ---------------------------
172
+ # # Push changes & tags
173
+ # # ---------------------------
174
+ # - name: Push Changes
175
+ # run: git push --follow-tags
176
+
177
+ # # ---------------------------
178
+ # # Publish to npm
179
+ # # ---------------------------
180
+ # - name: Publish Package
181
+ # run: npm publish --access public
182
+ # env:
183
+ # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
184
+
185
+
186
+
@@ -0,0 +1,310 @@
1
+ // Code generated by protoc-gen-go. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-go v1.36.11
4
+ // protoc v3.21.12
5
+ // source: proto/auth.proto
6
+
7
+ package auth
8
+
9
+ import (
10
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
11
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
12
+ reflect "reflect"
13
+ sync "sync"
14
+ unsafe "unsafe"
15
+ )
16
+
17
+ const (
18
+ // Verify that this generated code is sufficiently up-to-date.
19
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
20
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
21
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
22
+ )
23
+
24
+ type SendOtpRequest struct {
25
+ state protoimpl.MessageState `protogen:"open.v1"`
26
+ Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
27
+ Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
28
+ unknownFields protoimpl.UnknownFields
29
+ sizeCache protoimpl.SizeCache
30
+ }
31
+
32
+ func (x *SendOtpRequest) Reset() {
33
+ *x = SendOtpRequest{}
34
+ mi := &file_proto_auth_proto_msgTypes[0]
35
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
36
+ ms.StoreMessageInfo(mi)
37
+ }
38
+
39
+ func (x *SendOtpRequest) String() string {
40
+ return protoimpl.X.MessageStringOf(x)
41
+ }
42
+
43
+ func (*SendOtpRequest) ProtoMessage() {}
44
+
45
+ func (x *SendOtpRequest) ProtoReflect() protoreflect.Message {
46
+ mi := &file_proto_auth_proto_msgTypes[0]
47
+ if x != nil {
48
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
49
+ if ms.LoadMessageInfo() == nil {
50
+ ms.StoreMessageInfo(mi)
51
+ }
52
+ return ms
53
+ }
54
+ return mi.MessageOf(x)
55
+ }
56
+
57
+ // Deprecated: Use SendOtpRequest.ProtoReflect.Descriptor instead.
58
+ func (*SendOtpRequest) Descriptor() ([]byte, []int) {
59
+ return file_proto_auth_proto_rawDescGZIP(), []int{0}
60
+ }
61
+
62
+ func (x *SendOtpRequest) GetIdentifier() string {
63
+ if x != nil {
64
+ return x.Identifier
65
+ }
66
+ return ""
67
+ }
68
+
69
+ func (x *SendOtpRequest) GetType() string {
70
+ if x != nil {
71
+ return x.Type
72
+ }
73
+ return ""
74
+ }
75
+
76
+ type SendOtpResponse struct {
77
+ state protoimpl.MessageState `protogen:"open.v1"`
78
+ Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"`
79
+ unknownFields protoimpl.UnknownFields
80
+ sizeCache protoimpl.SizeCache
81
+ }
82
+
83
+ func (x *SendOtpResponse) Reset() {
84
+ *x = SendOtpResponse{}
85
+ mi := &file_proto_auth_proto_msgTypes[1]
86
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
87
+ ms.StoreMessageInfo(mi)
88
+ }
89
+
90
+ func (x *SendOtpResponse) String() string {
91
+ return protoimpl.X.MessageStringOf(x)
92
+ }
93
+
94
+ func (*SendOtpResponse) ProtoMessage() {}
95
+
96
+ func (x *SendOtpResponse) ProtoReflect() protoreflect.Message {
97
+ mi := &file_proto_auth_proto_msgTypes[1]
98
+ if x != nil {
99
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
100
+ if ms.LoadMessageInfo() == nil {
101
+ ms.StoreMessageInfo(mi)
102
+ }
103
+ return ms
104
+ }
105
+ return mi.MessageOf(x)
106
+ }
107
+
108
+ // Deprecated: Use SendOtpResponse.ProtoReflect.Descriptor instead.
109
+ func (*SendOtpResponse) Descriptor() ([]byte, []int) {
110
+ return file_proto_auth_proto_rawDescGZIP(), []int{1}
111
+ }
112
+
113
+ func (x *SendOtpResponse) GetOk() bool {
114
+ if x != nil {
115
+ return x.Ok
116
+ }
117
+ return false
118
+ }
119
+
120
+ type VerifyOtpRequest struct {
121
+ state protoimpl.MessageState `protogen:"open.v1"`
122
+ Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
123
+ Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
124
+ Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"`
125
+ unknownFields protoimpl.UnknownFields
126
+ sizeCache protoimpl.SizeCache
127
+ }
128
+
129
+ func (x *VerifyOtpRequest) Reset() {
130
+ *x = VerifyOtpRequest{}
131
+ mi := &file_proto_auth_proto_msgTypes[2]
132
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
133
+ ms.StoreMessageInfo(mi)
134
+ }
135
+
136
+ func (x *VerifyOtpRequest) String() string {
137
+ return protoimpl.X.MessageStringOf(x)
138
+ }
139
+
140
+ func (*VerifyOtpRequest) ProtoMessage() {}
141
+
142
+ func (x *VerifyOtpRequest) ProtoReflect() protoreflect.Message {
143
+ mi := &file_proto_auth_proto_msgTypes[2]
144
+ if x != nil {
145
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
146
+ if ms.LoadMessageInfo() == nil {
147
+ ms.StoreMessageInfo(mi)
148
+ }
149
+ return ms
150
+ }
151
+ return mi.MessageOf(x)
152
+ }
153
+
154
+ // Deprecated: Use VerifyOtpRequest.ProtoReflect.Descriptor instead.
155
+ func (*VerifyOtpRequest) Descriptor() ([]byte, []int) {
156
+ return file_proto_auth_proto_rawDescGZIP(), []int{2}
157
+ }
158
+
159
+ func (x *VerifyOtpRequest) GetIdentifier() string {
160
+ if x != nil {
161
+ return x.Identifier
162
+ }
163
+ return ""
164
+ }
165
+
166
+ func (x *VerifyOtpRequest) GetType() string {
167
+ if x != nil {
168
+ return x.Type
169
+ }
170
+ return ""
171
+ }
172
+
173
+ func (x *VerifyOtpRequest) GetCode() string {
174
+ if x != nil {
175
+ return x.Code
176
+ }
177
+ return ""
178
+ }
179
+
180
+ type VerifyOtpResponse struct {
181
+ state protoimpl.MessageState `protogen:"open.v1"`
182
+ AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
183
+ RefreshToken string `protobuf:"bytes,2,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
184
+ unknownFields protoimpl.UnknownFields
185
+ sizeCache protoimpl.SizeCache
186
+ }
187
+
188
+ func (x *VerifyOtpResponse) Reset() {
189
+ *x = VerifyOtpResponse{}
190
+ mi := &file_proto_auth_proto_msgTypes[3]
191
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
192
+ ms.StoreMessageInfo(mi)
193
+ }
194
+
195
+ func (x *VerifyOtpResponse) String() string {
196
+ return protoimpl.X.MessageStringOf(x)
197
+ }
198
+
199
+ func (*VerifyOtpResponse) ProtoMessage() {}
200
+
201
+ func (x *VerifyOtpResponse) ProtoReflect() protoreflect.Message {
202
+ mi := &file_proto_auth_proto_msgTypes[3]
203
+ if x != nil {
204
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
205
+ if ms.LoadMessageInfo() == nil {
206
+ ms.StoreMessageInfo(mi)
207
+ }
208
+ return ms
209
+ }
210
+ return mi.MessageOf(x)
211
+ }
212
+
213
+ // Deprecated: Use VerifyOtpResponse.ProtoReflect.Descriptor instead.
214
+ func (*VerifyOtpResponse) Descriptor() ([]byte, []int) {
215
+ return file_proto_auth_proto_rawDescGZIP(), []int{3}
216
+ }
217
+
218
+ func (x *VerifyOtpResponse) GetAccessToken() string {
219
+ if x != nil {
220
+ return x.AccessToken
221
+ }
222
+ return ""
223
+ }
224
+
225
+ func (x *VerifyOtpResponse) GetRefreshToken() string {
226
+ if x != nil {
227
+ return x.RefreshToken
228
+ }
229
+ return ""
230
+ }
231
+
232
+ var File_proto_auth_proto protoreflect.FileDescriptor
233
+
234
+ const file_proto_auth_proto_rawDesc = "" +
235
+ "\n" +
236
+ "\x10proto/auth.proto\x12\aauth.v1\"D\n" +
237
+ "\x0eSendOtpRequest\x12\x1e\n" +
238
+ "\n" +
239
+ "identifier\x18\x01 \x01(\tR\n" +
240
+ "identifier\x12\x12\n" +
241
+ "\x04type\x18\x02 \x01(\tR\x04type\"!\n" +
242
+ "\x0fSendOtpResponse\x12\x0e\n" +
243
+ "\x02ok\x18\x01 \x01(\bR\x02ok\"Z\n" +
244
+ "\x10VerifyOtpRequest\x12\x1e\n" +
245
+ "\n" +
246
+ "identifier\x18\x01 \x01(\tR\n" +
247
+ "identifier\x12\x12\n" +
248
+ "\x04type\x18\x02 \x01(\tR\x04type\x12\x12\n" +
249
+ "\x04code\x18\x03 \x01(\tR\x04code\"[\n" +
250
+ "\x11VerifyOtpResponse\x12!\n" +
251
+ "\faccess_token\x18\x01 \x01(\tR\vaccessToken\x12#\n" +
252
+ "\rrefresh_token\x18\x02 \x01(\tR\frefreshToken2\x8f\x01\n" +
253
+ "\vAuthService\x12<\n" +
254
+ "\aSendOtp\x12\x17.auth.v1.SendOtpRequest\x1a\x18.auth.v1.SendOtpResponse\x12B\n" +
255
+ "\tVerifyOtp\x12\x19.auth.v1.VerifyOtpRequest\x1a\x1a.auth.v1.VerifyOtpResponseB3Z1github.com/sa2-movie-ticket/contracts/gen/go/authb\x06proto3"
256
+
257
+ var (
258
+ file_proto_auth_proto_rawDescOnce sync.Once
259
+ file_proto_auth_proto_rawDescData []byte
260
+ )
261
+
262
+ func file_proto_auth_proto_rawDescGZIP() []byte {
263
+ file_proto_auth_proto_rawDescOnce.Do(func() {
264
+ file_proto_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_auth_proto_rawDesc), len(file_proto_auth_proto_rawDesc)))
265
+ })
266
+ return file_proto_auth_proto_rawDescData
267
+ }
268
+
269
+ var file_proto_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
270
+ var file_proto_auth_proto_goTypes = []any{
271
+ (*SendOtpRequest)(nil), // 0: auth.v1.SendOtpRequest
272
+ (*SendOtpResponse)(nil), // 1: auth.v1.SendOtpResponse
273
+ (*VerifyOtpRequest)(nil), // 2: auth.v1.VerifyOtpRequest
274
+ (*VerifyOtpResponse)(nil), // 3: auth.v1.VerifyOtpResponse
275
+ }
276
+ var file_proto_auth_proto_depIdxs = []int32{
277
+ 0, // 0: auth.v1.AuthService.SendOtp:input_type -> auth.v1.SendOtpRequest
278
+ 2, // 1: auth.v1.AuthService.VerifyOtp:input_type -> auth.v1.VerifyOtpRequest
279
+ 1, // 2: auth.v1.AuthService.SendOtp:output_type -> auth.v1.SendOtpResponse
280
+ 3, // 3: auth.v1.AuthService.VerifyOtp:output_type -> auth.v1.VerifyOtpResponse
281
+ 2, // [2:4] is the sub-list for method output_type
282
+ 0, // [0:2] is the sub-list for method input_type
283
+ 0, // [0:0] is the sub-list for extension type_name
284
+ 0, // [0:0] is the sub-list for extension extendee
285
+ 0, // [0:0] is the sub-list for field type_name
286
+ }
287
+
288
+ func init() { file_proto_auth_proto_init() }
289
+ func file_proto_auth_proto_init() {
290
+ if File_proto_auth_proto != nil {
291
+ return
292
+ }
293
+ type x struct{}
294
+ out := protoimpl.TypeBuilder{
295
+ File: protoimpl.DescBuilder{
296
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
297
+ RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_auth_proto_rawDesc), len(file_proto_auth_proto_rawDesc)),
298
+ NumEnums: 0,
299
+ NumMessages: 4,
300
+ NumExtensions: 0,
301
+ NumServices: 1,
302
+ },
303
+ GoTypes: file_proto_auth_proto_goTypes,
304
+ DependencyIndexes: file_proto_auth_proto_depIdxs,
305
+ MessageInfos: file_proto_auth_proto_msgTypes,
306
+ }.Build()
307
+ File_proto_auth_proto = out.File
308
+ file_proto_auth_proto_goTypes = nil
309
+ file_proto_auth_proto_depIdxs = nil
310
+ }
@@ -0,0 +1,159 @@
1
+ // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
2
+ // versions:
3
+ // - protoc-gen-go-grpc v1.6.1
4
+ // - protoc v3.21.12
5
+ // source: proto/auth.proto
6
+
7
+ package auth
8
+
9
+ import (
10
+ context "context"
11
+ grpc "google.golang.org/grpc"
12
+ codes "google.golang.org/grpc/codes"
13
+ status "google.golang.org/grpc/status"
14
+ )
15
+
16
+ // This is a compile-time assertion to ensure that this generated file
17
+ // is compatible with the grpc package it is being compiled against.
18
+ // Requires gRPC-Go v1.64.0 or later.
19
+ const _ = grpc.SupportPackageIsVersion9
20
+
21
+ const (
22
+ AuthService_SendOtp_FullMethodName = "/auth.v1.AuthService/SendOtp"
23
+ AuthService_VerifyOtp_FullMethodName = "/auth.v1.AuthService/VerifyOtp"
24
+ )
25
+
26
+ // AuthServiceClient is the client API for AuthService service.
27
+ //
28
+ // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
29
+ type AuthServiceClient interface {
30
+ SendOtp(ctx context.Context, in *SendOtpRequest, opts ...grpc.CallOption) (*SendOtpResponse, error)
31
+ VerifyOtp(ctx context.Context, in *VerifyOtpRequest, opts ...grpc.CallOption) (*VerifyOtpResponse, error)
32
+ }
33
+
34
+ type authServiceClient struct {
35
+ cc grpc.ClientConnInterface
36
+ }
37
+
38
+ func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient {
39
+ return &authServiceClient{cc}
40
+ }
41
+
42
+ func (c *authServiceClient) SendOtp(ctx context.Context, in *SendOtpRequest, opts ...grpc.CallOption) (*SendOtpResponse, error) {
43
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
44
+ out := new(SendOtpResponse)
45
+ err := c.cc.Invoke(ctx, AuthService_SendOtp_FullMethodName, in, out, cOpts...)
46
+ if err != nil {
47
+ return nil, err
48
+ }
49
+ return out, nil
50
+ }
51
+
52
+ func (c *authServiceClient) VerifyOtp(ctx context.Context, in *VerifyOtpRequest, opts ...grpc.CallOption) (*VerifyOtpResponse, error) {
53
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
54
+ out := new(VerifyOtpResponse)
55
+ err := c.cc.Invoke(ctx, AuthService_VerifyOtp_FullMethodName, in, out, cOpts...)
56
+ if err != nil {
57
+ return nil, err
58
+ }
59
+ return out, nil
60
+ }
61
+
62
+ // AuthServiceServer is the server API for AuthService service.
63
+ // All implementations must embed UnimplementedAuthServiceServer
64
+ // for forward compatibility.
65
+ type AuthServiceServer interface {
66
+ SendOtp(context.Context, *SendOtpRequest) (*SendOtpResponse, error)
67
+ VerifyOtp(context.Context, *VerifyOtpRequest) (*VerifyOtpResponse, error)
68
+ mustEmbedUnimplementedAuthServiceServer()
69
+ }
70
+
71
+ // UnimplementedAuthServiceServer must be embedded to have
72
+ // forward compatible implementations.
73
+ //
74
+ // NOTE: this should be embedded by value instead of pointer to avoid a nil
75
+ // pointer dereference when methods are called.
76
+ type UnimplementedAuthServiceServer struct{}
77
+
78
+ func (UnimplementedAuthServiceServer) SendOtp(context.Context, *SendOtpRequest) (*SendOtpResponse, error) {
79
+ return nil, status.Error(codes.Unimplemented, "method SendOtp not implemented")
80
+ }
81
+ func (UnimplementedAuthServiceServer) VerifyOtp(context.Context, *VerifyOtpRequest) (*VerifyOtpResponse, error) {
82
+ return nil, status.Error(codes.Unimplemented, "method VerifyOtp not implemented")
83
+ }
84
+ func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {}
85
+ func (UnimplementedAuthServiceServer) testEmbeddedByValue() {}
86
+
87
+ // UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service.
88
+ // Use of this interface is not recommended, as added methods to AuthServiceServer will
89
+ // result in compilation errors.
90
+ type UnsafeAuthServiceServer interface {
91
+ mustEmbedUnimplementedAuthServiceServer()
92
+ }
93
+
94
+ func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) {
95
+ // If the following call panics, it indicates UnimplementedAuthServiceServer was
96
+ // embedded by pointer and is nil. This will cause panics if an
97
+ // unimplemented method is ever invoked, so we test this at initialization
98
+ // time to prevent it from happening at runtime later due to I/O.
99
+ if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
100
+ t.testEmbeddedByValue()
101
+ }
102
+ s.RegisterService(&AuthService_ServiceDesc, srv)
103
+ }
104
+
105
+ func _AuthService_SendOtp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
106
+ in := new(SendOtpRequest)
107
+ if err := dec(in); err != nil {
108
+ return nil, err
109
+ }
110
+ if interceptor == nil {
111
+ return srv.(AuthServiceServer).SendOtp(ctx, in)
112
+ }
113
+ info := &grpc.UnaryServerInfo{
114
+ Server: srv,
115
+ FullMethod: AuthService_SendOtp_FullMethodName,
116
+ }
117
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
118
+ return srv.(AuthServiceServer).SendOtp(ctx, req.(*SendOtpRequest))
119
+ }
120
+ return interceptor(ctx, in, info, handler)
121
+ }
122
+
123
+ func _AuthService_VerifyOtp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
124
+ in := new(VerifyOtpRequest)
125
+ if err := dec(in); err != nil {
126
+ return nil, err
127
+ }
128
+ if interceptor == nil {
129
+ return srv.(AuthServiceServer).VerifyOtp(ctx, in)
130
+ }
131
+ info := &grpc.UnaryServerInfo{
132
+ Server: srv,
133
+ FullMethod: AuthService_VerifyOtp_FullMethodName,
134
+ }
135
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
136
+ return srv.(AuthServiceServer).VerifyOtp(ctx, req.(*VerifyOtpRequest))
137
+ }
138
+ return interceptor(ctx, in, info, handler)
139
+ }
140
+
141
+ // AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service.
142
+ // It's only intended for direct use with grpc.RegisterService,
143
+ // and not to be introspected or modified (even as a copy)
144
+ var AuthService_ServiceDesc = grpc.ServiceDesc{
145
+ ServiceName: "auth.v1.AuthService",
146
+ HandlerType: (*AuthServiceServer)(nil),
147
+ Methods: []grpc.MethodDesc{
148
+ {
149
+ MethodName: "SendOtp",
150
+ Handler: _AuthService_SendOtp_Handler,
151
+ },
152
+ {
153
+ MethodName: "VerifyOtp",
154
+ Handler: _AuthService_VerifyOtp_Handler,
155
+ },
156
+ },
157
+ Streams: []grpc.StreamDesc{},
158
+ Metadata: "proto/auth.proto",
159
+ }
@@ -0,0 +1,310 @@
1
+ // Code generated by protoc-gen-go. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-go v1.36.11
4
+ // protoc v3.21.12
5
+ // source: proto/auth.proto
6
+
7
+ package contracts
8
+
9
+ import (
10
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
11
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
12
+ reflect "reflect"
13
+ sync "sync"
14
+ unsafe "unsafe"
15
+ )
16
+
17
+ const (
18
+ // Verify that this generated code is sufficiently up-to-date.
19
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
20
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
21
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
22
+ )
23
+
24
+ type SendOtpRequest struct {
25
+ state protoimpl.MessageState `protogen:"open.v1"`
26
+ Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
27
+ Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
28
+ unknownFields protoimpl.UnknownFields
29
+ sizeCache protoimpl.SizeCache
30
+ }
31
+
32
+ func (x *SendOtpRequest) Reset() {
33
+ *x = SendOtpRequest{}
34
+ mi := &file_proto_auth_proto_msgTypes[0]
35
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
36
+ ms.StoreMessageInfo(mi)
37
+ }
38
+
39
+ func (x *SendOtpRequest) String() string {
40
+ return protoimpl.X.MessageStringOf(x)
41
+ }
42
+
43
+ func (*SendOtpRequest) ProtoMessage() {}
44
+
45
+ func (x *SendOtpRequest) ProtoReflect() protoreflect.Message {
46
+ mi := &file_proto_auth_proto_msgTypes[0]
47
+ if x != nil {
48
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
49
+ if ms.LoadMessageInfo() == nil {
50
+ ms.StoreMessageInfo(mi)
51
+ }
52
+ return ms
53
+ }
54
+ return mi.MessageOf(x)
55
+ }
56
+
57
+ // Deprecated: Use SendOtpRequest.ProtoReflect.Descriptor instead.
58
+ func (*SendOtpRequest) Descriptor() ([]byte, []int) {
59
+ return file_proto_auth_proto_rawDescGZIP(), []int{0}
60
+ }
61
+
62
+ func (x *SendOtpRequest) GetIdentifier() string {
63
+ if x != nil {
64
+ return x.Identifier
65
+ }
66
+ return ""
67
+ }
68
+
69
+ func (x *SendOtpRequest) GetType() string {
70
+ if x != nil {
71
+ return x.Type
72
+ }
73
+ return ""
74
+ }
75
+
76
+ type SendOtpResponse struct {
77
+ state protoimpl.MessageState `protogen:"open.v1"`
78
+ Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"`
79
+ unknownFields protoimpl.UnknownFields
80
+ sizeCache protoimpl.SizeCache
81
+ }
82
+
83
+ func (x *SendOtpResponse) Reset() {
84
+ *x = SendOtpResponse{}
85
+ mi := &file_proto_auth_proto_msgTypes[1]
86
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
87
+ ms.StoreMessageInfo(mi)
88
+ }
89
+
90
+ func (x *SendOtpResponse) String() string {
91
+ return protoimpl.X.MessageStringOf(x)
92
+ }
93
+
94
+ func (*SendOtpResponse) ProtoMessage() {}
95
+
96
+ func (x *SendOtpResponse) ProtoReflect() protoreflect.Message {
97
+ mi := &file_proto_auth_proto_msgTypes[1]
98
+ if x != nil {
99
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
100
+ if ms.LoadMessageInfo() == nil {
101
+ ms.StoreMessageInfo(mi)
102
+ }
103
+ return ms
104
+ }
105
+ return mi.MessageOf(x)
106
+ }
107
+
108
+ // Deprecated: Use SendOtpResponse.ProtoReflect.Descriptor instead.
109
+ func (*SendOtpResponse) Descriptor() ([]byte, []int) {
110
+ return file_proto_auth_proto_rawDescGZIP(), []int{1}
111
+ }
112
+
113
+ func (x *SendOtpResponse) GetOk() bool {
114
+ if x != nil {
115
+ return x.Ok
116
+ }
117
+ return false
118
+ }
119
+
120
+ type VerifyOtpRequest struct {
121
+ state protoimpl.MessageState `protogen:"open.v1"`
122
+ Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
123
+ Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
124
+ Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"`
125
+ unknownFields protoimpl.UnknownFields
126
+ sizeCache protoimpl.SizeCache
127
+ }
128
+
129
+ func (x *VerifyOtpRequest) Reset() {
130
+ *x = VerifyOtpRequest{}
131
+ mi := &file_proto_auth_proto_msgTypes[2]
132
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
133
+ ms.StoreMessageInfo(mi)
134
+ }
135
+
136
+ func (x *VerifyOtpRequest) String() string {
137
+ return protoimpl.X.MessageStringOf(x)
138
+ }
139
+
140
+ func (*VerifyOtpRequest) ProtoMessage() {}
141
+
142
+ func (x *VerifyOtpRequest) ProtoReflect() protoreflect.Message {
143
+ mi := &file_proto_auth_proto_msgTypes[2]
144
+ if x != nil {
145
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
146
+ if ms.LoadMessageInfo() == nil {
147
+ ms.StoreMessageInfo(mi)
148
+ }
149
+ return ms
150
+ }
151
+ return mi.MessageOf(x)
152
+ }
153
+
154
+ // Deprecated: Use VerifyOtpRequest.ProtoReflect.Descriptor instead.
155
+ func (*VerifyOtpRequest) Descriptor() ([]byte, []int) {
156
+ return file_proto_auth_proto_rawDescGZIP(), []int{2}
157
+ }
158
+
159
+ func (x *VerifyOtpRequest) GetIdentifier() string {
160
+ if x != nil {
161
+ return x.Identifier
162
+ }
163
+ return ""
164
+ }
165
+
166
+ func (x *VerifyOtpRequest) GetType() string {
167
+ if x != nil {
168
+ return x.Type
169
+ }
170
+ return ""
171
+ }
172
+
173
+ func (x *VerifyOtpRequest) GetCode() string {
174
+ if x != nil {
175
+ return x.Code
176
+ }
177
+ return ""
178
+ }
179
+
180
+ type VerifyOtpResponse struct {
181
+ state protoimpl.MessageState `protogen:"open.v1"`
182
+ AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
183
+ RefreshToken string `protobuf:"bytes,2,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
184
+ unknownFields protoimpl.UnknownFields
185
+ sizeCache protoimpl.SizeCache
186
+ }
187
+
188
+ func (x *VerifyOtpResponse) Reset() {
189
+ *x = VerifyOtpResponse{}
190
+ mi := &file_proto_auth_proto_msgTypes[3]
191
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
192
+ ms.StoreMessageInfo(mi)
193
+ }
194
+
195
+ func (x *VerifyOtpResponse) String() string {
196
+ return protoimpl.X.MessageStringOf(x)
197
+ }
198
+
199
+ func (*VerifyOtpResponse) ProtoMessage() {}
200
+
201
+ func (x *VerifyOtpResponse) ProtoReflect() protoreflect.Message {
202
+ mi := &file_proto_auth_proto_msgTypes[3]
203
+ if x != nil {
204
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
205
+ if ms.LoadMessageInfo() == nil {
206
+ ms.StoreMessageInfo(mi)
207
+ }
208
+ return ms
209
+ }
210
+ return mi.MessageOf(x)
211
+ }
212
+
213
+ // Deprecated: Use VerifyOtpResponse.ProtoReflect.Descriptor instead.
214
+ func (*VerifyOtpResponse) Descriptor() ([]byte, []int) {
215
+ return file_proto_auth_proto_rawDescGZIP(), []int{3}
216
+ }
217
+
218
+ func (x *VerifyOtpResponse) GetAccessToken() string {
219
+ if x != nil {
220
+ return x.AccessToken
221
+ }
222
+ return ""
223
+ }
224
+
225
+ func (x *VerifyOtpResponse) GetRefreshToken() string {
226
+ if x != nil {
227
+ return x.RefreshToken
228
+ }
229
+ return ""
230
+ }
231
+
232
+ var File_proto_auth_proto protoreflect.FileDescriptor
233
+
234
+ const file_proto_auth_proto_rawDesc = "" +
235
+ "\n" +
236
+ "\x10proto/auth.proto\x12\aauth.v1\"D\n" +
237
+ "\x0eSendOtpRequest\x12\x1e\n" +
238
+ "\n" +
239
+ "identifier\x18\x01 \x01(\tR\n" +
240
+ "identifier\x12\x12\n" +
241
+ "\x04type\x18\x02 \x01(\tR\x04type\"!\n" +
242
+ "\x0fSendOtpResponse\x12\x0e\n" +
243
+ "\x02ok\x18\x01 \x01(\bR\x02ok\"Z\n" +
244
+ "\x10VerifyOtpRequest\x12\x1e\n" +
245
+ "\n" +
246
+ "identifier\x18\x01 \x01(\tR\n" +
247
+ "identifier\x12\x12\n" +
248
+ "\x04type\x18\x02 \x01(\tR\x04type\x12\x12\n" +
249
+ "\x04code\x18\x03 \x01(\tR\x04code\"[\n" +
250
+ "\x11VerifyOtpResponse\x12!\n" +
251
+ "\faccess_token\x18\x01 \x01(\tR\vaccessToken\x12#\n" +
252
+ "\rrefresh_token\x18\x02 \x01(\tR\frefreshToken2\x8f\x01\n" +
253
+ "\vAuthService\x12<\n" +
254
+ "\aSendOtp\x12\x17.auth.v1.SendOtpRequest\x1a\x18.auth.v1.SendOtpResponse\x12B\n" +
255
+ "\tVerifyOtp\x12\x19.auth.v1.VerifyOtpRequest\x1a\x1a.auth.v1.VerifyOtpResponseB\x14Z\x12./gen/go;contractsb\x06proto3"
256
+
257
+ var (
258
+ file_proto_auth_proto_rawDescOnce sync.Once
259
+ file_proto_auth_proto_rawDescData []byte
260
+ )
261
+
262
+ func file_proto_auth_proto_rawDescGZIP() []byte {
263
+ file_proto_auth_proto_rawDescOnce.Do(func() {
264
+ file_proto_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_auth_proto_rawDesc), len(file_proto_auth_proto_rawDesc)))
265
+ })
266
+ return file_proto_auth_proto_rawDescData
267
+ }
268
+
269
+ var file_proto_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
270
+ var file_proto_auth_proto_goTypes = []any{
271
+ (*SendOtpRequest)(nil), // 0: auth.v1.SendOtpRequest
272
+ (*SendOtpResponse)(nil), // 1: auth.v1.SendOtpResponse
273
+ (*VerifyOtpRequest)(nil), // 2: auth.v1.VerifyOtpRequest
274
+ (*VerifyOtpResponse)(nil), // 3: auth.v1.VerifyOtpResponse
275
+ }
276
+ var file_proto_auth_proto_depIdxs = []int32{
277
+ 0, // 0: auth.v1.AuthService.SendOtp:input_type -> auth.v1.SendOtpRequest
278
+ 2, // 1: auth.v1.AuthService.VerifyOtp:input_type -> auth.v1.VerifyOtpRequest
279
+ 1, // 2: auth.v1.AuthService.SendOtp:output_type -> auth.v1.SendOtpResponse
280
+ 3, // 3: auth.v1.AuthService.VerifyOtp:output_type -> auth.v1.VerifyOtpResponse
281
+ 2, // [2:4] is the sub-list for method output_type
282
+ 0, // [0:2] is the sub-list for method input_type
283
+ 0, // [0:0] is the sub-list for extension type_name
284
+ 0, // [0:0] is the sub-list for extension extendee
285
+ 0, // [0:0] is the sub-list for field type_name
286
+ }
287
+
288
+ func init() { file_proto_auth_proto_init() }
289
+ func file_proto_auth_proto_init() {
290
+ if File_proto_auth_proto != nil {
291
+ return
292
+ }
293
+ type x struct{}
294
+ out := protoimpl.TypeBuilder{
295
+ File: protoimpl.DescBuilder{
296
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
297
+ RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_auth_proto_rawDesc), len(file_proto_auth_proto_rawDesc)),
298
+ NumEnums: 0,
299
+ NumMessages: 4,
300
+ NumExtensions: 0,
301
+ NumServices: 1,
302
+ },
303
+ GoTypes: file_proto_auth_proto_goTypes,
304
+ DependencyIndexes: file_proto_auth_proto_depIdxs,
305
+ MessageInfos: file_proto_auth_proto_msgTypes,
306
+ }.Build()
307
+ File_proto_auth_proto = out.File
308
+ file_proto_auth_proto_goTypes = nil
309
+ file_proto_auth_proto_depIdxs = nil
310
+ }
@@ -0,0 +1,159 @@
1
+ // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
2
+ // versions:
3
+ // - protoc-gen-go-grpc v1.6.1
4
+ // - protoc v3.21.12
5
+ // source: proto/auth.proto
6
+
7
+ package contracts
8
+
9
+ import (
10
+ context "context"
11
+ grpc "google.golang.org/grpc"
12
+ codes "google.golang.org/grpc/codes"
13
+ status "google.golang.org/grpc/status"
14
+ )
15
+
16
+ // This is a compile-time assertion to ensure that this generated file
17
+ // is compatible with the grpc package it is being compiled against.
18
+ // Requires gRPC-Go v1.64.0 or later.
19
+ const _ = grpc.SupportPackageIsVersion9
20
+
21
+ const (
22
+ AuthService_SendOtp_FullMethodName = "/auth.v1.AuthService/SendOtp"
23
+ AuthService_VerifyOtp_FullMethodName = "/auth.v1.AuthService/VerifyOtp"
24
+ )
25
+
26
+ // AuthServiceClient is the client API for AuthService service.
27
+ //
28
+ // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
29
+ type AuthServiceClient interface {
30
+ SendOtp(ctx context.Context, in *SendOtpRequest, opts ...grpc.CallOption) (*SendOtpResponse, error)
31
+ VerifyOtp(ctx context.Context, in *VerifyOtpRequest, opts ...grpc.CallOption) (*VerifyOtpResponse, error)
32
+ }
33
+
34
+ type authServiceClient struct {
35
+ cc grpc.ClientConnInterface
36
+ }
37
+
38
+ func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient {
39
+ return &authServiceClient{cc}
40
+ }
41
+
42
+ func (c *authServiceClient) SendOtp(ctx context.Context, in *SendOtpRequest, opts ...grpc.CallOption) (*SendOtpResponse, error) {
43
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
44
+ out := new(SendOtpResponse)
45
+ err := c.cc.Invoke(ctx, AuthService_SendOtp_FullMethodName, in, out, cOpts...)
46
+ if err != nil {
47
+ return nil, err
48
+ }
49
+ return out, nil
50
+ }
51
+
52
+ func (c *authServiceClient) VerifyOtp(ctx context.Context, in *VerifyOtpRequest, opts ...grpc.CallOption) (*VerifyOtpResponse, error) {
53
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
54
+ out := new(VerifyOtpResponse)
55
+ err := c.cc.Invoke(ctx, AuthService_VerifyOtp_FullMethodName, in, out, cOpts...)
56
+ if err != nil {
57
+ return nil, err
58
+ }
59
+ return out, nil
60
+ }
61
+
62
+ // AuthServiceServer is the server API for AuthService service.
63
+ // All implementations must embed UnimplementedAuthServiceServer
64
+ // for forward compatibility.
65
+ type AuthServiceServer interface {
66
+ SendOtp(context.Context, *SendOtpRequest) (*SendOtpResponse, error)
67
+ VerifyOtp(context.Context, *VerifyOtpRequest) (*VerifyOtpResponse, error)
68
+ mustEmbedUnimplementedAuthServiceServer()
69
+ }
70
+
71
+ // UnimplementedAuthServiceServer must be embedded to have
72
+ // forward compatible implementations.
73
+ //
74
+ // NOTE: this should be embedded by value instead of pointer to avoid a nil
75
+ // pointer dereference when methods are called.
76
+ type UnimplementedAuthServiceServer struct{}
77
+
78
+ func (UnimplementedAuthServiceServer) SendOtp(context.Context, *SendOtpRequest) (*SendOtpResponse, error) {
79
+ return nil, status.Error(codes.Unimplemented, "method SendOtp not implemented")
80
+ }
81
+ func (UnimplementedAuthServiceServer) VerifyOtp(context.Context, *VerifyOtpRequest) (*VerifyOtpResponse, error) {
82
+ return nil, status.Error(codes.Unimplemented, "method VerifyOtp not implemented")
83
+ }
84
+ func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {}
85
+ func (UnimplementedAuthServiceServer) testEmbeddedByValue() {}
86
+
87
+ // UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service.
88
+ // Use of this interface is not recommended, as added methods to AuthServiceServer will
89
+ // result in compilation errors.
90
+ type UnsafeAuthServiceServer interface {
91
+ mustEmbedUnimplementedAuthServiceServer()
92
+ }
93
+
94
+ func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) {
95
+ // If the following call panics, it indicates UnimplementedAuthServiceServer was
96
+ // embedded by pointer and is nil. This will cause panics if an
97
+ // unimplemented method is ever invoked, so we test this at initialization
98
+ // time to prevent it from happening at runtime later due to I/O.
99
+ if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
100
+ t.testEmbeddedByValue()
101
+ }
102
+ s.RegisterService(&AuthService_ServiceDesc, srv)
103
+ }
104
+
105
+ func _AuthService_SendOtp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
106
+ in := new(SendOtpRequest)
107
+ if err := dec(in); err != nil {
108
+ return nil, err
109
+ }
110
+ if interceptor == nil {
111
+ return srv.(AuthServiceServer).SendOtp(ctx, in)
112
+ }
113
+ info := &grpc.UnaryServerInfo{
114
+ Server: srv,
115
+ FullMethod: AuthService_SendOtp_FullMethodName,
116
+ }
117
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
118
+ return srv.(AuthServiceServer).SendOtp(ctx, req.(*SendOtpRequest))
119
+ }
120
+ return interceptor(ctx, in, info, handler)
121
+ }
122
+
123
+ func _AuthService_VerifyOtp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
124
+ in := new(VerifyOtpRequest)
125
+ if err := dec(in); err != nil {
126
+ return nil, err
127
+ }
128
+ if interceptor == nil {
129
+ return srv.(AuthServiceServer).VerifyOtp(ctx, in)
130
+ }
131
+ info := &grpc.UnaryServerInfo{
132
+ Server: srv,
133
+ FullMethod: AuthService_VerifyOtp_FullMethodName,
134
+ }
135
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
136
+ return srv.(AuthServiceServer).VerifyOtp(ctx, req.(*VerifyOtpRequest))
137
+ }
138
+ return interceptor(ctx, in, info, handler)
139
+ }
140
+
141
+ // AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service.
142
+ // It's only intended for direct use with grpc.RegisterService,
143
+ // and not to be introspected or modified (even as a copy)
144
+ var AuthService_ServiceDesc = grpc.ServiceDesc{
145
+ ServiceName: "auth.v1.AuthService",
146
+ HandlerType: (*AuthServiceServer)(nil),
147
+ Methods: []grpc.MethodDesc{
148
+ {
149
+ MethodName: "SendOtp",
150
+ Handler: _AuthService_SendOtp_Handler,
151
+ },
152
+ {
153
+ MethodName: "VerifyOtp",
154
+ Handler: _AuthService_VerifyOtp_Handler,
155
+ },
156
+ },
157
+ Streams: []grpc.StreamDesc{},
158
+ Metadata: "proto/auth.proto",
159
+ }
@@ -6,6 +6,18 @@
6
6
 
7
7
  /* eslint-disable */
8
8
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import {
10
+ type CallOptions,
11
+ type ChannelCredentials,
12
+ Client,
13
+ type ClientOptions,
14
+ type ClientUnaryCall,
15
+ type handleUnaryCall,
16
+ makeGenericClientConstructor,
17
+ type Metadata,
18
+ type ServiceError,
19
+ type UntypedServiceImplementation,
20
+ } from "@grpc/grpc-js";
9
21
 
10
22
  export const protobufPackage = "auth.v1";
11
23
 
@@ -339,38 +351,72 @@ export const VerifyOtpResponse: MessageFns<VerifyOtpResponse> = {
339
351
  },
340
352
  };
341
353
 
342
- export interface AuthService {
343
- SendOtp(request: SendOtpRequest): Promise<SendOtpResponse>;
344
- VerifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse>;
345
- }
354
+ export type AuthServiceService = typeof AuthServiceService;
355
+ export const AuthServiceService = {
356
+ sendOtp: {
357
+ path: "/auth.v1.AuthService/SendOtp",
358
+ requestStream: false,
359
+ responseStream: false,
360
+ requestSerialize: (value: SendOtpRequest): Buffer => Buffer.from(SendOtpRequest.encode(value).finish()),
361
+ requestDeserialize: (value: Buffer): SendOtpRequest => SendOtpRequest.decode(value),
362
+ responseSerialize: (value: SendOtpResponse): Buffer => Buffer.from(SendOtpResponse.encode(value).finish()),
363
+ responseDeserialize: (value: Buffer): SendOtpResponse => SendOtpResponse.decode(value),
364
+ },
365
+ verifyOtp: {
366
+ path: "/auth.v1.AuthService/VerifyOtp",
367
+ requestStream: false,
368
+ responseStream: false,
369
+ requestSerialize: (value: VerifyOtpRequest): Buffer => Buffer.from(VerifyOtpRequest.encode(value).finish()),
370
+ requestDeserialize: (value: Buffer): VerifyOtpRequest => VerifyOtpRequest.decode(value),
371
+ responseSerialize: (value: VerifyOtpResponse): Buffer => Buffer.from(VerifyOtpResponse.encode(value).finish()),
372
+ responseDeserialize: (value: Buffer): VerifyOtpResponse => VerifyOtpResponse.decode(value),
373
+ },
374
+ } as const;
346
375
 
347
- export const AuthServiceServiceName = "auth.v1.AuthService";
348
- export class AuthServiceClientImpl implements AuthService {
349
- private readonly rpc: Rpc;
350
- private readonly service: string;
351
- constructor(rpc: Rpc, opts?: { service?: string }) {
352
- this.service = opts?.service || AuthServiceServiceName;
353
- this.rpc = rpc;
354
- this.SendOtp = this.SendOtp.bind(this);
355
- this.VerifyOtp = this.VerifyOtp.bind(this);
356
- }
357
- SendOtp(request: SendOtpRequest): Promise<SendOtpResponse> {
358
- const data = SendOtpRequest.encode(request).finish();
359
- const promise = this.rpc.request(this.service, "SendOtp", data);
360
- return promise.then((data) => SendOtpResponse.decode(new BinaryReader(data)));
361
- }
362
-
363
- VerifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> {
364
- const data = VerifyOtpRequest.encode(request).finish();
365
- const promise = this.rpc.request(this.service, "VerifyOtp", data);
366
- return promise.then((data) => VerifyOtpResponse.decode(new BinaryReader(data)));
367
- }
376
+ export interface AuthServiceServer extends UntypedServiceImplementation {
377
+ sendOtp: handleUnaryCall<SendOtpRequest, SendOtpResponse>;
378
+ verifyOtp: handleUnaryCall<VerifyOtpRequest, VerifyOtpResponse>;
368
379
  }
369
380
 
370
- interface Rpc {
371
- request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
381
+ export interface AuthServiceClient extends Client {
382
+ sendOtp(
383
+ request: SendOtpRequest,
384
+ callback: (error: ServiceError | null, response: SendOtpResponse) => void,
385
+ ): ClientUnaryCall;
386
+ sendOtp(
387
+ request: SendOtpRequest,
388
+ metadata: Metadata,
389
+ callback: (error: ServiceError | null, response: SendOtpResponse) => void,
390
+ ): ClientUnaryCall;
391
+ sendOtp(
392
+ request: SendOtpRequest,
393
+ metadata: Metadata,
394
+ options: Partial<CallOptions>,
395
+ callback: (error: ServiceError | null, response: SendOtpResponse) => void,
396
+ ): ClientUnaryCall;
397
+ verifyOtp(
398
+ request: VerifyOtpRequest,
399
+ callback: (error: ServiceError | null, response: VerifyOtpResponse) => void,
400
+ ): ClientUnaryCall;
401
+ verifyOtp(
402
+ request: VerifyOtpRequest,
403
+ metadata: Metadata,
404
+ callback: (error: ServiceError | null, response: VerifyOtpResponse) => void,
405
+ ): ClientUnaryCall;
406
+ verifyOtp(
407
+ request: VerifyOtpRequest,
408
+ metadata: Metadata,
409
+ options: Partial<CallOptions>,
410
+ callback: (error: ServiceError | null, response: VerifyOtpResponse) => void,
411
+ ): ClientUnaryCall;
372
412
  }
373
413
 
414
+ export const AuthServiceClient = makeGenericClientConstructor(AuthServiceService, "auth.v1.AuthService") as unknown as {
415
+ new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): AuthServiceClient;
416
+ service: typeof AuthServiceService;
417
+ serviceName: string;
418
+ };
419
+
374
420
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
375
421
 
376
422
  export type DeepPartial<T> = T extends Builtin ? T
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@sa2-movie-ticket/testing",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
7
- "generate": "mkdir -p gen && protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./gen proto/*.proto",
7
+ "generate": "mkdir -p gen && protoc --ts_proto_out=gen/ts --ts_proto_opt=outputServices=grpc-js --go_out=gen/go --go-grpc_out=gen/go proto/*.proto",
8
+ "gen": "mkdir -p gen && protoc --ts_proto_out=gen/ts --ts_proto_opt=outputServices=grpc-js,esModuleInterop=true --go_out=paths=source_relative:gen/go --go-grpc_out=paths=source_relative:gen/go proto/*.proto",
8
9
  "start": "node src/index.js"
9
10
  },
10
11
  "keywords": [],
package/proto/auth.proto CHANGED
@@ -2,7 +2,8 @@ syntax = "proto3";
2
2
 
3
3
  package auth.v1;
4
4
 
5
- option go_package = "github.com/sa2-movie-ticket/contracts/gen/go/auth";
5
+ option go_package = "./gen/go;contracts";
6
+
6
7
 
7
8
  service AuthService {
8
9
  rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);