1
2
3
4
9 package examplepb
10
11 import (
12 "context"
13 "io"
14 "net/http"
15
16 "github.com/golang/protobuf/descriptor"
17 "github.com/golang/protobuf/proto"
18 "github.com/grpc-ecosystem/grpc-gateway/runtime"
19 "github.com/grpc-ecosystem/grpc-gateway/utilities"
20 "google.golang.org/grpc"
21 "google.golang.org/grpc/codes"
22 "google.golang.org/grpc/grpclog"
23 "google.golang.org/grpc/metadata"
24 "google.golang.org/grpc/status"
25 )
26
27
28 var _ codes.Code
29 var _ io.Reader
30 var _ status.Status
31 var _ = runtime.String
32 var _ = utilities.NewDoubleArray
33 var _ = descriptor.ForMessage
34 var _ = metadata.Join
35
36 var (
37 filter_EchoService_Echo_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
38 )
39
40 func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
41 var protoReq SimpleMessage
42 var metadata runtime.ServerMetadata
43
44 var (
45 val string
46 ok bool
47 err error
48 _ = err
49 )
50
51 val, ok = pathParams["id"]
52 if !ok {
53 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
54 }
55
56 protoReq.Id, err = runtime.String(val)
57
58 if err != nil {
59 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
60 }
61
62 if err := req.ParseForm(); err != nil {
63 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
64 }
65 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_0); err != nil {
66 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
67 }
68
69 msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
70 return msg, metadata, err
71
72 }
73
74 func local_request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
75 var protoReq SimpleMessage
76 var metadata runtime.ServerMetadata
77
78 var (
79 val string
80 ok bool
81 err error
82 _ = err
83 )
84
85 val, ok = pathParams["id"]
86 if !ok {
87 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
88 }
89
90 protoReq.Id, err = runtime.String(val)
91
92 if err != nil {
93 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
94 }
95
96 if err := req.ParseForm(); err != nil {
97 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
98 }
99 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_0); err != nil {
100 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
101 }
102
103 msg, err := server.Echo(ctx, &protoReq)
104 return msg, metadata, err
105
106 }
107
108 var (
109 filter_EchoService_Echo_1 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "num": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
110 )
111
112 func request_EchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
113 var protoReq SimpleMessage
114 var metadata runtime.ServerMetadata
115
116 var (
117 val string
118 ok bool
119 err error
120 _ = err
121 )
122
123 val, ok = pathParams["id"]
124 if !ok {
125 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
126 }
127
128 protoReq.Id, err = runtime.String(val)
129
130 if err != nil {
131 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
132 }
133
134 val, ok = pathParams["num"]
135 if !ok {
136 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num")
137 }
138
139 protoReq.Num, err = runtime.Int64(val)
140
141 if err != nil {
142 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err)
143 }
144
145 if err := req.ParseForm(); err != nil {
146 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
147 }
148 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_1); err != nil {
149 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
150 }
151
152 msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
153 return msg, metadata, err
154
155 }
156
157 func local_request_EchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
158 var protoReq SimpleMessage
159 var metadata runtime.ServerMetadata
160
161 var (
162 val string
163 ok bool
164 err error
165 _ = err
166 )
167
168 val, ok = pathParams["id"]
169 if !ok {
170 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
171 }
172
173 protoReq.Id, err = runtime.String(val)
174
175 if err != nil {
176 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
177 }
178
179 val, ok = pathParams["num"]
180 if !ok {
181 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num")
182 }
183
184 protoReq.Num, err = runtime.Int64(val)
185
186 if err != nil {
187 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err)
188 }
189
190 if err := req.ParseForm(); err != nil {
191 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
192 }
193 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_1); err != nil {
194 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
195 }
196
197 msg, err := server.Echo(ctx, &protoReq)
198 return msg, metadata, err
199
200 }
201
202 var (
203 filter_EchoService_Echo_2 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "num": 1, "lang": 2}, Base: []int{1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 3, 4}}
204 )
205
206 func request_EchoService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
207 var protoReq SimpleMessage
208 var metadata runtime.ServerMetadata
209
210 var (
211 val string
212 ok bool
213 err error
214 _ = err
215 )
216
217 val, ok = pathParams["id"]
218 if !ok {
219 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
220 }
221
222 protoReq.Id, err = runtime.String(val)
223
224 if err != nil {
225 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
226 }
227
228 val, ok = pathParams["num"]
229 if !ok {
230 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num")
231 }
232
233 protoReq.Num, err = runtime.Int64(val)
234
235 if err != nil {
236 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err)
237 }
238
239 val, ok = pathParams["lang"]
240 if !ok {
241 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "lang")
242 }
243
244 if protoReq.Code == nil {
245 protoReq.Code = &SimpleMessage_Lang{}
246 } else if _, ok := protoReq.Code.(*SimpleMessage_Lang); !ok {
247 return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *SimpleMessage_Lang, but: %t\n", protoReq.Code)
248 }
249 protoReq.Code.(*SimpleMessage_Lang).Lang, err = runtime.String(val)
250
251 if err != nil {
252 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lang", err)
253 }
254
255 if err := req.ParseForm(); err != nil {
256 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
257 }
258 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_2); err != nil {
259 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
260 }
261
262 msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
263 return msg, metadata, err
264
265 }
266
267 func local_request_EchoService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
268 var protoReq SimpleMessage
269 var metadata runtime.ServerMetadata
270
271 var (
272 val string
273 ok bool
274 err error
275 _ = err
276 )
277
278 val, ok = pathParams["id"]
279 if !ok {
280 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
281 }
282
283 protoReq.Id, err = runtime.String(val)
284
285 if err != nil {
286 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
287 }
288
289 val, ok = pathParams["num"]
290 if !ok {
291 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "num")
292 }
293
294 protoReq.Num, err = runtime.Int64(val)
295
296 if err != nil {
297 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "num", err)
298 }
299
300 val, ok = pathParams["lang"]
301 if !ok {
302 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "lang")
303 }
304
305 if protoReq.Code == nil {
306 protoReq.Code = &SimpleMessage_Lang{}
307 } else if _, ok := protoReq.Code.(*SimpleMessage_Lang); !ok {
308 return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *SimpleMessage_Lang, but: %t\n", protoReq.Code)
309 }
310 protoReq.Code.(*SimpleMessage_Lang).Lang, err = runtime.String(val)
311
312 if err != nil {
313 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lang", err)
314 }
315
316 if err := req.ParseForm(); err != nil {
317 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
318 }
319 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_2); err != nil {
320 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
321 }
322
323 msg, err := server.Echo(ctx, &protoReq)
324 return msg, metadata, err
325
326 }
327
328 var (
329 filter_EchoService_Echo_3 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "line_num": 1, "status": 2, "note": 3}, Base: []int{1, 1, 2, 1, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 4, 2, 3, 5}}
330 )
331
332 func request_EchoService_Echo_3(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
333 var protoReq SimpleMessage
334 var metadata runtime.ServerMetadata
335
336 var (
337 val string
338 ok bool
339 err error
340 _ = err
341 )
342
343 val, ok = pathParams["id"]
344 if !ok {
345 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
346 }
347
348 protoReq.Id, err = runtime.String(val)
349
350 if err != nil {
351 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
352 }
353
354 val, ok = pathParams["line_num"]
355 if !ok {
356 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "line_num")
357 }
358
359 if protoReq.Code == nil {
360 protoReq.Code = &SimpleMessage_LineNum{}
361 } else if _, ok := protoReq.Code.(*SimpleMessage_LineNum); !ok {
362 return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *SimpleMessage_LineNum, but: %t\n", protoReq.Code)
363 }
364 protoReq.Code.(*SimpleMessage_LineNum).LineNum, err = runtime.Int64(val)
365
366 if err != nil {
367 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "line_num", err)
368 }
369
370 val, ok = pathParams["status.note"]
371 if !ok {
372 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status.note")
373 }
374
375 err = runtime.PopulateFieldFromPath(&protoReq, "status.note", val)
376
377 if err != nil {
378 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status.note", err)
379 }
380
381 if err := req.ParseForm(); err != nil {
382 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
383 }
384 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_3); err != nil {
385 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
386 }
387
388 msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
389 return msg, metadata, err
390
391 }
392
393 func local_request_EchoService_Echo_3(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
394 var protoReq SimpleMessage
395 var metadata runtime.ServerMetadata
396
397 var (
398 val string
399 ok bool
400 err error
401 _ = err
402 )
403
404 val, ok = pathParams["id"]
405 if !ok {
406 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
407 }
408
409 protoReq.Id, err = runtime.String(val)
410
411 if err != nil {
412 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
413 }
414
415 val, ok = pathParams["line_num"]
416 if !ok {
417 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "line_num")
418 }
419
420 if protoReq.Code == nil {
421 protoReq.Code = &SimpleMessage_LineNum{}
422 } else if _, ok := protoReq.Code.(*SimpleMessage_LineNum); !ok {
423 return nil, metadata, status.Errorf(codes.InvalidArgument, "expect type: *SimpleMessage_LineNum, but: %t\n", protoReq.Code)
424 }
425 protoReq.Code.(*SimpleMessage_LineNum).LineNum, err = runtime.Int64(val)
426
427 if err != nil {
428 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "line_num", err)
429 }
430
431 val, ok = pathParams["status.note"]
432 if !ok {
433 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status.note")
434 }
435
436 err = runtime.PopulateFieldFromPath(&protoReq, "status.note", val)
437
438 if err != nil {
439 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status.note", err)
440 }
441
442 if err := req.ParseForm(); err != nil {
443 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
444 }
445 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_3); err != nil {
446 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
447 }
448
449 msg, err := server.Echo(ctx, &protoReq)
450 return msg, metadata, err
451
452 }
453
454 var (
455 filter_EchoService_Echo_4 = &utilities.DoubleArray{Encoding: map[string]int{"no": 0, "note": 1}, Base: []int{1, 1, 1, 0}, Check: []int{0, 1, 2, 3}}
456 )
457
458 func request_EchoService_Echo_4(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
459 var protoReq SimpleMessage
460 var metadata runtime.ServerMetadata
461
462 var (
463 val string
464 ok bool
465 err error
466 _ = err
467 )
468
469 val, ok = pathParams["no.note"]
470 if !ok {
471 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "no.note")
472 }
473
474 err = runtime.PopulateFieldFromPath(&protoReq, "no.note", val)
475
476 if err != nil {
477 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "no.note", err)
478 }
479
480 if err := req.ParseForm(); err != nil {
481 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
482 }
483 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_4); err != nil {
484 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
485 }
486
487 msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
488 return msg, metadata, err
489
490 }
491
492 func local_request_EchoService_Echo_4(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
493 var protoReq SimpleMessage
494 var metadata runtime.ServerMetadata
495
496 var (
497 val string
498 ok bool
499 err error
500 _ = err
501 )
502
503 val, ok = pathParams["no.note"]
504 if !ok {
505 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "no.note")
506 }
507
508 err = runtime.PopulateFieldFromPath(&protoReq, "no.note", val)
509
510 if err != nil {
511 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "no.note", err)
512 }
513
514 if err := req.ParseForm(); err != nil {
515 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
516 }
517 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_Echo_4); err != nil {
518 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
519 }
520
521 msg, err := server.Echo(ctx, &protoReq)
522 return msg, metadata, err
523
524 }
525
526 func request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
527 var protoReq SimpleMessage
528 var metadata runtime.ServerMetadata
529
530 newReader, berr := utilities.IOReaderFactory(req.Body)
531 if berr != nil {
532 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
533 }
534 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
535 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
536 }
537
538 msg, err := client.EchoBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
539 return msg, metadata, err
540
541 }
542
543 func local_request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
544 var protoReq SimpleMessage
545 var metadata runtime.ServerMetadata
546
547 newReader, berr := utilities.IOReaderFactory(req.Body)
548 if berr != nil {
549 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
550 }
551 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
552 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
553 }
554
555 msg, err := server.EchoBody(ctx, &protoReq)
556 return msg, metadata, err
557
558 }
559
560 var (
561 filter_EchoService_EchoDelete_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
562 )
563
564 func request_EchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
565 var protoReq SimpleMessage
566 var metadata runtime.ServerMetadata
567
568 if err := req.ParseForm(); err != nil {
569 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
570 }
571 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_EchoDelete_0); err != nil {
572 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
573 }
574
575 msg, err := client.EchoDelete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
576 return msg, metadata, err
577
578 }
579
580 func local_request_EchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Marshaler, server EchoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
581 var protoReq SimpleMessage
582 var metadata runtime.ServerMetadata
583
584 if err := req.ParseForm(); err != nil {
585 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
586 }
587 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EchoService_EchoDelete_0); err != nil {
588 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
589 }
590
591 msg, err := server.EchoDelete(ctx, &protoReq)
592 return msg, metadata, err
593
594 }
595
596
597
598
599
600 func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer) error {
601
602 mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
603 ctx, cancel := context.WithCancel(req.Context())
604 defer cancel()
605 var stream runtime.ServerTransportStream
606 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
607 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
608 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
609 if err != nil {
610 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
611 return
612 }
613 resp, md, err := local_request_EchoService_Echo_0(rctx, inboundMarshaler, server, req, pathParams)
614 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
615 ctx = runtime.NewServerMetadataContext(ctx, md)
616 if err != nil {
617 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
618 return
619 }
620
621 forward_EchoService_Echo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
622
623 })
624
625 mux.Handle("GET", pattern_EchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
626 ctx, cancel := context.WithCancel(req.Context())
627 defer cancel()
628 var stream runtime.ServerTransportStream
629 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
630 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
631 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
632 if err != nil {
633 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
634 return
635 }
636 resp, md, err := local_request_EchoService_Echo_1(rctx, inboundMarshaler, server, req, pathParams)
637 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
638 ctx = runtime.NewServerMetadataContext(ctx, md)
639 if err != nil {
640 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
641 return
642 }
643
644 forward_EchoService_Echo_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
645
646 })
647
648 mux.Handle("GET", pattern_EchoService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
649 ctx, cancel := context.WithCancel(req.Context())
650 defer cancel()
651 var stream runtime.ServerTransportStream
652 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
653 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
654 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
655 if err != nil {
656 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
657 return
658 }
659 resp, md, err := local_request_EchoService_Echo_2(rctx, inboundMarshaler, server, req, pathParams)
660 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
661 ctx = runtime.NewServerMetadataContext(ctx, md)
662 if err != nil {
663 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
664 return
665 }
666
667 forward_EchoService_Echo_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
668
669 })
670
671 mux.Handle("GET", pattern_EchoService_Echo_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
672 ctx, cancel := context.WithCancel(req.Context())
673 defer cancel()
674 var stream runtime.ServerTransportStream
675 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
676 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
677 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
678 if err != nil {
679 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
680 return
681 }
682 resp, md, err := local_request_EchoService_Echo_3(rctx, inboundMarshaler, server, req, pathParams)
683 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
684 ctx = runtime.NewServerMetadataContext(ctx, md)
685 if err != nil {
686 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
687 return
688 }
689
690 forward_EchoService_Echo_3(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
691
692 })
693
694 mux.Handle("GET", pattern_EchoService_Echo_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
695 ctx, cancel := context.WithCancel(req.Context())
696 defer cancel()
697 var stream runtime.ServerTransportStream
698 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
699 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
700 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
701 if err != nil {
702 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
703 return
704 }
705 resp, md, err := local_request_EchoService_Echo_4(rctx, inboundMarshaler, server, req, pathParams)
706 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
707 ctx = runtime.NewServerMetadataContext(ctx, md)
708 if err != nil {
709 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
710 return
711 }
712
713 forward_EchoService_Echo_4(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
714
715 })
716
717 mux.Handle("POST", pattern_EchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
718 ctx, cancel := context.WithCancel(req.Context())
719 defer cancel()
720 var stream runtime.ServerTransportStream
721 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
722 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
723 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
724 if err != nil {
725 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
726 return
727 }
728 resp, md, err := local_request_EchoService_EchoBody_0(rctx, inboundMarshaler, server, req, pathParams)
729 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
730 ctx = runtime.NewServerMetadataContext(ctx, md)
731 if err != nil {
732 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
733 return
734 }
735
736 forward_EchoService_EchoBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
737
738 })
739
740 mux.Handle("DELETE", pattern_EchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
741 ctx, cancel := context.WithCancel(req.Context())
742 defer cancel()
743 var stream runtime.ServerTransportStream
744 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
745 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
746 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
747 if err != nil {
748 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
749 return
750 }
751 resp, md, err := local_request_EchoService_EchoDelete_0(rctx, inboundMarshaler, server, req, pathParams)
752 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
753 ctx = runtime.NewServerMetadataContext(ctx, md)
754 if err != nil {
755 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
756 return
757 }
758
759 forward_EchoService_EchoDelete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
760
761 })
762
763 return nil
764 }
765
766
767
768 func RegisterEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
769 conn, err := grpc.Dial(endpoint, opts...)
770 if err != nil {
771 return err
772 }
773 defer func() {
774 if err != nil {
775 if cerr := conn.Close(); cerr != nil {
776 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
777 }
778 return
779 }
780 go func() {
781 <-ctx.Done()
782 if cerr := conn.Close(); cerr != nil {
783 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
784 }
785 }()
786 }()
787
788 return RegisterEchoServiceHandler(ctx, mux, conn)
789 }
790
791
792
793 func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
794 return RegisterEchoServiceHandlerClient(ctx, mux, NewEchoServiceClient(conn))
795 }
796
797
798
799
800
801
802 func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EchoServiceClient) error {
803
804 mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
805 ctx, cancel := context.WithCancel(req.Context())
806 defer cancel()
807 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
808 rctx, err := runtime.AnnotateContext(ctx, mux, req)
809 if err != nil {
810 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
811 return
812 }
813 resp, md, err := request_EchoService_Echo_0(rctx, inboundMarshaler, client, req, pathParams)
814 ctx = runtime.NewServerMetadataContext(ctx, md)
815 if err != nil {
816 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
817 return
818 }
819
820 forward_EchoService_Echo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
821
822 })
823
824 mux.Handle("GET", pattern_EchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
825 ctx, cancel := context.WithCancel(req.Context())
826 defer cancel()
827 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
828 rctx, err := runtime.AnnotateContext(ctx, mux, req)
829 if err != nil {
830 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
831 return
832 }
833 resp, md, err := request_EchoService_Echo_1(rctx, inboundMarshaler, client, req, pathParams)
834 ctx = runtime.NewServerMetadataContext(ctx, md)
835 if err != nil {
836 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
837 return
838 }
839
840 forward_EchoService_Echo_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
841
842 })
843
844 mux.Handle("GET", pattern_EchoService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
845 ctx, cancel := context.WithCancel(req.Context())
846 defer cancel()
847 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
848 rctx, err := runtime.AnnotateContext(ctx, mux, req)
849 if err != nil {
850 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
851 return
852 }
853 resp, md, err := request_EchoService_Echo_2(rctx, inboundMarshaler, client, req, pathParams)
854 ctx = runtime.NewServerMetadataContext(ctx, md)
855 if err != nil {
856 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
857 return
858 }
859
860 forward_EchoService_Echo_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
861
862 })
863
864 mux.Handle("GET", pattern_EchoService_Echo_3, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
865 ctx, cancel := context.WithCancel(req.Context())
866 defer cancel()
867 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
868 rctx, err := runtime.AnnotateContext(ctx, mux, req)
869 if err != nil {
870 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
871 return
872 }
873 resp, md, err := request_EchoService_Echo_3(rctx, inboundMarshaler, client, req, pathParams)
874 ctx = runtime.NewServerMetadataContext(ctx, md)
875 if err != nil {
876 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
877 return
878 }
879
880 forward_EchoService_Echo_3(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
881
882 })
883
884 mux.Handle("GET", pattern_EchoService_Echo_4, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
885 ctx, cancel := context.WithCancel(req.Context())
886 defer cancel()
887 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
888 rctx, err := runtime.AnnotateContext(ctx, mux, req)
889 if err != nil {
890 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
891 return
892 }
893 resp, md, err := request_EchoService_Echo_4(rctx, inboundMarshaler, client, req, pathParams)
894 ctx = runtime.NewServerMetadataContext(ctx, md)
895 if err != nil {
896 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
897 return
898 }
899
900 forward_EchoService_Echo_4(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
901
902 })
903
904 mux.Handle("POST", pattern_EchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
905 ctx, cancel := context.WithCancel(req.Context())
906 defer cancel()
907 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
908 rctx, err := runtime.AnnotateContext(ctx, mux, req)
909 if err != nil {
910 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
911 return
912 }
913 resp, md, err := request_EchoService_EchoBody_0(rctx, inboundMarshaler, client, req, pathParams)
914 ctx = runtime.NewServerMetadataContext(ctx, md)
915 if err != nil {
916 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
917 return
918 }
919
920 forward_EchoService_EchoBody_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
921
922 })
923
924 mux.Handle("DELETE", pattern_EchoService_EchoDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
925 ctx, cancel := context.WithCancel(req.Context())
926 defer cancel()
927 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
928 rctx, err := runtime.AnnotateContext(ctx, mux, req)
929 if err != nil {
930 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
931 return
932 }
933 resp, md, err := request_EchoService_EchoDelete_0(rctx, inboundMarshaler, client, req, pathParams)
934 ctx = runtime.NewServerMetadataContext(ctx, md)
935 if err != nil {
936 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
937 return
938 }
939
940 forward_EchoService_EchoDelete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
941
942 })
943
944 return nil
945 }
946
947 var (
948 pattern_EchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo", "id"}, "", runtime.AssumeColonVerbOpt(true)))
949
950 pattern_EchoService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "echo", "id", "num"}, "", runtime.AssumeColonVerbOpt(true)))
951
952 pattern_EchoService_Echo_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "echo", "id", "num", "lang"}, "", runtime.AssumeColonVerbOpt(true)))
953
954 pattern_EchoService_Echo_3 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"v1", "example", "echo1", "id", "line_num", "status.note"}, "", runtime.AssumeColonVerbOpt(true)))
955
956 pattern_EchoService_Echo_4 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo2", "no.note"}, "", runtime.AssumeColonVerbOpt(true)))
957
958 pattern_EchoService_EchoBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_body"}, "", runtime.AssumeColonVerbOpt(true)))
959
960 pattern_EchoService_EchoDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_delete"}, "", runtime.AssumeColonVerbOpt(true)))
961 )
962
963 var (
964 forward_EchoService_Echo_0 = runtime.ForwardResponseMessage
965
966 forward_EchoService_Echo_1 = runtime.ForwardResponseMessage
967
968 forward_EchoService_Echo_2 = runtime.ForwardResponseMessage
969
970 forward_EchoService_Echo_3 = runtime.ForwardResponseMessage
971
972 forward_EchoService_Echo_4 = runtime.ForwardResponseMessage
973
974 forward_EchoService_EchoBody_0 = runtime.ForwardResponseMessage
975
976 forward_EchoService_EchoDelete_0 = runtime.ForwardResponseMessage
977 )
978
View as plain text