🎉 Initial Commit of Ring

This commit is contained in:
2025-12-13 22:51:11 +08:00
parent aed5d53f9e
commit 445363406b
47 changed files with 31140 additions and 48 deletions

77
go.mod
View File

@@ -3,36 +3,79 @@ module git.solsynth.dev/goatworks/turbine
go 1.25.5
require (
firebase.google.com/go/v4 v4.18.0
github.com/charmbracelet/bubbles v0.21.0
github.com/charmbracelet/bubbletea v1.3.10
github.com/charmbracelet/lipgloss v1.1.0
github.com/gofiber/contrib/v3/websocket v1.0.0-rc.1
github.com/gofiber/fiber/v3 v3.0.0-rc.3
github.com/google/uuid v1.6.0
github.com/joho/godotenv v1.5.1
github.com/nats-io/nats.go v1.47.0
github.com/rs/zerolog v1.34.0
github.com/samber/lo v1.52.0
github.com/sideshow/apns2 v0.25.0
github.com/spf13/viper v1.21.0
go.etcd.io/etcd/client/v3 v3.6.6
google.golang.org/api v0.231.0
google.golang.org/grpc v1.72.0
google.golang.org/protobuf v1.36.6
gopkg.in/yaml.v3 v3.0.1
gorm.io/driver/postgres v1.6.0
gorm.io/gorm v1.31.1
)
require (
cel.dev/expr v0.23.1 // indirect
cloud.google.com/go v0.121.0 // indirect
cloud.google.com/go/auth v0.16.1 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
cloud.google.com/go/firestore v1.18.0 // indirect
cloud.google.com/go/iam v1.5.2 // indirect
cloud.google.com/go/longrunning v0.6.7 // indirect
cloud.google.com/go/monitoring v1.24.2 // indirect
cloud.google.com/go/storage v1.53.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0 // indirect
github.com/MicahParks/keyfunc v1.9.0 // indirect
github.com/andybalholm/brotli v1.2.0 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
github.com/charmbracelet/x/ansi v0.10.1 // indirect
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
github.com/charmbracelet/x/term v0.2.1 // indirect
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/fasthttp/websocket v1.5.12 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/gofiber/schema v1.6.0 // indirect
github.com/gofiber/utils/v2 v2.0.0-rc.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/google/s2a-go v0.1.9 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
github.com/klauspost/compress v1.18.1 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.6 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/klauspost/compress v1.18.2 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
@@ -41,30 +84,48 @@ require (
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/nats-io/nkeys v0.4.11 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/philhofer/fwd v1.2.0 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/savsgio/gotils v0.0.0-20250924091648-bce9a52d7761 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tinylib/msgp v1.5.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.68.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/zeebo/errs v1.4.0 // indirect
go.etcd.io/etcd/api/v3 v3.6.6 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.6.6 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/detectors/gcp v1.35.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
go.opentelemetry.io/otel v1.35.0 // indirect
go.opentelemetry.io/otel/metric v1.35.0 // indirect
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.35.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.44.0 // indirect
golang.org/x/crypto v0.46.0 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/text v0.31.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/grpc v1.71.1 // indirect
google.golang.org/protobuf v1.36.5 // indirect
golang.org/x/text v0.32.0 // indirect
golang.org/x/time v0.11.0 // indirect
google.golang.org/appengine/v2 v2.0.6 // indirect
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250505200425-f936aa4a68b2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2 // indirect
)

203
go.sum
View File

@@ -1,7 +1,47 @@
cel.dev/expr v0.23.1 h1:K4KOtPCJQjVggkARsjG9RWXP6O4R73aHeJMa/dmCQQg=
cel.dev/expr v0.23.1/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw=
cloud.google.com/go v0.121.0 h1:pgfwva8nGw7vivjZiRfrmglGWiCJBP+0OmDpenG/Fwg=
cloud.google.com/go v0.121.0/go.mod h1:rS7Kytwheu/y9buoDmu5EIpMMCI4Mb8ND4aeN4Vwj7Q=
cloud.google.com/go/auth v0.16.1 h1:XrXauHMd30LhQYVRHLGvJiYeczweKQXZxsTbV9TiguU=
cloud.google.com/go/auth v0.16.1/go.mod h1:1howDHJ5IETh/LwYs3ZxvlkXF48aSqqJUM+5o02dNOI=
cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc=
cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c=
cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I=
cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg=
cloud.google.com/go/firestore v1.18.0 h1:cuydCaLS7Vl2SatAeivXyhbhDEIR8BDmtn4egDhIn2s=
cloud.google.com/go/firestore v1.18.0/go.mod h1:5ye0v48PhseZBdcl0qbl3uttu7FIEwEYVaWm0UIEOEU=
cloud.google.com/go/iam v1.5.2 h1:qgFRAGEmd8z6dJ/qyEchAuL9jpswyODjA2lS+w234g8=
cloud.google.com/go/iam v1.5.2/go.mod h1:SE1vg0N81zQqLzQEwxL2WI6yhetBdbNQuTvIKCSkUHE=
cloud.google.com/go/logging v1.13.0 h1:7j0HgAp0B94o1YRDqiqm26w4q1rDMH7XNRU34lJXHYc=
cloud.google.com/go/logging v1.13.0/go.mod h1:36CoKh6KA/M0PbhPKMq6/qety2DCAErbhXT62TuXALA=
cloud.google.com/go/longrunning v0.6.7 h1:IGtfDWHhQCgCjwQjV9iiLnUta9LBCo8R9QmAFsS/PrE=
cloud.google.com/go/longrunning v0.6.7/go.mod h1:EAFV3IZAKmM56TyiE6VAP3VoTzhZzySwI/YI1s/nRsY=
cloud.google.com/go/monitoring v1.24.2 h1:5OTsoJ1dXYIiMiuL+sYscLc9BumrL3CarVLL7dd7lHM=
cloud.google.com/go/monitoring v1.24.2/go.mod h1:x7yzPWcgDRnPEv3sI+jJGBkwl5qINf+6qY4eq0I9B4U=
cloud.google.com/go/storage v1.53.0 h1:gg0ERZwL17pJ+Cz3cD2qS60w1WMDnwcm5YPAIQBHUAw=
cloud.google.com/go/storage v1.53.0/go.mod h1:7/eO2a/srr9ImZW9k5uufcNahT2+fPb8w5it1i5boaA=
cloud.google.com/go/trace v1.11.6 h1:2O2zjPzqPYAHrn3OKl029qlqG6W8ZdYaOWRyr8NgMT4=
cloud.google.com/go/trace v1.11.6/go.mod h1:GA855OeDEBiBMzcckLPE2kDunIpC72N+Pq8WFieFjnI=
firebase.google.com/go/v4 v4.18.0 h1:S+g0P72oDGqOaG4wlLErX3zQmU9plVdu7j+Bc3R1qFw=
firebase.google.com/go/v4 v4.18.0/go.mod h1:P7UfBpzc8+Z3MckX79+zsWzKVfpGryr6HLbAe7gCWfs=
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0 h1:ErKg/3iS1AKcTkf3yixlZ54f9U1rljCkQyEXWUnIUxc=
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0/go.mod h1:yAZHSGnqScoU556rBOVkwLze6WP5N+U11RHuWaGVxwY=
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0 h1:fYE9p3esPxA/C0rQ0AHhP0drtPXDRhaWiwg1DPqO7IU=
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0/go.mod h1:BnBReJLvVYx2CS/UHOgVz2BXKXD9wsQPxZug20nZhd0=
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.51.0 h1:OqVGm6Ei3x5+yZmSJG1Mh2NwHvpVmZ08CB5qJhT9Nuk=
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.51.0/go.mod h1:SZiPHWGOOk3bl8tkevxkoiwPgsIl6CwrWcbwjfHZpdM=
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0 h1:6/0iUd0xrnX7qt+mLNRwg5c0PGv8wpE8K90ryANQwMI=
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0/go.mod h1:otE2jQekW/PqXk1Awf5lmfokJx4uwuqcj1ab5SpGeW0=
github.com/MicahParks/keyfunc v1.9.0 h1:lhKd5xrFHLNOWrDc4Tyb/Q1AJ4LCzQ48GVJyVIID3+o=
github.com/MicahParks/keyfunc v1.9.0/go.mod h1:IdnCilugA0O/99dW+/MkvlyrsX8+L8+x95xuVNtM5jw=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20201120081800-1786d5ef83d4/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ=
github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/charmbracelet/bubbles v0.21.0 h1:9TdC97SdRVg/1aaXNVWfFH3nnLAwOXr8Fn6u6mfQdFs=
github.com/charmbracelet/bubbles v0.21.0/go.mod h1:HF+v6QUR4HkEpz62dx7ym2xc71/KBHg+zKwJtMw+qtg=
github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=
@@ -16,20 +56,38 @@ github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0G
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 h1:aQ3y1lwWyqYPiWZThqv1aFbZMiM9vblcSArJRf2Irls=
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8=
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/envoyproxy/go-control-plane v0.13.4 h1:zEqyPVyku6IvWCFwux4x9RxkLOMUL+1vC9xUFv5l2/M=
github.com/envoyproxy/go-control-plane v0.13.4/go.mod h1:kDfuBlDVsSj2MjrLEtRWtHlsWIFcGyB2RMO44Dc5GZA=
github.com/envoyproxy/go-control-plane/envoy v1.32.4 h1:jb83lalDRZSpPWW2Z7Mck/8kXZ5CQAFYVjQcdVIr83A=
github.com/envoyproxy/go-control-plane/envoy v1.32.4/go.mod h1:Gzjc5k8JcJswLjAx1Zm+wSYE20UrLtt7JZMWiWQXQEw=
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI=
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4=
github.com/envoyproxy/protoc-gen-validate v1.2.1 h1:DEo3O99U8j4hBFwbJfrz9VtgcDfUKS7KJ7spH3d86P8=
github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
github.com/fasthttp/websocket v1.5.12 h1:e4RGPpWW2HTbL3zV0Y/t7g0ub294LkiuXXUuTOUInlE=
github.com/fasthttp/websocket v1.5.12/go.mod h1:I+liyL7/4moHojiOgUOIKEWm9EIxHqxZChS+aMFltyg=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
github.com/go-jose/go-jose/v4 v4.0.5 h1:M6T8+mKZl/+fNNuFHvGIzDz7BTLQPIounk/b9dw3AaE=
github.com/go-jose/go-jose/v4 v4.0.5/go.mod h1:s3P1lRrkT8igV8D9OjyL4WRyHvjB6a4JSllnOrmmBOA=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
@@ -37,6 +95,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofiber/contrib/v3/websocket v1.0.0-rc.1 h1:8clbuE29DYk+X9in476o8HiOweDkQ6hUdrz5P3QsNb8=
github.com/gofiber/contrib/v3/websocket v1.0.0-rc.1/go.mod h1:FAz447DGYjVJzaU6tNC/hUF5oNr3/Qlb+AZ1Pe6Z13s=
github.com/gofiber/fiber/v3 v3.0.0-rc.3 h1:h0KXuRHbivSslIpoHD1R/XjUsjcGwt+2vK0avFiYonA=
github.com/gofiber/fiber/v3 v3.0.0-rc.3/go.mod h1:LNBPuS/rGoUFlOyy03fXsWAeWfdGoT1QytwjRVNSVWo=
github.com/gofiber/schema v1.6.0 h1:rAgVDFwhndtC+hgV7Vu5ItQCn7eC2mBA4Eu1/ZTiEYY=
@@ -45,20 +105,46 @@ github.com/gofiber/utils/v2 v2.0.0-rc.2 h1:NvJTf7yMafTq16lUOJv70nr+HIOLNQcvGme/X
github.com/gofiber/utils/v2 v2.0.0-rc.2/go.mod h1:gXins5o7up+BQFiubmO8aUJc/+Mhd7EKXIiAK5GBomI=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc=
github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0=
github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=
github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/enterprise-certificate-proxy v0.3.6 h1:GW/XbdyBFQ8Qe+YAmFU9uHLo7OnF5tL52HFAgMmyrf4=
github.com/googleapis/enterprise-certificate-proxy v0.3.6/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA=
github.com/googleapis/gax-go/v2 v2.14.1 h1:hb0FFeiPaQskmvakKu5EbCbpntQn48jyHuvrkurSS/Q=
github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.7.6 h1:rWQc5FwZSPX58r1OQmkuaNicxdmExaEz5A2DO2hUuTk=
github.com/jackc/pgx/v5 v5.7.6/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co=
github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0=
github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uqnapk=
github.com/klauspost/compress v1.18.2/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -82,11 +168,19 @@ github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELU
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
github.com/nats-io/nats.go v1.47.0 h1:YQdADw6J/UfGUd2Oy6tn4Hq6YHxCaJrVKayxxFqYrgM=
github.com/nats-io/nats.go v1.47.0/go.mod h1:iRWIPokVIFbVijxuMQq4y9ttaBTMe0SFdlZfMDd+33g=
github.com/nats-io/nkeys v0.4.11 h1:q44qGV008kYd9W1b1nEBkNzvnWxtRSQ7A8BoqRrcfa0=
github.com/nats-io/nkeys v0.4.11/go.mod h1:szDimtgmfOi9n25JpfIdGw12tZFYXqhGxjhVxsatHVE=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM=
github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo=
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=
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/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
@@ -99,8 +193,14 @@ github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc=
github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik=
github.com/samber/lo v1.52.0 h1:Rvi+3BFHES3A8meP33VPAxiBZX/Aws5RxrschYGjomw=
github.com/samber/lo v1.52.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
github.com/savsgio/gotils v0.0.0-20250924091648-bce9a52d7761 h1:McifyVxygw1d67y6vxUqls2D46J8W9nrki9c8c0eVvE=
github.com/savsgio/gotils v0.0.0-20250924091648-bce9a52d7761/go.mod h1:Vi9gvHvTw4yCUHIznFl5TPULS7aXwgaTByGeBY75Wko=
github.com/shamaton/msgpack/v2 v2.4.0 h1:O5Z08MRmbo0lA9o2xnQ4TXx6teJbPqEurqcCOQ8Oi/4=
github.com/shamaton/msgpack/v2 v2.4.0/go.mod h1:6khjYnkx73f7VQU7wjcFS9DFjs+59naVWJv1TB7qdOI=
github.com/sideshow/apns2 v0.25.0 h1:XOzanncO9MQxkb03T/2uU2KcdVjYiIf0TMLzec0FTW4=
github.com/sideshow/apns2 v0.25.0/go.mod h1:7Fceu+sL0XscxrfLSkAoH6UtvKefq3Kq1n4W3ayQZqE=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
@@ -111,6 +211,12 @@ github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY=
github.com/spiffe/go-spiffe/v2 v2.5.0 h1:N2I01KCUkv1FAjZXJMwh95KK1ZIQLYbPfhaxw8WS0hE=
github.com/spiffe/go-spiffe/v2 v2.5.0/go.mod h1:P+NxobPc6wXhVtINNtFjNWGBTreew1GBUCwT2wPmb7g=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
@@ -129,6 +235,9 @@ github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZ
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/zeebo/errs v1.4.0 h1:XNdoD/RRMKP7HD0UhJnIzUy74ISdGGxURlYG8HSWSfM=
github.com/zeebo/errs v1.4.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4=
go.etcd.io/etcd/api/v3 v3.6.6 h1:mcaMp3+7JawWv69p6QShYWS8cIWUOl32bFLb6qf8pOQ=
go.etcd.io/etcd/api/v3 v3.6.6/go.mod h1:f/om26iXl2wSkcTA1zGQv8reJRSLVdoEBsi4JdfMrx4=
go.etcd.io/etcd/client/pkg/v3 v3.6.6 h1:uoqgzSOv2H9KlIF5O1Lsd8sW+eMLuV6wzE3q5GJGQNs=
@@ -137,16 +246,24 @@ go.etcd.io/etcd/client/v3 v3.6.6 h1:G5z1wMf5B9SNexoxOHUGBaULurOZPIgGPsW6CN492ec=
go.etcd.io/etcd/client/v3 v3.6.6/go.mod h1:36Qv6baQ07znPR3+n7t+Rk5VHEzVYPvFfGmfF4wBHV8=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ=
go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE=
go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A=
go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU=
go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k=
go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE=
go.opentelemetry.io/contrib/detectors/gcp v1.35.0 h1:bGvFt68+KTiAKFlacHW6AhA56GF2rS0bdD3aJYEnmzA=
go.opentelemetry.io/contrib/detectors/gcp v1.35.0/go.mod h1:qGWP8/+ILwMRIUf9uIVLloR1uo5ZYAslM4O6OqUi1DA=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 h1:x7wzEgXfnzJcHDwStJT+mxOz4etr2EcexjqhBvmoakw=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0/go.mod h1:rg+RlpR5dKwaS95IyyZqj5Wd4E13lk/msnTS0Xl9lJM=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 h1:sbiXRNDSWJOTobXh5HyQKjq6wUC5tNybqjIqDpAY4CU=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0/go.mod h1:69uWxva0WgAA/4bu2Yy70SLDBwZXuQ6PbBpbsa5iZrQ=
go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ=
go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.35.0 h1:PB3Zrjs1sG1GBX51SXyTSoOTqcDglmsk7nT6tkKPb/k=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.35.0/go.mod h1:U2R3XyVPzn0WX7wOIypPuptulsMcPDPs/oiSVOMVnHY=
go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M=
go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE=
go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY=
go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg=
go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o=
go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w=
go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs=
go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
@@ -155,55 +272,93 @@ go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.0.0-20170512130425-ab89591268e0/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.44.0 h1:A97SsFvM3AIwEEmTBiaxPPTYpDC47w720rdiiUvgoAU=
golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E=
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220403103023-749bd193bc2b/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/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-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.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
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=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950=
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb h1:TLPQVbx1GJ8VKZxz52VAxl1EBgKXXbTiU9Fc5fZeLn4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I=
google.golang.org/grpc v1.71.1 h1:ffsFWr7ygTUscGPI0KKK6TLrGz0476KUvvsbqWK0rPI=
google.golang.org/grpc v1.71.1/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec=
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/api v0.231.0 h1:LbUD5FUl0C4qwia2bjXhCMH65yz1MLPzA/0OYEsYY7Q=
google.golang.org/api v0.231.0/go.mod h1:H52180fPI/QQlUc0F4xWfGZILdv09GCWKt2bcsn164A=
google.golang.org/appengine/v2 v2.0.6 h1:LvPZLGuchSBslPBp+LAhihBeGSiRh1myRoYK4NtuBIw=
google.golang.org/appengine/v2 v2.0.6/go.mod h1:WoEXGoXNfa0mLvaH5sV3ZSGXwVmy8yf7Z1JKf3J3wLI=
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2 h1:1tXaIXCracvtsRxSBsYDiSBN0cuJvM7QYW+MrpIRY78=
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2/go.mod h1:49MsLSx0oWMOZqcpB3uL8ZOkAh1+TndpJ8ONoCBWiZk=
google.golang.org/genproto/googleapis/api v0.0.0-20250505200425-f936aa4a68b2 h1:vPV0tzlsK6EzEDHNNH5sa7Hs9bd7iXR7B1tSiPepkV0=
google.golang.org/genproto/googleapis/api v0.0.0-20250505200425-f936aa4a68b2/go.mod h1:pKLAc5OolXC3ViWGI62vvC0n10CpwAtRcTNCFwTKBEw=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2 h1:IqsN8hx+lWLqlN+Sc3DoMy/watjofWiU8sRFgQ8fhKM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM=
google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/postgres v1.6.0 h1:2dxzU8xJ+ivvqTRph34QX+WrRaJlmfyPqXmoGVjMBa4=
gorm.io/driver/postgres v1.6.0/go.mod h1:vUw0mrGgrTK+uPHEhAdV4sfFELrByKVGnaVRkXDhtWo=
gorm.io/gorm v1.31.1 h1:7CA8FTFz/gRfgqgpeKIBcervUn3xSyPUmr6B2WXJ7kg=
gorm.io/gorm v1.31.1/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs=

130
pkg/ring/clients/email.go Normal file
View File

@@ -0,0 +1,130 @@
package clients
import (
"fmt"
"net/smtp"
"crypto/tls"
"github.com/spf13/viper"
"github.com/rs/zerolog/log"
)
type SMTPSettings struct {
Host string
Port int
Username string
Password string
Encryption string // "tls", "ssl", "none"
FromAddress string
FromName string
}
var smtpSettings SMTPSettings
func InitSMTPSettings() {
smtpSettings = SMTPSettings{
Host: viper.GetString("smtp.host"),
Port: viper.GetInt("smtp.port"),
Username: viper.GetString("smtp.username"),
Password: viper.GetString("smtp.password"),
Encryption: viper.GetString("smtp.encryption"),
FromAddress: viper.GetString("smtp.from_address"),
FromName: viper.GetString("smtp.from_name"),
}
if smtpSettings.Host == "" || smtpSettings.Port == 0 || smtpSettings.FromAddress == "" {
log.Warn().Msg("SMTP configuration incomplete. Email sending may not work.")
} else {
log.Info().Msgf("SMTP client initialized for %s:%d", smtpSettings.Host, smtpSettings.Port)
}
}
func GetSMTPSettings() SMTPSettings {
return smtpSettings
}
// SendEmail sends an email using the configured SMTP settings.
func SendEmail(toAddress, subject, body string) error {
if smtpSettings.Host == "" {
return fmt.Errorf("SMTP client not initialized or host is empty")
}
addr := fmt.Sprintf("%s:%d", smtpSettings.Host, smtpSettings.Port)
// Setup authentication
auth := smtp.PlainAuth("", smtpSettings.Username, smtpSettings.Password, smtpSettings.Host)
// Construct the email message
mime := "MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n"
msg := []byte("From: " + smtpSettings.FromName + " <" + smtpSettings.FromAddress + ">\r\n" +
"To: " + toAddress + "\r\n" +
"Subject: " + subject + "\r\n" +
mime + "\r\n" +
body + "\r\n")
var err error
switch smtpSettings.Encryption {
case "tls":
// TLS encryption
err = sendMailTLS(addr, auth, smtpSettings.FromAddress, []string{toAddress}, msg)
case "ssl":
// SSL encryption (usually port 465)
err = smtp.SendMail(addr, auth, smtpSettings.FromAddress, []string{toAddress}, msg)
case "none":
// No encryption (usually port 25 or 587 without STARTTLS)
err = smtp.SendMail(addr, auth, smtpSettings.FromAddress, []string{toAddress}, msg)
default:
return fmt.Errorf("unsupported SMTP encryption type: %s", smtpSettings.Encryption)
}
if err != nil {
return fmt.Errorf("failed to send email: %w", err)
}
log.Info().Msgf("Email sent successfully to %s", toAddress)
return nil
}
// sendMailTLS sends an email over a TLS connection.
func sendMailTLS(addr string, auth smtp.Auth, from string, to []string, msg []byte) error {
conn, err := tls.Dial("tcp", addr, nil)
if err != nil {
return err
}
defer conn.Close()
client, err := smtp.NewClient(conn, smtpSettings.Host)
if err != nil {
return err
}
defer client.Close()
if auth != nil {
if ok, _ := client.Extension("AUTH"); ok {
if err = client.Auth(auth); err != nil {
return err
}
}
}
if err = client.Mail(from); err != nil {
return err
}
for _, addr := range to {
if err = client.Rcpt(addr); err != nil {
return err
}
}
w, err := client.Data()
if err != nil {
return err
}
_, err = w.Write(msg)
if err != nil {
return err
}
err = w.Close()
if err != nil {
return err
}
return client.Quit()
}

29
pkg/ring/clients/nats.go Normal file
View File

@@ -0,0 +1,29 @@
package clients
import (
"github.com/nats-io/nats.go"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
)
var natsConn *nats.Conn
// InitNATSClient initializes the NATS client connection.
func InitNATSClient() {
natsURL := viper.GetString("nats.url")
if natsURL == "" {
log.Fatal().Msg("NATS URL not configured in viper (nats.url)")
}
var err error
natsConn, err = nats.Connect(natsURL)
if err != nil {
log.Fatal().Err(err).Msg("Failed to connect to NATS server")
}
log.Info().Msgf("Connected to NATS server: %s", natsURL)
}
// GetNATSClient returns the initialized NATS client connection.
func GetNATSClient() *nats.Conn {
return natsConn
}

67
pkg/ring/clients/push.go Normal file
View File

@@ -0,0 +1,67 @@
package clients
import (
"context"
firebase "firebase.google.com/go/v4"
"firebase.google.com/go/v4/messaging"
"github.com/rs/zerolog/log"
"github.com/sideshow/apns2"
"github.com/sideshow/apns2/token"
"github.com/spf13/viper"
"google.golang.org/api/option"
)
var (
apnsClient *apns2.Client
firebaseClient *messaging.Client
)
func InitPushClients() {
// Initialize APNs Client
apnsCertPath := viper.GetString("apns.certificate_path")
apnsKeyID := viper.GetString("apns.key_id")
apnsTeamID := viper.GetString("apns.team_id")
if apnsCertPath != "" && apnsKeyID != "" && apnsTeamID != "" {
authKey, err := token.AuthKeyFromFile(apnsCertPath)
token := &token.Token{
AuthKey: authKey,
KeyID: apnsKeyID,
TeamID: apnsTeamID,
}
if err != nil {
log.Fatal().Err(err).Msg("Failed to create APNs auth key")
}
apnsClient = apns2.NewTokenClient(token)
apnsClient.Production() // Use Production environment
log.Info().Msg("APNs client initialized in production mode")
} else {
log.Warn().Msg("APNs configuration missing. Skipping APNs client initialization.")
}
// Initialize Firebase Client
firebaseServiceAccountPath := viper.GetString("firebase.service_account_path")
if firebaseServiceAccountPath != "" {
opt := option.WithCredentialsFile(firebaseServiceAccountPath)
app, err := firebase.NewApp(context.Background(), nil, opt)
if err != nil {
log.Fatal().Err(err).Msg("Failed to create Firebase app")
}
firebaseClient, err = app.Messaging(context.Background())
if err != nil {
log.Fatal().Err(err).Msg("Failed to create Firebase Messaging client")
}
log.Info().Msg("Firebase Messaging client initialized")
} else {
log.Warn().Msg("Firebase service account path missing. Skipping Firebase client initialization.")
}
}
func GetAPNsClient() *apns2.Client {
return apnsClient
}
func GetFirebaseClient() *messaging.Client {
return firebaseClient
}

19
pkg/ring/infra/db.go Normal file
View File

@@ -0,0 +1,19 @@
package infra
import (
"github.com/spf13/viper"
"gorm.io/driver/postgres"
"gorm.io/gorm"
)
var Db *gorm.DB
func ConnectDb() error {
dsn := viper.GetString("database.dsn")
db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})
if err != nil {
return err
}
Db = db
return nil
}

View File

