add: some proto stuff

This commit is contained in:
2026-03-24 21:11:45 -07:00
parent 3df04e4cb6
commit 622eca78cb
10 changed files with 1752 additions and 0 deletions
File diff suppressed because it is too large Load Diff
+291
View File
@@ -0,0 +1,291 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: webstory/v1/api.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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
WebstoryService_StartStory_FullMethodName = "/webstory.v1.WebstoryService/StartStory"
WebstoryService_ContinueStory_FullMethodName = "/webstory.v1.WebstoryService/ContinueStory"
WebstoryService_GetStory_FullMethodName = "/webstory.v1.WebstoryService/GetStory"
WebstoryService_ResetStory_FullMethodName = "/webstory.v1.WebstoryService/ResetStory"
WebstoryService_StreamStory_FullMethodName = "/webstory.v1.WebstoryService/StreamStory"
)
// WebstoryServiceClient is the client API for WebstoryService 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.
//
// WebstoryService defines the RPC methods for the interactive fiction service
type WebstoryServiceClient interface {
// Start a new story session
StartStory(ctx context.Context, in *StartStoryRequest, opts ...grpc.CallOption) (*StartStoryResponse, error)
// Continue the story with user input or choice
ContinueStory(ctx context.Context, in *ContinueStoryRequest, opts ...grpc.CallOption) (*ContinueStoryResponse, error)
// Get the current state of a story
GetStory(ctx context.Context, in *GetStoryRequest, opts ...grpc.CallOption) (*GetStoryResponse, error)
// Reset or terminate a story session
ResetStory(ctx context.Context, in *ResetStoryRequest, opts ...grpc.CallOption) (*ResetStoryResponse, error)
// Stream story responses in real-time
StreamStory(ctx context.Context, in *StreamStoryRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StreamStoryResponse], error)
}
type webstoryServiceClient struct {
cc grpc.ClientConnInterface
}
func NewWebstoryServiceClient(cc grpc.ClientConnInterface) WebstoryServiceClient {
return &webstoryServiceClient{cc}
}
func (c *webstoryServiceClient) StartStory(ctx context.Context, in *StartStoryRequest, opts ...grpc.CallOption) (*StartStoryResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StartStoryResponse)
err := c.cc.Invoke(ctx, WebstoryService_StartStory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *webstoryServiceClient) ContinueStory(ctx context.Context, in *ContinueStoryRequest, opts ...grpc.CallOption) (*ContinueStoryResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ContinueStoryResponse)
err := c.cc.Invoke(ctx, WebstoryService_ContinueStory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *webstoryServiceClient) GetStory(ctx context.Context, in *GetStoryRequest, opts ...grpc.CallOption) (*GetStoryResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetStoryResponse)
err := c.cc.Invoke(ctx, WebstoryService_GetStory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *webstoryServiceClient) ResetStory(ctx context.Context, in *ResetStoryRequest, opts ...grpc.CallOption) (*ResetStoryResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ResetStoryResponse)
err := c.cc.Invoke(ctx, WebstoryService_ResetStory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *webstoryServiceClient) StreamStory(ctx context.Context, in *StreamStoryRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StreamStoryResponse], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &WebstoryService_ServiceDesc.Streams[0], WebstoryService_StreamStory_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[StreamStoryRequest, StreamStoryResponse]{ClientStream: 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
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type WebstoryService_StreamStoryClient = grpc.ServerStreamingClient[StreamStoryResponse]
// WebstoryServiceServer is the server API for WebstoryService service.
// All implementations must embed UnimplementedWebstoryServiceServer
// for forward compatibility.
//
// WebstoryService defines the RPC methods for the interactive fiction service
type WebstoryServiceServer interface {
// Start a new story session
StartStory(context.Context, *StartStoryRequest) (*StartStoryResponse, error)
// Continue the story with user input or choice
ContinueStory(context.Context, *ContinueStoryRequest) (*ContinueStoryResponse, error)
// Get the current state of a story
GetStory(context.Context, *GetStoryRequest) (*GetStoryResponse, error)
// Reset or terminate a story session
ResetStory(context.Context, *ResetStoryRequest) (*ResetStoryResponse, error)
// Stream story responses in real-time
StreamStory(*StreamStoryRequest, grpc.ServerStreamingServer[StreamStoryResponse]) error
mustEmbedUnimplementedWebstoryServiceServer()
}
// UnimplementedWebstoryServiceServer 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 UnimplementedWebstoryServiceServer struct{}
func (UnimplementedWebstoryServiceServer) StartStory(context.Context, *StartStoryRequest) (*StartStoryResponse, error) {
return nil, status.Error(codes.Unimplemented, "method StartStory not implemented")
}
func (UnimplementedWebstoryServiceServer) ContinueStory(context.Context, *ContinueStoryRequest) (*ContinueStoryResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ContinueStory not implemented")
}
func (UnimplementedWebstoryServiceServer) GetStory(context.Context, *GetStoryRequest) (*GetStoryResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetStory not implemented")
}
func (UnimplementedWebstoryServiceServer) ResetStory(context.Context, *ResetStoryRequest) (*ResetStoryResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ResetStory not implemented")
}
func (UnimplementedWebstoryServiceServer) StreamStory(*StreamStoryRequest, grpc.ServerStreamingServer[StreamStoryResponse]) error {
return status.Error(codes.Unimplemented, "method StreamStory not implemented")
}
func (UnimplementedWebstoryServiceServer) mustEmbedUnimplementedWebstoryServiceServer() {}
func (UnimplementedWebstoryServiceServer) testEmbeddedByValue() {}
// UnsafeWebstoryServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to WebstoryServiceServer will
// result in compilation errors.
type UnsafeWebstoryServiceServer interface {
mustEmbedUnimplementedWebstoryServiceServer()
}
func RegisterWebstoryServiceServer(s grpc.ServiceRegistrar, srv WebstoryServiceServer) {
// If the following call panics, it indicates UnimplementedWebstoryServiceServer 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(&WebstoryService_ServiceDesc, srv)
}
func _WebstoryService_StartStory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StartStoryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WebstoryServiceServer).StartStory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WebstoryService_StartStory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WebstoryServiceServer).StartStory(ctx, req.(*StartStoryRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WebstoryService_ContinueStory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ContinueStoryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WebstoryServiceServer).ContinueStory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WebstoryService_ContinueStory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WebstoryServiceServer).ContinueStory(ctx, req.(*ContinueStoryRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WebstoryService_GetStory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetStoryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WebstoryServiceServer).GetStory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WebstoryService_GetStory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WebstoryServiceServer).GetStory(ctx, req.(*GetStoryRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WebstoryService_ResetStory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ResetStoryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WebstoryServiceServer).ResetStory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WebstoryService_ResetStory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WebstoryServiceServer).ResetStory(ctx, req.(*ResetStoryRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WebstoryService_StreamStory_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(StreamStoryRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(WebstoryServiceServer).StreamStory(m, &grpc.GenericServerStream[StreamStoryRequest, StreamStoryResponse]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type WebstoryService_StreamStoryServer = grpc.ServerStreamingServer[StreamStoryResponse]
// WebstoryService_ServiceDesc is the grpc.ServiceDesc for WebstoryService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var WebstoryService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "webstory.v1.WebstoryService",
HandlerType: (*WebstoryServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "StartStory",
Handler: _WebstoryService_StartStory_Handler,
},
{
MethodName: "ContinueStory",
Handler: _WebstoryService_ContinueStory_Handler,
},
{
MethodName: "GetStory",
Handler: _WebstoryService_GetStory_Handler,
},
{
MethodName: "ResetStory",
Handler: _WebstoryService_ResetStory_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "StreamStory",
Handler: _WebstoryService_StreamStory_Handler,
ServerStreams: true,
},
},
Metadata: "webstory/v1/api.proto",
}