mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
377 lines
15 KiB
Go
377 lines
15 KiB
Go
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
|
|
// Licensed under the GNU Affero General Public License (AGPL).
|
|
// See License-AGPL.txt in the project root for license information.
|
|
|
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.2.0
|
|
// - protoc v3.20.0
|
|
// source: notification.proto
|
|
|
|
package api
|
|
|
|
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.32.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion7
|
|
|
|
// NotificationServiceClient is the client API for NotificationService 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.
|
|
type NotificationServiceClient interface {
|
|
// Prompts the user and asks for a decision. Typically called by some external
|
|
// process. If the list of actions is empty this service returns immediately,
|
|
// otherwise it blocks until the user has made their choice.
|
|
Notify(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (*NotifyResponse, error)
|
|
// Subscribe to notifications. Typically called by the IDE.
|
|
Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (NotificationService_SubscribeClient, error)
|
|
// Report a user's choice as a response to a notification. Typically called by
|
|
// the IDE.
|
|
Respond(ctx context.Context, in *RespondRequest, opts ...grpc.CallOption) (*RespondResponse, error)
|
|
// Called by the IDE to inform supervisor about which is the latest client
|
|
// actively used by the user. We consider active the last IDE with focus.
|
|
// Only 1 stream is kept open at any given time. A new subscription
|
|
// overrides the previous one, causing the stream to close.
|
|
// Supervisor will respond with a stream to which the IDE will listen
|
|
// waiting to receive actions to run, for example: `open` or `preview`
|
|
SubscribeActive(ctx context.Context, in *SubscribeActiveRequest, opts ...grpc.CallOption) (NotificationService_SubscribeActiveClient, error)
|
|
// Used by gp-cli to ask supervisor to request the active client
|
|
// to run a given command (eg. open or preview)
|
|
NotifyActive(ctx context.Context, in *NotifyActiveRequest, opts ...grpc.CallOption) (*NotifyActiveResponse, error)
|
|
// Used by the IDE to inform supervisor about the result (eg. success or
|
|
// failure) of the action (eg. open or preview) requested via NotifyActive
|
|
NotifyActiveRespond(ctx context.Context, in *NotifyActiveRespondRequest, opts ...grpc.CallOption) (*NotifyActiveRespondResponse, error)
|
|
}
|
|
|
|
type notificationServiceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewNotificationServiceClient(cc grpc.ClientConnInterface) NotificationServiceClient {
|
|
return ¬ificationServiceClient{cc}
|
|
}
|
|
|
|
func (c *notificationServiceClient) Notify(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (*NotifyResponse, error) {
|
|
out := new(NotifyResponse)
|
|
err := c.cc.Invoke(ctx, "/supervisor.NotificationService/Notify", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *notificationServiceClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (NotificationService_SubscribeClient, error) {
|
|
stream, err := c.cc.NewStream(ctx, &NotificationService_ServiceDesc.Streams[0], "/supervisor.NotificationService/Subscribe", opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := ¬ificationServiceSubscribeClient{stream}
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
type NotificationService_SubscribeClient interface {
|
|
Recv() (*SubscribeResponse, error)
|
|
grpc.ClientStream
|
|
}
|
|
|
|
type notificationServiceSubscribeClient struct {
|
|
grpc.ClientStream
|
|
}
|
|
|
|
func (x *notificationServiceSubscribeClient) Recv() (*SubscribeResponse, error) {
|
|
m := new(SubscribeResponse)
|
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
func (c *notificationServiceClient) Respond(ctx context.Context, in *RespondRequest, opts ...grpc.CallOption) (*RespondResponse, error) {
|
|
out := new(RespondResponse)
|
|
err := c.cc.Invoke(ctx, "/supervisor.NotificationService/Respond", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *notificationServiceClient) SubscribeActive(ctx context.Context, in *SubscribeActiveRequest, opts ...grpc.CallOption) (NotificationService_SubscribeActiveClient, error) {
|
|
stream, err := c.cc.NewStream(ctx, &NotificationService_ServiceDesc.Streams[1], "/supervisor.NotificationService/SubscribeActive", opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := ¬ificationServiceSubscribeActiveClient{stream}
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
type NotificationService_SubscribeActiveClient interface {
|
|
Recv() (*SubscribeActiveResponse, error)
|
|
grpc.ClientStream
|
|
}
|
|
|
|
type notificationServiceSubscribeActiveClient struct {
|
|
grpc.ClientStream
|
|
}
|
|
|
|
func (x *notificationServiceSubscribeActiveClient) Recv() (*SubscribeActiveResponse, error) {
|
|
m := new(SubscribeActiveResponse)
|
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
func (c *notificationServiceClient) NotifyActive(ctx context.Context, in *NotifyActiveRequest, opts ...grpc.CallOption) (*NotifyActiveResponse, error) {
|
|
out := new(NotifyActiveResponse)
|
|
err := c.cc.Invoke(ctx, "/supervisor.NotificationService/NotifyActive", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *notificationServiceClient) NotifyActiveRespond(ctx context.Context, in *NotifyActiveRespondRequest, opts ...grpc.CallOption) (*NotifyActiveRespondResponse, error) {
|
|
out := new(NotifyActiveRespondResponse)
|
|
err := c.cc.Invoke(ctx, "/supervisor.NotificationService/NotifyActiveRespond", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// NotificationServiceServer is the server API for NotificationService service.
|
|
// All implementations must embed UnimplementedNotificationServiceServer
|
|
// for forward compatibility
|
|
type NotificationServiceServer interface {
|
|
// Prompts the user and asks for a decision. Typically called by some external
|
|
// process. If the list of actions is empty this service returns immediately,
|
|
// otherwise it blocks until the user has made their choice.
|
|
Notify(context.Context, *NotifyRequest) (*NotifyResponse, error)
|
|
// Subscribe to notifications. Typically called by the IDE.
|
|
Subscribe(*SubscribeRequest, NotificationService_SubscribeServer) error
|
|
// Report a user's choice as a response to a notification. Typically called by
|
|
// the IDE.
|
|
Respond(context.Context, *RespondRequest) (*RespondResponse, error)
|
|
// Called by the IDE to inform supervisor about which is the latest client
|
|
// actively used by the user. We consider active the last IDE with focus.
|
|
// Only 1 stream is kept open at any given time. A new subscription
|
|
// overrides the previous one, causing the stream to close.
|
|
// Supervisor will respond with a stream to which the IDE will listen
|
|
// waiting to receive actions to run, for example: `open` or `preview`
|
|
SubscribeActive(*SubscribeActiveRequest, NotificationService_SubscribeActiveServer) error
|
|
// Used by gp-cli to ask supervisor to request the active client
|
|
// to run a given command (eg. open or preview)
|
|
NotifyActive(context.Context, *NotifyActiveRequest) (*NotifyActiveResponse, error)
|
|
// Used by the IDE to inform supervisor about the result (eg. success or
|
|
// failure) of the action (eg. open or preview) requested via NotifyActive
|
|
NotifyActiveRespond(context.Context, *NotifyActiveRespondRequest) (*NotifyActiveRespondResponse, error)
|
|
mustEmbedUnimplementedNotificationServiceServer()
|
|
}
|
|
|
|
// UnimplementedNotificationServiceServer must be embedded to have forward compatible implementations.
|
|
type UnimplementedNotificationServiceServer struct {
|
|
}
|
|
|
|
func (UnimplementedNotificationServiceServer) Notify(context.Context, *NotifyRequest) (*NotifyResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Notify not implemented")
|
|
}
|
|
func (UnimplementedNotificationServiceServer) Subscribe(*SubscribeRequest, NotificationService_SubscribeServer) error {
|
|
return status.Errorf(codes.Unimplemented, "method Subscribe not implemented")
|
|
}
|
|
func (UnimplementedNotificationServiceServer) Respond(context.Context, *RespondRequest) (*RespondResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Respond not implemented")
|
|
}
|
|
func (UnimplementedNotificationServiceServer) SubscribeActive(*SubscribeActiveRequest, NotificationService_SubscribeActiveServer) error {
|
|
return status.Errorf(codes.Unimplemented, "method SubscribeActive not implemented")
|
|
}
|
|
func (UnimplementedNotificationServiceServer) NotifyActive(context.Context, *NotifyActiveRequest) (*NotifyActiveResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method NotifyActive not implemented")
|
|
}
|
|
func (UnimplementedNotificationServiceServer) NotifyActiveRespond(context.Context, *NotifyActiveRespondRequest) (*NotifyActiveRespondResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method NotifyActiveRespond not implemented")
|
|
}
|
|
func (UnimplementedNotificationServiceServer) mustEmbedUnimplementedNotificationServiceServer() {}
|
|
|
|
// UnsafeNotificationServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to NotificationServiceServer will
|
|
// result in compilation errors.
|
|
type UnsafeNotificationServiceServer interface {
|
|
mustEmbedUnimplementedNotificationServiceServer()
|
|
}
|
|
|
|
func RegisterNotificationServiceServer(s grpc.ServiceRegistrar, srv NotificationServiceServer) {
|
|
s.RegisterService(&NotificationService_ServiceDesc, srv)
|
|
}
|
|
|
|
func _NotificationService_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.(NotificationServiceServer).Notify(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/supervisor.NotificationService/Notify",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(NotificationServiceServer).Notify(ctx, req.(*NotifyRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _NotificationService_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(SubscribeRequest)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(NotificationServiceServer).Subscribe(m, ¬ificationServiceSubscribeServer{stream})
|
|
}
|
|
|
|
type NotificationService_SubscribeServer interface {
|
|
Send(*SubscribeResponse) error
|
|
grpc.ServerStream
|
|
}
|
|
|
|
type notificationServiceSubscribeServer struct {
|
|
grpc.ServerStream
|
|
}
|
|
|
|
func (x *notificationServiceSubscribeServer) Send(m *SubscribeResponse) error {
|
|
return x.ServerStream.SendMsg(m)
|
|
}
|
|
|
|
func _NotificationService_Respond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(RespondRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(NotificationServiceServer).Respond(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/supervisor.NotificationService/Respond",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(NotificationServiceServer).Respond(ctx, req.(*RespondRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _NotificationService_SubscribeActive_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(SubscribeActiveRequest)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(NotificationServiceServer).SubscribeActive(m, ¬ificationServiceSubscribeActiveServer{stream})
|
|
}
|
|
|
|
type NotificationService_SubscribeActiveServer interface {
|
|
Send(*SubscribeActiveResponse) error
|
|
grpc.ServerStream
|
|
}
|
|
|
|
type notificationServiceSubscribeActiveServer struct {
|
|
grpc.ServerStream
|
|
}
|
|
|
|
func (x *notificationServiceSubscribeActiveServer) Send(m *SubscribeActiveResponse) error {
|
|
return x.ServerStream.SendMsg(m)
|
|
}
|
|
|
|
func _NotificationService_NotifyActive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(NotifyActiveRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(NotificationServiceServer).NotifyActive(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/supervisor.NotificationService/NotifyActive",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(NotificationServiceServer).NotifyActive(ctx, req.(*NotifyActiveRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _NotificationService_NotifyActiveRespond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(NotifyActiveRespondRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(NotificationServiceServer).NotifyActiveRespond(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/supervisor.NotificationService/NotifyActiveRespond",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(NotificationServiceServer).NotifyActiveRespond(ctx, req.(*NotifyActiveRespondRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// NotificationService_ServiceDesc is the grpc.ServiceDesc for NotificationService service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var NotificationService_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "supervisor.NotificationService",
|
|
HandlerType: (*NotificationServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "Notify",
|
|
Handler: _NotificationService_Notify_Handler,
|
|
},
|
|
{
|
|
MethodName: "Respond",
|
|
Handler: _NotificationService_Respond_Handler,
|
|
},
|
|
{
|
|
MethodName: "NotifyActive",
|
|
Handler: _NotificationService_NotifyActive_Handler,
|
|
},
|
|
{
|
|
MethodName: "NotifyActiveRespond",
|
|
Handler: _NotificationService_NotifyActiveRespond_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{
|
|
{
|
|
StreamName: "Subscribe",
|
|
Handler: _NotificationService_Subscribe_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
{
|
|
StreamName: "SubscribeActive",
|
|
Handler: _NotificationService_SubscribeActive_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
},
|
|
Metadata: "notification.proto",
|
|
}
|