@@ -2,17 +2,31 @@ package main
import (
"fmt"
"net"
"os"
"os/signal"
"strconv"
"strings"
"syscall"
"time"
"git.solsynth.dev/goatworks/turbine/pkg/ring/clients" // Add this import
"git.solsynth.dev/goatworks/turbine/pkg/ring/infra"
"git.solsynth.dev/goatworks/turbine/pkg/ring/routes"
"git.solsynth.dev/goatworks/turbine/pkg/ring/services"
"git.solsynth.dev/goatworks/turbine/pkg/ring/websocket" // Add this import
"git.solsynth.dev/goatworks/turbine/pkg/shared/hash"
pb "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen"
"git.solsynth.dev/goatworks/turbine/pkg/shared/registrar"
fiber_websocket "github.com/gofiber/contrib/v3/websocket" // Add this alias import
"github.com/gofiber/fiber/v3"
"github.com/google/uuid"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/samber/lo"
"github.com/spf13/viper"
"google.golang.org/grpc"
)
func init() {
@@ -31,12 +45,49 @@ func main() {
log.Fatal().Err(err).Msg("Failed to read config file...")
}
log.Info().Msg("Configuration loaded.")
clients.InitPushClients() // Initialize APNs and Firebase clients
clients.InitSMTPSettings() // Initialize SMTP client settings
clients.InitNATSClient() // Initialize NATS client
// --- gRPC Server ---
grpcListenAddr := viper.GetString("grpc.listen")
if grpcListenAddr == "" {
log.Fatal().Msg("grpc.listen not configured")
}
grpcServer := grpc.NewServer()
wsManager := websocket.NewManager(clients.GetNATSClient()) // Pass NATS client to WebSocket Manager
ringService := &services.RingServiceServerImpl{
WsManager: wsManager, // Inject WebSocket Manager into RingService
}
pb.RegisterRingServiceServer(grpcServer, ringService)
pb.RegisterRingHandlerServiceServer(grpcServer, ringService)
grpcLis, err := net.Listen("tcp", grpcListenAddr)
if err != nil {
log.Fatal().Err(err).Msgf("Failed to listen for gRPC: %s", grpcListenAddr)
}
go func() {
log.Info().Msgf("gRPC server listening on %s", grpcListenAddr)
if err := grpcServer.Serve(grpcLis); err != nil {
log.Fatal().Err(err).Msg("Failed to serve gRPC")
}
}()
// --- Service Registration ---
etcdEndpoints := viper.GetStringSlice("etcd.endpoints")
if len(etcdEndpoints) == 0 {
log.Fatal().Msg("etcd.endpoints not configured")
}
if err := infra.ConnectDb(); err != nil {
log.Fatal().Err(err).Msg("Failed to connect database.")
} else {
infra.Db.AutoMigrate()
}
if viper.GetBool("etcd.insecure") {
for i, ep := range etcdEndpoints {
if !strings.HasPrefix(ep, "http://") && !strings.HasPrefix(ep, "https://") {
@@ -61,7 +112,7 @@ func main() {
log.Fatal().Err(err).Msg("Invalid listen address")
}
serviceName := "config"
serviceName := "ring" // This should probably be "ring"
instanceID := fmt.Sprint(hash.Hash(fmt.Sprintf("%s-%s-%d", serviceName, host, port)))[:8]
err = serviceReg.Register(serviceName, "http", instanceID, host, port, 30)
@@ -75,23 +126,45 @@ func main() {
ServerHeader: "Turbine Ring",
})
// This is the main endpoint that serves the configuration as JSON.
app.Get("/", func(c fiber.Ctx) error {
log.Info().Msg("Serving shared configuration as JSON")
// Use a new Viper instance to read the shared config
v := viper.New()
v.SetConfigName("shared_config")
v.AddConfigPath(".") // Look in the current directory (pkg/config)
v.SetConfigType("toml")
if err := v.ReadInConfig(); err != nil {
log.Error().Err(err).Msg("Failed to read shared_config.toml")
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
"error": "could not load configuration",
})
api := app.Group("/api")
{
api.Post("/notifications/subscription", routes.CreatePushSubscription)
}
return c.JSON(v.AllSettings())
// Initialize WebSocket Controller
wsController := websocket.NewWebSocketController(wsManager)
// WebSocket endpoint
app.Use("/ws", func(c fiber.Ctx) error {
// Mock authentication based on C# example
// In a real scenario, you'd extract user/session from JWT or similar
// and set c.Locals("currentUser") and c.Locals("currentSession")
c.Locals("currentUser", &pb.Account{Id: uuid.New().String(), Name: "mock_user", Nick: "Mock User"})
c.Locals("currentSession", &pb.AuthSession{ClientId: lo.ToPtr(uuid.New().String())})
if fiber_websocket.IsWebSocketUpgrade(c) {
return c.Next()
}
return fiber.ErrUpgradeRequired
})
app.Get("/ws", fiber_websocket.New(wsController.HandleWebSocket))
// Graceful shutdown
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
<-c
log.Info().Msg("Shutting down servers...")
if err := app.ShutdownWithTimeout(5 * time.Second); err != nil {
log.Error().Err(err).Msg("Fiber server shutdown error")
}
grpcServer.GracefulStop()
log.Info().Msg("Servers gracefully stopped")
}()
err = app.Listen(listenAddr, fiber.ListenConfig{DisableStartupMessage: true})
if err != nil {
log.Fatal().Err(err).Msg("Failed to start the server...")
}
}

View File

@@ -0,0 +1,45 @@
package models
import (
"time"
"github.com/google/uuid"
"gorm.io/gorm"
)
type PushProvider int
const (
PushProviderApple PushProvider = iota
PushProviderGoogle
)
type Notification struct {
Id uuid.UUID `gorm:"primarykey;type:uuid;default:gen_random_uuid()" json:"id"`
Topic string `gorm:"not null;size:1024" json:"topic"`
Title *string `json:"title"`
Subtitle *string `json:"subtitle"`
Content *string `json:"content"`
Meta map[string]any `gorm:"type:jsonb;default:'{}'::jsonb;not null" json:"meta"`
Priority int `gorm:"default:10" json:"priority"`
ViewedAt *time.Time `json:"viewed_at"`
AccountId uuid.UUID `gorm:"type:uuid;not null" json:"account_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
}
type NotificationPushSubscription struct {
Id uuid.UUID `gorm:"primarykey;type:uuid;default:gen_random_uuid()" json:"id"`
AccountId uuid.UUID `gorm:"type:uuid;not null;uniqueIndex:account_device_deleted" json:"account_id"`
DeviceId string `gorm:"not null;size:8192;uniqueIndex:account_device_deleted" json:"device_id"`
DeviceToken string `gorm:"not null;size:8192" json:"device_token"`
Provider PushProvider `gorm:"not null" json:"provider"`
CountDelivered int `gorm:"default:0" json:"count_delivered"`
LastUsedAt *time.Time `json:"last_used_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"uniqueIndex:account_device_deleted,index" json:"deleted_at"`
}

BIN
pkg/ring/ring Executable file

Binary file not shown.

View File

@@ -0,0 +1,7 @@
package routes
import "github.com/gofiber/fiber/v3"
func CreatePushSubscription(c fiber.Ctx) error {
return c.JSON(fiber.Map{})
}

View File

@@ -0,0 +1,435 @@
package services
import (
"context"
"encoding/json"
"fmt"
"firebase.google.com/go/v4/messaging"
"github.com/google/uuid"
"github.com/rs/zerolog/log"
"github.com/sideshow/apns2"
"github.com/sideshow/apns2/payload"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/emptypb"
"git.solsynth.dev/goatworks/turbine/pkg/ring/clients"
"git.solsynth.dev/goatworks/turbine/pkg/ring/infra"
"git.solsynth.dev/goatworks/turbine/pkg/ring/models"
"git.solsynth.dev/goatworks/turbine/pkg/ring/websocket"
pb "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen"
)
// RingServiceServerImpl implements the RingServiceServer and RingHandlerServiceServer interfaces
type RingServiceServerImpl struct {
pb.UnimplementedRingServiceServer
pb.UnimplementedRingHandlerServiceServer
WsManager *websocket.Manager // Add WebSocket Manager
}
// sendPushNotification helper function to send notifications via APNs or FCM
func sendPushNotification(ctx context.Context, notif *models.Notification, sub *models.NotificationPushSubscription) error {
if sub.Provider == models.PushProviderApple {
apnsClient := clients.GetAPNsClient()
if apnsClient == nil {
return fmt.Errorf("APNs client not initialized")
}
apnsPayload := payload.NewPayload().
AlertTitle(*notif.Title).
AlertBody(*notif.Content)
if notif.Subtitle != nil {
apnsPayload.AlertSubtitle(*notif.Subtitle)
}
if notif.Meta != nil {
metaBytes, err := json.Marshal(notif.Meta)
if err != nil {
log.Error().Err(err).Msg("Failed to marshal notification meta for APNs")
} else {
apnsPayload.Custom("meta", string(metaBytes))
}
}
notification := &apns2.Notification{
DeviceToken: sub.DeviceToken,
Topic: notif.Topic,
Payload: apnsPayload,
}
res, err := apnsClient.PushWithContext(ctx, notification)
if err != nil {
return fmt.Errorf("failed to send APNs push notification: %w", err)
}
if res.Sent() {
log.Info().Msgf("APNs notification sent successfully to device %s (token: %s)", sub.DeviceId, sub.DeviceToken)
} else {
log.Error().Msgf("APNs notification failed to send to device %s (token: %s) with reason: %s", sub.DeviceId, sub.DeviceToken, res.Reason)
if res.StatusCode == 410 { // Expired token
log.Warn().Msgf("APNs token for device %s expired. Deleting subscription.", sub.DeviceId)
// TODO: Delete the subscription
}
return fmt.Errorf("APNs push notification failed: %s", res.Reason)
}
} else if sub.Provider == models.PushProviderGoogle {
firebaseClient := clients.GetFirebaseClient()
if firebaseClient == nil {
return fmt.Errorf("Firebase client not initialized")
}
message := &messaging.Message{
Token: sub.DeviceToken,
Notification: &messaging.Notification{
Title: *notif.Title,
Body: *notif.Content,
},
Data: make(map[string]string),
}
if notif.Meta != nil {
for k, v := range notif.Meta {
message.Data[k] = fmt.Sprintf("%v", v)
}
}
res, err := firebaseClient.Send(ctx, message)
if err != nil {
return fmt.Errorf("failed to send Firebase push notification: %w", err)
}
log.Info().Msgf("Firebase notification sent successfully to device %s (token: %s): %s", sub.DeviceId, sub.DeviceToken, res)
} else {
return fmt.Errorf("unsupported push provider: %v", sub.Provider)
}
return nil
}
// SendEmail implements proto.RingServiceServer
func (s *RingServiceServerImpl) SendEmail(ctx context.Context, req *pb.SendEmailRequest) (*emptypb.Empty, error) {
log.Info().Msgf("Received SendEmail request: %+v", req.GetEmail())
email := req.GetEmail()
if email == nil {
return nil, status.Errorf(codes.InvalidArgument, "email message is nil")
}
if email.ToAddress == "" || email.Subject == "" || email.Body == "" {
return nil, status.Errorf(codes.InvalidArgument, "to_address, subject, and body cannot be empty")
}
err := clients.SendEmail(email.ToAddress, email.Subject, email.Body)
if err != nil {
log.Error().Err(err).Msg("Failed to send email")
return nil, status.Errorf(codes.Internal, "failed to send email: %v", err)
}
log.Info().Msgf("Email sent successfully to %s", email.ToAddress)
return &emptypb.Empty{}, nil
}
// PushWebSocketPacket implements proto.RingServiceServer
func (s *RingServiceServerImpl) PushWebSocketPacket(ctx context.Context, req *pb.PushWebSocketPacketRequest) (*emptypb.Empty, error) {
log.Info().Msgf("Received PushWebSocketPacket request for user %s: %+v", req.GetUserId(), req.GetPacket())
if s.WsManager == nil {
return nil, status.Errorf(codes.Unavailable, "WebSocket manager not initialized")
}
accountID, err := uuid.Parse(req.GetUserId())
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "invalid user ID: %v", err)
}
packet := websocket.FromProtoValue(req.GetPacket())
s.WsManager.SendPacketToAccount(accountID, packet)
return &emptypb.Empty{}, nil
}
// PushWebSocketPacketToUsers implements proto.RingServiceServer
func (s *RingServiceServerImpl) PushWebSocketPacketToUsers(ctx context.Context, req *pb.PushWebSocketPacketToUsersRequest) (*emptypb.Empty, error) {
log.Info().Msgf("Received PushWebSocketPacketToUsers request for users %v: %+v", req.GetUserIds(), req.GetPacket())
if s.WsManager == nil {
return nil, status.Errorf(codes.Unavailable, "WebSocket manager not initialized")
}
packet := websocket.FromProtoValue(req.GetPacket())
for _, userID := range req.GetUserIds() {
accountID, err := uuid.Parse(userID)
if err != nil {
log.Warn().Err(err).Msgf("Invalid user ID in batch: %s, skipping", userID)
continue
}
s.WsManager.SendPacketToAccount(accountID, packet)
}
return &emptypb.Empty{}, nil
}
// PushWebSocketPacketToDevice implements proto.RingServiceServer
func (s *RingServiceServerImpl) PushWebSocketPacketToDevice(ctx context.Context, req *pb.PushWebSocketPacketToDeviceRequest) (*emptypb.Empty, error) {
log.Info().Msgf("Received PushWebSocketPacketToDevice request for device %s: %+v", req.GetDeviceId(), req.GetPacket())
if s.WsManager == nil {
return nil, status.Errorf(codes.Unavailable, "WebSocket manager not initialized")
}
packet := websocket.FromProtoValue(req.GetPacket())
s.WsManager.SendPacketToDevice(req.GetDeviceId(), packet)
return &emptypb.Empty{}, nil
}
// PushWebSocketPacketToDevices implements proto.RingServiceServer
func (s *RingServiceServerImpl) PushWebSocketPacketToDevices(ctx context.Context, req *pb.PushWebSocketPacketToDevicesRequest) (*emptypb.Empty, error) {
log.Info().Msgf("Received PushWebSocketPacketToDevices request for devices %v: %+v", req.GetDeviceIds(), req.GetPacket())
if s.WsManager == nil {
return nil, status.Errorf(codes.Unavailable, "WebSocket manager not initialized")
}
packet := websocket.FromProtoValue(req.GetPacket())
for _, deviceID := range req.GetDeviceIds() {
s.WsManager.SendPacketToDevice(deviceID, packet)
}
return &emptypb.Empty{}, nil
}
// SendPushNotificationToUser implements proto.RingServiceServer
func (s *RingServiceServerImpl) SendPushNotificationToUser(ctx context.Context, req *pb.SendPushNotificationToUserRequest) (*emptypb.Empty, error) {
log.Info().Msgf("Received SendPushNotificationToUser request for user %s: %+v", req.GetUserId(), req.GetNotification())
// 1. Parse incoming notification and save to DB
accountID, err := uuid.Parse(req.GetUserId())
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "invalid account ID: %v", err)
}
notif := &models.Notification{
Topic: req.GetNotification().GetTopic(),
Title: &req.GetNotification().Title,
Content: &req.GetNotification().Body,
AccountId: accountID,
}
if req.GetNotification().Subtitle != "" {
subtitle := req.GetNotification().Subtitle
notif.Subtitle = &subtitle
}
if req.GetNotification().Meta != nil {
var metaMap map[string]any
if err := json.Unmarshal(req.GetNotification().GetMeta(), &metaMap); err != nil {
log.Warn().Err(err).Msg("Failed to unmarshal notification meta, sending without it")
} else {
notif.Meta = metaMap
}
}
if err := infra.Db.WithContext(ctx).Create(notif).Error; err != nil {
log.Error().Err(err).Msg("Failed to save notification to database")
return nil, status.Errorf(codes.Internal, "failed to save notification: %v", err)
}
log.Info().Msgf("Notification saved to DB: %s", notif.Id.String())
// 2. Retrieve push subscriptions for the user
var subscriptions []models.NotificationPushSubscription
if err := infra.Db.WithContext(ctx).Where("account_id = ?", req.GetUserId()).Find(&subscriptions).Error; err != nil {
log.Error().Err(err).Msgf("Failed to retrieve subscriptions for account %s", req.GetUserId())
return nil, status.Errorf(codes.Internal, "failed to retrieve subscriptions: %v", err)
}
if len(subscriptions) == 0 {
log.Info().Msgf("No active push subscriptions found for user %s", req.GetUserId())
return &emptypb.Empty{}, nil
}
// 3. Send notification to each subscription
for _, sub := range subscriptions {
sub := sub // Create a local copy for the goroutine
go func() {
if err := sendPushNotification(ctx, notif, &sub); err != nil {
log.Error().Err(err).Msgf("Failed to send push notification to device %s", sub.DeviceId)
}
}()
}
return &emptypb.Empty{}, nil
}
// SendPushNotificationToUsers implements proto.RingServiceServer
func (s *RingServiceServerImpl) SendPushNotificationToUsers(ctx context.Context, req *pb.SendPushNotificationToUsersRequest) (*emptypb.Empty, error) {
log.Info().Msgf("Received SendPushNotificationToUsers request for users %v: %+v", req.GetUserIds(), req.GetNotification())
// 1. Parse incoming notification (one notification for all users)
// We'll create separate DB entries for each user if needed, or link to a single notification.
// For simplicity, let's assume we save one notification per user for now.
// A better approach for many users might be a single notification record linked to multiple user-notification bridges.
// Extract common notification details
notificationProto := req.GetNotification()
metaMap := make(map[string]any)
if notificationProto.Meta != nil {
if err := json.Unmarshal(notificationProto.GetMeta(), &metaMap); err != nil {
log.Warn().Err(err).Msg("Failed to unmarshal notification meta for batch, sending without it")
}
}
for _, userID := range req.GetUserIds() {
accountID, err := uuid.Parse(userID)
if err != nil {
log.Warn().Err(err).Msgf("Invalid account ID in batch: %s, skipping", userID)
continue
}
notif := &models.Notification{
Topic: notificationProto.GetTopic(),
Title: &notificationProto.Title,
Content: &notificationProto.Body,
Meta: metaMap,
AccountId: accountID,
}
if notificationProto.Subtitle != "" {
subtitle := notificationProto.Subtitle
notif.Subtitle = &subtitle
}
if err := infra.Db.WithContext(ctx).Create(notif).Error; err != nil {
log.Error().Err(err).Msgf("Failed to save notification to database for user %s: %v", userID, err)
continue
}
log.Info().Msgf("Notification saved to DB for user %s: %s", userID, notif.Id.String())
// Retrieve push subscriptions for the current user
var subscriptions []models.NotificationPushSubscription
if err := infra.Db.WithContext(ctx).Where("account_id = ?", userID).Find(&subscriptions).Error; err != nil {
log.Error().Err(err).Msgf("Failed to retrieve subscriptions for account %s in batch: %v", userID, err)
continue
}
if len(subscriptions) == 0 {
log.Info().Msgf("No active push subscriptions found for user %s in batch", userID)
continue
}
// Send notification to each subscription for the current user
for _, sub := range subscriptions {
sub := sub // Create a local copy for the goroutine
go func() {
if err := sendPushNotification(ctx, notif, &sub); err != nil {
log.Error().Err(err).Msgf("Failed to send push notification to device %s for user %s", sub.DeviceId, userID)
}
}()
}
}
return &emptypb.Empty{}, nil
}
// UnsubscribePushNotifications implements proto.RingServiceServer
func (s *RingServiceServerImpl) UnsubscribePushNotifications(ctx context.Context, req *pb.UnsubscribePushNotificationsRequest) (*emptypb.Empty, error) {
log.Info().Msgf("Received UnsubscribePushNotifications request for device %s", req.GetDeviceId())
if req.GetDeviceId() == "" {
return nil, status.Errorf(codes.InvalidArgument, "device_id cannot be empty")
}
result := infra.Db.WithContext(ctx).Where("device_id = ?", req.GetDeviceId()).Delete(&models.NotificationPushSubscription{})
if result.Error != nil {
log.Error().Err(result.Error).Msgf("Failed to unsubscribe device %s", req.GetDeviceId())
return nil, status.Errorf(codes.Internal, "failed to unsubscribe: %v", result.Error)
}
if result.RowsAffected == 0 {
log.Info().Msgf("No subscription found for device %s to unsubscribe", req.GetDeviceId())
} else {
log.Info().Msgf("Successfully unsubscribed device %s", req.GetDeviceId())
}
return &emptypb.Empty{}, nil
}
// GetWebsocketConnectionStatus implements proto.RingServiceServer
func (s *RingServiceServerImpl) GetWebsocketConnectionStatus(ctx context.Context, req *pb.GetWebsocketConnectionStatusRequest) (*pb.GetWebsocketConnectionStatusResponse, error) {
log.Info().Msgf("Received GetWebsocketConnectionStatus request: %+v", req)
if s.WsManager == nil {
return nil, status.Errorf(codes.Unavailable, "WebSocket manager not initialized")
}
isConnected := false
switch id := req.GetId().(type) {
case *pb.GetWebsocketConnectionStatusRequest_DeviceId:
isConnected = s.WsManager.GetDeviceIsConnected(id.DeviceId)
case *pb.GetWebsocketConnectionStatusRequest_UserId:
accountID, err := uuid.Parse(id.UserId)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "invalid user ID: %v", err)
}
isConnected = s.WsManager.GetAccountIsConnected(accountID)
default:
return nil, status.Errorf(codes.InvalidArgument, "either device_id or user_id must be provided")
}
return &pb.GetWebsocketConnectionStatusResponse{IsConnected: isConnected}, nil
}
// GetWebsocketConnectionStatusBatch implements proto.RingServiceServer
func (s *RingServiceServerImpl) GetWebsocketConnectionStatusBatch(ctx context.Context, req *pb.GetWebsocketConnectionStatusBatchRequest) (*pb.GetWebsocketConnectionStatusBatchResponse, error) {
log.Info().Msgf("Received GetWebsocketConnectionStatusBatch request: %+v", req)
if s.WsManager == nil {
return nil, status.Errorf(codes.Unavailable, "WebSocket manager not initialized")
}
response := &pb.GetWebsocketConnectionStatusBatchResponse{
IsConnected: make(map[string]bool),
}
for _, userID := range req.GetUsersId() {
accountID, err := uuid.Parse(userID)
if err != nil {
log.Warn().Err(err).Msgf("Invalid user ID in batch: %s, skipping", userID)
response.IsConnected[userID] = false // Indicate connection status as false for invalid IDs
continue
}
response.IsConnected[userID] = s.WsManager.GetAccountIsConnected(accountID)
}
return response, nil
}
// ReceiveWebSocketPacket implements proto.RingHandlerServiceServer
func (s *RingServiceServerImpl) ReceiveWebSocketPacket(ctx context.Context, req *pb.ReceiveWebSocketPacketRequest) (*emptypb.Empty, error) {
log.Info().Msgf("Received ReceiveWebSocketPacket request: %+v", req)
if s.WsManager == nil {
return nil, status.Errorf(codes.Unavailable, "WebSocket manager not initialized")
}
packet := websocket.FromProtoValue(req.GetPacket())
// The C# HandlePacket expects current user and device ID.
// For this gRPC endpoint, we can use the account and device_id from the request.
if req.GetAccount() == nil || req.GetAccount().GetId() == "" {
return nil, status.Errorf(codes.InvalidArgument, "account information missing in request")
}
if req.GetDeviceId() == "" {
return nil, status.Errorf(codes.InvalidArgument, "device_id missing in request")
}
// Assuming the request comes from a trusted source, we can use the provided account.
// We don't have a direct *websocket.Conn here, so we can't send error responses back on a direct WebSocket.
// Errors will be logged and returned as gRPC errors.
err := s.WsManager.HandlePacket(req.GetAccount(), req.GetDeviceId(), packet, nil) // Pass nil for *websocket.Conn
if err != nil {
log.Error().Err(err).Msg("Failed to handle received WebSocket packet via gRPC")
return nil, status.Errorf(codes.Internal, "failed to process packet: %v", err)
}
return &emptypb.Empty{}, nil
}

View File

@@ -0,0 +1,144 @@
package websocket
import (
"fmt"
"github.com/gofiber/contrib/v3/websocket"
"github.com/google/uuid"
"github.com/rs/zerolog/log"
"github.com/samber/lo"
pb "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen"
)
// WebSocketController handles the WebSocket endpoint.
type WebSocketController struct {
Manager *Manager
}
// NewWebSocketController creates a new WebSocketController.
func NewWebSocketController(manager *Manager) *WebSocketController {
return &WebSocketController{
Manager: manager,
}
}
// HandleWebSocket is the main handler for the /ws endpoint.
func (wc *WebSocketController) HandleWebSocket(c *websocket.Conn) {
// Mock Authentication for now based on C# example
// In a real scenario, this would involve JWT verification, session lookup, etc.
// For demonstration, we'll assume a dummy user and session.
// The C# code uses HttpContext.Items to get CurrentUser and CurrentSession.
// In Go Fiber, we can pass this through Locals or use middleware to set it up.
// For now, let's create a dummy user and session.
// TODO: Replace with actual authentication logic
// For now, assume a dummy account and session
// Based on the C# code, CurrentUser and CurrentSession are pb.Account and pb.AuthSession
dummyAccount := &pb.Account{
Id: uuid.New().String(),
Name: "dummy_user",
Nick: "Dummy User",
}
dummySession := &pb.AuthSession{
ClientId: lo.ToPtr(uuid.New().String()), // This is used as deviceId if not present
}
// Device ID handling
deviceAlt := c.Query("deviceAlt")
if deviceAlt != "" {
allowedDeviceAlternative := []string{"watch"} // Hardcoded for now
found := false
for _, alt := range allowedDeviceAlternative {
if deviceAlt == alt {
found = true
break
}
}
if !found {
log.Warn().Msgf("Unsupported device alternative: %s", deviceAlt)
bytes, _ := newErrorPacket("Unsupported device alternative: " + deviceAlt).ToBytes()
c.WriteMessage(websocket.BinaryMessage, bytes)
c.Close()
return
}
}
accountID := uuid.MustParse(dummyAccount.Id)
deviceIDStr := ""
if dummySession.ClientId == nil {
deviceIDStr = uuid.New().String()
} else {
deviceIDStr = *dummySession.ClientId
}
if deviceAlt != "" {
deviceIDStr = fmt.Sprintf("%s+%s", deviceIDStr, deviceAlt)
}
// Setup connection context for cancellation
cancel := func() {} // Placeholder
connectionKey := ConnectionKey{AccountID: accountID, DeviceID: deviceIDStr}
// Add connection to manager
if !wc.Manager.TryAdd(connectionKey, c, cancel) {
bytes, _ := newErrorPacket("Too many connections from the same device and account.").ToBytes()
c.WriteMessage(websocket.BinaryMessage, bytes)
c.Close()
return
}
log.Debug().Msgf("Connection established with user @%s#%s and device #%s", dummyAccount.Name, dummyAccount.Id, deviceIDStr)
// Publish WebSocket connected event
wc.Manager.PublishWebSocketConnectedEvent(accountID, deviceIDStr, false) // isOffline is false on connection
defer func() {
wc.Manager.Disconnect(connectionKey, "Client disconnected.")
// Publish WebSocket disconnected event
isOffline := !wc.Manager.GetAccountIsConnected(accountID) // Check if account is completely offline
wc.Manager.PublishWebSocketDisconnectedEvent(accountID, deviceIDStr, isOffline)
log.Debug().Msgf("Connection disconnected with user @%s#%s and device #%s", dummyAccount.Name, dummyAccount.Id, deviceIDStr)
}()
// Main event loop
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Error().Err(err).Msg("WebSocket read error")
break
}
if mt == websocket.CloseMessage {
log.Info().Msg("Received close message from client")
break
}
if mt != websocket.BinaryMessage {
log.Warn().Msgf("Received non-binary message type: %d", mt)
continue
}
packet, err := FromBytes(msg)
if err != nil {
log.Error().Err(err).Msg("Failed to deserialize WebSocket packet")
bytes, _ := newErrorPacket("Failed to deserialize packet").ToBytes()
c.WriteMessage(websocket.BinaryMessage, bytes)
continue
}
if err := wc.Manager.HandlePacket(dummyAccount, deviceIDStr, packet, c); err != nil {
log.Error().Err(err).Msg("Failed to handle incoming WebSocket packet")
bytes, _ := newErrorPacket("Failed to process packet").ToBytes()
c.WriteMessage(websocket.BinaryMessage, bytes)
// Depending on error, might want to close connection
}
}
}
// newErrorPacket creates a new WebSocketPacket with an error type.
func newErrorPacket(message string) *WebSocketPacket {
return &WebSocketPacket{
Type: WebSocketPacketTypeError,
ErrorMessage: message,
}
}

View File

@@ -0,0 +1,292 @@
package websocket
import (
"context"
"fmt"
"sync"
"github.com/gofiber/contrib/v3/websocket"
"github.com/google/uuid"
"github.com/nats-io/nats.go"
"github.com/rs/zerolog/log"
"google.golang.org/protobuf/proto" // Import for proto.Marshal
"google.golang.org/protobuf/types/known/wrapperspb"
pb "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen"
)
// ConnectionKey represents the unique identifier for a WebSocket connection.
type ConnectionKey struct {
AccountID uuid.UUID
DeviceID string
}
// ConnectionState holds the WebSocket connection and its cancellation context.
type ConnectionState struct {
Conn *websocket.Conn
Cancel context.CancelFunc
}
// Manager manages active WebSocket connections.
type Manager struct {
connections sync.Map // Map[ConnectionKey]*ConnectionState
natsClient *nats.Conn
}
// NewManager creates a new WebSocket Manager.
func NewManager(natsClient *nats.Conn) *Manager {
return &Manager{
natsClient: natsClient,
}
}
// TryAdd attempts to add a new connection. If a connection with the same key exists,
// it disconnects the old one and then adds the new one.
func (m *Manager) TryAdd(key ConnectionKey, conn *websocket.Conn, cancel context.CancelFunc) bool {
// Disconnect existing connection with the same identifier, if any
if _, loaded := m.connections.Load(key); loaded {
log.Warn().Msgf("Duplicate connection detected for %s:%s. Disconnecting old one.", key.AccountID, key.DeviceID)
m.Disconnect(key, "Just connected somewhere else with the same identifier.")
}
m.connections.Store(key, &ConnectionState{Conn: conn, Cancel: cancel})
log.Info().Msgf("Connection established for user %s and device %s", key.AccountID, key.DeviceID)
return true
}
// Disconnect removes a connection and closes it.
func (m *Manager) Disconnect(key ConnectionKey, reason string) {
if stateAny, loaded := m.connections.LoadAndDelete(key); loaded {
state := stateAny.(ConnectionState)
// Cancel the context to stop any goroutines associated with this connection
if state.Cancel != nil {
state.Cancel()
}
// Close the WebSocket connection
err := state.Conn.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, reason))
if err != nil {
log.Error().Err(err).Msgf("Error sending close message to WebSocket for %s:%s", key.AccountID, key.DeviceID)
}
err = state.Conn.Close() // Ensure the connection is closed
if err != nil {
log.Error().Err(err).Msgf("Error closing WebSocket for %s:%s", key.AccountID, key.DeviceID)
}
log.Info().Msgf("Connection disconnected for user %s and device %s. Reason: %s", key.AccountID, key.DeviceID, reason)
}
}
// GetDeviceIsConnected checks if any connection exists for a given device ID.
func (m *Manager) GetDeviceIsConnected(deviceID string) bool {
var isConnected bool
m.connections.Range(func(k, v interface{}) bool {
connKey := k.(ConnectionKey)
if connKey.DeviceID == deviceID {
isConnected = true
return false // Stop iteration
}
return true
})
return isConnected
}
// GetAccountIsConnected checks if any connection exists for a given account ID.
func (m *Manager) GetAccountIsConnected(accountID uuid.UUID) bool {
var isConnected bool
m.connections.Range(func(k, v interface{}) bool {
connKey := k.(ConnectionKey)
if connKey.AccountID == accountID {
isConnected = true
return false // Stop iteration
}
return true
})
return isConnected
}
// SendPacketToAccount sends a WebSocketPacket to all connections for a given account ID.
func (m *Manager) SendPacketToAccount(accountID uuid.UUID, packet *WebSocketPacket) {
packetBytes, err := packet.ToBytes()
if err != nil {
log.Error().Err(err).Msgf("Failed to marshal packet for account %s", accountID)
return
}
m.connections.Range(func(k, v interface{}) bool {
connKey := k.(ConnectionKey)
if connKey.AccountID == accountID {
state := v.(*ConnectionState)
if state.Conn != nil {
err := state.Conn.WriteMessage(websocket.BinaryMessage, packetBytes)
if err != nil {
log.Error().Err(err).Msgf("Failed to send packet to account %s, device %s", accountID, connKey.DeviceID)
// Optionally, disconnect this problematic connection
// m.Disconnect(connKey, "Failed to send packet")
}
}
}
return true
})
}
// SendPacketToDevice sends a WebSocketPacket to all connections for a given device ID.
func (m *Manager) SendPacketToDevice(deviceID string, packet *WebSocketPacket) {
packetBytes, err := packet.ToBytes()
if err != nil {
log.Error().Err(err).Msgf("Failed to marshal packet for device %s", deviceID)
return
}
m.connections.Range(func(k, v interface{}) bool {
connKey := k.(ConnectionKey)
if connKey.DeviceID == deviceID {
state := v.(*ConnectionState)
if state.Conn != nil {
err := state.Conn.WriteMessage(websocket.BinaryMessage, packetBytes)
if err != nil {
log.Error().Err(err).Msgf("Failed to send packet to device %s, account %s", deviceID, connKey.AccountID)
// Optionally, disconnect this problematic connection
// m.Disconnect(connKey, "Failed to send packet")
}
}
}
return true
})
}
// PublishWebSocketConnectedEvent publishes a WebSocketConnectedEvent to NATS.
func (m *Manager) PublishWebSocketConnectedEvent(accountID uuid.UUID, deviceID string, isOffline bool) {
if m.natsClient == nil {
log.Warn().Msg("NATS client not initialized. Cannot publish WebSocketConnectedEvent.")
return
}
event := &pb.WebSocketConnectedEvent{
AccountId: wrapperspb.String(accountID.String()),
DeviceId: deviceID,
IsOffline: isOffline,
}
eventBytes, err := proto.Marshal(event)
if err != nil {
log.Error().Err(err).Msg("Failed to marshal WebSocketConnectedEvent")
return
}
// Assuming WebSocketConnectedEvent.Type is a constant or can be derived
// For now, let's use a hardcoded subject. This needs to be consistent with C# code.
// C# uses `WebSocketConnectedEvent.Type`
// TODO: Define NATS subjects in a centralized place or derive from proto events.
natsSubject := "turbine.websocket.connected"
err = m.natsClient.Publish(natsSubject, eventBytes)
if err != nil {
log.Error().Err(err).Msg("Failed to publish WebSocketConnectedEvent to NATS")
} else {
log.Info().Msgf("Published WebSocketConnectedEvent for %s:%s to NATS subject %s", accountID, deviceID, natsSubject)
}
}
// PublishWebSocketDisconnectedEvent publishes a WebSocketDisconnectedEvent to NATS.
func (m *Manager) PublishWebSocketDisconnectedEvent(accountID uuid.UUID, deviceID string, isOffline bool) {
if m.natsClient == nil {
log.Warn().Msg("NATS client not initialized. Cannot publish WebSocketDisconnectedEvent.")
return
}
event := &pb.WebSocketDisconnectedEvent{
AccountId: wrapperspb.String(accountID.String()),
DeviceId: deviceID,
IsOffline: isOffline,
}
eventBytes, err := proto.Marshal(event)
if err != nil {
log.Error().Err(err).Msg("Failed to marshal WebSocketDisconnectedEvent")
return
}
// Assuming WebSocketDisconnectedEvent.Type is a constant or can be derived
natsSubject := "turbine.websocket.disconnected"
err = m.natsClient.Publish(natsSubject, eventBytes)
if err != nil {
log.Error().Err(err).Msg("Failed to publish WebSocketDisconnectedEvent to NATS")
} else {
log.Info().Msgf("Published WebSocketDisconnectedEvent for %s:%s to NATS subject %s", accountID, deviceID, natsSubject)
}
}
// HandlePacket processes incoming WebSocketPacket.
func (m *Manager) HandlePacket(currentUser *pb.Account, deviceID string, packet *WebSocketPacket, conn *websocket.Conn) error {
switch packet.Type {
case WebSocketPacketTypePing:
pongPacket := &WebSocketPacket{Type: WebSocketPacketTypePong}
pongBytes, err := pongPacket.ToBytes()
if err != nil {
log.Error().Err(err).Msg("Failed to marshal pong packet")
return err
}
return conn.WriteMessage(websocket.BinaryMessage, pongBytes)
case WebSocketPacketTypeError:
log.Error().Msgf("Received error packet from device %s: %s", deviceID, packet.ErrorMessage)
return nil // Or handle error appropriately
default:
if packet.Endpoint != "" {
return m.forwardPacketToNATS(currentUser, deviceID, packet)
} else {
errorPacket := &WebSocketPacket{
Type: WebSocketPacketTypeError,
ErrorMessage: fmt.Sprintf("Unprocessable packet: %s", packet.Type),
}
errorBytes, err := errorPacket.ToBytes()
if err != nil {
log.Error().Err(err).Msg("Failed to marshal error packet")
return err
}
return conn.WriteMessage(websocket.BinaryMessage, errorBytes)
}
}
}
func (m *Manager) forwardPacketToNATS(currentUser *pb.Account, deviceID string, packet *WebSocketPacket) error {
if m.natsClient == nil {
log.Warn().Msg("NATS client not initialized. Cannot forward packets to NATS.")
return fmt.Errorf("NATS client not initialized")
}
packetBytes, err := packet.ToBytes()
if err != nil {
log.Error().Err(err).Msg("Failed to marshal WebSocketPacket for NATS forwarding")
return err
}
// Convert currentUser.Id to string for the proto message
var accountIDStr string
if currentUser != nil && currentUser.Id != "" {
accountIDStr = currentUser.Id
} else {
log.Warn().Msg("CurrentUser or CurrentUser.Id is nil/empty for NATS forwarding")
return fmt.Errorf("current user ID is missing")
}
event := &pb.WebSocketPacketEvent{
AccountId: wrapperspb.String(accountIDStr),
DeviceId: deviceID,
PacketBytes: packetBytes,
}
eventBytes, err := proto.Marshal(event)
if err != nil {
log.Error().Err(err).Msg("Failed to marshal WebSocketPacketEvent for NATS")
return err
}
// C# uses WebSocketPacketEvent.SubjectPrefix + endpoint
// TODO: Centralize NATS subject definitions
natsSubject := fmt.Sprintf("turbine.websocket.packet.%s", packet.Endpoint)
err = m.natsClient.Publish(natsSubject, eventBytes)
if err != nil {
log.Error().Err(err).Msg("Failed to publish WebSocketPacketEvent to NATS")
return err
}
log.Info().Msgf("Forwarded packet to NATS subject %s from device %s", natsSubject, deviceID)
return nil
}

View File

@@ -0,0 +1,82 @@
package websocket
import (
"encoding/json"
"fmt"
pb "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen"
"google.golang.org/protobuf/types/known/wrapperspb"
)
// WebSocketPacket represents a WebSocket message packet.
type WebSocketPacket struct {
Type string `json:"type"`
Data json.RawMessage `json:"data,omitempty"` // Use json.RawMessage to delay deserialization
Endpoint string `json:"endpoint,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
}
// ToBytes serializes the WebSocketPacket to a byte array for sending over WebSocket.
func (w *WebSocketPacket) ToBytes() ([]byte, error) {
return json.Marshal(w)
}
// FromBytes deserializes a byte array into a WebSocketPacket.
func FromBytes(bytes []byte) (*WebSocketPacket, error) {
var packet WebSocketPacket
err := json.Unmarshal(bytes, &packet)
if err != nil {
return nil, fmt.Errorf("failed to deserialize WebSocketPacket: %w", err)
}
return &packet, nil
}
// GetData deserializes the Data property to the specified type T.
func (w *WebSocketPacket) GetData(v interface{}) error {
if w.Data == nil {
return nil
}
return json.Unmarshal(w.Data, v)
}
// ToProtoValue converts the WebSocketPacket to its protobuf equivalent.
func (w *WebSocketPacket) ToProtoValue() *pb.WebSocketPacket {
var dataBytes []byte
if w.Data != nil {
dataBytes = w.Data
}
var errorMessage string
if w.ErrorMessage != "" {
errorMessage = w.ErrorMessage
}
return &pb.WebSocketPacket{
Type: w.Type,
Data: dataBytes,
ErrorMessage: wrapperspb.String(errorMessage),
}
}
// FromProtoValue converts a protobuf WebSocketPacket to its Go struct equivalent.
func FromProtoValue(packet *pb.WebSocketPacket) *WebSocketPacket {
var data json.RawMessage
if packet.Data != nil {
data = json.RawMessage(packet.Data)
}
var errorMessage string
if packet.ErrorMessage != nil {
errorMessage = packet.ErrorMessage.GetValue()
}
return &WebSocketPacket{
Type: packet.Type,
Data: data,
ErrorMessage: errorMessage,
}
}
// WebSocketPacketType constants from C# example
const (
WebSocketPacketTypePing = "ping"
WebSocketPacketTypePong = "pong"
WebSocketPacketTypeError = "error"
)

14
pkg/shared/models/base.go Normal file
View File

@@ -0,0 +1,14 @@
package models
import (
"time"
"gorm.io/gorm"
)
type Model struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"created_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"created_at"`
}

View File

