From 78f0ae14d74fb047b6cdd1c81ab089a5d0482d7f Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Wed, 16 Aug 2023 13:17:42 +0300 Subject: [PATCH] rewrite Signed-off-by: Vasiliy Tolstov --- Makefile | 2 +- cmd/pkgdash/main.go | 185 +- cmd/script/main.go | 2 +- config/config.go | 22 - config/variables.go | 6 - go.mod | 46 +- go.sum | 74 + handler/errors.go | 80 - handler/handlers.go | 185 -- internal/config/config.go | 64 + internal/handler/comments_create.go | 40 + internal/handler/comments_delete.go | 36 + internal/handler/comments_list.go | 36 + internal/handler/comments_lookup.go | 11 + internal/handler/handler.go | 76 + internal/handler/modules_list.go | 35 + internal/handler/packages_create.go | 32 + internal/handler/packages_delete.go | 29 + internal/handler/packages_list.go | 28 + internal/handler/packages_update.go | 31 + internal/models/models.go | 78 + .../service}/client_git/client.go | 20 +- .../service}/client_git/client_test.go | 15 +- {service => internal/service}/service.go | 39 +- .../postgres/000001_init_schema.down.sql | 0 .../postgres/000001_init_schema.up.sql | 3 +- .../sqlite/000001_init_schema.down.sql | 0 .../sqlite/000001_init_schema.up.sql | 3 +- .../storage/postgres_tmp}/queries.go | 0 .../storage/postgres_tmp}/storage.go | 16 +- .../storage/postgres_tmp}/storage_test.go | 3 +- .../storage}/sqlite/queries.go | 23 +- .../storage}/sqlite/storage.go | 128 +- internal/storage/storage.go | 69 + {storage => internal/storage}/storage_test.go | 5 +- models/entities.go | 45 - models/mapping.go | 71 - proto/apidocs.swagger.yaml | 425 ++-- proto/pkgdash.pb.go | 1437 +++++++----- proto/pkgdash.pb.validate.go | 1951 +++++++++++------ proto/pkgdash.proto | 286 ++- proto/pkgdash_micro.pb.go | 31 +- proto/pkgdash_micro_http.pb.go | 289 ++- storage/storage.go | 71 - ui/src/app/api/models.ts | 22 +- ui/src/app/api/models/add-comment-rsp.ts | 5 - ...-comment-req.ts => comments-create-req.ts} | 4 +- ui/src/app/api/models/comments-create-rsp.ts | 6 + ui/src/app/api/models/comments-delete-rsp.ts | 4 + ...t-comments-rsp.ts => comments-list-rsp.ts} | 2 +- ui/src/app/api/models/comments-lookup-rsp.ts | 6 + ui/src/app/api/models/error-rsp.ts | 6 +- ui/src/app/api/models/error.ts | 8 - ui/src/app/api/models/module.ts | 2 + ...{get-module-rsp.ts => modules-list-rsp.ts} | 2 +- ui/src/app/api/models/package.ts | 2 + ...-package-req.ts => packages-create-req.ts} | 2 +- ...-package-rsp.ts => packages-create-rsp.ts} | 2 +- ui/src/app/api/models/packages-delete-rsp.ts | 4 + ...st-package-rsp.ts => packages-list-rsp.ts} | 2 +- ...-package-req.ts => packages-update-req.ts} | 2 +- ui/src/app/api/models/packages-update-rsp.ts | 6 + ui/src/app/api/models/update-package-rsp.ts | 5 - .../api/services/pkgdash-service.service.ts | 347 ++- ui/src/app/app.module.ts | 4 +- ui/src/app/dashboard/dashboard.component.html | 1 + ui/src/app/dashboard/dashboard.component.scss | 0 .../app/dashboard/dashboard.component.spec.ts | 25 + ui/src/app/dashboard/dashboard.component.ts | 15 + ui/src/index.html | 2 +- 70 files changed, 4159 insertions(+), 2355 deletions(-) delete mode 100644 config/config.go delete mode 100644 config/variables.go delete mode 100644 handler/errors.go delete mode 100644 handler/handlers.go create mode 100644 internal/config/config.go create mode 100644 internal/handler/comments_create.go create mode 100644 internal/handler/comments_delete.go create mode 100644 internal/handler/comments_list.go create mode 100644 internal/handler/comments_lookup.go create mode 100644 internal/handler/handler.go create mode 100644 internal/handler/modules_list.go create mode 100644 internal/handler/packages_create.go create mode 100644 internal/handler/packages_delete.go create mode 100644 internal/handler/packages_list.go create mode 100644 internal/handler/packages_update.go create mode 100644 internal/models/models.go rename {service => internal/service}/client_git/client.go (88%) rename {service => internal/service}/client_git/client_test.go (74%) rename {service => internal/service}/service.go (72%) rename {storage => internal/storage}/migrations/postgres/000001_init_schema.down.sql (100%) rename {storage => internal/storage}/migrations/postgres/000001_init_schema.up.sql (93%) rename {storage => internal/storage}/migrations/sqlite/000001_init_schema.down.sql (100%) rename {storage => internal/storage}/migrations/sqlite/000001_init_schema.up.sql (92%) rename {storage/postgres => internal/storage/postgres_tmp}/queries.go (100%) rename {storage/postgres => internal/storage/postgres_tmp}/storage.go (88%) rename {storage/postgres => internal/storage/postgres_tmp}/storage_test.go (90%) rename {storage => internal/storage}/sqlite/queries.go (53%) rename {storage => internal/storage}/sqlite/storage.go (64%) create mode 100644 internal/storage/storage.go rename {storage => internal/storage}/storage_test.go (91%) delete mode 100644 models/entities.go delete mode 100644 models/mapping.go delete mode 100644 storage/storage.go delete mode 100644 ui/src/app/api/models/add-comment-rsp.ts rename ui/src/app/api/models/{add-comment-req.ts => comments-create-req.ts} (50%) create mode 100644 ui/src/app/api/models/comments-create-rsp.ts create mode 100644 ui/src/app/api/models/comments-delete-rsp.ts rename ui/src/app/api/models/{get-comments-rsp.ts => comments-list-rsp.ts} (75%) create mode 100644 ui/src/app/api/models/comments-lookup-rsp.ts delete mode 100644 ui/src/app/api/models/error.ts rename ui/src/app/api/models/{get-module-rsp.ts => modules-list-rsp.ts} (75%) rename ui/src/app/api/models/{add-package-req.ts => packages-create-req.ts} (73%) rename ui/src/app/api/models/{add-package-rsp.ts => packages-create-rsp.ts} (63%) create mode 100644 ui/src/app/api/models/packages-delete-rsp.ts rename ui/src/app/api/models/{list-package-rsp.ts => packages-list-rsp.ts} (75%) rename ui/src/app/api/models/{update-package-req.ts => packages-update-req.ts} (79%) create mode 100644 ui/src/app/api/models/packages-update-rsp.ts delete mode 100644 ui/src/app/api/models/update-package-rsp.ts create mode 100644 ui/src/app/dashboard/dashboard.component.html create mode 100644 ui/src/app/dashboard/dashboard.component.scss create mode 100644 ui/src/app/dashboard/dashboard.component.spec.ts create mode 100644 ui/src/app/dashboard/dashboard.component.ts diff --git a/Makefile b/Makefile index 88dc99d..d389b69 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: build build: - go build -o bin/app -mod=readonly ./main.go + go build -o bin/app -mod=readonly git.unistack.org/unistack-org/pkgdash/cmd/pkgdash .PHONY: test test: diff --git a/cmd/pkgdash/main.go b/cmd/pkgdash/main.go index 0d33c43..a24631d 100644 --- a/cmd/pkgdash/main.go +++ b/cmd/pkgdash/main.go @@ -2,34 +2,181 @@ package main import ( "context" - "os" - "os/signal" - "syscall" + "crypto/tls" + "net/http" + "time" + appconfig "git.unistack.org/unistack-org/pkgdash/internal/config" + "git.unistack.org/unistack-org/pkgdash/internal/handler" + "git.unistack.org/unistack-org/pkgdash/internal/service/client_git" + pb "git.unistack.org/unistack-org/pkgdash/proto" + jsoncodec "go.unistack.org/micro-codec-json/v4" + yamlcodec "go.unistack.org/micro-codec-yaml/v4" + envconfig "go.unistack.org/micro-config-env/v4" + fileconfig "go.unistack.org/micro-config-file/v4" + vaultconfig "go.unistack.org/micro-config-vault/v4" + zlogger "go.unistack.org/micro-logger-zerolog/v4" + httpsrv "go.unistack.org/micro-server-http/v4" + healthhandler "go.unistack.org/micro-server-http/v4/handler/health" + meterhandler "go.unistack.org/micro-server-http/v4/handler/meter" + "go.unistack.org/micro/v4" + "go.unistack.org/micro/v4/config" "go.unistack.org/micro/v4/logger" - "go.unistack.org/unistack-org/pkgdash/service" + "go.unistack.org/micro/v4/options" + "go.unistack.org/micro/v4/server" + rutil "go.unistack.org/micro/v4/util/reflect" +) + +const appName = "pkgdash" + +var ( + BuildDate string = "now" // filled when build + AppVersion string = "latest" // filled when build ) func main() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - ch := make(chan os.Signal, 1) - signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) + logger.DefaultLogger = zlogger.NewLogger(zlogger.ReportCaller(), logger.WithLevel(logger.DebugLevel), logger.WithCallerSkipCount(3)) + if err := logger.DefaultLogger.Init(); err != nil { + logger.Fatalf(ctx, "failed to init logger") + } - go func() { - sig := <-ch - logger.Infof(ctx, "handle signal %v, exiting", sig) - cancel() + cfg := appconfig.NewConfig(appName, AppVersion) // create new empty config + vc := vaultconfig.NewConfig( + config.AllowFail(true), // that may be not exists + config.Struct(cfg), // load from vault + options.Codec(jsoncodec.NewCodec()), // vault config in json + config.BeforeLoad(func(ctx context.Context, c config.Config) error { + return c.Init( + vaultconfig.HTTPClient(&http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + }), + vaultconfig.Address(cfg.Vault.Addr), + vaultconfig.Timeout(5*time.Second), + vaultconfig.Token(cfg.Vault.Token), + vaultconfig.Path(cfg.Vault.Path), + ) + }), + ) + + if err := config.Load(ctx, + []config.Config{ + config.NewConfig( // load from defaults + config.Struct(cfg), // pass config struct + ), + fileconfig.NewConfig( // load from file + config.AllowFail(true), // that may be not exists + config.Struct(cfg), // pass config struct + options.Codec(yamlcodec.NewCodec()), // file config in json + fileconfig.Path("./local.yaml"), // nearby file + ), + envconfig.NewConfig( // load from environment + config.Struct(cfg), // pass config struct + ), + vc, + }, config.LoadOverride(true), + ); err != nil { + logger.Fatalf(ctx, "failed to load config: %v", err) + } + + if err := config.Validate(ctx, cfg); err != nil { + logger.Fatalf(ctx, "failed to validate config: %v", err) + } + + svc := micro.NewService() + + if err := svc.Init( + micro.Name(cfg.Server.Name), + micro.Version(cfg.Server.Version), + ); err != nil { + logger.Fatalf(ctx, "failed to init service: %v", err) + } + + if err := svc.Server("http").Init( + options.Address(cfg.Server.Addr), + options.Name(cfg.Server.Name), + server.Version(cfg.Server.Version), + ); err != nil { + logger.Fatalf(ctx, "failed to init service: %v", err) + } + + h := handler.NewHandler(svc, client_git.NewClient(5)) + if err := h.Init(svc.Options().Context); err != nil { + logger.Fatalf(ctx, "failed to init handler: %v", err) + } + + log := logger.NewLogger( + logger.WithLevel(logger.ParseLevel(cfg.Server.LoggerLevel)), + logger.WithCallerSkipCount(3), + ) + if err := svc.Init(micro.Logger(log)); err != nil { + logger.Fatalf(ctx, "failed to init service: %v", err) + } + + if err := pb.RegisterPkgdashServiceServer(svc.Server("http"), h); err != nil { + logger.Fatalf(ctx, "failed to register handler: %v", err) + } + + intsvc := httpsrv.NewServer( + options.Codecs("application/json", jsoncodec.NewCodec()), + options.Address(cfg.Meter.Addr), + options.Context(ctx), + ) + + if err := intsvc.Init(); err != nil { + logger.Fatalf(ctx, "failed to init http srv: %v", err) + } + + if err := healthhandler.RegisterHealthServiceServer(intsvc, healthhandler.NewHandler()); err != nil { + logger.Fatalf(ctx, "failed to set http handler: %v", err) + } + + if err := meterhandler.RegisterMeterServiceServer(intsvc, meterhandler.NewHandler()); err != nil { + logger.Fatalf(ctx, "failed to set http handler: %v", err) + } + + if err := intsvc.Start(); err != nil { + logger.Fatalf(ctx, "failed to run http srv: %v", err) + } + + cw, err := vc.Watch(ctx, config.WatchCoalesce(true), config.WatchInterval(1*time.Second, 5*time.Second)) + if err != nil { + logger.Fatalf(ctx, "failed to watch config: %v", err) + } + + defer func() { + if err := cw.Stop(); err != nil { + logger.Error(ctx, err) + } }() - svc, err := service.NewService(ctx) - if err != nil { - logger.Fatalf(ctx, "failed to create service: %v", err) - } - - // start server - if err = svc.Run(); err != nil { - logger.Fatal(ctx, err) - } + go func() { + for { + changes, err := cw.Next() + if err != nil { + logger.Errorf(ctx, "failed to get config update: %v", err) + } + for k, v := range changes { + if err = rutil.SetFieldByPath(cfg, v, k); err != nil { + logger.Errorf(ctx, "failed to set config update: %v", err) + break + } + } + if err == nil { + for k := range changes { + switch k { + case "Server.LoggerLevel": + if lvl, ok := changes[k].(string); ok { + logger.Infof(ctx, "logger level changed to %s", lvl) + logger.DefaultLogger.Level(logger.ParseLevel(lvl)) + } + } + } + } + } + }() } diff --git a/cmd/script/main.go b/cmd/script/main.go index e5f4aa5..034d2bb 100644 --- a/cmd/script/main.go +++ b/cmd/script/main.go @@ -4,7 +4,7 @@ import ( "context" "flag" "fmt" - "go.unistack.org/unistack-org/pkgdash/internal" + "git.unistack.org/unistack-org/pkgdash/internal" "io" "net/url" "os" diff --git a/config/config.go b/config/config.go deleted file mode 100644 index 7e66cb1..0000000 --- a/config/config.go +++ /dev/null @@ -1,22 +0,0 @@ -package config - -type App struct { - Name string - Version string -} - -type Config struct { - App *App - Address string `flag:"name=pkgdash.address,desc='listen address',default='127.0.0.1:8080'"` - StorageDSN map[string]string `flag:"name=storage.dsn,desc='components storage dsn',default='all=sqlite+file:database.db'"` - LogLevel string `flag:"name=logger.level,desc='logging level',default='info'"` -} - -func NewConfig() *Config { - return &Config{ - App: &App{ - Name: ServiceName, - Version: ServiceVersion, - }, - } -} diff --git a/config/variables.go b/config/variables.go deleted file mode 100644 index 8f1d4e0..0000000 --- a/config/variables.go +++ /dev/null @@ -1,6 +0,0 @@ -package config - -var ( - ServiceName = "pkgdash" - ServiceVersion = "0.0.1" -) diff --git a/go.mod b/go.mod index a8db54a..e685e88 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module go.unistack.org/unistack-org/pkgdash +module git.unistack.org/unistack-org/pkgdash go 1.20 @@ -13,32 +13,38 @@ require ( github.com/pkg/errors v0.9.1 go.unistack.org/micro-config-flag/v4 v4.0.2 go.unistack.org/micro-proto/v4 v4.0.1 - go.unistack.org/micro-server-http/v4 v4.0.9 - go.unistack.org/micro/v4 v4.0.6 + go.unistack.org/micro-server-http/v4 v4.0.11 + go.unistack.org/micro/v4 v4.0.7 go.unistack.org/protoc-gen-go-micro/v4 v4.0.6 golang.org/x/mod v0.12.0 golang.org/x/sync v0.3.0 google.golang.org/protobuf v1.31.0 -) - -require go.unistack.org/micro-client-http/v4 v4.0.2 - -require ( + go.unistack.org/micro-client-http/v4 v4.0.2 dario.cat/mergo v1.0.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect + github.com/cenkalti/backoff/v3 v3.2.2 // indirect github.com/cloudflare/circl v1.3.3 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.4.1 // indirect + github.com/go-jose/go-jose/v3 v3.0.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/gnostic v0.6.9 // indirect - github.com/hashicorp/errwrap v1.0.0 // indirect - github.com/hashicorp/go-multierror v1.1.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-retryablehttp v0.7.4 // indirect + github.com/hashicorp/go-rootcerts v1.0.2 // indirect + github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect + github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect + github.com/hashicorp/go-sockaddr v1.0.2 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/vault/api v1.9.2 // indirect github.com/iancoleman/strcase v0.2.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect @@ -53,21 +59,29 @@ require ( github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/lyft/protoc-gen-star/v2 v2.0.3 // indirect - github.com/mattn/go-isatty v0.0.18 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect + github.com/rs/zerolog v1.30.0 // indirect + github.com/ryanuber/go-glob v1.0.0 // indirect github.com/sergi/go-diff v1.1.0 // indirect github.com/skeema/knownhosts v1.2.0 // indirect github.com/spf13/afero v1.3.3 // indirect - github.com/stretchr/testify v1.8.1 // indirect + github.com/stretchr/testify v1.8.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect go.uber.org/atomic v1.6.0 // indirect - golang.org/x/crypto v0.11.0 // indirect + go.unistack.org/micro-config-vault/v4 v4.0.2 // indirect + go.unistack.org/micro-logger-zerolog/v4 v4.0.3 // indirect + golang.org/x/crypto v0.12.0 // indirect golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect - golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/net v0.14.0 // indirect + golang.org/x/sys v0.11.0 // indirect + golang.org/x/text v0.12.0 // indirect + golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.11.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index d80fc61..aae8595 100644 --- a/go.sum +++ b/go.sum @@ -111,6 +111,7 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/apache/arrow/go/arrow v0.0.0-20210818145353-234c94e4ce64/go.mod h1:2qMFB56yOP3KzkB3PbYZ4AlUFg3a88F67TIx5lB/WwY= github.com/apache/arrow/go/arrow v0.0.0-20211013220434-5962184e7a30/go.mod h1:Q7yQnSMnLvcXlZ8RV+jwz/6y1rQTqbX6C82SndT52Zs= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= @@ -161,6 +162,8 @@ github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8n github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M= +github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -285,6 +288,8 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7 github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -383,6 +388,8 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo= +github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -561,13 +568,34 @@ github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMW github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-retryablehttp v0.7.4 h1:ZQgVdpTdAL7WpMIwLzCfbalOcSUdkDZnpUv3/+BxzFA= +github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 h1:UpiO20jno/eV1eVZcxqWnUohyKRe1g8FPV/xH1s/2qs= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= +github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= +github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/vault/api v1.9.2 h1:YjkZLJ7K3inKgMZ0wzCU9OHqc+UqMQyXsPXnf3Cl2as= +github.com/hashicorp/vault/api v1.9.2/go.mod h1:jo5Y/ET+hNyz+JnKDt8XLAdKs+AM0G5W0Vp1IrFI8N8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= @@ -725,6 +753,9 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -733,8 +764,12 @@ github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= @@ -745,9 +780,15 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= @@ -837,6 +878,7 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -878,10 +920,19 @@ github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w= +github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= +github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= +github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= +github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= @@ -943,6 +994,7 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -1017,12 +1069,20 @@ go.unistack.org/micro-client-http/v4 v4.0.2 h1:0xsm2RCRWMfb1moeXQQ220uz52XE0R/PZ go.unistack.org/micro-client-http/v4 v4.0.2/go.mod h1:Z9QT/upeqrp/rXVkL0lk6AzrkTdes0W3QlFlZ+ytkqM= go.unistack.org/micro-config-flag/v4 v4.0.2 h1:qoDpT/H8a8TYZS9ucoNC0bLhNdp+UFlhnRWOuqIKAyo= go.unistack.org/micro-config-flag/v4 v4.0.2/go.mod h1:s0AYvz8rRtMHG2tkXoSmF8xFuHG12x3v1NERdMHDdiQ= +go.unistack.org/micro-config-vault/v4 v4.0.2 h1:QhDdtVJhQYmJZqAhsLRdnDZSZSzBunWX9a5l/WNKWNY= +go.unistack.org/micro-config-vault/v4 v4.0.2/go.mod h1:0gWQVkncMwaG0wZPqC98HhS6AYOcXR0lmPG/roR6AcM= +go.unistack.org/micro-logger-zerolog/v4 v4.0.2 h1:uKj/ZRiyEyiarImCm5Q3F6FvSvombZXB5aW4UGC2wVw= +go.unistack.org/micro-logger-zerolog/v4 v4.0.2/go.mod h1:EOtcMZ5WfBe9sUoYkWPurnY18uaUaeKDlMdSdaaqYz0= +go.unistack.org/micro-logger-zerolog/v4 v4.0.3 h1:ao6jGMo8jJG9WcOE738eqrWeabQaqpHMrLx+IniRDpI= +go.unistack.org/micro-logger-zerolog/v4 v4.0.3/go.mod h1:w5iq5eT/ZUAczueU5lsChJK/evwofGcs3gz5rZwyivQ= go.unistack.org/micro-proto/v4 v4.0.1 h1:2RKHgtCOOcAFgKsnngGK5bqM/6MWXOjVCdw03dbuoF8= go.unistack.org/micro-proto/v4 v4.0.1/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec= go.unistack.org/micro-server-http/v4 v4.0.9 h1:ye7LVVJSXlvE1TBvEuk4m3iZrAJk0rzs6vD2/qO/o2w= go.unistack.org/micro-server-http/v4 v4.0.9/go.mod h1:Cu4utVz2u98fychmjA2Ls6clXrja0sqH6Xu/JTamf7Y= go.unistack.org/micro/v4 v4.0.6 h1:YFWvTh3VwyOd6NHYTQcf47n2TF5+p/EhpnbuBQX3qhk= go.unistack.org/micro/v4 v4.0.6/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk= +go.unistack.org/micro/v4 v4.0.7 h1:2lwtZlHcSwgkahhFbkI4x1lOS79lw8uLHtcEhlFF+AM= +go.unistack.org/micro/v4 v4.0.7/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk= go.unistack.org/protoc-gen-go-micro/v4 v4.0.6 h1:qe6huziuXqRnsgvDSiaT1DR20iL676w37PMkdBEjvEk= go.unistack.org/protoc-gen-go-micro/v4 v4.0.6/go.mod h1:9bsKAlESlPXPBSmY/NDLL//smZbhnEMrnWyG+M8zVFA= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1055,6 +1115,8 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1169,6 +1231,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1201,6 +1265,7 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1294,16 +1359,20 @@ golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210818153620-00dd8d7831e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1311,6 +1380,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= +golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1325,11 +1395,15 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/handler/errors.go b/handler/errors.go deleted file mode 100644 index 54aca04..0000000 --- a/handler/errors.go +++ /dev/null @@ -1,80 +0,0 @@ -package handler - -import ( - "github.com/google/uuid" - "github.com/pkg/errors" - pb "go.unistack.org/unistack-org/pkgdash/proto" -) - -const ( - badRequest = `Bad Requet` - internalError = `Internal Error` - notFound = `Source Not Found` -) - -const ( - internalErrorCode = "1" - badRequestCode = "2" - notFoundErrorCode = "3" -) - -type UnmarshalError struct { - err error -} - -func (e *UnmarshalError) Error() string { - return e.err.Error() -} - -func (e *UnmarshalError) Unwrap() error { - return e.err -} - -func NewUnmarshalError(err error) error { - return errors.WithStack(&UnmarshalError{err: err}) -} - -func NewInternalError(err error) *pb.ErrorRsp { - return &pb.ErrorRsp{ - Error: &pb.Error{ - Code: internalErrorCode, - Title: internalError, - Uuid: uuid.New().String(), - Details: err.Error(), - }, - } -} - -type ParametersMissingError struct { - Err error -} - -func (e *ParametersMissingError) Error() string { - return e.Err.Error() -} - -func NewParametersMissingError(err error) error { - return errors.WithStack(&ParametersMissingError{Err: err}) -} - -func NewNotFoundError(err error) *pb.ErrorRsp { - return &pb.ErrorRsp{ - Error: &pb.Error{ - Code: notFoundErrorCode, - Title: notFound, - Uuid: uuid.New().String(), - Details: err.Error(), - }, - } -} - -func NewValidationError(err error) *pb.ErrorRsp { - return &pb.ErrorRsp{ - Error: &pb.Error{ - Code: badRequestCode, - Title: badRequest, - Uuid: uuid.New().String(), - Details: err.Error(), - }, - } -} diff --git a/handler/handlers.go b/handler/handlers.go deleted file mode 100644 index 41b7508..0000000 --- a/handler/handlers.go +++ /dev/null @@ -1,185 +0,0 @@ -package handler - -import ( - "context" - "database/sql" - "errors" - httpsrv "go.unistack.org/micro-server-http/v4" - "go.unistack.org/micro/v4" - pb "go.unistack.org/unistack-org/pkgdash/proto" - cligit "go.unistack.org/unistack-org/pkgdash/service/client_git" - "go.unistack.org/unistack-org/pkgdash/storage" - "google.golang.org/protobuf/encoding/protojson" - "google.golang.org/protobuf/types/known/emptypb" - "net/http" -) - -type Handler struct { - svc micro.Service - store storage.Storage - - protojson.MarshalOptions - protojson.UnmarshalOptions - - git cligit.Client - chanUrl chan *pb.AddPackageReq -} - -func (h *Handler) ListPackage(ctx context.Context, _ *emptypb.Empty, rsp *pb.ListPackageRsp) error { - logger := h.svc.Logger() - logger.Debug(ctx, "Start getListPackage") - - dbRsp, err := h.store.ListPackage(ctx) - if err != nil { - logger.Errorf(ctx, "error db response: %v", err) - httpsrv.SetRspCode(ctx, http.StatusInternalServerError) - return httpsrv.SetError(NewInternalError(err)) - } - - //rsp = new(pb.ListPackageRsp) - rsp.Packages = dbRsp.Decode() - - logger.Debug(ctx, "Success finish getListPackage") - return nil -} - -func (h *Handler) UpdatePackage(ctx context.Context, req *pb.UpdatePackageReq, rsp *pb.UpdatePackageRsp) error { - logger := h.svc.Logger() - logger.Debug(ctx, "Start UpdatePackage") - - if err := req.Validate(); err != nil { - logger.Error(ctx, err) - httpsrv.SetRspCode(ctx, http.StatusBadRequest) - return httpsrv.SetError(NewValidationError(err)) - } - - if err := h.store.UpdatePackage(ctx, req); err != nil { - logger.Error(ctx, err) - httpsrv.SetRspCode(ctx, http.StatusInternalServerError) - return httpsrv.SetError(NewInternalError(err)) - } - - rsp.Id = req.Id - - logger.Debug(ctx, "Success finish UpdatePackage") - return nil -} - -func (h *Handler) AddComment(ctx context.Context, req *pb.AddCommentReq, rsp *pb.AddCommentRsp) error { - logger := h.svc.Logger() - logger.Debug(ctx, "Start AddComment") - - err := req.Validate() - if err != nil { - logger.Error(ctx, err) - httpsrv.SetRspCode(ctx, http.StatusBadRequest) - return httpsrv.SetError(NewValidationError(err)) - } - - if rsp.Id, err = h.store.AddComment(ctx, req); err != nil { - logger.Error(ctx, err) - if errors.Is(err, sql.ErrNoRows) { - httpsrv.SetRspCode(ctx, http.StatusNotFound) - return httpsrv.SetError(NewNotFoundError(err)) - } - httpsrv.SetRspCode(ctx, http.StatusInternalServerError) - return httpsrv.SetError(NewInternalError(err)) - } - - logger.Debug(ctx, "Success finish addComment") - return nil -} - -func (h *Handler) AddPackage(ctx context.Context, req *pb.AddPackageReq, rsp *pb.AddPackageRsp) error { - logger := h.svc.Logger() - logger.Debug(ctx, "Start AddPackage") - - err := req.Validate() - if err != nil { - logger.Error(ctx, err) - httpsrv.SetRspCode(ctx, http.StatusBadRequest) - return httpsrv.SetError(NewValidationError(err)) - } - - if h.git.IsClose() { - logger.Error(ctx, "chan is closed") - } else { - h.chanUrl <- req - } - - rsp.Status = "Sent" - - logger.Debug(ctx, "Success finish addPackage") - return nil -} - -func (h *Handler) GetModule(ctx context.Context, req *pb.GetModuleReq, rsp *pb.GetModuleRsp) error { - logger := h.svc.Logger() - logger.Debug(ctx, "Start GetModule") - - err := req.Validate() - if err != nil { - logger.Error(ctx, err) - httpsrv.SetRspCode(ctx, http.StatusBadRequest) - return httpsrv.SetError(NewValidationError(err)) - } - - modules, err := h.store.GetModule(ctx, req) - if err != nil { - logger.Error(ctx, err) - httpsrv.SetRspCode(ctx, http.StatusInternalServerError) - return httpsrv.SetError(NewInternalError(err)) - } - - rsp.Modules = modules.Decode() - - logger.Debug(ctx, "Success finish getModule") - return nil -} - -func (h *Handler) GetComments(ctx context.Context, req *pb.GetCommentsReq, rsp *pb.GetCommentsRsp) error { - logger := h.svc.Logger() - logger.Debug(ctx, "Start GetModule") - - err := req.Validate() - if err != nil { - logger.Error(ctx, err) - httpsrv.SetRspCode(ctx, http.StatusBadRequest) - return httpsrv.SetError(NewValidationError(err)) - } - - comments, err := h.store.GetComment(ctx, req) - if err != nil { - logger.Error(ctx, err) - httpsrv.SetRspCode(ctx, http.StatusInternalServerError) - return httpsrv.SetError(NewInternalError(err)) - } - - rsp.Comments = comments.Decode() - - logger.Debug(ctx, "Success finish getModule") - return nil -} - -func NewHandler(svc micro.Service, client cligit.Client) *Handler { - h := &Handler{ - svc: svc, - git: client, - } - h.EmitUnpopulated = true - h.UseProtoNames = false - return h -} - -func (h *Handler) Init(ctx context.Context) error { - store, err := storage.FromContext(h.svc.Options().Context) - if err != nil { - return errors.New("missing storage") - } - - h.chanUrl = h.git.Run(ctx, store) - - h.store = store - - return nil -} diff --git a/internal/config/config.go b/internal/config/config.go new file mode 100644 index 0000000..d0818d4 --- /dev/null +++ b/internal/config/config.go @@ -0,0 +1,64 @@ +package config + +import "time" + +type AppConfig struct{} + +type ServerConfig struct { + Name string `json:"name" yaml:"name"` + Version string `json:"-" yaml:"-"` + Addr string `json:"addr" yaml:"addr" default:":9090"` + Crt string `json:"crt" yaml:"crt"` + Key string `json:"key" yaml:"key"` + ID string `json:"-" yaml:"-" default:"micro:generate uuid"` + LoggerLevel string `json:"logger_level" yaml:"logger_level"` +} + +type TracerConfig struct { + Metadata map[string]string `json:"metadata" yaml:"metadata"` + AgentHost string `env:"JAEGER_AGENT_HOST" json:"host" yaml:"host" default:"127.0.0.1"` + AgentPort string `env:"JAEGER_AGENT_PORT" json:"port" yaml:"port" default:"6831"` + Collector string `env:"JAEGER_ENDPOINT,TRACER_ENDPOINT" json:"endpoint" yaml:"endpoint"` +} + +type VaultConfig struct { + Addr string `env:"VAULT_ADDR" json:"addr" yaml:"addr" default:"http://127.0.0.1:8200"` + Token string `env:"VAULT_TOKEN" json:"-" yaml:"-"` + Path string `env:"VAULT_PATH" json:"-" yaml:"-" default:"apigw/data/authn"` +} + +type MeterConfig struct { + Addr string `json:"addr" yaml:"addr" default:"0.0.0.0:8080"` + Path string `json:"path" yaml:"path" default:"/metrics"` +} + +type DatabaseConfig struct { + DSN string `json:"dsn" yaml:"dsn"` + Type string `json:"-" yaml:"-"` + Migrate string `json:"-" yaml:"-"` + ConnStr string `json:"-" yaml:"-"` + MaxOpenConns int `json:"-" yaml:"-"` + MaxIdleConns int `json:"-" yaml:"-"` + ConnMaxLifetime time.Duration `json:"-" yaml:"-"` + ConnMaxIdleTime time.Duration `json:"-" yaml:"-"` + MigrateForce bool `json:"-" yaml:"-"` +} + +type Config struct { + App *AppConfig `json:"app" yaml:"app"` + Database *DatabaseConfig `json:"database" yaml:"database"` + Server *ServerConfig `json:"server" yaml:"server"` + Meter *MeterConfig `json:"meter" yaml:"meter"` + Vault *VaultConfig `json:"-" yaml:"-"` + Tracer *TracerConfig `json:"tracer" yaml:"tracer"` +} + +func NewConfig(name, version string) *Config { + return &Config{ + App: &AppConfig{}, + Server: &ServerConfig{Name: name, Version: version}, + Tracer: &TracerConfig{}, + Meter: &MeterConfig{}, + Vault: &VaultConfig{}, + } +} diff --git a/internal/handler/comments_create.go b/internal/handler/comments_create.go new file mode 100644 index 0000000..7dfa279 --- /dev/null +++ b/internal/handler/comments_create.go @@ -0,0 +1,40 @@ +package handler + +import ( + "context" + "database/sql" + "errors" + "net/http" + + httpsrv "go.unistack.org/micro-server-http/v4" + "git.unistack.org/unistack-org/pkgdash/internal/models" + pb "git.unistack.org/unistack-org/pkgdash/proto" +) + +func (h *Handler) CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq, rsp *pb.CommentsCreateRsp) error { + logger := h.svc.Logger() + logger.Debug(ctx, "Start AddComment") + + err := req.Validate() + if err != nil { + logger.Error(ctx, err) + httpsrv.SetRspCode(ctx, http.StatusBadRequest) + return httpsrv.SetError(NewValidationError(err)) + } + + var com *models.Comment + if com, err = h.store.CommentsCreate(ctx, req); err != nil { + logger.Error(ctx, err) + if errors.Is(err, sql.ErrNoRows) { + httpsrv.SetRspCode(ctx, http.StatusNotFound) + return httpsrv.SetError(NewNotFoundError(err)) + } + httpsrv.SetRspCode(ctx, http.StatusInternalServerError) + return httpsrv.SetError(NewInternalError(err)) + } + + rsp.Comment = models.NewComment(com) + + logger.Debug(ctx, "Success finish addComment") + return nil +} diff --git a/internal/handler/comments_delete.go b/internal/handler/comments_delete.go new file mode 100644 index 0000000..faf6d4e --- /dev/null +++ b/internal/handler/comments_delete.go @@ -0,0 +1,36 @@ +package handler + +import ( + "context" + "database/sql" + "errors" + "net/http" + + httpsrv "go.unistack.org/micro-server-http/v4" + pb "git.unistack.org/unistack-org/pkgdash/proto" +) + +func (h *Handler) CommentsDelete(ctx context.Context, req *pb.CommentsDeleteReq, rsp *pb.CommentsDeleteRsp) error { + logger := h.svc.Logger() + logger.Debug(ctx, "Start AddComment") + + err := req.Validate() + if err != nil { + logger.Error(ctx, err) + httpsrv.SetRspCode(ctx, http.StatusBadRequest) + return httpsrv.SetError(NewValidationError(err)) + } + + if err = h.store.CommentsDelete(ctx, req); err != nil { + logger.Error(ctx, err) + if errors.Is(err, sql.ErrNoRows) { + httpsrv.SetRspCode(ctx, http.StatusNotFound) + return httpsrv.SetError(NewNotFoundError(err)) + } + httpsrv.SetRspCode(ctx, http.StatusInternalServerError) + return httpsrv.SetError(NewInternalError(err)) + } + + logger.Debug(ctx, "Success finish addComment") + return nil +} diff --git a/internal/handler/comments_list.go b/internal/handler/comments_list.go new file mode 100644 index 0000000..af888b9 --- /dev/null +++ b/internal/handler/comments_list.go @@ -0,0 +1,36 @@ +package handler + +import ( + "context" + "net/http" + + httpsrv "go.unistack.org/micro-server-http/v4" + "git.unistack.org/unistack-org/pkgdash/internal/models" + pb "git.unistack.org/unistack-org/pkgdash/proto" +) + +func (h *Handler) CommentsList(ctx context.Context, req *pb.CommentsListReq, rsp *pb.CommentsListRsp) error { + logger := h.svc.Logger() + logger.Debug(ctx, "Start GetModule") + + err := req.Validate() + if err != nil { + logger.Error(ctx, err) + httpsrv.SetRspCode(ctx, http.StatusBadRequest) + return httpsrv.SetError(NewValidationError(err)) + } + + comments, err := h.store.CommentsList(ctx, req) + if err != nil { + logger.Error(ctx, err) + httpsrv.SetRspCode(ctx, http.StatusInternalServerError) + return httpsrv.SetError(NewInternalError(err)) + } + + for _, com := range comments { + rsp.Comments = append(rsp.Comments, models.NewComment(com)) + } + + logger.Debug(ctx, "Success finish getModule") + return nil +} diff --git a/internal/handler/comments_lookup.go b/internal/handler/comments_lookup.go new file mode 100644 index 0000000..e3df816 --- /dev/null +++ b/internal/handler/comments_lookup.go @@ -0,0 +1,11 @@ +package handler + +import ( + "context" + + pb "git.unistack.org/unistack-org/pkgdash/proto" +) + +func (h *Handler) CommentsLookup(ctx context.Context, req *pb.CommentsLookupReq, rsp *pb.CommentsLookupRsp) error { + return nil +} diff --git a/internal/handler/handler.go b/internal/handler/handler.go new file mode 100644 index 0000000..64252e6 --- /dev/null +++ b/internal/handler/handler.go @@ -0,0 +1,76 @@ +package handler + +import ( + "context" + "errors" + "net/http" + "strconv" + + "github.com/google/uuid" + "go.unistack.org/micro/v4" + cligit "git.unistack.org/unistack-org/pkgdash/internal/service/client_git" + "git.unistack.org/unistack-org/pkgdash/internal/storage" + pb "git.unistack.org/unistack-org/pkgdash/proto" + "google.golang.org/protobuf/encoding/protojson" +) + +type Handler struct { + svc micro.Service + store storage.Storage + + protojson.MarshalOptions + protojson.UnmarshalOptions + + git cligit.Client + chanUrl chan *pb.PackagesCreateReq +} + +func NewNotFoundError(err error) *pb.ErrorRsp { + return &pb.ErrorRsp{ + Code: strconv.Itoa(http.StatusBadRequest), + Title: "NotFound", + Uuid: uuid.New().String(), + Details: err.Error(), + } +} + +func NewInternalError(err error) *pb.ErrorRsp { + return &pb.ErrorRsp{ + Code: strconv.Itoa(http.StatusInternalServerError), + Title: "InternalServerError", + Uuid: uuid.New().String(), + Details: err.Error(), + } +} + +func NewValidationError(err error) *pb.ErrorRsp { + return &pb.ErrorRsp{ + Code: strconv.Itoa(http.StatusBadRequest), + Title: "BadRequest", + Uuid: uuid.New().String(), + Details: err.Error(), + } +} + +func NewHandler(svc micro.Service, client cligit.Client) *Handler { + h := &Handler{ + svc: svc, + git: client, + } + h.EmitUnpopulated = true + h.UseProtoNames = false + return h +} + +func (h *Handler) Init(ctx context.Context) error { + store, err := storage.FromContext(h.svc.Options().Context) + if err != nil { + return errors.New("missing storage") + } + + h.chanUrl = h.git.Run(ctx, store) + + h.store = store + + return nil +} diff --git a/internal/handler/modules_list.go b/internal/handler/modules_list.go new file mode 100644 index 0000000..bae5a08 --- /dev/null +++ b/internal/handler/modules_list.go @@ -0,0 +1,35 @@ +package handler + +import ( + "context" + "net/http" + + httpsrv "go.unistack.org/micro-server-http/v4" + "git.unistack.org/unistack-org/pkgdash/internal/models" + pb "git.unistack.org/unistack-org/pkgdash/proto" +) + +func (h *Handler) ModulesList(ctx context.Context, req *pb.ModulesListReq, rsp *pb.ModulesListRsp) error { + logger := h.svc.Logger() + logger.Debug(ctx, "Start GetModule") + + err := req.Validate() + if err != nil { + logger.Error(ctx, err) + httpsrv.SetRspCode(ctx, http.StatusBadRequest) + return httpsrv.SetError(NewValidationError(err)) + } + + modules, err := h.store.ModulesList(ctx, req) + if err != nil { + logger.Error(ctx, err) + httpsrv.SetRspCode(ctx, http.StatusInternalServerError) + return httpsrv.SetError(NewInternalError(err)) + } + + for _, mod := range modules { + rsp.Modules = append(rsp.Modules, models.NewModule(mod)) + } + logger.Debug(ctx, "Success finish getModule") + return nil +} diff --git a/internal/handler/packages_create.go b/internal/handler/packages_create.go new file mode 100644 index 0000000..dd75b9e --- /dev/null +++ b/internal/handler/packages_create.go @@ -0,0 +1,32 @@ +package handler + +import ( + "context" + "net/http" + + httpsrv "go.unistack.org/micro-server-http/v4" + pb "git.unistack.org/unistack-org/pkgdash/proto" +) + +func (h *Handler) PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq, rsp *pb.PackagesCreateRsp) error { + logger := h.svc.Logger() + logger.Debug(ctx, "Start AddPackage") + + err := req.Validate() + if err != nil { + logger.Error(ctx, err) + httpsrv.SetRspCode(ctx, http.StatusBadRequest) + return httpsrv.SetError(NewValidationError(err)) + } + + if h.git.IsClose() { + logger.Error(ctx, "chan is closed") + } else { + h.chanUrl <- req + } + + rsp.Status = "Sent" + + logger.Debug(ctx, "Success finish addPackage") + return nil +} diff --git a/internal/handler/packages_delete.go b/internal/handler/packages_delete.go new file mode 100644 index 0000000..306a475 --- /dev/null +++ b/internal/handler/packages_delete.go @@ -0,0 +1,29 @@ +package handler + +import ( + "context" + "net/http" + + httpsrv "go.unistack.org/micro-server-http/v4" + pb "git.unistack.org/unistack-org/pkgdash/proto" +) + +func (h *Handler) PackagesDelete(ctx context.Context, req *pb.PackagesDeleteReq, rsp *pb.PackagesDeleteRsp) error { + logger := h.svc.Logger() + logger.Debug(ctx, "Start UpdatePackage") + + if err := req.Validate(); err != nil { + logger.Error(ctx, err) + httpsrv.SetRspCode(ctx, http.StatusBadRequest) + return httpsrv.SetError(NewValidationError(err)) + } + + if err := h.store.PackagesDelete(ctx, req); err != nil { + logger.Error(ctx, err) + httpsrv.SetRspCode(ctx, http.StatusInternalServerError) + return httpsrv.SetError(NewInternalError(err)) + } + + logger.Debug(ctx, "Success finish UpdatePackage") + return nil +} diff --git a/internal/handler/packages_list.go b/internal/handler/packages_list.go new file mode 100644 index 0000000..29255b3 --- /dev/null +++ b/internal/handler/packages_list.go @@ -0,0 +1,28 @@ +package handler + +import ( + "context" + "net/http" + + httpsrv "go.unistack.org/micro-server-http/v4" + "git.unistack.org/unistack-org/pkgdash/internal/models" + pb "git.unistack.org/unistack-org/pkgdash/proto" +) + +func (h *Handler) PackagesList(ctx context.Context, req *pb.PackagesListReq, rsp *pb.PackagesListRsp) error { + logger := h.svc.Logger() + logger.Debug(ctx, "Start getListPackage") + + packages, err := h.store.PackagesList(ctx, req) + if err != nil { + logger.Errorf(ctx, "error db response: %v", err) + httpsrv.SetRspCode(ctx, http.StatusInternalServerError) + return httpsrv.SetError(NewInternalError(err)) + } + + for _, pkg := range packages { + rsp.Packages = append(rsp.Packages, models.NewPackage(pkg)) + } + logger.Debug(ctx, "Success finish getListPackage") + return nil +} diff --git a/internal/handler/packages_update.go b/internal/handler/packages_update.go new file mode 100644 index 0000000..1bcf064 --- /dev/null +++ b/internal/handler/packages_update.go @@ -0,0 +1,31 @@ +package handler + +import ( + "context" + "net/http" + + httpsrv "go.unistack.org/micro-server-http/v4" + pb "git.unistack.org/unistack-org/pkgdash/proto" +) + +func (h *Handler) PackagesUpdate(ctx context.Context, req *pb.PackagesUpdateReq, rsp *pb.PackagesUpdateRsp) error { + logger := h.svc.Logger() + logger.Debug(ctx, "Start UpdatePackage") + + if err := req.Validate(); err != nil { + logger.Error(ctx, err) + httpsrv.SetRspCode(ctx, http.StatusBadRequest) + return httpsrv.SetError(NewValidationError(err)) + } + + if err := h.store.PackagesUpdate(ctx, req); err != nil { + logger.Error(ctx, err) + httpsrv.SetRspCode(ctx, http.StatusInternalServerError) + return httpsrv.SetError(NewInternalError(err)) + } + + // rsp.Id = req.Id + + logger.Debug(ctx, "Success finish UpdatePackage") + return nil +} diff --git a/internal/models/models.go b/internal/models/models.go new file mode 100644 index 0000000..6a741a6 --- /dev/null +++ b/internal/models/models.go @@ -0,0 +1,78 @@ +package models + +import ( + "time" + + pb "git.unistack.org/unistack-org/pkgdash/proto" + "google.golang.org/protobuf/types/known/timestamppb" +) + +type Package struct { + Name string `db:"name" json:"name"` + URL string `db:"url" json:"url"` + Modules []uint64 `db:"modules" json:"modules"` + Issues []uint64 `db:"issues" json:"issues,omitempty"` + Comments []uint64 `db:"comments" json:"comments,omitempty"` + ID uint64 `db:"id" json:"id"` + Created time.Time `db:"created" json:"created"` + Updated time.Time `db:"updated" json:"updated,omitempty"` +} + +func NewPackage(pkg *Package) *pb.Package { + return &pb.Package{ + Name: pkg.Name, + Url: pkg.URL, + Modules: pkg.Modules, + Issues: pkg.Issues, + Comments: pkg.Comments, + Id: pkg.ID, + Created: timestamppb.New(pkg.Created), + Updated: timestamppb.New(pkg.Updated), + } +} + +type Module struct { + Name string `db:"name"` + Version string `db:"version"` + LastVersion string `db:"last_version"` + ID uint64 `db:"id"` + Package uint64 `db:"package"` + Created time.Time `db:"created" json:"created"` + Updated time.Time `db:"updated" json:"updated,omitempty"` +} + +func NewModule(mod *Module) *pb.Module { + return &pb.Module{ + Name: mod.Name, + Version: mod.Version, + LastVersion: mod.LastVersion, + Package: mod.Package, + Id: mod.ID, + Created: timestamppb.New(mod.Created), + Updated: timestamppb.New(mod.Updated), + } +} + +type Issue struct { + Desc string `db:"desc"` + Modules []int64 `db:"modules"` + ID uint64 `db:"id"` + Status uint64 `db:"status"` + Package int64 `db:"package"` +} + +type Comment struct { + Created time.Time `db:"created" json:"created"` + Updated time.Time `db:"updated" json:"updated,omitempty"` + Text string `db:"value" json:"text"` + ID uint64 `db:"id" json:"id"` +} + +func NewComment(com *Comment) *pb.Comment { + return &pb.Comment{ + Id: com.ID, + Text: com.Text, + Created: timestamppb.New(com.Created), + Updated: timestamppb.New(com.Updated), + } +} diff --git a/service/client_git/client.go b/internal/service/client_git/client.go similarity index 88% rename from service/client_git/client.go rename to internal/service/client_git/client.go index 3ad0ff9..c76d5f0 100644 --- a/service/client_git/client.go +++ b/internal/service/client_git/client.go @@ -15,35 +15,35 @@ import ( "github.com/go-git/go-git/v5/storage/memory" "github.com/pkg/errors" "go.unistack.org/micro/v4/logger" - "go.unistack.org/unistack-org/pkgdash/internal" - "go.unistack.org/unistack-org/pkgdash/models" - pb "go.unistack.org/unistack-org/pkgdash/proto" - "go.unistack.org/unistack-org/pkgdash/storage" + "git.unistack.org/unistack-org/pkgdash/internal" + "git.unistack.org/unistack-org/pkgdash/internal/models" + "git.unistack.org/unistack-org/pkgdash/internal/storage" + pb "git.unistack.org/unistack-org/pkgdash/proto" "golang.org/x/mod/modfile" "golang.org/x/mod/module" ) type Client interface { - Run(ctx context.Context, st storage.Storage) chan *pb.AddPackageReq + Run(ctx context.Context, st storage.Storage) chan *pb.PackagesCreateReq IsClose() bool Done() <-chan struct{} } type client struct { - worker chan *pb.AddPackageReq + worker chan *pb.PackagesCreateReq closed bool lock chan struct{} } func NewClient(cap uint) Client { return &client{ - make(chan *pb.AddPackageReq, cap), + make(chan *pb.PackagesCreateReq, cap), false, make(chan struct{}), } } -func (c *client) Run(ctx context.Context, st storage.Storage) chan *pb.AddPackageReq { +func (c *client) Run(ctx context.Context, st storage.Storage) chan *pb.PackagesCreateReq { go func() { defer close(c.worker) for { @@ -71,7 +71,7 @@ func (c *client) Done() <-chan struct{} { return c.lock } -func runner(ctx context.Context, st storage.Storage, req *pb.AddPackageReq) { +func runner(ctx context.Context, st storage.Storage, req *pb.PackagesCreateReq) { modules, err := getGoModule(ctx, req.Url) if err != nil { logger.Error(ctx, err) @@ -85,7 +85,7 @@ func runner(ctx context.Context, st storage.Storage, req *pb.AddPackageReq) { return } - if err = st.AddPackage(ctx, req); err != nil { + if err = st.PackagesCreate(ctx, req); err != nil { logger.Error(ctx, err) } } diff --git a/service/client_git/client_test.go b/internal/service/client_git/client_test.go similarity index 74% rename from service/client_git/client_test.go rename to internal/service/client_git/client_test.go index 9df12c2..edf56ef 100644 --- a/service/client_git/client_test.go +++ b/internal/service/client_git/client_test.go @@ -5,16 +5,17 @@ import ( "database/sql" "embed" "fmt" - pb "go.unistack.org/unistack-org/pkgdash/proto" - "go.unistack.org/unistack-org/pkgdash/storage" - "go.unistack.org/unistack-org/pkgdash/storage/postgres" - "go.unistack.org/unistack-org/pkgdash/storage/sqlite" "testing" + + "git.unistack.org/unistack-org/pkgdash/internal/storage" + // "git.unistack.org/unistack-org/pkgdash/internal/storage/postgres" + "git.unistack.org/unistack-org/pkgdash/internal/storage/sqlite" + pb "git.unistack.org/unistack-org/pkgdash/proto" ) func TestClientPG(t *testing.T) { - dsn := fmt.Sprintf("user=%s password=%s host=%s port=%s dbname=%s sslmode=disable", "test", "123", "localhost", "5432", "postgres") - conn, err := sql.Open("postgres", dsn) + dsn := fmt.Sprintf("file:///database.db") + conn, err := sql.Open("sqlite", dsn) if err != nil { t.Fatal(err) } @@ -23,7 +24,7 @@ func TestClientPG(t *testing.T) { t.Fatal(err) } - fucntion := postgres.NewStorage() + fucntion := sqlite.NewStorage() st := fucntion(conn, embed.FS{}) s, ok := st.(storage.Storage) if !ok { diff --git a/service/service.go b/internal/service/service.go similarity index 72% rename from service/service.go rename to internal/service/service.go index 1ba4e08..6adfede 100644 --- a/service/service.go +++ b/internal/service/service.go @@ -3,7 +3,10 @@ package service import ( "context" "database/sql" - httpsrv "go.unistack.org/micro-server-http/v4" + "net/url" + "strings" + + httpsrv "go.unistack.org/micro-server-http/v4" // TODO "go.unistack.org/micro/v4" "go.unistack.org/micro/v4/config" microcfg "go.unistack.org/micro/v4/config" @@ -11,19 +14,17 @@ import ( "go.unistack.org/micro/v4/options" "go.unistack.org/micro/v4/register" "go.unistack.org/micro/v4/server" - intcfg "go.unistack.org/unistack-org/pkgdash/config" - "go.unistack.org/unistack-org/pkgdash/handler" - pb "go.unistack.org/unistack-org/pkgdash/proto" - "go.unistack.org/unistack-org/pkgdash/service/client_git" - "go.unistack.org/unistack-org/pkgdash/storage" - "net/url" - "strings" + intcfg "git.unistack.org/unistack-org/pkgdash/config" + "git.unistack.org/unistack-org/pkgdash/handler" + pb "git.unistack.org/unistack-org/pkgdash/proto" + "git.unistack.org/unistack-org/pkgdash/service/client_git" + "git.unistack.org/unistack-org/pkgdash/storage" ) func NewService(ctx context.Context) (micro.Service, error) { var reg register.Register - cfg := intcfg.NewConfig() + cfg := intcfg.NewConfig(ServiceName, Service) cs := microcfg.NewConfig(config.Struct(cfg)) @@ -105,6 +106,26 @@ func NewService(ctx context.Context) (micro.Service, error) { logger.Fatalf(ctx, "failed to register handler: %v", err) } + intsvc := httpsrv.NewServer( + server.Codec("application/json", jsoncodec.NewCodec()), + server.Address(cfg.Meter.Addr), server.Context(ctx), + ) + + if err := intsvc.Init(); err != nil { + logger.Fatalf(ctx, "failed to init http srv: %v", err) + } + + if err := healthhandler.RegisterHealthServiceServer(intsvc, healthhandler.NewHandler()); err != nil { + logger.Fatalf(ctx, "failed to set http handler: %v", err) + } + if err := meterhandler.RegisterMeterServiceServer(intsvc, meterhandler.NewHandler()); err != nil { + logger.Fatalf(ctx, "failed to set http handler: %v", err) + } + + if err := intsvc.Start(); err != nil { + logger.Fatalf(ctx, "failed to run http srv: %v", err) + } + return svc, nil } diff --git a/storage/migrations/postgres/000001_init_schema.down.sql b/internal/storage/migrations/postgres/000001_init_schema.down.sql similarity index 100% rename from storage/migrations/postgres/000001_init_schema.down.sql rename to internal/storage/migrations/postgres/000001_init_schema.down.sql diff --git a/storage/migrations/postgres/000001_init_schema.up.sql b/internal/storage/migrations/postgres/000001_init_schema.up.sql similarity index 93% rename from storage/migrations/postgres/000001_init_schema.up.sql rename to internal/storage/migrations/postgres/000001_init_schema.up.sql index 2e7fdd1..bafd27d 100644 --- a/storage/migrations/postgres/000001_init_schema.up.sql +++ b/internal/storage/migrations/postgres/000001_init_schema.up.sql @@ -7,8 +7,9 @@ create table if not exists dashboard ( create table if not exists comment ( id serial not null unique primary key , "text" text , + package integer not null, created timestamp not null default current_timestamp , - updated timestamp + updated timestamp default current_timestamp ); create table if not exists module ( diff --git a/storage/migrations/sqlite/000001_init_schema.down.sql b/internal/storage/migrations/sqlite/000001_init_schema.down.sql similarity index 100% rename from storage/migrations/sqlite/000001_init_schema.down.sql rename to internal/storage/migrations/sqlite/000001_init_schema.down.sql diff --git a/storage/migrations/sqlite/000001_init_schema.up.sql b/internal/storage/migrations/sqlite/000001_init_schema.up.sql similarity index 92% rename from storage/migrations/sqlite/000001_init_schema.up.sql rename to internal/storage/migrations/sqlite/000001_init_schema.up.sql index 8893211..4d39c19 100644 --- a/storage/migrations/sqlite/000001_init_schema.up.sql +++ b/internal/storage/migrations/sqlite/000001_init_schema.up.sql @@ -7,8 +7,9 @@ create table if not exists dashboard ( create table if not exists comment ( id integer primary key autoincrement not null , "text" text , + package integer not null, created timestamp not null default current_timestamp , - updated timestamp + updated timestamp default current_timestamp ); create table if not exists module ( diff --git a/storage/postgres/queries.go b/internal/storage/postgres_tmp/queries.go similarity index 100% rename from storage/postgres/queries.go rename to internal/storage/postgres_tmp/queries.go diff --git a/storage/postgres/storage.go b/internal/storage/postgres_tmp/storage.go similarity index 88% rename from storage/postgres/storage.go rename to internal/storage/postgres_tmp/storage.go index c436cb0..28d1fba 100644 --- a/storage/postgres/storage.go +++ b/internal/storage/postgres_tmp/storage.go @@ -13,9 +13,9 @@ import ( "github.com/golang-migrate/migrate/v4/source/iofs" "github.com/lib/pq" "go.unistack.org/micro/v4/logger" - "go.unistack.org/unistack-org/pkgdash/config" - "go.unistack.org/unistack-org/pkgdash/models" - pb "go.unistack.org/unistack-org/pkgdash/proto" + "git.unistack.org/unistack-org/pkgdash/internal/config" + "git.unistack.org/unistack-org/pkgdash/internal/models" + pb "git.unistack.org/unistack-org/pkgdash/proto" ) const ( @@ -85,11 +85,11 @@ func (s *Postgres) MigrateDown() error { return nil } -func (s *Postgres) UpdatePackage(ctx context.Context, req *pb.UpdatePackageReq) error { +func (s *Postgres) PackagesUpdate(ctx context.Context, req *pb.PackagesUpdateReq) error { panic("need implement") } -func (s *Postgres) ListPackage(ctx context.Context) (models.ListPackage, error) { +func (s *Postgres) PackagesList(ctx context.Context, req *pb.PackagesListReq) (models.ListPackage, error) { rows, err := s.db.QueryContext(ctx, queryListPackage) if err != nil { return nil, err @@ -118,7 +118,7 @@ func (s *Postgres) ListPackage(ctx context.Context) (models.ListPackage, error) return result, err } -func (s *Postgres) AddComment(ctx context.Context, req *pb.AddCommentReq) error { +func (s *Postgres) CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq) error { tx, err := s.db.BeginTx(ctx, nil) if err != nil { return err @@ -134,7 +134,7 @@ func (s *Postgres) AddComment(ctx context.Context, req *pb.AddCommentReq) error } }() - res, err := tx.ExecContext(ctx, queryAddComment, req.Text, req.IdPackage) + res, err := tx.ExecContext(ctx, queryAddComment, req.Text, req.PackageId) if err != nil { return err } @@ -148,7 +148,7 @@ func (s *Postgres) AddComment(ctx context.Context, req *pb.AddCommentReq) error return err } -func (s *Postgres) AddPackage(ctx context.Context, req *pb.AddPackageReq) error { +func (s *Postgres) PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq) error { tx, err := s.db.BeginTx(ctx, nil) if err != nil { return err diff --git a/storage/postgres/storage_test.go b/internal/storage/postgres_tmp/storage_test.go similarity index 90% rename from storage/postgres/storage_test.go rename to internal/storage/postgres_tmp/storage_test.go index 2fcbd67..7ff77eb 100644 --- a/storage/postgres/storage_test.go +++ b/internal/storage/postgres_tmp/storage_test.go @@ -2,8 +2,9 @@ package postgres import ( "fmt" - "go.unistack.org/unistack-org/pkgdash/models" "testing" + + "git.unistack.org/unistack-org/pkgdash/internal/models" ) func TestGenerate(t *testing.T) { diff --git a/storage/sqlite/queries.go b/internal/storage/sqlite/queries.go similarity index 53% rename from storage/sqlite/queries.go rename to internal/storage/sqlite/queries.go index 5efffd2..b7f54a8 100644 --- a/storage/sqlite/queries.go +++ b/internal/storage/sqlite/queries.go @@ -1,37 +1,34 @@ package sqlite const ( - queryListPackage = ` -select + queryPackagesList = `select id, name, url, comments - --modules, - --issues, + modules, + issues, from package; ` - queryAddComment = ` + queryCommentsCreate = ` insert into comment(text) values ($1) returning id; update package set comments = json_insert(comments, '$[#]', ( select last_insert_rowid() as id from comment )) where id = $2 ; ` - queryAddPackage = ` + queryPackagesCreate = ` insert into package(name, url, modules) values ($1, $2, $3); ` queryInsMsgGetIDs = ` -insert into module(name, version, last_version) values +insert into module(name, version, last_version) values %s returning id; ` - queryGetModule = ` -select id, name, version, last_version from module -where id in %s ; + queryModulesList = ` +select id, name, version, last_version, created, updated from modules; ` - queryGetComments = ` -select id, text, created, updated from comment -where id in %s ; + queryCommentsList = ` +select id, text, created, updated from comments; ` ) diff --git a/storage/sqlite/storage.go b/internal/storage/sqlite/storage.go similarity index 64% rename from storage/sqlite/storage.go rename to internal/storage/sqlite/storage.go index 0d0e9d4..6d411f2 100644 --- a/storage/sqlite/storage.go +++ b/internal/storage/sqlite/storage.go @@ -14,9 +14,8 @@ import ( "github.com/lib/pq" _ "github.com/mattn/go-sqlite3" "go.unistack.org/micro/v4/logger" - "go.unistack.org/unistack-org/pkgdash/config" - "go.unistack.org/unistack-org/pkgdash/models" - pb "go.unistack.org/unistack-org/pkgdash/proto" + "git.unistack.org/unistack-org/pkgdash/internal/models" + pb "git.unistack.org/unistack-org/pkgdash/proto" ) const ( @@ -37,7 +36,7 @@ func NewStorage() func(*sql.DB, embed.FS) interface{} { func (s *Sqlite) MigrateUp() error { driver, err := sqlite.WithInstance(s.db, &sqlite.Config{ MigrationsTable: sqlite.DefaultMigrationsTable, - DatabaseName: config.ServiceName, + DatabaseName: "pkgdash", }) if err != nil { return err @@ -48,7 +47,7 @@ func (s *Sqlite) MigrateUp() error { } // TODO: pass own logger - m, err := migrate.NewWithInstance("fs", source, config.ServiceName, driver) + m, err := migrate.NewWithInstance("fs", source, "pkgdash", driver) if err != nil { return err } @@ -63,7 +62,7 @@ func (s *Sqlite) MigrateUp() error { func (s *Sqlite) MigrateDown() error { driver, err := sqlite.WithInstance(s.db, &sqlite.Config{ MigrationsTable: sqlite.DefaultMigrationsTable, - DatabaseName: config.ServiceName, + DatabaseName: "pkgdash", }) if err != nil { return err @@ -74,7 +73,7 @@ func (s *Sqlite) MigrateDown() error { } // TODO: pass own logger - m, err := migrate.NewWithInstance("fs", source, config.ServiceName, driver) + m, err := migrate.NewWithInstance("fs", source, "pkgdash", driver) if err != nil { return err } @@ -86,40 +85,44 @@ func (s *Sqlite) MigrateDown() error { return nil } -func (s *Sqlite) UpdatePackage(ctx context.Context, req *pb.UpdatePackageReq) error { +func (s *Sqlite) PackagesUpdate(ctx context.Context, req *pb.PackagesUpdateReq) error { panic("need implement") } -func (s *Sqlite) ListPackage(ctx context.Context) (models.ListPackage, error) { - rows, err := s.db.QueryContext(ctx, queryListPackage) +func (s *Sqlite) PackagesList(ctx context.Context, req *pb.PackagesListReq) ([]*models.Package, error) { + var packages []*models.Package + + rows, err := s.db.QueryContext(ctx, queryPackagesList) if err != nil { return nil, err } - defer func() { - if err = rows.Close(); err != nil { - return - } - err = rows.Err() - }() - - result := make([]*models.Package, 0) - for rows.Next() { - tmp := &models.Package{} + for ; rows.Err() == nil; rows.Next() { + pkg := &models.Package{} if err = rows.Scan( - &tmp.ID, - &tmp.Name, - &tmp.URL, - pq.Array(&tmp.Comments), + &pkg.ID, + &pkg.Name, + &pkg.URL, + &pkg.Comments, ); err != nil { + _ = rows.Close() return nil, err } + packages = append(packages, pkg) } - return result, err + if err = rows.Err(); err != nil { + return nil, err + } + + if err = rows.Close(); err != nil { + return nil, err + } + + return packages, err } -func (s *Sqlite) AddComment(ctx context.Context, req *pb.AddCommentReq) (id uint64, err error) { +func (s *Sqlite) CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq) (id uint64, err error) { tx, err := s.db.BeginTx(ctx, nil) if err != nil { return 0, err @@ -135,14 +138,14 @@ func (s *Sqlite) AddComment(ctx context.Context, req *pb.AddCommentReq) (id uint } }() - if err = tx.QueryRowContext(ctx, queryAddComment, req.Text, req.IdPackage).Scan(&id); err != nil { + if err = tx.QueryRowContext(ctx, queryCommentsCreate, req.Text, req.PackageId).Scan(&id); err != nil { return id, err } return id, err } -func (s *Sqlite) AddPackage(ctx context.Context, req *pb.AddPackageReq) error { +func (s *Sqlite) PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq) error { tx, err := s.db.BeginTx(ctx, nil) if err != nil { return err @@ -158,7 +161,7 @@ func (s *Sqlite) AddPackage(ctx context.Context, req *pb.AddPackageReq) error { } }() - res, err := tx.ExecContext(ctx, queryAddPackage, req.Name, req.Url, pq.Array(req.Modules)) + res, err := tx.ExecContext(ctx, queryPackagesCreate, req.Name, req.Url, pq.Array(req.Modules)) if err != nil { return err } @@ -213,15 +216,11 @@ func (s *Sqlite) InsertButchModules(ctx context.Context, req []models.Module) ([ return result, err } -func (s *Sqlite) GetModule(ctx context.Context, req *pb.GetModuleReq) (result models.ListModule, err error) { - query := "" - if len(req.Id) < 1 { - query = fmt.Sprintf(queryGetModule, "() or 1=1") - } else { - query = fmt.Sprintf(queryGetModule, generateArrayIneq(len(req.Id))) - } +func (s *Sqlite) GetModule(ctx context.Context, req *pb.ModulesListReq) ([]*models.Module, error) { + var err error + var modules []*models.Module - rows, err := s.db.QueryContext(ctx, query, convertSliceUInt(req.Id...)...) + rows, err := s.db.QueryContext(ctx, queryModulesList) if err != nil { return nil, err } @@ -232,27 +231,35 @@ func (s *Sqlite) GetModule(ctx context.Context, req *pb.GetModuleReq) (result mo err = rows.Err() }() - for rows.Next() { - tmp := &models.Module{} + for ; rows.Err() == nil; rows.Next() { + mod := &models.Module{} if err = rows.Scan( - &tmp.ID, - &tmp.Name, - &tmp.Version, - &tmp.LastVersion, + &mod.ID, + &mod.Name, + &mod.Version, + &mod.LastVersion, ); err != nil { return nil, err } - result = append(result, tmp) + modules = append(modules, mod) } - return result, err + if err = rows.Err(); err != nil { + return nil, err + } + + if err = rows.Close(); err != nil { + return nil, err + } + + return modules, nil } -func (s *Sqlite) GetComment(ctx context.Context, req *pb.GetCommentsReq) (result models.ListComment, err error) { - query := fmt.Sprintf(queryGetComments, generateArrayIneq(len(req.Id))) +func (s *Sqlite) CommentsList(ctx context.Context, req *pb.CommentsListReq) ([]*models.Comment, error) { + var comments []*models.Comment - rows, err := s.db.QueryContext(ctx, query, convertSliceUInt(req.Id...)...) + rows, err := s.db.QueryContext(ctx, queryCommentsList, req.PackageId) if err != nil { return nil, err } @@ -262,21 +269,30 @@ func (s *Sqlite) GetComment(ctx context.Context, req *pb.GetCommentsReq) (result } err = rows.Err() }() - for rows.Next() { - tmp := &models.Comment{} + for ; rows.Err() == nil; rows.Next() { + com := &models.Comment{} if err = rows.Scan( - &tmp.ID, - &tmp.Text, - &tmp.Created, - &tmp.Updated, + &com.ID, + &com.Text, + &com.Created, + &com.Updated, ); err != nil { + _ = rows.Close() return nil, err } - result = append(result, tmp) + comments = append(comments, com) } - return result, err + if err = rows.Err(); err != nil { + return nil, err + } + + if err = rows.Close(); err != nil { + return nil, err + } + + return comments, nil } func convertSliceUInt(arg ...uint64) []interface{} { diff --git a/internal/storage/storage.go b/internal/storage/storage.go new file mode 100644 index 0000000..2e9e03a --- /dev/null +++ b/internal/storage/storage.go @@ -0,0 +1,69 @@ +package storage + +import ( + "context" + "database/sql" + "embed" + "errors" + + "git.unistack.org/unistack-org/pkgdash/internal/models" + // "git.unistack.org/unistack-org/pkgdash/internal/storage/postgres" + + "git.unistack.org/unistack-org/pkgdash/internal/storage/sqlite" + pb "git.unistack.org/unistack-org/pkgdash/proto" +) + +//go:embed migrations +var fs embed.FS + +var storages = map[string]func(*sql.DB, embed.FS) interface{}{ + //"postgres": postgres.NewStorage(), + "sqlite": sqlite.NewStorage(), +} + +type contextKey string + +var storeIdent = contextKey("store") + +type Migrate interface { + MigrateUp() error + MigrateDown() error +} + +type Storage interface { + Migrate + PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq) error + PackagesList(ctx context.Context, req *pb.PackagesListReq) ([]*models.Package, error) + PackagesUpdate(ctx context.Context, req *pb.PackagesUpdateReq) error + PackagesDelete(ctx context.Context, req *pb.PackagesDeleteReq) error + CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq) (*models.Comment, error) + CommentsDelete(ctx context.Context, req *pb.CommentsDeleteReq) error + CommentsList(ctx context.Context, req *pb.CommentsListReq) ([]*models.Comment, error) + InsertButchModules(ctx context.Context, req []models.Module) ([]uint64, error) + ModulesList(ctx context.Context, req *pb.ModulesListReq) ([]*models.Module, error) +} + +func NewStorage(name string, db *sql.DB) (Storage, error) { + function, ok := storages[name] + if !ok { + return nil, errors.New("incorrect name store") + } + store := function(db, fs) + database, ok := store.(Storage) + if !ok { + return nil, errors.New("dont implements interface Storage") + } + return database, nil +} + +func InContext(ctx context.Context, val Storage) context.Context { + return context.WithValue(ctx, storeIdent, val) +} + +func FromContext(ctx context.Context) (Storage, error) { + if store, ok := ctx.Value(storeIdent).(Storage); !ok { + return nil, errors.New("empty store") + } else { + return store, nil + } +} diff --git a/storage/storage_test.go b/internal/storage/storage_test.go similarity index 91% rename from storage/storage_test.go rename to internal/storage/storage_test.go index 826b23a..bc5624b 100644 --- a/storage/storage_test.go +++ b/internal/storage/storage_test.go @@ -4,9 +4,10 @@ import ( "context" "database/sql" "fmt" - pb "go.unistack.org/unistack-org/pkgdash/proto" - "go.unistack.org/unistack-org/pkgdash/storage/sqlite" "testing" + + "git.unistack.org/unistack-org/pkgdash/internal/storage/sqlite" + pb "git.unistack.org/unistack-org/pkgdash/proto" ) func TestGetModule(t *testing.T) { diff --git a/models/entities.go b/models/entities.go deleted file mode 100644 index e9e2d52..0000000 --- a/models/entities.go +++ /dev/null @@ -1,45 +0,0 @@ -package models - -import ( - _ "database/sql" - "github.com/google/uuid" - "github.com/jackc/pgtype" -) - -type Package struct { - ID uint64 `db:"id" json:"id"` // package id - Name string `db:"name" json:"name"` // service name, last component path - URL string `db:"url" json:"url"` // scm url - Modules []uint64 `db:"modules" json:"modules"` // parsed go.mod modules - Issues []uint64 `db:"issues" json:"issues,omitempty"` // issues list - Comments []uint64 `db:"comments" json:"comments,omitempty"` -} - -type Module struct { - ID uint64 `db:"id"` - Name string `db:"name"` // module name - Version string `db:"version"` // module - Package uint64 `db:"package"` - LastVersion string `db:"last_version"` -} - -type Issue struct { - ID uint64 `db:"id"` - Status uint64 `db:"status"` - Desc string `db:"desc"` - Package int64 `db:"package"` - Modules []int64 `db:"modules"` -} - -type Comment struct { - ID uint64 `db:"id" json:"id"` - Text string `db:"value" json:"text"` - Created pgtype.Date `db:"created" json:"created"` - Updated pgtype.Date `db:"updated" json:"updated,omitempty"` -} - -type Dashboard struct { - ID uint64 `db:"id"` - Uuid uuid.UUID `db:"uuid"` - Packages []uint64 `db:"package"` -} diff --git a/models/mapping.go b/models/mapping.go deleted file mode 100644 index 6f1c4ba..0000000 --- a/models/mapping.go +++ /dev/null @@ -1,71 +0,0 @@ -package models - -import ( - "github.com/jackc/pgtype" - pb "go.unistack.org/unistack-org/pkgdash/proto" - "time" -) - -type ListPackage []*Package - -func (l ListPackage) Decode() []*pb.Package { - result := make([]*pb.Package, 0, len(l)) - - for i := range l { - temp := &pb.Package{ - Id: l[i].ID, - Name: l[i].Name, - Url: l[i].URL, - Modules: l[i].Modules, - Issues: l[i].Issues, - Comments: l[i].Comments, - } - - result = append(result, temp) - } - - return result -} - -type ListModule []*Module - -func (l ListModule) Decode() []*pb.Module { - result := make([]*pb.Module, 0, len(l)) - for i := range l { - temp := &pb.Module{ - Id: l[i].ID, - Name: l[i].Name, - Version: l[i].Version, - LastVersion: l[i].LastVersion, - } - - result = append(result, temp) - } - - return result -} - -type ListComment []*Comment - -func (l ListComment) Decode() []*pb.Comment { - result := make([]*pb.Comment, 0, len(l)) - for i := range l { - temp := &pb.Comment{ - Id: l[i].ID, - //Package: l[i]., - Text: l[i].Text, - } - - if l[i].Created.Status == pgtype.Present { - temp.Created = l[i].Created.Time.Format(time.DateTime) - } - - if l[i].Updated.Status == pgtype.Present { - temp.Updated = l[i].Updated.Time.Format(time.DateTime) - } - - result = append(result, temp) - } - - return result -} diff --git a/proto/apidocs.swagger.yaml b/proto/apidocs.swagger.yaml index 836b89d..643e277 100644 --- a/proto/apidocs.swagger.yaml +++ b/proto/apidocs.swagger.yaml @@ -5,87 +5,11 @@ info: title: PkgdashService API version: 0.0.1 paths: - /v1/comment: + /v1/comments/{id}/comments: get: tags: - PkgdashService - operationId: GetComments - parameters: - - name: id - in: query - schema: - type: array - items: - type: integer - format: uint64 - responses: - default: - description: Default - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorRsp' - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/GetCommentsRsp' - /v1/module: - get: - tags: - - PkgdashService - operationId: GetModule - parameters: - - name: id - in: query - schema: - type: array - items: - type: integer - format: uint64 - responses: - default: - description: Default - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorRsp' - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/GetModuleRsp' - /v1/package: - post: - tags: - - PkgdashService - operationId: AddPackage - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AddPackageReq' - required: true - responses: - default: - description: Default - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorRsp' - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AddPackageRsp' - /v1/package/{id}: - post: - tags: - - PkgdashService - operationId: UpdateInfo + operationId: CommentsLookup parameters: - name: id in: path @@ -93,12 +17,11 @@ paths: schema: type: integer format: uint64 - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UpdatePackageReq' - required: true + - name: package_id + in: query + schema: + type: integer + format: uint64 responses: default: description: Default @@ -111,24 +34,12 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/UpdatePackageRsp' - /v1/package/{pkg}/comment: - post: + $ref: '#/components/schemas/CommentsLookupRsp' + /v1/modules: + get: tags: - PkgdashService - operationId: AddComment - parameters: - - name: pkg - in: path - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AddCommentReq' - required: true + operationId: ModulesList responses: default: description: Default @@ -141,12 +52,12 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AddCommentRsp' + $ref: '#/components/schemas/ModulesListRsp' /v1/packages: get: tags: - PkgdashService - operationId: ListPackage + operationId: PackagesList responses: default: description: Default @@ -159,40 +70,173 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ListPackageRsp' + $ref: '#/components/schemas/PackagesListRsp' + post: + tags: + - PkgdashService + operationId: PackagesCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PackagesCreateReq' + required: true + responses: + default: + description: Default + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorRsp' + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PackagesCreateRsp' + /v1/packages/{id}: + put: + tags: + - PkgdashService + operationId: PackagesUpdate + parameters: + - name: id + in: path + required: true + schema: + type: integer + format: uint64 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PackagesUpdateReq' + required: true + responses: + default: + description: Default + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorRsp' + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PackagesUpdateRsp' + delete: + tags: + - PkgdashService + operationId: PackagesDelete + parameters: + - name: id + in: path + required: true + schema: + type: integer + format: uint64 + responses: + default: + description: Default + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorRsp' + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PackagesDeleteRsp' + /v1/packages/{package_id}/comments: + get: + tags: + - PkgdashService + operationId: CommentsList + parameters: + - name: package_id + in: path + required: true + schema: + type: integer + format: uint64 + responses: + default: + description: Default + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorRsp' + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CommentsListRsp' + post: + tags: + - PkgdashService + operationId: CommentsCreate + parameters: + - name: package_id + in: path + required: true + schema: + type: integer + format: uint64 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CommentsCreateReq' + required: true + responses: + default: + description: Default + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorRsp' + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CommentsCreateRsp' + /v1/packages/{package_id}/comments/{id}: + delete: + tags: + - PkgdashService + operationId: CommentsDelete + parameters: + - name: package_id + in: path + required: true + schema: + type: integer + format: uint64 + - name: id + in: path + required: true + schema: + type: integer + format: uint64 + responses: + default: + description: Default + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorRsp' + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CommentsDeleteRsp' components: schemas: - AddCommentReq: - type: object - properties: - idPackage: - type: integer - format: uint64 - text: - type: string - AddCommentRsp: - type: object - properties: - id: - type: integer - format: uint64 - AddPackageReq: - type: object - properties: - name: - type: string - url: - type: string - modules: - type: array - items: - type: integer - format: uint64 - AddPackageRsp: - type: object - properties: - status: - type: string Comment: type: object properties: @@ -206,9 +250,39 @@ components: type: string created: type: string + format: RFC3339 updated: type: string - Error: + format: RFC3339 + CommentsCreateReq: + type: object + properties: + package_id: + type: integer + format: uint64 + text: + type: string + CommentsCreateRsp: + type: object + properties: + comment: + $ref: '#/components/schemas/Comment' + CommentsDeleteRsp: + type: object + properties: {} + CommentsListRsp: + type: object + properties: + comments: + type: array + items: + $ref: '#/components/schemas/Comment' + CommentsLookupRsp: + type: object + properties: + comment: + $ref: '#/components/schemas/Comment' + ErrorRsp: type: object properties: code: @@ -219,32 +293,6 @@ components: type: string details: type: string - ErrorRsp: - type: object - properties: - error: - $ref: '#/components/schemas/Error' - GetCommentsRsp: - type: object - properties: - comments: - type: array - items: - $ref: '#/components/schemas/Comment' - GetModuleRsp: - type: object - properties: - modules: - type: array - items: - $ref: '#/components/schemas/Module' - ListPackageRsp: - type: object - properties: - packages: - type: array - items: - $ref: '#/components/schemas/Package' Module: type: object properties: @@ -260,6 +308,19 @@ components: format: uint64 last_version: type: string + created: + type: string + format: RFC3339 + updated: + type: string + format: RFC3339 + ModulesListRsp: + type: object + properties: + modules: + type: array + items: + $ref: '#/components/schemas/Module' Package: type: object properties: @@ -285,7 +346,40 @@ components: items: type: integer format: uint64 - UpdatePackageReq: + created: + type: string + format: RFC3339 + updated: + type: string + format: RFC3339 + PackagesCreateReq: + type: object + properties: + name: + type: string + url: + type: string + modules: + type: array + items: + type: integer + format: uint64 + PackagesCreateRsp: + type: object + properties: + status: + type: string + PackagesDeleteRsp: + type: object + properties: {} + PackagesListRsp: + type: object + properties: + packages: + type: array + items: + $ref: '#/components/schemas/Package' + PackagesUpdateReq: type: object properties: id: @@ -305,11 +399,10 @@ components: items: type: integer format: uint64 - UpdatePackageRsp: + PackagesUpdateRsp: type: object properties: - id: - type: integer - format: uint64 + package: + $ref: '#/components/schemas/Package' tags: - name: PkgdashService diff --git a/proto/pkgdash.pb.go b/proto/pkgdash.pb.go index 8774ce6..9944a6b 100644 --- a/proto/pkgdash.pb.go +++ b/proto/pkgdash.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.26.0 // protoc v4.23.4 // source: pkgdash.proto @@ -12,7 +12,7 @@ import ( _ "go.unistack.org/micro-proto/v4/openapiv3" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -29,7 +29,10 @@ type ErrorRsp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Error *Error `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + Uuid string `protobuf:"bytes,3,opt,name=uuid,proto3" json:"uuid,omitempty"` + Details string `protobuf:"bytes,4,opt,name=details,proto3" json:"details,omitempty"` } func (x *ErrorRsp) Reset() { @@ -64,78 +67,28 @@ func (*ErrorRsp) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{0} } -func (x *ErrorRsp) GetError() *Error { - if x != nil { - return x.Error - } - return nil -} - -type Error struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` - Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` - Uuid string `protobuf:"bytes,3,opt,name=uuid,proto3" json:"uuid,omitempty"` - Details string `protobuf:"bytes,4,opt,name=details,proto3" json:"details,omitempty"` -} - -func (x *Error) Reset() { - *x = Error{} - if protoimpl.UnsafeEnabled { - mi := &file_pkgdash_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Error) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Error) ProtoMessage() {} - -func (x *Error) ProtoReflect() protoreflect.Message { - mi := &file_pkgdash_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 Error.ProtoReflect.Descriptor instead. -func (*Error) Descriptor() ([]byte, []int) { - return file_pkgdash_proto_rawDescGZIP(), []int{1} -} - -func (x *Error) GetCode() string { +func (x *ErrorRsp) GetCode() string { if x != nil { return x.Code } return "" } -func (x *Error) GetTitle() string { +func (x *ErrorRsp) GetTitle() string { if x != nil { return x.Title } return "" } -func (x *Error) GetUuid() string { +func (x *ErrorRsp) GetUuid() string { if x != nil { return x.Uuid } return "" } -func (x *Error) GetDetails() string { +func (x *ErrorRsp) GetDetails() string { if x != nil { return x.Details } @@ -147,18 +100,20 @@ type Package struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` - Modules []uint64 `protobuf:"varint,4,rep,packed,name=modules,proto3" json:"modules,omitempty"` - Issues []uint64 `protobuf:"varint,5,rep,packed,name=issues,proto3" json:"issues,omitempty"` - Comments []uint64 `protobuf:"varint,6,rep,packed,name=comments,proto3" json:"comments,omitempty"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` + Modules []uint64 `protobuf:"varint,4,rep,packed,name=modules,proto3" json:"modules,omitempty"` + Issues []uint64 `protobuf:"varint,5,rep,packed,name=issues,proto3" json:"issues,omitempty"` + Comments []uint64 `protobuf:"varint,6,rep,packed,name=comments,proto3" json:"comments,omitempty"` + Created *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=created,proto3" json:"created,omitempty"` + Updated *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=updated,proto3" json:"updated,omitempty"` } func (x *Package) Reset() { *x = Package{} if protoimpl.UnsafeEnabled { - mi := &file_pkgdash_proto_msgTypes[2] + mi := &file_pkgdash_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -171,7 +126,7 @@ func (x *Package) String() string { func (*Package) ProtoMessage() {} func (x *Package) ProtoReflect() protoreflect.Message { - mi := &file_pkgdash_proto_msgTypes[2] + mi := &file_pkgdash_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -184,7 +139,7 @@ func (x *Package) ProtoReflect() protoreflect.Message { // Deprecated: Use Package.ProtoReflect.Descriptor instead. func (*Package) Descriptor() ([]byte, []int) { - return file_pkgdash_proto_rawDescGZIP(), []int{2} + return file_pkgdash_proto_rawDescGZIP(), []int{1} } func (x *Package) GetId() uint64 { @@ -229,22 +184,38 @@ func (x *Package) GetComments() []uint64 { return nil } +func (x *Package) GetCreated() *timestamppb.Timestamp { + if x != nil { + return x.Created + } + return nil +} + +func (x *Package) GetUpdated() *timestamppb.Timestamp { + if x != nil { + return x.Updated + } + return nil +} + type Module struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` - Package uint64 `protobuf:"varint,4,opt,name=package,proto3" json:"package,omitempty"` - LastVersion string `protobuf:"bytes,5,opt,name=last_version,json=lastVersion,proto3" json:"last_version,omitempty"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Package uint64 `protobuf:"varint,4,opt,name=package,proto3" json:"package,omitempty"` + LastVersion string `protobuf:"bytes,5,opt,name=last_version,json=lastVersion,proto3" json:"last_version,omitempty"` + Created *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created,proto3" json:"created,omitempty"` + Updated *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=updated,proto3" json:"updated,omitempty"` } func (x *Module) Reset() { *x = Module{} if protoimpl.UnsafeEnabled { - mi := &file_pkgdash_proto_msgTypes[3] + mi := &file_pkgdash_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -257,7 +228,7 @@ func (x *Module) String() string { func (*Module) ProtoMessage() {} func (x *Module) ProtoReflect() protoreflect.Message { - mi := &file_pkgdash_proto_msgTypes[3] + mi := &file_pkgdash_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -270,7 +241,7 @@ func (x *Module) ProtoReflect() protoreflect.Message { // Deprecated: Use Module.ProtoReflect.Descriptor instead. func (*Module) Descriptor() ([]byte, []int) { - return file_pkgdash_proto_rawDescGZIP(), []int{3} + return file_pkgdash_proto_rawDescGZIP(), []int{2} } func (x *Module) GetId() uint64 { @@ -308,22 +279,38 @@ func (x *Module) GetLastVersion() string { return "" } +func (x *Module) GetCreated() *timestamppb.Timestamp { + if x != nil { + return x.Created + } + return nil +} + +func (x *Module) GetUpdated() *timestamppb.Timestamp { + if x != nil { + return x.Updated + } + return nil +} + type Issue struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Status uint64 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` - Desc string `protobuf:"bytes,3,opt,name=desc,proto3" json:"desc,omitempty"` - Package uint64 `protobuf:"varint,4,opt,name=package,proto3" json:"package,omitempty"` - Modules []uint64 `protobuf:"varint,5,rep,packed,name=modules,proto3" json:"modules,omitempty"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Status uint64 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` + Desc string `protobuf:"bytes,3,opt,name=desc,proto3" json:"desc,omitempty"` + Package uint64 `protobuf:"varint,4,opt,name=package,proto3" json:"package,omitempty"` + Modules []uint64 `protobuf:"varint,5,rep,packed,name=modules,proto3" json:"modules,omitempty"` + Created *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created,proto3" json:"created,omitempty"` + Updated *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=updated,proto3" json:"updated,omitempty"` } func (x *Issue) Reset() { *x = Issue{} if protoimpl.UnsafeEnabled { - mi := &file_pkgdash_proto_msgTypes[4] + mi := &file_pkgdash_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -336,7 +323,7 @@ func (x *Issue) String() string { func (*Issue) ProtoMessage() {} func (x *Issue) ProtoReflect() protoreflect.Message { - mi := &file_pkgdash_proto_msgTypes[4] + mi := &file_pkgdash_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -349,7 +336,7 @@ func (x *Issue) ProtoReflect() protoreflect.Message { // Deprecated: Use Issue.ProtoReflect.Descriptor instead. func (*Issue) Descriptor() ([]byte, []int) { - return file_pkgdash_proto_rawDescGZIP(), []int{4} + return file_pkgdash_proto_rawDescGZIP(), []int{3} } func (x *Issue) GetId() uint64 { @@ -387,22 +374,36 @@ func (x *Issue) GetModules() []uint64 { return nil } +func (x *Issue) GetCreated() *timestamppb.Timestamp { + if x != nil { + return x.Created + } + return nil +} + +func (x *Issue) GetUpdated() *timestamppb.Timestamp { + if x != nil { + return x.Updated + } + return nil +} + type Comment struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Package uint64 `protobuf:"varint,2,opt,name=package,proto3" json:"package,omitempty"` - Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` - Created string `protobuf:"bytes,4,opt,name=created,proto3" json:"created,omitempty"` - Updated string `protobuf:"bytes,5,opt,name=updated,proto3" json:"updated,omitempty"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Package uint64 `protobuf:"varint,2,opt,name=package,proto3" json:"package,omitempty"` + Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` + Created *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created,proto3" json:"created,omitempty"` + Updated *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=updated,proto3" json:"updated,omitempty"` } func (x *Comment) Reset() { *x = Comment{} if protoimpl.UnsafeEnabled { - mi := &file_pkgdash_proto_msgTypes[5] + mi := &file_pkgdash_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -415,7 +416,7 @@ func (x *Comment) String() string { func (*Comment) ProtoMessage() {} func (x *Comment) ProtoReflect() protoreflect.Message { - mi := &file_pkgdash_proto_msgTypes[5] + mi := &file_pkgdash_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -428,7 +429,7 @@ func (x *Comment) ProtoReflect() protoreflect.Message { // Deprecated: Use Comment.ProtoReflect.Descriptor instead. func (*Comment) Descriptor() ([]byte, []int) { - return file_pkgdash_proto_rawDescGZIP(), []int{5} + return file_pkgdash_proto_rawDescGZIP(), []int{4} } func (x *Comment) GetId() uint64 { @@ -452,28 +453,83 @@ func (x *Comment) GetText() string { return "" } -func (x *Comment) GetCreated() string { +func (x *Comment) GetCreated() *timestamppb.Timestamp { if x != nil { return x.Created } - return "" + return nil } -func (x *Comment) GetUpdated() string { +func (x *Comment) GetUpdated() *timestamppb.Timestamp { if x != nil { return x.Updated } - return "" + return nil } -type ListPackageReq struct { +type CommentsDeleteReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + PackageId uint64 `protobuf:"varint,2,opt,name=package_id,proto3" json:"package_id,omitempty"` +} + +func (x *CommentsDeleteReq) Reset() { + *x = CommentsDeleteReq{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CommentsDeleteReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommentsDeleteReq) ProtoMessage() {} + +func (x *CommentsDeleteReq) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_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 CommentsDeleteReq.ProtoReflect.Descriptor instead. +func (*CommentsDeleteReq) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{5} +} + +func (x *CommentsDeleteReq) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *CommentsDeleteReq) GetPackageId() uint64 { + if x != nil { + return x.PackageId + } + return 0 +} + +type CommentsDeleteRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *ListPackageReq) Reset() { - *x = ListPackageReq{} +func (x *CommentsDeleteRsp) Reset() { + *x = CommentsDeleteRsp{} if protoimpl.UnsafeEnabled { mi := &file_pkgdash_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -481,13 +537,13 @@ func (x *ListPackageReq) Reset() { } } -func (x *ListPackageReq) String() string { +func (x *CommentsDeleteRsp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListPackageReq) ProtoMessage() {} +func (*CommentsDeleteRsp) ProtoMessage() {} -func (x *ListPackageReq) ProtoReflect() protoreflect.Message { +func (x *CommentsDeleteRsp) ProtoReflect() protoreflect.Message { mi := &file_pkgdash_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -499,21 +555,21 @@ func (x *ListPackageReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListPackageReq.ProtoReflect.Descriptor instead. -func (*ListPackageReq) Descriptor() ([]byte, []int) { +// Deprecated: Use CommentsDeleteRsp.ProtoReflect.Descriptor instead. +func (*CommentsDeleteRsp) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{6} } -type ListPackageRsp struct { +type PackagesDeleteReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Packages []*Package `protobuf:"bytes,1,rep,name=packages,proto3" json:"packages,omitempty"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } -func (x *ListPackageRsp) Reset() { - *x = ListPackageRsp{} +func (x *PackagesDeleteReq) Reset() { + *x = PackagesDeleteReq{} if protoimpl.UnsafeEnabled { mi := &file_pkgdash_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -521,13 +577,13 @@ func (x *ListPackageRsp) Reset() { } } -func (x *ListPackageRsp) String() string { +func (x *PackagesDeleteReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListPackageRsp) ProtoMessage() {} +func (*PackagesDeleteReq) ProtoMessage() {} -func (x *ListPackageRsp) ProtoReflect() protoreflect.Message { +func (x *PackagesDeleteReq) ProtoReflect() protoreflect.Message { mi := &file_pkgdash_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -539,32 +595,26 @@ func (x *ListPackageRsp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListPackageRsp.ProtoReflect.Descriptor instead. -func (*ListPackageRsp) Descriptor() ([]byte, []int) { +// Deprecated: Use PackagesDeleteReq.ProtoReflect.Descriptor instead. +func (*PackagesDeleteReq) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{7} } -func (x *ListPackageRsp) GetPackages() []*Package { +func (x *PackagesDeleteReq) GetId() uint64 { if x != nil { - return x.Packages + return x.Id } - return nil + return 0 } -type UpdatePackageReq struct { +type PackagesDeleteRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` - Modules []uint64 `protobuf:"varint,4,rep,packed,name=modules,proto3" json:"modules,omitempty"` - Issues []uint64 `protobuf:"varint,5,rep,packed,name=issues,proto3" json:"issues,omitempty"` } -func (x *UpdatePackageReq) Reset() { - *x = UpdatePackageReq{} +func (x *PackagesDeleteRsp) Reset() { + *x = PackagesDeleteRsp{} if protoimpl.UnsafeEnabled { mi := &file_pkgdash_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -572,13 +622,13 @@ func (x *UpdatePackageReq) Reset() { } } -func (x *UpdatePackageReq) String() string { +func (x *PackagesDeleteRsp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*UpdatePackageReq) ProtoMessage() {} +func (*PackagesDeleteRsp) ProtoMessage() {} -func (x *UpdatePackageReq) ProtoReflect() protoreflect.Message { +func (x *PackagesDeleteRsp) ProtoReflect() protoreflect.Message { mi := &file_pkgdash_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -590,56 +640,19 @@ func (x *UpdatePackageReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use UpdatePackageReq.ProtoReflect.Descriptor instead. -func (*UpdatePackageReq) Descriptor() ([]byte, []int) { +// Deprecated: Use PackagesDeleteRsp.ProtoReflect.Descriptor instead. +func (*PackagesDeleteRsp) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{8} } -func (x *UpdatePackageReq) GetId() uint64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *UpdatePackageReq) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *UpdatePackageReq) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *UpdatePackageReq) GetModules() []uint64 { - if x != nil { - return x.Modules - } - return nil -} - -func (x *UpdatePackageReq) GetIssues() []uint64 { - if x != nil { - return x.Issues - } - return nil -} - -type UpdatePackageRsp struct { +type PackagesListReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } -func (x *UpdatePackageRsp) Reset() { - *x = UpdatePackageRsp{} +func (x *PackagesListReq) Reset() { + *x = PackagesListReq{} if protoimpl.UnsafeEnabled { mi := &file_pkgdash_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -647,13 +660,13 @@ func (x *UpdatePackageRsp) Reset() { } } -func (x *UpdatePackageRsp) String() string { +func (x *PackagesListReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*UpdatePackageRsp) ProtoMessage() {} +func (*PackagesListReq) ProtoMessage() {} -func (x *UpdatePackageRsp) ProtoReflect() protoreflect.Message { +func (x *PackagesListReq) ProtoReflect() protoreflect.Message { mi := &file_pkgdash_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -665,29 +678,21 @@ func (x *UpdatePackageRsp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use UpdatePackageRsp.ProtoReflect.Descriptor instead. -func (*UpdatePackageRsp) Descriptor() ([]byte, []int) { +// Deprecated: Use PackagesListReq.ProtoReflect.Descriptor instead. +func (*PackagesListReq) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{9} } -func (x *UpdatePackageRsp) GetId() uint64 { - if x != nil { - return x.Id - } - return 0 -} - -type CommentReq struct { +type PackagesListRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Pkg uint64 `protobuf:"varint,1,opt,name=pkg,proto3" json:"pkg,omitempty"` - Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` + Packages []*Package `protobuf:"bytes,1,rep,name=packages,proto3" json:"packages,omitempty"` } -func (x *CommentReq) Reset() { - *x = CommentReq{} +func (x *PackagesListRsp) Reset() { + *x = PackagesListRsp{} if protoimpl.UnsafeEnabled { mi := &file_pkgdash_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -695,13 +700,13 @@ func (x *CommentReq) Reset() { } } -func (x *CommentReq) String() string { +func (x *PackagesListRsp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CommentReq) ProtoMessage() {} +func (*PackagesListRsp) ProtoMessage() {} -func (x *CommentReq) ProtoReflect() protoreflect.Message { +func (x *PackagesListRsp) ProtoReflect() protoreflect.Message { mi := &file_pkgdash_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -713,36 +718,32 @@ func (x *CommentReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CommentReq.ProtoReflect.Descriptor instead. -func (*CommentReq) Descriptor() ([]byte, []int) { +// Deprecated: Use PackagesListRsp.ProtoReflect.Descriptor instead. +func (*PackagesListRsp) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{10} } -func (x *CommentReq) GetPkg() uint64 { +func (x *PackagesListRsp) GetPackages() []*Package { if x != nil { - return x.Pkg + return x.Packages } - return 0 + return nil } -func (x *CommentReq) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -type AddCommentReq struct { +type PackagesUpdateReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - IdPackage uint64 `protobuf:"varint,1,opt,name=idPackage,proto3" json:"idPackage,omitempty"` - Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` + Modules []uint64 `protobuf:"varint,4,rep,packed,name=modules,proto3" json:"modules,omitempty"` + Issues []uint64 `protobuf:"varint,5,rep,packed,name=issues,proto3" json:"issues,omitempty"` } -func (x *AddCommentReq) Reset() { - *x = AddCommentReq{} +func (x *PackagesUpdateReq) Reset() { + *x = PackagesUpdateReq{} if protoimpl.UnsafeEnabled { mi := &file_pkgdash_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -750,13 +751,13 @@ func (x *AddCommentReq) Reset() { } } -func (x *AddCommentReq) String() string { +func (x *PackagesUpdateReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*AddCommentReq) ProtoMessage() {} +func (*PackagesUpdateReq) ProtoMessage() {} -func (x *AddCommentReq) ProtoReflect() protoreflect.Message { +func (x *PackagesUpdateReq) ProtoReflect() protoreflect.Message { mi := &file_pkgdash_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -768,35 +769,56 @@ func (x *AddCommentReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use AddCommentReq.ProtoReflect.Descriptor instead. -func (*AddCommentReq) Descriptor() ([]byte, []int) { +// Deprecated: Use PackagesUpdateReq.ProtoReflect.Descriptor instead. +func (*PackagesUpdateReq) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{11} } -func (x *AddCommentReq) GetIdPackage() uint64 { +func (x *PackagesUpdateReq) GetId() uint64 { if x != nil { - return x.IdPackage + return x.Id } return 0 } -func (x *AddCommentReq) GetText() string { +func (x *PackagesUpdateReq) GetName() string { if x != nil { - return x.Text + return x.Name } return "" } -type AddCommentRsp struct { +func (x *PackagesUpdateReq) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *PackagesUpdateReq) GetModules() []uint64 { + if x != nil { + return x.Modules + } + return nil +} + +func (x *PackagesUpdateReq) GetIssues() []uint64 { + if x != nil { + return x.Issues + } + return nil +} + +type PackagesUpdateRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Package *Package `protobuf:"bytes,1,opt,name=package,proto3" json:"package,omitempty"` } -func (x *AddCommentRsp) Reset() { - *x = AddCommentRsp{} +func (x *PackagesUpdateRsp) Reset() { + *x = PackagesUpdateRsp{} if protoimpl.UnsafeEnabled { mi := &file_pkgdash_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -804,13 +826,13 @@ func (x *AddCommentRsp) Reset() { } } -func (x *AddCommentRsp) String() string { +func (x *PackagesUpdateRsp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*AddCommentRsp) ProtoMessage() {} +func (*PackagesUpdateRsp) ProtoMessage() {} -func (x *AddCommentRsp) ProtoReflect() protoreflect.Message { +func (x *PackagesUpdateRsp) ProtoReflect() protoreflect.Message { mi := &file_pkgdash_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -822,30 +844,29 @@ func (x *AddCommentRsp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use AddCommentRsp.ProtoReflect.Descriptor instead. -func (*AddCommentRsp) Descriptor() ([]byte, []int) { +// Deprecated: Use PackagesUpdateRsp.ProtoReflect.Descriptor instead. +func (*PackagesUpdateRsp) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{12} } -func (x *AddCommentRsp) GetId() uint64 { +func (x *PackagesUpdateRsp) GetPackage() *Package { if x != nil { - return x.Id + return x.Package } - return 0 + return nil } -type AddPackageReq struct { +type CommentsCreateReq 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"` - Modules []uint64 `protobuf:"varint,3,rep,packed,name=modules,proto3" json:"modules,omitempty"` + PackageId uint64 `protobuf:"varint,1,opt,name=package_id,proto3" json:"package_id,omitempty"` + Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` } -func (x *AddPackageReq) Reset() { - *x = AddPackageReq{} +func (x *CommentsCreateReq) Reset() { + *x = CommentsCreateReq{} if protoimpl.UnsafeEnabled { mi := &file_pkgdash_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -853,13 +874,13 @@ func (x *AddPackageReq) Reset() { } } -func (x *AddPackageReq) String() string { +func (x *CommentsCreateReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*AddPackageReq) ProtoMessage() {} +func (*CommentsCreateReq) ProtoMessage() {} -func (x *AddPackageReq) ProtoReflect() protoreflect.Message { +func (x *CommentsCreateReq) ProtoReflect() protoreflect.Message { mi := &file_pkgdash_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -871,42 +892,35 @@ func (x *AddPackageReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use AddPackageReq.ProtoReflect.Descriptor instead. -func (*AddPackageReq) Descriptor() ([]byte, []int) { +// Deprecated: Use CommentsCreateReq.ProtoReflect.Descriptor instead. +func (*CommentsCreateReq) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{13} } -func (x *AddPackageReq) GetName() string { +func (x *CommentsCreateReq) GetPackageId() uint64 { if x != nil { - return x.Name + return x.PackageId + } + return 0 +} + +func (x *CommentsCreateReq) GetText() string { + if x != nil { + return x.Text } return "" } -func (x *AddPackageReq) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *AddPackageReq) GetModules() []uint64 { - if x != nil { - return x.Modules - } - return nil -} - -type AddPackageRsp struct { +type CommentsCreateRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + Comment *Comment `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` } -func (x *AddPackageRsp) Reset() { - *x = AddPackageRsp{} +func (x *CommentsCreateRsp) Reset() { + *x = CommentsCreateRsp{} if protoimpl.UnsafeEnabled { mi := &file_pkgdash_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -914,13 +928,13 @@ func (x *AddPackageRsp) Reset() { } } -func (x *AddPackageRsp) String() string { +func (x *CommentsCreateRsp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*AddPackageRsp) ProtoMessage() {} +func (*CommentsCreateRsp) ProtoMessage() {} -func (x *AddPackageRsp) ProtoReflect() protoreflect.Message { +func (x *CommentsCreateRsp) ProtoReflect() protoreflect.Message { mi := &file_pkgdash_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -932,28 +946,30 @@ func (x *AddPackageRsp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use AddPackageRsp.ProtoReflect.Descriptor instead. -func (*AddPackageRsp) Descriptor() ([]byte, []int) { +// Deprecated: Use CommentsCreateRsp.ProtoReflect.Descriptor instead. +func (*CommentsCreateRsp) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{14} } -func (x *AddPackageRsp) GetStatus() string { +func (x *CommentsCreateRsp) GetComment() *Comment { if x != nil { - return x.Status + return x.Comment } - return "" + return nil } -type GetModuleReq struct { +type PackagesCreateReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id []uint64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + Modules []uint64 `protobuf:"varint,3,rep,packed,name=modules,proto3" json:"modules,omitempty"` } -func (x *GetModuleReq) Reset() { - *x = GetModuleReq{} +func (x *PackagesCreateReq) Reset() { + *x = PackagesCreateReq{} if protoimpl.UnsafeEnabled { mi := &file_pkgdash_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -961,13 +977,13 @@ func (x *GetModuleReq) Reset() { } } -func (x *GetModuleReq) String() string { +func (x *PackagesCreateReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetModuleReq) ProtoMessage() {} +func (*PackagesCreateReq) ProtoMessage() {} -func (x *GetModuleReq) ProtoReflect() protoreflect.Message { +func (x *PackagesCreateReq) ProtoReflect() protoreflect.Message { mi := &file_pkgdash_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -979,28 +995,42 @@ func (x *GetModuleReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetModuleReq.ProtoReflect.Descriptor instead. -func (*GetModuleReq) Descriptor() ([]byte, []int) { +// Deprecated: Use PackagesCreateReq.ProtoReflect.Descriptor instead. +func (*PackagesCreateReq) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{15} } -func (x *GetModuleReq) GetId() []uint64 { +func (x *PackagesCreateReq) GetName() string { if x != nil { - return x.Id + return x.Name + } + return "" +} + +func (x *PackagesCreateReq) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *PackagesCreateReq) GetModules() []uint64 { + if x != nil { + return x.Modules } return nil } -type GetModuleRsp struct { +type PackagesCreateRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Modules []*Module `protobuf:"bytes,1,rep,name=modules,proto3" json:"modules,omitempty"` + Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` } -func (x *GetModuleRsp) Reset() { - *x = GetModuleRsp{} +func (x *PackagesCreateRsp) Reset() { + *x = PackagesCreateRsp{} if protoimpl.UnsafeEnabled { mi := &file_pkgdash_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1008,13 +1038,13 @@ func (x *GetModuleRsp) Reset() { } } -func (x *GetModuleRsp) String() string { +func (x *PackagesCreateRsp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetModuleRsp) ProtoMessage() {} +func (*PackagesCreateRsp) ProtoMessage() {} -func (x *GetModuleRsp) ProtoReflect() protoreflect.Message { +func (x *PackagesCreateRsp) ProtoReflect() protoreflect.Message { mi := &file_pkgdash_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1026,28 +1056,26 @@ func (x *GetModuleRsp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetModuleRsp.ProtoReflect.Descriptor instead. -func (*GetModuleRsp) Descriptor() ([]byte, []int) { +// Deprecated: Use PackagesCreateRsp.ProtoReflect.Descriptor instead. +func (*PackagesCreateRsp) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{16} } -func (x *GetModuleRsp) GetModules() []*Module { +func (x *PackagesCreateRsp) GetStatus() string { if x != nil { - return x.Modules + return x.Status } - return nil + return "" } -type GetCommentsReq struct { +type ModulesListReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Id []uint64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` } -func (x *GetCommentsReq) Reset() { - *x = GetCommentsReq{} +func (x *ModulesListReq) Reset() { + *x = ModulesListReq{} if protoimpl.UnsafeEnabled { mi := &file_pkgdash_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1055,13 +1083,13 @@ func (x *GetCommentsReq) Reset() { } } -func (x *GetCommentsReq) String() string { +func (x *ModulesListReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetCommentsReq) ProtoMessage() {} +func (*ModulesListReq) ProtoMessage() {} -func (x *GetCommentsReq) ProtoReflect() protoreflect.Message { +func (x *ModulesListReq) ProtoReflect() protoreflect.Message { mi := &file_pkgdash_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1073,28 +1101,21 @@ func (x *GetCommentsReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetCommentsReq.ProtoReflect.Descriptor instead. -func (*GetCommentsReq) Descriptor() ([]byte, []int) { +// Deprecated: Use ModulesListReq.ProtoReflect.Descriptor instead. +func (*ModulesListReq) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{17} } -func (x *GetCommentsReq) GetId() []uint64 { - if x != nil { - return x.Id - } - return nil -} - -type GetCommentsRsp struct { +type ModulesListRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Comments []*Comment `protobuf:"bytes,1,rep,name=comments,proto3" json:"comments,omitempty"` + Modules []*Module `protobuf:"bytes,1,rep,name=modules,proto3" json:"modules,omitempty"` } -func (x *GetCommentsRsp) Reset() { - *x = GetCommentsRsp{} +func (x *ModulesListRsp) Reset() { + *x = ModulesListRsp{} if protoimpl.UnsafeEnabled { mi := &file_pkgdash_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1102,13 +1123,13 @@ func (x *GetCommentsRsp) Reset() { } } -func (x *GetCommentsRsp) String() string { +func (x *ModulesListRsp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetCommentsRsp) ProtoMessage() {} +func (*ModulesListRsp) ProtoMessage() {} -func (x *GetCommentsRsp) ProtoReflect() protoreflect.Message { +func (x *ModulesListRsp) ProtoReflect() protoreflect.Message { mi := &file_pkgdash_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1120,18 +1141,214 @@ func (x *GetCommentsRsp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetCommentsRsp.ProtoReflect.Descriptor instead. -func (*GetCommentsRsp) Descriptor() ([]byte, []int) { +// Deprecated: Use ModulesListRsp.ProtoReflect.Descriptor instead. +func (*ModulesListRsp) Descriptor() ([]byte, []int) { return file_pkgdash_proto_rawDescGZIP(), []int{18} } -func (x *GetCommentsRsp) GetComments() []*Comment { +func (x *ModulesListRsp) GetModules() []*Module { + if x != nil { + return x.Modules + } + return nil +} + +type CommentsListReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PackageId uint64 `protobuf:"varint,1,opt,name=package_id,proto3" json:"package_id,omitempty"` +} + +func (x *CommentsListReq) Reset() { + *x = CommentsListReq{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CommentsListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommentsListReq) ProtoMessage() {} + +func (x *CommentsListReq) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[19] + 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 CommentsListReq.ProtoReflect.Descriptor instead. +func (*CommentsListReq) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{19} +} + +func (x *CommentsListReq) GetPackageId() uint64 { + if x != nil { + return x.PackageId + } + return 0 +} + +type CommentsListRsp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Comments []*Comment `protobuf:"bytes,1,rep,name=comments,proto3" json:"comments,omitempty"` +} + +func (x *CommentsListRsp) Reset() { + *x = CommentsListRsp{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CommentsListRsp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommentsListRsp) ProtoMessage() {} + +func (x *CommentsListRsp) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[20] + 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 CommentsListRsp.ProtoReflect.Descriptor instead. +func (*CommentsListRsp) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{20} +} + +func (x *CommentsListRsp) GetComments() []*Comment { if x != nil { return x.Comments } return nil } +type CommentsLookupReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + PackageId uint64 `protobuf:"varint,2,opt,name=package_id,proto3" json:"package_id,omitempty"` +} + +func (x *CommentsLookupReq) Reset() { + *x = CommentsLookupReq{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CommentsLookupReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommentsLookupReq) ProtoMessage() {} + +func (x *CommentsLookupReq) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[21] + 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 CommentsLookupReq.ProtoReflect.Descriptor instead. +func (*CommentsLookupReq) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{21} +} + +func (x *CommentsLookupReq) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *CommentsLookupReq) GetPackageId() uint64 { + if x != nil { + return x.PackageId + } + return 0 +} + +type CommentsLookupRsp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Comment *Comment `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` +} + +func (x *CommentsLookupRsp) Reset() { + *x = CommentsLookupRsp{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CommentsLookupRsp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommentsLookupRsp) ProtoMessage() {} + +func (x *CommentsLookupRsp) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[22] + 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 CommentsLookupRsp.ProtoReflect.Descriptor instead. +func (*CommentsLookupRsp) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{22} +} + +func (x *CommentsLookupRsp) GetComment() *Comment { + if x != nil { + return x.Comment + } + return nil +} + var File_pkgdash_proto protoreflect.FileDescriptor var file_pkgdash_proto_rawDesc = []byte{ @@ -1141,164 +1358,242 @@ var file_pkgdash_proto_rawDesc = []byte{ 0x1b, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x33, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x30, 0x0a, 0x08, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0x12, 0x24, - 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x22, 0x5f, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x12, 0x0a, - 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, - 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, - 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0xa8, 0x01, 0x0a, 0x07, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, - 0x65, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, - 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75, - 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, - 0x69, 0x73, 0x73, 0x75, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x69, 0x73, - 0x73, 0x75, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x22, 0xb0, 0x01, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x17, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x21, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x07, - 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x5f, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x22, 0x9b, 0x01, 0x0a, 0x05, 0x49, 0x73, 0x73, 0x75, 0x65, 0x12, 0x17, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, - 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x04, 0x64, 0x65, 0x73, 0x63, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, - 0x64, 0x65, 0x73, 0x63, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x07, - 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, - 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, - 0x73, 0x22, 0x8d, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, - 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, - 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x18, 0x0a, - 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, - 0x52, 0x65, 0x71, 0x22, 0x3e, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, - 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, - 0x68, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x61, - 0x67, 0x65, 0x73, 0x22, 0x95, 0x01, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, - 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, - 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, - 0x75, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, - 0x6c, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x73, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x04, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x73, 0x22, 0x2b, 0x0a, 0x10, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, - 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, - 0x32, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x22, 0x3b, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, 0x03, 0x70, 0x6b, 0x67, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x03, 0x70, 0x6b, - 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x4a, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x25, 0x0a, 0x09, 0x69, 0x64, 0x50, 0x61, 0x63, 0x6b, - 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, - 0x20, 0x00, 0x52, 0x09, 0x69, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, - 0x74, 0x22, 0x28, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, - 0x73, 0x70, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, - 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x22, 0x61, 0x0a, 0x0d, 0x41, - 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x04, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x62, 0x0a, 0x08, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, + 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x75, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, + 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x94, 0x02, 0x0a, 0x07, 0x50, + 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, + 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x03, + 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, + 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x73, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, + 0x04, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x08, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x34, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x07, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x64, 0x22, 0x9c, 0x02, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x17, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, + 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, + 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x0c, 0x6c, 0x61, 0x73, 0x74, + 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, + 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x07, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, + 0x22, 0x87, 0x02, 0x0a, 0x05, 0x49, 0x73, 0x73, 0x75, 0x65, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x04, 0x64, 0x65, 0x73, 0x63, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x64, 0x65, 0x73, + 0x63, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x07, 0x70, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, + 0x05, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x34, + 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x22, 0xc5, 0x01, 0x0a, 0x07, 0x43, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x21, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, + 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x34, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x07, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x22, 0x43, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x22, 0x13, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x73, 0x70, 0x22, 0x23, 0x0a, 0x11, + 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, + 0x64, 0x22, 0x13, 0x0a, 0x11, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x52, 0x73, 0x70, 0x22, 0x11, 0x0a, 0x0f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, + 0x65, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x3f, 0x0a, 0x0f, 0x50, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x08, + 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x52, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x22, 0x96, 0x01, 0x0a, 0x11, 0x50, + 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, + 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, + 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x69, + 0x73, 0x73, 0x75, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x69, 0x73, 0x73, + 0x75, 0x65, 0x73, 0x22, 0x3f, 0x0a, 0x11, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x73, 0x70, 0x12, 0x2a, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6b, 0x67, 0x64, + 0x61, 0x73, 0x68, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x07, 0x70, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x22, 0x50, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x27, 0x0a, 0x0a, 0x70, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, + 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, + 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x3f, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x73, 0x70, 0x12, 0x2a, 0x0a, 0x07, 0x63, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, + 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x07, + 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x65, 0x0a, 0x11, 0x50, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x30, - 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, - 0x1f, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x22, 0x1e, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, - 0x22, 0x39, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x73, 0x70, - 0x12, 0x29, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x4d, 0x6f, 0x64, 0x75, - 0x6c, 0x65, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x32, 0x0a, 0x0e, 0x47, - 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x42, 0x10, 0xfa, 0x42, 0x0d, 0x92, 0x01, - 0x0a, 0x08, 0x01, 0x18, 0x01, 0x22, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x22, - 0x3e, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x73, - 0x70, 0x12, 0x2c, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x43, 0x6f, - 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x32, - 0xa8, 0x06, 0x0a, 0x0e, 0x50, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x7f, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, - 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x70, 0x6b, 0x67, 0x64, - 0x61, 0x73, 0x68, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, - 0x73, 0x70, 0x22, 0x3f, 0xaa, 0x84, 0x9e, 0x03, 0x26, 0x2a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x50, - 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, - 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, - 0xea, 0xff, 0xf9, 0x01, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, - 0x67, 0x65, 0x73, 0x12, 0x8c, 0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x19, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, - 0x1a, 0x19, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x45, 0xaa, 0x84, 0x9e, - 0x03, 0x25, 0x2a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x17, - 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, - 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x15, 0x3a, 0x01, 0x2a, - 0x22, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2f, 0x7b, 0x69, - 0x64, 0x7d, 0x12, 0x8c, 0x01, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x64, 0x64, 0x43, - 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, - 0x61, 0x73, 0x68, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x73, - 0x70, 0x22, 0x4e, 0xaa, 0x84, 0x9e, 0x03, 0x25, 0x2a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, - 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, - 0xf9, 0x01, 0x1e, 0x3a, 0x01, 0x2a, 0x22, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, - 0x61, 0x67, 0x65, 0x2f, 0x7b, 0x70, 0x6b, 0x67, 0x7d, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x7e, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, - 0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, - 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, - 0x68, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, - 0x40, 0xaa, 0x84, 0x9e, 0x03, 0x25, 0x2a, 0x0a, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, - 0x67, 0x65, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, + 0x03, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x34, + 0x0a, 0x11, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x3b, 0x0a, 0x0e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6b, 0x67, 0x64, + 0x61, 0x73, 0x68, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x73, 0x22, 0x31, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, + 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x22, 0x3f, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x08, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6b, + 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x63, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x43, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, + 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x22, 0x3f, 0x0a, 0x11, + 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x73, + 0x70, 0x12, 0x2a, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x43, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x32, 0xa1, 0x0b, + 0x0a, 0x0e, 0x50, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x8f, 0x01, 0x0a, 0x0e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x50, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, + 0x1a, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, + 0x65, 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x73, 0x70, 0x22, 0x45, 0xaa, 0x84, 0x9e, + 0x03, 0x29, 0x2a, 0x0e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, - 0x10, 0x3a, 0x01, 0x2a, 0x22, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, - 0x65, 0x12, 0x76, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x15, - 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, - 0x6c, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, - 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x22, 0x3b, 0xaa, 0x84, - 0x9e, 0x03, 0x24, 0x2a, 0x09, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x17, + 0x11, 0x22, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x3a, + 0x01, 0x2a, 0x12, 0x91, 0x01, 0x0a, 0x0e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, + 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x1a, 0x1a, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x50, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x73, 0x70, 0x22, 0x47, 0xaa, + 0x84, 0x9e, 0x03, 0x29, 0x2a, 0x0e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, + 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, + 0xf9, 0x01, 0x13, 0x2a, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x84, 0x01, 0x0a, 0x0c, 0x50, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x18, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, + 0x68, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x1a, 0x18, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x50, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x73, 0x70, 0x22, 0x40, 0xaa, 0x84, 0x9e, + 0x03, 0x27, 0x2a, 0x0c, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x4c, 0x69, 0x73, 0x74, + 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, + 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x0e, 0x12, + 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x12, 0x94, 0x01, + 0x0a, 0x0e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x12, 0x1a, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x70, + 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x73, 0x70, 0x22, 0x4a, 0xaa, 0x84, 0x9e, 0x03, 0x29, 0x2a, + 0x0e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, + 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x16, 0x1a, 0x11, + 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, + 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0xa5, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, + 0x68, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x43, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x73, 0x70, 0x22, + 0x5b, 0xaa, 0x84, 0x9e, 0x03, 0x29, 0x2a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, + 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, + 0xea, 0xff, 0xf9, 0x01, 0x27, 0x22, 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x7d, + 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x3a, 0x01, 0x2a, 0x12, 0xc5, 0x01, 0x0a, + 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x12, + 0x1a, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x70, 0x6b, + 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x6f, + 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x73, 0x70, 0x22, 0x7b, 0xaa, 0x84, 0x9e, 0x03, 0x29, 0x2a, 0x0e, + 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, - 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x0c, 0x12, 0x0a, 0x2f, - 0x76, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x7f, 0x0a, 0x0b, 0x47, 0x65, 0x74, - 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x17, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, - 0x73, 0x68, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, - 0x71, 0x1a, 0x17, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x47, 0x65, 0x74, 0x43, - 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x73, 0x70, 0x22, 0x3e, 0xaa, 0x84, 0x9e, 0x03, - 0x26, 0x2a, 0x0b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x17, + 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x47, 0x12, 0x1a, 0x2f, + 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, + 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5a, 0x29, 0x12, 0x27, 0x2f, 0x76, 0x31, + 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x7b, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, + 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x9a, 0x01, 0x0a, 0x0c, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x18, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, + 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, + 0x18, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x73, 0x70, 0x22, 0x56, 0xaa, 0x84, 0x9e, 0x03, 0x27, + 0x2a, 0x0c, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, - 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x0d, 0x12, 0x0b, 0x2f, - 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x6f, - 0x2e, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x75, 0x6e, - 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x6b, 0x67, 0x64, 0x61, - 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x24, 0x12, 0x22, 0x2f, + 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x70, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x12, 0xbc, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x43, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x1a, 0x1a, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x73, 0x70, 0x22, 0x72, 0xaa, 0x84, + 0x9e, 0x03, 0x29, 0x2a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, + 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, + 0x01, 0x3e, 0x2a, 0x27, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, + 0x2f, 0x7b, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x5a, 0x13, 0x2a, 0x11, 0x2f, + 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, + 0x12, 0x7f, 0x0a, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, + 0x17, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, + 0x73, 0x68, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x73, + 0x70, 0x22, 0x3e, 0xaa, 0x84, 0x9e, 0x03, 0x26, 0x2a, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x73, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, + 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, + 0xff, 0xf9, 0x01, 0x0d, 0x12, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x73, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x6f, 0x2e, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, + 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2d, 0x6f, 0x72, + 0x67, 0x2f, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, + 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -1313,51 +1608,71 @@ func file_pkgdash_proto_rawDescGZIP() []byte { return file_pkgdash_proto_rawDescData } -var file_pkgdash_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_pkgdash_proto_msgTypes = make([]protoimpl.MessageInfo, 23) var file_pkgdash_proto_goTypes = []interface{}{ - (*ErrorRsp)(nil), // 0: pkgdash.ErrorRsp - (*Error)(nil), // 1: pkgdash.Error - (*Package)(nil), // 2: pkgdash.Package - (*Module)(nil), // 3: pkgdash.Module - (*Issue)(nil), // 4: pkgdash.Issue - (*Comment)(nil), // 5: pkgdash.Comment - (*ListPackageReq)(nil), // 6: pkgdash.ListPackageReq - (*ListPackageRsp)(nil), // 7: pkgdash.ListPackageRsp - (*UpdatePackageReq)(nil), // 8: pkgdash.UpdatePackageReq - (*UpdatePackageRsp)(nil), // 9: pkgdash.UpdatePackageRsp - (*CommentReq)(nil), // 10: pkgdash.CommentReq - (*AddCommentReq)(nil), // 11: pkgdash.AddCommentReq - (*AddCommentRsp)(nil), // 12: pkgdash.AddCommentRsp - (*AddPackageReq)(nil), // 13: pkgdash.AddPackageReq - (*AddPackageRsp)(nil), // 14: pkgdash.AddPackageRsp - (*GetModuleReq)(nil), // 15: pkgdash.GetModuleReq - (*GetModuleRsp)(nil), // 16: pkgdash.GetModuleRsp - (*GetCommentsReq)(nil), // 17: pkgdash.GetCommentsReq - (*GetCommentsRsp)(nil), // 18: pkgdash.GetCommentsRsp - (*emptypb.Empty)(nil), // 19: google.protobuf.Empty + (*ErrorRsp)(nil), // 0: pkgdash.ErrorRsp + (*Package)(nil), // 1: pkgdash.Package + (*Module)(nil), // 2: pkgdash.Module + (*Issue)(nil), // 3: pkgdash.Issue + (*Comment)(nil), // 4: pkgdash.Comment + (*CommentsDeleteReq)(nil), // 5: pkgdash.CommentsDeleteReq + (*CommentsDeleteRsp)(nil), // 6: pkgdash.CommentsDeleteRsp + (*PackagesDeleteReq)(nil), // 7: pkgdash.PackagesDeleteReq + (*PackagesDeleteRsp)(nil), // 8: pkgdash.PackagesDeleteRsp + (*PackagesListReq)(nil), // 9: pkgdash.PackagesListReq + (*PackagesListRsp)(nil), // 10: pkgdash.PackagesListRsp + (*PackagesUpdateReq)(nil), // 11: pkgdash.PackagesUpdateReq + (*PackagesUpdateRsp)(nil), // 12: pkgdash.PackagesUpdateRsp + (*CommentsCreateReq)(nil), // 13: pkgdash.CommentsCreateReq + (*CommentsCreateRsp)(nil), // 14: pkgdash.CommentsCreateRsp + (*PackagesCreateReq)(nil), // 15: pkgdash.PackagesCreateReq + (*PackagesCreateRsp)(nil), // 16: pkgdash.PackagesCreateRsp + (*ModulesListReq)(nil), // 17: pkgdash.ModulesListReq + (*ModulesListRsp)(nil), // 18: pkgdash.ModulesListRsp + (*CommentsListReq)(nil), // 19: pkgdash.CommentsListReq + (*CommentsListRsp)(nil), // 20: pkgdash.CommentsListRsp + (*CommentsLookupReq)(nil), // 21: pkgdash.CommentsLookupReq + (*CommentsLookupRsp)(nil), // 22: pkgdash.CommentsLookupRsp + (*timestamppb.Timestamp)(nil), // 23: google.protobuf.Timestamp } var file_pkgdash_proto_depIdxs = []int32{ - 1, // 0: pkgdash.ErrorRsp.error:type_name -> pkgdash.Error - 2, // 1: pkgdash.ListPackageRsp.packages:type_name -> pkgdash.Package - 3, // 2: pkgdash.GetModuleRsp.modules:type_name -> pkgdash.Module - 5, // 3: pkgdash.GetCommentsRsp.comments:type_name -> pkgdash.Comment - 19, // 4: pkgdash.PkgdashService.ListPackage:input_type -> google.protobuf.Empty - 8, // 5: pkgdash.PkgdashService.UpdatePackage:input_type -> pkgdash.UpdatePackageReq - 11, // 6: pkgdash.PkgdashService.AddComment:input_type -> pkgdash.AddCommentReq - 13, // 7: pkgdash.PkgdashService.AddPackage:input_type -> pkgdash.AddPackageReq - 15, // 8: pkgdash.PkgdashService.GetModule:input_type -> pkgdash.GetModuleReq - 17, // 9: pkgdash.PkgdashService.GetComments:input_type -> pkgdash.GetCommentsReq - 7, // 10: pkgdash.PkgdashService.ListPackage:output_type -> pkgdash.ListPackageRsp - 9, // 11: pkgdash.PkgdashService.UpdatePackage:output_type -> pkgdash.UpdatePackageRsp - 12, // 12: pkgdash.PkgdashService.AddComment:output_type -> pkgdash.AddCommentRsp - 14, // 13: pkgdash.PkgdashService.AddPackage:output_type -> pkgdash.AddPackageRsp - 16, // 14: pkgdash.PkgdashService.GetModule:output_type -> pkgdash.GetModuleRsp - 18, // 15: pkgdash.PkgdashService.GetComments:output_type -> pkgdash.GetCommentsRsp - 10, // [10:16] is the sub-list for method output_type - 4, // [4:10] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 23, // 0: pkgdash.Package.created:type_name -> google.protobuf.Timestamp + 23, // 1: pkgdash.Package.updated:type_name -> google.protobuf.Timestamp + 23, // 2: pkgdash.Module.created:type_name -> google.protobuf.Timestamp + 23, // 3: pkgdash.Module.updated:type_name -> google.protobuf.Timestamp + 23, // 4: pkgdash.Issue.created:type_name -> google.protobuf.Timestamp + 23, // 5: pkgdash.Issue.updated:type_name -> google.protobuf.Timestamp + 23, // 6: pkgdash.Comment.created:type_name -> google.protobuf.Timestamp + 23, // 7: pkgdash.Comment.updated:type_name -> google.protobuf.Timestamp + 1, // 8: pkgdash.PackagesListRsp.packages:type_name -> pkgdash.Package + 1, // 9: pkgdash.PackagesUpdateRsp.package:type_name -> pkgdash.Package + 4, // 10: pkgdash.CommentsCreateRsp.comment:type_name -> pkgdash.Comment + 2, // 11: pkgdash.ModulesListRsp.modules:type_name -> pkgdash.Module + 4, // 12: pkgdash.CommentsListRsp.comments:type_name -> pkgdash.Comment + 4, // 13: pkgdash.CommentsLookupRsp.comment:type_name -> pkgdash.Comment + 15, // 14: pkgdash.PkgdashService.PackagesCreate:input_type -> pkgdash.PackagesCreateReq + 7, // 15: pkgdash.PkgdashService.PackagesDelete:input_type -> pkgdash.PackagesDeleteReq + 9, // 16: pkgdash.PkgdashService.PackagesList:input_type -> pkgdash.PackagesListReq + 11, // 17: pkgdash.PkgdashService.PackagesUpdate:input_type -> pkgdash.PackagesUpdateReq + 13, // 18: pkgdash.PkgdashService.CommentsCreate:input_type -> pkgdash.CommentsCreateReq + 21, // 19: pkgdash.PkgdashService.CommentsLookup:input_type -> pkgdash.CommentsLookupReq + 19, // 20: pkgdash.PkgdashService.CommentsList:input_type -> pkgdash.CommentsListReq + 5, // 21: pkgdash.PkgdashService.CommentsDelete:input_type -> pkgdash.CommentsDeleteReq + 17, // 22: pkgdash.PkgdashService.ModulesList:input_type -> pkgdash.ModulesListReq + 16, // 23: pkgdash.PkgdashService.PackagesCreate:output_type -> pkgdash.PackagesCreateRsp + 8, // 24: pkgdash.PkgdashService.PackagesDelete:output_type -> pkgdash.PackagesDeleteRsp + 10, // 25: pkgdash.PkgdashService.PackagesList:output_type -> pkgdash.PackagesListRsp + 12, // 26: pkgdash.PkgdashService.PackagesUpdate:output_type -> pkgdash.PackagesUpdateRsp + 14, // 27: pkgdash.PkgdashService.CommentsCreate:output_type -> pkgdash.CommentsCreateRsp + 22, // 28: pkgdash.PkgdashService.CommentsLookup:output_type -> pkgdash.CommentsLookupRsp + 20, // 29: pkgdash.PkgdashService.CommentsList:output_type -> pkgdash.CommentsListRsp + 6, // 30: pkgdash.PkgdashService.CommentsDelete:output_type -> pkgdash.CommentsDeleteRsp + 18, // 31: pkgdash.PkgdashService.ModulesList:output_type -> pkgdash.ModulesListRsp + 23, // [23:32] is the sub-list for method output_type + 14, // [14:23] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name } func init() { file_pkgdash_proto_init() } @@ -1379,18 +1694,6 @@ func file_pkgdash_proto_init() { } } file_pkgdash_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Error); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pkgdash_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Package); i { case 0: return &v.state @@ -1402,7 +1705,7 @@ func file_pkgdash_proto_init() { return nil } } - file_pkgdash_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_pkgdash_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Module); i { case 0: return &v.state @@ -1414,7 +1717,7 @@ func file_pkgdash_proto_init() { return nil } } - file_pkgdash_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_pkgdash_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Issue); i { case 0: return &v.state @@ -1426,7 +1729,7 @@ func file_pkgdash_proto_init() { return nil } } - file_pkgdash_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_pkgdash_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Comment); i { case 0: return &v.state @@ -1438,8 +1741,20 @@ func file_pkgdash_proto_init() { return nil } } + file_pkgdash_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CommentsDeleteReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } file_pkgdash_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListPackageReq); i { + switch v := v.(*CommentsDeleteRsp); i { case 0: return &v.state case 1: @@ -1451,7 +1766,7 @@ func file_pkgdash_proto_init() { } } file_pkgdash_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListPackageRsp); i { + switch v := v.(*PackagesDeleteReq); i { case 0: return &v.state case 1: @@ -1463,7 +1778,7 @@ func file_pkgdash_proto_init() { } } file_pkgdash_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdatePackageReq); i { + switch v := v.(*PackagesDeleteRsp); i { case 0: return &v.state case 1: @@ -1475,7 +1790,7 @@ func file_pkgdash_proto_init() { } } file_pkgdash_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdatePackageRsp); i { + switch v := v.(*PackagesListReq); i { case 0: return &v.state case 1: @@ -1487,7 +1802,7 @@ func file_pkgdash_proto_init() { } } file_pkgdash_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommentReq); i { + switch v := v.(*PackagesListRsp); i { case 0: return &v.state case 1: @@ -1499,7 +1814,7 @@ func file_pkgdash_proto_init() { } } file_pkgdash_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddCommentReq); i { + switch v := v.(*PackagesUpdateReq); i { case 0: return &v.state case 1: @@ -1511,7 +1826,7 @@ func file_pkgdash_proto_init() { } } file_pkgdash_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddCommentRsp); i { + switch v := v.(*PackagesUpdateRsp); i { case 0: return &v.state case 1: @@ -1523,7 +1838,7 @@ func file_pkgdash_proto_init() { } } file_pkgdash_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddPackageReq); i { + switch v := v.(*CommentsCreateReq); i { case 0: return &v.state case 1: @@ -1535,7 +1850,7 @@ func file_pkgdash_proto_init() { } } file_pkgdash_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddPackageRsp); i { + switch v := v.(*CommentsCreateRsp); i { case 0: return &v.state case 1: @@ -1547,7 +1862,7 @@ func file_pkgdash_proto_init() { } } file_pkgdash_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetModuleReq); i { + switch v := v.(*PackagesCreateReq); i { case 0: return &v.state case 1: @@ -1559,7 +1874,7 @@ func file_pkgdash_proto_init() { } } file_pkgdash_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetModuleRsp); i { + switch v := v.(*PackagesCreateRsp); i { case 0: return &v.state case 1: @@ -1571,7 +1886,7 @@ func file_pkgdash_proto_init() { } } file_pkgdash_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetCommentsReq); i { + switch v := v.(*ModulesListReq); i { case 0: return &v.state case 1: @@ -1583,7 +1898,55 @@ func file_pkgdash_proto_init() { } } file_pkgdash_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetCommentsRsp); i { + switch v := v.(*ModulesListRsp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CommentsListReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CommentsListRsp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CommentsLookupReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CommentsLookupRsp); i { case 0: return &v.state case 1: @@ -1601,7 +1964,7 @@ func file_pkgdash_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pkgdash_proto_rawDesc, NumEnums: 0, - NumMessages: 19, + NumMessages: 23, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/pkgdash.pb.validate.go b/proto/pkgdash.pb.validate.go index 0aeea39..3a048ba 100644 --- a/proto/pkgdash.pb.validate.go +++ b/proto/pkgdash.pb.validate.go @@ -57,39 +57,17 @@ func (m *ErrorRsp) validate(all bool) error { var errors []error - if all { - switch v := interface{}(m.GetError()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ErrorRspValidationError{ - field: "Error", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ErrorRspValidationError{ - field: "Error", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetError()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ErrorRspValidationError{ - field: "Error", - reason: "embedded message failed validation", - cause: err, - } - } - } + // no validation rules for Code + + // no validation rules for Title + + // no validation rules for Uuid + + // no validation rules for Details if len(errors) > 0 { return ErrorRspMultiError(errors) } - return nil } @@ -163,112 +141,6 @@ var _ interface { ErrorName() string } = ErrorRspValidationError{} -// Validate checks the field values on Error with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Error) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Error with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in ErrorMultiError, or nil if none found. -func (m *Error) ValidateAll() error { - return m.validate(true) -} - -func (m *Error) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Code - - // no validation rules for Title - - // no validation rules for Uuid - - // no validation rules for Details - - if len(errors) > 0 { - return ErrorMultiError(errors) - } - - return nil -} - -// ErrorMultiError is an error wrapping multiple validation errors returned by -// Error.ValidateAll() if the designated constraints aren't met. -type ErrorMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ErrorMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ErrorMultiError) AllErrors() []error { return m } - -// ErrorValidationError is the validation error returned by Error.Validate if -// the designated constraints aren't met. -type ErrorValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ErrorValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ErrorValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ErrorValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ErrorValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ErrorValidationError) ErrorName() string { return "ErrorValidationError" } - -// Error satisfies the builtin error interface -func (e ErrorValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sError.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ErrorValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ErrorValidationError{} - // Validate checks the field values on Package with the rules defined in the // proto definition for this message. If any rules are violated, the first // error encountered is returned, or nil if there are no violations. @@ -323,10 +195,67 @@ func (m *Package) validate(all bool) error { errors = append(errors, err) } + if all { + switch v := interface{}(m.GetCreated()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PackageValidationError{ + field: "Created", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PackageValidationError{ + field: "Created", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreated()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PackageValidationError{ + field: "Created", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetUpdated()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PackageValidationError{ + field: "Updated", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PackageValidationError{ + field: "Updated", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUpdated()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PackageValidationError{ + field: "Updated", + reason: "embedded message failed validation", + cause: err, + } + } + } + if len(errors) > 0 { return PackageMultiError(errors) } - return nil } @@ -476,10 +405,67 @@ func (m *Module) validate(all bool) error { errors = append(errors, err) } + if all { + switch v := interface{}(m.GetCreated()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ModuleValidationError{ + field: "Created", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ModuleValidationError{ + field: "Created", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreated()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ModuleValidationError{ + field: "Created", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetUpdated()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ModuleValidationError{ + field: "Updated", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ModuleValidationError{ + field: "Updated", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUpdated()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ModuleValidationError{ + field: "Updated", + reason: "embedded message failed validation", + cause: err, + } + } + } + if len(errors) > 0 { return ModuleMultiError(errors) } - return nil } @@ -618,10 +604,67 @@ func (m *Issue) validate(all bool) error { errors = append(errors, err) } + if all { + switch v := interface{}(m.GetCreated()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, IssueValidationError{ + field: "Created", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, IssueValidationError{ + field: "Created", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreated()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return IssueValidationError{ + field: "Created", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetUpdated()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, IssueValidationError{ + field: "Updated", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, IssueValidationError{ + field: "Updated", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUpdated()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return IssueValidationError{ + field: "Updated", + reason: "embedded message failed validation", + cause: err, + } + } + } + if len(errors) > 0 { return IssueMultiError(errors) } - return nil } @@ -740,14 +783,67 @@ func (m *Comment) validate(all bool) error { // no validation rules for Text - // no validation rules for Created + if all { + switch v := interface{}(m.GetCreated()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CommentValidationError{ + field: "Created", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CommentValidationError{ + field: "Created", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreated()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CommentValidationError{ + field: "Created", + reason: "embedded message failed validation", + cause: err, + } + } + } - // no validation rules for Updated + if all { + switch v := interface{}(m.GetUpdated()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CommentValidationError{ + field: "Updated", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CommentValidationError{ + field: "Updated", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUpdated()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CommentValidationError{ + field: "Updated", + reason: "embedded message failed validation", + cause: err, + } + } + } if len(errors) > 0 { return CommentMultiError(errors) } - return nil } @@ -821,42 +917,45 @@ var _ interface { ErrorName() string } = CommentValidationError{} -// Validate checks the field values on ListPackageReq with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ListPackageReq) Validate() error { +// Validate checks the field values on CommentsDeleteReq with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *CommentsDeleteReq) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on ListPackageReq with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ListPackageReqMultiError, -// or nil if none found. -func (m *ListPackageReq) ValidateAll() error { +// ValidateAll checks the field values on CommentsDeleteReq with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CommentsDeleteReqMultiError, or nil if none found. +func (m *CommentsDeleteReq) ValidateAll() error { return m.validate(true) } -func (m *ListPackageReq) validate(all bool) error { +func (m *CommentsDeleteReq) validate(all bool) error { if m == nil { return nil } var errors []error - if len(errors) > 0 { - return ListPackageReqMultiError(errors) - } + // no validation rules for Id + // no validation rules for PackageId + + if len(errors) > 0 { + return CommentsDeleteReqMultiError(errors) + } return nil } -// ListPackageReqMultiError is an error wrapping multiple validation errors -// returned by ListPackageReq.ValidateAll() if the designated constraints +// CommentsDeleteReqMultiError is an error wrapping multiple validation errors +// returned by CommentsDeleteReq.ValidateAll() if the designated constraints // aren't met. -type ListPackageReqMultiError []error +type CommentsDeleteReqMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m ListPackageReqMultiError) Error() string { +func (m CommentsDeleteReqMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -865,11 +964,11 @@ func (m ListPackageReqMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m ListPackageReqMultiError) AllErrors() []error { return m } +func (m CommentsDeleteReqMultiError) AllErrors() []error { return m } -// ListPackageReqValidationError is the validation error returned by -// ListPackageReq.Validate if the designated constraints aren't met. -type ListPackageReqValidationError struct { +// CommentsDeleteReqValidationError is the validation error returned by +// CommentsDeleteReq.Validate if the designated constraints aren't met. +type CommentsDeleteReqValidationError struct { field string reason string cause error @@ -877,22 +976,24 @@ type ListPackageReqValidationError struct { } // Field function returns field value. -func (e ListPackageReqValidationError) Field() string { return e.field } +func (e CommentsDeleteReqValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e ListPackageReqValidationError) Reason() string { return e.reason } +func (e CommentsDeleteReqValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e ListPackageReqValidationError) Cause() error { return e.cause } +func (e CommentsDeleteReqValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e ListPackageReqValidationError) Key() bool { return e.key } +func (e CommentsDeleteReqValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e ListPackageReqValidationError) ErrorName() string { return "ListPackageReqValidationError" } +func (e CommentsDeleteReqValidationError) ErrorName() string { + return "CommentsDeleteReqValidationError" +} // Error satisfies the builtin error interface -func (e ListPackageReqValidationError) Error() string { +func (e CommentsDeleteReqValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -904,14 +1005,14 @@ func (e ListPackageReqValidationError) Error() string { } return fmt.Sprintf( - "invalid %sListPackageReq.%s: %s%s", + "invalid %sCommentsDeleteReq.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = ListPackageReqValidationError{} +var _ error = CommentsDeleteReqValidationError{} var _ interface { Field() string @@ -919,24 +1020,428 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = ListPackageReqValidationError{} +} = CommentsDeleteReqValidationError{} -// Validate checks the field values on ListPackageRsp with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ListPackageRsp) Validate() error { +// Validate checks the field values on CommentsDeleteRsp with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *CommentsDeleteRsp) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on ListPackageRsp with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ListPackageRspMultiError, -// or nil if none found. -func (m *ListPackageRsp) ValidateAll() error { +// ValidateAll checks the field values on CommentsDeleteRsp with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CommentsDeleteRspMultiError, or nil if none found. +func (m *CommentsDeleteRsp) ValidateAll() error { return m.validate(true) } -func (m *ListPackageRsp) validate(all bool) error { +func (m *CommentsDeleteRsp) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if len(errors) > 0 { + return CommentsDeleteRspMultiError(errors) + } + return nil +} + +// CommentsDeleteRspMultiError is an error wrapping multiple validation errors +// returned by CommentsDeleteRsp.ValidateAll() if the designated constraints +// aren't met. +type CommentsDeleteRspMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CommentsDeleteRspMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CommentsDeleteRspMultiError) AllErrors() []error { return m } + +// CommentsDeleteRspValidationError is the validation error returned by +// CommentsDeleteRsp.Validate if the designated constraints aren't met. +type CommentsDeleteRspValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CommentsDeleteRspValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CommentsDeleteRspValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CommentsDeleteRspValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CommentsDeleteRspValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CommentsDeleteRspValidationError) ErrorName() string { + return "CommentsDeleteRspValidationError" +} + +// Error satisfies the builtin error interface +func (e CommentsDeleteRspValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCommentsDeleteRsp.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CommentsDeleteRspValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CommentsDeleteRspValidationError{} + +// Validate checks the field values on PackagesDeleteReq with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *PackagesDeleteReq) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PackagesDeleteReq with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// PackagesDeleteReqMultiError, or nil if none found. +func (m *PackagesDeleteReq) ValidateAll() error { + return m.validate(true) +} + +func (m *PackagesDeleteReq) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + if len(errors) > 0 { + return PackagesDeleteReqMultiError(errors) + } + return nil +} + +// PackagesDeleteReqMultiError is an error wrapping multiple validation errors +// returned by PackagesDeleteReq.ValidateAll() if the designated constraints +// aren't met. +type PackagesDeleteReqMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PackagesDeleteReqMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PackagesDeleteReqMultiError) AllErrors() []error { return m } + +// PackagesDeleteReqValidationError is the validation error returned by +// PackagesDeleteReq.Validate if the designated constraints aren't met. +type PackagesDeleteReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PackagesDeleteReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PackagesDeleteReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PackagesDeleteReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PackagesDeleteReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PackagesDeleteReqValidationError) ErrorName() string { + return "PackagesDeleteReqValidationError" +} + +// Error satisfies the builtin error interface +func (e PackagesDeleteReqValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPackagesDeleteReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PackagesDeleteReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PackagesDeleteReqValidationError{} + +// Validate checks the field values on PackagesDeleteRsp with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *PackagesDeleteRsp) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PackagesDeleteRsp with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// PackagesDeleteRspMultiError, or nil if none found. +func (m *PackagesDeleteRsp) ValidateAll() error { + return m.validate(true) +} + +func (m *PackagesDeleteRsp) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if len(errors) > 0 { + return PackagesDeleteRspMultiError(errors) + } + return nil +} + +// PackagesDeleteRspMultiError is an error wrapping multiple validation errors +// returned by PackagesDeleteRsp.ValidateAll() if the designated constraints +// aren't met. +type PackagesDeleteRspMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PackagesDeleteRspMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PackagesDeleteRspMultiError) AllErrors() []error { return m } + +// PackagesDeleteRspValidationError is the validation error returned by +// PackagesDeleteRsp.Validate if the designated constraints aren't met. +type PackagesDeleteRspValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PackagesDeleteRspValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PackagesDeleteRspValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PackagesDeleteRspValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PackagesDeleteRspValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PackagesDeleteRspValidationError) ErrorName() string { + return "PackagesDeleteRspValidationError" +} + +// Error satisfies the builtin error interface +func (e PackagesDeleteRspValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPackagesDeleteRsp.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PackagesDeleteRspValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PackagesDeleteRspValidationError{} + +// Validate checks the field values on PackagesListReq with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *PackagesListReq) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PackagesListReq with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// PackagesListReqMultiError, or nil if none found. +func (m *PackagesListReq) ValidateAll() error { + return m.validate(true) +} + +func (m *PackagesListReq) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if len(errors) > 0 { + return PackagesListReqMultiError(errors) + } + return nil +} + +// PackagesListReqMultiError is an error wrapping multiple validation errors +// returned by PackagesListReq.ValidateAll() if the designated constraints +// aren't met. +type PackagesListReqMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PackagesListReqMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PackagesListReqMultiError) AllErrors() []error { return m } + +// PackagesListReqValidationError is the validation error returned by +// PackagesListReq.Validate if the designated constraints aren't met. +type PackagesListReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PackagesListReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PackagesListReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PackagesListReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PackagesListReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PackagesListReqValidationError) ErrorName() string { return "PackagesListReqValidationError" } + +// Error satisfies the builtin error interface +func (e PackagesListReqValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPackagesListReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PackagesListReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PackagesListReqValidationError{} + +// Validate checks the field values on PackagesListRsp with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *PackagesListRsp) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PackagesListRsp with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// PackagesListRspMultiError, or nil if none found. +func (m *PackagesListRsp) ValidateAll() error { + return m.validate(true) +} + +func (m *PackagesListRsp) validate(all bool) error { if m == nil { return nil } @@ -950,7 +1455,7 @@ func (m *ListPackageRsp) validate(all bool) error { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { - errors = append(errors, ListPackageRspValidationError{ + errors = append(errors, PackagesListRspValidationError{ field: fmt.Sprintf("Packages[%v]", idx), reason: "embedded message failed validation", cause: err, @@ -958,7 +1463,7 @@ func (m *ListPackageRsp) validate(all bool) error { } case interface{ Validate() error }: if err := v.Validate(); err != nil { - errors = append(errors, ListPackageRspValidationError{ + errors = append(errors, PackagesListRspValidationError{ field: fmt.Sprintf("Packages[%v]", idx), reason: "embedded message failed validation", cause: err, @@ -967,7 +1472,7 @@ func (m *ListPackageRsp) validate(all bool) error { } } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { - return ListPackageRspValidationError{ + return PackagesListRspValidationError{ field: fmt.Sprintf("Packages[%v]", idx), reason: "embedded message failed validation", cause: err, @@ -978,19 +1483,18 @@ func (m *ListPackageRsp) validate(all bool) error { } if len(errors) > 0 { - return ListPackageRspMultiError(errors) + return PackagesListRspMultiError(errors) } - return nil } -// ListPackageRspMultiError is an error wrapping multiple validation errors -// returned by ListPackageRsp.ValidateAll() if the designated constraints +// PackagesListRspMultiError is an error wrapping multiple validation errors +// returned by PackagesListRsp.ValidateAll() if the designated constraints // aren't met. -type ListPackageRspMultiError []error +type PackagesListRspMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m ListPackageRspMultiError) Error() string { +func (m PackagesListRspMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -999,11 +1503,11 @@ func (m ListPackageRspMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m ListPackageRspMultiError) AllErrors() []error { return m } +func (m PackagesListRspMultiError) AllErrors() []error { return m } -// ListPackageRspValidationError is the validation error returned by -// ListPackageRsp.Validate if the designated constraints aren't met. -type ListPackageRspValidationError struct { +// PackagesListRspValidationError is the validation error returned by +// PackagesListRsp.Validate if the designated constraints aren't met. +type PackagesListRspValidationError struct { field string reason string cause error @@ -1011,22 +1515,22 @@ type ListPackageRspValidationError struct { } // Field function returns field value. -func (e ListPackageRspValidationError) Field() string { return e.field } +func (e PackagesListRspValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e ListPackageRspValidationError) Reason() string { return e.reason } +func (e PackagesListRspValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e ListPackageRspValidationError) Cause() error { return e.cause } +func (e PackagesListRspValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e ListPackageRspValidationError) Key() bool { return e.key } +func (e PackagesListRspValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e ListPackageRspValidationError) ErrorName() string { return "ListPackageRspValidationError" } +func (e PackagesListRspValidationError) ErrorName() string { return "PackagesListRspValidationError" } // Error satisfies the builtin error interface -func (e ListPackageRspValidationError) Error() string { +func (e PackagesListRspValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -1038,14 +1542,14 @@ func (e ListPackageRspValidationError) Error() string { } return fmt.Sprintf( - "invalid %sListPackageRsp.%s: %s%s", + "invalid %sPackagesListRsp.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = ListPackageRspValidationError{} +var _ error = PackagesListRspValidationError{} var _ interface { Field() string @@ -1053,24 +1557,24 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = ListPackageRspValidationError{} +} = PackagesListRspValidationError{} -// Validate checks the field values on UpdatePackageReq with the rules defined +// Validate checks the field values on PackagesUpdateReq with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. -func (m *UpdatePackageReq) Validate() error { +func (m *PackagesUpdateReq) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on UpdatePackageReq with the rules +// ValidateAll checks the field values on PackagesUpdateReq with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in -// UpdatePackageReqMultiError, or nil if none found. -func (m *UpdatePackageReq) ValidateAll() error { +// PackagesUpdateReqMultiError, or nil if none found. +func (m *PackagesUpdateReq) ValidateAll() error { return m.validate(true) } -func (m *UpdatePackageReq) validate(all bool) error { +func (m *PackagesUpdateReq) validate(all bool) error { if m == nil { return nil } @@ -1078,7 +1582,7 @@ func (m *UpdatePackageReq) validate(all bool) error { var errors []error if m.GetId() <= 0 { - err := UpdatePackageReqValidationError{ + err := PackagesUpdateReqValidationError{ field: "Id", reason: "value must be greater than 0", } @@ -1089,7 +1593,7 @@ func (m *UpdatePackageReq) validate(all bool) error { } if utf8.RuneCountInString(m.GetName()) < 1 { - err := UpdatePackageReqValidationError{ + err := PackagesUpdateReqValidationError{ field: "Name", reason: "value length must be at least 1 runes", } @@ -1100,7 +1604,7 @@ func (m *UpdatePackageReq) validate(all bool) error { } if utf8.RuneCountInString(m.GetUrl()) < 1 { - err := UpdatePackageReqValidationError{ + err := PackagesUpdateReqValidationError{ field: "Url", reason: "value length must be at least 1 runes", } @@ -1111,19 +1615,18 @@ func (m *UpdatePackageReq) validate(all bool) error { } if len(errors) > 0 { - return UpdatePackageReqMultiError(errors) + return PackagesUpdateReqMultiError(errors) } - return nil } -// UpdatePackageReqMultiError is an error wrapping multiple validation errors -// returned by UpdatePackageReq.ValidateAll() if the designated constraints +// PackagesUpdateReqMultiError is an error wrapping multiple validation errors +// returned by PackagesUpdateReq.ValidateAll() if the designated constraints // aren't met. -type UpdatePackageReqMultiError []error +type PackagesUpdateReqMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m UpdatePackageReqMultiError) Error() string { +func (m PackagesUpdateReqMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -1132,11 +1635,11 @@ func (m UpdatePackageReqMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m UpdatePackageReqMultiError) AllErrors() []error { return m } +func (m PackagesUpdateReqMultiError) AllErrors() []error { return m } -// UpdatePackageReqValidationError is the validation error returned by -// UpdatePackageReq.Validate if the designated constraints aren't met. -type UpdatePackageReqValidationError struct { +// PackagesUpdateReqValidationError is the validation error returned by +// PackagesUpdateReq.Validate if the designated constraints aren't met. +type PackagesUpdateReqValidationError struct { field string reason string cause error @@ -1144,22 +1647,24 @@ type UpdatePackageReqValidationError struct { } // Field function returns field value. -func (e UpdatePackageReqValidationError) Field() string { return e.field } +func (e PackagesUpdateReqValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e UpdatePackageReqValidationError) Reason() string { return e.reason } +func (e PackagesUpdateReqValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e UpdatePackageReqValidationError) Cause() error { return e.cause } +func (e PackagesUpdateReqValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e UpdatePackageReqValidationError) Key() bool { return e.key } +func (e PackagesUpdateReqValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e UpdatePackageReqValidationError) ErrorName() string { return "UpdatePackageReqValidationError" } +func (e PackagesUpdateReqValidationError) ErrorName() string { + return "PackagesUpdateReqValidationError" +} // Error satisfies the builtin error interface -func (e UpdatePackageReqValidationError) Error() string { +func (e PackagesUpdateReqValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -1171,14 +1676,14 @@ func (e UpdatePackageReqValidationError) Error() string { } return fmt.Sprintf( - "invalid %sUpdatePackageReq.%s: %s%s", + "invalid %sPackagesUpdateReq.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = UpdatePackageReqValidationError{} +var _ error = PackagesUpdateReqValidationError{} var _ interface { Field() string @@ -1186,55 +1691,72 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = UpdatePackageReqValidationError{} +} = PackagesUpdateReqValidationError{} -// Validate checks the field values on UpdatePackageRsp with the rules defined +// Validate checks the field values on PackagesUpdateRsp with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. -func (m *UpdatePackageRsp) Validate() error { +func (m *PackagesUpdateRsp) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on UpdatePackageRsp with the rules +// ValidateAll checks the field values on PackagesUpdateRsp with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in -// UpdatePackageRspMultiError, or nil if none found. -func (m *UpdatePackageRsp) ValidateAll() error { +// PackagesUpdateRspMultiError, or nil if none found. +func (m *PackagesUpdateRsp) ValidateAll() error { return m.validate(true) } -func (m *UpdatePackageRsp) validate(all bool) error { +func (m *PackagesUpdateRsp) validate(all bool) error { if m == nil { return nil } var errors []error - if m.GetId() <= 0 { - err := UpdatePackageRspValidationError{ - field: "Id", - reason: "value must be greater than 0", + if all { + switch v := interface{}(m.GetPackage()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PackagesUpdateRspValidationError{ + field: "Package", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PackagesUpdateRspValidationError{ + field: "Package", + reason: "embedded message failed validation", + cause: err, + }) + } } - if !all { - return err + } else if v, ok := interface{}(m.GetPackage()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PackagesUpdateRspValidationError{ + field: "Package", + reason: "embedded message failed validation", + cause: err, + } } - errors = append(errors, err) } if len(errors) > 0 { - return UpdatePackageRspMultiError(errors) + return PackagesUpdateRspMultiError(errors) } - return nil } -// UpdatePackageRspMultiError is an error wrapping multiple validation errors -// returned by UpdatePackageRsp.ValidateAll() if the designated constraints +// PackagesUpdateRspMultiError is an error wrapping multiple validation errors +// returned by PackagesUpdateRsp.ValidateAll() if the designated constraints // aren't met. -type UpdatePackageRspMultiError []error +type PackagesUpdateRspMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m UpdatePackageRspMultiError) Error() string { +func (m PackagesUpdateRspMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -1243,11 +1765,11 @@ func (m UpdatePackageRspMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m UpdatePackageRspMultiError) AllErrors() []error { return m } +func (m PackagesUpdateRspMultiError) AllErrors() []error { return m } -// UpdatePackageRspValidationError is the validation error returned by -// UpdatePackageRsp.Validate if the designated constraints aren't met. -type UpdatePackageRspValidationError struct { +// PackagesUpdateRspValidationError is the validation error returned by +// PackagesUpdateRsp.Validate if the designated constraints aren't met. +type PackagesUpdateRspValidationError struct { field string reason string cause error @@ -1255,22 +1777,24 @@ type UpdatePackageRspValidationError struct { } // Field function returns field value. -func (e UpdatePackageRspValidationError) Field() string { return e.field } +func (e PackagesUpdateRspValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e UpdatePackageRspValidationError) Reason() string { return e.reason } +func (e PackagesUpdateRspValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e UpdatePackageRspValidationError) Cause() error { return e.cause } +func (e PackagesUpdateRspValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e UpdatePackageRspValidationError) Key() bool { return e.key } +func (e PackagesUpdateRspValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e UpdatePackageRspValidationError) ErrorName() string { return "UpdatePackageRspValidationError" } +func (e PackagesUpdateRspValidationError) ErrorName() string { + return "PackagesUpdateRspValidationError" +} // Error satisfies the builtin error interface -func (e UpdatePackageRspValidationError) Error() string { +func (e PackagesUpdateRspValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -1282,14 +1806,14 @@ func (e UpdatePackageRspValidationError) Error() string { } return fmt.Sprintf( - "invalid %sUpdatePackageRsp.%s: %s%s", + "invalid %sPackagesUpdateRsp.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = UpdatePackageRspValidationError{} +var _ error = PackagesUpdateRspValidationError{} var _ interface { Field() string @@ -1297,33 +1821,33 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = UpdatePackageRspValidationError{} +} = PackagesUpdateRspValidationError{} -// Validate checks the field values on CommentReq with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *CommentReq) Validate() error { +// Validate checks the field values on CommentsCreateReq with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *CommentsCreateReq) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on CommentReq with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in CommentReqMultiError, or -// nil if none found. -func (m *CommentReq) ValidateAll() error { +// ValidateAll checks the field values on CommentsCreateReq with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CommentsCreateReqMultiError, or nil if none found. +func (m *CommentsCreateReq) ValidateAll() error { return m.validate(true) } -func (m *CommentReq) validate(all bool) error { +func (m *CommentsCreateReq) validate(all bool) error { if m == nil { return nil } var errors []error - if m.GetPkg() <= 0 { - err := CommentReqValidationError{ - field: "Pkg", + if m.GetPackageId() <= 0 { + err := CommentsCreateReqValidationError{ + field: "PackageId", reason: "value must be greater than 0", } if !all { @@ -1335,18 +1859,18 @@ func (m *CommentReq) validate(all bool) error { // no validation rules for Text if len(errors) > 0 { - return CommentReqMultiError(errors) + return CommentsCreateReqMultiError(errors) } - return nil } -// CommentReqMultiError is an error wrapping multiple validation errors -// returned by CommentReq.ValidateAll() if the designated constraints aren't met. -type CommentReqMultiError []error +// CommentsCreateReqMultiError is an error wrapping multiple validation errors +// returned by CommentsCreateReq.ValidateAll() if the designated constraints +// aren't met. +type CommentsCreateReqMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m CommentReqMultiError) Error() string { +func (m CommentsCreateReqMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -1355,11 +1879,11 @@ func (m CommentReqMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m CommentReqMultiError) AllErrors() []error { return m } +func (m CommentsCreateReqMultiError) AllErrors() []error { return m } -// CommentReqValidationError is the validation error returned by -// CommentReq.Validate if the designated constraints aren't met. -type CommentReqValidationError struct { +// CommentsCreateReqValidationError is the validation error returned by +// CommentsCreateReq.Validate if the designated constraints aren't met. +type CommentsCreateReqValidationError struct { field string reason string cause error @@ -1367,22 +1891,24 @@ type CommentReqValidationError struct { } // Field function returns field value. -func (e CommentReqValidationError) Field() string { return e.field } +func (e CommentsCreateReqValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e CommentReqValidationError) Reason() string { return e.reason } +func (e CommentsCreateReqValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e CommentReqValidationError) Cause() error { return e.cause } +func (e CommentsCreateReqValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e CommentReqValidationError) Key() bool { return e.key } +func (e CommentsCreateReqValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e CommentReqValidationError) ErrorName() string { return "CommentReqValidationError" } +func (e CommentsCreateReqValidationError) ErrorName() string { + return "CommentsCreateReqValidationError" +} // Error satisfies the builtin error interface -func (e CommentReqValidationError) Error() string { +func (e CommentsCreateReqValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -1394,14 +1920,14 @@ func (e CommentReqValidationError) Error() string { } return fmt.Sprintf( - "invalid %sCommentReq.%s: %s%s", + "invalid %sCommentsCreateReq.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = CommentReqValidationError{} +var _ error = CommentsCreateReqValidationError{} var _ interface { Field() string @@ -1409,57 +1935,72 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = CommentReqValidationError{} +} = CommentsCreateReqValidationError{} -// Validate checks the field values on AddCommentReq with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *AddCommentReq) Validate() error { +// Validate checks the field values on CommentsCreateRsp with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *CommentsCreateRsp) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on AddCommentReq with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in AddCommentReqMultiError, or -// nil if none found. -func (m *AddCommentReq) ValidateAll() error { +// ValidateAll checks the field values on CommentsCreateRsp with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CommentsCreateRspMultiError, or nil if none found. +func (m *CommentsCreateRsp) ValidateAll() error { return m.validate(true) } -func (m *AddCommentReq) validate(all bool) error { +func (m *CommentsCreateRsp) validate(all bool) error { if m == nil { return nil } var errors []error - if m.GetIdPackage() <= 0 { - err := AddCommentReqValidationError{ - field: "IdPackage", - reason: "value must be greater than 0", + if all { + switch v := interface{}(m.GetComment()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CommentsCreateRspValidationError{ + field: "Comment", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CommentsCreateRspValidationError{ + field: "Comment", + reason: "embedded message failed validation", + cause: err, + }) + } } - if !all { - return err + } else if v, ok := interface{}(m.GetComment()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CommentsCreateRspValidationError{ + field: "Comment", + reason: "embedded message failed validation", + cause: err, + } } - errors = append(errors, err) } - // no validation rules for Text - if len(errors) > 0 { - return AddCommentReqMultiError(errors) + return CommentsCreateRspMultiError(errors) } - return nil } -// AddCommentReqMultiError is an error wrapping multiple validation errors -// returned by AddCommentReq.ValidateAll() if the designated constraints +// CommentsCreateRspMultiError is an error wrapping multiple validation errors +// returned by CommentsCreateRsp.ValidateAll() if the designated constraints // aren't met. -type AddCommentReqMultiError []error +type CommentsCreateRspMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m AddCommentReqMultiError) Error() string { +func (m CommentsCreateRspMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -1468,11 +2009,11 @@ func (m AddCommentReqMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m AddCommentReqMultiError) AllErrors() []error { return m } +func (m CommentsCreateRspMultiError) AllErrors() []error { return m } -// AddCommentReqValidationError is the validation error returned by -// AddCommentReq.Validate if the designated constraints aren't met. -type AddCommentReqValidationError struct { +// CommentsCreateRspValidationError is the validation error returned by +// CommentsCreateRsp.Validate if the designated constraints aren't met. +type CommentsCreateRspValidationError struct { field string reason string cause error @@ -1480,22 +2021,24 @@ type AddCommentReqValidationError struct { } // Field function returns field value. -func (e AddCommentReqValidationError) Field() string { return e.field } +func (e CommentsCreateRspValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e AddCommentReqValidationError) Reason() string { return e.reason } +func (e CommentsCreateRspValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e AddCommentReqValidationError) Cause() error { return e.cause } +func (e CommentsCreateRspValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e AddCommentReqValidationError) Key() bool { return e.key } +func (e CommentsCreateRspValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e AddCommentReqValidationError) ErrorName() string { return "AddCommentReqValidationError" } +func (e CommentsCreateRspValidationError) ErrorName() string { + return "CommentsCreateRspValidationError" +} // Error satisfies the builtin error interface -func (e AddCommentReqValidationError) Error() string { +func (e CommentsCreateRspValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -1507,14 +2050,14 @@ func (e AddCommentReqValidationError) Error() string { } return fmt.Sprintf( - "invalid %sAddCommentReq.%s: %s%s", + "invalid %sCommentsCreateRsp.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = AddCommentReqValidationError{} +var _ error = CommentsCreateRspValidationError{} var _ interface { Field() string @@ -1522,135 +2065,24 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = AddCommentReqValidationError{} +} = CommentsCreateRspValidationError{} -// Validate checks the field values on AddCommentRsp with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *AddCommentRsp) Validate() error { +// Validate checks the field values on PackagesCreateReq with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *PackagesCreateReq) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on AddCommentRsp with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in AddCommentRspMultiError, or -// nil if none found. -func (m *AddCommentRsp) ValidateAll() error { +// ValidateAll checks the field values on PackagesCreateReq with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// PackagesCreateReqMultiError, or nil if none found. +func (m *PackagesCreateReq) ValidateAll() error { return m.validate(true) } -func (m *AddCommentRsp) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetId() <= 0 { - err := AddCommentRspValidationError{ - field: "Id", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return AddCommentRspMultiError(errors) - } - - return nil -} - -// AddCommentRspMultiError is an error wrapping multiple validation errors -// returned by AddCommentRsp.ValidateAll() if the designated constraints -// aren't met. -type AddCommentRspMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddCommentRspMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AddCommentRspMultiError) AllErrors() []error { return m } - -// AddCommentRspValidationError is the validation error returned by -// AddCommentRsp.Validate if the designated constraints aren't met. -type AddCommentRspValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddCommentRspValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddCommentRspValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddCommentRspValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddCommentRspValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddCommentRspValidationError) ErrorName() string { return "AddCommentRspValidationError" } - -// Error satisfies the builtin error interface -func (e AddCommentRspValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAddCommentRsp.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddCommentRspValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddCommentRspValidationError{} - -// Validate checks the field values on AddPackageReq with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *AddPackageReq) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddPackageReq with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in AddPackageReqMultiError, or -// nil if none found. -func (m *AddPackageReq) ValidateAll() error { - return m.validate(true) -} - -func (m *AddPackageReq) validate(all bool) error { +func (m *PackagesCreateReq) validate(all bool) error { if m == nil { return nil } @@ -1658,7 +2090,7 @@ func (m *AddPackageReq) validate(all bool) error { var errors []error if utf8.RuneCountInString(m.GetName()) < 1 { - err := AddPackageReqValidationError{ + err := PackagesCreateReqValidationError{ field: "Name", reason: "value length must be at least 1 runes", } @@ -1669,7 +2101,7 @@ func (m *AddPackageReq) validate(all bool) error { } if utf8.RuneCountInString(m.GetUrl()) < 1 { - err := AddPackageReqValidationError{ + err := PackagesCreateReqValidationError{ field: "Url", reason: "value length must be at least 1 runes", } @@ -1680,19 +2112,18 @@ func (m *AddPackageReq) validate(all bool) error { } if len(errors) > 0 { - return AddPackageReqMultiError(errors) + return PackagesCreateReqMultiError(errors) } - return nil } -// AddPackageReqMultiError is an error wrapping multiple validation errors -// returned by AddPackageReq.ValidateAll() if the designated constraints +// PackagesCreateReqMultiError is an error wrapping multiple validation errors +// returned by PackagesCreateReq.ValidateAll() if the designated constraints // aren't met. -type AddPackageReqMultiError []error +type PackagesCreateReqMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m AddPackageReqMultiError) Error() string { +func (m PackagesCreateReqMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -1701,11 +2132,11 @@ func (m AddPackageReqMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m AddPackageReqMultiError) AllErrors() []error { return m } +func (m PackagesCreateReqMultiError) AllErrors() []error { return m } -// AddPackageReqValidationError is the validation error returned by -// AddPackageReq.Validate if the designated constraints aren't met. -type AddPackageReqValidationError struct { +// PackagesCreateReqValidationError is the validation error returned by +// PackagesCreateReq.Validate if the designated constraints aren't met. +type PackagesCreateReqValidationError struct { field string reason string cause error @@ -1713,22 +2144,24 @@ type AddPackageReqValidationError struct { } // Field function returns field value. -func (e AddPackageReqValidationError) Field() string { return e.field } +func (e PackagesCreateReqValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e AddPackageReqValidationError) Reason() string { return e.reason } +func (e PackagesCreateReqValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e AddPackageReqValidationError) Cause() error { return e.cause } +func (e PackagesCreateReqValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e AddPackageReqValidationError) Key() bool { return e.key } +func (e PackagesCreateReqValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e AddPackageReqValidationError) ErrorName() string { return "AddPackageReqValidationError" } +func (e PackagesCreateReqValidationError) ErrorName() string { + return "PackagesCreateReqValidationError" +} // Error satisfies the builtin error interface -func (e AddPackageReqValidationError) Error() string { +func (e PackagesCreateReqValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -1740,14 +2173,14 @@ func (e AddPackageReqValidationError) Error() string { } return fmt.Sprintf( - "invalid %sAddPackageReq.%s: %s%s", + "invalid %sPackagesCreateReq.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = AddPackageReqValidationError{} +var _ error = PackagesCreateReqValidationError{} var _ interface { Field() string @@ -1755,24 +2188,24 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = AddPackageReqValidationError{} +} = PackagesCreateReqValidationError{} -// Validate checks the field values on AddPackageRsp with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *AddPackageRsp) Validate() error { +// Validate checks the field values on PackagesCreateRsp with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *PackagesCreateRsp) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on AddPackageRsp with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in AddPackageRspMultiError, or -// nil if none found. -func (m *AddPackageRsp) ValidateAll() error { +// ValidateAll checks the field values on PackagesCreateRsp with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// PackagesCreateRspMultiError, or nil if none found. +func (m *PackagesCreateRsp) ValidateAll() error { return m.validate(true) } -func (m *AddPackageRsp) validate(all bool) error { +func (m *PackagesCreateRsp) validate(all bool) error { if m == nil { return nil } @@ -1780,7 +2213,7 @@ func (m *AddPackageRsp) validate(all bool) error { var errors []error if utf8.RuneCountInString(m.GetStatus()) < 1 { - err := AddPackageRspValidationError{ + err := PackagesCreateRspValidationError{ field: "Status", reason: "value length must be at least 1 runes", } @@ -1791,19 +2224,18 @@ func (m *AddPackageRsp) validate(all bool) error { } if len(errors) > 0 { - return AddPackageRspMultiError(errors) + return PackagesCreateRspMultiError(errors) } - return nil } -// AddPackageRspMultiError is an error wrapping multiple validation errors -// returned by AddPackageRsp.ValidateAll() if the designated constraints +// PackagesCreateRspMultiError is an error wrapping multiple validation errors +// returned by PackagesCreateRsp.ValidateAll() if the designated constraints // aren't met. -type AddPackageRspMultiError []error +type PackagesCreateRspMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m AddPackageRspMultiError) Error() string { +func (m PackagesCreateRspMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -1812,11 +2244,11 @@ func (m AddPackageRspMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m AddPackageRspMultiError) AllErrors() []error { return m } +func (m PackagesCreateRspMultiError) AllErrors() []error { return m } -// AddPackageRspValidationError is the validation error returned by -// AddPackageRsp.Validate if the designated constraints aren't met. -type AddPackageRspValidationError struct { +// PackagesCreateRspValidationError is the validation error returned by +// PackagesCreateRsp.Validate if the designated constraints aren't met. +type PackagesCreateRspValidationError struct { field string reason string cause error @@ -1824,22 +2256,24 @@ type AddPackageRspValidationError struct { } // Field function returns field value. -func (e AddPackageRspValidationError) Field() string { return e.field } +func (e PackagesCreateRspValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e AddPackageRspValidationError) Reason() string { return e.reason } +func (e PackagesCreateRspValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e AddPackageRspValidationError) Cause() error { return e.cause } +func (e PackagesCreateRspValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e AddPackageRspValidationError) Key() bool { return e.key } +func (e PackagesCreateRspValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e AddPackageRspValidationError) ErrorName() string { return "AddPackageRspValidationError" } +func (e PackagesCreateRspValidationError) ErrorName() string { + return "PackagesCreateRspValidationError" +} // Error satisfies the builtin error interface -func (e AddPackageRspValidationError) Error() string { +func (e PackagesCreateRspValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -1851,14 +2285,14 @@ func (e AddPackageRspValidationError) Error() string { } return fmt.Sprintf( - "invalid %sAddPackageRsp.%s: %s%s", + "invalid %sPackagesCreateRsp.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = AddPackageRspValidationError{} +var _ error = PackagesCreateRspValidationError{} var _ interface { Field() string @@ -1866,24 +2300,24 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = AddPackageRspValidationError{} +} = PackagesCreateRspValidationError{} -// Validate checks the field values on GetModuleReq with the rules defined in +// Validate checks the field values on ModulesListReq with the rules defined in // the proto definition for this message. If any rules are violated, the first // error encountered is returned, or nil if there are no violations. -func (m *GetModuleReq) Validate() error { +func (m *ModulesListReq) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on GetModuleReq with the rules defined +// ValidateAll checks the field values on ModulesListReq with the rules defined // in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GetModuleReqMultiError, or -// nil if none found. -func (m *GetModuleReq) ValidateAll() error { +// result is a list of violation errors wrapped in ModulesListReqMultiError, +// or nil if none found. +func (m *ModulesListReq) ValidateAll() error { return m.validate(true) } -func (m *GetModuleReq) validate(all bool) error { +func (m *ModulesListReq) validate(all bool) error { if m == nil { return nil } @@ -1891,18 +2325,18 @@ func (m *GetModuleReq) validate(all bool) error { var errors []error if len(errors) > 0 { - return GetModuleReqMultiError(errors) + return ModulesListReqMultiError(errors) } - return nil } -// GetModuleReqMultiError is an error wrapping multiple validation errors -// returned by GetModuleReq.ValidateAll() if the designated constraints aren't met. -type GetModuleReqMultiError []error +// ModulesListReqMultiError is an error wrapping multiple validation errors +// returned by ModulesListReq.ValidateAll() if the designated constraints +// aren't met. +type ModulesListReqMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m GetModuleReqMultiError) Error() string { +func (m ModulesListReqMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -1911,11 +2345,11 @@ func (m GetModuleReqMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m GetModuleReqMultiError) AllErrors() []error { return m } +func (m ModulesListReqMultiError) AllErrors() []error { return m } -// GetModuleReqValidationError is the validation error returned by -// GetModuleReq.Validate if the designated constraints aren't met. -type GetModuleReqValidationError struct { +// ModulesListReqValidationError is the validation error returned by +// ModulesListReq.Validate if the designated constraints aren't met. +type ModulesListReqValidationError struct { field string reason string cause error @@ -1923,22 +2357,22 @@ type GetModuleReqValidationError struct { } // Field function returns field value. -func (e GetModuleReqValidationError) Field() string { return e.field } +func (e ModulesListReqValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e GetModuleReqValidationError) Reason() string { return e.reason } +func (e ModulesListReqValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e GetModuleReqValidationError) Cause() error { return e.cause } +func (e ModulesListReqValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e GetModuleReqValidationError) Key() bool { return e.key } +func (e ModulesListReqValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e GetModuleReqValidationError) ErrorName() string { return "GetModuleReqValidationError" } +func (e ModulesListReqValidationError) ErrorName() string { return "ModulesListReqValidationError" } // Error satisfies the builtin error interface -func (e GetModuleReqValidationError) Error() string { +func (e ModulesListReqValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -1950,14 +2384,14 @@ func (e GetModuleReqValidationError) Error() string { } return fmt.Sprintf( - "invalid %sGetModuleReq.%s: %s%s", + "invalid %sModulesListReq.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = GetModuleReqValidationError{} +var _ error = ModulesListReqValidationError{} var _ interface { Field() string @@ -1965,24 +2399,24 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = GetModuleReqValidationError{} +} = ModulesListReqValidationError{} -// Validate checks the field values on GetModuleRsp with the rules defined in +// Validate checks the field values on ModulesListRsp with the rules defined in // the proto definition for this message. If any rules are violated, the first // error encountered is returned, or nil if there are no violations. -func (m *GetModuleRsp) Validate() error { +func (m *ModulesListRsp) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on GetModuleRsp with the rules defined +// ValidateAll checks the field values on ModulesListRsp with the rules defined // in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GetModuleRspMultiError, or -// nil if none found. -func (m *GetModuleRsp) ValidateAll() error { +// result is a list of violation errors wrapped in ModulesListRspMultiError, +// or nil if none found. +func (m *ModulesListRsp) ValidateAll() error { return m.validate(true) } -func (m *GetModuleRsp) validate(all bool) error { +func (m *ModulesListRsp) validate(all bool) error { if m == nil { return nil } @@ -1996,7 +2430,7 @@ func (m *GetModuleRsp) validate(all bool) error { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { - errors = append(errors, GetModuleRspValidationError{ + errors = append(errors, ModulesListRspValidationError{ field: fmt.Sprintf("Modules[%v]", idx), reason: "embedded message failed validation", cause: err, @@ -2004,7 +2438,7 @@ func (m *GetModuleRsp) validate(all bool) error { } case interface{ Validate() error }: if err := v.Validate(); err != nil { - errors = append(errors, GetModuleRspValidationError{ + errors = append(errors, ModulesListRspValidationError{ field: fmt.Sprintf("Modules[%v]", idx), reason: "embedded message failed validation", cause: err, @@ -2013,7 +2447,7 @@ func (m *GetModuleRsp) validate(all bool) error { } } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { - return GetModuleRspValidationError{ + return ModulesListRspValidationError{ field: fmt.Sprintf("Modules[%v]", idx), reason: "embedded message failed validation", cause: err, @@ -2024,18 +2458,18 @@ func (m *GetModuleRsp) validate(all bool) error { } if len(errors) > 0 { - return GetModuleRspMultiError(errors) + return ModulesListRspMultiError(errors) } - return nil } -// GetModuleRspMultiError is an error wrapping multiple validation errors -// returned by GetModuleRsp.ValidateAll() if the designated constraints aren't met. -type GetModuleRspMultiError []error +// ModulesListRspMultiError is an error wrapping multiple validation errors +// returned by ModulesListRsp.ValidateAll() if the designated constraints +// aren't met. +type ModulesListRspMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m GetModuleRspMultiError) Error() string { +func (m ModulesListRspMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -2044,11 +2478,11 @@ func (m GetModuleRspMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m GetModuleRspMultiError) AllErrors() []error { return m } +func (m ModulesListRspMultiError) AllErrors() []error { return m } -// GetModuleRspValidationError is the validation error returned by -// GetModuleRsp.Validate if the designated constraints aren't met. -type GetModuleRspValidationError struct { +// ModulesListRspValidationError is the validation error returned by +// ModulesListRsp.Validate if the designated constraints aren't met. +type ModulesListRspValidationError struct { field string reason string cause error @@ -2056,22 +2490,22 @@ type GetModuleRspValidationError struct { } // Field function returns field value. -func (e GetModuleRspValidationError) Field() string { return e.field } +func (e ModulesListRspValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e GetModuleRspValidationError) Reason() string { return e.reason } +func (e ModulesListRspValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e GetModuleRspValidationError) Cause() error { return e.cause } +func (e ModulesListRspValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e GetModuleRspValidationError) Key() bool { return e.key } +func (e ModulesListRspValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e GetModuleRspValidationError) ErrorName() string { return "GetModuleRspValidationError" } +func (e ModulesListRspValidationError) ErrorName() string { return "ModulesListRspValidationError" } // Error satisfies the builtin error interface -func (e GetModuleRspValidationError) Error() string { +func (e ModulesListRspValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -2083,14 +2517,14 @@ func (e GetModuleRspValidationError) Error() string { } return fmt.Sprintf( - "invalid %sGetModuleRsp.%s: %s%s", + "invalid %sModulesListRsp.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = GetModuleRspValidationError{} +var _ error = ModulesListRspValidationError{} var _ interface { Field() string @@ -2098,86 +2532,45 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = GetModuleRspValidationError{} +} = ModulesListRspValidationError{} -// Validate checks the field values on GetCommentsReq with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GetCommentsReq) Validate() error { +// Validate checks the field values on CommentsListReq with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *CommentsListReq) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on GetCommentsReq with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GetCommentsReqMultiError, -// or nil if none found. -func (m *GetCommentsReq) ValidateAll() error { +// ValidateAll checks the field values on CommentsListReq with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CommentsListReqMultiError, or nil if none found. +func (m *CommentsListReq) ValidateAll() error { return m.validate(true) } -func (m *GetCommentsReq) validate(all bool) error { +func (m *CommentsListReq) validate(all bool) error { if m == nil { return nil } var errors []error - if len(m.GetId()) < 1 { - err := GetCommentsReqValidationError{ - field: "Id", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - _GetCommentsReq_Id_Unique := make(map[uint64]struct{}, len(m.GetId())) - - for idx, item := range m.GetId() { - _, _ = idx, item - - if _, exists := _GetCommentsReq_Id_Unique[item]; exists { - err := GetCommentsReqValidationError{ - field: fmt.Sprintf("Id[%v]", idx), - reason: "repeated value must contain unique items", - } - if !all { - return err - } - errors = append(errors, err) - } else { - _GetCommentsReq_Id_Unique[item] = struct{}{} - } - - if item <= 0 { - err := GetCommentsReqValidationError{ - field: fmt.Sprintf("Id[%v]", idx), - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - - } + // no validation rules for PackageId if len(errors) > 0 { - return GetCommentsReqMultiError(errors) + return CommentsListReqMultiError(errors) } - return nil } -// GetCommentsReqMultiError is an error wrapping multiple validation errors -// returned by GetCommentsReq.ValidateAll() if the designated constraints +// CommentsListReqMultiError is an error wrapping multiple validation errors +// returned by CommentsListReq.ValidateAll() if the designated constraints // aren't met. -type GetCommentsReqMultiError []error +type CommentsListReqMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m GetCommentsReqMultiError) Error() string { +func (m CommentsListReqMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -2186,11 +2579,11 @@ func (m GetCommentsReqMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m GetCommentsReqMultiError) AllErrors() []error { return m } +func (m CommentsListReqMultiError) AllErrors() []error { return m } -// GetCommentsReqValidationError is the validation error returned by -// GetCommentsReq.Validate if the designated constraints aren't met. -type GetCommentsReqValidationError struct { +// CommentsListReqValidationError is the validation error returned by +// CommentsListReq.Validate if the designated constraints aren't met. +type CommentsListReqValidationError struct { field string reason string cause error @@ -2198,22 +2591,22 @@ type GetCommentsReqValidationError struct { } // Field function returns field value. -func (e GetCommentsReqValidationError) Field() string { return e.field } +func (e CommentsListReqValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e GetCommentsReqValidationError) Reason() string { return e.reason } +func (e CommentsListReqValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e GetCommentsReqValidationError) Cause() error { return e.cause } +func (e CommentsListReqValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e GetCommentsReqValidationError) Key() bool { return e.key } +func (e CommentsListReqValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e GetCommentsReqValidationError) ErrorName() string { return "GetCommentsReqValidationError" } +func (e CommentsListReqValidationError) ErrorName() string { return "CommentsListReqValidationError" } // Error satisfies the builtin error interface -func (e GetCommentsReqValidationError) Error() string { +func (e CommentsListReqValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -2225,14 +2618,14 @@ func (e GetCommentsReqValidationError) Error() string { } return fmt.Sprintf( - "invalid %sGetCommentsReq.%s: %s%s", + "invalid %sCommentsListReq.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = GetCommentsReqValidationError{} +var _ error = CommentsListReqValidationError{} var _ interface { Field() string @@ -2240,24 +2633,24 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = GetCommentsReqValidationError{} +} = CommentsListReqValidationError{} -// Validate checks the field values on GetCommentsRsp with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GetCommentsRsp) Validate() error { +// Validate checks the field values on CommentsListRsp with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *CommentsListRsp) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on GetCommentsRsp with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GetCommentsRspMultiError, -// or nil if none found. -func (m *GetCommentsRsp) ValidateAll() error { +// ValidateAll checks the field values on CommentsListRsp with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CommentsListRspMultiError, or nil if none found. +func (m *CommentsListRsp) ValidateAll() error { return m.validate(true) } -func (m *GetCommentsRsp) validate(all bool) error { +func (m *CommentsListRsp) validate(all bool) error { if m == nil { return nil } @@ -2271,7 +2664,7 @@ func (m *GetCommentsRsp) validate(all bool) error { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { - errors = append(errors, GetCommentsRspValidationError{ + errors = append(errors, CommentsListRspValidationError{ field: fmt.Sprintf("Comments[%v]", idx), reason: "embedded message failed validation", cause: err, @@ -2279,7 +2672,7 @@ func (m *GetCommentsRsp) validate(all bool) error { } case interface{ Validate() error }: if err := v.Validate(); err != nil { - errors = append(errors, GetCommentsRspValidationError{ + errors = append(errors, CommentsListRspValidationError{ field: fmt.Sprintf("Comments[%v]", idx), reason: "embedded message failed validation", cause: err, @@ -2288,7 +2681,7 @@ func (m *GetCommentsRsp) validate(all bool) error { } } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { - return GetCommentsRspValidationError{ + return CommentsListRspValidationError{ field: fmt.Sprintf("Comments[%v]", idx), reason: "embedded message failed validation", cause: err, @@ -2299,19 +2692,18 @@ func (m *GetCommentsRsp) validate(all bool) error { } if len(errors) > 0 { - return GetCommentsRspMultiError(errors) + return CommentsListRspMultiError(errors) } - return nil } -// GetCommentsRspMultiError is an error wrapping multiple validation errors -// returned by GetCommentsRsp.ValidateAll() if the designated constraints +// CommentsListRspMultiError is an error wrapping multiple validation errors +// returned by CommentsListRsp.ValidateAll() if the designated constraints // aren't met. -type GetCommentsRspMultiError []error +type CommentsListRspMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m GetCommentsRspMultiError) Error() string { +func (m CommentsListRspMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -2320,11 +2712,11 @@ func (m GetCommentsRspMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m GetCommentsRspMultiError) AllErrors() []error { return m } +func (m CommentsListRspMultiError) AllErrors() []error { return m } -// GetCommentsRspValidationError is the validation error returned by -// GetCommentsRsp.Validate if the designated constraints aren't met. -type GetCommentsRspValidationError struct { +// CommentsListRspValidationError is the validation error returned by +// CommentsListRsp.Validate if the designated constraints aren't met. +type CommentsListRspValidationError struct { field string reason string cause error @@ -2332,22 +2724,22 @@ type GetCommentsRspValidationError struct { } // Field function returns field value. -func (e GetCommentsRspValidationError) Field() string { return e.field } +func (e CommentsListRspValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e GetCommentsRspValidationError) Reason() string { return e.reason } +func (e CommentsListRspValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e GetCommentsRspValidationError) Cause() error { return e.cause } +func (e CommentsListRspValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e GetCommentsRspValidationError) Key() bool { return e.key } +func (e CommentsListRspValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e GetCommentsRspValidationError) ErrorName() string { return "GetCommentsRspValidationError" } +func (e CommentsListRspValidationError) ErrorName() string { return "CommentsListRspValidationError" } // Error satisfies the builtin error interface -func (e GetCommentsRspValidationError) Error() string { +func (e CommentsListRspValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -2359,14 +2751,14 @@ func (e GetCommentsRspValidationError) Error() string { } return fmt.Sprintf( - "invalid %sGetCommentsRsp.%s: %s%s", + "invalid %sCommentsListRsp.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = GetCommentsRspValidationError{} +var _ error = CommentsListRspValidationError{} var _ interface { Field() string @@ -2374,4 +2766,239 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = GetCommentsRspValidationError{} +} = CommentsListRspValidationError{} + +// Validate checks the field values on CommentsLookupReq with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *CommentsLookupReq) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CommentsLookupReq with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CommentsLookupReqMultiError, or nil if none found. +func (m *CommentsLookupReq) ValidateAll() error { + return m.validate(true) +} + +func (m *CommentsLookupReq) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + // no validation rules for PackageId + + if len(errors) > 0 { + return CommentsLookupReqMultiError(errors) + } + return nil +} + +// CommentsLookupReqMultiError is an error wrapping multiple validation errors +// returned by CommentsLookupReq.ValidateAll() if the designated constraints +// aren't met. +type CommentsLookupReqMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CommentsLookupReqMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CommentsLookupReqMultiError) AllErrors() []error { return m } + +// CommentsLookupReqValidationError is the validation error returned by +// CommentsLookupReq.Validate if the designated constraints aren't met. +type CommentsLookupReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CommentsLookupReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CommentsLookupReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CommentsLookupReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CommentsLookupReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CommentsLookupReqValidationError) ErrorName() string { + return "CommentsLookupReqValidationError" +} + +// Error satisfies the builtin error interface +func (e CommentsLookupReqValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCommentsLookupReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CommentsLookupReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CommentsLookupReqValidationError{} + +// Validate checks the field values on CommentsLookupRsp with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *CommentsLookupRsp) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CommentsLookupRsp with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CommentsLookupRspMultiError, or nil if none found. +func (m *CommentsLookupRsp) ValidateAll() error { + return m.validate(true) +} + +func (m *CommentsLookupRsp) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetComment()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CommentsLookupRspValidationError{ + field: "Comment", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CommentsLookupRspValidationError{ + field: "Comment", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetComment()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CommentsLookupRspValidationError{ + field: "Comment", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return CommentsLookupRspMultiError(errors) + } + return nil +} + +// CommentsLookupRspMultiError is an error wrapping multiple validation errors +// returned by CommentsLookupRsp.ValidateAll() if the designated constraints +// aren't met. +type CommentsLookupRspMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CommentsLookupRspMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CommentsLookupRspMultiError) AllErrors() []error { return m } + +// CommentsLookupRspValidationError is the validation error returned by +// CommentsLookupRsp.Validate if the designated constraints aren't met. +type CommentsLookupRspValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CommentsLookupRspValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CommentsLookupRspValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CommentsLookupRspValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CommentsLookupRspValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CommentsLookupRspValidationError) ErrorName() string { + return "CommentsLookupRspValidationError" +} + +// Error satisfies the builtin error interface +func (e CommentsLookupRspValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCommentsLookupRsp.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CommentsLookupRspValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CommentsLookupRspValidationError{} diff --git a/proto/pkgdash.proto b/proto/pkgdash.proto index a38d012..ea2148e 100644 --- a/proto/pkgdash.proto +++ b/proto/pkgdash.proto @@ -2,17 +2,17 @@ syntax = "proto3"; package pkgdash; -option go_package = "go.unistack.org/unistack-org/pkgdash/proto;pkgdashpb"; - import "api/annotations.proto"; import "openapiv3/annotations.proto"; import "validate/validate.proto"; -import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "go.unistack.org/unistack-org/pkgdash/proto;pkgdashpb"; service PkgdashService { - rpc ListPackage(google.protobuf.Empty) returns (ListPackageRsp) { + rpc PackagesCreate(PackagesCreateReq) returns (PackagesCreateRsp) { option (micro.openapiv3.openapiv3_operation) = { - operation_id: "ListPackage"; + operation_id: "PackagesCreate"; responses: { default: { reference: {_ref: ".pkgdash.ErrorRsp"}; @@ -20,84 +20,113 @@ service PkgdashService { }; }; option (micro.api.http) = { - get: "/v1/packages"; - }; - }; - rpc UpdatePackage(UpdatePackageReq) returns (UpdatePackageRsp) { - option (micro.openapiv3.openapiv3_operation) = { - operation_id: "UpdateInfo"; - responses: { - default: { - reference: {_ref: ".pkgdash.ErrorRsp"}; - }; - }; - }; - option (micro.api.http) = { - post: "/v1/package/{id}"; + post: "/v1/packages"; body: "*"; }; - }; - rpc AddComment(AddCommentReq) returns (AddCommentRsp) { - option (micro.openapiv3.openapiv3_operation) = { - operation_id: "AddComment"; - responses: { - default: { - reference: {_ref: ".pkgdash.ErrorRsp"}; - }; - }; - }; - option (micro.api.http) = { - post: "/v1/package/{pkg}/comment"; - body: "*"; - }; - }; - rpc AddPackage(AddPackageReq) returns (AddPackageRsp) { - option (micro.openapiv3.openapiv3_operation) = { - operation_id: "AddPackage"; - responses: { - default: { - reference: {_ref: ".pkgdash.ErrorRsp"}; - }; - }; - }; - option (micro.api.http) = { - post: "/v1/package"; - body: "*"; - }; - }; - rpc GetModule(GetModuleReq) returns (GetModuleRsp) { - option (micro.openapiv3.openapiv3_operation) = { - operation_id: "GetModule"; - responses: { - default: { - reference: {_ref: ".pkgdash.ErrorRsp"}; - }; - }; - }; - option (micro.api.http) = { - get: "/v1/module"; - }; - }; - rpc GetComments(GetCommentsReq) returns (GetCommentsRsp) { - option (micro.openapiv3.openapiv3_operation) = { - operation_id: "GetComments"; - responses: { - default: { - reference: {_ref: ".pkgdash.ErrorRsp"}; - }; - }; - }; - option (micro.api.http) = { - get: "/v1/comment"; - }; } -}; - -message ErrorRsp { - Error error = 1 [json_name = "error"]; + rpc PackagesDelete(PackagesDeleteReq) returns (PackagesDeleteRsp) { + option (micro.openapiv3.openapiv3_operation) = { + operation_id: "PackagesDelete"; + responses: { + default: { + reference: {_ref: ".pkgdash.ErrorRsp"}; + }; + }; + }; + option (micro.api.http) = {delete: "/v1/packages/{id}"}; + } + rpc PackagesList(PackagesListReq) returns (PackagesListRsp) { + option (micro.openapiv3.openapiv3_operation) = { + operation_id: "PackagesList"; + responses: { + default: { + reference: {_ref: ".pkgdash.ErrorRsp"}; + }; + }; + }; + option (micro.api.http) = {get: "/v1/packages"}; + } + rpc PackagesUpdate(PackagesUpdateReq) returns (PackagesUpdateRsp) { + option (micro.openapiv3.openapiv3_operation) = { + operation_id: "PackagesUpdate"; + responses: { + default: { + reference: {_ref: ".pkgdash.ErrorRsp"}; + }; + }; + }; + option (micro.api.http) = { + put: "/v1/packages/{id}"; + body: "*"; + }; + } + rpc CommentsCreate(CommentsCreateReq) returns (CommentsCreateRsp) { + option (micro.openapiv3.openapiv3_operation) = { + operation_id: "CommentsCreate"; + responses: { + default: { + reference: {_ref: ".pkgdash.ErrorRsp"}; + }; + }; + }; + option (micro.api.http) = { + post: "/v1/packages/{package_id}/comments"; + body: "*"; + }; + } + rpc CommentsLookup(CommentsLookupReq) returns (CommentsLookupRsp) { + option (micro.openapiv3.openapiv3_operation) = { + operation_id: "CommentsLookup"; + responses: { + default: { + reference: {_ref: ".pkgdash.ErrorRsp"}; + }; + }; + }; + option (micro.api.http) = { + get: "/v1/comments/{id}/comments"; + additional_bindings {get: "/v1/comments/{package_id}/comments/{id}"}; + }; + } + rpc CommentsList(CommentsListReq) returns (CommentsListRsp) { + option (micro.openapiv3.openapiv3_operation) = { + operation_id: "CommentsList"; + responses: { + default: { + reference: {_ref: ".pkgdash.ErrorRsp"}; + }; + }; + }; + option (micro.api.http) = {get: "/v1/packages/{package_id}/comments"}; + } + rpc CommentsDelete(CommentsDeleteReq) returns (CommentsDeleteRsp) { + option (micro.openapiv3.openapiv3_operation) = { + operation_id: "CommentsDelete"; + responses: { + default: { + reference: {_ref: ".pkgdash.ErrorRsp"}; + }; + }; + }; + option (micro.api.http) = { + delete: "/v1/packages/{package_id}/comments/{id}"; + additional_bindings {delete: "/v1/comments/{id}"}; + }; + } + rpc ModulesList(ModulesListReq) returns (ModulesListRsp) { + option (micro.openapiv3.openapiv3_operation) = { + operation_id: "ModulesList"; + responses: { + default: { + reference: {_ref: ".pkgdash.ErrorRsp"}; + }; + }; + }; + option (micro.api.http) = {get: "/v1/modules"}; + } } -message Error { +message ErrorRsp { string code = 1 [json_name = "code"]; string title = 2 [json_name = "title"]; string uuid = 3 [json_name = "uuid"]; @@ -111,7 +140,9 @@ message Package { repeated uint64 modules = 4; repeated uint64 issues = 5; repeated uint64 comments = 6; -}; + google.protobuf.Timestamp created = 7; + google.protobuf.Timestamp updated = 8; +} message Module { uint64 id = 1 [(validate.rules).uint64.gt = 0]; @@ -119,6 +150,8 @@ message Module { string version = 3 [(validate.rules).string.min_len = 1]; uint64 package = 4 [(validate.rules).uint64.gt = 0]; string last_version = 5 [(validate.rules).string.min_len = 1]; + google.protobuf.Timestamp created = 6; + google.protobuf.Timestamp updated = 7; } message Issue { @@ -127,75 +160,90 @@ message Issue { string desc = 3 [(validate.rules).string.min_len = 1]; uint64 package = 4 [(validate.rules).uint64.gt = 0]; repeated uint64 modules = 5; + google.protobuf.Timestamp created = 6; + google.protobuf.Timestamp updated = 7; } message Comment { uint64 id = 1 [(validate.rules).uint64.gt = 0]; uint64 package = 2 [(validate.rules).uint64.gt = 0]; string text = 3; - string created = 4 ; - string updated = 5 ; + google.protobuf.Timestamp created = 4; + google.protobuf.Timestamp updated = 5; } -message ListPackageReq {} -message ListPackageRsp{ +message CommentsDeleteReq { + uint64 id = 1 [json_name = "id"]; + uint64 package_id = 2 [json_name = "package_id"]; +} + +message CommentsDeleteRsp {} + +message PackagesDeleteReq { + uint64 id = 1 [json_name = "id"]; +} + +message PackagesDeleteRsp {} + +message PackagesListReq {} + +message PackagesListRsp { repeated Package packages = 1; } -message UpdatePackageReq { +message PackagesUpdateReq { uint64 id = 1 [(validate.rules).uint64.gt = 0]; string name = 2 [(validate.rules).string.min_len = 1]; string url = 3 [(validate.rules).string.min_len = 1]; - repeated uint64 modules = 4 ; - repeated uint64 issues = 5 ; -} -message UpdatePackageRsp { - uint64 id = 1 [(validate.rules).uint64.gt = 0]; + repeated uint64 modules = 4; + repeated uint64 issues = 5; } -message CommentReq { - uint64 pkg = 1 [(validate.rules).uint64.gt = 0]; +message PackagesUpdateRsp { + Package package = 1 [json_name = "package"]; +} + +message CommentsCreateReq { + uint64 package_id = 1 [ + json_name = "package_id", + (validate.rules).uint64.gt = 0 + ]; string text = 2; } -message AddCommentReq { - uint64 idPackage = 1 [(validate.rules).uint64.gt = 0]; - string text = 2; +message CommentsCreateRsp { + Comment comment = 1 [json_name = "comment"]; } -message AddCommentRsp { - uint64 id = 1 [(validate.rules).uint64.gt = 0]; -} - -message AddPackageReq { +message PackagesCreateReq { string name = 1 [(validate.rules).string.min_len = 1]; - string url = 2 [(validate.rules).string.min_len = 1]; + string url = 2 [(validate.rules).string.min_len = 1]; repeated uint64 modules = 3; } -message AddPackageRsp{ +message PackagesCreateRsp { string status = 1 [(validate.rules).string.min_len = 1]; } -message GetModuleReq { - repeated uint64 id = 1 ; -} -message GetModuleRsp { - repeated Module modules = 1 ; +message ModulesListReq {} + +message ModulesListRsp { + repeated Module modules = 1; } -message GetCommentsReq { - repeated uint64 id = 1 [(validate.rules).repeated = { - unique: true - min_items: 1 - items: { - uint64: { - gt: 0 - } - } - }] ; +message CommentsListReq { + uint64 package_id = 1 [json_name = "package_id"]; } -message GetCommentsRsp { - repeated Comment comments = 1; -} \ No newline at end of file +message CommentsListRsp { + repeated Comment comments = 1 [json_name = "comments"]; +} + +message CommentsLookupReq { + uint64 id = 1 [json_name = "id"]; + uint64 package_id = 2 [json_name = "package_id"]; +} + +message CommentsLookupRsp { + Comment comment = 1 [json_name = "comment"]; +} diff --git a/proto/pkgdash_micro.pb.go b/proto/pkgdash_micro.pb.go index 2ac1918..4dc5a08 100644 --- a/proto/pkgdash_micro.pb.go +++ b/proto/pkgdash_micro.pb.go @@ -10,7 +10,6 @@ import ( context "context" _ "go.unistack.org/micro/v4/client" options "go.unistack.org/micro/v4/options" - emptypb "google.golang.org/protobuf/types/known/emptypb" ) var ( @@ -18,19 +17,25 @@ var ( ) type PkgdashServiceClient interface { - ListPackage(ctx context.Context, req *emptypb.Empty, opts ...options.Option) (*ListPackageRsp, error) - UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...options.Option) (*UpdatePackageRsp, error) - AddComment(ctx context.Context, req *AddCommentReq, opts ...options.Option) (*AddCommentRsp, error) - AddPackage(ctx context.Context, req *AddPackageReq, opts ...options.Option) (*AddPackageRsp, error) - GetModule(ctx context.Context, req *GetModuleReq, opts ...options.Option) (*GetModuleRsp, error) - GetComments(ctx context.Context, req *GetCommentsReq, opts ...options.Option) (*GetCommentsRsp, error) + PackagesCreate(ctx context.Context, req *PackagesCreateReq, opts ...options.Option) (*PackagesCreateRsp, error) + PackagesDelete(ctx context.Context, req *PackagesDeleteReq, opts ...options.Option) (*PackagesDeleteRsp, error) + PackagesList(ctx context.Context, req *PackagesListReq, opts ...options.Option) (*PackagesListRsp, error) + PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, opts ...options.Option) (*PackagesUpdateRsp, error) + CommentsCreate(ctx context.Context, req *CommentsCreateReq, opts ...options.Option) (*CommentsCreateRsp, error) + CommentsLookup(ctx context.Context, req *CommentsLookupReq, opts ...options.Option) (*CommentsLookupRsp, error) + CommentsList(ctx context.Context, req *CommentsListReq, opts ...options.Option) (*CommentsListRsp, error) + CommentsDelete(ctx context.Context, req *CommentsDeleteReq, opts ...options.Option) (*CommentsDeleteRsp, error) + ModulesList(ctx context.Context, req *ModulesListReq, opts ...options.Option) (*ModulesListRsp, error) } type PkgdashServiceServer interface { - ListPackage(ctx context.Context, req *emptypb.Empty, rsp *ListPackageRsp) error - UpdatePackage(ctx context.Context, req *UpdatePackageReq, rsp *UpdatePackageRsp) error - AddComment(ctx context.Context, req *AddCommentReq, rsp *AddCommentRsp) error - AddPackage(ctx context.Context, req *AddPackageReq, rsp *AddPackageRsp) error - GetModule(ctx context.Context, req *GetModuleReq, rsp *GetModuleRsp) error - GetComments(ctx context.Context, req *GetCommentsReq, rsp *GetCommentsRsp) error + PackagesCreate(ctx context.Context, req *PackagesCreateReq, rsp *PackagesCreateRsp) error + PackagesDelete(ctx context.Context, req *PackagesDeleteReq, rsp *PackagesDeleteRsp) error + PackagesList(ctx context.Context, req *PackagesListReq, rsp *PackagesListRsp) error + PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, rsp *PackagesUpdateRsp) error + CommentsCreate(ctx context.Context, req *CommentsCreateReq, rsp *CommentsCreateRsp) error + CommentsLookup(ctx context.Context, req *CommentsLookupReq, rsp *CommentsLookupRsp) error + CommentsList(ctx context.Context, req *CommentsListReq, rsp *CommentsListRsp) error + CommentsDelete(ctx context.Context, req *CommentsDeleteReq, rsp *CommentsDeleteRsp) error + ModulesList(ctx context.Context, req *ModulesListReq, rsp *ModulesListRsp) error } diff --git a/proto/pkgdash_micro_http.pb.go b/proto/pkgdash_micro_http.pb.go index 1aec5dd..90f599c 100644 --- a/proto/pkgdash_micro_http.pb.go +++ b/proto/pkgdash_micro_http.pb.go @@ -11,50 +11,84 @@ import ( client "go.unistack.org/micro/v4/client" options "go.unistack.org/micro/v4/options" server "go.unistack.org/micro/v4/server" - emptypb "google.golang.org/protobuf/types/known/emptypb" http "net/http" ) var ( PkgdashServiceServerEndpoints = []v4.EndpointMetadata{ { - Name: "PkgdashService.ListPackage", + Name: "PkgdashService.PackagesCreate", + Path: "/v1/packages", + Method: "POST", + Body: "*", + Stream: false, + }, + { + Name: "PkgdashService.PackagesDelete", + Path: "/v1/packages/{id}", + Method: "DELETE", + Body: "", + Stream: false, + }, + { + Name: "PkgdashService.PackagesList", Path: "/v1/packages", Method: "GET", Body: "", Stream: false, }, { - Name: "PkgdashService.UpdatePackage", - Path: "/v1/package/{id}", + Name: "PkgdashService.PackagesUpdate", + Path: "/v1/packages/{id}", + Method: "PUT", + Body: "*", + Stream: false, + }, + { + Name: "PkgdashService.CommentsCreate", + Path: "/v1/packages/{package_id}/comments", Method: "POST", Body: "*", Stream: false, }, { - Name: "PkgdashService.AddComment", - Path: "/v1/package/{pkg}/comment", - Method: "POST", - Body: "*", - Stream: false, - }, - { - Name: "PkgdashService.AddPackage", - Path: "/v1/package", - Method: "POST", - Body: "*", - Stream: false, - }, - { - Name: "PkgdashService.GetModule", - Path: "/v1/module", + Name: "PkgdashService.CommentsLookup", + Path: "/v1/comments/{id}/comments", Method: "GET", Body: "", Stream: false, }, { - Name: "PkgdashService.GetComments", - Path: "/v1/comment", + Name: "PkgdashService.CommentsLookup", + Path: "/v1/comments/{package_id}/comments/{id}", + Method: "GET", + Body: "", + Stream: false, + }, + { + Name: "PkgdashService.CommentsList", + Path: "/v1/packages/{package_id}/comments", + Method: "GET", + Body: "", + Stream: false, + }, + { + Name: "PkgdashService.CommentsDelete", + Path: "/v1/packages/{package_id}/comments/{id}", + Method: "DELETE", + Body: "", + Stream: false, + }, + { + Name: "PkgdashService.CommentsDelete", + Path: "/v1/comments/{id}", + Method: "DELETE", + Body: "", + Stream: false, + }, + { + Name: "PkgdashService.ModulesList", + Path: "/v1/modules", Method: "GET", Body: "", Stream: false, @@ -71,7 +105,44 @@ func NewPkgdashServiceClient(name string, c client.Client) PkgdashServiceClient return &pkgdashServiceClient{c: c, name: name} } -func (c *pkgdashServiceClient) ListPackage(ctx context.Context, req *emptypb.Empty, opts ...options.Option) (*ListPackageRsp, error) { +func (c *pkgdashServiceClient) PackagesCreate(ctx context.Context, req *PackagesCreateReq, opts ...options.Option) (*PackagesCreateRsp, error) { + errmap := make(map[string]interface{}, 1) + errmap["default"] = &ErrorRsp{} + opts = append(opts, + v41.ErrorMap(errmap), + ) + opts = append(opts, + v41.Method(http.MethodPost), + v41.Path("/v1/packages"), + v41.Body("*"), + ) + rsp := &PackagesCreateRsp{} + err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.PackagesCreate", req), rsp, opts...) + if err != nil { + return nil, err + } + return rsp, nil +} + +func (c *pkgdashServiceClient) PackagesDelete(ctx context.Context, req *PackagesDeleteReq, opts ...options.Option) (*PackagesDeleteRsp, error) { + errmap := make(map[string]interface{}, 1) + errmap["default"] = &ErrorRsp{} + opts = append(opts, + v41.ErrorMap(errmap), + ) + opts = append(opts, + v41.Method(http.MethodDelete), + v41.Path("/v1/packages/{id}"), + ) + rsp := &PackagesDeleteRsp{} + err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.PackagesDelete", req), rsp, opts...) + if err != nil { + return nil, err + } + return rsp, nil +} + +func (c *pkgdashServiceClient) PackagesList(ctx context.Context, req *PackagesListReq, opts ...options.Option) (*PackagesListRsp, error) { errmap := make(map[string]interface{}, 1) errmap["default"] = &ErrorRsp{} opts = append(opts, @@ -81,15 +152,34 @@ func (c *pkgdashServiceClient) ListPackage(ctx context.Context, req *emptypb.Emp v41.Method(http.MethodGet), v41.Path("/v1/packages"), ) - rsp := &ListPackageRsp{} - err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.ListPackage", req), rsp, opts...) + rsp := &PackagesListRsp{} + err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.PackagesList", req), rsp, opts...) if err != nil { return nil, err } return rsp, nil } -func (c *pkgdashServiceClient) UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...options.Option) (*UpdatePackageRsp, error) { +func (c *pkgdashServiceClient) PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, opts ...options.Option) (*PackagesUpdateRsp, error) { + errmap := make(map[string]interface{}, 1) + errmap["default"] = &ErrorRsp{} + opts = append(opts, + v41.ErrorMap(errmap), + ) + opts = append(opts, + v41.Method(http.MethodPut), + v41.Path("/v1/packages/{id}"), + v41.Body("*"), + ) + rsp := &PackagesUpdateRsp{} + err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.PackagesUpdate", req), rsp, opts...) + if err != nil { + return nil, err + } + return rsp, nil +} + +func (c *pkgdashServiceClient) CommentsCreate(ctx context.Context, req *CommentsCreateReq, opts ...options.Option) (*CommentsCreateRsp, error) { errmap := make(map[string]interface{}, 1) errmap["default"] = &ErrorRsp{} opts = append(opts, @@ -97,56 +187,18 @@ func (c *pkgdashServiceClient) UpdatePackage(ctx context.Context, req *UpdatePac ) opts = append(opts, v41.Method(http.MethodPost), - v41.Path("/v1/package/{id}"), + v41.Path("/v1/packages/{package_id}/comments"), v41.Body("*"), ) - rsp := &UpdatePackageRsp{} - err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.UpdatePackage", req), rsp, opts...) + rsp := &CommentsCreateRsp{} + err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.CommentsCreate", req), rsp, opts...) if err != nil { return nil, err } return rsp, nil } -func (c *pkgdashServiceClient) AddComment(ctx context.Context, req *AddCommentReq, opts ...options.Option) (*AddCommentRsp, error) { - errmap := make(map[string]interface{}, 1) - errmap["default"] = &ErrorRsp{} - opts = append(opts, - v41.ErrorMap(errmap), - ) - opts = append(opts, - v41.Method(http.MethodPost), - v41.Path("/v1/package/{pkg}/comment"), - v41.Body("*"), - ) - rsp := &AddCommentRsp{} - err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.AddComment", req), rsp, opts...) - if err != nil { - return nil, err - } - return rsp, nil -} - -func (c *pkgdashServiceClient) AddPackage(ctx context.Context, req *AddPackageReq, opts ...options.Option) (*AddPackageRsp, error) { - errmap := make(map[string]interface{}, 1) - errmap["default"] = &ErrorRsp{} - opts = append(opts, - v41.ErrorMap(errmap), - ) - opts = append(opts, - v41.Method(http.MethodPost), - v41.Path("/v1/package"), - v41.Body("*"), - ) - rsp := &AddPackageRsp{} - err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.AddPackage", req), rsp, opts...) - if err != nil { - return nil, err - } - return rsp, nil -} - -func (c *pkgdashServiceClient) GetModule(ctx context.Context, req *GetModuleReq, opts ...options.Option) (*GetModuleRsp, error) { +func (c *pkgdashServiceClient) CommentsLookup(ctx context.Context, req *CommentsLookupReq, opts ...options.Option) (*CommentsLookupRsp, error) { errmap := make(map[string]interface{}, 1) errmap["default"] = &ErrorRsp{} opts = append(opts, @@ -154,17 +206,17 @@ func (c *pkgdashServiceClient) GetModule(ctx context.Context, req *GetModuleReq, ) opts = append(opts, v41.Method(http.MethodGet), - v41.Path("/v1/module"), + v41.Path("/v1/comments/{id}/comments"), ) - rsp := &GetModuleRsp{} - err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.GetModule", req), rsp, opts...) + rsp := &CommentsLookupRsp{} + err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.CommentsLookup", req), rsp, opts...) if err != nil { return nil, err } return rsp, nil } -func (c *pkgdashServiceClient) GetComments(ctx context.Context, req *GetCommentsReq, opts ...options.Option) (*GetCommentsRsp, error) { +func (c *pkgdashServiceClient) CommentsList(ctx context.Context, req *CommentsListReq, opts ...options.Option) (*CommentsListRsp, error) { errmap := make(map[string]interface{}, 1) errmap["default"] = &ErrorRsp{} opts = append(opts, @@ -172,10 +224,46 @@ func (c *pkgdashServiceClient) GetComments(ctx context.Context, req *GetComments ) opts = append(opts, v41.Method(http.MethodGet), - v41.Path("/v1/comment"), + v41.Path("/v1/packages/{package_id}/comments"), ) - rsp := &GetCommentsRsp{} - err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.GetComments", req), rsp, opts...) + rsp := &CommentsListRsp{} + err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.CommentsList", req), rsp, opts...) + if err != nil { + return nil, err + } + return rsp, nil +} + +func (c *pkgdashServiceClient) CommentsDelete(ctx context.Context, req *CommentsDeleteReq, opts ...options.Option) (*CommentsDeleteRsp, error) { + errmap := make(map[string]interface{}, 1) + errmap["default"] = &ErrorRsp{} + opts = append(opts, + v41.ErrorMap(errmap), + ) + opts = append(opts, + v41.Method(http.MethodDelete), + v41.Path("/v1/packages/{package_id}/comments/{id}"), + ) + rsp := &CommentsDeleteRsp{} + err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.CommentsDelete", req), rsp, opts...) + if err != nil { + return nil, err + } + return rsp, nil +} + +func (c *pkgdashServiceClient) ModulesList(ctx context.Context, req *ModulesListReq, opts ...options.Option) (*ModulesListRsp, error) { + errmap := make(map[string]interface{}, 1) + errmap["default"] = &ErrorRsp{} + opts = append(opts, + v41.ErrorMap(errmap), + ) + opts = append(opts, + v41.Method(http.MethodGet), + v41.Path("/v1/modules"), + ) + rsp := &ModulesListRsp{} + err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.ModulesList", req), rsp, opts...) if err != nil { return nil, err } @@ -186,38 +274,53 @@ type pkgdashServiceServer struct { PkgdashServiceServer } -func (h *pkgdashServiceServer) ListPackage(ctx context.Context, req *emptypb.Empty, rsp *ListPackageRsp) error { - return h.PkgdashServiceServer.ListPackage(ctx, req, rsp) +func (h *pkgdashServiceServer) PackagesCreate(ctx context.Context, req *PackagesCreateReq, rsp *PackagesCreateRsp) error { + return h.PkgdashServiceServer.PackagesCreate(ctx, req, rsp) } -func (h *pkgdashServiceServer) UpdatePackage(ctx context.Context, req *UpdatePackageReq, rsp *UpdatePackageRsp) error { - return h.PkgdashServiceServer.UpdatePackage(ctx, req, rsp) +func (h *pkgdashServiceServer) PackagesDelete(ctx context.Context, req *PackagesDeleteReq, rsp *PackagesDeleteRsp) error { + return h.PkgdashServiceServer.PackagesDelete(ctx, req, rsp) } -func (h *pkgdashServiceServer) AddComment(ctx context.Context, req *AddCommentReq, rsp *AddCommentRsp) error { - return h.PkgdashServiceServer.AddComment(ctx, req, rsp) +func (h *pkgdashServiceServer) PackagesList(ctx context.Context, req *PackagesListReq, rsp *PackagesListRsp) error { + return h.PkgdashServiceServer.PackagesList(ctx, req, rsp) } -func (h *pkgdashServiceServer) AddPackage(ctx context.Context, req *AddPackageReq, rsp *AddPackageRsp) error { - return h.PkgdashServiceServer.AddPackage(ctx, req, rsp) +func (h *pkgdashServiceServer) PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, rsp *PackagesUpdateRsp) error { + return h.PkgdashServiceServer.PackagesUpdate(ctx, req, rsp) } -func (h *pkgdashServiceServer) GetModule(ctx context.Context, req *GetModuleReq, rsp *GetModuleRsp) error { - return h.PkgdashServiceServer.GetModule(ctx, req, rsp) +func (h *pkgdashServiceServer) CommentsCreate(ctx context.Context, req *CommentsCreateReq, rsp *CommentsCreateRsp) error { + return h.PkgdashServiceServer.CommentsCreate(ctx, req, rsp) } -func (h *pkgdashServiceServer) GetComments(ctx context.Context, req *GetCommentsReq, rsp *GetCommentsRsp) error { - return h.PkgdashServiceServer.GetComments(ctx, req, rsp) +func (h *pkgdashServiceServer) CommentsLookup(ctx context.Context, req *CommentsLookupReq, rsp *CommentsLookupRsp) error { + return h.PkgdashServiceServer.CommentsLookup(ctx, req, rsp) +} + +func (h *pkgdashServiceServer) CommentsList(ctx context.Context, req *CommentsListReq, rsp *CommentsListRsp) error { + return h.PkgdashServiceServer.CommentsList(ctx, req, rsp) +} + +func (h *pkgdashServiceServer) CommentsDelete(ctx context.Context, req *CommentsDeleteReq, rsp *CommentsDeleteRsp) error { + return h.PkgdashServiceServer.CommentsDelete(ctx, req, rsp) +} + +func (h *pkgdashServiceServer) ModulesList(ctx context.Context, req *ModulesListReq, rsp *ModulesListRsp) error { + return h.PkgdashServiceServer.ModulesList(ctx, req, rsp) } func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts ...options.Option) error { type pkgdashService interface { - ListPackage(ctx context.Context, req *emptypb.Empty, rsp *ListPackageRsp) error - UpdatePackage(ctx context.Context, req *UpdatePackageReq, rsp *UpdatePackageRsp) error - AddComment(ctx context.Context, req *AddCommentReq, rsp *AddCommentRsp) error - AddPackage(ctx context.Context, req *AddPackageReq, rsp *AddPackageRsp) error - GetModule(ctx context.Context, req *GetModuleReq, rsp *GetModuleRsp) error - GetComments(ctx context.Context, req *GetCommentsReq, rsp *GetCommentsRsp) error + PackagesCreate(ctx context.Context, req *PackagesCreateReq, rsp *PackagesCreateRsp) error + PackagesDelete(ctx context.Context, req *PackagesDeleteReq, rsp *PackagesDeleteRsp) error + PackagesList(ctx context.Context, req *PackagesListReq, rsp *PackagesListRsp) error + PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, rsp *PackagesUpdateRsp) error + CommentsCreate(ctx context.Context, req *CommentsCreateReq, rsp *CommentsCreateRsp) error + CommentsLookup(ctx context.Context, req *CommentsLookupReq, rsp *CommentsLookupRsp) error + CommentsList(ctx context.Context, req *CommentsListReq, rsp *CommentsListRsp) error + CommentsDelete(ctx context.Context, req *CommentsDeleteReq, rsp *CommentsDeleteRsp) error + ModulesList(ctx context.Context, req *ModulesListReq, rsp *ModulesListRsp) error } type PkgdashService struct { pkgdashService diff --git a/storage/storage.go b/storage/storage.go deleted file mode 100644 index 5f165bd..0000000 --- a/storage/storage.go +++ /dev/null @@ -1,71 +0,0 @@ -package storage - -import ( - "context" - "database/sql" - "embed" - "errors" - - "go.unistack.org/unistack-org/pkgdash/models" - pb "go.unistack.org/unistack-org/pkgdash/proto" - "go.unistack.org/unistack-org/pkgdash/storage/postgres" - "go.unistack.org/unistack-org/pkgdash/storage/sqlite" -) - -//go:embed migrations -var fs embed.FS - -var ( - storages = map[string]func(*sql.DB, embed.FS) interface{}{ - "postgres": postgres.NewStorage(), - "sqlite": sqlite.NewStorage(), - } -) - -type contextKey string - -var ( - storeIdent = contextKey("store") -) - -type Migrate interface { - MigrateUp() error - MigrateDown() error -} - -type Storage interface { - Migrate - - ListPackage(ctx context.Context) (models.ListPackage, error) - UpdatePackage(ctx context.Context, req *pb.UpdatePackageReq) error - AddComment(ctx context.Context, req *pb.AddCommentReq) (uint64, error) - AddPackage(ctx context.Context, req *pb.AddPackageReq) error - InsertButchModules(ctx context.Context, req []models.Module) ([]uint64, error) - GetModule(ctx context.Context, req *pb.GetModuleReq) (models.ListModule, error) - GetComment(ctx context.Context, req *pb.GetCommentsReq) (models.ListComment, error) -} - -func NewStorage(name string, db *sql.DB) (Storage, error) { - function, ok := storages[name] - if !ok { - return nil, errors.New("incorrect name store") - } - store := function(db, fs) - database, ok := store.(Storage) - if !ok { - return nil, errors.New("dont implements interface Storage") - } - return database, nil -} - -func InContext(ctx context.Context, val Storage) context.Context { - return context.WithValue(ctx, storeIdent, val) -} - -func FromContext(ctx context.Context) (Storage, error) { - if store, ok := ctx.Value(storeIdent).(Storage); !ok { - return nil, errors.New("empty store") - } else { - return store, nil - } -} diff --git a/ui/src/app/api/models.ts b/ui/src/app/api/models.ts index 8ba8ba5..2e0c5b9 100644 --- a/ui/src/app/api/models.ts +++ b/ui/src/app/api/models.ts @@ -1,16 +1,18 @@ /* tslint:disable */ /* eslint-disable */ -export { AddCommentReq } from './models/add-comment-req'; -export { AddCommentRsp } from './models/add-comment-rsp'; -export { AddPackageReq } from './models/add-package-req'; -export { AddPackageRsp } from './models/add-package-rsp'; export { Comment } from './models/comment'; -export { Error } from './models/error'; +export { CommentsCreateReq } from './models/comments-create-req'; +export { CommentsCreateRsp } from './models/comments-create-rsp'; +export { CommentsDeleteRsp } from './models/comments-delete-rsp'; +export { CommentsListRsp } from './models/comments-list-rsp'; +export { CommentsLookupRsp } from './models/comments-lookup-rsp'; export { ErrorRsp } from './models/error-rsp'; -export { GetCommentsRsp } from './models/get-comments-rsp'; -export { GetModuleRsp } from './models/get-module-rsp'; -export { ListPackageRsp } from './models/list-package-rsp'; export { Module } from './models/module'; +export { ModulesListRsp } from './models/modules-list-rsp'; export { Package } from './models/package'; -export { UpdatePackageReq } from './models/update-package-req'; -export { UpdatePackageRsp } from './models/update-package-rsp'; +export { PackagesCreateReq } from './models/packages-create-req'; +export { PackagesCreateRsp } from './models/packages-create-rsp'; +export { PackagesDeleteRsp } from './models/packages-delete-rsp'; +export { PackagesListRsp } from './models/packages-list-rsp'; +export { PackagesUpdateReq } from './models/packages-update-req'; +export { PackagesUpdateRsp } from './models/packages-update-rsp'; diff --git a/ui/src/app/api/models/add-comment-rsp.ts b/ui/src/app/api/models/add-comment-rsp.ts deleted file mode 100644 index bef4c03..0000000 --- a/ui/src/app/api/models/add-comment-rsp.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface AddCommentRsp { - id?: number; -} diff --git a/ui/src/app/api/models/add-comment-req.ts b/ui/src/app/api/models/comments-create-req.ts similarity index 50% rename from ui/src/app/api/models/add-comment-req.ts rename to ui/src/app/api/models/comments-create-req.ts index 15b3647..62ebf2c 100644 --- a/ui/src/app/api/models/add-comment-req.ts +++ b/ui/src/app/api/models/comments-create-req.ts @@ -1,6 +1,6 @@ /* tslint:disable */ /* eslint-disable */ -export interface AddCommentReq { - idPackage?: number; +export interface CommentsCreateReq { + package_id?: number; text?: string; } diff --git a/ui/src/app/api/models/comments-create-rsp.ts b/ui/src/app/api/models/comments-create-rsp.ts new file mode 100644 index 0000000..f7eb8bc --- /dev/null +++ b/ui/src/app/api/models/comments-create-rsp.ts @@ -0,0 +1,6 @@ +/* tslint:disable */ +/* eslint-disable */ +import { Comment } from './comment'; +export interface CommentsCreateRsp { + comment?: Comment; +} diff --git a/ui/src/app/api/models/comments-delete-rsp.ts b/ui/src/app/api/models/comments-delete-rsp.ts new file mode 100644 index 0000000..9239c1f --- /dev/null +++ b/ui/src/app/api/models/comments-delete-rsp.ts @@ -0,0 +1,4 @@ +/* tslint:disable */ +/* eslint-disable */ +export interface CommentsDeleteRsp { +} diff --git a/ui/src/app/api/models/get-comments-rsp.ts b/ui/src/app/api/models/comments-list-rsp.ts similarity index 75% rename from ui/src/app/api/models/get-comments-rsp.ts rename to ui/src/app/api/models/comments-list-rsp.ts index 3f54e4a..eb0a478 100644 --- a/ui/src/app/api/models/get-comments-rsp.ts +++ b/ui/src/app/api/models/comments-list-rsp.ts @@ -1,6 +1,6 @@ /* tslint:disable */ /* eslint-disable */ import { Comment } from './comment'; -export interface GetCommentsRsp { +export interface CommentsListRsp { comments?: Array; } diff --git a/ui/src/app/api/models/comments-lookup-rsp.ts b/ui/src/app/api/models/comments-lookup-rsp.ts new file mode 100644 index 0000000..e013caa --- /dev/null +++ b/ui/src/app/api/models/comments-lookup-rsp.ts @@ -0,0 +1,6 @@ +/* tslint:disable */ +/* eslint-disable */ +import { Comment } from './comment'; +export interface CommentsLookupRsp { + comment?: Comment; +} diff --git a/ui/src/app/api/models/error-rsp.ts b/ui/src/app/api/models/error-rsp.ts index 0d3c797..73712a4 100644 --- a/ui/src/app/api/models/error-rsp.ts +++ b/ui/src/app/api/models/error-rsp.ts @@ -1,6 +1,8 @@ /* tslint:disable */ /* eslint-disable */ -import { Error } from './error'; export interface ErrorRsp { - error?: Error; + code?: string; + details?: string; + title?: string; + uuid?: string; } diff --git a/ui/src/app/api/models/error.ts b/ui/src/app/api/models/error.ts deleted file mode 100644 index 1443489..0000000 --- a/ui/src/app/api/models/error.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface Error { - code?: string; - details?: string; - title?: string; - uuid?: string; -} diff --git a/ui/src/app/api/models/module.ts b/ui/src/app/api/models/module.ts index 7296cd3..0318b38 100644 --- a/ui/src/app/api/models/module.ts +++ b/ui/src/app/api/models/module.ts @@ -1,9 +1,11 @@ /* tslint:disable */ /* eslint-disable */ export interface Module { + created?: string; id?: number; last_version?: string; name?: string; package?: number; + updated?: string; version?: string; } diff --git a/ui/src/app/api/models/get-module-rsp.ts b/ui/src/app/api/models/modules-list-rsp.ts similarity index 75% rename from ui/src/app/api/models/get-module-rsp.ts rename to ui/src/app/api/models/modules-list-rsp.ts index a484391..92aefc0 100644 --- a/ui/src/app/api/models/get-module-rsp.ts +++ b/ui/src/app/api/models/modules-list-rsp.ts @@ -1,6 +1,6 @@ /* tslint:disable */ /* eslint-disable */ import { Module } from './module'; -export interface GetModuleRsp { +export interface ModulesListRsp { modules?: Array; } diff --git a/ui/src/app/api/models/package.ts b/ui/src/app/api/models/package.ts index 2ca0e04..b8c470c 100644 --- a/ui/src/app/api/models/package.ts +++ b/ui/src/app/api/models/package.ts @@ -2,9 +2,11 @@ /* eslint-disable */ export interface Package { comments?: Array; + created?: string; id?: number; issues?: Array; modules?: Array; name?: string; + updated?: string; url?: string; } diff --git a/ui/src/app/api/models/add-package-req.ts b/ui/src/app/api/models/packages-create-req.ts similarity index 73% rename from ui/src/app/api/models/add-package-req.ts rename to ui/src/app/api/models/packages-create-req.ts index 6e6cc1c..278b1fd 100644 --- a/ui/src/app/api/models/add-package-req.ts +++ b/ui/src/app/api/models/packages-create-req.ts @@ -1,6 +1,6 @@ /* tslint:disable */ /* eslint-disable */ -export interface AddPackageReq { +export interface PackagesCreateReq { modules?: Array; name?: string; url?: string; diff --git a/ui/src/app/api/models/add-package-rsp.ts b/ui/src/app/api/models/packages-create-rsp.ts similarity index 63% rename from ui/src/app/api/models/add-package-rsp.ts rename to ui/src/app/api/models/packages-create-rsp.ts index d969d38..5fb2fb5 100644 --- a/ui/src/app/api/models/add-package-rsp.ts +++ b/ui/src/app/api/models/packages-create-rsp.ts @@ -1,5 +1,5 @@ /* tslint:disable */ /* eslint-disable */ -export interface AddPackageRsp { +export interface PackagesCreateRsp { status?: string; } diff --git a/ui/src/app/api/models/packages-delete-rsp.ts b/ui/src/app/api/models/packages-delete-rsp.ts new file mode 100644 index 0000000..a053c2f --- /dev/null +++ b/ui/src/app/api/models/packages-delete-rsp.ts @@ -0,0 +1,4 @@ +/* tslint:disable */ +/* eslint-disable */ +export interface PackagesDeleteRsp { +} diff --git a/ui/src/app/api/models/list-package-rsp.ts b/ui/src/app/api/models/packages-list-rsp.ts similarity index 75% rename from ui/src/app/api/models/list-package-rsp.ts rename to ui/src/app/api/models/packages-list-rsp.ts index f160c7f..089335c 100644 --- a/ui/src/app/api/models/list-package-rsp.ts +++ b/ui/src/app/api/models/packages-list-rsp.ts @@ -1,6 +1,6 @@ /* tslint:disable */ /* eslint-disable */ import { Package } from './package'; -export interface ListPackageRsp { +export interface PackagesListRsp { packages?: Array; } diff --git a/ui/src/app/api/models/update-package-req.ts b/ui/src/app/api/models/packages-update-req.ts similarity index 79% rename from ui/src/app/api/models/update-package-req.ts rename to ui/src/app/api/models/packages-update-req.ts index a29844a..006dd3a 100644 --- a/ui/src/app/api/models/update-package-req.ts +++ b/ui/src/app/api/models/packages-update-req.ts @@ -1,6 +1,6 @@ /* tslint:disable */ /* eslint-disable */ -export interface UpdatePackageReq { +export interface PackagesUpdateReq { id?: number; issues?: Array; modules?: Array; diff --git a/ui/src/app/api/models/packages-update-rsp.ts b/ui/src/app/api/models/packages-update-rsp.ts new file mode 100644 index 0000000..fb26304 --- /dev/null +++ b/ui/src/app/api/models/packages-update-rsp.ts @@ -0,0 +1,6 @@ +/* tslint:disable */ +/* eslint-disable */ +import { Package } from './package'; +export interface PackagesUpdateRsp { + package?: Package; +} diff --git a/ui/src/app/api/models/update-package-rsp.ts b/ui/src/app/api/models/update-package-rsp.ts deleted file mode 100644 index d68e911..0000000 --- a/ui/src/app/api/models/update-package-rsp.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface UpdatePackageRsp { - id?: number; -} diff --git a/ui/src/app/api/services/pkgdash-service.service.ts b/ui/src/app/api/services/pkgdash-service.service.ts index cd0815f..65c0f17 100644 --- a/ui/src/app/api/services/pkgdash-service.service.ts +++ b/ui/src/app/api/services/pkgdash-service.service.ts @@ -10,15 +10,18 @@ import { ApiConfiguration } from '../api-configuration'; import { StrictHttpResponse } from '../strict-http-response'; import { RequestBuilder } from '../request-builder'; -import { AddCommentReq } from '../models/add-comment-req'; -import { AddCommentRsp } from '../models/add-comment-rsp'; -import { AddPackageReq } from '../models/add-package-req'; -import { AddPackageRsp } from '../models/add-package-rsp'; -import { GetCommentsRsp } from '../models/get-comments-rsp'; -import { GetModuleRsp } from '../models/get-module-rsp'; -import { ListPackageRsp } from '../models/list-package-rsp'; -import { UpdatePackageReq } from '../models/update-package-req'; -import { UpdatePackageRsp } from '../models/update-package-rsp'; +import { CommentsCreateReq } from '../models/comments-create-req'; +import { CommentsCreateRsp } from '../models/comments-create-rsp'; +import { CommentsDeleteRsp } from '../models/comments-delete-rsp'; +import { CommentsListRsp } from '../models/comments-list-rsp'; +import { CommentsLookupRsp } from '../models/comments-lookup-rsp'; +import { ModulesListRsp } from '../models/modules-list-rsp'; +import { PackagesCreateReq } from '../models/packages-create-req'; +import { PackagesCreateRsp } from '../models/packages-create-rsp'; +import { PackagesDeleteRsp } from '../models/packages-delete-rsp'; +import { PackagesListRsp } from '../models/packages-list-rsp'; +import { PackagesUpdateReq } from '../models/packages-update-req'; +import { PackagesUpdateRsp } from '../models/packages-update-rsp'; @Injectable({ providedIn: 'root' }) export class PkgdashServiceService extends BaseService { @@ -26,24 +29,26 @@ export class PkgdashServiceService extends BaseService { super(config, http); } - /** Path part for operation `getComments()` */ - static readonly GetCommentsPath = '/v1/comment'; + /** Path part for operation `commentsLookup()` */ + static readonly CommentsLookupPath = '/v1/comments/{id}/comments'; /** * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `getComments()` instead. + * To access only the response body, use `commentsLookup()` instead. * * This method doesn't expect any request body. */ - getComments$Response( - params?: { - id?: Array; + commentsLookup$Response( + params: { + id: number; + package_id?: number; }, context?: HttpContext - ): Observable> { - const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.GetCommentsPath, 'get'); + ): Observable> { + const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.CommentsLookupPath, 'get'); if (params) { - rb.query('id', params.id, {}); + rb.path('id', params.id, {}); + rb.query('package_id', params.package_id, {}); } return this.http.request( @@ -51,46 +56,45 @@ export class PkgdashServiceService extends BaseService { ).pipe( filter((r: any): r is HttpResponse => r instanceof HttpResponse), map((r: HttpResponse) => { - return r as StrictHttpResponse; + return r as StrictHttpResponse; }) ); } /** * This method provides access only to the response body. - * To access the full response (for headers, for example), `getComments$Response()` instead. + * To access the full response (for headers, for example), `commentsLookup$Response()` instead. * * This method doesn't expect any request body. */ - getComments( - params?: { - id?: Array; + commentsLookup( + params: { + id: number; + package_id?: number; }, context?: HttpContext - ): Observable { - return this.getComments$Response(params, context).pipe( - map((r: StrictHttpResponse): GetCommentsRsp => r.body) + ): Observable { + return this.commentsLookup$Response(params, context).pipe( + map((r: StrictHttpResponse): CommentsLookupRsp => r.body) ); } - /** Path part for operation `getModule()` */ - static readonly GetModulePath = '/v1/module'; + /** Path part for operation `modulesList()` */ + static readonly ModulesListPath = '/v1/modules'; /** * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `getModule()` instead. + * To access only the response body, use `modulesList()` instead. * * This method doesn't expect any request body. */ - getModule$Response( + modulesList$Response( params?: { - id?: Array; }, context?: HttpContext - ): Observable> { - const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.GetModulePath, 'get'); + ): Observable> { + const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.ModulesListPath, 'get'); if (params) { - rb.query('id', params.id, {}); } return this.http.request( @@ -98,44 +102,87 @@ export class PkgdashServiceService extends BaseService { ).pipe( filter((r: any): r is HttpResponse => r instanceof HttpResponse), map((r: HttpResponse) => { - return r as StrictHttpResponse; + return r as StrictHttpResponse; }) ); } /** * This method provides access only to the response body. - * To access the full response (for headers, for example), `getModule$Response()` instead. + * To access the full response (for headers, for example), `modulesList$Response()` instead. * * This method doesn't expect any request body. */ - getModule( + modulesList( params?: { - id?: Array; }, context?: HttpContext - ): Observable { - return this.getModule$Response(params, context).pipe( - map((r: StrictHttpResponse): GetModuleRsp => r.body) + ): Observable { + return this.modulesList$Response(params, context).pipe( + map((r: StrictHttpResponse): ModulesListRsp => r.body) ); } - /** Path part for operation `addPackage()` */ - static readonly AddPackagePath = '/v1/package'; + /** Path part for operation `packagesList()` */ + static readonly PackagesListPath = '/v1/packages'; /** * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `addPackage()` instead. + * To access only the response body, use `packagesList()` instead. + * + * This method doesn't expect any request body. + */ + packagesList$Response( + params?: { + }, + context?: HttpContext + ): Observable> { + const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.PackagesListPath, 'get'); + if (params) { + } + + return this.http.request( + rb.build({ responseType: 'json', accept: 'application/json', context }) + ).pipe( + filter((r: any): r is HttpResponse => r instanceof HttpResponse), + map((r: HttpResponse) => { + return r as StrictHttpResponse; + }) + ); + } + + /** + * This method provides access only to the response body. + * To access the full response (for headers, for example), `packagesList$Response()` instead. + * + * This method doesn't expect any request body. + */ + packagesList( + params?: { + }, + context?: HttpContext + ): Observable { + return this.packagesList$Response(params, context).pipe( + map((r: StrictHttpResponse): PackagesListRsp => r.body) + ); + } + + /** Path part for operation `packagesCreate()` */ + static readonly PackagesCreatePath = '/v1/packages'; + + /** + * This method provides access to the full `HttpResponse`, allowing access to response headers. + * To access only the response body, use `packagesCreate()` instead. * * This method sends `application/json` and handles request body of type `application/json`. */ - addPackage$Response( + packagesCreate$Response( params: { - body: AddPackageReq + body: PackagesCreateReq }, context?: HttpContext - ): Observable> { - const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.AddPackagePath, 'post'); + ): Observable> { + const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.PackagesCreatePath, 'post'); if (params) { rb.body(params.body, 'application/json'); } @@ -145,45 +192,45 @@ export class PkgdashServiceService extends BaseService { ).pipe( filter((r: any): r is HttpResponse => r instanceof HttpResponse), map((r: HttpResponse) => { - return r as StrictHttpResponse; + return r as StrictHttpResponse; }) ); } /** * This method provides access only to the response body. - * To access the full response (for headers, for example), `addPackage$Response()` instead. + * To access the full response (for headers, for example), `packagesCreate$Response()` instead. * * This method sends `application/json` and handles request body of type `application/json`. */ - addPackage( + packagesCreate( params: { - body: AddPackageReq + body: PackagesCreateReq }, context?: HttpContext - ): Observable { - return this.addPackage$Response(params, context).pipe( - map((r: StrictHttpResponse): AddPackageRsp => r.body) + ): Observable { + return this.packagesCreate$Response(params, context).pipe( + map((r: StrictHttpResponse): PackagesCreateRsp => r.body) ); } - /** Path part for operation `updateInfo()` */ - static readonly UpdateInfoPath = '/v1/package/{id}'; + /** Path part for operation `packagesUpdate()` */ + static readonly PackagesUpdatePath = '/v1/packages/{id}'; /** * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `updateInfo()` instead. + * To access only the response body, use `packagesUpdate()` instead. * * This method sends `application/json` and handles request body of type `application/json`. */ - updateInfo$Response( + packagesUpdate$Response( params: { id: number; - body: UpdatePackageReq + body: PackagesUpdateReq }, context?: HttpContext - ): Observable> { - const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.UpdateInfoPath, 'post'); + ): Observable> { + const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.PackagesUpdatePath, 'put'); if (params) { rb.path('id', params.id, {}); rb.body(params.body, 'application/json'); @@ -194,48 +241,142 @@ export class PkgdashServiceService extends BaseService { ).pipe( filter((r: any): r is HttpResponse => r instanceof HttpResponse), map((r: HttpResponse) => { - return r as StrictHttpResponse; + return r as StrictHttpResponse; }) ); } /** * This method provides access only to the response body. - * To access the full response (for headers, for example), `updateInfo$Response()` instead. + * To access the full response (for headers, for example), `packagesUpdate$Response()` instead. * * This method sends `application/json` and handles request body of type `application/json`. */ - updateInfo( + packagesUpdate( params: { id: number; - body: UpdatePackageReq + body: PackagesUpdateReq }, context?: HttpContext - ): Observable { - return this.updateInfo$Response(params, context).pipe( - map((r: StrictHttpResponse): UpdatePackageRsp => r.body) + ): Observable { + return this.packagesUpdate$Response(params, context).pipe( + map((r: StrictHttpResponse): PackagesUpdateRsp => r.body) ); } - /** Path part for operation `addComment()` */ - static readonly AddCommentPath = '/v1/package/{pkg}/comment'; + /** Path part for operation `packagesDelete()` */ + static readonly PackagesDeletePath = '/v1/packages/{id}'; /** * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `addComment()` instead. + * To access only the response body, use `packagesDelete()` instead. + * + * This method doesn't expect any request body. + */ + packagesDelete$Response( + params: { + id: number; + }, + context?: HttpContext + ): Observable> { + const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.PackagesDeletePath, 'delete'); + if (params) { + rb.path('id', params.id, {}); + } + + return this.http.request( + rb.build({ responseType: 'json', accept: 'application/json', context }) + ).pipe( + filter((r: any): r is HttpResponse => r instanceof HttpResponse), + map((r: HttpResponse) => { + return r as StrictHttpResponse; + }) + ); + } + + /** + * This method provides access only to the response body. + * To access the full response (for headers, for example), `packagesDelete$Response()` instead. + * + * This method doesn't expect any request body. + */ + packagesDelete( + params: { + id: number; + }, + context?: HttpContext + ): Observable { + return this.packagesDelete$Response(params, context).pipe( + map((r: StrictHttpResponse): PackagesDeleteRsp => r.body) + ); + } + + /** Path part for operation `commentsList()` */ + static readonly CommentsListPath = '/v1/packages/{package_id}/comments'; + + /** + * This method provides access to the full `HttpResponse`, allowing access to response headers. + * To access only the response body, use `commentsList()` instead. + * + * This method doesn't expect any request body. + */ + commentsList$Response( + params: { + package_id: number; + }, + context?: HttpContext + ): Observable> { + const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.CommentsListPath, 'get'); + if (params) { + rb.path('package_id', params.package_id, {}); + } + + return this.http.request( + rb.build({ responseType: 'json', accept: 'application/json', context }) + ).pipe( + filter((r: any): r is HttpResponse => r instanceof HttpResponse), + map((r: HttpResponse) => { + return r as StrictHttpResponse; + }) + ); + } + + /** + * This method provides access only to the response body. + * To access the full response (for headers, for example), `commentsList$Response()` instead. + * + * This method doesn't expect any request body. + */ + commentsList( + params: { + package_id: number; + }, + context?: HttpContext + ): Observable { + return this.commentsList$Response(params, context).pipe( + map((r: StrictHttpResponse): CommentsListRsp => r.body) + ); + } + + /** Path part for operation `commentsCreate()` */ + static readonly CommentsCreatePath = '/v1/packages/{package_id}/comments'; + + /** + * This method provides access to the full `HttpResponse`, allowing access to response headers. + * To access only the response body, use `commentsCreate()` instead. * * This method sends `application/json` and handles request body of type `application/json`. */ - addComment$Response( + commentsCreate$Response( params: { - pkg: string; - body: AddCommentReq + package_id: number; + body: CommentsCreateReq }, context?: HttpContext - ): Observable> { - const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.AddCommentPath, 'post'); + ): Observable> { + const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.CommentsCreatePath, 'post'); if (params) { - rb.path('pkg', params.pkg, {}); + rb.path('package_id', params.package_id, {}); rb.body(params.body, 'application/json'); } @@ -244,45 +385,49 @@ export class PkgdashServiceService extends BaseService { ).pipe( filter((r: any): r is HttpResponse => r instanceof HttpResponse), map((r: HttpResponse) => { - return r as StrictHttpResponse; + return r as StrictHttpResponse; }) ); } /** * This method provides access only to the response body. - * To access the full response (for headers, for example), `addComment$Response()` instead. + * To access the full response (for headers, for example), `commentsCreate$Response()` instead. * * This method sends `application/json` and handles request body of type `application/json`. */ - addComment( + commentsCreate( params: { - pkg: string; - body: AddCommentReq + package_id: number; + body: CommentsCreateReq }, context?: HttpContext - ): Observable { - return this.addComment$Response(params, context).pipe( - map((r: StrictHttpResponse): AddCommentRsp => r.body) + ): Observable { + return this.commentsCreate$Response(params, context).pipe( + map((r: StrictHttpResponse): CommentsCreateRsp => r.body) ); } - /** Path part for operation `listPackage()` */ - static readonly ListPackagePath = '/v1/packages'; + /** Path part for operation `commentsDelete()` */ + static readonly CommentsDeletePath = '/v1/packages/{package_id}/comments/{id}'; /** * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `listPackage()` instead. + * To access only the response body, use `commentsDelete()` instead. * * This method doesn't expect any request body. */ - listPackage$Response( - params?: { + commentsDelete$Response( + params: { + package_id: number; + id: number; }, context?: HttpContext - ): Observable> { - const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.ListPackagePath, 'get'); + ): Observable> { + const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.CommentsDeletePath, 'delete'); if (params) { + rb.path('package_id', params.package_id, {}); + rb.path('id', params.id, {}); } return this.http.request( @@ -290,24 +435,26 @@ export class PkgdashServiceService extends BaseService { ).pipe( filter((r: any): r is HttpResponse => r instanceof HttpResponse), map((r: HttpResponse) => { - return r as StrictHttpResponse; + return r as StrictHttpResponse; }) ); } /** * This method provides access only to the response body. - * To access the full response (for headers, for example), `listPackage$Response()` instead. + * To access the full response (for headers, for example), `commentsDelete$Response()` instead. * * This method doesn't expect any request body. */ - listPackage( - params?: { + commentsDelete( + params: { + package_id: number; + id: number; }, context?: HttpContext - ): Observable { - return this.listPackage$Response(params, context).pipe( - map((r: StrictHttpResponse): ListPackageRsp => r.body) + ): Observable { + return this.commentsDelete$Response(params, context).pipe( + map((r: StrictHttpResponse): CommentsDeleteRsp => r.body) ); } diff --git a/ui/src/app/app.module.ts b/ui/src/app/app.module.ts index b1c6c96..8327929 100644 --- a/ui/src/app/app.module.ts +++ b/ui/src/app/app.module.ts @@ -3,10 +3,12 @@ import { BrowserModule } from '@angular/platform-browser'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; +import { DashboardComponent } from './dashboard/dashboard.component'; @NgModule({ declarations: [ - AppComponent + AppComponent, + DashboardComponent, ], imports: [ BrowserModule, diff --git a/ui/src/app/dashboard/dashboard.component.html b/ui/src/app/dashboard/dashboard.component.html new file mode 100644 index 0000000..9c5fce9 --- /dev/null +++ b/ui/src/app/dashboard/dashboard.component.html @@ -0,0 +1 @@ +

dashboard works!

diff --git a/ui/src/app/dashboard/dashboard.component.scss b/ui/src/app/dashboard/dashboard.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/ui/src/app/dashboard/dashboard.component.spec.ts b/ui/src/app/dashboard/dashboard.component.spec.ts new file mode 100644 index 0000000..5ec4ff8 --- /dev/null +++ b/ui/src/app/dashboard/dashboard.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DashboardComponent } from './dashboard.component'; + +describe('DashboardComponent', () => { + let component: DashboardComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ DashboardComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(DashboardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ui/src/app/dashboard/dashboard.component.ts b/ui/src/app/dashboard/dashboard.component.ts new file mode 100644 index 0000000..843c80f --- /dev/null +++ b/ui/src/app/dashboard/dashboard.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-dashboard', + templateUrl: './dashboard.component.html', + styleUrls: ['./dashboard.component.scss'] +}) +export class DashboardComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/ui/src/index.html b/ui/src/index.html index e4a618e..5350814 100644 --- a/ui/src/index.html +++ b/ui/src/index.html @@ -2,7 +2,7 @@ - Ui + UI