From e50d7ebe0f93d2507b65463df86a1812a2189a55 Mon Sep 17 00:00:00 2001 From: nownabe Date: Sat, 19 Aug 2023 15:51:29 +0900 Subject: [PATCH] Integrate API with Redirector --- api/api.go | 12 - api/dto_internal_test.go | 3 - api/repository.go | 193 --- {api => backend}/.envrc.example | 0 {api => backend}/api_handler.go | 24 +- backend/app.go | 34 +- backend/cmd/backend/main.go | 74 +- {api => backend}/debug_service.go | 2 +- {api => backend}/dto.go | 2 +- backend/gen/golink/v1/debug.pb.go | 200 +++ backend/gen/golink/v1/golink.pb.go | 1404 +++++++++++++++++ .../v1/golinkv1connect/debug.connect.go | 104 ++ .../v1/golinkv1connect/golink.connect.go | 318 ++++ backend/go.mod | 1 + backend/go.sum | 2 + api/service.go => backend/golink_service.go | 2 +- .../golink_service_test.go | 2 +- {api => backend}/interceptor/interceptors.go | 0 backend/repository.go | 189 +++ buf.gen.yaml | 6 +- console/package.json | 2 +- 21 files changed, 2330 insertions(+), 244 deletions(-) delete mode 100644 api/dto_internal_test.go rename {api => backend}/.envrc.example (100%) rename {api => backend}/api_handler.go (69%) rename {api => backend}/debug_service.go (98%) rename {api => backend}/dto.go (97%) create mode 100644 backend/gen/golink/v1/debug.pb.go create mode 100644 backend/gen/golink/v1/golink.pb.go create mode 100644 backend/gen/golink/v1/golinkv1connect/debug.connect.go create mode 100644 backend/gen/golink/v1/golinkv1connect/golink.connect.go rename api/service.go => backend/golink_service.go (99%) rename api/service_test.go => backend/golink_service_test.go (99%) rename {api => backend}/interceptor/interceptors.go (100%) diff --git a/api/api.go b/api/api.go index fa28f893..96442ebe 100644 --- a/api/api.go +++ b/api/api.go @@ -11,7 +11,6 @@ import ( "cloud.google.com/go/firestore" "github.com/nownabe/golink/go/clog" "github.com/nownabe/golink/go/errors" - "github.com/rs/cors" "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" ) @@ -98,14 +97,3 @@ func (a *api) serve(ctx context.Context) error { return nil } - -func (a *api) cors(h http.Handler) http.Handler { - c := cors.New(cors.Options{ - AllowedOrigins: a.allowedOrigins, - AllowedMethods: []string{"GET", "POST", "OPTIONS"}, - AllowCredentials: true, - AllowedHeaders: []string{"*"}, - }) - - return c.Handler(h) -} diff --git a/api/dto_internal_test.go b/api/dto_internal_test.go deleted file mode 100644 index 7322a745..00000000 --- a/api/dto_internal_test.go +++ /dev/null @@ -1,3 +0,0 @@ -package api - -type DTO = dto diff --git a/api/repository.go b/api/repository.go index a0696eab..373bfc6a 100644 --- a/api/repository.go +++ b/api/repository.go @@ -1,14 +1,8 @@ package api import ( - "context" - "time" - "cloud.google.com/go/firestore" "github.com/nownabe/golink/go/errors" - "google.golang.org/api/iterator" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) const collectionName = "golinks" @@ -18,190 +12,3 @@ var errDocumentNotFound = errors.NewWithoutStack("not found") type repository struct { firestore *firestore.Client } - -func (r *repository) Transaction( - ctx context.Context, - f func(ctx context.Context, tx *firestore.Transaction) error, -) error { - return r.firestore.RunTransaction(ctx, f) -} - -func (r *repository) TxExists(ctx context.Context, tx *firestore.Transaction, name string) (bool, error) { - col := r.collection() - doc := col.Doc(nameToID(name)) - - s, err := tx.Get(doc) - if status.Code(err) == codes.NotFound { - return false, nil - } - if err != nil { - return false, errors.Wrapf(err, "failed to get %s", doc.Path) - } - - return s.Exists(), nil -} - -func (r *repository) Get(ctx context.Context, name string) (*dto, error) { - col := r.collection() - doc := col.Doc(nameToID(name)) - - s, err := doc.Get(ctx) - if status.Code(err) == codes.NotFound { - return nil, errors.Wrapf(errDocumentNotFound, "%s not found", doc.Path) - } - - if err != nil { - return nil, errors.Wrapf(err, "failed to get %s", doc.Path) - } - var o dto - if err := s.DataTo(&o); err != nil { - return nil, errors.Wrapf(err, "failed to populate %s", doc.Path) - } - - return &o, nil -} - -func (r *repository) TxGet(ctx context.Context, tx *firestore.Transaction, name string) (*dto, error) { - col := r.collection() - doc := col.Doc(nameToID(name)) - - s, err := tx.Get(doc) - if status.Code(err) == codes.NotFound { - return nil, errors.Wrapf(errDocumentNotFound, "%s not found", doc.Path) - } - if err != nil { - return nil, errors.Wrapf(err, "failed to get %s", doc.Path) - } - - var o dto - if err := s.DataTo(&o); err != nil { - return nil, errors.Wrapf(err, "failed to populate %s", doc.Path) - } - - return &o, nil -} - -func (r *repository) TxCreate(ctx context.Context, tx *firestore.Transaction, dto *dto) error { - col := r.collection() - doc := col.Doc(dto.ID()) - - dto.CreatedAt = time.Now() - dto.UpdatedAt = time.Now() - - if err := tx.Create(doc, dto); err != nil { - return errors.Wrapf(err, "failed to create %s", doc.Path) - } - - return nil -} - -func (r *repository) ListByOwner(ctx context.Context, owner string) ([]*dto, error) { - col := r.collection() - iter := col.Where("owners", "array-contains", owner).Documents(ctx) - defer iter.Stop() - - var dtos []*dto - for { - s, err := iter.Next() - if err == iterator.Done { - break - } - if err != nil { - return nil, errors.Wrapf(err, "failed to iterate %s", col.Path) - } - - var o dto - if err := s.DataTo(&o); err != nil { - return nil, errors.Wrapf(err, "failed to populate %s", s.Ref.Path) - } - - dtos = append(dtos, &o) - } - - return dtos, nil -} - -func (r *repository) ListByURL(ctx context.Context, url string) ([]*dto, error) { - col := r.collection() - iter := col.Where("url", "==", url).Documents(ctx) - defer iter.Stop() - - var dtos []*dto - for { - s, err := iter.Next() - if err == iterator.Done { - break - } - if err != nil { - return nil, errors.Wrapf(err, "failed to iterate %s", col.Path) - } - - var o dto - if err := s.DataTo(&o); err != nil { - return nil, errors.Wrapf(err, "failed to populate %s", s.Ref.Path) - } - - dtos = append(dtos, &o) - } - - return dtos, nil -} - -func (r *repository) TxUpdate(ctx context.Context, tx *firestore.Transaction, dto *dto) error { - col := r.collection() - doc := col.Doc(dto.ID()) - - dto.UpdatedAt = time.Now() - - if err := tx.Update(doc, []firestore.Update{ - {Path: "url", Value: dto.URL}, - {Path: "updated_at", Value: dto.UpdatedAt}, - }); err != nil { - return errors.Wrapf(err, "failed to update %s", doc.Path) - } - - return nil -} - -func (r *repository) TxDelete(ctx context.Context, tx *firestore.Transaction, name string) error { - col := r.collection() - doc := col.Doc(nameToID(name)) - - if err := tx.Delete(doc); err != nil { - return errors.Wrapf(err, "failed to delete %s", doc.Path) - } - - return nil -} - -func (r *repository) TxAddOwner(ctx context.Context, tx *firestore.Transaction, name string, owner string) error { - col := r.collection() - doc := col.Doc(nameToID(name)) - - if err := tx.Update(doc, []firestore.Update{ - {Path: "owners", Value: firestore.ArrayUnion(owner)}, - {Path: "updated_at", Value: time.Now()}, - }); err != nil { - return errors.Wrapf(err, "failed to update %s", doc.Path) - } - - return nil -} - -func (r *repository) TxRemoveOwner(ctx context.Context, tx *firestore.Transaction, name string, owner string) error { - col := r.collection() - doc := col.Doc(nameToID(name)) - - if err := tx.Update(doc, []firestore.Update{ - {Path: "owners", Value: firestore.ArrayRemove(owner)}, - {Path: "updated_at", Value: time.Now()}, - }); err != nil { - return errors.Wrapf(err, "failed to update %s", doc.Path) - } - - return nil -} - -func (r *repository) collection() *firestore.CollectionRef { - return r.firestore.Collection(collectionName) -} diff --git a/api/.envrc.example b/backend/.envrc.example similarity index 100% rename from api/.envrc.example rename to backend/.envrc.example diff --git a/api/api_handler.go b/backend/api_handler.go similarity index 69% rename from api/api_handler.go rename to backend/api_handler.go index fa765b80..dee910ed 100644 --- a/api/api_handler.go +++ b/backend/api_handler.go @@ -1,4 +1,4 @@ -package api +package backend import ( "net/http" @@ -7,16 +7,10 @@ import ( "github.com/bufbuild/connect-go" "github.com/nownabe/golink/api/gen/golink/v1/golinkv1connect" - "github.com/nownabe/golink/api/interceptor" + "github.com/nownabe/golink/backend/interceptor" ) -type APIConfig struct { - Prefix string - Debug bool - DummyUser string -} - -func newAPIHandler(cfg *APIConfig, repo *repository) http.Handler { +func newAPIHandler(repo *repository, debug bool, dummyUser string) http.Handler { // TODO: Move interceptors to route http middlewares interceptors := []connect.Interceptor{ // outermost @@ -28,8 +22,8 @@ func newAPIHandler(cfg *APIConfig, repo *repository) http.Handler { // innermost } - if cfg.DummyUser != "" { - u := strings.Split(cfg.DummyUser, ":") + if dummyUser != "" { + u := strings.Split(dummyUser, ":") interceptors = append([]connect.Interceptor{interceptor.NewDummyUser(u[0], u[1])}, interceptors...) } @@ -40,7 +34,7 @@ func newAPIHandler(cfg *APIConfig, repo *repository) http.Handler { svc := &golinkService{repo} grpcHandler.Handle(golinkv1connect.NewGolinkServiceHandler(svc, interceptorsOpt)) - if cfg.Debug { + if debug { grpcHandler.Handle(golinkv1connect.NewDebugServiceHandler(&debugService{}, interceptorsOpt)) } @@ -49,11 +43,7 @@ func newAPIHandler(cfg *APIConfig, repo *repository) http.Handler { grpcHandler.HandleFunc("/", http.NotFound) - // https://connectrpc.com/docs/go/routing#prefixing-routes - prefixedMux := http.NewServeMux() - prefixedMux.Handle(cfg.Prefix+"/", http.StripPrefix(cfg.Prefix, grpcHandler)) - - return prefixedMux + return grpcHandler } func healthz(w http.ResponseWriter, _ *http.Request) { diff --git a/backend/app.go b/backend/app.go index 2fc17ac3..b205ee56 100644 --- a/backend/app.go +++ b/backend/app.go @@ -11,6 +11,9 @@ import ( "cloud.google.com/go/firestore" "github.com/nownabe/golink/go/clog" "github.com/nownabe/golink/go/errors" + "github.com/rs/cors" + "golang.org/x/net/http2" + "golang.org/x/net/http2/h2c" ) const ( @@ -25,23 +28,33 @@ type App interface { // New returns a new backend app. func New( port string, + allowedOrigins []string, + apiPrefix string, consolePrefix string, firestoreClient *firestore.Client, + debug bool, + dummyUser string, ) App { repo := &repository{firestoreClient} return &app{ - port: port, + port: port, + allowedOrigins: allowedOrigins, + apiPrefix: apiPrefix, redirectHandler: &redirectHandler{ consolePrefix: consolePrefix, repo: repo, }, + apiHandler: newAPIHandler(repo, debug, dummyUser), } } type app struct { port string + allowedOrigins []string + apiPrefix string redirectHandler http.Handler + apiHandler http.Handler } func (a *app) Run(ctx context.Context) error { @@ -49,9 +62,15 @@ func (a *app) Run(ctx context.Context) error { } func (a *app) serve(ctx context.Context) error { + mux := http.NewServeMux() + // https://connectrpc.com/docs/go/routing#prefixing-routes + mux.Handle(a.apiPrefix+"/", http.StripPrefix(a.apiPrefix, a.apiHandler)) + mux.Handle("/", a.redirectHandler) + + h2s := &http2.Server{} s := &http.Server{ Addr: ":" + a.port, - Handler: a.redirectHandler, + Handler: a.cors(h2c.NewHandler(mux, h2s)), ReadHeaderTimeout: readHeaderTimeoutSeconds * time.Second, } @@ -86,3 +105,14 @@ func (a *app) serve(ctx context.Context) error { return nil } + +func (a *app) cors(h http.Handler) http.Handler { + c := cors.New(cors.Options{ + AllowedOrigins: a.allowedOrigins, + AllowedMethods: []string{"GET", "POST", "OPTIONS"}, + AllowCredentials: true, + AllowedHeaders: []string{"*"}, + }) + + return c.Handler(h) +} diff --git a/backend/cmd/backend/main.go b/backend/cmd/backend/main.go index c64c832d..b2f4a0e6 100644 --- a/backend/cmd/backend/main.go +++ b/backend/cmd/backend/main.go @@ -3,11 +3,19 @@ package main import ( "context" "os" + "strings" "cloud.google.com/go/compute/metadata" "cloud.google.com/go/firestore" + texporter "github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace" "github.com/nownabe/golink/go/clog" "github.com/nownabe/golink/go/errors" + "go.opentelemetry.io/contrib/detectors/gcp" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/sdk/resource" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" "github.com/nownabe/golink/backend" ) @@ -15,31 +23,52 @@ import ( func main() { clog.SetDefault(clog.New(os.Stdout, clog.LevelInfo)) + ctx := context.Background() + + app, err := buildApp(ctx) + if err != nil { + clog.AlertErr(ctx, errors.Wrap(err, "failed to build app")) + os.Exit(1) + } + + if err := app.Run(ctx); err != nil { + clog.AlertErr(ctx, errors.Wrap(err, "failed to run redirector")) + } +} + +func buildApp(ctx context.Context) (backend.App, error) { port := os.Getenv("PORT") if port == "" { port = "8080" } - ctx := context.Background() - projectID, err := getProjectID(ctx) if err != nil { - clog.AlertErr(ctx, err) - os.Exit(1) + return nil, errors.Wrap(err, "failed to get project ID") } clog.Infof(ctx, "project ID: %s", projectID) + clog.SetContextHandler(projectID) + + origins := strings.Split(os.Getenv("ALLOWED_ORIGINS"), ",") + clog.Infof(ctx, "Allowed origins: %v", origins) fsClient, err := firestore.NewClient(ctx, projectID) if err != nil { - clog.AlertErr(ctx, errors.Wrap(err, "failed to create firestore client")) - os.Exit(1) + return nil, errors.Wrap(err, "failed to create Firestore client") } - app := backend.New(port, "/c/", fsClient) + if err := setOtel(ctx, projectID); err != nil { + return nil, errors.Wrap(err, "failed to get tracer") + } - if err := app.Run(ctx); err != nil { - clog.AlertErr(ctx, errors.Wrap(err, "failed to run redirector")) + debug := false + if isDebug := strings.ToLower(os.Getenv("DEBUG")); isDebug == "true" { + debug = true } + + dummyUser := os.Getenv("USE_DUMMY_USER") + + return backend.New(port, origins, "/api", "/c/", fsClient, debug, dummyUser), nil } func getProjectID(ctx context.Context) (string, error) { @@ -57,3 +86,30 @@ func getProjectID(ctx context.Context) (string, error) { return projectID, nil } + +func setOtel(ctx context.Context, projectID string) error { + exporter, err := texporter.New(texporter.WithProjectID(projectID)) + if err != nil { + return errors.Wrapf(err, "failed to create exporter with project ID %s", projectID) + } + + res, err := resource.New(ctx, + resource.WithDetectors(gcp.NewDetector()), + resource.WithTelemetrySDK(), + resource.WithAttributes( + semconv.ServiceNameKey.String("golink-api"), + ), + ) + if err != nil { + return errors.Wrap(err, "failed to create resource") + } + + tp := sdktrace.NewTracerProvider( + sdktrace.WithBatcher(exporter), + sdktrace.WithResource(res), + ) + otel.SetTracerProvider(tp) + otel.SetTextMapPropagator(propagation.TraceContext{}) + + return nil +} diff --git a/api/debug_service.go b/backend/debug_service.go similarity index 98% rename from api/debug_service.go rename to backend/debug_service.go index a45717ab..9386fc6b 100644 --- a/api/debug_service.go +++ b/backend/debug_service.go @@ -1,4 +1,4 @@ -package api +package backend import ( "context" diff --git a/api/dto.go b/backend/dto.go similarity index 97% rename from api/dto.go rename to backend/dto.go index 340bdc53..e03ed2af 100644 --- a/api/dto.go +++ b/backend/dto.go @@ -1,4 +1,4 @@ -package api +package backend import ( "strings" diff --git a/backend/gen/golink/v1/debug.pb.go b/backend/gen/golink/v1/debug.pb.go new file mode 100644 index 00000000..6687b1ad --- /dev/null +++ b/backend/gen/golink/v1/debug.pb.go @@ -0,0 +1,200 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: golink/v1/debug.proto + +package golinkv1 + +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 DebugRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DebugRequest) Reset() { + *x = DebugRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_debug_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DebugRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebugRequest) ProtoMessage() {} + +func (x *DebugRequest) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_debug_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 DebugRequest.ProtoReflect.Descriptor instead. +func (*DebugRequest) Descriptor() ([]byte, []int) { + return file_golink_v1_debug_proto_rawDescGZIP(), []int{0} +} + +type DebugResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DebugResponse) Reset() { + *x = DebugResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_debug_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DebugResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebugResponse) ProtoMessage() {} + +func (x *DebugResponse) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_debug_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 DebugResponse.ProtoReflect.Descriptor instead. +func (*DebugResponse) Descriptor() ([]byte, []int) { + return file_golink_v1_debug_proto_rawDescGZIP(), []int{1} +} + +var File_golink_v1_debug_proto protoreflect.FileDescriptor + +var file_golink_v1_debug_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x62, 0x75, + 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, + 0x76, 0x31, 0x22, 0x0e, 0x0a, 0x0c, 0x44, 0x65, 0x62, 0x75, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x0f, 0x0a, 0x0d, 0x44, 0x65, 0x62, 0x75, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x32, 0x4c, 0x0a, 0x0c, 0x44, 0x65, 0x62, 0x75, 0x67, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x3c, 0x0a, 0x05, 0x44, 0x65, 0x62, 0x75, 0x67, 0x12, 0x17, 0x2e, 0x67, + 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, + 0x31, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x42, 0x9a, 0x01, 0x0a, 0x0d, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, + 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6f, + 0x77, 0x6e, 0x61, 0x62, 0x65, 0x2f, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2f, 0x62, 0x61, 0x63, + 0x6b, 0x65, 0x6e, 0x64, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2f, + 0x76, 0x31, 0x3b, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x47, 0x58, + 0x58, 0xaa, 0x02, 0x09, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x09, + 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x15, 0x47, 0x6f, 0x6c, 0x69, + 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x0a, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_golink_v1_debug_proto_rawDescOnce sync.Once + file_golink_v1_debug_proto_rawDescData = file_golink_v1_debug_proto_rawDesc +) + +func file_golink_v1_debug_proto_rawDescGZIP() []byte { + file_golink_v1_debug_proto_rawDescOnce.Do(func() { + file_golink_v1_debug_proto_rawDescData = protoimpl.X.CompressGZIP(file_golink_v1_debug_proto_rawDescData) + }) + return file_golink_v1_debug_proto_rawDescData +} + +var file_golink_v1_debug_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_golink_v1_debug_proto_goTypes = []interface{}{ + (*DebugRequest)(nil), // 0: golink.v1.DebugRequest + (*DebugResponse)(nil), // 1: golink.v1.DebugResponse +} +var file_golink_v1_debug_proto_depIdxs = []int32{ + 0, // 0: golink.v1.DebugService.Debug:input_type -> golink.v1.DebugRequest + 1, // 1: golink.v1.DebugService.Debug:output_type -> golink.v1.DebugResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] 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_golink_v1_debug_proto_init() } +func file_golink_v1_debug_proto_init() { + if File_golink_v1_debug_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_golink_v1_debug_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DebugRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_debug_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DebugResponse); 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_golink_v1_debug_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_golink_v1_debug_proto_goTypes, + DependencyIndexes: file_golink_v1_debug_proto_depIdxs, + MessageInfos: file_golink_v1_debug_proto_msgTypes, + }.Build() + File_golink_v1_debug_proto = out.File + file_golink_v1_debug_proto_rawDesc = nil + file_golink_v1_debug_proto_goTypes = nil + file_golink_v1_debug_proto_depIdxs = nil +} diff --git a/backend/gen/golink/v1/golink.pb.go b/backend/gen/golink/v1/golink.pb.go new file mode 100644 index 00000000..e442c6d7 --- /dev/null +++ b/backend/gen/golink/v1/golink.pb.go @@ -0,0 +1,1404 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: golink/v1/golink.proto + +package golinkv1 + +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 Golink struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + Owners []string `protobuf:"bytes,3,rep,name=owners,proto3" json:"owners,omitempty"` +} + +func (x *Golink) Reset() { + *x = Golink{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Golink) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Golink) ProtoMessage() {} + +func (x *Golink) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_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 Golink.ProtoReflect.Descriptor instead. +func (*Golink) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{0} +} + +func (x *Golink) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Golink) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *Golink) GetOwners() []string { + if x != nil { + return x.Owners + } + return nil +} + +type CreateGolinkRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` +} + +func (x *CreateGolinkRequest) Reset() { + *x = CreateGolinkRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateGolinkRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateGolinkRequest) ProtoMessage() {} + +func (x *CreateGolinkRequest) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_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 CreateGolinkRequest.ProtoReflect.Descriptor instead. +func (*CreateGolinkRequest) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateGolinkRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateGolinkRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +type CreateGolinkResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Golink *Golink `protobuf:"bytes,1,opt,name=golink,proto3" json:"golink,omitempty"` +} + +func (x *CreateGolinkResponse) Reset() { + *x = CreateGolinkResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateGolinkResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateGolinkResponse) ProtoMessage() {} + +func (x *CreateGolinkResponse) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_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 CreateGolinkResponse.ProtoReflect.Descriptor instead. +func (*CreateGolinkResponse) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateGolinkResponse) GetGolink() *Golink { + if x != nil { + return x.Golink + } + return nil +} + +type GetGolinkRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetGolinkRequest) Reset() { + *x = GetGolinkRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGolinkRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGolinkRequest) ProtoMessage() {} + +func (x *GetGolinkRequest) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_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 GetGolinkRequest.ProtoReflect.Descriptor instead. +func (*GetGolinkRequest) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{3} +} + +func (x *GetGolinkRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetGolinkResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Golink *Golink `protobuf:"bytes,1,opt,name=golink,proto3" json:"golink,omitempty"` +} + +func (x *GetGolinkResponse) Reset() { + *x = GetGolinkResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGolinkResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGolinkResponse) ProtoMessage() {} + +func (x *GetGolinkResponse) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[4] + 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 GetGolinkResponse.ProtoReflect.Descriptor instead. +func (*GetGolinkResponse) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{4} +} + +func (x *GetGolinkResponse) GetGolink() *Golink { + if x != nil { + return x.Golink + } + return nil +} + +type ListGolinksRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (x *ListGolinksRequest) Reset() { + *x = ListGolinksRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListGolinksRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListGolinksRequest) ProtoMessage() {} + +func (x *ListGolinksRequest) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[5] + 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 ListGolinksRequest.ProtoReflect.Descriptor instead. +func (*ListGolinksRequest) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{5} +} + +func (x *ListGolinksRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +type ListGolinksResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Golinks []*Golink `protobuf:"bytes,1,rep,name=golinks,proto3" json:"golinks,omitempty"` +} + +func (x *ListGolinksResponse) Reset() { + *x = ListGolinksResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListGolinksResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListGolinksResponse) ProtoMessage() {} + +func (x *ListGolinksResponse) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[6] + 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 ListGolinksResponse.ProtoReflect.Descriptor instead. +func (*ListGolinksResponse) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{6} +} + +func (x *ListGolinksResponse) GetGolinks() []*Golink { + if x != nil { + return x.Golinks + } + return nil +} + +type ListGolinksByUrlRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` +} + +func (x *ListGolinksByUrlRequest) Reset() { + *x = ListGolinksByUrlRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListGolinksByUrlRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListGolinksByUrlRequest) ProtoMessage() {} + +func (x *ListGolinksByUrlRequest) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[7] + 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 ListGolinksByUrlRequest.ProtoReflect.Descriptor instead. +func (*ListGolinksByUrlRequest) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{7} +} + +func (x *ListGolinksByUrlRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +type ListGolinksByUrlResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Golinks []*Golink `protobuf:"bytes,1,rep,name=golinks,proto3" json:"golinks,omitempty"` +} + +func (x *ListGolinksByUrlResponse) Reset() { + *x = ListGolinksByUrlResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListGolinksByUrlResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListGolinksByUrlResponse) ProtoMessage() {} + +func (x *ListGolinksByUrlResponse) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[8] + 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 ListGolinksByUrlResponse.ProtoReflect.Descriptor instead. +func (*ListGolinksByUrlResponse) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{8} +} + +func (x *ListGolinksByUrlResponse) GetGolinks() []*Golink { + if x != nil { + return x.Golinks + } + return nil +} + +type UpdateGolinkRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` +} + +func (x *UpdateGolinkRequest) Reset() { + *x = UpdateGolinkRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateGolinkRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateGolinkRequest) ProtoMessage() {} + +func (x *UpdateGolinkRequest) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[9] + 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 UpdateGolinkRequest.ProtoReflect.Descriptor instead. +func (*UpdateGolinkRequest) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{9} +} + +func (x *UpdateGolinkRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateGolinkRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +type UpdateGolinkResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Golink *Golink `protobuf:"bytes,1,opt,name=golink,proto3" json:"golink,omitempty"` +} + +func (x *UpdateGolinkResponse) Reset() { + *x = UpdateGolinkResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateGolinkResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateGolinkResponse) ProtoMessage() {} + +func (x *UpdateGolinkResponse) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[10] + 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 UpdateGolinkResponse.ProtoReflect.Descriptor instead. +func (*UpdateGolinkResponse) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{10} +} + +func (x *UpdateGolinkResponse) GetGolink() *Golink { + if x != nil { + return x.Golink + } + return nil +} + +type DeleteGolinkRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *DeleteGolinkRequest) Reset() { + *x = DeleteGolinkRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteGolinkRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteGolinkRequest) ProtoMessage() {} + +func (x *DeleteGolinkRequest) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[11] + 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 DeleteGolinkRequest.ProtoReflect.Descriptor instead. +func (*DeleteGolinkRequest) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{11} +} + +func (x *DeleteGolinkRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteGolinkResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteGolinkResponse) Reset() { + *x = DeleteGolinkResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteGolinkResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteGolinkResponse) ProtoMessage() {} + +func (x *DeleteGolinkResponse) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[12] + 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 DeleteGolinkResponse.ProtoReflect.Descriptor instead. +func (*DeleteGolinkResponse) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{12} +} + +type AddOwnerRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` // email +} + +func (x *AddOwnerRequest) Reset() { + *x = AddOwnerRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddOwnerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddOwnerRequest) ProtoMessage() {} + +func (x *AddOwnerRequest) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[13] + 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 AddOwnerRequest.ProtoReflect.Descriptor instead. +func (*AddOwnerRequest) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{13} +} + +func (x *AddOwnerRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *AddOwnerRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +type AddOwnerResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Golink *Golink `protobuf:"bytes,1,opt,name=golink,proto3" json:"golink,omitempty"` +} + +func (x *AddOwnerResponse) Reset() { + *x = AddOwnerResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddOwnerResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddOwnerResponse) ProtoMessage() {} + +func (x *AddOwnerResponse) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[14] + 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 AddOwnerResponse.ProtoReflect.Descriptor instead. +func (*AddOwnerResponse) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{14} +} + +func (x *AddOwnerResponse) GetGolink() *Golink { + if x != nil { + return x.Golink + } + return nil +} + +type RemoveOwnerRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` // email +} + +func (x *RemoveOwnerRequest) Reset() { + *x = RemoveOwnerRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveOwnerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveOwnerRequest) ProtoMessage() {} + +func (x *RemoveOwnerRequest) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[15] + 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 RemoveOwnerRequest.ProtoReflect.Descriptor instead. +func (*RemoveOwnerRequest) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{15} +} + +func (x *RemoveOwnerRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RemoveOwnerRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +type RemoveOwnerResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Golink *Golink `protobuf:"bytes,1,opt,name=golink,proto3" json:"golink,omitempty"` +} + +func (x *RemoveOwnerResponse) Reset() { + *x = RemoveOwnerResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveOwnerResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveOwnerResponse) ProtoMessage() {} + +func (x *RemoveOwnerResponse) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[16] + 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 RemoveOwnerResponse.ProtoReflect.Descriptor instead. +func (*RemoveOwnerResponse) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{16} +} + +func (x *RemoveOwnerResponse) GetGolink() *Golink { + if x != nil { + return x.Golink + } + return nil +} + +type GetMeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetMeRequest) Reset() { + *x = GetMeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMeRequest) ProtoMessage() {} + +func (x *GetMeRequest) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[17] + 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 GetMeRequest.ProtoReflect.Descriptor instead. +func (*GetMeRequest) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{17} +} + +type GetMeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + IsAdmin bool `protobuf:"varint,2,opt,name=is_admin,json=isAdmin,proto3" json:"is_admin,omitempty"` +} + +func (x *GetMeResponse) Reset() { + *x = GetMeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_golink_v1_golink_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMeResponse) ProtoMessage() {} + +func (x *GetMeResponse) ProtoReflect() protoreflect.Message { + mi := &file_golink_v1_golink_proto_msgTypes[18] + 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 GetMeResponse.ProtoReflect.Descriptor instead. +func (*GetMeResponse) Descriptor() ([]byte, []int) { + return file_golink_v1_golink_proto_rawDescGZIP(), []int{18} +} + +func (x *GetMeResponse) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *GetMeResponse) GetIsAdmin() bool { + if x != nil { + return x.IsAdmin + } + return false +} + +var File_golink_v1_golink_proto protoreflect.FileDescriptor + +var file_golink_v1_golink_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x6f, 0x6c, 0x69, + 0x6e, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, + 0x2e, 0x76, 0x31, 0x22, 0x46, 0x0a, 0x06, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x75, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x22, 0x3b, 0x0a, 0x13, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x41, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x29, 0x0a, 0x06, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x6f, 0x6c, + 0x69, 0x6e, 0x6b, 0x52, 0x06, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x26, 0x0a, 0x10, 0x47, + 0x65, 0x74, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x22, 0x3e, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x67, 0x6f, 0x6c, 0x69, + 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, + 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x06, 0x67, 0x6f, 0x6c, + 0x69, 0x6e, 0x6b, 0x22, 0x2a, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x47, 0x6f, 0x6c, 0x69, 0x6e, + 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x22, + 0x42, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x07, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, + 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x07, 0x67, 0x6f, 0x6c, 0x69, + 0x6e, 0x6b, 0x73, 0x22, 0x2b, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x47, 0x6f, 0x6c, 0x69, 0x6e, + 0x6b, 0x73, 0x42, 0x79, 0x55, 0x72, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, + 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, + 0x22, 0x47, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x42, + 0x79, 0x55, 0x72, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x07, + 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, + 0x52, 0x07, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x22, 0x3b, 0x0a, 0x13, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x41, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, + 0x0a, 0x06, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x6f, 0x6c, 0x69, 0x6e, + 0x6b, 0x52, 0x06, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x29, 0x0a, 0x13, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x16, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x47, 0x6f, + 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x0a, 0x0f, + 0x41, 0x64, 0x64, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x22, 0x3d, 0x0a, 0x10, 0x41, 0x64, 0x64, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, + 0x06, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, + 0x52, 0x06, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x3e, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x22, 0x40, 0x0a, 0x13, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x29, 0x0a, 0x06, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x11, 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x6f, 0x6c, 0x69, + 0x6e, 0x6b, 0x52, 0x06, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x0e, 0x0a, 0x0c, 0x47, 0x65, + 0x74, 0x4d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x40, 0x0a, 0x0d, 0x47, 0x65, + 0x74, 0x4d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, + 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x32, 0xd6, 0x05, 0x0a, + 0x0d, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x51, + 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x1e, + 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, + 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x48, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x1b, + 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x6f, + 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x67, 0x6f, + 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x6f, 0x6c, 0x69, 0x6e, + 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0b, 0x4c, + 0x69, 0x73, 0x74, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6c, + 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x47, 0x6f, 0x6c, 0x69, 0x6e, + 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x67, 0x6f, 0x6c, 0x69, + 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5d, 0x0a, 0x10, 0x4c, + 0x69, 0x73, 0x74, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x42, 0x79, 0x55, 0x72, 0x6c, 0x12, + 0x22, 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x42, 0x79, 0x55, 0x72, 0x6c, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x42, 0x79, 0x55, 0x72, 0x6c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0c, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x1e, 0x2e, 0x67, 0x6f, 0x6c, + 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x6f, 0x6c, + 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x6f, 0x6c, + 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x6f, 0x6c, + 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x51, 0x0a, + 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x1e, 0x2e, + 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, + 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x45, 0x0a, 0x08, 0x41, 0x64, 0x64, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1a, 0x2e, 0x67, + 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x77, 0x6e, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, + 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0b, 0x52, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, + 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, + 0x31, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x05, 0x47, 0x65, 0x74, 0x4d, 0x65, + 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x4d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x67, 0x6f, 0x6c, 0x69, + 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x9b, 0x01, 0x0a, 0x0d, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, + 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x6e, 0x6f, 0x77, 0x6e, 0x61, 0x62, 0x65, 0x2f, 0x67, 0x6f, 0x6c, 0x69, 0x6e, + 0x6b, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, + 0x6c, 0x69, 0x6e, 0x6b, 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x76, 0x31, + 0xa2, 0x02, 0x03, 0x47, 0x58, 0x58, 0xaa, 0x02, 0x09, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, + 0x56, 0x31, 0xca, 0x02, 0x09, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0xe2, 0x02, + 0x15, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0a, 0x47, 0x6f, 0x6c, 0x69, 0x6e, 0x6b, 0x3a, + 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_golink_v1_golink_proto_rawDescOnce sync.Once + file_golink_v1_golink_proto_rawDescData = file_golink_v1_golink_proto_rawDesc +) + +func file_golink_v1_golink_proto_rawDescGZIP() []byte { + file_golink_v1_golink_proto_rawDescOnce.Do(func() { + file_golink_v1_golink_proto_rawDescData = protoimpl.X.CompressGZIP(file_golink_v1_golink_proto_rawDescData) + }) + return file_golink_v1_golink_proto_rawDescData +} + +var file_golink_v1_golink_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_golink_v1_golink_proto_goTypes = []interface{}{ + (*Golink)(nil), // 0: golink.v1.Golink + (*CreateGolinkRequest)(nil), // 1: golink.v1.CreateGolinkRequest + (*CreateGolinkResponse)(nil), // 2: golink.v1.CreateGolinkResponse + (*GetGolinkRequest)(nil), // 3: golink.v1.GetGolinkRequest + (*GetGolinkResponse)(nil), // 4: golink.v1.GetGolinkResponse + (*ListGolinksRequest)(nil), // 5: golink.v1.ListGolinksRequest + (*ListGolinksResponse)(nil), // 6: golink.v1.ListGolinksResponse + (*ListGolinksByUrlRequest)(nil), // 7: golink.v1.ListGolinksByUrlRequest + (*ListGolinksByUrlResponse)(nil), // 8: golink.v1.ListGolinksByUrlResponse + (*UpdateGolinkRequest)(nil), // 9: golink.v1.UpdateGolinkRequest + (*UpdateGolinkResponse)(nil), // 10: golink.v1.UpdateGolinkResponse + (*DeleteGolinkRequest)(nil), // 11: golink.v1.DeleteGolinkRequest + (*DeleteGolinkResponse)(nil), // 12: golink.v1.DeleteGolinkResponse + (*AddOwnerRequest)(nil), // 13: golink.v1.AddOwnerRequest + (*AddOwnerResponse)(nil), // 14: golink.v1.AddOwnerResponse + (*RemoveOwnerRequest)(nil), // 15: golink.v1.RemoveOwnerRequest + (*RemoveOwnerResponse)(nil), // 16: golink.v1.RemoveOwnerResponse + (*GetMeRequest)(nil), // 17: golink.v1.GetMeRequest + (*GetMeResponse)(nil), // 18: golink.v1.GetMeResponse +} +var file_golink_v1_golink_proto_depIdxs = []int32{ + 0, // 0: golink.v1.CreateGolinkResponse.golink:type_name -> golink.v1.Golink + 0, // 1: golink.v1.GetGolinkResponse.golink:type_name -> golink.v1.Golink + 0, // 2: golink.v1.ListGolinksResponse.golinks:type_name -> golink.v1.Golink + 0, // 3: golink.v1.ListGolinksByUrlResponse.golinks:type_name -> golink.v1.Golink + 0, // 4: golink.v1.UpdateGolinkResponse.golink:type_name -> golink.v1.Golink + 0, // 5: golink.v1.AddOwnerResponse.golink:type_name -> golink.v1.Golink + 0, // 6: golink.v1.RemoveOwnerResponse.golink:type_name -> golink.v1.Golink + 1, // 7: golink.v1.GolinkService.CreateGolink:input_type -> golink.v1.CreateGolinkRequest + 3, // 8: golink.v1.GolinkService.GetGolink:input_type -> golink.v1.GetGolinkRequest + 5, // 9: golink.v1.GolinkService.ListGolinks:input_type -> golink.v1.ListGolinksRequest + 7, // 10: golink.v1.GolinkService.ListGolinksByUrl:input_type -> golink.v1.ListGolinksByUrlRequest + 9, // 11: golink.v1.GolinkService.UpdateGolink:input_type -> golink.v1.UpdateGolinkRequest + 11, // 12: golink.v1.GolinkService.DeleteGolink:input_type -> golink.v1.DeleteGolinkRequest + 13, // 13: golink.v1.GolinkService.AddOwner:input_type -> golink.v1.AddOwnerRequest + 15, // 14: golink.v1.GolinkService.RemoveOwner:input_type -> golink.v1.RemoveOwnerRequest + 17, // 15: golink.v1.GolinkService.GetMe:input_type -> golink.v1.GetMeRequest + 2, // 16: golink.v1.GolinkService.CreateGolink:output_type -> golink.v1.CreateGolinkResponse + 4, // 17: golink.v1.GolinkService.GetGolink:output_type -> golink.v1.GetGolinkResponse + 6, // 18: golink.v1.GolinkService.ListGolinks:output_type -> golink.v1.ListGolinksResponse + 8, // 19: golink.v1.GolinkService.ListGolinksByUrl:output_type -> golink.v1.ListGolinksByUrlResponse + 10, // 20: golink.v1.GolinkService.UpdateGolink:output_type -> golink.v1.UpdateGolinkResponse + 12, // 21: golink.v1.GolinkService.DeleteGolink:output_type -> golink.v1.DeleteGolinkResponse + 14, // 22: golink.v1.GolinkService.AddOwner:output_type -> golink.v1.AddOwnerResponse + 16, // 23: golink.v1.GolinkService.RemoveOwner:output_type -> golink.v1.RemoveOwnerResponse + 18, // 24: golink.v1.GolinkService.GetMe:output_type -> golink.v1.GetMeResponse + 16, // [16:25] is the sub-list for method output_type + 7, // [7:16] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_golink_v1_golink_proto_init() } +func file_golink_v1_golink_proto_init() { + if File_golink_v1_golink_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_golink_v1_golink_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Golink); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateGolinkRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateGolinkResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGolinkRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGolinkResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListGolinksRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListGolinksResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListGolinksByUrlRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListGolinksByUrlResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateGolinkRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateGolinkResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteGolinkRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteGolinkResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddOwnerRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddOwnerResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveOwnerRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveOwnerResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_golink_v1_golink_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMeResponse); 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_golink_v1_golink_proto_rawDesc, + NumEnums: 0, + NumMessages: 19, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_golink_v1_golink_proto_goTypes, + DependencyIndexes: file_golink_v1_golink_proto_depIdxs, + MessageInfos: file_golink_v1_golink_proto_msgTypes, + }.Build() + File_golink_v1_golink_proto = out.File + file_golink_v1_golink_proto_rawDesc = nil + file_golink_v1_golink_proto_goTypes = nil + file_golink_v1_golink_proto_depIdxs = nil +} diff --git a/backend/gen/golink/v1/golinkv1connect/debug.connect.go b/backend/gen/golink/v1/golinkv1connect/debug.connect.go new file mode 100644 index 00000000..bf2b35b2 --- /dev/null +++ b/backend/gen/golink/v1/golinkv1connect/debug.connect.go @@ -0,0 +1,104 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: golink/v1/debug.proto + +package golinkv1connect + +import ( + context "context" + errors "errors" + connect_go "github.com/bufbuild/connect-go" + v1 "github.com/nownabe/golink/backend/gen/golink/v1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // DebugServiceName is the fully-qualified name of the DebugService service. + DebugServiceName = "golink.v1.DebugService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // DebugServiceDebugProcedure is the fully-qualified name of the DebugService's Debug RPC. + DebugServiceDebugProcedure = "/golink.v1.DebugService/Debug" +) + +// DebugServiceClient is a client for the golink.v1.DebugService service. +type DebugServiceClient interface { + Debug(context.Context, *connect_go.Request[v1.DebugRequest]) (*connect_go.Response[v1.DebugResponse], error) +} + +// NewDebugServiceClient constructs a client for the golink.v1.DebugService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewDebugServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) DebugServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &debugServiceClient{ + debug: connect_go.NewClient[v1.DebugRequest, v1.DebugResponse]( + httpClient, + baseURL+DebugServiceDebugProcedure, + opts..., + ), + } +} + +// debugServiceClient implements DebugServiceClient. +type debugServiceClient struct { + debug *connect_go.Client[v1.DebugRequest, v1.DebugResponse] +} + +// Debug calls golink.v1.DebugService.Debug. +func (c *debugServiceClient) Debug(ctx context.Context, req *connect_go.Request[v1.DebugRequest]) (*connect_go.Response[v1.DebugResponse], error) { + return c.debug.CallUnary(ctx, req) +} + +// DebugServiceHandler is an implementation of the golink.v1.DebugService service. +type DebugServiceHandler interface { + Debug(context.Context, *connect_go.Request[v1.DebugRequest]) (*connect_go.Response[v1.DebugResponse], error) +} + +// NewDebugServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewDebugServiceHandler(svc DebugServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + debugServiceDebugHandler := connect_go.NewUnaryHandler( + DebugServiceDebugProcedure, + svc.Debug, + opts..., + ) + return "/golink.v1.DebugService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case DebugServiceDebugProcedure: + debugServiceDebugHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedDebugServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedDebugServiceHandler struct{} + +func (UnimplementedDebugServiceHandler) Debug(context.Context, *connect_go.Request[v1.DebugRequest]) (*connect_go.Response[v1.DebugResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("golink.v1.DebugService.Debug is not implemented")) +} diff --git a/backend/gen/golink/v1/golinkv1connect/golink.connect.go b/backend/gen/golink/v1/golinkv1connect/golink.connect.go new file mode 100644 index 00000000..175bc58a --- /dev/null +++ b/backend/gen/golink/v1/golinkv1connect/golink.connect.go @@ -0,0 +1,318 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: golink/v1/golink.proto + +package golinkv1connect + +import ( + context "context" + errors "errors" + connect_go "github.com/bufbuild/connect-go" + v1 "github.com/nownabe/golink/backend/gen/golink/v1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // GolinkServiceName is the fully-qualified name of the GolinkService service. + GolinkServiceName = "golink.v1.GolinkService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // GolinkServiceCreateGolinkProcedure is the fully-qualified name of the GolinkService's + // CreateGolink RPC. + GolinkServiceCreateGolinkProcedure = "/golink.v1.GolinkService/CreateGolink" + // GolinkServiceGetGolinkProcedure is the fully-qualified name of the GolinkService's GetGolink RPC. + GolinkServiceGetGolinkProcedure = "/golink.v1.GolinkService/GetGolink" + // GolinkServiceListGolinksProcedure is the fully-qualified name of the GolinkService's ListGolinks + // RPC. + GolinkServiceListGolinksProcedure = "/golink.v1.GolinkService/ListGolinks" + // GolinkServiceListGolinksByUrlProcedure is the fully-qualified name of the GolinkService's + // ListGolinksByUrl RPC. + GolinkServiceListGolinksByUrlProcedure = "/golink.v1.GolinkService/ListGolinksByUrl" + // GolinkServiceUpdateGolinkProcedure is the fully-qualified name of the GolinkService's + // UpdateGolink RPC. + GolinkServiceUpdateGolinkProcedure = "/golink.v1.GolinkService/UpdateGolink" + // GolinkServiceDeleteGolinkProcedure is the fully-qualified name of the GolinkService's + // DeleteGolink RPC. + GolinkServiceDeleteGolinkProcedure = "/golink.v1.GolinkService/DeleteGolink" + // GolinkServiceAddOwnerProcedure is the fully-qualified name of the GolinkService's AddOwner RPC. + GolinkServiceAddOwnerProcedure = "/golink.v1.GolinkService/AddOwner" + // GolinkServiceRemoveOwnerProcedure is the fully-qualified name of the GolinkService's RemoveOwner + // RPC. + GolinkServiceRemoveOwnerProcedure = "/golink.v1.GolinkService/RemoveOwner" + // GolinkServiceGetMeProcedure is the fully-qualified name of the GolinkService's GetMe RPC. + GolinkServiceGetMeProcedure = "/golink.v1.GolinkService/GetMe" +) + +// GolinkServiceClient is a client for the golink.v1.GolinkService service. +type GolinkServiceClient interface { + CreateGolink(context.Context, *connect_go.Request[v1.CreateGolinkRequest]) (*connect_go.Response[v1.CreateGolinkResponse], error) + GetGolink(context.Context, *connect_go.Request[v1.GetGolinkRequest]) (*connect_go.Response[v1.GetGolinkResponse], error) + ListGolinks(context.Context, *connect_go.Request[v1.ListGolinksRequest]) (*connect_go.Response[v1.ListGolinksResponse], error) + ListGolinksByUrl(context.Context, *connect_go.Request[v1.ListGolinksByUrlRequest]) (*connect_go.Response[v1.ListGolinksByUrlResponse], error) + UpdateGolink(context.Context, *connect_go.Request[v1.UpdateGolinkRequest]) (*connect_go.Response[v1.UpdateGolinkResponse], error) + DeleteGolink(context.Context, *connect_go.Request[v1.DeleteGolinkRequest]) (*connect_go.Response[v1.DeleteGolinkResponse], error) + AddOwner(context.Context, *connect_go.Request[v1.AddOwnerRequest]) (*connect_go.Response[v1.AddOwnerResponse], error) + RemoveOwner(context.Context, *connect_go.Request[v1.RemoveOwnerRequest]) (*connect_go.Response[v1.RemoveOwnerResponse], error) + GetMe(context.Context, *connect_go.Request[v1.GetMeRequest]) (*connect_go.Response[v1.GetMeResponse], error) +} + +// NewGolinkServiceClient constructs a client for the golink.v1.GolinkService service. By default, +// it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and +// sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() +// or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewGolinkServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) GolinkServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &golinkServiceClient{ + createGolink: connect_go.NewClient[v1.CreateGolinkRequest, v1.CreateGolinkResponse]( + httpClient, + baseURL+GolinkServiceCreateGolinkProcedure, + opts..., + ), + getGolink: connect_go.NewClient[v1.GetGolinkRequest, v1.GetGolinkResponse]( + httpClient, + baseURL+GolinkServiceGetGolinkProcedure, + opts..., + ), + listGolinks: connect_go.NewClient[v1.ListGolinksRequest, v1.ListGolinksResponse]( + httpClient, + baseURL+GolinkServiceListGolinksProcedure, + opts..., + ), + listGolinksByUrl: connect_go.NewClient[v1.ListGolinksByUrlRequest, v1.ListGolinksByUrlResponse]( + httpClient, + baseURL+GolinkServiceListGolinksByUrlProcedure, + opts..., + ), + updateGolink: connect_go.NewClient[v1.UpdateGolinkRequest, v1.UpdateGolinkResponse]( + httpClient, + baseURL+GolinkServiceUpdateGolinkProcedure, + opts..., + ), + deleteGolink: connect_go.NewClient[v1.DeleteGolinkRequest, v1.DeleteGolinkResponse]( + httpClient, + baseURL+GolinkServiceDeleteGolinkProcedure, + opts..., + ), + addOwner: connect_go.NewClient[v1.AddOwnerRequest, v1.AddOwnerResponse]( + httpClient, + baseURL+GolinkServiceAddOwnerProcedure, + opts..., + ), + removeOwner: connect_go.NewClient[v1.RemoveOwnerRequest, v1.RemoveOwnerResponse]( + httpClient, + baseURL+GolinkServiceRemoveOwnerProcedure, + opts..., + ), + getMe: connect_go.NewClient[v1.GetMeRequest, v1.GetMeResponse]( + httpClient, + baseURL+GolinkServiceGetMeProcedure, + opts..., + ), + } +} + +// golinkServiceClient implements GolinkServiceClient. +type golinkServiceClient struct { + createGolink *connect_go.Client[v1.CreateGolinkRequest, v1.CreateGolinkResponse] + getGolink *connect_go.Client[v1.GetGolinkRequest, v1.GetGolinkResponse] + listGolinks *connect_go.Client[v1.ListGolinksRequest, v1.ListGolinksResponse] + listGolinksByUrl *connect_go.Client[v1.ListGolinksByUrlRequest, v1.ListGolinksByUrlResponse] + updateGolink *connect_go.Client[v1.UpdateGolinkRequest, v1.UpdateGolinkResponse] + deleteGolink *connect_go.Client[v1.DeleteGolinkRequest, v1.DeleteGolinkResponse] + addOwner *connect_go.Client[v1.AddOwnerRequest, v1.AddOwnerResponse] + removeOwner *connect_go.Client[v1.RemoveOwnerRequest, v1.RemoveOwnerResponse] + getMe *connect_go.Client[v1.GetMeRequest, v1.GetMeResponse] +} + +// CreateGolink calls golink.v1.GolinkService.CreateGolink. +func (c *golinkServiceClient) CreateGolink(ctx context.Context, req *connect_go.Request[v1.CreateGolinkRequest]) (*connect_go.Response[v1.CreateGolinkResponse], error) { + return c.createGolink.CallUnary(ctx, req) +} + +// GetGolink calls golink.v1.GolinkService.GetGolink. +func (c *golinkServiceClient) GetGolink(ctx context.Context, req *connect_go.Request[v1.GetGolinkRequest]) (*connect_go.Response[v1.GetGolinkResponse], error) { + return c.getGolink.CallUnary(ctx, req) +} + +// ListGolinks calls golink.v1.GolinkService.ListGolinks. +func (c *golinkServiceClient) ListGolinks(ctx context.Context, req *connect_go.Request[v1.ListGolinksRequest]) (*connect_go.Response[v1.ListGolinksResponse], error) { + return c.listGolinks.CallUnary(ctx, req) +} + +// ListGolinksByUrl calls golink.v1.GolinkService.ListGolinksByUrl. +func (c *golinkServiceClient) ListGolinksByUrl(ctx context.Context, req *connect_go.Request[v1.ListGolinksByUrlRequest]) (*connect_go.Response[v1.ListGolinksByUrlResponse], error) { + return c.listGolinksByUrl.CallUnary(ctx, req) +} + +// UpdateGolink calls golink.v1.GolinkService.UpdateGolink. +func (c *golinkServiceClient) UpdateGolink(ctx context.Context, req *connect_go.Request[v1.UpdateGolinkRequest]) (*connect_go.Response[v1.UpdateGolinkResponse], error) { + return c.updateGolink.CallUnary(ctx, req) +} + +// DeleteGolink calls golink.v1.GolinkService.DeleteGolink. +func (c *golinkServiceClient) DeleteGolink(ctx context.Context, req *connect_go.Request[v1.DeleteGolinkRequest]) (*connect_go.Response[v1.DeleteGolinkResponse], error) { + return c.deleteGolink.CallUnary(ctx, req) +} + +// AddOwner calls golink.v1.GolinkService.AddOwner. +func (c *golinkServiceClient) AddOwner(ctx context.Context, req *connect_go.Request[v1.AddOwnerRequest]) (*connect_go.Response[v1.AddOwnerResponse], error) { + return c.addOwner.CallUnary(ctx, req) +} + +// RemoveOwner calls golink.v1.GolinkService.RemoveOwner. +func (c *golinkServiceClient) RemoveOwner(ctx context.Context, req *connect_go.Request[v1.RemoveOwnerRequest]) (*connect_go.Response[v1.RemoveOwnerResponse], error) { + return c.removeOwner.CallUnary(ctx, req) +} + +// GetMe calls golink.v1.GolinkService.GetMe. +func (c *golinkServiceClient) GetMe(ctx context.Context, req *connect_go.Request[v1.GetMeRequest]) (*connect_go.Response[v1.GetMeResponse], error) { + return c.getMe.CallUnary(ctx, req) +} + +// GolinkServiceHandler is an implementation of the golink.v1.GolinkService service. +type GolinkServiceHandler interface { + CreateGolink(context.Context, *connect_go.Request[v1.CreateGolinkRequest]) (*connect_go.Response[v1.CreateGolinkResponse], error) + GetGolink(context.Context, *connect_go.Request[v1.GetGolinkRequest]) (*connect_go.Response[v1.GetGolinkResponse], error) + ListGolinks(context.Context, *connect_go.Request[v1.ListGolinksRequest]) (*connect_go.Response[v1.ListGolinksResponse], error) + ListGolinksByUrl(context.Context, *connect_go.Request[v1.ListGolinksByUrlRequest]) (*connect_go.Response[v1.ListGolinksByUrlResponse], error) + UpdateGolink(context.Context, *connect_go.Request[v1.UpdateGolinkRequest]) (*connect_go.Response[v1.UpdateGolinkResponse], error) + DeleteGolink(context.Context, *connect_go.Request[v1.DeleteGolinkRequest]) (*connect_go.Response[v1.DeleteGolinkResponse], error) + AddOwner(context.Context, *connect_go.Request[v1.AddOwnerRequest]) (*connect_go.Response[v1.AddOwnerResponse], error) + RemoveOwner(context.Context, *connect_go.Request[v1.RemoveOwnerRequest]) (*connect_go.Response[v1.RemoveOwnerResponse], error) + GetMe(context.Context, *connect_go.Request[v1.GetMeRequest]) (*connect_go.Response[v1.GetMeResponse], error) +} + +// NewGolinkServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewGolinkServiceHandler(svc GolinkServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + golinkServiceCreateGolinkHandler := connect_go.NewUnaryHandler( + GolinkServiceCreateGolinkProcedure, + svc.CreateGolink, + opts..., + ) + golinkServiceGetGolinkHandler := connect_go.NewUnaryHandler( + GolinkServiceGetGolinkProcedure, + svc.GetGolink, + opts..., + ) + golinkServiceListGolinksHandler := connect_go.NewUnaryHandler( + GolinkServiceListGolinksProcedure, + svc.ListGolinks, + opts..., + ) + golinkServiceListGolinksByUrlHandler := connect_go.NewUnaryHandler( + GolinkServiceListGolinksByUrlProcedure, + svc.ListGolinksByUrl, + opts..., + ) + golinkServiceUpdateGolinkHandler := connect_go.NewUnaryHandler( + GolinkServiceUpdateGolinkProcedure, + svc.UpdateGolink, + opts..., + ) + golinkServiceDeleteGolinkHandler := connect_go.NewUnaryHandler( + GolinkServiceDeleteGolinkProcedure, + svc.DeleteGolink, + opts..., + ) + golinkServiceAddOwnerHandler := connect_go.NewUnaryHandler( + GolinkServiceAddOwnerProcedure, + svc.AddOwner, + opts..., + ) + golinkServiceRemoveOwnerHandler := connect_go.NewUnaryHandler( + GolinkServiceRemoveOwnerProcedure, + svc.RemoveOwner, + opts..., + ) + golinkServiceGetMeHandler := connect_go.NewUnaryHandler( + GolinkServiceGetMeProcedure, + svc.GetMe, + opts..., + ) + return "/golink.v1.GolinkService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case GolinkServiceCreateGolinkProcedure: + golinkServiceCreateGolinkHandler.ServeHTTP(w, r) + case GolinkServiceGetGolinkProcedure: + golinkServiceGetGolinkHandler.ServeHTTP(w, r) + case GolinkServiceListGolinksProcedure: + golinkServiceListGolinksHandler.ServeHTTP(w, r) + case GolinkServiceListGolinksByUrlProcedure: + golinkServiceListGolinksByUrlHandler.ServeHTTP(w, r) + case GolinkServiceUpdateGolinkProcedure: + golinkServiceUpdateGolinkHandler.ServeHTTP(w, r) + case GolinkServiceDeleteGolinkProcedure: + golinkServiceDeleteGolinkHandler.ServeHTTP(w, r) + case GolinkServiceAddOwnerProcedure: + golinkServiceAddOwnerHandler.ServeHTTP(w, r) + case GolinkServiceRemoveOwnerProcedure: + golinkServiceRemoveOwnerHandler.ServeHTTP(w, r) + case GolinkServiceGetMeProcedure: + golinkServiceGetMeHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedGolinkServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedGolinkServiceHandler struct{} + +func (UnimplementedGolinkServiceHandler) CreateGolink(context.Context, *connect_go.Request[v1.CreateGolinkRequest]) (*connect_go.Response[v1.CreateGolinkResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("golink.v1.GolinkService.CreateGolink is not implemented")) +} + +func (UnimplementedGolinkServiceHandler) GetGolink(context.Context, *connect_go.Request[v1.GetGolinkRequest]) (*connect_go.Response[v1.GetGolinkResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("golink.v1.GolinkService.GetGolink is not implemented")) +} + +func (UnimplementedGolinkServiceHandler) ListGolinks(context.Context, *connect_go.Request[v1.ListGolinksRequest]) (*connect_go.Response[v1.ListGolinksResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("golink.v1.GolinkService.ListGolinks is not implemented")) +} + +func (UnimplementedGolinkServiceHandler) ListGolinksByUrl(context.Context, *connect_go.Request[v1.ListGolinksByUrlRequest]) (*connect_go.Response[v1.ListGolinksByUrlResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("golink.v1.GolinkService.ListGolinksByUrl is not implemented")) +} + +func (UnimplementedGolinkServiceHandler) UpdateGolink(context.Context, *connect_go.Request[v1.UpdateGolinkRequest]) (*connect_go.Response[v1.UpdateGolinkResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("golink.v1.GolinkService.UpdateGolink is not implemented")) +} + +func (UnimplementedGolinkServiceHandler) DeleteGolink(context.Context, *connect_go.Request[v1.DeleteGolinkRequest]) (*connect_go.Response[v1.DeleteGolinkResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("golink.v1.GolinkService.DeleteGolink is not implemented")) +} + +func (UnimplementedGolinkServiceHandler) AddOwner(context.Context, *connect_go.Request[v1.AddOwnerRequest]) (*connect_go.Response[v1.AddOwnerResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("golink.v1.GolinkService.AddOwner is not implemented")) +} + +func (UnimplementedGolinkServiceHandler) RemoveOwner(context.Context, *connect_go.Request[v1.RemoveOwnerRequest]) (*connect_go.Response[v1.RemoveOwnerResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("golink.v1.GolinkService.RemoveOwner is not implemented")) +} + +func (UnimplementedGolinkServiceHandler) GetMe(context.Context, *connect_go.Request[v1.GetMeRequest]) (*connect_go.Response[v1.GetMeResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("golink.v1.GolinkService.GetMe is not implemented")) +} diff --git a/backend/go.mod b/backend/go.mod index f0dc90a8..0763a088 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -5,6 +5,7 @@ go 1.20 require ( cloud.google.com/go/compute/metadata v0.2.3 cloud.google.com/go/firestore v1.12.0 + github.com/bufbuild/connect-go v1.10.0 github.com/nownabe/golink/go v0.0.0-20230814035337-5b67ef87285c google.golang.org/grpc v1.55.0 ) diff --git a/backend/go.sum b/backend/go.sum index f0e5d890..ef4ff048 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -12,6 +12,8 @@ cloud.google.com/go/longrunning v0.5.0 h1:DK8BH0+hS+DIvc9a2TPnteUievsTCH4ORMAASS cloud.google.com/go/longrunning v0.5.0/go.mod h1:0JNuqRShmscVAhIACGtskSAWtqtOoPkwP0YF1oVEchc= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/bufbuild/connect-go v1.10.0 h1:QAJ3G9A1OYQW2Jbk3DeoJbkCxuKArrvZgDt47mjdTbg= +github.com/bufbuild/connect-go v1.10.0/go.mod h1:CAIePUgkDR5pAFaylSMtNK45ANQjp9JvpluG20rhpV8= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= diff --git a/api/service.go b/backend/golink_service.go similarity index 99% rename from api/service.go rename to backend/golink_service.go index c81a01aa..d38b64e1 100644 --- a/api/service.go +++ b/backend/golink_service.go @@ -1,4 +1,4 @@ -package api +package backend import ( "context" diff --git a/api/service_test.go b/backend/golink_service_test.go similarity index 99% rename from api/service_test.go rename to backend/golink_service_test.go index 5f23f784..36123a19 100644 --- a/api/service_test.go +++ b/backend/golink_service_test.go @@ -1,4 +1,4 @@ -package api +package backend import ( "context" diff --git a/api/interceptor/interceptors.go b/backend/interceptor/interceptors.go similarity index 100% rename from api/interceptor/interceptors.go rename to backend/interceptor/interceptors.go diff --git a/backend/repository.go b/backend/repository.go index e17e9530..195778a0 100644 --- a/backend/repository.go +++ b/backend/repository.go @@ -3,10 +3,12 @@ package backend import ( "context" "net/url" + "time" "cloud.google.com/go/firestore" "github.com/nownabe/golink/go/clog" "github.com/nownabe/golink/go/errors" + "google.golang.org/api/iterator" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -23,6 +25,189 @@ type golink struct { URL string `firestore:"url"` } +func (r *repository) Transaction( + ctx context.Context, + f func(ctx context.Context, tx *firestore.Transaction) error, +) error { + return r.firestore.RunTransaction(ctx, f) +} + +func (r *repository) TxExists(ctx context.Context, tx *firestore.Transaction, name string) (bool, error) { + col := r.collection() + doc := col.Doc(nameToID(name)) + + s, err := tx.Get(doc) + if status.Code(err) == codes.NotFound { + return false, nil + } + if err != nil { + return false, errors.Wrapf(err, "failed to get %s", doc.Path) + } + + return s.Exists(), nil +} + +func (r *repository) Get(ctx context.Context, name string) (*dto, error) { + col := r.collection() + doc := col.Doc(nameToID(name)) + + s, err := doc.Get(ctx) + if status.Code(err) == codes.NotFound { + return nil, errors.Wrapf(errDocumentNotFound, "%s not found", doc.Path) + } + + if err != nil { + return nil, errors.Wrapf(err, "failed to get %s", doc.Path) + } + var o dto + if err := s.DataTo(&o); err != nil { + return nil, errors.Wrapf(err, "failed to populate %s", doc.Path) + } + + return &o, nil +} + +func (r *repository) TxGet(ctx context.Context, tx *firestore.Transaction, name string) (*dto, error) { + col := r.collection() + doc := col.Doc(nameToID(name)) + + s, err := tx.Get(doc) + if status.Code(err) == codes.NotFound { + return nil, errors.Wrapf(errDocumentNotFound, "%s not found", doc.Path) + } + if err != nil { + return nil, errors.Wrapf(err, "failed to get %s", doc.Path) + } + + var o dto + if err := s.DataTo(&o); err != nil { + return nil, errors.Wrapf(err, "failed to populate %s", doc.Path) + } + + return &o, nil +} + +func (r *repository) TxCreate(ctx context.Context, tx *firestore.Transaction, dto *dto) error { + col := r.collection() + doc := col.Doc(dto.ID()) + + dto.CreatedAt = time.Now() + dto.UpdatedAt = time.Now() + + if err := tx.Create(doc, dto); err != nil { + return errors.Wrapf(err, "failed to create %s", doc.Path) + } + + return nil +} + +func (r *repository) ListByOwner(ctx context.Context, owner string) ([]*dto, error) { + col := r.collection() + iter := col.Where("owners", "array-contains", owner).Documents(ctx) + defer iter.Stop() + + var dtos []*dto + for { + s, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + return nil, errors.Wrapf(err, "failed to iterate %s", col.Path) + } + + var o dto + if err := s.DataTo(&o); err != nil { + return nil, errors.Wrapf(err, "failed to populate %s", s.Ref.Path) + } + + dtos = append(dtos, &o) + } + + return dtos, nil +} + +func (r *repository) ListByURL(ctx context.Context, url string) ([]*dto, error) { + col := r.collection() + iter := col.Where("url", "==", url).Documents(ctx) + defer iter.Stop() + + var dtos []*dto + for { + s, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + return nil, errors.Wrapf(err, "failed to iterate %s", col.Path) + } + + var o dto + if err := s.DataTo(&o); err != nil { + return nil, errors.Wrapf(err, "failed to populate %s", s.Ref.Path) + } + + dtos = append(dtos, &o) + } + + return dtos, nil +} + +func (r *repository) TxUpdate(ctx context.Context, tx *firestore.Transaction, dto *dto) error { + col := r.collection() + doc := col.Doc(dto.ID()) + + dto.UpdatedAt = time.Now() + + if err := tx.Update(doc, []firestore.Update{ + {Path: "url", Value: dto.URL}, + {Path: "updated_at", Value: dto.UpdatedAt}, + }); err != nil { + return errors.Wrapf(err, "failed to update %s", doc.Path) + } + + return nil +} + +func (r *repository) TxDelete(ctx context.Context, tx *firestore.Transaction, name string) error { + col := r.collection() + doc := col.Doc(nameToID(name)) + + if err := tx.Delete(doc); err != nil { + return errors.Wrapf(err, "failed to delete %s", doc.Path) + } + + return nil +} + +func (r *repository) TxAddOwner(ctx context.Context, tx *firestore.Transaction, name string, owner string) error { + col := r.collection() + doc := col.Doc(nameToID(name)) + + if err := tx.Update(doc, []firestore.Update{ + {Path: "owners", Value: firestore.ArrayUnion(owner)}, + {Path: "updated_at", Value: time.Now()}, + }); err != nil { + return errors.Wrapf(err, "failed to update %s", doc.Path) + } + + return nil +} + +func (r *repository) TxRemoveOwner(ctx context.Context, tx *firestore.Transaction, name string, owner string) error { + col := r.collection() + doc := col.Doc(nameToID(name)) + + if err := tx.Update(doc, []firestore.Update{ + {Path: "owners", Value: firestore.ArrayRemove(owner)}, + {Path: "updated_at", Value: time.Now()}, + }); err != nil { + return errors.Wrapf(err, "failed to update %s", doc.Path) + } + + return nil +} + func (r *repository) GetURLAndUpdateStats(ctx context.Context, name string) (*url.URL, error) { col := r.firestore.Collection(collectionName) doc := col.Doc(name) @@ -62,3 +247,7 @@ func (r *repository) incrementCount(ctx context.Context, docRef *firestore.Docum clog.Err(ctx, err) } } + +func (r *repository) collection() *firestore.CollectionRef { + return r.firestore.Collection(collectionName) +} diff --git a/buf.gen.yaml b/buf.gen.yaml index 2814cddb..e95c7c9d 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -2,14 +2,14 @@ version: v1 managed: enabled: true go_package_prefix: - default: github.com/nownabe/golink/api/gen + default: github.com/nownabe/golink/backend/gen plugins: - plugin: buf.build/protocolbuffers/go - out: api/gen + out: backend/gen opt: - paths=source_relative - plugin: buf.build/bufbuild/connect-go - out: api/gen + out: backend/gen opt: - paths=source_relative - plugin: buf.build/bufbuild/es diff --git a/console/package.json b/console/package.json index e535fec2..8c378837 100644 --- a/console/package.json +++ b/console/package.json @@ -9,7 +9,7 @@ }, "packageManager": "pnpm@8.6.12", "scripts": { - "dev": "VITE_API_ENDPOINT='http://localhost:8081/api' vite", + "dev": "VITE_API_ENDPOINT='http://localhost:8080/api' vite", "build": "vite build --outDir ../backend/console", "clean": "rm -rf ../backend/console" },