@@ -0,0 +1,499 @@
syntax = "proto3";
package proto;
option csharp_namespace = "DysonNetwork.Shared.Proto";
option go_package = "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/struct.proto";
import 'file.proto';
import 'wallet.proto';
// Account represents a user account in the system
message Account {
string id = 1;
string name = 2;
string nick = 3;
string language = 4;
string region = 18;
google.protobuf.Timestamp activated_at = 5;
bool is_superuser = 6;
AccountProfile profile = 7;
optional SubscriptionReferenceObject perk_subscription = 16;
repeated AccountContact contacts = 8;
repeated AccountBadge badges = 9;
repeated AccountAuthFactor auth_factors = 10;
repeated AccountConnection connections = 11;
repeated Relationship outgoing_relationships = 12;
repeated Relationship incoming_relationships = 13;
google.protobuf.Timestamp created_at = 14;
google.protobuf.Timestamp updated_at = 15;
google.protobuf.StringValue automated_id = 17;
}
// Enum for status attitude
enum StatusAttitude {
STATUS_ATTITUDE_UNSPECIFIED = 0;
POSITIVE = 1;
NEGATIVE = 2;
NEUTRAL = 3;
}
// AccountStatus represents the status of an account
message AccountStatus {
string id = 1;
StatusAttitude attitude = 2;
bool is_online = 3;
bool is_customized = 4;
bool is_invisible = 5;
bool is_not_disturb = 6;
google.protobuf.StringValue label = 7;
google.protobuf.Timestamp cleared_at = 8;
string account_id = 9;
bytes meta = 10;
}
message UsernameColor {
string type = 1;
google.protobuf.StringValue value = 2;
google.protobuf.StringValue direction = 3;
repeated string colors = 4;
}
message ProfileLink {
string name = 1;
string url = 2;
}
// Profile contains detailed information about a user
message AccountProfile {
string id = 1;
google.protobuf.StringValue first_name = 2;
google.protobuf.StringValue middle_name = 3;
google.protobuf.StringValue last_name = 4;
google.protobuf.StringValue bio = 5;
google.protobuf.StringValue gender = 6;
google.protobuf.StringValue pronouns = 7;
google.protobuf.StringValue time_zone = 8;
google.protobuf.StringValue location = 9;
google.protobuf.Timestamp birthday = 10;
google.protobuf.Timestamp last_seen_at = 11;
VerificationMark verification = 12;
BadgeReferenceObject active_badge = 13;
int32 experience = 14;
int32 level = 15;
double leveling_progress = 16;
double social_credits = 17;
int32 social_credits_level = 18;
CloudFile picture = 19;
CloudFile background = 20;
string account_id = 21;
google.protobuf.Timestamp created_at = 22;
google.protobuf.Timestamp updated_at = 23;
optional UsernameColor username_color = 24;
repeated ProfileLink links = 25;
}
// AccountContact represents a contact method for an account
message AccountContact {
string id = 1;
AccountContactType type = 2;
google.protobuf.Timestamp verified_at = 3;
bool is_primary = 4;
string content = 5;
string account_id = 6;
google.protobuf.Timestamp created_at = 7;
google.protobuf.Timestamp updated_at = 8;
}
// Enum for contact types
enum AccountContactType {
ACCOUNT_CONTACT_TYPE_UNSPECIFIED = 0;
EMAIL = 1;
PHONE_NUMBER = 2;
ADDRESS = 3;
}
// AccountAuthFactor represents an authentication factor for an account
message AccountAuthFactor {
string id = 1;
AccountAuthFactorType type = 2;
google.protobuf.StringValue secret = 3; // Omitted from JSON serialization in original
map<string, google.protobuf.Value> config = 4; // Omitted from JSON serialization in original
int32 trustworthy = 5;
google.protobuf.Timestamp enabled_at = 6;
google.protobuf.Timestamp expired_at = 7;
string account_id = 8;
map<string, google.protobuf.Value> created_response = 9; // For initial setup
google.protobuf.Timestamp created_at = 10;
google.protobuf.Timestamp updated_at = 11;
}
// Enum for authentication factor types
enum AccountAuthFactorType {
AUTH_FACTOR_TYPE_UNSPECIFIED = 0;
PASSWORD = 1;
EMAIL_CODE = 2;
IN_APP_CODE = 3;
TIMED_CODE = 4;
PIN_CODE = 5;
}
// AccountBadge represents a badge associated with an account
message AccountBadge {
string id = 1; // Unique identifier for the badge
string type = 2; // Type/category of the badge
google.protobuf.StringValue label = 3; // Display name of the badge
google.protobuf.StringValue caption = 4; // Optional description of the badge
map<string, google.protobuf.Value> meta = 5; // Additional metadata for the badge
google.protobuf.Timestamp activated_at = 6; // When the badge was activated
google.protobuf.Timestamp expired_at = 7; // Optional expiration time
string account_id = 8; // ID of the account this badge belongs to
google.protobuf.Timestamp created_at = 9;
google.protobuf.Timestamp updated_at = 10;
}
// AccountConnection represents a third-party connection for an account
message AccountConnection {
string id = 1;
string provider = 2;
string provided_identifier = 3;
map<string, google.protobuf.Value> meta = 4;
google.protobuf.StringValue access_token = 5; // Omitted from JSON serialization
google.protobuf.StringValue refresh_token = 6; // Omitted from JSON serialization
google.protobuf.Timestamp last_used_at = 7;
string account_id = 8;
google.protobuf.Timestamp created_at = 9;
google.protobuf.Timestamp updated_at = 10;
}
// VerificationMark represents verification status
message VerificationMark {
VerificationMarkType type = 1;
string title = 2;
string description = 3;
string verified_by = 4;
google.protobuf.Timestamp created_at = 5;
google.protobuf.Timestamp updated_at = 6;
}
enum VerificationMarkType {
VERIFICATION_MARK_TYPE_UNSPECIFIED = 0;
OFFICIAL = 1;
INDIVIDUAL = 2;
ORGANIZATION = 3;
GOVERNMENT = 4;
CREATOR = 5;
DEVELOPER = 6;
PARODY = 7;
}
// BadgeReferenceObject represents a reference to a badge with minimal information
message BadgeReferenceObject {
string id = 1; // Unique identifier for the badge
string type = 2; // Type/category of the badge
google.protobuf.StringValue label = 3; // Display name of the badge
google.protobuf.StringValue caption = 4; // Optional description of the badge
map<string, google.protobuf.Value> meta = 5; // Additional metadata for the badge
google.protobuf.Timestamp activated_at = 6; // When the badge was activated
google.protobuf.Timestamp expired_at = 7; // Optional expiration time
string account_id = 8; // ID of the account this badge belongs to
}
// Relationship represents a connection between two accounts
message Relationship {
string account_id = 1;
string related_id = 2;
optional Account account = 3;
optional Account related = 4;
int32 status = 5;
google.protobuf.Timestamp created_at = 6;
google.protobuf.Timestamp updated_at = 7;
}
// Leveling information
message LevelingInfo {
int32 current_level = 1;
int32 current_experience = 2;
int32 next_level_experience = 3;
int32 previous_level_experience = 4;
double level_progress = 5;
repeated int32 experience_per_level = 6;
}
// ActionLog represents a record of an action taken by a user
message ActionLog {
string id = 1; // Unique identifier for the log entry
string action = 2; // The action that was performed, e.g., "user.login"
map<string, google.protobuf.Value> meta = 3; // Metadata associated with the action
google.protobuf.StringValue user_agent = 4; // User agent of the client
google.protobuf.StringValue ip_address = 5; // IP address of the client
google.protobuf.StringValue location = 6; // Geographic location of the client, derived from IP
string account_id = 7; // The account that performed the action
google.protobuf.StringValue session_id = 8; // The session in which the action was performed
google.protobuf.Timestamp created_at = 9; // When the action log was created
}
message GetAccountStatusBatchResponse {
repeated AccountStatus statuses = 1;
}
// ====================================
// Service Definitions
// ====================================
// AccountService provides CRUD operations for user accounts and related entities
service AccountService {
// Account Operations
rpc GetAccount(GetAccountRequest) returns (Account) {}
rpc GetBotAccount(GetBotAccountRequest) returns (Account) {}
rpc GetAccountBatch(GetAccountBatchRequest) returns (GetAccountBatchResponse) {}
rpc GetBotAccountBatch(GetBotAccountBatchRequest) returns (GetAccountBatchResponse) {}
rpc LookupAccountBatch(LookupAccountBatchRequest) returns (GetAccountBatchResponse) {}
rpc SearchAccount(SearchAccountRequest) returns (GetAccountBatchResponse) {}
rpc ListAccounts(ListAccountsRequest) returns (ListAccountsResponse) {}
rpc GetAccountStatus(GetAccountRequest) returns (AccountStatus) {}
rpc GetAccountStatusBatch(GetAccountBatchRequest) returns (GetAccountStatusBatchResponse) {}
// Profile Operations
rpc GetProfile(GetProfileRequest) returns (AccountProfile) {}
// Contact Operations
rpc ListContacts(ListContactsRequest) returns (ListContactsResponse) {}
// Badge Operations
rpc ListBadges(ListBadgesRequest) returns (ListBadgesResponse) {}
// Authentication Factor Operations
rpc ListAuthFactors(ListAuthFactorsRequest) returns (ListAuthFactorsResponse) {}
// Connection Operations
rpc ListConnections(ListConnectionsRequest) returns (ListConnectionsResponse) {}
// Relationship Operations
rpc ListRelationships(ListRelationshipsRequest) returns (ListRelationshipsResponse) {}
rpc GetRelationship(GetRelationshipRequest) returns (GetRelationshipResponse) {}
rpc HasRelationship(GetRelationshipRequest) returns (google.protobuf.BoolValue) {}
rpc ListFriends(ListRelationshipSimpleRequest) returns (ListRelationshipSimpleResponse) {}
rpc ListBlocked(ListRelationshipSimpleRequest) returns (ListRelationshipSimpleResponse) {}
}
// ActionLogService provides operations for action logs
service ActionLogService {
rpc CreateActionLog(CreateActionLogRequest) returns (CreateActionLogResponse) {}
rpc ListActionLogs(ListActionLogsRequest) returns (ListActionLogsResponse) {}
}
// ====================================
// Request/Response Messages
// ====================================
// ActionLog Requests/Responses
message CreateActionLogRequest {
string action = 1;
map<string, google.protobuf.Value> meta = 2;
google.protobuf.StringValue user_agent = 3;
google.protobuf.StringValue ip_address = 4;
google.protobuf.StringValue location = 5;
string account_id = 6;
google.protobuf.StringValue session_id = 7;
}
message CreateActionLogResponse {
ActionLog action_log = 1;
}
message ListActionLogsRequest {
string account_id = 1;
string action = 2;
int32 page_size = 3;
string page_token = 4;
string order_by = 5;
}
message ListActionLogsResponse {
repeated ActionLog action_logs = 1;
string next_page_token = 2;
int32 total_size = 3;
}
// Account Requests/Responses
message GetAccountRequest {
string id = 1; // Account ID to retrieve
}
message GetBotAccountRequest {
string automated_id = 1;
}
message GetAccountBatchRequest {
repeated string id = 1; // Account ID to retrieve
}
message GetBotAccountBatchRequest {
repeated string automated_id = 1;
}
message LookupAccountBatchRequest {
repeated string names = 1;
}
message SearchAccountRequest {
string query = 1;
}
message GetAccountBatchResponse {
repeated Account accounts = 1; // List of accounts
}
message CreateAccountRequest {
string name = 1; // Required: Unique username
string nick = 2; // Optional: Display name
string language = 3; // Default language
bool is_superuser = 4; // Admin flag
AccountProfile profile = 5; // Initial profile data
}
message UpdateAccountRequest {
string id = 1; // Account ID to update
google.protobuf.StringValue name = 2; // New username if changing
google.protobuf.StringValue nick = 3; // New display name
google.protobuf.StringValue language = 4; // New language
google.protobuf.BoolValue is_superuser = 5; // Admin status
}
message DeleteAccountRequest {
string id = 1; // Account ID to delete
bool purge = 2; // If true, permanently delete instead of soft delete
}
message ListAccountsRequest {
int32 page_size = 1; // Number of results per page
string page_token = 2; // Token for pagination
string filter = 3; // Filter expression
string order_by = 4; // Sort order
}
message ListAccountsResponse {
repeated Account accounts = 1; // List of accounts
string next_page_token = 2; // Token for next page
int32 total_size = 3; // Total number of accounts
}
// Profile Requests/Responses
message GetProfileRequest {
string account_id = 1; // Account ID to get profile for
}
message UpdateProfileRequest {
string account_id = 1; // Account ID to update profile for
AccountProfile profile = 2; // Profile data to update
google.protobuf.FieldMask update_mask = 3; // Fields to update
}
// Contact Requests/Responses
message AddContactRequest {
string account_id = 1; // Account to add contact to
AccountContactType type = 2; // Type of contact
string content = 3; // Contact content (email, phone, etc.)
bool is_primary = 4; // If this should be the primary contact
}
message ListContactsRequest {
string account_id = 1; // Account ID to list contacts for
AccountContactType type = 2; // Optional: filter by type
bool verified_only = 3; // Only return verified contacts
}
message ListContactsResponse {
repeated AccountContact contacts = 1; // List of contacts
}
message VerifyContactRequest {
string id = 1; // Contact ID to verify
string account_id = 2; // Account ID (for validation)
string code = 3; // Verification code
}
// Badge Requests/Responses
message ListBadgesRequest {
string account_id = 1; // Account to list badges for
string type = 2; // Optional: filter by type
bool active_only = 3; // Only return active (non-expired) badges
}
message ListBadgesResponse {
repeated AccountBadge badges = 1; // List of badges
}
message ListAuthFactorsRequest {
string account_id = 1; // Account to list factors for
bool active_only = 2; // Only return active (non-expired) factors
}
message ListAuthFactorsResponse {
repeated AccountAuthFactor factors = 1; // List of auth factors
}
message ListConnectionsRequest {
string account_id = 1; // Account to list connections for
string provider = 2; // Optional: filter by provider
}
message ListConnectionsResponse {
repeated AccountConnection connections = 1; // List of connections
}
// Relationship Requests/Responses
message ListRelationshipsRequest {
string account_id = 1; // Account to list relationships for
optional int32 status = 2; // Filter by status
int32 page_size = 5; // Number of results per page
string page_token = 6; // Token for pagination
}
message ListRelationshipsResponse {
repeated Relationship relationships = 1; // List of relationships
string next_page_token = 2; // Token for next page
int32 total_size = 3; // Total number of relationships
}
message GetRelationshipRequest {
string account_id = 1;
string related_id = 2;
optional int32 status = 3;
}
message GetRelationshipResponse {
optional Relationship relationship = 1;
}
message ListRelationshipSimpleRequest {
string account_id = 1;
}
message ListRelationshipSimpleResponse {
repeated string accounts_id = 1;
}

212
pkg/shared/proto/auth.proto Normal file
View File

@@ -0,0 +1,212 @@
syntax = "proto3";
package proto;
option csharp_namespace = "DysonNetwork.Shared.Proto";
option go_package = "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/struct.proto";
import "account.proto";
// Represents a user session
message AuthSession {
string id = 1;
optional google.protobuf.Timestamp last_granted_at = 3;
optional google.protobuf.Timestamp expired_at = 4;
string account_id = 5;
Account account = 6;
google.protobuf.StringValue app_id = 9;
optional string client_id = 10;
optional string parent_session_id = 11;
AuthClient client = 12;
repeated string audiences = 13;
repeated string scopes = 14;
google.protobuf.StringValue ip_address = 15;
google.protobuf.StringValue user_agent = 16;
SessionType type = 17;
}
// Represents an authentication challenge
message AuthChallenge {
string id = 1;
google.protobuf.Timestamp expired_at = 2;
int32 step_remain = 3;
int32 step_total = 4;
int32 failed_attempts = 5;
repeated string blacklist_factors = 8;
repeated string audiences = 9;
repeated string scopes = 10;
google.protobuf.StringValue ip_address = 11;
google.protobuf.StringValue user_agent = 12;
google.protobuf.StringValue device_id = 13;
google.protobuf.StringValue nonce = 14;
// Point location is omitted as there is no direct proto equivalent.
string account_id = 15;
google.protobuf.StringValue device_name = 16;
ClientPlatform platform = 17;
}
message AuthClient {
string id = 1;
ClientPlatform platform = 2;
google.protobuf.StringValue device_name = 3;
google.protobuf.StringValue device_label = 4;
string device_id = 5;
string account_id = 6;
}
// Enum for challenge types
enum SessionType {
CHALLENGE_TYPE_UNSPECIFIED = 0;
LOGIN = 1;
OAUTH = 2;
OIDC = 3;
}
// Enum for client platforms
enum ClientPlatform {
CLIENT_PLATFORM_UNSPECIFIED = 0;
UNIDENTIFIED = 1;
WEB = 2;
IOS = 3;
ANDROID = 4;
MACOS = 5;
WINDOWS = 6;
LINUX = 7;
}
service AuthService {
rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) {}
rpc ValidatePin(ValidatePinRequest) returns (ValidateResponse) {}
rpc ValidateCaptcha(ValidateCaptchaRequest) returns (ValidateResponse) {}
}
message AuthenticateRequest {
string token = 1;
optional google.protobuf.StringValue ip_address = 2;
}
message AuthenticateResponse {
bool valid = 1;
optional string message = 2;
optional AuthSession session = 3;
}
message ValidatePinRequest {
string account_id = 1;
string pin = 2;
}
message ValidateCaptchaRequest {
string token = 1;
}
message ValidateResponse {
bool valid = 1;
}
enum PermissionNodeActorType {
ACCOUNT = 0;
GROUP = 1;
}
// Permission related messages and services
message PermissionNode {
string id = 1;
string actor = 2;
PermissionNodeActorType type = 3;
string key = 4;
google.protobuf.Value value = 5; // Using Value to represent generic type
google.protobuf.Timestamp expired_at = 6;
google.protobuf.Timestamp affected_at = 7;
string group_id = 8; // Optional group ID
}
message PermissionGroup {
string id = 1;
string name = 2;
google.protobuf.Timestamp created_at = 3;
}
message HasPermissionRequest {
string actor = 1;
string key = 2;
optional PermissionNodeActorType type = 3;
}
message HasPermissionResponse {
bool has_permission = 1;
}
message GetPermissionRequest {
string actor = 1;
optional PermissionNodeActorType type = 2;
string key = 3;
}
message GetPermissionResponse {
google.protobuf.Value value = 1; // Using Value to represent generic type
}
message AddPermissionNodeRequest {
string actor = 1;
optional PermissionNodeActorType type = 2;
string key = 3;
google.protobuf.Value value = 4;
google.protobuf.Timestamp expired_at = 5;
google.protobuf.Timestamp affected_at = 6;
}
message AddPermissionNodeResponse {
PermissionNode node = 1;
}
message AddPermissionNodeToGroupRequest {
PermissionGroup group = 1;
string actor = 2;
optional PermissionNodeActorType type = 3;
string key = 4;
google.protobuf.Value value = 5;
google.protobuf.Timestamp expired_at = 6;
google.protobuf.Timestamp affected_at = 7;
}
message AddPermissionNodeToGroupResponse {
PermissionNode node = 1;
}
message RemovePermissionNodeRequest {
string actor = 1;
optional PermissionNodeActorType type = 2;
string key = 3;
}
message RemovePermissionNodeResponse {
bool success = 1;
}
message RemovePermissionNodeFromGroupRequest {
PermissionGroup group = 1;
string actor = 2;
string key = 4;
}
message RemovePermissionNodeFromGroupResponse {
bool success = 1;
}
service PermissionService {
rpc HasPermission(HasPermissionRequest) returns (HasPermissionResponse) {}
rpc GetPermission(GetPermissionRequest) returns (GetPermissionResponse) {}
rpc AddPermissionNode(AddPermissionNodeRequest) returns (AddPermissionNodeResponse) {}
rpc AddPermissionNodeToGroup(AddPermissionNodeToGroupRequest) returns (AddPermissionNodeToGroupResponse) {}
rpc RemovePermissionNode(RemovePermissionNodeRequest) returns (RemovePermissionNodeResponse) {}
rpc RemovePermissionNodeFromGroup(RemovePermissionNodeFromGroupRequest)
returns (RemovePermissionNodeFromGroupResponse) {}
}

View File

@@ -0,0 +1,187 @@
syntax = "proto3";
package proto;
option csharp_namespace = "DysonNetwork.Shared.Proto";
option go_package = "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "account.proto";
import "file.proto";
message CustomAppOauthConfig {
string client_uri = 1;
repeated string redirect_uris = 2;
repeated string post_logout_redirect_uris = 3;
repeated string allowed_scopes = 4;
repeated string allowed_grant_types = 5;
bool require_pkce = 6;
bool allow_offline_access = 7;
}
message CustomAppLinks {
string home_page = 1;
string privacy_policy = 2;
string terms_of_service = 3;
}
enum CustomAppStatus {
CUSTOM_APP_STATUS_UNSPECIFIED = 0;
DEVELOPING = 1;
STAGING = 2;
PRODUCTION = 3;
SUSPENDED = 4;
}
message CustomApp {
string id = 1;
string slug = 2;
string name = 3;
string description = 4;
CustomAppStatus status = 5;
// jsonb columns represented as bytes
CloudFile picture = 6;
CloudFile background = 7;
VerificationMark verification = 8;
CustomAppLinks links = 9;
CustomAppOauthConfig oauth_config = 13;
string project_id = 10;
google.protobuf.Timestamp created_at = 11;
google.protobuf.Timestamp updated_at = 12;
}
message CustomAppSecret {
string id = 1;
string secret = 2;
string description = 3;
google.protobuf.Timestamp expired_at = 4;
bool is_oidc = 5;
string app_id = 6;
google.protobuf.Timestamp created_at = 7;
google.protobuf.Timestamp updated_at = 8;
}
message GetCustomAppRequest {
oneof Query {
string id = 1;
string slug = 2;
}
}
message GetCustomAppResponse {
CustomApp app = 1;
}
message CheckCustomAppSecretRequest {
oneof SecretIdentifier {
string secret_id = 1;
string app_id = 2;
}
string secret = 3;
optional bool is_oidc = 4;
}
message CheckCustomAppSecretResponse {
bool valid = 1;
}
service CustomAppService {
rpc GetCustomApp(GetCustomAppRequest) returns (GetCustomAppResponse);
rpc CheckCustomAppSecret(CheckCustomAppSecretRequest) returns (CheckCustomAppSecretResponse);
}
// BotAccount represents a bot account in the system
// It extends the base Account with bot-specific fields
message BotAccount {
// Base account information
Account account = 1;
// Bot-specific information
string slug = 2; // Unique identifier for the bot
bool is_active = 3; // Whether the bot is currently active
string automated_id = 5; // The bot ID
// Timestamps
google.protobuf.Timestamp created_at = 6;
google.protobuf.Timestamp updated_at = 7;
}
// Request/Response messages for BotAccount operations
message CreateBotAccountRequest {
Account account = 1;
string automated_id = 2;
google.protobuf.StringValue picture_id = 8;
google.protobuf.StringValue background_id = 9;
}
message CreateBotAccountResponse {
BotAccount bot = 1; // The created bot account
}
message UpdateBotAccountRequest {
string automated_id = 1; // ID of the bot account to update
Account account = 2; // Updated account information
optional string picture_id = 8;
optional string background_id = 9;
}
message UpdateBotAccountResponse {
BotAccount bot = 1; // The updated bot account
}
message DeleteBotAccountRequest {
string automated_id = 1; // ID of the bot account to delete
bool force = 2; // Whether to force delete (bypass soft delete)
}
message DeleteBotAccountResponse {
bool success = 1; // Whether the deletion was successful
}
message ApiKey {
string id = 1;
string label = 2;
string account_id = 3;
string session_id = 4;
google.protobuf.StringValue key = 5;
google.protobuf.Timestamp created_at = 6;
google.protobuf.Timestamp updated_at = 7;
}
message GetApiKeyRequest {
string id = 1;
}
message ListApiKeyRequest {
string automated_id = 1;
}
message GetApiKeyBatchResponse {
repeated ApiKey data = 1;
}
message DeleteApiKeyResponse {
bool success = 1;
}
// This service should be implemented by the Pass service to handle the creation, update, and deletion of bot accounts
service BotAccountReceiverService {
rpc CreateBotAccount(CreateBotAccountRequest) returns (CreateBotAccountResponse);
rpc UpdateBotAccount(UpdateBotAccountRequest) returns (UpdateBotAccountResponse);
rpc DeleteBotAccount(DeleteBotAccountRequest) returns (DeleteBotAccountResponse);
rpc GetApiKey(GetApiKeyRequest) returns (ApiKey);
rpc ListApiKey(ListApiKeyRequest) returns (GetApiKeyBatchResponse);
rpc CreateApiKey(ApiKey) returns (ApiKey);
rpc UpdateApiKey(ApiKey) returns (ApiKey);
rpc RotateApiKey(GetApiKeyRequest) returns (ApiKey);
rpc DeleteApiKey(GetApiKeyRequest) returns (DeleteApiKeyResponse);
}

304
pkg/shared/proto/file.proto Normal file
View File

