-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
48 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package server | ||
|
||
import ( | ||
"buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/ping/v1/pingv1grpc" | ||
|
||
"google.golang.org/grpc" | ||
) | ||
|
||
var _ pingv1grpc.PingServiceServer = (*ping_srv1)(nil) | ||
|
||
type ping_srv1 struct { | ||
reqProcessor externalRequestProcessor | ||
} | ||
|
||
func NewPingServer( | ||
grpcServer *grpc.Server, | ||
reqProcess externalRequestProcessor, | ||
) pingv1grpc.PingServiceServer { | ||
ping_srv := &ping_srv1{reqProcessor: reqProcess} | ||
pingv1grpc.RegisterPingServiceServer(grpcServer, ping_srv) | ||
return ping_srv | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Code generated by '{{GENERATOR}}'. DO NOT EDIT. | ||
// template: {{TEMPLATE}} | ||
|
||
package server | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
{{TYPE_PACKAGE}} "{{PROTO_INC}}" | ||
|
||
"github.com/chain4travel/camino-messenger-bot/internal/messaging/clients" | ||
) | ||
|
||
func (s *{{TYPE_PACKAGE}}_srv1) {{METHOD}}(ctx context.Context, request *{{TYPE_PACKAGE}}.{{REQUEST}}) (*{{TYPE_PACKAGE}}.{{RESPONSE}}, error) { | ||
response, err := s.reqProcessor.processExternalRequest(ctx, clients.{{SERVICE}}V{{VERSION}}Request, request) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to process %s request: %w", clients.{{SERVICE}}V{{VERSION}}Request, err) | ||
} | ||
resp, ok := response.(*{{TYPE_PACKAGE}}.{{RESPONSE}}) | ||
if !ok { | ||
return nil, fmt.Errorf("invalid response type: expected %s, got %T", clients.{{SERVICE}}V{{VERSION}}Response, response) | ||
} | ||
return resp, nil | ||
} |