// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc             v3.21.12
// source: yandex/cloud/iam/v1/refresh_token_service.proto

package iam

import (
	context "context"
	operation "github.com/yandex-cloud/go-genproto/yandex/cloud/operation"
	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 (
	RefreshTokenService_List_FullMethodName   = "/yandex.cloud.iam.v1.RefreshTokenService/List"
	RefreshTokenService_Revoke_FullMethodName = "/yandex.cloud.iam.v1.RefreshTokenService/Revoke"
)

// RefreshTokenServiceClient is the client API for RefreshTokenService 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.
//
// A set of methods for managing Refresh Tokens.
type RefreshTokenServiceClient interface {
	// List subjects Refresh Tokens.
	List(ctx context.Context, in *ListRefreshTokensRequest, opts ...grpc.CallOption) (*ListRefreshTokensResponse, error)
	// Revoke Refresh Tokens. Several Refresh Tokens can be revoked by one request.
	Revoke(ctx context.Context, in *RevokeRefreshTokenRequest, opts ...grpc.CallOption) (*operation.Operation, error)
}

type refreshTokenServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewRefreshTokenServiceClient(cc grpc.ClientConnInterface) RefreshTokenServiceClient {
	return &refreshTokenServiceClient{cc}
}

func (c *refreshTokenServiceClient) List(ctx context.Context, in *ListRefreshTokensRequest, opts ...grpc.CallOption) (*ListRefreshTokensResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ListRefreshTokensResponse)
	err := c.cc.Invoke(ctx, RefreshTokenService_List_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *refreshTokenServiceClient) Revoke(ctx context.Context, in *RevokeRefreshTokenRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(operation.Operation)
	err := c.cc.Invoke(ctx, RefreshTokenService_Revoke_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// RefreshTokenServiceServer is the server API for RefreshTokenService service.
// All implementations should embed UnimplementedRefreshTokenServiceServer
// for forward compatibility.
//
// A set of methods for managing Refresh Tokens.
type RefreshTokenServiceServer interface {
	// List subjects Refresh Tokens.
	List(context.Context, *ListRefreshTokensRequest) (*ListRefreshTokensResponse, error)
	// Revoke Refresh Tokens. Several Refresh Tokens can be revoked by one request.
	Revoke(context.Context, *RevokeRefreshTokenRequest) (*operation.Operation, error)
}

// UnimplementedRefreshTokenServiceServer should 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 UnimplementedRefreshTokenServiceServer struct{}

func (UnimplementedRefreshTokenServiceServer) List(context.Context, *ListRefreshTokensRequest) (*ListRefreshTokensResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method List not implemented")
}
func (UnimplementedRefreshTokenServiceServer) Revoke(context.Context, *RevokeRefreshTokenRequest) (*operation.Operation, error) {
	return nil, status.Error(codes.Unimplemented, "method Revoke not implemented")
}
func (UnimplementedRefreshTokenServiceServer) testEmbeddedByValue() {}

// UnsafeRefreshTokenServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to RefreshTokenServiceServer will
// result in compilation errors.
type UnsafeRefreshTokenServiceServer interface {
	mustEmbedUnimplementedRefreshTokenServiceServer()
}

func RegisterRefreshTokenServiceServer(s grpc.ServiceRegistrar, srv RefreshTokenServiceServer) {
	// If the following call panics, it indicates UnimplementedRefreshTokenServiceServer 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(&RefreshTokenService_ServiceDesc, srv)
}

func _RefreshTokenService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ListRefreshTokensRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(RefreshTokenServiceServer).List(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: RefreshTokenService_List_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(RefreshTokenServiceServer).List(ctx, req.(*ListRefreshTokensRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _RefreshTokenService_Revoke_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(RevokeRefreshTokenRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(RefreshTokenServiceServer).Revoke(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: RefreshTokenService_Revoke_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(RefreshTokenServiceServer).Revoke(ctx, req.(*RevokeRefreshTokenRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// RefreshTokenService_ServiceDesc is the grpc.ServiceDesc for RefreshTokenService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var RefreshTokenService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "yandex.cloud.iam.v1.RefreshTokenService",
	HandlerType: (*RefreshTokenServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "List",
			Handler:    _RefreshTokenService_List_Handler,
		},
		{
			MethodName: "Revoke",
			Handler:    _RefreshTokenService_Revoke_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "yandex/cloud/iam/v1/refresh_token_service.proto",
}