@@ -0,0 +1,304 @@
syntax = "proto3";
package proto;
option csharp_namespace = "DysonNetwork.Shared.Proto";
option go_package = "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/duration.proto";
// CloudFile represents a reference to a file stored in cloud storage.
// It contains metadata about the file that won't change, helping to reduce database load.
message CloudFile {
// Unique identifier for the file
string id = 1;
// Original name of the file
string name = 2;
// The metadata uses JSON bytes to store to keep the data structure over gRPC
// File metadata (e.g., dimensions, duration, etc.)
bytes file_meta = 3;
// User-defined metadata
bytes user_meta = 4;
optional bytes sensitive_marks = 12;
// MIME type of the file
string mime_type = 5;
// File content hash (e.g., MD5, SHA-256)
string hash = 6;
// File size in bytes
int64 size = 7;
// Indicates if the file is stored with compression
bool has_compression = 8;
// URL to access the file
string url = 9;
// Content type of the file
string content_type = 10;
// When the file was uploaded
google.protobuf.Timestamp uploaded_at = 11;
}
// Service for file operations
service FileService {
// Get file reference by ID
rpc GetFile(GetFileRequest) returns (CloudFile);
rpc GetFileBatch(GetFileBatchRequest) returns (GetFileBatchResponse);
// Update an existing file reference
rpc UpdateFile(UpdateFileRequest) returns (CloudFile);
// Delete a file reference
rpc DeleteFile(DeleteFileRequest) returns (google.protobuf.Empty);
// Load files from references
rpc LoadFromReference(LoadFromReferenceRequest) returns (LoadFromReferenceResponse);
// Check if a file is referenced by any resource
rpc IsReferenced(IsReferencedRequest) returns (IsReferencedResponse);
// Purge cache for a file
rpc PurgeCache(PurgeCacheRequest) returns (google.protobuf.Empty);
}
// Request message for GetFile
message GetFileRequest {
string id = 1;
}
message GetFileBatchRequest {
repeated string ids = 1;
}
message GetFileBatchResponse {
repeated CloudFile files = 1;
}
// Request message for UpdateFile
message UpdateFileRequest {
CloudFile file = 1;
google.protobuf.FieldMask update_mask = 2;
}
message FileMetadata {
string file_id = 1;
string file_name = 2;
string content_type = 3;
string account_id = 4;
}
message UploadMetadata {
string file_id = 1;
string target_remote = 2;
string suffix = 3;
string content_type = 4;
}
message DeleteFileRequest {
string id = 1;
bool purge = 2;
}
message LoadFromReferenceRequest {
repeated string reference_ids = 1;
}
message LoadFromReferenceResponse {
repeated CloudFile files = 1;
}
message GetReferenceCountRequest {
string file_id = 1;
}
message GetReferenceCountResponse {
int32 count = 1;
}
message IsReferencedRequest {
string file_id = 1;
}
message IsReferencedResponse {
bool is_referenced = 1;
}
message PurgeCacheRequest {
string file_id = 1;
}
// CloudFileReference represents a reference to a CloudFile with additional metadata
// about its usage in the system.
message CloudFileReference {
// Unique identifier for the reference
string id = 1;
// Reference to the actual file
string file_id = 2;
// The actual file data (optional, can be populated when needed)
CloudFile file = 3;
// Description of how this file is being used
string usage = 4;
// ID of the resource that this file is associated with
string resource_id = 5;
// Optional expiration timestamp for the reference
google.protobuf.Timestamp expired_at = 6;
}
// Request/Response messages for FileReferenceService
message CreateReferenceRequest {
string file_id = 1;
string usage = 2;
string resource_id = 3;
optional google.protobuf.Timestamp expired_at = 4;
optional google.protobuf.Duration duration = 5; // Alternative to expired_at
}
message CreateReferenceBatchRequest {
repeated string files_id = 1;
string usage = 2;
string resource_id = 3;
optional google.protobuf.Timestamp expired_at = 4;
optional google.protobuf.Duration duration = 5; // Alternative to expired_at
}
message CreateReferenceBatchResponse {
repeated CloudFileReference references = 1;
}
message GetReferencesRequest {
string file_id = 1;
}
message GetReferencesResponse {
repeated CloudFileReference references = 1;
}
message GetResourceReferencesRequest {
string resource_id = 1;
string usage = 2; // Optional
}
message GetResourceFilesRequest {
string resource_id = 1;
optional string usage = 2;
}
message GetResourceFilesResponse {
repeated CloudFile files = 1;
}
message DeleteResourceReferencesRequest {
string resource_id = 1;
optional string usage = 2;
}
message DeleteResourceReferencesBatchRequest {
repeated string resource_ids = 1;
optional string usage = 2;
}
message DeleteResourceReferencesResponse {
int32 deleted_count = 1;
}
message DeleteReferenceRequest {
string reference_id = 1;
}
message DeleteReferenceResponse {
bool success = 1;
}
message UpdateResourceFilesRequest {
string resource_id = 1;
repeated string file_ids = 2;
string usage = 3;
google.protobuf.Timestamp expired_at = 4;
google.protobuf.Duration duration = 5; // Alternative to expired_at
}
message UpdateResourceFilesResponse {
repeated CloudFileReference references = 1;
}
message SetReferenceExpirationRequest {
string reference_id = 1;
google.protobuf.Timestamp expired_at = 2;
google.protobuf.Duration duration = 3; // Alternative to expired_at
}
message SetReferenceExpirationResponse {
bool success = 1;
}
message SetFileReferencesExpirationRequest {
string file_id = 1;
google.protobuf.Timestamp expired_at = 2;
}
message SetFileReferencesExpirationResponse {
int32 updated_count = 1;
}
message HasFileReferencesRequest {
string file_id = 1;
}
message HasFileReferencesResponse {
bool has_references = 1;
}
// Service for managing file references
service FileReferenceService {
// Creates a new reference to a file for a specific resource
rpc CreateReference(CreateReferenceRequest) returns (CloudFileReference);
rpc CreateReferenceBatch(CreateReferenceBatchRequest) returns (CreateReferenceBatchResponse);
// Gets all references to a file
rpc GetReferences(GetReferencesRequest) returns (GetReferencesResponse);
// Gets the number of references to a file
rpc GetReferenceCount(GetReferenceCountRequest) returns (GetReferenceCountResponse);
// Gets all references for a specific resource and optional usage
rpc GetResourceReferences(GetResourceReferencesRequest) returns (GetReferencesResponse);
// Gets all files referenced by a resource with optional usage filter
rpc GetResourceFiles(GetResourceFilesRequest) returns (GetResourceFilesResponse);
// Deletes references for a specific resource and optional usage
rpc DeleteResourceReferences(DeleteResourceReferencesRequest) returns (DeleteResourceReferencesResponse);
// Deletes references for multiple specific resources and optional usage
rpc DeleteResourceReferencesBatch(DeleteResourceReferencesBatchRequest) returns (DeleteResourceReferencesResponse);
// Deletes a specific file reference
rpc DeleteReference(DeleteReferenceRequest) returns (DeleteReferenceResponse);
// Updates the files referenced by a resource
rpc UpdateResourceFiles(UpdateResourceFilesRequest) returns (UpdateResourceFilesResponse);
// Updates the expiration time for a file reference
rpc SetReferenceExpiration(SetReferenceExpirationRequest) returns (SetReferenceExpirationResponse);
// Updates the expiration time for all references to a file
rpc SetFileReferencesExpiration(SetFileReferencesExpirationRequest) returns (SetFileReferencesExpirationResponse);
// Checks if a file has any references
rpc HasFileReferences(HasFileReferencesRequest) returns (HasFileReferencesResponse);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,968 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.1
// source: account.proto
package gen
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
AccountService_GetAccount_FullMethodName = "/proto.AccountService/GetAccount"
AccountService_GetBotAccount_FullMethodName = "/proto.AccountService/GetBotAccount"
AccountService_GetAccountBatch_FullMethodName = "/proto.AccountService/GetAccountBatch"
AccountService_GetBotAccountBatch_FullMethodName = "/proto.AccountService/GetBotAccountBatch"
AccountService_LookupAccountBatch_FullMethodName = "/proto.AccountService/LookupAccountBatch"
AccountService_SearchAccount_FullMethodName = "/proto.AccountService/SearchAccount"
AccountService_ListAccounts_FullMethodName = "/proto.AccountService/ListAccounts"
AccountService_GetAccountStatus_FullMethodName = "/proto.AccountService/GetAccountStatus"
AccountService_GetAccountStatusBatch_FullMethodName = "/proto.AccountService/GetAccountStatusBatch"
AccountService_GetProfile_FullMethodName = "/proto.AccountService/GetProfile"
AccountService_ListContacts_FullMethodName = "/proto.AccountService/ListContacts"
AccountService_ListBadges_FullMethodName = "/proto.AccountService/ListBadges"
AccountService_ListAuthFactors_FullMethodName = "/proto.AccountService/ListAuthFactors"
AccountService_ListConnections_FullMethodName = "/proto.AccountService/ListConnections"
AccountService_ListRelationships_FullMethodName = "/proto.AccountService/ListRelationships"
AccountService_GetRelationship_FullMethodName = "/proto.AccountService/GetRelationship"
AccountService_HasRelationship_FullMethodName = "/proto.AccountService/HasRelationship"
AccountService_ListFriends_FullMethodName = "/proto.AccountService/ListFriends"
AccountService_ListBlocked_FullMethodName = "/proto.AccountService/ListBlocked"
)
// AccountServiceClient is the client API for AccountService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// AccountService provides CRUD operations for user accounts and related entities
type AccountServiceClient interface {
// Account Operations
GetAccount(ctx context.Context, in *GetAccountRequest, opts ...grpc.CallOption) (*Account, error)
GetBotAccount(ctx context.Context, in *GetBotAccountRequest, opts ...grpc.CallOption) (*Account, error)
GetAccountBatch(ctx context.Context, in *GetAccountBatchRequest, opts ...grpc.CallOption) (*GetAccountBatchResponse, error)
GetBotAccountBatch(ctx context.Context, in *GetBotAccountBatchRequest, opts ...grpc.CallOption) (*GetAccountBatchResponse, error)
LookupAccountBatch(ctx context.Context, in *LookupAccountBatchRequest, opts ...grpc.CallOption) (*GetAccountBatchResponse, error)
SearchAccount(ctx context.Context, in *SearchAccountRequest, opts ...grpc.CallOption) (*GetAccountBatchResponse, error)
ListAccounts(ctx context.Context, in *ListAccountsRequest, opts ...grpc.CallOption) (*ListAccountsResponse, error)
GetAccountStatus(ctx context.Context, in *GetAccountRequest, opts ...grpc.CallOption) (*AccountStatus, error)
GetAccountStatusBatch(ctx context.Context, in *GetAccountBatchRequest, opts ...grpc.CallOption) (*GetAccountStatusBatchResponse, error)
// Profile Operations
GetProfile(ctx context.Context, in *GetProfileRequest, opts ...grpc.CallOption) (*AccountProfile, error)
// Contact Operations
ListContacts(ctx context.Context, in *ListContactsRequest, opts ...grpc.CallOption) (*ListContactsResponse, error)
// Badge Operations
ListBadges(ctx context.Context, in *ListBadgesRequest, opts ...grpc.CallOption) (*ListBadgesResponse, error)
// Authentication Factor Operations
ListAuthFactors(ctx context.Context, in *ListAuthFactorsRequest, opts ...grpc.CallOption) (*ListAuthFactorsResponse, error)
// Connection Operations
ListConnections(ctx context.Context, in *ListConnectionsRequest, opts ...grpc.CallOption) (*ListConnectionsResponse, error)
// Relationship Operations
ListRelationships(ctx context.Context, in *ListRelationshipsRequest, opts ...grpc.CallOption) (*ListRelationshipsResponse, error)
GetRelationship(ctx context.Context, in *GetRelationshipRequest, opts ...grpc.CallOption) (*GetRelationshipResponse, error)
HasRelationship(ctx context.Context, in *GetRelationshipRequest, opts ...grpc.CallOption) (*wrapperspb.BoolValue, error)
ListFriends(ctx context.Context, in *ListRelationshipSimpleRequest, opts ...grpc.CallOption) (*ListRelationshipSimpleResponse, error)
ListBlocked(ctx context.Context, in *ListRelationshipSimpleRequest, opts ...grpc.CallOption) (*ListRelationshipSimpleResponse, error)
}
type accountServiceClient struct {
cc grpc.ClientConnInterface
}
func NewAccountServiceClient(cc grpc.ClientConnInterface) AccountServiceClient {
return &accountServiceClient{cc}
}
func (c *accountServiceClient) GetAccount(ctx context.Context, in *GetAccountRequest, opts ...grpc.CallOption) (*Account, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Account)
err := c.cc.Invoke(ctx, AccountService_GetAccount_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) GetBotAccount(ctx context.Context, in *GetBotAccountRequest, opts ...grpc.CallOption) (*Account, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Account)
err := c.cc.Invoke(ctx, AccountService_GetBotAccount_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) GetAccountBatch(ctx context.Context, in *GetAccountBatchRequest, opts ...grpc.CallOption) (*GetAccountBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetAccountBatchResponse)
err := c.cc.Invoke(ctx, AccountService_GetAccountBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) GetBotAccountBatch(ctx context.Context, in *GetBotAccountBatchRequest, opts ...grpc.CallOption) (*GetAccountBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetAccountBatchResponse)
err := c.cc.Invoke(ctx, AccountService_GetBotAccountBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) LookupAccountBatch(ctx context.Context, in *LookupAccountBatchRequest, opts ...grpc.CallOption) (*GetAccountBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetAccountBatchResponse)
err := c.cc.Invoke(ctx, AccountService_LookupAccountBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) SearchAccount(ctx context.Context, in *SearchAccountRequest, opts ...grpc.CallOption) (*GetAccountBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetAccountBatchResponse)
err := c.cc.Invoke(ctx, AccountService_SearchAccount_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) ListAccounts(ctx context.Context, in *ListAccountsRequest, opts ...grpc.CallOption) (*ListAccountsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListAccountsResponse)
err := c.cc.Invoke(ctx, AccountService_ListAccounts_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) GetAccountStatus(ctx context.Context, in *GetAccountRequest, opts ...grpc.CallOption) (*AccountStatus, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AccountStatus)
err := c.cc.Invoke(ctx, AccountService_GetAccountStatus_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) GetAccountStatusBatch(ctx context.Context, in *GetAccountBatchRequest, opts ...grpc.CallOption) (*GetAccountStatusBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetAccountStatusBatchResponse)
err := c.cc.Invoke(ctx, AccountService_GetAccountStatusBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) GetProfile(ctx context.Context, in *GetProfileRequest, opts ...grpc.CallOption) (*AccountProfile, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AccountProfile)
err := c.cc.Invoke(ctx, AccountService_GetProfile_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) ListContacts(ctx context.Context, in *ListContactsRequest, opts ...grpc.CallOption) (*ListContactsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListContactsResponse)
err := c.cc.Invoke(ctx, AccountService_ListContacts_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) ListBadges(ctx context.Context, in *ListBadgesRequest, opts ...grpc.CallOption) (*ListBadgesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListBadgesResponse)
err := c.cc.Invoke(ctx, AccountService_ListBadges_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) ListAuthFactors(ctx context.Context, in *ListAuthFactorsRequest, opts ...grpc.CallOption) (*ListAuthFactorsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListAuthFactorsResponse)
err := c.cc.Invoke(ctx, AccountService_ListAuthFactors_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) ListConnections(ctx context.Context, in *ListConnectionsRequest, opts ...grpc.CallOption) (*ListConnectionsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListConnectionsResponse)
err := c.cc.Invoke(ctx, AccountService_ListConnections_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) ListRelationships(ctx context.Context, in *ListRelationshipsRequest, opts ...grpc.CallOption) (*ListRelationshipsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListRelationshipsResponse)
err := c.cc.Invoke(ctx, AccountService_ListRelationships_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) GetRelationship(ctx context.Context, in *GetRelationshipRequest, opts ...grpc.CallOption) (*GetRelationshipResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetRelationshipResponse)
err := c.cc.Invoke(ctx, AccountService_GetRelationship_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) HasRelationship(ctx context.Context, in *GetRelationshipRequest, opts ...grpc.CallOption) (*wrapperspb.BoolValue, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(wrapperspb.BoolValue)
err := c.cc.Invoke(ctx, AccountService_HasRelationship_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) ListFriends(ctx context.Context, in *ListRelationshipSimpleRequest, opts ...grpc.CallOption) (*ListRelationshipSimpleResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListRelationshipSimpleResponse)
err := c.cc.Invoke(ctx, AccountService_ListFriends_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *accountServiceClient) ListBlocked(ctx context.Context, in *ListRelationshipSimpleRequest, opts ...grpc.CallOption) (*ListRelationshipSimpleResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListRelationshipSimpleResponse)
err := c.cc.Invoke(ctx, AccountService_ListBlocked_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AccountServiceServer is the server API for AccountService service.
// All implementations must embed UnimplementedAccountServiceServer
// for forward compatibility.
//
// AccountService provides CRUD operations for user accounts and related entities
type AccountServiceServer interface {
// Account Operations
GetAccount(context.Context, *GetAccountRequest) (*Account, error)
GetBotAccount(context.Context, *GetBotAccountRequest) (*Account, error)
GetAccountBatch(context.Context, *GetAccountBatchRequest) (*GetAccountBatchResponse, error)
GetBotAccountBatch(context.Context, *GetBotAccountBatchRequest) (*GetAccountBatchResponse, error)
LookupAccountBatch(context.Context, *LookupAccountBatchRequest) (*GetAccountBatchResponse, error)
SearchAccount(context.Context, *SearchAccountRequest) (*GetAccountBatchResponse, error)
ListAccounts(context.Context, *ListAccountsRequest) (*ListAccountsResponse, error)
GetAccountStatus(context.Context, *GetAccountRequest) (*AccountStatus, error)
GetAccountStatusBatch(context.Context, *GetAccountBatchRequest) (*GetAccountStatusBatchResponse, error)
// Profile Operations
GetProfile(context.Context, *GetProfileRequest) (*AccountProfile, error)
// Contact Operations
ListContacts(context.Context, *ListContactsRequest) (*ListContactsResponse, error)
// Badge Operations
ListBadges(context.Context, *ListBadgesRequest) (*ListBadgesResponse, error)
// Authentication Factor Operations
ListAuthFactors(context.Context, *ListAuthFactorsRequest) (*ListAuthFactorsResponse, error)
// Connection Operations
ListConnections(context.Context, *ListConnectionsRequest) (*ListConnectionsResponse, error)
// Relationship Operations
ListRelationships(context.Context, *ListRelationshipsRequest) (*ListRelationshipsResponse, error)
GetRelationship(context.Context, *GetRelationshipRequest) (*GetRelationshipResponse, error)
HasRelationship(context.Context, *GetRelationshipRequest) (*wrapperspb.BoolValue, error)
ListFriends(context.Context, *ListRelationshipSimpleRequest) (*ListRelationshipSimpleResponse, error)
ListBlocked(context.Context, *ListRelationshipSimpleRequest) (*ListRelationshipSimpleResponse, error)
mustEmbedUnimplementedAccountServiceServer()
}
// UnimplementedAccountServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAccountServiceServer struct{}
func (UnimplementedAccountServiceServer) GetAccount(context.Context, *GetAccountRequest) (*Account, error) {
return nil, status.Error(codes.Unimplemented, "method GetAccount not implemented")
}
func (UnimplementedAccountServiceServer) GetBotAccount(context.Context, *GetBotAccountRequest) (*Account, error) {
return nil, status.Error(codes.Unimplemented, "method GetBotAccount not implemented")
}
func (UnimplementedAccountServiceServer) GetAccountBatch(context.Context, *GetAccountBatchRequest) (*GetAccountBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetAccountBatch not implemented")
}
func (UnimplementedAccountServiceServer) GetBotAccountBatch(context.Context, *GetBotAccountBatchRequest) (*GetAccountBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetBotAccountBatch not implemented")
}
func (UnimplementedAccountServiceServer) LookupAccountBatch(context.Context, *LookupAccountBatchRequest) (*GetAccountBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method LookupAccountBatch not implemented")
}
func (UnimplementedAccountServiceServer) SearchAccount(context.Context, *SearchAccountRequest) (*GetAccountBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SearchAccount not implemented")
}
func (UnimplementedAccountServiceServer) ListAccounts(context.Context, *ListAccountsRequest) (*ListAccountsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListAccounts not implemented")
}
func (UnimplementedAccountServiceServer) GetAccountStatus(context.Context, *GetAccountRequest) (*AccountStatus, error) {
return nil, status.Error(codes.Unimplemented, "method GetAccountStatus not implemented")
}
func (UnimplementedAccountServiceServer) GetAccountStatusBatch(context.Context, *GetAccountBatchRequest) (*GetAccountStatusBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetAccountStatusBatch not implemented")
}
func (UnimplementedAccountServiceServer) GetProfile(context.Context, *GetProfileRequest) (*AccountProfile, error) {
return nil, status.Error(codes.Unimplemented, "method GetProfile not implemented")
}
func (UnimplementedAccountServiceServer) ListContacts(context.Context, *ListContactsRequest) (*ListContactsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListContacts not implemented")
}
func (UnimplementedAccountServiceServer) ListBadges(context.Context, *ListBadgesRequest) (*ListBadgesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListBadges not implemented")
}
func (UnimplementedAccountServiceServer) ListAuthFactors(context.Context, *ListAuthFactorsRequest) (*ListAuthFactorsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListAuthFactors not implemented")
}
func (UnimplementedAccountServiceServer) ListConnections(context.Context, *ListConnectionsRequest) (*ListConnectionsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListConnections not implemented")
}
func (UnimplementedAccountServiceServer) ListRelationships(context.Context, *ListRelationshipsRequest) (*ListRelationshipsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListRelationships not implemented")
}
func (UnimplementedAccountServiceServer) GetRelationship(context.Context, *GetRelationshipRequest) (*GetRelationshipResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetRelationship not implemented")
}
func (UnimplementedAccountServiceServer) HasRelationship(context.Context, *GetRelationshipRequest) (*wrapperspb.BoolValue, error) {
return nil, status.Error(codes.Unimplemented, "method HasRelationship not implemented")
}
func (UnimplementedAccountServiceServer) ListFriends(context.Context, *ListRelationshipSimpleRequest) (*ListRelationshipSimpleResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListFriends not implemented")
}
func (UnimplementedAccountServiceServer) ListBlocked(context.Context, *ListRelationshipSimpleRequest) (*ListRelationshipSimpleResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListBlocked not implemented")
}
func (UnimplementedAccountServiceServer) mustEmbedUnimplementedAccountServiceServer() {}
func (UnimplementedAccountServiceServer) testEmbeddedByValue() {}
// UnsafeAccountServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AccountServiceServer will
// result in compilation errors.
type UnsafeAccountServiceServer interface {
mustEmbedUnimplementedAccountServiceServer()
}
func RegisterAccountServiceServer(s grpc.ServiceRegistrar, srv AccountServiceServer) {
// If the following call panics, it indicates UnimplementedAccountServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&AccountService_ServiceDesc, srv)
}
func _AccountService_GetAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).GetAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_GetAccount_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).GetAccount(ctx, req.(*GetAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_GetBotAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBotAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).GetBotAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_GetBotAccount_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).GetBotAccount(ctx, req.(*GetBotAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_GetAccountBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetAccountBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).GetAccountBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_GetAccountBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).GetAccountBatch(ctx, req.(*GetAccountBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_GetBotAccountBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBotAccountBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).GetBotAccountBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_GetBotAccountBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).GetBotAccountBatch(ctx, req.(*GetBotAccountBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_LookupAccountBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LookupAccountBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).LookupAccountBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_LookupAccountBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).LookupAccountBatch(ctx, req.(*LookupAccountBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_SearchAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SearchAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).SearchAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_SearchAccount_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).SearchAccount(ctx, req.(*SearchAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_ListAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListAccountsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).ListAccounts(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_ListAccounts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).ListAccounts(ctx, req.(*ListAccountsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_GetAccountStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).GetAccountStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_GetAccountStatus_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).GetAccountStatus(ctx, req.(*GetAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_GetAccountStatusBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetAccountBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).GetAccountStatusBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_GetAccountStatusBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).GetAccountStatusBatch(ctx, req.(*GetAccountBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_GetProfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetProfileRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).GetProfile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_GetProfile_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).GetProfile(ctx, req.(*GetProfileRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_ListContacts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListContactsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).ListContacts(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_ListContacts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).ListContacts(ctx, req.(*ListContactsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_ListBadges_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListBadgesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).ListBadges(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_ListBadges_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).ListBadges(ctx, req.(*ListBadgesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_ListAuthFactors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListAuthFactorsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).ListAuthFactors(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_ListAuthFactors_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).ListAuthFactors(ctx, req.(*ListAuthFactorsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_ListConnections_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListConnectionsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).ListConnections(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_ListConnections_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).ListConnections(ctx, req.(*ListConnectionsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_ListRelationships_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListRelationshipsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).ListRelationships(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_ListRelationships_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).ListRelationships(ctx, req.(*ListRelationshipsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_GetRelationship_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetRelationshipRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).GetRelationship(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_GetRelationship_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).GetRelationship(ctx, req.(*GetRelationshipRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_HasRelationship_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetRelationshipRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).HasRelationship(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_HasRelationship_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).HasRelationship(ctx, req.(*GetRelationshipRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_ListFriends_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListRelationshipSimpleRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).ListFriends(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_ListFriends_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).ListFriends(ctx, req.(*ListRelationshipSimpleRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AccountService_ListBlocked_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListRelationshipSimpleRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).ListBlocked(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_ListBlocked_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).ListBlocked(ctx, req.(*ListRelationshipSimpleRequest))
}
return interceptor(ctx, in, info, handler)
}
// AccountService_ServiceDesc is the grpc.ServiceDesc for AccountService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var AccountService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.AccountService",
HandlerType: (*AccountServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetAccount",
Handler: _AccountService_GetAccount_Handler,
},
{
MethodName: "GetBotAccount",
Handler: _AccountService_GetBotAccount_Handler,
},
{
MethodName: "GetAccountBatch",
Handler: _AccountService_GetAccountBatch_Handler,
},
{
MethodName: "GetBotAccountBatch",
Handler: _AccountService_GetBotAccountBatch_Handler,
},
{
MethodName: "LookupAccountBatch",
Handler: _AccountService_LookupAccountBatch_Handler,
},
{
MethodName: "SearchAccount",
Handler: _AccountService_SearchAccount_Handler,
},
{
MethodName: "ListAccounts",
Handler: _AccountService_ListAccounts_Handler,
},
{
MethodName: "GetAccountStatus",
Handler: _AccountService_GetAccountStatus_Handler,
},
{
MethodName: "GetAccountStatusBatch",
Handler: _AccountService_GetAccountStatusBatch_Handler,
},
{
MethodName: "GetProfile",
Handler: _AccountService_GetProfile_Handler,
},
{
MethodName: "ListContacts",
Handler: _AccountService_ListContacts_Handler,
},
{
MethodName: "ListBadges",
Handler: _AccountService_ListBadges_Handler,
},
{
MethodName: "ListAuthFactors",
Handler: _AccountService_ListAuthFactors_Handler,
},
{
MethodName: "ListConnections",
Handler: _AccountService_ListConnections_Handler,
},
{
MethodName: "ListRelationships",
Handler: _AccountService_ListRelationships_Handler,
},
{
MethodName: "GetRelationship",
Handler: _AccountService_GetRelationship_Handler,
},
{
MethodName: "HasRelationship",
Handler: _AccountService_HasRelationship_Handler,
},
{
MethodName: "ListFriends",
Handler: _AccountService_ListFriends_Handler,
},
{
MethodName: "ListBlocked",
Handler: _AccountService_ListBlocked_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "account.proto",
}
const (
ActionLogService_CreateActionLog_FullMethodName = "/proto.ActionLogService/CreateActionLog"
ActionLogService_ListActionLogs_FullMethodName = "/proto.ActionLogService/ListActionLogs"
)
// ActionLogServiceClient is the client API for ActionLogService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// ActionLogService provides operations for action logs
type ActionLogServiceClient interface {
CreateActionLog(ctx context.Context, in *CreateActionLogRequest, opts ...grpc.CallOption) (*CreateActionLogResponse, error)
ListActionLogs(ctx context.Context, in *ListActionLogsRequest, opts ...grpc.CallOption) (*ListActionLogsResponse, error)
}
type actionLogServiceClient struct {
cc grpc.ClientConnInterface
}
func NewActionLogServiceClient(cc grpc.ClientConnInterface) ActionLogServiceClient {
return &actionLogServiceClient{cc}
}
func (c *actionLogServiceClient) CreateActionLog(ctx context.Context, in *CreateActionLogRequest, opts ...grpc.CallOption) (*CreateActionLogResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateActionLogResponse)
err := c.cc.Invoke(ctx, ActionLogService_CreateActionLog_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *actionLogServiceClient) ListActionLogs(ctx context.Context, in *ListActionLogsRequest, opts ...grpc.CallOption) (*ListActionLogsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListActionLogsResponse)
err := c.cc.Invoke(ctx, ActionLogService_ListActionLogs_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ActionLogServiceServer is the server API for ActionLogService service.
// All implementations must embed UnimplementedActionLogServiceServer
// for forward compatibility.
//
// ActionLogService provides operations for action logs
type ActionLogServiceServer interface {
CreateActionLog(context.Context, *CreateActionLogRequest) (*CreateActionLogResponse, error)
ListActionLogs(context.Context, *ListActionLogsRequest) (*ListActionLogsResponse, error)
mustEmbedUnimplementedActionLogServiceServer()
}
// UnimplementedActionLogServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedActionLogServiceServer struct{}
func (UnimplementedActionLogServiceServer) CreateActionLog(context.Context, *CreateActionLogRequest) (*CreateActionLogResponse, error) {
return nil, status.Error(codes.Unimplemented, "method CreateActionLog not implemented")
}
func (UnimplementedActionLogServiceServer) ListActionLogs(context.Context, *ListActionLogsRequest) (*ListActionLogsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListActionLogs not implemented")
}
func (UnimplementedActionLogServiceServer) mustEmbedUnimplementedActionLogServiceServer() {}
func (UnimplementedActionLogServiceServer) testEmbeddedByValue() {}
// UnsafeActionLogServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ActionLogServiceServer will
// result in compilation errors.
type UnsafeActionLogServiceServer interface {
mustEmbedUnimplementedActionLogServiceServer()
}
func RegisterActionLogServiceServer(s grpc.ServiceRegistrar, srv ActionLogServiceServer) {
// If the following call panics, it indicates UnimplementedActionLogServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&ActionLogService_ServiceDesc, srv)
}
func _ActionLogService_CreateActionLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateActionLogRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ActionLogServiceServer).CreateActionLog(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ActionLogService_CreateActionLog_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ActionLogServiceServer).CreateActionLog(ctx, req.(*CreateActionLogRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ActionLogService_ListActionLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListActionLogsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ActionLogServiceServer).ListActionLogs(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ActionLogService_ListActionLogs_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ActionLogServiceServer).ListActionLogs(ctx, req.(*ListActionLogsRequest))
}
return interceptor(ctx, in, info, handler)
}
// ActionLogService_ServiceDesc is the grpc.ServiceDesc for ActionLogService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ActionLogService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.ActionLogService",
HandlerType: (*ActionLogServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateActionLog",
Handler: _ActionLogService_CreateActionLog_Handler,
},
{
MethodName: "ListActionLogs",
Handler: _ActionLogService_ListActionLogs_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "account.proto",
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,489 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.1
// source: auth.proto
package gen
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
AuthService_Authenticate_FullMethodName = "/proto.AuthService/Authenticate"
AuthService_ValidatePin_FullMethodName = "/proto.AuthService/ValidatePin"
AuthService_ValidateCaptcha_FullMethodName = "/proto.AuthService/ValidateCaptcha"
)
// AuthServiceClient is the client API for AuthService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type AuthServiceClient interface {
Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error)
ValidatePin(ctx context.Context, in *ValidatePinRequest, opts ...grpc.CallOption) (*ValidateResponse, error)
ValidateCaptcha(ctx context.Context, in *ValidateCaptchaRequest, opts ...grpc.CallOption) (*ValidateResponse, error)
}
type authServiceClient struct {
cc grpc.ClientConnInterface
}
func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient {
return &authServiceClient{cc}
}
func (c *authServiceClient) Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AuthenticateResponse)
err := c.cc.Invoke(ctx, AuthService_Authenticate_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authServiceClient) ValidatePin(ctx context.Context, in *ValidatePinRequest, opts ...grpc.CallOption) (*ValidateResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ValidateResponse)
err := c.cc.Invoke(ctx, AuthService_ValidatePin_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authServiceClient) ValidateCaptcha(ctx context.Context, in *ValidateCaptchaRequest, opts ...grpc.CallOption) (*ValidateResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ValidateResponse)
err := c.cc.Invoke(ctx, AuthService_ValidateCaptcha_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AuthServiceServer is the server API for AuthService service.
// All implementations must embed UnimplementedAuthServiceServer
// for forward compatibility.
type AuthServiceServer interface {
Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error)
ValidatePin(context.Context, *ValidatePinRequest) (*ValidateResponse, error)
ValidateCaptcha(context.Context, *ValidateCaptchaRequest) (*ValidateResponse, error)
mustEmbedUnimplementedAuthServiceServer()
}
// UnimplementedAuthServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAuthServiceServer struct{}
func (UnimplementedAuthServiceServer) Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error) {
return nil, status.Error(codes.Unimplemented, "method Authenticate not implemented")
}
func (UnimplementedAuthServiceServer) ValidatePin(context.Context, *ValidatePinRequest) (*ValidateResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ValidatePin not implemented")
}
func (UnimplementedAuthServiceServer) ValidateCaptcha(context.Context, *ValidateCaptchaRequest) (*ValidateResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ValidateCaptcha not implemented")
}
func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {}
func (UnimplementedAuthServiceServer) testEmbeddedByValue() {}
// UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AuthServiceServer will
// result in compilation errors.
type UnsafeAuthServiceServer interface {
mustEmbedUnimplementedAuthServiceServer()
}
func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) {
// If the following call panics, it indicates UnimplementedAuthServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&AuthService_ServiceDesc, srv)
}
func _AuthService_Authenticate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AuthenticateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServiceServer).Authenticate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AuthService_Authenticate_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).Authenticate(ctx, req.(*AuthenticateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AuthService_ValidatePin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ValidatePinRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServiceServer).ValidatePin(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AuthService_ValidatePin_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).ValidatePin(ctx, req.(*ValidatePinRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AuthService_ValidateCaptcha_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ValidateCaptchaRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServiceServer).ValidateCaptcha(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AuthService_ValidateCaptcha_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).ValidateCaptcha(ctx, req.(*ValidateCaptchaRequest))
}
return interceptor(ctx, in, info, handler)
}
// AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var AuthService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.AuthService",
HandlerType: (*AuthServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Authenticate",
Handler: _AuthService_Authenticate_Handler,
},
{
MethodName: "ValidatePin",
Handler: _AuthService_ValidatePin_Handler,
},
{
MethodName: "ValidateCaptcha",
Handler: _AuthService_ValidateCaptcha_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "auth.proto",
}
const (
PermissionService_HasPermission_FullMethodName = "/proto.PermissionService/HasPermission"
PermissionService_GetPermission_FullMethodName = "/proto.PermissionService/GetPermission"
PermissionService_AddPermissionNode_FullMethodName = "/proto.PermissionService/AddPermissionNode"
PermissionService_AddPermissionNodeToGroup_FullMethodName = "/proto.PermissionService/AddPermissionNodeToGroup"
PermissionService_RemovePermissionNode_FullMethodName = "/proto.PermissionService/RemovePermissionNode"
PermissionService_RemovePermissionNodeFromGroup_FullMethodName = "/proto.PermissionService/RemovePermissionNodeFromGroup"
)
// PermissionServiceClient is the client API for PermissionService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PermissionServiceClient interface {
HasPermission(ctx context.Context, in *HasPermissionRequest, opts ...grpc.CallOption) (*HasPermissionResponse, error)
GetPermission(ctx context.Context, in *GetPermissionRequest, opts ...grpc.CallOption) (*GetPermissionResponse, error)
AddPermissionNode(ctx context.Context, in *AddPermissionNodeRequest, opts ...grpc.CallOption) (*AddPermissionNodeResponse, error)
AddPermissionNodeToGroup(ctx context.Context, in *AddPermissionNodeToGroupRequest, opts ...grpc.CallOption) (*AddPermissionNodeToGroupResponse, error)
RemovePermissionNode(ctx context.Context, in *RemovePermissionNodeRequest, opts ...grpc.CallOption) (*RemovePermissionNodeResponse, error)
RemovePermissionNodeFromGroup(ctx context.Context, in *RemovePermissionNodeFromGroupRequest, opts ...grpc.CallOption) (*RemovePermissionNodeFromGroupResponse, error)
}
type permissionServiceClient struct {
cc grpc.ClientConnInterface
}
func NewPermissionServiceClient(cc grpc.ClientConnInterface) PermissionServiceClient {
return &permissionServiceClient{cc}
}
func (c *permissionServiceClient) HasPermission(ctx context.Context, in *HasPermissionRequest, opts ...grpc.CallOption) (*HasPermissionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(HasPermissionResponse)
err := c.cc.Invoke(ctx, PermissionService_HasPermission_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *permissionServiceClient) GetPermission(ctx context.Context, in *GetPermissionRequest, opts ...grpc.CallOption) (*GetPermissionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetPermissionResponse)
err := c.cc.Invoke(ctx, PermissionService_GetPermission_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *permissionServiceClient) AddPermissionNode(ctx context.Context, in *AddPermissionNodeRequest, opts ...grpc.CallOption) (*AddPermissionNodeResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddPermissionNodeResponse)
err := c.cc.Invoke(ctx, PermissionService_AddPermissionNode_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *permissionServiceClient) AddPermissionNodeToGroup(ctx context.Context, in *AddPermissionNodeToGroupRequest, opts ...grpc.CallOption) (*AddPermissionNodeToGroupResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddPermissionNodeToGroupResponse)
err := c.cc.Invoke(ctx, PermissionService_AddPermissionNodeToGroup_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *permissionServiceClient) RemovePermissionNode(ctx context.Context, in *RemovePermissionNodeRequest, opts ...grpc.CallOption) (*RemovePermissionNodeResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RemovePermissionNodeResponse)
err := c.cc.Invoke(ctx, PermissionService_RemovePermissionNode_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *permissionServiceClient) RemovePermissionNodeFromGroup(ctx context.Context, in *RemovePermissionNodeFromGroupRequest, opts ...grpc.CallOption) (*RemovePermissionNodeFromGroupResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RemovePermissionNodeFromGroupResponse)
err := c.cc.Invoke(ctx, PermissionService_RemovePermissionNodeFromGroup_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// PermissionServiceServer is the server API for PermissionService service.
// All implementations must embed UnimplementedPermissionServiceServer
// for forward compatibility.
type PermissionServiceServer interface {
HasPermission(context.Context, *HasPermissionRequest) (*HasPermissionResponse, error)
GetPermission(context.Context, *GetPermissionRequest) (*GetPermissionResponse, error)
AddPermissionNode(context.Context, *AddPermissionNodeRequest) (*AddPermissionNodeResponse, error)
AddPermissionNodeToGroup(context.Context, *AddPermissionNodeToGroupRequest) (*AddPermissionNodeToGroupResponse, error)
RemovePermissionNode(context.Context, *RemovePermissionNodeRequest) (*RemovePermissionNodeResponse, error)
RemovePermissionNodeFromGroup(context.Context, *RemovePermissionNodeFromGroupRequest) (*RemovePermissionNodeFromGroupResponse, error)
mustEmbedUnimplementedPermissionServiceServer()
}
// UnimplementedPermissionServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedPermissionServiceServer struct{}
func (UnimplementedPermissionServiceServer) HasPermission(context.Context, *HasPermissionRequest) (*HasPermissionResponse, error) {
return nil, status.Error(codes.Unimplemented, "method HasPermission not implemented")
}
func (UnimplementedPermissionServiceServer) GetPermission(context.Context, *GetPermissionRequest) (*GetPermissionResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetPermission not implemented")
}
func (UnimplementedPermissionServiceServer) AddPermissionNode(context.Context, *AddPermissionNodeRequest) (*AddPermissionNodeResponse, error) {
return nil, status.Error(codes.Unimplemented, "method AddPermissionNode not implemented")
}
func (UnimplementedPermissionServiceServer) AddPermissionNodeToGroup(context.Context, *AddPermissionNodeToGroupRequest) (*AddPermissionNodeToGroupResponse, error) {
return nil, status.Error(codes.Unimplemented, "method AddPermissionNodeToGroup not implemented")
}
func (UnimplementedPermissionServiceServer) RemovePermissionNode(context.Context, *RemovePermissionNodeRequest) (*RemovePermissionNodeResponse, error) {
return nil, status.Error(codes.Unimplemented, "method RemovePermissionNode not implemented")
}
func (UnimplementedPermissionServiceServer) RemovePermissionNodeFromGroup(context.Context, *RemovePermissionNodeFromGroupRequest) (*RemovePermissionNodeFromGroupResponse, error) {
return nil, status.Error(codes.Unimplemented, "method RemovePermissionNodeFromGroup not implemented")
}
func (UnimplementedPermissionServiceServer) mustEmbedUnimplementedPermissionServiceServer() {}
func (UnimplementedPermissionServiceServer) testEmbeddedByValue() {}
// UnsafePermissionServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PermissionServiceServer will
// result in compilation errors.
type UnsafePermissionServiceServer interface {
mustEmbedUnimplementedPermissionServiceServer()
}
func RegisterPermissionServiceServer(s grpc.ServiceRegistrar, srv PermissionServiceServer) {
// If the following call panics, it indicates UnimplementedPermissionServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&PermissionService_ServiceDesc, srv)
}
func _PermissionService_HasPermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HasPermissionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PermissionServiceServer).HasPermission(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PermissionService_HasPermission_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PermissionServiceServer).HasPermission(ctx, req.(*HasPermissionRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PermissionService_GetPermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPermissionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PermissionServiceServer).GetPermission(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PermissionService_GetPermission_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PermissionServiceServer).GetPermission(ctx, req.(*GetPermissionRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PermissionService_AddPermissionNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddPermissionNodeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PermissionServiceServer).AddPermissionNode(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PermissionService_AddPermissionNode_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PermissionServiceServer).AddPermissionNode(ctx, req.(*AddPermissionNodeRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PermissionService_AddPermissionNodeToGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddPermissionNodeToGroupRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PermissionServiceServer).AddPermissionNodeToGroup(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PermissionService_AddPermissionNodeToGroup_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PermissionServiceServer).AddPermissionNodeToGroup(ctx, req.(*AddPermissionNodeToGroupRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PermissionService_RemovePermissionNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RemovePermissionNodeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PermissionServiceServer).RemovePermissionNode(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PermissionService_RemovePermissionNode_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PermissionServiceServer).RemovePermissionNode(ctx, req.(*RemovePermissionNodeRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PermissionService_RemovePermissionNodeFromGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RemovePermissionNodeFromGroupRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PermissionServiceServer).RemovePermissionNodeFromGroup(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PermissionService_RemovePermissionNodeFromGroup_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PermissionServiceServer).RemovePermissionNodeFromGroup(ctx, req.(*RemovePermissionNodeFromGroupRequest))
}
return interceptor(ctx, in, info, handler)
}
// PermissionService_ServiceDesc is the grpc.ServiceDesc for PermissionService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PermissionService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.PermissionService",
HandlerType: (*PermissionServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "HasPermission",
Handler: _PermissionService_HasPermission_Handler,
},
{
MethodName: "GetPermission",
Handler: _PermissionService_GetPermission_Handler,
},
{
MethodName: "AddPermissionNode",
Handler: _PermissionService_AddPermissionNode_Handler,
},
{
MethodName: "AddPermissionNodeToGroup",
Handler: _PermissionService_AddPermissionNodeToGroup_Handler,
},
{
MethodName: "RemovePermissionNode",
Handler: _PermissionService_RemovePermissionNode_Handler,
},
{
MethodName: "RemovePermissionNodeFromGroup",
Handler: _PermissionService_RemovePermissionNodeFromGroup_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "auth.proto",
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,570 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.1
// source: develop.proto
package gen
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
CustomAppService_GetCustomApp_FullMethodName = "/proto.CustomAppService/GetCustomApp"
CustomAppService_CheckCustomAppSecret_FullMethodName = "/proto.CustomAppService/CheckCustomAppSecret"
)
// CustomAppServiceClient is the client API for CustomAppService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type CustomAppServiceClient interface {
GetCustomApp(ctx context.Context, in *GetCustomAppRequest, opts ...grpc.CallOption) (*GetCustomAppResponse, error)
CheckCustomAppSecret(ctx context.Context, in *CheckCustomAppSecretRequest, opts ...grpc.CallOption) (*CheckCustomAppSecretResponse, error)
}
type customAppServiceClient struct {
cc grpc.ClientConnInterface
}
func NewCustomAppServiceClient(cc grpc.ClientConnInterface) CustomAppServiceClient {
return &customAppServiceClient{cc}
}
func (c *customAppServiceClient) GetCustomApp(ctx context.Context, in *GetCustomAppRequest, opts ...grpc.CallOption) (*GetCustomAppResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetCustomAppResponse)
err := c.cc.Invoke(ctx, CustomAppService_GetCustomApp_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *customAppServiceClient) CheckCustomAppSecret(ctx context.Context, in *CheckCustomAppSecretRequest, opts ...grpc.CallOption) (*CheckCustomAppSecretResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CheckCustomAppSecretResponse)
err := c.cc.Invoke(ctx, CustomAppService_CheckCustomAppSecret_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// CustomAppServiceServer is the server API for CustomAppService service.
// All implementations must embed UnimplementedCustomAppServiceServer
// for forward compatibility.
type CustomAppServiceServer interface {
GetCustomApp(context.Context, *GetCustomAppRequest) (*GetCustomAppResponse, error)
CheckCustomAppSecret(context.Context, *CheckCustomAppSecretRequest) (*CheckCustomAppSecretResponse, error)
mustEmbedUnimplementedCustomAppServiceServer()
}
// UnimplementedCustomAppServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedCustomAppServiceServer struct{}
func (UnimplementedCustomAppServiceServer) GetCustomApp(context.Context, *GetCustomAppRequest) (*GetCustomAppResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetCustomApp not implemented")
}
func (UnimplementedCustomAppServiceServer) CheckCustomAppSecret(context.Context, *CheckCustomAppSecretRequest) (*CheckCustomAppSecretResponse, error) {
return nil, status.Error(codes.Unimplemented, "method CheckCustomAppSecret not implemented")
}
func (UnimplementedCustomAppServiceServer) mustEmbedUnimplementedCustomAppServiceServer() {}
func (UnimplementedCustomAppServiceServer) testEmbeddedByValue() {}
// UnsafeCustomAppServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to CustomAppServiceServer will
// result in compilation errors.
type UnsafeCustomAppServiceServer interface {
mustEmbedUnimplementedCustomAppServiceServer()
}
func RegisterCustomAppServiceServer(s grpc.ServiceRegistrar, srv CustomAppServiceServer) {
// If the following call panics, it indicates UnimplementedCustomAppServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&CustomAppService_ServiceDesc, srv)
}
func _CustomAppService_GetCustomApp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetCustomAppRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CustomAppServiceServer).GetCustomApp(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: CustomAppService_GetCustomApp_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CustomAppServiceServer).GetCustomApp(ctx, req.(*GetCustomAppRequest))
}
return interceptor(ctx, in, info, handler)
}
func _CustomAppService_CheckCustomAppSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckCustomAppSecretRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CustomAppServiceServer).CheckCustomAppSecret(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: CustomAppService_CheckCustomAppSecret_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CustomAppServiceServer).CheckCustomAppSecret(ctx, req.(*CheckCustomAppSecretRequest))
}
return interceptor(ctx, in, info, handler)
}
// CustomAppService_ServiceDesc is the grpc.ServiceDesc for CustomAppService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var CustomAppService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.CustomAppService",
HandlerType: (*CustomAppServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetCustomApp",
Handler: _CustomAppService_GetCustomApp_Handler,
},
{
MethodName: "CheckCustomAppSecret",
Handler: _CustomAppService_CheckCustomAppSecret_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "develop.proto",
}
const (
BotAccountReceiverService_CreateBotAccount_FullMethodName = "/proto.BotAccountReceiverService/CreateBotAccount"
BotAccountReceiverService_UpdateBotAccount_FullMethodName = "/proto.BotAccountReceiverService/UpdateBotAccount"
BotAccountReceiverService_DeleteBotAccount_FullMethodName = "/proto.BotAccountReceiverService/DeleteBotAccount"
BotAccountReceiverService_GetApiKey_FullMethodName = "/proto.BotAccountReceiverService/GetApiKey"
BotAccountReceiverService_ListApiKey_FullMethodName = "/proto.BotAccountReceiverService/ListApiKey"
BotAccountReceiverService_CreateApiKey_FullMethodName = "/proto.BotAccountReceiverService/CreateApiKey"
BotAccountReceiverService_UpdateApiKey_FullMethodName = "/proto.BotAccountReceiverService/UpdateApiKey"
BotAccountReceiverService_RotateApiKey_FullMethodName = "/proto.BotAccountReceiverService/RotateApiKey"
BotAccountReceiverService_DeleteApiKey_FullMethodName = "/proto.BotAccountReceiverService/DeleteApiKey"
)
// BotAccountReceiverServiceClient is the client API for BotAccountReceiverService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// This service should be implemented by the Pass service to handle the creation, update, and deletion of bot accounts
type BotAccountReceiverServiceClient interface {
CreateBotAccount(ctx context.Context, in *CreateBotAccountRequest, opts ...grpc.CallOption) (*CreateBotAccountResponse, error)
UpdateBotAccount(ctx context.Context, in *UpdateBotAccountRequest, opts ...grpc.CallOption) (*UpdateBotAccountResponse, error)
DeleteBotAccount(ctx context.Context, in *DeleteBotAccountRequest, opts ...grpc.CallOption) (*DeleteBotAccountResponse, error)
GetApiKey(ctx context.Context, in *GetApiKeyRequest, opts ...grpc.CallOption) (*ApiKey, error)
ListApiKey(ctx context.Context, in *ListApiKeyRequest, opts ...grpc.CallOption) (*GetApiKeyBatchResponse, error)
CreateApiKey(ctx context.Context, in *ApiKey, opts ...grpc.CallOption) (*ApiKey, error)
UpdateApiKey(ctx context.Context, in *ApiKey, opts ...grpc.CallOption) (*ApiKey, error)
RotateApiKey(ctx context.Context, in *GetApiKeyRequest, opts ...grpc.CallOption) (*ApiKey, error)
DeleteApiKey(ctx context.Context, in *GetApiKeyRequest, opts ...grpc.CallOption) (*DeleteApiKeyResponse, error)
}
type botAccountReceiverServiceClient struct {
cc grpc.ClientConnInterface
}
func NewBotAccountReceiverServiceClient(cc grpc.ClientConnInterface) BotAccountReceiverServiceClient {
return &botAccountReceiverServiceClient{cc}
}
func (c *botAccountReceiverServiceClient) CreateBotAccount(ctx context.Context, in *CreateBotAccountRequest, opts ...grpc.CallOption) (*CreateBotAccountResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateBotAccountResponse)
err := c.cc.Invoke(ctx, BotAccountReceiverService_CreateBotAccount_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *botAccountReceiverServiceClient) UpdateBotAccount(ctx context.Context, in *UpdateBotAccountRequest, opts ...grpc.CallOption) (*UpdateBotAccountResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateBotAccountResponse)
err := c.cc.Invoke(ctx, BotAccountReceiverService_UpdateBotAccount_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *botAccountReceiverServiceClient) DeleteBotAccount(ctx context.Context, in *DeleteBotAccountRequest, opts ...grpc.CallOption) (*DeleteBotAccountResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteBotAccountResponse)
err := c.cc.Invoke(ctx, BotAccountReceiverService_DeleteBotAccount_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *botAccountReceiverServiceClient) GetApiKey(ctx context.Context, in *GetApiKeyRequest, opts ...grpc.CallOption) (*ApiKey, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ApiKey)
err := c.cc.Invoke(ctx, BotAccountReceiverService_GetApiKey_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *botAccountReceiverServiceClient) ListApiKey(ctx context.Context, in *ListApiKeyRequest, opts ...grpc.CallOption) (*GetApiKeyBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetApiKeyBatchResponse)
err := c.cc.Invoke(ctx, BotAccountReceiverService_ListApiKey_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *botAccountReceiverServiceClient) CreateApiKey(ctx context.Context, in *ApiKey, opts ...grpc.CallOption) (*ApiKey, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ApiKey)
err := c.cc.Invoke(ctx, BotAccountReceiverService_CreateApiKey_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *botAccountReceiverServiceClient) UpdateApiKey(ctx context.Context, in *ApiKey, opts ...grpc.CallOption) (*ApiKey, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ApiKey)
err := c.cc.Invoke(ctx, BotAccountReceiverService_UpdateApiKey_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *botAccountReceiverServiceClient) RotateApiKey(ctx context.Context, in *GetApiKeyRequest, opts ...grpc.CallOption) (*ApiKey, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ApiKey)
err := c.cc.Invoke(ctx, BotAccountReceiverService_RotateApiKey_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *botAccountReceiverServiceClient) DeleteApiKey(ctx context.Context, in *GetApiKeyRequest, opts ...grpc.CallOption) (*DeleteApiKeyResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteApiKeyResponse)
err := c.cc.Invoke(ctx, BotAccountReceiverService_DeleteApiKey_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// BotAccountReceiverServiceServer is the server API for BotAccountReceiverService service.
// All implementations must embed UnimplementedBotAccountReceiverServiceServer
// for forward compatibility.
//
// This service should be implemented by the Pass service to handle the creation, update, and deletion of bot accounts
type BotAccountReceiverServiceServer interface {
CreateBotAccount(context.Context, *CreateBotAccountRequest) (*CreateBotAccountResponse, error)
UpdateBotAccount(context.Context, *UpdateBotAccountRequest) (*UpdateBotAccountResponse, error)
DeleteBotAccount(context.Context, *DeleteBotAccountRequest) (*DeleteBotAccountResponse, error)
GetApiKey(context.Context, *GetApiKeyRequest) (*ApiKey, error)
ListApiKey(context.Context, *ListApiKeyRequest) (*GetApiKeyBatchResponse, error)
CreateApiKey(context.Context, *ApiKey) (*ApiKey, error)
UpdateApiKey(context.Context, *ApiKey) (*ApiKey, error)
RotateApiKey(context.Context, *GetApiKeyRequest) (*ApiKey, error)
DeleteApiKey(context.Context, *GetApiKeyRequest) (*DeleteApiKeyResponse, error)
mustEmbedUnimplementedBotAccountReceiverServiceServer()
}
// UnimplementedBotAccountReceiverServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedBotAccountReceiverServiceServer struct{}
func (UnimplementedBotAccountReceiverServiceServer) CreateBotAccount(context.Context, *CreateBotAccountRequest) (*CreateBotAccountResponse, error) {
return nil, status.Error(codes.Unimplemented, "method CreateBotAccount not implemented")
}
func (UnimplementedBotAccountReceiverServiceServer) UpdateBotAccount(context.Context, *UpdateBotAccountRequest) (*UpdateBotAccountResponse, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateBotAccount not implemented")
}
func (UnimplementedBotAccountReceiverServiceServer) DeleteBotAccount(context.Context, *DeleteBotAccountRequest) (*DeleteBotAccountResponse, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteBotAccount not implemented")
}
func (UnimplementedBotAccountReceiverServiceServer) GetApiKey(context.Context, *GetApiKeyRequest) (*ApiKey, error) {
return nil, status.Error(codes.Unimplemented, "method GetApiKey not implemented")
}
func (UnimplementedBotAccountReceiverServiceServer) ListApiKey(context.Context, *ListApiKeyRequest) (*GetApiKeyBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListApiKey not implemented")
}
func (UnimplementedBotAccountReceiverServiceServer) CreateApiKey(context.Context, *ApiKey) (*ApiKey, error) {
return nil, status.Error(codes.Unimplemented, "method CreateApiKey not implemented")
}
func (UnimplementedBotAccountReceiverServiceServer) UpdateApiKey(context.Context, *ApiKey) (*ApiKey, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateApiKey not implemented")
}
func (UnimplementedBotAccountReceiverServiceServer) RotateApiKey(context.Context, *GetApiKeyRequest) (*ApiKey, error) {
return nil, status.Error(codes.Unimplemented, "method RotateApiKey not implemented")
}
func (UnimplementedBotAccountReceiverServiceServer) DeleteApiKey(context.Context, *GetApiKeyRequest) (*DeleteApiKeyResponse, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteApiKey not implemented")
}
func (UnimplementedBotAccountReceiverServiceServer) mustEmbedUnimplementedBotAccountReceiverServiceServer() {
}
func (UnimplementedBotAccountReceiverServiceServer) testEmbeddedByValue() {}
// UnsafeBotAccountReceiverServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to BotAccountReceiverServiceServer will
// result in compilation errors.
type UnsafeBotAccountReceiverServiceServer interface {
mustEmbedUnimplementedBotAccountReceiverServiceServer()
}
func RegisterBotAccountReceiverServiceServer(s grpc.ServiceRegistrar, srv BotAccountReceiverServiceServer) {
// If the following call panics, it indicates UnimplementedBotAccountReceiverServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&BotAccountReceiverService_ServiceDesc, srv)
}
func _BotAccountReceiverService_CreateBotAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateBotAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BotAccountReceiverServiceServer).CreateBotAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: BotAccountReceiverService_CreateBotAccount_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BotAccountReceiverServiceServer).CreateBotAccount(ctx, req.(*CreateBotAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _BotAccountReceiverService_UpdateBotAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateBotAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BotAccountReceiverServiceServer).UpdateBotAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: BotAccountReceiverService_UpdateBotAccount_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BotAccountReceiverServiceServer).UpdateBotAccount(ctx, req.(*UpdateBotAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _BotAccountReceiverService_DeleteBotAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteBotAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BotAccountReceiverServiceServer).DeleteBotAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: BotAccountReceiverService_DeleteBotAccount_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BotAccountReceiverServiceServer).DeleteBotAccount(ctx, req.(*DeleteBotAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _BotAccountReceiverService_GetApiKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetApiKeyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BotAccountReceiverServiceServer).GetApiKey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: BotAccountReceiverService_GetApiKey_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BotAccountReceiverServiceServer).GetApiKey(ctx, req.(*GetApiKeyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _BotAccountReceiverService_ListApiKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListApiKeyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BotAccountReceiverServiceServer).ListApiKey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: BotAccountReceiverService_ListApiKey_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BotAccountReceiverServiceServer).ListApiKey(ctx, req.(*ListApiKeyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _BotAccountReceiverService_CreateApiKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ApiKey)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BotAccountReceiverServiceServer).CreateApiKey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: BotAccountReceiverService_CreateApiKey_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BotAccountReceiverServiceServer).CreateApiKey(ctx, req.(*ApiKey))
}
return interceptor(ctx, in, info, handler)
}
func _BotAccountReceiverService_UpdateApiKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ApiKey)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BotAccountReceiverServiceServer).UpdateApiKey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: BotAccountReceiverService_UpdateApiKey_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BotAccountReceiverServiceServer).UpdateApiKey(ctx, req.(*ApiKey))
}
return interceptor(ctx, in, info, handler)
}
func _BotAccountReceiverService_RotateApiKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetApiKeyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BotAccountReceiverServiceServer).RotateApiKey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: BotAccountReceiverService_RotateApiKey_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BotAccountReceiverServiceServer).RotateApiKey(ctx, req.(*GetApiKeyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _BotAccountReceiverService_DeleteApiKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetApiKeyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BotAccountReceiverServiceServer).DeleteApiKey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: BotAccountReceiverService_DeleteApiKey_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BotAccountReceiverServiceServer).DeleteApiKey(ctx, req.(*GetApiKeyRequest))
}
return interceptor(ctx, in, info, handler)
}
// BotAccountReceiverService_ServiceDesc is the grpc.ServiceDesc for BotAccountReceiverService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var BotAccountReceiverService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.BotAccountReceiverService",
HandlerType: (*BotAccountReceiverServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateBotAccount",
Handler: _BotAccountReceiverService_CreateBotAccount_Handler,
},
{
MethodName: "UpdateBotAccount",
Handler: _BotAccountReceiverService_UpdateBotAccount_Handler,
},
{
MethodName: "DeleteBotAccount",
Handler: _BotAccountReceiverService_DeleteBotAccount_Handler,
},
{
MethodName: "GetApiKey",
Handler: _BotAccountReceiverService_GetApiKey_Handler,
},
{
MethodName: "ListApiKey",
Handler: _BotAccountReceiverService_ListApiKey_Handler,
},
{
MethodName: "CreateApiKey",
Handler: _BotAccountReceiverService_CreateApiKey_Handler,
},
{
MethodName: "UpdateApiKey",
Handler: _BotAccountReceiverService_UpdateApiKey_Handler,
},
{
MethodName: "RotateApiKey",
Handler: _BotAccountReceiverService_RotateApiKey_Handler,
},
{
MethodName: "DeleteApiKey",
Handler: _BotAccountReceiverService_DeleteApiKey_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "develop.proto",
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,952 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.1
// source: file.proto
package gen
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
FileService_GetFile_FullMethodName = "/proto.FileService/GetFile"
FileService_GetFileBatch_FullMethodName = "/proto.FileService/GetFileBatch"
FileService_UpdateFile_FullMethodName = "/proto.FileService/UpdateFile"
FileService_DeleteFile_FullMethodName = "/proto.FileService/DeleteFile"
FileService_LoadFromReference_FullMethodName = "/proto.FileService/LoadFromReference"
FileService_IsReferenced_FullMethodName = "/proto.FileService/IsReferenced"
FileService_PurgeCache_FullMethodName = "/proto.FileService/PurgeCache"
)
// FileServiceClient is the client API for FileService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Service for file operations
type FileServiceClient interface {
// Get file reference by ID
GetFile(ctx context.Context, in *GetFileRequest, opts ...grpc.CallOption) (*CloudFile, error)
GetFileBatch(ctx context.Context, in *GetFileBatchRequest, opts ...grpc.CallOption) (*GetFileBatchResponse, error)
// Update an existing file reference
UpdateFile(ctx context.Context, in *UpdateFileRequest, opts ...grpc.CallOption) (*CloudFile, error)
// Delete a file reference
DeleteFile(ctx context.Context, in *DeleteFileRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Load files from references
LoadFromReference(ctx context.Context, in *LoadFromReferenceRequest, opts ...grpc.CallOption) (*LoadFromReferenceResponse, error)
// Check if a file is referenced by any resource
IsReferenced(ctx context.Context, in *IsReferencedRequest, opts ...grpc.CallOption) (*IsReferencedResponse, error)
// Purge cache for a file
PurgeCache(ctx context.Context, in *PurgeCacheRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type fileServiceClient struct {
cc grpc.ClientConnInterface
}
func NewFileServiceClient(cc grpc.ClientConnInterface) FileServiceClient {
return &fileServiceClient{cc}
}
func (c *fileServiceClient) GetFile(ctx context.Context, in *GetFileRequest, opts ...grpc.CallOption) (*CloudFile, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CloudFile)
err := c.cc.Invoke(ctx, FileService_GetFile_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileServiceClient) GetFileBatch(ctx context.Context, in *GetFileBatchRequest, opts ...grpc.CallOption) (*GetFileBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetFileBatchResponse)
err := c.cc.Invoke(ctx, FileService_GetFileBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileServiceClient) UpdateFile(ctx context.Context, in *UpdateFileRequest, opts ...grpc.CallOption) (*CloudFile, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CloudFile)
err := c.cc.Invoke(ctx, FileService_UpdateFile_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileServiceClient) DeleteFile(ctx context.Context, in *DeleteFileRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, FileService_DeleteFile_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileServiceClient) LoadFromReference(ctx context.Context, in *LoadFromReferenceRequest, opts ...grpc.CallOption) (*LoadFromReferenceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(LoadFromReferenceResponse)
err := c.cc.Invoke(ctx, FileService_LoadFromReference_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileServiceClient) IsReferenced(ctx context.Context, in *IsReferencedRequest, opts ...grpc.CallOption) (*IsReferencedResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(IsReferencedResponse)
err := c.cc.Invoke(ctx, FileService_IsReferenced_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileServiceClient) PurgeCache(ctx context.Context, in *PurgeCacheRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, FileService_PurgeCache_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// FileServiceServer is the server API for FileService service.
// All implementations must embed UnimplementedFileServiceServer
// for forward compatibility.
//
// Service for file operations
type FileServiceServer interface {
// Get file reference by ID
GetFile(context.Context, *GetFileRequest) (*CloudFile, error)
GetFileBatch(context.Context, *GetFileBatchRequest) (*GetFileBatchResponse, error)
// Update an existing file reference
UpdateFile(context.Context, *UpdateFileRequest) (*CloudFile, error)
// Delete a file reference
DeleteFile(context.Context, *DeleteFileRequest) (*emptypb.Empty, error)
// Load files from references
LoadFromReference(context.Context, *LoadFromReferenceRequest) (*LoadFromReferenceResponse, error)
// Check if a file is referenced by any resource
IsReferenced(context.Context, *IsReferencedRequest) (*IsReferencedResponse, error)
// Purge cache for a file
PurgeCache(context.Context, *PurgeCacheRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedFileServiceServer()
}
// UnimplementedFileServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedFileServiceServer struct{}
func (UnimplementedFileServiceServer) GetFile(context.Context, *GetFileRequest) (*CloudFile, error) {
return nil, status.Error(codes.Unimplemented, "method GetFile not implemented")
}
func (UnimplementedFileServiceServer) GetFileBatch(context.Context, *GetFileBatchRequest) (*GetFileBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetFileBatch not implemented")
}
func (UnimplementedFileServiceServer) UpdateFile(context.Context, *UpdateFileRequest) (*CloudFile, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateFile not implemented")
}
func (UnimplementedFileServiceServer) DeleteFile(context.Context, *DeleteFileRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteFile not implemented")
}
func (UnimplementedFileServiceServer) LoadFromReference(context.Context, *LoadFromReferenceRequest) (*LoadFromReferenceResponse, error) {
return nil, status.Error(codes.Unimplemented, "method LoadFromReference not implemented")
}
func (UnimplementedFileServiceServer) IsReferenced(context.Context, *IsReferencedRequest) (*IsReferencedResponse, error) {
return nil, status.Error(codes.Unimplemented, "method IsReferenced not implemented")
}
func (UnimplementedFileServiceServer) PurgeCache(context.Context, *PurgeCacheRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method PurgeCache not implemented")
}
func (UnimplementedFileServiceServer) mustEmbedUnimplementedFileServiceServer() {}
func (UnimplementedFileServiceServer) testEmbeddedByValue() {}
// UnsafeFileServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to FileServiceServer will
// result in compilation errors.
type UnsafeFileServiceServer interface {
mustEmbedUnimplementedFileServiceServer()
}
func RegisterFileServiceServer(s grpc.ServiceRegistrar, srv FileServiceServer) {
// If the following call panics, it indicates UnimplementedFileServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&FileService_ServiceDesc, srv)
}
func _FileService_GetFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetFileRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).GetFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileService_GetFile_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).GetFile(ctx, req.(*GetFileRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileService_GetFileBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetFileBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).GetFileBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileService_GetFileBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).GetFileBatch(ctx, req.(*GetFileBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileService_UpdateFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateFileRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).UpdateFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileService_UpdateFile_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).UpdateFile(ctx, req.(*UpdateFileRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileService_DeleteFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteFileRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).DeleteFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileService_DeleteFile_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).DeleteFile(ctx, req.(*DeleteFileRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileService_LoadFromReference_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoadFromReferenceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).LoadFromReference(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileService_LoadFromReference_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).LoadFromReference(ctx, req.(*LoadFromReferenceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileService_IsReferenced_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IsReferencedRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).IsReferenced(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileService_IsReferenced_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).IsReferenced(ctx, req.(*IsReferencedRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileService_PurgeCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PurgeCacheRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).PurgeCache(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileService_PurgeCache_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).PurgeCache(ctx, req.(*PurgeCacheRequest))
}
return interceptor(ctx, in, info, handler)
}
// FileService_ServiceDesc is the grpc.ServiceDesc for FileService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var FileService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.FileService",
HandlerType: (*FileServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetFile",
Handler: _FileService_GetFile_Handler,
},
{
MethodName: "GetFileBatch",
Handler: _FileService_GetFileBatch_Handler,
},
{
MethodName: "UpdateFile",
Handler: _FileService_UpdateFile_Handler,
},
{
MethodName: "DeleteFile",
Handler: _FileService_DeleteFile_Handler,
},
{
MethodName: "LoadFromReference",
Handler: _FileService_LoadFromReference_Handler,
},
{
MethodName: "IsReferenced",
Handler: _FileService_IsReferenced_Handler,
},
{
MethodName: "PurgeCache",
Handler: _FileService_PurgeCache_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "file.proto",
}
const (
FileReferenceService_CreateReference_FullMethodName = "/proto.FileReferenceService/CreateReference"
FileReferenceService_CreateReferenceBatch_FullMethodName = "/proto.FileReferenceService/CreateReferenceBatch"
FileReferenceService_GetReferences_FullMethodName = "/proto.FileReferenceService/GetReferences"
FileReferenceService_GetReferenceCount_FullMethodName = "/proto.FileReferenceService/GetReferenceCount"
FileReferenceService_GetResourceReferences_FullMethodName = "/proto.FileReferenceService/GetResourceReferences"
FileReferenceService_GetResourceFiles_FullMethodName = "/proto.FileReferenceService/GetResourceFiles"
FileReferenceService_DeleteResourceReferences_FullMethodName = "/proto.FileReferenceService/DeleteResourceReferences"
FileReferenceService_DeleteResourceReferencesBatch_FullMethodName = "/proto.FileReferenceService/DeleteResourceReferencesBatch"
FileReferenceService_DeleteReference_FullMethodName = "/proto.FileReferenceService/DeleteReference"
FileReferenceService_UpdateResourceFiles_FullMethodName = "/proto.FileReferenceService/UpdateResourceFiles"
FileReferenceService_SetReferenceExpiration_FullMethodName = "/proto.FileReferenceService/SetReferenceExpiration"
FileReferenceService_SetFileReferencesExpiration_FullMethodName = "/proto.FileReferenceService/SetFileReferencesExpiration"
FileReferenceService_HasFileReferences_FullMethodName = "/proto.FileReferenceService/HasFileReferences"
)
// FileReferenceServiceClient is the client API for FileReferenceService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Service for managing file references
type FileReferenceServiceClient interface {
// Creates a new reference to a file for a specific resource
CreateReference(ctx context.Context, in *CreateReferenceRequest, opts ...grpc.CallOption) (*CloudFileReference, error)
CreateReferenceBatch(ctx context.Context, in *CreateReferenceBatchRequest, opts ...grpc.CallOption) (*CreateReferenceBatchResponse, error)
// Gets all references to a file
GetReferences(ctx context.Context, in *GetReferencesRequest, opts ...grpc.CallOption) (*GetReferencesResponse, error)
// Gets the number of references to a file
GetReferenceCount(ctx context.Context, in *GetReferenceCountRequest, opts ...grpc.CallOption) (*GetReferenceCountResponse, error)
// Gets all references for a specific resource and optional usage
GetResourceReferences(ctx context.Context, in *GetResourceReferencesRequest, opts ...grpc.CallOption) (*GetReferencesResponse, error)
// Gets all files referenced by a resource with optional usage filter
GetResourceFiles(ctx context.Context, in *GetResourceFilesRequest, opts ...grpc.CallOption) (*GetResourceFilesResponse, error)
// Deletes references for a specific resource and optional usage
DeleteResourceReferences(ctx context.Context, in *DeleteResourceReferencesRequest, opts ...grpc.CallOption) (*DeleteResourceReferencesResponse, error)
// Deletes references for multiple specific resources and optional usage
DeleteResourceReferencesBatch(ctx context.Context, in *DeleteResourceReferencesBatchRequest, opts ...grpc.CallOption) (*DeleteResourceReferencesResponse, error)
// Deletes a specific file reference
DeleteReference(ctx context.Context, in *DeleteReferenceRequest, opts ...grpc.CallOption) (*DeleteReferenceResponse, error)
// Updates the files referenced by a resource
UpdateResourceFiles(ctx context.Context, in *UpdateResourceFilesRequest, opts ...grpc.CallOption) (*UpdateResourceFilesResponse, error)
// Updates the expiration time for a file reference
SetReferenceExpiration(ctx context.Context, in *SetReferenceExpirationRequest, opts ...grpc.CallOption) (*SetReferenceExpirationResponse, error)
// Updates the expiration time for all references to a file
SetFileReferencesExpiration(ctx context.Context, in *SetFileReferencesExpirationRequest, opts ...grpc.CallOption) (*SetFileReferencesExpirationResponse, error)
// Checks if a file has any references
HasFileReferences(ctx context.Context, in *HasFileReferencesRequest, opts ...grpc.CallOption) (*HasFileReferencesResponse, error)
}
type fileReferenceServiceClient struct {
cc grpc.ClientConnInterface
}
func NewFileReferenceServiceClient(cc grpc.ClientConnInterface) FileReferenceServiceClient {
return &fileReferenceServiceClient{cc}
}
func (c *fileReferenceServiceClient) CreateReference(ctx context.Context, in *CreateReferenceRequest, opts ...grpc.CallOption) (*CloudFileReference, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CloudFileReference)
err := c.cc.Invoke(ctx, FileReferenceService_CreateReference_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileReferenceServiceClient) CreateReferenceBatch(ctx context.Context, in *CreateReferenceBatchRequest, opts ...grpc.CallOption) (*CreateReferenceBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateReferenceBatchResponse)
err := c.cc.Invoke(ctx, FileReferenceService_CreateReferenceBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileReferenceServiceClient) GetReferences(ctx context.Context, in *GetReferencesRequest, opts ...grpc.CallOption) (*GetReferencesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetReferencesResponse)
err := c.cc.Invoke(ctx, FileReferenceService_GetReferences_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileReferenceServiceClient) GetReferenceCount(ctx context.Context, in *GetReferenceCountRequest, opts ...grpc.CallOption) (*GetReferenceCountResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetReferenceCountResponse)
err := c.cc.Invoke(ctx, FileReferenceService_GetReferenceCount_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileReferenceServiceClient) GetResourceReferences(ctx context.Context, in *GetResourceReferencesRequest, opts ...grpc.CallOption) (*GetReferencesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetReferencesResponse)
err := c.cc.Invoke(ctx, FileReferenceService_GetResourceReferences_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileReferenceServiceClient) GetResourceFiles(ctx context.Context, in *GetResourceFilesRequest, opts ...grpc.CallOption) (*GetResourceFilesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetResourceFilesResponse)
err := c.cc.Invoke(ctx, FileReferenceService_GetResourceFiles_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileReferenceServiceClient) DeleteResourceReferences(ctx context.Context, in *DeleteResourceReferencesRequest, opts ...grpc.CallOption) (*DeleteResourceReferencesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteResourceReferencesResponse)
err := c.cc.Invoke(ctx, FileReferenceService_DeleteResourceReferences_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileReferenceServiceClient) DeleteResourceReferencesBatch(ctx context.Context, in *DeleteResourceReferencesBatchRequest, opts ...grpc.CallOption) (*DeleteResourceReferencesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteResourceReferencesResponse)
err := c.cc.Invoke(ctx, FileReferenceService_DeleteResourceReferencesBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileReferenceServiceClient) DeleteReference(ctx context.Context, in *DeleteReferenceRequest, opts ...grpc.CallOption) (*DeleteReferenceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteReferenceResponse)
err := c.cc.Invoke(ctx, FileReferenceService_DeleteReference_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileReferenceServiceClient) UpdateResourceFiles(ctx context.Context, in *UpdateResourceFilesRequest, opts ...grpc.CallOption) (*UpdateResourceFilesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateResourceFilesResponse)
err := c.cc.Invoke(ctx, FileReferenceService_UpdateResourceFiles_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileReferenceServiceClient) SetReferenceExpiration(ctx context.Context, in *SetReferenceExpirationRequest, opts ...grpc.CallOption) (*SetReferenceExpirationResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SetReferenceExpirationResponse)
err := c.cc.Invoke(ctx, FileReferenceService_SetReferenceExpiration_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileReferenceServiceClient) SetFileReferencesExpiration(ctx context.Context, in *SetFileReferencesExpirationRequest, opts ...grpc.CallOption) (*SetFileReferencesExpirationResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SetFileReferencesExpirationResponse)
err := c.cc.Invoke(ctx, FileReferenceService_SetFileReferencesExpiration_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileReferenceServiceClient) HasFileReferences(ctx context.Context, in *HasFileReferencesRequest, opts ...grpc.CallOption) (*HasFileReferencesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(HasFileReferencesResponse)
err := c.cc.Invoke(ctx, FileReferenceService_HasFileReferences_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// FileReferenceServiceServer is the server API for FileReferenceService service.
// All implementations must embed UnimplementedFileReferenceServiceServer
// for forward compatibility.
//
// Service for managing file references
type FileReferenceServiceServer interface {
// Creates a new reference to a file for a specific resource
CreateReference(context.Context, *CreateReferenceRequest) (*CloudFileReference, error)
CreateReferenceBatch(context.Context, *CreateReferenceBatchRequest) (*CreateReferenceBatchResponse, error)
// Gets all references to a file
GetReferences(context.Context, *GetReferencesRequest) (*GetReferencesResponse, error)
// Gets the number of references to a file
GetReferenceCount(context.Context, *GetReferenceCountRequest) (*GetReferenceCountResponse, error)
// Gets all references for a specific resource and optional usage
GetResourceReferences(context.Context, *GetResourceReferencesRequest) (*GetReferencesResponse, error)
// Gets all files referenced by a resource with optional usage filter
GetResourceFiles(context.Context, *GetResourceFilesRequest) (*GetResourceFilesResponse, error)
// Deletes references for a specific resource and optional usage
DeleteResourceReferences(context.Context, *DeleteResourceReferencesRequest) (*DeleteResourceReferencesResponse, error)
// Deletes references for multiple specific resources and optional usage
DeleteResourceReferencesBatch(context.Context, *DeleteResourceReferencesBatchRequest) (*DeleteResourceReferencesResponse, error)
// Deletes a specific file reference
DeleteReference(context.Context, *DeleteReferenceRequest) (*DeleteReferenceResponse, error)
// Updates the files referenced by a resource
UpdateResourceFiles(context.Context, *UpdateResourceFilesRequest) (*UpdateResourceFilesResponse, error)
// Updates the expiration time for a file reference
SetReferenceExpiration(context.Context, *SetReferenceExpirationRequest) (*SetReferenceExpirationResponse, error)
// Updates the expiration time for all references to a file
SetFileReferencesExpiration(context.Context, *SetFileReferencesExpirationRequest) (*SetFileReferencesExpirationResponse, error)
// Checks if a file has any references
HasFileReferences(context.Context, *HasFileReferencesRequest) (*HasFileReferencesResponse, error)
mustEmbedUnimplementedFileReferenceServiceServer()
}
// UnimplementedFileReferenceServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedFileReferenceServiceServer struct{}
func (UnimplementedFileReferenceServiceServer) CreateReference(context.Context, *CreateReferenceRequest) (*CloudFileReference, error) {
return nil, status.Error(codes.Unimplemented, "method CreateReference not implemented")
}
func (UnimplementedFileReferenceServiceServer) CreateReferenceBatch(context.Context, *CreateReferenceBatchRequest) (*CreateReferenceBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method CreateReferenceBatch not implemented")
}
func (UnimplementedFileReferenceServiceServer) GetReferences(context.Context, *GetReferencesRequest) (*GetReferencesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetReferences not implemented")
}
func (UnimplementedFileReferenceServiceServer) GetReferenceCount(context.Context, *GetReferenceCountRequest) (*GetReferenceCountResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetReferenceCount not implemented")
}
func (UnimplementedFileReferenceServiceServer) GetResourceReferences(context.Context, *GetResourceReferencesRequest) (*GetReferencesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetResourceReferences not implemented")
}
func (UnimplementedFileReferenceServiceServer) GetResourceFiles(context.Context, *GetResourceFilesRequest) (*GetResourceFilesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetResourceFiles not implemented")
}
func (UnimplementedFileReferenceServiceServer) DeleteResourceReferences(context.Context, *DeleteResourceReferencesRequest) (*DeleteResourceReferencesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteResourceReferences not implemented")
}
func (UnimplementedFileReferenceServiceServer) DeleteResourceReferencesBatch(context.Context, *DeleteResourceReferencesBatchRequest) (*DeleteResourceReferencesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteResourceReferencesBatch not implemented")
}
func (UnimplementedFileReferenceServiceServer) DeleteReference(context.Context, *DeleteReferenceRequest) (*DeleteReferenceResponse, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteReference not implemented")
}
func (UnimplementedFileReferenceServiceServer) UpdateResourceFiles(context.Context, *UpdateResourceFilesRequest) (*UpdateResourceFilesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateResourceFiles not implemented")
}
func (UnimplementedFileReferenceServiceServer) SetReferenceExpiration(context.Context, *SetReferenceExpirationRequest) (*SetReferenceExpirationResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SetReferenceExpiration not implemented")
}
func (UnimplementedFileReferenceServiceServer) SetFileReferencesExpiration(context.Context, *SetFileReferencesExpirationRequest) (*SetFileReferencesExpirationResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SetFileReferencesExpiration not implemented")
}
func (UnimplementedFileReferenceServiceServer) HasFileReferences(context.Context, *HasFileReferencesRequest) (*HasFileReferencesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method HasFileReferences not implemented")
}
func (UnimplementedFileReferenceServiceServer) mustEmbedUnimplementedFileReferenceServiceServer() {}
func (UnimplementedFileReferenceServiceServer) testEmbeddedByValue() {}
// UnsafeFileReferenceServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to FileReferenceServiceServer will
// result in compilation errors.
type UnsafeFileReferenceServiceServer interface {
mustEmbedUnimplementedFileReferenceServiceServer()
}
func RegisterFileReferenceServiceServer(s grpc.ServiceRegistrar, srv FileReferenceServiceServer) {
// If the following call panics, it indicates UnimplementedFileReferenceServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&FileReferenceService_ServiceDesc, srv)
}
func _FileReferenceService_CreateReference_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateReferenceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileReferenceServiceServer).CreateReference(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileReferenceService_CreateReference_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileReferenceServiceServer).CreateReference(ctx, req.(*CreateReferenceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileReferenceService_CreateReferenceBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateReferenceBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileReferenceServiceServer).CreateReferenceBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileReferenceService_CreateReferenceBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileReferenceServiceServer).CreateReferenceBatch(ctx, req.(*CreateReferenceBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileReferenceService_GetReferences_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetReferencesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileReferenceServiceServer).GetReferences(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileReferenceService_GetReferences_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileReferenceServiceServer).GetReferences(ctx, req.(*GetReferencesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileReferenceService_GetReferenceCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetReferenceCountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileReferenceServiceServer).GetReferenceCount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileReferenceService_GetReferenceCount_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileReferenceServiceServer).GetReferenceCount(ctx, req.(*GetReferenceCountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileReferenceService_GetResourceReferences_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetResourceReferencesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileReferenceServiceServer).GetResourceReferences(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileReferenceService_GetResourceReferences_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileReferenceServiceServer).GetResourceReferences(ctx, req.(*GetResourceReferencesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileReferenceService_GetResourceFiles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetResourceFilesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileReferenceServiceServer).GetResourceFiles(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileReferenceService_GetResourceFiles_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileReferenceServiceServer).GetResourceFiles(ctx, req.(*GetResourceFilesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileReferenceService_DeleteResourceReferences_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteResourceReferencesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileReferenceServiceServer).DeleteResourceReferences(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileReferenceService_DeleteResourceReferences_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileReferenceServiceServer).DeleteResourceReferences(ctx, req.(*DeleteResourceReferencesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileReferenceService_DeleteResourceReferencesBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteResourceReferencesBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileReferenceServiceServer).DeleteResourceReferencesBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileReferenceService_DeleteResourceReferencesBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileReferenceServiceServer).DeleteResourceReferencesBatch(ctx, req.(*DeleteResourceReferencesBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileReferenceService_DeleteReference_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteReferenceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileReferenceServiceServer).DeleteReference(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileReferenceService_DeleteReference_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileReferenceServiceServer).DeleteReference(ctx, req.(*DeleteReferenceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileReferenceService_UpdateResourceFiles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateResourceFilesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileReferenceServiceServer).UpdateResourceFiles(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileReferenceService_UpdateResourceFiles_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileReferenceServiceServer).UpdateResourceFiles(ctx, req.(*UpdateResourceFilesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileReferenceService_SetReferenceExpiration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetReferenceExpirationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileReferenceServiceServer).SetReferenceExpiration(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileReferenceService_SetReferenceExpiration_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileReferenceServiceServer).SetReferenceExpiration(ctx, req.(*SetReferenceExpirationRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileReferenceService_SetFileReferencesExpiration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetFileReferencesExpirationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileReferenceServiceServer).SetFileReferencesExpiration(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileReferenceService_SetFileReferencesExpiration_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileReferenceServiceServer).SetFileReferencesExpiration(ctx, req.(*SetFileReferencesExpirationRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileReferenceService_HasFileReferences_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HasFileReferencesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileReferenceServiceServer).HasFileReferences(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileReferenceService_HasFileReferences_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileReferenceServiceServer).HasFileReferences(ctx, req.(*HasFileReferencesRequest))
}
return interceptor(ctx, in, info, handler)
}
// FileReferenceService_ServiceDesc is the grpc.ServiceDesc for FileReferenceService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var FileReferenceService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.FileReferenceService",
HandlerType: (*FileReferenceServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateReference",
Handler: _FileReferenceService_CreateReference_Handler,
},
{
MethodName: "CreateReferenceBatch",
Handler: _FileReferenceService_CreateReferenceBatch_Handler,
},
{
MethodName: "GetReferences",
Handler: _FileReferenceService_GetReferences_Handler,
},
{
MethodName: "GetReferenceCount",
Handler: _FileReferenceService_GetReferenceCount_Handler,
},
{
MethodName: "GetResourceReferences",
Handler: _FileReferenceService_GetResourceReferences_Handler,
},
{
MethodName: "GetResourceFiles",
Handler: _FileReferenceService_GetResourceFiles_Handler,
},
{
MethodName: "DeleteResourceReferences",
Handler: _FileReferenceService_DeleteResourceReferences_Handler,
},
{
MethodName: "DeleteResourceReferencesBatch",
Handler: _FileReferenceService_DeleteResourceReferencesBatch_Handler,
},
{
MethodName: "DeleteReference",
Handler: _FileReferenceService_DeleteReference_Handler,
},
{
MethodName: "UpdateResourceFiles",
Handler: _FileReferenceService_UpdateResourceFiles_Handler,
},
{
MethodName: "SetReferenceExpiration",
Handler: _FileReferenceService_SetReferenceExpiration_Handler,
},
{
MethodName: "SetFileReferencesExpiration",
Handler: _FileReferenceService_SetFileReferencesExpiration_Handler,
},
{
MethodName: "HasFileReferences",
Handler: _FileReferenceService_HasFileReferences_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "file.proto",
}

View File

@@ -0,0 +1,573 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.10
// protoc v6.33.1
// source: leveling.proto
package gen
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// SocialCreditRecord represents a record of social credit changes for an account
type SocialCreditRecord struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // UUID string
ReasonType string `protobuf:"bytes,2,opt,name=reason_type,json=reasonType,proto3" json:"reason_type,omitempty"`
Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"`
Delta float64 `protobuf:"fixed64,4,opt,name=delta,proto3" json:"delta,omitempty"`
AccountId string `protobuf:"bytes,5,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"` // UUID string
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SocialCreditRecord) Reset() {
*x = SocialCreditRecord{}
mi := &file_leveling_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SocialCreditRecord) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SocialCreditRecord) ProtoMessage() {}
func (x *SocialCreditRecord) ProtoReflect() protoreflect.Message {
mi := &file_leveling_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SocialCreditRecord.ProtoReflect.Descriptor instead.
func (*SocialCreditRecord) Descriptor() ([]byte, []int) {
return file_leveling_proto_rawDescGZIP(), []int{0}
}
func (x *SocialCreditRecord) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *SocialCreditRecord) GetReasonType() string {
if x != nil {
return x.ReasonType
}
return ""
}
func (x *SocialCreditRecord) GetReason() string {
if x != nil {
return x.Reason
}
return ""
}
func (x *SocialCreditRecord) GetDelta() float64 {
if x != nil {
return x.Delta
}
return 0
}
func (x *SocialCreditRecord) GetAccountId() string {
if x != nil {
return x.AccountId
}
return ""
}
func (x *SocialCreditRecord) GetCreatedAt() *timestamppb.Timestamp {
if x != nil {
return x.CreatedAt
}
return nil
}
func (x *SocialCreditRecord) GetUpdatedAt() *timestamppb.Timestamp {
if x != nil {
return x.UpdatedAt
}
return nil
}
// ExperienceRecord represents a record of experience points gained by an account
type ExperienceRecord struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // UUID string
ReasonType string `protobuf:"bytes,2,opt,name=reason_type,json=reasonType,proto3" json:"reason_type,omitempty"`
Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"`
Delta int64 `protobuf:"varint,4,opt,name=delta,proto3" json:"delta,omitempty"`
BonusMultiplier float64 `protobuf:"fixed64,5,opt,name=bonus_multiplier,json=bonusMultiplier,proto3" json:"bonus_multiplier,omitempty"`
AccountId string `protobuf:"bytes,6,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"` // UUID string
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ExperienceRecord) Reset() {
*x = ExperienceRecord{}
mi := &file_leveling_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ExperienceRecord) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ExperienceRecord) ProtoMessage() {}
func (x *ExperienceRecord) ProtoReflect() protoreflect.Message {
mi := &file_leveling_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ExperienceRecord.ProtoReflect.Descriptor instead.
func (*ExperienceRecord) Descriptor() ([]byte, []int) {
return file_leveling_proto_rawDescGZIP(), []int{1}
}
func (x *ExperienceRecord) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *ExperienceRecord) GetReasonType() string {
if x != nil {
return x.ReasonType
}
return ""
}
func (x *ExperienceRecord) GetReason() string {
if x != nil {
return x.Reason
}
return ""
}
func (x *ExperienceRecord) GetDelta() int64 {
if x != nil {
return x.Delta
}
return 0
}
func (x *ExperienceRecord) GetBonusMultiplier() float64 {
if x != nil {
return x.BonusMultiplier
}
return 0
}
func (x *ExperienceRecord) GetAccountId() string {
if x != nil {
return x.AccountId
}
return ""
}
func (x *ExperienceRecord) GetCreatedAt() *timestamppb.Timestamp {
if x != nil {
return x.CreatedAt
}
return nil
}
func (x *ExperienceRecord) GetUpdatedAt() *timestamppb.Timestamp {
if x != nil {
return x.UpdatedAt
}
return nil
}
// Social Credit Requests/Responses
type AddSocialCreditRecordRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
ReasonType string `protobuf:"bytes,1,opt,name=reason_type,json=reasonType,proto3" json:"reason_type,omitempty"`
Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
Delta float64 `protobuf:"fixed64,3,opt,name=delta,proto3" json:"delta,omitempty"`
AccountId string `protobuf:"bytes,4,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"` // UUID string
ExpiredAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=expired_at,json=expiredAt,proto3" json:"expired_at,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AddSocialCreditRecordRequest) Reset() {
*x = AddSocialCreditRecordRequest{}
mi := &file_leveling_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AddSocialCreditRecordRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddSocialCreditRecordRequest) ProtoMessage() {}
func (x *AddSocialCreditRecordRequest) ProtoReflect() protoreflect.Message {
mi := &file_leveling_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AddSocialCreditRecordRequest.ProtoReflect.Descriptor instead.
func (*AddSocialCreditRecordRequest) Descriptor() ([]byte, []int) {
return file_leveling_proto_rawDescGZIP(), []int{2}
}
func (x *AddSocialCreditRecordRequest) GetReasonType() string {
if x != nil {
return x.ReasonType
}
return ""
}
func (x *AddSocialCreditRecordRequest) GetReason() string {
if x != nil {
return x.Reason
}
return ""
}
func (x *AddSocialCreditRecordRequest) GetDelta() float64 {
if x != nil {
return x.Delta
}
return 0
}
func (x *AddSocialCreditRecordRequest) GetAccountId() string {
if x != nil {
return x.AccountId
}
return ""
}
func (x *AddSocialCreditRecordRequest) GetExpiredAt() *timestamppb.Timestamp {
if x != nil {
return x.ExpiredAt
}
return nil
}
type GetSocialCreditRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
AccountId string `protobuf:"bytes,1,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"` // UUID string
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetSocialCreditRequest) Reset() {
*x = GetSocialCreditRequest{}
mi := &file_leveling_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetSocialCreditRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetSocialCreditRequest) ProtoMessage() {}
func (x *GetSocialCreditRequest) ProtoReflect() protoreflect.Message {
mi := &file_leveling_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetSocialCreditRequest.ProtoReflect.Descriptor instead.
func (*GetSocialCreditRequest) Descriptor() ([]byte, []int) {
return file_leveling_proto_rawDescGZIP(), []int{3}
}
func (x *GetSocialCreditRequest) GetAccountId() string {
if x != nil {
return x.AccountId
}
return ""
}
type SocialCreditResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Amount float64 `protobuf:"fixed64,1,opt,name=amount,proto3" json:"amount,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SocialCreditResponse) Reset() {
*x = SocialCreditResponse{}
mi := &file_leveling_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SocialCreditResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SocialCreditResponse) ProtoMessage() {}
func (x *SocialCreditResponse) ProtoReflect() protoreflect.Message {
mi := &file_leveling_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SocialCreditResponse.ProtoReflect.Descriptor instead.
func (*SocialCreditResponse) Descriptor() ([]byte, []int) {
return file_leveling_proto_rawDescGZIP(), []int{4}
}
func (x *SocialCreditResponse) GetAmount() float64 {
if x != nil {
return x.Amount
}
return 0
}
// Experience Requests/Responses
type AddExperienceRecordRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
ReasonType string `protobuf:"bytes,1,opt,name=reason_type,json=reasonType,proto3" json:"reason_type,omitempty"`
Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
Delta int64 `protobuf:"varint,3,opt,name=delta,proto3" json:"delta,omitempty"`
AccountId string `protobuf:"bytes,4,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"` // UUID string
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AddExperienceRecordRequest) Reset() {
*x = AddExperienceRecordRequest{}
mi := &file_leveling_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AddExperienceRecordRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddExperienceRecordRequest) ProtoMessage() {}
func (x *AddExperienceRecordRequest) ProtoReflect() protoreflect.Message {
mi := &file_leveling_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AddExperienceRecordRequest.ProtoReflect.Descriptor instead.
func (*AddExperienceRecordRequest) Descriptor() ([]byte, []int) {
return file_leveling_proto_rawDescGZIP(), []int{5}
}
func (x *AddExperienceRecordRequest) GetReasonType() string {
if x != nil {
return x.ReasonType
}
return ""
}
func (x *AddExperienceRecordRequest) GetReason() string {
if x != nil {
return x.Reason
}
return ""
}
func (x *AddExperienceRecordRequest) GetDelta() int64 {
if x != nil {
return x.Delta
}
return 0
}
func (x *AddExperienceRecordRequest) GetAccountId() string {
if x != nil {
return x.AccountId
}
return ""
}
var File_leveling_proto protoreflect.FileDescriptor
const file_leveling_proto_rawDesc = "" +
"\n" +
"\x0eleveling.proto\x12\x05proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x88\x02\n" +
"\x12SocialCreditRecord\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\x12\x1f\n" +
"\vreason_type\x18\x02 \x01(\tR\n" +
"reasonType\x12\x16\n" +
"\x06reason\x18\x03 \x01(\tR\x06reason\x12\x14\n" +
"\x05delta\x18\x04 \x01(\x01R\x05delta\x12\x1d\n" +
"\n" +
"account_id\x18\x05 \x01(\tR\taccountId\x129\n" +
"\n" +
"created_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" +
"\n" +
"updated_at\x18\a \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\"\xb1\x02\n" +
"\x10ExperienceRecord\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\x12\x1f\n" +
"\vreason_type\x18\x02 \x01(\tR\n" +
"reasonType\x12\x16\n" +
"\x06reason\x18\x03 \x01(\tR\x06reason\x12\x14\n" +
"\x05delta\x18\x04 \x01(\x03R\x05delta\x12)\n" +
"\x10bonus_multiplier\x18\x05 \x01(\x01R\x0fbonusMultiplier\x12\x1d\n" +
"\n" +
"account_id\x18\x06 \x01(\tR\taccountId\x129\n" +
"\n" +
"created_at\x18\a \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" +
"\n" +
"updated_at\x18\b \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\"\xc7\x01\n" +
"\x1cAddSocialCreditRecordRequest\x12\x1f\n" +
"\vreason_type\x18\x01 \x01(\tR\n" +
"reasonType\x12\x16\n" +
"\x06reason\x18\x02 \x01(\tR\x06reason\x12\x14\n" +
"\x05delta\x18\x03 \x01(\x01R\x05delta\x12\x1d\n" +
"\n" +
"account_id\x18\x04 \x01(\tR\taccountId\x129\n" +
"\n" +
"expired_at\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\texpiredAt\"7\n" +
"\x16GetSocialCreditRequest\x12\x1d\n" +
"\n" +
"account_id\x18\x01 \x01(\tR\taccountId\".\n" +
"\x14SocialCreditResponse\x12\x16\n" +
"\x06amount\x18\x01 \x01(\x01R\x06amount\"\x8a\x01\n" +
"\x1aAddExperienceRecordRequest\x12\x1f\n" +
"\vreason_type\x18\x01 \x01(\tR\n" +
"reasonType\x12\x16\n" +
"\x06reason\x18\x02 \x01(\tR\x06reason\x12\x14\n" +
"\x05delta\x18\x03 \x01(\x03R\x05delta\x12\x1d\n" +
"\n" +
"account_id\x18\x04 \x01(\tR\taccountId2\xb1\x01\n" +
"\x13SocialCreditService\x12K\n" +
"\tAddRecord\x12#.proto.AddSocialCreditRecordRequest\x1a\x19.proto.SocialCreditRecord\x12M\n" +
"\x0fGetSocialCredit\x12\x1d.proto.GetSocialCreditRequest\x1a\x1b.proto.SocialCreditResponse2\\\n" +
"\x11ExperienceService\x12G\n" +
"\tAddRecord\x12!.proto.AddExperienceRecordRequest\x1a\x17.proto.ExperienceRecordBUZ7git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen\xaa\x02\x19DysonNetwork.Shared.Protob\x06proto3"
var (
file_leveling_proto_rawDescOnce sync.Once
file_leveling_proto_rawDescData []byte
)
func file_leveling_proto_rawDescGZIP() []byte {
file_leveling_proto_rawDescOnce.Do(func() {
file_leveling_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_leveling_proto_rawDesc), len(file_leveling_proto_rawDesc)))
})
return file_leveling_proto_rawDescData
}
var file_leveling_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_leveling_proto_goTypes = []any{
(*SocialCreditRecord)(nil), // 0: proto.SocialCreditRecord
(*ExperienceRecord)(nil), // 1: proto.ExperienceRecord
(*AddSocialCreditRecordRequest)(nil), // 2: proto.AddSocialCreditRecordRequest
(*GetSocialCreditRequest)(nil), // 3: proto.GetSocialCreditRequest
(*SocialCreditResponse)(nil), // 4: proto.SocialCreditResponse
(*AddExperienceRecordRequest)(nil), // 5: proto.AddExperienceRecordRequest
(*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp
}
var file_leveling_proto_depIdxs = []int32{
6, // 0: proto.SocialCreditRecord.created_at:type_name -> google.protobuf.Timestamp
6, // 1: proto.SocialCreditRecord.updated_at:type_name -> google.protobuf.Timestamp
6, // 2: proto.ExperienceRecord.created_at:type_name -> google.protobuf.Timestamp
6, // 3: proto.ExperienceRecord.updated_at:type_name -> google.protobuf.Timestamp
6, // 4: proto.AddSocialCreditRecordRequest.expired_at:type_name -> google.protobuf.Timestamp
2, // 5: proto.SocialCreditService.AddRecord:input_type -> proto.AddSocialCreditRecordRequest
3, // 6: proto.SocialCreditService.GetSocialCredit:input_type -> proto.GetSocialCreditRequest
5, // 7: proto.ExperienceService.AddRecord:input_type -> proto.AddExperienceRecordRequest
0, // 8: proto.SocialCreditService.AddRecord:output_type -> proto.SocialCreditRecord
4, // 9: proto.SocialCreditService.GetSocialCredit:output_type -> proto.SocialCreditResponse
1, // 10: proto.ExperienceService.AddRecord:output_type -> proto.ExperienceRecord
8, // [8:11] is the sub-list for method output_type
5, // [5:8] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_leveling_proto_init() }
func file_leveling_proto_init() {
if File_leveling_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_leveling_proto_rawDesc), len(file_leveling_proto_rawDesc)),
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 2,
},
GoTypes: file_leveling_proto_goTypes,
DependencyIndexes: file_leveling_proto_depIdxs,
MessageInfos: file_leveling_proto_msgTypes,
}.Build()
File_leveling_proto = out.File
file_leveling_proto_goTypes = nil
file_leveling_proto_depIdxs = nil
}

View File

@@ -0,0 +1,275 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.1
// source: leveling.proto
package gen
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
SocialCreditService_AddRecord_FullMethodName = "/proto.SocialCreditService/AddRecord"
SocialCreditService_GetSocialCredit_FullMethodName = "/proto.SocialCreditService/GetSocialCredit"
)
// SocialCreditServiceClient is the client API for SocialCreditService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// SocialCreditService provides operations for managing social credit scores
type SocialCreditServiceClient interface {
// Adds a new social credit record for an account
AddRecord(ctx context.Context, in *AddSocialCreditRecordRequest, opts ...grpc.CallOption) (*SocialCreditRecord, error)
// Gets the current social credit score for an account
GetSocialCredit(ctx context.Context, in *GetSocialCreditRequest, opts ...grpc.CallOption) (*SocialCreditResponse, error)
}
type socialCreditServiceClient struct {
cc grpc.ClientConnInterface
}
func NewSocialCreditServiceClient(cc grpc.ClientConnInterface) SocialCreditServiceClient {
return &socialCreditServiceClient{cc}
}
func (c *socialCreditServiceClient) AddRecord(ctx context.Context, in *AddSocialCreditRecordRequest, opts ...grpc.CallOption) (*SocialCreditRecord, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SocialCreditRecord)
err := c.cc.Invoke(ctx, SocialCreditService_AddRecord_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *socialCreditServiceClient) GetSocialCredit(ctx context.Context, in *GetSocialCreditRequest, opts ...grpc.CallOption) (*SocialCreditResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SocialCreditResponse)
err := c.cc.Invoke(ctx, SocialCreditService_GetSocialCredit_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// SocialCreditServiceServer is the server API for SocialCreditService service.
// All implementations must embed UnimplementedSocialCreditServiceServer
// for forward compatibility.
//
// SocialCreditService provides operations for managing social credit scores
type SocialCreditServiceServer interface {
// Adds a new social credit record for an account
AddRecord(context.Context, *AddSocialCreditRecordRequest) (*SocialCreditRecord, error)
// Gets the current social credit score for an account
GetSocialCredit(context.Context, *GetSocialCreditRequest) (*SocialCreditResponse, error)
mustEmbedUnimplementedSocialCreditServiceServer()
}
// UnimplementedSocialCreditServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedSocialCreditServiceServer struct{}
func (UnimplementedSocialCreditServiceServer) AddRecord(context.Context, *AddSocialCreditRecordRequest) (*SocialCreditRecord, error) {
return nil, status.Error(codes.Unimplemented, "method AddRecord not implemented")
}
func (UnimplementedSocialCreditServiceServer) GetSocialCredit(context.Context, *GetSocialCreditRequest) (*SocialCreditResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetSocialCredit not implemented")
}
func (UnimplementedSocialCreditServiceServer) mustEmbedUnimplementedSocialCreditServiceServer() {}
func (UnimplementedSocialCreditServiceServer) testEmbeddedByValue() {}
// UnsafeSocialCreditServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SocialCreditServiceServer will
// result in compilation errors.
type UnsafeSocialCreditServiceServer interface {
mustEmbedUnimplementedSocialCreditServiceServer()
}
func RegisterSocialCreditServiceServer(s grpc.ServiceRegistrar, srv SocialCreditServiceServer) {
// If the following call panics, it indicates UnimplementedSocialCreditServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&SocialCreditService_ServiceDesc, srv)
}
func _SocialCreditService_AddRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddSocialCreditRecordRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SocialCreditServiceServer).AddRecord(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SocialCreditService_AddRecord_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SocialCreditServiceServer).AddRecord(ctx, req.(*AddSocialCreditRecordRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SocialCreditService_GetSocialCredit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetSocialCreditRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SocialCreditServiceServer).GetSocialCredit(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SocialCreditService_GetSocialCredit_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SocialCreditServiceServer).GetSocialCredit(ctx, req.(*GetSocialCreditRequest))
}
return interceptor(ctx, in, info, handler)
}
// SocialCreditService_ServiceDesc is the grpc.ServiceDesc for SocialCreditService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var SocialCreditService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.SocialCreditService",
HandlerType: (*SocialCreditServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "AddRecord",
Handler: _SocialCreditService_AddRecord_Handler,
},
{
MethodName: "GetSocialCredit",
Handler: _SocialCreditService_GetSocialCredit_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "leveling.proto",
}
const (
ExperienceService_AddRecord_FullMethodName = "/proto.ExperienceService/AddRecord"
)
// ExperienceServiceClient is the client API for ExperienceService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// ExperienceService provides operations for managing experience points
type ExperienceServiceClient interface {
// Adds a new experience record for an account
AddRecord(ctx context.Context, in *AddExperienceRecordRequest, opts ...grpc.CallOption) (*ExperienceRecord, error)
}
type experienceServiceClient struct {
cc grpc.ClientConnInterface
}
func NewExperienceServiceClient(cc grpc.ClientConnInterface) ExperienceServiceClient {
return &experienceServiceClient{cc}
}
func (c *experienceServiceClient) AddRecord(ctx context.Context, in *AddExperienceRecordRequest, opts ...grpc.CallOption) (*ExperienceRecord, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ExperienceRecord)
err := c.cc.Invoke(ctx, ExperienceService_AddRecord_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ExperienceServiceServer is the server API for ExperienceService service.
// All implementations must embed UnimplementedExperienceServiceServer
// for forward compatibility.
//
// ExperienceService provides operations for managing experience points
type ExperienceServiceServer interface {
// Adds a new experience record for an account
AddRecord(context.Context, *AddExperienceRecordRequest) (*ExperienceRecord, error)
mustEmbedUnimplementedExperienceServiceServer()
}
// UnimplementedExperienceServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedExperienceServiceServer struct{}
func (UnimplementedExperienceServiceServer) AddRecord(context.Context, *AddExperienceRecordRequest) (*ExperienceRecord, error) {
return nil, status.Error(codes.Unimplemented, "method AddRecord not implemented")
}
func (UnimplementedExperienceServiceServer) mustEmbedUnimplementedExperienceServiceServer() {}
func (UnimplementedExperienceServiceServer) testEmbeddedByValue() {}
// UnsafeExperienceServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ExperienceServiceServer will
// result in compilation errors.
type UnsafeExperienceServiceServer interface {
mustEmbedUnimplementedExperienceServiceServer()
}
func RegisterExperienceServiceServer(s grpc.ServiceRegistrar, srv ExperienceServiceServer) {
// If the following call panics, it indicates UnimplementedExperienceServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&ExperienceService_ServiceDesc, srv)
}
func _ExperienceService_AddRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddExperienceRecordRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ExperienceServiceServer).AddRecord(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ExperienceService_AddRecord_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ExperienceServiceServer).AddRecord(ctx, req.(*AddExperienceRecordRequest))
}
return interceptor(ctx, in, info, handler)
}
// ExperienceService_ServiceDesc is the grpc.ServiceDesc for ExperienceService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ExperienceService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.ExperienceService",
HandlerType: (*ExperienceServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "AddRecord",
Handler: _ExperienceService_AddRecord_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "leveling.proto",
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,243 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.1
// source: post.proto
package gen
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
PostService_GetPost_FullMethodName = "/proto.PostService/GetPost"
PostService_GetPostBatch_FullMethodName = "/proto.PostService/GetPostBatch"
PostService_SearchPosts_FullMethodName = "/proto.PostService/SearchPosts"
PostService_ListPosts_FullMethodName = "/proto.PostService/ListPosts"
)
// PostServiceClient is the client API for PostService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PostServiceClient interface {
// Get a single post by id
GetPost(ctx context.Context, in *GetPostRequest, opts ...grpc.CallOption) (*Post, error)
// Get multiple posts by ids
GetPostBatch(ctx context.Context, in *GetPostBatchRequest, opts ...grpc.CallOption) (*GetPostBatchResponse, error)
// Search posts
SearchPosts(ctx context.Context, in *SearchPostsRequest, opts ...grpc.CallOption) (*SearchPostsResponse, error)
// List posts with filters
ListPosts(ctx context.Context, in *ListPostsRequest, opts ...grpc.CallOption) (*ListPostsResponse, error)
}
type postServiceClient struct {
cc grpc.ClientConnInterface
}
func NewPostServiceClient(cc grpc.ClientConnInterface) PostServiceClient {
return &postServiceClient{cc}
}
func (c *postServiceClient) GetPost(ctx context.Context, in *GetPostRequest, opts ...grpc.CallOption) (*Post, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Post)
err := c.cc.Invoke(ctx, PostService_GetPost_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postServiceClient) GetPostBatch(ctx context.Context, in *GetPostBatchRequest, opts ...grpc.CallOption) (*GetPostBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetPostBatchResponse)
err := c.cc.Invoke(ctx, PostService_GetPostBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postServiceClient) SearchPosts(ctx context.Context, in *SearchPostsRequest, opts ...grpc.CallOption) (*SearchPostsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SearchPostsResponse)
err := c.cc.Invoke(ctx, PostService_SearchPosts_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postServiceClient) ListPosts(ctx context.Context, in *ListPostsRequest, opts ...grpc.CallOption) (*ListPostsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListPostsResponse)
err := c.cc.Invoke(ctx, PostService_ListPosts_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// PostServiceServer is the server API for PostService service.
// All implementations must embed UnimplementedPostServiceServer
// for forward compatibility.
type PostServiceServer interface {
// Get a single post by id
GetPost(context.Context, *GetPostRequest) (*Post, error)
// Get multiple posts by ids
GetPostBatch(context.Context, *GetPostBatchRequest) (*GetPostBatchResponse, error)
// Search posts
SearchPosts(context.Context, *SearchPostsRequest) (*SearchPostsResponse, error)
// List posts with filters
ListPosts(context.Context, *ListPostsRequest) (*ListPostsResponse, error)
mustEmbedUnimplementedPostServiceServer()
}
// UnimplementedPostServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedPostServiceServer struct{}
func (UnimplementedPostServiceServer) GetPost(context.Context, *GetPostRequest) (*Post, error) {
return nil, status.Error(codes.Unimplemented, "method GetPost not implemented")
}
func (UnimplementedPostServiceServer) GetPostBatch(context.Context, *GetPostBatchRequest) (*GetPostBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetPostBatch not implemented")
}
func (UnimplementedPostServiceServer) SearchPosts(context.Context, *SearchPostsRequest) (*SearchPostsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SearchPosts not implemented")
}
func (UnimplementedPostServiceServer) ListPosts(context.Context, *ListPostsRequest) (*ListPostsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListPosts not implemented")
}
func (UnimplementedPostServiceServer) mustEmbedUnimplementedPostServiceServer() {}
func (UnimplementedPostServiceServer) testEmbeddedByValue() {}
// UnsafePostServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PostServiceServer will
// result in compilation errors.
type UnsafePostServiceServer interface {
mustEmbedUnimplementedPostServiceServer()
}
func RegisterPostServiceServer(s grpc.ServiceRegistrar, srv PostServiceServer) {
// If the following call panics, it indicates UnimplementedPostServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&PostService_ServiceDesc, srv)
}
func _PostService_GetPost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPostRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServiceServer).GetPost(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PostService_GetPost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).GetPost(ctx, req.(*GetPostRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PostService_GetPostBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPostBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServiceServer).GetPostBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PostService_GetPostBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).GetPostBatch(ctx, req.(*GetPostBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PostService_SearchPosts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SearchPostsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServiceServer).SearchPosts(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PostService_SearchPosts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).SearchPosts(ctx, req.(*SearchPostsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PostService_ListPosts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListPostsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServiceServer).ListPosts(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PostService_ListPosts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).ListPosts(ctx, req.(*ListPostsRequest))
}
return interceptor(ctx, in, info, handler)
}
// PostService_ServiceDesc is the grpc.ServiceDesc for PostService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PostService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.PostService",
HandlerType: (*PostServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetPost",
Handler: _PostService_GetPost_Handler,
},
{
MethodName: "GetPostBatch",
Handler: _PostService_GetPostBatch_Handler,
},
{
MethodName: "SearchPosts",
Handler: _PostService_SearchPosts_Handler,
},
{
MethodName: "ListPosts",
Handler: _PostService_ListPosts_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "post.proto",
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,350 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.1
// source: publisher.proto
package gen
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
PublisherService_GetPublisher_FullMethodName = "/proto.PublisherService/GetPublisher"
PublisherService_GetPublisherBatch_FullMethodName = "/proto.PublisherService/GetPublisherBatch"
PublisherService_ListPublishers_FullMethodName = "/proto.PublisherService/ListPublishers"
PublisherService_ListPublisherMembers_FullMethodName = "/proto.PublisherService/ListPublisherMembers"
PublisherService_SetPublisherFeatureFlag_FullMethodName = "/proto.PublisherService/SetPublisherFeatureFlag"
PublisherService_HasPublisherFeature_FullMethodName = "/proto.PublisherService/HasPublisherFeature"
PublisherService_IsPublisherMember_FullMethodName = "/proto.PublisherService/IsPublisherMember"
)
// PublisherServiceClient is the client API for PublisherService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PublisherServiceClient interface {
GetPublisher(ctx context.Context, in *GetPublisherRequest, opts ...grpc.CallOption) (*GetPublisherResponse, error)
GetPublisherBatch(ctx context.Context, in *GetPublisherBatchRequest, opts ...grpc.CallOption) (*ListPublishersResponse, error)
ListPublishers(ctx context.Context, in *ListPublishersRequest, opts ...grpc.CallOption) (*ListPublishersResponse, error)
ListPublisherMembers(ctx context.Context, in *ListPublisherMembersRequest, opts ...grpc.CallOption) (*ListPublisherMembersResponse, error)
SetPublisherFeatureFlag(ctx context.Context, in *SetPublisherFeatureFlagRequest, opts ...grpc.CallOption) (*wrapperspb.StringValue, error)
HasPublisherFeature(ctx context.Context, in *HasPublisherFeatureRequest, opts ...grpc.CallOption) (*HasPublisherFeatureResponse, error)
IsPublisherMember(ctx context.Context, in *IsPublisherMemberRequest, opts ...grpc.CallOption) (*IsPublisherMemberResponse, error)
}
type publisherServiceClient struct {
cc grpc.ClientConnInterface
}
func NewPublisherServiceClient(cc grpc.ClientConnInterface) PublisherServiceClient {
return &publisherServiceClient{cc}
}
func (c *publisherServiceClient) GetPublisher(ctx context.Context, in *GetPublisherRequest, opts ...grpc.CallOption) (*GetPublisherResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetPublisherResponse)
err := c.cc.Invoke(ctx, PublisherService_GetPublisher_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *publisherServiceClient) GetPublisherBatch(ctx context.Context, in *GetPublisherBatchRequest, opts ...grpc.CallOption) (*ListPublishersResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListPublishersResponse)
err := c.cc.Invoke(ctx, PublisherService_GetPublisherBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *publisherServiceClient) ListPublishers(ctx context.Context, in *ListPublishersRequest, opts ...grpc.CallOption) (*ListPublishersResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListPublishersResponse)
err := c.cc.Invoke(ctx, PublisherService_ListPublishers_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *publisherServiceClient) ListPublisherMembers(ctx context.Context, in *ListPublisherMembersRequest, opts ...grpc.CallOption) (*ListPublisherMembersResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListPublisherMembersResponse)
err := c.cc.Invoke(ctx, PublisherService_ListPublisherMembers_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *publisherServiceClient) SetPublisherFeatureFlag(ctx context.Context, in *SetPublisherFeatureFlagRequest, opts ...grpc.CallOption) (*wrapperspb.StringValue, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(wrapperspb.StringValue)
err := c.cc.Invoke(ctx, PublisherService_SetPublisherFeatureFlag_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *publisherServiceClient) HasPublisherFeature(ctx context.Context, in *HasPublisherFeatureRequest, opts ...grpc.CallOption) (*HasPublisherFeatureResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(HasPublisherFeatureResponse)
err := c.cc.Invoke(ctx, PublisherService_HasPublisherFeature_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *publisherServiceClient) IsPublisherMember(ctx context.Context, in *IsPublisherMemberRequest, opts ...grpc.CallOption) (*IsPublisherMemberResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(IsPublisherMemberResponse)
err := c.cc.Invoke(ctx, PublisherService_IsPublisherMember_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// PublisherServiceServer is the server API for PublisherService service.
// All implementations must embed UnimplementedPublisherServiceServer
// for forward compatibility.
type PublisherServiceServer interface {
GetPublisher(context.Context, *GetPublisherRequest) (*GetPublisherResponse, error)
GetPublisherBatch(context.Context, *GetPublisherBatchRequest) (*ListPublishersResponse, error)
ListPublishers(context.Context, *ListPublishersRequest) (*ListPublishersResponse, error)
ListPublisherMembers(context.Context, *ListPublisherMembersRequest) (*ListPublisherMembersResponse, error)
SetPublisherFeatureFlag(context.Context, *SetPublisherFeatureFlagRequest) (*wrapperspb.StringValue, error)
HasPublisherFeature(context.Context, *HasPublisherFeatureRequest) (*HasPublisherFeatureResponse, error)
IsPublisherMember(context.Context, *IsPublisherMemberRequest) (*IsPublisherMemberResponse, error)
mustEmbedUnimplementedPublisherServiceServer()
}
// UnimplementedPublisherServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedPublisherServiceServer struct{}
func (UnimplementedPublisherServiceServer) GetPublisher(context.Context, *GetPublisherRequest) (*GetPublisherResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetPublisher not implemented")
}
func (UnimplementedPublisherServiceServer) GetPublisherBatch(context.Context, *GetPublisherBatchRequest) (*ListPublishersResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetPublisherBatch not implemented")
}
func (UnimplementedPublisherServiceServer) ListPublishers(context.Context, *ListPublishersRequest) (*ListPublishersResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListPublishers not implemented")
}
func (UnimplementedPublisherServiceServer) ListPublisherMembers(context.Context, *ListPublisherMembersRequest) (*ListPublisherMembersResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListPublisherMembers not implemented")
}
func (UnimplementedPublisherServiceServer) SetPublisherFeatureFlag(context.Context, *SetPublisherFeatureFlagRequest) (*wrapperspb.StringValue, error) {
return nil, status.Error(codes.Unimplemented, "method SetPublisherFeatureFlag not implemented")
}
func (UnimplementedPublisherServiceServer) HasPublisherFeature(context.Context, *HasPublisherFeatureRequest) (*HasPublisherFeatureResponse, error) {
return nil, status.Error(codes.Unimplemented, "method HasPublisherFeature not implemented")
}
func (UnimplementedPublisherServiceServer) IsPublisherMember(context.Context, *IsPublisherMemberRequest) (*IsPublisherMemberResponse, error) {
return nil, status.Error(codes.Unimplemented, "method IsPublisherMember not implemented")
}
func (UnimplementedPublisherServiceServer) mustEmbedUnimplementedPublisherServiceServer() {}
func (UnimplementedPublisherServiceServer) testEmbeddedByValue() {}
// UnsafePublisherServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PublisherServiceServer will
// result in compilation errors.
type UnsafePublisherServiceServer interface {
mustEmbedUnimplementedPublisherServiceServer()
}
func RegisterPublisherServiceServer(s grpc.ServiceRegistrar, srv PublisherServiceServer) {
// If the following call panics, it indicates UnimplementedPublisherServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&PublisherService_ServiceDesc, srv)
}
func _PublisherService_GetPublisher_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPublisherRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PublisherServiceServer).GetPublisher(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PublisherService_GetPublisher_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PublisherServiceServer).GetPublisher(ctx, req.(*GetPublisherRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PublisherService_GetPublisherBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPublisherBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PublisherServiceServer).GetPublisherBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PublisherService_GetPublisherBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PublisherServiceServer).GetPublisherBatch(ctx, req.(*GetPublisherBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PublisherService_ListPublishers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListPublishersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PublisherServiceServer).ListPublishers(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PublisherService_ListPublishers_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PublisherServiceServer).ListPublishers(ctx, req.(*ListPublishersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PublisherService_ListPublisherMembers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListPublisherMembersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PublisherServiceServer).ListPublisherMembers(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PublisherService_ListPublisherMembers_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PublisherServiceServer).ListPublisherMembers(ctx, req.(*ListPublisherMembersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PublisherService_SetPublisherFeatureFlag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetPublisherFeatureFlagRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PublisherServiceServer).SetPublisherFeatureFlag(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PublisherService_SetPublisherFeatureFlag_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PublisherServiceServer).SetPublisherFeatureFlag(ctx, req.(*SetPublisherFeatureFlagRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PublisherService_HasPublisherFeature_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HasPublisherFeatureRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PublisherServiceServer).HasPublisherFeature(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PublisherService_HasPublisherFeature_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PublisherServiceServer).HasPublisherFeature(ctx, req.(*HasPublisherFeatureRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PublisherService_IsPublisherMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IsPublisherMemberRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PublisherServiceServer).IsPublisherMember(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PublisherService_IsPublisherMember_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PublisherServiceServer).IsPublisherMember(ctx, req.(*IsPublisherMemberRequest))
}
return interceptor(ctx, in, info, handler)
}
// PublisherService_ServiceDesc is the grpc.ServiceDesc for PublisherService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PublisherService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.PublisherService",
HandlerType: (*PublisherServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetPublisher",
Handler: _PublisherService_GetPublisher_Handler,
},
{
MethodName: "GetPublisherBatch",
Handler: _PublisherService_GetPublisherBatch_Handler,
},
{
MethodName: "ListPublishers",
Handler: _PublisherService_ListPublishers_Handler,
},
{
MethodName: "ListPublisherMembers",
Handler: _PublisherService_ListPublisherMembers_Handler,
},
{
MethodName: "SetPublisherFeatureFlag",
Handler: _PublisherService_SetPublisherFeatureFlag_Handler,
},
{
MethodName: "HasPublisherFeature",
Handler: _PublisherService_HasPublisherFeature_Handler,
},
{
MethodName: "IsPublisherMember",
Handler: _PublisherService_IsPublisherMember_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "publisher.proto",
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,445 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.1
// source: realm.proto
package gen
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
RealmService_GetRealm_FullMethodName = "/proto.RealmService/GetRealm"
RealmService_GetRealmBatch_FullMethodName = "/proto.RealmService/GetRealmBatch"
RealmService_GetUserRealms_FullMethodName = "/proto.RealmService/GetUserRealms"
RealmService_GetPublicRealms_FullMethodName = "/proto.RealmService/GetPublicRealms"
RealmService_SearchRealms_FullMethodName = "/proto.RealmService/SearchRealms"
RealmService_SendInviteNotify_FullMethodName = "/proto.RealmService/SendInviteNotify"
RealmService_IsMemberWithRole_FullMethodName = "/proto.RealmService/IsMemberWithRole"
RealmService_LoadMemberAccount_FullMethodName = "/proto.RealmService/LoadMemberAccount"
RealmService_LoadMemberAccounts_FullMethodName = "/proto.RealmService/LoadMemberAccounts"
)
// RealmServiceClient is the client API for RealmService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type RealmServiceClient interface {
// Get realm by id or slug
GetRealm(ctx context.Context, in *GetRealmRequest, opts ...grpc.CallOption) (*Realm, error)
// Get realm batch by ids
GetRealmBatch(ctx context.Context, in *GetRealmBatchRequest, opts ...grpc.CallOption) (*GetRealmBatchResponse, error)
// Get realms for a user
GetUserRealms(ctx context.Context, in *GetUserRealmsRequest, opts ...grpc.CallOption) (*GetUserRealmsResponse, error)
// Get public realms
GetPublicRealms(ctx context.Context, in *GetPublicRealmsRequest, opts ...grpc.CallOption) (*GetPublicRealmsResponse, error)
// Search public realms
SearchRealms(ctx context.Context, in *SearchRealmsRequest, opts ...grpc.CallOption) (*GetPublicRealmsResponse, error)
// Send invitation notification
SendInviteNotify(ctx context.Context, in *SendInviteNotifyRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Check if member has required role
IsMemberWithRole(ctx context.Context, in *IsMemberWithRoleRequest, opts ...grpc.CallOption) (*wrapperspb.BoolValue, error)
// Load account for a member
LoadMemberAccount(ctx context.Context, in *LoadMemberAccountRequest, opts ...grpc.CallOption) (*RealmMember, error)
// Load accounts for members
LoadMemberAccounts(ctx context.Context, in *LoadMemberAccountsRequest, opts ...grpc.CallOption) (*LoadMemberAccountsResponse, error)
}
type realmServiceClient struct {
cc grpc.ClientConnInterface
}
func NewRealmServiceClient(cc grpc.ClientConnInterface) RealmServiceClient {
return &realmServiceClient{cc}
}
func (c *realmServiceClient) GetRealm(ctx context.Context, in *GetRealmRequest, opts ...grpc.CallOption) (*Realm, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Realm)
err := c.cc.Invoke(ctx, RealmService_GetRealm_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *realmServiceClient) GetRealmBatch(ctx context.Context, in *GetRealmBatchRequest, opts ...grpc.CallOption) (*GetRealmBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetRealmBatchResponse)
err := c.cc.Invoke(ctx, RealmService_GetRealmBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *realmServiceClient) GetUserRealms(ctx context.Context, in *GetUserRealmsRequest, opts ...grpc.CallOption) (*GetUserRealmsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetUserRealmsResponse)
err := c.cc.Invoke(ctx, RealmService_GetUserRealms_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *realmServiceClient) GetPublicRealms(ctx context.Context, in *GetPublicRealmsRequest, opts ...grpc.CallOption) (*GetPublicRealmsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetPublicRealmsResponse)
err := c.cc.Invoke(ctx, RealmService_GetPublicRealms_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *realmServiceClient) SearchRealms(ctx context.Context, in *SearchRealmsRequest, opts ...grpc.CallOption) (*GetPublicRealmsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetPublicRealmsResponse)
err := c.cc.Invoke(ctx, RealmService_SearchRealms_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *realmServiceClient) SendInviteNotify(ctx context.Context, in *SendInviteNotifyRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RealmService_SendInviteNotify_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *realmServiceClient) IsMemberWithRole(ctx context.Context, in *IsMemberWithRoleRequest, opts ...grpc.CallOption) (*wrapperspb.BoolValue, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(wrapperspb.BoolValue)
err := c.cc.Invoke(ctx, RealmService_IsMemberWithRole_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *realmServiceClient) LoadMemberAccount(ctx context.Context, in *LoadMemberAccountRequest, opts ...grpc.CallOption) (*RealmMember, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RealmMember)
err := c.cc.Invoke(ctx, RealmService_LoadMemberAccount_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *realmServiceClient) LoadMemberAccounts(ctx context.Context, in *LoadMemberAccountsRequest, opts ...grpc.CallOption) (*LoadMemberAccountsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(LoadMemberAccountsResponse)
err := c.cc.Invoke(ctx, RealmService_LoadMemberAccounts_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// RealmServiceServer is the server API for RealmService service.
// All implementations must embed UnimplementedRealmServiceServer
// for forward compatibility.
type RealmServiceServer interface {
// Get realm by id or slug
GetRealm(context.Context, *GetRealmRequest) (*Realm, error)
// Get realm batch by ids
GetRealmBatch(context.Context, *GetRealmBatchRequest) (*GetRealmBatchResponse, error)
// Get realms for a user
GetUserRealms(context.Context, *GetUserRealmsRequest) (*GetUserRealmsResponse, error)
// Get public realms
GetPublicRealms(context.Context, *GetPublicRealmsRequest) (*GetPublicRealmsResponse, error)
// Search public realms
SearchRealms(context.Context, *SearchRealmsRequest) (*GetPublicRealmsResponse, error)
// Send invitation notification
SendInviteNotify(context.Context, *SendInviteNotifyRequest) (*emptypb.Empty, error)
// Check if member has required role
IsMemberWithRole(context.Context, *IsMemberWithRoleRequest) (*wrapperspb.BoolValue, error)
// Load account for a member
LoadMemberAccount(context.Context, *LoadMemberAccountRequest) (*RealmMember, error)
// Load accounts for members
LoadMemberAccounts(context.Context, *LoadMemberAccountsRequest) (*LoadMemberAccountsResponse, error)
mustEmbedUnimplementedRealmServiceServer()
}
// UnimplementedRealmServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedRealmServiceServer struct{}
func (UnimplementedRealmServiceServer) GetRealm(context.Context, *GetRealmRequest) (*Realm, error) {
return nil, status.Error(codes.Unimplemented, "method GetRealm not implemented")
}
func (UnimplementedRealmServiceServer) GetRealmBatch(context.Context, *GetRealmBatchRequest) (*GetRealmBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetRealmBatch not implemented")
}
func (UnimplementedRealmServiceServer) GetUserRealms(context.Context, *GetUserRealmsRequest) (*GetUserRealmsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetUserRealms not implemented")
}
func (UnimplementedRealmServiceServer) GetPublicRealms(context.Context, *GetPublicRealmsRequest) (*GetPublicRealmsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetPublicRealms not implemented")
}
func (UnimplementedRealmServiceServer) SearchRealms(context.Context, *SearchRealmsRequest) (*GetPublicRealmsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SearchRealms not implemented")
}
func (UnimplementedRealmServiceServer) SendInviteNotify(context.Context, *SendInviteNotifyRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method SendInviteNotify not implemented")
}
func (UnimplementedRealmServiceServer) IsMemberWithRole(context.Context, *IsMemberWithRoleRequest) (*wrapperspb.BoolValue, error) {
return nil, status.Error(codes.Unimplemented, "method IsMemberWithRole not implemented")
}
func (UnimplementedRealmServiceServer) LoadMemberAccount(context.Context, *LoadMemberAccountRequest) (*RealmMember, error) {
return nil, status.Error(codes.Unimplemented, "method LoadMemberAccount not implemented")
}
func (UnimplementedRealmServiceServer) LoadMemberAccounts(context.Context, *LoadMemberAccountsRequest) (*LoadMemberAccountsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method LoadMemberAccounts not implemented")
}
func (UnimplementedRealmServiceServer) mustEmbedUnimplementedRealmServiceServer() {}
func (UnimplementedRealmServiceServer) testEmbeddedByValue() {}
// UnsafeRealmServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to RealmServiceServer will
// result in compilation errors.
type UnsafeRealmServiceServer interface {
mustEmbedUnimplementedRealmServiceServer()
}
func RegisterRealmServiceServer(s grpc.ServiceRegistrar, srv RealmServiceServer) {
// If the following call panics, it indicates UnimplementedRealmServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&RealmService_ServiceDesc, srv)
}
func _RealmService_GetRealm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetRealmRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RealmServiceServer).GetRealm(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RealmService_GetRealm_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).GetRealm(ctx, req.(*GetRealmRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RealmService_GetRealmBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetRealmBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RealmServiceServer).GetRealmBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RealmService_GetRealmBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).GetRealmBatch(ctx, req.(*GetRealmBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RealmService_GetUserRealms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUserRealmsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RealmServiceServer).GetUserRealms(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RealmService_GetUserRealms_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).GetUserRealms(ctx, req.(*GetUserRealmsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RealmService_GetPublicRealms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPublicRealmsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RealmServiceServer).GetPublicRealms(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RealmService_GetPublicRealms_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).GetPublicRealms(ctx, req.(*GetPublicRealmsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RealmService_SearchRealms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SearchRealmsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RealmServiceServer).SearchRealms(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RealmService_SearchRealms_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).SearchRealms(ctx, req.(*SearchRealmsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RealmService_SendInviteNotify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendInviteNotifyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RealmServiceServer).SendInviteNotify(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RealmService_SendInviteNotify_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).SendInviteNotify(ctx, req.(*SendInviteNotifyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RealmService_IsMemberWithRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IsMemberWithRoleRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RealmServiceServer).IsMemberWithRole(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RealmService_IsMemberWithRole_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).IsMemberWithRole(ctx, req.(*IsMemberWithRoleRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RealmService_LoadMemberAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoadMemberAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RealmServiceServer).LoadMemberAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RealmService_LoadMemberAccount_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).LoadMemberAccount(ctx, req.(*LoadMemberAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RealmService_LoadMemberAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoadMemberAccountsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RealmServiceServer).LoadMemberAccounts(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RealmService_LoadMemberAccounts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).LoadMemberAccounts(ctx, req.(*LoadMemberAccountsRequest))
}
return interceptor(ctx, in, info, handler)
}
// RealmService_ServiceDesc is the grpc.ServiceDesc for RealmService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var RealmService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.RealmService",
HandlerType: (*RealmServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetRealm",
Handler: _RealmService_GetRealm_Handler,
},
{
MethodName: "GetRealmBatch",
Handler: _RealmService_GetRealmBatch_Handler,
},
{
MethodName: "GetUserRealms",
Handler: _RealmService_GetUserRealms_Handler,
},
{
MethodName: "GetPublicRealms",
Handler: _RealmService_GetPublicRealms_Handler,
},
{
MethodName: "SearchRealms",
Handler: _RealmService_SearchRealms_Handler,
},
{
MethodName: "SendInviteNotify",
Handler: _RealmService_SendInviteNotify_Handler,
},
{
MethodName: "IsMemberWithRole",
Handler: _RealmService_IsMemberWithRole_Handler,
},
{
MethodName: "LoadMemberAccount",
Handler: _RealmService_LoadMemberAccount_Handler,
},
{
MethodName: "LoadMemberAccounts",
Handler: _RealmService_LoadMemberAccounts_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "realm.proto",
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,588 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.1
// source: ring.proto
package gen
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
RingService_SendEmail_FullMethodName = "/proto.RingService/SendEmail"
RingService_PushWebSocketPacket_FullMethodName = "/proto.RingService/PushWebSocketPacket"
RingService_PushWebSocketPacketToUsers_FullMethodName = "/proto.RingService/PushWebSocketPacketToUsers"
RingService_PushWebSocketPacketToDevice_FullMethodName = "/proto.RingService/PushWebSocketPacketToDevice"
RingService_PushWebSocketPacketToDevices_FullMethodName = "/proto.RingService/PushWebSocketPacketToDevices"
RingService_SendPushNotificationToUser_FullMethodName = "/proto.RingService/SendPushNotificationToUser"
RingService_SendPushNotificationToUsers_FullMethodName = "/proto.RingService/SendPushNotificationToUsers"
RingService_UnsubscribePushNotifications_FullMethodName = "/proto.RingService/UnsubscribePushNotifications"
RingService_GetWebsocketConnectionStatus_FullMethodName = "/proto.RingService/GetWebsocketConnectionStatus"
RingService_GetWebsocketConnectionStatusBatch_FullMethodName = "/proto.RingService/GetWebsocketConnectionStatusBatch"
)
// RingServiceClient is the client API for RingService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// RingService provides methods to send various types of notifications.
type RingServiceClient interface {
// Sends an email.
SendEmail(ctx context.Context, in *SendEmailRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Pushes a packet to a user via WebSocket.
PushWebSocketPacket(ctx context.Context, in *PushWebSocketPacketRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Pushes a packet to a list of users via WebSocket.
PushWebSocketPacketToUsers(ctx context.Context, in *PushWebSocketPacketToUsersRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Pushes a packet to a device via WebSocket.
PushWebSocketPacketToDevice(ctx context.Context, in *PushWebSocketPacketToDeviceRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Pushes a packet to a list of devices via WebSocket.
PushWebSocketPacketToDevices(ctx context.Context, in *PushWebSocketPacketToDevicesRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Sends a push notification to a user.
SendPushNotificationToUser(ctx context.Context, in *SendPushNotificationToUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Sends a push notification to a list of users.
SendPushNotificationToUsers(ctx context.Context, in *SendPushNotificationToUsersRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Unsubscribes a device from push notifications.
UnsubscribePushNotifications(ctx context.Context, in *UnsubscribePushNotificationsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Gets the WebSocket connection status for a device or user.
GetWebsocketConnectionStatus(ctx context.Context, in *GetWebsocketConnectionStatusRequest, opts ...grpc.CallOption) (*GetWebsocketConnectionStatusResponse, error)
GetWebsocketConnectionStatusBatch(ctx context.Context, in *GetWebsocketConnectionStatusBatchRequest, opts ...grpc.CallOption) (*GetWebsocketConnectionStatusBatchResponse, error)
}
type ringServiceClient struct {
cc grpc.ClientConnInterface
}
func NewRingServiceClient(cc grpc.ClientConnInterface) RingServiceClient {
return &ringServiceClient{cc}
}
func (c *ringServiceClient) SendEmail(ctx context.Context, in *SendEmailRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_SendEmail_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) PushWebSocketPacket(ctx context.Context, in *PushWebSocketPacketRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_PushWebSocketPacket_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) PushWebSocketPacketToUsers(ctx context.Context, in *PushWebSocketPacketToUsersRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_PushWebSocketPacketToUsers_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) PushWebSocketPacketToDevice(ctx context.Context, in *PushWebSocketPacketToDeviceRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_PushWebSocketPacketToDevice_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) PushWebSocketPacketToDevices(ctx context.Context, in *PushWebSocketPacketToDevicesRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_PushWebSocketPacketToDevices_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) SendPushNotificationToUser(ctx context.Context, in *SendPushNotificationToUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_SendPushNotificationToUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) SendPushNotificationToUsers(ctx context.Context, in *SendPushNotificationToUsersRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_SendPushNotificationToUsers_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) UnsubscribePushNotifications(ctx context.Context, in *UnsubscribePushNotificationsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_UnsubscribePushNotifications_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) GetWebsocketConnectionStatus(ctx context.Context, in *GetWebsocketConnectionStatusRequest, opts ...grpc.CallOption) (*GetWebsocketConnectionStatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetWebsocketConnectionStatusResponse)
err := c.cc.Invoke(ctx, RingService_GetWebsocketConnectionStatus_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) GetWebsocketConnectionStatusBatch(ctx context.Context, in *GetWebsocketConnectionStatusBatchRequest, opts ...grpc.CallOption) (*GetWebsocketConnectionStatusBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetWebsocketConnectionStatusBatchResponse)
err := c.cc.Invoke(ctx, RingService_GetWebsocketConnectionStatusBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// RingServiceServer is the server API for RingService service.
// All implementations must embed UnimplementedRingServiceServer
// for forward compatibility.
//
// RingService provides methods to send various types of notifications.
type RingServiceServer interface {
// Sends an email.
SendEmail(context.Context, *SendEmailRequest) (*emptypb.Empty, error)
// Pushes a packet to a user via WebSocket.
PushWebSocketPacket(context.Context, *PushWebSocketPacketRequest) (*emptypb.Empty, error)
// Pushes a packet to a list of users via WebSocket.
PushWebSocketPacketToUsers(context.Context, *PushWebSocketPacketToUsersRequest) (*emptypb.Empty, error)
// Pushes a packet to a device via WebSocket.
PushWebSocketPacketToDevice(context.Context, *PushWebSocketPacketToDeviceRequest) (*emptypb.Empty, error)
// Pushes a packet to a list of devices via WebSocket.
PushWebSocketPacketToDevices(context.Context, *PushWebSocketPacketToDevicesRequest) (*emptypb.Empty, error)
// Sends a push notification to a user.
SendPushNotificationToUser(context.Context, *SendPushNotificationToUserRequest) (*emptypb.Empty, error)
// Sends a push notification to a list of users.
SendPushNotificationToUsers(context.Context, *SendPushNotificationToUsersRequest) (*emptypb.Empty, error)
// Unsubscribes a device from push notifications.
UnsubscribePushNotifications(context.Context, *UnsubscribePushNotificationsRequest) (*emptypb.Empty, error)
// Gets the WebSocket connection status for a device or user.
GetWebsocketConnectionStatus(context.Context, *GetWebsocketConnectionStatusRequest) (*GetWebsocketConnectionStatusResponse, error)
GetWebsocketConnectionStatusBatch(context.Context, *GetWebsocketConnectionStatusBatchRequest) (*GetWebsocketConnectionStatusBatchResponse, error)
mustEmbedUnimplementedRingServiceServer()
}
// UnimplementedRingServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedRingServiceServer struct{}
func (UnimplementedRingServiceServer) SendEmail(context.Context, *SendEmailRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method SendEmail not implemented")
}
func (UnimplementedRingServiceServer) PushWebSocketPacket(context.Context, *PushWebSocketPacketRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method PushWebSocketPacket not implemented")
}
func (UnimplementedRingServiceServer) PushWebSocketPacketToUsers(context.Context, *PushWebSocketPacketToUsersRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method PushWebSocketPacketToUsers not implemented")
}
func (UnimplementedRingServiceServer) PushWebSocketPacketToDevice(context.Context, *PushWebSocketPacketToDeviceRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method PushWebSocketPacketToDevice not implemented")
}
func (UnimplementedRingServiceServer) PushWebSocketPacketToDevices(context.Context, *PushWebSocketPacketToDevicesRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method PushWebSocketPacketToDevices not implemented")
}
func (UnimplementedRingServiceServer) SendPushNotificationToUser(context.Context, *SendPushNotificationToUserRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method SendPushNotificationToUser not implemented")
}
func (UnimplementedRingServiceServer) SendPushNotificationToUsers(context.Context, *SendPushNotificationToUsersRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method SendPushNotificationToUsers not implemented")
}
func (UnimplementedRingServiceServer) UnsubscribePushNotifications(context.Context, *UnsubscribePushNotificationsRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method UnsubscribePushNotifications not implemented")
}
func (UnimplementedRingServiceServer) GetWebsocketConnectionStatus(context.Context, *GetWebsocketConnectionStatusRequest) (*GetWebsocketConnectionStatusResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetWebsocketConnectionStatus not implemented")
}
func (UnimplementedRingServiceServer) GetWebsocketConnectionStatusBatch(context.Context, *GetWebsocketConnectionStatusBatchRequest) (*GetWebsocketConnectionStatusBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetWebsocketConnectionStatusBatch not implemented")
}
func (UnimplementedRingServiceServer) mustEmbedUnimplementedRingServiceServer() {}
func (UnimplementedRingServiceServer) testEmbeddedByValue() {}
// UnsafeRingServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to RingServiceServer will
// result in compilation errors.
type UnsafeRingServiceServer interface {
mustEmbedUnimplementedRingServiceServer()
}
func RegisterRingServiceServer(s grpc.ServiceRegistrar, srv RingServiceServer) {
// If the following call panics, it indicates UnimplementedRingServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&RingService_ServiceDesc, srv)
}
func _RingService_SendEmail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendEmailRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).SendEmail(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_SendEmail_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).SendEmail(ctx, req.(*SendEmailRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_PushWebSocketPacket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PushWebSocketPacketRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).PushWebSocketPacket(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_PushWebSocketPacket_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).PushWebSocketPacket(ctx, req.(*PushWebSocketPacketRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_PushWebSocketPacketToUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PushWebSocketPacketToUsersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).PushWebSocketPacketToUsers(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_PushWebSocketPacketToUsers_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).PushWebSocketPacketToUsers(ctx, req.(*PushWebSocketPacketToUsersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_PushWebSocketPacketToDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PushWebSocketPacketToDeviceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).PushWebSocketPacketToDevice(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_PushWebSocketPacketToDevice_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).PushWebSocketPacketToDevice(ctx, req.(*PushWebSocketPacketToDeviceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_PushWebSocketPacketToDevices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PushWebSocketPacketToDevicesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).PushWebSocketPacketToDevices(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_PushWebSocketPacketToDevices_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).PushWebSocketPacketToDevices(ctx, req.(*PushWebSocketPacketToDevicesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_SendPushNotificationToUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendPushNotificationToUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).SendPushNotificationToUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_SendPushNotificationToUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).SendPushNotificationToUser(ctx, req.(*SendPushNotificationToUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_SendPushNotificationToUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendPushNotificationToUsersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).SendPushNotificationToUsers(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_SendPushNotificationToUsers_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).SendPushNotificationToUsers(ctx, req.(*SendPushNotificationToUsersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_UnsubscribePushNotifications_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UnsubscribePushNotificationsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).UnsubscribePushNotifications(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_UnsubscribePushNotifications_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).UnsubscribePushNotifications(ctx, req.(*UnsubscribePushNotificationsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_GetWebsocketConnectionStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetWebsocketConnectionStatusRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).GetWebsocketConnectionStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_GetWebsocketConnectionStatus_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).GetWebsocketConnectionStatus(ctx, req.(*GetWebsocketConnectionStatusRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_GetWebsocketConnectionStatusBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetWebsocketConnectionStatusBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).GetWebsocketConnectionStatusBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_GetWebsocketConnectionStatusBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).GetWebsocketConnectionStatusBatch(ctx, req.(*GetWebsocketConnectionStatusBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
// RingService_ServiceDesc is the grpc.ServiceDesc for RingService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var RingService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.RingService",
HandlerType: (*RingServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "SendEmail",
Handler: _RingService_SendEmail_Handler,
},
{
MethodName: "PushWebSocketPacket",
Handler: _RingService_PushWebSocketPacket_Handler,
},
{
MethodName: "PushWebSocketPacketToUsers",
Handler: _RingService_PushWebSocketPacketToUsers_Handler,
},
{
MethodName: "PushWebSocketPacketToDevice",
Handler: _RingService_PushWebSocketPacketToDevice_Handler,
},
{
MethodName: "PushWebSocketPacketToDevices",
Handler: _RingService_PushWebSocketPacketToDevices_Handler,
},
{
MethodName: "SendPushNotificationToUser",
Handler: _RingService_SendPushNotificationToUser_Handler,
},
{
MethodName: "SendPushNotificationToUsers",
Handler: _RingService_SendPushNotificationToUsers_Handler,
},
{
MethodName: "UnsubscribePushNotifications",
Handler: _RingService_UnsubscribePushNotifications_Handler,
},
{
MethodName: "GetWebsocketConnectionStatus",
Handler: _RingService_GetWebsocketConnectionStatus_Handler,
},
{
MethodName: "GetWebsocketConnectionStatusBatch",
Handler: _RingService_GetWebsocketConnectionStatusBatch_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ring.proto",
}
const (
RingHandlerService_ReceiveWebSocketPacket_FullMethodName = "/proto.RingHandlerService/ReceiveWebSocketPacket"
)
// RingHandlerServiceClient is the client API for RingHandlerService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type RingHandlerServiceClient interface {
ReceiveWebSocketPacket(ctx context.Context, in *ReceiveWebSocketPacketRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type ringHandlerServiceClient struct {
cc grpc.ClientConnInterface
}
func NewRingHandlerServiceClient(cc grpc.ClientConnInterface) RingHandlerServiceClient {
return &ringHandlerServiceClient{cc}
}
func (c *ringHandlerServiceClient) ReceiveWebSocketPacket(ctx context.Context, in *ReceiveWebSocketPacketRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingHandlerService_ReceiveWebSocketPacket_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// RingHandlerServiceServer is the server API for RingHandlerService service.
// All implementations must embed UnimplementedRingHandlerServiceServer
// for forward compatibility.
type RingHandlerServiceServer interface {
ReceiveWebSocketPacket(context.Context, *ReceiveWebSocketPacketRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedRingHandlerServiceServer()
}
// UnimplementedRingHandlerServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedRingHandlerServiceServer struct{}
func (UnimplementedRingHandlerServiceServer) ReceiveWebSocketPacket(context.Context, *ReceiveWebSocketPacketRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method ReceiveWebSocketPacket not implemented")
}
func (UnimplementedRingHandlerServiceServer) mustEmbedUnimplementedRingHandlerServiceServer() {}
func (UnimplementedRingHandlerServiceServer) testEmbeddedByValue() {}
// UnsafeRingHandlerServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to RingHandlerServiceServer will
// result in compilation errors.
type UnsafeRingHandlerServiceServer interface {
mustEmbedUnimplementedRingHandlerServiceServer()
}
func RegisterRingHandlerServiceServer(s grpc.ServiceRegistrar, srv RingHandlerServiceServer) {
// If the following call panics, it indicates UnimplementedRingHandlerServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&RingHandlerService_ServiceDesc, srv)
}
func _RingHandlerService_ReceiveWebSocketPacket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReceiveWebSocketPacketRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingHandlerServiceServer).ReceiveWebSocketPacket(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingHandlerService_ReceiveWebSocketPacket_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingHandlerServiceServer).ReceiveWebSocketPacket(ctx, req.(*ReceiveWebSocketPacketRequest))
}
return interceptor(ctx, in, info, handler)
}
// RingHandlerService_ServiceDesc is the grpc.ServiceDesc for RingHandlerService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var RingHandlerService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.RingHandlerService",
HandlerType: (*RingHandlerServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ReceiveWebSocketPacket",
Handler: _RingHandlerService_ReceiveWebSocketPacket_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ring.proto",
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,527 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.1
// source: wallet.proto
package gen
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
WalletService_GetWallet_FullMethodName = "/proto.WalletService/GetWallet"
WalletService_CreateWallet_FullMethodName = "/proto.WalletService/CreateWallet"
WalletService_GetOrCreateWalletPocket_FullMethodName = "/proto.WalletService/GetOrCreateWalletPocket"
)
// WalletServiceClient is the client API for WalletService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type WalletServiceClient interface {
GetWallet(ctx context.Context, in *GetWalletRequest, opts ...grpc.CallOption) (*Wallet, error)
CreateWallet(ctx context.Context, in *CreateWalletRequest, opts ...grpc.CallOption) (*Wallet, error)
GetOrCreateWalletPocket(ctx context.Context, in *GetOrCreateWalletPocketRequest, opts ...grpc.CallOption) (*WalletPocket, error)
}
type walletServiceClient struct {
cc grpc.ClientConnInterface
}
func NewWalletServiceClient(cc grpc.ClientConnInterface) WalletServiceClient {
return &walletServiceClient{cc}
}
func (c *walletServiceClient) GetWallet(ctx context.Context, in *GetWalletRequest, opts ...grpc.CallOption) (*Wallet, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Wallet)
err := c.cc.Invoke(ctx, WalletService_GetWallet_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletServiceClient) CreateWallet(ctx context.Context, in *CreateWalletRequest, opts ...grpc.CallOption) (*Wallet, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Wallet)
err := c.cc.Invoke(ctx, WalletService_CreateWallet_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletServiceClient) GetOrCreateWalletPocket(ctx context.Context, in *GetOrCreateWalletPocketRequest, opts ...grpc.CallOption) (*WalletPocket, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(WalletPocket)
err := c.cc.Invoke(ctx, WalletService_GetOrCreateWalletPocket_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// WalletServiceServer is the server API for WalletService service.
// All implementations must embed UnimplementedWalletServiceServer
// for forward compatibility.
type WalletServiceServer interface {
GetWallet(context.Context, *GetWalletRequest) (*Wallet, error)
CreateWallet(context.Context, *CreateWalletRequest) (*Wallet, error)
GetOrCreateWalletPocket(context.Context, *GetOrCreateWalletPocketRequest) (*WalletPocket, error)
mustEmbedUnimplementedWalletServiceServer()
}
// UnimplementedWalletServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedWalletServiceServer struct{}
func (UnimplementedWalletServiceServer) GetWallet(context.Context, *GetWalletRequest) (*Wallet, error) {
return nil, status.Error(codes.Unimplemented, "method GetWallet not implemented")
}
func (UnimplementedWalletServiceServer) CreateWallet(context.Context, *CreateWalletRequest) (*Wallet, error) {
return nil, status.Error(codes.Unimplemented, "method CreateWallet not implemented")
}
func (UnimplementedWalletServiceServer) GetOrCreateWalletPocket(context.Context, *GetOrCreateWalletPocketRequest) (*WalletPocket, error) {
return nil, status.Error(codes.Unimplemented, "method GetOrCreateWalletPocket not implemented")
}
func (UnimplementedWalletServiceServer) mustEmbedUnimplementedWalletServiceServer() {}
func (UnimplementedWalletServiceServer) testEmbeddedByValue() {}
// UnsafeWalletServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to WalletServiceServer will
// result in compilation errors.
type UnsafeWalletServiceServer interface {
mustEmbedUnimplementedWalletServiceServer()
}
func RegisterWalletServiceServer(s grpc.ServiceRegistrar, srv WalletServiceServer) {
// If the following call panics, it indicates UnimplementedWalletServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&WalletService_ServiceDesc, srv)
}
func _WalletService_GetWallet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetWalletRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletServiceServer).GetWallet(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WalletService_GetWallet_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletServiceServer).GetWallet(ctx, req.(*GetWalletRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WalletService_CreateWallet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateWalletRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletServiceServer).CreateWallet(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WalletService_CreateWallet_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletServiceServer).CreateWallet(ctx, req.(*CreateWalletRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WalletService_GetOrCreateWalletPocket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetOrCreateWalletPocketRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletServiceServer).GetOrCreateWalletPocket(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WalletService_GetOrCreateWalletPocket_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletServiceServer).GetOrCreateWalletPocket(ctx, req.(*GetOrCreateWalletPocketRequest))
}
return interceptor(ctx, in, info, handler)
}
// WalletService_ServiceDesc is the grpc.ServiceDesc for WalletService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var WalletService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.WalletService",
HandlerType: (*WalletServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetWallet",
Handler: _WalletService_GetWallet_Handler,
},
{
MethodName: "CreateWallet",
Handler: _WalletService_CreateWallet_Handler,
},
{
MethodName: "GetOrCreateWalletPocket",
Handler: _WalletService_GetOrCreateWalletPocket_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "wallet.proto",
}
const (
PaymentService_CreateOrder_FullMethodName = "/proto.PaymentService/CreateOrder"
PaymentService_CreateTransactionWithAccount_FullMethodName = "/proto.PaymentService/CreateTransactionWithAccount"
PaymentService_CreateTransaction_FullMethodName = "/proto.PaymentService/CreateTransaction"
PaymentService_CancelOrder_FullMethodName = "/proto.PaymentService/CancelOrder"
PaymentService_RefundOrder_FullMethodName = "/proto.PaymentService/RefundOrder"
PaymentService_Transfer_FullMethodName = "/proto.PaymentService/Transfer"
PaymentService_GetWalletFund_FullMethodName = "/proto.PaymentService/GetWalletFund"
)
// PaymentServiceClient is the client API for PaymentService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PaymentServiceClient interface {
CreateOrder(ctx context.Context, in *CreateOrderRequest, opts ...grpc.CallOption) (*Order, error)
CreateTransactionWithAccount(ctx context.Context, in *CreateTransactionWithAccountRequest, opts ...grpc.CallOption) (*Transaction, error)
CreateTransaction(ctx context.Context, in *CreateTransactionRequest, opts ...grpc.CallOption) (*Transaction, error)
CancelOrder(ctx context.Context, in *CancelOrderRequest, opts ...grpc.CallOption) (*Order, error)
RefundOrder(ctx context.Context, in *RefundOrderRequest, opts ...grpc.CallOption) (*RefundOrderResponse, error)
Transfer(ctx context.Context, in *TransferRequest, opts ...grpc.CallOption) (*Transaction, error)
GetWalletFund(ctx context.Context, in *GetWalletFundRequest, opts ...grpc.CallOption) (*WalletFund, error)
}
type paymentServiceClient struct {
cc grpc.ClientConnInterface
}
func NewPaymentServiceClient(cc grpc.ClientConnInterface) PaymentServiceClient {
return &paymentServiceClient{cc}
}
func (c *paymentServiceClient) CreateOrder(ctx context.Context, in *CreateOrderRequest, opts ...grpc.CallOption) (*Order, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Order)
err := c.cc.Invoke(ctx, PaymentService_CreateOrder_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *paymentServiceClient) CreateTransactionWithAccount(ctx context.Context, in *CreateTransactionWithAccountRequest, opts ...grpc.CallOption) (*Transaction, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Transaction)
err := c.cc.Invoke(ctx, PaymentService_CreateTransactionWithAccount_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *paymentServiceClient) CreateTransaction(ctx context.Context, in *CreateTransactionRequest, opts ...grpc.CallOption) (*Transaction, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Transaction)
err := c.cc.Invoke(ctx, PaymentService_CreateTransaction_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *paymentServiceClient) CancelOrder(ctx context.Context, in *CancelOrderRequest, opts ...grpc.CallOption) (*Order, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Order)
err := c.cc.Invoke(ctx, PaymentService_CancelOrder_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *paymentServiceClient) RefundOrder(ctx context.Context, in *RefundOrderRequest, opts ...grpc.CallOption) (*RefundOrderResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RefundOrderResponse)
err := c.cc.Invoke(ctx, PaymentService_RefundOrder_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *paymentServiceClient) Transfer(ctx context.Context, in *TransferRequest, opts ...grpc.CallOption) (*Transaction, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Transaction)
err := c.cc.Invoke(ctx, PaymentService_Transfer_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *paymentServiceClient) GetWalletFund(ctx context.Context, in *GetWalletFundRequest, opts ...grpc.CallOption) (*WalletFund, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(WalletFund)
err := c.cc.Invoke(ctx, PaymentService_GetWalletFund_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// PaymentServiceServer is the server API for PaymentService service.
// All implementations must embed UnimplementedPaymentServiceServer
// for forward compatibility.
type PaymentServiceServer interface {
CreateOrder(context.Context, *CreateOrderRequest) (*Order, error)
CreateTransactionWithAccount(context.Context, *CreateTransactionWithAccountRequest) (*Transaction, error)
CreateTransaction(context.Context, *CreateTransactionRequest) (*Transaction, error)
CancelOrder(context.Context, *CancelOrderRequest) (*Order, error)
RefundOrder(context.Context, *RefundOrderRequest) (*RefundOrderResponse, error)
Transfer(context.Context, *TransferRequest) (*Transaction, error)
GetWalletFund(context.Context, *GetWalletFundRequest) (*WalletFund, error)
mustEmbedUnimplementedPaymentServiceServer()
}
// UnimplementedPaymentServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedPaymentServiceServer struct{}
func (UnimplementedPaymentServiceServer) CreateOrder(context.Context, *CreateOrderRequest) (*Order, error) {
return nil, status.Error(codes.Unimplemented, "method CreateOrder not implemented")
}
func (UnimplementedPaymentServiceServer) CreateTransactionWithAccount(context.Context, *CreateTransactionWithAccountRequest) (*Transaction, error) {
return nil, status.Error(codes.Unimplemented, "method CreateTransactionWithAccount not implemented")
}
func (UnimplementedPaymentServiceServer) CreateTransaction(context.Context, *CreateTransactionRequest) (*Transaction, error) {
return nil, status.Error(codes.Unimplemented, "method CreateTransaction not implemented")
}
func (UnimplementedPaymentServiceServer) CancelOrder(context.Context, *CancelOrderRequest) (*Order, error) {
return nil, status.Error(codes.Unimplemented, "method CancelOrder not implemented")
}
func (UnimplementedPaymentServiceServer) RefundOrder(context.Context, *RefundOrderRequest) (*RefundOrderResponse, error) {
return nil, status.Error(codes.Unimplemented, "method RefundOrder not implemented")
}
func (UnimplementedPaymentServiceServer) Transfer(context.Context, *TransferRequest) (*Transaction, error) {
return nil, status.Error(codes.Unimplemented, "method Transfer not implemented")
}
func (UnimplementedPaymentServiceServer) GetWalletFund(context.Context, *GetWalletFundRequest) (*WalletFund, error) {
return nil, status.Error(codes.Unimplemented, "method GetWalletFund not implemented")
}
func (UnimplementedPaymentServiceServer) mustEmbedUnimplementedPaymentServiceServer() {}
func (UnimplementedPaymentServiceServer) testEmbeddedByValue() {}
// UnsafePaymentServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PaymentServiceServer will
// result in compilation errors.
type UnsafePaymentServiceServer interface {
mustEmbedUnimplementedPaymentServiceServer()
}
func RegisterPaymentServiceServer(s grpc.ServiceRegistrar, srv PaymentServiceServer) {
// If the following call panics, it indicates UnimplementedPaymentServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&PaymentService_ServiceDesc, srv)
}
func _PaymentService_CreateOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateOrderRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentServiceServer).CreateOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PaymentService_CreateOrder_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentServiceServer).CreateOrder(ctx, req.(*CreateOrderRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PaymentService_CreateTransactionWithAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateTransactionWithAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentServiceServer).CreateTransactionWithAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PaymentService_CreateTransactionWithAccount_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentServiceServer).CreateTransactionWithAccount(ctx, req.(*CreateTransactionWithAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PaymentService_CreateTransaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateTransactionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentServiceServer).CreateTransaction(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PaymentService_CreateTransaction_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentServiceServer).CreateTransaction(ctx, req.(*CreateTransactionRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PaymentService_CancelOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CancelOrderRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentServiceServer).CancelOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PaymentService_CancelOrder_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentServiceServer).CancelOrder(ctx, req.(*CancelOrderRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PaymentService_RefundOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RefundOrderRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentServiceServer).RefundOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PaymentService_RefundOrder_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentServiceServer).RefundOrder(ctx, req.(*RefundOrderRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PaymentService_Transfer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TransferRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentServiceServer).Transfer(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PaymentService_Transfer_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentServiceServer).Transfer(ctx, req.(*TransferRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PaymentService_GetWalletFund_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetWalletFundRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentServiceServer).GetWalletFund(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PaymentService_GetWalletFund_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentServiceServer).GetWalletFund(ctx, req.(*GetWalletFundRequest))
}
return interceptor(ctx, in, info, handler)
}
// PaymentService_ServiceDesc is the grpc.ServiceDesc for PaymentService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PaymentService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.PaymentService",
HandlerType: (*PaymentServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateOrder",
Handler: _PaymentService_CreateOrder_Handler,
},
{
MethodName: "CreateTransactionWithAccount",
Handler: _PaymentService_CreateTransactionWithAccount_Handler,
},
{
MethodName: "CreateTransaction",
Handler: _PaymentService_CreateTransaction_Handler,
},
{
MethodName: "CancelOrder",
Handler: _PaymentService_CancelOrder_Handler,
},
{
MethodName: "RefundOrder",
Handler: _PaymentService_RefundOrder_Handler,
},
{
MethodName: "Transfer",
Handler: _PaymentService_Transfer_Handler,
},
{
MethodName: "GetWalletFund",
Handler: _PaymentService_GetWalletFund_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "wallet.proto",
}

View File

@@ -0,0 +1,84 @@
syntax = "proto3";
package proto;
option csharp_namespace = "DysonNetwork.Shared.Proto";
option go_package = "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen";
import "google/protobuf/timestamp.proto";
// ====================================
// Message Definitions
// ====================================
// SocialCreditRecord represents a record of social credit changes for an account
message SocialCreditRecord {
string id = 1; // UUID string
string reason_type = 2;
string reason = 3;
double delta = 4;
string account_id = 5; // UUID string
google.protobuf.Timestamp created_at = 6;
google.protobuf.Timestamp updated_at = 7;
}
// ExperienceRecord represents a record of experience points gained by an account
message ExperienceRecord {
string id = 1; // UUID string
string reason_type = 2;
string reason = 3;
int64 delta = 4;
double bonus_multiplier = 5;
string account_id = 6; // UUID string
google.protobuf.Timestamp created_at = 7;
google.protobuf.Timestamp updated_at = 8;
}
// ====================================
// Request/Response Messages
// ====================================
// Social Credit Requests/Responses
message AddSocialCreditRecordRequest {
string reason_type = 1;
string reason = 2;
double delta = 3;
string account_id = 4; // UUID string
google.protobuf.Timestamp expired_at = 5;
}
message GetSocialCreditRequest {
string account_id = 1; // UUID string
}
message SocialCreditResponse {
double amount = 1;
}
// Experience Requests/Responses
message AddExperienceRecordRequest {
string reason_type = 1;
string reason = 2;
int64 delta = 3;
string account_id = 4; // UUID string
}
// ====================================
// Service Definitions
// ====================================
// SocialCreditService provides operations for managing social credit scores
service SocialCreditService {
// Adds a new social credit record for an account
rpc AddRecord(AddSocialCreditRecordRequest) returns (SocialCreditRecord);
// Gets the current social credit score for an account
rpc GetSocialCredit(GetSocialCreditRequest) returns (SocialCreditResponse);
}
// ExperienceService provides operations for managing experience points
service ExperienceService {
// Adds a new experience record for an account
rpc AddRecord(AddExperienceRecordRequest) returns (ExperienceRecord);
}

289
pkg/shared/proto/post.proto Normal file
View File

@@ -0,0 +1,289 @@
syntax = "proto3";
package proto;
option csharp_namespace = "DysonNetwork.Shared.Proto";
option go_package = "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "file.proto";
import "realm.proto";
import "publisher.proto";
// Enums
enum PostType {
POST_TYPE_UNSPECIFIED = 0;
MOMENT = 1;
ARTICLE = 2;
}
enum PostVisibility {
VISIBILITY_UNSPECIFIED = 0;
PUBLIC = 1;
FRIENDS = 2;
UNLISTED = 3;
PRIVATE = 4;
}
enum PostPinMode {
PIN_MODE_UNSPECIFIED = 0;
PUBLISHER_PAGE = 1;
REALM_PAGE = 2;
REPLY_PAGE = 3;
}
enum ContentSensitiveMark {
SENSITIVE_MARK_UNSPECIFIED = 0;
LANGUAGE = 1;
SEXUAL_CONTENT = 2;
VIOLENCE = 3;
PROFANITY = 4;
HATE_SPEECH = 5;
RACISM = 6;
ADULT_CONTENT = 7;
DRUG_ABUSE = 8;
ALCOHOL_ABUSE = 9;
GAMBLING = 10;
SELF_HARM = 11;
CHILD_ABUSE = 12;
OTHER = 13;
}
enum PostReactionAttitude {
ATTITUDE_UNSPECIFIED = 0;
POST_ATTITUDE_POSITIVE = 1;
POST_ATTITUDE_NEUTRAL = 2;
POST_ATTITUDE_NEGATIVE = 3;
}
enum PostEmbedViewRenderer {
RENDERER_UNSPECIFIED = 0;
WEBVIEW = 1;
}
// Messages
message PostEmbedView {
string uri = 1;
optional double aspect_ratio = 2;
PostEmbedViewRenderer renderer = 3;
}
message Post {
string id = 1;
string title = 2;
string description = 3;
string slug = 4;
optional google.protobuf.Timestamp edited_at = 5;
optional google.protobuf.Timestamp published_at = 6;
PostVisibility visibility = 7;
optional string content = 8;
PostType type = 9;
optional PostPinMode pin_mode = 10;
optional bytes meta = 11; // Dictionary<string, object>
optional bytes sensitive_marks = 12; // List<ContentSensitiveMark>
optional PostEmbedView embed_view = 13;
int32 views_unique = 14;
int32 views_total = 15;
int32 upvotes = 16;
int32 downvotes = 17;
double awarded_score = 18;
// Not mapped fields: handled client-side
map<string, int32> reactions_count = 19; // Dictionary<string, int>
int32 replies_count = 20;
map<string, bool> reactions_made = 21; // Dictionary<string, bool>
bool replied_gone = 22;
bool forwarded_gone = 23;
optional string replied_post_id = 24;
optional Post replied_post = 25; // full if populated
optional string forwarded_post_id = 26;
optional Post forwarded_post = 27; // full if populated
optional string realm_id = 28;
optional Realm realm = 29; // full if populated
repeated CloudFile attachments = 30; // List<SnCloudFileReferenceObject>
string publisher_id = 31;
Publisher publisher = 32;
repeated PostAward awards = 33;
repeated PostReaction reactions = 34;
repeated PostTag tags = 35;
repeated PostCategory categories = 36;
repeated PostFeaturedRecord featured_records = 37;
// Added for ToActivity
google.protobuf.Timestamp created_at = 38;
google.protobuf.Timestamp updated_at = 39;
optional google.protobuf.Timestamp deleted_at = 40;
}
message PostTag {
string id = 1;
string slug = 2;
string name = 3;
google.protobuf.Timestamp created_at = 4;
google.protobuf.Timestamp updated_at = 5;
}
message PostCategory {
string id = 1;
string slug = 2;
string name = 3;
google.protobuf.Timestamp created_at = 4;
google.protobuf.Timestamp updated_at = 5;
}
message PostCategorySubscription {
string id = 1;
string account_id = 2;
optional string category_id = 3;
optional PostCategory category = 4;
optional string tag_id = 5;
optional PostTag tag = 6;
google.protobuf.Timestamp created_at = 7;
google.protobuf.Timestamp updated_at = 8;
}
message PostCollection {
string id = 1;
string slug = 2;
optional google.protobuf.StringValue name = 3;
optional google.protobuf.StringValue description = 4;
Publisher publisher = 5;
optional string publisher_id = 6; // for cases where full publisher not needed
repeated Post posts = 7;
google.protobuf.Timestamp created_at = 8;
google.protobuf.Timestamp updated_at = 9;
}
message PostFeaturedRecord {
string id = 1;
string post_id = 2;
optional google.protobuf.Timestamp featured_at = 3;
int32 social_credits = 4;
google.protobuf.Timestamp created_at = 5;
google.protobuf.Timestamp updated_at = 6;
}
message PostReaction {
string id = 1;
string symbol = 2;
PostReactionAttitude attitude = 3;
string post_id = 4;
string account_id = 5;
optional Account account = 6; // optional full account
google.protobuf.Timestamp created_at = 7;
google.protobuf.Timestamp updated_at = 8;
}
message PostAward {
string id = 1;
double amount = 2;
PostReactionAttitude attitude = 3;
optional google.protobuf.StringValue message = 4;
string post_id = 5;
string account_id = 6;
google.protobuf.Timestamp created_at = 7;
google.protobuf.Timestamp updated_at = 8;
}
// ====================================
// Request/Response Messages
// ====================================
message GetPostRequest {
oneof identifier {
string id = 1;
string slug = 2;
}
google.protobuf.StringValue publisher_id = 3;
}
message GetPostBatchRequest {
repeated string ids = 1;
}
message GetPostBatchResponse {
repeated Post posts = 1;
}
message SearchPostsRequest {
string query = 1;
string publisher_id = 2;
string realm_id = 3;
int32 page_size = 4;
string page_token = 5;
string order_by = 6;
}
message SearchPostsResponse {
repeated Post posts = 1;
string next_page_token = 2;
int32 total_size = 3;
}
message ListPostsRequest {
google.protobuf.StringValue publisher_id = 1;
google.protobuf.StringValue realm_id = 2;
int32 page_size = 3;
string page_token = 4;
google.protobuf.StringValue order_by = 5;
bool order_desc = 16;
repeated string categories = 6;
repeated string tags = 7;
google.protobuf.StringValue query = 8;
repeated PostType types = 9;
optional google.protobuf.Timestamp after = 10; // Filter posts created after this timestamp
optional google.protobuf.Timestamp before = 11; // Filter posts created before this timestamp
bool include_replies = 12; // Include reply posts
optional PostPinMode pinned = 13; // Filter by pinned mode (if present, null means not pinned)
bool only_media = 14; // Only return posts with attachments
bool shuffle = 15; // Random order
}
message ListPostsResponse {
repeated Post posts = 1;
string next_page_token = 2;
int32 total_size = 3;
}
// ====================================
// Service Definitions
// ====================================
service PostService {
// Get a single post by id
rpc GetPost(GetPostRequest) returns (Post);
// Get multiple posts by ids
rpc GetPostBatch(GetPostBatchRequest) returns (GetPostBatchResponse);
// Search posts
rpc SearchPosts(SearchPostsRequest) returns (SearchPostsResponse);
// List posts with filters
rpc ListPosts(ListPostsRequest) returns (ListPostsResponse);
}
import 'account.proto';

View File

@@ -0,0 +1,125 @@
syntax = "proto3";
package proto;
option csharp_namespace = "DysonNetwork.Shared.Proto";
option go_package = "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "file.proto";
import "account.proto";
enum PublisherType {
PUBLISHER_TYPE_UNSPECIFIED = 0;
PUB_INDIVIDUAL = 1;
PUB_ORGANIZATIONAL = 2;
}
enum PublisherMemberRole {
PUBLISHER_MEMBER_ROLE_UNSPECIFIED = 0;
OWNER = 100;
MANAGER = 75;
EDITOR = 50;
VIEWER = 25;
}
message PublisherFeature {
string id = 1;
string flag = 2;
google.protobuf.Timestamp expired_at = 3;
string publisher_id = 4;
google.protobuf.Timestamp created_at = 5;
google.protobuf.Timestamp updated_at = 6;
}
message PublisherMember {
string publisher_id = 1;
string account_id = 2;
PublisherMemberRole role = 3;
google.protobuf.Timestamp joined_at = 4;
google.protobuf.Timestamp created_at = 5;
google.protobuf.Timestamp updated_at = 6;
}
message Publisher {
string id = 1;
PublisherType type = 2;
string name = 3;
string nick = 4;
google.protobuf.StringValue bio = 5;
CloudFile picture = 8;
CloudFile background = 9;
optional VerificationMark verification_mark = 10;
string account_id = 11;
optional string realm_id = 12;
google.protobuf.Timestamp created_at = 13;
google.protobuf.Timestamp updated_at = 14;
}
message GetPublisherRequest {
oneof query {
string name = 1;
string id = 2;
}
}
message GetPublisherResponse {
Publisher publisher = 1;
}
message GetPublisherBatchRequest {
repeated string ids = 1;
}
message ListPublishersRequest {
string account_id = 1; // filter by owner/member account
string realm_id = 2; // filter by realm
}
message ListPublishersResponse {
repeated Publisher publishers = 1;
}
message ListPublisherMembersRequest {
string publisher_id = 1;
}
message ListPublisherMembersResponse {
repeated PublisherMember members = 1;
}
message SetPublisherFeatureFlagRequest {
string publisher_id = 1;
string flag = 2;
}
message HasPublisherFeatureRequest {
string publisher_id = 1;
string flag = 2;
}
message HasPublisherFeatureResponse {
bool enabled = 1;
}
message IsPublisherMemberRequest {
string publisher_id = 1;
string account_id = 2;
PublisherMemberRole role = 3;
}
message IsPublisherMemberResponse {
bool valid = 1;
}
service PublisherService {
rpc GetPublisher(GetPublisherRequest) returns (GetPublisherResponse);
rpc GetPublisherBatch(GetPublisherBatchRequest) returns (ListPublishersResponse);
rpc ListPublishers(ListPublishersRequest) returns (ListPublishersResponse);
rpc ListPublisherMembers(ListPublisherMembersRequest) returns (ListPublisherMembersResponse);
rpc SetPublisherFeatureFlag(SetPublisherFeatureFlagRequest) returns (google.protobuf.StringValue); // returns optional message
rpc HasPublisherFeature(HasPublisherFeatureRequest) returns (HasPublisherFeatureResponse);
rpc IsPublisherMember(IsPublisherMemberRequest) returns (IsPublisherMemberResponse);
}

View File

@@ -0,0 +1,122 @@
syntax = "proto3";
package proto;
option csharp_namespace = "DysonNetwork.Shared.Proto";
option go_package = "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/empty.proto";
import 'account.proto';
import "file.proto";
// Message Definitions
message Realm {
string id = 1;
string name = 2;
string slug = 3;
bool is_community = 4;
bool is_public = 5;
string description = 6;
optional CloudFile picture = 7;
optional CloudFile background = 8;
optional VerificationMark verification = 9;
string account_id = 10;
}
message RealmMember {
string account_id = 1;
string realm_id = 2;
int32 role = 3;
optional google.protobuf.Timestamp joined_at = 4;
optional google.protobuf.Timestamp leave_at = 5;
optional Account account = 6;
optional Realm realm = 7;
}
// Service Definitions
service RealmService {
// Get realm by id or slug
rpc GetRealm(GetRealmRequest) returns (Realm) {}
// Get realm batch by ids
rpc GetRealmBatch(GetRealmBatchRequest) returns (GetRealmBatchResponse) {}
// Get realms for a user
rpc GetUserRealms(GetUserRealmsRequest) returns (GetUserRealmsResponse) {}
// Get public realms
rpc GetPublicRealms(GetPublicRealmsRequest) returns (GetPublicRealmsResponse) {}
// Search public realms
rpc SearchRealms(SearchRealmsRequest) returns (GetPublicRealmsResponse) {}
// Send invitation notification
rpc SendInviteNotify(SendInviteNotifyRequest) returns (google.protobuf.Empty) {}
// Check if member has required role
rpc IsMemberWithRole(IsMemberWithRoleRequest) returns (google.protobuf.BoolValue) {}
// Load account for a member
rpc LoadMemberAccount(LoadMemberAccountRequest) returns (RealmMember) {}
// Load accounts for members
rpc LoadMemberAccounts(LoadMemberAccountsRequest) returns (LoadMemberAccountsResponse) {}
}
// Request/Response Messages
message GetRealmRequest {
oneof query {
string id = 1;
string slug = 2;
}
}
message GetUserRealmsRequest {
string account_id = 1;
}
message GetRealmBatchRequest {
repeated string ids = 1;
}
message GetRealmBatchResponse {
repeated Realm realms = 1;
}
message GetUserRealmsResponse {
repeated string realm_ids = 1;
}
message GetPublicRealmsRequest {
optional string order_by = 1;
}
message GetPublicRealmsResponse {
repeated Realm realms = 1;
}
message SearchRealmsRequest {
string query = 1;
int32 limit = 2;
}
message SendInviteNotifyRequest {
RealmMember member = 1;
}
message IsMemberWithRoleRequest {
string realm_id = 1;
string account_id = 2;
repeated int32 required_roles = 3;
}
message LoadMemberAccountRequest {
RealmMember member = 1;
}
message LoadMemberAccountsRequest {
repeated RealmMember members = 1;
}
message LoadMemberAccountsResponse {
repeated RealmMember members = 1;
}

1322
pkg/shared/proto/ring.pb.go Normal file

File diff suppressed because it is too large Load Diff

157
pkg/shared/proto/ring.proto Normal file
View File

@@ -0,0 +1,157 @@
syntax = "proto3";
package proto;
option csharp_namespace = "DysonNetwork.Shared.Proto";
option go_package = "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "account.proto";
// RingService provides methods to send various types of notifications.
service RingService {
// Sends an email.
rpc SendEmail(SendEmailRequest) returns (google.protobuf.Empty) {}
// Pushes a packet to a user via WebSocket.
rpc PushWebSocketPacket(PushWebSocketPacketRequest) returns (google.protobuf.Empty) {}
// Pushes a packet to a list of users via WebSocket.
rpc PushWebSocketPacketToUsers(PushWebSocketPacketToUsersRequest) returns (google.protobuf.Empty) {}
// Pushes a packet to a device via WebSocket.
rpc PushWebSocketPacketToDevice(PushWebSocketPacketToDeviceRequest) returns (google.protobuf.Empty) {}
// Pushes a packet to a list of devices via WebSocket.
rpc PushWebSocketPacketToDevices(PushWebSocketPacketToDevicesRequest) returns (google.protobuf.Empty) {}
// Sends a push notification to a user.
rpc SendPushNotificationToUser(SendPushNotificationToUserRequest) returns (google.protobuf.Empty) {}
// Sends a push notification to a list of users.
rpc SendPushNotificationToUsers(SendPushNotificationToUsersRequest) returns (google.protobuf.Empty) {}
// Unsubscribes a device from push notifications.
rpc UnsubscribePushNotifications(UnsubscribePushNotificationsRequest) returns (google.protobuf.Empty) {}
// Gets the WebSocket connection status for a device or user.
rpc GetWebsocketConnectionStatus(GetWebsocketConnectionStatusRequest) returns (GetWebsocketConnectionStatusResponse) {}
rpc GetWebsocketConnectionStatusBatch(GetWebsocketConnectionStatusBatchRequest) returns (GetWebsocketConnectionStatusBatchResponse) {}
}
// Represents an email message.
message EmailMessage {
string to_name = 1;
string to_address = 2;
string subject = 3;
string body = 4;
}
message SendEmailRequest {
EmailMessage email = 1;
}
// Represents a WebSocket packet.
message WebSocketPacket {
string type = 1;
bytes data = 2;
google.protobuf.StringValue error_message = 3;
}
message PushWebSocketPacketRequest {
string user_id = 1;
WebSocketPacket packet = 2;
}
message PushWebSocketPacketToUsersRequest {
repeated string user_ids = 1;
WebSocketPacket packet = 2;
}
message PushWebSocketPacketToDeviceRequest {
string device_id = 1;
WebSocketPacket packet = 2;
}
message PushWebSocketPacketToDevicesRequest {
repeated string device_ids = 1;
WebSocketPacket packet = 2;
}
// Represents a push notification.
message PushNotification {
string topic = 1;
string title = 2;
string subtitle = 3;
string body = 4;
optional bytes meta = 5;
optional string action_uri = 6;
bool is_silent = 7;
bool is_savable = 8;
}
message SendPushNotificationToUserRequest {
string user_id = 1;
PushNotification notification = 2;
}
message SendPushNotificationToUsersRequest {
repeated string user_ids = 1;
PushNotification notification = 2;
}
message UnsubscribePushNotificationsRequest {
string device_id = 1;
}
message GetWebsocketConnectionStatusRequest {
oneof id {
string device_id = 1;
string user_id = 2;
}
}
message GetWebsocketConnectionStatusResponse {
bool is_connected = 1;
}
message GetWebsocketConnectionStatusBatchRequest {
repeated string users_id = 1;
}
message GetWebsocketConnectionStatusBatchResponse {
map<string, bool> is_connected = 1;
}
service RingHandlerService {
rpc ReceiveWebSocketPacket(ReceiveWebSocketPacketRequest) returns (google.protobuf.Empty) {}
}
message ReceiveWebSocketPacketRequest {
WebSocketPacket packet = 1;
Account account = 2;
string device_id = 3;
}
// WebSocket event messages for NATS publishing
message WebSocketConnectedEvent {
google.protobuf.StringValue account_id = 1;
string device_id = 2;
bool is_offline = 3;
}
message WebSocketDisconnectedEvent {
google.protobuf.StringValue account_id = 1;
string device_id = 2;
bool is_offline = 3;
}
message WebSocketPacketEvent {
google.protobuf.StringValue account_id = 1;
string device_id = 2;
bytes packet_bytes = 3;
}

View File

@@ -0,0 +1,588 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.1
// source: ring.proto
package gen
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
RingService_SendEmail_FullMethodName = "/proto.RingService/SendEmail"
RingService_PushWebSocketPacket_FullMethodName = "/proto.RingService/PushWebSocketPacket"
RingService_PushWebSocketPacketToUsers_FullMethodName = "/proto.RingService/PushWebSocketPacketToUsers"
RingService_PushWebSocketPacketToDevice_FullMethodName = "/proto.RingService/PushWebSocketPacketToDevice"
RingService_PushWebSocketPacketToDevices_FullMethodName = "/proto.RingService/PushWebSocketPacketToDevices"
RingService_SendPushNotificationToUser_FullMethodName = "/proto.RingService/SendPushNotificationToUser"
RingService_SendPushNotificationToUsers_FullMethodName = "/proto.RingService/SendPushNotificationToUsers"
RingService_UnsubscribePushNotifications_FullMethodName = "/proto.RingService/UnsubscribePushNotifications"
RingService_GetWebsocketConnectionStatus_FullMethodName = "/proto.RingService/GetWebsocketConnectionStatus"
RingService_GetWebsocketConnectionStatusBatch_FullMethodName = "/proto.RingService/GetWebsocketConnectionStatusBatch"
)
// RingServiceClient is the client API for RingService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// RingService provides methods to send various types of notifications.
type RingServiceClient interface {
// Sends an email.
SendEmail(ctx context.Context, in *SendEmailRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Pushes a packet to a user via WebSocket.
PushWebSocketPacket(ctx context.Context, in *PushWebSocketPacketRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Pushes a packet to a list of users via WebSocket.
PushWebSocketPacketToUsers(ctx context.Context, in *PushWebSocketPacketToUsersRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Pushes a packet to a device via WebSocket.
PushWebSocketPacketToDevice(ctx context.Context, in *PushWebSocketPacketToDeviceRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Pushes a packet to a list of devices via WebSocket.
PushWebSocketPacketToDevices(ctx context.Context, in *PushWebSocketPacketToDevicesRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Sends a push notification to a user.
SendPushNotificationToUser(ctx context.Context, in *SendPushNotificationToUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Sends a push notification to a list of users.
SendPushNotificationToUsers(ctx context.Context, in *SendPushNotificationToUsersRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Unsubscribes a device from push notifications.
UnsubscribePushNotifications(ctx context.Context, in *UnsubscribePushNotificationsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Gets the WebSocket connection status for a device or user.
GetWebsocketConnectionStatus(ctx context.Context, in *GetWebsocketConnectionStatusRequest, opts ...grpc.CallOption) (*GetWebsocketConnectionStatusResponse, error)
GetWebsocketConnectionStatusBatch(ctx context.Context, in *GetWebsocketConnectionStatusBatchRequest, opts ...grpc.CallOption) (*GetWebsocketConnectionStatusBatchResponse, error)
}
type ringServiceClient struct {
cc grpc.ClientConnInterface
}
func NewRingServiceClient(cc grpc.ClientConnInterface) RingServiceClient {
return &ringServiceClient{cc}
}
func (c *ringServiceClient) SendEmail(ctx context.Context, in *SendEmailRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_SendEmail_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) PushWebSocketPacket(ctx context.Context, in *PushWebSocketPacketRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_PushWebSocketPacket_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) PushWebSocketPacketToUsers(ctx context.Context, in *PushWebSocketPacketToUsersRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_PushWebSocketPacketToUsers_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) PushWebSocketPacketToDevice(ctx context.Context, in *PushWebSocketPacketToDeviceRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_PushWebSocketPacketToDevice_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) PushWebSocketPacketToDevices(ctx context.Context, in *PushWebSocketPacketToDevicesRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_PushWebSocketPacketToDevices_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) SendPushNotificationToUser(ctx context.Context, in *SendPushNotificationToUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_SendPushNotificationToUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) SendPushNotificationToUsers(ctx context.Context, in *SendPushNotificationToUsersRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_SendPushNotificationToUsers_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) UnsubscribePushNotifications(ctx context.Context, in *UnsubscribePushNotificationsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingService_UnsubscribePushNotifications_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) GetWebsocketConnectionStatus(ctx context.Context, in *GetWebsocketConnectionStatusRequest, opts ...grpc.CallOption) (*GetWebsocketConnectionStatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetWebsocketConnectionStatusResponse)
err := c.cc.Invoke(ctx, RingService_GetWebsocketConnectionStatus_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) GetWebsocketConnectionStatusBatch(ctx context.Context, in *GetWebsocketConnectionStatusBatchRequest, opts ...grpc.CallOption) (*GetWebsocketConnectionStatusBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetWebsocketConnectionStatusBatchResponse)
err := c.cc.Invoke(ctx, RingService_GetWebsocketConnectionStatusBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// RingServiceServer is the server API for RingService service.
// All implementations must embed UnimplementedRingServiceServer
// for forward compatibility.
//
// RingService provides methods to send various types of notifications.
type RingServiceServer interface {
// Sends an email.
SendEmail(context.Context, *SendEmailRequest) (*emptypb.Empty, error)
// Pushes a packet to a user via WebSocket.
PushWebSocketPacket(context.Context, *PushWebSocketPacketRequest) (*emptypb.Empty, error)
// Pushes a packet to a list of users via WebSocket.
PushWebSocketPacketToUsers(context.Context, *PushWebSocketPacketToUsersRequest) (*emptypb.Empty, error)
// Pushes a packet to a device via WebSocket.
PushWebSocketPacketToDevice(context.Context, *PushWebSocketPacketToDeviceRequest) (*emptypb.Empty, error)
// Pushes a packet to a list of devices via WebSocket.
PushWebSocketPacketToDevices(context.Context, *PushWebSocketPacketToDevicesRequest) (*emptypb.Empty, error)
// Sends a push notification to a user.
SendPushNotificationToUser(context.Context, *SendPushNotificationToUserRequest) (*emptypb.Empty, error)
// Sends a push notification to a list of users.
SendPushNotificationToUsers(context.Context, *SendPushNotificationToUsersRequest) (*emptypb.Empty, error)
// Unsubscribes a device from push notifications.
UnsubscribePushNotifications(context.Context, *UnsubscribePushNotificationsRequest) (*emptypb.Empty, error)
// Gets the WebSocket connection status for a device or user.
GetWebsocketConnectionStatus(context.Context, *GetWebsocketConnectionStatusRequest) (*GetWebsocketConnectionStatusResponse, error)
GetWebsocketConnectionStatusBatch(context.Context, *GetWebsocketConnectionStatusBatchRequest) (*GetWebsocketConnectionStatusBatchResponse, error)
mustEmbedUnimplementedRingServiceServer()
}
// UnimplementedRingServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedRingServiceServer struct{}
func (UnimplementedRingServiceServer) SendEmail(context.Context, *SendEmailRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method SendEmail not implemented")
}
func (UnimplementedRingServiceServer) PushWebSocketPacket(context.Context, *PushWebSocketPacketRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method PushWebSocketPacket not implemented")
}
func (UnimplementedRingServiceServer) PushWebSocketPacketToUsers(context.Context, *PushWebSocketPacketToUsersRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method PushWebSocketPacketToUsers not implemented")
}
func (UnimplementedRingServiceServer) PushWebSocketPacketToDevice(context.Context, *PushWebSocketPacketToDeviceRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method PushWebSocketPacketToDevice not implemented")
}
func (UnimplementedRingServiceServer) PushWebSocketPacketToDevices(context.Context, *PushWebSocketPacketToDevicesRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method PushWebSocketPacketToDevices not implemented")
}
func (UnimplementedRingServiceServer) SendPushNotificationToUser(context.Context, *SendPushNotificationToUserRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method SendPushNotificationToUser not implemented")
}
func (UnimplementedRingServiceServer) SendPushNotificationToUsers(context.Context, *SendPushNotificationToUsersRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method SendPushNotificationToUsers not implemented")
}
func (UnimplementedRingServiceServer) UnsubscribePushNotifications(context.Context, *UnsubscribePushNotificationsRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method UnsubscribePushNotifications not implemented")
}
func (UnimplementedRingServiceServer) GetWebsocketConnectionStatus(context.Context, *GetWebsocketConnectionStatusRequest) (*GetWebsocketConnectionStatusResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetWebsocketConnectionStatus not implemented")
}
func (UnimplementedRingServiceServer) GetWebsocketConnectionStatusBatch(context.Context, *GetWebsocketConnectionStatusBatchRequest) (*GetWebsocketConnectionStatusBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetWebsocketConnectionStatusBatch not implemented")
}
func (UnimplementedRingServiceServer) mustEmbedUnimplementedRingServiceServer() {}
func (UnimplementedRingServiceServer) testEmbeddedByValue() {}
// UnsafeRingServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to RingServiceServer will
// result in compilation errors.
type UnsafeRingServiceServer interface {
mustEmbedUnimplementedRingServiceServer()
}
func RegisterRingServiceServer(s grpc.ServiceRegistrar, srv RingServiceServer) {
// If the following call panics, it indicates UnimplementedRingServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&RingService_ServiceDesc, srv)
}
func _RingService_SendEmail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendEmailRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).SendEmail(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_SendEmail_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).SendEmail(ctx, req.(*SendEmailRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_PushWebSocketPacket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PushWebSocketPacketRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).PushWebSocketPacket(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_PushWebSocketPacket_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).PushWebSocketPacket(ctx, req.(*PushWebSocketPacketRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_PushWebSocketPacketToUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PushWebSocketPacketToUsersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).PushWebSocketPacketToUsers(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_PushWebSocketPacketToUsers_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).PushWebSocketPacketToUsers(ctx, req.(*PushWebSocketPacketToUsersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_PushWebSocketPacketToDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PushWebSocketPacketToDeviceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).PushWebSocketPacketToDevice(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_PushWebSocketPacketToDevice_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).PushWebSocketPacketToDevice(ctx, req.(*PushWebSocketPacketToDeviceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_PushWebSocketPacketToDevices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PushWebSocketPacketToDevicesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).PushWebSocketPacketToDevices(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_PushWebSocketPacketToDevices_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).PushWebSocketPacketToDevices(ctx, req.(*PushWebSocketPacketToDevicesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_SendPushNotificationToUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendPushNotificationToUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).SendPushNotificationToUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_SendPushNotificationToUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).SendPushNotificationToUser(ctx, req.(*SendPushNotificationToUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_SendPushNotificationToUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendPushNotificationToUsersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).SendPushNotificationToUsers(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_SendPushNotificationToUsers_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).SendPushNotificationToUsers(ctx, req.(*SendPushNotificationToUsersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_UnsubscribePushNotifications_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UnsubscribePushNotificationsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).UnsubscribePushNotifications(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_UnsubscribePushNotifications_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).UnsubscribePushNotifications(ctx, req.(*UnsubscribePushNotificationsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_GetWebsocketConnectionStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetWebsocketConnectionStatusRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).GetWebsocketConnectionStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_GetWebsocketConnectionStatus_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).GetWebsocketConnectionStatus(ctx, req.(*GetWebsocketConnectionStatusRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_GetWebsocketConnectionStatusBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetWebsocketConnectionStatusBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).GetWebsocketConnectionStatusBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingService_GetWebsocketConnectionStatusBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).GetWebsocketConnectionStatusBatch(ctx, req.(*GetWebsocketConnectionStatusBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
// RingService_ServiceDesc is the grpc.ServiceDesc for RingService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var RingService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.RingService",
HandlerType: (*RingServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "SendEmail",
Handler: _RingService_SendEmail_Handler,
},
{
MethodName: "PushWebSocketPacket",
Handler: _RingService_PushWebSocketPacket_Handler,
},
{
MethodName: "PushWebSocketPacketToUsers",
Handler: _RingService_PushWebSocketPacketToUsers_Handler,
},
{
MethodName: "PushWebSocketPacketToDevice",
Handler: _RingService_PushWebSocketPacketToDevice_Handler,
},
{
MethodName: "PushWebSocketPacketToDevices",
Handler: _RingService_PushWebSocketPacketToDevices_Handler,
},
{
MethodName: "SendPushNotificationToUser",
Handler: _RingService_SendPushNotificationToUser_Handler,
},
{
MethodName: "SendPushNotificationToUsers",
Handler: _RingService_SendPushNotificationToUsers_Handler,
},
{
MethodName: "UnsubscribePushNotifications",
Handler: _RingService_UnsubscribePushNotifications_Handler,
},
{
MethodName: "GetWebsocketConnectionStatus",
Handler: _RingService_GetWebsocketConnectionStatus_Handler,
},
{
MethodName: "GetWebsocketConnectionStatusBatch",
Handler: _RingService_GetWebsocketConnectionStatusBatch_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ring.proto",
}
const (
RingHandlerService_ReceiveWebSocketPacket_FullMethodName = "/proto.RingHandlerService/ReceiveWebSocketPacket"
)
// RingHandlerServiceClient is the client API for RingHandlerService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type RingHandlerServiceClient interface {
ReceiveWebSocketPacket(ctx context.Context, in *ReceiveWebSocketPacketRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type ringHandlerServiceClient struct {
cc grpc.ClientConnInterface
}
func NewRingHandlerServiceClient(cc grpc.ClientConnInterface) RingHandlerServiceClient {
return &ringHandlerServiceClient{cc}
}
func (c *ringHandlerServiceClient) ReceiveWebSocketPacket(ctx context.Context, in *ReceiveWebSocketPacketRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, RingHandlerService_ReceiveWebSocketPacket_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// RingHandlerServiceServer is the server API for RingHandlerService service.
// All implementations must embed UnimplementedRingHandlerServiceServer
// for forward compatibility.
type RingHandlerServiceServer interface {
ReceiveWebSocketPacket(context.Context, *ReceiveWebSocketPacketRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedRingHandlerServiceServer()
}
// UnimplementedRingHandlerServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedRingHandlerServiceServer struct{}
func (UnimplementedRingHandlerServiceServer) ReceiveWebSocketPacket(context.Context, *ReceiveWebSocketPacketRequest) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method ReceiveWebSocketPacket not implemented")
}
func (UnimplementedRingHandlerServiceServer) mustEmbedUnimplementedRingHandlerServiceServer() {}
func (UnimplementedRingHandlerServiceServer) testEmbeddedByValue() {}
// UnsafeRingHandlerServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to RingHandlerServiceServer will
// result in compilation errors.
type UnsafeRingHandlerServiceServer interface {
mustEmbedUnimplementedRingHandlerServiceServer()
}
func RegisterRingHandlerServiceServer(s grpc.ServiceRegistrar, srv RingHandlerServiceServer) {
// If the following call panics, it indicates UnimplementedRingHandlerServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&RingHandlerService_ServiceDesc, srv)
}
func _RingHandlerService_ReceiveWebSocketPacket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReceiveWebSocketPacketRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingHandlerServiceServer).ReceiveWebSocketPacket(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: RingHandlerService_ReceiveWebSocketPacket_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingHandlerServiceServer).ReceiveWebSocketPacket(ctx, req.(*ReceiveWebSocketPacketRequest))
}
return interceptor(ctx, in, info, handler)
}
// RingHandlerService_ServiceDesc is the grpc.ServiceDesc for RingHandlerService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var RingHandlerService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.RingHandlerService",
HandlerType: (*RingHandlerServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ReceiveWebSocketPacket",
Handler: _RingHandlerService_ReceiveWebSocketPacket_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ring.proto",
}

View File

@@ -0,0 +1,297 @@
syntax = "proto3";
package proto;
option csharp_namespace = "DysonNetwork.Shared.Proto";
option go_package = "git.solsynth.dev/goatworks/turbine/pkg/shared/proto/gen";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/duration.proto";
message Wallet {
string id = 1;
repeated WalletPocket pockets = 2;
string account_id = 3;
}
message WalletPocket {
string id = 1;
string currency = 2;
// Using string for decimal to avoid precision loss.
string amount = 3;
string wallet_id = 4;
}
enum FundSplitType {
FUND_SPLIT_TYPE_UNSPECIFIED = 0;
FUND_SPLIT_TYPE_EVEN = 1;
FUND_SPLIT_TYPE_RANDOM = 2;
}
enum FundStatus {
FUND_STATUS_UNSPECIFIED = 0;
FUND_STATUS_CREATED = 1;
FUND_STATUS_PARTIALLY_RECEIVED = 2;
FUND_STATUS_FULLY_RECEIVED = 3;
FUND_STATUS_EXPIRED = 4;
FUND_STATUS_REFUNDED = 5;
}
message WalletFund {
string id = 1;
string currency = 2;
string total_amount = 3;
string remaining_amount = 10;
FundSplitType split_type = 4;
FundStatus status = 5;
google.protobuf.StringValue message = 6;
string creator_account_id = 7;
google.protobuf.Timestamp expired_at = 8;
repeated WalletFundRecipient recipients = 9;
}
message WalletFundRecipient {
string id = 1;
string fund_id = 2;
string recipient_account_id = 3;
string amount = 4;
bool is_received = 5;
optional google.protobuf.Timestamp received_at = 6;
}
enum SubscriptionStatus {
// Using proto3 enum naming convention
SUBSCRIPTION_STATUS_UNSPECIFIED = 0;
SUBSCRIPTION_STATUS_UNPAID = 1;
SUBSCRIPTION_STATUS_ACTIVE = 2;
SUBSCRIPTION_STATUS_EXPIRED = 3;
SUBSCRIPTION_STATUS_CANCELLED = 4;
}
enum GiftStatus {
// Using proto3 enum naming convention
GIFT_STATUS_UNSPECIFIED = 0;
GIFT_STATUS_CREATED = 1;
GIFT_STATUS_SENT = 2;
GIFT_STATUS_REDEEMED = 3;
GIFT_STATUS_EXPIRED = 4;
GIFT_STATUS_CANCELLED = 5;
}
message Subscription {
string id = 1;
google.protobuf.Timestamp begun_at = 2;
optional google.protobuf.Timestamp ended_at = 3;
string identifier = 4;
bool is_active = 5;
bool is_free_trial = 6;
SubscriptionStatus status = 7;
string payment_method = 8;
PaymentDetails payment_details = 9;
// Using string for decimal to avoid precision loss.
string base_price = 10;
optional string coupon_id = 11;
optional Coupon coupon = 12;
optional google.protobuf.Timestamp renewal_at = 13;
string account_id = 14;
bool is_available = 15;
// Using string for decimal to avoid precision loss.
string final_price = 16;
google.protobuf.Timestamp created_at = 17;
google.protobuf.Timestamp updated_at = 18;
}
message SubscriptionReferenceObject {
string id = 1;
string identifier = 2;
google.protobuf.Timestamp begun_at = 3;
optional google.protobuf.Timestamp ended_at = 4;
bool is_active = 5;
bool is_available = 6;
bool is_free_trial = 7;
SubscriptionStatus status = 8;
// Using string for decimal to avoid precision loss.
string base_price = 9;
// Using string for decimal to avoid precision loss.
string final_price = 10;
optional google.protobuf.Timestamp renewal_at = 11;
string account_id = 12;
optional string display_name = 13;
google.protobuf.Timestamp created_at = 14;
google.protobuf.Timestamp updated_at = 15;
}
message PaymentDetails {
string currency = 1;
optional string order_id = 2;
}
message Coupon {
string id = 1;
optional string identifier = 2;
optional string code = 3;
optional google.protobuf.Timestamp affected_at = 4;
optional google.protobuf.Timestamp expired_at = 5;
// Using string for decimal to avoid precision loss.
optional string discount_amount = 6;
optional google.protobuf.DoubleValue discount_rate = 7;
optional google.protobuf.Int32Value max_usage = 8;
google.protobuf.Timestamp created_at = 9;
google.protobuf.Timestamp updated_at = 10;
}
message Gift {
string id = 1;
string gifter_id = 2;
optional string recipient_id = 3;
string gift_code = 4;
optional string message = 5;
string subscription_identifier = 6;
string base_price = 7;
string final_price = 8;
GiftStatus status = 9;
optional google.protobuf.Timestamp redeemed_at = 10;
optional string redeemer_id = 11;
optional string subscription_id = 12;
google.protobuf.Timestamp expires_at = 13;
bool is_open_gift = 14;
string payment_method = 15;
PaymentDetails payment_details = 16;
optional string coupon_id = 17;
optional Coupon coupon = 18;
bool is_redeemable = 19;
bool is_expired = 20;
google.protobuf.Timestamp created_at = 21;
google.protobuf.Timestamp updated_at = 22;
}
service WalletService {
rpc GetWallet(GetWalletRequest) returns (Wallet);
rpc CreateWallet(CreateWalletRequest) returns (Wallet);
rpc GetOrCreateWalletPocket(GetOrCreateWalletPocketRequest) returns (WalletPocket);
}
message GetWalletRequest {
string account_id = 1;
}
message CreateWalletRequest {
string account_id = 1;
}
message GetOrCreateWalletPocketRequest {
string wallet_id = 1;
string currency = 2;
optional string initial_amount = 3;
}
service PaymentService {
rpc CreateOrder(CreateOrderRequest) returns (Order);
rpc CreateTransactionWithAccount(CreateTransactionWithAccountRequest) returns (Transaction);
rpc CreateTransaction(CreateTransactionRequest) returns (Transaction);
rpc CancelOrder(CancelOrderRequest) returns (Order);
rpc RefundOrder(RefundOrderRequest) returns (RefundOrderResponse);
rpc Transfer(TransferRequest) returns (Transaction);
rpc GetWalletFund(GetWalletFundRequest) returns (WalletFund);
}
message CreateOrderRequest {
optional string payee_wallet_id = 1;
string currency = 2;
string amount = 3;
optional google.protobuf.Duration expiration = 4;
optional string app_identifier = 5;
optional string product_identifier = 8;
// Using bytes for meta to represent JSON.
optional bytes meta = 6;
optional string remarks = 9;
bool reuseable = 7;
}
message Order {
string id = 1;
google.protobuf.StringValue payee_wallet_id = 2;
google.protobuf.StringValue currency = 3;
string amount = 4;
google.protobuf.Timestamp expired_at = 5;
google.protobuf.StringValue app_identifier = 6;
google.protobuf.StringValue product_identifier = 12;
// Using bytes for meta to represent JSON.
optional bytes meta = 7;
OrderStatus status = 8;
google.protobuf.StringValue transaction_id = 9;
optional Transaction transaction = 10;
google.protobuf.StringValue remarks = 11;
}
enum OrderStatus {
ORDER_STATUS_UNSPECIFIED = 0;
ORDER_STATUS_UNPAID = 1;
ORDER_STATUS_PAID = 2;
ORDER_STATUS_EXPIRED = 3;
ORDER_STATUS_CANCELLED = 4;
ORDER_STATUS_FINISHED = 5;
}
message Transaction {
string id = 1;
google.protobuf.StringValue payer_wallet_id = 2;
google.protobuf.StringValue payee_wallet_id = 3;
string currency = 4;
string amount = 5;
google.protobuf.StringValue remarks = 6;
TransactionType type = 7;
google.protobuf.Timestamp created_at = 8;
google.protobuf.Timestamp updated_at = 9;
}
enum TransactionType {
TRANSACTION_TYPE_UNSPECIFIED = 0;
TRANSACTION_TYPE_SYSTEM = 1;
TRANSACTION_TYPE_ORDER = 2;
TRANSACTION_TYPE_TRANSFER = 3;
}
message CreateTransactionWithAccountRequest {
google.protobuf.StringValue payer_account_id = 1;
google.protobuf.StringValue payee_account_id = 2;
string currency = 3;
string amount = 4;
google.protobuf.StringValue remarks = 5;
TransactionType type = 6;
}
message CreateTransactionRequest {
google.protobuf.StringValue payer_wallet_id = 1;
google.protobuf.StringValue payee_wallet_id = 2;
string currency = 3;
string amount = 4;
google.protobuf.StringValue remarks = 5;
TransactionType type = 6;
}
message CancelOrderRequest {
string order_id = 1;
}
message RefundOrderRequest {
string order_id = 1;
}
message RefundOrderResponse {
Order order = 1;
Transaction refund_transaction = 2;
}
message TransferRequest {
string payer_account_id = 1;
string payee_account_id = 2;
string currency = 3;
string amount = 4;
}
message GetWalletFundRequest {
string fund_id = 1;
}