add: aip, a story resource

This commit is contained in:
2026-03-24 22:49:44 -07:00
parent 622eca78cb
commit 4e111c7f6d
9 changed files with 13325 additions and 1208 deletions
File diff suppressed because it is too large Load Diff
+133 -136
View File
@@ -11,6 +11,7 @@ import (
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
@@ -19,11 +20,11 @@ import (
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"
WebstoryService_GetStory_FullMethodName = "/webstory.v1.WebstoryService/GetStory"
WebstoryService_ListStories_FullMethodName = "/webstory.v1.WebstoryService/ListStories"
WebstoryService_CreateStory_FullMethodName = "/webstory.v1.WebstoryService/CreateStory"
WebstoryService_UpdateStory_FullMethodName = "/webstory.v1.WebstoryService/UpdateStory"
WebstoryService_DeleteStory_FullMethodName = "/webstory.v1.WebstoryService/DeleteStory"
)
// WebstoryServiceClient is the client API for WebstoryService service.
@@ -32,16 +33,16 @@ const (
//
// 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)
// GetStory retrieves a story by its resource name.
GetStory(ctx context.Context, in *GetStoryRequest, opts ...grpc.CallOption) (*Story, error)
// ListStories returns a list of stories.
ListStories(ctx context.Context, in *ListStoriesRequest, opts ...grpc.CallOption) (*ListStoriesResponse, error)
// CreateStory creates a new story.
CreateStory(ctx context.Context, in *CreateStoryRequest, opts ...grpc.CallOption) (*Story, error)
// UpdateStory updates an existing story.
UpdateStory(ctx context.Context, in *UpdateStoryRequest, opts ...grpc.CallOption) (*Story, error)
// DeleteStory deletes a story.
DeleteStory(ctx context.Context, in *DeleteStoryRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type webstoryServiceClient struct {
@@ -52,29 +53,9 @@ func NewWebstoryServiceClient(cc grpc.ClientConnInterface) WebstoryServiceClient
return &webstoryServiceClient{cc}
}
func (c *webstoryServiceClient) StartStory(ctx context.Context, in *StartStoryRequest, opts ...grpc.CallOption) (*StartStoryResponse, error) {
func (c *webstoryServiceClient) GetStory(ctx context.Context, in *GetStoryRequest, opts ...grpc.CallOption) (*Story, 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)
out := new(Story)
err := c.cc.Invoke(ctx, WebstoryService_GetStory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -82,34 +63,45 @@ func (c *webstoryServiceClient) GetStory(ctx context.Context, in *GetStoryReques
return out, nil
}
func (c *webstoryServiceClient) ResetStory(ctx context.Context, in *ResetStoryRequest, opts ...grpc.CallOption) (*ResetStoryResponse, error) {
func (c *webstoryServiceClient) ListStories(ctx context.Context, in *ListStoriesRequest, opts ...grpc.CallOption) (*ListStoriesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ResetStoryResponse)
err := c.cc.Invoke(ctx, WebstoryService_ResetStory_FullMethodName, in, out, cOpts...)
out := new(ListStoriesResponse)
err := c.cc.Invoke(ctx, WebstoryService_ListStories_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) {
func (c *webstoryServiceClient) CreateStory(ctx context.Context, in *CreateStoryRequest, opts ...grpc.CallOption) (*Story, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &WebstoryService_ServiceDesc.Streams[0], WebstoryService_StreamStory_FullMethodName, cOpts...)
out := new(Story)
err := c.cc.Invoke(ctx, WebstoryService_CreateStory_FullMethodName, in, out, 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
return out, 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]
func (c *webstoryServiceClient) UpdateStory(ctx context.Context, in *UpdateStoryRequest, opts ...grpc.CallOption) (*Story, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Story)
err := c.cc.Invoke(ctx, WebstoryService_UpdateStory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *webstoryServiceClient) DeleteStory(ctx context.Context, in *DeleteStoryRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, WebstoryService_DeleteStory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// WebstoryServiceServer is the server API for WebstoryService service.
// All implementations must embed UnimplementedWebstoryServiceServer
@@ -117,16 +109,16 @@ type WebstoryService_StreamStoryClient = grpc.ServerStreamingClient[StreamStoryR
//
// 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
// GetStory retrieves a story by its resource name.
GetStory(context.Context, *GetStoryRequest) (*Story, error)
// ListStories returns a list of stories.
ListStories(context.Context, *ListStoriesRequest) (*ListStoriesResponse, error)
// CreateStory creates a new story.
CreateStory(context.Context, *CreateStoryRequest) (*Story, error)
// UpdateStory updates an existing story.
UpdateStory(context.Context, *UpdateStoryRequest) (*Story, error)
// DeleteStory deletes a story.
DeleteStory(context.Context, *DeleteStoryRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedWebstoryServiceServer()
}
@@ -137,20 +129,20 @@ type WebstoryServiceServer interface {
// 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) {
func (UnimplementedWebstoryServiceServer) GetStory(context.Context, *GetStoryRequest) (*Story, 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) ListStories(context.Context, *ListStoriesRequest) (*ListStoriesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListStories not implemented")
}
func (UnimplementedWebstoryServiceServer) StreamStory(*StreamStoryRequest, grpc.ServerStreamingServer[StreamStoryResponse]) error {
return status.Error(codes.Unimplemented, "method StreamStory not implemented")
func (UnimplementedWebstoryServiceServer) CreateStory(context.Context, *CreateStoryRequest) (*Story, error) {
return nil, status.Error(codes.Unimplemented, "method CreateStory not implemented")
}
func (UnimplementedWebstoryServiceServer) UpdateStory(context.Context, *UpdateStoryRequest) (*Story, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateStory not implemented")
}
func (UnimplementedWebstoryServiceServer) DeleteStory(context.Context, *DeleteStoryRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteStory not implemented")
}
func (UnimplementedWebstoryServiceServer) mustEmbedUnimplementedWebstoryServiceServer() {}
func (UnimplementedWebstoryServiceServer) testEmbeddedByValue() {}
@@ -173,42 +165,6 @@ func RegisterWebstoryServiceServer(s grpc.ServiceRegistrar, srv WebstoryServiceS
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 {
@@ -227,34 +183,77 @@ func _WebstoryService_GetStory_Handler(srv interface{}, ctx context.Context, dec
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)
func _WebstoryService_ListStories_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListStoriesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WebstoryServiceServer).ResetStory(ctx, in)
return srv.(WebstoryServiceServer).ListStories(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WebstoryService_ResetStory_FullMethodName,
FullMethod: WebstoryService_ListStories_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WebstoryServiceServer).ResetStory(ctx, req.(*ResetStoryRequest))
return srv.(WebstoryServiceServer).ListStories(ctx, req.(*ListStoriesRequest))
}
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
func _WebstoryService_CreateStory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateStoryRequest)
if err := dec(in); err != nil {
return nil, err
}
return srv.(WebstoryServiceServer).StreamStory(m, &grpc.GenericServerStream[StreamStoryRequest, StreamStoryResponse]{ServerStream: stream})
if interceptor == nil {
return srv.(WebstoryServiceServer).CreateStory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WebstoryService_CreateStory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WebstoryServiceServer).CreateStory(ctx, req.(*CreateStoryRequest))
}
return interceptor(ctx, in, info, handler)
}
// 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]
func _WebstoryService_UpdateStory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateStoryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WebstoryServiceServer).UpdateStory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WebstoryService_UpdateStory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WebstoryServiceServer).UpdateStory(ctx, req.(*UpdateStoryRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WebstoryService_DeleteStory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteStoryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WebstoryServiceServer).DeleteStory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WebstoryService_DeleteStory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WebstoryServiceServer).DeleteStory(ctx, req.(*DeleteStoryRequest))
}
return interceptor(ctx, in, info, handler)
}
// WebstoryService_ServiceDesc is the grpc.ServiceDesc for WebstoryService service.
// It's only intended for direct use with grpc.RegisterService,
@@ -263,29 +262,27 @@ 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,
MethodName: "ListStories",
Handler: _WebstoryService_ListStories_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "StreamStory",
Handler: _WebstoryService_StreamStory_Handler,
ServerStreams: true,
MethodName: "CreateStory",
Handler: _WebstoryService_CreateStory_Handler,
},
{
MethodName: "UpdateStory",
Handler: _WebstoryService_UpdateStory_Handler,
},
{
MethodName: "DeleteStory",
Handler: _WebstoryService_DeleteStory_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "webstory/v1/api.proto",
}