proto/tokens/v1/tokens_grpc.pb.go (134 lines of code) (raw):
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v5.26.1
// source: proto/tokens/v1/tokens.proto
package v1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// 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
// TokensClient is the client API for Tokens 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 TokensClient interface {
// Gets the information for the specified token.
GetToken(ctx context.Context, in *GetTokenRequest, opts ...grpc.CallOption) (*Token, error)
// Deletes the specified token.
DeleteToken(ctx context.Context, in *DeleteTokenRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Lists the tokens.
ListTokens(ctx context.Context, in *ListTokensRequest, opts ...grpc.CallOption) (*ListTokensResponse, error)
}
type tokensClient struct {
cc grpc.ClientConnInterface
}
func NewTokensClient(cc grpc.ClientConnInterface) TokensClient {
return &tokensClient{cc}
}
func (c *tokensClient) GetToken(ctx context.Context, in *GetTokenRequest, opts ...grpc.CallOption) (*Token, error) {
out := new(Token)
err := c.cc.Invoke(ctx, "/tokens.v1.Tokens/GetToken", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *tokensClient) DeleteToken(ctx context.Context, in *DeleteTokenRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/tokens.v1.Tokens/DeleteToken", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *tokensClient) ListTokens(ctx context.Context, in *ListTokensRequest, opts ...grpc.CallOption) (*ListTokensResponse, error) {
out := new(ListTokensResponse)
err := c.cc.Invoke(ctx, "/tokens.v1.Tokens/ListTokens", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// TokensServer is the server API for Tokens service.
// All implementations must embed UnimplementedTokensServer
// for forward compatibility
type TokensServer interface {
// Gets the information for the specified token.
GetToken(context.Context, *GetTokenRequest) (*Token, error)
// Deletes the specified token.
DeleteToken(context.Context, *DeleteTokenRequest) (*emptypb.Empty, error)
// Lists the tokens.
ListTokens(context.Context, *ListTokensRequest) (*ListTokensResponse, error)
}
// UnimplementedTokensServer must be embedded to have forward compatible implementations.
type UnimplementedTokensServer struct {
}
func (UnimplementedTokensServer) GetToken(context.Context, *GetTokenRequest) (*Token, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetToken not implemented")
}
func (UnimplementedTokensServer) DeleteToken(context.Context, *DeleteTokenRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteToken not implemented")
}
func (UnimplementedTokensServer) ListTokens(context.Context, *ListTokensRequest) (*ListTokensResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListTokens not implemented")
}
func RegisterTokensServer(s grpc.ServiceRegistrar, srv TokensServer) {
s.RegisterService(&Tokens_ServiceDesc, srv)
}
func _Tokens_GetToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetTokenRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TokensServer).GetToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/tokens.v1.Tokens/GetToken",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TokensServer).GetToken(ctx, req.(*GetTokenRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Tokens_DeleteToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteTokenRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TokensServer).DeleteToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/tokens.v1.Tokens/DeleteToken",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TokensServer).DeleteToken(ctx, req.(*DeleteTokenRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Tokens_ListTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListTokensRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TokensServer).ListTokens(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/tokens.v1.Tokens/ListTokens",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TokensServer).ListTokens(ctx, req.(*ListTokensRequest))
}
return interceptor(ctx, in, info, handler)
}
// Tokens_ServiceDesc is the grpc.ServiceDesc for Tokens service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Tokens_ServiceDesc = grpc.ServiceDesc{
ServiceName: "tokens.v1.Tokens",
HandlerType: (*TokensServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetToken",
Handler: _Tokens_GetToken_Handler,
},
{
MethodName: "DeleteToken",
Handler: _Tokens_DeleteToken_Handler,
},
{
MethodName: "ListTokens",
Handler: _Tokens_ListTokens_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "proto/tokens/v1/tokens.proto",
}