// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: telegram/v1/telegram.proto // Package scrabble.telegram.v1 is the RPC contract of the Telegram platform // side-service (the "connector"). The connector holds the bot token and is the // only component that talks to the Telegram Bot API; gateway and backend reach it // over plain gRPC on the trusted internal network (ARCHITECTURE.md §1, §12). // // The generic delivery methods (Notify, SendToUser, SendToGameChannel) are // platform-agnostic: they address a recipient by the identity external_id (as in // the backend identities table), so a future VK / MAX connector can implement the // same service. ValidateInitData is the one Telegram-specific method (it parses // Telegram Web App launch data); it is kept here for now. package telegramv1 import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // 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.64.0 or later. const _ = grpc.SupportPackageIsVersion9 const ( Telegram_ValidateInitData_FullMethodName = "/scrabble.telegram.v1.Telegram/ValidateInitData" Telegram_ValidateLoginWidget_FullMethodName = "/scrabble.telegram.v1.Telegram/ValidateLoginWidget" Telegram_Notify_FullMethodName = "/scrabble.telegram.v1.Telegram/Notify" Telegram_SendToUser_FullMethodName = "/scrabble.telegram.v1.Telegram/SendToUser" Telegram_SendToGameChannel_FullMethodName = "/scrabble.telegram.v1.Telegram/SendToGameChannel" ) // TelegramClient is the client API for Telegram service. // // 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. // // Telegram is the connector RPC surface. type TelegramClient interface { // ValidateInitData verifies Telegram Mini App launch data (HMAC) and returns // the authenticated user. The gateway calls it during the auth.telegram edge // operation, then provisions the session through the backend internal API. ValidateInitData(ctx context.Context, in *ValidateInitDataRequest, opts ...grpc.CallOption) (*ValidateInitDataResponse, error) // ValidateLoginWidget verifies Telegram Login Widget authorization data (the web // sign-in flow, HMAC under SHA-256(bot_token)) and returns the authenticated // user. The gateway calls it during the link.telegram edge operation to attach a // Telegram identity to an existing account (Stage 11). ValidateLoginWidget(ctx context.Context, in *ValidateLoginWidgetRequest, opts ...grpc.CallOption) (*ValidateLoginWidgetResponse, error) // Notify delivers an out-of-app notification for a backend push event. The // gateway calls it only for a recipient with no live in-app stream (so the // platform push never duplicates in-app delivery). The connector renders a // localized message with a Mini App deep-link button from the FlatBuffers // payload; unrenderable kinds are skipped (delivered=false). Notify(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (*NotifyResponse, error) // SendToUser sends an arbitrary text message to one user (admin use, wired in // Stage 10). delivered is false when the user has not started the bot. SendToUser(ctx context.Context, in *SendToUserRequest, opts ...grpc.CallOption) (*SendResponse, error) // SendToGameChannel posts an arbitrary text message to the bot's configured // game channel (admin use, wired in Stage 10); the channel id lives only in the // connector configuration. SendToGameChannel(ctx context.Context, in *SendToGameChannelRequest, opts ...grpc.CallOption) (*SendResponse, error) } type telegramClient struct { cc grpc.ClientConnInterface } func NewTelegramClient(cc grpc.ClientConnInterface) TelegramClient { return &telegramClient{cc} } func (c *telegramClient) ValidateInitData(ctx context.Context, in *ValidateInitDataRequest, opts ...grpc.CallOption) (*ValidateInitDataResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ValidateInitDataResponse) err := c.cc.Invoke(ctx, Telegram_ValidateInitData_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *telegramClient) ValidateLoginWidget(ctx context.Context, in *ValidateLoginWidgetRequest, opts ...grpc.CallOption) (*ValidateLoginWidgetResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ValidateLoginWidgetResponse) err := c.cc.Invoke(ctx, Telegram_ValidateLoginWidget_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *telegramClient) Notify(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (*NotifyResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(NotifyResponse) err := c.cc.Invoke(ctx, Telegram_Notify_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *telegramClient) SendToUser(ctx context.Context, in *SendToUserRequest, opts ...grpc.CallOption) (*SendResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SendResponse) err := c.cc.Invoke(ctx, Telegram_SendToUser_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *telegramClient) SendToGameChannel(ctx context.Context, in *SendToGameChannelRequest, opts ...grpc.CallOption) (*SendResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SendResponse) err := c.cc.Invoke(ctx, Telegram_SendToGameChannel_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } // TelegramServer is the server API for Telegram service. // All implementations must embed UnimplementedTelegramServer // for forward compatibility. // // Telegram is the connector RPC surface. type TelegramServer interface { // ValidateInitData verifies Telegram Mini App launch data (HMAC) and returns // the authenticated user. The gateway calls it during the auth.telegram edge // operation, then provisions the session through the backend internal API. ValidateInitData(context.Context, *ValidateInitDataRequest) (*ValidateInitDataResponse, error) // ValidateLoginWidget verifies Telegram Login Widget authorization data (the web // sign-in flow, HMAC under SHA-256(bot_token)) and returns the authenticated // user. The gateway calls it during the link.telegram edge operation to attach a // Telegram identity to an existing account (Stage 11). ValidateLoginWidget(context.Context, *ValidateLoginWidgetRequest) (*ValidateLoginWidgetResponse, error) // Notify delivers an out-of-app notification for a backend push event. The // gateway calls it only for a recipient with no live in-app stream (so the // platform push never duplicates in-app delivery). The connector renders a // localized message with a Mini App deep-link button from the FlatBuffers // payload; unrenderable kinds are skipped (delivered=false). Notify(context.Context, *NotifyRequest) (*NotifyResponse, error) // SendToUser sends an arbitrary text message to one user (admin use, wired in // Stage 10). delivered is false when the user has not started the bot. SendToUser(context.Context, *SendToUserRequest) (*SendResponse, error) // SendToGameChannel posts an arbitrary text message to the bot's configured // game channel (admin use, wired in Stage 10); the channel id lives only in the // connector configuration. SendToGameChannel(context.Context, *SendToGameChannelRequest) (*SendResponse, error) mustEmbedUnimplementedTelegramServer() } // UnimplementedTelegramServer must be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil // pointer dereference when methods are called. type UnimplementedTelegramServer struct{} func (UnimplementedTelegramServer) ValidateInitData(context.Context, *ValidateInitDataRequest) (*ValidateInitDataResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ValidateInitData not implemented") } func (UnimplementedTelegramServer) ValidateLoginWidget(context.Context, *ValidateLoginWidgetRequest) (*ValidateLoginWidgetResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ValidateLoginWidget not implemented") } func (UnimplementedTelegramServer) Notify(context.Context, *NotifyRequest) (*NotifyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Notify not implemented") } func (UnimplementedTelegramServer) SendToUser(context.Context, *SendToUserRequest) (*SendResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SendToUser not implemented") } func (UnimplementedTelegramServer) SendToGameChannel(context.Context, *SendToGameChannelRequest) (*SendResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SendToGameChannel not implemented") } func (UnimplementedTelegramServer) mustEmbedUnimplementedTelegramServer() {} func (UnimplementedTelegramServer) testEmbeddedByValue() {} // UnsafeTelegramServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to TelegramServer will // result in compilation errors. type UnsafeTelegramServer interface { mustEmbedUnimplementedTelegramServer() } func RegisterTelegramServer(s grpc.ServiceRegistrar, srv TelegramServer) { // If the following call pancis, it indicates UnimplementedTelegramServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { t.testEmbeddedByValue() } s.RegisterService(&Telegram_ServiceDesc, srv) } func _Telegram_ValidateInitData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ValidateInitDataRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TelegramServer).ValidateInitData(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: Telegram_ValidateInitData_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TelegramServer).ValidateInitData(ctx, req.(*ValidateInitDataRequest)) } return interceptor(ctx, in, info, handler) } func _Telegram_ValidateLoginWidget_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ValidateLoginWidgetRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TelegramServer).ValidateLoginWidget(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: Telegram_ValidateLoginWidget_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TelegramServer).ValidateLoginWidget(ctx, req.(*ValidateLoginWidgetRequest)) } return interceptor(ctx, in, info, handler) } func _Telegram_Notify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NotifyRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TelegramServer).Notify(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: Telegram_Notify_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TelegramServer).Notify(ctx, req.(*NotifyRequest)) } return interceptor(ctx, in, info, handler) } func _Telegram_SendToUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SendToUserRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TelegramServer).SendToUser(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: Telegram_SendToUser_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TelegramServer).SendToUser(ctx, req.(*SendToUserRequest)) } return interceptor(ctx, in, info, handler) } func _Telegram_SendToGameChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SendToGameChannelRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(TelegramServer).SendToGameChannel(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: Telegram_SendToGameChannel_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TelegramServer).SendToGameChannel(ctx, req.(*SendToGameChannelRequest)) } return interceptor(ctx, in, info, handler) } // Telegram_ServiceDesc is the grpc.ServiceDesc for Telegram service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var Telegram_ServiceDesc = grpc.ServiceDesc{ ServiceName: "scrabble.telegram.v1.Telegram", HandlerType: (*TelegramServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "ValidateInitData", Handler: _Telegram_ValidateInitData_Handler, }, { MethodName: "ValidateLoginWidget", Handler: _Telegram_ValidateLoginWidget_Handler, }, { MethodName: "Notify", Handler: _Telegram_Notify_Handler, }, { MethodName: "SendToUser", Handler: _Telegram_SendToUser_Handler, }, { MethodName: "SendToGameChannel", Handler: _Telegram_SendToGameChannel_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "telegram/v1/telegram.proto", }