evcc-io/vehicle/polestar/pb/polestar_grpc.pb.go

136 lines
5.3 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v7.34.1
// source: polestar.proto
// Polestar gRPC API (PCCS vehicle battery service).
//
// Polestar removed the chargingStatus field from the GraphQL carTelematicsV2
// API. The gRPC battery service still exposes the charger connection and
// charging status. Protocol reconstructed by the pypolestar project from the
// Polestar Android app, see https://github.com/pypolestar/pypolestar.
//
// The proto package name is significant: it forms the gRPC method path
// (/services.vehiclestates.battery.BatteryService/GetLatestBattery) expected
// by the server.
//
// Regenerate with:
// protoc --go_out=. --go_opt=paths=source_relative \
// --go-grpc_out=. --go-grpc_opt=paths=source_relative polestar.proto
package pb
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 (
BatteryService_GetLatestBattery_FullMethodName = "/services.vehiclestates.battery.BatteryService/GetLatestBattery"
)
// BatteryServiceClient is the client API for BatteryService 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 BatteryServiceClient interface {
GetLatestBattery(ctx context.Context, in *GetBatteryRequest, opts ...grpc.CallOption) (*GetBatteryResponse, error)
}
type batteryServiceClient struct {
cc grpc.ClientConnInterface
}
func NewBatteryServiceClient(cc grpc.ClientConnInterface) BatteryServiceClient {
return &batteryServiceClient{cc}
}
func (c *batteryServiceClient) GetLatestBattery(ctx context.Context, in *GetBatteryRequest, opts ...grpc.CallOption) (*GetBatteryResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetBatteryResponse)
err := c.cc.Invoke(ctx, BatteryService_GetLatestBattery_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// BatteryServiceServer is the server API for BatteryService service.
// All implementations must embed UnimplementedBatteryServiceServer
// for forward compatibility.
type BatteryServiceServer interface {
GetLatestBattery(context.Context, *GetBatteryRequest) (*GetBatteryResponse, error)
mustEmbedUnimplementedBatteryServiceServer()
}
// UnimplementedBatteryServiceServer 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 UnimplementedBatteryServiceServer struct{}
func (UnimplementedBatteryServiceServer) GetLatestBattery(context.Context, *GetBatteryRequest) (*GetBatteryResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetLatestBattery not implemented")
}
func (UnimplementedBatteryServiceServer) mustEmbedUnimplementedBatteryServiceServer() {}
func (UnimplementedBatteryServiceServer) testEmbeddedByValue() {}
// UnsafeBatteryServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to BatteryServiceServer will
// result in compilation errors.
type UnsafeBatteryServiceServer interface {
mustEmbedUnimplementedBatteryServiceServer()
}
func RegisterBatteryServiceServer(s grpc.ServiceRegistrar, srv BatteryServiceServer) {
// If the following call panics, it indicates UnimplementedBatteryServiceServer 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(&BatteryService_ServiceDesc, srv)
}
func _BatteryService_GetLatestBattery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBatteryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BatteryServiceServer).GetLatestBattery(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: BatteryService_GetLatestBattery_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BatteryServiceServer).GetLatestBattery(ctx, req.(*GetBatteryRequest))
}
return interceptor(ctx, in, info, handler)
}
// BatteryService_ServiceDesc is the grpc.ServiceDesc for BatteryService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var BatteryService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "services.vehiclestates.battery.BatteryService",
HandlerType: (*BatteryServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetLatestBattery",
Handler: _BatteryService_GetLatestBattery_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "polestar.proto",
}