commit e1caf757e714061da92f4fdfeb3cbef39b35f70f Author: maximo tejeda Date: Wed Dec 4 19:46:11 2024 -0400 FIRST COMMIT diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..3ac2432 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,14 @@ +((nil (eglot-workspace-configuration . ((gopls . ((staticcheck . t) + (matcher . "CaseSensitive") + (hints . ( + (compositeLiteralFields . t) + (compositeLiteralTypes . t) + (constantValues . t) + (functionTypeParameters . t) + (parameterNames . t) + (rangeVariableTypes . t) + (assignVariableTypes . t) + )))))) + (eglot-server-programs + ((go-mode go-ts-mode) . ("gopls"))) + )) diff --git a/.github/workflows/image_creation.yml b/.github/workflows/image_creation.yml new file mode 100644 index 0000000..8ef56e6 --- /dev/null +++ b/.github/workflows/image_creation.yml @@ -0,0 +1,105 @@ +name: ${{ github.actor }} executed Build Push Prod +on: + push: + tags: + - 'v[0-9]+\.[0-9]+\.[0-9]+' +jobs: + build: + runs-on: ubuntu-latest + env: + TOKEN: ${{ secrets.TOKEN }} + USERNAME: ${{ vars.USERNAME }} + TAG_VERSION: ${{ github.ref_name }} + steps: + - name: echo repo dir + id: repo-url + run: | + echo "repourl=$(echo ${{ github.server_url }} | sed -e 's;https://;;')" >> $GITHUB_OUTPUT + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Quemu + uses: docker/setup-qemu-action@v3 + + - name: Set Up BuildX + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker + uses: docker/login-action@v3 + with: + registry: https://git.maximotejeda.com + username: ${{ vars.USERNAME }} + password: ${{ secrets.PWD }} + + - name: calculate short sha + id: calculate-sha + run: | + echo "shortsha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: "${{ steps.repo-url.outputs.repourl }}/${{ github.repository }}:${{ github.ref_name }}" + build-args: | + version=${{ github.ref_name }} + SHORTSHA=${{ steps.calculate-sha.outputs.shortsha }} + + deploy: + runs-on: ubuntu-latest + needs: build + env: + TOKEN: ${{ secrets.TOKEN }} + TAG: ${{ github.ref_name }} + PASSWORD: $PWD + USERNAME: ${{ vars.USERNAME }} + TAG_VERSION: ${{ github.ref_name }} + NATS_SERVICE_URL: "${{ vars.NATS_SERVICE_URL }}" + ENV: "production" + APPLICATION_PORT: "${{ vars.APPLICATION_PORT }}" + DATA_SOURCE_URL: "${{ vars.DATA_SOURCE_URL }}" + steps: + - name: echo repo dir + id: repo-url + run: | + echo "repourl=$(echo ${{ github.server_url }} | sed -e 's;https://;;')" >> $GITHUB_OUTPUT + echo "repoName=$(echo ${{ github.repository }} | sed -e 's;${{ github.actor }}/;;')" >> $GITHUB_OUTPUT + echo "${{ github.repository }} | sed -e 's;${{ github.actor }}/;;')" + - name: Checkout code + uses: actions/checkout@v4 + + - name: install envsubst + run: | + apt update + apt install -y gettext-base + apt clean + + - name: create deployment files + env: + IMAGE: "${{ steps.repo-url.outputs.repourl }}/${{ github.repository }}:${{ github.ref_name }}" + REPONAME: "${{ steps.repo-url.outputs.repoName }}" + run: | + envsubst < k8s/deployment.yml.template > k8s/deployment.yml + - name: Download kubectl + run: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + + - name: install kubectl + run: sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl + + - name: insert kube config + run: | + mkdir ~/.kube + export IMAGE="$( echo ${{ github.server_url }} | sed -e 's;https://;;')/${{ github.repository }}:${{ github.ref_name }}" + echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config + - name: check pod + run: kubectl apply -f k8s/deployment.yml + + - name: scale down deployment + continue-on-error: true + run: kubectl scale deployment ${{ steps.repo-url.outputs.repoName }}-grpc --replicas=0 + + - name: scale up deployment + run: kubectl scale deployment ${{ steps.repo-url.outputs.repoName }}-grpc --replicas=1 diff --git a/.github/workflows/test_project.yml b/.github/workflows/test_project.yml new file mode 100644 index 0000000..8ef56e6 --- /dev/null +++ b/.github/workflows/test_project.yml @@ -0,0 +1,105 @@ +name: ${{ github.actor }} executed Build Push Prod +on: + push: + tags: + - 'v[0-9]+\.[0-9]+\.[0-9]+' +jobs: + build: + runs-on: ubuntu-latest + env: + TOKEN: ${{ secrets.TOKEN }} + USERNAME: ${{ vars.USERNAME }} + TAG_VERSION: ${{ github.ref_name }} + steps: + - name: echo repo dir + id: repo-url + run: | + echo "repourl=$(echo ${{ github.server_url }} | sed -e 's;https://;;')" >> $GITHUB_OUTPUT + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Quemu + uses: docker/setup-qemu-action@v3 + + - name: Set Up BuildX + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker + uses: docker/login-action@v3 + with: + registry: https://git.maximotejeda.com + username: ${{ vars.USERNAME }} + password: ${{ secrets.PWD }} + + - name: calculate short sha + id: calculate-sha + run: | + echo "shortsha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: "${{ steps.repo-url.outputs.repourl }}/${{ github.repository }}:${{ github.ref_name }}" + build-args: | + version=${{ github.ref_name }} + SHORTSHA=${{ steps.calculate-sha.outputs.shortsha }} + + deploy: + runs-on: ubuntu-latest + needs: build + env: + TOKEN: ${{ secrets.TOKEN }} + TAG: ${{ github.ref_name }} + PASSWORD: $PWD + USERNAME: ${{ vars.USERNAME }} + TAG_VERSION: ${{ github.ref_name }} + NATS_SERVICE_URL: "${{ vars.NATS_SERVICE_URL }}" + ENV: "production" + APPLICATION_PORT: "${{ vars.APPLICATION_PORT }}" + DATA_SOURCE_URL: "${{ vars.DATA_SOURCE_URL }}" + steps: + - name: echo repo dir + id: repo-url + run: | + echo "repourl=$(echo ${{ github.server_url }} | sed -e 's;https://;;')" >> $GITHUB_OUTPUT + echo "repoName=$(echo ${{ github.repository }} | sed -e 's;${{ github.actor }}/;;')" >> $GITHUB_OUTPUT + echo "${{ github.repository }} | sed -e 's;${{ github.actor }}/;;')" + - name: Checkout code + uses: actions/checkout@v4 + + - name: install envsubst + run: | + apt update + apt install -y gettext-base + apt clean + + - name: create deployment files + env: + IMAGE: "${{ steps.repo-url.outputs.repourl }}/${{ github.repository }}:${{ github.ref_name }}" + REPONAME: "${{ steps.repo-url.outputs.repoName }}" + run: | + envsubst < k8s/deployment.yml.template > k8s/deployment.yml + - name: Download kubectl + run: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + + - name: install kubectl + run: sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl + + - name: insert kube config + run: | + mkdir ~/.kube + export IMAGE="$( echo ${{ github.server_url }} | sed -e 's;https://;;')/${{ github.repository }}:${{ github.ref_name }}" + echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config + - name: check pod + run: kubectl apply -f k8s/deployment.yml + + - name: scale down deployment + continue-on-error: true + run: kubectl scale deployment ${{ steps.repo-url.outputs.repoName }}-grpc --replicas=0 + + - name: scale up deployment + run: kubectl scale deployment ${{ steps.repo-url.outputs.repoName }}-grpc --replicas=1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..774e1f2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM alpine:latest +ARG BINAME=tgbuser-grpc-linux-arm64-0.0.0_1 +COPY ./bin/${BINAME} /usr/bin/tgbuser-grpc +RUN mkdir /app +WORKDIR /app + +ENTRYPOINT tgbuser-grpc diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b9d5505 --- /dev/null +++ b/Makefile @@ -0,0 +1,66 @@ +# must create a .env file with info +# must have compose installed +include .env +export +OS:=${shell go env GOOS} +ARCH=$(shell go env GOARCH) +OOSS="linux" +ARRCHS="arm 386" +DEBUG=1 +SERVICE=tgbuser-grpc +VERSION=0.0.0_7 +BINAME=$(SERVICE)-$(OS)-amd64-$(VERSION) +BINAMEARM=$(SERVICE)-$(OS)-arm64-$(VERSION) +# can be docker or podman or whatever +CONTAINERS=docker +COMPOSE=$(CONTAINERS)-compose +# Configure local registry +REGADDR=192.168.0.151:32000 +K8SRSNAME=$(shell kubectl get rs --no-headers -o custom-columns=":metadata.name" | grep $(SERVICE)) +.phony: all clean build test clean-image build-image build-image-debug run-image run-image-debug run-local + + +build-image: build +# here we made the images and push to registry with buildx + @$(CONTAINERS) buildx build --build-arg="BINAME=$(BINAMEARM)" --platform linux/arm64 --push -t $(REGADDR)/$(SERVICE):latest . + +# Here we upload it to local + +build-test-image: + @$(CONTAINERS) buildx build --build-arg="BINAME=$(BINAMEARM)" --platform linux/arm64 --push -t $(REGADDR)/$(SERVICE):latest . + +run-image: build-image + @$(CONTAINERS) compose -f docker-compose.yaml up + +build-image-debug: clean + @$(CONTAINERS) compose -f docker-compose-debug.yaml build + +run-image-debug: build-image-debug + @$(CONTAINERS) compose -f docker-compose-debug.yaml up + +run-local:clean build + @bin/$(BINAME) + +build: clean + #@mkdir dolardb + @protoc -I ./proto --go_out ./proto/golang --go_opt paths=source_relative --go-grpc_out ./proto/golang --go-grpc_opt paths=source_relative ./proto/tgbuser/tgbuser.proto + @env CGO_ENABLED=0 GOOS=$(OS) GOARCH=amd64 go build -o ./bin/$(BINAME) ./cmd/. + @env CGO_ENABLED=0 GOOS=$(OS) GOARCH=arm64 go build -o ./bin/$(BINAMEARM) ./cmd/. + +create-descriptors: + @envsubst < k8s/deployment.yml.template > k8s/deployment.yml + +deploy: build-image create-descriptors + @kubectl apply -f k8s/deployment.yml + @kubectl scale rs $(K8SRSNAME) --replicas=0 + @kubectl scale rs $(K8SRSNAME) --replicas=1 + +test: + @go -count=1 test ./... +clean: + @rm -rf ./bin + +clean-image: + @$(CONTAINERS) system prune -f + + diff --git a/README.org b/README.org new file mode 100644 index 0000000..0892f76 --- /dev/null +++ b/README.org @@ -0,0 +1,4 @@ +#+TITLE: New svc +#+AUTHOR: Maximo Tejeda +#+DATE: 21/04/2024 + diff --git a/bin/tgbuser-grpc-linux-amd64-0.0.0_7 b/bin/tgbuser-grpc-linux-amd64-0.0.0_7 new file mode 100755 index 0000000..d2a888f Binary files /dev/null and b/bin/tgbuser-grpc-linux-amd64-0.0.0_7 differ diff --git a/bin/tgbuser-grpc-linux-arm64-0.0.0_7 b/bin/tgbuser-grpc-linux-arm64-0.0.0_7 new file mode 100755 index 0000000..69a53c9 Binary files /dev/null and b/bin/tgbuser-grpc-linux-arm64-0.0.0_7 differ diff --git a/cmd/main.go b/cmd/main.go new file mode 100644 index 0000000..5174180 --- /dev/null +++ b/cmd/main.go @@ -0,0 +1,24 @@ +package main + +import ( + "log/slog" + + "git.maximotejeda.com/maximo/tgb-user/config" + "git.maximotejeda.com/maximo/tgb-user/internal/adapters/db" + "git.maximotejeda.com/maximo/tgb-user/internal/adapters/grpc" + "git.maximotejeda.com/maximo/tgb-user/internal/application/core/api" +) + +func main() { + log := slog.Default() + log.With("place", "main") + dbAdapter, err := db.NewAdapter(config.GetDataSourceURL()) + if err != nil { + log.Error("creating db connection", "error", err) + } + app := api.NewApplication(dbAdapter) + + grpcAdapter := grpc.NewAdapter(app, config.GetApplicationPort()) + log.Info("[tgbuser] service running", "port", config.GetApplicationPort()) + grpcAdapter.Run() +} diff --git a/config/config.go b/config/config.go new file mode 100644 index 0000000..0522a93 --- /dev/null +++ b/config/config.go @@ -0,0 +1,30 @@ +package config + +import ( + "log" + "os" + "strconv" +) + +func GetEnv() string { + return getEnvValue("ENV") +} + +func GetDataSourceURL() string { + return getEnvValue("DATA_SOURCE_URL") +} + +func GetApplicationPort() int { + portStr := getEnvValue("APPLICATION_PORT") + port, err := strconv.Atoi(portStr) + if err != nil { + log.Fatalf("port: %s is invalid", portStr) + } + return port +} +func getEnvValue(key string) string { + if os.Getenv(key) == "" { + log.Fatal("env variable not set: " + key) + } + return os.Getenv(key) +} diff --git a/dolar.db b/dolar.db new file mode 100644 index 0000000..e9c30bf Binary files /dev/null and b/dolar.db differ diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..80cf6b0 --- /dev/null +++ b/go.mod @@ -0,0 +1,28 @@ +module git.maximotejeda.com/maximo/tgb-user + +go 1.22.0 + +require ( + google.golang.org/grpc v1.63.2 + modernc.org/sqlite v1.29.8 +) + +require ( + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/ncruces/go-strftime v0.1.9 // indirect + github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/sys v0.19.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 // indirect + google.golang.org/protobuf v1.34.0 // indirect + modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect + modernc.org/libc v1.49.3 // indirect + modernc.org/mathutil v1.6.0 // indirect + modernc.org/memory v1.8.0 // indirect + modernc.org/strutil v1.2.0 // indirect + modernc.org/token v1.1.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..91f8039 --- /dev/null +++ b/go.sum @@ -0,0 +1,73 @@ +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +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.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd h1:gbpYu9NMq8jhDVbvlGkMFWCjLFlqqEZjEmObmhUy6Vo= +github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= +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/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= +github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= +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/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= +golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= +golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be h1:LG9vZxsWGOmUKieR8wPAUR3u3MpnYFQZROPIMaXh7/A= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 h1:DujSIu+2tC9Ht0aPNA7jgj23Iq8Ewi5sgkQ++wdvonE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4= +google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +modernc.org/cc/v4 v4.20.0 h1:45Or8mQfbUqJOG9WaxvlFYOAQO0lQ5RvqBcFCXngjxk= +modernc.org/cc/v4 v4.20.0/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ= +modernc.org/ccgo/v4 v4.16.0 h1:ofwORa6vx2FMm0916/CkZjpFPSR70VwTjUCe2Eg5BnA= +modernc.org/ccgo/v4 v4.16.0/go.mod h1:dkNyWIjFrVIZ68DTo36vHK+6/ShBn4ysU61So6PIqCI= +modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE= +modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ= +modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw= +modernc.org/gc/v2 v2.4.1/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU= +modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 h1:5D53IMaUuA5InSeMu9eJtlQXS2NxAhyWQvkKEgXZhHI= +modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4= +modernc.org/libc v1.49.3 h1:j2MRCRdwJI2ls/sGbeSk0t2bypOG/uvPZUsGQFDulqg= +modernc.org/libc v1.49.3/go.mod h1:yMZuGkn7pXbKfoT/M35gFJOAEdSKdxL0q64sF7KqCDo= +modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= +modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= +modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E= +modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU= +modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= +modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= +modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc= +modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss= +modernc.org/sqlite v1.29.8 h1:nGKglNx9K5v0As+zF0/Gcl1kMkmaU1XynYyq92PbsC8= +modernc.org/sqlite v1.29.8/go.mod h1:lQPm27iqa4UNZpmr4Aor0MH0HkCLbt1huYDfWylLZFk= +modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= +modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= +modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= +modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= diff --git a/internal/adapters/db/access.go b/internal/adapters/db/access.go new file mode 100644 index 0000000..7cb90f9 --- /dev/null +++ b/internal/adapters/db/access.go @@ -0,0 +1,245 @@ +package db + +import ( + "context" + "database/sql" + "log/slog" +) + +type BotAccessRequest struct { + db *sql.DB + log *slog.Logger + ID int64 `json:"id"` + TgbID int64 `json:"tgb_id"` + BotName string `json:"bot_name"` + BotID int64 `json:"bot_id"` + Created int64 `json:"edited"` +} + +type BotBannedAccess struct { + db *sql.DB + log *slog.Logger + ID int64 `json:"id"` + TgbID int64 `json:"tgb_id"` + BotName string `json:"bot_name"` + Until int64 `json:"until"` + Created int64 `json:"edited"` +} + +func NewBotAccessRequest(db *sql.DB, log *slog.Logger) *BotAccessRequest { + return &BotAccessRequest{ + db: db, + log: log, + } +} + +func NewBotBannedAccess(db *sql.DB, log *slog.Logger) *BotBannedAccess { + return &BotBannedAccess{ + db: db, + log: log, + } +} + +func (bar *BotAccessRequest) Add(ctx context.Context, tgbID int64, botName string) (bool, error) { + + stmt, err := bar.db.PrepareContext(ctx, + ` +INSERT INTO bot_access_requests + (tgb_id, bot_id, created) +VALUES(?,(SELECT id FROM bots WHERE bot_name = ?),strftime('%s', 'now'));`) + + if err != nil { + bar.log.Error("prepare stmt add bot access request", "error", err) + return false, err + } + defer stmt.Close() + _, err = stmt.ExecContext(ctx, tgbID, botName) + if err != nil { + bar.log.Error("exec add bot access requests", "error", err) + return false, err + } + return true, nil +} + +// Get +// Get access request pending for bots +func (bar *BotAccessRequest) Get(ctx context.Context, tgbID int64) ([]*BotAccessRequest, error) { + stmt, err := bar.db.PrepareContext(ctx, + `SELECT bar.id, b.bot_name, bar.created FROM bot_access_requests AS bar + JOIN bots AS b ON bar.bot_id = b.id + WHERE bar.tgb_id = ?;`) + if err != nil { + bar.log.Error("prepare stmt getBots", "error", err) + return nil, err + } + defer stmt.Close() + rows, err := stmt.QueryContext(ctx, tgbID) + if err != nil { + bar.log.Error("query get bot_access_request", "error", err) + return nil, err + } + defer rows.Close() + bl := []*BotAccessRequest{} + for rows.Next() { + ba := &BotAccessRequest{} + err := rows.Scan(&ba.ID, &ba.BotName, &ba.Created) + if err != nil { + bar.log.Error("scanning get bots_access_requests", "error", err) + return nil, err + } + bl = append(bl, ba) + + } + return bl, nil +} + +// GetAll +// GetAll access request pending for bots +func (bar *BotAccessRequest) GetAll(ctx context.Context, botName string) ([]*BotAccessRequest, error) { + stmt, err := bar.db.PrepareContext(ctx, + `SELECT bar.id, b.bot_name, bar.tgb_id, bar.created FROM bot_access_requests AS bar + JOIN bots AS b ON bar.bot_id = b.id + WHERE b.bot_name = ?;`) + if err != nil { + bar.log.Error("prepare stmt getBots", "error", err) + return nil, err + } + defer stmt.Close() + rows, err := stmt.QueryContext(ctx, botName) + if err != nil { + bar.log.Error("query get bot_access_request", "error", err) + return nil, err + } + defer rows.Close() + bl := []*BotAccessRequest{} + for rows.Next() { + ba := &BotAccessRequest{} + err := rows.Scan(&ba.ID, &ba.BotName, &ba.TgbID, &ba.Created) + if err != nil { + bar.log.Error("scanning get bots_access_requests", "error", err) + return nil, err + } + bl = append(bl, ba) + + } + return bl, nil +} + +func (bar BotAccessRequest) Delete(ctx context.Context, tgbID int64, botName string) (bool, error) { + stmt, err := bar.db.PrepareContext(ctx, + ` +DELETE FROM bot_access_requests as bar +WHERE bar.bot_id = (SELECT id FROM bots WHERE bot_name = ?) AND bar.tgb_id = ? +`) + if err != nil { + bar.log.Error("prepare stmt delete", "error", err) + return false, err + } + defer stmt.Close() + _, err = stmt.ExecContext(ctx, botName, tgbID) + if err != nil { + bar.log.Error("exec delete", "error", err) + return false, err + } + return true, nil +} + +func (bba *BotBannedAccess) Add(ctx context.Context, tgbID, until int64, botName string) (bool, error) { + + stmt, err := bba.db.PrepareContext(ctx, + ` +INSERT INTO banned_bot_access + (tgb_id, until, bot_id, created) +VALUES(?,?,(SELECT id FROM bots WHERE bot_name = ?),strftime('%s', 'now'));`) + + if err != nil { + bba.log.Error("prepare stmt add bot banned access", "error", err) + return false, err + } + defer stmt.Close() + _, err = stmt.ExecContext(ctx, tgbID, until, botName) + if err != nil { + bba.log.Error("exec add bot banned Access", "error", err) + return false, err + } + return true, nil +} + +func (bba *BotBannedAccess) Get(ctx context.Context, tgbID int64) ([]*BotBannedAccess, error) { + stmt, err := bba.db.PrepareContext(ctx, + `SELECT bba.id, b.bot_name, bba.until, bba.created FROM banned_bot_access AS bba + JOIN bots AS b ON bba.bot_id = b.id + WHERE bba.tgb_id = ?;`) + if err != nil { + bba.log.Error("prepare stmt bots banned access", "error", err) + return nil, err + } + defer stmt.Close() + rows, err := stmt.QueryContext(ctx, tgbID) + if err != nil { + bba.log.Error("query get bot banned access", "error", err) + return nil, err + } + defer rows.Close() + bl := []*BotBannedAccess{} + for rows.Next() { + ba := &BotBannedAccess{} + err := rows.Scan(&ba.ID, &ba.BotName, &ba.Until, &ba.Created) + if err != nil { + bba.log.Error("scanning get bots banned access", "error", err) + return nil, err + } + bl = append(bl, ba) + + } + return bl, nil +} + +func (bba *BotBannedAccess) GetAll(ctx context.Context, botName string) ([]*BotBannedAccess, error) { + stmt, err := bba.db.PrepareContext(ctx, + `SELECT bba.id, b.bot_name, bba.tgb_id, bba.until, bba.created FROM banned_bot_access AS bba + JOIN bots AS b ON bba.bot_id = b.id + WHERE b.bot_name = ?;`) + if err != nil { + bba.log.Error("prepare stmt bots banned access", "error", err) + return nil, err + } + defer stmt.Close() + rows, err := stmt.QueryContext(ctx, botName) + if err != nil { + bba.log.Error("query get bot banned access", "error", err) + return nil, err + } + defer rows.Close() + bl := []*BotBannedAccess{} + for rows.Next() { + ba := &BotBannedAccess{} + err := rows.Scan(&ba.ID, &ba.BotName, &ba.TgbID, &ba.Until, &ba.Created) + if err != nil { + bba.log.Error("scanning get bots banned access", "error", err) + return nil, err + } + bl = append(bl, ba) + + } + return bl, nil +} + +func (bba *BotBannedAccess) Delete(ctx context.Context, tgbID int64, botName string) (bool, error) { + stmt, err := bba.db.PrepareContext(ctx, + ` +DELETE FROM banned_bot_access as bar +WHERE bar.bot_id = (SELECT id FROM bots WHERE bot_name = ?) AND bar.tgb_id = ? +`) + if err != nil { + bba.log.Error("prepare stmt delete bot banned access", "error", err) + return false, err + } + defer stmt.Close() + _, err = stmt.ExecContext(ctx, botName, tgbID) + if err != nil { + bba.log.Error("exec delete bot banned access", "error", err) + return false, err + } + return true, nil +} diff --git a/internal/adapters/db/bot_users.go b/internal/adapters/db/bot_users.go new file mode 100644 index 0000000..1647ccb --- /dev/null +++ b/internal/adapters/db/bot_users.go @@ -0,0 +1,170 @@ +package db + +import ( + "context" + "database/sql" + "log/slog" + + "git.maximotejeda.com/maximo/tgb-user/internal/application/core/domain" +) + +type BotUser struct { + db *sql.DB + log *slog.Logger + ID int64 `json:"id"` + Tgb_ID int64 `json:"tgb_id"` + Bot_id int64 `json:"bot_id"` + Created int64 `json:"edited"` +} + +func NewBotUser(db *sql.DB, log *slog.Logger) *BotUser { + log = log.With("obj", "BotUsers") + return &BotUser{ + db: db, + log: log, + } +} + +func (bu BotUser) GetUsers(ctx context.Context, botName string) (ul []*domain.User, err error) { + smt, err := bu.db.PrepareContext(ctx, + `SELECT u.tgb_id, u.username, u.first_name, u.last_name, u.created, u.edited + FROM bot_users AS bu + JOIN bots as b ON b.id = bu.bot_id + JOIN users as u ON bu.tgb_id = u.tgb_id + WHERE b.bot_name = ? AND u.deleted IS NULL;`) + if err != nil { + bu.log.Error("prepare stmt getUsers", "error", err) + return nil, err + } + defer smt.Close() + rows, err := smt.QueryContext(ctx, botName) + if err != nil { + bu.log.Error("query getUsers", "error", err) + return nil, err + } + defer rows.Close() + for rows.Next() { + u := &domain.User{} + err = rows.Scan(&u.TGB_ID, &u.Username, &u.FirstName, &u.LastName, &u.Created, &u.Edited) + if err != nil { + bu.log.Error("canning getUsers", "error", err) + return nil, err + } + ul = append(ul, u) + } + return ul, nil +} + +func (bu BotUser) GetBots(ctx context.Context, tgb_id int64) (bl []*domain.Bot, err error) { + stmt, err := bu.db.PrepareContext(ctx, + `SELECT b.id, b.bot_name, b.created FROM bot_users AS bu + JOIN bots AS b ON bu.bot_id = b.id + WHERE bu.tgb_id = ?;`) + if err != nil { + bu.log.Error("prepare stmt getBots", "error", err) + return nil, err + } + defer stmt.Close() + rows, err := stmt.QueryContext(ctx, tgb_id) + if err != nil { + bu.log.Error("query get bots", "error", err) + return nil, err + } + defer rows.Close() + bl = []*domain.Bot{} + for rows.Next() { + bot := &domain.Bot{} + err := rows.Scan(&bot.ID, &bot.BotName, &bot.Created) + if err != nil { + bu.log.Error("scanning get bots", "error", err) + return nil, err + } + bl = append(bl, bot) + + } + return bl, nil +} + +func (bu BotUser) CreateBot(ctx context.Context, bot_name string) (bool, error) { + stmt, err := bu.db.PrepareContext(ctx, + `INSERT OR IGNORE INTO bots (bot_name, created) VALUES(?, strftime('%s', 'now'));`) + if err != nil { + bu.log.Error("prepare stmt add", "error", err) + return false, err + } + defer stmt.Close() + _, err = stmt.ExecContext(ctx, bot_name) + + if err != nil { + bu.log.Error("exec context add", "error", err) + return false, err + } + return true, nil + +} + +func (bu BotUser) Add(ctx context.Context, tgb_id int64, bot_name string) (bool, error) { + + stmt1, err := bu.db.PrepareContext(ctx, + ` +INSERT INTO bot_users + (tgb_id, bot_id, created) +VALUES(?,(SELECT id FROM bots WHERE bot_name = ?),strftime('%s', 'now'));`) + + if err != nil { + bu.log.Error("prepare stmt add botusers", "error", err) + return false, err + } + defer stmt1.Close() + _, err = stmt1.ExecContext(ctx, tgb_id, bot_name) + if err != nil { + bu.log.Error("exec add bot users", "error", err) + return false, err + } + return true, nil +} + +func (bu BotUser) Delete(ctx context.Context, tgb_id int64, botname string) (bool, error) { + stmt, err := bu.db.PrepareContext(ctx, + ` +DELETE FROM bot_users as u +WHERE u.bot_id = (SELECT id FROM bots WHERE bot_name = ?) AND u.tgb_id = ? +`) + if err != nil { + bu.log.Error("prepare stmt delete", "error", err) + return false, err + } + defer stmt.Close() + _, err = stmt.ExecContext(ctx, botname, tgb_id) + if err != nil { + bu.log.Error("exec delete", "error", err) + return false, err + } + return true, nil +} + +func (bu BotUser) GetAllBots(ctx context.Context) ([]*domain.Bot, error) { + stmt, err := bu.db.Prepare(`SELECT id, bot_name, created FROM bots`) + if err != nil { + bu.log.Error("prepare stmt get all bots", "error", err) + return nil, err + } + stmt.Close() + rows, err := stmt.Query() + if err != nil { + bu.log.Error("query get all bots", "error", err) + return nil, err + } + defer rows.Close() + list := []*domain.Bot{} + for rows.Next() { + bot := &domain.Bot{} + err := rows.Scan(&bot.ID, &bot.BotName, &bot.Created) + if err != nil { + bu.log.Error("scanning get all bots", "error", err) + continue + } + list = append(list, bot) + } + return list, nil +} diff --git a/internal/adapters/db/db.go b/internal/adapters/db/db.go new file mode 100644 index 0000000..283ce84 --- /dev/null +++ b/internal/adapters/db/db.go @@ -0,0 +1,189 @@ +package db + +import ( + "context" + "database/sql" + _ "embed" + "fmt" + "log/slog" + "time" + + "git.maximotejeda.com/maximo/tgb-user/internal/application/core/domain" + _ "modernc.org/sqlite" +) + +//go:embed schema.sql +var schema string + +type Adapter struct { + db *sql.DB + log *slog.Logger +} + +func NewAdapter(dataSourceURL string) (*Adapter, error) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + log := slog.Default().With("adapter", "db") + pragmas := "cache=shared&_foreign_keys=on&_busy_timeout=3000&_journal_mode=WAL" + db, err := sql.Open("sqlite", fmt.Sprintf("file:%s?%s", dataSourceURL, pragmas)) + if err != nil { + return nil, fmt.Errorf("connecion error: %w", err) + } + err = db.PingContext(ctx) + if err != nil { + return nil, fmt.Errorf("ping error: %w", err) + } + db.SetConnMaxIdleTime(10 * time.Second) + CreateTables(db) + + return &Adapter{db: db, log: log}, nil +} + +// Schema +func CreateTables(db *sql.DB) { + _, err := db.Exec(schema) + if err != nil { + panic(err) + } +} + +func (a Adapter) Create(ctx context.Context, req *domain.User) (bool, error) { + user := User{db: a.db, log: a.log} + ok, err := user.Create(ctx, req) + return ok, err +} +func (a Adapter) Get(ctx context.Context, id int64) (*domain.User, error) { + user := NewUser(a.db, a.log) + visit := NewVisits(a.db, a.log) + + us, err := user.Get(ctx, id) + if err != nil { + return nil, err + } + _, err1 := visit.Add(ctx, id) + if err1 != nil { + fmt.Println(err1) + } + return us, err +} +func (a Adapter) Edit(ctx context.Context, us *domain.User) (bool, error) { + user := NewUser(a.db, a.log) + ok, err := user.Edit(ctx, *us) + return ok, err +} +func (a Adapter) Delete(ctx context.Context, id int64) (bool, error) { + // TODO db work + user := NewUser(a.db, a.log) + ok, err := user.Delete(ctx, id) + + return ok, err +} +func (a Adapter) AddBot(ctx context.Context, tgb_id int64, botname string) (bool, error) { + bu := NewBotUser(a.db, a.log) + ok, err := bu.Add(ctx, tgb_id, botname) + return ok, err +} +func (a Adapter) DeleteBot(ctx context.Context, tgb_id int64, botname string) (bool, error) { + bu := NewBotUser(a.db, a.log) + ok, err := bu.Delete(ctx, tgb_id, botname) + return ok, err +} + +func (a Adapter) GetBots(ctx context.Context, tgb_id int64) ([]*domain.Bot, error) { + bu := NewBotUser(a.db, a.log) + return bu.GetBots(ctx, tgb_id) +} + +func (a Adapter) GetAllBotUsers(ctx context.Context, bot_name string) ([]*domain.User, error) { + bu := NewBotUser(a.db, a.log) + return bu.GetUsers(ctx, bot_name) +} + +func (a Adapter) GetAllBots(ctx context.Context) ([]*domain.Bot, error) { + bu := NewBotUser(a.db, a.log) + return bu.GetAllBots(ctx) +} + +// GetAccessRequest +// Returns all access request from a user +func (a Adapter) GetAccessRequest(ctx context.Context, tgbID int64) ([]*BotAccessRequest, error) { + bar := NewBotAccessRequest(a.db, a.log) + return bar.Get(ctx, tgbID) +} + +// GetAllAccessRequest +// Returns all Access request from a bot +func (a Adapter) GetAllAccessRequest(ctx context.Context, botName string) ([]*BotAccessRequest, error) { + bar := NewBotAccessRequest(a.db, a.log) + return bar.GetAll(ctx, botName) +} + +// CreateAccessRequest +// When user try get access to a restricted bot create a row in here +func (a Adapter) CreateAccessRequest(ctx context.Context, tgbID int64, botName string) (bool, error) { + bar := NewBotAccessRequest(a.db, a.log) + return bar.Add(ctx, tgbID, botName) +} + +// GrantAccess +// +// If a row with user id and bot id is in db returns an object +func (a Adapter) GrantAccess(ctx context.Context, tgbID int64, botName string) (bool, error) { + bar := NewBotAccessRequest(a.db, a.log) + ok, err := bar.Delete(ctx, tgbID, botName) + if !ok { + return false, err + } else { + return a.AddBot(ctx, tgbID, botName) + } +} + +// GetBannedBot +// get banned bots for a user +func (a Adapter) GetBannedBot(ctx context.Context, tgbID int64) ([]*BotBannedAccess, error) { + bba := NewBotBannedAccess(a.db, a.log) + return bba.Get(ctx, tgbID) +} + +// GetAllBannedUsers +// get all users banned from a bot +func (a Adapter) GetAllBannedUsers(ctx context.Context, botName string) ([]*BotBannedAccess, error) { + bba := NewBotBannedAccess(a.db, a.log) + return bba.GetAll(ctx, botName) +} + +// BanUser +// ban a user creating a row in db ban and removin access request and bot grants +func (a Adapter) BanUser(ctx context.Context, tgbID, until int64, botName string) (bool, error) { + bba := NewBotBannedAccess(a.db, a.log) + bar := NewBotAccessRequest(a.db, a.log) + if ok, err := bar.Delete(ctx, tgbID, botName); !ok { + a.log.Error("access request not deleted", "error", err) + } + if ok, err := a.DeleteBot(ctx, tgbID, botName); !ok { + a.log.Error("bot access not deleted", "error", err) + } + + return bba.Add(ctx, tgbID, until, botName) + +} + +// UnBanUser +// Remove restriction from an user and create a access request +func (a Adapter) UnBanUser(ctx context.Context, tgbID int64, botName string) (bool, error) { + bba := NewBotBannedAccess(a.db, a.log) + bar := NewBotAccessRequest(a.db, a.log) + + if ok, err := bba.Delete(ctx, tgbID, botName); !ok { + return false, err + } else { + return bar.Add(ctx, tgbID, botName) + } +} + +// CreateBot +// create a new bot in db +func (a Adapter) CreateBot(ctx context.Context, botName string) (bool, error) { + bu := NewBotUser(a.db, a.log) + return bu.CreateBot(ctx, botName) +} diff --git a/internal/adapters/db/schema.sql b/internal/adapters/db/schema.sql new file mode 100644 index 0000000..dc44d2b --- /dev/null +++ b/internal/adapters/db/schema.sql @@ -0,0 +1,69 @@ +-- sql goes here +CREATE TABLE IF NOT EXISTS 'users' ( + id INTEGER PRIMARY KEY, + tgb_id INTEGER NOT NULL UNIQUE, + username TEXT, + first_name TEXT, + last_name TEXT, + created INTEGER NOT NULL, + edited INTEGER NOT NULL, + deleted INTEGER +); + +CREATE INDEX IF NOT EXISTS tgb_id_user_index ON 'users' (tgb_id); + +CREATE TABLE IF NOT EXISTS 'visits' ( + id INTEGER PRIMARY KEY, + tgb_id INTEGER NOT NULL, + quantity INTEGER, + edited INTEGER, + FOREIGN KEY(tgb_id) REFERENCES users(id) ON DELETE CASCADE +); + +CREATE INDEX IF NOT EXISTS tgb_id_visit_index ON 'users' (tgb_id); + +CREATE TRIGGER IF NOT EXISTS check_daily_visits + BEFORE INSERT ON 'users' + BEGIN + INSERT OR IGNORE INTO 'visits' (tgb_id, quantity, edited) + VALUES (new.tgb_id, 1, strftime('%s', 'now')); + END; + + +CREATE TABLE IF NOT EXISTS 'bots' ( + id INTEGER PRIMARY KEY, + bot_name TEXT UNIQUE, + created INTEGER NOT NULL +); + + +CREATE TABLE IF NOT EXISTS 'bot_users' ( + id INTEGER PRIMARY KEY, + tgb_id INTEGER NOT NULL, + bot_id INTEGER NOT NULL, + created INTEGER NOT NULL, + UNIQUE(tgb_id, bot_id), + FOREIGN KEY(tgb_id) REFERENCES users(id) ON DELETE CASCADE, + FOREIGN KEY(bot_id) REFERENCES bots(id) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS 'bot_access_requests' ( + id INTEGER PRIMARY KEY, + tgb_id INTEGER NOT NULL, + bot_id INTEGER NOT NULL, + created INTEGER NOT NULL, + UNIQUE(tgb_id, bot_id), + FOREIGN KEY(tgb_id) REFERENCES users(id) ON DELETE CASCADE, + FOREIGN KEY(bot_id) REFERENCES bots(id) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS 'banned_bot_access' ( + id INTEGER PRIMARY KEY, + tgb_id INTEGER NOT NULL, + bot_id INTEGER NOT NULL, + created INTEGER NOT NULL, + until INTEGER NOT NULL, + UNIQUE(tgb_id, bot_id), + FOREIGN KEY(tgb_id) REFERENCES users(id) ON DELETE CASCADE, + FOREIGN KEY(bot_id) REFERENCES bots(id) ON DELETE CASCADE +); diff --git a/internal/adapters/db/users.go b/internal/adapters/db/users.go new file mode 100644 index 0000000..c1dc198 --- /dev/null +++ b/internal/adapters/db/users.go @@ -0,0 +1,157 @@ +package db + +import ( + "context" + "database/sql" + "fmt" + "log/slog" + "strings" + + "git.maximotejeda.com/maximo/tgb-user/internal/application/core/domain" +) + +type User struct { + db *sql.DB + log *slog.Logger + ID int64 `json:"id"` + Tgb_ID int64 `json:"tgb_id"` + Username string `json:"username"` + FirstName string `json:"first_name"` + LastName string `json:"last_name"` + Created int64 `json:"created"` + Edited int64 `json:"edited"` + Deleted int64 `json:"deleted"` +} + +func NewUser(db *sql.DB, log *slog.Logger) *User { + log = log.With("obj", "User") + return &User{ + db: db, + log: log, + } +} + +func (u User) Get(ctx context.Context, tgb_id int64) (*domain.User, error) { + stmt, err := u.db.PrepareContext(ctx, + ` +SELECT u.id, u.tgb_id, u.username, u.first_name, u.last_name, u.created, u.edited + FROM users AS u + WHERE u.tgb_id = ? AND deleted IS NULL; +`) + if err != nil { + u.log.Error("prepare stmt get", "error", err) + return nil, err + } + defer stmt.Close() + us := &domain.User{} + if err := stmt.QueryRowContext(ctx, tgb_id).Scan(&us.ID, &us.TGB_ID, &us.Username, &us.FirstName, &us.LastName, &us.Created, &us.Edited); err != nil { + u.log.Error("query row context get", "error", err) + return nil, err + } + bu := NewBotUser(u.db, u.log) + bul, err := bu.GetBots(ctx, us.TGB_ID) + if err != nil { + u.log.Error("getting bots", "error", err) + } + for _, i := range bul { + us.TGBOT = us.TGBOT + "," + i.BotName + } + us.TGBOT, _ = strings.CutPrefix(us.TGBOT, ",") + return us, nil +} + +func (u User) Create(ctx context.Context, user *domain.User) (bool, error) { + stmt, err := u.db.PrepareContext(ctx, + ` +INSERT INTO users (tgb_id, username, first_name, last_name, created, edited) +VALUES(?,?,?,?,strftime('%s', 'now'),strftime('%s', 'now')); +`) + if err != nil { + u.log.Error("prepare stmt create", "error", err) + return false, err + } + defer stmt.Close() + _, err = stmt.ExecContext(ctx, user.TGB_ID, user.Username, user.FirstName, user.LastName) + if err != nil { + u.log.Error("exec context create", "error", err) + return false, err + } + return true, nil + +} +func (u User) Edit(ctx context.Context, user domain.User) (bool, error) { + stmt, err := u.db.PrepareContext(ctx, + ` +UPDATE users + SET username = ?, + first_name = ?, + last_name = ?, + edited = strftime('%s', 'now') + WHERE + tgb_id = ? AND deleted IS NULL; +`) + if err != nil { + u.log.Error("prepare stmt edit", "error", err) + return false, err + } + defer stmt.Close() + row, err := stmt.ExecContext(ctx, user.Username, user.FirstName, user.LastName, user.TGB_ID) + if err != nil { + u.log.Error("exec context edit", "error", err) + return false, nil + } + + num, _ := row.RowsAffected() + if num < 1 { + return false, fmt.Errorf("no rows affected with tgb_id: %d", user.TGB_ID) + } + return true, nil + +} +func (u User) Delete(ctx context.Context, tgb_id int64) (bool, error) { + stmt, err := u.db.PrepareContext(ctx, ` +UPDATE users +SET deleted = strftime('%s', 'now'), +edited = strftime('%s', 'now') +WHERE tgb_id = ?; +`) + if err != nil { + u.log.Error("prepare stmt delete", "error", err) + return false, err + } + defer stmt.Close() + _, err = stmt.ExecContext(ctx, tgb_id) + if err != nil { + u.log.Error("exec context delete", "error", err) + return false, err + } + return true, nil +} + +func (u User) HardDelete(ctx context.Context, tgb_id int64) (bool, error) { + stmt, err := u.db.PrepareContext(ctx, ` +DELETE FROM users +WHERE tgb_id = ?; +`) + if err != nil { + u.log.Error("prepare stmt hard delete", "error", err) + return false, err + } + defer stmt.Close() + _, err = stmt.ExecContext(ctx, tgb_id) + if err != nil { + u.log.Error("exec context hard delete", "error", err) + return false, err + } + return true, nil +} +func (u User) AddBot(ctx context.Context, tgb_id int64, bot_name string) (bool, error) { + bu := BotUser{db: u.db} + ok, err := bu.Add(ctx, tgb_id, bot_name) + return ok, err +} +func (u User) DeleteBot(ctx context.Context, tgb_id int64, bot_name string) (bool, error) { + bu := BotUser{db: u.db} + ok, err := bu.Delete(ctx, tgb_id, bot_name) + return ok, err +} diff --git a/internal/adapters/db/visits.go b/internal/adapters/db/visits.go new file mode 100644 index 0000000..8cb7397 --- /dev/null +++ b/internal/adapters/db/visits.go @@ -0,0 +1,56 @@ +package db + +import ( + "context" + "database/sql" + "log/slog" +) + +type Visit struct { + db *sql.DB + log *slog.Logger + ID int64 `json:"id"` + Tgb_ID int64 `json:"tgb_id"` + Quantity int `json:"quantity"` + Edited int64 `json:"edited"` +} + +func NewVisits(db *sql.DB, log *slog.Logger) *Visit { + log = log.With("obj", "Visits") + return &Visit{db: db, log: log} +} + +func (v Visit) Add(ctx context.Context, tgb_id int64) (bool, error) { + stmt, err := v.db.PrepareContext(ctx, + ` +UPDATE visits + SET quantity = quantity + 1, + edited = strftime('%s','now') + WHERE tgb_id = ?;`) + if err != nil { + v.log.Error("prepare stmt", "error", err) + return false, err + } + defer stmt.Close() + _, err = stmt.ExecContext(ctx, tgb_id) + if err != nil { + v.log.Error("exec content", "error", err) + return false, err + } + return true, nil +} +func (v Visit) Get(ctx context.Context, tgb_id int64) (*Visit, error) { + stmt, err := v.db.PrepareContext(ctx, "SELECT id, tgb_id, quantity, edited FROM visits WHERE tgb_id = ?;") + if err != nil { + v.log.Error("prepare stmt", "error", err) + return nil, err + } + defer stmt.Close() + vi := &Visit{} + if err := stmt.QueryRowContext(ctx, tgb_id).Scan(&v.ID, &v.Tgb_ID, &v.Quantity, &v.Edited); err != nil { + v.log.Error("Query row", "error", err) + return nil, err + } + + return vi, nil +} diff --git a/internal/adapters/grpc/grpc.go b/internal/adapters/grpc/grpc.go new file mode 100644 index 0000000..ae2532e --- /dev/null +++ b/internal/adapters/grpc/grpc.go @@ -0,0 +1,223 @@ +package grpc + +import ( + "context" + + "git.maximotejeda.com/maximo/tgb-user/proto/golang/tgbuser" + "git.maximotejeda.com/maximo/tgb-user/internal/application/core/domain" +) + +// TODO: Methods to map to api <-> grpc + +func (a Adapter) Create(ctx context.Context, req *tgbuser.CreateTGBUserRequest) (*tgbuser.CreateTGBUserResponse, error) { + // TODO db work + user := &domain.User{ + ID: req.User.Id, + TGB_ID: req.User.TgbId, + Username: req.User.Username, + FirstName: req.User.FirstName, + LastName: req.User.LastName, + TGBOT: req.User.TgBot, + } + _, err := a.api.Create(ctx, user) + if err != nil { + return nil, err + } + return &tgbuser.CreateTGBUserResponse{Id: req.User.Id}, nil +} +func (a Adapter) Get(ctx context.Context, req *tgbuser.GetTGBUserRequest) (*tgbuser.GetTGBUserResponse, error) { + // TODO db work + user, err := a.api.Get(ctx, req.TgbId) + if err != nil { + return nil, err + } + + us := &tgbuser.User{ + Id: user.ID, + TgbId: user.TGB_ID, + Username: user.Username, + FirstName: user.FirstName, + LastName: user.LastName, + TgBot: user.TGBOT, + Created: user.Created, + Edited: user.Edited, + } + return &tgbuser.GetTGBUserResponse{User: us}, err +} +func (a Adapter) Edit(ctx context.Context, req *tgbuser.EditTGBUserRequest) (*tgbuser.EditTGBUserResponse, error) { + // TODO db work + user := &domain.User{ + ID: req.User.Id, + TGB_ID: req.User.TgbId, + Username: req.User.Username, + FirstName: req.User.FirstName, + LastName: req.User.LastName, + TGBOT: req.User.TgBot, + } + + ok, err := a.api.Edit(ctx, user) + if err != nil { + return nil, err + } + return &tgbuser.EditTGBUserResponse{Response: ok}, nil +} +func (a Adapter) Delete(ctx context.Context, req *tgbuser.DeleteTGBUserRequest) (*tgbuser.DeleteTGBUserResponse, error) { + ok, err := a.api.Delete(ctx, req.TgbId) + // TODO db work + return &tgbuser.DeleteTGBUserResponse{Response: ok}, err +} +func (a Adapter) AddBot(ctx context.Context, req *tgbuser.AddBotTGBUserRequest) (*tgbuser.AddBotTGBUserResponse, error) { + // TODO db work + ok, err := a.api.AddBot(ctx, req.TgbId, req.BotName) + return &tgbuser.AddBotTGBUserResponse{Response: ok}, err +} +func (a Adapter) DeleteBot(ctx context.Context, req *tgbuser.DeleteBotTGBUserRequest) (*tgbuser.DeleteBotTGBUserResponse, error) { + // TODO db work + ok, err := a.api.DeleteBot(ctx, req.TgbId, req.BotName) + return &tgbuser.DeleteBotTGBUserResponse{Response: ok}, err +} + +func (a Adapter) GetBots(ctx context.Context, req *tgbuser.GetBotsTGBUserRequest) (*tgbuser.GetBotsTGBUserResponse, error) { + bl, err := a.api.GetBots(ctx, req.TgbId) + if err != nil { + return nil, err + } + botList := []*tgbuser.Bot{} + for _, v := range bl { + b := &tgbuser.Bot{ + Id: v.ID, + BotName: v.BotName, + Created: v.Created, + } + botList = append(botList, b) + } + return &tgbuser.GetBotsTGBUserResponse{Bots: botList}, nil +} + +func (a Adapter) GetAllBotsUsers(ctx context.Context, req *tgbuser.GetAllBotsUsersRequest) (*tgbuser.GetAllBotsUsersResponse, error) { + users, err := a.api.GetAllBotsUsers(ctx, req.BotName) + if err != nil { + return nil, err + } + userList := []*tgbuser.User{} + for _, v := range users { + user := &tgbuser.User{ + Id: v.ID, + TgbId: v.TGB_ID, + Username: v.Username, + FirstName: v.FirstName, + LastName: v.LastName, + Created: v.Created, + Edited: v.Edited, + } + userList = append(userList, user) + } + return &tgbuser.GetAllBotsUsersResponse{Users: userList}, err +} + +func (a Adapter) GetAllBots(ctx context.Context, req *tgbuser.GetAllBotsRequest) (*tgbuser.GetAllBotsResponse, error) { + bots, err := a.api.GetAllBots(ctx) + if err != nil { + return nil, err + } + botList := []*tgbuser.Bot{} + for _, v := range bots { + bot := &tgbuser.Bot{ + Id: v.ID, + BotName: v.BotName, + Created: v.Created, + } + botList = append(botList, bot) + } + return &tgbuser.GetAllBotsResponse{Bots: botList}, nil +} + +func (a Adapter) CreateBot(ctx context.Context, req *tgbuser.TGBBotNameRequest) (*tgbuser.TGBGenericResponse, error) { + ok, err := a.api.CreateBot(ctx, req.BotName) + return &tgbuser.TGBGenericResponse{Response: ok}, err +} +func (a Adapter) CreateAccessRequest(ctx context.Context, req *tgbuser.TGBUserBotNameRequest) (*tgbuser.TGBGenericResponse, error) { + ok, err := a.api.CreateAccessRequest(ctx, req.TgbId, req.BotName) + return &tgbuser.TGBGenericResponse{Response: ok}, err +} +func (a Adapter) GrantAccess(ctx context.Context, req *tgbuser.TGBUserBotNameRequest) (*tgbuser.TGBGenericResponse, error) { + ok, err := a.api.GrantAccess(ctx, req.TgbId, req.BotName) + return &tgbuser.TGBGenericResponse{Response: ok}, err +} +func (a Adapter) BanUser(ctx context.Context, req *tgbuser.TGBBanUserRequest) (*tgbuser.TGBGenericResponse, error) { + + ok, err := a.api.BanUser(ctx, req.TgbId, req.Until, req.BotName) + return &tgbuser.TGBGenericResponse{Response: ok}, err +} +func (a Adapter) UnBanUser(ctx context.Context, req *tgbuser.TGBUserBotNameRequest) (*tgbuser.TGBGenericResponse, error) { + + ok, err := a.api.UnBanUser(ctx, req.TgbId, req.BotName) + return &tgbuser.TGBGenericResponse{Response: ok}, err +} +func (a Adapter) GetAllAccessRequest(ctx context.Context, req *tgbuser.TGBBotNameRequest) (*tgbuser.GetAccessResponse, error) { + ar, err := a.api.GetAllAccessRequest(ctx, req.BotName) + if err != nil { + return nil, err + } + tgbARL := []*tgbuser.AccessRq{} + for _, it := range ar { + tgbAr := &tgbuser.AccessRq{ + TgbId: it.TgbID, + BotName: it.BotName, + Created: it.Created, + } + tgbARL = append(tgbARL, tgbAr) + } + return &tgbuser.GetAccessResponse{Access: tgbARL}, err +} +func (a Adapter) GetAllBannedUsers(ctx context.Context, req *tgbuser.TGBBotNameRequest) (*tgbuser.GetBanResponse, error) { + br, err := a.api.GetAllBannedUsers(ctx, req.BotName) + if err != nil { + return nil, err + } + brL := []*tgbuser.Ban{} + for _, it := range br { + b := &tgbuser.Ban{ + TgbId: it.TgbID, + BotName: it.BotName, + Until: it.Until, + Created: it.Created, + } + brL = append(brL, b) + } + return &tgbuser.GetBanResponse{Bans: brL}, err +} + +func (a Adapter) GetBannedBot(ctx context.Context, req *tgbuser.TGBUserRequest) (*tgbuser.GetBanResponse, error) { + br, err := a.api.GetBannedBot(ctx, req.TgbId) + if err != nil { + return nil, err + } + brL := []*tgbuser.Ban{} + for _, it := range br { + b := &tgbuser.Ban{ + TgbId: it.TgbID, + BotName: it.BotName, + Until: it.Until, + Created: it.Created, + } + brL = append(brL, b) + } + return &tgbuser.GetBanResponse{Bans: brL}, err +} +func (a Adapter) GetAccessRequest(ctx context.Context, req *tgbuser.TGBUserRequest) (*tgbuser.GetAccessResponse, error) { + ar, err := a.api.GetAccessRequest(ctx, req.TgbId) + if err != nil { + return nil, err + } + tgbARL := []*tgbuser.AccessRq{} + for _, it := range ar { + tgbAr := &tgbuser.AccessRq{ + TgbId: it.TgbID, + BotName: it.BotName, + Created: it.Created, + } + tgbARL = append(tgbARL, tgbAr) + } + return &tgbuser.GetAccessResponse{Access: tgbARL}, err +} diff --git a/internal/adapters/grpc/server.go b/internal/adapters/grpc/server.go new file mode 100644 index 0000000..32234ad --- /dev/null +++ b/internal/adapters/grpc/server.go @@ -0,0 +1,48 @@ +package grpc + +import ( + "fmt" + "log/slog" + "net" + + "git.maximotejeda.com/maximo/tgb-user/config" + "git.maximotejeda.com/maximo/tgb-user/internal/ports" + "git.maximotejeda.com/maximo/tgb-user/proto/golang/tgbuser" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +type Adapter struct { + api ports.APIPort + port int + log *slog.Logger + tgbuser.UnimplementedUserManagerServer + +} + +func NewAdapter(api ports.APIPort, port int) *Adapter { + log := slog.Default() + log = log.With("adapter", "dolar-grpc") + return &Adapter{api: api, port: port, log: log} +} + +func (a Adapter) Run() { + var err error + + listen, err := net.Listen("tcp", fmt.Sprintf(":%d", a.port)) + if err != nil { + a.log.Error("failed to listen", "port", a.port, "error", err) + panic(err) + } + grpcServer := grpc.NewServer() + + tgbuser.RegisterUserManagerServer(grpcServer, a) + + if config.GetEnv() == "development" { + // This is to use GRPCurl to test services + reflection.Register(grpcServer) + } + if err := grpcServer.Serve(listen); err != nil { + a.log.Error("failed to serve grpc on port", "port", a.port) + } +} diff --git a/internal/application/core/api/api.go b/internal/application/core/api/api.go new file mode 100644 index 0000000..cc6c101 --- /dev/null +++ b/internal/application/core/api/api.go @@ -0,0 +1,94 @@ +package api + +import ( + "context" + "log/slog" + + "git.maximotejeda.com/maximo/tgb-user/internal/adapters/db" + "git.maximotejeda.com/maximo/tgb-user/internal/application/core/domain" + "git.maximotejeda.com/maximo/tgb-user/internal/ports" +) + +type Application struct { + db ports.DBPort + log *slog.Logger +} + +func NewApplication(db ports.DBPort) *Application { + log := slog.Default() + log = log.With("adapter", "application") + return &Application{ + db: db, + log: log, + } +} + +// todo Export differents Methods to map to grpc contracts +func (a Application) Create(ctx context.Context, user *domain.User) (bool, error) { + ok, err := a.db.Create(ctx, user) + return ok, err +} +func (a Application) Get(ctx context.Context, tgb_id int64) (*domain.User, error) { + user, err := a.db.Get(ctx, tgb_id) + return user, err +} +func (a Application) Edit(ctx context.Context, user *domain.User) (bool, error) { + ok, err := a.db.Edit(ctx, user) + if err != nil { + return false, err + } + return ok, err +} +func (a Application) Delete(ctx context.Context, id int64) (bool, error) { + ok, err := a.db.Delete(ctx, id) + return ok, err +} +func (a Application) AddBot(ctx context.Context, tgb_id int64, botname string) (bool, error) { + ok, err := a.db.AddBot(ctx, tgb_id, botname) + return ok, err +} + +func (a Application) DeleteBot(ctx context.Context, tgb_id int64, botname string) (bool, error) { + ok, err := a.db.DeleteBot(ctx, tgb_id, botname) + return ok, err +} + +func (a Application) GetBots(ctx context.Context, tgb_id int64) ([]*domain.Bot, error) { + return a.db.GetBots(ctx, tgb_id) +} + +func (a Application) GetAllBotsUsers(ctx context.Context, bot_name string) ([]*domain.User, error) { + return a.db.GetAllBotUsers(ctx, bot_name) +} +func (a Application) GetAllBots(ctx context.Context) ([]*domain.Bot, error) { + return a.db.GetAllBots(ctx) +} + +func (a Application) CreateBot(ctx context.Context, botName string) (bool, error) { + return a.db.CreateBot(ctx, botName) +} +func (a Application) CreateAccessRequest(ctx context.Context, tgbID int64, botName string) (bool, error) { + return a.db.CreateAccessRequest(ctx, tgbID, botName) +} +func (a Application) GrantAccess(ctx context.Context, tgbID int64, botName string) (bool, error) { + return a.db.GrantAccess(ctx, tgbID, botName) +} +func (a Application) BanUser(ctx context.Context, tgbID, until int64, botName string) (bool, error) { + return a.db.BanUser(ctx, tgbID, until, botName) +} +func (a Application) UnBanUser(ctx context.Context, tgbID int64, botName string) (bool, error) { + return a.db.UnBanUser(ctx, tgbID, botName) +} + +func (a Application) GetAllAccessRequest(ctx context.Context, botName string) ([]*db.BotAccessRequest, error) { + return a.db.GetAllAccessRequest(ctx, botName) +} +func (a Application) GetAllBannedUsers(ctx context.Context, botName string) ([]*db.BotBannedAccess, error) { + return a.db.GetAllBannedUsers(ctx, botName) +} +func (a Application) GetAccessRequest(ctx context.Context, tgbID int64) ([]*db.BotAccessRequest, error) { + return a.db.GetAccessRequest(ctx, tgbID) +} +func (a Application) GetBannedBot(ctx context.Context, tgbID int64) ([]*db.BotBannedAccess, error) { + return a.db.GetBannedBot(ctx, tgbID) +} diff --git a/internal/application/core/domain/bot.go b/internal/application/core/domain/bot.go new file mode 100644 index 0000000..d2ca6e2 --- /dev/null +++ b/internal/application/core/domain/bot.go @@ -0,0 +1,7 @@ +package domain + +type Bot struct { + ID int64 `json:"id"` + BotName string `json:"bot_name"` + Created int64 `json:"created"` +} diff --git a/internal/application/core/domain/domain.go b/internal/application/core/domain/domain.go new file mode 100644 index 0000000..4188b5a --- /dev/null +++ b/internal/application/core/domain/domain.go @@ -0,0 +1 @@ +package domain diff --git a/internal/application/core/domain/user.go b/internal/application/core/domain/user.go new file mode 100644 index 0000000..9cba161 --- /dev/null +++ b/internal/application/core/domain/user.go @@ -0,0 +1,13 @@ +package domain + +type User struct { + ID int64 `json:"id"` + TGB_ID int64 `json:"tgb_id"` + Username string `json:"username"` + FirstName string `json:"first_name"` + LastName string `json:"last_name"` + TGBOT string `json:"tg_bot"` + Created int64 `json:"created"` + Edited int64 `json:"edited"` + Deleted int64 `json:"deleted"` +} diff --git a/internal/ports/api.go b/internal/ports/api.go new file mode 100644 index 0000000..daaee05 --- /dev/null +++ b/internal/ports/api.go @@ -0,0 +1,29 @@ +package ports + +import ( + "context" + + "git.maximotejeda.com/maximo/tgb-user/internal/adapters/db" + "git.maximotejeda.com/maximo/tgb-user/internal/application/core/domain" +) + +type APIPort interface { + Create(context.Context, *domain.User) (bool, error) + Get(context.Context, int64) (*domain.User, error) + Edit(context.Context, *domain.User) (bool, error) + Delete(context.Context, int64) (bool, error) + AddBot(context.Context, int64, string) (bool, error) + DeleteBot(context.Context, int64, string) (bool, error) + GetBots(context.Context, int64) ([]*domain.Bot, error) + GetAllBotsUsers(context.Context, string) ([]*domain.User, error) + GetAllBots(context.Context) ([]*domain.Bot, error) + CreateBot(context.Context, string) (bool, error) + CreateAccessRequest(context.Context, int64, string) (bool, error) + GrantAccess(context.Context, int64, string) (bool, error) + BanUser(context.Context, int64, int64, string) (bool, error) + UnBanUser(context.Context, int64, string) (bool, error) + GetAllAccessRequest(context.Context, string) ([]*db.BotAccessRequest, error) + GetAllBannedUsers(context.Context, string) ([]*db.BotBannedAccess, error) + GetAccessRequest(context.Context, int64) ([]*db.BotAccessRequest, error) + GetBannedBot(context.Context, int64) ([]*db.BotBannedAccess, error) +} diff --git a/internal/ports/db.go b/internal/ports/db.go new file mode 100644 index 0000000..a3bdec6 --- /dev/null +++ b/internal/ports/db.go @@ -0,0 +1,29 @@ +package ports + +import ( + "context" + + "git.maximotejeda.com/maximo/tgb-user/internal/adapters/db" + "git.maximotejeda.com/maximo/tgb-user/internal/application/core/domain" +) + +type DBPort interface { + Create(context.Context, *domain.User) (bool, error) + Get(context.Context, int64) (*domain.User, error) + Edit(context.Context, *domain.User) (bool, error) + Delete(context.Context, int64) (bool, error) + AddBot(context.Context, int64, string) (bool, error) + DeleteBot(context.Context, int64, string) (bool, error) + GetBots(context.Context, int64) ([]*domain.Bot, error) + GetAllBotUsers(context.Context, string) ([]*domain.User, error) + GetAllBots(context.Context) ([]*domain.Bot, error) + CreateBot(context.Context, string) (bool, error) + CreateAccessRequest(context.Context, int64, string) (bool, error) + GrantAccess(context.Context, int64, string) (bool, error) + BanUser(context.Context, int64, int64, string) (bool, error) + UnBanUser(context.Context, int64, string) (bool, error) + GetAllAccessRequest(context.Context, string) ([]*db.BotAccessRequest, error) + GetAllBannedUsers(context.Context, string) ([]*db.BotBannedAccess, error) + GetAccessRequest(context.Context, int64) ([]*db.BotAccessRequest, error) + GetBannedBot(context.Context, int64) ([]*db.BotBannedAccess, error) +} diff --git a/k8s/deployment.yml b/k8s/deployment.yml new file mode 100644 index 0000000..5b55d48 --- /dev/null +++ b/k8s/deployment.yml @@ -0,0 +1,62 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tgbuser-grpc + labels: + app: tgbuser-grpc +spec: + replicas: 2 + selector: + matchLabels: + app: tgbuser-grpc + template: + metadata: + labels: + app: tgbuser-grpc + name: tgbuser-grpc + spec: + containers: + - name: tgbuser-grpc + image: localhost:32000/tgbuser-grpc:latest + env: + - name: ENV + value: "production" + - name: NATS_SERVICE_URL + value: "nats://nats-svc:4222" + - name: DATA_SOURCE_URL + value: "tgbdb/data.db" + - name: APPLICATION_PORT + value: "8080" + volumeMounts: + - name: db + mountPath: "/app/tgbdb" + volumes: + - name: db + persistentVolumeClaim: + claimName: tgbuser-grpc-pvc + +--- + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: tgbuser-grpc-pvc + spec: + storageClassName: nfs-csi + accessModes: [ReadWriteMany] + resources: + requests: + storage: 30Mi +--- +apiVersion: v1 +kind: Service +metadata: + name: tgbuser-grpc-svc +spec: + selector: + app: tgbuser-grpc + ports: + - port: 80 + protocol: TCP + targetPort: 8080 + name: grpc + type: LoadBalancer \ No newline at end of file diff --git a/k8s/deployment.yml.template b/k8s/deployment.yml.template new file mode 100644 index 0000000..3c81b18 --- /dev/null +++ b/k8s/deployment.yml.template @@ -0,0 +1,62 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: $REPONAME + labels: + app: $REPONAME +spec: + replicas: 2 + selector: + matchLabels: + app: $REPONAME + template: + metadata: + labels: + app: $REPONAME + name: $REPONAME + spec: + containers: + - name: $REPONAME + image: $IMAGE + env: + - name: ENV + value: "$ENVIRONMET" + - name: NATS_SERVICE_URL + value: "$NATS_SERVICE_URL" + - name: DATA_SOURCE_URL + value: "$DATA_SOURCE_URL" + - name: APPLICATION_PORT + value: "$APPLICATION_PORT" + volumeMounts: + - name: db + mountPath: "$DATA_SOURCE_URL" + volumes: + - name: db + persistentVolumeClaim: + claimName: $REPONAME-pvc + +--- + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: $REPONAME-pvc + spec: + storageClassName: nfs-csi + accessModes: [ReadWriteMany] + resources: + requests: + storage: 1Gi +--- +apiVersion: v1 +kind: Service +metadata: + name: $REPONAME-svc +spec: + selector: + app: $REPONAME + ports: + - port: 80 + protocol: TCP + targetPort: $APPLICATION_PORT + name: grpc + type: LoadBalancer diff --git a/proto/golang/tgbuser/tgbuser.pb.go b/proto/golang/tgbuser/tgbuser.pb.go new file mode 100644 index 0000000..4b175f8 --- /dev/null +++ b/proto/golang/tgbuser/tgbuser.pb.go @@ -0,0 +1,2200 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.33.0 +// protoc v4.25.1 +// source: tgbuser/tgbuser.proto + +package tgbuser + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type User struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + TgbId int64 `protobuf:"varint,2,opt,name=tgb_id,json=tgbId,proto3" json:"tgb_id,omitempty"` + Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"` + FirstName string `protobuf:"bytes,4,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"` + LastName string `protobuf:"bytes,5,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"` + TgBot string `protobuf:"bytes,6,opt,name=tg_bot,json=tgBot,proto3" json:"tg_bot,omitempty"` + Created int64 `protobuf:"varint,7,opt,name=created,proto3" json:"created,omitempty"` + Edited int64 `protobuf:"varint,8,opt,name=edited,proto3" json:"edited,omitempty"` + Deleted int64 `protobuf:"varint,9,opt,name=deleted,proto3" json:"deleted,omitempty"` +} + +func (x *User) Reset() { + *x = User{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *User) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*User) ProtoMessage() {} + +func (x *User) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use User.ProtoReflect.Descriptor instead. +func (*User) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{0} +} + +func (x *User) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *User) GetTgbId() int64 { + if x != nil { + return x.TgbId + } + return 0 +} + +func (x *User) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *User) GetFirstName() string { + if x != nil { + return x.FirstName + } + return "" +} + +func (x *User) GetLastName() string { + if x != nil { + return x.LastName + } + return "" +} + +func (x *User) GetTgBot() string { + if x != nil { + return x.TgBot + } + return "" +} + +func (x *User) GetCreated() int64 { + if x != nil { + return x.Created + } + return 0 +} + +func (x *User) GetEdited() int64 { + if x != nil { + return x.Edited + } + return 0 +} + +func (x *User) GetDeleted() int64 { + if x != nil { + return x.Deleted + } + return 0 +} + +type Bot struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + BotName string `protobuf:"bytes,2,opt,name=bot_name,json=botName,proto3" json:"bot_name,omitempty"` + Created int64 `protobuf:"varint,3,opt,name=created,proto3" json:"created,omitempty"` +} + +func (x *Bot) Reset() { + *x = Bot{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Bot) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Bot) ProtoMessage() {} + +func (x *Bot) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Bot.ProtoReflect.Descriptor instead. +func (*Bot) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{1} +} + +func (x *Bot) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Bot) GetBotName() string { + if x != nil { + return x.BotName + } + return "" +} + +func (x *Bot) GetCreated() int64 { + if x != nil { + return x.Created + } + return 0 +} + +type Ban struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TgbId int64 `protobuf:"varint,1,opt,name=tgb_id,json=tgbId,proto3" json:"tgb_id,omitempty"` + BotName string `protobuf:"bytes,2,opt,name=bot_name,json=botName,proto3" json:"bot_name,omitempty"` + Until int64 `protobuf:"varint,3,opt,name=until,proto3" json:"until,omitempty"` + Created int64 `protobuf:"varint,4,opt,name=created,proto3" json:"created,omitempty"` +} + +func (x *Ban) Reset() { + *x = Ban{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Ban) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Ban) ProtoMessage() {} + +func (x *Ban) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Ban.ProtoReflect.Descriptor instead. +func (*Ban) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{2} +} + +func (x *Ban) GetTgbId() int64 { + if x != nil { + return x.TgbId + } + return 0 +} + +func (x *Ban) GetBotName() string { + if x != nil { + return x.BotName + } + return "" +} + +func (x *Ban) GetUntil() int64 { + if x != nil { + return x.Until + } + return 0 +} + +func (x *Ban) GetCreated() int64 { + if x != nil { + return x.Created + } + return 0 +} + +type AccessRq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TgbId int64 `protobuf:"varint,1,opt,name=tgb_id,json=tgbId,proto3" json:"tgb_id,omitempty"` + BotName string `protobuf:"bytes,2,opt,name=bot_name,json=botName,proto3" json:"bot_name,omitempty"` + Created int64 `protobuf:"varint,3,opt,name=created,proto3" json:"created,omitempty"` +} + +func (x *AccessRq) Reset() { + *x = AccessRq{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AccessRq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AccessRq) ProtoMessage() {} + +func (x *AccessRq) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AccessRq.ProtoReflect.Descriptor instead. +func (*AccessRq) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{3} +} + +func (x *AccessRq) GetTgbId() int64 { + if x != nil { + return x.TgbId + } + return 0 +} + +func (x *AccessRq) GetBotName() string { + if x != nil { + return x.BotName + } + return "" +} + +func (x *AccessRq) GetCreated() int64 { + if x != nil { + return x.Created + } + return 0 +} + +type GetTGBUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TgbId int64 `protobuf:"varint,1,opt,name=tgb_id,json=tgbId,proto3" json:"tgb_id,omitempty"` +} + +func (x *GetTGBUserRequest) Reset() { + *x = GetTGBUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetTGBUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTGBUserRequest) ProtoMessage() {} + +func (x *GetTGBUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTGBUserRequest.ProtoReflect.Descriptor instead. +func (*GetTGBUserRequest) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{4} +} + +func (x *GetTGBUserRequest) GetTgbId() int64 { + if x != nil { + return x.TgbId + } + return 0 +} + +type GetTGBUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *GetTGBUserResponse) Reset() { + *x = GetTGBUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetTGBUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTGBUserResponse) ProtoMessage() {} + +func (x *GetTGBUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTGBUserResponse.ProtoReflect.Descriptor instead. +func (*GetTGBUserResponse) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{5} +} + +func (x *GetTGBUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type CreateTGBUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *CreateTGBUserRequest) Reset() { + *x = CreateTGBUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateTGBUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateTGBUserRequest) ProtoMessage() {} + +func (x *CreateTGBUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateTGBUserRequest.ProtoReflect.Descriptor instead. +func (*CreateTGBUserRequest) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{6} +} + +func (x *CreateTGBUserRequest) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type CreateTGBUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *CreateTGBUserResponse) Reset() { + *x = CreateTGBUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateTGBUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateTGBUserResponse) ProtoMessage() {} + +func (x *CreateTGBUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateTGBUserResponse.ProtoReflect.Descriptor instead. +func (*CreateTGBUserResponse) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{7} +} + +func (x *CreateTGBUserResponse) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +type EditTGBUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *EditTGBUserRequest) Reset() { + *x = EditTGBUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EditTGBUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EditTGBUserRequest) ProtoMessage() {} + +func (x *EditTGBUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EditTGBUserRequest.ProtoReflect.Descriptor instead. +func (*EditTGBUserRequest) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{8} +} + +func (x *EditTGBUserRequest) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type EditTGBUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Response bool `protobuf:"varint,1,opt,name=response,proto3" json:"response,omitempty"` +} + +func (x *EditTGBUserResponse) Reset() { + *x = EditTGBUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EditTGBUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EditTGBUserResponse) ProtoMessage() {} + +func (x *EditTGBUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EditTGBUserResponse.ProtoReflect.Descriptor instead. +func (*EditTGBUserResponse) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{9} +} + +func (x *EditTGBUserResponse) GetResponse() bool { + if x != nil { + return x.Response + } + return false +} + +type DeleteTGBUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TgbId int64 `protobuf:"varint,1,opt,name=tgb_id,json=tgbId,proto3" json:"tgb_id,omitempty"` +} + +func (x *DeleteTGBUserRequest) Reset() { + *x = DeleteTGBUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteTGBUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteTGBUserRequest) ProtoMessage() {} + +func (x *DeleteTGBUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteTGBUserRequest.ProtoReflect.Descriptor instead. +func (*DeleteTGBUserRequest) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{10} +} + +func (x *DeleteTGBUserRequest) GetTgbId() int64 { + if x != nil { + return x.TgbId + } + return 0 +} + +type DeleteTGBUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Response bool `protobuf:"varint,1,opt,name=response,proto3" json:"response,omitempty"` +} + +func (x *DeleteTGBUserResponse) Reset() { + *x = DeleteTGBUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteTGBUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteTGBUserResponse) ProtoMessage() {} + +func (x *DeleteTGBUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteTGBUserResponse.ProtoReflect.Descriptor instead. +func (*DeleteTGBUserResponse) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{11} +} + +func (x *DeleteTGBUserResponse) GetResponse() bool { + if x != nil { + return x.Response + } + return false +} + +type AddBotTGBUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TgbId int64 `protobuf:"varint,1,opt,name=tgb_id,json=tgbId,proto3" json:"tgb_id,omitempty"` + BotName string `protobuf:"bytes,2,opt,name=bot_name,json=botName,proto3" json:"bot_name,omitempty"` +} + +func (x *AddBotTGBUserRequest) Reset() { + *x = AddBotTGBUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddBotTGBUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddBotTGBUserRequest) ProtoMessage() {} + +func (x *AddBotTGBUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddBotTGBUserRequest.ProtoReflect.Descriptor instead. +func (*AddBotTGBUserRequest) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{12} +} + +func (x *AddBotTGBUserRequest) GetTgbId() int64 { + if x != nil { + return x.TgbId + } + return 0 +} + +func (x *AddBotTGBUserRequest) GetBotName() string { + if x != nil { + return x.BotName + } + return "" +} + +type AddBotTGBUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Response bool `protobuf:"varint,1,opt,name=response,proto3" json:"response,omitempty"` +} + +func (x *AddBotTGBUserResponse) Reset() { + *x = AddBotTGBUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddBotTGBUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddBotTGBUserResponse) ProtoMessage() {} + +func (x *AddBotTGBUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddBotTGBUserResponse.ProtoReflect.Descriptor instead. +func (*AddBotTGBUserResponse) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{13} +} + +func (x *AddBotTGBUserResponse) GetResponse() bool { + if x != nil { + return x.Response + } + return false +} + +type DeleteBotTGBUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TgbId int64 `protobuf:"varint,1,opt,name=tgb_id,json=tgbId,proto3" json:"tgb_id,omitempty"` + BotName string `protobuf:"bytes,2,opt,name=bot_name,json=botName,proto3" json:"bot_name,omitempty"` +} + +func (x *DeleteBotTGBUserRequest) Reset() { + *x = DeleteBotTGBUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteBotTGBUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteBotTGBUserRequest) ProtoMessage() {} + +func (x *DeleteBotTGBUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteBotTGBUserRequest.ProtoReflect.Descriptor instead. +func (*DeleteBotTGBUserRequest) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{14} +} + +func (x *DeleteBotTGBUserRequest) GetTgbId() int64 { + if x != nil { + return x.TgbId + } + return 0 +} + +func (x *DeleteBotTGBUserRequest) GetBotName() string { + if x != nil { + return x.BotName + } + return "" +} + +type DeleteBotTGBUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Response bool `protobuf:"varint,1,opt,name=response,proto3" json:"response,omitempty"` +} + +func (x *DeleteBotTGBUserResponse) Reset() { + *x = DeleteBotTGBUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteBotTGBUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteBotTGBUserResponse) ProtoMessage() {} + +func (x *DeleteBotTGBUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteBotTGBUserResponse.ProtoReflect.Descriptor instead. +func (*DeleteBotTGBUserResponse) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{15} +} + +func (x *DeleteBotTGBUserResponse) GetResponse() bool { + if x != nil { + return x.Response + } + return false +} + +type GetBotsTGBUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TgbId int64 `protobuf:"varint,1,opt,name=tgb_id,json=tgbId,proto3" json:"tgb_id,omitempty"` +} + +func (x *GetBotsTGBUserRequest) Reset() { + *x = GetBotsTGBUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetBotsTGBUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBotsTGBUserRequest) ProtoMessage() {} + +func (x *GetBotsTGBUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBotsTGBUserRequest.ProtoReflect.Descriptor instead. +func (*GetBotsTGBUserRequest) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{16} +} + +func (x *GetBotsTGBUserRequest) GetTgbId() int64 { + if x != nil { + return x.TgbId + } + return 0 +} + +type GetBotsTGBUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Bots []*Bot `protobuf:"bytes,1,rep,name=bots,proto3" json:"bots,omitempty"` +} + +func (x *GetBotsTGBUserResponse) Reset() { + *x = GetBotsTGBUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetBotsTGBUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBotsTGBUserResponse) ProtoMessage() {} + +func (x *GetBotsTGBUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBotsTGBUserResponse.ProtoReflect.Descriptor instead. +func (*GetBotsTGBUserResponse) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{17} +} + +func (x *GetBotsTGBUserResponse) GetBots() []*Bot { + if x != nil { + return x.Bots + } + return nil +} + +type GetAllBotsUsersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BotName string `protobuf:"bytes,1,opt,name=bot_name,json=botName,proto3" json:"bot_name,omitempty"` +} + +func (x *GetAllBotsUsersRequest) Reset() { + *x = GetAllBotsUsersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAllBotsUsersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllBotsUsersRequest) ProtoMessage() {} + +func (x *GetAllBotsUsersRequest) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllBotsUsersRequest.ProtoReflect.Descriptor instead. +func (*GetAllBotsUsersRequest) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{18} +} + +func (x *GetAllBotsUsersRequest) GetBotName() string { + if x != nil { + return x.BotName + } + return "" +} + +type GetAllBotsUsersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` +} + +func (x *GetAllBotsUsersResponse) Reset() { + *x = GetAllBotsUsersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAllBotsUsersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllBotsUsersResponse) ProtoMessage() {} + +func (x *GetAllBotsUsersResponse) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllBotsUsersResponse.ProtoReflect.Descriptor instead. +func (*GetAllBotsUsersResponse) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{19} +} + +func (x *GetAllBotsUsersResponse) GetUsers() []*User { + if x != nil { + return x.Users + } + return nil +} + +type GetAllBotsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetAllBotsRequest) Reset() { + *x = GetAllBotsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAllBotsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllBotsRequest) ProtoMessage() {} + +func (x *GetAllBotsRequest) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllBotsRequest.ProtoReflect.Descriptor instead. +func (*GetAllBotsRequest) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{20} +} + +type GetAllBotsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Bots []*Bot `protobuf:"bytes,1,rep,name=bots,proto3" json:"bots,omitempty"` +} + +func (x *GetAllBotsResponse) Reset() { + *x = GetAllBotsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAllBotsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllBotsResponse) ProtoMessage() {} + +func (x *GetAllBotsResponse) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllBotsResponse.ProtoReflect.Descriptor instead. +func (*GetAllBotsResponse) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{21} +} + +func (x *GetAllBotsResponse) GetBots() []*Bot { + if x != nil { + return x.Bots + } + return nil +} + +type TGBGenericResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Response bool `protobuf:"varint,1,opt,name=response,proto3" json:"response,omitempty"` +} + +func (x *TGBGenericResponse) Reset() { + *x = TGBGenericResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TGBGenericResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TGBGenericResponse) ProtoMessage() {} + +func (x *TGBGenericResponse) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TGBGenericResponse.ProtoReflect.Descriptor instead. +func (*TGBGenericResponse) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{22} +} + +func (x *TGBGenericResponse) GetResponse() bool { + if x != nil { + return x.Response + } + return false +} + +type TGBUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TgbId int64 `protobuf:"varint,1,opt,name=tgb_id,json=tgbId,proto3" json:"tgb_id,omitempty"` +} + +func (x *TGBUserRequest) Reset() { + *x = TGBUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TGBUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TGBUserRequest) ProtoMessage() {} + +func (x *TGBUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TGBUserRequest.ProtoReflect.Descriptor instead. +func (*TGBUserRequest) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{23} +} + +func (x *TGBUserRequest) GetTgbId() int64 { + if x != nil { + return x.TgbId + } + return 0 +} + +type TGBBotNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BotName string `protobuf:"bytes,1,opt,name=bot_name,json=botName,proto3" json:"bot_name,omitempty"` +} + +func (x *TGBBotNameRequest) Reset() { + *x = TGBBotNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TGBBotNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TGBBotNameRequest) ProtoMessage() {} + +func (x *TGBBotNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TGBBotNameRequest.ProtoReflect.Descriptor instead. +func (*TGBBotNameRequest) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{24} +} + +func (x *TGBBotNameRequest) GetBotName() string { + if x != nil { + return x.BotName + } + return "" +} + +type TGBUserBotNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TgbId int64 `protobuf:"varint,1,opt,name=tgb_id,json=tgbId,proto3" json:"tgb_id,omitempty"` + BotName string `protobuf:"bytes,2,opt,name=bot_name,json=botName,proto3" json:"bot_name,omitempty"` +} + +func (x *TGBUserBotNameRequest) Reset() { + *x = TGBUserBotNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TGBUserBotNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TGBUserBotNameRequest) ProtoMessage() {} + +func (x *TGBUserBotNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TGBUserBotNameRequest.ProtoReflect.Descriptor instead. +func (*TGBUserBotNameRequest) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{25} +} + +func (x *TGBUserBotNameRequest) GetTgbId() int64 { + if x != nil { + return x.TgbId + } + return 0 +} + +func (x *TGBUserBotNameRequest) GetBotName() string { + if x != nil { + return x.BotName + } + return "" +} + +type TGBBanUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TgbId int64 `protobuf:"varint,1,opt,name=tgb_id,json=tgbId,proto3" json:"tgb_id,omitempty"` + BotName string `protobuf:"bytes,2,opt,name=bot_name,json=botName,proto3" json:"bot_name,omitempty"` + Until int64 `protobuf:"varint,3,opt,name=until,proto3" json:"until,omitempty"` +} + +func (x *TGBBanUserRequest) Reset() { + *x = TGBBanUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TGBBanUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TGBBanUserRequest) ProtoMessage() {} + +func (x *TGBBanUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TGBBanUserRequest.ProtoReflect.Descriptor instead. +func (*TGBBanUserRequest) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{26} +} + +func (x *TGBBanUserRequest) GetTgbId() int64 { + if x != nil { + return x.TgbId + } + return 0 +} + +func (x *TGBBanUserRequest) GetBotName() string { + if x != nil { + return x.BotName + } + return "" +} + +func (x *TGBBanUserRequest) GetUntil() int64 { + if x != nil { + return x.Until + } + return 0 +} + +type GetAccessResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Access []*AccessRq `protobuf:"bytes,1,rep,name=access,proto3" json:"access,omitempty"` +} + +func (x *GetAccessResponse) Reset() { + *x = GetAccessResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAccessResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAccessResponse) ProtoMessage() {} + +func (x *GetAccessResponse) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAccessResponse.ProtoReflect.Descriptor instead. +func (*GetAccessResponse) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{27} +} + +func (x *GetAccessResponse) GetAccess() []*AccessRq { + if x != nil { + return x.Access + } + return nil +} + +type GetBanResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Bans []*Ban `protobuf:"bytes,1,rep,name=bans,proto3" json:"bans,omitempty"` +} + +func (x *GetBanResponse) Reset() { + *x = GetBanResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_tgbuser_tgbuser_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetBanResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBanResponse) ProtoMessage() {} + +func (x *GetBanResponse) ProtoReflect() protoreflect.Message { + mi := &file_tgbuser_tgbuser_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBanResponse.ProtoReflect.Descriptor instead. +func (*GetBanResponse) Descriptor() ([]byte, []int) { + return file_tgbuser_tgbuser_proto_rawDescGZIP(), []int{28} +} + +func (x *GetBanResponse) GetBans() []*Ban { + if x != nil { + return x.Bans + } + return nil +} + +var File_tgbuser_tgbuser_proto protoreflect.FileDescriptor + +var file_tgbuser_tgbuser_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x74, 0x67, 0x62, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x74, 0x67, 0x62, 0x75, 0x73, 0x65, + 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe8, 0x01, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x15, 0x0a, 0x06, 0x74, 0x67, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x05, 0x74, 0x67, 0x62, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x15, 0x0a, 0x06, 0x74, 0x67, 0x5f, 0x62, 0x6f, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x74, 0x67, 0x42, 0x6f, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x64, 0x22, 0x4a, 0x0a, 0x03, 0x42, 0x6f, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x6f, 0x74, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x6f, 0x74, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, 0x67, + 0x0a, 0x03, 0x42, 0x61, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x74, 0x67, 0x62, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x67, 0x62, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, + 0x62, 0x6f, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x62, 0x6f, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x74, 0x69, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x75, 0x6e, 0x74, 0x69, 0x6c, 0x12, 0x18, 0x0a, + 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, 0x56, 0x0a, 0x08, 0x41, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x52, 0x71, 0x12, 0x15, 0x0a, 0x06, 0x74, 0x67, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x67, 0x62, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x6f, + 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x6f, + 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, + 0x2a, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x74, 0x67, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x67, 0x62, 0x49, 0x64, 0x22, 0x2f, 0x0a, 0x12, 0x47, + 0x65, 0x74, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x19, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x31, 0x0a, 0x14, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, + 0x27, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2f, 0x0a, 0x12, 0x45, 0x64, 0x69, 0x74, + 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, + 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x31, 0x0a, 0x13, 0x45, 0x64, 0x69, + 0x74, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x0a, 0x14, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x74, 0x67, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x67, 0x62, 0x49, 0x64, 0x22, 0x33, 0x0a, 0x15, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x48, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x42, 0x6f, 0x74, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x74, 0x67, 0x62, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x67, 0x62, 0x49, 0x64, 0x12, + 0x19, 0x0a, 0x08, 0x62, 0x6f, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x62, 0x6f, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x33, 0x0a, 0x15, 0x41, 0x64, + 0x64, 0x42, 0x6f, 0x74, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x4b, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x74, 0x54, 0x47, 0x42, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x74, 0x67, + 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x67, 0x62, 0x49, + 0x64, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x6f, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x6f, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x36, 0x0a, 0x18, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x74, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x74, 0x73, 0x54, + 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, + 0x06, 0x74, 0x67, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, + 0x67, 0x62, 0x49, 0x64, 0x22, 0x32, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x74, 0x73, 0x54, + 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, + 0x0a, 0x04, 0x62, 0x6f, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x42, + 0x6f, 0x74, 0x52, 0x04, 0x62, 0x6f, 0x74, 0x73, 0x22, 0x33, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x41, + 0x6c, 0x6c, 0x42, 0x6f, 0x74, 0x73, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x6f, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x6f, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x36, 0x0a, + 0x17, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x42, 0x6f, 0x74, 0x73, 0x55, 0x73, 0x65, 0x72, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, + 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0x13, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x42, + 0x6f, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x2e, 0x0a, 0x12, 0x47, 0x65, + 0x74, 0x41, 0x6c, 0x6c, 0x42, 0x6f, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x18, 0x0a, 0x04, 0x62, 0x6f, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x04, + 0x2e, 0x42, 0x6f, 0x74, 0x52, 0x04, 0x62, 0x6f, 0x74, 0x73, 0x22, 0x30, 0x0a, 0x12, 0x54, 0x47, + 0x42, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x0a, 0x0e, + 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, + 0x0a, 0x06, 0x74, 0x67, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x74, 0x67, 0x62, 0x49, 0x64, 0x22, 0x2e, 0x0a, 0x11, 0x54, 0x47, 0x42, 0x42, 0x6f, 0x74, 0x4e, + 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x6f, + 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x6f, + 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x49, 0x0a, 0x15, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, + 0x42, 0x6f, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, + 0x0a, 0x06, 0x74, 0x67, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x74, 0x67, 0x62, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x6f, 0x74, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x6f, 0x74, 0x4e, 0x61, 0x6d, 0x65, + 0x22, 0x5b, 0x0a, 0x11, 0x54, 0x47, 0x42, 0x42, 0x61, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x74, 0x67, 0x62, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x67, 0x62, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, + 0x62, 0x6f, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x62, 0x6f, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x74, 0x69, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x75, 0x6e, 0x74, 0x69, 0x6c, 0x22, 0x36, 0x0a, + 0x11, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x21, 0x0a, 0x06, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x71, 0x52, 0x06, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x2a, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x04, 0x62, 0x61, 0x6e, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x42, 0x61, 0x6e, 0x52, 0x04, 0x62, 0x61, 0x6e, + 0x73, 0x32, 0xc2, 0x08, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x12, 0x39, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x47, 0x42, 0x55, 0x73, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x30, 0x0a, 0x03, + 0x47, 0x65, 0x74, 0x12, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x47, 0x42, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x33, + 0x0a, 0x04, 0x45, 0x64, 0x69, 0x74, 0x12, 0x13, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x54, 0x47, 0x42, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x45, 0x64, + 0x69, 0x74, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x15, 0x2e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x47, 0x42, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x39, + 0x0a, 0x06, 0x41, 0x64, 0x64, 0x42, 0x6f, 0x74, 0x12, 0x15, 0x2e, 0x41, 0x64, 0x64, 0x42, 0x6f, + 0x74, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x16, 0x2e, 0x41, 0x64, 0x64, 0x42, 0x6f, 0x74, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x09, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x42, 0x6f, 0x74, 0x12, 0x18, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, + 0x6f, 0x74, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x19, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x74, 0x54, 0x47, 0x42, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3c, 0x0a, + 0x07, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x74, 0x73, 0x12, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, + 0x74, 0x73, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x74, 0x73, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x0f, 0x47, + 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x42, 0x6f, 0x74, 0x73, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x17, + 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x42, 0x6f, 0x74, 0x73, 0x55, 0x73, 0x65, 0x72, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, + 0x42, 0x6f, 0x74, 0x73, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x42, 0x6f, 0x74, + 0x73, 0x12, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x42, 0x6f, 0x74, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x42, 0x6f, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x09, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x74, 0x12, 0x12, 0x2e, 0x54, 0x47, 0x42, 0x42, + 0x6f, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, + 0x54, 0x47, 0x42, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x54, 0x47, + 0x42, 0x55, 0x73, 0x65, 0x72, 0x42, 0x6f, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x54, 0x47, 0x42, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x0b, 0x47, 0x72, + 0x61, 0x6e, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x16, 0x2e, 0x54, 0x47, 0x42, 0x55, + 0x73, 0x65, 0x72, 0x42, 0x6f, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x13, 0x2e, 0x54, 0x47, 0x42, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x07, 0x42, 0x61, 0x6e, 0x55, + 0x73, 0x65, 0x72, 0x12, 0x12, 0x2e, 0x54, 0x47, 0x42, 0x42, 0x61, 0x6e, 0x55, 0x73, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x54, 0x47, 0x42, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x69, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, + 0x0a, 0x09, 0x55, 0x6e, 0x42, 0x61, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x54, 0x47, + 0x42, 0x55, 0x73, 0x65, 0x72, 0x42, 0x6f, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x54, 0x47, 0x42, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x13, 0x47, 0x65, + 0x74, 0x41, 0x6c, 0x6c, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x12, 0x2e, 0x54, 0x47, 0x42, 0x42, 0x6f, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x11, 0x47, + 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x42, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x73, + 0x12, 0x12, 0x2e, 0x54, 0x47, 0x42, 0x42, 0x6f, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x41, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0f, 0x2e, 0x54, 0x47, + 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x47, + 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x32, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x42, + 0x6f, 0x74, 0x12, 0x0f, 0x2e, 0x54, 0x47, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x6f, 0x74, 0x65, 0x6a, 0x65, 0x64, + 0x61, 0x2f, 0x6d, 0x73, 0x76, 0x63, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2f, 0x74, 0x67, 0x62, 0x75, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_tgbuser_tgbuser_proto_rawDescOnce sync.Once + file_tgbuser_tgbuser_proto_rawDescData = file_tgbuser_tgbuser_proto_rawDesc +) + +func file_tgbuser_tgbuser_proto_rawDescGZIP() []byte { + file_tgbuser_tgbuser_proto_rawDescOnce.Do(func() { + file_tgbuser_tgbuser_proto_rawDescData = protoimpl.X.CompressGZIP(file_tgbuser_tgbuser_proto_rawDescData) + }) + return file_tgbuser_tgbuser_proto_rawDescData +} + +var file_tgbuser_tgbuser_proto_msgTypes = make([]protoimpl.MessageInfo, 29) +var file_tgbuser_tgbuser_proto_goTypes = []interface{}{ + (*User)(nil), // 0: User + (*Bot)(nil), // 1: Bot + (*Ban)(nil), // 2: Ban + (*AccessRq)(nil), // 3: AccessRq + (*GetTGBUserRequest)(nil), // 4: GetTGBUserRequest + (*GetTGBUserResponse)(nil), // 5: GetTGBUserResponse + (*CreateTGBUserRequest)(nil), // 6: CreateTGBUserRequest + (*CreateTGBUserResponse)(nil), // 7: CreateTGBUserResponse + (*EditTGBUserRequest)(nil), // 8: EditTGBUserRequest + (*EditTGBUserResponse)(nil), // 9: EditTGBUserResponse + (*DeleteTGBUserRequest)(nil), // 10: DeleteTGBUserRequest + (*DeleteTGBUserResponse)(nil), // 11: DeleteTGBUserResponse + (*AddBotTGBUserRequest)(nil), // 12: AddBotTGBUserRequest + (*AddBotTGBUserResponse)(nil), // 13: AddBotTGBUserResponse + (*DeleteBotTGBUserRequest)(nil), // 14: DeleteBotTGBUserRequest + (*DeleteBotTGBUserResponse)(nil), // 15: DeleteBotTGBUserResponse + (*GetBotsTGBUserRequest)(nil), // 16: GetBotsTGBUserRequest + (*GetBotsTGBUserResponse)(nil), // 17: GetBotsTGBUserResponse + (*GetAllBotsUsersRequest)(nil), // 18: GetAllBotsUsersRequest + (*GetAllBotsUsersResponse)(nil), // 19: GetAllBotsUsersResponse + (*GetAllBotsRequest)(nil), // 20: GetAllBotsRequest + (*GetAllBotsResponse)(nil), // 21: GetAllBotsResponse + (*TGBGenericResponse)(nil), // 22: TGBGenericResponse + (*TGBUserRequest)(nil), // 23: TGBUserRequest + (*TGBBotNameRequest)(nil), // 24: TGBBotNameRequest + (*TGBUserBotNameRequest)(nil), // 25: TGBUserBotNameRequest + (*TGBBanUserRequest)(nil), // 26: TGBBanUserRequest + (*GetAccessResponse)(nil), // 27: GetAccessResponse + (*GetBanResponse)(nil), // 28: GetBanResponse +} +var file_tgbuser_tgbuser_proto_depIdxs = []int32{ + 0, // 0: GetTGBUserResponse.user:type_name -> User + 0, // 1: CreateTGBUserRequest.user:type_name -> User + 0, // 2: EditTGBUserRequest.user:type_name -> User + 1, // 3: GetBotsTGBUserResponse.bots:type_name -> Bot + 0, // 4: GetAllBotsUsersResponse.users:type_name -> User + 1, // 5: GetAllBotsResponse.bots:type_name -> Bot + 3, // 6: GetAccessResponse.access:type_name -> AccessRq + 2, // 7: GetBanResponse.bans:type_name -> Ban + 6, // 8: UserManager.Create:input_type -> CreateTGBUserRequest + 4, // 9: UserManager.Get:input_type -> GetTGBUserRequest + 8, // 10: UserManager.Edit:input_type -> EditTGBUserRequest + 10, // 11: UserManager.Delete:input_type -> DeleteTGBUserRequest + 12, // 12: UserManager.AddBot:input_type -> AddBotTGBUserRequest + 14, // 13: UserManager.DeleteBot:input_type -> DeleteBotTGBUserRequest + 16, // 14: UserManager.GetBots:input_type -> GetBotsTGBUserRequest + 18, // 15: UserManager.GetAllBotsUsers:input_type -> GetAllBotsUsersRequest + 20, // 16: UserManager.GetAllBots:input_type -> GetAllBotsRequest + 24, // 17: UserManager.CreateBot:input_type -> TGBBotNameRequest + 25, // 18: UserManager.CreateAccessRequest:input_type -> TGBUserBotNameRequest + 25, // 19: UserManager.GrantAccess:input_type -> TGBUserBotNameRequest + 26, // 20: UserManager.BanUser:input_type -> TGBBanUserRequest + 25, // 21: UserManager.UnBanUser:input_type -> TGBUserBotNameRequest + 24, // 22: UserManager.GetAllAccessRequest:input_type -> TGBBotNameRequest + 24, // 23: UserManager.GetAllBannedUsers:input_type -> TGBBotNameRequest + 23, // 24: UserManager.GetAccessRequest:input_type -> TGBUserRequest + 23, // 25: UserManager.GetBannedBot:input_type -> TGBUserRequest + 7, // 26: UserManager.Create:output_type -> CreateTGBUserResponse + 5, // 27: UserManager.Get:output_type -> GetTGBUserResponse + 9, // 28: UserManager.Edit:output_type -> EditTGBUserResponse + 11, // 29: UserManager.Delete:output_type -> DeleteTGBUserResponse + 13, // 30: UserManager.AddBot:output_type -> AddBotTGBUserResponse + 15, // 31: UserManager.DeleteBot:output_type -> DeleteBotTGBUserResponse + 17, // 32: UserManager.GetBots:output_type -> GetBotsTGBUserResponse + 19, // 33: UserManager.GetAllBotsUsers:output_type -> GetAllBotsUsersResponse + 21, // 34: UserManager.GetAllBots:output_type -> GetAllBotsResponse + 22, // 35: UserManager.CreateBot:output_type -> TGBGenericResponse + 22, // 36: UserManager.CreateAccessRequest:output_type -> TGBGenericResponse + 22, // 37: UserManager.GrantAccess:output_type -> TGBGenericResponse + 22, // 38: UserManager.BanUser:output_type -> TGBGenericResponse + 22, // 39: UserManager.UnBanUser:output_type -> TGBGenericResponse + 27, // 40: UserManager.GetAllAccessRequest:output_type -> GetAccessResponse + 28, // 41: UserManager.GetAllBannedUsers:output_type -> GetBanResponse + 27, // 42: UserManager.GetAccessRequest:output_type -> GetAccessResponse + 28, // 43: UserManager.GetBannedBot:output_type -> GetBanResponse + 26, // [26:44] is the sub-list for method output_type + 8, // [8:26] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_tgbuser_tgbuser_proto_init() } +func file_tgbuser_tgbuser_proto_init() { + if File_tgbuser_tgbuser_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_tgbuser_tgbuser_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*User); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Bot); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Ban); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AccessRq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTGBUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTGBUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateTGBUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateTGBUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EditTGBUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EditTGBUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteTGBUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteTGBUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddBotTGBUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddBotTGBUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteBotTGBUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteBotTGBUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetBotsTGBUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetBotsTGBUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllBotsUsersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllBotsUsersResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllBotsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllBotsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TGBGenericResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TGBUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TGBBotNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TGBUserBotNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TGBBanUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAccessResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tgbuser_tgbuser_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetBanResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_tgbuser_tgbuser_proto_rawDesc, + NumEnums: 0, + NumMessages: 29, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_tgbuser_tgbuser_proto_goTypes, + DependencyIndexes: file_tgbuser_tgbuser_proto_depIdxs, + MessageInfos: file_tgbuser_tgbuser_proto_msgTypes, + }.Build() + File_tgbuser_tgbuser_proto = out.File + file_tgbuser_tgbuser_proto_rawDesc = nil + file_tgbuser_tgbuser_proto_goTypes = nil + file_tgbuser_tgbuser_proto_depIdxs = nil +} diff --git a/proto/golang/tgbuser/tgbuser_grpc.pb.go b/proto/golang/tgbuser/tgbuser_grpc.pb.go new file mode 100644 index 0000000..cae000d --- /dev/null +++ b/proto/golang/tgbuser/tgbuser_grpc.pb.go @@ -0,0 +1,738 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.25.1 +// source: tgbuser/tgbuser.proto + +package tgbuser + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + UserManager_Create_FullMethodName = "/UserManager/Create" + UserManager_Get_FullMethodName = "/UserManager/Get" + UserManager_Edit_FullMethodName = "/UserManager/Edit" + UserManager_Delete_FullMethodName = "/UserManager/Delete" + UserManager_AddBot_FullMethodName = "/UserManager/AddBot" + UserManager_DeleteBot_FullMethodName = "/UserManager/DeleteBot" + UserManager_GetBots_FullMethodName = "/UserManager/GetBots" + UserManager_GetAllBotsUsers_FullMethodName = "/UserManager/GetAllBotsUsers" + UserManager_GetAllBots_FullMethodName = "/UserManager/GetAllBots" + UserManager_CreateBot_FullMethodName = "/UserManager/CreateBot" + UserManager_CreateAccessRequest_FullMethodName = "/UserManager/CreateAccessRequest" + UserManager_GrantAccess_FullMethodName = "/UserManager/GrantAccess" + UserManager_BanUser_FullMethodName = "/UserManager/BanUser" + UserManager_UnBanUser_FullMethodName = "/UserManager/UnBanUser" + UserManager_GetAllAccessRequest_FullMethodName = "/UserManager/GetAllAccessRequest" + UserManager_GetAllBannedUsers_FullMethodName = "/UserManager/GetAllBannedUsers" + UserManager_GetAccessRequest_FullMethodName = "/UserManager/GetAccessRequest" + UserManager_GetBannedBot_FullMethodName = "/UserManager/GetBannedBot" +) + +// UserManagerClient is the client API for UserManager 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 UserManagerClient interface { + Create(ctx context.Context, in *CreateTGBUserRequest, opts ...grpc.CallOption) (*CreateTGBUserResponse, error) + Get(ctx context.Context, in *GetTGBUserRequest, opts ...grpc.CallOption) (*GetTGBUserResponse, error) + Edit(ctx context.Context, in *EditTGBUserRequest, opts ...grpc.CallOption) (*EditTGBUserResponse, error) + Delete(ctx context.Context, in *DeleteTGBUserRequest, opts ...grpc.CallOption) (*DeleteTGBUserResponse, error) + AddBot(ctx context.Context, in *AddBotTGBUserRequest, opts ...grpc.CallOption) (*AddBotTGBUserResponse, error) + DeleteBot(ctx context.Context, in *DeleteBotTGBUserRequest, opts ...grpc.CallOption) (*DeleteBotTGBUserResponse, error) + GetBots(ctx context.Context, in *GetBotsTGBUserRequest, opts ...grpc.CallOption) (*GetBotsTGBUserResponse, error) + GetAllBotsUsers(ctx context.Context, in *GetAllBotsUsersRequest, opts ...grpc.CallOption) (*GetAllBotsUsersResponse, error) + GetAllBots(ctx context.Context, in *GetAllBotsRequest, opts ...grpc.CallOption) (*GetAllBotsResponse, error) + CreateBot(ctx context.Context, in *TGBBotNameRequest, opts ...grpc.CallOption) (*TGBGenericResponse, error) + CreateAccessRequest(ctx context.Context, in *TGBUserBotNameRequest, opts ...grpc.CallOption) (*TGBGenericResponse, error) + GrantAccess(ctx context.Context, in *TGBUserBotNameRequest, opts ...grpc.CallOption) (*TGBGenericResponse, error) + BanUser(ctx context.Context, in *TGBBanUserRequest, opts ...grpc.CallOption) (*TGBGenericResponse, error) + UnBanUser(ctx context.Context, in *TGBUserBotNameRequest, opts ...grpc.CallOption) (*TGBGenericResponse, error) + GetAllAccessRequest(ctx context.Context, in *TGBBotNameRequest, opts ...grpc.CallOption) (*GetAccessResponse, error) + GetAllBannedUsers(ctx context.Context, in *TGBBotNameRequest, opts ...grpc.CallOption) (*GetBanResponse, error) + GetAccessRequest(ctx context.Context, in *TGBUserRequest, opts ...grpc.CallOption) (*GetAccessResponse, error) + GetBannedBot(ctx context.Context, in *TGBUserRequest, opts ...grpc.CallOption) (*GetBanResponse, error) +} + +type userManagerClient struct { + cc grpc.ClientConnInterface +} + +func NewUserManagerClient(cc grpc.ClientConnInterface) UserManagerClient { + return &userManagerClient{cc} +} + +func (c *userManagerClient) Create(ctx context.Context, in *CreateTGBUserRequest, opts ...grpc.CallOption) (*CreateTGBUserResponse, error) { + out := new(CreateTGBUserResponse) + err := c.cc.Invoke(ctx, UserManager_Create_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) Get(ctx context.Context, in *GetTGBUserRequest, opts ...grpc.CallOption) (*GetTGBUserResponse, error) { + out := new(GetTGBUserResponse) + err := c.cc.Invoke(ctx, UserManager_Get_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) Edit(ctx context.Context, in *EditTGBUserRequest, opts ...grpc.CallOption) (*EditTGBUserResponse, error) { + out := new(EditTGBUserResponse) + err := c.cc.Invoke(ctx, UserManager_Edit_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) Delete(ctx context.Context, in *DeleteTGBUserRequest, opts ...grpc.CallOption) (*DeleteTGBUserResponse, error) { + out := new(DeleteTGBUserResponse) + err := c.cc.Invoke(ctx, UserManager_Delete_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) AddBot(ctx context.Context, in *AddBotTGBUserRequest, opts ...grpc.CallOption) (*AddBotTGBUserResponse, error) { + out := new(AddBotTGBUserResponse) + err := c.cc.Invoke(ctx, UserManager_AddBot_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) DeleteBot(ctx context.Context, in *DeleteBotTGBUserRequest, opts ...grpc.CallOption) (*DeleteBotTGBUserResponse, error) { + out := new(DeleteBotTGBUserResponse) + err := c.cc.Invoke(ctx, UserManager_DeleteBot_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) GetBots(ctx context.Context, in *GetBotsTGBUserRequest, opts ...grpc.CallOption) (*GetBotsTGBUserResponse, error) { + out := new(GetBotsTGBUserResponse) + err := c.cc.Invoke(ctx, UserManager_GetBots_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) GetAllBotsUsers(ctx context.Context, in *GetAllBotsUsersRequest, opts ...grpc.CallOption) (*GetAllBotsUsersResponse, error) { + out := new(GetAllBotsUsersResponse) + err := c.cc.Invoke(ctx, UserManager_GetAllBotsUsers_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) GetAllBots(ctx context.Context, in *GetAllBotsRequest, opts ...grpc.CallOption) (*GetAllBotsResponse, error) { + out := new(GetAllBotsResponse) + err := c.cc.Invoke(ctx, UserManager_GetAllBots_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) CreateBot(ctx context.Context, in *TGBBotNameRequest, opts ...grpc.CallOption) (*TGBGenericResponse, error) { + out := new(TGBGenericResponse) + err := c.cc.Invoke(ctx, UserManager_CreateBot_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) CreateAccessRequest(ctx context.Context, in *TGBUserBotNameRequest, opts ...grpc.CallOption) (*TGBGenericResponse, error) { + out := new(TGBGenericResponse) + err := c.cc.Invoke(ctx, UserManager_CreateAccessRequest_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) GrantAccess(ctx context.Context, in *TGBUserBotNameRequest, opts ...grpc.CallOption) (*TGBGenericResponse, error) { + out := new(TGBGenericResponse) + err := c.cc.Invoke(ctx, UserManager_GrantAccess_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) BanUser(ctx context.Context, in *TGBBanUserRequest, opts ...grpc.CallOption) (*TGBGenericResponse, error) { + out := new(TGBGenericResponse) + err := c.cc.Invoke(ctx, UserManager_BanUser_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) UnBanUser(ctx context.Context, in *TGBUserBotNameRequest, opts ...grpc.CallOption) (*TGBGenericResponse, error) { + out := new(TGBGenericResponse) + err := c.cc.Invoke(ctx, UserManager_UnBanUser_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) GetAllAccessRequest(ctx context.Context, in *TGBBotNameRequest, opts ...grpc.CallOption) (*GetAccessResponse, error) { + out := new(GetAccessResponse) + err := c.cc.Invoke(ctx, UserManager_GetAllAccessRequest_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) GetAllBannedUsers(ctx context.Context, in *TGBBotNameRequest, opts ...grpc.CallOption) (*GetBanResponse, error) { + out := new(GetBanResponse) + err := c.cc.Invoke(ctx, UserManager_GetAllBannedUsers_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) GetAccessRequest(ctx context.Context, in *TGBUserRequest, opts ...grpc.CallOption) (*GetAccessResponse, error) { + out := new(GetAccessResponse) + err := c.cc.Invoke(ctx, UserManager_GetAccessRequest_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userManagerClient) GetBannedBot(ctx context.Context, in *TGBUserRequest, opts ...grpc.CallOption) (*GetBanResponse, error) { + out := new(GetBanResponse) + err := c.cc.Invoke(ctx, UserManager_GetBannedBot_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// UserManagerServer is the server API for UserManager service. +// All implementations must embed UnimplementedUserManagerServer +// for forward compatibility +type UserManagerServer interface { + Create(context.Context, *CreateTGBUserRequest) (*CreateTGBUserResponse, error) + Get(context.Context, *GetTGBUserRequest) (*GetTGBUserResponse, error) + Edit(context.Context, *EditTGBUserRequest) (*EditTGBUserResponse, error) + Delete(context.Context, *DeleteTGBUserRequest) (*DeleteTGBUserResponse, error) + AddBot(context.Context, *AddBotTGBUserRequest) (*AddBotTGBUserResponse, error) + DeleteBot(context.Context, *DeleteBotTGBUserRequest) (*DeleteBotTGBUserResponse, error) + GetBots(context.Context, *GetBotsTGBUserRequest) (*GetBotsTGBUserResponse, error) + GetAllBotsUsers(context.Context, *GetAllBotsUsersRequest) (*GetAllBotsUsersResponse, error) + GetAllBots(context.Context, *GetAllBotsRequest) (*GetAllBotsResponse, error) + CreateBot(context.Context, *TGBBotNameRequest) (*TGBGenericResponse, error) + CreateAccessRequest(context.Context, *TGBUserBotNameRequest) (*TGBGenericResponse, error) + GrantAccess(context.Context, *TGBUserBotNameRequest) (*TGBGenericResponse, error) + BanUser(context.Context, *TGBBanUserRequest) (*TGBGenericResponse, error) + UnBanUser(context.Context, *TGBUserBotNameRequest) (*TGBGenericResponse, error) + GetAllAccessRequest(context.Context, *TGBBotNameRequest) (*GetAccessResponse, error) + GetAllBannedUsers(context.Context, *TGBBotNameRequest) (*GetBanResponse, error) + GetAccessRequest(context.Context, *TGBUserRequest) (*GetAccessResponse, error) + GetBannedBot(context.Context, *TGBUserRequest) (*GetBanResponse, error) + mustEmbedUnimplementedUserManagerServer() +} + +// UnimplementedUserManagerServer must be embedded to have forward compatible implementations. +type UnimplementedUserManagerServer struct { +} + +func (UnimplementedUserManagerServer) Create(context.Context, *CreateTGBUserRequest) (*CreateTGBUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") +} +func (UnimplementedUserManagerServer) Get(context.Context, *GetTGBUserRequest) (*GetTGBUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (UnimplementedUserManagerServer) Edit(context.Context, *EditTGBUserRequest) (*EditTGBUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Edit not implemented") +} +func (UnimplementedUserManagerServer) Delete(context.Context, *DeleteTGBUserRequest) (*DeleteTGBUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (UnimplementedUserManagerServer) AddBot(context.Context, *AddBotTGBUserRequest) (*AddBotTGBUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddBot not implemented") +} +func (UnimplementedUserManagerServer) DeleteBot(context.Context, *DeleteBotTGBUserRequest) (*DeleteBotTGBUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteBot not implemented") +} +func (UnimplementedUserManagerServer) GetBots(context.Context, *GetBotsTGBUserRequest) (*GetBotsTGBUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBots not implemented") +} +func (UnimplementedUserManagerServer) GetAllBotsUsers(context.Context, *GetAllBotsUsersRequest) (*GetAllBotsUsersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllBotsUsers not implemented") +} +func (UnimplementedUserManagerServer) GetAllBots(context.Context, *GetAllBotsRequest) (*GetAllBotsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllBots not implemented") +} +func (UnimplementedUserManagerServer) CreateBot(context.Context, *TGBBotNameRequest) (*TGBGenericResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateBot not implemented") +} +func (UnimplementedUserManagerServer) CreateAccessRequest(context.Context, *TGBUserBotNameRequest) (*TGBGenericResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateAccessRequest not implemented") +} +func (UnimplementedUserManagerServer) GrantAccess(context.Context, *TGBUserBotNameRequest) (*TGBGenericResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GrantAccess not implemented") +} +func (UnimplementedUserManagerServer) BanUser(context.Context, *TGBBanUserRequest) (*TGBGenericResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BanUser not implemented") +} +func (UnimplementedUserManagerServer) UnBanUser(context.Context, *TGBUserBotNameRequest) (*TGBGenericResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnBanUser not implemented") +} +func (UnimplementedUserManagerServer) GetAllAccessRequest(context.Context, *TGBBotNameRequest) (*GetAccessResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllAccessRequest not implemented") +} +func (UnimplementedUserManagerServer) GetAllBannedUsers(context.Context, *TGBBotNameRequest) (*GetBanResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllBannedUsers not implemented") +} +func (UnimplementedUserManagerServer) GetAccessRequest(context.Context, *TGBUserRequest) (*GetAccessResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAccessRequest not implemented") +} +func (UnimplementedUserManagerServer) GetBannedBot(context.Context, *TGBUserRequest) (*GetBanResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBannedBot not implemented") +} +func (UnimplementedUserManagerServer) mustEmbedUnimplementedUserManagerServer() {} + +// UnsafeUserManagerServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to UserManagerServer will +// result in compilation errors. +type UnsafeUserManagerServer interface { + mustEmbedUnimplementedUserManagerServer() +} + +func RegisterUserManagerServer(s grpc.ServiceRegistrar, srv UserManagerServer) { + s.RegisterService(&UserManager_ServiceDesc, srv) +} + +func _UserManager_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateTGBUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_Create_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).Create(ctx, req.(*CreateTGBUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTGBUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_Get_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).Get(ctx, req.(*GetTGBUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_Edit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EditTGBUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).Edit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_Edit_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).Edit(ctx, req.(*EditTGBUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteTGBUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_Delete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).Delete(ctx, req.(*DeleteTGBUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_AddBot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddBotTGBUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).AddBot(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_AddBot_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).AddBot(ctx, req.(*AddBotTGBUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_DeleteBot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteBotTGBUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).DeleteBot(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_DeleteBot_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).DeleteBot(ctx, req.(*DeleteBotTGBUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_GetBots_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBotsTGBUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).GetBots(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_GetBots_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).GetBots(ctx, req.(*GetBotsTGBUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_GetAllBotsUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllBotsUsersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).GetAllBotsUsers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_GetAllBotsUsers_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).GetAllBotsUsers(ctx, req.(*GetAllBotsUsersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_GetAllBots_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllBotsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).GetAllBots(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_GetAllBots_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).GetAllBots(ctx, req.(*GetAllBotsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_CreateBot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TGBBotNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).CreateBot(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_CreateBot_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).CreateBot(ctx, req.(*TGBBotNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_CreateAccessRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TGBUserBotNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).CreateAccessRequest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_CreateAccessRequest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).CreateAccessRequest(ctx, req.(*TGBUserBotNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_GrantAccess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TGBUserBotNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).GrantAccess(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_GrantAccess_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).GrantAccess(ctx, req.(*TGBUserBotNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_BanUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TGBBanUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).BanUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_BanUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).BanUser(ctx, req.(*TGBBanUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_UnBanUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TGBUserBotNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).UnBanUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_UnBanUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).UnBanUser(ctx, req.(*TGBUserBotNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_GetAllAccessRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TGBBotNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).GetAllAccessRequest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_GetAllAccessRequest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).GetAllAccessRequest(ctx, req.(*TGBBotNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_GetAllBannedUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TGBBotNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).GetAllBannedUsers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_GetAllBannedUsers_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).GetAllBannedUsers(ctx, req.(*TGBBotNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_GetAccessRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TGBUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).GetAccessRequest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_GetAccessRequest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).GetAccessRequest(ctx, req.(*TGBUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserManager_GetBannedBot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TGBUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserManagerServer).GetBannedBot(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserManager_GetBannedBot_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserManagerServer).GetBannedBot(ctx, req.(*TGBUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// UserManager_ServiceDesc is the grpc.ServiceDesc for UserManager service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var UserManager_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "UserManager", + HandlerType: (*UserManagerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Create", + Handler: _UserManager_Create_Handler, + }, + { + MethodName: "Get", + Handler: _UserManager_Get_Handler, + }, + { + MethodName: "Edit", + Handler: _UserManager_Edit_Handler, + }, + { + MethodName: "Delete", + Handler: _UserManager_Delete_Handler, + }, + { + MethodName: "AddBot", + Handler: _UserManager_AddBot_Handler, + }, + { + MethodName: "DeleteBot", + Handler: _UserManager_DeleteBot_Handler, + }, + { + MethodName: "GetBots", + Handler: _UserManager_GetBots_Handler, + }, + { + MethodName: "GetAllBotsUsers", + Handler: _UserManager_GetAllBotsUsers_Handler, + }, + { + MethodName: "GetAllBots", + Handler: _UserManager_GetAllBots_Handler, + }, + { + MethodName: "CreateBot", + Handler: _UserManager_CreateBot_Handler, + }, + { + MethodName: "CreateAccessRequest", + Handler: _UserManager_CreateAccessRequest_Handler, + }, + { + MethodName: "GrantAccess", + Handler: _UserManager_GrantAccess_Handler, + }, + { + MethodName: "BanUser", + Handler: _UserManager_BanUser_Handler, + }, + { + MethodName: "UnBanUser", + Handler: _UserManager_UnBanUser_Handler, + }, + { + MethodName: "GetAllAccessRequest", + Handler: _UserManager_GetAllAccessRequest_Handler, + }, + { + MethodName: "GetAllBannedUsers", + Handler: _UserManager_GetAllBannedUsers_Handler, + }, + { + MethodName: "GetAccessRequest", + Handler: _UserManager_GetAccessRequest_Handler, + }, + { + MethodName: "GetBannedBot", + Handler: _UserManager_GetBannedBot_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "tgbuser/tgbuser.proto", +} diff --git a/proto/tgbuser/tgbuser.proto b/proto/tgbuser/tgbuser.proto new file mode 100644 index 0000000..76d4cbd --- /dev/null +++ b/proto/tgbuser/tgbuser.proto @@ -0,0 +1,152 @@ +syntax = "proto3"; +option go_package="github.com/maximotejeda/msvc-proto/golang/tgbuser"; + +message User { + int64 id = 1; + int64 tgb_id = 2; + string username = 3; + string first_name = 4; + string last_name = 5; + string tg_bot = 6; + int64 created = 7; + int64 edited = 8; + int64 deleted = 9; +} +message Bot { + int64 id = 1; + string bot_name = 2; + int64 created = 3; +} +message Ban { + int64 tgb_id = 1; + string bot_name = 2; + int64 until = 3; + int64 created = 4; +} +message AccessRq { + int64 tgb_id = 1; + string bot_name = 2; + int64 created = 3; +} +message GetTGBUserRequest { + int64 tgb_id = 1; +} +message GetTGBUserResponse { + User user = 1; +} +message CreateTGBUserRequest { + User user = 1; +} +message CreateTGBUserResponse { + int64 id = 1; +} +message EditTGBUserRequest { + User user = 1; +} +message EditTGBUserResponse { + bool response = 1; +} +message DeleteTGBUserRequest { + int64 tgb_id = 1 ; +} +message DeleteTGBUserResponse { + bool response = 1; +} +message AddBotTGBUserRequest{ + int64 tgb_id = 1; + string bot_name = 2; +} + +message AddBotTGBUserResponse { + bool response = 1; +} +message DeleteBotTGBUserRequest{ + int64 tgb_id = 1; + string bot_name = 2; +} +message DeleteBotTGBUserResponse { + bool response = 1; +} +message GetBotsTGBUserRequest { + int64 tgb_id = 1; +} +message GetBotsTGBUserResponse { + repeated Bot bots = 1; +} + +message GetAllBotsUsersRequest{ + string bot_name = 1; +} +message GetAllBotsUsersResponse{ + repeated User users = 1; +} + +message GetAllBotsRequest{} +message GetAllBotsResponse{ + repeated Bot bots = 1; +} + +message TGBGenericResponse{ + bool response = 1; +} +message TGBUserRequest{ + int64 tgb_id = 1; +} +message TGBBotNameRequest { + string bot_name = 1; +} +message TGBUserBotNameRequest { + int64 tgb_id = 1; + string bot_name =2; +} +message TGBBanUserRequest{ + int64 tgb_id = 1; + string bot_name = 2; + int64 until = 3; +} +message GetAccessResponse{ + repeated AccessRq access = 1; +} +message GetBanResponse { + repeated Ban bans = 1; +} + + +service UserManager { + rpc Create(CreateTGBUserRequest) + returns (CreateTGBUserResponse){} + rpc Get(GetTGBUserRequest) + returns (GetTGBUserResponse){} + rpc Edit(EditTGBUserRequest) + returns (EditTGBUserResponse){} + rpc Delete(DeleteTGBUserRequest) + returns (DeleteTGBUserResponse){} + rpc AddBot(AddBotTGBUserRequest) + returns (AddBotTGBUserResponse){} + rpc DeleteBot(DeleteBotTGBUserRequest) + returns (DeleteBotTGBUserResponse){} + rpc GetBots(GetBotsTGBUserRequest) + returns (GetBotsTGBUserResponse){} + rpc GetAllBotsUsers(GetAllBotsUsersRequest) + returns(GetAllBotsUsersResponse){} + rpc GetAllBots(GetAllBotsRequest) + returns(GetAllBotsResponse){} + rpc CreateBot(TGBBotNameRequest) + returns (TGBGenericResponse){} + rpc CreateAccessRequest(TGBUserBotNameRequest) + returns (TGBGenericResponse){} + rpc GrantAccess(TGBUserBotNameRequest) + returns (TGBGenericResponse){} + rpc BanUser(TGBBanUserRequest) + returns (TGBGenericResponse){} + rpc UnBanUser(TGBUserBotNameRequest) + returns (TGBGenericResponse){} + rpc GetAllAccessRequest(TGBBotNameRequest) + returns (GetAccessResponse){} + rpc GetAllBannedUsers(TGBBotNameRequest) + returns (GetBanResponse){} + rpc GetAccessRequest(TGBUserRequest) + returns (GetAccessResponse){} + rpc GetBannedBot(TGBUserRequest) + returns (GetBanResponse){} +} diff --git a/tgbdb/data.db b/tgbdb/data.db new file mode 100644 index 0000000..aae2ffa Binary files /dev/null and b/tgbdb/data.db differ