diff --git a/Makefile b/Makefile index f32d6df..651cc3c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: gen-proto BIN := $(abspath ./bin) -TAG := v1.0.0 +TAG := v1.1.1 go-build: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o grapevineer-grpc cmd/grapevineer-grpc/main.go cmd/grapevineer-grpc/wire_gen.go diff --git a/application/grapevineer.go b/application/grapevineer.go index 8ac399f..3b81867 100644 --- a/application/grapevineer.go +++ b/application/grapevineer.go @@ -50,21 +50,27 @@ type GrapevineerService interface { UpdatePlayer(ctx context.Context, req *grapevineer.UpdatePlayerRequest) (*grapevineer.UpdatePlayerResponse, error) GetPlayerInfo(ctx context.Context, req *grapevineer.GetPlayerInfoRequest) (*grapevineer.GetPlayerInfoResponse, error) + // bo + SetBoScript(ctx context.Context, req *grapevineer.SetBoScriptRequest) (*grapevineer.SetBoScriptResponse, error) + GetBoScriptRandomly(ctx context.Context, req *grapevineer.GetBoScriptRandomlyRequest) (*grapevineer.GetBoScriptRandomlyResponse, error) + // voicevox GetWavFromText(ctx context.Context, req *grapevineer.GetWavFromTextRequest) (*grapevineer.GetWavFromTextResponse, error) } type grapevineerService struct { - cfg config.Config - db *database.Database - repository repository.Repository + cfg config.Config + db *database.Database + playerRepository repository.PlayerRepository + boRepository repository.BoRepository } -func NewGrapevineerService(cfg config.Config, db *database.Database, repository repository.Repository) GrapevineerService { +func NewGrapevineerService(cfg config.Config, db *database.Database, playerRepository repository.PlayerRepository, boRepository repository.BoRepository) GrapevineerService { return &grapevineerService{ - cfg: cfg, - db: db, - repository: repository, + cfg: cfg, + db: db, + playerRepository: playerRepository, + boRepository: boRepository, } } @@ -319,7 +325,7 @@ func (s *grapevineerService) SetPlayer(ctx context.Context, req *grapevineer.Set Name: req.Name, Region: req.Region, } - if _, err := s.repository.CreatePlayer(ctx, s.db, player); err != nil { + if _, err := s.playerRepository.CreatePlayer(ctx, s.db, player); err != nil { return nil, status.Errorf(codes.Internal, "failed to create player: %v", err) } return &grapevineer.SetPlayerResponse{ @@ -328,7 +334,7 @@ func (s *grapevineerService) SetPlayer(ctx context.Context, req *grapevineer.Set } func (s *grapevineerService) GetAllPlayers(ctx context.Context, req *grapevineer.GetAllPlayersRequest) (*grapevineer.GetAllPlayersResponse, error) { - players, err := s.repository.FindAll(ctx, s.db) + players, err := s.playerRepository.FindAll(ctx, s.db) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get all players: %v", err) } @@ -359,7 +365,7 @@ func (s *grapevineerService) UpdatePlayer(ctx context.Context, req *grapevineer. Name: req.Name, Region: req.Region, } - if _, err := s.repository.UpdatePlayer(ctx, s.db, player); err != nil { + if _, err := s.playerRepository.UpdatePlayer(ctx, s.db, player); err != nil { return nil, status.Errorf(codes.Internal, "failed to update player: %v", err) } return &grapevineer.UpdatePlayerResponse{ @@ -526,3 +532,27 @@ func (s *grapevineerService) GetWavFromText(ctx context.Context, req *grapevinee return response, nil } + +func (s *grapevineerService) SetBoScript(ctx context.Context, req *grapevineer.SetBoScriptRequest) (*grapevineer.SetBoScriptResponse, error) { + bo := &model.Bo{ + ID: uuid.New().String(), + Script: req.Script, + } + if _, err := s.boRepository.CreateBo(ctx, s.db, bo); err != nil { + return nil, status.Errorf(codes.Internal, "failed to create bo: %v", err) + } + return &grapevineer.SetBoScriptResponse{ + Status: 200, + }, nil +} + +func (s *grapevineerService) GetBoScriptRandomly(ctx context.Context, req *grapevineer.GetBoScriptRandomlyRequest) (*grapevineer.GetBoScriptRandomlyResponse, error) { + bo, err := s.boRepository.FindOneRandomly(ctx, s.db) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get bo: %v", err) + } + return &grapevineer.GetBoScriptRandomlyResponse{ + BoId: bo.ID, + Script: bo.Script, + }, nil +} diff --git a/cmd/grapevineer-grpc/wire_gen.go b/cmd/grapevineer-grpc/wire_gen.go index e40ff06..c37549c 100644 --- a/cmd/grapevineer-grpc/wire_gen.go +++ b/cmd/grapevineer-grpc/wire_gen.go @@ -23,8 +23,9 @@ func wireInject(ctx context.Context) (application.GrapevineerService, func(), er if err != nil { return nil, nil, err } - repositoryRepository := repository.NewPlayerRepository() - grapevineerService := application.NewGrapevineerService(configConfig, databaseDatabase, repositoryRepository) + playerRepository := repository.NewPlayerRepository() + boRepository := repository.NewBoRepository() + grapevineerService := application.NewGrapevineerService(configConfig, databaseDatabase, playerRepository, boRepository) return grapevineerService, func() { }, nil } diff --git a/domain/model/bo.go b/domain/model/bo.go new file mode 100644 index 0000000..194004b --- /dev/null +++ b/domain/model/bo.go @@ -0,0 +1,6 @@ +package model + +type Bo struct { + ID string + Script string +} diff --git a/domain/repository/bo.go b/domain/repository/bo.go new file mode 100644 index 0000000..8af5e8e --- /dev/null +++ b/domain/repository/bo.go @@ -0,0 +1,55 @@ +package repository + +import ( + "context" + "errors" + "esh2n/grapevineer/domain/model" + "esh2n/grapevineer/internal/database" + "math/rand" + "time" +) + +type BoRepository interface { + CreateBo(ctx context.Context, db *database.Database, bo *model.Bo) (*model.Bo, error) + FindOneRandomly(ctx context.Context, db *database.Database) (*model.Bo, error) +} + +type boRepositoryImpl struct{} + +func (r *boRepositoryImpl) CreateBo(ctx context.Context, db *database.Database, bo *model.Bo) (*model.Bo, error) { + q := db.Client.Bo. + Create(). + SetID(bo.ID). + SetScript(bo.Script) + + x, err := q.Save(ctx) + if err != nil { + return nil, err + } + return &model.Bo{ + ID: x.ID, + Script: x.Script, + }, nil +} + +func (r *boRepositoryImpl) FindOneRandomly(ctx context.Context, db *database.Database) (*model.Bo, error) { + bos, err := db.Client.Bo.Query().All(ctx) + if err != nil { + return nil, err + } + + if len(bos) == 0 { + return nil, errors.New("No records found in the database") + } + + rand.Seed(time.Now().UnixNano()) // ensure truly random number + randomIndex := rand.Intn(len(bos)) + + return &model.Bo{ + ID: bos[randomIndex].ID, + Script: bos[randomIndex].Script, + }, nil +} +func NewBoRepository() BoRepository { + return &boRepositoryImpl{} +} diff --git a/domain/repository/player.go b/domain/repository/player.go index 458e553..c2099bf 100644 --- a/domain/repository/player.go +++ b/domain/repository/player.go @@ -6,7 +6,7 @@ import ( "esh2n/grapevineer/internal/database" ) -type Repository interface { +type PlayerRepository interface { CreatePlayer(ctx context.Context, db *database.Database, player *model.Player) (*model.Player, error) DeletePlayer(ctx context.Context, db *database.Database, id string) error UpdatePlayer(ctx context.Context, db *database.Database, player *model.Player) (*model.Player, error) @@ -76,6 +76,6 @@ func (a *playerRepositoryImpl) FindAll(ctx context.Context, db *database.Databas return result, nil } -func NewPlayerRepository() Repository { +func NewPlayerRepository() PlayerRepository { return &playerRepositoryImpl{} } diff --git a/domain/repository/repository.go b/domain/repository/repository.go index ce907c8..22b43db 100644 --- a/domain/repository/repository.go +++ b/domain/repository/repository.go @@ -6,4 +6,5 @@ import ( var Set = wire.NewSet( NewPlayerRepository, + NewBoRepository, ) diff --git a/ent/bo.go b/ent/bo.go new file mode 100644 index 0000000..4c4a9fb --- /dev/null +++ b/ent/bo.go @@ -0,0 +1,101 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "esh2n/grapevineer/ent/bo" + "fmt" + "strings" + + "entgo.io/ent" + "entgo.io/ent/dialect/sql" +) + +// Bo is the model entity for the Bo schema. +type Bo struct { + config `json:"-"` + // ID of the ent. + ID string `json:"id,omitempty"` + // Script holds the value of the "script" field. + Script string `json:"script,omitempty"` + selectValues sql.SelectValues +} + +// scanValues returns the types for scanning values from sql.Rows. +func (*Bo) scanValues(columns []string) ([]any, error) { + values := make([]any, len(columns)) + for i := range columns { + switch columns[i] { + case bo.FieldID, bo.FieldScript: + values[i] = new(sql.NullString) + default: + values[i] = new(sql.UnknownType) + } + } + return values, nil +} + +// assignValues assigns the values that were returned from sql.Rows (after scanning) +// to the Bo fields. +func (b *Bo) assignValues(columns []string, values []any) error { + if m, n := len(values), len(columns); m < n { + return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) + } + for i := range columns { + switch columns[i] { + case bo.FieldID: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field id", values[i]) + } else if value.Valid { + b.ID = value.String + } + case bo.FieldScript: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field script", values[i]) + } else if value.Valid { + b.Script = value.String + } + default: + b.selectValues.Set(columns[i], values[i]) + } + } + return nil +} + +// Value returns the ent.Value that was dynamically selected and assigned to the Bo. +// This includes values selected through modifiers, order, etc. +func (b *Bo) Value(name string) (ent.Value, error) { + return b.selectValues.Get(name) +} + +// Update returns a builder for updating this Bo. +// Note that you need to call Bo.Unwrap() before calling this method if this Bo +// was returned from a transaction, and the transaction was committed or rolled back. +func (b *Bo) Update() *BoUpdateOne { + return NewBoClient(b.config).UpdateOne(b) +} + +// Unwrap unwraps the Bo entity that was returned from a transaction after it was closed, +// so that all future queries will be executed through the driver which created the transaction. +func (b *Bo) Unwrap() *Bo { + _tx, ok := b.config.driver.(*txDriver) + if !ok { + panic("ent: Bo is not a transactional entity") + } + b.config.driver = _tx.drv + return b +} + +// String implements the fmt.Stringer. +func (b *Bo) String() string { + var builder strings.Builder + builder.WriteString("Bo(") + builder.WriteString(fmt.Sprintf("id=%v, ", b.ID)) + builder.WriteString("script=") + builder.WriteString(b.Script) + builder.WriteByte(')') + return builder.String() +} + +// Bos is a parsable slice of Bo. +type Bos []*Bo diff --git a/ent/bo/bo.go b/ent/bo/bo.go new file mode 100644 index 0000000..14797c3 --- /dev/null +++ b/ent/bo/bo.go @@ -0,0 +1,52 @@ +// Code generated by ent, DO NOT EDIT. + +package bo + +import ( + "entgo.io/ent/dialect/sql" +) + +const ( + // Label holds the string label denoting the bo type in the database. + Label = "bo" + // FieldID holds the string denoting the id field in the database. + FieldID = "id" + // FieldScript holds the string denoting the script field in the database. + FieldScript = "script" + // Table holds the table name of the bo in the database. + Table = "bos" +) + +// Columns holds all SQL columns for bo fields. +var Columns = []string{ + FieldID, + FieldScript, +} + +// ValidColumn reports if the column name is valid (part of the table columns). +func ValidColumn(column string) bool { + for i := range Columns { + if column == Columns[i] { + return true + } + } + return false +} + +var ( + // ScriptValidator is a validator for the "script" field. It is called by the builders before save. + ScriptValidator func(string) error +) + +// OrderOption defines the ordering options for the Bo queries. +type OrderOption func(*sql.Selector) + +// ByID orders the results by the id field. +func ByID(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldID, opts...).ToFunc() +} + +// ByScript orders the results by the script field. +func ByScript(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldScript, opts...).ToFunc() +} diff --git a/ent/bo/where.go b/ent/bo/where.go new file mode 100644 index 0000000..858595e --- /dev/null +++ b/ent/bo/where.go @@ -0,0 +1,166 @@ +// Code generated by ent, DO NOT EDIT. + +package bo + +import ( + "esh2n/grapevineer/ent/predicate" + + "entgo.io/ent/dialect/sql" +) + +// ID filters vertices based on their ID field. +func ID(id string) predicate.Bo { + return predicate.Bo(sql.FieldEQ(FieldID, id)) +} + +// IDEQ applies the EQ predicate on the ID field. +func IDEQ(id string) predicate.Bo { + return predicate.Bo(sql.FieldEQ(FieldID, id)) +} + +// IDNEQ applies the NEQ predicate on the ID field. +func IDNEQ(id string) predicate.Bo { + return predicate.Bo(sql.FieldNEQ(FieldID, id)) +} + +// IDIn applies the In predicate on the ID field. +func IDIn(ids ...string) predicate.Bo { + return predicate.Bo(sql.FieldIn(FieldID, ids...)) +} + +// IDNotIn applies the NotIn predicate on the ID field. +func IDNotIn(ids ...string) predicate.Bo { + return predicate.Bo(sql.FieldNotIn(FieldID, ids...)) +} + +// IDGT applies the GT predicate on the ID field. +func IDGT(id string) predicate.Bo { + return predicate.Bo(sql.FieldGT(FieldID, id)) +} + +// IDGTE applies the GTE predicate on the ID field. +func IDGTE(id string) predicate.Bo { + return predicate.Bo(sql.FieldGTE(FieldID, id)) +} + +// IDLT applies the LT predicate on the ID field. +func IDLT(id string) predicate.Bo { + return predicate.Bo(sql.FieldLT(FieldID, id)) +} + +// IDLTE applies the LTE predicate on the ID field. +func IDLTE(id string) predicate.Bo { + return predicate.Bo(sql.FieldLTE(FieldID, id)) +} + +// IDEqualFold applies the EqualFold predicate on the ID field. +func IDEqualFold(id string) predicate.Bo { + return predicate.Bo(sql.FieldEqualFold(FieldID, id)) +} + +// IDContainsFold applies the ContainsFold predicate on the ID field. +func IDContainsFold(id string) predicate.Bo { + return predicate.Bo(sql.FieldContainsFold(FieldID, id)) +} + +// Script applies equality check predicate on the "script" field. It's identical to ScriptEQ. +func Script(v string) predicate.Bo { + return predicate.Bo(sql.FieldEQ(FieldScript, v)) +} + +// ScriptEQ applies the EQ predicate on the "script" field. +func ScriptEQ(v string) predicate.Bo { + return predicate.Bo(sql.FieldEQ(FieldScript, v)) +} + +// ScriptNEQ applies the NEQ predicate on the "script" field. +func ScriptNEQ(v string) predicate.Bo { + return predicate.Bo(sql.FieldNEQ(FieldScript, v)) +} + +// ScriptIn applies the In predicate on the "script" field. +func ScriptIn(vs ...string) predicate.Bo { + return predicate.Bo(sql.FieldIn(FieldScript, vs...)) +} + +// ScriptNotIn applies the NotIn predicate on the "script" field. +func ScriptNotIn(vs ...string) predicate.Bo { + return predicate.Bo(sql.FieldNotIn(FieldScript, vs...)) +} + +// ScriptGT applies the GT predicate on the "script" field. +func ScriptGT(v string) predicate.Bo { + return predicate.Bo(sql.FieldGT(FieldScript, v)) +} + +// ScriptGTE applies the GTE predicate on the "script" field. +func ScriptGTE(v string) predicate.Bo { + return predicate.Bo(sql.FieldGTE(FieldScript, v)) +} + +// ScriptLT applies the LT predicate on the "script" field. +func ScriptLT(v string) predicate.Bo { + return predicate.Bo(sql.FieldLT(FieldScript, v)) +} + +// ScriptLTE applies the LTE predicate on the "script" field. +func ScriptLTE(v string) predicate.Bo { + return predicate.Bo(sql.FieldLTE(FieldScript, v)) +} + +// ScriptContains applies the Contains predicate on the "script" field. +func ScriptContains(v string) predicate.Bo { + return predicate.Bo(sql.FieldContains(FieldScript, v)) +} + +// ScriptHasPrefix applies the HasPrefix predicate on the "script" field. +func ScriptHasPrefix(v string) predicate.Bo { + return predicate.Bo(sql.FieldHasPrefix(FieldScript, v)) +} + +// ScriptHasSuffix applies the HasSuffix predicate on the "script" field. +func ScriptHasSuffix(v string) predicate.Bo { + return predicate.Bo(sql.FieldHasSuffix(FieldScript, v)) +} + +// ScriptEqualFold applies the EqualFold predicate on the "script" field. +func ScriptEqualFold(v string) predicate.Bo { + return predicate.Bo(sql.FieldEqualFold(FieldScript, v)) +} + +// ScriptContainsFold applies the ContainsFold predicate on the "script" field. +func ScriptContainsFold(v string) predicate.Bo { + return predicate.Bo(sql.FieldContainsFold(FieldScript, v)) +} + +// And groups predicates with the AND operator between them. +func And(predicates ...predicate.Bo) predicate.Bo { + return predicate.Bo(func(s *sql.Selector) { + s1 := s.Clone().SetP(nil) + for _, p := range predicates { + p(s1) + } + s.Where(s1.P()) + }) +} + +// Or groups predicates with the OR operator between them. +func Or(predicates ...predicate.Bo) predicate.Bo { + return predicate.Bo(func(s *sql.Selector) { + s1 := s.Clone().SetP(nil) + for i, p := range predicates { + if i > 0 { + s1.Or() + } + p(s1) + } + s.Where(s1.P()) + }) +} + +// Not applies the not operator on the given predicate. +func Not(p predicate.Bo) predicate.Bo { + return predicate.Bo(func(s *sql.Selector) { + p(s.Not()) + }) +} diff --git a/ent/bo_create.go b/ent/bo_create.go new file mode 100644 index 0000000..429a7c5 --- /dev/null +++ b/ent/bo_create.go @@ -0,0 +1,195 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "errors" + "esh2n/grapevineer/ent/bo" + "fmt" + + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" +) + +// BoCreate is the builder for creating a Bo entity. +type BoCreate struct { + config + mutation *BoMutation + hooks []Hook +} + +// SetScript sets the "script" field. +func (bc *BoCreate) SetScript(s string) *BoCreate { + bc.mutation.SetScript(s) + return bc +} + +// SetID sets the "id" field. +func (bc *BoCreate) SetID(s string) *BoCreate { + bc.mutation.SetID(s) + return bc +} + +// Mutation returns the BoMutation object of the builder. +func (bc *BoCreate) Mutation() *BoMutation { + return bc.mutation +} + +// Save creates the Bo in the database. +func (bc *BoCreate) Save(ctx context.Context) (*Bo, error) { + return withHooks(ctx, bc.sqlSave, bc.mutation, bc.hooks) +} + +// SaveX calls Save and panics if Save returns an error. +func (bc *BoCreate) SaveX(ctx context.Context) *Bo { + v, err := bc.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (bc *BoCreate) Exec(ctx context.Context) error { + _, err := bc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (bc *BoCreate) ExecX(ctx context.Context) { + if err := bc.Exec(ctx); err != nil { + panic(err) + } +} + +// check runs all checks and user-defined validators on the builder. +func (bc *BoCreate) check() error { + if _, ok := bc.mutation.Script(); !ok { + return &ValidationError{Name: "script", err: errors.New(`ent: missing required field "Bo.script"`)} + } + if v, ok := bc.mutation.Script(); ok { + if err := bo.ScriptValidator(v); err != nil { + return &ValidationError{Name: "script", err: fmt.Errorf(`ent: validator failed for field "Bo.script": %w`, err)} + } + } + return nil +} + +func (bc *BoCreate) sqlSave(ctx context.Context) (*Bo, error) { + if err := bc.check(); err != nil { + return nil, err + } + _node, _spec := bc.createSpec() + if err := sqlgraph.CreateNode(ctx, bc.driver, _spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + if _spec.ID.Value != nil { + if id, ok := _spec.ID.Value.(string); ok { + _node.ID = id + } else { + return nil, fmt.Errorf("unexpected Bo.ID type: %T", _spec.ID.Value) + } + } + bc.mutation.id = &_node.ID + bc.mutation.done = true + return _node, nil +} + +func (bc *BoCreate) createSpec() (*Bo, *sqlgraph.CreateSpec) { + var ( + _node = &Bo{config: bc.config} + _spec = sqlgraph.NewCreateSpec(bo.Table, sqlgraph.NewFieldSpec(bo.FieldID, field.TypeString)) + ) + if id, ok := bc.mutation.ID(); ok { + _node.ID = id + _spec.ID.Value = id + } + if value, ok := bc.mutation.Script(); ok { + _spec.SetField(bo.FieldScript, field.TypeString, value) + _node.Script = value + } + return _node, _spec +} + +// BoCreateBulk is the builder for creating many Bo entities in bulk. +type BoCreateBulk struct { + config + builders []*BoCreate +} + +// Save creates the Bo entities in the database. +func (bcb *BoCreateBulk) Save(ctx context.Context) ([]*Bo, error) { + specs := make([]*sqlgraph.CreateSpec, len(bcb.builders)) + nodes := make([]*Bo, len(bcb.builders)) + mutators := make([]Mutator, len(bcb.builders)) + for i := range bcb.builders { + func(i int, root context.Context) { + builder := bcb.builders[i] + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*BoMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + if err := builder.check(); err != nil { + return nil, err + } + builder.mutation = mutation + var err error + nodes[i], specs[i] = builder.createSpec() + if i < len(mutators)-1 { + _, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation) + } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} + // Invoke the actual operation on the latest mutation in the chain. + if err = sqlgraph.BatchCreate(ctx, bcb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + } + } + if err != nil { + return nil, err + } + mutation.id = &nodes[i].ID + mutation.done = true + return nodes[i], nil + }) + for i := len(builder.hooks) - 1; i >= 0; i-- { + mut = builder.hooks[i](mut) + } + mutators[i] = mut + }(i, ctx) + } + if len(mutators) > 0 { + if _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil { + return nil, err + } + } + return nodes, nil +} + +// SaveX is like Save, but panics if an error occurs. +func (bcb *BoCreateBulk) SaveX(ctx context.Context) []*Bo { + v, err := bcb.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (bcb *BoCreateBulk) Exec(ctx context.Context) error { + _, err := bcb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (bcb *BoCreateBulk) ExecX(ctx context.Context) { + if err := bcb.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/ent/bo_delete.go b/ent/bo_delete.go new file mode 100644 index 0000000..039e77e --- /dev/null +++ b/ent/bo_delete.go @@ -0,0 +1,88 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "esh2n/grapevineer/ent/bo" + "esh2n/grapevineer/ent/predicate" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" +) + +// BoDelete is the builder for deleting a Bo entity. +type BoDelete struct { + config + hooks []Hook + mutation *BoMutation +} + +// Where appends a list predicates to the BoDelete builder. +func (bd *BoDelete) Where(ps ...predicate.Bo) *BoDelete { + bd.mutation.Where(ps...) + return bd +} + +// Exec executes the deletion query and returns how many vertices were deleted. +func (bd *BoDelete) Exec(ctx context.Context) (int, error) { + return withHooks(ctx, bd.sqlExec, bd.mutation, bd.hooks) +} + +// ExecX is like Exec, but panics if an error occurs. +func (bd *BoDelete) ExecX(ctx context.Context) int { + n, err := bd.Exec(ctx) + if err != nil { + panic(err) + } + return n +} + +func (bd *BoDelete) sqlExec(ctx context.Context) (int, error) { + _spec := sqlgraph.NewDeleteSpec(bo.Table, sqlgraph.NewFieldSpec(bo.FieldID, field.TypeString)) + if ps := bd.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + affected, err := sqlgraph.DeleteNodes(ctx, bd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + bd.mutation.done = true + return affected, err +} + +// BoDeleteOne is the builder for deleting a single Bo entity. +type BoDeleteOne struct { + bd *BoDelete +} + +// Where appends a list predicates to the BoDelete builder. +func (bdo *BoDeleteOne) Where(ps ...predicate.Bo) *BoDeleteOne { + bdo.bd.mutation.Where(ps...) + return bdo +} + +// Exec executes the deletion query. +func (bdo *BoDeleteOne) Exec(ctx context.Context) error { + n, err := bdo.bd.Exec(ctx) + switch { + case err != nil: + return err + case n == 0: + return &NotFoundError{bo.Label} + default: + return nil + } +} + +// ExecX is like Exec, but panics if an error occurs. +func (bdo *BoDeleteOne) ExecX(ctx context.Context) { + if err := bdo.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/ent/bo_query.go b/ent/bo_query.go new file mode 100644 index 0000000..9e23c76 --- /dev/null +++ b/ent/bo_query.go @@ -0,0 +1,526 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "esh2n/grapevineer/ent/bo" + "esh2n/grapevineer/ent/predicate" + "fmt" + "math" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" +) + +// BoQuery is the builder for querying Bo entities. +type BoQuery struct { + config + ctx *QueryContext + order []bo.OrderOption + inters []Interceptor + predicates []predicate.Bo + // intermediate query (i.e. traversal path). + sql *sql.Selector + path func(context.Context) (*sql.Selector, error) +} + +// Where adds a new predicate for the BoQuery builder. +func (bq *BoQuery) Where(ps ...predicate.Bo) *BoQuery { + bq.predicates = append(bq.predicates, ps...) + return bq +} + +// Limit the number of records to be returned by this query. +func (bq *BoQuery) Limit(limit int) *BoQuery { + bq.ctx.Limit = &limit + return bq +} + +// Offset to start from. +func (bq *BoQuery) Offset(offset int) *BoQuery { + bq.ctx.Offset = &offset + return bq +} + +// Unique configures the query builder to filter duplicate records on query. +// By default, unique is set to true, and can be disabled using this method. +func (bq *BoQuery) Unique(unique bool) *BoQuery { + bq.ctx.Unique = &unique + return bq +} + +// Order specifies how the records should be ordered. +func (bq *BoQuery) Order(o ...bo.OrderOption) *BoQuery { + bq.order = append(bq.order, o...) + return bq +} + +// First returns the first Bo entity from the query. +// Returns a *NotFoundError when no Bo was found. +func (bq *BoQuery) First(ctx context.Context) (*Bo, error) { + nodes, err := bq.Limit(1).All(setContextOp(ctx, bq.ctx, "First")) + if err != nil { + return nil, err + } + if len(nodes) == 0 { + return nil, &NotFoundError{bo.Label} + } + return nodes[0], nil +} + +// FirstX is like First, but panics if an error occurs. +func (bq *BoQuery) FirstX(ctx context.Context) *Bo { + node, err := bq.First(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return node +} + +// FirstID returns the first Bo ID from the query. +// Returns a *NotFoundError when no Bo ID was found. +func (bq *BoQuery) FirstID(ctx context.Context) (id string, err error) { + var ids []string + if ids, err = bq.Limit(1).IDs(setContextOp(ctx, bq.ctx, "FirstID")); err != nil { + return + } + if len(ids) == 0 { + err = &NotFoundError{bo.Label} + return + } + return ids[0], nil +} + +// FirstIDX is like FirstID, but panics if an error occurs. +func (bq *BoQuery) FirstIDX(ctx context.Context) string { + id, err := bq.FirstID(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return id +} + +// Only returns a single Bo entity found by the query, ensuring it only returns one. +// Returns a *NotSingularError when more than one Bo entity is found. +// Returns a *NotFoundError when no Bo entities are found. +func (bq *BoQuery) Only(ctx context.Context) (*Bo, error) { + nodes, err := bq.Limit(2).All(setContextOp(ctx, bq.ctx, "Only")) + if err != nil { + return nil, err + } + switch len(nodes) { + case 1: + return nodes[0], nil + case 0: + return nil, &NotFoundError{bo.Label} + default: + return nil, &NotSingularError{bo.Label} + } +} + +// OnlyX is like Only, but panics if an error occurs. +func (bq *BoQuery) OnlyX(ctx context.Context) *Bo { + node, err := bq.Only(ctx) + if err != nil { + panic(err) + } + return node +} + +// OnlyID is like Only, but returns the only Bo ID in the query. +// Returns a *NotSingularError when more than one Bo ID is found. +// Returns a *NotFoundError when no entities are found. +func (bq *BoQuery) OnlyID(ctx context.Context) (id string, err error) { + var ids []string + if ids, err = bq.Limit(2).IDs(setContextOp(ctx, bq.ctx, "OnlyID")); err != nil { + return + } + switch len(ids) { + case 1: + id = ids[0] + case 0: + err = &NotFoundError{bo.Label} + default: + err = &NotSingularError{bo.Label} + } + return +} + +// OnlyIDX is like OnlyID, but panics if an error occurs. +func (bq *BoQuery) OnlyIDX(ctx context.Context) string { + id, err := bq.OnlyID(ctx) + if err != nil { + panic(err) + } + return id +} + +// All executes the query and returns a list of Bos. +func (bq *BoQuery) All(ctx context.Context) ([]*Bo, error) { + ctx = setContextOp(ctx, bq.ctx, "All") + if err := bq.prepareQuery(ctx); err != nil { + return nil, err + } + qr := querierAll[[]*Bo, *BoQuery]() + return withInterceptors[[]*Bo](ctx, bq, qr, bq.inters) +} + +// AllX is like All, but panics if an error occurs. +func (bq *BoQuery) AllX(ctx context.Context) []*Bo { + nodes, err := bq.All(ctx) + if err != nil { + panic(err) + } + return nodes +} + +// IDs executes the query and returns a list of Bo IDs. +func (bq *BoQuery) IDs(ctx context.Context) (ids []string, err error) { + if bq.ctx.Unique == nil && bq.path != nil { + bq.Unique(true) + } + ctx = setContextOp(ctx, bq.ctx, "IDs") + if err = bq.Select(bo.FieldID).Scan(ctx, &ids); err != nil { + return nil, err + } + return ids, nil +} + +// IDsX is like IDs, but panics if an error occurs. +func (bq *BoQuery) IDsX(ctx context.Context) []string { + ids, err := bq.IDs(ctx) + if err != nil { + panic(err) + } + return ids +} + +// Count returns the count of the given query. +func (bq *BoQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, bq.ctx, "Count") + if err := bq.prepareQuery(ctx); err != nil { + return 0, err + } + return withInterceptors[int](ctx, bq, querierCount[*BoQuery](), bq.inters) +} + +// CountX is like Count, but panics if an error occurs. +func (bq *BoQuery) CountX(ctx context.Context) int { + count, err := bq.Count(ctx) + if err != nil { + panic(err) + } + return count +} + +// Exist returns true if the query has elements in the graph. +func (bq *BoQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, bq.ctx, "Exist") + switch _, err := bq.FirstID(ctx); { + case IsNotFound(err): + return false, nil + case err != nil: + return false, fmt.Errorf("ent: check existence: %w", err) + default: + return true, nil + } +} + +// ExistX is like Exist, but panics if an error occurs. +func (bq *BoQuery) ExistX(ctx context.Context) bool { + exist, err := bq.Exist(ctx) + if err != nil { + panic(err) + } + return exist +} + +// Clone returns a duplicate of the BoQuery builder, including all associated steps. It can be +// used to prepare common query builders and use them differently after the clone is made. +func (bq *BoQuery) Clone() *BoQuery { + if bq == nil { + return nil + } + return &BoQuery{ + config: bq.config, + ctx: bq.ctx.Clone(), + order: append([]bo.OrderOption{}, bq.order...), + inters: append([]Interceptor{}, bq.inters...), + predicates: append([]predicate.Bo{}, bq.predicates...), + // clone intermediate query. + sql: bq.sql.Clone(), + path: bq.path, + } +} + +// GroupBy is used to group vertices by one or more fields/columns. +// It is often used with aggregate functions, like: count, max, mean, min, sum. +// +// Example: +// +// var v []struct { +// Script string `json:"script,omitempty"` +// Count int `json:"count,omitempty"` +// } +// +// client.Bo.Query(). +// GroupBy(bo.FieldScript). +// Aggregate(ent.Count()). +// Scan(ctx, &v) +func (bq *BoQuery) GroupBy(field string, fields ...string) *BoGroupBy { + bq.ctx.Fields = append([]string{field}, fields...) + grbuild := &BoGroupBy{build: bq} + grbuild.flds = &bq.ctx.Fields + grbuild.label = bo.Label + grbuild.scan = grbuild.Scan + return grbuild +} + +// Select allows the selection one or more fields/columns for the given query, +// instead of selecting all fields in the entity. +// +// Example: +// +// var v []struct { +// Script string `json:"script,omitempty"` +// } +// +// client.Bo.Query(). +// Select(bo.FieldScript). +// Scan(ctx, &v) +func (bq *BoQuery) Select(fields ...string) *BoSelect { + bq.ctx.Fields = append(bq.ctx.Fields, fields...) + sbuild := &BoSelect{BoQuery: bq} + sbuild.label = bo.Label + sbuild.flds, sbuild.scan = &bq.ctx.Fields, sbuild.Scan + return sbuild +} + +// Aggregate returns a BoSelect configured with the given aggregations. +func (bq *BoQuery) Aggregate(fns ...AggregateFunc) *BoSelect { + return bq.Select().Aggregate(fns...) +} + +func (bq *BoQuery) prepareQuery(ctx context.Context) error { + for _, inter := range bq.inters { + if inter == nil { + return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") + } + if trv, ok := inter.(Traverser); ok { + if err := trv.Traverse(ctx, bq); err != nil { + return err + } + } + } + for _, f := range bq.ctx.Fields { + if !bo.ValidColumn(f) { + return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + } + if bq.path != nil { + prev, err := bq.path(ctx) + if err != nil { + return err + } + bq.sql = prev + } + return nil +} + +func (bq *BoQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Bo, error) { + var ( + nodes = []*Bo{} + _spec = bq.querySpec() + ) + _spec.ScanValues = func(columns []string) ([]any, error) { + return (*Bo).scanValues(nil, columns) + } + _spec.Assign = func(columns []string, values []any) error { + node := &Bo{config: bq.config} + nodes = append(nodes, node) + return node.assignValues(columns, values) + } + for i := range hooks { + hooks[i](ctx, _spec) + } + if err := sqlgraph.QueryNodes(ctx, bq.driver, _spec); err != nil { + return nil, err + } + if len(nodes) == 0 { + return nodes, nil + } + return nodes, nil +} + +func (bq *BoQuery) sqlCount(ctx context.Context) (int, error) { + _spec := bq.querySpec() + _spec.Node.Columns = bq.ctx.Fields + if len(bq.ctx.Fields) > 0 { + _spec.Unique = bq.ctx.Unique != nil && *bq.ctx.Unique + } + return sqlgraph.CountNodes(ctx, bq.driver, _spec) +} + +func (bq *BoQuery) querySpec() *sqlgraph.QuerySpec { + _spec := sqlgraph.NewQuerySpec(bo.Table, bo.Columns, sqlgraph.NewFieldSpec(bo.FieldID, field.TypeString)) + _spec.From = bq.sql + if unique := bq.ctx.Unique; unique != nil { + _spec.Unique = *unique + } else if bq.path != nil { + _spec.Unique = true + } + if fields := bq.ctx.Fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, bo.FieldID) + for i := range fields { + if fields[i] != bo.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) + } + } + } + if ps := bq.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if limit := bq.ctx.Limit; limit != nil { + _spec.Limit = *limit + } + if offset := bq.ctx.Offset; offset != nil { + _spec.Offset = *offset + } + if ps := bq.order; len(ps) > 0 { + _spec.Order = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + return _spec +} + +func (bq *BoQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(bq.driver.Dialect()) + t1 := builder.Table(bo.Table) + columns := bq.ctx.Fields + if len(columns) == 0 { + columns = bo.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) + if bq.sql != nil { + selector = bq.sql + selector.Select(selector.Columns(columns...)...) + } + if bq.ctx.Unique != nil && *bq.ctx.Unique { + selector.Distinct() + } + for _, p := range bq.predicates { + p(selector) + } + for _, p := range bq.order { + p(selector) + } + if offset := bq.ctx.Offset; offset != nil { + // limit is mandatory for offset clause. We start + // with default value, and override it below if needed. + selector.Offset(*offset).Limit(math.MaxInt32) + } + if limit := bq.ctx.Limit; limit != nil { + selector.Limit(*limit) + } + return selector +} + +// BoGroupBy is the group-by builder for Bo entities. +type BoGroupBy struct { + selector + build *BoQuery +} + +// Aggregate adds the given aggregation functions to the group-by query. +func (bgb *BoGroupBy) Aggregate(fns ...AggregateFunc) *BoGroupBy { + bgb.fns = append(bgb.fns, fns...) + return bgb +} + +// Scan applies the selector query and scans the result into the given value. +func (bgb *BoGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, bgb.build.ctx, "GroupBy") + if err := bgb.build.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*BoQuery, *BoGroupBy](ctx, bgb.build, bgb, bgb.build.inters, v) +} + +func (bgb *BoGroupBy) sqlScan(ctx context.Context, root *BoQuery, v any) error { + selector := root.sqlQuery(ctx).Select() + aggregation := make([]string, 0, len(bgb.fns)) + for _, fn := range bgb.fns { + aggregation = append(aggregation, fn(selector)) + } + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(*bgb.flds)+len(bgb.fns)) + for _, f := range *bgb.flds { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) + } + selector.GroupBy(selector.Columns(*bgb.flds...)...) + if err := selector.Err(); err != nil { + return err + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := bgb.build.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} + +// BoSelect is the builder for selecting fields of Bo entities. +type BoSelect struct { + *BoQuery + selector +} + +// Aggregate adds the given aggregation functions to the selector query. +func (bs *BoSelect) Aggregate(fns ...AggregateFunc) *BoSelect { + bs.fns = append(bs.fns, fns...) + return bs +} + +// Scan applies the selector query and scans the result into the given value. +func (bs *BoSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, bs.ctx, "Select") + if err := bs.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*BoQuery, *BoSelect](ctx, bs.BoQuery, bs, bs.inters, v) +} + +func (bs *BoSelect) sqlScan(ctx context.Context, root *BoQuery, v any) error { + selector := root.sqlQuery(ctx) + aggregation := make([]string, 0, len(bs.fns)) + for _, fn := range bs.fns { + aggregation = append(aggregation, fn(selector)) + } + switch n := len(*bs.selector.flds); { + case n == 0 && len(aggregation) > 0: + selector.Select(aggregation...) + case n != 0 && len(aggregation) > 0: + selector.AppendSelect(aggregation...) + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := bs.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} diff --git a/ent/bo_update.go b/ent/bo_update.go new file mode 100644 index 0000000..5a7beb0 --- /dev/null +++ b/ent/bo_update.go @@ -0,0 +1,219 @@ +// Code generated by ent, DO NOT EDIT. + +package ent + +import ( + "context" + "errors" + "esh2n/grapevineer/ent/bo" + "esh2n/grapevineer/ent/predicate" + "fmt" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" +) + +// BoUpdate is the builder for updating Bo entities. +type BoUpdate struct { + config + hooks []Hook + mutation *BoMutation +} + +// Where appends a list predicates to the BoUpdate builder. +func (bu *BoUpdate) Where(ps ...predicate.Bo) *BoUpdate { + bu.mutation.Where(ps...) + return bu +} + +// SetScript sets the "script" field. +func (bu *BoUpdate) SetScript(s string) *BoUpdate { + bu.mutation.SetScript(s) + return bu +} + +// Mutation returns the BoMutation object of the builder. +func (bu *BoUpdate) Mutation() *BoMutation { + return bu.mutation +} + +// Save executes the query and returns the number of nodes affected by the update operation. +func (bu *BoUpdate) Save(ctx context.Context) (int, error) { + return withHooks(ctx, bu.sqlSave, bu.mutation, bu.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (bu *BoUpdate) SaveX(ctx context.Context) int { + affected, err := bu.Save(ctx) + if err != nil { + panic(err) + } + return affected +} + +// Exec executes the query. +func (bu *BoUpdate) Exec(ctx context.Context) error { + _, err := bu.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (bu *BoUpdate) ExecX(ctx context.Context) { + if err := bu.Exec(ctx); err != nil { + panic(err) + } +} + +// check runs all checks and user-defined validators on the builder. +func (bu *BoUpdate) check() error { + if v, ok := bu.mutation.Script(); ok { + if err := bo.ScriptValidator(v); err != nil { + return &ValidationError{Name: "script", err: fmt.Errorf(`ent: validator failed for field "Bo.script": %w`, err)} + } + } + return nil +} + +func (bu *BoUpdate) sqlSave(ctx context.Context) (n int, err error) { + if err := bu.check(); err != nil { + return n, err + } + _spec := sqlgraph.NewUpdateSpec(bo.Table, bo.Columns, sqlgraph.NewFieldSpec(bo.FieldID, field.TypeString)) + if ps := bu.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := bu.mutation.Script(); ok { + _spec.SetField(bo.FieldScript, field.TypeString, value) + } + if n, err = sqlgraph.UpdateNodes(ctx, bu.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{bo.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return 0, err + } + bu.mutation.done = true + return n, nil +} + +// BoUpdateOne is the builder for updating a single Bo entity. +type BoUpdateOne struct { + config + fields []string + hooks []Hook + mutation *BoMutation +} + +// SetScript sets the "script" field. +func (buo *BoUpdateOne) SetScript(s string) *BoUpdateOne { + buo.mutation.SetScript(s) + return buo +} + +// Mutation returns the BoMutation object of the builder. +func (buo *BoUpdateOne) Mutation() *BoMutation { + return buo.mutation +} + +// Where appends a list predicates to the BoUpdate builder. +func (buo *BoUpdateOne) Where(ps ...predicate.Bo) *BoUpdateOne { + buo.mutation.Where(ps...) + return buo +} + +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (buo *BoUpdateOne) Select(field string, fields ...string) *BoUpdateOne { + buo.fields = append([]string{field}, fields...) + return buo +} + +// Save executes the query and returns the updated Bo entity. +func (buo *BoUpdateOne) Save(ctx context.Context) (*Bo, error) { + return withHooks(ctx, buo.sqlSave, buo.mutation, buo.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (buo *BoUpdateOne) SaveX(ctx context.Context) *Bo { + node, err := buo.Save(ctx) + if err != nil { + panic(err) + } + return node +} + +// Exec executes the query on the entity. +func (buo *BoUpdateOne) Exec(ctx context.Context) error { + _, err := buo.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (buo *BoUpdateOne) ExecX(ctx context.Context) { + if err := buo.Exec(ctx); err != nil { + panic(err) + } +} + +// check runs all checks and user-defined validators on the builder. +func (buo *BoUpdateOne) check() error { + if v, ok := buo.mutation.Script(); ok { + if err := bo.ScriptValidator(v); err != nil { + return &ValidationError{Name: "script", err: fmt.Errorf(`ent: validator failed for field "Bo.script": %w`, err)} + } + } + return nil +} + +func (buo *BoUpdateOne) sqlSave(ctx context.Context) (_node *Bo, err error) { + if err := buo.check(); err != nil { + return _node, err + } + _spec := sqlgraph.NewUpdateSpec(bo.Table, bo.Columns, sqlgraph.NewFieldSpec(bo.FieldID, field.TypeString)) + id, ok := buo.mutation.ID() + if !ok { + return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Bo.id" for update`)} + } + _spec.Node.ID.Value = id + if fields := buo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, bo.FieldID) + for _, f := range fields { + if !bo.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != bo.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } + if ps := buo.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := buo.mutation.Script(); ok { + _spec.SetField(bo.FieldScript, field.TypeString, value) + } + _node = &Bo{config: buo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues + if err = sqlgraph.UpdateNode(ctx, buo.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{bo.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + buo.mutation.done = true + return _node, nil +} diff --git a/ent/client.go b/ent/client.go index fba1cf5..e33efce 100644 --- a/ent/client.go +++ b/ent/client.go @@ -10,6 +10,7 @@ import ( "esh2n/grapevineer/ent/migrate" + "esh2n/grapevineer/ent/bo" "esh2n/grapevineer/ent/player" "entgo.io/ent" @@ -22,6 +23,8 @@ type Client struct { config // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema + // Bo is the client for interacting with the Bo builders. + Bo *BoClient // Player is the client for interacting with the Player builders. Player *PlayerClient } @@ -37,6 +40,7 @@ func NewClient(opts ...Option) *Client { func (c *Client) init() { c.Schema = migrate.NewSchema(c.driver) + c.Bo = NewBoClient(c.config) c.Player = NewPlayerClient(c.config) } @@ -120,6 +124,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) { return &Tx{ ctx: ctx, config: cfg, + Bo: NewBoClient(cfg), Player: NewPlayerClient(cfg), }, nil } @@ -140,6 +145,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) return &Tx{ ctx: ctx, config: cfg, + Bo: NewBoClient(cfg), Player: NewPlayerClient(cfg), }, nil } @@ -147,7 +153,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) // Debug returns a new debug-client. It's used to get verbose logging on specific operations. // // client.Debug(). -// Player. +// Bo. // Query(). // Count(ctx) func (c *Client) Debug() *Client { @@ -169,18 +175,22 @@ func (c *Client) Close() error { // Use adds the mutation hooks to all the entity clients. // In order to add hooks to a specific client, call: `client.Node.Use(...)`. func (c *Client) Use(hooks ...Hook) { + c.Bo.Use(hooks...) c.Player.Use(hooks...) } // Intercept adds the query interceptors to all the entity clients. // In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`. func (c *Client) Intercept(interceptors ...Interceptor) { + c.Bo.Intercept(interceptors...) c.Player.Intercept(interceptors...) } // Mutate implements the ent.Mutator interface. func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) { switch m := m.(type) { + case *BoMutation: + return c.Bo.mutate(ctx, m) case *PlayerMutation: return c.Player.mutate(ctx, m) default: @@ -188,6 +198,124 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) { } } +// BoClient is a client for the Bo schema. +type BoClient struct { + config +} + +// NewBoClient returns a client for the Bo from the given config. +func NewBoClient(c config) *BoClient { + return &BoClient{config: c} +} + +// Use adds a list of mutation hooks to the hooks stack. +// A call to `Use(f, g, h)` equals to `bo.Hooks(f(g(h())))`. +func (c *BoClient) Use(hooks ...Hook) { + c.hooks.Bo = append(c.hooks.Bo, hooks...) +} + +// Intercept adds a list of query interceptors to the interceptors stack. +// A call to `Intercept(f, g, h)` equals to `bo.Intercept(f(g(h())))`. +func (c *BoClient) Intercept(interceptors ...Interceptor) { + c.inters.Bo = append(c.inters.Bo, interceptors...) +} + +// Create returns a builder for creating a Bo entity. +func (c *BoClient) Create() *BoCreate { + mutation := newBoMutation(c.config, OpCreate) + return &BoCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// CreateBulk returns a builder for creating a bulk of Bo entities. +func (c *BoClient) CreateBulk(builders ...*BoCreate) *BoCreateBulk { + return &BoCreateBulk{config: c.config, builders: builders} +} + +// Update returns an update builder for Bo. +func (c *BoClient) Update() *BoUpdate { + mutation := newBoMutation(c.config, OpUpdate) + return &BoUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOne returns an update builder for the given entity. +func (c *BoClient) UpdateOne(b *Bo) *BoUpdateOne { + mutation := newBoMutation(c.config, OpUpdateOne, withBo(b)) + return &BoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOneID returns an update builder for the given id. +func (c *BoClient) UpdateOneID(id string) *BoUpdateOne { + mutation := newBoMutation(c.config, OpUpdateOne, withBoID(id)) + return &BoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// Delete returns a delete builder for Bo. +func (c *BoClient) Delete() *BoDelete { + mutation := newBoMutation(c.config, OpDelete) + return &BoDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// DeleteOne returns a builder for deleting the given entity. +func (c *BoClient) DeleteOne(b *Bo) *BoDeleteOne { + return c.DeleteOneID(b.ID) +} + +// DeleteOneID returns a builder for deleting the given entity by its id. +func (c *BoClient) DeleteOneID(id string) *BoDeleteOne { + builder := c.Delete().Where(bo.ID(id)) + builder.mutation.id = &id + builder.mutation.op = OpDeleteOne + return &BoDeleteOne{builder} +} + +// Query returns a query builder for Bo. +func (c *BoClient) Query() *BoQuery { + return &BoQuery{ + config: c.config, + ctx: &QueryContext{Type: TypeBo}, + inters: c.Interceptors(), + } +} + +// Get returns a Bo entity by its id. +func (c *BoClient) Get(ctx context.Context, id string) (*Bo, error) { + return c.Query().Where(bo.ID(id)).Only(ctx) +} + +// GetX is like Get, but panics if an error occurs. +func (c *BoClient) GetX(ctx context.Context, id string) *Bo { + obj, err := c.Get(ctx, id) + if err != nil { + panic(err) + } + return obj +} + +// Hooks returns the client hooks. +func (c *BoClient) Hooks() []Hook { + return c.hooks.Bo +} + +// Interceptors returns the client interceptors. +func (c *BoClient) Interceptors() []Interceptor { + return c.inters.Bo +} + +func (c *BoClient) mutate(ctx context.Context, m *BoMutation) (Value, error) { + switch m.Op() { + case OpCreate: + return (&BoCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdate: + return (&BoUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdateOne: + return (&BoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpDelete, OpDeleteOne: + return (&BoDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) + default: + return nil, fmt.Errorf("ent: unknown Bo mutation op: %q", m.Op()) + } +} + // PlayerClient is a client for the Player schema. type PlayerClient struct { config @@ -309,9 +437,9 @@ func (c *PlayerClient) mutate(ctx context.Context, m *PlayerMutation) (Value, er // hooks and interceptors per client, for fast access. type ( hooks struct { - Player []ent.Hook + Bo, Player []ent.Hook } inters struct { - Player []ent.Interceptor + Bo, Player []ent.Interceptor } ) diff --git a/ent/ent.go b/ent/ent.go index b35d530..341feef 100644 --- a/ent/ent.go +++ b/ent/ent.go @@ -5,6 +5,7 @@ package ent import ( "context" "errors" + "esh2n/grapevineer/ent/bo" "esh2n/grapevineer/ent/player" "fmt" "reflect" @@ -73,6 +74,7 @@ var ( func checkColumn(table, column string) error { initCheck.Do(func() { columnCheck = sql.NewColumnCheck(map[string]func(string) bool{ + bo.Table: bo.ValidColumn, player.Table: player.ValidColumn, }) }) diff --git a/ent/hook/hook.go b/ent/hook/hook.go index c959b10..00c4a4b 100644 --- a/ent/hook/hook.go +++ b/ent/hook/hook.go @@ -8,6 +8,18 @@ import ( "fmt" ) +// The BoFunc type is an adapter to allow the use of ordinary +// function as Bo mutator. +type BoFunc func(context.Context, *ent.BoMutation) (ent.Value, error) + +// Mutate calls f(ctx, m). +func (f BoFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { + if mv, ok := m.(*ent.BoMutation); ok { + return f(ctx, mv) + } + return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.BoMutation", m) +} + // The PlayerFunc type is an adapter to allow the use of ordinary // function as Player mutator. type PlayerFunc func(context.Context, *ent.PlayerMutation) (ent.Value, error) diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index dcd4af8..3fe4415 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -8,6 +8,17 @@ import ( ) var ( + // BosColumns holds the columns for the "bos" table. + BosColumns = []*schema.Column{ + {Name: "id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "uuid"}}, + {Name: "script", Type: field.TypeString}, + } + // BosTable holds the schema information for the "bos" table. + BosTable = &schema.Table{ + Name: "bos", + Columns: BosColumns, + PrimaryKey: []*schema.Column{BosColumns[0]}, + } // PlayersColumns holds the columns for the "players" table. PlayersColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "uuid"}}, @@ -23,6 +34,7 @@ var ( } // Tables holds all the tables in the schema. Tables = []*schema.Table{ + BosTable, PlayersTable, } ) diff --git a/ent/mutation.go b/ent/mutation.go index 4251eb9..140010a 100644 --- a/ent/mutation.go +++ b/ent/mutation.go @@ -5,6 +5,7 @@ package ent import ( "context" "errors" + "esh2n/grapevineer/ent/bo" "esh2n/grapevineer/ent/player" "esh2n/grapevineer/ent/predicate" "fmt" @@ -23,9 +24,342 @@ const ( OpUpdateOne = ent.OpUpdateOne // Node types. + TypeBo = "Bo" TypePlayer = "Player" ) +// BoMutation represents an operation that mutates the Bo nodes in the graph. +type BoMutation struct { + config + op Op + typ string + id *string + script *string + clearedFields map[string]struct{} + done bool + oldValue func(context.Context) (*Bo, error) + predicates []predicate.Bo +} + +var _ ent.Mutation = (*BoMutation)(nil) + +// boOption allows management of the mutation configuration using functional options. +type boOption func(*BoMutation) + +// newBoMutation creates new mutation for the Bo entity. +func newBoMutation(c config, op Op, opts ...boOption) *BoMutation { + m := &BoMutation{ + config: c, + op: op, + typ: TypeBo, + clearedFields: make(map[string]struct{}), + } + for _, opt := range opts { + opt(m) + } + return m +} + +// withBoID sets the ID field of the mutation. +func withBoID(id string) boOption { + return func(m *BoMutation) { + var ( + err error + once sync.Once + value *Bo + ) + m.oldValue = func(ctx context.Context) (*Bo, error) { + once.Do(func() { + if m.done { + err = errors.New("querying old values post mutation is not allowed") + } else { + value, err = m.Client().Bo.Get(ctx, id) + } + }) + return value, err + } + m.id = &id + } +} + +// withBo sets the old Bo of the mutation. +func withBo(node *Bo) boOption { + return func(m *BoMutation) { + m.oldValue = func(context.Context) (*Bo, error) { + return node, nil + } + m.id = &node.ID + } +} + +// Client returns a new `ent.Client` from the mutation. If the mutation was +// executed in a transaction (ent.Tx), a transactional client is returned. +func (m BoMutation) Client() *Client { + client := &Client{config: m.config} + client.init() + return client +} + +// Tx returns an `ent.Tx` for mutations that were executed in transactions; +// it returns an error otherwise. +func (m BoMutation) Tx() (*Tx, error) { + if _, ok := m.driver.(*txDriver); !ok { + return nil, errors.New("ent: mutation is not running in a transaction") + } + tx := &Tx{config: m.config} + tx.init() + return tx, nil +} + +// SetID sets the value of the id field. Note that this +// operation is only accepted on creation of Bo entities. +func (m *BoMutation) SetID(id string) { + m.id = &id +} + +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. +func (m *BoMutation) ID() (id string, exists bool) { + if m.id == nil { + return + } + return *m.id, true +} + +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *BoMutation) IDs(ctx context.Context) ([]string, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []string{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().Bo.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + +// SetScript sets the "script" field. +func (m *BoMutation) SetScript(s string) { + m.script = &s +} + +// Script returns the value of the "script" field in the mutation. +func (m *BoMutation) Script() (r string, exists bool) { + v := m.script + if v == nil { + return + } + return *v, true +} + +// OldScript returns the old "script" field's value of the Bo entity. +// If the Bo object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BoMutation) OldScript(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldScript is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldScript requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldScript: %w", err) + } + return oldValue.Script, nil +} + +// ResetScript resets all changes to the "script" field. +func (m *BoMutation) ResetScript() { + m.script = nil +} + +// Where appends a list predicates to the BoMutation builder. +func (m *BoMutation) Where(ps ...predicate.Bo) { + m.predicates = append(m.predicates, ps...) +} + +// WhereP appends storage-level predicates to the BoMutation builder. Using this method, +// users can use type-assertion to append predicates that do not depend on any generated package. +func (m *BoMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.Bo, len(ps)) + for i := range ps { + p[i] = ps[i] + } + m.Where(p...) +} + +// Op returns the operation name. +func (m *BoMutation) Op() Op { + return m.op +} + +// SetOp allows setting the mutation operation. +func (m *BoMutation) SetOp(op Op) { + m.op = op +} + +// Type returns the node type of this mutation (Bo). +func (m *BoMutation) Type() string { + return m.typ +} + +// Fields returns all fields that were changed during this mutation. Note that in +// order to get all numeric fields that were incremented/decremented, call +// AddedFields(). +func (m *BoMutation) Fields() []string { + fields := make([]string, 0, 1) + if m.script != nil { + fields = append(fields, bo.FieldScript) + } + return fields +} + +// Field returns the value of a field with the given name. The second boolean +// return value indicates that this field was not set, or was not defined in the +// schema. +func (m *BoMutation) Field(name string) (ent.Value, bool) { + switch name { + case bo.FieldScript: + return m.Script() + } + return nil, false +} + +// OldField returns the old value of the field from the database. An error is +// returned if the mutation operation is not UpdateOne, or the query to the +// database failed. +func (m *BoMutation) OldField(ctx context.Context, name string) (ent.Value, error) { + switch name { + case bo.FieldScript: + return m.OldScript(ctx) + } + return nil, fmt.Errorf("unknown Bo field %s", name) +} + +// SetField sets the value of a field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *BoMutation) SetField(name string, value ent.Value) error { + switch name { + case bo.FieldScript: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetScript(v) + return nil + } + return fmt.Errorf("unknown Bo field %s", name) +} + +// AddedFields returns all numeric fields that were incremented/decremented during +// this mutation. +func (m *BoMutation) AddedFields() []string { + return nil +} + +// AddedField returns the numeric value that was incremented/decremented on a field +// with the given name. The second boolean return value indicates that this field +// was not set, or was not defined in the schema. +func (m *BoMutation) AddedField(name string) (ent.Value, bool) { + return nil, false +} + +// AddField adds the value to the field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *BoMutation) AddField(name string, value ent.Value) error { + switch name { + } + return fmt.Errorf("unknown Bo numeric field %s", name) +} + +// ClearedFields returns all nullable fields that were cleared during this +// mutation. +func (m *BoMutation) ClearedFields() []string { + return nil +} + +// FieldCleared returns a boolean indicating if a field with the given name was +// cleared in this mutation. +func (m *BoMutation) FieldCleared(name string) bool { + _, ok := m.clearedFields[name] + return ok +} + +// ClearField clears the value of the field with the given name. It returns an +// error if the field is not defined in the schema. +func (m *BoMutation) ClearField(name string) error { + return fmt.Errorf("unknown Bo nullable field %s", name) +} + +// ResetField resets all changes in the mutation for the field with the given name. +// It returns an error if the field is not defined in the schema. +func (m *BoMutation) ResetField(name string) error { + switch name { + case bo.FieldScript: + m.ResetScript() + return nil + } + return fmt.Errorf("unknown Bo field %s", name) +} + +// AddedEdges returns all edge names that were set/added in this mutation. +func (m *BoMutation) AddedEdges() []string { + edges := make([]string, 0, 0) + return edges +} + +// AddedIDs returns all IDs (to other nodes) that were added for the given edge +// name in this mutation. +func (m *BoMutation) AddedIDs(name string) []ent.Value { + return nil +} + +// RemovedEdges returns all edge names that were removed in this mutation. +func (m *BoMutation) RemovedEdges() []string { + edges := make([]string, 0, 0) + return edges +} + +// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with +// the given name in this mutation. +func (m *BoMutation) RemovedIDs(name string) []ent.Value { + return nil +} + +// ClearedEdges returns all edge names that were cleared in this mutation. +func (m *BoMutation) ClearedEdges() []string { + edges := make([]string, 0, 0) + return edges +} + +// EdgeCleared returns a boolean which indicates if the edge with the given name +// was cleared in this mutation. +func (m *BoMutation) EdgeCleared(name string) bool { + return false +} + +// ClearEdge clears the value of the edge with the given name. It returns an error +// if that edge is not defined in the schema. +func (m *BoMutation) ClearEdge(name string) error { + return fmt.Errorf("unknown Bo unique edge %s", name) +} + +// ResetEdge resets all changes to the edge with the given name in this mutation. +// It returns an error if the edge is not defined in the schema. +func (m *BoMutation) ResetEdge(name string) error { + return fmt.Errorf("unknown Bo edge %s", name) +} + // PlayerMutation represents an operation that mutates the Player nodes in the graph. type PlayerMutation struct { config diff --git a/ent/predicate/predicate.go b/ent/predicate/predicate.go index a10d2cb..1c7a3c2 100644 --- a/ent/predicate/predicate.go +++ b/ent/predicate/predicate.go @@ -6,5 +6,8 @@ import ( "entgo.io/ent/dialect/sql" ) +// Bo is the predicate function for bo builders. +type Bo func(*sql.Selector) + // Player is the predicate function for player builders. type Player func(*sql.Selector) diff --git a/ent/runtime.go b/ent/runtime.go index d2bab7b..8eae2b1 100644 --- a/ent/runtime.go +++ b/ent/runtime.go @@ -3,6 +3,7 @@ package ent import ( + "esh2n/grapevineer/ent/bo" "esh2n/grapevineer/ent/player" "esh2n/grapevineer/ent/schema" ) @@ -11,6 +12,12 @@ import ( // (default values, validators, hooks and policies) and stitches it // to their package variables. func init() { + boFields := schema.Bo{}.Fields() + _ = boFields + // boDescScript is the schema descriptor for script field. + boDescScript := boFields[1].Descriptor() + // bo.ScriptValidator is a validator for the "script" field. It is called by the builders before save. + bo.ScriptValidator = boDescScript.Validators[0].(func(string) error) playerFields := schema.Player{}.Fields() _ = playerFields // playerDescPlayerID is the schema descriptor for player_id field. diff --git a/ent/schema/bo.go b/ent/schema/bo.go new file mode 100644 index 0000000..bba1084 --- /dev/null +++ b/ent/schema/bo.go @@ -0,0 +1,28 @@ +package schema + +import ( + "entgo.io/ent" + "entgo.io/ent/dialect" + "entgo.io/ent/schema/field" +) + +// Bo holds the schema definition for the Bo entity. +type Bo struct { + ent.Schema +} + +// Fields of the Bo. +func (Bo) Fields() []ent.Field { + return []ent.Field{ + field.String("id"). + SchemaType(map[string]string{ + dialect.Postgres: "uuid", + }), + field.String("script").NotEmpty(), + } +} + +// Edges of the Bo. +func (Bo) Edges() []ent.Edge { + return nil +} diff --git a/ent/tx.go b/ent/tx.go index 7c5f9ca..f290ef9 100644 --- a/ent/tx.go +++ b/ent/tx.go @@ -12,6 +12,8 @@ import ( // Tx is a transactional client that is created by calling Client.Tx(). type Tx struct { config + // Bo is the client for interacting with the Bo builders. + Bo *BoClient // Player is the client for interacting with the Player builders. Player *PlayerClient @@ -145,6 +147,7 @@ func (tx *Tx) Client() *Client { } func (tx *Tx) init() { + tx.Bo = NewBoClient(tx.config) tx.Player = NewPlayerClient(tx.config) } @@ -155,7 +158,7 @@ func (tx *Tx) init() { // of them in order to commit or rollback the transaction. // // If a closed transaction is embedded in one of the generated entities, and the entity -// applies a query, for example: Player.QueryXXX(), the query will be executed +// applies a query, for example: Bo.QueryXXX(), the query will be executed // through the driver which created this transaction. // // Note that txDriver is not goroutine safe. diff --git a/gen/dart/v1/bo.pb.dart b/gen/dart/v1/bo.pb.dart new file mode 100644 index 0000000..c74ce79 --- /dev/null +++ b/gen/dart/v1/bo.pb.dart @@ -0,0 +1,195 @@ +/// +// Generated code. Do not modify. +// source: v1/bo.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,constant_identifier_names,directives_ordering,library_prefixes,non_constant_identifier_names,prefer_final_fields,return_of_invalid_type,unnecessary_const,unnecessary_import,unnecessary_this,unused_import,unused_shown_name + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class SetBoScriptRequest extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SetBoScriptRequest', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'script') + ..hasRequiredFields = false + ; + + SetBoScriptRequest._() : super(); + factory SetBoScriptRequest({ + $core.String? script, + }) { + final _result = create(); + if (script != null) { + _result.script = script; + } + return _result; + } + factory SetBoScriptRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory SetBoScriptRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + SetBoScriptRequest clone() => SetBoScriptRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + SetBoScriptRequest copyWith(void Function(SetBoScriptRequest) updates) => super.copyWith((message) => updates(message as SetBoScriptRequest)) as SetBoScriptRequest; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static SetBoScriptRequest create() => SetBoScriptRequest._(); + SetBoScriptRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static SetBoScriptRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static SetBoScriptRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get script => $_getSZ(0); + @$pb.TagNumber(1) + set script($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasScript() => $_has(0); + @$pb.TagNumber(1) + void clearScript() => clearField(1); +} + +class SetBoScriptResponse extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SetBoScriptResponse', createEmptyInstance: create) + ..a<$core.int>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'status', $pb.PbFieldType.O3) + ..hasRequiredFields = false + ; + + SetBoScriptResponse._() : super(); + factory SetBoScriptResponse({ + $core.int? status, + }) { + final _result = create(); + if (status != null) { + _result.status = status; + } + return _result; + } + factory SetBoScriptResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory SetBoScriptResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + SetBoScriptResponse clone() => SetBoScriptResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + SetBoScriptResponse copyWith(void Function(SetBoScriptResponse) updates) => super.copyWith((message) => updates(message as SetBoScriptResponse)) as SetBoScriptResponse; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static SetBoScriptResponse create() => SetBoScriptResponse._(); + SetBoScriptResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static SetBoScriptResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static SetBoScriptResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.int get status => $_getIZ(0); + @$pb.TagNumber(1) + set status($core.int v) { $_setSignedInt32(0, v); } + @$pb.TagNumber(1) + $core.bool hasStatus() => $_has(0); + @$pb.TagNumber(1) + void clearStatus() => clearField(1); +} + +class GetBoScriptRandomlyRequest extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GetBoScriptRandomlyRequest', createEmptyInstance: create) + ..hasRequiredFields = false + ; + + GetBoScriptRandomlyRequest._() : super(); + factory GetBoScriptRandomlyRequest() => create(); + factory GetBoScriptRandomlyRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetBoScriptRandomlyRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetBoScriptRandomlyRequest clone() => GetBoScriptRandomlyRequest()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetBoScriptRandomlyRequest copyWith(void Function(GetBoScriptRandomlyRequest) updates) => super.copyWith((message) => updates(message as GetBoScriptRandomlyRequest)) as GetBoScriptRandomlyRequest; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static GetBoScriptRandomlyRequest create() => GetBoScriptRandomlyRequest._(); + GetBoScriptRandomlyRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetBoScriptRandomlyRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetBoScriptRandomlyRequest? _defaultInstance; +} + +class GetBoScriptRandomlyResponse extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GetBoScriptRandomlyResponse', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'boId') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'script') + ..hasRequiredFields = false + ; + + GetBoScriptRandomlyResponse._() : super(); + factory GetBoScriptRandomlyResponse({ + $core.String? boId, + $core.String? script, + }) { + final _result = create(); + if (boId != null) { + _result.boId = boId; + } + if (script != null) { + _result.script = script; + } + return _result; + } + factory GetBoScriptRandomlyResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GetBoScriptRandomlyResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetBoScriptRandomlyResponse clone() => GetBoScriptRandomlyResponse()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetBoScriptRandomlyResponse copyWith(void Function(GetBoScriptRandomlyResponse) updates) => super.copyWith((message) => updates(message as GetBoScriptRandomlyResponse)) as GetBoScriptRandomlyResponse; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static GetBoScriptRandomlyResponse create() => GetBoScriptRandomlyResponse._(); + GetBoScriptRandomlyResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetBoScriptRandomlyResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GetBoScriptRandomlyResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get boId => $_getSZ(0); + @$pb.TagNumber(1) + set boId($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasBoId() => $_has(0); + @$pb.TagNumber(1) + void clearBoId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get script => $_getSZ(1); + @$pb.TagNumber(2) + set script($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasScript() => $_has(1); + @$pb.TagNumber(2) + void clearScript() => clearField(2); +} + diff --git a/gen/dart/v1/bo.pbenum.dart b/gen/dart/v1/bo.pbenum.dart new file mode 100644 index 0000000..0eb0507 --- /dev/null +++ b/gen/dart/v1/bo.pbenum.dart @@ -0,0 +1,7 @@ +/// +// Generated code. Do not modify. +// source: v1/bo.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,constant_identifier_names,directives_ordering,library_prefixes,non_constant_identifier_names,prefer_final_fields,return_of_invalid_type,unnecessary_const,unnecessary_import,unnecessary_this,unused_import,unused_shown_name + diff --git a/gen/dart/v1/bo.pbjson.dart b/gen/dart/v1/bo.pbjson.dart new file mode 100644 index 0000000..d4add22 --- /dev/null +++ b/gen/dart/v1/bo.pbjson.dart @@ -0,0 +1,48 @@ +/// +// Generated code. Do not modify. +// source: v1/bo.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,constant_identifier_names,deprecated_member_use_from_same_package,directives_ordering,library_prefixes,non_constant_identifier_names,prefer_final_fields,return_of_invalid_type,unnecessary_const,unnecessary_import,unnecessary_this,unused_import,unused_shown_name + +import 'dart:core' as $core; +import 'dart:convert' as $convert; +import 'dart:typed_data' as $typed_data; +@$core.Deprecated('Use setBoScriptRequestDescriptor instead') +const SetBoScriptRequest$json = const { + '1': 'SetBoScriptRequest', + '2': const [ + const {'1': 'script', '3': 1, '4': 1, '5': 9, '10': 'script'}, + ], +}; + +/// Descriptor for `SetBoScriptRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List setBoScriptRequestDescriptor = $convert.base64Decode('ChJTZXRCb1NjcmlwdFJlcXVlc3QSFgoGc2NyaXB0GAEgASgJUgZzY3JpcHQ='); +@$core.Deprecated('Use setBoScriptResponseDescriptor instead') +const SetBoScriptResponse$json = const { + '1': 'SetBoScriptResponse', + '2': const [ + const {'1': 'status', '3': 1, '4': 1, '5': 5, '10': 'status'}, + ], +}; + +/// Descriptor for `SetBoScriptResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List setBoScriptResponseDescriptor = $convert.base64Decode('ChNTZXRCb1NjcmlwdFJlc3BvbnNlEhYKBnN0YXR1cxgBIAEoBVIGc3RhdHVz'); +@$core.Deprecated('Use getBoScriptRandomlyRequestDescriptor instead') +const GetBoScriptRandomlyRequest$json = const { + '1': 'GetBoScriptRandomlyRequest', +}; + +/// Descriptor for `GetBoScriptRandomlyRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getBoScriptRandomlyRequestDescriptor = $convert.base64Decode('ChpHZXRCb1NjcmlwdFJhbmRvbWx5UmVxdWVzdA=='); +@$core.Deprecated('Use getBoScriptRandomlyResponseDescriptor instead') +const GetBoScriptRandomlyResponse$json = const { + '1': 'GetBoScriptRandomlyResponse', + '2': const [ + const {'1': 'bo_id', '3': 1, '4': 1, '5': 9, '10': 'boId'}, + const {'1': 'script', '3': 2, '4': 1, '5': 9, '10': 'script'}, + ], +}; + +/// Descriptor for `GetBoScriptRandomlyResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getBoScriptRandomlyResponseDescriptor = $convert.base64Decode('ChtHZXRCb1NjcmlwdFJhbmRvbWx5UmVzcG9uc2USEwoFYm9faWQYASABKAlSBGJvSWQSFgoGc2NyaXB0GAIgASgJUgZzY3JpcHQ='); diff --git a/gen/dart/v1/grapevineer.pbgrpc.dart b/gen/dart/v1/grapevineer.pbgrpc.dart index 9a999d6..74edb93 100644 --- a/gen/dart/v1/grapevineer.pbgrpc.dart +++ b/gen/dart/v1/grapevineer.pbgrpc.dart @@ -16,6 +16,7 @@ import 'line.pb.dart' as $2; import 'openai.pb.dart' as $3; import 'player.pb.dart' as $4; import 'voicevox.pb.dart' as $5; +import 'bo.pb.dart' as $6; export 'grapevineer.pb.dart'; class GrapevineerClient extends $grpc.Client { @@ -73,6 +74,18 @@ class GrapevineerClient extends $grpc.Client { ($5.GetWavFromTextRequest value) => value.writeToBuffer(), ($core.List<$core.int> value) => $5.GetWavFromTextResponse.fromBuffer(value)); + static final _$setBoScript = + $grpc.ClientMethod<$6.SetBoScriptRequest, $6.SetBoScriptResponse>( + '/grapevineer.Grapevineer/SetBoScript', + ($6.SetBoScriptRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => + $6.SetBoScriptResponse.fromBuffer(value)); + static final _$getBoScriptRandomly = $grpc.ClientMethod< + $6.GetBoScriptRandomlyRequest, $6.GetBoScriptRandomlyResponse>( + '/grapevineer.Grapevineer/GetBoScriptRandomly', + ($6.GetBoScriptRandomlyRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => + $6.GetBoScriptRandomlyResponse.fromBuffer(value)); GrapevineerClient($grpc.ClientChannel channel, {$grpc.CallOptions? options, @@ -133,6 +146,18 @@ class GrapevineerClient extends $grpc.Client { {$grpc.CallOptions? options}) { return $createUnaryCall(_$getWavFromText, request, options: options); } + + $grpc.ResponseFuture<$6.SetBoScriptResponse> setBoScript( + $6.SetBoScriptRequest request, + {$grpc.CallOptions? options}) { + return $createUnaryCall(_$setBoScript, request, options: options); + } + + $grpc.ResponseFuture<$6.GetBoScriptRandomlyResponse> getBoScriptRandomly( + $6.GetBoScriptRandomlyRequest request, + {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getBoScriptRandomly, request, options: options); + } } abstract class GrapevineerServiceBase extends $grpc.Service { @@ -216,6 +241,24 @@ abstract class GrapevineerServiceBase extends $grpc.Service { ($core.List<$core.int> value) => $5.GetWavFromTextRequest.fromBuffer(value), ($5.GetWavFromTextResponse value) => value.writeToBuffer())); + $addMethod( + $grpc.ServiceMethod<$6.SetBoScriptRequest, $6.SetBoScriptResponse>( + 'SetBoScript', + setBoScript_Pre, + false, + false, + ($core.List<$core.int> value) => + $6.SetBoScriptRequest.fromBuffer(value), + ($6.SetBoScriptResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$6.GetBoScriptRandomlyRequest, + $6.GetBoScriptRandomlyResponse>( + 'GetBoScriptRandomly', + getBoScriptRandomly_Pre, + false, + false, + ($core.List<$core.int> value) => + $6.GetBoScriptRandomlyRequest.fromBuffer(value), + ($6.GetBoScriptRandomlyResponse value) => value.writeToBuffer())); } $async.Future<$0.GetOGImageResponse> getOGImage_Pre($grpc.ServiceCall call, @@ -270,6 +313,17 @@ abstract class GrapevineerServiceBase extends $grpc.Service { return getWavFromText(call, await request); } + $async.Future<$6.SetBoScriptResponse> setBoScript_Pre($grpc.ServiceCall call, + $async.Future<$6.SetBoScriptRequest> request) async { + return setBoScript(call, await request); + } + + $async.Future<$6.GetBoScriptRandomlyResponse> getBoScriptRandomly_Pre( + $grpc.ServiceCall call, + $async.Future<$6.GetBoScriptRandomlyRequest> request) async { + return getBoScriptRandomly(call, await request); + } + $async.Future<$0.GetOGImageResponse> getOGImage( $grpc.ServiceCall call, $0.GetOGImageRequest request); $async.Future<$1.GetFlowerMeaningByDateResponse> getFlowerMeaningByDate( @@ -288,4 +342,8 @@ abstract class GrapevineerServiceBase extends $grpc.Service { $grpc.ServiceCall call, $4.GetPlayerInfoRequest request); $async.Future<$5.GetWavFromTextResponse> getWavFromText( $grpc.ServiceCall call, $5.GetWavFromTextRequest request); + $async.Future<$6.SetBoScriptResponse> setBoScript( + $grpc.ServiceCall call, $6.SetBoScriptRequest request); + $async.Future<$6.GetBoScriptRandomlyResponse> getBoScriptRandomly( + $grpc.ServiceCall call, $6.GetBoScriptRandomlyRequest request); } diff --git a/gen/go/v1/bo.pb.go b/gen/go/v1/bo.pb.go new file mode 100644 index 0000000..8ce2c36 --- /dev/null +++ b/gen/go/v1/bo.pb.go @@ -0,0 +1,332 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.20.3 +// source: v1/bo.proto + +package grapevineer + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SetBoScriptRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Script string `protobuf:"bytes,1,opt,name=script,proto3" json:"script,omitempty"` +} + +func (x *SetBoScriptRequest) Reset() { + *x = SetBoScriptRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_bo_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetBoScriptRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetBoScriptRequest) ProtoMessage() {} + +func (x *SetBoScriptRequest) ProtoReflect() protoreflect.Message { + mi := &file_v1_bo_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetBoScriptRequest.ProtoReflect.Descriptor instead. +func (*SetBoScriptRequest) Descriptor() ([]byte, []int) { + return file_v1_bo_proto_rawDescGZIP(), []int{0} +} + +func (x *SetBoScriptRequest) GetScript() string { + if x != nil { + return x.Script + } + return "" +} + +type SetBoScriptResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` +} + +func (x *SetBoScriptResponse) Reset() { + *x = SetBoScriptResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_bo_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetBoScriptResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetBoScriptResponse) ProtoMessage() {} + +func (x *SetBoScriptResponse) ProtoReflect() protoreflect.Message { + mi := &file_v1_bo_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetBoScriptResponse.ProtoReflect.Descriptor instead. +func (*SetBoScriptResponse) Descriptor() ([]byte, []int) { + return file_v1_bo_proto_rawDescGZIP(), []int{1} +} + +func (x *SetBoScriptResponse) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +type GetBoScriptRandomlyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetBoScriptRandomlyRequest) Reset() { + *x = GetBoScriptRandomlyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_bo_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetBoScriptRandomlyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBoScriptRandomlyRequest) ProtoMessage() {} + +func (x *GetBoScriptRandomlyRequest) ProtoReflect() protoreflect.Message { + mi := &file_v1_bo_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBoScriptRandomlyRequest.ProtoReflect.Descriptor instead. +func (*GetBoScriptRandomlyRequest) Descriptor() ([]byte, []int) { + return file_v1_bo_proto_rawDescGZIP(), []int{2} +} + +type GetBoScriptRandomlyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BoId string `protobuf:"bytes,1,opt,name=bo_id,json=boId,proto3" json:"bo_id,omitempty"` + Script string `protobuf:"bytes,2,opt,name=script,proto3" json:"script,omitempty"` +} + +func (x *GetBoScriptRandomlyResponse) Reset() { + *x = GetBoScriptRandomlyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_bo_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetBoScriptRandomlyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBoScriptRandomlyResponse) ProtoMessage() {} + +func (x *GetBoScriptRandomlyResponse) ProtoReflect() protoreflect.Message { + mi := &file_v1_bo_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBoScriptRandomlyResponse.ProtoReflect.Descriptor instead. +func (*GetBoScriptRandomlyResponse) Descriptor() ([]byte, []int) { + return file_v1_bo_proto_rawDescGZIP(), []int{3} +} + +func (x *GetBoScriptRandomlyResponse) GetBoId() string { + if x != nil { + return x.BoId + } + return "" +} + +func (x *GetBoScriptRandomlyResponse) GetScript() string { + if x != nil { + return x.Script + } + return "" +} + +var File_v1_bo_proto protoreflect.FileDescriptor + +var file_v1_bo_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x76, 0x31, 0x2f, 0x62, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, + 0x12, 0x53, 0x65, 0x74, 0x42, 0x6f, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x22, 0x2d, 0x0a, 0x13, 0x53, + 0x65, 0x74, 0x42, 0x6f, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x1c, 0x0a, 0x1a, 0x47, 0x65, + 0x74, 0x42, 0x6f, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x6c, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x4a, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x42, + 0x6f, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x6c, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x13, 0x0a, 0x05, 0x62, 0x6f, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x6f, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x65, 0x73, 0x68, 0x32, 0x6e, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x65, 0x76, 0x69, + 0x6e, 0x65, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x72, 0x61, 0x70, + 0x65, 0x76, 0x69, 0x6e, 0x65, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_v1_bo_proto_rawDescOnce sync.Once + file_v1_bo_proto_rawDescData = file_v1_bo_proto_rawDesc +) + +func file_v1_bo_proto_rawDescGZIP() []byte { + file_v1_bo_proto_rawDescOnce.Do(func() { + file_v1_bo_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_bo_proto_rawDescData) + }) + return file_v1_bo_proto_rawDescData +} + +var file_v1_bo_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_v1_bo_proto_goTypes = []interface{}{ + (*SetBoScriptRequest)(nil), // 0: SetBoScriptRequest + (*SetBoScriptResponse)(nil), // 1: SetBoScriptResponse + (*GetBoScriptRandomlyRequest)(nil), // 2: GetBoScriptRandomlyRequest + (*GetBoScriptRandomlyResponse)(nil), // 3: GetBoScriptRandomlyResponse +} +var file_v1_bo_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_v1_bo_proto_init() } +func file_v1_bo_proto_init() { + if File_v1_bo_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v1_bo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetBoScriptRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_bo_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetBoScriptResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_bo_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetBoScriptRandomlyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_bo_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetBoScriptRandomlyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v1_bo_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_v1_bo_proto_goTypes, + DependencyIndexes: file_v1_bo_proto_depIdxs, + MessageInfos: file_v1_bo_proto_msgTypes, + }.Build() + File_v1_bo_proto = out.File + file_v1_bo_proto_rawDesc = nil + file_v1_bo_proto_goTypes = nil + file_v1_bo_proto_depIdxs = nil +} diff --git a/gen/go/v1/flower_meaning.pb.go b/gen/go/v1/flower_meaning.pb.go index 31e9bb2..3baf158 100644 --- a/gen/go/v1/flower_meaning.pb.go +++ b/gen/go/v1/flower_meaning.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.21.12 +// protoc v3.20.3 // source: v1/flower_meaning.proto package grapevineer diff --git a/gen/go/v1/grapevineer.pb.go b/gen/go/v1/grapevineer.pb.go index c4df0d1..65a0d57 100644 --- a/gen/go/v1/grapevineer.pb.go +++ b/gen/go/v1/grapevineer.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.21.12 +// protoc v3.20.3 // source: v1/grapevineer.proto package grapevineer @@ -27,70 +27,82 @@ var file_v1_grapevineer_proto_rawDesc = []byte{ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x67, 0x72, 0x61, 0x70, 0x65, 0x76, 0x69, 0x6e, 0x65, 0x65, 0x72, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x0f, 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x11, 0x76, 0x31, 0x2f, 0x6f, 0x67, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x31, 0x2f, 0x66, 0x6c, 0x6f, 0x77, 0x65, 0x72, - 0x5f, 0x6d, 0x65, 0x61, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, - 0x76, 0x31, 0x2f, 0x6c, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x76, - 0x31, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, - 0x76, 0x31, 0x2f, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x76, 0x6f, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x32, 0xc5, 0x06, 0x0a, 0x0b, 0x47, 0x72, 0x61, 0x70, 0x65, 0x76, 0x69, 0x6e, 0x65, 0x65, - 0x72, 0x12, 0x4b, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x4f, 0x47, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, - 0x12, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x47, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x47, 0x49, 0x6d, 0x61, 0x67, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, - 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x67, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x7c, - 0x0a, 0x16, 0x47, 0x65, 0x74, 0x46, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x4d, 0x65, 0x61, 0x6e, 0x69, - 0x6e, 0x67, 0x42, 0x79, 0x44, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x6c, - 0x6f, 0x77, 0x65, 0x72, 0x4d, 0x65, 0x61, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x79, 0x44, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x6c, - 0x6f, 0x77, 0x65, 0x72, 0x4d, 0x65, 0x61, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x79, 0x44, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x1b, 0x12, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x6d, 0x65, - 0x61, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x64, 0x61, 0x74, 0x65, 0x7d, 0x12, 0x5e, 0x0a, 0x0f, - 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, - 0x17, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, - 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, - 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x66, 0x0a, 0x11, - 0x53, 0x65, 0x6e, 0x64, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x49, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x12, 0x19, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x49, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x53, - 0x65, 0x6e, 0x64, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x49, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, - 0x12, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x69, 0x5f, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x46, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x12, 0x11, 0x2e, 0x53, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x53, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, - 0x22, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x53, 0x0a, 0x0d, - 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x15, 0x2e, - 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x13, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x0d, 0x12, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x73, 0x12, 0x4f, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x12, 0x14, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x1a, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x12, 0x57, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x15, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x47, 0x65, 0x74, - 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x76, 0x31, 0x2f, - 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x5c, 0x0a, 0x0e, 0x47, - 0x65, 0x74, 0x57, 0x61, 0x76, 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x65, 0x78, 0x74, 0x12, 0x16, 0x2e, - 0x47, 0x65, 0x74, 0x57, 0x61, 0x76, 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x65, 0x78, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x61, 0x76, 0x46, 0x72, - 0x6f, 0x6d, 0x54, 0x65, 0x78, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x61, 0x76, 0x5f, - 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x73, 0x68, 0x32, 0x6e, 0x2f, 0x67, 0x72, - 0x61, 0x70, 0x65, 0x76, 0x69, 0x6e, 0x65, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, - 0x2f, 0x67, 0x72, 0x61, 0x70, 0x65, 0x76, 0x69, 0x6e, 0x65, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x1a, 0x0b, 0x76, 0x31, 0x2f, 0x62, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, + 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x11, 0x76, 0x31, 0x2f, 0x6f, 0x67, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x31, 0x2f, 0x66, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x6d, 0x65, + 0x61, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, 0x76, 0x31, 0x2f, + 0x6c, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x76, 0x31, 0x2f, 0x6f, + 0x70, 0x65, 0x6e, 0x61, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x76, 0x31, 0x2f, + 0x76, 0x6f, 0x69, 0x63, 0x65, 0x76, 0x6f, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xff, + 0x07, 0x0a, 0x0b, 0x47, 0x72, 0x61, 0x70, 0x65, 0x76, 0x69, 0x6e, 0x65, 0x65, 0x72, 0x12, 0x4b, + 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x4f, 0x47, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x12, 0x2e, 0x47, + 0x65, 0x74, 0x4f, 0x47, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x47, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, + 0x76, 0x31, 0x2f, 0x6f, 0x67, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x7c, 0x0a, 0x16, 0x47, + 0x65, 0x74, 0x46, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x4d, 0x65, 0x61, 0x6e, 0x69, 0x6e, 0x67, 0x42, + 0x79, 0x44, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x6c, 0x6f, 0x77, 0x65, + 0x72, 0x4d, 0x65, 0x61, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x79, 0x44, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x6c, 0x6f, 0x77, 0x65, + 0x72, 0x4d, 0x65, 0x61, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x79, 0x44, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, + 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x61, 0x6e, 0x69, + 0x6e, 0x67, 0x2f, 0x7b, 0x64, 0x61, 0x74, 0x65, 0x7d, 0x12, 0x5e, 0x0a, 0x0f, 0x53, 0x65, 0x6e, + 0x64, 0x4c, 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x2e, 0x53, + 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x6e, 0x65, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x69, 0x6e, + 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x66, 0x0a, 0x11, 0x53, 0x65, 0x6e, + 0x64, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x49, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x19, + 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x49, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x53, 0x65, 0x6e, 0x64, + 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x49, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, + 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x69, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x46, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x11, + 0x2e, 0x53, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x12, 0x2e, 0x53, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x22, 0x0a, 0x2f, + 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x53, 0x0a, 0x0d, 0x47, 0x65, 0x74, + 0x41, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x15, 0x2e, 0x47, 0x65, 0x74, + 0x41, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x0d, 0x12, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x4f, + 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x14, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x0c, 0x1a, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, + 0x57, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x15, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x5c, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x57, + 0x61, 0x76, 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x65, 0x78, 0x74, 0x12, 0x16, 0x2e, 0x47, 0x65, 0x74, + 0x57, 0x61, 0x76, 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x65, 0x78, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x61, 0x76, 0x46, 0x72, 0x6f, 0x6d, 0x54, + 0x65, 0x78, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x61, 0x76, 0x5f, 0x66, 0x72, 0x6f, + 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x12, 0x4f, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x42, 0x6f, 0x53, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x13, 0x2e, 0x53, 0x65, 0x74, 0x42, 0x6f, 0x53, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x53, 0x65, 0x74, + 0x42, 0x6f, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x22, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x6f, + 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x67, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x42, 0x6f, + 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x6c, 0x79, 0x12, 0x1b, + 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x61, 0x6e, 0x64, + 0x6f, 0x6d, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x47, 0x65, + 0x74, 0x42, 0x6f, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x6c, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x0f, 0x12, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x6f, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, + 0x73, 0x68, 0x32, 0x6e, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x65, 0x76, 0x69, 0x6e, 0x65, 0x65, 0x72, + 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x65, 0x76, 0x69, 0x6e, + 0x65, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_v1_grapevineer_proto_goTypes = []interface{}{ @@ -103,15 +115,19 @@ var file_v1_grapevineer_proto_goTypes = []interface{}{ (*UpdatePlayerRequest)(nil), // 6: UpdatePlayerRequest (*GetPlayerInfoRequest)(nil), // 7: GetPlayerInfoRequest (*GetWavFromTextRequest)(nil), // 8: GetWavFromTextRequest - (*GetOGImageResponse)(nil), // 9: GetOGImageResponse - (*GetFlowerMeaningByDateResponse)(nil), // 10: GetFlowerMeaningByDateResponse - (*SendLineMessageResponse)(nil), // 11: SendLineMessageResponse - (*SendOpenAIMessageResponse)(nil), // 12: SendOpenAIMessageResponse - (*SetPlayerResponse)(nil), // 13: SetPlayerResponse - (*GetAllPlayersResponse)(nil), // 14: GetAllPlayersResponse - (*UpdatePlayerResponse)(nil), // 15: UpdatePlayerResponse - (*GetPlayerInfoResponse)(nil), // 16: GetPlayerInfoResponse - (*GetWavFromTextResponse)(nil), // 17: GetWavFromTextResponse + (*SetBoScriptRequest)(nil), // 9: SetBoScriptRequest + (*GetBoScriptRandomlyRequest)(nil), // 10: GetBoScriptRandomlyRequest + (*GetOGImageResponse)(nil), // 11: GetOGImageResponse + (*GetFlowerMeaningByDateResponse)(nil), // 12: GetFlowerMeaningByDateResponse + (*SendLineMessageResponse)(nil), // 13: SendLineMessageResponse + (*SendOpenAIMessageResponse)(nil), // 14: SendOpenAIMessageResponse + (*SetPlayerResponse)(nil), // 15: SetPlayerResponse + (*GetAllPlayersResponse)(nil), // 16: GetAllPlayersResponse + (*UpdatePlayerResponse)(nil), // 17: UpdatePlayerResponse + (*GetPlayerInfoResponse)(nil), // 18: GetPlayerInfoResponse + (*GetWavFromTextResponse)(nil), // 19: GetWavFromTextResponse + (*SetBoScriptResponse)(nil), // 20: SetBoScriptResponse + (*GetBoScriptRandomlyResponse)(nil), // 21: GetBoScriptRandomlyResponse } var file_v1_grapevineer_proto_depIdxs = []int32{ 0, // 0: grapevineer.Grapevineer.GetOGImage:input_type -> GetOGImageRequest @@ -123,17 +139,21 @@ var file_v1_grapevineer_proto_depIdxs = []int32{ 6, // 6: grapevineer.Grapevineer.UpdatePlayer:input_type -> UpdatePlayerRequest 7, // 7: grapevineer.Grapevineer.GetPlayerInfo:input_type -> GetPlayerInfoRequest 8, // 8: grapevineer.Grapevineer.GetWavFromText:input_type -> GetWavFromTextRequest - 9, // 9: grapevineer.Grapevineer.GetOGImage:output_type -> GetOGImageResponse - 10, // 10: grapevineer.Grapevineer.GetFlowerMeaningByDate:output_type -> GetFlowerMeaningByDateResponse - 11, // 11: grapevineer.Grapevineer.SendLineMessage:output_type -> SendLineMessageResponse - 12, // 12: grapevineer.Grapevineer.SendOpenAIMessage:output_type -> SendOpenAIMessageResponse - 13, // 13: grapevineer.Grapevineer.SetPlayer:output_type -> SetPlayerResponse - 14, // 14: grapevineer.Grapevineer.GetAllPlayers:output_type -> GetAllPlayersResponse - 15, // 15: grapevineer.Grapevineer.UpdatePlayer:output_type -> UpdatePlayerResponse - 16, // 16: grapevineer.Grapevineer.GetPlayerInfo:output_type -> GetPlayerInfoResponse - 17, // 17: grapevineer.Grapevineer.GetWavFromText:output_type -> GetWavFromTextResponse - 9, // [9:18] is the sub-list for method output_type - 0, // [0:9] is the sub-list for method input_type + 9, // 9: grapevineer.Grapevineer.SetBoScript:input_type -> SetBoScriptRequest + 10, // 10: grapevineer.Grapevineer.GetBoScriptRandomly:input_type -> GetBoScriptRandomlyRequest + 11, // 11: grapevineer.Grapevineer.GetOGImage:output_type -> GetOGImageResponse + 12, // 12: grapevineer.Grapevineer.GetFlowerMeaningByDate:output_type -> GetFlowerMeaningByDateResponse + 13, // 13: grapevineer.Grapevineer.SendLineMessage:output_type -> SendLineMessageResponse + 14, // 14: grapevineer.Grapevineer.SendOpenAIMessage:output_type -> SendOpenAIMessageResponse + 15, // 15: grapevineer.Grapevineer.SetPlayer:output_type -> SetPlayerResponse + 16, // 16: grapevineer.Grapevineer.GetAllPlayers:output_type -> GetAllPlayersResponse + 17, // 17: grapevineer.Grapevineer.UpdatePlayer:output_type -> UpdatePlayerResponse + 18, // 18: grapevineer.Grapevineer.GetPlayerInfo:output_type -> GetPlayerInfoResponse + 19, // 19: grapevineer.Grapevineer.GetWavFromText:output_type -> GetWavFromTextResponse + 20, // 20: grapevineer.Grapevineer.SetBoScript:output_type -> SetBoScriptResponse + 21, // 21: grapevineer.Grapevineer.GetBoScriptRandomly:output_type -> GetBoScriptRandomlyResponse + 11, // [11:22] is the sub-list for method output_type + 0, // [0:11] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -144,6 +164,7 @@ func file_v1_grapevineer_proto_init() { if File_v1_grapevineer_proto != nil { return } + file_v1_bo_proto_init() file_v1_player_proto_init() file_v1_og_image_proto_init() file_v1_flower_meaning_proto_init() diff --git a/gen/go/v1/grapevineer.pb.gw.go b/gen/go/v1/grapevineer.pb.gw.go index a8d44dd..1e3b00a 100644 --- a/gen/go/v1/grapevineer.pb.gw.go +++ b/gen/go/v1/grapevineer.pb.gw.go @@ -353,6 +353,60 @@ func local_request_Grapevineer_GetWavFromText_0(ctx context.Context, marshaler r } +var ( + filter_Grapevineer_SetBoScript_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Grapevineer_SetBoScript_0(ctx context.Context, marshaler runtime.Marshaler, client GrapevineerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SetBoScriptRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Grapevineer_SetBoScript_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SetBoScript(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Grapevineer_SetBoScript_0(ctx context.Context, marshaler runtime.Marshaler, server GrapevineerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SetBoScriptRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Grapevineer_SetBoScript_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SetBoScript(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Grapevineer_GetBoScriptRandomly_0(ctx context.Context, marshaler runtime.Marshaler, client GrapevineerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetBoScriptRandomlyRequest + var metadata runtime.ServerMetadata + + msg, err := client.GetBoScriptRandomly(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Grapevineer_GetBoScriptRandomly_0(ctx context.Context, marshaler runtime.Marshaler, server GrapevineerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetBoScriptRandomlyRequest + var metadata runtime.ServerMetadata + + msg, err := server.GetBoScriptRandomly(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterGrapevineerHandlerServer registers the http handlers for service Grapevineer to "mux". // UnaryRPC :call GrapevineerServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -584,6 +638,56 @@ func RegisterGrapevineerHandlerServer(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("POST", pattern_Grapevineer_SetBoScript_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grapevineer.Grapevineer/SetBoScript", runtime.WithHTTPPathPattern("/v1/bo_script")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Grapevineer_SetBoScript_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Grapevineer_SetBoScript_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Grapevineer_GetBoScriptRandomly_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/grapevineer.Grapevineer/GetBoScriptRandomly", runtime.WithHTTPPathPattern("/v1/bo_script")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Grapevineer_GetBoScriptRandomly_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Grapevineer_GetBoScriptRandomly_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -823,6 +927,50 @@ func RegisterGrapevineerHandlerClient(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("POST", pattern_Grapevineer_SetBoScript_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grapevineer.Grapevineer/SetBoScript", runtime.WithHTTPPathPattern("/v1/bo_script")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Grapevineer_SetBoScript_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Grapevineer_SetBoScript_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Grapevineer_GetBoScriptRandomly_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/grapevineer.Grapevineer/GetBoScriptRandomly", runtime.WithHTTPPathPattern("/v1/bo_script")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Grapevineer_GetBoScriptRandomly_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Grapevineer_GetBoScriptRandomly_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -844,6 +992,10 @@ var ( pattern_Grapevineer_GetPlayerInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "player_info"}, "")) pattern_Grapevineer_GetWavFromText_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "wav_from_text"}, "")) + + pattern_Grapevineer_SetBoScript_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "bo_script"}, "")) + + pattern_Grapevineer_GetBoScriptRandomly_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "bo_script"}, "")) ) var ( @@ -864,4 +1016,8 @@ var ( forward_Grapevineer_GetPlayerInfo_0 = runtime.ForwardResponseMessage forward_Grapevineer_GetWavFromText_0 = runtime.ForwardResponseMessage + + forward_Grapevineer_SetBoScript_0 = runtime.ForwardResponseMessage + + forward_Grapevineer_GetBoScriptRandomly_0 = runtime.ForwardResponseMessage ) diff --git a/gen/go/v1/grapevineer_grpc.pb.go b/gen/go/v1/grapevineer_grpc.pb.go index 7202ada..ec67642 100644 --- a/gen/go/v1/grapevineer_grpc.pb.go +++ b/gen/go/v1/grapevineer_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v3.21.12 +// - protoc v3.20.3 // source: v1/grapevineer.proto package grapevineer @@ -28,6 +28,8 @@ const ( Grapevineer_UpdatePlayer_FullMethodName = "/grapevineer.Grapevineer/UpdatePlayer" Grapevineer_GetPlayerInfo_FullMethodName = "/grapevineer.Grapevineer/GetPlayerInfo" Grapevineer_GetWavFromText_FullMethodName = "/grapevineer.Grapevineer/GetWavFromText" + Grapevineer_SetBoScript_FullMethodName = "/grapevineer.Grapevineer/SetBoScript" + Grapevineer_GetBoScriptRandomly_FullMethodName = "/grapevineer.Grapevineer/GetBoScriptRandomly" ) // GrapevineerClient is the client API for Grapevineer service. @@ -43,6 +45,8 @@ type GrapevineerClient interface { UpdatePlayer(ctx context.Context, in *UpdatePlayerRequest, opts ...grpc.CallOption) (*UpdatePlayerResponse, error) GetPlayerInfo(ctx context.Context, in *GetPlayerInfoRequest, opts ...grpc.CallOption) (*GetPlayerInfoResponse, error) GetWavFromText(ctx context.Context, in *GetWavFromTextRequest, opts ...grpc.CallOption) (*GetWavFromTextResponse, error) + SetBoScript(ctx context.Context, in *SetBoScriptRequest, opts ...grpc.CallOption) (*SetBoScriptResponse, error) + GetBoScriptRandomly(ctx context.Context, in *GetBoScriptRandomlyRequest, opts ...grpc.CallOption) (*GetBoScriptRandomlyResponse, error) } type grapevineerClient struct { @@ -134,6 +138,24 @@ func (c *grapevineerClient) GetWavFromText(ctx context.Context, in *GetWavFromTe return out, nil } +func (c *grapevineerClient) SetBoScript(ctx context.Context, in *SetBoScriptRequest, opts ...grpc.CallOption) (*SetBoScriptResponse, error) { + out := new(SetBoScriptResponse) + err := c.cc.Invoke(ctx, Grapevineer_SetBoScript_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *grapevineerClient) GetBoScriptRandomly(ctx context.Context, in *GetBoScriptRandomlyRequest, opts ...grpc.CallOption) (*GetBoScriptRandomlyResponse, error) { + out := new(GetBoScriptRandomlyResponse) + err := c.cc.Invoke(ctx, Grapevineer_GetBoScriptRandomly_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // GrapevineerServer is the server API for Grapevineer service. // All implementations must embed UnimplementedGrapevineerServer // for forward compatibility @@ -147,6 +169,8 @@ type GrapevineerServer interface { UpdatePlayer(context.Context, *UpdatePlayerRequest) (*UpdatePlayerResponse, error) GetPlayerInfo(context.Context, *GetPlayerInfoRequest) (*GetPlayerInfoResponse, error) GetWavFromText(context.Context, *GetWavFromTextRequest) (*GetWavFromTextResponse, error) + SetBoScript(context.Context, *SetBoScriptRequest) (*SetBoScriptResponse, error) + GetBoScriptRandomly(context.Context, *GetBoScriptRandomlyRequest) (*GetBoScriptRandomlyResponse, error) mustEmbedUnimplementedGrapevineerServer() } @@ -181,6 +205,12 @@ func (UnimplementedGrapevineerServer) GetPlayerInfo(context.Context, *GetPlayerI func (UnimplementedGrapevineerServer) GetWavFromText(context.Context, *GetWavFromTextRequest) (*GetWavFromTextResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetWavFromText not implemented") } +func (UnimplementedGrapevineerServer) SetBoScript(context.Context, *SetBoScriptRequest) (*SetBoScriptResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetBoScript not implemented") +} +func (UnimplementedGrapevineerServer) GetBoScriptRandomly(context.Context, *GetBoScriptRandomlyRequest) (*GetBoScriptRandomlyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBoScriptRandomly not implemented") +} func (UnimplementedGrapevineerServer) mustEmbedUnimplementedGrapevineerServer() {} // UnsafeGrapevineerServer may be embedded to opt out of forward compatibility for this service. @@ -356,6 +386,42 @@ func _Grapevineer_GetWavFromText_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _Grapevineer_SetBoScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetBoScriptRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GrapevineerServer).SetBoScript(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Grapevineer_SetBoScript_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GrapevineerServer).SetBoScript(ctx, req.(*SetBoScriptRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Grapevineer_GetBoScriptRandomly_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBoScriptRandomlyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GrapevineerServer).GetBoScriptRandomly(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Grapevineer_GetBoScriptRandomly_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GrapevineerServer).GetBoScriptRandomly(ctx, req.(*GetBoScriptRandomlyRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Grapevineer_ServiceDesc is the grpc.ServiceDesc for Grapevineer service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -399,6 +465,14 @@ var Grapevineer_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetWavFromText", Handler: _Grapevineer_GetWavFromText_Handler, }, + { + MethodName: "SetBoScript", + Handler: _Grapevineer_SetBoScript_Handler, + }, + { + MethodName: "GetBoScriptRandomly", + Handler: _Grapevineer_GetBoScriptRandomly_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "v1/grapevineer.proto", diff --git a/gen/go/v1/line.pb.go b/gen/go/v1/line.pb.go index f0cddcb..94750d3 100644 --- a/gen/go/v1/line.pb.go +++ b/gen/go/v1/line.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.21.12 +// protoc v3.20.3 // source: v1/line.proto package grapevineer diff --git a/gen/go/v1/og_image.pb.go b/gen/go/v1/og_image.pb.go index 641d1fa..370ab66 100644 --- a/gen/go/v1/og_image.pb.go +++ b/gen/go/v1/og_image.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.21.12 +// protoc v3.20.3 // source: v1/og_image.proto package grapevineer diff --git a/gen/go/v1/openai.pb.go b/gen/go/v1/openai.pb.go index b79bea4..0d4aa8e 100644 --- a/gen/go/v1/openai.pb.go +++ b/gen/go/v1/openai.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.21.12 +// protoc v3.20.3 // source: v1/openai.proto package grapevineer diff --git a/gen/go/v1/player.pb.go b/gen/go/v1/player.pb.go index e29fcf9..cbe9774 100644 --- a/gen/go/v1/player.pb.go +++ b/gen/go/v1/player.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.21.12 +// protoc v3.20.3 // source: v1/player.proto package grapevineer diff --git a/gen/go/v1/voicevox.pb.go b/gen/go/v1/voicevox.pb.go index 0b4f12c..8f8a715 100644 --- a/gen/go/v1/voicevox.pb.go +++ b/gen/go/v1/voicevox.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.21.12 +// protoc v3.20.3 // source: v1/voicevox.proto package grapevineer diff --git a/gen/openapi/api_definition.swagger.json b/gen/openapi/api_definition.swagger.json index 8d84e19..1917788 100644 --- a/gen/openapi/api_definition.swagger.json +++ b/gen/openapi/api_definition.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "v1/flower_meaning.proto", + "title": "v1/bo.proto", "version": "version not set" }, "tags": [ @@ -16,6 +16,44 @@ "application/json" ], "paths": { + "/v1/bo_script": { + "get": { + "operationId": "Grapevineer_GetBoScriptRandomly", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/GetBoScriptRandomlyResponse" + } + } + }, + "tags": [ + "Grapevineer" + ] + }, + "post": { + "operationId": "Grapevineer_SetBoScript", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/SetBoScriptResponse" + } + } + }, + "parameters": [ + { + "name": "script", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Grapevineer" + ] + } + }, "/v1/flower_meaning/{date}": { "get": { "operationId": "Grapevineer_GetFlowerMeaningByDate", @@ -388,6 +426,17 @@ } } }, + "GetBoScriptRandomlyResponse": { + "type": "object", + "properties": { + "boId": { + "type": "string" + }, + "script": { + "type": "string" + } + } + }, "GetFlowerMeaningByDateResponse": { "type": "object", "properties": { @@ -574,6 +623,15 @@ } } }, + "SetBoScriptResponse": { + "type": "object", + "properties": { + "status": { + "type": "integer", + "format": "int32" + } + } + }, "SetPlayerResponse": { "type": "object", "properties": { diff --git a/gen/rust/grapevineer.tonic.rs b/gen/rust/grapevineer.tonic.rs index 2534d53..dd400ac 100644 --- a/gen/rust/grapevineer.tonic.rs +++ b/gen/rust/grapevineer.tonic.rs @@ -4,6 +4,7 @@ pub mod grapevineer_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; use tonic::codegen::http::Uri; + /// #[derive(Debug, Clone)] pub struct GrapevineerClient { inner: tonic::client::Grpc, @@ -266,6 +267,49 @@ pub mod grapevineer_client { ); self.inner.unary(request.into_request(), path, codec).await } + /// + pub async fn set_bo_script( + &mut self, + request: impl tonic::IntoRequest, + ) -> Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/grapevineer.Grapevineer/SetBoScript", + ); + self.inner.unary(request.into_request(), path, codec).await + } + /// + pub async fn get_bo_script_randomly( + &mut self, + request: impl tonic::IntoRequest, + ) -> Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/grapevineer.Grapevineer/GetBoScriptRandomly", + ); + self.inner.unary(request.into_request(), path, codec).await + } } } /// Generated server implementations. @@ -332,7 +376,21 @@ pub mod grapevineer_server { tonic::Response, tonic::Status, >; + /// + async fn set_bo_script( + &self, + request: tonic::Request, + ) -> Result, tonic::Status>; + /// + async fn get_bo_script_randomly( + &self, + request: tonic::Request, + ) -> Result< + tonic::Response, + tonic::Status, + >; } + /// #[derive(Debug)] pub struct GrapevineerServer { inner: _Inner, @@ -755,6 +813,89 @@ pub mod grapevineer_server { }; Box::pin(fut) } + "/grapevineer.Grapevineer/SetBoScript" => { + #[allow(non_camel_case_types)] + struct SetBoScriptSvc(pub Arc); + impl< + T: Grapevineer, + > tonic::server::UnaryService + for SetBoScriptSvc { + type Response = super::super::SetBoScriptResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = self.0.clone(); + let fut = async move { + (*inner).set_bo_script(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = SetBoScriptSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/grapevineer.Grapevineer/GetBoScriptRandomly" => { + #[allow(non_camel_case_types)] + struct GetBoScriptRandomlySvc(pub Arc); + impl< + T: Grapevineer, + > tonic::server::UnaryService< + super::super::GetBoScriptRandomlyRequest, + > for GetBoScriptRandomlySvc { + type Response = super::super::GetBoScriptRandomlyResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::super::GetBoScriptRandomlyRequest, + >, + ) -> Self::Future { + let inner = self.0.clone(); + let fut = async move { + (*inner).get_bo_script_randomly(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GetBoScriptRandomlySvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } _ => { Box::pin(async move { Ok( diff --git a/gen/ts/v1/bo_grpc_pb.d.ts b/gen/ts/v1/bo_grpc_pb.d.ts new file mode 100644 index 0000000..51b4d69 --- /dev/null +++ b/gen/ts/v1/bo_grpc_pb.d.ts @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO diff --git a/gen/ts/v1/bo_grpc_pb.js b/gen/ts/v1/bo_grpc_pb.js new file mode 100644 index 0000000..97b3a24 --- /dev/null +++ b/gen/ts/v1/bo_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/gen/ts/v1/bo_pb.d.ts b/gen/ts/v1/bo_pb.d.ts new file mode 100644 index 0000000..1f46fbd --- /dev/null +++ b/gen/ts/v1/bo_pb.d.ts @@ -0,0 +1,85 @@ +// package: +// file: v1/bo.proto + +import * as jspb from "google-protobuf"; + +export class SetBoScriptRequest extends jspb.Message { + getScript(): string; + setScript(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SetBoScriptRequest.AsObject; + static toObject(includeInstance: boolean, msg: SetBoScriptRequest): SetBoScriptRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SetBoScriptRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SetBoScriptRequest; + static deserializeBinaryFromReader(message: SetBoScriptRequest, reader: jspb.BinaryReader): SetBoScriptRequest; +} + +export namespace SetBoScriptRequest { + export type AsObject = { + script: string, + } +} + +export class SetBoScriptResponse extends jspb.Message { + getStatus(): number; + setStatus(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SetBoScriptResponse.AsObject; + static toObject(includeInstance: boolean, msg: SetBoScriptResponse): SetBoScriptResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SetBoScriptResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SetBoScriptResponse; + static deserializeBinaryFromReader(message: SetBoScriptResponse, reader: jspb.BinaryReader): SetBoScriptResponse; +} + +export namespace SetBoScriptResponse { + export type AsObject = { + status: number, + } +} + +export class GetBoScriptRandomlyRequest extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetBoScriptRandomlyRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetBoScriptRandomlyRequest): GetBoScriptRandomlyRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetBoScriptRandomlyRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBoScriptRandomlyRequest; + static deserializeBinaryFromReader(message: GetBoScriptRandomlyRequest, reader: jspb.BinaryReader): GetBoScriptRandomlyRequest; +} + +export namespace GetBoScriptRandomlyRequest { + export type AsObject = { + } +} + +export class GetBoScriptRandomlyResponse extends jspb.Message { + getBoId(): string; + setBoId(value: string): void; + + getScript(): string; + setScript(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetBoScriptRandomlyResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetBoScriptRandomlyResponse): GetBoScriptRandomlyResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetBoScriptRandomlyResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBoScriptRandomlyResponse; + static deserializeBinaryFromReader(message: GetBoScriptRandomlyResponse, reader: jspb.BinaryReader): GetBoScriptRandomlyResponse; +} + +export namespace GetBoScriptRandomlyResponse { + export type AsObject = { + boId: string, + script: string, + } +} + diff --git a/gen/ts/v1/bo_pb.js b/gen/ts/v1/bo_pb.js new file mode 100644 index 0000000..20b01fb --- /dev/null +++ b/gen/ts/v1/bo_pb.js @@ -0,0 +1,633 @@ +// source: v1/bo.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = (function() { + if (this) { return this; } + if (typeof window !== 'undefined') { return window; } + if (typeof global !== 'undefined') { return global; } + if (typeof self !== 'undefined') { return self; } + return Function('return this')(); +}.call(null)); + +goog.exportSymbol('proto.GetBoScriptRandomlyRequest', null, global); +goog.exportSymbol('proto.GetBoScriptRandomlyResponse', null, global); +goog.exportSymbol('proto.SetBoScriptRequest', null, global); +goog.exportSymbol('proto.SetBoScriptResponse', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.SetBoScriptRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.SetBoScriptRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.SetBoScriptRequest.displayName = 'proto.SetBoScriptRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.SetBoScriptResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.SetBoScriptResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.SetBoScriptResponse.displayName = 'proto.SetBoScriptResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.GetBoScriptRandomlyRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.GetBoScriptRandomlyRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.GetBoScriptRandomlyRequest.displayName = 'proto.GetBoScriptRandomlyRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.GetBoScriptRandomlyResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.GetBoScriptRandomlyResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.GetBoScriptRandomlyResponse.displayName = 'proto.GetBoScriptRandomlyResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.SetBoScriptRequest.prototype.toObject = function(opt_includeInstance) { + return proto.SetBoScriptRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.SetBoScriptRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.SetBoScriptRequest.toObject = function(includeInstance, msg) { + var f, obj = { + script: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.SetBoScriptRequest} + */ +proto.SetBoScriptRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.SetBoScriptRequest; + return proto.SetBoScriptRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.SetBoScriptRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.SetBoScriptRequest} + */ +proto.SetBoScriptRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setScript(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.SetBoScriptRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.SetBoScriptRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.SetBoScriptRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.SetBoScriptRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getScript(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string script = 1; + * @return {string} + */ +proto.SetBoScriptRequest.prototype.getScript = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.SetBoScriptRequest} returns this + */ +proto.SetBoScriptRequest.prototype.setScript = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.SetBoScriptResponse.prototype.toObject = function(opt_includeInstance) { + return proto.SetBoScriptResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.SetBoScriptResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.SetBoScriptResponse.toObject = function(includeInstance, msg) { + var f, obj = { + status: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.SetBoScriptResponse} + */ +proto.SetBoScriptResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.SetBoScriptResponse; + return proto.SetBoScriptResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.SetBoScriptResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.SetBoScriptResponse} + */ +proto.SetBoScriptResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setStatus(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.SetBoScriptResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.SetBoScriptResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.SetBoScriptResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.SetBoScriptResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStatus(); + if (f !== 0) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 status = 1; + * @return {number} + */ +proto.SetBoScriptResponse.prototype.getStatus = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.SetBoScriptResponse} returns this + */ +proto.SetBoScriptResponse.prototype.setStatus = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.GetBoScriptRandomlyRequest.prototype.toObject = function(opt_includeInstance) { + return proto.GetBoScriptRandomlyRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.GetBoScriptRandomlyRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.GetBoScriptRandomlyRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.GetBoScriptRandomlyRequest} + */ +proto.GetBoScriptRandomlyRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.GetBoScriptRandomlyRequest; + return proto.GetBoScriptRandomlyRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.GetBoScriptRandomlyRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.GetBoScriptRandomlyRequest} + */ +proto.GetBoScriptRandomlyRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.GetBoScriptRandomlyRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.GetBoScriptRandomlyRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.GetBoScriptRandomlyRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.GetBoScriptRandomlyRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.GetBoScriptRandomlyResponse.prototype.toObject = function(opt_includeInstance) { + return proto.GetBoScriptRandomlyResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.GetBoScriptRandomlyResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.GetBoScriptRandomlyResponse.toObject = function(includeInstance, msg) { + var f, obj = { + boId: jspb.Message.getFieldWithDefault(msg, 1, ""), + script: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.GetBoScriptRandomlyResponse} + */ +proto.GetBoScriptRandomlyResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.GetBoScriptRandomlyResponse; + return proto.GetBoScriptRandomlyResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.GetBoScriptRandomlyResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.GetBoScriptRandomlyResponse} + */ +proto.GetBoScriptRandomlyResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setBoId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setScript(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.GetBoScriptRandomlyResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.GetBoScriptRandomlyResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.GetBoScriptRandomlyResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.GetBoScriptRandomlyResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBoId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getScript(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string bo_id = 1; + * @return {string} + */ +proto.GetBoScriptRandomlyResponse.prototype.getBoId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.GetBoScriptRandomlyResponse} returns this + */ +proto.GetBoScriptRandomlyResponse.prototype.setBoId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string script = 2; + * @return {string} + */ +proto.GetBoScriptRandomlyResponse.prototype.getScript = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.GetBoScriptRandomlyResponse} returns this + */ +proto.GetBoScriptRandomlyResponse.prototype.setScript = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +goog.object.extend(exports, proto); diff --git a/gen/ts/v1/bo_pb_service.d.ts b/gen/ts/v1/bo_pb_service.d.ts new file mode 100644 index 0000000..ee69fff --- /dev/null +++ b/gen/ts/v1/bo_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: +// file: v1/bo.proto + diff --git a/gen/ts/v1/bo_pb_service.js b/gen/ts/v1/bo_pb_service.js new file mode 100644 index 0000000..ee69fff --- /dev/null +++ b/gen/ts/v1/bo_pb_service.js @@ -0,0 +1,3 @@ +// package: +// file: v1/bo.proto + diff --git a/gen/ts/v1/grapevineer_grpc_pb.d.ts b/gen/ts/v1/grapevineer_grpc_pb.d.ts index a2717ca..99fb4e1 100644 --- a/gen/ts/v1/grapevineer_grpc_pb.d.ts +++ b/gen/ts/v1/grapevineer_grpc_pb.d.ts @@ -4,6 +4,7 @@ // file: v1/grapevineer.proto import * as v1_grapevineer_pb from "../v1/grapevineer_pb"; +import * as v1_bo_pb from "../v1/bo_pb"; import * as v1_player_pb from "../v1/player_pb"; import * as v1_og_image_pb from "../v1/og_image_pb"; import * as v1_flower_meaning_pb from "../v1/flower_meaning_pb"; @@ -22,6 +23,8 @@ interface IGrapevineerService extends grpc.ServiceDefinition; getPlayerInfo: grpc.MethodDefinition; getWavFromText: grpc.MethodDefinition; + setBoScript: grpc.MethodDefinition; + getBoScriptRandomly: grpc.MethodDefinition; } export const GrapevineerService: IGrapevineerService; @@ -36,6 +39,8 @@ export interface IGrapevineerServer extends grpc.UntypedServiceImplementation { updatePlayer: grpc.handleUnaryCall; getPlayerInfo: grpc.handleUnaryCall; getWavFromText: grpc.handleUnaryCall; + setBoScript: grpc.handleUnaryCall; + getBoScriptRandomly: grpc.handleUnaryCall; } export class GrapevineerClient extends grpc.Client { @@ -67,4 +72,10 @@ export class GrapevineerClient extends grpc.Client { getWavFromText(argument: v1_voicevox_pb.GetWavFromTextRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall; getWavFromText(argument: v1_voicevox_pb.GetWavFromTextRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; getWavFromText(argument: v1_voicevox_pb.GetWavFromTextRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + setBoScript(argument: v1_bo_pb.SetBoScriptRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall; + setBoScript(argument: v1_bo_pb.SetBoScriptRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + setBoScript(argument: v1_bo_pb.SetBoScriptRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + getBoScriptRandomly(argument: v1_bo_pb.GetBoScriptRandomlyRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall; + getBoScriptRandomly(argument: v1_bo_pb.GetBoScriptRandomlyRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + getBoScriptRandomly(argument: v1_bo_pb.GetBoScriptRandomlyRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; } diff --git a/gen/ts/v1/grapevineer_grpc_pb.js b/gen/ts/v1/grapevineer_grpc_pb.js index 749db7a..1963f59 100644 --- a/gen/ts/v1/grapevineer_grpc_pb.js +++ b/gen/ts/v1/grapevineer_grpc_pb.js @@ -3,6 +3,7 @@ 'use strict'; var grpc = require('@grpc/grpc-js'); var google_api_annotations_pb = require('../google/api/annotations_pb.js'); +var v1_bo_pb = require('../v1/bo_pb.js'); var v1_player_pb = require('../v1/player_pb.js'); var v1_og_image_pb = require('../v1/og_image_pb.js'); var v1_flower_meaning_pb = require('../v1/flower_meaning_pb.js'); @@ -32,6 +33,28 @@ function deserialize_GetAllPlayersResponse(buffer_arg) { return v1_player_pb.GetAllPlayersResponse.deserializeBinary(new Uint8Array(buffer_arg)); } +function serialize_GetBoScriptRandomlyRequest(arg) { + if (!(arg instanceof v1_bo_pb.GetBoScriptRandomlyRequest)) { + throw new Error('Expected argument of type GetBoScriptRandomlyRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_GetBoScriptRandomlyRequest(buffer_arg) { + return v1_bo_pb.GetBoScriptRandomlyRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_GetBoScriptRandomlyResponse(arg) { + if (!(arg instanceof v1_bo_pb.GetBoScriptRandomlyResponse)) { + throw new Error('Expected argument of type GetBoScriptRandomlyResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_GetBoScriptRandomlyResponse(buffer_arg) { + return v1_bo_pb.GetBoScriptRandomlyResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + function serialize_GetFlowerMeaningByDateRequest(arg) { if (!(arg instanceof v1_flower_meaning_pb.GetFlowerMeaningByDateRequest)) { throw new Error('Expected argument of type GetFlowerMeaningByDateRequest'); @@ -164,6 +187,28 @@ function deserialize_SendOpenAIMessageResponse(buffer_arg) { return v1_openai_pb.SendOpenAIMessageResponse.deserializeBinary(new Uint8Array(buffer_arg)); } +function serialize_SetBoScriptRequest(arg) { + if (!(arg instanceof v1_bo_pb.SetBoScriptRequest)) { + throw new Error('Expected argument of type SetBoScriptRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_SetBoScriptRequest(buffer_arg) { + return v1_bo_pb.SetBoScriptRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_SetBoScriptResponse(arg) { + if (!(arg instanceof v1_bo_pb.SetBoScriptResponse)) { + throw new Error('Expected argument of type SetBoScriptResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_SetBoScriptResponse(buffer_arg) { + return v1_bo_pb.SetBoScriptResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + function serialize_SetPlayerRequest(arg) { if (!(arg instanceof v1_player_pb.SetPlayerRequest)) { throw new Error('Expected argument of type SetPlayerRequest'); @@ -309,6 +354,28 @@ var GrapevineerService = exports.GrapevineerService = { responseSerialize: serialize_GetWavFromTextResponse, responseDeserialize: deserialize_GetWavFromTextResponse, }, + setBoScript: { + path: '/grapevineer.Grapevineer/SetBoScript', + requestStream: false, + responseStream: false, + requestType: v1_bo_pb.SetBoScriptRequest, + responseType: v1_bo_pb.SetBoScriptResponse, + requestSerialize: serialize_SetBoScriptRequest, + requestDeserialize: deserialize_SetBoScriptRequest, + responseSerialize: serialize_SetBoScriptResponse, + responseDeserialize: deserialize_SetBoScriptResponse, + }, + getBoScriptRandomly: { + path: '/grapevineer.Grapevineer/GetBoScriptRandomly', + requestStream: false, + responseStream: false, + requestType: v1_bo_pb.GetBoScriptRandomlyRequest, + responseType: v1_bo_pb.GetBoScriptRandomlyResponse, + requestSerialize: serialize_GetBoScriptRandomlyRequest, + requestDeserialize: deserialize_GetBoScriptRandomlyRequest, + responseSerialize: serialize_GetBoScriptRandomlyResponse, + responseDeserialize: deserialize_GetBoScriptRandomlyResponse, + }, }; exports.GrapevineerClient = grpc.makeGenericClientConstructor(GrapevineerService); diff --git a/gen/ts/v1/grapevineer_pb.d.ts b/gen/ts/v1/grapevineer_pb.d.ts index ecb1887..7ca5b71 100644 --- a/gen/ts/v1/grapevineer_pb.d.ts +++ b/gen/ts/v1/grapevineer_pb.d.ts @@ -3,6 +3,7 @@ import * as jspb from "google-protobuf"; import * as google_api_annotations_pb from "../google/api/annotations_pb"; +import * as v1_bo_pb from "../v1/bo_pb"; import * as v1_player_pb from "../v1/player_pb"; import * as v1_og_image_pb from "../v1/og_image_pb"; import * as v1_flower_meaning_pb from "../v1/flower_meaning_pb"; diff --git a/gen/ts/v1/grapevineer_pb.js b/gen/ts/v1/grapevineer_pb.js index ad14677..d3a031f 100644 --- a/gen/ts/v1/grapevineer_pb.js +++ b/gen/ts/v1/grapevineer_pb.js @@ -23,6 +23,8 @@ var global = (function() { var google_api_annotations_pb = require('../google/api/annotations_pb.js'); goog.object.extend(proto, google_api_annotations_pb); +var v1_bo_pb = require('../v1/bo_pb.js'); +goog.object.extend(proto, v1_bo_pb); var v1_player_pb = require('../v1/player_pb.js'); goog.object.extend(proto, v1_player_pb); var v1_og_image_pb = require('../v1/og_image_pb.js'); diff --git a/gen/ts/v1/grapevineer_pb_service.d.ts b/gen/ts/v1/grapevineer_pb_service.d.ts index e681d81..a664a12 100644 --- a/gen/ts/v1/grapevineer_pb_service.d.ts +++ b/gen/ts/v1/grapevineer_pb_service.d.ts @@ -2,6 +2,7 @@ // file: v1/grapevineer.proto import * as v1_grapevineer_pb from "../v1/grapevineer_pb"; +import * as v1_bo_pb from "../v1/bo_pb"; import * as v1_player_pb from "../v1/player_pb"; import * as v1_og_image_pb from "../v1/og_image_pb"; import * as v1_flower_meaning_pb from "../v1/flower_meaning_pb"; @@ -91,6 +92,24 @@ type GrapevineerGetWavFromText = { readonly responseType: typeof v1_voicevox_pb.GetWavFromTextResponse; }; +type GrapevineerSetBoScript = { + readonly methodName: string; + readonly service: typeof Grapevineer; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof v1_bo_pb.SetBoScriptRequest; + readonly responseType: typeof v1_bo_pb.SetBoScriptResponse; +}; + +type GrapevineerGetBoScriptRandomly = { + readonly methodName: string; + readonly service: typeof Grapevineer; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof v1_bo_pb.GetBoScriptRandomlyRequest; + readonly responseType: typeof v1_bo_pb.GetBoScriptRandomlyResponse; +}; + export class Grapevineer { static readonly serviceName: string; static readonly GetOGImage: GrapevineerGetOGImage; @@ -102,6 +121,8 @@ export class Grapevineer { static readonly UpdatePlayer: GrapevineerUpdatePlayer; static readonly GetPlayerInfo: GrapevineerGetPlayerInfo; static readonly GetWavFromText: GrapevineerGetWavFromText; + static readonly SetBoScript: GrapevineerSetBoScript; + static readonly GetBoScriptRandomly: GrapevineerGetBoScriptRandomly; } export type ServiceError = { message: string, code: number; metadata: grpc.Metadata } @@ -217,5 +238,23 @@ export class GrapevineerClient { requestMessage: v1_voicevox_pb.GetWavFromTextRequest, callback: (error: ServiceError|null, responseMessage: v1_voicevox_pb.GetWavFromTextResponse|null) => void ): UnaryResponse; + setBoScript( + requestMessage: v1_bo_pb.SetBoScriptRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: v1_bo_pb.SetBoScriptResponse|null) => void + ): UnaryResponse; + setBoScript( + requestMessage: v1_bo_pb.SetBoScriptRequest, + callback: (error: ServiceError|null, responseMessage: v1_bo_pb.SetBoScriptResponse|null) => void + ): UnaryResponse; + getBoScriptRandomly( + requestMessage: v1_bo_pb.GetBoScriptRandomlyRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: v1_bo_pb.GetBoScriptRandomlyResponse|null) => void + ): UnaryResponse; + getBoScriptRandomly( + requestMessage: v1_bo_pb.GetBoScriptRandomlyRequest, + callback: (error: ServiceError|null, responseMessage: v1_bo_pb.GetBoScriptRandomlyResponse|null) => void + ): UnaryResponse; } diff --git a/gen/ts/v1/grapevineer_pb_service.js b/gen/ts/v1/grapevineer_pb_service.js index b1fd9e2..b2a057c 100644 --- a/gen/ts/v1/grapevineer_pb_service.js +++ b/gen/ts/v1/grapevineer_pb_service.js @@ -2,6 +2,7 @@ // file: v1/grapevineer.proto var v1_grapevineer_pb = require("../v1/grapevineer_pb"); +var v1_bo_pb = require("../v1/bo_pb"); var v1_player_pb = require("../v1/player_pb"); var v1_og_image_pb = require("../v1/og_image_pb"); var v1_flower_meaning_pb = require("../v1/flower_meaning_pb"); @@ -97,6 +98,24 @@ Grapevineer.GetWavFromText = { responseType: v1_voicevox_pb.GetWavFromTextResponse }; +Grapevineer.SetBoScript = { + methodName: "SetBoScript", + service: Grapevineer, + requestStream: false, + responseStream: false, + requestType: v1_bo_pb.SetBoScriptRequest, + responseType: v1_bo_pb.SetBoScriptResponse +}; + +Grapevineer.GetBoScriptRandomly = { + methodName: "GetBoScriptRandomly", + service: Grapevineer, + requestStream: false, + responseStream: false, + requestType: v1_bo_pb.GetBoScriptRandomlyRequest, + responseType: v1_bo_pb.GetBoScriptRandomlyResponse +}; + exports.Grapevineer = Grapevineer; function GrapevineerClient(serviceHost, options) { @@ -383,5 +402,67 @@ GrapevineerClient.prototype.getWavFromText = function getWavFromText(requestMess }; }; +GrapevineerClient.prototype.setBoScript = function setBoScript(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Grapevineer.SetBoScript, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +GrapevineerClient.prototype.getBoScriptRandomly = function getBoScriptRandomly(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(Grapevineer.GetBoScriptRandomly, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + exports.GrapevineerClient = GrapevineerClient; diff --git a/go.sum b/go.sum index 3d9dbe5..6567ad3 100644 --- a/go.sum +++ b/go.sum @@ -49,14 +49,18 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/sashabaranov/go-openai v1.9.4 h1:KanoCEoowAI45jVXlenMCckutSRr39qOmSi9MyPBfZM= github.com/sashabaranov/go-openai v1.9.4/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= @@ -105,6 +109,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.8.1-0.20230428195545-5283a0178901 h1:0wxTF6pSjIIhNt7mo9GvjDfzyCOiWhmICgtO/Ah948s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= diff --git a/infra/db/init/init_database.sql b/infra/db/init/init_database.sql index a30f03e..cb79834 100644 --- a/infra/db/init/init_database.sql +++ b/infra/db/init/init_database.sql @@ -11,4 +11,9 @@ CREATE TABLE IF NOT EXISTS players ( player_id VARCHAR(255), name VARCHAR(255), region VARCHAR(255) +); + +CREATE TABLE IF NOT EXISTS bos ( + id uuid NOT NULL, + script VARCHAR(255) ); \ No newline at end of file diff --git a/internal/grpc/v1/v1.go b/internal/grpc/v1/v1.go index efb125d..3f19047 100644 --- a/internal/grpc/v1/v1.go +++ b/internal/grpc/v1/v1.go @@ -86,3 +86,18 @@ func (x *V1) GetWavFromText(ctx context.Context, req *grapevineer.GetWavFromText return got, nil } } +func (x *V1) GetBoScriptRandomly(ctx context.Context, req *grapevineer.GetBoScriptRandomlyRequest) (*grapevineer.GetBoScriptRandomlyResponse, error) { + if got, err := x.app.GetBoScriptRandomly(ctx, req); err != nil { + return nil, err + } else { + return got, nil + } +} + +func (x *V1) SetBoScript(ctx context.Context, req *grapevineer.SetBoScriptRequest) (*grapevineer.SetBoScriptResponse, error) { + if got, err := x.app.SetBoScript(ctx, req); err != nil { + return nil, err + } else { + return got, nil + } +} diff --git a/proto/google/protobuf/descriptor.proto b/proto/google/protobuf/descriptor.proto new file mode 100644 index 0000000..7b06c6c --- /dev/null +++ b/proto/google/protobuf/descriptor.proto @@ -0,0 +1,1156 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + +syntax = "proto2"; + +package google.protobuf; + +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "DescriptorProtos"; +option csharp_namespace = "Google.Protobuf.Reflection"; +option objc_class_prefix = "GPB"; +option cc_enable_arenas = true; + +// descriptor.proto must be optimized for speed because reflection-based +// algorithms don't work during bootstrapping. +option optimize_for = SPEED; + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; +} + +// Describes a complete .proto file. +message FileDescriptorProto { + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. + + // Names of files imported by this file. + repeated string dependency = 3; + // Indexes of the public imported files in the dependency list above. + repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + repeated int32 weak_dependency = 11; + + // All top-level definitions in this file. + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + + optional FileOptions options = 8; + + // This field contains optional information about the original source code. + // You may safely remove this entire field without harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + optional SourceCodeInfo source_code_info = 9; + + // The syntax of the proto file. + // The supported values are "proto2", "proto3", and "editions". + // + // If `edition` is present, this value must be "editions". + optional string syntax = 12; + + // The edition of the proto file, which is an opaque string. + optional string edition = 13; +} + +// Describes a message type. +message DescriptorProto { + optional string name = 1; + + repeated FieldDescriptorProto field = 2; + repeated FieldDescriptorProto extension = 6; + + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + + message ExtensionRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. + + optional ExtensionRangeOptions options = 3; + } + repeated ExtensionRange extension_range = 5; + + repeated OneofDescriptorProto oneof_decl = 8; + + optional MessageOptions options = 7; + + // Range of reserved tag numbers. Reserved tag numbers may not be used by + // fields or extension ranges in the same message. Reserved ranges may + // not overlap. + message ReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. + } + repeated ReservedRange reserved_range = 9; + // Reserved field names, which may not be used by fields in the same message. + // A given name may only be reserved once. + repeated string reserved_name = 10; +} + +message ExtensionRangeOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + message Declaration { + // The extension number declared within the extension range. + optional int32 number = 1; + + // The fully-qualified name of the extension field. There must be a leading + // dot in front of the full name. + optional string full_name = 2; + + // The fully-qualified type name of the extension field. Unlike + // Metadata.type, Declaration.type must have a leading dot for messages + // and enums. + optional string type = 3; + + // Deprecated. Please use "repeated". + optional bool is_repeated = 4 [deprecated = true]; + + // If true, indicates that the number is reserved in the extension range, + // and any extension field with the number will fail to compile. Set this + // when a declared extension field is deleted. + optional bool reserved = 5; + + // If true, indicates that the extension must be defined as repeated. + // Otherwise the extension must be defined as optional. + optional bool repeated = 6; + } + + // For external users: DO NOT USE. We are in the process of open sourcing + // extension declaration and executing internal cleanups before it can be + // used externally. + repeated Declaration declaration = 2 [retention = RETENTION_SOURCE]; + + // Any features defined in the specific edition. + optional FeatureSet features = 50; + + // The verification state of the extension range. + enum VerificationState { + // All the extensions of the range must be declared. + DECLARATION = 0; + UNVERIFIED = 1; + } + + // The verification state of the range. + // TODO(b/278783756): flip the default to DECLARATION once all empty ranges + // are marked as UNVERIFIED. + optional VerificationState verification = 3 [default = UNVERIFIED]; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +// Describes a field within a message. +message FieldDescriptorProto { + enum Type { + // 0 is reserved for errors. + // Order is weird for historical reasons. + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + TYPE_INT64 = 3; + TYPE_UINT64 = 4; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + // Tag-delimited aggregate. + // Group type is deprecated and not supported in proto3. However, Proto3 + // implementations should still be able to parse the group wire format and + // treat group fields as unknown fields. + TYPE_GROUP = 10; + TYPE_MESSAGE = 11; // Length-delimited aggregate. + + // New in version 2. + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. + } + + enum Label { + // 0 is reserved for errors + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + } + + optional string name = 1; + optional int32 number = 3; + optional Label label = 4; + + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + optional Type type = 5; + + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + optional string type_name = 6; + + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + optional string extendee = 2; + + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + optional string default_value = 7; + + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + optional int32 oneof_index = 9; + + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + optional string json_name = 10; + + optional FieldOptions options = 8; + + // If true, this is a proto3 "optional". When a proto3 field is optional, it + // tracks presence regardless of field type. + // + // When proto3_optional is true, this field must be belong to a oneof to + // signal to old proto3 clients that presence is tracked for this field. This + // oneof is known as a "synthetic" oneof, and this field must be its sole + // member (each proto3 optional field gets its own synthetic oneof). Synthetic + // oneofs exist in the descriptor only, and do not generate any API. Synthetic + // oneofs must be ordered after all "real" oneofs. + // + // For message fields, proto3_optional doesn't create any semantic change, + // since non-repeated message fields always track presence. However it still + // indicates the semantic detail of whether the user wrote "optional" or not. + // This can be useful for round-tripping the .proto file. For consistency we + // give message fields a synthetic oneof also, even though it is not required + // to track presence. This is especially important because the parser can't + // tell if a field is a message or an enum, so it must always create a + // synthetic oneof. + // + // Proto2 optional fields do not set this flag, because they already indicate + // optional with `LABEL_OPTIONAL`. + optional bool proto3_optional = 17; +} + +// Describes a oneof. +message OneofDescriptorProto { + optional string name = 1; + optional OneofOptions options = 2; +} + +// Describes an enum type. +message EnumDescriptorProto { + optional string name = 1; + + repeated EnumValueDescriptorProto value = 2; + + optional EnumOptions options = 3; + + // Range of reserved numeric values. Reserved values may not be used by + // entries in the same enum. Reserved ranges may not overlap. + // + // Note that this is distinct from DescriptorProto.ReservedRange in that it + // is inclusive such that it can appropriately represent the entire int32 + // domain. + message EnumReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Inclusive. + } + + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + repeated EnumReservedRange reserved_range = 4; + + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + repeated string reserved_name = 5; +} + +// Describes a value within an enum. +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + + optional EnumValueOptions options = 3; +} + +// Describes a service. +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + + optional ServiceOptions options = 3; +} + +// Describes a method of a service. +message MethodDescriptorProto { + optional string name = 1; + + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + optional string input_type = 2; + optional string output_type = 3; + + optional MethodOptions options = 4; + + // Identifies if client streams multiple client messages + optional bool client_streaming = 5 [default = false]; + // Identifies if server streams multiple server messages + optional bool server_streaming = 6 [default = false]; +} + +// =================================================================== +// Options + +// Each of the definitions above may have "options" attached. These are +// just annotations which may cause code to be generated slightly differently +// or may contain hints for code that manipulates protocol messages. +// +// Clients may define custom options as extensions of the *Options messages. +// These extensions may not yet be known at parsing time, so the parser cannot +// store the values in them. Instead it stores them in a field in the *Options +// message called uninterpreted_option. This field must have the same name +// across all *Options messages. We then use this field to populate the +// extensions when we build a descriptor, at which point all protos have been +// parsed and so all extensions are known. +// +// Extension numbers for custom options may be chosen as follows: +// * For options which will only be used within a single application or +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. +// * For options which will be published and used publicly by multiple +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Objective-C plugin) and your project website (if available) -- there's no +// need to explain how you intend to use them. Usually you only need one +// extension number. You can declare multiple options with only one extension +// number by putting them in a sub-message. See the Custom Options section of +// the docs for examples: +// https://developers.google.com/protocol-buffers/docs/proto#options +// If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. + +message FileOptions { + + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + optional string java_package = 1; + + // Controls the name of the wrapper Java class generated for the .proto file. + // That class will always contain the .proto file's getDescriptor() method as + // well as any top-level extensions defined in the .proto file. + // If java_multiple_files is disabled, then all the other classes from the + // .proto file will be nested inside the single wrapper outer class. + optional string java_outer_classname = 8; + + // If enabled, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the wrapper class + // named by java_outer_classname. However, the wrapper class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + optional bool java_multiple_files = 10 [default = false]; + + // This option does nothing. + optional bool java_generate_equals_and_hash = 20 [deprecated=true]; + + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + optional bool java_string_check_utf8 = 27 [default = false]; + + // Generated classes can be optimized for speed or code size. + enum OptimizeMode { + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + } + optional OptimizeMode optimize_for = 9 [default = SPEED]; + + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + optional string go_package = 11; + + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool php_generic_services = 42 [default = false]; + + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + optional bool deprecated = 23 [default = false]; + + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + optional bool cc_enable_arenas = 31 [default = true]; + + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + optional string objc_class_prefix = 36; + + // Namespace for generated classes; defaults to the package. + optional string csharp_namespace = 37; + + // By default Swift generators will take the proto package and CamelCase it + // replacing '.' with underscore and use that to prefix the types/symbols + // defined. When this options is provided, they will use this value instead + // to prefix the types/symbols defined. + optional string swift_prefix = 39; + + // Sets the php class prefix which is prepended to all php generated classes + // from this .proto. Default is empty. + optional string php_class_prefix = 40; + + // Use this option to change the namespace of php generated classes. Default + // is empty. When this option is empty, the package name will be used for + // determining the namespace. + optional string php_namespace = 41; + + // Use this option to change the namespace of php generated metadata classes. + // Default is empty. When this option is empty, the proto file name will be + // used for determining the namespace. + optional string php_metadata_namespace = 44; + + // Use this option to change the package of ruby generated classes. Default + // is empty. When this option is not set, the package name will be used for + // determining the ruby package. + optional string ruby_package = 45; + + // Any features defined in the specific edition. + optional FeatureSet features = 50; + + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. + // See the documentation for the "Options" section above. + extensions 1000 to max; + + reserved 38; +} + +message MessageOptions { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + optional bool message_set_wire_format = 1 [default = false]; + + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + optional bool no_standard_descriptor_accessor = 2 [default = false]; + + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + optional bool deprecated = 3 [default = false]; + + reserved 4, 5, 6; + + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + // + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementations still need to work as + // if the field is a repeated message field. + optional bool map_entry = 7; + + reserved 8; // javalite_serializable + reserved 9; // javanano_as_lite + + // Enable the legacy handling of JSON field name conflicts. This lowercases + // and strips underscored from the fields before comparison in proto3 only. + // The new behavior takes `json_name` into account and applies to proto2 as + // well. + // + // This should only be used as a temporary measure against broken builds due + // to the change in behavior for JSON field name conflicts. + // + // TODO(b/261750190) This is legacy behavior we plan to remove once downstream + // teams have had time to migrate. + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + + // Any features defined in the specific edition. + optional FeatureSet features = 12; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message FieldOptions { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is only implemented to support use of + // [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + // type "bytes" in the open source release -- sorry, we'll try to include + // other types in a future version! + optional CType ctype = 1 [default = STRING]; + enum CType { + // Default mode. + STRING = 0; + + // The option [ctype=CORD] may be applied to a non-repeated field of type + // "bytes". It indicates that in C++, the data should be stored in a Cord + // instead of a string. For very large strings, this may reduce memory + // fragmentation. It may also allow better performance when parsing from a + // Cord, or when parsing with aliasing enabled, as the parsed Cord may then + // alias the original buffer. + CORD = 1; + + STRING_PIECE = 2; + } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. + optional bool packed = 2; + + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + // is represented as JavaScript string, which avoids loss of precision that + // can happen when a large value is converted to a floating point JavaScript. + // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + // use the JavaScript "number" type. The behavior of the default option + // JS_NORMAL is implementation dependent. + // + // This option is an enum to permit additional types to be added, e.g. + // goog.math.Integer. + optional JSType jstype = 6 [default = JS_NORMAL]; + enum JSType { + // Use the default type. + JS_NORMAL = 0; + + // Use JavaScript strings. + JS_STRING = 1; + + // Use JavaScript numbers. + JS_NUMBER = 2; + } + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outer message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + // + // As of May 2022, lazy verifies the contents of the byte stream during + // parsing. An invalid byte stream will cause the overall parsing to fail. + optional bool lazy = 5 [default = false]; + + // unverified_lazy does no correctness checks on the byte stream. This should + // only be used where lazy with verification is prohibitive for performance + // reasons. + optional bool unverified_lazy = 15 [default = false]; + + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + optional bool deprecated = 3 [default = false]; + + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default = false]; + + // Indicate that the field value should not be printed out when using debug + // formats, e.g. when the field contains sensitive credentials. + optional bool debug_redact = 16 [default = false]; + + // If set to RETENTION_SOURCE, the option will be omitted from the binary. + // Note: as of January 2023, support for this is in progress and does not yet + // have an effect (b/264593489). + enum OptionRetention { + RETENTION_UNKNOWN = 0; + RETENTION_RUNTIME = 1; + RETENTION_SOURCE = 2; + } + + optional OptionRetention retention = 17; + + // This indicates the types of entities that the field may apply to when used + // as an option. If it is unset, then the field may be freely used as an + // option on any kind of entity. Note: as of January 2023, support for this is + // in progress and does not yet have an effect (b/264593489). + enum OptionTargetType { + TARGET_TYPE_UNKNOWN = 0; + TARGET_TYPE_FILE = 1; + TARGET_TYPE_EXTENSION_RANGE = 2; + TARGET_TYPE_MESSAGE = 3; + TARGET_TYPE_FIELD = 4; + TARGET_TYPE_ONEOF = 5; + TARGET_TYPE_ENUM = 6; + TARGET_TYPE_ENUM_ENTRY = 7; + TARGET_TYPE_SERVICE = 8; + TARGET_TYPE_METHOD = 9; + } + + repeated OptionTargetType targets = 19; + + message EditionDefault { + optional string edition = 1; + optional string value = 2; // Textproto value. + } + repeated EditionDefault edition_defaults = 20; + + // Any features defined in the specific edition. + optional FeatureSet features = 21; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; + + reserved 4; // removed jtype + optional OptionTargetType target_obsolete_do_not_use = 18 [deprecated = true]; +} + +message OneofOptions { + // Any features defined in the specific edition. + optional FeatureSet features = 1; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumOptions { + + // Set this option to true to allow mapping different tag names to the same + // value. + optional bool allow_alias = 2; + + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + optional bool deprecated = 3 [default = false]; + + reserved 5; // javanano_as_lite + + // Enable the legacy handling of JSON field name conflicts. This lowercases + // and strips underscored from the fields before comparison in proto3 only. + // The new behavior takes `json_name` into account and applies to proto2 as + // well. + // TODO(b/261750190) Remove this legacy behavior once downstream teams have + // had time to migrate. + optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; + + // Any features defined in the specific edition. + optional FeatureSet features = 7; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumValueOptions { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + optional bool deprecated = 1 [default = false]; + + // Any features defined in the specific edition. + optional FeatureSet features = 2; + + // Indicate that fields annotated with this enum value should not be printed + // out when using debug formats, e.g. when the field contains sensitive + // credentials. + optional bool debug_redact = 3 [default = false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message ServiceOptions { + + // Any features defined in the specific edition. + optional FeatureSet features = 34; + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + optional bool deprecated = 33 [default = false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MethodOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + optional bool deprecated = 33 [default = false]; + + // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + // or neither? HTTP based RPC implementation may choose GET verb for safe + // methods, and PUT verb for idempotent methods instead of the default POST. + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0; + NO_SIDE_EFFECTS = 1; // implies idempotent + IDEMPOTENT = 2; // idempotent, but may have side effects + } + optional IdempotencyLevel idempotency_level = 34 + [default = IDEMPOTENCY_UNKNOWN]; + + // Any features defined in the specific edition. + optional FeatureSet features = 35; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +message UninterpretedOption { + // The name of the uninterpreted option. Each string represents a segment in + // a dot-separated name. is_extension is true iff a segment represents an + // extension (denoted with parentheses in options specs in .proto files). + // E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + // "foo.(bar.baz).moo". + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } + repeated NamePart name = 2; + + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; +} + +// =================================================================== +// Features + +// TODO(b/274655146) Enums in C++ gencode (and potentially other languages) are +// not well scoped. This means that each of the feature enums below can clash +// with each other. The short names we've chosen maximize call-site +// readability, but leave us very open to this scenario. A future feature will +// be designed and implemented to handle this, hopefully before we ever hit a +// conflict here. +message FeatureSet { + enum FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0; + EXPLICIT = 1; + IMPLICIT = 2; + LEGACY_REQUIRED = 3; + } + optional FieldPresence field_presence = 1 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_FILE, + edition_defaults = { edition: "2023", value: "EXPLICIT" } + ]; + + enum EnumType { + ENUM_TYPE_UNKNOWN = 0; + OPEN = 1; + CLOSED = 2; + } + optional EnumType enum_type = 2 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_ENUM, + targets = TARGET_TYPE_FILE, + edition_defaults = { edition: "2023", value: "OPEN" } + ]; + + enum RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0; + PACKED = 1; + EXPANDED = 2; + } + optional RepeatedFieldEncoding repeated_field_encoding = 3 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_FILE, + edition_defaults = { edition: "2023", value: "PACKED" } + ]; + + enum StringFieldValidation { + STRING_FIELD_VALIDATION_UNKNOWN = 0; + MANDATORY = 1; + HINT = 2; + NONE = 3; + } + optional StringFieldValidation string_field_validation = 4 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_FILE, + edition_defaults = { edition: "2023", value: "MANDATORY" } + ]; + + enum MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0; + LENGTH_PREFIXED = 1; + DELIMITED = 2; + } + optional MessageEncoding message_encoding = 5 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_FILE, + edition_defaults = { edition: "2023", value: "LENGTH_PREFIXED" } + ]; + + enum JsonFormat { + JSON_FORMAT_UNKNOWN = 0; + ALLOW = 1; + LEGACY_BEST_EFFORT = 2; + } + optional JsonFormat json_format = 6 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_MESSAGE, + targets = TARGET_TYPE_ENUM, + targets = TARGET_TYPE_FILE, + edition_defaults = { edition: "2023", value: "ALLOW" } + ]; + + extensions 1000; // for Protobuf C++ + extensions 1001; // for Protobuf Java + + extensions 9995 to 9999; // For internal testing +} + +// =================================================================== +// Optional source code info + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +message SourceCodeInfo { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendant. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + repeated Location location = 1; + message Location { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition occurs. + // For example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + repeated int32 path = 1 [packed = true]; + + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + repeated int32 span = 2 [packed = true]; + + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to moo. + // // + // // Another line attached to moo. + // optional double moo = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to moo or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + optional string leading_comments = 3; + optional string trailing_comments = 4; + repeated string leading_detached_comments = 6; + } +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +message GeneratedCodeInfo { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + repeated Annotation annotation = 1; + message Annotation { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + repeated int32 path = 1 [packed = true]; + + // Identifies the filesystem path to the original source .proto. + optional string source_file = 2; + + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + optional int32 begin = 3; + + // Identifies the ending offset in bytes in the generated code that + // relates to the identified object. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + optional int32 end = 4; + + // Represents the identified object's effect on the element in the original + // .proto file. + enum Semantic { + // There is no effect or the effect is indescribable. + NONE = 0; + // The element is set or otherwise mutated. + SET = 1; + // An alias to the element is returned. + ALIAS = 2; + } + optional Semantic semantic = 5; + } +} \ No newline at end of file diff --git a/proto/v1/bo.proto b/proto/v1/bo.proto new file mode 100644 index 0000000..d54e0cf --- /dev/null +++ b/proto/v1/bo.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +option go_package = "github.com/esh2n/grapevineer/gen/go/grapevineer"; + +// Bo Related... + +message SetBoScriptRequest { + string script = 1; +} + +message SetBoScriptResponse { + int32 status = 1; +} + +message GetBoScriptRandomlyRequest { +} + +message GetBoScriptRandomlyResponse { + string bo_id = 1; + string script = 2; +} diff --git a/proto/v1/grapevineer.proto b/proto/v1/grapevineer.proto index 1d979a8..2a92a98 100644 --- a/proto/v1/grapevineer.proto +++ b/proto/v1/grapevineer.proto @@ -4,6 +4,7 @@ package grapevineer; import "google/api/annotations.proto"; +import "v1/bo.proto"; import "v1/player.proto"; import "v1/og_image.proto"; import "v1/flower_meaning.proto"; @@ -59,4 +60,14 @@ service Grapevineer { get: "/v1/wav_from_text" }; } + rpc SetBoScript(SetBoScriptRequest) returns (SetBoScriptResponse) { + option (google.api.http) = { + post: "/v1/bo_script" + }; + } + rpc GetBoScriptRandomly(GetBoScriptRandomlyRequest) returns (GetBoScriptRandomlyResponse) { + option (google.api.http) = { + get: "/v1/bo_script" + }; + } } \ No newline at end of file