diff --git a/go.mod b/go.mod index 9eb274a5d..587b0ce81 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/usememos/memos go 1.25 require ( + connectrpc.com/connect v1.19.1 github.com/aws/aws-sdk-go-v2 v1.39.2 github.com/aws/aws-sdk-go-v2/config v1.31.12 github.com/aws/aws-sdk-go-v2/credentials v1.18.16 @@ -14,7 +15,6 @@ require ( github.com/gorilla/feeds v1.2.0 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 - github.com/improbable-eng/grpc-web v0.15.0 github.com/joho/godotenv v1.5.1 github.com/labstack/echo/v4 v4.13.4 github.com/lib/pq v1.10.9 @@ -38,8 +38,6 @@ require ( cel.dev/expr v0.24.0 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/antlr4-go/antlr/v4 v4.13.1 // indirect - github.com/cenkalti/backoff/v4 v4.3.0 // indirect - github.com/desertbit/timer v1.0.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect github.com/go-viper/mapstructure/v2 v2.2.1 // indirect @@ -48,7 +46,6 @@ require ( github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - github.com/rs/cors v1.11.1 // indirect github.com/sagikazarmark/locafero v0.7.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.12.0 // indirect @@ -64,7 +61,6 @@ require ( modernc.org/libc v1.66.8 // indirect modernc.org/mathutil v1.7.1 // indirect modernc.org/memory v1.11.0 // indirect - nhooyr.io/websocket v1.8.17 // indirect ) require ( diff --git a/go.sum b/go.sum index d2a9b2c8d..78986a869 100644 --- a/go.sum +++ b/go.sum @@ -1,33 +1,13 @@ cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY= cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +connectrpc.com/connect v1.19.1 h1:R5M57z05+90EfEvCY1b7hBxDVOUl45PrtXtAV2fOC14= +connectrpc.com/connect v1.19.1/go.mod h1:tN20fjdGlewnSFeZxLKb0xwIZ6ozc3OQs2hTXy4du9w= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= -github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/aws/aws-sdk-go-v2 v1.39.2 h1:EJLg8IdbzgeD7xgvZ+I8M1e0fL0ptn/M47lianzth0I= github.com/aws/aws-sdk-go-v2 v1.39.2/go.mod h1:sDioUELIUO9Znk23YVmIk86/9DOpkbyyVb1i/gUNFXY= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.1 h1:i8p8P4diljCr60PpJp6qZXNlgX4m2yQFpYk+9ZT+J4E= @@ -67,196 +47,69 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.38.6/go.mod h1:WtKK+ppze5yKPkZ0XwqIV github.com/aws/smithy-go v1.23.0 h1:8n6I3gXzWJB2DxBDnfxgBaSX6oe0d/t10qGz7OKqMCE= github.com/aws/smithy-go v1.23.0/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= -github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= -github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= -github.com/desertbit/timer v1.0.1 h1:yRpYNn5Vaaj6QXecdLMPMJsW81JLiI1eokUft5nBmeo= -github.com/desertbit/timer v1.0.1/go.mod h1:htRrYeY5V/t4iu1xCJ5XsQvp4xve8QulXXctAzxqcwE= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= 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/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= -github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ= github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs= github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 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/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/feeds v1.2.0 h1:O6pBiXJ5JHhPvqy53NsjKOThq+dNFm8+DFrxBEdzSCc= github.com/gorilla/feeds v1.2.0/go.mod h1:WMib8uJP3BbY+X8Szd1rA5Pzhdfh+HCCAYT2z7Fza6Y= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= -github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= -github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= -github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -268,151 +121,50 @@ github.com/labstack/echo/v4 v4.13.4 h1:oTZZW+T3s9gAu5L8vmzihV7/lkXGZuITzTQkTEhcX github.com/labstack/echo/v4 v4.13.4/go.mod h1:g63b33BZ5vZzcIUF8AtRH40DrTlXnx4UMC8rBdndmjQ= github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0= github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= -github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/lithammer/shortuuid/v4 v4.2.0 h1:LMFOzVB3996a7b8aBuEXxqOBflbfPQAiVzkIcHO0h8c= github.com/lithammer/shortuuid/v4 v4.2.0/go.mod h1:D5noHZ2oFw/YaKCfGy0YxyE7M0wMbezmMjPdhyEFe6Y= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= 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-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= -github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= 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/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= -github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= -github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= -github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo= github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k= -github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= -github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs= github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4= github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y= github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4= github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4= github.com/stoewer/go-strcase v1.3.1 h1:iS0MdW+kVTxgMoE1LAZyMiYJFKlOzLooE4MxjirtkAs= github.com/stoewer/go-strcase v1.3.1/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= -github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -428,25 +180,14 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.7.13 h1:GPddIs617DnBLFFVJFgpo1aBfe/4xcvMc3SB5t/D0pA= github.com/yuin/goldmark v1.7.13/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= @@ -459,150 +200,76 @@ go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFh go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps= go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI= golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b h1:DXr+pvt3nC887026GRP39Ej11UATqWDmWuS99x26cD0= golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.30.0 h1:jD5RhkmVAnjqaCUXfbGBrn3lpxbknfN9w2UhHHU+5B4= golang.org/x/image v0.30.0/go.mod h1:SAEUTxCCMWSrJcCy/4HwavEsfZZJlYxeHLc6tTiAe/c= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U= golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= @@ -613,77 +280,36 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto/googleapis/api v0.0.0-20250826171959-ef028d996bc1 h1:APHvLLYBhtZvsbnpkfknDZ7NyH4z5+ub/I0u8L3Oz6g= google.golang.org/genproto/googleapis/api v0.0.0-20250826171959-ef028d996bc1/go.mod h1:xUjFWUnWDpZ/C0Gu0qloASKFb6f8/QXiiXhSPFsD668= google.golang.org/genproto/googleapis/rpc v0.0.0-20250826171959-ef028d996bc1 h1:pmJpJEvT846VzausCQ5d7KreSROcDqmO388w5YbnltA= google.golang.org/genproto/googleapis/rpc v0.0.0-20250826171959-ef028d996bc1/go.mod h1:GmFNa4BdJZ2a8G+wCe9Bg3wwThLrJun751XstdJt5Og= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI= google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= modernc.org/cc/v4 v4.26.4 h1:jPhG8oNjtTYuP2FA4YefTJ/wioNUGALmGuEWt7SUR6s= modernc.org/cc/v4 v4.26.4/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0= modernc.org/ccgo/v4 v4.28.1 h1:wPKYn5EC/mYTqBO373jKjvX2n+3+aK7+sICCv4Fjy1A= @@ -710,8 +336,3 @@ modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0= modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -nhooyr.io/websocket v1.8.17 h1:KEVeLJkUywCKVsnLIDlD/5gtayKp8VoCkksHCGGfT9Y= -nhooyr.io/websocket v1.8.17/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml index 8bf2973c3..fb1eea72e 100644 --- a/proto/buf.gen.yaml +++ b/proto/buf.gen.yaml @@ -7,6 +7,15 @@ managed: override: - file_option: go_package_prefix value: github.com/usememos/memos/proto/gen +inputs: + - directory: . + - module: buf.build/googleapis/googleapis + paths: + - google/api/annotations.proto + - google/api/client.proto + - google/api/field_behavior.proto + - google/api/http.proto + - google/api/resource.proto plugins: - remote: buf.build/protocolbuffers/go out: gen @@ -14,19 +23,17 @@ plugins: - remote: buf.build/grpc/go out: gen opt: paths=source_relative + - remote: buf.build/connectrpc/go + out: gen + opt: paths=source_relative - remote: buf.build/grpc-ecosystem/gateway out: gen opt: paths=source_relative - remote: buf.build/community/google-gnostic-openapi out: gen opt: paths=source_relative,enum_type=string - - remote: buf.build/community/stephenh-ts-proto + - remote: buf.build/bufbuild/es out: ../web/src/types/proto opt: - - env=browser - - useOptionals=messages - - outputServices=generic-definitions - - outputJsonMethods=false - - useExactTypes=false - - esModuleInterop=true - - stringEnums=true + - target=ts + include_imports: true diff --git a/proto/gen/api/v1/apiv1connect/activity_service.connect.go b/proto/gen/api/v1/apiv1connect/activity_service.connect.go new file mode 100644 index 000000000..903efe925 --- /dev/null +++ b/proto/gen/api/v1/apiv1connect/activity_service.connect.go @@ -0,0 +1,142 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: api/v1/activity_service.proto + +package apiv1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v1 "github.com/usememos/memos/proto/gen/api/v1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // ActivityServiceName is the fully-qualified name of the ActivityService service. + ActivityServiceName = "memos.api.v1.ActivityService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ActivityServiceListActivitiesProcedure is the fully-qualified name of the ActivityService's + // ListActivities RPC. + ActivityServiceListActivitiesProcedure = "/memos.api.v1.ActivityService/ListActivities" + // ActivityServiceGetActivityProcedure is the fully-qualified name of the ActivityService's + // GetActivity RPC. + ActivityServiceGetActivityProcedure = "/memos.api.v1.ActivityService/GetActivity" +) + +// ActivityServiceClient is a client for the memos.api.v1.ActivityService service. +type ActivityServiceClient interface { + // ListActivities returns a list of activities. + ListActivities(context.Context, *connect.Request[v1.ListActivitiesRequest]) (*connect.Response[v1.ListActivitiesResponse], error) + // GetActivity returns the activity with the given id. + GetActivity(context.Context, *connect.Request[v1.GetActivityRequest]) (*connect.Response[v1.Activity], error) +} + +// NewActivityServiceClient constructs a client for the memos.api.v1.ActivityService service. By +// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, +// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the +// connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewActivityServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ActivityServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + activityServiceMethods := v1.File_api_v1_activity_service_proto.Services().ByName("ActivityService").Methods() + return &activityServiceClient{ + listActivities: connect.NewClient[v1.ListActivitiesRequest, v1.ListActivitiesResponse]( + httpClient, + baseURL+ActivityServiceListActivitiesProcedure, + connect.WithSchema(activityServiceMethods.ByName("ListActivities")), + connect.WithClientOptions(opts...), + ), + getActivity: connect.NewClient[v1.GetActivityRequest, v1.Activity]( + httpClient, + baseURL+ActivityServiceGetActivityProcedure, + connect.WithSchema(activityServiceMethods.ByName("GetActivity")), + connect.WithClientOptions(opts...), + ), + } +} + +// activityServiceClient implements ActivityServiceClient. +type activityServiceClient struct { + listActivities *connect.Client[v1.ListActivitiesRequest, v1.ListActivitiesResponse] + getActivity *connect.Client[v1.GetActivityRequest, v1.Activity] +} + +// ListActivities calls memos.api.v1.ActivityService.ListActivities. +func (c *activityServiceClient) ListActivities(ctx context.Context, req *connect.Request[v1.ListActivitiesRequest]) (*connect.Response[v1.ListActivitiesResponse], error) { + return c.listActivities.CallUnary(ctx, req) +} + +// GetActivity calls memos.api.v1.ActivityService.GetActivity. +func (c *activityServiceClient) GetActivity(ctx context.Context, req *connect.Request[v1.GetActivityRequest]) (*connect.Response[v1.Activity], error) { + return c.getActivity.CallUnary(ctx, req) +} + +// ActivityServiceHandler is an implementation of the memos.api.v1.ActivityService service. +type ActivityServiceHandler interface { + // ListActivities returns a list of activities. + ListActivities(context.Context, *connect.Request[v1.ListActivitiesRequest]) (*connect.Response[v1.ListActivitiesResponse], error) + // GetActivity returns the activity with the given id. + GetActivity(context.Context, *connect.Request[v1.GetActivityRequest]) (*connect.Response[v1.Activity], error) +} + +// NewActivityServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewActivityServiceHandler(svc ActivityServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + activityServiceMethods := v1.File_api_v1_activity_service_proto.Services().ByName("ActivityService").Methods() + activityServiceListActivitiesHandler := connect.NewUnaryHandler( + ActivityServiceListActivitiesProcedure, + svc.ListActivities, + connect.WithSchema(activityServiceMethods.ByName("ListActivities")), + connect.WithHandlerOptions(opts...), + ) + activityServiceGetActivityHandler := connect.NewUnaryHandler( + ActivityServiceGetActivityProcedure, + svc.GetActivity, + connect.WithSchema(activityServiceMethods.ByName("GetActivity")), + connect.WithHandlerOptions(opts...), + ) + return "/memos.api.v1.ActivityService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ActivityServiceListActivitiesProcedure: + activityServiceListActivitiesHandler.ServeHTTP(w, r) + case ActivityServiceGetActivityProcedure: + activityServiceGetActivityHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedActivityServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedActivityServiceHandler struct{} + +func (UnimplementedActivityServiceHandler) ListActivities(context.Context, *connect.Request[v1.ListActivitiesRequest]) (*connect.Response[v1.ListActivitiesResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.ActivityService.ListActivities is not implemented")) +} + +func (UnimplementedActivityServiceHandler) GetActivity(context.Context, *connect.Request[v1.GetActivityRequest]) (*connect.Response[v1.Activity], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.ActivityService.GetActivity is not implemented")) +} diff --git a/proto/gen/api/v1/apiv1connect/attachment_service.connect.go b/proto/gen/api/v1/apiv1connect/attachment_service.connect.go new file mode 100644 index 000000000..ac68f7641 --- /dev/null +++ b/proto/gen/api/v1/apiv1connect/attachment_service.connect.go @@ -0,0 +1,236 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: api/v1/attachment_service.proto + +package apiv1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v1 "github.com/usememos/memos/proto/gen/api/v1" + emptypb "google.golang.org/protobuf/types/known/emptypb" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // AttachmentServiceName is the fully-qualified name of the AttachmentService service. + AttachmentServiceName = "memos.api.v1.AttachmentService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AttachmentServiceCreateAttachmentProcedure is the fully-qualified name of the AttachmentService's + // CreateAttachment RPC. + AttachmentServiceCreateAttachmentProcedure = "/memos.api.v1.AttachmentService/CreateAttachment" + // AttachmentServiceListAttachmentsProcedure is the fully-qualified name of the AttachmentService's + // ListAttachments RPC. + AttachmentServiceListAttachmentsProcedure = "/memos.api.v1.AttachmentService/ListAttachments" + // AttachmentServiceGetAttachmentProcedure is the fully-qualified name of the AttachmentService's + // GetAttachment RPC. + AttachmentServiceGetAttachmentProcedure = "/memos.api.v1.AttachmentService/GetAttachment" + // AttachmentServiceUpdateAttachmentProcedure is the fully-qualified name of the AttachmentService's + // UpdateAttachment RPC. + AttachmentServiceUpdateAttachmentProcedure = "/memos.api.v1.AttachmentService/UpdateAttachment" + // AttachmentServiceDeleteAttachmentProcedure is the fully-qualified name of the AttachmentService's + // DeleteAttachment RPC. + AttachmentServiceDeleteAttachmentProcedure = "/memos.api.v1.AttachmentService/DeleteAttachment" +) + +// AttachmentServiceClient is a client for the memos.api.v1.AttachmentService service. +type AttachmentServiceClient interface { + // CreateAttachment creates a new attachment. + CreateAttachment(context.Context, *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error) + // ListAttachments lists all attachments. + ListAttachments(context.Context, *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error) + // GetAttachment returns a attachment by name. + GetAttachment(context.Context, *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error) + // UpdateAttachment updates a attachment. + UpdateAttachment(context.Context, *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error) + // DeleteAttachment deletes a attachment by name. + DeleteAttachment(context.Context, *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) +} + +// NewAttachmentServiceClient constructs a client for the memos.api.v1.AttachmentService service. By +// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, +// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the +// connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewAttachmentServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) AttachmentServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + attachmentServiceMethods := v1.File_api_v1_attachment_service_proto.Services().ByName("AttachmentService").Methods() + return &attachmentServiceClient{ + createAttachment: connect.NewClient[v1.CreateAttachmentRequest, v1.Attachment]( + httpClient, + baseURL+AttachmentServiceCreateAttachmentProcedure, + connect.WithSchema(attachmentServiceMethods.ByName("CreateAttachment")), + connect.WithClientOptions(opts...), + ), + listAttachments: connect.NewClient[v1.ListAttachmentsRequest, v1.ListAttachmentsResponse]( + httpClient, + baseURL+AttachmentServiceListAttachmentsProcedure, + connect.WithSchema(attachmentServiceMethods.ByName("ListAttachments")), + connect.WithClientOptions(opts...), + ), + getAttachment: connect.NewClient[v1.GetAttachmentRequest, v1.Attachment]( + httpClient, + baseURL+AttachmentServiceGetAttachmentProcedure, + connect.WithSchema(attachmentServiceMethods.ByName("GetAttachment")), + connect.WithClientOptions(opts...), + ), + updateAttachment: connect.NewClient[v1.UpdateAttachmentRequest, v1.Attachment]( + httpClient, + baseURL+AttachmentServiceUpdateAttachmentProcedure, + connect.WithSchema(attachmentServiceMethods.ByName("UpdateAttachment")), + connect.WithClientOptions(opts...), + ), + deleteAttachment: connect.NewClient[v1.DeleteAttachmentRequest, emptypb.Empty]( + httpClient, + baseURL+AttachmentServiceDeleteAttachmentProcedure, + connect.WithSchema(attachmentServiceMethods.ByName("DeleteAttachment")), + connect.WithClientOptions(opts...), + ), + } +} + +// attachmentServiceClient implements AttachmentServiceClient. +type attachmentServiceClient struct { + createAttachment *connect.Client[v1.CreateAttachmentRequest, v1.Attachment] + listAttachments *connect.Client[v1.ListAttachmentsRequest, v1.ListAttachmentsResponse] + getAttachment *connect.Client[v1.GetAttachmentRequest, v1.Attachment] + updateAttachment *connect.Client[v1.UpdateAttachmentRequest, v1.Attachment] + deleteAttachment *connect.Client[v1.DeleteAttachmentRequest, emptypb.Empty] +} + +// CreateAttachment calls memos.api.v1.AttachmentService.CreateAttachment. +func (c *attachmentServiceClient) CreateAttachment(ctx context.Context, req *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error) { + return c.createAttachment.CallUnary(ctx, req) +} + +// ListAttachments calls memos.api.v1.AttachmentService.ListAttachments. +func (c *attachmentServiceClient) ListAttachments(ctx context.Context, req *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error) { + return c.listAttachments.CallUnary(ctx, req) +} + +// GetAttachment calls memos.api.v1.AttachmentService.GetAttachment. +func (c *attachmentServiceClient) GetAttachment(ctx context.Context, req *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error) { + return c.getAttachment.CallUnary(ctx, req) +} + +// UpdateAttachment calls memos.api.v1.AttachmentService.UpdateAttachment. +func (c *attachmentServiceClient) UpdateAttachment(ctx context.Context, req *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error) { + return c.updateAttachment.CallUnary(ctx, req) +} + +// DeleteAttachment calls memos.api.v1.AttachmentService.DeleteAttachment. +func (c *attachmentServiceClient) DeleteAttachment(ctx context.Context, req *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) { + return c.deleteAttachment.CallUnary(ctx, req) +} + +// AttachmentServiceHandler is an implementation of the memos.api.v1.AttachmentService service. +type AttachmentServiceHandler interface { + // CreateAttachment creates a new attachment. + CreateAttachment(context.Context, *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error) + // ListAttachments lists all attachments. + ListAttachments(context.Context, *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error) + // GetAttachment returns a attachment by name. + GetAttachment(context.Context, *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error) + // UpdateAttachment updates a attachment. + UpdateAttachment(context.Context, *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error) + // DeleteAttachment deletes a attachment by name. + DeleteAttachment(context.Context, *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) +} + +// NewAttachmentServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewAttachmentServiceHandler(svc AttachmentServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + attachmentServiceMethods := v1.File_api_v1_attachment_service_proto.Services().ByName("AttachmentService").Methods() + attachmentServiceCreateAttachmentHandler := connect.NewUnaryHandler( + AttachmentServiceCreateAttachmentProcedure, + svc.CreateAttachment, + connect.WithSchema(attachmentServiceMethods.ByName("CreateAttachment")), + connect.WithHandlerOptions(opts...), + ) + attachmentServiceListAttachmentsHandler := connect.NewUnaryHandler( + AttachmentServiceListAttachmentsProcedure, + svc.ListAttachments, + connect.WithSchema(attachmentServiceMethods.ByName("ListAttachments")), + connect.WithHandlerOptions(opts...), + ) + attachmentServiceGetAttachmentHandler := connect.NewUnaryHandler( + AttachmentServiceGetAttachmentProcedure, + svc.GetAttachment, + connect.WithSchema(attachmentServiceMethods.ByName("GetAttachment")), + connect.WithHandlerOptions(opts...), + ) + attachmentServiceUpdateAttachmentHandler := connect.NewUnaryHandler( + AttachmentServiceUpdateAttachmentProcedure, + svc.UpdateAttachment, + connect.WithSchema(attachmentServiceMethods.ByName("UpdateAttachment")), + connect.WithHandlerOptions(opts...), + ) + attachmentServiceDeleteAttachmentHandler := connect.NewUnaryHandler( + AttachmentServiceDeleteAttachmentProcedure, + svc.DeleteAttachment, + connect.WithSchema(attachmentServiceMethods.ByName("DeleteAttachment")), + connect.WithHandlerOptions(opts...), + ) + return "/memos.api.v1.AttachmentService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case AttachmentServiceCreateAttachmentProcedure: + attachmentServiceCreateAttachmentHandler.ServeHTTP(w, r) + case AttachmentServiceListAttachmentsProcedure: + attachmentServiceListAttachmentsHandler.ServeHTTP(w, r) + case AttachmentServiceGetAttachmentProcedure: + attachmentServiceGetAttachmentHandler.ServeHTTP(w, r) + case AttachmentServiceUpdateAttachmentProcedure: + attachmentServiceUpdateAttachmentHandler.ServeHTTP(w, r) + case AttachmentServiceDeleteAttachmentProcedure: + attachmentServiceDeleteAttachmentHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedAttachmentServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAttachmentServiceHandler struct{} + +func (UnimplementedAttachmentServiceHandler) CreateAttachment(context.Context, *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.CreateAttachment is not implemented")) +} + +func (UnimplementedAttachmentServiceHandler) ListAttachments(context.Context, *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.ListAttachments is not implemented")) +} + +func (UnimplementedAttachmentServiceHandler) GetAttachment(context.Context, *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.GetAttachment is not implemented")) +} + +func (UnimplementedAttachmentServiceHandler) UpdateAttachment(context.Context, *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.UpdateAttachment is not implemented")) +} + +func (UnimplementedAttachmentServiceHandler) DeleteAttachment(context.Context, *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.DeleteAttachment is not implemented")) +} diff --git a/proto/gen/api/v1/apiv1connect/auth_service.connect.go b/proto/gen/api/v1/apiv1connect/auth_service.connect.go new file mode 100644 index 000000000..536ff0eb0 --- /dev/null +++ b/proto/gen/api/v1/apiv1connect/auth_service.connect.go @@ -0,0 +1,180 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: api/v1/auth_service.proto + +package apiv1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v1 "github.com/usememos/memos/proto/gen/api/v1" + emptypb "google.golang.org/protobuf/types/known/emptypb" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // AuthServiceName is the fully-qualified name of the AuthService service. + AuthServiceName = "memos.api.v1.AuthService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AuthServiceGetCurrentSessionProcedure is the fully-qualified name of the AuthService's + // GetCurrentSession RPC. + AuthServiceGetCurrentSessionProcedure = "/memos.api.v1.AuthService/GetCurrentSession" + // AuthServiceCreateSessionProcedure is the fully-qualified name of the AuthService's CreateSession + // RPC. + AuthServiceCreateSessionProcedure = "/memos.api.v1.AuthService/CreateSession" + // AuthServiceDeleteSessionProcedure is the fully-qualified name of the AuthService's DeleteSession + // RPC. + AuthServiceDeleteSessionProcedure = "/memos.api.v1.AuthService/DeleteSession" +) + +// AuthServiceClient is a client for the memos.api.v1.AuthService service. +type AuthServiceClient interface { + // GetCurrentSession returns the current active session information. + // This method is idempotent and safe, suitable for checking current session state. + GetCurrentSession(context.Context, *connect.Request[v1.GetCurrentSessionRequest]) (*connect.Response[v1.GetCurrentSessionResponse], error) + // CreateSession authenticates a user and creates a new session. + // Returns the authenticated user information upon successful authentication. + CreateSession(context.Context, *connect.Request[v1.CreateSessionRequest]) (*connect.Response[v1.CreateSessionResponse], error) + // DeleteSession terminates the current user session. + // This is an idempotent operation that invalidates the user's authentication. + DeleteSession(context.Context, *connect.Request[v1.DeleteSessionRequest]) (*connect.Response[emptypb.Empty], error) +} + +// NewAuthServiceClient constructs a client for the memos.api.v1.AuthService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewAuthServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) AuthServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + authServiceMethods := v1.File_api_v1_auth_service_proto.Services().ByName("AuthService").Methods() + return &authServiceClient{ + getCurrentSession: connect.NewClient[v1.GetCurrentSessionRequest, v1.GetCurrentSessionResponse]( + httpClient, + baseURL+AuthServiceGetCurrentSessionProcedure, + connect.WithSchema(authServiceMethods.ByName("GetCurrentSession")), + connect.WithClientOptions(opts...), + ), + createSession: connect.NewClient[v1.CreateSessionRequest, v1.CreateSessionResponse]( + httpClient, + baseURL+AuthServiceCreateSessionProcedure, + connect.WithSchema(authServiceMethods.ByName("CreateSession")), + connect.WithClientOptions(opts...), + ), + deleteSession: connect.NewClient[v1.DeleteSessionRequest, emptypb.Empty]( + httpClient, + baseURL+AuthServiceDeleteSessionProcedure, + connect.WithSchema(authServiceMethods.ByName("DeleteSession")), + connect.WithClientOptions(opts...), + ), + } +} + +// authServiceClient implements AuthServiceClient. +type authServiceClient struct { + getCurrentSession *connect.Client[v1.GetCurrentSessionRequest, v1.GetCurrentSessionResponse] + createSession *connect.Client[v1.CreateSessionRequest, v1.CreateSessionResponse] + deleteSession *connect.Client[v1.DeleteSessionRequest, emptypb.Empty] +} + +// GetCurrentSession calls memos.api.v1.AuthService.GetCurrentSession. +func (c *authServiceClient) GetCurrentSession(ctx context.Context, req *connect.Request[v1.GetCurrentSessionRequest]) (*connect.Response[v1.GetCurrentSessionResponse], error) { + return c.getCurrentSession.CallUnary(ctx, req) +} + +// CreateSession calls memos.api.v1.AuthService.CreateSession. +func (c *authServiceClient) CreateSession(ctx context.Context, req *connect.Request[v1.CreateSessionRequest]) (*connect.Response[v1.CreateSessionResponse], error) { + return c.createSession.CallUnary(ctx, req) +} + +// DeleteSession calls memos.api.v1.AuthService.DeleteSession. +func (c *authServiceClient) DeleteSession(ctx context.Context, req *connect.Request[v1.DeleteSessionRequest]) (*connect.Response[emptypb.Empty], error) { + return c.deleteSession.CallUnary(ctx, req) +} + +// AuthServiceHandler is an implementation of the memos.api.v1.AuthService service. +type AuthServiceHandler interface { + // GetCurrentSession returns the current active session information. + // This method is idempotent and safe, suitable for checking current session state. + GetCurrentSession(context.Context, *connect.Request[v1.GetCurrentSessionRequest]) (*connect.Response[v1.GetCurrentSessionResponse], error) + // CreateSession authenticates a user and creates a new session. + // Returns the authenticated user information upon successful authentication. + CreateSession(context.Context, *connect.Request[v1.CreateSessionRequest]) (*connect.Response[v1.CreateSessionResponse], error) + // DeleteSession terminates the current user session. + // This is an idempotent operation that invalidates the user's authentication. + DeleteSession(context.Context, *connect.Request[v1.DeleteSessionRequest]) (*connect.Response[emptypb.Empty], error) +} + +// NewAuthServiceHandler builds an HTTP handler from the service implementation. It returns the path +// on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewAuthServiceHandler(svc AuthServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + authServiceMethods := v1.File_api_v1_auth_service_proto.Services().ByName("AuthService").Methods() + authServiceGetCurrentSessionHandler := connect.NewUnaryHandler( + AuthServiceGetCurrentSessionProcedure, + svc.GetCurrentSession, + connect.WithSchema(authServiceMethods.ByName("GetCurrentSession")), + connect.WithHandlerOptions(opts...), + ) + authServiceCreateSessionHandler := connect.NewUnaryHandler( + AuthServiceCreateSessionProcedure, + svc.CreateSession, + connect.WithSchema(authServiceMethods.ByName("CreateSession")), + connect.WithHandlerOptions(opts...), + ) + authServiceDeleteSessionHandler := connect.NewUnaryHandler( + AuthServiceDeleteSessionProcedure, + svc.DeleteSession, + connect.WithSchema(authServiceMethods.ByName("DeleteSession")), + connect.WithHandlerOptions(opts...), + ) + return "/memos.api.v1.AuthService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case AuthServiceGetCurrentSessionProcedure: + authServiceGetCurrentSessionHandler.ServeHTTP(w, r) + case AuthServiceCreateSessionProcedure: + authServiceCreateSessionHandler.ServeHTTP(w, r) + case AuthServiceDeleteSessionProcedure: + authServiceDeleteSessionHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedAuthServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAuthServiceHandler struct{} + +func (UnimplementedAuthServiceHandler) GetCurrentSession(context.Context, *connect.Request[v1.GetCurrentSessionRequest]) (*connect.Response[v1.GetCurrentSessionResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AuthService.GetCurrentSession is not implemented")) +} + +func (UnimplementedAuthServiceHandler) CreateSession(context.Context, *connect.Request[v1.CreateSessionRequest]) (*connect.Response[v1.CreateSessionResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AuthService.CreateSession is not implemented")) +} + +func (UnimplementedAuthServiceHandler) DeleteSession(context.Context, *connect.Request[v1.DeleteSessionRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AuthService.DeleteSession is not implemented")) +} diff --git a/proto/gen/api/v1/apiv1connect/idp_service.connect.go b/proto/gen/api/v1/apiv1connect/idp_service.connect.go new file mode 100644 index 000000000..d9111ba32 --- /dev/null +++ b/proto/gen/api/v1/apiv1connect/idp_service.connect.go @@ -0,0 +1,237 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: api/v1/idp_service.proto + +package apiv1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v1 "github.com/usememos/memos/proto/gen/api/v1" + emptypb "google.golang.org/protobuf/types/known/emptypb" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // IdentityProviderServiceName is the fully-qualified name of the IdentityProviderService service. + IdentityProviderServiceName = "memos.api.v1.IdentityProviderService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // IdentityProviderServiceListIdentityProvidersProcedure is the fully-qualified name of the + // IdentityProviderService's ListIdentityProviders RPC. + IdentityProviderServiceListIdentityProvidersProcedure = "/memos.api.v1.IdentityProviderService/ListIdentityProviders" + // IdentityProviderServiceGetIdentityProviderProcedure is the fully-qualified name of the + // IdentityProviderService's GetIdentityProvider RPC. + IdentityProviderServiceGetIdentityProviderProcedure = "/memos.api.v1.IdentityProviderService/GetIdentityProvider" + // IdentityProviderServiceCreateIdentityProviderProcedure is the fully-qualified name of the + // IdentityProviderService's CreateIdentityProvider RPC. + IdentityProviderServiceCreateIdentityProviderProcedure = "/memos.api.v1.IdentityProviderService/CreateIdentityProvider" + // IdentityProviderServiceUpdateIdentityProviderProcedure is the fully-qualified name of the + // IdentityProviderService's UpdateIdentityProvider RPC. + IdentityProviderServiceUpdateIdentityProviderProcedure = "/memos.api.v1.IdentityProviderService/UpdateIdentityProvider" + // IdentityProviderServiceDeleteIdentityProviderProcedure is the fully-qualified name of the + // IdentityProviderService's DeleteIdentityProvider RPC. + IdentityProviderServiceDeleteIdentityProviderProcedure = "/memos.api.v1.IdentityProviderService/DeleteIdentityProvider" +) + +// IdentityProviderServiceClient is a client for the memos.api.v1.IdentityProviderService service. +type IdentityProviderServiceClient interface { + // ListIdentityProviders lists identity providers. + ListIdentityProviders(context.Context, *connect.Request[v1.ListIdentityProvidersRequest]) (*connect.Response[v1.ListIdentityProvidersResponse], error) + // GetIdentityProvider gets an identity provider. + GetIdentityProvider(context.Context, *connect.Request[v1.GetIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) + // CreateIdentityProvider creates an identity provider. + CreateIdentityProvider(context.Context, *connect.Request[v1.CreateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) + // UpdateIdentityProvider updates an identity provider. + UpdateIdentityProvider(context.Context, *connect.Request[v1.UpdateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) + // DeleteIdentityProvider deletes an identity provider. + DeleteIdentityProvider(context.Context, *connect.Request[v1.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) +} + +// NewIdentityProviderServiceClient constructs a client for the memos.api.v1.IdentityProviderService +// service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for +// gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply +// the connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewIdentityProviderServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) IdentityProviderServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + identityProviderServiceMethods := v1.File_api_v1_idp_service_proto.Services().ByName("IdentityProviderService").Methods() + return &identityProviderServiceClient{ + listIdentityProviders: connect.NewClient[v1.ListIdentityProvidersRequest, v1.ListIdentityProvidersResponse]( + httpClient, + baseURL+IdentityProviderServiceListIdentityProvidersProcedure, + connect.WithSchema(identityProviderServiceMethods.ByName("ListIdentityProviders")), + connect.WithClientOptions(opts...), + ), + getIdentityProvider: connect.NewClient[v1.GetIdentityProviderRequest, v1.IdentityProvider]( + httpClient, + baseURL+IdentityProviderServiceGetIdentityProviderProcedure, + connect.WithSchema(identityProviderServiceMethods.ByName("GetIdentityProvider")), + connect.WithClientOptions(opts...), + ), + createIdentityProvider: connect.NewClient[v1.CreateIdentityProviderRequest, v1.IdentityProvider]( + httpClient, + baseURL+IdentityProviderServiceCreateIdentityProviderProcedure, + connect.WithSchema(identityProviderServiceMethods.ByName("CreateIdentityProvider")), + connect.WithClientOptions(opts...), + ), + updateIdentityProvider: connect.NewClient[v1.UpdateIdentityProviderRequest, v1.IdentityProvider]( + httpClient, + baseURL+IdentityProviderServiceUpdateIdentityProviderProcedure, + connect.WithSchema(identityProviderServiceMethods.ByName("UpdateIdentityProvider")), + connect.WithClientOptions(opts...), + ), + deleteIdentityProvider: connect.NewClient[v1.DeleteIdentityProviderRequest, emptypb.Empty]( + httpClient, + baseURL+IdentityProviderServiceDeleteIdentityProviderProcedure, + connect.WithSchema(identityProviderServiceMethods.ByName("DeleteIdentityProvider")), + connect.WithClientOptions(opts...), + ), + } +} + +// identityProviderServiceClient implements IdentityProviderServiceClient. +type identityProviderServiceClient struct { + listIdentityProviders *connect.Client[v1.ListIdentityProvidersRequest, v1.ListIdentityProvidersResponse] + getIdentityProvider *connect.Client[v1.GetIdentityProviderRequest, v1.IdentityProvider] + createIdentityProvider *connect.Client[v1.CreateIdentityProviderRequest, v1.IdentityProvider] + updateIdentityProvider *connect.Client[v1.UpdateIdentityProviderRequest, v1.IdentityProvider] + deleteIdentityProvider *connect.Client[v1.DeleteIdentityProviderRequest, emptypb.Empty] +} + +// ListIdentityProviders calls memos.api.v1.IdentityProviderService.ListIdentityProviders. +func (c *identityProviderServiceClient) ListIdentityProviders(ctx context.Context, req *connect.Request[v1.ListIdentityProvidersRequest]) (*connect.Response[v1.ListIdentityProvidersResponse], error) { + return c.listIdentityProviders.CallUnary(ctx, req) +} + +// GetIdentityProvider calls memos.api.v1.IdentityProviderService.GetIdentityProvider. +func (c *identityProviderServiceClient) GetIdentityProvider(ctx context.Context, req *connect.Request[v1.GetIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) { + return c.getIdentityProvider.CallUnary(ctx, req) +} + +// CreateIdentityProvider calls memos.api.v1.IdentityProviderService.CreateIdentityProvider. +func (c *identityProviderServiceClient) CreateIdentityProvider(ctx context.Context, req *connect.Request[v1.CreateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) { + return c.createIdentityProvider.CallUnary(ctx, req) +} + +// UpdateIdentityProvider calls memos.api.v1.IdentityProviderService.UpdateIdentityProvider. +func (c *identityProviderServiceClient) UpdateIdentityProvider(ctx context.Context, req *connect.Request[v1.UpdateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) { + return c.updateIdentityProvider.CallUnary(ctx, req) +} + +// DeleteIdentityProvider calls memos.api.v1.IdentityProviderService.DeleteIdentityProvider. +func (c *identityProviderServiceClient) DeleteIdentityProvider(ctx context.Context, req *connect.Request[v1.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) { + return c.deleteIdentityProvider.CallUnary(ctx, req) +} + +// IdentityProviderServiceHandler is an implementation of the memos.api.v1.IdentityProviderService +// service. +type IdentityProviderServiceHandler interface { + // ListIdentityProviders lists identity providers. + ListIdentityProviders(context.Context, *connect.Request[v1.ListIdentityProvidersRequest]) (*connect.Response[v1.ListIdentityProvidersResponse], error) + // GetIdentityProvider gets an identity provider. + GetIdentityProvider(context.Context, *connect.Request[v1.GetIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) + // CreateIdentityProvider creates an identity provider. + CreateIdentityProvider(context.Context, *connect.Request[v1.CreateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) + // UpdateIdentityProvider updates an identity provider. + UpdateIdentityProvider(context.Context, *connect.Request[v1.UpdateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) + // DeleteIdentityProvider deletes an identity provider. + DeleteIdentityProvider(context.Context, *connect.Request[v1.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) +} + +// NewIdentityProviderServiceHandler builds an HTTP handler from the service implementation. It +// returns the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewIdentityProviderServiceHandler(svc IdentityProviderServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + identityProviderServiceMethods := v1.File_api_v1_idp_service_proto.Services().ByName("IdentityProviderService").Methods() + identityProviderServiceListIdentityProvidersHandler := connect.NewUnaryHandler( + IdentityProviderServiceListIdentityProvidersProcedure, + svc.ListIdentityProviders, + connect.WithSchema(identityProviderServiceMethods.ByName("ListIdentityProviders")), + connect.WithHandlerOptions(opts...), + ) + identityProviderServiceGetIdentityProviderHandler := connect.NewUnaryHandler( + IdentityProviderServiceGetIdentityProviderProcedure, + svc.GetIdentityProvider, + connect.WithSchema(identityProviderServiceMethods.ByName("GetIdentityProvider")), + connect.WithHandlerOptions(opts...), + ) + identityProviderServiceCreateIdentityProviderHandler := connect.NewUnaryHandler( + IdentityProviderServiceCreateIdentityProviderProcedure, + svc.CreateIdentityProvider, + connect.WithSchema(identityProviderServiceMethods.ByName("CreateIdentityProvider")), + connect.WithHandlerOptions(opts...), + ) + identityProviderServiceUpdateIdentityProviderHandler := connect.NewUnaryHandler( + IdentityProviderServiceUpdateIdentityProviderProcedure, + svc.UpdateIdentityProvider, + connect.WithSchema(identityProviderServiceMethods.ByName("UpdateIdentityProvider")), + connect.WithHandlerOptions(opts...), + ) + identityProviderServiceDeleteIdentityProviderHandler := connect.NewUnaryHandler( + IdentityProviderServiceDeleteIdentityProviderProcedure, + svc.DeleteIdentityProvider, + connect.WithSchema(identityProviderServiceMethods.ByName("DeleteIdentityProvider")), + connect.WithHandlerOptions(opts...), + ) + return "/memos.api.v1.IdentityProviderService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case IdentityProviderServiceListIdentityProvidersProcedure: + identityProviderServiceListIdentityProvidersHandler.ServeHTTP(w, r) + case IdentityProviderServiceGetIdentityProviderProcedure: + identityProviderServiceGetIdentityProviderHandler.ServeHTTP(w, r) + case IdentityProviderServiceCreateIdentityProviderProcedure: + identityProviderServiceCreateIdentityProviderHandler.ServeHTTP(w, r) + case IdentityProviderServiceUpdateIdentityProviderProcedure: + identityProviderServiceUpdateIdentityProviderHandler.ServeHTTP(w, r) + case IdentityProviderServiceDeleteIdentityProviderProcedure: + identityProviderServiceDeleteIdentityProviderHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedIdentityProviderServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedIdentityProviderServiceHandler struct{} + +func (UnimplementedIdentityProviderServiceHandler) ListIdentityProviders(context.Context, *connect.Request[v1.ListIdentityProvidersRequest]) (*connect.Response[v1.ListIdentityProvidersResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.IdentityProviderService.ListIdentityProviders is not implemented")) +} + +func (UnimplementedIdentityProviderServiceHandler) GetIdentityProvider(context.Context, *connect.Request[v1.GetIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.IdentityProviderService.GetIdentityProvider is not implemented")) +} + +func (UnimplementedIdentityProviderServiceHandler) CreateIdentityProvider(context.Context, *connect.Request[v1.CreateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.IdentityProviderService.CreateIdentityProvider is not implemented")) +} + +func (UnimplementedIdentityProviderServiceHandler) UpdateIdentityProvider(context.Context, *connect.Request[v1.UpdateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.IdentityProviderService.UpdateIdentityProvider is not implemented")) +} + +func (UnimplementedIdentityProviderServiceHandler) DeleteIdentityProvider(context.Context, *connect.Request[v1.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.IdentityProviderService.DeleteIdentityProvider is not implemented")) +} diff --git a/proto/gen/api/v1/apiv1connect/instance_service.connect.go b/proto/gen/api/v1/apiv1connect/instance_service.connect.go new file mode 100644 index 000000000..83d4b7dd3 --- /dev/null +++ b/proto/gen/api/v1/apiv1connect/instance_service.connect.go @@ -0,0 +1,173 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: api/v1/instance_service.proto + +package apiv1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v1 "github.com/usememos/memos/proto/gen/api/v1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // InstanceServiceName is the fully-qualified name of the InstanceService service. + InstanceServiceName = "memos.api.v1.InstanceService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // InstanceServiceGetInstanceProfileProcedure is the fully-qualified name of the InstanceService's + // GetInstanceProfile RPC. + InstanceServiceGetInstanceProfileProcedure = "/memos.api.v1.InstanceService/GetInstanceProfile" + // InstanceServiceGetInstanceSettingProcedure is the fully-qualified name of the InstanceService's + // GetInstanceSetting RPC. + InstanceServiceGetInstanceSettingProcedure = "/memos.api.v1.InstanceService/GetInstanceSetting" + // InstanceServiceUpdateInstanceSettingProcedure is the fully-qualified name of the + // InstanceService's UpdateInstanceSetting RPC. + InstanceServiceUpdateInstanceSettingProcedure = "/memos.api.v1.InstanceService/UpdateInstanceSetting" +) + +// InstanceServiceClient is a client for the memos.api.v1.InstanceService service. +type InstanceServiceClient interface { + // Gets the instance profile. + GetInstanceProfile(context.Context, *connect.Request[v1.GetInstanceProfileRequest]) (*connect.Response[v1.InstanceProfile], error) + // Gets an instance setting. + GetInstanceSetting(context.Context, *connect.Request[v1.GetInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) + // Updates an instance setting. + UpdateInstanceSetting(context.Context, *connect.Request[v1.UpdateInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) +} + +// NewInstanceServiceClient constructs a client for the memos.api.v1.InstanceService service. By +// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, +// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the +// connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewInstanceServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) InstanceServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + instanceServiceMethods := v1.File_api_v1_instance_service_proto.Services().ByName("InstanceService").Methods() + return &instanceServiceClient{ + getInstanceProfile: connect.NewClient[v1.GetInstanceProfileRequest, v1.InstanceProfile]( + httpClient, + baseURL+InstanceServiceGetInstanceProfileProcedure, + connect.WithSchema(instanceServiceMethods.ByName("GetInstanceProfile")), + connect.WithClientOptions(opts...), + ), + getInstanceSetting: connect.NewClient[v1.GetInstanceSettingRequest, v1.InstanceSetting]( + httpClient, + baseURL+InstanceServiceGetInstanceSettingProcedure, + connect.WithSchema(instanceServiceMethods.ByName("GetInstanceSetting")), + connect.WithClientOptions(opts...), + ), + updateInstanceSetting: connect.NewClient[v1.UpdateInstanceSettingRequest, v1.InstanceSetting]( + httpClient, + baseURL+InstanceServiceUpdateInstanceSettingProcedure, + connect.WithSchema(instanceServiceMethods.ByName("UpdateInstanceSetting")), + connect.WithClientOptions(opts...), + ), + } +} + +// instanceServiceClient implements InstanceServiceClient. +type instanceServiceClient struct { + getInstanceProfile *connect.Client[v1.GetInstanceProfileRequest, v1.InstanceProfile] + getInstanceSetting *connect.Client[v1.GetInstanceSettingRequest, v1.InstanceSetting] + updateInstanceSetting *connect.Client[v1.UpdateInstanceSettingRequest, v1.InstanceSetting] +} + +// GetInstanceProfile calls memos.api.v1.InstanceService.GetInstanceProfile. +func (c *instanceServiceClient) GetInstanceProfile(ctx context.Context, req *connect.Request[v1.GetInstanceProfileRequest]) (*connect.Response[v1.InstanceProfile], error) { + return c.getInstanceProfile.CallUnary(ctx, req) +} + +// GetInstanceSetting calls memos.api.v1.InstanceService.GetInstanceSetting. +func (c *instanceServiceClient) GetInstanceSetting(ctx context.Context, req *connect.Request[v1.GetInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) { + return c.getInstanceSetting.CallUnary(ctx, req) +} + +// UpdateInstanceSetting calls memos.api.v1.InstanceService.UpdateInstanceSetting. +func (c *instanceServiceClient) UpdateInstanceSetting(ctx context.Context, req *connect.Request[v1.UpdateInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) { + return c.updateInstanceSetting.CallUnary(ctx, req) +} + +// InstanceServiceHandler is an implementation of the memos.api.v1.InstanceService service. +type InstanceServiceHandler interface { + // Gets the instance profile. + GetInstanceProfile(context.Context, *connect.Request[v1.GetInstanceProfileRequest]) (*connect.Response[v1.InstanceProfile], error) + // Gets an instance setting. + GetInstanceSetting(context.Context, *connect.Request[v1.GetInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) + // Updates an instance setting. + UpdateInstanceSetting(context.Context, *connect.Request[v1.UpdateInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) +} + +// NewInstanceServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewInstanceServiceHandler(svc InstanceServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + instanceServiceMethods := v1.File_api_v1_instance_service_proto.Services().ByName("InstanceService").Methods() + instanceServiceGetInstanceProfileHandler := connect.NewUnaryHandler( + InstanceServiceGetInstanceProfileProcedure, + svc.GetInstanceProfile, + connect.WithSchema(instanceServiceMethods.ByName("GetInstanceProfile")), + connect.WithHandlerOptions(opts...), + ) + instanceServiceGetInstanceSettingHandler := connect.NewUnaryHandler( + InstanceServiceGetInstanceSettingProcedure, + svc.GetInstanceSetting, + connect.WithSchema(instanceServiceMethods.ByName("GetInstanceSetting")), + connect.WithHandlerOptions(opts...), + ) + instanceServiceUpdateInstanceSettingHandler := connect.NewUnaryHandler( + InstanceServiceUpdateInstanceSettingProcedure, + svc.UpdateInstanceSetting, + connect.WithSchema(instanceServiceMethods.ByName("UpdateInstanceSetting")), + connect.WithHandlerOptions(opts...), + ) + return "/memos.api.v1.InstanceService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case InstanceServiceGetInstanceProfileProcedure: + instanceServiceGetInstanceProfileHandler.ServeHTTP(w, r) + case InstanceServiceGetInstanceSettingProcedure: + instanceServiceGetInstanceSettingHandler.ServeHTTP(w, r) + case InstanceServiceUpdateInstanceSettingProcedure: + instanceServiceUpdateInstanceSettingHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedInstanceServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedInstanceServiceHandler struct{} + +func (UnimplementedInstanceServiceHandler) GetInstanceProfile(context.Context, *connect.Request[v1.GetInstanceProfileRequest]) (*connect.Response[v1.InstanceProfile], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.InstanceService.GetInstanceProfile is not implemented")) +} + +func (UnimplementedInstanceServiceHandler) GetInstanceSetting(context.Context, *connect.Request[v1.GetInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.InstanceService.GetInstanceSetting is not implemented")) +} + +func (UnimplementedInstanceServiceHandler) UpdateInstanceSetting(context.Context, *connect.Request[v1.UpdateInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.InstanceService.UpdateInstanceSetting is not implemented")) +} diff --git a/proto/gen/api/v1/apiv1connect/memo_service.connect.go b/proto/gen/api/v1/apiv1connect/memo_service.connect.go new file mode 100644 index 000000000..6399154a2 --- /dev/null +++ b/proto/gen/api/v1/apiv1connect/memo_service.connect.go @@ -0,0 +1,510 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: api/v1/memo_service.proto + +package apiv1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v1 "github.com/usememos/memos/proto/gen/api/v1" + emptypb "google.golang.org/protobuf/types/known/emptypb" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // MemoServiceName is the fully-qualified name of the MemoService service. + MemoServiceName = "memos.api.v1.MemoService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // MemoServiceCreateMemoProcedure is the fully-qualified name of the MemoService's CreateMemo RPC. + MemoServiceCreateMemoProcedure = "/memos.api.v1.MemoService/CreateMemo" + // MemoServiceListMemosProcedure is the fully-qualified name of the MemoService's ListMemos RPC. + MemoServiceListMemosProcedure = "/memos.api.v1.MemoService/ListMemos" + // MemoServiceGetMemoProcedure is the fully-qualified name of the MemoService's GetMemo RPC. + MemoServiceGetMemoProcedure = "/memos.api.v1.MemoService/GetMemo" + // MemoServiceUpdateMemoProcedure is the fully-qualified name of the MemoService's UpdateMemo RPC. + MemoServiceUpdateMemoProcedure = "/memos.api.v1.MemoService/UpdateMemo" + // MemoServiceDeleteMemoProcedure is the fully-qualified name of the MemoService's DeleteMemo RPC. + MemoServiceDeleteMemoProcedure = "/memos.api.v1.MemoService/DeleteMemo" + // MemoServiceSetMemoAttachmentsProcedure is the fully-qualified name of the MemoService's + // SetMemoAttachments RPC. + MemoServiceSetMemoAttachmentsProcedure = "/memos.api.v1.MemoService/SetMemoAttachments" + // MemoServiceListMemoAttachmentsProcedure is the fully-qualified name of the MemoService's + // ListMemoAttachments RPC. + MemoServiceListMemoAttachmentsProcedure = "/memos.api.v1.MemoService/ListMemoAttachments" + // MemoServiceSetMemoRelationsProcedure is the fully-qualified name of the MemoService's + // SetMemoRelations RPC. + MemoServiceSetMemoRelationsProcedure = "/memos.api.v1.MemoService/SetMemoRelations" + // MemoServiceListMemoRelationsProcedure is the fully-qualified name of the MemoService's + // ListMemoRelations RPC. + MemoServiceListMemoRelationsProcedure = "/memos.api.v1.MemoService/ListMemoRelations" + // MemoServiceCreateMemoCommentProcedure is the fully-qualified name of the MemoService's + // CreateMemoComment RPC. + MemoServiceCreateMemoCommentProcedure = "/memos.api.v1.MemoService/CreateMemoComment" + // MemoServiceListMemoCommentsProcedure is the fully-qualified name of the MemoService's + // ListMemoComments RPC. + MemoServiceListMemoCommentsProcedure = "/memos.api.v1.MemoService/ListMemoComments" + // MemoServiceListMemoReactionsProcedure is the fully-qualified name of the MemoService's + // ListMemoReactions RPC. + MemoServiceListMemoReactionsProcedure = "/memos.api.v1.MemoService/ListMemoReactions" + // MemoServiceUpsertMemoReactionProcedure is the fully-qualified name of the MemoService's + // UpsertMemoReaction RPC. + MemoServiceUpsertMemoReactionProcedure = "/memos.api.v1.MemoService/UpsertMemoReaction" + // MemoServiceDeleteMemoReactionProcedure is the fully-qualified name of the MemoService's + // DeleteMemoReaction RPC. + MemoServiceDeleteMemoReactionProcedure = "/memos.api.v1.MemoService/DeleteMemoReaction" +) + +// MemoServiceClient is a client for the memos.api.v1.MemoService service. +type MemoServiceClient interface { + // CreateMemo creates a memo. + CreateMemo(context.Context, *connect.Request[v1.CreateMemoRequest]) (*connect.Response[v1.Memo], error) + // ListMemos lists memos with pagination and filter. + ListMemos(context.Context, *connect.Request[v1.ListMemosRequest]) (*connect.Response[v1.ListMemosResponse], error) + // GetMemo gets a memo. + GetMemo(context.Context, *connect.Request[v1.GetMemoRequest]) (*connect.Response[v1.Memo], error) + // UpdateMemo updates a memo. + UpdateMemo(context.Context, *connect.Request[v1.UpdateMemoRequest]) (*connect.Response[v1.Memo], error) + // DeleteMemo deletes a memo. + DeleteMemo(context.Context, *connect.Request[v1.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error) + // SetMemoAttachments sets attachments for a memo. + SetMemoAttachments(context.Context, *connect.Request[v1.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) + // ListMemoAttachments lists attachments for a memo. + ListMemoAttachments(context.Context, *connect.Request[v1.ListMemoAttachmentsRequest]) (*connect.Response[v1.ListMemoAttachmentsResponse], error) + // SetMemoRelations sets relations for a memo. + SetMemoRelations(context.Context, *connect.Request[v1.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error) + // ListMemoRelations lists relations for a memo. + ListMemoRelations(context.Context, *connect.Request[v1.ListMemoRelationsRequest]) (*connect.Response[v1.ListMemoRelationsResponse], error) + // CreateMemoComment creates a comment for a memo. + CreateMemoComment(context.Context, *connect.Request[v1.CreateMemoCommentRequest]) (*connect.Response[v1.Memo], error) + // ListMemoComments lists comments for a memo. + ListMemoComments(context.Context, *connect.Request[v1.ListMemoCommentsRequest]) (*connect.Response[v1.ListMemoCommentsResponse], error) + // ListMemoReactions lists reactions for a memo. + ListMemoReactions(context.Context, *connect.Request[v1.ListMemoReactionsRequest]) (*connect.Response[v1.ListMemoReactionsResponse], error) + // UpsertMemoReaction upserts a reaction for a memo. + UpsertMemoReaction(context.Context, *connect.Request[v1.UpsertMemoReactionRequest]) (*connect.Response[v1.Reaction], error) + // DeleteMemoReaction deletes a reaction for a memo. + DeleteMemoReaction(context.Context, *connect.Request[v1.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error) +} + +// NewMemoServiceClient constructs a client for the memos.api.v1.MemoService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewMemoServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) MemoServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + memoServiceMethods := v1.File_api_v1_memo_service_proto.Services().ByName("MemoService").Methods() + return &memoServiceClient{ + createMemo: connect.NewClient[v1.CreateMemoRequest, v1.Memo]( + httpClient, + baseURL+MemoServiceCreateMemoProcedure, + connect.WithSchema(memoServiceMethods.ByName("CreateMemo")), + connect.WithClientOptions(opts...), + ), + listMemos: connect.NewClient[v1.ListMemosRequest, v1.ListMemosResponse]( + httpClient, + baseURL+MemoServiceListMemosProcedure, + connect.WithSchema(memoServiceMethods.ByName("ListMemos")), + connect.WithClientOptions(opts...), + ), + getMemo: connect.NewClient[v1.GetMemoRequest, v1.Memo]( + httpClient, + baseURL+MemoServiceGetMemoProcedure, + connect.WithSchema(memoServiceMethods.ByName("GetMemo")), + connect.WithClientOptions(opts...), + ), + updateMemo: connect.NewClient[v1.UpdateMemoRequest, v1.Memo]( + httpClient, + baseURL+MemoServiceUpdateMemoProcedure, + connect.WithSchema(memoServiceMethods.ByName("UpdateMemo")), + connect.WithClientOptions(opts...), + ), + deleteMemo: connect.NewClient[v1.DeleteMemoRequest, emptypb.Empty]( + httpClient, + baseURL+MemoServiceDeleteMemoProcedure, + connect.WithSchema(memoServiceMethods.ByName("DeleteMemo")), + connect.WithClientOptions(opts...), + ), + setMemoAttachments: connect.NewClient[v1.SetMemoAttachmentsRequest, emptypb.Empty]( + httpClient, + baseURL+MemoServiceSetMemoAttachmentsProcedure, + connect.WithSchema(memoServiceMethods.ByName("SetMemoAttachments")), + connect.WithClientOptions(opts...), + ), + listMemoAttachments: connect.NewClient[v1.ListMemoAttachmentsRequest, v1.ListMemoAttachmentsResponse]( + httpClient, + baseURL+MemoServiceListMemoAttachmentsProcedure, + connect.WithSchema(memoServiceMethods.ByName("ListMemoAttachments")), + connect.WithClientOptions(opts...), + ), + setMemoRelations: connect.NewClient[v1.SetMemoRelationsRequest, emptypb.Empty]( + httpClient, + baseURL+MemoServiceSetMemoRelationsProcedure, + connect.WithSchema(memoServiceMethods.ByName("SetMemoRelations")), + connect.WithClientOptions(opts...), + ), + listMemoRelations: connect.NewClient[v1.ListMemoRelationsRequest, v1.ListMemoRelationsResponse]( + httpClient, + baseURL+MemoServiceListMemoRelationsProcedure, + connect.WithSchema(memoServiceMethods.ByName("ListMemoRelations")), + connect.WithClientOptions(opts...), + ), + createMemoComment: connect.NewClient[v1.CreateMemoCommentRequest, v1.Memo]( + httpClient, + baseURL+MemoServiceCreateMemoCommentProcedure, + connect.WithSchema(memoServiceMethods.ByName("CreateMemoComment")), + connect.WithClientOptions(opts...), + ), + listMemoComments: connect.NewClient[v1.ListMemoCommentsRequest, v1.ListMemoCommentsResponse]( + httpClient, + baseURL+MemoServiceListMemoCommentsProcedure, + connect.WithSchema(memoServiceMethods.ByName("ListMemoComments")), + connect.WithClientOptions(opts...), + ), + listMemoReactions: connect.NewClient[v1.ListMemoReactionsRequest, v1.ListMemoReactionsResponse]( + httpClient, + baseURL+MemoServiceListMemoReactionsProcedure, + connect.WithSchema(memoServiceMethods.ByName("ListMemoReactions")), + connect.WithClientOptions(opts...), + ), + upsertMemoReaction: connect.NewClient[v1.UpsertMemoReactionRequest, v1.Reaction]( + httpClient, + baseURL+MemoServiceUpsertMemoReactionProcedure, + connect.WithSchema(memoServiceMethods.ByName("UpsertMemoReaction")), + connect.WithClientOptions(opts...), + ), + deleteMemoReaction: connect.NewClient[v1.DeleteMemoReactionRequest, emptypb.Empty]( + httpClient, + baseURL+MemoServiceDeleteMemoReactionProcedure, + connect.WithSchema(memoServiceMethods.ByName("DeleteMemoReaction")), + connect.WithClientOptions(opts...), + ), + } +} + +// memoServiceClient implements MemoServiceClient. +type memoServiceClient struct { + createMemo *connect.Client[v1.CreateMemoRequest, v1.Memo] + listMemos *connect.Client[v1.ListMemosRequest, v1.ListMemosResponse] + getMemo *connect.Client[v1.GetMemoRequest, v1.Memo] + updateMemo *connect.Client[v1.UpdateMemoRequest, v1.Memo] + deleteMemo *connect.Client[v1.DeleteMemoRequest, emptypb.Empty] + setMemoAttachments *connect.Client[v1.SetMemoAttachmentsRequest, emptypb.Empty] + listMemoAttachments *connect.Client[v1.ListMemoAttachmentsRequest, v1.ListMemoAttachmentsResponse] + setMemoRelations *connect.Client[v1.SetMemoRelationsRequest, emptypb.Empty] + listMemoRelations *connect.Client[v1.ListMemoRelationsRequest, v1.ListMemoRelationsResponse] + createMemoComment *connect.Client[v1.CreateMemoCommentRequest, v1.Memo] + listMemoComments *connect.Client[v1.ListMemoCommentsRequest, v1.ListMemoCommentsResponse] + listMemoReactions *connect.Client[v1.ListMemoReactionsRequest, v1.ListMemoReactionsResponse] + upsertMemoReaction *connect.Client[v1.UpsertMemoReactionRequest, v1.Reaction] + deleteMemoReaction *connect.Client[v1.DeleteMemoReactionRequest, emptypb.Empty] +} + +// CreateMemo calls memos.api.v1.MemoService.CreateMemo. +func (c *memoServiceClient) CreateMemo(ctx context.Context, req *connect.Request[v1.CreateMemoRequest]) (*connect.Response[v1.Memo], error) { + return c.createMemo.CallUnary(ctx, req) +} + +// ListMemos calls memos.api.v1.MemoService.ListMemos. +func (c *memoServiceClient) ListMemos(ctx context.Context, req *connect.Request[v1.ListMemosRequest]) (*connect.Response[v1.ListMemosResponse], error) { + return c.listMemos.CallUnary(ctx, req) +} + +// GetMemo calls memos.api.v1.MemoService.GetMemo. +func (c *memoServiceClient) GetMemo(ctx context.Context, req *connect.Request[v1.GetMemoRequest]) (*connect.Response[v1.Memo], error) { + return c.getMemo.CallUnary(ctx, req) +} + +// UpdateMemo calls memos.api.v1.MemoService.UpdateMemo. +func (c *memoServiceClient) UpdateMemo(ctx context.Context, req *connect.Request[v1.UpdateMemoRequest]) (*connect.Response[v1.Memo], error) { + return c.updateMemo.CallUnary(ctx, req) +} + +// DeleteMemo calls memos.api.v1.MemoService.DeleteMemo. +func (c *memoServiceClient) DeleteMemo(ctx context.Context, req *connect.Request[v1.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error) { + return c.deleteMemo.CallUnary(ctx, req) +} + +// SetMemoAttachments calls memos.api.v1.MemoService.SetMemoAttachments. +func (c *memoServiceClient) SetMemoAttachments(ctx context.Context, req *connect.Request[v1.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) { + return c.setMemoAttachments.CallUnary(ctx, req) +} + +// ListMemoAttachments calls memos.api.v1.MemoService.ListMemoAttachments. +func (c *memoServiceClient) ListMemoAttachments(ctx context.Context, req *connect.Request[v1.ListMemoAttachmentsRequest]) (*connect.Response[v1.ListMemoAttachmentsResponse], error) { + return c.listMemoAttachments.CallUnary(ctx, req) +} + +// SetMemoRelations calls memos.api.v1.MemoService.SetMemoRelations. +func (c *memoServiceClient) SetMemoRelations(ctx context.Context, req *connect.Request[v1.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error) { + return c.setMemoRelations.CallUnary(ctx, req) +} + +// ListMemoRelations calls memos.api.v1.MemoService.ListMemoRelations. +func (c *memoServiceClient) ListMemoRelations(ctx context.Context, req *connect.Request[v1.ListMemoRelationsRequest]) (*connect.Response[v1.ListMemoRelationsResponse], error) { + return c.listMemoRelations.CallUnary(ctx, req) +} + +// CreateMemoComment calls memos.api.v1.MemoService.CreateMemoComment. +func (c *memoServiceClient) CreateMemoComment(ctx context.Context, req *connect.Request[v1.CreateMemoCommentRequest]) (*connect.Response[v1.Memo], error) { + return c.createMemoComment.CallUnary(ctx, req) +} + +// ListMemoComments calls memos.api.v1.MemoService.ListMemoComments. +func (c *memoServiceClient) ListMemoComments(ctx context.Context, req *connect.Request[v1.ListMemoCommentsRequest]) (*connect.Response[v1.ListMemoCommentsResponse], error) { + return c.listMemoComments.CallUnary(ctx, req) +} + +// ListMemoReactions calls memos.api.v1.MemoService.ListMemoReactions. +func (c *memoServiceClient) ListMemoReactions(ctx context.Context, req *connect.Request[v1.ListMemoReactionsRequest]) (*connect.Response[v1.ListMemoReactionsResponse], error) { + return c.listMemoReactions.CallUnary(ctx, req) +} + +// UpsertMemoReaction calls memos.api.v1.MemoService.UpsertMemoReaction. +func (c *memoServiceClient) UpsertMemoReaction(ctx context.Context, req *connect.Request[v1.UpsertMemoReactionRequest]) (*connect.Response[v1.Reaction], error) { + return c.upsertMemoReaction.CallUnary(ctx, req) +} + +// DeleteMemoReaction calls memos.api.v1.MemoService.DeleteMemoReaction. +func (c *memoServiceClient) DeleteMemoReaction(ctx context.Context, req *connect.Request[v1.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error) { + return c.deleteMemoReaction.CallUnary(ctx, req) +} + +// MemoServiceHandler is an implementation of the memos.api.v1.MemoService service. +type MemoServiceHandler interface { + // CreateMemo creates a memo. + CreateMemo(context.Context, *connect.Request[v1.CreateMemoRequest]) (*connect.Response[v1.Memo], error) + // ListMemos lists memos with pagination and filter. + ListMemos(context.Context, *connect.Request[v1.ListMemosRequest]) (*connect.Response[v1.ListMemosResponse], error) + // GetMemo gets a memo. + GetMemo(context.Context, *connect.Request[v1.GetMemoRequest]) (*connect.Response[v1.Memo], error) + // UpdateMemo updates a memo. + UpdateMemo(context.Context, *connect.Request[v1.UpdateMemoRequest]) (*connect.Response[v1.Memo], error) + // DeleteMemo deletes a memo. + DeleteMemo(context.Context, *connect.Request[v1.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error) + // SetMemoAttachments sets attachments for a memo. + SetMemoAttachments(context.Context, *connect.Request[v1.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) + // ListMemoAttachments lists attachments for a memo. + ListMemoAttachments(context.Context, *connect.Request[v1.ListMemoAttachmentsRequest]) (*connect.Response[v1.ListMemoAttachmentsResponse], error) + // SetMemoRelations sets relations for a memo. + SetMemoRelations(context.Context, *connect.Request[v1.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error) + // ListMemoRelations lists relations for a memo. + ListMemoRelations(context.Context, *connect.Request[v1.ListMemoRelationsRequest]) (*connect.Response[v1.ListMemoRelationsResponse], error) + // CreateMemoComment creates a comment for a memo. + CreateMemoComment(context.Context, *connect.Request[v1.CreateMemoCommentRequest]) (*connect.Response[v1.Memo], error) + // ListMemoComments lists comments for a memo. + ListMemoComments(context.Context, *connect.Request[v1.ListMemoCommentsRequest]) (*connect.Response[v1.ListMemoCommentsResponse], error) + // ListMemoReactions lists reactions for a memo. + ListMemoReactions(context.Context, *connect.Request[v1.ListMemoReactionsRequest]) (*connect.Response[v1.ListMemoReactionsResponse], error) + // UpsertMemoReaction upserts a reaction for a memo. + UpsertMemoReaction(context.Context, *connect.Request[v1.UpsertMemoReactionRequest]) (*connect.Response[v1.Reaction], error) + // DeleteMemoReaction deletes a reaction for a memo. + DeleteMemoReaction(context.Context, *connect.Request[v1.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error) +} + +// NewMemoServiceHandler builds an HTTP handler from the service implementation. It returns the path +// on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewMemoServiceHandler(svc MemoServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + memoServiceMethods := v1.File_api_v1_memo_service_proto.Services().ByName("MemoService").Methods() + memoServiceCreateMemoHandler := connect.NewUnaryHandler( + MemoServiceCreateMemoProcedure, + svc.CreateMemo, + connect.WithSchema(memoServiceMethods.ByName("CreateMemo")), + connect.WithHandlerOptions(opts...), + ) + memoServiceListMemosHandler := connect.NewUnaryHandler( + MemoServiceListMemosProcedure, + svc.ListMemos, + connect.WithSchema(memoServiceMethods.ByName("ListMemos")), + connect.WithHandlerOptions(opts...), + ) + memoServiceGetMemoHandler := connect.NewUnaryHandler( + MemoServiceGetMemoProcedure, + svc.GetMemo, + connect.WithSchema(memoServiceMethods.ByName("GetMemo")), + connect.WithHandlerOptions(opts...), + ) + memoServiceUpdateMemoHandler := connect.NewUnaryHandler( + MemoServiceUpdateMemoProcedure, + svc.UpdateMemo, + connect.WithSchema(memoServiceMethods.ByName("UpdateMemo")), + connect.WithHandlerOptions(opts...), + ) + memoServiceDeleteMemoHandler := connect.NewUnaryHandler( + MemoServiceDeleteMemoProcedure, + svc.DeleteMemo, + connect.WithSchema(memoServiceMethods.ByName("DeleteMemo")), + connect.WithHandlerOptions(opts...), + ) + memoServiceSetMemoAttachmentsHandler := connect.NewUnaryHandler( + MemoServiceSetMemoAttachmentsProcedure, + svc.SetMemoAttachments, + connect.WithSchema(memoServiceMethods.ByName("SetMemoAttachments")), + connect.WithHandlerOptions(opts...), + ) + memoServiceListMemoAttachmentsHandler := connect.NewUnaryHandler( + MemoServiceListMemoAttachmentsProcedure, + svc.ListMemoAttachments, + connect.WithSchema(memoServiceMethods.ByName("ListMemoAttachments")), + connect.WithHandlerOptions(opts...), + ) + memoServiceSetMemoRelationsHandler := connect.NewUnaryHandler( + MemoServiceSetMemoRelationsProcedure, + svc.SetMemoRelations, + connect.WithSchema(memoServiceMethods.ByName("SetMemoRelations")), + connect.WithHandlerOptions(opts...), + ) + memoServiceListMemoRelationsHandler := connect.NewUnaryHandler( + MemoServiceListMemoRelationsProcedure, + svc.ListMemoRelations, + connect.WithSchema(memoServiceMethods.ByName("ListMemoRelations")), + connect.WithHandlerOptions(opts...), + ) + memoServiceCreateMemoCommentHandler := connect.NewUnaryHandler( + MemoServiceCreateMemoCommentProcedure, + svc.CreateMemoComment, + connect.WithSchema(memoServiceMethods.ByName("CreateMemoComment")), + connect.WithHandlerOptions(opts...), + ) + memoServiceListMemoCommentsHandler := connect.NewUnaryHandler( + MemoServiceListMemoCommentsProcedure, + svc.ListMemoComments, + connect.WithSchema(memoServiceMethods.ByName("ListMemoComments")), + connect.WithHandlerOptions(opts...), + ) + memoServiceListMemoReactionsHandler := connect.NewUnaryHandler( + MemoServiceListMemoReactionsProcedure, + svc.ListMemoReactions, + connect.WithSchema(memoServiceMethods.ByName("ListMemoReactions")), + connect.WithHandlerOptions(opts...), + ) + memoServiceUpsertMemoReactionHandler := connect.NewUnaryHandler( + MemoServiceUpsertMemoReactionProcedure, + svc.UpsertMemoReaction, + connect.WithSchema(memoServiceMethods.ByName("UpsertMemoReaction")), + connect.WithHandlerOptions(opts...), + ) + memoServiceDeleteMemoReactionHandler := connect.NewUnaryHandler( + MemoServiceDeleteMemoReactionProcedure, + svc.DeleteMemoReaction, + connect.WithSchema(memoServiceMethods.ByName("DeleteMemoReaction")), + connect.WithHandlerOptions(opts...), + ) + return "/memos.api.v1.MemoService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case MemoServiceCreateMemoProcedure: + memoServiceCreateMemoHandler.ServeHTTP(w, r) + case MemoServiceListMemosProcedure: + memoServiceListMemosHandler.ServeHTTP(w, r) + case MemoServiceGetMemoProcedure: + memoServiceGetMemoHandler.ServeHTTP(w, r) + case MemoServiceUpdateMemoProcedure: + memoServiceUpdateMemoHandler.ServeHTTP(w, r) + case MemoServiceDeleteMemoProcedure: + memoServiceDeleteMemoHandler.ServeHTTP(w, r) + case MemoServiceSetMemoAttachmentsProcedure: + memoServiceSetMemoAttachmentsHandler.ServeHTTP(w, r) + case MemoServiceListMemoAttachmentsProcedure: + memoServiceListMemoAttachmentsHandler.ServeHTTP(w, r) + case MemoServiceSetMemoRelationsProcedure: + memoServiceSetMemoRelationsHandler.ServeHTTP(w, r) + case MemoServiceListMemoRelationsProcedure: + memoServiceListMemoRelationsHandler.ServeHTTP(w, r) + case MemoServiceCreateMemoCommentProcedure: + memoServiceCreateMemoCommentHandler.ServeHTTP(w, r) + case MemoServiceListMemoCommentsProcedure: + memoServiceListMemoCommentsHandler.ServeHTTP(w, r) + case MemoServiceListMemoReactionsProcedure: + memoServiceListMemoReactionsHandler.ServeHTTP(w, r) + case MemoServiceUpsertMemoReactionProcedure: + memoServiceUpsertMemoReactionHandler.ServeHTTP(w, r) + case MemoServiceDeleteMemoReactionProcedure: + memoServiceDeleteMemoReactionHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedMemoServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedMemoServiceHandler struct{} + +func (UnimplementedMemoServiceHandler) CreateMemo(context.Context, *connect.Request[v1.CreateMemoRequest]) (*connect.Response[v1.Memo], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.CreateMemo is not implemented")) +} + +func (UnimplementedMemoServiceHandler) ListMemos(context.Context, *connect.Request[v1.ListMemosRequest]) (*connect.Response[v1.ListMemosResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.ListMemos is not implemented")) +} + +func (UnimplementedMemoServiceHandler) GetMemo(context.Context, *connect.Request[v1.GetMemoRequest]) (*connect.Response[v1.Memo], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.GetMemo is not implemented")) +} + +func (UnimplementedMemoServiceHandler) UpdateMemo(context.Context, *connect.Request[v1.UpdateMemoRequest]) (*connect.Response[v1.Memo], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.UpdateMemo is not implemented")) +} + +func (UnimplementedMemoServiceHandler) DeleteMemo(context.Context, *connect.Request[v1.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.DeleteMemo is not implemented")) +} + +func (UnimplementedMemoServiceHandler) SetMemoAttachments(context.Context, *connect.Request[v1.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.SetMemoAttachments is not implemented")) +} + +func (UnimplementedMemoServiceHandler) ListMemoAttachments(context.Context, *connect.Request[v1.ListMemoAttachmentsRequest]) (*connect.Response[v1.ListMemoAttachmentsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.ListMemoAttachments is not implemented")) +} + +func (UnimplementedMemoServiceHandler) SetMemoRelations(context.Context, *connect.Request[v1.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.SetMemoRelations is not implemented")) +} + +func (UnimplementedMemoServiceHandler) ListMemoRelations(context.Context, *connect.Request[v1.ListMemoRelationsRequest]) (*connect.Response[v1.ListMemoRelationsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.ListMemoRelations is not implemented")) +} + +func (UnimplementedMemoServiceHandler) CreateMemoComment(context.Context, *connect.Request[v1.CreateMemoCommentRequest]) (*connect.Response[v1.Memo], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.CreateMemoComment is not implemented")) +} + +func (UnimplementedMemoServiceHandler) ListMemoComments(context.Context, *connect.Request[v1.ListMemoCommentsRequest]) (*connect.Response[v1.ListMemoCommentsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.ListMemoComments is not implemented")) +} + +func (UnimplementedMemoServiceHandler) ListMemoReactions(context.Context, *connect.Request[v1.ListMemoReactionsRequest]) (*connect.Response[v1.ListMemoReactionsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.ListMemoReactions is not implemented")) +} + +func (UnimplementedMemoServiceHandler) UpsertMemoReaction(context.Context, *connect.Request[v1.UpsertMemoReactionRequest]) (*connect.Response[v1.Reaction], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.UpsertMemoReaction is not implemented")) +} + +func (UnimplementedMemoServiceHandler) DeleteMemoReaction(context.Context, *connect.Request[v1.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.DeleteMemoReaction is not implemented")) +} diff --git a/proto/gen/api/v1/apiv1connect/shortcut_service.connect.go b/proto/gen/api/v1/apiv1connect/shortcut_service.connect.go new file mode 100644 index 000000000..7d97c3fe4 --- /dev/null +++ b/proto/gen/api/v1/apiv1connect/shortcut_service.connect.go @@ -0,0 +1,236 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: api/v1/shortcut_service.proto + +package apiv1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v1 "github.com/usememos/memos/proto/gen/api/v1" + emptypb "google.golang.org/protobuf/types/known/emptypb" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // ShortcutServiceName is the fully-qualified name of the ShortcutService service. + ShortcutServiceName = "memos.api.v1.ShortcutService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ShortcutServiceListShortcutsProcedure is the fully-qualified name of the ShortcutService's + // ListShortcuts RPC. + ShortcutServiceListShortcutsProcedure = "/memos.api.v1.ShortcutService/ListShortcuts" + // ShortcutServiceGetShortcutProcedure is the fully-qualified name of the ShortcutService's + // GetShortcut RPC. + ShortcutServiceGetShortcutProcedure = "/memos.api.v1.ShortcutService/GetShortcut" + // ShortcutServiceCreateShortcutProcedure is the fully-qualified name of the ShortcutService's + // CreateShortcut RPC. + ShortcutServiceCreateShortcutProcedure = "/memos.api.v1.ShortcutService/CreateShortcut" + // ShortcutServiceUpdateShortcutProcedure is the fully-qualified name of the ShortcutService's + // UpdateShortcut RPC. + ShortcutServiceUpdateShortcutProcedure = "/memos.api.v1.ShortcutService/UpdateShortcut" + // ShortcutServiceDeleteShortcutProcedure is the fully-qualified name of the ShortcutService's + // DeleteShortcut RPC. + ShortcutServiceDeleteShortcutProcedure = "/memos.api.v1.ShortcutService/DeleteShortcut" +) + +// ShortcutServiceClient is a client for the memos.api.v1.ShortcutService service. +type ShortcutServiceClient interface { + // ListShortcuts returns a list of shortcuts for a user. + ListShortcuts(context.Context, *connect.Request[v1.ListShortcutsRequest]) (*connect.Response[v1.ListShortcutsResponse], error) + // GetShortcut gets a shortcut by name. + GetShortcut(context.Context, *connect.Request[v1.GetShortcutRequest]) (*connect.Response[v1.Shortcut], error) + // CreateShortcut creates a new shortcut for a user. + CreateShortcut(context.Context, *connect.Request[v1.CreateShortcutRequest]) (*connect.Response[v1.Shortcut], error) + // UpdateShortcut updates a shortcut for a user. + UpdateShortcut(context.Context, *connect.Request[v1.UpdateShortcutRequest]) (*connect.Response[v1.Shortcut], error) + // DeleteShortcut deletes a shortcut for a user. + DeleteShortcut(context.Context, *connect.Request[v1.DeleteShortcutRequest]) (*connect.Response[emptypb.Empty], error) +} + +// NewShortcutServiceClient constructs a client for the memos.api.v1.ShortcutService service. By +// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, +// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the +// connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewShortcutServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ShortcutServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + shortcutServiceMethods := v1.File_api_v1_shortcut_service_proto.Services().ByName("ShortcutService").Methods() + return &shortcutServiceClient{ + listShortcuts: connect.NewClient[v1.ListShortcutsRequest, v1.ListShortcutsResponse]( + httpClient, + baseURL+ShortcutServiceListShortcutsProcedure, + connect.WithSchema(shortcutServiceMethods.ByName("ListShortcuts")), + connect.WithClientOptions(opts...), + ), + getShortcut: connect.NewClient[v1.GetShortcutRequest, v1.Shortcut]( + httpClient, + baseURL+ShortcutServiceGetShortcutProcedure, + connect.WithSchema(shortcutServiceMethods.ByName("GetShortcut")), + connect.WithClientOptions(opts...), + ), + createShortcut: connect.NewClient[v1.CreateShortcutRequest, v1.Shortcut]( + httpClient, + baseURL+ShortcutServiceCreateShortcutProcedure, + connect.WithSchema(shortcutServiceMethods.ByName("CreateShortcut")), + connect.WithClientOptions(opts...), + ), + updateShortcut: connect.NewClient[v1.UpdateShortcutRequest, v1.Shortcut]( + httpClient, + baseURL+ShortcutServiceUpdateShortcutProcedure, + connect.WithSchema(shortcutServiceMethods.ByName("UpdateShortcut")), + connect.WithClientOptions(opts...), + ), + deleteShortcut: connect.NewClient[v1.DeleteShortcutRequest, emptypb.Empty]( + httpClient, + baseURL+ShortcutServiceDeleteShortcutProcedure, + connect.WithSchema(shortcutServiceMethods.ByName("DeleteShortcut")), + connect.WithClientOptions(opts...), + ), + } +} + +// shortcutServiceClient implements ShortcutServiceClient. +type shortcutServiceClient struct { + listShortcuts *connect.Client[v1.ListShortcutsRequest, v1.ListShortcutsResponse] + getShortcut *connect.Client[v1.GetShortcutRequest, v1.Shortcut] + createShortcut *connect.Client[v1.CreateShortcutRequest, v1.Shortcut] + updateShortcut *connect.Client[v1.UpdateShortcutRequest, v1.Shortcut] + deleteShortcut *connect.Client[v1.DeleteShortcutRequest, emptypb.Empty] +} + +// ListShortcuts calls memos.api.v1.ShortcutService.ListShortcuts. +func (c *shortcutServiceClient) ListShortcuts(ctx context.Context, req *connect.Request[v1.ListShortcutsRequest]) (*connect.Response[v1.ListShortcutsResponse], error) { + return c.listShortcuts.CallUnary(ctx, req) +} + +// GetShortcut calls memos.api.v1.ShortcutService.GetShortcut. +func (c *shortcutServiceClient) GetShortcut(ctx context.Context, req *connect.Request[v1.GetShortcutRequest]) (*connect.Response[v1.Shortcut], error) { + return c.getShortcut.CallUnary(ctx, req) +} + +// CreateShortcut calls memos.api.v1.ShortcutService.CreateShortcut. +func (c *shortcutServiceClient) CreateShortcut(ctx context.Context, req *connect.Request[v1.CreateShortcutRequest]) (*connect.Response[v1.Shortcut], error) { + return c.createShortcut.CallUnary(ctx, req) +} + +// UpdateShortcut calls memos.api.v1.ShortcutService.UpdateShortcut. +func (c *shortcutServiceClient) UpdateShortcut(ctx context.Context, req *connect.Request[v1.UpdateShortcutRequest]) (*connect.Response[v1.Shortcut], error) { + return c.updateShortcut.CallUnary(ctx, req) +} + +// DeleteShortcut calls memos.api.v1.ShortcutService.DeleteShortcut. +func (c *shortcutServiceClient) DeleteShortcut(ctx context.Context, req *connect.Request[v1.DeleteShortcutRequest]) (*connect.Response[emptypb.Empty], error) { + return c.deleteShortcut.CallUnary(ctx, req) +} + +// ShortcutServiceHandler is an implementation of the memos.api.v1.ShortcutService service. +type ShortcutServiceHandler interface { + // ListShortcuts returns a list of shortcuts for a user. + ListShortcuts(context.Context, *connect.Request[v1.ListShortcutsRequest]) (*connect.Response[v1.ListShortcutsResponse], error) + // GetShortcut gets a shortcut by name. + GetShortcut(context.Context, *connect.Request[v1.GetShortcutRequest]) (*connect.Response[v1.Shortcut], error) + // CreateShortcut creates a new shortcut for a user. + CreateShortcut(context.Context, *connect.Request[v1.CreateShortcutRequest]) (*connect.Response[v1.Shortcut], error) + // UpdateShortcut updates a shortcut for a user. + UpdateShortcut(context.Context, *connect.Request[v1.UpdateShortcutRequest]) (*connect.Response[v1.Shortcut], error) + // DeleteShortcut deletes a shortcut for a user. + DeleteShortcut(context.Context, *connect.Request[v1.DeleteShortcutRequest]) (*connect.Response[emptypb.Empty], error) +} + +// NewShortcutServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewShortcutServiceHandler(svc ShortcutServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + shortcutServiceMethods := v1.File_api_v1_shortcut_service_proto.Services().ByName("ShortcutService").Methods() + shortcutServiceListShortcutsHandler := connect.NewUnaryHandler( + ShortcutServiceListShortcutsProcedure, + svc.ListShortcuts, + connect.WithSchema(shortcutServiceMethods.ByName("ListShortcuts")), + connect.WithHandlerOptions(opts...), + ) + shortcutServiceGetShortcutHandler := connect.NewUnaryHandler( + ShortcutServiceGetShortcutProcedure, + svc.GetShortcut, + connect.WithSchema(shortcutServiceMethods.ByName("GetShortcut")), + connect.WithHandlerOptions(opts...), + ) + shortcutServiceCreateShortcutHandler := connect.NewUnaryHandler( + ShortcutServiceCreateShortcutProcedure, + svc.CreateShortcut, + connect.WithSchema(shortcutServiceMethods.ByName("CreateShortcut")), + connect.WithHandlerOptions(opts...), + ) + shortcutServiceUpdateShortcutHandler := connect.NewUnaryHandler( + ShortcutServiceUpdateShortcutProcedure, + svc.UpdateShortcut, + connect.WithSchema(shortcutServiceMethods.ByName("UpdateShortcut")), + connect.WithHandlerOptions(opts...), + ) + shortcutServiceDeleteShortcutHandler := connect.NewUnaryHandler( + ShortcutServiceDeleteShortcutProcedure, + svc.DeleteShortcut, + connect.WithSchema(shortcutServiceMethods.ByName("DeleteShortcut")), + connect.WithHandlerOptions(opts...), + ) + return "/memos.api.v1.ShortcutService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ShortcutServiceListShortcutsProcedure: + shortcutServiceListShortcutsHandler.ServeHTTP(w, r) + case ShortcutServiceGetShortcutProcedure: + shortcutServiceGetShortcutHandler.ServeHTTP(w, r) + case ShortcutServiceCreateShortcutProcedure: + shortcutServiceCreateShortcutHandler.ServeHTTP(w, r) + case ShortcutServiceUpdateShortcutProcedure: + shortcutServiceUpdateShortcutHandler.ServeHTTP(w, r) + case ShortcutServiceDeleteShortcutProcedure: + shortcutServiceDeleteShortcutHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedShortcutServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedShortcutServiceHandler struct{} + +func (UnimplementedShortcutServiceHandler) ListShortcuts(context.Context, *connect.Request[v1.ListShortcutsRequest]) (*connect.Response[v1.ListShortcutsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.ShortcutService.ListShortcuts is not implemented")) +} + +func (UnimplementedShortcutServiceHandler) GetShortcut(context.Context, *connect.Request[v1.GetShortcutRequest]) (*connect.Response[v1.Shortcut], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.ShortcutService.GetShortcut is not implemented")) +} + +func (UnimplementedShortcutServiceHandler) CreateShortcut(context.Context, *connect.Request[v1.CreateShortcutRequest]) (*connect.Response[v1.Shortcut], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.ShortcutService.CreateShortcut is not implemented")) +} + +func (UnimplementedShortcutServiceHandler) UpdateShortcut(context.Context, *connect.Request[v1.UpdateShortcutRequest]) (*connect.Response[v1.Shortcut], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.ShortcutService.UpdateShortcut is not implemented")) +} + +func (UnimplementedShortcutServiceHandler) DeleteShortcut(context.Context, *connect.Request[v1.DeleteShortcutRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.ShortcutService.DeleteShortcut is not implemented")) +} diff --git a/proto/gen/api/v1/apiv1connect/user_service.connect.go b/proto/gen/api/v1/apiv1connect/user_service.connect.go new file mode 100644 index 000000000..eab283971 --- /dev/null +++ b/proto/gen/api/v1/apiv1connect/user_service.connect.go @@ -0,0 +1,764 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: api/v1/user_service.proto + +package apiv1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v1 "github.com/usememos/memos/proto/gen/api/v1" + emptypb "google.golang.org/protobuf/types/known/emptypb" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // UserServiceName is the fully-qualified name of the UserService service. + UserServiceName = "memos.api.v1.UserService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // UserServiceListUsersProcedure is the fully-qualified name of the UserService's ListUsers RPC. + UserServiceListUsersProcedure = "/memos.api.v1.UserService/ListUsers" + // UserServiceGetUserProcedure is the fully-qualified name of the UserService's GetUser RPC. + UserServiceGetUserProcedure = "/memos.api.v1.UserService/GetUser" + // UserServiceCreateUserProcedure is the fully-qualified name of the UserService's CreateUser RPC. + UserServiceCreateUserProcedure = "/memos.api.v1.UserService/CreateUser" + // UserServiceUpdateUserProcedure is the fully-qualified name of the UserService's UpdateUser RPC. + UserServiceUpdateUserProcedure = "/memos.api.v1.UserService/UpdateUser" + // UserServiceDeleteUserProcedure is the fully-qualified name of the UserService's DeleteUser RPC. + UserServiceDeleteUserProcedure = "/memos.api.v1.UserService/DeleteUser" + // UserServiceListAllUserStatsProcedure is the fully-qualified name of the UserService's + // ListAllUserStats RPC. + UserServiceListAllUserStatsProcedure = "/memos.api.v1.UserService/ListAllUserStats" + // UserServiceGetUserStatsProcedure is the fully-qualified name of the UserService's GetUserStats + // RPC. + UserServiceGetUserStatsProcedure = "/memos.api.v1.UserService/GetUserStats" + // UserServiceGetUserSettingProcedure is the fully-qualified name of the UserService's + // GetUserSetting RPC. + UserServiceGetUserSettingProcedure = "/memos.api.v1.UserService/GetUserSetting" + // UserServiceUpdateUserSettingProcedure is the fully-qualified name of the UserService's + // UpdateUserSetting RPC. + UserServiceUpdateUserSettingProcedure = "/memos.api.v1.UserService/UpdateUserSetting" + // UserServiceListUserSettingsProcedure is the fully-qualified name of the UserService's + // ListUserSettings RPC. + UserServiceListUserSettingsProcedure = "/memos.api.v1.UserService/ListUserSettings" + // UserServiceListUserAccessTokensProcedure is the fully-qualified name of the UserService's + // ListUserAccessTokens RPC. + UserServiceListUserAccessTokensProcedure = "/memos.api.v1.UserService/ListUserAccessTokens" + // UserServiceCreateUserAccessTokenProcedure is the fully-qualified name of the UserService's + // CreateUserAccessToken RPC. + UserServiceCreateUserAccessTokenProcedure = "/memos.api.v1.UserService/CreateUserAccessToken" + // UserServiceDeleteUserAccessTokenProcedure is the fully-qualified name of the UserService's + // DeleteUserAccessToken RPC. + UserServiceDeleteUserAccessTokenProcedure = "/memos.api.v1.UserService/DeleteUserAccessToken" + // UserServiceListUserSessionsProcedure is the fully-qualified name of the UserService's + // ListUserSessions RPC. + UserServiceListUserSessionsProcedure = "/memos.api.v1.UserService/ListUserSessions" + // UserServiceRevokeUserSessionProcedure is the fully-qualified name of the UserService's + // RevokeUserSession RPC. + UserServiceRevokeUserSessionProcedure = "/memos.api.v1.UserService/RevokeUserSession" + // UserServiceListUserWebhooksProcedure is the fully-qualified name of the UserService's + // ListUserWebhooks RPC. + UserServiceListUserWebhooksProcedure = "/memos.api.v1.UserService/ListUserWebhooks" + // UserServiceCreateUserWebhookProcedure is the fully-qualified name of the UserService's + // CreateUserWebhook RPC. + UserServiceCreateUserWebhookProcedure = "/memos.api.v1.UserService/CreateUserWebhook" + // UserServiceUpdateUserWebhookProcedure is the fully-qualified name of the UserService's + // UpdateUserWebhook RPC. + UserServiceUpdateUserWebhookProcedure = "/memos.api.v1.UserService/UpdateUserWebhook" + // UserServiceDeleteUserWebhookProcedure is the fully-qualified name of the UserService's + // DeleteUserWebhook RPC. + UserServiceDeleteUserWebhookProcedure = "/memos.api.v1.UserService/DeleteUserWebhook" + // UserServiceListUserNotificationsProcedure is the fully-qualified name of the UserService's + // ListUserNotifications RPC. + UserServiceListUserNotificationsProcedure = "/memos.api.v1.UserService/ListUserNotifications" + // UserServiceUpdateUserNotificationProcedure is the fully-qualified name of the UserService's + // UpdateUserNotification RPC. + UserServiceUpdateUserNotificationProcedure = "/memos.api.v1.UserService/UpdateUserNotification" + // UserServiceDeleteUserNotificationProcedure is the fully-qualified name of the UserService's + // DeleteUserNotification RPC. + UserServiceDeleteUserNotificationProcedure = "/memos.api.v1.UserService/DeleteUserNotification" +) + +// UserServiceClient is a client for the memos.api.v1.UserService service. +type UserServiceClient interface { + // ListUsers returns a list of users. + ListUsers(context.Context, *connect.Request[v1.ListUsersRequest]) (*connect.Response[v1.ListUsersResponse], error) + // GetUser gets a user by ID or username. + // Supports both numeric IDs and username strings: + // - users/{id} (e.g., users/101) + // - users/{username} (e.g., users/steven) + GetUser(context.Context, *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.User], error) + // CreateUser creates a new user. + CreateUser(context.Context, *connect.Request[v1.CreateUserRequest]) (*connect.Response[v1.User], error) + // UpdateUser updates a user. + UpdateUser(context.Context, *connect.Request[v1.UpdateUserRequest]) (*connect.Response[v1.User], error) + // DeleteUser deletes a user. + DeleteUser(context.Context, *connect.Request[v1.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error) + // ListAllUserStats returns statistics for all users. + ListAllUserStats(context.Context, *connect.Request[v1.ListAllUserStatsRequest]) (*connect.Response[v1.ListAllUserStatsResponse], error) + // GetUserStats returns statistics for a specific user. + GetUserStats(context.Context, *connect.Request[v1.GetUserStatsRequest]) (*connect.Response[v1.UserStats], error) + // GetUserSetting returns the user setting. + GetUserSetting(context.Context, *connect.Request[v1.GetUserSettingRequest]) (*connect.Response[v1.UserSetting], error) + // UpdateUserSetting updates the user setting. + UpdateUserSetting(context.Context, *connect.Request[v1.UpdateUserSettingRequest]) (*connect.Response[v1.UserSetting], error) + // ListUserSettings returns a list of user settings. + ListUserSettings(context.Context, *connect.Request[v1.ListUserSettingsRequest]) (*connect.Response[v1.ListUserSettingsResponse], error) + // ListUserAccessTokens returns a list of access tokens for a user. + ListUserAccessTokens(context.Context, *connect.Request[v1.ListUserAccessTokensRequest]) (*connect.Response[v1.ListUserAccessTokensResponse], error) + // CreateUserAccessToken creates a new access token for a user. + CreateUserAccessToken(context.Context, *connect.Request[v1.CreateUserAccessTokenRequest]) (*connect.Response[v1.UserAccessToken], error) + // DeleteUserAccessToken deletes an access token. + DeleteUserAccessToken(context.Context, *connect.Request[v1.DeleteUserAccessTokenRequest]) (*connect.Response[emptypb.Empty], error) + // ListUserSessions returns a list of active sessions for a user. + ListUserSessions(context.Context, *connect.Request[v1.ListUserSessionsRequest]) (*connect.Response[v1.ListUserSessionsResponse], error) + // RevokeUserSession revokes a specific session for a user. + RevokeUserSession(context.Context, *connect.Request[v1.RevokeUserSessionRequest]) (*connect.Response[emptypb.Empty], error) + // ListUserWebhooks returns a list of webhooks for a user. + ListUserWebhooks(context.Context, *connect.Request[v1.ListUserWebhooksRequest]) (*connect.Response[v1.ListUserWebhooksResponse], error) + // CreateUserWebhook creates a new webhook for a user. + CreateUserWebhook(context.Context, *connect.Request[v1.CreateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) + // UpdateUserWebhook updates an existing webhook for a user. + UpdateUserWebhook(context.Context, *connect.Request[v1.UpdateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) + // DeleteUserWebhook deletes a webhook for a user. + DeleteUserWebhook(context.Context, *connect.Request[v1.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error) + // ListUserNotifications lists notifications for a user. + ListUserNotifications(context.Context, *connect.Request[v1.ListUserNotificationsRequest]) (*connect.Response[v1.ListUserNotificationsResponse], error) + // UpdateUserNotification updates a notification. + UpdateUserNotification(context.Context, *connect.Request[v1.UpdateUserNotificationRequest]) (*connect.Response[v1.UserNotification], error) + // DeleteUserNotification deletes a notification. + DeleteUserNotification(context.Context, *connect.Request[v1.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error) +} + +// NewUserServiceClient constructs a client for the memos.api.v1.UserService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewUserServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) UserServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + userServiceMethods := v1.File_api_v1_user_service_proto.Services().ByName("UserService").Methods() + return &userServiceClient{ + listUsers: connect.NewClient[v1.ListUsersRequest, v1.ListUsersResponse]( + httpClient, + baseURL+UserServiceListUsersProcedure, + connect.WithSchema(userServiceMethods.ByName("ListUsers")), + connect.WithClientOptions(opts...), + ), + getUser: connect.NewClient[v1.GetUserRequest, v1.User]( + httpClient, + baseURL+UserServiceGetUserProcedure, + connect.WithSchema(userServiceMethods.ByName("GetUser")), + connect.WithClientOptions(opts...), + ), + createUser: connect.NewClient[v1.CreateUserRequest, v1.User]( + httpClient, + baseURL+UserServiceCreateUserProcedure, + connect.WithSchema(userServiceMethods.ByName("CreateUser")), + connect.WithClientOptions(opts...), + ), + updateUser: connect.NewClient[v1.UpdateUserRequest, v1.User]( + httpClient, + baseURL+UserServiceUpdateUserProcedure, + connect.WithSchema(userServiceMethods.ByName("UpdateUser")), + connect.WithClientOptions(opts...), + ), + deleteUser: connect.NewClient[v1.DeleteUserRequest, emptypb.Empty]( + httpClient, + baseURL+UserServiceDeleteUserProcedure, + connect.WithSchema(userServiceMethods.ByName("DeleteUser")), + connect.WithClientOptions(opts...), + ), + listAllUserStats: connect.NewClient[v1.ListAllUserStatsRequest, v1.ListAllUserStatsResponse]( + httpClient, + baseURL+UserServiceListAllUserStatsProcedure, + connect.WithSchema(userServiceMethods.ByName("ListAllUserStats")), + connect.WithClientOptions(opts...), + ), + getUserStats: connect.NewClient[v1.GetUserStatsRequest, v1.UserStats]( + httpClient, + baseURL+UserServiceGetUserStatsProcedure, + connect.WithSchema(userServiceMethods.ByName("GetUserStats")), + connect.WithClientOptions(opts...), + ), + getUserSetting: connect.NewClient[v1.GetUserSettingRequest, v1.UserSetting]( + httpClient, + baseURL+UserServiceGetUserSettingProcedure, + connect.WithSchema(userServiceMethods.ByName("GetUserSetting")), + connect.WithClientOptions(opts...), + ), + updateUserSetting: connect.NewClient[v1.UpdateUserSettingRequest, v1.UserSetting]( + httpClient, + baseURL+UserServiceUpdateUserSettingProcedure, + connect.WithSchema(userServiceMethods.ByName("UpdateUserSetting")), + connect.WithClientOptions(opts...), + ), + listUserSettings: connect.NewClient[v1.ListUserSettingsRequest, v1.ListUserSettingsResponse]( + httpClient, + baseURL+UserServiceListUserSettingsProcedure, + connect.WithSchema(userServiceMethods.ByName("ListUserSettings")), + connect.WithClientOptions(opts...), + ), + listUserAccessTokens: connect.NewClient[v1.ListUserAccessTokensRequest, v1.ListUserAccessTokensResponse]( + httpClient, + baseURL+UserServiceListUserAccessTokensProcedure, + connect.WithSchema(userServiceMethods.ByName("ListUserAccessTokens")), + connect.WithClientOptions(opts...), + ), + createUserAccessToken: connect.NewClient[v1.CreateUserAccessTokenRequest, v1.UserAccessToken]( + httpClient, + baseURL+UserServiceCreateUserAccessTokenProcedure, + connect.WithSchema(userServiceMethods.ByName("CreateUserAccessToken")), + connect.WithClientOptions(opts...), + ), + deleteUserAccessToken: connect.NewClient[v1.DeleteUserAccessTokenRequest, emptypb.Empty]( + httpClient, + baseURL+UserServiceDeleteUserAccessTokenProcedure, + connect.WithSchema(userServiceMethods.ByName("DeleteUserAccessToken")), + connect.WithClientOptions(opts...), + ), + listUserSessions: connect.NewClient[v1.ListUserSessionsRequest, v1.ListUserSessionsResponse]( + httpClient, + baseURL+UserServiceListUserSessionsProcedure, + connect.WithSchema(userServiceMethods.ByName("ListUserSessions")), + connect.WithClientOptions(opts...), + ), + revokeUserSession: connect.NewClient[v1.RevokeUserSessionRequest, emptypb.Empty]( + httpClient, + baseURL+UserServiceRevokeUserSessionProcedure, + connect.WithSchema(userServiceMethods.ByName("RevokeUserSession")), + connect.WithClientOptions(opts...), + ), + listUserWebhooks: connect.NewClient[v1.ListUserWebhooksRequest, v1.ListUserWebhooksResponse]( + httpClient, + baseURL+UserServiceListUserWebhooksProcedure, + connect.WithSchema(userServiceMethods.ByName("ListUserWebhooks")), + connect.WithClientOptions(opts...), + ), + createUserWebhook: connect.NewClient[v1.CreateUserWebhookRequest, v1.UserWebhook]( + httpClient, + baseURL+UserServiceCreateUserWebhookProcedure, + connect.WithSchema(userServiceMethods.ByName("CreateUserWebhook")), + connect.WithClientOptions(opts...), + ), + updateUserWebhook: connect.NewClient[v1.UpdateUserWebhookRequest, v1.UserWebhook]( + httpClient, + baseURL+UserServiceUpdateUserWebhookProcedure, + connect.WithSchema(userServiceMethods.ByName("UpdateUserWebhook")), + connect.WithClientOptions(opts...), + ), + deleteUserWebhook: connect.NewClient[v1.DeleteUserWebhookRequest, emptypb.Empty]( + httpClient, + baseURL+UserServiceDeleteUserWebhookProcedure, + connect.WithSchema(userServiceMethods.ByName("DeleteUserWebhook")), + connect.WithClientOptions(opts...), + ), + listUserNotifications: connect.NewClient[v1.ListUserNotificationsRequest, v1.ListUserNotificationsResponse]( + httpClient, + baseURL+UserServiceListUserNotificationsProcedure, + connect.WithSchema(userServiceMethods.ByName("ListUserNotifications")), + connect.WithClientOptions(opts...), + ), + updateUserNotification: connect.NewClient[v1.UpdateUserNotificationRequest, v1.UserNotification]( + httpClient, + baseURL+UserServiceUpdateUserNotificationProcedure, + connect.WithSchema(userServiceMethods.ByName("UpdateUserNotification")), + connect.WithClientOptions(opts...), + ), + deleteUserNotification: connect.NewClient[v1.DeleteUserNotificationRequest, emptypb.Empty]( + httpClient, + baseURL+UserServiceDeleteUserNotificationProcedure, + connect.WithSchema(userServiceMethods.ByName("DeleteUserNotification")), + connect.WithClientOptions(opts...), + ), + } +} + +// userServiceClient implements UserServiceClient. +type userServiceClient struct { + listUsers *connect.Client[v1.ListUsersRequest, v1.ListUsersResponse] + getUser *connect.Client[v1.GetUserRequest, v1.User] + createUser *connect.Client[v1.CreateUserRequest, v1.User] + updateUser *connect.Client[v1.UpdateUserRequest, v1.User] + deleteUser *connect.Client[v1.DeleteUserRequest, emptypb.Empty] + listAllUserStats *connect.Client[v1.ListAllUserStatsRequest, v1.ListAllUserStatsResponse] + getUserStats *connect.Client[v1.GetUserStatsRequest, v1.UserStats] + getUserSetting *connect.Client[v1.GetUserSettingRequest, v1.UserSetting] + updateUserSetting *connect.Client[v1.UpdateUserSettingRequest, v1.UserSetting] + listUserSettings *connect.Client[v1.ListUserSettingsRequest, v1.ListUserSettingsResponse] + listUserAccessTokens *connect.Client[v1.ListUserAccessTokensRequest, v1.ListUserAccessTokensResponse] + createUserAccessToken *connect.Client[v1.CreateUserAccessTokenRequest, v1.UserAccessToken] + deleteUserAccessToken *connect.Client[v1.DeleteUserAccessTokenRequest, emptypb.Empty] + listUserSessions *connect.Client[v1.ListUserSessionsRequest, v1.ListUserSessionsResponse] + revokeUserSession *connect.Client[v1.RevokeUserSessionRequest, emptypb.Empty] + listUserWebhooks *connect.Client[v1.ListUserWebhooksRequest, v1.ListUserWebhooksResponse] + createUserWebhook *connect.Client[v1.CreateUserWebhookRequest, v1.UserWebhook] + updateUserWebhook *connect.Client[v1.UpdateUserWebhookRequest, v1.UserWebhook] + deleteUserWebhook *connect.Client[v1.DeleteUserWebhookRequest, emptypb.Empty] + listUserNotifications *connect.Client[v1.ListUserNotificationsRequest, v1.ListUserNotificationsResponse] + updateUserNotification *connect.Client[v1.UpdateUserNotificationRequest, v1.UserNotification] + deleteUserNotification *connect.Client[v1.DeleteUserNotificationRequest, emptypb.Empty] +} + +// ListUsers calls memos.api.v1.UserService.ListUsers. +func (c *userServiceClient) ListUsers(ctx context.Context, req *connect.Request[v1.ListUsersRequest]) (*connect.Response[v1.ListUsersResponse], error) { + return c.listUsers.CallUnary(ctx, req) +} + +// GetUser calls memos.api.v1.UserService.GetUser. +func (c *userServiceClient) GetUser(ctx context.Context, req *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.User], error) { + return c.getUser.CallUnary(ctx, req) +} + +// CreateUser calls memos.api.v1.UserService.CreateUser. +func (c *userServiceClient) CreateUser(ctx context.Context, req *connect.Request[v1.CreateUserRequest]) (*connect.Response[v1.User], error) { + return c.createUser.CallUnary(ctx, req) +} + +// UpdateUser calls memos.api.v1.UserService.UpdateUser. +func (c *userServiceClient) UpdateUser(ctx context.Context, req *connect.Request[v1.UpdateUserRequest]) (*connect.Response[v1.User], error) { + return c.updateUser.CallUnary(ctx, req) +} + +// DeleteUser calls memos.api.v1.UserService.DeleteUser. +func (c *userServiceClient) DeleteUser(ctx context.Context, req *connect.Request[v1.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error) { + return c.deleteUser.CallUnary(ctx, req) +} + +// ListAllUserStats calls memos.api.v1.UserService.ListAllUserStats. +func (c *userServiceClient) ListAllUserStats(ctx context.Context, req *connect.Request[v1.ListAllUserStatsRequest]) (*connect.Response[v1.ListAllUserStatsResponse], error) { + return c.listAllUserStats.CallUnary(ctx, req) +} + +// GetUserStats calls memos.api.v1.UserService.GetUserStats. +func (c *userServiceClient) GetUserStats(ctx context.Context, req *connect.Request[v1.GetUserStatsRequest]) (*connect.Response[v1.UserStats], error) { + return c.getUserStats.CallUnary(ctx, req) +} + +// GetUserSetting calls memos.api.v1.UserService.GetUserSetting. +func (c *userServiceClient) GetUserSetting(ctx context.Context, req *connect.Request[v1.GetUserSettingRequest]) (*connect.Response[v1.UserSetting], error) { + return c.getUserSetting.CallUnary(ctx, req) +} + +// UpdateUserSetting calls memos.api.v1.UserService.UpdateUserSetting. +func (c *userServiceClient) UpdateUserSetting(ctx context.Context, req *connect.Request[v1.UpdateUserSettingRequest]) (*connect.Response[v1.UserSetting], error) { + return c.updateUserSetting.CallUnary(ctx, req) +} + +// ListUserSettings calls memos.api.v1.UserService.ListUserSettings. +func (c *userServiceClient) ListUserSettings(ctx context.Context, req *connect.Request[v1.ListUserSettingsRequest]) (*connect.Response[v1.ListUserSettingsResponse], error) { + return c.listUserSettings.CallUnary(ctx, req) +} + +// ListUserAccessTokens calls memos.api.v1.UserService.ListUserAccessTokens. +func (c *userServiceClient) ListUserAccessTokens(ctx context.Context, req *connect.Request[v1.ListUserAccessTokensRequest]) (*connect.Response[v1.ListUserAccessTokensResponse], error) { + return c.listUserAccessTokens.CallUnary(ctx, req) +} + +// CreateUserAccessToken calls memos.api.v1.UserService.CreateUserAccessToken. +func (c *userServiceClient) CreateUserAccessToken(ctx context.Context, req *connect.Request[v1.CreateUserAccessTokenRequest]) (*connect.Response[v1.UserAccessToken], error) { + return c.createUserAccessToken.CallUnary(ctx, req) +} + +// DeleteUserAccessToken calls memos.api.v1.UserService.DeleteUserAccessToken. +func (c *userServiceClient) DeleteUserAccessToken(ctx context.Context, req *connect.Request[v1.DeleteUserAccessTokenRequest]) (*connect.Response[emptypb.Empty], error) { + return c.deleteUserAccessToken.CallUnary(ctx, req) +} + +// ListUserSessions calls memos.api.v1.UserService.ListUserSessions. +func (c *userServiceClient) ListUserSessions(ctx context.Context, req *connect.Request[v1.ListUserSessionsRequest]) (*connect.Response[v1.ListUserSessionsResponse], error) { + return c.listUserSessions.CallUnary(ctx, req) +} + +// RevokeUserSession calls memos.api.v1.UserService.RevokeUserSession. +func (c *userServiceClient) RevokeUserSession(ctx context.Context, req *connect.Request[v1.RevokeUserSessionRequest]) (*connect.Response[emptypb.Empty], error) { + return c.revokeUserSession.CallUnary(ctx, req) +} + +// ListUserWebhooks calls memos.api.v1.UserService.ListUserWebhooks. +func (c *userServiceClient) ListUserWebhooks(ctx context.Context, req *connect.Request[v1.ListUserWebhooksRequest]) (*connect.Response[v1.ListUserWebhooksResponse], error) { + return c.listUserWebhooks.CallUnary(ctx, req) +} + +// CreateUserWebhook calls memos.api.v1.UserService.CreateUserWebhook. +func (c *userServiceClient) CreateUserWebhook(ctx context.Context, req *connect.Request[v1.CreateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) { + return c.createUserWebhook.CallUnary(ctx, req) +} + +// UpdateUserWebhook calls memos.api.v1.UserService.UpdateUserWebhook. +func (c *userServiceClient) UpdateUserWebhook(ctx context.Context, req *connect.Request[v1.UpdateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) { + return c.updateUserWebhook.CallUnary(ctx, req) +} + +// DeleteUserWebhook calls memos.api.v1.UserService.DeleteUserWebhook. +func (c *userServiceClient) DeleteUserWebhook(ctx context.Context, req *connect.Request[v1.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error) { + return c.deleteUserWebhook.CallUnary(ctx, req) +} + +// ListUserNotifications calls memos.api.v1.UserService.ListUserNotifications. +func (c *userServiceClient) ListUserNotifications(ctx context.Context, req *connect.Request[v1.ListUserNotificationsRequest]) (*connect.Response[v1.ListUserNotificationsResponse], error) { + return c.listUserNotifications.CallUnary(ctx, req) +} + +// UpdateUserNotification calls memos.api.v1.UserService.UpdateUserNotification. +func (c *userServiceClient) UpdateUserNotification(ctx context.Context, req *connect.Request[v1.UpdateUserNotificationRequest]) (*connect.Response[v1.UserNotification], error) { + return c.updateUserNotification.CallUnary(ctx, req) +} + +// DeleteUserNotification calls memos.api.v1.UserService.DeleteUserNotification. +func (c *userServiceClient) DeleteUserNotification(ctx context.Context, req *connect.Request[v1.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error) { + return c.deleteUserNotification.CallUnary(ctx, req) +} + +// UserServiceHandler is an implementation of the memos.api.v1.UserService service. +type UserServiceHandler interface { + // ListUsers returns a list of users. + ListUsers(context.Context, *connect.Request[v1.ListUsersRequest]) (*connect.Response[v1.ListUsersResponse], error) + // GetUser gets a user by ID or username. + // Supports both numeric IDs and username strings: + // - users/{id} (e.g., users/101) + // - users/{username} (e.g., users/steven) + GetUser(context.Context, *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.User], error) + // CreateUser creates a new user. + CreateUser(context.Context, *connect.Request[v1.CreateUserRequest]) (*connect.Response[v1.User], error) + // UpdateUser updates a user. + UpdateUser(context.Context, *connect.Request[v1.UpdateUserRequest]) (*connect.Response[v1.User], error) + // DeleteUser deletes a user. + DeleteUser(context.Context, *connect.Request[v1.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error) + // ListAllUserStats returns statistics for all users. + ListAllUserStats(context.Context, *connect.Request[v1.ListAllUserStatsRequest]) (*connect.Response[v1.ListAllUserStatsResponse], error) + // GetUserStats returns statistics for a specific user. + GetUserStats(context.Context, *connect.Request[v1.GetUserStatsRequest]) (*connect.Response[v1.UserStats], error) + // GetUserSetting returns the user setting. + GetUserSetting(context.Context, *connect.Request[v1.GetUserSettingRequest]) (*connect.Response[v1.UserSetting], error) + // UpdateUserSetting updates the user setting. + UpdateUserSetting(context.Context, *connect.Request[v1.UpdateUserSettingRequest]) (*connect.Response[v1.UserSetting], error) + // ListUserSettings returns a list of user settings. + ListUserSettings(context.Context, *connect.Request[v1.ListUserSettingsRequest]) (*connect.Response[v1.ListUserSettingsResponse], error) + // ListUserAccessTokens returns a list of access tokens for a user. + ListUserAccessTokens(context.Context, *connect.Request[v1.ListUserAccessTokensRequest]) (*connect.Response[v1.ListUserAccessTokensResponse], error) + // CreateUserAccessToken creates a new access token for a user. + CreateUserAccessToken(context.Context, *connect.Request[v1.CreateUserAccessTokenRequest]) (*connect.Response[v1.UserAccessToken], error) + // DeleteUserAccessToken deletes an access token. + DeleteUserAccessToken(context.Context, *connect.Request[v1.DeleteUserAccessTokenRequest]) (*connect.Response[emptypb.Empty], error) + // ListUserSessions returns a list of active sessions for a user. + ListUserSessions(context.Context, *connect.Request[v1.ListUserSessionsRequest]) (*connect.Response[v1.ListUserSessionsResponse], error) + // RevokeUserSession revokes a specific session for a user. + RevokeUserSession(context.Context, *connect.Request[v1.RevokeUserSessionRequest]) (*connect.Response[emptypb.Empty], error) + // ListUserWebhooks returns a list of webhooks for a user. + ListUserWebhooks(context.Context, *connect.Request[v1.ListUserWebhooksRequest]) (*connect.Response[v1.ListUserWebhooksResponse], error) + // CreateUserWebhook creates a new webhook for a user. + CreateUserWebhook(context.Context, *connect.Request[v1.CreateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) + // UpdateUserWebhook updates an existing webhook for a user. + UpdateUserWebhook(context.Context, *connect.Request[v1.UpdateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) + // DeleteUserWebhook deletes a webhook for a user. + DeleteUserWebhook(context.Context, *connect.Request[v1.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error) + // ListUserNotifications lists notifications for a user. + ListUserNotifications(context.Context, *connect.Request[v1.ListUserNotificationsRequest]) (*connect.Response[v1.ListUserNotificationsResponse], error) + // UpdateUserNotification updates a notification. + UpdateUserNotification(context.Context, *connect.Request[v1.UpdateUserNotificationRequest]) (*connect.Response[v1.UserNotification], error) + // DeleteUserNotification deletes a notification. + DeleteUserNotification(context.Context, *connect.Request[v1.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error) +} + +// NewUserServiceHandler builds an HTTP handler from the service implementation. It returns the path +// on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + userServiceMethods := v1.File_api_v1_user_service_proto.Services().ByName("UserService").Methods() + userServiceListUsersHandler := connect.NewUnaryHandler( + UserServiceListUsersProcedure, + svc.ListUsers, + connect.WithSchema(userServiceMethods.ByName("ListUsers")), + connect.WithHandlerOptions(opts...), + ) + userServiceGetUserHandler := connect.NewUnaryHandler( + UserServiceGetUserProcedure, + svc.GetUser, + connect.WithSchema(userServiceMethods.ByName("GetUser")), + connect.WithHandlerOptions(opts...), + ) + userServiceCreateUserHandler := connect.NewUnaryHandler( + UserServiceCreateUserProcedure, + svc.CreateUser, + connect.WithSchema(userServiceMethods.ByName("CreateUser")), + connect.WithHandlerOptions(opts...), + ) + userServiceUpdateUserHandler := connect.NewUnaryHandler( + UserServiceUpdateUserProcedure, + svc.UpdateUser, + connect.WithSchema(userServiceMethods.ByName("UpdateUser")), + connect.WithHandlerOptions(opts...), + ) + userServiceDeleteUserHandler := connect.NewUnaryHandler( + UserServiceDeleteUserProcedure, + svc.DeleteUser, + connect.WithSchema(userServiceMethods.ByName("DeleteUser")), + connect.WithHandlerOptions(opts...), + ) + userServiceListAllUserStatsHandler := connect.NewUnaryHandler( + UserServiceListAllUserStatsProcedure, + svc.ListAllUserStats, + connect.WithSchema(userServiceMethods.ByName("ListAllUserStats")), + connect.WithHandlerOptions(opts...), + ) + userServiceGetUserStatsHandler := connect.NewUnaryHandler( + UserServiceGetUserStatsProcedure, + svc.GetUserStats, + connect.WithSchema(userServiceMethods.ByName("GetUserStats")), + connect.WithHandlerOptions(opts...), + ) + userServiceGetUserSettingHandler := connect.NewUnaryHandler( + UserServiceGetUserSettingProcedure, + svc.GetUserSetting, + connect.WithSchema(userServiceMethods.ByName("GetUserSetting")), + connect.WithHandlerOptions(opts...), + ) + userServiceUpdateUserSettingHandler := connect.NewUnaryHandler( + UserServiceUpdateUserSettingProcedure, + svc.UpdateUserSetting, + connect.WithSchema(userServiceMethods.ByName("UpdateUserSetting")), + connect.WithHandlerOptions(opts...), + ) + userServiceListUserSettingsHandler := connect.NewUnaryHandler( + UserServiceListUserSettingsProcedure, + svc.ListUserSettings, + connect.WithSchema(userServiceMethods.ByName("ListUserSettings")), + connect.WithHandlerOptions(opts...), + ) + userServiceListUserAccessTokensHandler := connect.NewUnaryHandler( + UserServiceListUserAccessTokensProcedure, + svc.ListUserAccessTokens, + connect.WithSchema(userServiceMethods.ByName("ListUserAccessTokens")), + connect.WithHandlerOptions(opts...), + ) + userServiceCreateUserAccessTokenHandler := connect.NewUnaryHandler( + UserServiceCreateUserAccessTokenProcedure, + svc.CreateUserAccessToken, + connect.WithSchema(userServiceMethods.ByName("CreateUserAccessToken")), + connect.WithHandlerOptions(opts...), + ) + userServiceDeleteUserAccessTokenHandler := connect.NewUnaryHandler( + UserServiceDeleteUserAccessTokenProcedure, + svc.DeleteUserAccessToken, + connect.WithSchema(userServiceMethods.ByName("DeleteUserAccessToken")), + connect.WithHandlerOptions(opts...), + ) + userServiceListUserSessionsHandler := connect.NewUnaryHandler( + UserServiceListUserSessionsProcedure, + svc.ListUserSessions, + connect.WithSchema(userServiceMethods.ByName("ListUserSessions")), + connect.WithHandlerOptions(opts...), + ) + userServiceRevokeUserSessionHandler := connect.NewUnaryHandler( + UserServiceRevokeUserSessionProcedure, + svc.RevokeUserSession, + connect.WithSchema(userServiceMethods.ByName("RevokeUserSession")), + connect.WithHandlerOptions(opts...), + ) + userServiceListUserWebhooksHandler := connect.NewUnaryHandler( + UserServiceListUserWebhooksProcedure, + svc.ListUserWebhooks, + connect.WithSchema(userServiceMethods.ByName("ListUserWebhooks")), + connect.WithHandlerOptions(opts...), + ) + userServiceCreateUserWebhookHandler := connect.NewUnaryHandler( + UserServiceCreateUserWebhookProcedure, + svc.CreateUserWebhook, + connect.WithSchema(userServiceMethods.ByName("CreateUserWebhook")), + connect.WithHandlerOptions(opts...), + ) + userServiceUpdateUserWebhookHandler := connect.NewUnaryHandler( + UserServiceUpdateUserWebhookProcedure, + svc.UpdateUserWebhook, + connect.WithSchema(userServiceMethods.ByName("UpdateUserWebhook")), + connect.WithHandlerOptions(opts...), + ) + userServiceDeleteUserWebhookHandler := connect.NewUnaryHandler( + UserServiceDeleteUserWebhookProcedure, + svc.DeleteUserWebhook, + connect.WithSchema(userServiceMethods.ByName("DeleteUserWebhook")), + connect.WithHandlerOptions(opts...), + ) + userServiceListUserNotificationsHandler := connect.NewUnaryHandler( + UserServiceListUserNotificationsProcedure, + svc.ListUserNotifications, + connect.WithSchema(userServiceMethods.ByName("ListUserNotifications")), + connect.WithHandlerOptions(opts...), + ) + userServiceUpdateUserNotificationHandler := connect.NewUnaryHandler( + UserServiceUpdateUserNotificationProcedure, + svc.UpdateUserNotification, + connect.WithSchema(userServiceMethods.ByName("UpdateUserNotification")), + connect.WithHandlerOptions(opts...), + ) + userServiceDeleteUserNotificationHandler := connect.NewUnaryHandler( + UserServiceDeleteUserNotificationProcedure, + svc.DeleteUserNotification, + connect.WithSchema(userServiceMethods.ByName("DeleteUserNotification")), + connect.WithHandlerOptions(opts...), + ) + return "/memos.api.v1.UserService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case UserServiceListUsersProcedure: + userServiceListUsersHandler.ServeHTTP(w, r) + case UserServiceGetUserProcedure: + userServiceGetUserHandler.ServeHTTP(w, r) + case UserServiceCreateUserProcedure: + userServiceCreateUserHandler.ServeHTTP(w, r) + case UserServiceUpdateUserProcedure: + userServiceUpdateUserHandler.ServeHTTP(w, r) + case UserServiceDeleteUserProcedure: + userServiceDeleteUserHandler.ServeHTTP(w, r) + case UserServiceListAllUserStatsProcedure: + userServiceListAllUserStatsHandler.ServeHTTP(w, r) + case UserServiceGetUserStatsProcedure: + userServiceGetUserStatsHandler.ServeHTTP(w, r) + case UserServiceGetUserSettingProcedure: + userServiceGetUserSettingHandler.ServeHTTP(w, r) + case UserServiceUpdateUserSettingProcedure: + userServiceUpdateUserSettingHandler.ServeHTTP(w, r) + case UserServiceListUserSettingsProcedure: + userServiceListUserSettingsHandler.ServeHTTP(w, r) + case UserServiceListUserAccessTokensProcedure: + userServiceListUserAccessTokensHandler.ServeHTTP(w, r) + case UserServiceCreateUserAccessTokenProcedure: + userServiceCreateUserAccessTokenHandler.ServeHTTP(w, r) + case UserServiceDeleteUserAccessTokenProcedure: + userServiceDeleteUserAccessTokenHandler.ServeHTTP(w, r) + case UserServiceListUserSessionsProcedure: + userServiceListUserSessionsHandler.ServeHTTP(w, r) + case UserServiceRevokeUserSessionProcedure: + userServiceRevokeUserSessionHandler.ServeHTTP(w, r) + case UserServiceListUserWebhooksProcedure: + userServiceListUserWebhooksHandler.ServeHTTP(w, r) + case UserServiceCreateUserWebhookProcedure: + userServiceCreateUserWebhookHandler.ServeHTTP(w, r) + case UserServiceUpdateUserWebhookProcedure: + userServiceUpdateUserWebhookHandler.ServeHTTP(w, r) + case UserServiceDeleteUserWebhookProcedure: + userServiceDeleteUserWebhookHandler.ServeHTTP(w, r) + case UserServiceListUserNotificationsProcedure: + userServiceListUserNotificationsHandler.ServeHTTP(w, r) + case UserServiceUpdateUserNotificationProcedure: + userServiceUpdateUserNotificationHandler.ServeHTTP(w, r) + case UserServiceDeleteUserNotificationProcedure: + userServiceDeleteUserNotificationHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedUserServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedUserServiceHandler struct{} + +func (UnimplementedUserServiceHandler) ListUsers(context.Context, *connect.Request[v1.ListUsersRequest]) (*connect.Response[v1.ListUsersResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListUsers is not implemented")) +} + +func (UnimplementedUserServiceHandler) GetUser(context.Context, *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.User], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.GetUser is not implemented")) +} + +func (UnimplementedUserServiceHandler) CreateUser(context.Context, *connect.Request[v1.CreateUserRequest]) (*connect.Response[v1.User], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.CreateUser is not implemented")) +} + +func (UnimplementedUserServiceHandler) UpdateUser(context.Context, *connect.Request[v1.UpdateUserRequest]) (*connect.Response[v1.User], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.UpdateUser is not implemented")) +} + +func (UnimplementedUserServiceHandler) DeleteUser(context.Context, *connect.Request[v1.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.DeleteUser is not implemented")) +} + +func (UnimplementedUserServiceHandler) ListAllUserStats(context.Context, *connect.Request[v1.ListAllUserStatsRequest]) (*connect.Response[v1.ListAllUserStatsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListAllUserStats is not implemented")) +} + +func (UnimplementedUserServiceHandler) GetUserStats(context.Context, *connect.Request[v1.GetUserStatsRequest]) (*connect.Response[v1.UserStats], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.GetUserStats is not implemented")) +} + +func (UnimplementedUserServiceHandler) GetUserSetting(context.Context, *connect.Request[v1.GetUserSettingRequest]) (*connect.Response[v1.UserSetting], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.GetUserSetting is not implemented")) +} + +func (UnimplementedUserServiceHandler) UpdateUserSetting(context.Context, *connect.Request[v1.UpdateUserSettingRequest]) (*connect.Response[v1.UserSetting], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.UpdateUserSetting is not implemented")) +} + +func (UnimplementedUserServiceHandler) ListUserSettings(context.Context, *connect.Request[v1.ListUserSettingsRequest]) (*connect.Response[v1.ListUserSettingsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListUserSettings is not implemented")) +} + +func (UnimplementedUserServiceHandler) ListUserAccessTokens(context.Context, *connect.Request[v1.ListUserAccessTokensRequest]) (*connect.Response[v1.ListUserAccessTokensResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListUserAccessTokens is not implemented")) +} + +func (UnimplementedUserServiceHandler) CreateUserAccessToken(context.Context, *connect.Request[v1.CreateUserAccessTokenRequest]) (*connect.Response[v1.UserAccessToken], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.CreateUserAccessToken is not implemented")) +} + +func (UnimplementedUserServiceHandler) DeleteUserAccessToken(context.Context, *connect.Request[v1.DeleteUserAccessTokenRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.DeleteUserAccessToken is not implemented")) +} + +func (UnimplementedUserServiceHandler) ListUserSessions(context.Context, *connect.Request[v1.ListUserSessionsRequest]) (*connect.Response[v1.ListUserSessionsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListUserSessions is not implemented")) +} + +func (UnimplementedUserServiceHandler) RevokeUserSession(context.Context, *connect.Request[v1.RevokeUserSessionRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.RevokeUserSession is not implemented")) +} + +func (UnimplementedUserServiceHandler) ListUserWebhooks(context.Context, *connect.Request[v1.ListUserWebhooksRequest]) (*connect.Response[v1.ListUserWebhooksResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListUserWebhooks is not implemented")) +} + +func (UnimplementedUserServiceHandler) CreateUserWebhook(context.Context, *connect.Request[v1.CreateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.CreateUserWebhook is not implemented")) +} + +func (UnimplementedUserServiceHandler) UpdateUserWebhook(context.Context, *connect.Request[v1.UpdateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.UpdateUserWebhook is not implemented")) +} + +func (UnimplementedUserServiceHandler) DeleteUserWebhook(context.Context, *connect.Request[v1.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.DeleteUserWebhook is not implemented")) +} + +func (UnimplementedUserServiceHandler) ListUserNotifications(context.Context, *connect.Request[v1.ListUserNotificationsRequest]) (*connect.Response[v1.ListUserNotificationsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListUserNotifications is not implemented")) +} + +func (UnimplementedUserServiceHandler) UpdateUserNotification(context.Context, *connect.Request[v1.UpdateUserNotificationRequest]) (*connect.Response[v1.UserNotification], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.UpdateUserNotification is not implemented")) +} + +func (UnimplementedUserServiceHandler) DeleteUserNotification(context.Context, *connect.Request[v1.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.DeleteUserNotification is not implemented")) +} diff --git a/proto/gen/google/api/annotations.pb.go b/proto/gen/google/api/annotations.pb.go new file mode 100644 index 000000000..e65a57cc7 --- /dev/null +++ b/proto/gen/google/api/annotations.pb.go @@ -0,0 +1,105 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc (unknown) +// source: google/api/annotations.proto + +package annotations + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" + reflect "reflect" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +var file_google_api_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptorpb.MethodOptions)(nil), + ExtensionType: (*HttpRule)(nil), + Field: 72295728, + Name: "google.api.http", + Tag: "bytes,72295728,opt,name=http", + Filename: "google/api/annotations.proto", + }, +} + +// Extension fields to descriptorpb.MethodOptions. +var ( + // See `HttpRule`. + // + // optional google.api.HttpRule http = 72295728; + E_Http = &file_google_api_annotations_proto_extTypes[0] +) + +var File_google_api_annotations_proto protoreflect.FileDescriptor + +const file_google_api_annotations_proto_rawDesc = "" + + "\n" + + "\x1cgoogle/api/annotations.proto\x12\n" + + "google.api\x1a\x15google/api/http.proto\x1a google/protobuf/descriptor.proto:K\n" + + "\x04http\x12\x1e.google.protobuf.MethodOptions\x18\xb0ʼ\" \x01(\v2\x14.google.api.HttpRuleR\x04httpB\xae\x01\n" + + "\x0ecom.google.apiB\x10AnnotationsProtoP\x01ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\xa2\x02\x03GAX\xaa\x02\n" + + "Google.Api\xca\x02\n" + + "Google\\Api\xe2\x02\x16Google\\Api\\GPBMetadata\xea\x02\vGoogle::Apib\x06proto3" + +var file_google_api_annotations_proto_goTypes = []any{ + (*descriptorpb.MethodOptions)(nil), // 0: google.protobuf.MethodOptions + (*HttpRule)(nil), // 1: google.api.HttpRule +} +var file_google_api_annotations_proto_depIdxs = []int32{ + 0, // 0: google.api.http:extendee -> google.protobuf.MethodOptions + 1, // 1: google.api.http:type_name -> google.api.HttpRule + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 1, // [1:2] is the sub-list for extension type_name + 0, // [0:1] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_google_api_annotations_proto_init() } +func file_google_api_annotations_proto_init() { + if File_google_api_annotations_proto != nil { + return + } + file_google_api_http_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_api_annotations_proto_rawDesc), len(file_google_api_annotations_proto_rawDesc)), + NumEnums: 0, + NumMessages: 0, + NumExtensions: 1, + NumServices: 0, + }, + GoTypes: file_google_api_annotations_proto_goTypes, + DependencyIndexes: file_google_api_annotations_proto_depIdxs, + ExtensionInfos: file_google_api_annotations_proto_extTypes, + }.Build() + File_google_api_annotations_proto = out.File + file_google_api_annotations_proto_goTypes = nil + file_google_api_annotations_proto_depIdxs = nil +} diff --git a/proto/gen/google/api/client.pb.go b/proto/gen/google/api/client.pb.go new file mode 100644 index 000000000..f73df28da --- /dev/null +++ b/proto/gen/google/api/client.pb.go @@ -0,0 +1,1691 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc (unknown) +// source: google/api/client.proto + +package annotations + +import ( + api "google.golang.org/genproto/googleapis/api" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" + durationpb "google.golang.org/protobuf/types/known/durationpb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// The organization for which the client libraries are being published. +// Affects the url where generated docs are published, etc. +type ClientLibraryOrganization int32 + +const ( + // Not useful. + ClientLibraryOrganization_CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED ClientLibraryOrganization = 0 + // Google Cloud Platform Org. + ClientLibraryOrganization_CLOUD ClientLibraryOrganization = 1 + // Ads (Advertising) Org. + ClientLibraryOrganization_ADS ClientLibraryOrganization = 2 + // Photos Org. + ClientLibraryOrganization_PHOTOS ClientLibraryOrganization = 3 + // Street View Org. + ClientLibraryOrganization_STREET_VIEW ClientLibraryOrganization = 4 + // Shopping Org. + ClientLibraryOrganization_SHOPPING ClientLibraryOrganization = 5 + // Geo Org. + ClientLibraryOrganization_GEO ClientLibraryOrganization = 6 + // Generative AI - https://developers.generativeai.google + ClientLibraryOrganization_GENERATIVE_AI ClientLibraryOrganization = 7 +) + +// Enum value maps for ClientLibraryOrganization. +var ( + ClientLibraryOrganization_name = map[int32]string{ + 0: "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED", + 1: "CLOUD", + 2: "ADS", + 3: "PHOTOS", + 4: "STREET_VIEW", + 5: "SHOPPING", + 6: "GEO", + 7: "GENERATIVE_AI", + } + ClientLibraryOrganization_value = map[string]int32{ + "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": 0, + "CLOUD": 1, + "ADS": 2, + "PHOTOS": 3, + "STREET_VIEW": 4, + "SHOPPING": 5, + "GEO": 6, + "GENERATIVE_AI": 7, + } +) + +func (x ClientLibraryOrganization) Enum() *ClientLibraryOrganization { + p := new(ClientLibraryOrganization) + *p = x + return p +} + +func (x ClientLibraryOrganization) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClientLibraryOrganization) Descriptor() protoreflect.EnumDescriptor { + return file_google_api_client_proto_enumTypes[0].Descriptor() +} + +func (ClientLibraryOrganization) Type() protoreflect.EnumType { + return &file_google_api_client_proto_enumTypes[0] +} + +func (x ClientLibraryOrganization) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ClientLibraryOrganization.Descriptor instead. +func (ClientLibraryOrganization) EnumDescriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{0} +} + +// To where should client libraries be published? +type ClientLibraryDestination int32 + +const ( + // Client libraries will neither be generated nor published to package + // managers. + ClientLibraryDestination_CLIENT_LIBRARY_DESTINATION_UNSPECIFIED ClientLibraryDestination = 0 + // Generate the client library in a repo under github.com/googleapis, + // but don't publish it to package managers. + ClientLibraryDestination_GITHUB ClientLibraryDestination = 10 + // Publish the library to package managers like nuget.org and npmjs.com. + ClientLibraryDestination_PACKAGE_MANAGER ClientLibraryDestination = 20 +) + +// Enum value maps for ClientLibraryDestination. +var ( + ClientLibraryDestination_name = map[int32]string{ + 0: "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED", + 10: "GITHUB", + 20: "PACKAGE_MANAGER", + } + ClientLibraryDestination_value = map[string]int32{ + "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": 0, + "GITHUB": 10, + "PACKAGE_MANAGER": 20, + } +) + +func (x ClientLibraryDestination) Enum() *ClientLibraryDestination { + p := new(ClientLibraryDestination) + *p = x + return p +} + +func (x ClientLibraryDestination) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClientLibraryDestination) Descriptor() protoreflect.EnumDescriptor { + return file_google_api_client_proto_enumTypes[1].Descriptor() +} + +func (ClientLibraryDestination) Type() protoreflect.EnumType { + return &file_google_api_client_proto_enumTypes[1] +} + +func (x ClientLibraryDestination) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ClientLibraryDestination.Descriptor instead. +func (ClientLibraryDestination) EnumDescriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{1} +} + +// Required information for every language. +type CommonLanguageSettings struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Link to automatically generated reference documentation. Example: + // https://cloud.google.com/nodejs/docs/reference/asset/latest + // + // Deprecated: Marked as deprecated in google/api/client.proto. + ReferenceDocsUri string `protobuf:"bytes,1,opt,name=reference_docs_uri,json=referenceDocsUri,proto3" json:"reference_docs_uri,omitempty"` + // The destination where API teams want this client library to be published. + Destinations []ClientLibraryDestination `protobuf:"varint,2,rep,packed,name=destinations,proto3,enum=google.api.ClientLibraryDestination" json:"destinations,omitempty"` + // Configuration for which RPCs should be generated in the GAPIC client. + SelectiveGapicGeneration *SelectiveGapicGeneration `protobuf:"bytes,3,opt,name=selective_gapic_generation,json=selectiveGapicGeneration,proto3" json:"selective_gapic_generation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CommonLanguageSettings) Reset() { + *x = CommonLanguageSettings{} + mi := &file_google_api_client_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CommonLanguageSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommonLanguageSettings) ProtoMessage() {} + +func (x *CommonLanguageSettings) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CommonLanguageSettings.ProtoReflect.Descriptor instead. +func (*CommonLanguageSettings) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{0} +} + +// Deprecated: Marked as deprecated in google/api/client.proto. +func (x *CommonLanguageSettings) GetReferenceDocsUri() string { + if x != nil { + return x.ReferenceDocsUri + } + return "" +} + +func (x *CommonLanguageSettings) GetDestinations() []ClientLibraryDestination { + if x != nil { + return x.Destinations + } + return nil +} + +func (x *CommonLanguageSettings) GetSelectiveGapicGeneration() *SelectiveGapicGeneration { + if x != nil { + return x.SelectiveGapicGeneration + } + return nil +} + +// Details about how and where to publish client libraries. +type ClientLibrarySettings struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Version of the API to apply these settings to. This is the full protobuf + // package for the API, ending in the version element. + // Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1". + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // Launch stage of this version of the API. + LaunchStage api.LaunchStage `protobuf:"varint,2,opt,name=launch_stage,json=launchStage,proto3,enum=google.api.LaunchStage" json:"launch_stage,omitempty"` + // When using transport=rest, the client request will encode enums as + // numbers rather than strings. + RestNumericEnums bool `protobuf:"varint,3,opt,name=rest_numeric_enums,json=restNumericEnums,proto3" json:"rest_numeric_enums,omitempty"` + // Settings for legacy Java features, supported in the Service YAML. + JavaSettings *JavaSettings `protobuf:"bytes,21,opt,name=java_settings,json=javaSettings,proto3" json:"java_settings,omitempty"` + // Settings for C++ client libraries. + CppSettings *CppSettings `protobuf:"bytes,22,opt,name=cpp_settings,json=cppSettings,proto3" json:"cpp_settings,omitempty"` + // Settings for PHP client libraries. + PhpSettings *PhpSettings `protobuf:"bytes,23,opt,name=php_settings,json=phpSettings,proto3" json:"php_settings,omitempty"` + // Settings for Python client libraries. + PythonSettings *PythonSettings `protobuf:"bytes,24,opt,name=python_settings,json=pythonSettings,proto3" json:"python_settings,omitempty"` + // Settings for Node client libraries. + NodeSettings *NodeSettings `protobuf:"bytes,25,opt,name=node_settings,json=nodeSettings,proto3" json:"node_settings,omitempty"` + // Settings for .NET client libraries. + DotnetSettings *DotnetSettings `protobuf:"bytes,26,opt,name=dotnet_settings,json=dotnetSettings,proto3" json:"dotnet_settings,omitempty"` + // Settings for Ruby client libraries. + RubySettings *RubySettings `protobuf:"bytes,27,opt,name=ruby_settings,json=rubySettings,proto3" json:"ruby_settings,omitempty"` + // Settings for Go client libraries. + GoSettings *GoSettings `protobuf:"bytes,28,opt,name=go_settings,json=goSettings,proto3" json:"go_settings,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ClientLibrarySettings) Reset() { + *x = ClientLibrarySettings{} + mi := &file_google_api_client_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ClientLibrarySettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientLibrarySettings) ProtoMessage() {} + +func (x *ClientLibrarySettings) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientLibrarySettings.ProtoReflect.Descriptor instead. +func (*ClientLibrarySettings) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{1} +} + +func (x *ClientLibrarySettings) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *ClientLibrarySettings) GetLaunchStage() api.LaunchStage { + if x != nil { + return x.LaunchStage + } + return api.LaunchStage(0) +} + +func (x *ClientLibrarySettings) GetRestNumericEnums() bool { + if x != nil { + return x.RestNumericEnums + } + return false +} + +func (x *ClientLibrarySettings) GetJavaSettings() *JavaSettings { + if x != nil { + return x.JavaSettings + } + return nil +} + +func (x *ClientLibrarySettings) GetCppSettings() *CppSettings { + if x != nil { + return x.CppSettings + } + return nil +} + +func (x *ClientLibrarySettings) GetPhpSettings() *PhpSettings { + if x != nil { + return x.PhpSettings + } + return nil +} + +func (x *ClientLibrarySettings) GetPythonSettings() *PythonSettings { + if x != nil { + return x.PythonSettings + } + return nil +} + +func (x *ClientLibrarySettings) GetNodeSettings() *NodeSettings { + if x != nil { + return x.NodeSettings + } + return nil +} + +func (x *ClientLibrarySettings) GetDotnetSettings() *DotnetSettings { + if x != nil { + return x.DotnetSettings + } + return nil +} + +func (x *ClientLibrarySettings) GetRubySettings() *RubySettings { + if x != nil { + return x.RubySettings + } + return nil +} + +func (x *ClientLibrarySettings) GetGoSettings() *GoSettings { + if x != nil { + return x.GoSettings + } + return nil +} + +// This message configures the settings for publishing [Google Cloud Client +// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) +// generated from the service config. +type Publishing struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A list of API method settings, e.g. the behavior for methods that use the + // long-running operation pattern. + MethodSettings []*MethodSettings `protobuf:"bytes,2,rep,name=method_settings,json=methodSettings,proto3" json:"method_settings,omitempty"` + // Link to a *public* URI where users can report issues. Example: + // https://issuetracker.google.com/issues/new?component=190865&template=1161103 + NewIssueUri string `protobuf:"bytes,101,opt,name=new_issue_uri,json=newIssueUri,proto3" json:"new_issue_uri,omitempty"` + // Link to product home page. Example: + // https://cloud.google.com/asset-inventory/docs/overview + DocumentationUri string `protobuf:"bytes,102,opt,name=documentation_uri,json=documentationUri,proto3" json:"documentation_uri,omitempty"` + // Used as a tracking tag when collecting data about the APIs developer + // relations artifacts like docs, packages delivered to package managers, + // etc. Example: "speech". + ApiShortName string `protobuf:"bytes,103,opt,name=api_short_name,json=apiShortName,proto3" json:"api_short_name,omitempty"` + // GitHub label to apply to issues and pull requests opened for this API. + GithubLabel string `protobuf:"bytes,104,opt,name=github_label,json=githubLabel,proto3" json:"github_label,omitempty"` + // GitHub teams to be added to CODEOWNERS in the directory in GitHub + // containing source code for the client libraries for this API. + CodeownerGithubTeams []string `protobuf:"bytes,105,rep,name=codeowner_github_teams,json=codeownerGithubTeams,proto3" json:"codeowner_github_teams,omitempty"` + // A prefix used in sample code when demarking regions to be included in + // documentation. + DocTagPrefix string `protobuf:"bytes,106,opt,name=doc_tag_prefix,json=docTagPrefix,proto3" json:"doc_tag_prefix,omitempty"` + // For whom the client library is being published. + Organization ClientLibraryOrganization `protobuf:"varint,107,opt,name=organization,proto3,enum=google.api.ClientLibraryOrganization" json:"organization,omitempty"` + // Client library settings. If the same version string appears multiple + // times in this list, then the last one wins. Settings from earlier + // settings with the same version string are discarded. + LibrarySettings []*ClientLibrarySettings `protobuf:"bytes,109,rep,name=library_settings,json=librarySettings,proto3" json:"library_settings,omitempty"` + // Optional link to proto reference documentation. Example: + // https://cloud.google.com/pubsub/lite/docs/reference/rpc + ProtoReferenceDocumentationUri string `protobuf:"bytes,110,opt,name=proto_reference_documentation_uri,json=protoReferenceDocumentationUri,proto3" json:"proto_reference_documentation_uri,omitempty"` + // Optional link to REST reference documentation. Example: + // https://cloud.google.com/pubsub/lite/docs/reference/rest + RestReferenceDocumentationUri string `protobuf:"bytes,111,opt,name=rest_reference_documentation_uri,json=restReferenceDocumentationUri,proto3" json:"rest_reference_documentation_uri,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Publishing) Reset() { + *x = Publishing{} + mi := &file_google_api_client_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Publishing) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Publishing) ProtoMessage() {} + +func (x *Publishing) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Publishing.ProtoReflect.Descriptor instead. +func (*Publishing) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{2} +} + +func (x *Publishing) GetMethodSettings() []*MethodSettings { + if x != nil { + return x.MethodSettings + } + return nil +} + +func (x *Publishing) GetNewIssueUri() string { + if x != nil { + return x.NewIssueUri + } + return "" +} + +func (x *Publishing) GetDocumentationUri() string { + if x != nil { + return x.DocumentationUri + } + return "" +} + +func (x *Publishing) GetApiShortName() string { + if x != nil { + return x.ApiShortName + } + return "" +} + +func (x *Publishing) GetGithubLabel() string { + if x != nil { + return x.GithubLabel + } + return "" +} + +func (x *Publishing) GetCodeownerGithubTeams() []string { + if x != nil { + return x.CodeownerGithubTeams + } + return nil +} + +func (x *Publishing) GetDocTagPrefix() string { + if x != nil { + return x.DocTagPrefix + } + return "" +} + +func (x *Publishing) GetOrganization() ClientLibraryOrganization { + if x != nil { + return x.Organization + } + return ClientLibraryOrganization_CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED +} + +func (x *Publishing) GetLibrarySettings() []*ClientLibrarySettings { + if x != nil { + return x.LibrarySettings + } + return nil +} + +func (x *Publishing) GetProtoReferenceDocumentationUri() string { + if x != nil { + return x.ProtoReferenceDocumentationUri + } + return "" +} + +func (x *Publishing) GetRestReferenceDocumentationUri() string { + if x != nil { + return x.RestReferenceDocumentationUri + } + return "" +} + +// Settings for Java client libraries. +type JavaSettings struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The package name to use in Java. Clobbers the java_package option + // set in the protobuf. This should be used **only** by APIs + // who have already set the language_settings.java.package_name" field + // in gapic.yaml. API teams should use the protobuf java_package option + // where possible. + // + // Example of a YAML configuration:: + // + // publishing: + // java_settings: + // library_package: com.google.cloud.pubsub.v1 + LibraryPackage string `protobuf:"bytes,1,opt,name=library_package,json=libraryPackage,proto3" json:"library_package,omitempty"` + // Configure the Java class name to use instead of the service's for its + // corresponding generated GAPIC client. Keys are fully-qualified + // service names as they appear in the protobuf (including the full + // the language_settings.java.interface_names" field in gapic.yaml. API + // teams should otherwise use the service name as it appears in the + // protobuf. + // + // Example of a YAML configuration:: + // + // publishing: + // java_settings: + // service_class_names: + // - google.pubsub.v1.Publisher: TopicAdmin + // - google.pubsub.v1.Subscriber: SubscriptionAdmin + ServiceClassNames map[string]string `protobuf:"bytes,2,rep,name=service_class_names,json=serviceClassNames,proto3" json:"service_class_names,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Some settings. + Common *CommonLanguageSettings `protobuf:"bytes,3,opt,name=common,proto3" json:"common,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *JavaSettings) Reset() { + *x = JavaSettings{} + mi := &file_google_api_client_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *JavaSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JavaSettings) ProtoMessage() {} + +func (x *JavaSettings) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JavaSettings.ProtoReflect.Descriptor instead. +func (*JavaSettings) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{3} +} + +func (x *JavaSettings) GetLibraryPackage() string { + if x != nil { + return x.LibraryPackage + } + return "" +} + +func (x *JavaSettings) GetServiceClassNames() map[string]string { + if x != nil { + return x.ServiceClassNames + } + return nil +} + +func (x *JavaSettings) GetCommon() *CommonLanguageSettings { + if x != nil { + return x.Common + } + return nil +} + +// Settings for C++ client libraries. +type CppSettings struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Some settings. + Common *CommonLanguageSettings `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CppSettings) Reset() { + *x = CppSettings{} + mi := &file_google_api_client_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CppSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CppSettings) ProtoMessage() {} + +func (x *CppSettings) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CppSettings.ProtoReflect.Descriptor instead. +func (*CppSettings) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{4} +} + +func (x *CppSettings) GetCommon() *CommonLanguageSettings { + if x != nil { + return x.Common + } + return nil +} + +// Settings for Php client libraries. +type PhpSettings struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Some settings. + Common *CommonLanguageSettings `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PhpSettings) Reset() { + *x = PhpSettings{} + mi := &file_google_api_client_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PhpSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PhpSettings) ProtoMessage() {} + +func (x *PhpSettings) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PhpSettings.ProtoReflect.Descriptor instead. +func (*PhpSettings) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{5} +} + +func (x *PhpSettings) GetCommon() *CommonLanguageSettings { + if x != nil { + return x.Common + } + return nil +} + +// Settings for Python client libraries. +type PythonSettings struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Some settings. + Common *CommonLanguageSettings `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"` + // Experimental features to be included during client library generation. + ExperimentalFeatures *PythonSettings_ExperimentalFeatures `protobuf:"bytes,2,opt,name=experimental_features,json=experimentalFeatures,proto3" json:"experimental_features,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PythonSettings) Reset() { + *x = PythonSettings{} + mi := &file_google_api_client_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PythonSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PythonSettings) ProtoMessage() {} + +func (x *PythonSettings) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PythonSettings.ProtoReflect.Descriptor instead. +func (*PythonSettings) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{6} +} + +func (x *PythonSettings) GetCommon() *CommonLanguageSettings { + if x != nil { + return x.Common + } + return nil +} + +func (x *PythonSettings) GetExperimentalFeatures() *PythonSettings_ExperimentalFeatures { + if x != nil { + return x.ExperimentalFeatures + } + return nil +} + +// Settings for Node client libraries. +type NodeSettings struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Some settings. + Common *CommonLanguageSettings `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NodeSettings) Reset() { + *x = NodeSettings{} + mi := &file_google_api_client_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NodeSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeSettings) ProtoMessage() {} + +func (x *NodeSettings) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodeSettings.ProtoReflect.Descriptor instead. +func (*NodeSettings) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{7} +} + +func (x *NodeSettings) GetCommon() *CommonLanguageSettings { + if x != nil { + return x.Common + } + return nil +} + +// Settings for Dotnet client libraries. +type DotnetSettings struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Some settings. + Common *CommonLanguageSettings `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"` + // Map from original service names to renamed versions. + // This is used when the default generated types + // would cause a naming conflict. (Neither name is + // fully-qualified.) + // Example: Subscriber to SubscriberServiceApi. + RenamedServices map[string]string `protobuf:"bytes,2,rep,name=renamed_services,json=renamedServices,proto3" json:"renamed_services,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Map from full resource types to the effective short name + // for the resource. This is used when otherwise resource + // named from different services would cause naming collisions. + // Example entry: + // "datalabeling.googleapis.com/Dataset": "DataLabelingDataset" + RenamedResources map[string]string `protobuf:"bytes,3,rep,name=renamed_resources,json=renamedResources,proto3" json:"renamed_resources,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // List of full resource types to ignore during generation. + // This is typically used for API-specific Location resources, + // which should be handled by the generator as if they were actually + // the common Location resources. + // Example entry: "documentai.googleapis.com/Location" + IgnoredResources []string `protobuf:"bytes,4,rep,name=ignored_resources,json=ignoredResources,proto3" json:"ignored_resources,omitempty"` + // Namespaces which must be aliased in snippets due to + // a known (but non-generator-predictable) naming collision + ForcedNamespaceAliases []string `protobuf:"bytes,5,rep,name=forced_namespace_aliases,json=forcedNamespaceAliases,proto3" json:"forced_namespace_aliases,omitempty"` + // Method signatures (in the form "service.method(signature)") + // which are provided separately, so shouldn't be generated. + // Snippets *calling* these methods are still generated, however. + HandwrittenSignatures []string `protobuf:"bytes,6,rep,name=handwritten_signatures,json=handwrittenSignatures,proto3" json:"handwritten_signatures,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DotnetSettings) Reset() { + *x = DotnetSettings{} + mi := &file_google_api_client_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DotnetSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DotnetSettings) ProtoMessage() {} + +func (x *DotnetSettings) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DotnetSettings.ProtoReflect.Descriptor instead. +func (*DotnetSettings) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{8} +} + +func (x *DotnetSettings) GetCommon() *CommonLanguageSettings { + if x != nil { + return x.Common + } + return nil +} + +func (x *DotnetSettings) GetRenamedServices() map[string]string { + if x != nil { + return x.RenamedServices + } + return nil +} + +func (x *DotnetSettings) GetRenamedResources() map[string]string { + if x != nil { + return x.RenamedResources + } + return nil +} + +func (x *DotnetSettings) GetIgnoredResources() []string { + if x != nil { + return x.IgnoredResources + } + return nil +} + +func (x *DotnetSettings) GetForcedNamespaceAliases() []string { + if x != nil { + return x.ForcedNamespaceAliases + } + return nil +} + +func (x *DotnetSettings) GetHandwrittenSignatures() []string { + if x != nil { + return x.HandwrittenSignatures + } + return nil +} + +// Settings for Ruby client libraries. +type RubySettings struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Some settings. + Common *CommonLanguageSettings `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RubySettings) Reset() { + *x = RubySettings{} + mi := &file_google_api_client_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RubySettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RubySettings) ProtoMessage() {} + +func (x *RubySettings) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RubySettings.ProtoReflect.Descriptor instead. +func (*RubySettings) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{9} +} + +func (x *RubySettings) GetCommon() *CommonLanguageSettings { + if x != nil { + return x.Common + } + return nil +} + +// Settings for Go client libraries. +type GoSettings struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Some settings. + Common *CommonLanguageSettings `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"` + // Map of service names to renamed services. Keys are the package relative + // service names and values are the name to be used for the service client + // and call options. + // + // publishing: + // + // go_settings: + // renamed_services: + // Publisher: TopicAdmin + RenamedServices map[string]string `protobuf:"bytes,2,rep,name=renamed_services,json=renamedServices,proto3" json:"renamed_services,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GoSettings) Reset() { + *x = GoSettings{} + mi := &file_google_api_client_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GoSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GoSettings) ProtoMessage() {} + +func (x *GoSettings) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GoSettings.ProtoReflect.Descriptor instead. +func (*GoSettings) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{10} +} + +func (x *GoSettings) GetCommon() *CommonLanguageSettings { + if x != nil { + return x.Common + } + return nil +} + +func (x *GoSettings) GetRenamedServices() map[string]string { + if x != nil { + return x.RenamedServices + } + return nil +} + +// Describes the generator configuration for a method. +type MethodSettings struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The fully qualified name of the method, for which the options below apply. + // This is used to find the method to apply the options. + // + // Example: + // + // publishing: + // method_settings: + // - selector: google.storage.control.v2.StorageControl.CreateFolder + // # method settings for CreateFolder... + Selector string `protobuf:"bytes,1,opt,name=selector,proto3" json:"selector,omitempty"` + // Describes settings to use for long-running operations when generating + // API methods for RPCs. Complements RPCs that use the annotations in + // google/longrunning/operations.proto. + // + // Example of a YAML configuration:: + // + // publishing: + // method_settings: + // - selector: google.cloud.speech.v2.Speech.BatchRecognize + // long_running: + // initial_poll_delay: 60s # 1 minute + // poll_delay_multiplier: 1.5 + // max_poll_delay: 360s # 6 minutes + // total_poll_timeout: 54000s # 90 minutes + LongRunning *MethodSettings_LongRunning `protobuf:"bytes,2,opt,name=long_running,json=longRunning,proto3" json:"long_running,omitempty"` + // List of top-level fields of the request message, that should be + // automatically populated by the client libraries based on their + // (google.api.field_info).format. Currently supported format: UUID4. + // + // Example of a YAML configuration: + // + // publishing: + // method_settings: + // - selector: google.example.v1.ExampleService.CreateExample + // auto_populated_fields: + // - request_id + AutoPopulatedFields []string `protobuf:"bytes,3,rep,name=auto_populated_fields,json=autoPopulatedFields,proto3" json:"auto_populated_fields,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MethodSettings) Reset() { + *x = MethodSettings{} + mi := &file_google_api_client_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MethodSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MethodSettings) ProtoMessage() {} + +func (x *MethodSettings) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MethodSettings.ProtoReflect.Descriptor instead. +func (*MethodSettings) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{11} +} + +func (x *MethodSettings) GetSelector() string { + if x != nil { + return x.Selector + } + return "" +} + +func (x *MethodSettings) GetLongRunning() *MethodSettings_LongRunning { + if x != nil { + return x.LongRunning + } + return nil +} + +func (x *MethodSettings) GetAutoPopulatedFields() []string { + if x != nil { + return x.AutoPopulatedFields + } + return nil +} + +// This message is used to configure the generation of a subset of the RPCs in +// a service for client libraries. +type SelectiveGapicGeneration struct { + state protoimpl.MessageState `protogen:"open.v1"` + // An allowlist of the fully qualified names of RPCs that should be included + // on public client surfaces. + Methods []string `protobuf:"bytes,1,rep,name=methods,proto3" json:"methods,omitempty"` + // Setting this to true indicates to the client generators that methods + // that would be excluded from the generation should instead be generated + // in a way that indicates these methods should not be consumed by + // end users. How this is expressed is up to individual language + // implementations to decide. Some examples may be: added annotations, + // obfuscated identifiers, or other language idiomatic patterns. + GenerateOmittedAsInternal bool `protobuf:"varint,2,opt,name=generate_omitted_as_internal,json=generateOmittedAsInternal,proto3" json:"generate_omitted_as_internal,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SelectiveGapicGeneration) Reset() { + *x = SelectiveGapicGeneration{} + mi := &file_google_api_client_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SelectiveGapicGeneration) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SelectiveGapicGeneration) ProtoMessage() {} + +func (x *SelectiveGapicGeneration) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SelectiveGapicGeneration.ProtoReflect.Descriptor instead. +func (*SelectiveGapicGeneration) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{12} +} + +func (x *SelectiveGapicGeneration) GetMethods() []string { + if x != nil { + return x.Methods + } + return nil +} + +func (x *SelectiveGapicGeneration) GetGenerateOmittedAsInternal() bool { + if x != nil { + return x.GenerateOmittedAsInternal + } + return false +} + +// Experimental features to be included during client library generation. +// These fields will be deprecated once the feature graduates and is enabled +// by default. +type PythonSettings_ExperimentalFeatures struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Enables generation of asynchronous REST clients if `rest` transport is + // enabled. By default, asynchronous REST clients will not be generated. + // This feature will be enabled by default 1 month after launching the + // feature in preview packages. + RestAsyncIoEnabled bool `protobuf:"varint,1,opt,name=rest_async_io_enabled,json=restAsyncIoEnabled,proto3" json:"rest_async_io_enabled,omitempty"` + // Enables generation of protobuf code using new types that are more + // Pythonic which are included in `protobuf>=5.29.x`. This feature will be + // enabled by default 1 month after launching the feature in preview + // packages. + ProtobufPythonicTypesEnabled bool `protobuf:"varint,2,opt,name=protobuf_pythonic_types_enabled,json=protobufPythonicTypesEnabled,proto3" json:"protobuf_pythonic_types_enabled,omitempty"` + // Disables generation of an unversioned Python package for this client + // library. This means that the module names will need to be versioned in + // import statements. For example `import google.cloud.library_v2` instead + // of `import google.cloud.library`. + UnversionedPackageDisabled bool `protobuf:"varint,3,opt,name=unversioned_package_disabled,json=unversionedPackageDisabled,proto3" json:"unversioned_package_disabled,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PythonSettings_ExperimentalFeatures) Reset() { + *x = PythonSettings_ExperimentalFeatures{} + mi := &file_google_api_client_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PythonSettings_ExperimentalFeatures) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PythonSettings_ExperimentalFeatures) ProtoMessage() {} + +func (x *PythonSettings_ExperimentalFeatures) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PythonSettings_ExperimentalFeatures.ProtoReflect.Descriptor instead. +func (*PythonSettings_ExperimentalFeatures) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{6, 0} +} + +func (x *PythonSettings_ExperimentalFeatures) GetRestAsyncIoEnabled() bool { + if x != nil { + return x.RestAsyncIoEnabled + } + return false +} + +func (x *PythonSettings_ExperimentalFeatures) GetProtobufPythonicTypesEnabled() bool { + if x != nil { + return x.ProtobufPythonicTypesEnabled + } + return false +} + +func (x *PythonSettings_ExperimentalFeatures) GetUnversionedPackageDisabled() bool { + if x != nil { + return x.UnversionedPackageDisabled + } + return false +} + +// Describes settings to use when generating API methods that use the +// long-running operation pattern. +// All default values below are from those used in the client library +// generators (e.g. +// [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)). +type MethodSettings_LongRunning struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Initial delay after which the first poll request will be made. + // Default value: 5 seconds. + InitialPollDelay *durationpb.Duration `protobuf:"bytes,1,opt,name=initial_poll_delay,json=initialPollDelay,proto3" json:"initial_poll_delay,omitempty"` + // Multiplier to gradually increase delay between subsequent polls until it + // reaches max_poll_delay. + // Default value: 1.5. + PollDelayMultiplier float32 `protobuf:"fixed32,2,opt,name=poll_delay_multiplier,json=pollDelayMultiplier,proto3" json:"poll_delay_multiplier,omitempty"` + // Maximum time between two subsequent poll requests. + // Default value: 45 seconds. + MaxPollDelay *durationpb.Duration `protobuf:"bytes,3,opt,name=max_poll_delay,json=maxPollDelay,proto3" json:"max_poll_delay,omitempty"` + // Total polling timeout. + // Default value: 5 minutes. + TotalPollTimeout *durationpb.Duration `protobuf:"bytes,4,opt,name=total_poll_timeout,json=totalPollTimeout,proto3" json:"total_poll_timeout,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MethodSettings_LongRunning) Reset() { + *x = MethodSettings_LongRunning{} + mi := &file_google_api_client_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MethodSettings_LongRunning) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MethodSettings_LongRunning) ProtoMessage() {} + +func (x *MethodSettings_LongRunning) ProtoReflect() protoreflect.Message { + mi := &file_google_api_client_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MethodSettings_LongRunning.ProtoReflect.Descriptor instead. +func (*MethodSettings_LongRunning) Descriptor() ([]byte, []int) { + return file_google_api_client_proto_rawDescGZIP(), []int{11, 0} +} + +func (x *MethodSettings_LongRunning) GetInitialPollDelay() *durationpb.Duration { + if x != nil { + return x.InitialPollDelay + } + return nil +} + +func (x *MethodSettings_LongRunning) GetPollDelayMultiplier() float32 { + if x != nil { + return x.PollDelayMultiplier + } + return 0 +} + +func (x *MethodSettings_LongRunning) GetMaxPollDelay() *durationpb.Duration { + if x != nil { + return x.MaxPollDelay + } + return nil +} + +func (x *MethodSettings_LongRunning) GetTotalPollTimeout() *durationpb.Duration { + if x != nil { + return x.TotalPollTimeout + } + return nil +} + +var file_google_api_client_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptorpb.MethodOptions)(nil), + ExtensionType: ([]string)(nil), + Field: 1051, + Name: "google.api.method_signature", + Tag: "bytes,1051,rep,name=method_signature", + Filename: "google/api/client.proto", + }, + { + ExtendedType: (*descriptorpb.ServiceOptions)(nil), + ExtensionType: (*string)(nil), + Field: 1049, + Name: "google.api.default_host", + Tag: "bytes,1049,opt,name=default_host", + Filename: "google/api/client.proto", + }, + { + ExtendedType: (*descriptorpb.ServiceOptions)(nil), + ExtensionType: (*string)(nil), + Field: 1050, + Name: "google.api.oauth_scopes", + Tag: "bytes,1050,opt,name=oauth_scopes", + Filename: "google/api/client.proto", + }, + { + ExtendedType: (*descriptorpb.ServiceOptions)(nil), + ExtensionType: (*string)(nil), + Field: 525000001, + Name: "google.api.api_version", + Tag: "bytes,525000001,opt,name=api_version", + Filename: "google/api/client.proto", + }, +} + +// Extension fields to descriptorpb.MethodOptions. +var ( + // A definition of a client library method signature. + // + // In client libraries, each proto RPC corresponds to one or more methods + // which the end user is able to call, and calls the underlying RPC. + // Normally, this method receives a single argument (a struct or instance + // corresponding to the RPC request object). Defining this field will + // add one or more overloads providing flattened or simpler method signatures + // in some languages. + // + // The fields on the method signature are provided as a comma-separated + // string. + // + // For example, the proto RPC and annotation: + // + // rpc CreateSubscription(CreateSubscriptionRequest) + // returns (Subscription) { + // option (google.api.method_signature) = "name,topic"; + // } + // + // Would add the following Java overload (in addition to the method accepting + // the request object): + // + // public final Subscription createSubscription(String name, String topic) + // + // The following backwards-compatibility guidelines apply: + // + // - Adding this annotation to an unannotated method is backwards + // compatible. + // - Adding this annotation to a method which already has existing + // method signature annotations is backwards compatible if and only if + // the new method signature annotation is last in the sequence. + // - Modifying or removing an existing method signature annotation is + // a breaking change. + // - Re-ordering existing method signature annotations is a breaking + // change. + // + // repeated string method_signature = 1051; + E_MethodSignature = &file_google_api_client_proto_extTypes[0] +) + +// Extension fields to descriptorpb.ServiceOptions. +var ( + // The hostname for this service. + // This should be specified with no prefix or protocol. + // + // Example: + // + // service Foo { + // option (google.api.default_host) = "foo.googleapi.com"; + // ... + // } + // + // optional string default_host = 1049; + E_DefaultHost = &file_google_api_client_proto_extTypes[1] + // OAuth scopes needed for the client. + // + // Example: + // + // service Foo { + // option (google.api.oauth_scopes) = \ + // "https://www.googleapis.com/auth/cloud-platform"; + // ... + // } + // + // If there is more than one scope, use a comma-separated string: + // + // Example: + // + // service Foo { + // option (google.api.oauth_scopes) = \ + // "https://www.googleapis.com/auth/cloud-platform," + // "https://www.googleapis.com/auth/monitoring"; + // ... + // } + // + // optional string oauth_scopes = 1050; + E_OauthScopes = &file_google_api_client_proto_extTypes[2] + // The API version of this service, which should be sent by version-aware + // clients to the service. This allows services to abide by the schema and + // behavior of the service at the time this API version was deployed. + // The format of the API version must be treated as opaque by clients. + // Services may use a format with an apparent structure, but clients must + // not rely on this to determine components within an API version, or attempt + // to construct other valid API versions. Note that this is for upcoming + // functionality and may not be implemented for all services. + // + // Example: + // + // service Foo { + // option (google.api.api_version) = "v1_20230821_preview"; + // } + // + // optional string api_version = 525000001; + E_ApiVersion = &file_google_api_client_proto_extTypes[3] +) + +var File_google_api_client_proto protoreflect.FileDescriptor + +const file_google_api_client_proto_rawDesc = "" + + "\n" + + "\x17google/api/client.proto\x12\n" + + "google.api\x1a\x1dgoogle/api/launch_stage.proto\x1a google/protobuf/descriptor.proto\x1a\x1egoogle/protobuf/duration.proto\"\xf8\x01\n" + + "\x16CommonLanguageSettings\x120\n" + + "\x12reference_docs_uri\x18\x01 \x01(\tB\x02\x18\x01R\x10referenceDocsUri\x12H\n" + + "\fdestinations\x18\x02 \x03(\x0e2$.google.api.ClientLibraryDestinationR\fdestinations\x12b\n" + + "\x1aselective_gapic_generation\x18\x03 \x01(\v2$.google.api.SelectiveGapicGenerationR\x18selectiveGapicGeneration\"\x93\x05\n" + + "\x15ClientLibrarySettings\x12\x18\n" + + "\aversion\x18\x01 \x01(\tR\aversion\x12:\n" + + "\flaunch_stage\x18\x02 \x01(\x0e2\x17.google.api.LaunchStageR\vlaunchStage\x12,\n" + + "\x12rest_numeric_enums\x18\x03 \x01(\bR\x10restNumericEnums\x12=\n" + + "\rjava_settings\x18\x15 \x01(\v2\x18.google.api.JavaSettingsR\fjavaSettings\x12:\n" + + "\fcpp_settings\x18\x16 \x01(\v2\x17.google.api.CppSettingsR\vcppSettings\x12:\n" + + "\fphp_settings\x18\x17 \x01(\v2\x17.google.api.PhpSettingsR\vphpSettings\x12C\n" + + "\x0fpython_settings\x18\x18 \x01(\v2\x1a.google.api.PythonSettingsR\x0epythonSettings\x12=\n" + + "\rnode_settings\x18\x19 \x01(\v2\x18.google.api.NodeSettingsR\fnodeSettings\x12C\n" + + "\x0fdotnet_settings\x18\x1a \x01(\v2\x1a.google.api.DotnetSettingsR\x0edotnetSettings\x12=\n" + + "\rruby_settings\x18\x1b \x01(\v2\x18.google.api.RubySettingsR\frubySettings\x127\n" + + "\vgo_settings\x18\x1c \x01(\v2\x16.google.api.GoSettingsR\n" + + "goSettings\"\xf4\x04\n" + + "\n" + + "Publishing\x12C\n" + + "\x0fmethod_settings\x18\x02 \x03(\v2\x1a.google.api.MethodSettingsR\x0emethodSettings\x12\"\n" + + "\rnew_issue_uri\x18e \x01(\tR\vnewIssueUri\x12+\n" + + "\x11documentation_uri\x18f \x01(\tR\x10documentationUri\x12$\n" + + "\x0eapi_short_name\x18g \x01(\tR\fapiShortName\x12!\n" + + "\fgithub_label\x18h \x01(\tR\vgithubLabel\x124\n" + + "\x16codeowner_github_teams\x18i \x03(\tR\x14codeownerGithubTeams\x12$\n" + + "\x0edoc_tag_prefix\x18j \x01(\tR\fdocTagPrefix\x12I\n" + + "\forganization\x18k \x01(\x0e2%.google.api.ClientLibraryOrganizationR\forganization\x12L\n" + + "\x10library_settings\x18m \x03(\v2!.google.api.ClientLibrarySettingsR\x0flibrarySettings\x12I\n" + + "!proto_reference_documentation_uri\x18n \x01(\tR\x1eprotoReferenceDocumentationUri\x12G\n" + + " rest_reference_documentation_uri\x18o \x01(\tR\x1drestReferenceDocumentationUri\"\x9a\x02\n" + + "\fJavaSettings\x12'\n" + + "\x0flibrary_package\x18\x01 \x01(\tR\x0elibraryPackage\x12_\n" + + "\x13service_class_names\x18\x02 \x03(\v2/.google.api.JavaSettings.ServiceClassNamesEntryR\x11serviceClassNames\x12:\n" + + "\x06common\x18\x03 \x01(\v2\".google.api.CommonLanguageSettingsR\x06common\x1aD\n" + + "\x16ServiceClassNamesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"I\n" + + "\vCppSettings\x12:\n" + + "\x06common\x18\x01 \x01(\v2\".google.api.CommonLanguageSettingsR\x06common\"I\n" + + "\vPhpSettings\x12:\n" + + "\x06common\x18\x01 \x01(\v2\".google.api.CommonLanguageSettingsR\x06common\"\x87\x03\n" + + "\x0ePythonSettings\x12:\n" + + "\x06common\x18\x01 \x01(\v2\".google.api.CommonLanguageSettingsR\x06common\x12d\n" + + "\x15experimental_features\x18\x02 \x01(\v2/.google.api.PythonSettings.ExperimentalFeaturesR\x14experimentalFeatures\x1a\xd2\x01\n" + + "\x14ExperimentalFeatures\x121\n" + + "\x15rest_async_io_enabled\x18\x01 \x01(\bR\x12restAsyncIoEnabled\x12E\n" + + "\x1fprotobuf_pythonic_types_enabled\x18\x02 \x01(\bR\x1cprotobufPythonicTypesEnabled\x12@\n" + + "\x1cunversioned_package_disabled\x18\x03 \x01(\bR\x1aunversionedPackageDisabled\"J\n" + + "\fNodeSettings\x12:\n" + + "\x06common\x18\x01 \x01(\v2\".google.api.CommonLanguageSettingsR\x06common\"\xae\x04\n" + + "\x0eDotnetSettings\x12:\n" + + "\x06common\x18\x01 \x01(\v2\".google.api.CommonLanguageSettingsR\x06common\x12Z\n" + + "\x10renamed_services\x18\x02 \x03(\v2/.google.api.DotnetSettings.RenamedServicesEntryR\x0frenamedServices\x12]\n" + + "\x11renamed_resources\x18\x03 \x03(\v20.google.api.DotnetSettings.RenamedResourcesEntryR\x10renamedResources\x12+\n" + + "\x11ignored_resources\x18\x04 \x03(\tR\x10ignoredResources\x128\n" + + "\x18forced_namespace_aliases\x18\x05 \x03(\tR\x16forcedNamespaceAliases\x125\n" + + "\x16handwritten_signatures\x18\x06 \x03(\tR\x15handwrittenSignatures\x1aB\n" + + "\x14RenamedServicesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1aC\n" + + "\x15RenamedResourcesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"J\n" + + "\fRubySettings\x12:\n" + + "\x06common\x18\x01 \x01(\v2\".google.api.CommonLanguageSettingsR\x06common\"\xe4\x01\n" + + "\n" + + "GoSettings\x12:\n" + + "\x06common\x18\x01 \x01(\v2\".google.api.CommonLanguageSettingsR\x06common\x12V\n" + + "\x10renamed_services\x18\x02 \x03(\v2+.google.api.GoSettings.RenamedServicesEntryR\x0frenamedServices\x1aB\n" + + "\x14RenamedServicesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xc2\x03\n" + + "\x0eMethodSettings\x12\x1a\n" + + "\bselector\x18\x01 \x01(\tR\bselector\x12I\n" + + "\flong_running\x18\x02 \x01(\v2&.google.api.MethodSettings.LongRunningR\vlongRunning\x122\n" + + "\x15auto_populated_fields\x18\x03 \x03(\tR\x13autoPopulatedFields\x1a\x94\x02\n" + + "\vLongRunning\x12G\n" + + "\x12initial_poll_delay\x18\x01 \x01(\v2\x19.google.protobuf.DurationR\x10initialPollDelay\x122\n" + + "\x15poll_delay_multiplier\x18\x02 \x01(\x02R\x13pollDelayMultiplier\x12?\n" + + "\x0emax_poll_delay\x18\x03 \x01(\v2\x19.google.protobuf.DurationR\fmaxPollDelay\x12G\n" + + "\x12total_poll_timeout\x18\x04 \x01(\v2\x19.google.protobuf.DurationR\x10totalPollTimeout\"u\n" + + "\x18SelectiveGapicGeneration\x12\x18\n" + + "\amethods\x18\x01 \x03(\tR\amethods\x12?\n" + + "\x1cgenerate_omitted_as_internal\x18\x02 \x01(\bR\x19generateOmittedAsInternal*\xa3\x01\n" + + "\x19ClientLibraryOrganization\x12+\n" + + "'CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED\x10\x00\x12\t\n" + + "\x05CLOUD\x10\x01\x12\a\n" + + "\x03ADS\x10\x02\x12\n" + + "\n" + + "\x06PHOTOS\x10\x03\x12\x0f\n" + + "\vSTREET_VIEW\x10\x04\x12\f\n" + + "\bSHOPPING\x10\x05\x12\a\n" + + "\x03GEO\x10\x06\x12\x11\n" + + "\rGENERATIVE_AI\x10\a*g\n" + + "\x18ClientLibraryDestination\x12*\n" + + "&CLIENT_LIBRARY_DESTINATION_UNSPECIFIED\x10\x00\x12\n" + + "\n" + + "\x06GITHUB\x10\n" + + "\x12\x13\n" + + "\x0fPACKAGE_MANAGER\x10\x14:J\n" + + "\x10method_signature\x12\x1e.google.protobuf.MethodOptions\x18\x9b\b \x03(\tR\x0fmethodSignature:C\n" + + "\fdefault_host\x12\x1f.google.protobuf.ServiceOptions\x18\x99\b \x01(\tR\vdefaultHost:C\n" + + "\foauth_scopes\x12\x1f.google.protobuf.ServiceOptions\x18\x9a\b \x01(\tR\voauthScopes:D\n" + + "\vapi_version\x12\x1f.google.protobuf.ServiceOptions\x18\xc1\xba\xab\xfa\x01 \x01(\tR\n" + + "apiVersionB\xa9\x01\n" + + "\x0ecom.google.apiB\vClientProtoP\x01ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\xa2\x02\x03GAX\xaa\x02\n" + + "Google.Api\xca\x02\n" + + "Google\\Api\xe2\x02\x16Google\\Api\\GPBMetadata\xea\x02\vGoogle::Apib\x06proto3" + +var ( + file_google_api_client_proto_rawDescOnce sync.Once + file_google_api_client_proto_rawDescData []byte +) + +func file_google_api_client_proto_rawDescGZIP() []byte { + file_google_api_client_proto_rawDescOnce.Do(func() { + file_google_api_client_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_google_api_client_proto_rawDesc), len(file_google_api_client_proto_rawDesc))) + }) + return file_google_api_client_proto_rawDescData +} + +var file_google_api_client_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_google_api_client_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_google_api_client_proto_goTypes = []any{ + (ClientLibraryOrganization)(0), // 0: google.api.ClientLibraryOrganization + (ClientLibraryDestination)(0), // 1: google.api.ClientLibraryDestination + (*CommonLanguageSettings)(nil), // 2: google.api.CommonLanguageSettings + (*ClientLibrarySettings)(nil), // 3: google.api.ClientLibrarySettings + (*Publishing)(nil), // 4: google.api.Publishing + (*JavaSettings)(nil), // 5: google.api.JavaSettings + (*CppSettings)(nil), // 6: google.api.CppSettings + (*PhpSettings)(nil), // 7: google.api.PhpSettings + (*PythonSettings)(nil), // 8: google.api.PythonSettings + (*NodeSettings)(nil), // 9: google.api.NodeSettings + (*DotnetSettings)(nil), // 10: google.api.DotnetSettings + (*RubySettings)(nil), // 11: google.api.RubySettings + (*GoSettings)(nil), // 12: google.api.GoSettings + (*MethodSettings)(nil), // 13: google.api.MethodSettings + (*SelectiveGapicGeneration)(nil), // 14: google.api.SelectiveGapicGeneration + nil, // 15: google.api.JavaSettings.ServiceClassNamesEntry + (*PythonSettings_ExperimentalFeatures)(nil), // 16: google.api.PythonSettings.ExperimentalFeatures + nil, // 17: google.api.DotnetSettings.RenamedServicesEntry + nil, // 18: google.api.DotnetSettings.RenamedResourcesEntry + nil, // 19: google.api.GoSettings.RenamedServicesEntry + (*MethodSettings_LongRunning)(nil), // 20: google.api.MethodSettings.LongRunning + (api.LaunchStage)(0), // 21: google.api.LaunchStage + (*durationpb.Duration)(nil), // 22: google.protobuf.Duration + (*descriptorpb.MethodOptions)(nil), // 23: google.protobuf.MethodOptions + (*descriptorpb.ServiceOptions)(nil), // 24: google.protobuf.ServiceOptions +} +var file_google_api_client_proto_depIdxs = []int32{ + 1, // 0: google.api.CommonLanguageSettings.destinations:type_name -> google.api.ClientLibraryDestination + 14, // 1: google.api.CommonLanguageSettings.selective_gapic_generation:type_name -> google.api.SelectiveGapicGeneration + 21, // 2: google.api.ClientLibrarySettings.launch_stage:type_name -> google.api.LaunchStage + 5, // 3: google.api.ClientLibrarySettings.java_settings:type_name -> google.api.JavaSettings + 6, // 4: google.api.ClientLibrarySettings.cpp_settings:type_name -> google.api.CppSettings + 7, // 5: google.api.ClientLibrarySettings.php_settings:type_name -> google.api.PhpSettings + 8, // 6: google.api.ClientLibrarySettings.python_settings:type_name -> google.api.PythonSettings + 9, // 7: google.api.ClientLibrarySettings.node_settings:type_name -> google.api.NodeSettings + 10, // 8: google.api.ClientLibrarySettings.dotnet_settings:type_name -> google.api.DotnetSettings + 11, // 9: google.api.ClientLibrarySettings.ruby_settings:type_name -> google.api.RubySettings + 12, // 10: google.api.ClientLibrarySettings.go_settings:type_name -> google.api.GoSettings + 13, // 11: google.api.Publishing.method_settings:type_name -> google.api.MethodSettings + 0, // 12: google.api.Publishing.organization:type_name -> google.api.ClientLibraryOrganization + 3, // 13: google.api.Publishing.library_settings:type_name -> google.api.ClientLibrarySettings + 15, // 14: google.api.JavaSettings.service_class_names:type_name -> google.api.JavaSettings.ServiceClassNamesEntry + 2, // 15: google.api.JavaSettings.common:type_name -> google.api.CommonLanguageSettings + 2, // 16: google.api.CppSettings.common:type_name -> google.api.CommonLanguageSettings + 2, // 17: google.api.PhpSettings.common:type_name -> google.api.CommonLanguageSettings + 2, // 18: google.api.PythonSettings.common:type_name -> google.api.CommonLanguageSettings + 16, // 19: google.api.PythonSettings.experimental_features:type_name -> google.api.PythonSettings.ExperimentalFeatures + 2, // 20: google.api.NodeSettings.common:type_name -> google.api.CommonLanguageSettings + 2, // 21: google.api.DotnetSettings.common:type_name -> google.api.CommonLanguageSettings + 17, // 22: google.api.DotnetSettings.renamed_services:type_name -> google.api.DotnetSettings.RenamedServicesEntry + 18, // 23: google.api.DotnetSettings.renamed_resources:type_name -> google.api.DotnetSettings.RenamedResourcesEntry + 2, // 24: google.api.RubySettings.common:type_name -> google.api.CommonLanguageSettings + 2, // 25: google.api.GoSettings.common:type_name -> google.api.CommonLanguageSettings + 19, // 26: google.api.GoSettings.renamed_services:type_name -> google.api.GoSettings.RenamedServicesEntry + 20, // 27: google.api.MethodSettings.long_running:type_name -> google.api.MethodSettings.LongRunning + 22, // 28: google.api.MethodSettings.LongRunning.initial_poll_delay:type_name -> google.protobuf.Duration + 22, // 29: google.api.MethodSettings.LongRunning.max_poll_delay:type_name -> google.protobuf.Duration + 22, // 30: google.api.MethodSettings.LongRunning.total_poll_timeout:type_name -> google.protobuf.Duration + 23, // 31: google.api.method_signature:extendee -> google.protobuf.MethodOptions + 24, // 32: google.api.default_host:extendee -> google.protobuf.ServiceOptions + 24, // 33: google.api.oauth_scopes:extendee -> google.protobuf.ServiceOptions + 24, // 34: google.api.api_version:extendee -> google.protobuf.ServiceOptions + 35, // [35:35] is the sub-list for method output_type + 35, // [35:35] is the sub-list for method input_type + 35, // [35:35] is the sub-list for extension type_name + 31, // [31:35] is the sub-list for extension extendee + 0, // [0:31] is the sub-list for field type_name +} + +func init() { file_google_api_client_proto_init() } +func file_google_api_client_proto_init() { + if File_google_api_client_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_api_client_proto_rawDesc), len(file_google_api_client_proto_rawDesc)), + NumEnums: 2, + NumMessages: 19, + NumExtensions: 4, + NumServices: 0, + }, + GoTypes: file_google_api_client_proto_goTypes, + DependencyIndexes: file_google_api_client_proto_depIdxs, + EnumInfos: file_google_api_client_proto_enumTypes, + MessageInfos: file_google_api_client_proto_msgTypes, + ExtensionInfos: file_google_api_client_proto_extTypes, + }.Build() + File_google_api_client_proto = out.File + file_google_api_client_proto_goTypes = nil + file_google_api_client_proto_depIdxs = nil +} diff --git a/proto/gen/google/api/field_behavior.pb.go b/proto/gen/google/api/field_behavior.pb.go new file mode 100644 index 000000000..f7d80d0e0 --- /dev/null +++ b/proto/gen/google/api/field_behavior.pb.go @@ -0,0 +1,252 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc (unknown) +// source: google/api/field_behavior.proto + +package annotations + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// An indicator of the behavior of a given field (for example, that a field +// is required in requests, or given as output but ignored as input). +// This **does not** change the behavior in protocol buffers itself; it only +// denotes the behavior and may affect how API tooling handles the field. +// +// Note: This enum **may** receive new values in the future. +type FieldBehavior int32 + +const ( + // Conventional default for enums. Do not use this. + FieldBehavior_FIELD_BEHAVIOR_UNSPECIFIED FieldBehavior = 0 + // Specifically denotes a field as optional. + // While all fields in protocol buffers are optional, this may be specified + // for emphasis if appropriate. + FieldBehavior_OPTIONAL FieldBehavior = 1 + // Denotes a field as required. + // This indicates that the field **must** be provided as part of the request, + // and failure to do so will cause an error (usually `INVALID_ARGUMENT`). + FieldBehavior_REQUIRED FieldBehavior = 2 + // Denotes a field as output only. + // This indicates that the field is provided in responses, but including the + // field in a request does nothing (the server *must* ignore it and + // *must not* throw an error as a result of the field's presence). + FieldBehavior_OUTPUT_ONLY FieldBehavior = 3 + // Denotes a field as input only. + // This indicates that the field is provided in requests, and the + // corresponding field is not included in output. + FieldBehavior_INPUT_ONLY FieldBehavior = 4 + // Denotes a field as immutable. + // This indicates that the field may be set once in a request to create a + // resource, but may not be changed thereafter. + FieldBehavior_IMMUTABLE FieldBehavior = 5 + // Denotes that a (repeated) field is an unordered list. + // This indicates that the service may provide the elements of the list + // in any arbitrary order, rather than the order the user originally + // provided. Additionally, the list's order may or may not be stable. + FieldBehavior_UNORDERED_LIST FieldBehavior = 6 + // Denotes that this field returns a non-empty default value if not set. + // This indicates that if the user provides the empty value in a request, + // a non-empty value will be returned. The user will not be aware of what + // non-empty value to expect. + FieldBehavior_NON_EMPTY_DEFAULT FieldBehavior = 7 + // Denotes that the field in a resource (a message annotated with + // google.api.resource) is used in the resource name to uniquely identify the + // resource. For AIP-compliant APIs, this should only be applied to the + // `name` field on the resource. + // + // This behavior should not be applied to references to other resources within + // the message. + // + // The identifier field of resources often have different field behavior + // depending on the request it is embedded in (e.g. for Create methods name + // is optional and unused, while for Update methods it is required). Instead + // of method-specific annotations, only `IDENTIFIER` is required. + FieldBehavior_IDENTIFIER FieldBehavior = 8 +) + +// Enum value maps for FieldBehavior. +var ( + FieldBehavior_name = map[int32]string{ + 0: "FIELD_BEHAVIOR_UNSPECIFIED", + 1: "OPTIONAL", + 2: "REQUIRED", + 3: "OUTPUT_ONLY", + 4: "INPUT_ONLY", + 5: "IMMUTABLE", + 6: "UNORDERED_LIST", + 7: "NON_EMPTY_DEFAULT", + 8: "IDENTIFIER", + } + FieldBehavior_value = map[string]int32{ + "FIELD_BEHAVIOR_UNSPECIFIED": 0, + "OPTIONAL": 1, + "REQUIRED": 2, + "OUTPUT_ONLY": 3, + "INPUT_ONLY": 4, + "IMMUTABLE": 5, + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7, + "IDENTIFIER": 8, + } +) + +func (x FieldBehavior) Enum() *FieldBehavior { + p := new(FieldBehavior) + *p = x + return p +} + +func (x FieldBehavior) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FieldBehavior) Descriptor() protoreflect.EnumDescriptor { + return file_google_api_field_behavior_proto_enumTypes[0].Descriptor() +} + +func (FieldBehavior) Type() protoreflect.EnumType { + return &file_google_api_field_behavior_proto_enumTypes[0] +} + +func (x FieldBehavior) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use FieldBehavior.Descriptor instead. +func (FieldBehavior) EnumDescriptor() ([]byte, []int) { + return file_google_api_field_behavior_proto_rawDescGZIP(), []int{0} +} + +var file_google_api_field_behavior_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptorpb.FieldOptions)(nil), + ExtensionType: ([]FieldBehavior)(nil), + Field: 1052, + Name: "google.api.field_behavior", + Tag: "varint,1052,rep,name=field_behavior,enum=google.api.FieldBehavior", + Filename: "google/api/field_behavior.proto", + }, +} + +// Extension fields to descriptorpb.FieldOptions. +var ( + // A designation of a specific field behavior (required, output only, etc.) + // in protobuf messages. + // + // Examples: + // + // string name = 1 [(google.api.field_behavior) = REQUIRED]; + // State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + // google.protobuf.Duration ttl = 1 + // [(google.api.field_behavior) = INPUT_ONLY]; + // google.protobuf.Timestamp expire_time = 1 + // [(google.api.field_behavior) = OUTPUT_ONLY, + // (google.api.field_behavior) = IMMUTABLE]; + // + // repeated google.api.FieldBehavior field_behavior = 1052; + E_FieldBehavior = &file_google_api_field_behavior_proto_extTypes[0] +) + +var File_google_api_field_behavior_proto protoreflect.FileDescriptor + +const file_google_api_field_behavior_proto_rawDesc = "" + + "\n" + + "\x1fgoogle/api/field_behavior.proto\x12\n" + + "google.api\x1a google/protobuf/descriptor.proto*\xb6\x01\n" + + "\rFieldBehavior\x12\x1e\n" + + "\x1aFIELD_BEHAVIOR_UNSPECIFIED\x10\x00\x12\f\n" + + "\bOPTIONAL\x10\x01\x12\f\n" + + "\bREQUIRED\x10\x02\x12\x0f\n" + + "\vOUTPUT_ONLY\x10\x03\x12\x0e\n" + + "\n" + + "INPUT_ONLY\x10\x04\x12\r\n" + + "\tIMMUTABLE\x10\x05\x12\x12\n" + + "\x0eUNORDERED_LIST\x10\x06\x12\x15\n" + + "\x11NON_EMPTY_DEFAULT\x10\a\x12\x0e\n" + + "\n" + + "IDENTIFIER\x10\b:d\n" + + "\x0efield_behavior\x12\x1d.google.protobuf.FieldOptions\x18\x9c\b \x03(\x0e2\x19.google.api.FieldBehaviorB\x02\x10\x00R\rfieldBehaviorB\xb0\x01\n" + + "\x0ecom.google.apiB\x12FieldBehaviorProtoP\x01ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\xa2\x02\x03GAX\xaa\x02\n" + + "Google.Api\xca\x02\n" + + "Google\\Api\xe2\x02\x16Google\\Api\\GPBMetadata\xea\x02\vGoogle::Apib\x06proto3" + +var ( + file_google_api_field_behavior_proto_rawDescOnce sync.Once + file_google_api_field_behavior_proto_rawDescData []byte +) + +func file_google_api_field_behavior_proto_rawDescGZIP() []byte { + file_google_api_field_behavior_proto_rawDescOnce.Do(func() { + file_google_api_field_behavior_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_google_api_field_behavior_proto_rawDesc), len(file_google_api_field_behavior_proto_rawDesc))) + }) + return file_google_api_field_behavior_proto_rawDescData +} + +var file_google_api_field_behavior_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_google_api_field_behavior_proto_goTypes = []any{ + (FieldBehavior)(0), // 0: google.api.FieldBehavior + (*descriptorpb.FieldOptions)(nil), // 1: google.protobuf.FieldOptions +} +var file_google_api_field_behavior_proto_depIdxs = []int32{ + 1, // 0: google.api.field_behavior:extendee -> google.protobuf.FieldOptions + 0, // 1: google.api.field_behavior:type_name -> google.api.FieldBehavior + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 1, // [1:2] is the sub-list for extension type_name + 0, // [0:1] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_google_api_field_behavior_proto_init() } +func file_google_api_field_behavior_proto_init() { + if File_google_api_field_behavior_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_api_field_behavior_proto_rawDesc), len(file_google_api_field_behavior_proto_rawDesc)), + NumEnums: 1, + NumMessages: 0, + NumExtensions: 1, + NumServices: 0, + }, + GoTypes: file_google_api_field_behavior_proto_goTypes, + DependencyIndexes: file_google_api_field_behavior_proto_depIdxs, + EnumInfos: file_google_api_field_behavior_proto_enumTypes, + ExtensionInfos: file_google_api_field_behavior_proto_extTypes, + }.Build() + File_google_api_field_behavior_proto = out.File + file_google_api_field_behavior_proto_goTypes = nil + file_google_api_field_behavior_proto_depIdxs = nil +} diff --git a/proto/gen/google/api/http.pb.go b/proto/gen/google/api/http.pb.go new file mode 100644 index 000000000..5d1bb59bd --- /dev/null +++ b/proto/gen/google/api/http.pb.go @@ -0,0 +1,718 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc (unknown) +// source: google/api/http.proto + +package annotations + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Defines the HTTP configuration for an API service. It contains a list of +// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method +// to one or more HTTP REST API methods. +type Http struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A list of HTTP configuration rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + Rules []*HttpRule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"` + // When set to true, URL path parameters will be fully URI-decoded except in + // cases of single segment matches in reserved expansion, where "%2F" will be + // left encoded. + // + // The default behavior is to not decode RFC 6570 reserved characters in multi + // segment matches. + FullyDecodeReservedExpansion bool `protobuf:"varint,2,opt,name=fully_decode_reserved_expansion,json=fullyDecodeReservedExpansion,proto3" json:"fully_decode_reserved_expansion,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Http) Reset() { + *x = Http{} + mi := &file_google_api_http_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Http) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Http) ProtoMessage() {} + +func (x *Http) ProtoReflect() protoreflect.Message { + mi := &file_google_api_http_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Http.ProtoReflect.Descriptor instead. +func (*Http) Descriptor() ([]byte, []int) { + return file_google_api_http_proto_rawDescGZIP(), []int{0} +} + +func (x *Http) GetRules() []*HttpRule { + if x != nil { + return x.Rules + } + return nil +} + +func (x *Http) GetFullyDecodeReservedExpansion() bool { + if x != nil { + return x.FullyDecodeReservedExpansion + } + return false +} + +// gRPC Transcoding +// +// gRPC Transcoding is a feature for mapping between a gRPC method and one or +// more HTTP REST endpoints. It allows developers to build a single API service +// that supports both gRPC APIs and REST APIs. Many systems, including [Google +// APIs](https://github.com/googleapis/googleapis), +// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC +// Gateway](https://github.com/grpc-ecosystem/grpc-gateway), +// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature +// and use it for large scale production services. +// +// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies +// how different portions of the gRPC request message are mapped to the URL +// path, URL query parameters, and HTTP request body. It also controls how the +// gRPC response message is mapped to the HTTP response body. `HttpRule` is +// typically specified as an `google.api.http` annotation on the gRPC method. +// +// Each mapping specifies a URL path template and an HTTP method. The path +// template may refer to one or more fields in the gRPC request message, as long +// as each field is a non-repeated field with a primitive (non-message) type. +// The path template controls how fields of the request message are mapped to +// the URL path. +// +// Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/{name=messages/*}" +// }; +// } +// } +// message GetMessageRequest { +// string name = 1; // Mapped to URL path. +// } +// message Message { +// string text = 1; // The resource content. +// } +// +// This enables an HTTP REST to gRPC mapping as below: +// +// - HTTP: `GET /v1/messages/123456` +// - gRPC: `GetMessage(name: "messages/123456")` +// +// Any fields in the request message which are not bound by the path template +// automatically become HTTP query parameters if there is no HTTP request body. +// For example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get:"/v1/messages/{message_id}" +// }; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // Mapped to URL path. +// int64 revision = 2; // Mapped to URL query parameter `revision`. +// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. +// } +// +// This enables a HTTP JSON to RPC mapping as below: +// +// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` +// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: +// SubMessage(subfield: "foo"))` +// +// Note that fields which are mapped to URL query parameters must have a +// primitive type or a repeated primitive type or a non-repeated message type. +// In the case of a repeated type, the parameter can be repeated in the URL +// as `...?param=A¶m=B`. In the case of a message type, each field of the +// message is mapped to a separate parameter, such as +// `...?foo.a=A&foo.b=B&foo.c=C`. +// +// For HTTP methods that allow a request body, the `body` field +// specifies the mapping. Consider a REST update method on the +// message resource collection: +// +// service Messaging { +// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +// option (google.api.http) = { +// patch: "/v1/messages/{message_id}" +// body: "message" +// }; +// } +// } +// message UpdateMessageRequest { +// string message_id = 1; // mapped to the URL +// Message message = 2; // mapped to the body +// } +// +// The following HTTP JSON to RPC mapping is enabled, where the +// representation of the JSON in the request body is determined by +// protos JSON encoding: +// +// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` +// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` +// +// The special name `*` can be used in the body mapping to define that +// every field not bound by the path template should be mapped to the +// request body. This enables the following alternative definition of +// the update method: +// +// service Messaging { +// rpc UpdateMessage(Message) returns (Message) { +// option (google.api.http) = { +// patch: "/v1/messages/{message_id}" +// body: "*" +// }; +// } +// } +// message Message { +// string message_id = 1; +// string text = 2; +// } +// +// The following HTTP JSON to RPC mapping is enabled: +// +// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` +// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` +// +// Note that when using `*` in the body mapping, it is not possible to +// have HTTP parameters, as all fields not bound by the path end in +// the body. This makes this option more rarely used in practice when +// defining REST APIs. The common usage of `*` is in custom methods +// which don't use the URL at all for transferring data. +// +// It is possible to define multiple HTTP methods for one RPC by using +// the `additional_bindings` option. Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/messages/{message_id}" +// additional_bindings { +// get: "/v1/users/{user_id}/messages/{message_id}" +// } +// }; +// } +// } +// message GetMessageRequest { +// string message_id = 1; +// string user_id = 2; +// } +// +// This enables the following two alternative HTTP JSON to RPC mappings: +// +// - HTTP: `GET /v1/messages/123456` +// - gRPC: `GetMessage(message_id: "123456")` +// +// - HTTP: `GET /v1/users/me/messages/123456` +// - gRPC: `GetMessage(user_id: "me" message_id: "123456")` +// +// # Rules for HTTP mapping +// +// 1. Leaf request fields (recursive expansion nested messages in the request +// message) are classified into three categories: +// - Fields referred by the path template. They are passed via the URL path. +// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They +// are passed via the HTTP +// request body. +// - All other fields are passed via the URL query parameters, and the +// parameter name is the field path in the request message. A repeated +// field can be represented as multiple query parameters under the same +// name. +// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL +// query parameter, all fields +// are passed via URL path and HTTP request body. +// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP +// request body, all +// fields are passed via URL path and URL query parameters. +// +// Path template syntax +// +// Template = "/" Segments [ Verb ] ; +// Segments = Segment { "/" Segment } ; +// Segment = "*" | "**" | LITERAL | Variable ; +// Variable = "{" FieldPath [ "=" Segments ] "}" ; +// FieldPath = IDENT { "." IDENT } ; +// Verb = ":" LITERAL ; +// +// The syntax `*` matches a single URL path segment. The syntax `**` matches +// zero or more URL path segments, which must be the last part of the URL path +// except the `Verb`. +// +// The syntax `Variable` matches part of the URL path as specified by its +// template. A variable template must not contain other variables. If a variable +// matches a single path segment, its template may be omitted, e.g. `{var}` +// is equivalent to `{var=*}`. +// +// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` +// contains any reserved character, such characters should be percent-encoded +// before the matching. +// +// If a variable contains exactly one path segment, such as `"{var}"` or +// `"{var=*}"`, when such a variable is expanded into a URL path on the client +// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The +// server side does the reverse decoding. Such variables show up in the +// [Discovery +// Document](https://developers.google.com/discovery/v1/reference/apis) as +// `{var}`. +// +// If a variable contains multiple path segments, such as `"{var=foo/*}"` +// or `"{var=**}"`, when such a variable is expanded into a URL path on the +// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. +// The server side does the reverse decoding, except "%2F" and "%2f" are left +// unchanged. Such variables show up in the +// [Discovery +// Document](https://developers.google.com/discovery/v1/reference/apis) as +// `{+var}`. +// +// # Using gRPC API Service Configuration +// +// gRPC API Service Configuration (service config) is a configuration language +// for configuring a gRPC service to become a user-facing product. The +// service config is simply the YAML representation of the `google.api.Service` +// proto message. +// +// As an alternative to annotating your proto file, you can configure gRPC +// transcoding in your service config YAML files. You do this by specifying a +// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same +// effect as the proto annotation. This can be particularly useful if you +// have a proto that is reused in multiple services. Note that any transcoding +// specified in the service config will override any matching transcoding +// configuration in the proto. +// +// The following example selects a gRPC method and applies an `HttpRule` to it: +// +// http: +// rules: +// - selector: example.v1.Messaging.GetMessage +// get: /v1/messages/{message_id}/{sub.subfield} +// +// # Special notes +// +// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the +// proto to JSON conversion must follow the [proto3 +// specification](https://developers.google.com/protocol-buffers/docs/proto3#json). +// +// While the single segment variable follows the semantics of +// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String +// Expansion, the multi segment variable **does not** follow RFC 6570 Section +// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion +// does not expand special characters like `?` and `#`, which would lead +// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding +// for multi segment variables. +// +// The path variables **must not** refer to any repeated or mapped field, +// because client libraries are not capable of handling such variable expansion. +// +// The path variables **must not** capture the leading "/" character. The reason +// is that the most common use case "{var}" does not capture the leading "/" +// character. For consistency, all path variables must share the same behavior. +// +// Repeated message fields must not be mapped to URL query parameters, because +// no client library can support such complicated mapping. +// +// If an API needs to use a JSON array for request or response body, it can map +// the request or response body to a repeated field. However, some gRPC +// Transcoding implementations may not support this feature. +type HttpRule struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Selects a method to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax + // details. + Selector string `protobuf:"bytes,1,opt,name=selector,proto3" json:"selector,omitempty"` + // Determines the URL pattern is matched by this rules. This pattern can be + // used with any of the {get|put|post|delete|patch} methods. A custom method + // can be defined using the 'custom' field. + // + // Types that are valid to be assigned to Pattern: + // + // *HttpRule_Get + // *HttpRule_Put + // *HttpRule_Post + // *HttpRule_Delete + // *HttpRule_Patch + // *HttpRule_Custom + Pattern isHttpRule_Pattern `protobuf_oneof:"pattern"` + // The name of the request field whose value is mapped to the HTTP request + // body, or `*` for mapping all request fields not captured by the path + // pattern to the HTTP body, or omitted for not having any HTTP request body. + // + // NOTE: the referred field must be present at the top-level of the request + // message type. + Body string `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"` + // Optional. The name of the response field whose value is mapped to the HTTP + // response body. When omitted, the entire response message will be used + // as the HTTP response body. + // + // NOTE: The referred field must be present at the top-level of the response + // message type. + ResponseBody string `protobuf:"bytes,12,opt,name=response_body,json=responseBody,proto3" json:"response_body,omitempty"` + // Additional HTTP bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). + AdditionalBindings []*HttpRule `protobuf:"bytes,11,rep,name=additional_bindings,json=additionalBindings,proto3" json:"additional_bindings,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HttpRule) Reset() { + *x = HttpRule{} + mi := &file_google_api_http_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HttpRule) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HttpRule) ProtoMessage() {} + +func (x *HttpRule) ProtoReflect() protoreflect.Message { + mi := &file_google_api_http_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HttpRule.ProtoReflect.Descriptor instead. +func (*HttpRule) Descriptor() ([]byte, []int) { + return file_google_api_http_proto_rawDescGZIP(), []int{1} +} + +func (x *HttpRule) GetSelector() string { + if x != nil { + return x.Selector + } + return "" +} + +func (x *HttpRule) GetPattern() isHttpRule_Pattern { + if x != nil { + return x.Pattern + } + return nil +} + +func (x *HttpRule) GetGet() string { + if x != nil { + if x, ok := x.Pattern.(*HttpRule_Get); ok { + return x.Get + } + } + return "" +} + +func (x *HttpRule) GetPut() string { + if x != nil { + if x, ok := x.Pattern.(*HttpRule_Put); ok { + return x.Put + } + } + return "" +} + +func (x *HttpRule) GetPost() string { + if x != nil { + if x, ok := x.Pattern.(*HttpRule_Post); ok { + return x.Post + } + } + return "" +} + +func (x *HttpRule) GetDelete() string { + if x != nil { + if x, ok := x.Pattern.(*HttpRule_Delete); ok { + return x.Delete + } + } + return "" +} + +func (x *HttpRule) GetPatch() string { + if x != nil { + if x, ok := x.Pattern.(*HttpRule_Patch); ok { + return x.Patch + } + } + return "" +} + +func (x *HttpRule) GetCustom() *CustomHttpPattern { + if x != nil { + if x, ok := x.Pattern.(*HttpRule_Custom); ok { + return x.Custom + } + } + return nil +} + +func (x *HttpRule) GetBody() string { + if x != nil { + return x.Body + } + return "" +} + +func (x *HttpRule) GetResponseBody() string { + if x != nil { + return x.ResponseBody + } + return "" +} + +func (x *HttpRule) GetAdditionalBindings() []*HttpRule { + if x != nil { + return x.AdditionalBindings + } + return nil +} + +type isHttpRule_Pattern interface { + isHttpRule_Pattern() +} + +type HttpRule_Get struct { + // Maps to HTTP GET. Used for listing and getting information about + // resources. + Get string `protobuf:"bytes,2,opt,name=get,proto3,oneof"` +} + +type HttpRule_Put struct { + // Maps to HTTP PUT. Used for replacing a resource. + Put string `protobuf:"bytes,3,opt,name=put,proto3,oneof"` +} + +type HttpRule_Post struct { + // Maps to HTTP POST. Used for creating a resource or performing an action. + Post string `protobuf:"bytes,4,opt,name=post,proto3,oneof"` +} + +type HttpRule_Delete struct { + // Maps to HTTP DELETE. Used for deleting a resource. + Delete string `protobuf:"bytes,5,opt,name=delete,proto3,oneof"` +} + +type HttpRule_Patch struct { + // Maps to HTTP PATCH. Used for updating a resource. + Patch string `protobuf:"bytes,6,opt,name=patch,proto3,oneof"` +} + +type HttpRule_Custom struct { + // The custom pattern is used for specifying an HTTP method that is not + // included in the `pattern` field, such as HEAD, or "*" to leave the + // HTTP method unspecified for this rule. The wild-card rule is useful + // for services that provide content to Web (HTML) clients. + Custom *CustomHttpPattern `protobuf:"bytes,8,opt,name=custom,proto3,oneof"` +} + +func (*HttpRule_Get) isHttpRule_Pattern() {} + +func (*HttpRule_Put) isHttpRule_Pattern() {} + +func (*HttpRule_Post) isHttpRule_Pattern() {} + +func (*HttpRule_Delete) isHttpRule_Pattern() {} + +func (*HttpRule_Patch) isHttpRule_Pattern() {} + +func (*HttpRule_Custom) isHttpRule_Pattern() {} + +// A custom pattern is used for defining custom HTTP verb. +type CustomHttpPattern struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name of this custom HTTP verb. + Kind string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"` + // The path matched by this custom verb. + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CustomHttpPattern) Reset() { + *x = CustomHttpPattern{} + mi := &file_google_api_http_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CustomHttpPattern) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CustomHttpPattern) ProtoMessage() {} + +func (x *CustomHttpPattern) ProtoReflect() protoreflect.Message { + mi := &file_google_api_http_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CustomHttpPattern.ProtoReflect.Descriptor instead. +func (*CustomHttpPattern) Descriptor() ([]byte, []int) { + return file_google_api_http_proto_rawDescGZIP(), []int{2} +} + +func (x *CustomHttpPattern) GetKind() string { + if x != nil { + return x.Kind + } + return "" +} + +func (x *CustomHttpPattern) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +var File_google_api_http_proto protoreflect.FileDescriptor + +const file_google_api_http_proto_rawDesc = "" + + "\n" + + "\x15google/api/http.proto\x12\n" + + "google.api\"y\n" + + "\x04Http\x12*\n" + + "\x05rules\x18\x01 \x03(\v2\x14.google.api.HttpRuleR\x05rules\x12E\n" + + "\x1ffully_decode_reserved_expansion\x18\x02 \x01(\bR\x1cfullyDecodeReservedExpansion\"\xda\x02\n" + + "\bHttpRule\x12\x1a\n" + + "\bselector\x18\x01 \x01(\tR\bselector\x12\x12\n" + + "\x03get\x18\x02 \x01(\tH\x00R\x03get\x12\x12\n" + + "\x03put\x18\x03 \x01(\tH\x00R\x03put\x12\x14\n" + + "\x04post\x18\x04 \x01(\tH\x00R\x04post\x12\x18\n" + + "\x06delete\x18\x05 \x01(\tH\x00R\x06delete\x12\x16\n" + + "\x05patch\x18\x06 \x01(\tH\x00R\x05patch\x127\n" + + "\x06custom\x18\b \x01(\v2\x1d.google.api.CustomHttpPatternH\x00R\x06custom\x12\x12\n" + + "\x04body\x18\a \x01(\tR\x04body\x12#\n" + + "\rresponse_body\x18\f \x01(\tR\fresponseBody\x12E\n" + + "\x13additional_bindings\x18\v \x03(\v2\x14.google.api.HttpRuleR\x12additionalBindingsB\t\n" + + "\apattern\";\n" + + "\x11CustomHttpPattern\x12\x12\n" + + "\x04kind\x18\x01 \x01(\tR\x04kind\x12\x12\n" + + "\x04path\x18\x02 \x01(\tR\x04pathB\xa7\x01\n" + + "\x0ecom.google.apiB\tHttpProtoP\x01ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\xa2\x02\x03GAX\xaa\x02\n" + + "Google.Api\xca\x02\n" + + "Google\\Api\xe2\x02\x16Google\\Api\\GPBMetadata\xea\x02\vGoogle::Apib\x06proto3" + +var ( + file_google_api_http_proto_rawDescOnce sync.Once + file_google_api_http_proto_rawDescData []byte +) + +func file_google_api_http_proto_rawDescGZIP() []byte { + file_google_api_http_proto_rawDescOnce.Do(func() { + file_google_api_http_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_google_api_http_proto_rawDesc), len(file_google_api_http_proto_rawDesc))) + }) + return file_google_api_http_proto_rawDescData +} + +var file_google_api_http_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_google_api_http_proto_goTypes = []any{ + (*Http)(nil), // 0: google.api.Http + (*HttpRule)(nil), // 1: google.api.HttpRule + (*CustomHttpPattern)(nil), // 2: google.api.CustomHttpPattern +} +var file_google_api_http_proto_depIdxs = []int32{ + 1, // 0: google.api.Http.rules:type_name -> google.api.HttpRule + 2, // 1: google.api.HttpRule.custom:type_name -> google.api.CustomHttpPattern + 1, // 2: google.api.HttpRule.additional_bindings:type_name -> google.api.HttpRule + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_google_api_http_proto_init() } +func file_google_api_http_proto_init() { + if File_google_api_http_proto != nil { + return + } + file_google_api_http_proto_msgTypes[1].OneofWrappers = []any{ + (*HttpRule_Get)(nil), + (*HttpRule_Put)(nil), + (*HttpRule_Post)(nil), + (*HttpRule_Delete)(nil), + (*HttpRule_Patch)(nil), + (*HttpRule_Custom)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_api_http_proto_rawDesc), len(file_google_api_http_proto_rawDesc)), + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_google_api_http_proto_goTypes, + DependencyIndexes: file_google_api_http_proto_depIdxs, + MessageInfos: file_google_api_http_proto_msgTypes, + }.Build() + File_google_api_http_proto = out.File + file_google_api_http_proto_goTypes = nil + file_google_api_http_proto_depIdxs = nil +} diff --git a/proto/gen/google/api/resource.pb.go b/proto/gen/google/api/resource.pb.go new file mode 100644 index 000000000..2c9637ae7 --- /dev/null +++ b/proto/gen/google/api/resource.pb.go @@ -0,0 +1,592 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc (unknown) +// source: google/api/resource.proto + +package annotations + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// A description of the historical or future-looking state of the +// resource pattern. +type ResourceDescriptor_History int32 + +const ( + // The "unset" value. + ResourceDescriptor_HISTORY_UNSPECIFIED ResourceDescriptor_History = 0 + // The resource originally had one pattern and launched as such, and + // additional patterns were added later. + ResourceDescriptor_ORIGINALLY_SINGLE_PATTERN ResourceDescriptor_History = 1 + // The resource has one pattern, but the API owner expects to add more + // later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents + // that from being necessary once there are multiple patterns.) + ResourceDescriptor_FUTURE_MULTI_PATTERN ResourceDescriptor_History = 2 +) + +// Enum value maps for ResourceDescriptor_History. +var ( + ResourceDescriptor_History_name = map[int32]string{ + 0: "HISTORY_UNSPECIFIED", + 1: "ORIGINALLY_SINGLE_PATTERN", + 2: "FUTURE_MULTI_PATTERN", + } + ResourceDescriptor_History_value = map[string]int32{ + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2, + } +) + +func (x ResourceDescriptor_History) Enum() *ResourceDescriptor_History { + p := new(ResourceDescriptor_History) + *p = x + return p +} + +func (x ResourceDescriptor_History) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ResourceDescriptor_History) Descriptor() protoreflect.EnumDescriptor { + return file_google_api_resource_proto_enumTypes[0].Descriptor() +} + +func (ResourceDescriptor_History) Type() protoreflect.EnumType { + return &file_google_api_resource_proto_enumTypes[0] +} + +func (x ResourceDescriptor_History) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ResourceDescriptor_History.Descriptor instead. +func (ResourceDescriptor_History) EnumDescriptor() ([]byte, []int) { + return file_google_api_resource_proto_rawDescGZIP(), []int{0, 0} +} + +// A flag representing a specific style that a resource claims to conform to. +type ResourceDescriptor_Style int32 + +const ( + // The unspecified value. Do not use. + ResourceDescriptor_STYLE_UNSPECIFIED ResourceDescriptor_Style = 0 + // This resource is intended to be "declarative-friendly". + // + // Declarative-friendly resources must be more strictly consistent, and + // setting this to true communicates to tools that this resource should + // adhere to declarative-friendly expectations. + // + // Note: This is used by the API linter (linter.aip.dev) to enable + // additional checks. + ResourceDescriptor_DECLARATIVE_FRIENDLY ResourceDescriptor_Style = 1 +) + +// Enum value maps for ResourceDescriptor_Style. +var ( + ResourceDescriptor_Style_name = map[int32]string{ + 0: "STYLE_UNSPECIFIED", + 1: "DECLARATIVE_FRIENDLY", + } + ResourceDescriptor_Style_value = map[string]int32{ + "STYLE_UNSPECIFIED": 0, + "DECLARATIVE_FRIENDLY": 1, + } +) + +func (x ResourceDescriptor_Style) Enum() *ResourceDescriptor_Style { + p := new(ResourceDescriptor_Style) + *p = x + return p +} + +func (x ResourceDescriptor_Style) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ResourceDescriptor_Style) Descriptor() protoreflect.EnumDescriptor { + return file_google_api_resource_proto_enumTypes[1].Descriptor() +} + +func (ResourceDescriptor_Style) Type() protoreflect.EnumType { + return &file_google_api_resource_proto_enumTypes[1] +} + +func (x ResourceDescriptor_Style) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ResourceDescriptor_Style.Descriptor instead. +func (ResourceDescriptor_Style) EnumDescriptor() ([]byte, []int) { + return file_google_api_resource_proto_rawDescGZIP(), []int{0, 1} +} + +// A simple descriptor of a resource type. +// +// ResourceDescriptor annotates a resource message (either by means of a +// protobuf annotation or use in the service config), and associates the +// resource's schema, the resource type, and the pattern of the resource name. +// +// Example: +// +// message Topic { +// // Indicates this message defines a resource schema. +// // Declares the resource type in the format of {service}/{kind}. +// // For Kubernetes resources, the format is {api group}/{kind}. +// option (google.api.resource) = { +// type: "pubsub.googleapis.com/Topic" +// pattern: "projects/{project}/topics/{topic}" +// }; +// } +// +// The ResourceDescriptor Yaml config will look like: +// +// resources: +// - type: "pubsub.googleapis.com/Topic" +// pattern: "projects/{project}/topics/{topic}" +// +// Sometimes, resources have multiple patterns, typically because they can +// live under multiple parents. +// +// Example: +// +// message LogEntry { +// option (google.api.resource) = { +// type: "logging.googleapis.com/LogEntry" +// pattern: "projects/{project}/logs/{log}" +// pattern: "folders/{folder}/logs/{log}" +// pattern: "organizations/{organization}/logs/{log}" +// pattern: "billingAccounts/{billing_account}/logs/{log}" +// }; +// } +// +// The ResourceDescriptor Yaml config will look like: +// +// resources: +// - type: 'logging.googleapis.com/LogEntry' +// pattern: "projects/{project}/logs/{log}" +// pattern: "folders/{folder}/logs/{log}" +// pattern: "organizations/{organization}/logs/{log}" +// pattern: "billingAccounts/{billing_account}/logs/{log}" +type ResourceDescriptor struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The resource type. It must be in the format of + // {service_name}/{resource_type_kind}. The `resource_type_kind` must be + // singular and must not include version numbers. + // + // Example: `storage.googleapis.com/Bucket` + // + // The value of the resource_type_kind must follow the regular expression + // /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + // should use PascalCase (UpperCamelCase). The maximum number of + // characters allowed for the `resource_type_kind` is 100. + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + // Optional. The relative resource name pattern associated with this resource + // type. The DNS prefix of the full resource name shouldn't be specified here. + // + // The path pattern must follow the syntax, which aligns with HTTP binding + // syntax: + // + // Template = Segment { "/" Segment } ; + // Segment = LITERAL | Variable ; + // Variable = "{" LITERAL "}" ; + // + // Examples: + // + // - "projects/{project}/topics/{topic}" + // - "projects/{project}/knowledgeBases/{knowledge_base}" + // + // The components in braces correspond to the IDs for each resource in the + // hierarchy. It is expected that, if multiple patterns are provided, + // the same component name (e.g. "project") refers to IDs of the same + // type of resource. + Pattern []string `protobuf:"bytes,2,rep,name=pattern,proto3" json:"pattern,omitempty"` + // Optional. The field on the resource that designates the resource name + // field. If omitted, this is assumed to be "name". + NameField string `protobuf:"bytes,3,opt,name=name_field,json=nameField,proto3" json:"name_field,omitempty"` + // Optional. The historical or future-looking state of the resource pattern. + // + // Example: + // + // // The InspectTemplate message originally only supported resource + // // names with organization, and project was added later. + // message InspectTemplate { + // option (google.api.resource) = { + // type: "dlp.googleapis.com/InspectTemplate" + // pattern: + // "organizations/{organization}/inspectTemplates/{inspect_template}" + // pattern: "projects/{project}/inspectTemplates/{inspect_template}" + // history: ORIGINALLY_SINGLE_PATTERN + // }; + // } + History ResourceDescriptor_History `protobuf:"varint,4,opt,name=history,proto3,enum=google.api.ResourceDescriptor_History" json:"history,omitempty"` + // The plural name used in the resource name and permission names, such as + // 'projects' for the resource name of 'projects/{project}' and the permission + // name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception + // to this is for Nested Collections that have stuttering names, as defined + // in [AIP-122](https://google.aip.dev/122#nested-collections), where the + // collection ID in the resource name pattern does not necessarily directly + // match the `plural` value. + // + // It is the same concept of the `plural` field in k8s CRD spec + // https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + // + // Note: The plural form is required even for singleton resources. See + // https://aip.dev/156 + Plural string `protobuf:"bytes,5,opt,name=plural,proto3" json:"plural,omitempty"` + // The same concept of the `singular` field in k8s CRD spec + // https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + // Such as "project" for the `resourcemanager.googleapis.com/Project` type. + Singular string `protobuf:"bytes,6,opt,name=singular,proto3" json:"singular,omitempty"` + // Style flag(s) for this resource. + // These indicate that a resource is expected to conform to a given + // style. See the specific style flags for additional information. + Style []ResourceDescriptor_Style `protobuf:"varint,10,rep,packed,name=style,proto3,enum=google.api.ResourceDescriptor_Style" json:"style,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceDescriptor) Reset() { + *x = ResourceDescriptor{} + mi := &file_google_api_resource_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceDescriptor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceDescriptor) ProtoMessage() {} + +func (x *ResourceDescriptor) ProtoReflect() protoreflect.Message { + mi := &file_google_api_resource_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResourceDescriptor.ProtoReflect.Descriptor instead. +func (*ResourceDescriptor) Descriptor() ([]byte, []int) { + return file_google_api_resource_proto_rawDescGZIP(), []int{0} +} + +func (x *ResourceDescriptor) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *ResourceDescriptor) GetPattern() []string { + if x != nil { + return x.Pattern + } + return nil +} + +func (x *ResourceDescriptor) GetNameField() string { + if x != nil { + return x.NameField + } + return "" +} + +func (x *ResourceDescriptor) GetHistory() ResourceDescriptor_History { + if x != nil { + return x.History + } + return ResourceDescriptor_HISTORY_UNSPECIFIED +} + +func (x *ResourceDescriptor) GetPlural() string { + if x != nil { + return x.Plural + } + return "" +} + +func (x *ResourceDescriptor) GetSingular() string { + if x != nil { + return x.Singular + } + return "" +} + +func (x *ResourceDescriptor) GetStyle() []ResourceDescriptor_Style { + if x != nil { + return x.Style + } + return nil +} + +// Defines a proto annotation that describes a string field that refers to +// an API resource. +type ResourceReference struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The resource type that the annotated field references. + // + // Example: + // + // message Subscription { + // string topic = 2 [(google.api.resource_reference) = { + // type: "pubsub.googleapis.com/Topic" + // }]; + // } + // + // Occasionally, a field may reference an arbitrary resource. In this case, + // APIs use the special value * in their resource reference. + // + // Example: + // + // message GetIamPolicyRequest { + // string resource = 2 [(google.api.resource_reference) = { + // type: "*" + // }]; + // } + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + // The resource type of a child collection that the annotated field + // references. This is useful for annotating the `parent` field that + // doesn't have a fixed resource type. + // + // Example: + // + // message ListLogEntriesRequest { + // string parent = 1 [(google.api.resource_reference) = { + // child_type: "logging.googleapis.com/LogEntry" + // }; + // } + ChildType string `protobuf:"bytes,2,opt,name=child_type,json=childType,proto3" json:"child_type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceReference) Reset() { + *x = ResourceReference{} + mi := &file_google_api_resource_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceReference) ProtoMessage() {} + +func (x *ResourceReference) ProtoReflect() protoreflect.Message { + mi := &file_google_api_resource_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResourceReference.ProtoReflect.Descriptor instead. +func (*ResourceReference) Descriptor() ([]byte, []int) { + return file_google_api_resource_proto_rawDescGZIP(), []int{1} +} + +func (x *ResourceReference) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *ResourceReference) GetChildType() string { + if x != nil { + return x.ChildType + } + return "" +} + +var file_google_api_resource_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptorpb.FieldOptions)(nil), + ExtensionType: (*ResourceReference)(nil), + Field: 1055, + Name: "google.api.resource_reference", + Tag: "bytes,1055,opt,name=resource_reference", + Filename: "google/api/resource.proto", + }, + { + ExtendedType: (*descriptorpb.FileOptions)(nil), + ExtensionType: ([]*ResourceDescriptor)(nil), + Field: 1053, + Name: "google.api.resource_definition", + Tag: "bytes,1053,rep,name=resource_definition", + Filename: "google/api/resource.proto", + }, + { + ExtendedType: (*descriptorpb.MessageOptions)(nil), + ExtensionType: (*ResourceDescriptor)(nil), + Field: 1053, + Name: "google.api.resource", + Tag: "bytes,1053,opt,name=resource", + Filename: "google/api/resource.proto", + }, +} + +// Extension fields to descriptorpb.FieldOptions. +var ( + // An annotation that describes a resource reference, see + // [ResourceReference][]. + // + // optional google.api.ResourceReference resource_reference = 1055; + E_ResourceReference = &file_google_api_resource_proto_extTypes[0] +) + +// Extension fields to descriptorpb.FileOptions. +var ( + // An annotation that describes a resource definition without a corresponding + // message; see [ResourceDescriptor][]. + // + // repeated google.api.ResourceDescriptor resource_definition = 1053; + E_ResourceDefinition = &file_google_api_resource_proto_extTypes[1] +) + +// Extension fields to descriptorpb.MessageOptions. +var ( + // An annotation that describes a resource definition, see + // [ResourceDescriptor][]. + // + // optional google.api.ResourceDescriptor resource = 1053; + E_Resource = &file_google_api_resource_proto_extTypes[2] +) + +var File_google_api_resource_proto protoreflect.FileDescriptor + +const file_google_api_resource_proto_rawDesc = "" + + "\n" + + "\x19google/api/resource.proto\x12\n" + + "google.api\x1a google/protobuf/descriptor.proto\"\xaa\x03\n" + + "\x12ResourceDescriptor\x12\x12\n" + + "\x04type\x18\x01 \x01(\tR\x04type\x12\x18\n" + + "\apattern\x18\x02 \x03(\tR\apattern\x12\x1d\n" + + "\n" + + "name_field\x18\x03 \x01(\tR\tnameField\x12@\n" + + "\ahistory\x18\x04 \x01(\x0e2&.google.api.ResourceDescriptor.HistoryR\ahistory\x12\x16\n" + + "\x06plural\x18\x05 \x01(\tR\x06plural\x12\x1a\n" + + "\bsingular\x18\x06 \x01(\tR\bsingular\x12:\n" + + "\x05style\x18\n" + + " \x03(\x0e2$.google.api.ResourceDescriptor.StyleR\x05style\"[\n" + + "\aHistory\x12\x17\n" + + "\x13HISTORY_UNSPECIFIED\x10\x00\x12\x1d\n" + + "\x19ORIGINALLY_SINGLE_PATTERN\x10\x01\x12\x18\n" + + "\x14FUTURE_MULTI_PATTERN\x10\x02\"8\n" + + "\x05Style\x12\x15\n" + + "\x11STYLE_UNSPECIFIED\x10\x00\x12\x18\n" + + "\x14DECLARATIVE_FRIENDLY\x10\x01\"F\n" + + "\x11ResourceReference\x12\x12\n" + + "\x04type\x18\x01 \x01(\tR\x04type\x12\x1d\n" + + "\n" + + "child_type\x18\x02 \x01(\tR\tchildType:l\n" + + "\x12resource_reference\x12\x1d.google.protobuf.FieldOptions\x18\x9f\b \x01(\v2\x1d.google.api.ResourceReferenceR\x11resourceReference:n\n" + + "\x13resource_definition\x12\x1c.google.protobuf.FileOptions\x18\x9d\b \x03(\v2\x1e.google.api.ResourceDescriptorR\x12resourceDefinition:\\\n" + + "\bresource\x12\x1f.google.protobuf.MessageOptions\x18\x9d\b \x01(\v2\x1e.google.api.ResourceDescriptorR\bresourceB\xab\x01\n" + + "\x0ecom.google.apiB\rResourceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\xa2\x02\x03GAX\xaa\x02\n" + + "Google.Api\xca\x02\n" + + "Google\\Api\xe2\x02\x16Google\\Api\\GPBMetadata\xea\x02\vGoogle::Apib\x06proto3" + +var ( + file_google_api_resource_proto_rawDescOnce sync.Once + file_google_api_resource_proto_rawDescData []byte +) + +func file_google_api_resource_proto_rawDescGZIP() []byte { + file_google_api_resource_proto_rawDescOnce.Do(func() { + file_google_api_resource_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_google_api_resource_proto_rawDesc), len(file_google_api_resource_proto_rawDesc))) + }) + return file_google_api_resource_proto_rawDescData +} + +var file_google_api_resource_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_google_api_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_google_api_resource_proto_goTypes = []any{ + (ResourceDescriptor_History)(0), // 0: google.api.ResourceDescriptor.History + (ResourceDescriptor_Style)(0), // 1: google.api.ResourceDescriptor.Style + (*ResourceDescriptor)(nil), // 2: google.api.ResourceDescriptor + (*ResourceReference)(nil), // 3: google.api.ResourceReference + (*descriptorpb.FieldOptions)(nil), // 4: google.protobuf.FieldOptions + (*descriptorpb.FileOptions)(nil), // 5: google.protobuf.FileOptions + (*descriptorpb.MessageOptions)(nil), // 6: google.protobuf.MessageOptions +} +var file_google_api_resource_proto_depIdxs = []int32{ + 0, // 0: google.api.ResourceDescriptor.history:type_name -> google.api.ResourceDescriptor.History + 1, // 1: google.api.ResourceDescriptor.style:type_name -> google.api.ResourceDescriptor.Style + 4, // 2: google.api.resource_reference:extendee -> google.protobuf.FieldOptions + 5, // 3: google.api.resource_definition:extendee -> google.protobuf.FileOptions + 6, // 4: google.api.resource:extendee -> google.protobuf.MessageOptions + 3, // 5: google.api.resource_reference:type_name -> google.api.ResourceReference + 2, // 6: google.api.resource_definition:type_name -> google.api.ResourceDescriptor + 2, // 7: google.api.resource:type_name -> google.api.ResourceDescriptor + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 5, // [5:8] is the sub-list for extension type_name + 2, // [2:5] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_google_api_resource_proto_init() } +func file_google_api_resource_proto_init() { + if File_google_api_resource_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_api_resource_proto_rawDesc), len(file_google_api_resource_proto_rawDesc)), + NumEnums: 2, + NumMessages: 2, + NumExtensions: 3, + NumServices: 0, + }, + GoTypes: file_google_api_resource_proto_goTypes, + DependencyIndexes: file_google_api_resource_proto_depIdxs, + EnumInfos: file_google_api_resource_proto_enumTypes, + MessageInfos: file_google_api_resource_proto_msgTypes, + ExtensionInfos: file_google_api_resource_proto_extTypes, + }.Build() + File_google_api_resource_proto = out.File + file_google_api_resource_proto_goTypes = nil + file_google_api_resource_proto_depIdxs = nil +} diff --git a/proto/gen/openapi.yaml b/proto/gen/openapi.yaml index 412b0a8ee..f8f373526 100644 --- a/proto/gen/openapi.yaml +++ b/proto/gen/openapi.yaml @@ -5,3129 +5,6 @@ openapi: 3.0.3 info: title: "" version: 0.0.1 -paths: - /api/v1/activities: - get: - tags: - - ActivityService - description: ListActivities returns a list of activities. - operationId: ActivityService_ListActivities - parameters: - - name: pageSize - in: query - description: |- - The maximum number of activities to return. - The service may return fewer than this value. - If unspecified, at most 100 activities will be returned. - The maximum value is 1000; values above 1000 will be coerced to 1000. - schema: - type: integer - format: int32 - - name: pageToken - in: query - description: |- - A page token, received from a previous `ListActivities` call. - Provide this to retrieve the subsequent page. - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListActivitiesResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/activities/{activity}: - get: - tags: - - ActivityService - description: GetActivity returns the activity with the given id. - operationId: ActivityService_GetActivity - parameters: - - name: activity - in: path - description: The activity id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Activity' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/attachments: - get: - tags: - - AttachmentService - description: ListAttachments lists all attachments. - operationId: AttachmentService_ListAttachments - parameters: - - name: pageSize - in: query - description: |- - Optional. The maximum number of attachments to return. - The service may return fewer than this value. - If unspecified, at most 50 attachments will be returned. - The maximum value is 1000; values above 1000 will be coerced to 1000. - schema: - type: integer - format: int32 - - name: pageToken - in: query - description: |- - Optional. A page token, received from a previous `ListAttachments` call. - Provide this to retrieve the subsequent page. - schema: - type: string - - name: filter - in: query - description: |- - Optional. Filter to apply to the list results. - Example: "type=image/png" or "filename:*.jpg" - Supported operators: =, !=, <, <=, >, >=, : - Supported fields: filename, type, size, create_time, memo - schema: - type: string - - name: orderBy - in: query - description: |- - Optional. The order to sort results by. - Example: "create_time desc" or "filename asc" - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListAttachmentsResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - post: - tags: - - AttachmentService - description: CreateAttachment creates a new attachment. - operationId: AttachmentService_CreateAttachment - parameters: - - name: attachmentId - in: query - description: |- - Optional. The attachment ID to use for this attachment. - If empty, a unique ID will be generated. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Attachment' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Attachment' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/attachments/{attachment}: - get: - tags: - - AttachmentService - description: GetAttachment returns a attachment by name. - operationId: AttachmentService_GetAttachment - parameters: - - name: attachment - in: path - description: The attachment id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Attachment' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - delete: - tags: - - AttachmentService - description: DeleteAttachment deletes a attachment by name. - operationId: AttachmentService_DeleteAttachment - parameters: - - name: attachment - in: path - description: The attachment id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - patch: - tags: - - AttachmentService - description: UpdateAttachment updates a attachment. - operationId: AttachmentService_UpdateAttachment - parameters: - - name: attachment - in: path - description: The attachment id. - required: true - schema: - type: string - - name: updateMask - in: query - description: Required. The list of fields to update. - schema: - type: string - format: field-mask - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Attachment' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Attachment' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/auth/sessions: - post: - tags: - - AuthService - description: |- - CreateSession authenticates a user and creates a new session. - Returns the authenticated user information upon successful authentication. - operationId: AuthService_CreateSession - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/CreateSessionRequest' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/CreateSessionResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/auth/sessions/current: - get: - tags: - - AuthService - description: |- - GetCurrentSession returns the current active session information. - This method is idempotent and safe, suitable for checking current session state. - operationId: AuthService_GetCurrentSession - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/GetCurrentSessionResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - delete: - tags: - - AuthService - description: |- - DeleteSession terminates the current user session. - This is an idempotent operation that invalidates the user's authentication. - operationId: AuthService_DeleteSession - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/identity-providers: - get: - tags: - - IdentityProviderService - description: ListIdentityProviders lists identity providers. - operationId: IdentityProviderService_ListIdentityProviders - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListIdentityProvidersResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - post: - tags: - - IdentityProviderService - description: CreateIdentityProvider creates an identity provider. - operationId: IdentityProviderService_CreateIdentityProvider - parameters: - - name: identityProviderId - in: query - description: |- - Optional. The ID to use for the identity provider, which will become the final component of the resource name. - If not provided, the system will generate one. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/IdentityProvider' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/IdentityProvider' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/identity-providers/{identity-provider}: - get: - tags: - - IdentityProviderService - description: GetIdentityProvider gets an identity provider. - operationId: IdentityProviderService_GetIdentityProvider - parameters: - - name: identity-provider - in: path - description: The identity-provider id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/IdentityProvider' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - delete: - tags: - - IdentityProviderService - description: DeleteIdentityProvider deletes an identity provider. - operationId: IdentityProviderService_DeleteIdentityProvider - parameters: - - name: identity-provider - in: path - description: The identity-provider id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - patch: - tags: - - IdentityProviderService - description: UpdateIdentityProvider updates an identity provider. - operationId: IdentityProviderService_UpdateIdentityProvider - parameters: - - name: identity-provider - in: path - description: The identity-provider id. - required: true - schema: - type: string - - name: updateMask - in: query - description: |- - Required. The update mask applies to the resource. Only the top level fields of - IdentityProvider are supported. - schema: - type: string - format: field-mask - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/IdentityProvider' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/IdentityProvider' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/instance/profile: - get: - tags: - - InstanceService - description: Gets the instance profile. - operationId: InstanceService_GetInstanceProfile - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/InstanceProfile' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/instance/{instance}/*: - get: - tags: - - InstanceService - description: Gets an instance setting. - operationId: InstanceService_GetInstanceSetting - parameters: - - name: instance - in: path - description: The instance id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/InstanceSetting' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - patch: - tags: - - InstanceService - description: Updates an instance setting. - operationId: InstanceService_UpdateInstanceSetting - parameters: - - name: instance - in: path - description: The instance id. - required: true - schema: - type: string - - name: updateMask - in: query - description: The list of fields to update. - schema: - type: string - format: field-mask - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/InstanceSetting' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/InstanceSetting' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/memos: - get: - tags: - - MemoService - description: ListMemos lists memos with pagination and filter. - operationId: MemoService_ListMemos - parameters: - - name: pageSize - in: query - description: |- - Optional. The maximum number of memos to return. - The service may return fewer than this value. - If unspecified, at most 50 memos will be returned. - The maximum value is 1000; values above 1000 will be coerced to 1000. - schema: - type: integer - format: int32 - - name: pageToken - in: query - description: |- - Optional. A page token, received from a previous `ListMemos` call. - Provide this to retrieve the subsequent page. - schema: - type: string - - name: state - in: query - description: |- - Optional. The state of the memos to list. - Default to `NORMAL`. Set to `ARCHIVED` to list archived memos. - schema: - enum: - - STATE_UNSPECIFIED - - NORMAL - - ARCHIVED - type: string - format: enum - - name: orderBy - in: query - description: |- - Optional. The order to sort results by. - Default to "display_time desc". - Supports comma-separated list of fields following AIP-132. - Example: "pinned desc, display_time desc" or "create_time asc" - Supported fields: pinned, display_time, create_time, update_time, name - schema: - type: string - - name: filter - in: query - description: |- - Optional. Filter to apply to the list results. - Filter is a CEL expression to filter memos. - Refer to `Shortcut.filter`. - schema: - type: string - - name: showDeleted - in: query - description: Optional. If true, show deleted memos in the response. - schema: - type: boolean - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListMemosResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - post: - tags: - - MemoService - description: CreateMemo creates a memo. - operationId: MemoService_CreateMemo - parameters: - - name: memoId - in: query - description: |- - Optional. The memo ID to use for this memo. - If empty, a unique ID will be generated. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Memo' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Memo' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/memos/{memo}: - get: - tags: - - MemoService - description: GetMemo gets a memo. - operationId: MemoService_GetMemo - parameters: - - name: memo - in: path - description: The memo id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Memo' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - delete: - tags: - - MemoService - description: DeleteMemo deletes a memo. - operationId: MemoService_DeleteMemo - parameters: - - name: memo - in: path - description: The memo id. - required: true - schema: - type: string - - name: force - in: query - description: Optional. If set to true, the memo will be deleted even if it has associated data. - schema: - type: boolean - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - patch: - tags: - - MemoService - description: UpdateMemo updates a memo. - operationId: MemoService_UpdateMemo - parameters: - - name: memo - in: path - description: The memo id. - required: true - schema: - type: string - - name: updateMask - in: query - description: Required. The list of fields to update. - schema: - type: string - format: field-mask - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Memo' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Memo' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/memos/{memo}/attachments: - get: - tags: - - MemoService - description: ListMemoAttachments lists attachments for a memo. - operationId: MemoService_ListMemoAttachments - parameters: - - name: memo - in: path - description: The memo id. - required: true - schema: - type: string - - name: pageSize - in: query - description: Optional. The maximum number of attachments to return. - schema: - type: integer - format: int32 - - name: pageToken - in: query - description: Optional. A page token for pagination. - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListMemoAttachmentsResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - patch: - tags: - - MemoService - description: SetMemoAttachments sets attachments for a memo. - operationId: MemoService_SetMemoAttachments - parameters: - - name: memo - in: path - description: The memo id. - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/SetMemoAttachmentsRequest' - required: true - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/memos/{memo}/comments: - get: - tags: - - MemoService - description: ListMemoComments lists comments for a memo. - operationId: MemoService_ListMemoComments - parameters: - - name: memo - in: path - description: The memo id. - required: true - schema: - type: string - - name: pageSize - in: query - description: Optional. The maximum number of comments to return. - schema: - type: integer - format: int32 - - name: pageToken - in: query - description: Optional. A page token for pagination. - schema: - type: string - - name: orderBy - in: query - description: Optional. The order to sort results by. - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListMemoCommentsResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - post: - tags: - - MemoService - description: CreateMemoComment creates a comment for a memo. - operationId: MemoService_CreateMemoComment - parameters: - - name: memo - in: path - description: The memo id. - required: true - schema: - type: string - - name: commentId - in: query - description: Optional. The comment ID to use. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Memo' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Memo' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/memos/{memo}/reactions: - get: - tags: - - MemoService - description: ListMemoReactions lists reactions for a memo. - operationId: MemoService_ListMemoReactions - parameters: - - name: memo - in: path - description: The memo id. - required: true - schema: - type: string - - name: pageSize - in: query - description: Optional. The maximum number of reactions to return. - schema: - type: integer - format: int32 - - name: pageToken - in: query - description: Optional. A page token for pagination. - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListMemoReactionsResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - post: - tags: - - MemoService - description: UpsertMemoReaction upserts a reaction for a memo. - operationId: MemoService_UpsertMemoReaction - parameters: - - name: memo - in: path - description: The memo id. - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UpsertMemoReactionRequest' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Reaction' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/memos/{memo}/relations: - get: - tags: - - MemoService - description: ListMemoRelations lists relations for a memo. - operationId: MemoService_ListMemoRelations - parameters: - - name: memo - in: path - description: The memo id. - required: true - schema: - type: string - - name: pageSize - in: query - description: Optional. The maximum number of relations to return. - schema: - type: integer - format: int32 - - name: pageToken - in: query - description: Optional. A page token for pagination. - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListMemoRelationsResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - patch: - tags: - - MemoService - description: SetMemoRelations sets relations for a memo. - operationId: MemoService_SetMemoRelations - parameters: - - name: memo - in: path - description: The memo id. - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/SetMemoRelationsRequest' - required: true - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/reactions/{reaction}: - delete: - tags: - - MemoService - description: DeleteMemoReaction deletes a reaction for a memo. - operationId: MemoService_DeleteMemoReaction - parameters: - - name: reaction - in: path - description: The reaction id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users: - get: - tags: - - UserService - description: ListUsers returns a list of users. - operationId: UserService_ListUsers - parameters: - - name: pageSize - in: query - description: |- - Optional. The maximum number of users to return. - The service may return fewer than this value. - If unspecified, at most 50 users will be returned. - The maximum value is 1000; values above 1000 will be coerced to 1000. - schema: - type: integer - format: int32 - - name: pageToken - in: query - description: |- - Optional. A page token, received from a previous `ListUsers` call. - Provide this to retrieve the subsequent page. - schema: - type: string - - name: filter - in: query - description: |- - Optional. Filter to apply to the list results. - Example: "username == 'steven'" - Supported operators: == - Supported fields: username - schema: - type: string - - name: showDeleted - in: query - description: Optional. If true, show deleted users in the response. - schema: - type: boolean - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListUsersResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - post: - tags: - - UserService - description: CreateUser creates a new user. - operationId: UserService_CreateUser - parameters: - - name: userId - in: query - description: |- - Optional. The user ID to use for this user. - If empty, a unique ID will be generated. - Must match the pattern [a-z0-9-]+ - schema: - type: string - - name: validateOnly - in: query - description: Optional. If set, validate the request but don't actually create the user. - schema: - type: boolean - - name: requestId - in: query - description: |- - Optional. An idempotency token that can be used to ensure that multiple - requests to create a user have the same result. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/User' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/User' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}: - get: - tags: - - UserService - description: |- - GetUser gets a user by ID or username. - Supports both numeric IDs and username strings: - - users/{id} (e.g., users/101) - - users/{username} (e.g., users/steven) - operationId: UserService_GetUser - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: readMask - in: query - description: |- - Optional. The fields to return in the response. - If not specified, all fields are returned. - schema: - type: string - format: field-mask - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/User' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - delete: - tags: - - UserService - description: DeleteUser deletes a user. - operationId: UserService_DeleteUser - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: force - in: query - description: Optional. If set to true, the user will be deleted even if they have associated data. - schema: - type: boolean - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - patch: - tags: - - UserService - description: UpdateUser updates a user. - operationId: UserService_UpdateUser - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: updateMask - in: query - description: Required. The list of fields to update. - schema: - type: string - format: field-mask - - name: allowMissing - in: query - description: Optional. If set to true, allows updating sensitive fields. - schema: - type: boolean - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/User' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/User' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}/accessTokens: - get: - tags: - - UserService - description: ListUserAccessTokens returns a list of access tokens for a user. - operationId: UserService_ListUserAccessTokens - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: pageSize - in: query - description: Optional. The maximum number of access tokens to return. - schema: - type: integer - format: int32 - - name: pageToken - in: query - description: Optional. A page token for pagination. - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListUserAccessTokensResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - post: - tags: - - UserService - description: CreateUserAccessToken creates a new access token for a user. - operationId: UserService_CreateUserAccessToken - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: accessTokenId - in: query - description: Optional. The access token ID to use. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UserAccessToken' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/UserAccessToken' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}/accessTokens/{accessToken}: - delete: - tags: - - UserService - description: DeleteUserAccessToken deletes an access token. - operationId: UserService_DeleteUserAccessToken - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: accessToken - in: path - description: The accessToken id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}/notifications: - get: - tags: - - UserService - description: ListUserNotifications lists notifications for a user. - operationId: UserService_ListUserNotifications - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: pageSize - in: query - schema: - type: integer - format: int32 - - name: pageToken - in: query - schema: - type: string - - name: filter - in: query - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListUserNotificationsResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}/notifications/{notification}: - delete: - tags: - - UserService - description: DeleteUserNotification deletes a notification. - operationId: UserService_DeleteUserNotification - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: notification - in: path - description: The notification id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - patch: - tags: - - UserService - description: UpdateUserNotification updates a notification. - operationId: UserService_UpdateUserNotification - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: notification - in: path - description: The notification id. - required: true - schema: - type: string - - name: updateMask - in: query - schema: - type: string - format: field-mask - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UserNotification' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/UserNotification' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}/sessions: - get: - tags: - - UserService - description: ListUserSessions returns a list of active sessions for a user. - operationId: UserService_ListUserSessions - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListUserSessionsResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}/sessions/{session}: - delete: - tags: - - UserService - description: RevokeUserSession revokes a specific session for a user. - operationId: UserService_RevokeUserSession - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: session - in: path - description: The session id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}/settings: - get: - tags: - - UserService - description: ListUserSettings returns a list of user settings. - operationId: UserService_ListUserSettings - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: pageSize - in: query - description: |- - Optional. The maximum number of settings to return. - The service may return fewer than this value. - If unspecified, at most 50 settings will be returned. - The maximum value is 1000; values above 1000 will be coerced to 1000. - schema: - type: integer - format: int32 - - name: pageToken - in: query - description: |- - Optional. A page token, received from a previous `ListUserSettings` call. - Provide this to retrieve the subsequent page. - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListUserSettingsResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}/settings/{setting}: - get: - tags: - - UserService - description: GetUserSetting returns the user setting. - operationId: UserService_GetUserSetting - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: setting - in: path - description: The setting id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/UserSetting' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - patch: - tags: - - UserService - description: UpdateUserSetting updates the user setting. - operationId: UserService_UpdateUserSetting - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: setting - in: path - description: The setting id. - required: true - schema: - type: string - - name: updateMask - in: query - description: Required. The list of fields to update. - schema: - type: string - format: field-mask - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UserSetting' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/UserSetting' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}/shortcuts: - get: - tags: - - ShortcutService - description: ListShortcuts returns a list of shortcuts for a user. - operationId: ShortcutService_ListShortcuts - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListShortcutsResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - post: - tags: - - ShortcutService - description: CreateShortcut creates a new shortcut for a user. - operationId: ShortcutService_CreateShortcut - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: validateOnly - in: query - description: Optional. If set, validate the request, but do not actually create the shortcut. - schema: - type: boolean - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Shortcut' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Shortcut' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}/shortcuts/{shortcut}: - get: - tags: - - ShortcutService - description: GetShortcut gets a shortcut by name. - operationId: ShortcutService_GetShortcut - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: shortcut - in: path - description: The shortcut id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Shortcut' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - delete: - tags: - - ShortcutService - description: DeleteShortcut deletes a shortcut for a user. - operationId: ShortcutService_DeleteShortcut - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: shortcut - in: path - description: The shortcut id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - patch: - tags: - - ShortcutService - description: UpdateShortcut updates a shortcut for a user. - operationId: ShortcutService_UpdateShortcut - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: shortcut - in: path - description: The shortcut id. - required: true - schema: - type: string - - name: updateMask - in: query - description: Optional. The list of fields to update. - schema: - type: string - format: field-mask - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Shortcut' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Shortcut' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}/webhooks: - get: - tags: - - UserService - description: ListUserWebhooks returns a list of webhooks for a user. - operationId: UserService_ListUserWebhooks - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListUserWebhooksResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - post: - tags: - - UserService - description: CreateUserWebhook creates a new webhook for a user. - operationId: UserService_CreateUserWebhook - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UserWebhook' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/UserWebhook' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}/webhooks/{webhook}: - delete: - tags: - - UserService - description: DeleteUserWebhook deletes a webhook for a user. - operationId: UserService_DeleteUserWebhook - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: webhook - in: path - description: The webhook id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: {} - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - patch: - tags: - - UserService - description: UpdateUserWebhook updates an existing webhook for a user. - operationId: UserService_UpdateUserWebhook - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - - name: webhook - in: path - description: The webhook id. - required: true - schema: - type: string - - name: updateMask - in: query - description: The list of fields to update. - schema: - type: string - format: field-mask - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UserWebhook' - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/UserWebhook' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users/{user}:getStats: - get: - tags: - - UserService - description: GetUserStats returns statistics for a specific user. - operationId: UserService_GetUserStats - parameters: - - name: user - in: path - description: The user id. - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/UserStats' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' - /api/v1/users:stats: - get: - tags: - - UserService - description: ListAllUserStats returns statistics for all users. - operationId: UserService_ListAllUserStats - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListAllUserStatsResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' +paths: {} components: - schemas: - Activity: - type: object - properties: - name: - readOnly: true - type: string - description: |- - The name of the activity. - Format: activities/{id} - creator: - readOnly: true - type: string - description: |- - The name of the creator. - Format: users/{user} - type: - readOnly: true - enum: - - TYPE_UNSPECIFIED - - MEMO_COMMENT - type: string - description: The type of the activity. - format: enum - level: - readOnly: true - enum: - - LEVEL_UNSPECIFIED - - INFO - - WARN - - ERROR - type: string - description: The level of the activity. - format: enum - createTime: - readOnly: true - type: string - description: The create time of the activity. - format: date-time - payload: - readOnly: true - allOf: - - $ref: '#/components/schemas/ActivityPayload' - description: The payload of the activity. - ActivityMemoCommentPayload: - type: object - properties: - memo: - type: string - description: |- - The memo name of comment. - Format: memos/{memo} - relatedMemo: - type: string - description: |- - The name of related memo. - Format: memos/{memo} - description: ActivityMemoCommentPayload represents the payload of a memo comment activity. - ActivityPayload: - type: object - properties: - memoComment: - allOf: - - $ref: '#/components/schemas/ActivityMemoCommentPayload' - description: Memo comment activity payload. - Attachment: - required: - - filename - - type - type: object - properties: - name: - type: string - description: |- - The name of the attachment. - Format: attachments/{attachment} - createTime: - readOnly: true - type: string - description: Output only. The creation timestamp. - format: date-time - filename: - type: string - description: The filename of the attachment. - content: - writeOnly: true - type: string - description: Input only. The content of the attachment. - format: bytes - externalLink: - type: string - description: Optional. The external link of the attachment. - type: - type: string - description: The MIME type of the attachment. - size: - readOnly: true - type: string - description: Output only. The size of the attachment in bytes. - memo: - type: string - description: |- - Optional. The related memo. Refer to `Memo.name`. - Format: memos/{memo} - CreateSessionRequest: - type: object - properties: - passwordCredentials: - allOf: - - $ref: '#/components/schemas/CreateSessionRequest_PasswordCredentials' - description: Username and password authentication method. - ssoCredentials: - allOf: - - $ref: '#/components/schemas/CreateSessionRequest_SSOCredentials' - description: SSO provider authentication method. - CreateSessionRequest_PasswordCredentials: - required: - - username - - password - type: object - properties: - username: - type: string - description: |- - The username to sign in with. - Required field for password-based authentication. - password: - type: string - description: |- - The password to sign in with. - Required field for password-based authentication. - description: Nested message for password-based authentication credentials. - CreateSessionRequest_SSOCredentials: - required: - - idpId - - code - - redirectUri - type: object - properties: - idpId: - type: integer - description: |- - The ID of the SSO provider. - Required field to identify the SSO provider. - format: int32 - code: - type: string - description: |- - The authorization code from the SSO provider. - Required field for completing the SSO flow. - redirectUri: - type: string - description: |- - The redirect URI used in the SSO flow. - Required field for security validation. - codeVerifier: - type: string - description: |- - The PKCE code verifier for enhanced security (RFC 7636). - Optional field - if provided, enables PKCE flow protection against authorization code interception. - description: Nested message for SSO authentication credentials. - CreateSessionResponse: - type: object - properties: - user: - allOf: - - $ref: '#/components/schemas/User' - description: The authenticated user information. - lastAccessedAt: - type: string - description: |- - Last time the session was accessed. - Used for sliding expiration calculation (last_accessed_time + 2 weeks). - format: date-time - FieldMapping: - type: object - properties: - identifier: - type: string - displayName: - type: string - email: - type: string - avatarUrl: - type: string - GeneralSetting_CustomProfile: - type: object - properties: - title: - type: string - description: - type: string - logoUrl: - type: string - description: Custom profile configuration for instance branding. - GetCurrentSessionResponse: - type: object - properties: - user: - $ref: '#/components/schemas/User' - lastAccessedAt: - type: string - description: |- - Last time the session was accessed. - Used for sliding expiration calculation (last_accessed_time + 2 weeks). - format: date-time - GoogleProtobufAny: - type: object - properties: - '@type': - type: string - description: The type of the serialized message. - additionalProperties: true - description: Contains an arbitrary serialized message along with a @type that describes the type of the serialized message. - IdentityProvider: - required: - - type - - title - - config - type: object - properties: - name: - type: string - description: |- - The resource name of the identity provider. - Format: identity-providers/{idp} - type: - enum: - - TYPE_UNSPECIFIED - - OAUTH2 - type: string - description: Required. The type of the identity provider. - format: enum - title: - type: string - description: Required. The display title of the identity provider. - identifierFilter: - type: string - description: Optional. Filter applied to user identifiers. - config: - allOf: - - $ref: '#/components/schemas/IdentityProviderConfig' - description: Required. Configuration for the identity provider. - IdentityProviderConfig: - type: object - properties: - oauth2Config: - $ref: '#/components/schemas/OAuth2Config' - InstanceProfile: - type: object - properties: - owner: - type: string - description: |- - The name of instance owner. - Format: users/{user} - version: - type: string - description: Version is the current version of instance. - mode: - type: string - description: Mode is the instance mode (e.g. "prod", "dev" or "demo"). - instanceUrl: - type: string - description: Instance URL is the URL of the instance. - description: Instance profile message containing basic instance information. - InstanceSetting: - type: object - properties: - name: - type: string - description: |- - The name of the instance setting. - Format: instance/settings/{setting} - generalSetting: - $ref: '#/components/schemas/InstanceSetting_GeneralSetting' - storageSetting: - $ref: '#/components/schemas/InstanceSetting_StorageSetting' - memoRelatedSetting: - $ref: '#/components/schemas/InstanceSetting_MemoRelatedSetting' - description: An instance setting resource. - InstanceSetting_GeneralSetting: - type: object - properties: - disallowUserRegistration: - type: boolean - description: disallow_user_registration disallows user registration. - disallowPasswordAuth: - type: boolean - description: disallow_password_auth disallows password authentication. - additionalScript: - type: string - description: additional_script is the additional script. - additionalStyle: - type: string - description: additional_style is the additional style. - customProfile: - allOf: - - $ref: '#/components/schemas/GeneralSetting_CustomProfile' - description: custom_profile is the custom profile. - weekStartDayOffset: - type: integer - description: |- - week_start_day_offset is the week start day offset from Sunday. - 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday - Default is Sunday. - format: int32 - disallowChangeUsername: - type: boolean - description: disallow_change_username disallows changing username. - disallowChangeNickname: - type: boolean - description: disallow_change_nickname disallows changing nickname. - description: General instance settings configuration. - InstanceSetting_MemoRelatedSetting: - type: object - properties: - disallowPublicVisibility: - type: boolean - description: disallow_public_visibility disallows set memo as public visibility. - displayWithUpdateTime: - type: boolean - description: display_with_update_time orders and displays memo with update time. - contentLengthLimit: - type: integer - description: content_length_limit is the limit of content length. Unit is byte. - format: int32 - enableDoubleClickEdit: - type: boolean - description: enable_double_click_edit enables editing on double click. - reactions: - type: array - items: - type: string - description: reactions is the list of reactions. - enableBlurNsfwContent: - type: boolean - description: enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW). - nsfwTags: - type: array - items: - type: string - description: nsfw_tags is the list of tags that mark content as NSFW for blurring. - description: Memo-related instance settings and policies. - InstanceSetting_StorageSetting: - type: object - properties: - storageType: - enum: - - STORAGE_TYPE_UNSPECIFIED - - DATABASE - - LOCAL - - S3 - type: string - description: storage_type is the storage type. - format: enum - filepathTemplate: - type: string - description: |- - The template of file path. - e.g. assets/{timestamp}_{filename} - uploadSizeLimitMb: - type: string - description: The max upload size in megabytes. - s3Config: - allOf: - - $ref: '#/components/schemas/StorageSetting_S3Config' - description: The S3 config. - description: Storage configuration settings for instance attachments. - ListActivitiesResponse: - type: object - properties: - activities: - type: array - items: - $ref: '#/components/schemas/Activity' - description: The activities. - nextPageToken: - type: string - description: |- - A token to retrieve the next page of results. - Pass this value in the page_token field in the subsequent call to `ListActivities` - method to retrieve the next page of results. - ListAllUserStatsResponse: - type: object - properties: - stats: - type: array - items: - $ref: '#/components/schemas/UserStats' - description: The list of user statistics. - ListAttachmentsResponse: - type: object - properties: - attachments: - type: array - items: - $ref: '#/components/schemas/Attachment' - description: The list of attachments. - nextPageToken: - type: string - description: |- - A token that can be sent as `page_token` to retrieve the next page. - If this field is omitted, there are no subsequent pages. - totalSize: - type: integer - description: The total count of attachments (may be approximate). - format: int32 - ListIdentityProvidersResponse: - type: object - properties: - identityProviders: - type: array - items: - $ref: '#/components/schemas/IdentityProvider' - description: The list of identity providers. - ListMemoAttachmentsResponse: - type: object - properties: - attachments: - type: array - items: - $ref: '#/components/schemas/Attachment' - description: The list of attachments. - nextPageToken: - type: string - description: A token for the next page of results. - ListMemoCommentsResponse: - type: object - properties: - memos: - type: array - items: - $ref: '#/components/schemas/Memo' - description: The list of comment memos. - nextPageToken: - type: string - description: A token for the next page of results. - totalSize: - type: integer - description: The total count of comments. - format: int32 - ListMemoReactionsResponse: - type: object - properties: - reactions: - type: array - items: - $ref: '#/components/schemas/Reaction' - description: The list of reactions. - nextPageToken: - type: string - description: A token for the next page of results. - totalSize: - type: integer - description: The total count of reactions. - format: int32 - ListMemoRelationsResponse: - type: object - properties: - relations: - type: array - items: - $ref: '#/components/schemas/MemoRelation' - description: The list of relations. - nextPageToken: - type: string - description: A token for the next page of results. - ListMemosResponse: - type: object - properties: - memos: - type: array - items: - $ref: '#/components/schemas/Memo' - description: The list of memos. - nextPageToken: - type: string - description: |- - A token that can be sent as `page_token` to retrieve the next page. - If this field is omitted, there are no subsequent pages. - ListShortcutsResponse: - type: object - properties: - shortcuts: - type: array - items: - $ref: '#/components/schemas/Shortcut' - description: The list of shortcuts. - ListUserAccessTokensResponse: - type: object - properties: - accessTokens: - type: array - items: - $ref: '#/components/schemas/UserAccessToken' - description: The list of access tokens. - nextPageToken: - type: string - description: A token for the next page of results. - totalSize: - type: integer - description: The total count of access tokens. - format: int32 - ListUserNotificationsResponse: - type: object - properties: - notifications: - type: array - items: - $ref: '#/components/schemas/UserNotification' - nextPageToken: - type: string - ListUserSessionsResponse: - type: object - properties: - sessions: - type: array - items: - $ref: '#/components/schemas/UserSession' - description: The list of user sessions. - ListUserSettingsResponse: - type: object - properties: - settings: - type: array - items: - $ref: '#/components/schemas/UserSetting' - description: The list of user settings. - nextPageToken: - type: string - description: |- - A token that can be sent as `page_token` to retrieve the next page. - If this field is omitted, there are no subsequent pages. - totalSize: - type: integer - description: The total count of settings (may be approximate). - format: int32 - description: Response message for ListUserSettings method. - ListUserWebhooksResponse: - type: object - properties: - webhooks: - type: array - items: - $ref: '#/components/schemas/UserWebhook' - description: The list of webhooks. - ListUsersResponse: - type: object - properties: - users: - type: array - items: - $ref: '#/components/schemas/User' - description: The list of users. - nextPageToken: - type: string - description: |- - A token that can be sent as `page_token` to retrieve the next page. - If this field is omitted, there are no subsequent pages. - totalSize: - type: integer - description: The total count of users (may be approximate). - format: int32 - Location: - type: object - properties: - placeholder: - type: string - description: A placeholder text for the location. - latitude: - type: number - description: The latitude of the location. - format: double - longitude: - type: number - description: The longitude of the location. - format: double - Memo: - required: - - state - - content - - visibility - type: object - properties: - name: - type: string - description: |- - The resource name of the memo. - Format: memos/{memo}, memo is the user defined id or uuid. - state: - enum: - - STATE_UNSPECIFIED - - NORMAL - - ARCHIVED - type: string - description: The state of the memo. - format: enum - creator: - readOnly: true - type: string - description: |- - The name of the creator. - Format: users/{user} - createTime: - readOnly: true - type: string - description: Output only. The creation timestamp. - format: date-time - updateTime: - readOnly: true - type: string - description: Output only. The last update timestamp. - format: date-time - displayTime: - type: string - description: The display timestamp of the memo. - format: date-time - content: - type: string - description: Required. The content of the memo in Markdown format. - visibility: - enum: - - VISIBILITY_UNSPECIFIED - - PRIVATE - - PROTECTED - - PUBLIC - type: string - description: The visibility of the memo. - format: enum - tags: - readOnly: true - type: array - items: - type: string - description: Output only. The tags extracted from the content. - pinned: - type: boolean - description: Whether the memo is pinned. - attachments: - type: array - items: - $ref: '#/components/schemas/Attachment' - description: Optional. The attachments of the memo. - relations: - type: array - items: - $ref: '#/components/schemas/MemoRelation' - description: Optional. The relations of the memo. - reactions: - readOnly: true - type: array - items: - $ref: '#/components/schemas/Reaction' - description: Output only. The reactions to the memo. - property: - readOnly: true - allOf: - - $ref: '#/components/schemas/Memo_Property' - description: Output only. The computed properties of the memo. - parent: - readOnly: true - type: string - description: |- - Output only. The name of the parent memo. - Format: memos/{memo} - snippet: - readOnly: true - type: string - description: Output only. The snippet of the memo content. Plain text only. - location: - allOf: - - $ref: '#/components/schemas/Location' - description: Optional. The location of the memo. - MemoRelation: - required: - - memo - - relatedMemo - - type - type: object - properties: - memo: - allOf: - - $ref: '#/components/schemas/MemoRelation_Memo' - description: The memo in the relation. - relatedMemo: - allOf: - - $ref: '#/components/schemas/MemoRelation_Memo' - description: The related memo. - type: - enum: - - TYPE_UNSPECIFIED - - REFERENCE - - COMMENT - type: string - format: enum - MemoRelation_Memo: - required: - - name - type: object - properties: - name: - type: string - description: |- - The resource name of the memo. - Format: memos/{memo} - snippet: - readOnly: true - type: string - description: Output only. The snippet of the memo content. Plain text only. - description: Memo reference in relations. - Memo_Property: - type: object - properties: - hasLink: - type: boolean - hasTaskList: - type: boolean - hasCode: - type: boolean - hasIncompleteTasks: - type: boolean - description: Computed properties of a memo. - OAuth2Config: - type: object - properties: - clientId: - type: string - clientSecret: - type: string - authUrl: - type: string - tokenUrl: - type: string - userInfoUrl: - type: string - scopes: - type: array - items: - type: string - fieldMapping: - $ref: '#/components/schemas/FieldMapping' - Reaction: - required: - - contentId - - reactionType - type: object - properties: - name: - readOnly: true - type: string - description: |- - The resource name of the reaction. - Format: reactions/{reaction} - creator: - readOnly: true - type: string - description: |- - The resource name of the creator. - Format: users/{user} - contentId: - type: string - description: |- - The resource name of the content. - For memo reactions, this should be the memo's resource name. - Format: memos/{memo} - reactionType: - type: string - description: "Required. The type of reaction (e.g., \"\U0001F44D\", \"❤️\", \"\U0001F604\")." - createTime: - readOnly: true - type: string - description: Output only. The creation timestamp. - format: date-time - SetMemoAttachmentsRequest: - required: - - name - - attachments - type: object - properties: - name: - type: string - description: |- - Required. The resource name of the memo. - Format: memos/{memo} - attachments: - type: array - items: - $ref: '#/components/schemas/Attachment' - description: Required. The attachments to set for the memo. - SetMemoRelationsRequest: - required: - - name - - relations - type: object - properties: - name: - type: string - description: |- - Required. The resource name of the memo. - Format: memos/{memo} - relations: - type: array - items: - $ref: '#/components/schemas/MemoRelation' - description: Required. The relations to set for the memo. - Shortcut: - required: - - title - type: object - properties: - name: - type: string - description: |- - The resource name of the shortcut. - Format: users/{user}/shortcuts/{shortcut} - title: - type: string - description: The title of the shortcut. - filter: - type: string - description: The filter expression for the shortcut. - Status: - type: object - properties: - code: - type: integer - description: The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. - format: int32 - message: - type: string - description: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. - details: - type: array - items: - $ref: '#/components/schemas/GoogleProtobufAny' - description: A list of messages that carry the error details. There is a common set of message types for APIs to use. - description: 'The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).' - StorageSetting_S3Config: - type: object - properties: - accessKeyId: - type: string - accessKeySecret: - type: string - endpoint: - type: string - region: - type: string - bucket: - type: string - usePathStyle: - type: boolean - description: |- - S3 configuration for cloud storage backend. - Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ - UpsertMemoReactionRequest: - required: - - name - - reaction - type: object - properties: - name: - type: string - description: |- - Required. The resource name of the memo. - Format: memos/{memo} - reaction: - allOf: - - $ref: '#/components/schemas/Reaction' - description: Required. The reaction to upsert. - User: - required: - - role - - username - - state - type: object - properties: - name: - type: string - description: |- - The resource name of the user. - Format: users/{user} - role: - enum: - - ROLE_UNSPECIFIED - - HOST - - ADMIN - - USER - type: string - description: The role of the user. - format: enum - username: - type: string - description: Required. The unique username for login. - email: - type: string - description: Optional. The email address of the user. - displayName: - type: string - description: Optional. The display name of the user. - avatarUrl: - type: string - description: Optional. The avatar URL of the user. - description: - type: string - description: Optional. The description of the user. - password: - writeOnly: true - type: string - description: Input only. The password for the user. - state: - enum: - - STATE_UNSPECIFIED - - NORMAL - - ARCHIVED - type: string - description: The state of the user. - format: enum - createTime: - readOnly: true - type: string - description: Output only. The creation timestamp. - format: date-time - updateTime: - readOnly: true - type: string - description: Output only. The last update timestamp. - format: date-time - UserAccessToken: - type: object - properties: - name: - type: string - description: |- - The resource name of the access token. - Format: users/{user}/accessTokens/{access_token} - accessToken: - readOnly: true - type: string - description: Output only. The access token value. - description: - type: string - description: The description of the access token. - issuedAt: - readOnly: true - type: string - description: Output only. The issued timestamp. - format: date-time - expiresAt: - type: string - description: Optional. The expiration timestamp. - format: date-time - description: User access token message - UserNotification: - type: object - properties: - name: - readOnly: true - type: string - description: |- - The resource name of the notification. - Format: users/{user}/notifications/{notification} - sender: - readOnly: true - type: string - description: |- - The sender of the notification. - Format: users/{user} - status: - enum: - - STATUS_UNSPECIFIED - - UNREAD - - ARCHIVED - type: string - description: The status of the notification. - format: enum - createTime: - readOnly: true - type: string - description: The creation timestamp. - format: date-time - type: - readOnly: true - enum: - - TYPE_UNSPECIFIED - - MEMO_COMMENT - type: string - description: The type of the notification. - format: enum - activityId: - type: integer - description: The activity ID associated with this notification. - format: int32 - UserSession: - type: object - properties: - name: - type: string - description: |- - The resource name of the session. - Format: users/{user}/sessions/{session} - sessionId: - readOnly: true - type: string - description: The session ID. - createTime: - readOnly: true - type: string - description: The timestamp when the session was created. - format: date-time - lastAccessedTime: - readOnly: true - type: string - description: |- - The timestamp when the session was last accessed. - Used for sliding expiration calculation (last_accessed_time + 2 weeks). - format: date-time - clientInfo: - readOnly: true - allOf: - - $ref: '#/components/schemas/UserSession_ClientInfo' - description: Client information associated with this session. - UserSession_ClientInfo: - type: object - properties: - userAgent: - type: string - description: User agent string of the client. - ipAddress: - type: string - description: IP address of the client. - deviceType: - type: string - description: Optional. Device type (e.g., "mobile", "desktop", "tablet"). - os: - type: string - description: Optional. Operating system (e.g., "iOS 17.0", "Windows 11"). - browser: - type: string - description: Optional. Browser name and version (e.g., "Chrome 119.0"). - UserSetting: - type: object - properties: - name: - type: string - description: |- - The name of the user setting. - Format: users/{user}/settings/{setting}, {setting} is the key for the setting. - For example, "users/123/settings/GENERAL" for general settings. - generalSetting: - $ref: '#/components/schemas/UserSetting_GeneralSetting' - sessionsSetting: - $ref: '#/components/schemas/UserSetting_SessionsSetting' - accessTokensSetting: - $ref: '#/components/schemas/UserSetting_AccessTokensSetting' - webhooksSetting: - $ref: '#/components/schemas/UserSetting_WebhooksSetting' - description: User settings message - UserSetting_AccessTokensSetting: - type: object - properties: - accessTokens: - type: array - items: - $ref: '#/components/schemas/UserAccessToken' - description: List of user access tokens. - description: User access tokens configuration. - UserSetting_GeneralSetting: - type: object - properties: - locale: - type: string - description: The preferred locale of the user. - memoVisibility: - type: string - description: The default visibility of the memo. - theme: - type: string - description: |- - The preferred theme of the user. - This references a CSS file in the web/public/themes/ directory. - If not set, the default theme will be used. - description: General user settings configuration. - UserSetting_SessionsSetting: - type: object - properties: - sessions: - type: array - items: - $ref: '#/components/schemas/UserSession' - description: List of active user sessions. - description: User authentication sessions configuration. - UserSetting_WebhooksSetting: - type: object - properties: - webhooks: - type: array - items: - $ref: '#/components/schemas/UserWebhook' - description: List of user webhooks. - description: User webhooks configuration. - UserStats: - type: object - properties: - name: - type: string - description: |- - The resource name of the user whose stats these are. - Format: users/{user} - memoDisplayTimestamps: - type: array - items: - type: string - format: date-time - description: The timestamps when the memos were displayed. - memoTypeStats: - allOf: - - $ref: '#/components/schemas/UserStats_MemoTypeStats' - description: The stats of memo types. - tagCount: - type: object - additionalProperties: - type: integer - format: int32 - description: The count of tags. - pinnedMemos: - type: array - items: - type: string - description: The pinned memos of the user. - totalMemoCount: - type: integer - description: Total memo count. - format: int32 - description: User statistics messages - UserStats_MemoTypeStats: - type: object - properties: - linkCount: - type: integer - format: int32 - codeCount: - type: integer - format: int32 - todoCount: - type: integer - format: int32 - undoCount: - type: integer - format: int32 - description: Memo type statistics. - UserWebhook: - type: object - properties: - name: - type: string - description: |- - The name of the webhook. - Format: users/{user}/webhooks/{webhook} - url: - type: string - description: The URL to send the webhook to. - displayName: - type: string - description: Optional. Human-readable name for the webhook. - createTime: - readOnly: true - type: string - description: The creation time of the webhook. - format: date-time - updateTime: - readOnly: true - type: string - description: The last update time of the webhook. - format: date-time - description: UserWebhook represents a webhook owned by a user. -tags: - - name: ActivityService - - name: AttachmentService - - name: AuthService - - name: IdentityProviderService - - name: InstanceService - - name: MemoService - - name: ShortcutService - - name: UserService + schemas: {} diff --git a/server/auth/authenticator.go b/server/auth/authenticator.go new file mode 100644 index 000000000..e494115a7 --- /dev/null +++ b/server/auth/authenticator.go @@ -0,0 +1,197 @@ +package auth + +import ( + "context" + "time" + + "github.com/golang-jwt/jwt/v5" + "github.com/pkg/errors" + "google.golang.org/protobuf/types/known/timestamppb" + + "github.com/usememos/memos/internal/util" + storepb "github.com/usememos/memos/proto/gen/store" + "github.com/usememos/memos/store" +) + +// Authenticator provides shared authentication and authorization logic. +// Used by gRPC interceptor, Connect interceptor, and file server to ensure +// consistent authentication behavior across all API endpoints. +// +// Authentication methods: +// - Session cookie: Browser-based authentication with sliding expiration +// - JWT token: API token authentication for programmatic access +// +// This struct is safe for concurrent use. +type Authenticator struct { + store *store.Store + secret string +} + +// NewAuthenticator creates a new Authenticator instance. +func NewAuthenticator(store *store.Store, secret string) *Authenticator { + return &Authenticator{ + store: store, + secret: secret, + } +} + +// AuthenticateBySession validates a session cookie and returns the authenticated user. +// +// Validation steps: +// 1. Parse cookie value to extract userID and sessionID +// 2. Verify user exists and is not archived +// 3. Verify session exists in user's sessions list +// 4. Check session hasn't expired (sliding expiration: 14 days from last access) +// +// Returns the user if authentication succeeds, or an error describing the failure. +func (a *Authenticator) AuthenticateBySession(ctx context.Context, sessionCookieValue string) (*store.User, error) { + if sessionCookieValue == "" { + return nil, errors.New("session cookie value not found") + } + + userID, sessionID, err := ParseSessionCookieValue(sessionCookieValue) + if err != nil { + return nil, errors.Wrap(err, "invalid session cookie format") + } + + user, err := a.store.GetUser(ctx, &store.FindUser{ID: &userID}) + if err != nil { + return nil, errors.Wrap(err, "failed to get user") + } + if user == nil { + return nil, errors.New("user not found") + } + if user.RowStatus == store.Archived { + return nil, errors.New("user is archived") + } + + sessions, err := a.store.GetUserSessions(ctx, user.ID) + if err != nil { + return nil, errors.Wrap(err, "failed to get user sessions") + } + + if !validateSession(sessionID, sessions) { + return nil, errors.New("invalid or expired session") + } + + return user, nil +} + +// AuthenticateByJWT validates a JWT access token and returns the authenticated user. +// +// Validation steps: +// 1. Parse and verify JWT signature using server secret +// 2. Verify key ID matches expected version +// 3. Extract user ID from JWT claims (subject field) +// 4. Verify user exists and is not archived +// 5. Verify token exists in user's access_tokens list (for revocation support) +// +// Returns the user if authentication succeeds, or an error describing the failure. +func (a *Authenticator) AuthenticateByJWT(ctx context.Context, accessToken string) (*store.User, error) { + if accessToken == "" { + return nil, errors.New("access token not found") + } + + claims := &ClaimsMessage{} + _, err := jwt.ParseWithClaims(accessToken, claims, func(t *jwt.Token) (any, error) { + if t.Method.Alg() != jwt.SigningMethodHS256.Name { + return nil, errors.Errorf("unexpected signing method: %v", t.Header["alg"]) + } + kid, ok := t.Header["kid"].(string) + if !ok || kid != KeyID { + return nil, errors.Errorf("unexpected kid: %v", t.Header["kid"]) + } + return []byte(a.secret), nil + }) + if err != nil { + return nil, errors.New("invalid or expired access token") + } + + userID, err := util.ConvertStringToInt32(claims.Subject) + if err != nil { + return nil, errors.Wrap(err, "malformed ID in token") + } + + user, err := a.store.GetUser(ctx, &store.FindUser{ID: &userID}) + if err != nil { + return nil, errors.Wrap(err, "failed to get user") + } + if user == nil { + return nil, errors.Errorf("user %d not found", userID) + } + if user.RowStatus == store.Archived { + return nil, errors.Errorf("user %d is archived", userID) + } + + accessTokens, err := a.store.GetUserAccessTokens(ctx, user.ID) + if err != nil { + return nil, errors.Wrap(err, "failed to get user access tokens") + } + if !validateAccessToken(accessToken, accessTokens) { + return nil, errors.New("invalid access token") + } + + return user, nil +} + +// AuthorizeAndSetContext checks user authorization for the given procedure and sets context values. +// +// Authorization checks: +// - Admin-only methods require Host or Admin role (checked via isAdminOnly function) +// +// Context values set: +// - UserIDContextKey: Always set with the user's ID +// - SessionIDContextKey: Set if authenticated via session cookie +// - AccessTokenContextKey: Set if authenticated via JWT token +// +// Also updates session last accessed time for session-based auth (sliding expiration). +// +// Returns the updated context or an error if authorization fails. +func (a *Authenticator) AuthorizeAndSetContext(ctx context.Context, procedure string, user *store.User, sessionID, accessToken string, isAdminOnly func(string) bool) (context.Context, error) { + // Check admin-only method authorization + if isAdminOnly != nil && isAdminOnly(procedure) && user.Role != store.RoleHost && user.Role != store.RoleAdmin { + return nil, errors.Errorf("user %q is not authorized for this operation", user.Username) + } + + // Set user ID in context (always) + ctx = context.WithValue(ctx, UserIDContextKey, user.ID) + + // Set authentication method specific context values + if sessionID != "" { + ctx = context.WithValue(ctx, SessionIDContextKey, sessionID) + // Update session last accessed time for sliding expiration + _ = a.store.UpdateUserSessionLastAccessed(ctx, user.ID, sessionID, timestamppb.Now()) + } else if accessToken != "" { + ctx = context.WithValue(ctx, AccessTokenContextKey, accessToken) + } + + return ctx, nil +} + +// validateSession checks if a session exists and is still valid. +// Uses sliding expiration: session is valid if last accessed within SessionSlidingDuration. +func validateSession(sessionID string, sessions []*storepb.SessionsUserSetting_Session) bool { + for _, session := range sessions { + if sessionID == session.SessionId { + if session.LastAccessedTime != nil { + expiration := session.LastAccessedTime.AsTime().Add(SessionSlidingDuration) + if expiration.Before(time.Now()) { + return false // Session expired + } + } + return true + } + } + return false // Session not found +} + +// validateAccessToken checks if the token exists in the user's access tokens list. +// This enables token revocation: deleted tokens are removed from the list. +func validateAccessToken(token string, tokens []*storepb.AccessTokensUserSetting_AccessToken) bool { + for _, t := range tokens { + if token == t.AccessToken { + return true + } + } + return false +} diff --git a/server/auth/context.go b/server/auth/context.go new file mode 100644 index 000000000..dfcf946e6 --- /dev/null +++ b/server/auth/context.go @@ -0,0 +1,49 @@ +package auth + +import "context" + +// ContextKey is the key type for context values. +// Using a custom type prevents collisions with other packages. +type ContextKey int + +const ( + // UserIDContextKey stores the authenticated user's ID. + // Set for both session-based and token-based authentication. + // Use GetUserID(ctx) to retrieve this value. + UserIDContextKey ContextKey = iota + + // SessionIDContextKey stores the session ID for session-based auth. + // Only set when authenticated via session cookie. + SessionIDContextKey + + // AccessTokenContextKey stores the JWT token for token-based auth. + // Only set when authenticated via Bearer token. + AccessTokenContextKey +) + +// GetUserID retrieves the authenticated user's ID from the context. +// Returns 0 if no user ID is set (unauthenticated request). +func GetUserID(ctx context.Context) int32 { + if v, ok := ctx.Value(UserIDContextKey).(int32); ok { + return v + } + return 0 +} + +// GetSessionID retrieves the session ID from the context. +// Returns empty string if not authenticated via session cookie. +func GetSessionID(ctx context.Context) string { + if v, ok := ctx.Value(SessionIDContextKey).(string); ok { + return v + } + return "" +} + +// GetAccessToken retrieves the JWT access token from the context. +// Returns empty string if not authenticated via bearer token. +func GetAccessToken(ctx context.Context) string { + if v, ok := ctx.Value(AccessTokenContextKey).(string); ok { + return v + } + return "" +} diff --git a/server/auth/extract.go b/server/auth/extract.go new file mode 100644 index 000000000..2d264a9d0 --- /dev/null +++ b/server/auth/extract.go @@ -0,0 +1,35 @@ +package auth + +import ( + "net/http" + "strings" +) + +// ExtractSessionCookieFromHeader extracts the session cookie value from an HTTP Cookie header. +// Returns empty string if the session cookie is not found. +func ExtractSessionCookieFromHeader(cookieHeader string) string { + if cookieHeader == "" { + return "" + } + // Use http.Request to parse cookies properly + req := &http.Request{Header: http.Header{"Cookie": []string{cookieHeader}}} + cookie, err := req.Cookie(SessionCookieName) + if err != nil { + return "" + } + return cookie.Value +} + +// ExtractBearerToken extracts the JWT token from an Authorization header value. +// Expected format: "Bearer {token}" +// Returns empty string if no valid bearer token is found. +func ExtractBearerToken(authHeader string) string { + if authHeader == "" { + return "" + } + parts := strings.Fields(authHeader) + if len(parts) != 2 || !strings.EqualFold(parts[0], "bearer") { + return "" + } + return parts[1] +} diff --git a/server/router/api/v1/auth.go b/server/auth/token.go similarity index 90% rename from server/router/api/v1/auth.go rename to server/auth/token.go index 78afef35b..813e4824b 100644 --- a/server/router/api/v1/auth.go +++ b/server/auth/token.go @@ -1,4 +1,13 @@ -package v1 +// Package auth provides authentication and authorization for the Memos server. +// +// This package is used by: +// - server/router/api/v1: gRPC and Connect API interceptors +// - server/router/fileserver: HTTP file server authentication +// +// Authentication methods supported: +// - Session cookie: Browser-based authentication with sliding expiration +// - JWT token: API token authentication for programmatic access +package auth import ( "fmt" @@ -99,8 +108,8 @@ func generateToken(username string, userID int32, audience string, expirationTim // // Uses UUID v4 (random) for high entropy and uniqueness. // Session IDs are stored in user settings and used to identify browser sessions. -func GenerateSessionID() (string, error) { - return util.GenUUID(), nil +func GenerateSessionID() string { + return util.GenUUID() } // BuildSessionCookieValue creates the session cookie value. diff --git a/server/router/api/v1/acl.go b/server/router/api/v1/acl.go index 6e974d316..a6acb8341 100644 --- a/server/router/api/v1/acl.go +++ b/server/router/api/v1/acl.go @@ -1,315 +1,125 @@ package v1 +// gRPC Authentication Interceptor +// +// This file implements the authentication interceptor for gRPC requests. +// It extracts credentials from gRPC metadata and delegates to the shared Authenticator. +// +// Authentication flow: +// 1. Extract session cookie or bearer token from metadata +// 2. Validate credentials using Authenticator +// 3. Check authorization (admin-only methods) +// 4. Set user context and proceed with request +// +// For public methods (defined in acl_config.go), authentication is skipped. + import ( "context" - "net/http" - "strings" - "time" - "github.com/golang-jwt/jwt/v5" - "github.com/pkg/errors" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/timestamppb" - "github.com/usememos/memos/internal/util" - storepb "github.com/usememos/memos/proto/gen/store" + "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" ) -// ContextKey is the key type of context value. -type ContextKey int - -const ( - // UserIDContextKey stores the authenticated user's ID in the context. - // Set for both session-based and token-based authentication. - UserIDContextKey ContextKey = iota - - // sessionIDContextKey stores the session ID in the context. - // Only set for session-based authentication (cookie auth). - sessionIDContextKey - - // accessTokenContextKey stores the JWT access token in the context. - // Only set for token-based authentication (Bearer token). - accessTokenContextKey -) - -// GRPCAuthInterceptor is the auth interceptor for gRPC server. +// GRPCAuthInterceptor is the authentication interceptor for gRPC server. +// It validates incoming requests and sets user context for authenticated requests. type GRPCAuthInterceptor struct { - Store *store.Store - secret string + authenticator *auth.Authenticator } -// NewGRPCAuthInterceptor returns a new API auth interceptor. +// NewGRPCAuthInterceptor creates a new gRPC authentication interceptor. func NewGRPCAuthInterceptor(store *store.Store, secret string) *GRPCAuthInterceptor { return &GRPCAuthInterceptor{ - Store: store, - secret: secret, + authenticator: auth.NewAuthenticator(store, secret), } } // AuthenticationInterceptor is the unary interceptor for gRPC API. // -// Authentication Strategy (in priority order): -// 1. Session Cookie: Check for "user_session" cookie with format "{userID}-{sessionID}" -// 2. Access Token: Check for "Authorization: Bearer {token}" header with JWT -// 3. Public Endpoints: Allow if method is in public allowlist -// 4. Reject: Return 401 Unauthenticated if none of the above succeed +// Authentication strategy (in priority order): +// 1. Session Cookie: "user_session" cookie with format "{userID}-{sessionID}" +// 2. Bearer Token: "Authorization: Bearer {jwt_token}" header +// 3. Public Methods: Allow without auth if method is in public allowlist +// 4. Reject: Return Unauthenticated error // -// On successful authentication, sets context values: -// - UserIDContextKey: The authenticated user's ID (always set) -// - sessionIDContextKey: Session ID (only for cookie auth) -// - accessTokenContextKey: JWT token (only for Bearer token auth). +// On successful authentication, context values are set: +// - auth.UserIDContextKey: The authenticated user's ID +// - auth.SessionIDContextKey: Session ID (cookie auth only) +// - auth.AccessTokenContextKey: JWT token (bearer auth only). func (in *GRPCAuthInterceptor) AuthenticationInterceptor(ctx context.Context, request any, serverInfo *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) { md, ok := metadata.FromIncomingContext(ctx) if !ok { return nil, status.Errorf(codes.Unauthenticated, "failed to parse metadata from incoming context") } - // Authentication Method 1: Session-based authentication (Cookie) - // Format: Cookie: user_session={userID}-{sessionID} - // Used by: Web browsers - if sessionCookieValue, err := getSessionIDFromMetadata(md); err == nil && sessionCookieValue != "" { - user, err := in.authenticateBySession(ctx, sessionCookieValue) + // Try session cookie authentication + if sessionCookie := extractSessionCookieFromMetadata(md); sessionCookie != "" { + user, err := in.authenticator.AuthenticateBySession(ctx, sessionCookie) if err == nil && user != nil { - // Extract just the sessionID part for context storage - _, sessionID, parseErr := ParseSessionCookieValue(sessionCookieValue) - if parseErr != nil { - return nil, status.Errorf(codes.Internal, "failed to parse session cookie: %v", parseErr) + _, sessionID, _ := auth.ParseSessionCookieValue(sessionCookie) + ctx, err = in.authenticator.AuthorizeAndSetContext(ctx, serverInfo.FullMethod, user, sessionID, "", IsAdminOnlyMethod) + if err != nil { + return nil, toGRPCError(err, codes.PermissionDenied) } - return in.handleAuthenticatedRequest(ctx, request, serverInfo, handler, user, sessionID, "") + return handler(ctx, request) } } - // Authentication Method 2: Token-based authentication (JWT) - // Format: Authorization: Bearer {jwt_token} - // Used by: Mobile apps, CLI tools, API clients - if accessToken, err := getAccessTokenFromMetadata(md); err == nil && accessToken != "" { - user, err := in.authenticateByJWT(ctx, accessToken) + // Try bearer token authentication + if token := extractBearerTokenFromMetadata(md); token != "" { + user, err := in.authenticator.AuthenticateByJWT(ctx, token) if err == nil && user != nil { - return in.handleAuthenticatedRequest(ctx, request, serverInfo, handler, user, "", accessToken) + ctx, err = in.authenticator.AuthorizeAndSetContext(ctx, serverInfo.FullMethod, user, "", token, IsAdminOnlyMethod) + if err != nil { + return nil, toGRPCError(err, codes.PermissionDenied) + } + return handler(ctx, request) } } - // Authentication Method 3: Public endpoints - // Some endpoints don't require authentication (e.g., login, signup) - // Check if this method is in the allowlist - if isUnauthorizeAllowedMethod(serverInfo.FullMethod) { + // Allow public methods without authentication + if IsPublicMethod(serverInfo.FullMethod) { return handler(ctx, request) } - // If authentication is required but not found, reject the request return nil, status.Errorf(codes.Unauthenticated, "authentication required") } -// handleAuthenticatedRequest processes an authenticated request with the given user and auth info. -func (in *GRPCAuthInterceptor) handleAuthenticatedRequest(ctx context.Context, request any, serverInfo *grpc.UnaryServerInfo, handler grpc.UnaryHandler, user *store.User, sessionID, accessToken string) (any, error) { - // Check user status - if user.RowStatus == store.Archived { - return nil, errors.Errorf("user %q is archived", user.Username) +// toGRPCError converts an error to a gRPC status error with the given code. +// If the error is already a gRPC status error, it is returned as-is. +func toGRPCError(err error, code codes.Code) error { + if err == nil { + return nil } - if isOnlyForAdminAllowedMethod(serverInfo.FullMethod) && user.Role != store.RoleHost && user.Role != store.RoleAdmin { - return nil, errors.Errorf("user %q is not admin", user.Username) + if _, ok := status.FromError(err); ok { + return err } - - // Set context values - ctx = context.WithValue(ctx, UserIDContextKey, user.ID) - - if sessionID != "" { - // Session-based authentication - ctx = context.WithValue(ctx, sessionIDContextKey, sessionID) - // Update session last accessed time - _ = in.updateSessionLastAccessed(ctx, user.ID, sessionID) - } else if accessToken != "" { - // JWT access token-based authentication - ctx = context.WithValue(ctx, accessTokenContextKey, accessToken) - } - - return handler(ctx, request) + return status.Errorf(code, "%v", err) } -// authenticateByJWT authenticates a user using JWT access token from Authorization header. -// -// Validation steps: -// 1. Parse and verify JWT signature using server secret -// 2. Extract user ID from JWT claims (subject field) -// 3. Verify user exists and is not archived -// 4. Verify token exists in user's access_tokens list (for revocation support) -// -// Returns the authenticated user or an error. -func (in *GRPCAuthInterceptor) authenticateByJWT(ctx context.Context, accessToken string) (*store.User, error) { - if accessToken == "" { - return nil, status.Errorf(codes.Unauthenticated, "access token not found") - } - claims := &ClaimsMessage{} - _, err := jwt.ParseWithClaims(accessToken, claims, func(t *jwt.Token) (any, error) { - if t.Method.Alg() != jwt.SigningMethodHS256.Name { - return nil, status.Errorf(codes.Unauthenticated, "unexpected access token signing method=%v, expect %v", t.Header["alg"], jwt.SigningMethodHS256) - } - if kid, ok := t.Header["kid"].(string); ok { - if kid == "v1" { - return []byte(in.secret), nil - } - } - return nil, status.Errorf(codes.Unauthenticated, "unexpected access token kid=%v", t.Header["kid"]) - }) - if err != nil { - return nil, status.Errorf(codes.Unauthenticated, "Invalid or expired access token") - } - - // Get user from JWT claims - userID, err := util.ConvertStringToInt32(claims.Subject) - if err != nil { - return nil, errors.Wrap(err, "malformed ID in the token") - } - user, err := in.Store.GetUser(ctx, &store.FindUser{ - ID: &userID, - }) - if err != nil { - return nil, errors.Wrap(err, "failed to get user") - } - if user == nil { - return nil, errors.Errorf("user %q not exists", userID) - } - if user.RowStatus == store.Archived { - return nil, errors.Errorf("user %q is archived", userID) - } - - // Validate that this access token exists in the user's access tokens - accessTokens, err := in.Store.GetUserAccessTokens(ctx, user.ID) - if err != nil { - return nil, errors.Wrapf(err, "failed to get user access tokens") - } - if !validateAccessToken(accessToken, accessTokens) { - return nil, status.Errorf(codes.Unauthenticated, "invalid access token") - } - - return user, nil -} - -// authenticateBySession authenticates a user using session ID from cookie. -// -// Validation steps: -// 1. Parse cookie value to extract userID and sessionID -// 2. Verify user exists and is not archived -// 3. Verify session exists in user's sessions list -// 4. Check session hasn't expired (sliding expiration: 14 days from last access) -// -// Returns the authenticated user or an error. -func (in *GRPCAuthInterceptor) authenticateBySession(ctx context.Context, sessionCookieValue string) (*store.User, error) { - if sessionCookieValue == "" { - return nil, status.Errorf(codes.Unauthenticated, "session cookie value not found") - } - - // Parse the cookie value to extract userID and sessionID - userID, sessionID, err := ParseSessionCookieValue(sessionCookieValue) - if err != nil { - return nil, status.Errorf(codes.Unauthenticated, "invalid session cookie format: %v", err) - } - - // Get the user directly using the userID from the cookie - user, err := in.Store.GetUser(ctx, &store.FindUser{ - ID: &userID, - }) - if err != nil { - return nil, errors.Wrap(err, "failed to get user") - } - if user == nil { - return nil, status.Errorf(codes.Unauthenticated, "user not found") - } - if user.RowStatus == store.Archived { - return nil, status.Errorf(codes.Unauthenticated, "user is archived") - } - - // Get user sessions and validate the sessionID - sessions, err := in.Store.GetUserSessions(ctx, user.ID) - if err != nil { - return nil, errors.Wrap(err, "failed to get user sessions") - } - - if !validateUserSession(sessionID, sessions) { - return nil, status.Errorf(codes.Unauthenticated, "invalid or expired session") - } - - return user, nil -} - -// updateSessionLastAccessed updates the last accessed time for a user session. -func (in *GRPCAuthInterceptor) updateSessionLastAccessed(ctx context.Context, userID int32, sessionID string) error { - return in.Store.UpdateUserSessionLastAccessed(ctx, userID, sessionID, timestamppb.Now()) -} - -// validateUserSession checks if a session exists and is still valid using sliding expiration. -// -// Sliding expiration logic: -// - Session is valid if: last_accessed_time + 14 days > current_time -// - Each API call updates last_accessed_time, extending the session -// - This provides better UX than fixed expiration (users stay logged in while active). -func validateUserSession(sessionID string, userSessions []*storepb.SessionsUserSetting_Session) bool { - for _, session := range userSessions { - if sessionID == session.SessionId { - // Use sliding expiration: check if last_accessed_time + 2 weeks > current_time - if session.LastAccessedTime != nil { - expirationTime := session.LastAccessedTime.AsTime().Add(SessionSlidingDuration) - if expirationTime.Before(time.Now()) { - return false - } - } - return true +// extractSessionCookieFromMetadata extracts the session cookie value from gRPC metadata. +// Checks both "grpcgateway-cookie" (from gRPC-Gateway) and "cookie" (native gRPC). +// Returns empty string if no session cookie is found. +func extractSessionCookieFromMetadata(md metadata.MD) string { + // gRPC-Gateway puts cookies in "grpcgateway-cookie", native gRPC uses "cookie" + for _, cookieHeader := range append(md.Get("grpcgateway-cookie"), md.Get("cookie")...) { + if cookie := auth.ExtractSessionCookieFromHeader(cookieHeader); cookie != "" { + return cookie } } - return false + return "" } -// getSessionIDFromMetadata extracts session cookie value from metadata. -// -// Checks both "grpcgateway-cookie" (set by gRPC-Gateway) and "cookie" (set by native gRPC). -// Cookie format: user_session={userID}-{sessionID}. -func getSessionIDFromMetadata(md metadata.MD) (string, error) { - // Check the cookie header for session cookie value - var sessionCookieValue string - for _, t := range append(md.Get("grpcgateway-cookie"), md.Get("cookie")...) { - header := http.Header{} - header.Add("Cookie", t) - request := http.Request{Header: header} - if v, _ := request.Cookie(SessionCookieName); v != nil { - sessionCookieValue = v.Value - } +// extractBearerTokenFromMetadata extracts JWT token from Authorization header in gRPC metadata. +// Returns empty string if no valid bearer token is found. +func extractBearerTokenFromMetadata(md metadata.MD) string { + authHeaders := md.Get("Authorization") + if len(authHeaders) == 0 { + return "" } - if sessionCookieValue == "" { - return "", errors.New("session cookie not found") - } - return sessionCookieValue, nil -} - -// getAccessTokenFromMetadata extracts JWT access token from Authorization header. -// -// Expected header format: Authorization: Bearer {jwt_token} -// This follows the OAuth 2.0 Bearer token specification (RFC 6750). -func getAccessTokenFromMetadata(md metadata.MD) (string, error) { - // Check the HTTP request Authorization header. - authorizationHeaders := md.Get("Authorization") - if len(authorizationHeaders) == 0 { - return "", errors.New("authorization header not found") - } - authHeaderParts := strings.Fields(authorizationHeaders[0]) - if len(authHeaderParts) != 2 || strings.ToLower(authHeaderParts[0]) != "bearer" { - return "", errors.New("authorization header format must be Bearer {token}") - } - return authHeaderParts[1], nil -} - -// validateAccessToken checks if the provided JWT token exists in the user's access tokens list. -// -// This enables token revocation: when a user deletes a token from their settings, -// it's removed from this list and subsequent API calls with that token will fail. -func validateAccessToken(accessTokenString string, userAccessTokens []*storepb.AccessTokensUserSetting_AccessToken) bool { - for _, userAccessToken := range userAccessTokens { - if accessTokenString == userAccessToken.AccessToken { - return true - } - } - return false + return auth.ExtractBearerToken(authHeaders[0]) } diff --git a/server/router/api/v1/acl_config.go b/server/router/api/v1/acl_config.go index 2f9caa500..5f8fbef9f 100644 --- a/server/router/api/v1/acl_config.go +++ b/server/router/api/v1/acl_config.go @@ -1,33 +1,56 @@ package v1 -var authenticationAllowlistMethods = map[string]bool{ - "/memos.api.v1.InstanceService/GetInstanceProfile": true, - "/memos.api.v1.InstanceService/GetInstanceSetting": true, +// Access Control List (ACL) Configuration +// +// This file defines which API methods require authentication and which require admin privileges. +// Used by both gRPC and Connect interceptors to enforce access control. +// +// Method names follow the gRPC full method format: "/{package}.{service}/{method}" +// Example: "/memos.api.v1.MemoService/CreateMemo" + +// publicMethods lists methods that can be called without authentication. +// These are typically read-only endpoints for public content or login-related endpoints. +var publicMethods = map[string]bool{ + // Instance info - needed before login + "/memos.api.v1.InstanceService/GetInstanceProfile": true, + "/memos.api.v1.InstanceService/GetInstanceSetting": true, + + // Auth - login/session endpoints + "/memos.api.v1.AuthService/CreateSession": true, + "/memos.api.v1.AuthService/GetCurrentSession": true, + + // User - public user info and registration + "/memos.api.v1.UserService/CreateUser": true, // Registration (also admin-only when not first user) + "/memos.api.v1.UserService/GetUser": true, + "/memos.api.v1.UserService/GetUserAvatar": true, + "/memos.api.v1.UserService/GetUserStats": true, + "/memos.api.v1.UserService/ListAllUserStats": true, + "/memos.api.v1.UserService/SearchUsers": true, + + // Identity providers - needed for SSO login "/memos.api.v1.IdentityProviderService/ListIdentityProviders": true, - "/memos.api.v1.AuthService/CreateSession": true, - "/memos.api.v1.AuthService/GetCurrentSession": true, - "/memos.api.v1.UserService/CreateUser": true, - "/memos.api.v1.UserService/GetUser": true, - "/memos.api.v1.UserService/GetUserAvatar": true, - "/memos.api.v1.UserService/GetUserStats": true, - "/memos.api.v1.UserService/ListAllUserStats": true, - "/memos.api.v1.UserService/SearchUsers": true, - "/memos.api.v1.MemoService/GetMemo": true, - "/memos.api.v1.MemoService/ListMemos": true, - "/memos.api.v1.AttachmentService/GetAttachmentBinary": true, + + // Memo - public memo access + "/memos.api.v1.MemoService/GetMemo": true, + "/memos.api.v1.MemoService/ListMemos": true, + + // Attachment - public attachment access + "/memos.api.v1.AttachmentService/GetAttachmentBinary": true, } -// isUnauthorizeAllowedMethod returns whether the method is exempted from authentication. -func isUnauthorizeAllowedMethod(fullMethodName string) bool { - return authenticationAllowlistMethods[fullMethodName] -} - -var allowedMethodsOnlyForAdmin = map[string]bool{ - "/memos.api.v1.UserService/CreateUser": true, +// adminOnlyMethods lists methods that require admin (Host or Admin role) privileges. +// Regular users cannot call these methods even if authenticated. +var adminOnlyMethods = map[string]bool{ + "/memos.api.v1.UserService/CreateUser": true, // Admin creates users (except first user registration) "/memos.api.v1.InstanceService/UpdateInstanceSetting": true, } -// isOnlyForAdminAllowedMethod returns true if the method is allowed to be called only by admin. -func isOnlyForAdminAllowedMethod(methodName string) bool { - return allowedMethodsOnlyForAdmin[methodName] +// IsPublicMethod returns true if the method can be called without authentication. +func IsPublicMethod(fullMethodName string) bool { + return publicMethods[fullMethodName] +} + +// IsAdminOnlyMethod returns true if the method requires admin privileges. +func IsAdminOnlyMethod(fullMethodName string) bool { + return adminOnlyMethods[fullMethodName] } diff --git a/server/router/api/v1/auth_service.go b/server/router/api/v1/auth_service.go index c98967139..92e4dafca 100644 --- a/server/router/api/v1/auth_service.go +++ b/server/router/api/v1/auth_service.go @@ -22,6 +22,7 @@ import ( "github.com/usememos/memos/plugin/idp/oauth2" v1pb "github.com/usememos/memos/proto/gen/api/v1" storepb "github.com/usememos/memos/proto/gen/store" + "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" ) @@ -53,7 +54,7 @@ func (s *APIV1Service) GetCurrentSession(ctx context.Context, _ *v1pb.GetCurrent var lastAccessedAt *timestamppb.Timestamp // Update session last accessed time if we have a session ID and get the current session info - if sessionID, ok := ctx.Value(sessionIDContextKey).(string); ok && sessionID != "" { + if sessionID := auth.GetSessionID(ctx); sessionID != "" { now := timestamppb.Now() if err := s.Store.UpdateUserSessionLastAccessed(ctx, user.ID, sessionID, now); err != nil { // Log error but don't fail the request @@ -221,10 +222,7 @@ func (s *APIV1Service) CreateSession(ctx context.Context, request *v1pb.CreateSe // sliding expiration (14 days from last access) checked during authentication. func (s *APIV1Service) doSignIn(ctx context.Context, user *store.User, expireTime time.Time) error { // Generate unique session ID for web use - sessionID, err := GenerateSessionID() - if err != nil { - return status.Errorf(codes.Internal, "failed to generate session ID, error: %v", err) - } + sessionID := auth.GenerateSessionID() // Track session in user settings if err := s.trackUserSession(ctx, user.ID, sessionID); err != nil { @@ -234,7 +232,7 @@ func (s *APIV1Service) doSignIn(ctx context.Context, user *store.User, expireTim } // Set session cookie for web use (format: userID-sessionID) - sessionCookieValue := BuildSessionCookieValue(user.ID, sessionID) + sessionCookieValue := auth.BuildSessionCookieValue(user.ID, sessionID) sessionCookie, err := s.buildSessionCookie(ctx, sessionCookieValue, expireTime) if err != nil { return status.Errorf(codes.Internal, "failed to build session cookie, error: %v", err) @@ -266,7 +264,7 @@ func (s *APIV1Service) DeleteSession(ctx context.Context, _ *v1pb.DeleteSessionR } // Check if we have a session ID (from cookie-based auth) - if sessionID, ok := ctx.Value(sessionIDContextKey).(string); ok && sessionID != "" { + if sessionID := auth.GetSessionID(ctx); sessionID != "" { // Remove session from user settings if err := s.Store.RemoveUserSession(ctx, user.ID, sessionID); err != nil { slog.Error("failed to remove user session", "error", err) @@ -297,7 +295,7 @@ func (s *APIV1Service) clearAuthCookies(ctx context.Context) error { func (*APIV1Service) buildSessionCookie(ctx context.Context, sessionCookieValue string, expireTime time.Time) (string, error) { attrs := []string{ - fmt.Sprintf("%s=%s", SessionCookieName, sessionCookieValue), + fmt.Sprintf("%s=%s", auth.SessionCookieName, sessionCookieValue), "Path=/", "HttpOnly", } @@ -326,8 +324,8 @@ func (*APIV1Service) buildSessionCookie(ctx context.Context, sessionCookieValue } func (s *APIV1Service) GetCurrentUser(ctx context.Context) (*store.User, error) { - userID, ok := ctx.Value(UserIDContextKey).(int32) - if !ok { + userID := auth.GetUserID(ctx) + if userID == 0 { return nil, nil } user, err := s.Store.GetUser(ctx, &store.FindUser{ diff --git a/server/router/api/v1/connect_handler.go b/server/router/api/v1/connect_handler.go new file mode 100644 index 000000000..b1cca529d --- /dev/null +++ b/server/router/api/v1/connect_handler.go @@ -0,0 +1,80 @@ +package v1 + +import ( + "net/http" + + "connectrpc.com/connect" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/usememos/memos/proto/gen/api/v1/apiv1connect" +) + +// ConnectServiceHandler wraps APIV1Service to implement Connect handler interfaces. +// It adapts the existing gRPC service implementations to work with Connect's +// request/response wrapper types. +// +// This wrapper pattern allows us to: +// - Reuse existing gRPC service implementations +// - Support both native gRPC and Connect protocols +// - Maintain a single source of truth for business logic. +type ConnectServiceHandler struct { + *APIV1Service +} + +// NewConnectServiceHandler creates a new Connect service handler. +func NewConnectServiceHandler(svc *APIV1Service) *ConnectServiceHandler { + return &ConnectServiceHandler{APIV1Service: svc} +} + +// RegisterConnectHandlers registers all Connect service handlers on the given mux. +func (s *ConnectServiceHandler) RegisterConnectHandlers(mux *http.ServeMux, opts ...connect.HandlerOption) { + // Register all service handlers + handlers := []struct { + path string + handler http.Handler + }{ + wrap(apiv1connect.NewInstanceServiceHandler(s, opts...)), + wrap(apiv1connect.NewAuthServiceHandler(s, opts...)), + wrap(apiv1connect.NewUserServiceHandler(s, opts...)), + wrap(apiv1connect.NewMemoServiceHandler(s, opts...)), + wrap(apiv1connect.NewAttachmentServiceHandler(s, opts...)), + wrap(apiv1connect.NewShortcutServiceHandler(s, opts...)), + wrap(apiv1connect.NewActivityServiceHandler(s, opts...)), + wrap(apiv1connect.NewIdentityProviderServiceHandler(s, opts...)), + } + + for _, h := range handlers { + mux.Handle(h.path, h.handler) + } +} + +// wrap converts (path, handler) return value to a struct for cleaner iteration. +func wrap(path string, handler http.Handler) struct { + path string + handler http.Handler +} { + return struct { + path string + handler http.Handler + }{path, handler} +} + +// convertGRPCError converts gRPC status errors to Connect errors. +// This preserves the error code semantics between the two protocols. +func convertGRPCError(err error) error { + if err == nil { + return nil + } + if st, ok := status.FromError(err); ok { + return connect.NewError(grpcCodeToConnectCode(st.Code()), err) + } + return connect.NewError(connect.CodeInternal, err) +} + +// grpcCodeToConnectCode converts gRPC status codes to Connect error codes. +// gRPC and Connect use the same error code semantics, so this is a direct cast. +// See: https://connectrpc.com/docs/protocol/#error-codes +func grpcCodeToConnectCode(code codes.Code) connect.Code { + return connect.Code(code) +} diff --git a/server/router/api/v1/connect_interceptors.go b/server/router/api/v1/connect_interceptors.go new file mode 100644 index 000000000..a7acb2c24 --- /dev/null +++ b/server/router/api/v1/connect_interceptors.go @@ -0,0 +1,203 @@ +package v1 + +import ( + "context" + "fmt" + "log/slog" + "runtime/debug" + + "connectrpc.com/connect" + "github.com/pkg/errors" + + "github.com/usememos/memos/server/auth" + "github.com/usememos/memos/store" +) + +// LoggingInterceptor logs Connect RPC requests with appropriate log levels. +// +// Log levels: +// - INFO: Successful requests and expected client errors (not found, permission denied, etc.) +// - ERROR: Server errors (internal, unavailable, etc.) +type LoggingInterceptor struct { + logStacktrace bool +} + +// NewLoggingInterceptor creates a new logging interceptor. +func NewLoggingInterceptor(logStacktrace bool) *LoggingInterceptor { + return &LoggingInterceptor{logStacktrace: logStacktrace} +} + +func (in *LoggingInterceptor) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc { + return func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + resp, err := next(ctx, req) + in.log(req.Spec().Procedure, err) + return resp, err + } +} + +func (*LoggingInterceptor) WrapStreamingClient(next connect.StreamingClientFunc) connect.StreamingClientFunc { + return next // No-op for server-side interceptor +} + +func (*LoggingInterceptor) WrapStreamingHandler(next connect.StreamingHandlerFunc) connect.StreamingHandlerFunc { + return next // Streaming not used in this service +} + +func (in *LoggingInterceptor) log(procedure string, err error) { + level, msg := in.classifyError(err) + attrs := []slog.Attr{slog.String("method", procedure)} + if err != nil { + attrs = append(attrs, slog.String("error", err.Error())) + if in.logStacktrace { + attrs = append(attrs, slog.String("stacktrace", fmt.Sprintf("%+v", err))) + } + } + slog.LogAttrs(context.Background(), level, msg, attrs...) +} + +func (*LoggingInterceptor) classifyError(err error) (slog.Level, string) { + if err == nil { + return slog.LevelInfo, "OK" + } + + var connectErr *connect.Error + if !errors.As(err, &connectErr) { + return slog.LevelError, "unknown error" + } + + // Client errors (expected, log at INFO) + switch connectErr.Code() { + case connect.CodeCanceled, + connect.CodeInvalidArgument, + connect.CodeNotFound, + connect.CodeAlreadyExists, + connect.CodePermissionDenied, + connect.CodeUnauthenticated, + connect.CodeResourceExhausted, + connect.CodeFailedPrecondition, + connect.CodeAborted, + connect.CodeOutOfRange: + return slog.LevelInfo, "client error" + default: + // Server errors + return slog.LevelError, "server error" + } +} + +// RecoveryInterceptor recovers from panics in Connect handlers and returns an internal error. +type RecoveryInterceptor struct { + logStacktrace bool +} + +// NewRecoveryInterceptor creates a new recovery interceptor. +func NewRecoveryInterceptor(logStacktrace bool) *RecoveryInterceptor { + return &RecoveryInterceptor{logStacktrace: logStacktrace} +} + +func (in *RecoveryInterceptor) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc { + return func(ctx context.Context, req connect.AnyRequest) (resp connect.AnyResponse, err error) { + defer func() { + if r := recover(); r != nil { + in.logPanic(req.Spec().Procedure, r) + err = connect.NewError(connect.CodeInternal, errors.New("internal server error")) + } + }() + return next(ctx, req) + } +} + +func (*RecoveryInterceptor) WrapStreamingClient(next connect.StreamingClientFunc) connect.StreamingClientFunc { + return next +} + +func (*RecoveryInterceptor) WrapStreamingHandler(next connect.StreamingHandlerFunc) connect.StreamingHandlerFunc { + return next +} + +func (in *RecoveryInterceptor) logPanic(procedure string, panicValue any) { + attrs := []slog.Attr{ + slog.String("method", procedure), + slog.Any("panic", panicValue), + } + if in.logStacktrace { + attrs = append(attrs, slog.String("stacktrace", string(debug.Stack()))) + } + slog.LogAttrs(context.Background(), slog.LevelError, "panic recovered in Connect handler", attrs...) +} + +// AuthInterceptor handles authentication for Connect handlers. +// +// It reuses the same authentication logic as GRPCAuthInterceptor by delegating +// to a shared Authenticator instance. This ensures consistent authentication +// behavior across both gRPC and Connect protocols. +type AuthInterceptor struct { + authenticator *auth.Authenticator +} + +// NewAuthInterceptor creates a new auth interceptor. +func NewAuthInterceptor(store *store.Store, secret string) *AuthInterceptor { + return &AuthInterceptor{ + authenticator: auth.NewAuthenticator(store, secret), + } +} + +func (in *AuthInterceptor) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc { + return func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + procedure := req.Spec().Procedure + header := req.Header() + + // Try session cookie authentication first + if sessionCookie := auth.ExtractSessionCookieFromHeader(header.Get("Cookie")); sessionCookie != "" { + user, err := in.authenticator.AuthenticateBySession(ctx, sessionCookie) + if err == nil && user != nil { + _, sessionID, _ := auth.ParseSessionCookieValue(sessionCookie) + ctx, err = in.authenticator.AuthorizeAndSetContext(ctx, procedure, user, sessionID, "", IsAdminOnlyMethod) + if err != nil { + return nil, convertAuthError(err) + } + return next(ctx, req) + } + } + + // Try JWT token authentication + if accessToken := auth.ExtractBearerToken(header.Get("Authorization")); accessToken != "" { + user, err := in.authenticator.AuthenticateByJWT(ctx, accessToken) + if err == nil && user != nil { + ctx, err = in.authenticator.AuthorizeAndSetContext(ctx, procedure, user, "", accessToken, IsAdminOnlyMethod) + if err != nil { + return nil, convertAuthError(err) + } + return next(ctx, req) + } + } + + // Allow public methods without authentication + if IsPublicMethod(procedure) { + return next(ctx, req) + } + + return nil, connect.NewError(connect.CodeUnauthenticated, errors.New("authentication required")) + } +} + +func (*AuthInterceptor) WrapStreamingClient(next connect.StreamingClientFunc) connect.StreamingClientFunc { + return next +} + +func (*AuthInterceptor) WrapStreamingHandler(next connect.StreamingHandlerFunc) connect.StreamingHandlerFunc { + return next +} + +// convertAuthError converts authentication/authorization errors to Connect errors. +func convertAuthError(err error) error { + if err == nil { + return nil + } + // Check if it's already a Connect error + var connectErr *connect.Error + if errors.As(err, &connectErr) { + return err + } + // Default to permission denied for auth errors + return connect.NewError(connect.CodePermissionDenied, err) +} diff --git a/server/router/api/v1/connect_services.go b/server/router/api/v1/connect_services.go new file mode 100644 index 000000000..281b9632f --- /dev/null +++ b/server/router/api/v1/connect_services.go @@ -0,0 +1,502 @@ +package v1 + +import ( + "context" + + "connectrpc.com/connect" + "google.golang.org/protobuf/types/known/emptypb" + + v1pb "github.com/usememos/memos/proto/gen/api/v1" +) + +// This file contains all Connect service handler method implementations. +// Each method delegates to the underlying gRPC service implementation, +// converting between Connect and gRPC request/response types. + +// InstanceService + +func (s *ConnectServiceHandler) GetInstanceProfile(ctx context.Context, req *connect.Request[v1pb.GetInstanceProfileRequest]) (*connect.Response[v1pb.InstanceProfile], error) { + resp, err := s.APIV1Service.GetInstanceProfile(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) GetInstanceSetting(ctx context.Context, req *connect.Request[v1pb.GetInstanceSettingRequest]) (*connect.Response[v1pb.InstanceSetting], error) { + resp, err := s.APIV1Service.GetInstanceSetting(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) UpdateInstanceSetting(ctx context.Context, req *connect.Request[v1pb.UpdateInstanceSettingRequest]) (*connect.Response[v1pb.InstanceSetting], error) { + resp, err := s.APIV1Service.UpdateInstanceSetting(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +// AuthService + +func (s *ConnectServiceHandler) GetCurrentSession(ctx context.Context, req *connect.Request[v1pb.GetCurrentSessionRequest]) (*connect.Response[v1pb.GetCurrentSessionResponse], error) { + resp, err := s.APIV1Service.GetCurrentSession(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) CreateSession(ctx context.Context, req *connect.Request[v1pb.CreateSessionRequest]) (*connect.Response[v1pb.CreateSessionResponse], error) { + resp, err := s.APIV1Service.CreateSession(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) DeleteSession(ctx context.Context, req *connect.Request[v1pb.DeleteSessionRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIV1Service.DeleteSession(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +// UserService + +func (s *ConnectServiceHandler) ListUsers(ctx context.Context, req *connect.Request[v1pb.ListUsersRequest]) (*connect.Response[v1pb.ListUsersResponse], error) { + resp, err := s.APIV1Service.ListUsers(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) GetUser(ctx context.Context, req *connect.Request[v1pb.GetUserRequest]) (*connect.Response[v1pb.User], error) { + resp, err := s.APIV1Service.GetUser(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) CreateUser(ctx context.Context, req *connect.Request[v1pb.CreateUserRequest]) (*connect.Response[v1pb.User], error) { + resp, err := s.APIV1Service.CreateUser(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) UpdateUser(ctx context.Context, req *connect.Request[v1pb.UpdateUserRequest]) (*connect.Response[v1pb.User], error) { + resp, err := s.APIV1Service.UpdateUser(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) DeleteUser(ctx context.Context, req *connect.Request[v1pb.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIV1Service.DeleteUser(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) ListAllUserStats(ctx context.Context, req *connect.Request[v1pb.ListAllUserStatsRequest]) (*connect.Response[v1pb.ListAllUserStatsResponse], error) { + resp, err := s.APIV1Service.ListAllUserStats(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) GetUserStats(ctx context.Context, req *connect.Request[v1pb.GetUserStatsRequest]) (*connect.Response[v1pb.UserStats], error) { + resp, err := s.APIV1Service.GetUserStats(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) GetUserSetting(ctx context.Context, req *connect.Request[v1pb.GetUserSettingRequest]) (*connect.Response[v1pb.UserSetting], error) { + resp, err := s.APIV1Service.GetUserSetting(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) UpdateUserSetting(ctx context.Context, req *connect.Request[v1pb.UpdateUserSettingRequest]) (*connect.Response[v1pb.UserSetting], error) { + resp, err := s.APIV1Service.UpdateUserSetting(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) ListUserSettings(ctx context.Context, req *connect.Request[v1pb.ListUserSettingsRequest]) (*connect.Response[v1pb.ListUserSettingsResponse], error) { + resp, err := s.APIV1Service.ListUserSettings(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) ListUserAccessTokens(ctx context.Context, req *connect.Request[v1pb.ListUserAccessTokensRequest]) (*connect.Response[v1pb.ListUserAccessTokensResponse], error) { + resp, err := s.APIV1Service.ListUserAccessTokens(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) CreateUserAccessToken(ctx context.Context, req *connect.Request[v1pb.CreateUserAccessTokenRequest]) (*connect.Response[v1pb.UserAccessToken], error) { + resp, err := s.APIV1Service.CreateUserAccessToken(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) DeleteUserAccessToken(ctx context.Context, req *connect.Request[v1pb.DeleteUserAccessTokenRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIV1Service.DeleteUserAccessToken(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) ListUserSessions(ctx context.Context, req *connect.Request[v1pb.ListUserSessionsRequest]) (*connect.Response[v1pb.ListUserSessionsResponse], error) { + resp, err := s.APIV1Service.ListUserSessions(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) RevokeUserSession(ctx context.Context, req *connect.Request[v1pb.RevokeUserSessionRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIV1Service.RevokeUserSession(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) ListUserWebhooks(ctx context.Context, req *connect.Request[v1pb.ListUserWebhooksRequest]) (*connect.Response[v1pb.ListUserWebhooksResponse], error) { + resp, err := s.APIV1Service.ListUserWebhooks(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) CreateUserWebhook(ctx context.Context, req *connect.Request[v1pb.CreateUserWebhookRequest]) (*connect.Response[v1pb.UserWebhook], error) { + resp, err := s.APIV1Service.CreateUserWebhook(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) UpdateUserWebhook(ctx context.Context, req *connect.Request[v1pb.UpdateUserWebhookRequest]) (*connect.Response[v1pb.UserWebhook], error) { + resp, err := s.APIV1Service.UpdateUserWebhook(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) DeleteUserWebhook(ctx context.Context, req *connect.Request[v1pb.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIV1Service.DeleteUserWebhook(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) ListUserNotifications(ctx context.Context, req *connect.Request[v1pb.ListUserNotificationsRequest]) (*connect.Response[v1pb.ListUserNotificationsResponse], error) { + resp, err := s.APIV1Service.ListUserNotifications(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) UpdateUserNotification(ctx context.Context, req *connect.Request[v1pb.UpdateUserNotificationRequest]) (*connect.Response[v1pb.UserNotification], error) { + resp, err := s.APIV1Service.UpdateUserNotification(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) DeleteUserNotification(ctx context.Context, req *connect.Request[v1pb.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIV1Service.DeleteUserNotification(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +// MemoService + +func (s *ConnectServiceHandler) CreateMemo(ctx context.Context, req *connect.Request[v1pb.CreateMemoRequest]) (*connect.Response[v1pb.Memo], error) { + resp, err := s.APIV1Service.CreateMemo(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) ListMemos(ctx context.Context, req *connect.Request[v1pb.ListMemosRequest]) (*connect.Response[v1pb.ListMemosResponse], error) { + resp, err := s.APIV1Service.ListMemos(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) GetMemo(ctx context.Context, req *connect.Request[v1pb.GetMemoRequest]) (*connect.Response[v1pb.Memo], error) { + resp, err := s.APIV1Service.GetMemo(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) UpdateMemo(ctx context.Context, req *connect.Request[v1pb.UpdateMemoRequest]) (*connect.Response[v1pb.Memo], error) { + resp, err := s.APIV1Service.UpdateMemo(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) DeleteMemo(ctx context.Context, req *connect.Request[v1pb.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIV1Service.DeleteMemo(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) SetMemoAttachments(ctx context.Context, req *connect.Request[v1pb.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIV1Service.SetMemoAttachments(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) ListMemoAttachments(ctx context.Context, req *connect.Request[v1pb.ListMemoAttachmentsRequest]) (*connect.Response[v1pb.ListMemoAttachmentsResponse], error) { + resp, err := s.APIV1Service.ListMemoAttachments(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) SetMemoRelations(ctx context.Context, req *connect.Request[v1pb.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIV1Service.SetMemoRelations(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) ListMemoRelations(ctx context.Context, req *connect.Request[v1pb.ListMemoRelationsRequest]) (*connect.Response[v1pb.ListMemoRelationsResponse], error) { + resp, err := s.APIV1Service.ListMemoRelations(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) CreateMemoComment(ctx context.Context, req *connect.Request[v1pb.CreateMemoCommentRequest]) (*connect.Response[v1pb.Memo], error) { + resp, err := s.APIV1Service.CreateMemoComment(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) ListMemoComments(ctx context.Context, req *connect.Request[v1pb.ListMemoCommentsRequest]) (*connect.Response[v1pb.ListMemoCommentsResponse], error) { + resp, err := s.APIV1Service.ListMemoComments(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) ListMemoReactions(ctx context.Context, req *connect.Request[v1pb.ListMemoReactionsRequest]) (*connect.Response[v1pb.ListMemoReactionsResponse], error) { + resp, err := s.APIV1Service.ListMemoReactions(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) UpsertMemoReaction(ctx context.Context, req *connect.Request[v1pb.UpsertMemoReactionRequest]) (*connect.Response[v1pb.Reaction], error) { + resp, err := s.APIV1Service.UpsertMemoReaction(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) DeleteMemoReaction(ctx context.Context, req *connect.Request[v1pb.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIV1Service.DeleteMemoReaction(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +// AttachmentService + +func (s *ConnectServiceHandler) CreateAttachment(ctx context.Context, req *connect.Request[v1pb.CreateAttachmentRequest]) (*connect.Response[v1pb.Attachment], error) { + resp, err := s.APIV1Service.CreateAttachment(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) ListAttachments(ctx context.Context, req *connect.Request[v1pb.ListAttachmentsRequest]) (*connect.Response[v1pb.ListAttachmentsResponse], error) { + resp, err := s.APIV1Service.ListAttachments(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) GetAttachment(ctx context.Context, req *connect.Request[v1pb.GetAttachmentRequest]) (*connect.Response[v1pb.Attachment], error) { + resp, err := s.APIV1Service.GetAttachment(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) UpdateAttachment(ctx context.Context, req *connect.Request[v1pb.UpdateAttachmentRequest]) (*connect.Response[v1pb.Attachment], error) { + resp, err := s.APIV1Service.UpdateAttachment(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) DeleteAttachment(ctx context.Context, req *connect.Request[v1pb.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIV1Service.DeleteAttachment(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +// ShortcutService + +func (s *ConnectServiceHandler) ListShortcuts(ctx context.Context, req *connect.Request[v1pb.ListShortcutsRequest]) (*connect.Response[v1pb.ListShortcutsResponse], error) { + resp, err := s.APIV1Service.ListShortcuts(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) GetShortcut(ctx context.Context, req *connect.Request[v1pb.GetShortcutRequest]) (*connect.Response[v1pb.Shortcut], error) { + resp, err := s.APIV1Service.GetShortcut(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) CreateShortcut(ctx context.Context, req *connect.Request[v1pb.CreateShortcutRequest]) (*connect.Response[v1pb.Shortcut], error) { + resp, err := s.APIV1Service.CreateShortcut(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) UpdateShortcut(ctx context.Context, req *connect.Request[v1pb.UpdateShortcutRequest]) (*connect.Response[v1pb.Shortcut], error) { + resp, err := s.APIV1Service.UpdateShortcut(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) DeleteShortcut(ctx context.Context, req *connect.Request[v1pb.DeleteShortcutRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIV1Service.DeleteShortcut(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +// ActivityService + +func (s *ConnectServiceHandler) ListActivities(ctx context.Context, req *connect.Request[v1pb.ListActivitiesRequest]) (*connect.Response[v1pb.ListActivitiesResponse], error) { + resp, err := s.APIV1Service.ListActivities(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) GetActivity(ctx context.Context, req *connect.Request[v1pb.GetActivityRequest]) (*connect.Response[v1pb.Activity], error) { + resp, err := s.APIV1Service.GetActivity(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +// IdentityProviderService + +func (s *ConnectServiceHandler) ListIdentityProviders(ctx context.Context, req *connect.Request[v1pb.ListIdentityProvidersRequest]) (*connect.Response[v1pb.ListIdentityProvidersResponse], error) { + resp, err := s.APIV1Service.ListIdentityProviders(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) GetIdentityProvider(ctx context.Context, req *connect.Request[v1pb.GetIdentityProviderRequest]) (*connect.Response[v1pb.IdentityProvider], error) { + resp, err := s.APIV1Service.GetIdentityProvider(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) CreateIdentityProvider(ctx context.Context, req *connect.Request[v1pb.CreateIdentityProviderRequest]) (*connect.Response[v1pb.IdentityProvider], error) { + resp, err := s.APIV1Service.CreateIdentityProvider(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) UpdateIdentityProvider(ctx context.Context, req *connect.Request[v1pb.UpdateIdentityProviderRequest]) (*connect.Response[v1pb.IdentityProvider], error) { + resp, err := s.APIV1Service.UpdateIdentityProvider(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} + +func (s *ConnectServiceHandler) DeleteIdentityProvider(ctx context.Context, req *connect.Request[v1pb.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIV1Service.DeleteIdentityProvider(ctx, req.Msg) + if err != nil { + return nil, convertGRPCError(err) + } + return connect.NewResponse(resp), nil +} diff --git a/server/router/api/v1/test/test_helper.go b/server/router/api/v1/test/test_helper.go index 63883e4f7..e14fab738 100644 --- a/server/router/api/v1/test/test_helper.go +++ b/server/router/api/v1/test/test_helper.go @@ -6,6 +6,7 @@ import ( "github.com/usememos/memos/internal/profile" "github.com/usememos/memos/plugin/markdown" + "github.com/usememos/memos/server/auth" apiv1 "github.com/usememos/memos/server/router/api/v1" "github.com/usememos/memos/store" teststore "github.com/usememos/memos/store/test" @@ -81,6 +82,6 @@ func (ts *TestService) CreateRegularUser(ctx context.Context, username string) ( // CreateUserContext creates a context with the given user's ID for authentication. func (*TestService) CreateUserContext(ctx context.Context, userID int32) context.Context { - // Use the real context key from the parent package - return context.WithValue(ctx, apiv1.UserIDContextKey, userID) + // Use the context key from the auth package + return context.WithValue(ctx, auth.UserIDContextKey, userID) } diff --git a/server/router/api/v1/user_service.go b/server/router/api/v1/user_service.go index 0e71bfa29..349f4b957 100644 --- a/server/router/api/v1/user_service.go +++ b/server/router/api/v1/user_service.go @@ -27,6 +27,7 @@ import ( "github.com/usememos/memos/internal/util" v1pb "github.com/usememos/memos/proto/gen/api/v1" storepb "github.com/usememos/memos/proto/gen/store" + "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" ) @@ -536,7 +537,7 @@ func (s *APIV1Service) ListUserAccessTokens(ctx context.Context, request *v1pb.L accessTokens := []*v1pb.UserAccessToken{} for _, userAccessToken := range userAccessTokens { - claims := &ClaimsMessage{} + claims := &auth.ClaimsMessage{} _, err := jwt.ParseWithClaims(userAccessToken.AccessToken, claims, func(t *jwt.Token) (any, error) { if t.Method.Alg() != jwt.SigningMethodHS256.Name { return nil, errors.Errorf("unexpected access token signing method=%v, expect %v", t.Header["alg"], jwt.SigningMethodHS256) @@ -616,12 +617,12 @@ func (s *APIV1Service) CreateUserAccessToken(ctx context.Context, request *v1pb. expiresAt = request.AccessToken.ExpiresAt.AsTime() } - accessToken, err := GenerateAccessToken(currentUser.Username, currentUser.ID, expiresAt, []byte(s.Secret)) + accessToken, err := auth.GenerateAccessToken(currentUser.Username, currentUser.ID, expiresAt, []byte(s.Secret)) if err != nil { return nil, status.Errorf(codes.Internal, "failed to generate access token: %v", err) } - claims := &ClaimsMessage{} + claims := &auth.ClaimsMessage{} _, err = jwt.ParseWithClaims(accessToken, claims, func(t *jwt.Token) (any, error) { if t.Method.Alg() != jwt.SigningMethodHS256.Name { return nil, errors.Errorf("unexpected access token signing method=%v, expect %v", t.Header["alg"], jwt.SigningMethodHS256) diff --git a/server/router/api/v1/v1.go b/server/router/api/v1/v1.go index f64594e16..22442aace 100644 --- a/server/router/api/v1/v1.go +++ b/server/router/api/v1/v1.go @@ -4,9 +4,10 @@ import ( "context" "fmt" "math" + "net/http" + "connectrpc.com/connect" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/improbable-eng/grpc-web/go/grpcweb" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" "golang.org/x/sync/semaphore" @@ -123,15 +124,28 @@ func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Ech gwGroup.Any("/api/v1/*", handler) gwGroup.Any("/file/*", handler) - // GRPC web proxy. - options := []grpcweb.Option{ - grpcweb.WithCorsForRegisteredEndpointsOnly(false), - grpcweb.WithOriginFunc(func(_ string) bool { - return true - }), - } - wrappedGrpc := grpcweb.WrapServer(s.grpcServer, options...) - echoServer.Any("/memos.api.v1.*", echo.WrapHandler(wrappedGrpc)) + // Connect handlers for browser clients (replaces grpc-web). + logStacktraces := s.Profile.IsDev() + connectInterceptors := connect.WithInterceptors( + NewLoggingInterceptor(logStacktraces), + NewRecoveryInterceptor(logStacktraces), + NewAuthInterceptor(s.Store, s.Secret), + ) + connectMux := http.NewServeMux() + connectHandler := NewConnectServiceHandler(s) + connectHandler.RegisterConnectHandlers(connectMux, connectInterceptors) + + // Wrap with CORS for browser access + corsHandler := middleware.CORSWithConfig(middleware.CORSConfig{ + AllowOriginFunc: func(_ string) (bool, error) { + return true, nil + }, + AllowMethods: []string{http.MethodGet, http.MethodPost, http.MethodOptions}, + AllowHeaders: []string{"*"}, + AllowCredentials: true, + }) + connectGroup := echoServer.Group("", corsHandler) + connectGroup.Any("/memos.api.v1.*", echo.WrapHandler(connectMux)) return nil } diff --git a/server/router/fileserver/fileserver.go b/server/router/fileserver/fileserver.go index 9295628d5..177754783 100644 --- a/server/router/fileserver/fileserver.go +++ b/server/router/fileserver/fileserver.go @@ -14,7 +14,6 @@ import ( "time" "github.com/disintegration/imaging" - "github.com/golang-jwt/jwt/v5" "github.com/labstack/echo/v4" "github.com/pkg/errors" "golang.org/x/sync/semaphore" @@ -23,7 +22,7 @@ import ( "github.com/usememos/memos/internal/util" "github.com/usememos/memos/plugin/storage/s3" storepb "github.com/usememos/memos/proto/gen/store" - apiv1 "github.com/usememos/memos/server/router/api/v1" + "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" ) @@ -43,9 +42,9 @@ var SupportedThumbnailMimeTypes = []string{ // This service bypasses gRPC-Gateway to use native HTTP serving via http.ServeContent(), // which is required for Safari video/audio playback. type FileServerService struct { - Profile *profile.Profile - Store *store.Store - Secret string + Profile *profile.Profile + Store *store.Store + authenticator *auth.Authenticator // thumbnailSemaphore limits concurrent thumbnail generation to prevent memory exhaustion thumbnailSemaphore *semaphore.Weighted @@ -56,7 +55,7 @@ func NewFileServerService(profile *profile.Profile, store *store.Store, secret s return &FileServerService{ Profile: profile, Store: store, - Secret: secret, + authenticator: auth.NewAuthenticator(store, secret), thumbnailSemaphore: semaphore.NewWeighted(3), // Limit to 3 concurrent thumbnail generations } } @@ -249,10 +248,11 @@ func (s *FileServerService) checkAttachmentPermission(ctx context.Context, c ech // getCurrentUser retrieves the current authenticated user from the Echo context. // It checks both session cookies and Bearer tokens for authentication. +// Uses the shared Authenticator for consistent authentication logic. func (s *FileServerService) getCurrentUser(ctx context.Context, c echo.Context) (*store.User, error) { // Try session cookie authentication first - if cookie, err := c.Cookie(apiv1.SessionCookieName); err == nil && cookie.Value != "" { - user, err := s.authenticateBySession(ctx, cookie.Value) + if cookie, err := c.Cookie(auth.SessionCookieName); err == nil && cookie.Value != "" { + user, err := s.authenticator.AuthenticateBySession(ctx, cookie.Value) if err == nil && user != nil { return user, nil } @@ -262,8 +262,8 @@ func (s *FileServerService) getCurrentUser(ctx context.Context, c echo.Context) authHeader := c.Request().Header.Get("Authorization") if authHeader != "" { parts := strings.Fields(authHeader) - if len(parts) == 2 && strings.ToLower(parts[0]) == "bearer" { - user, err := s.authenticateByJWT(ctx, parts[1]) + if len(parts) == 2 && strings.EqualFold(parts[0], "bearer") { + user, err := s.authenticator.AuthenticateByJWT(ctx, parts[1]) if err == nil && user != nil { return user, nil } @@ -274,139 +274,6 @@ func (s *FileServerService) getCurrentUser(ctx context.Context, c echo.Context) return nil, nil } -// authenticateBySession authenticates a user using session ID from cookie. -func (s *FileServerService) authenticateBySession(ctx context.Context, sessionCookieValue string) (*store.User, error) { - if sessionCookieValue == "" { - return nil, errors.New("session cookie value not found") - } - - // Parse the cookie value to extract userID and sessionID - userID, sessionID, err := s.parseSessionCookieValue(sessionCookieValue) - if err != nil { - return nil, errors.Wrap(err, "invalid session cookie format") - } - - // Get the user - user, err := s.Store.GetUser(ctx, &store.FindUser{ - ID: &userID, - }) - if err != nil { - return nil, errors.Wrap(err, "failed to get user") - } - if user == nil { - return nil, errors.New("user not found") - } - if user.RowStatus == store.Archived { - return nil, errors.New("user is archived") - } - - // Get user sessions and validate the sessionID - sessions, err := s.Store.GetUserSessions(ctx, user.ID) - if err != nil { - return nil, errors.Wrap(err, "failed to get user sessions") - } - - if !s.validateUserSession(sessionID, sessions) { - return nil, errors.New("invalid or expired session") - } - - return user, nil -} - -// authenticateByJWT authenticates a user using JWT access token from Authorization header. -func (s *FileServerService) authenticateByJWT(ctx context.Context, accessToken string) (*store.User, error) { - if accessToken == "" { - return nil, errors.New("access token not found") - } - - claims := &apiv1.ClaimsMessage{} - _, err := jwt.ParseWithClaims(accessToken, claims, func(t *jwt.Token) (any, error) { - if t.Method.Alg() != jwt.SigningMethodHS256.Name { - return nil, errors.Errorf("unexpected access token signing method=%v, expect %v", t.Header["alg"], jwt.SigningMethodHS256) - } - if kid, ok := t.Header["kid"].(string); ok { - if kid == apiv1.KeyID { - return []byte(s.Secret), nil - } - } - return nil, errors.Errorf("unexpected access token kid=%v", t.Header["kid"]) - }) - if err != nil { - return nil, errors.Wrap(err, "Invalid or expired access token") - } - - // Get user from JWT claims - userID, err := util.ConvertStringToInt32(claims.Subject) - if err != nil { - return nil, errors.Wrap(err, "malformed ID in the token") - } - user, err := s.Store.GetUser(ctx, &store.FindUser{ - ID: &userID, - }) - if err != nil { - return nil, errors.Wrap(err, "failed to get user") - } - if user == nil { - return nil, errors.Errorf("user %q not exists", userID) - } - if user.RowStatus == store.Archived { - return nil, errors.Errorf("user %q is archived", userID) - } - - // Validate that this access token exists in the user's access tokens - accessTokens, err := s.Store.GetUserAccessTokens(ctx, user.ID) - if err != nil { - return nil, errors.Wrapf(err, "failed to get user access tokens") - } - if !s.validateAccessToken(accessToken, accessTokens) { - return nil, errors.New("invalid access token") - } - - return user, nil -} - -// parseSessionCookieValue parses the session cookie value to extract userID and sessionID. -func (*FileServerService) parseSessionCookieValue(cookieValue string) (int32, string, error) { - parts := strings.SplitN(cookieValue, "-", 2) - if len(parts) != 2 { - return 0, "", errors.New("invalid session cookie format") - } - - userID, err := util.ConvertStringToInt32(parts[0]) - if err != nil { - return 0, "", errors.Errorf("invalid user ID in session cookie: %v", err) - } - - return userID, parts[1], nil -} - -// validateUserSession checks if a session exists and is still valid using sliding expiration. -func (*FileServerService) validateUserSession(sessionID string, userSessions []*storepb.SessionsUserSetting_Session) bool { - for _, session := range userSessions { - if sessionID == session.SessionId { - // Use sliding expiration: check if last_accessed_time + 14 days > current_time - if session.LastAccessedTime != nil { - expirationTime := session.LastAccessedTime.AsTime().Add(apiv1.SessionSlidingDuration) - if expirationTime.Before(time.Now()) { - return false - } - } - return true - } - } - return false -} - -// validateAccessToken checks if the provided JWT token exists in the user's access tokens list. -func (*FileServerService) validateAccessToken(accessTokenString string, userAccessTokens []*storepb.AccessTokensUserSetting_AccessToken) bool { - for _, userAccessToken := range userAccessTokens { - if accessTokenString == userAccessToken.AccessToken { - return true - } - } - return false -} - // isImageType checks if the mime type is an image that supports thumbnails. func (*FileServerService) isImageType(mimeType string) bool { return mimeType == "image/png" || mimeType == "image/jpeg" diff --git a/web/package.json b/web/package.json index d2cd1ba82..02eb3028b 100644 --- a/web/package.json +++ b/web/package.json @@ -10,6 +10,8 @@ "format": "biome format --write src" }, "dependencies": { + "@connectrpc/connect": "^2.1.1", + "@connectrpc/connect-web": "^2.1.1", "@dnd-kit/core": "^6.3.1", "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", @@ -84,7 +86,6 @@ "@types/uuid": "^10.0.0", "@vitejs/plugin-react": "^4.7.0", "long": "^5.3.2", - "nice-grpc-web": "^3.3.9", "terser": "^5.44.1", "tw-animate-css": "^1.4.0", "typescript": "^5.9.3", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index ba48132b8..be03d3f35 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -8,6 +8,12 @@ importers: .: dependencies: + '@connectrpc/connect': + specifier: ^2.1.1 + version: 2.1.1(@bufbuild/protobuf@2.10.1) + '@connectrpc/connect-web': + specifier: ^2.1.1 + version: 2.1.1(@bufbuild/protobuf@2.10.1)(@connectrpc/connect@2.1.1(@bufbuild/protobuf@2.10.1)) '@dnd-kit/core': specifier: ^6.3.1 version: 6.3.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -225,9 +231,6 @@ importers: long: specifier: ^5.3.2 version: 5.3.2 - nice-grpc-web: - specifier: ^3.3.9 - version: 3.3.9(ws@8.18.3) terser: specifier: ^5.44.1 version: 5.44.1 @@ -410,6 +413,17 @@ packages: '@chevrotain/utils@11.0.3': resolution: {integrity: sha512-YslZMgtJUyuMbZ+aKvfF3x1f5liK4mWNxghFRv7jqRR9C3R3fAOGTTKvxXDa2Y1s9zSbcpuO0cAxDYsc9SrXoQ==} + '@connectrpc/connect-web@2.1.1': + resolution: {integrity: sha512-J8317Q2MaFRCT1jzVR1o06bZhDIBmU0UAzWx6xOIXzOq8+k71/+k7MUF7AwcBUX+34WIvbm5syRgC5HXQA8fOg==} + peerDependencies: + '@bufbuild/protobuf': ^2.7.0 + '@connectrpc/connect': 2.1.1 + + '@connectrpc/connect@2.1.1': + resolution: {integrity: sha512-JzhkaTvM73m2K1URT6tv53k2RwngSmCXLZJgK580qNQOXRzZRR/BCMfZw3h+90JpnG6XksP5bYT+cz0rpUzUWQ==} + peerDependencies: + '@bufbuild/protobuf': ^2.7.0 + '@dnd-kit/accessibility@3.1.1': resolution: {integrity: sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw==} peerDependencies: @@ -1519,9 +1533,6 @@ packages: '@xobotyi/scrollbar-width@1.9.5': resolution: {integrity: sha512-N8tkAACJx2ww8vFMneJmaAgmjAG1tnVBZJRLRcx061tmsLRZHSEZSLuGWnwPtunsSLvSqXQ2wfp7Mgqg1I+2dQ==} - abort-controller-x@0.4.3: - resolution: {integrity: sha512-VtUwTNU8fpMwvWGn4xE93ywbogTYsuT+AUxAXOeelbXuQVIwNmC5YLeho9sH4vZ4ITW8414TTAOG1nW6uIVHCA==} - accessor-fn@1.5.3: resolution: {integrity: sha512-rkAofCwe/FvYFUlMB0v0gWmhqtfAtV1IUkdPbfhTUyYniu5LrC0A0UJkTH0Jv3S8SvwkmfuAlY+mQIJATdocMA==} engines: {node: '>=12'} @@ -2077,11 +2088,6 @@ packages: resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==} engines: {node: '>=12'} - isomorphic-ws@5.0.0: - resolution: {integrity: sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==} - peerDependencies: - ws: '*' - jerrypick@1.1.2: resolution: {integrity: sha512-YKnxXEekXKzhpf7CLYA0A+oDP8V0OhICNCr5lv96FvSsDEmrb0GKM776JgQvHTMjr7DTTPEVv/1Ciaw0uEWzBA==} engines: {node: '>=12'} @@ -2090,9 +2096,6 @@ packages: resolution: {integrity: sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==} hasBin: true - js-base64@3.7.8: - resolution: {integrity: sha512-hNngCeKxIUQiEUN3GPJOkz4wF/YvdUdbNL9hsBcMQTkKzboD7T/q3OYOuuPZLUE6dBxSGpwhk5mwuDud7JVAow==} - js-cookie@2.2.1: resolution: {integrity: sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==} @@ -2430,12 +2433,6 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - nice-grpc-common@2.0.2: - resolution: {integrity: sha512-7RNWbls5kAL1QVUOXvBsv1uO0wPQK3lHv+cY1gwkTzirnG1Nop4cBJZubpgziNbaVc/bl9QJcyvsf/NQxa3rjQ==} - - nice-grpc-web@3.3.9: - resolution: {integrity: sha512-CiCQLdLTux9D4try8XlHW9tHIP/uLB+aciNKErDNLUM6kzhPFaVh8q+oTkoVGOjxOacEzlOwQRRjwQETAx5lVw==} - node-releases@2.0.27: resolution: {integrity: sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==} @@ -2819,9 +2816,6 @@ packages: ts-easing@0.2.0: resolution: {integrity: sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ==} - ts-error@1.0.6: - resolution: {integrity: sha512-tLJxacIQUM82IR7JO1UUkKlYuUTmoY9HBJAmNWFzheSlDS5SPMcNIepejHJa4BpPQLAcbRhRf3GDJzyj6rbKvA==} - tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} @@ -2974,18 +2968,6 @@ packages: web-namespaces@2.0.1: resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==} - ws@8.18.3: - resolution: {integrity: sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - yallist@3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} @@ -3175,6 +3157,15 @@ snapshots: '@chevrotain/utils@11.0.3': {} + '@connectrpc/connect-web@2.1.1(@bufbuild/protobuf@2.10.1)(@connectrpc/connect@2.1.1(@bufbuild/protobuf@2.10.1))': + dependencies: + '@bufbuild/protobuf': 2.10.1 + '@connectrpc/connect': 2.1.1(@bufbuild/protobuf@2.10.1) + + '@connectrpc/connect@2.1.1(@bufbuild/protobuf@2.10.1)': + dependencies: + '@bufbuild/protobuf': 2.10.1 + '@dnd-kit/accessibility@3.1.1(react@18.3.1)': dependencies: react: 18.3.1 @@ -4221,8 +4212,6 @@ snapshots: '@xobotyi/scrollbar-width@1.9.5': {} - abort-controller-x@0.4.3: {} - accessor-fn@1.5.3: {} acorn@8.15.0: {} @@ -4857,16 +4846,10 @@ snapshots: is-plain-obj@4.1.0: {} - isomorphic-ws@5.0.0(ws@8.18.3): - dependencies: - ws: 8.18.3 - jerrypick@1.1.2: {} jiti@2.6.1: {} - js-base64@3.7.8: {} - js-cookie@2.2.1: {} js-tokens@4.0.0: {} @@ -5420,19 +5403,6 @@ snapshots: nanoid@3.3.11: {} - nice-grpc-common@2.0.2: - dependencies: - ts-error: 1.0.6 - - nice-grpc-web@3.3.9(ws@8.18.3): - dependencies: - abort-controller-x: 0.4.3 - isomorphic-ws: 5.0.0(ws@8.18.3) - js-base64: 3.7.8 - nice-grpc-common: 2.0.2 - transitivePeerDependencies: - - ws - node-releases@2.0.27: {} object-assign@4.1.1: {} @@ -5877,8 +5847,6 @@ snapshots: ts-easing@0.2.0: {} - ts-error@1.0.6: {} - tslib@2.8.1: {} tw-animate-css@1.4.0: {} @@ -6010,8 +5978,6 @@ snapshots: web-namespaces@2.0.1: {} - ws@8.18.3: {} - yallist@3.1.1: {} yaml@1.10.2: {} diff --git a/web/src/components/AttachmentIcon.tsx b/web/src/components/AttachmentIcon.tsx index 6cd20c5c4..3b8f8f29d 100644 --- a/web/src/components/AttachmentIcon.tsx +++ b/web/src/components/AttachmentIcon.tsx @@ -11,7 +11,7 @@ import { } from "lucide-react"; import React, { useState } from "react"; import { cn } from "@/lib/utils"; -import { Attachment } from "@/types/proto/api/v1/attachment_service"; +import { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; import { getAttachmentThumbnailUrl, getAttachmentType, getAttachmentUrl } from "@/utils/attachment"; import SquareDiv from "./kit/SquareDiv"; import PreviewImageDialog from "./PreviewImageDialog"; diff --git a/web/src/components/ChangeMemberPasswordDialog.tsx b/web/src/components/ChangeMemberPasswordDialog.tsx index 696da195b..70f57881c 100644 --- a/web/src/components/ChangeMemberPasswordDialog.tsx +++ b/web/src/components/ChangeMemberPasswordDialog.tsx @@ -5,7 +5,7 @@ import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from " import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { userStore } from "@/store"; -import { User } from "@/types/proto/api/v1/user_service"; +import { User } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { @@ -61,7 +61,7 @@ function ChangeMemberPasswordDialog({ open, onOpenChange, user, onSuccess }: Pro onOpenChange(false); } catch (error: any) { console.error(error); - toast.error(error.details); + toast.error(error.message); } }; diff --git a/web/src/components/CreateAccessTokenDialog.tsx b/web/src/components/CreateAccessTokenDialog.tsx index 8af13e509..505c3af15 100644 --- a/web/src/components/CreateAccessTokenDialog.tsx +++ b/web/src/components/CreateAccessTokenDialog.tsx @@ -1,3 +1,4 @@ +import { timestampFromDate } from "@bufbuild/protobuf/wkt"; import React, { useState } from "react"; import { toast } from "react-hot-toast"; import { Button } from "@/components/ui/button"; @@ -8,7 +9,7 @@ import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { userServiceClient } from "@/grpcweb"; import useCurrentUser from "@/hooks/useCurrentUser"; import useLoading from "@/hooks/useLoading"; -import { UserAccessToken } from "@/types/proto/api/v1/user_service"; +import { UserAccessToken } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { @@ -77,7 +78,7 @@ function CreateAccessTokenDialog({ open, onOpenChange, onSuccess }: Props) { parent: currentUser.name, accessToken: { description: state.description, - expiresAt: state.expiration ? new Date(Date.now() + state.expiration * 1000) : undefined, + expiresAt: state.expiration ? timestampFromDate(new Date(Date.now() + state.expiration * 1000)) : undefined, }, }); @@ -85,7 +86,7 @@ function CreateAccessTokenDialog({ open, onOpenChange, onSuccess }: Props) { onSuccess(created); onOpenChange(false); } catch (error: any) { - toast.error(error.details); + toast.error(error.message); console.error(error); requestState.setError(); } diff --git a/web/src/components/CreateIdentityProviderDialog.tsx b/web/src/components/CreateIdentityProviderDialog.tsx index da5b2a869..e914fd8c2 100644 --- a/web/src/components/CreateIdentityProviderDialog.tsx +++ b/web/src/components/CreateIdentityProviderDialog.tsx @@ -1,3 +1,5 @@ +import { create } from "@bufbuild/protobuf"; +import { FieldMaskSchema } from "@bufbuild/protobuf/wkt"; import { useEffect, useState } from "react"; import { toast } from "react-hot-toast"; import { Button } from "@/components/ui/button"; @@ -7,94 +9,115 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@ import { Separator } from "@/components/ui/separator"; import { identityProviderServiceClient } from "@/grpcweb"; import { absolutifyLink } from "@/helpers/utils"; -import { FieldMapping, IdentityProvider, IdentityProvider_Type, OAuth2Config } from "@/types/proto/api/v1/idp_service"; +import { + FieldMapping, + FieldMappingSchema, + IdentityProvider, + IdentityProvider_Type, + IdentityProviderConfigSchema, + IdentityProviderSchema, + OAuth2Config, + OAuth2ConfigSchema, +} from "@/types/proto/api/v1/idp_service_pb"; import { useTranslate } from "@/utils/i18n"; const templateList: IdentityProvider[] = [ - { + create(IdentityProviderSchema, { name: "", title: "GitHub", type: IdentityProvider_Type.OAUTH2, identifierFilter: "", - config: { - oauth2Config: { - clientId: "", - clientSecret: "", - authUrl: "https://github.com/login/oauth/authorize", - tokenUrl: "https://github.com/login/oauth/access_token", - userInfoUrl: "https://api.github.com/user", - scopes: ["read:user"], - fieldMapping: FieldMapping.fromPartial({ - identifier: "login", - displayName: "name", - email: "email", + config: create(IdentityProviderConfigSchema, { + config: { + case: "oauth2Config", + value: create(OAuth2ConfigSchema, { + clientId: "", + clientSecret: "", + authUrl: "https://github.com/login/oauth/authorize", + tokenUrl: "https://github.com/login/oauth/access_token", + userInfoUrl: "https://api.github.com/user", + scopes: ["read:user"], + fieldMapping: create(FieldMappingSchema, { + identifier: "login", + displayName: "name", + email: "email", + }), }), }, - }, - }, - { + }), + }), + create(IdentityProviderSchema, { name: "", title: "GitLab", type: IdentityProvider_Type.OAUTH2, identifierFilter: "", - config: { - oauth2Config: { - clientId: "", - clientSecret: "", - authUrl: "https://gitlab.com/oauth/authorize", - tokenUrl: "https://gitlab.com/oauth/token", - userInfoUrl: "https://gitlab.com/oauth/userinfo", - scopes: ["openid"], - fieldMapping: FieldMapping.fromPartial({ - identifier: "name", - displayName: "name", - email: "email", + config: create(IdentityProviderConfigSchema, { + config: { + case: "oauth2Config", + value: create(OAuth2ConfigSchema, { + clientId: "", + clientSecret: "", + authUrl: "https://gitlab.com/oauth/authorize", + tokenUrl: "https://gitlab.com/oauth/token", + userInfoUrl: "https://gitlab.com/oauth/userinfo", + scopes: ["openid"], + fieldMapping: create(FieldMappingSchema, { + identifier: "name", + displayName: "name", + email: "email", + }), }), }, - }, - }, - { + }), + }), + create(IdentityProviderSchema, { name: "", title: "Google", type: IdentityProvider_Type.OAUTH2, identifierFilter: "", - config: { - oauth2Config: { - clientId: "", - clientSecret: "", - authUrl: "https://accounts.google.com/o/oauth2/v2/auth", - tokenUrl: "https://oauth2.googleapis.com/token", - userInfoUrl: "https://www.googleapis.com/oauth2/v2/userinfo", - scopes: ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"], - fieldMapping: FieldMapping.fromPartial({ - identifier: "email", - displayName: "name", - email: "email", + config: create(IdentityProviderConfigSchema, { + config: { + case: "oauth2Config", + value: create(OAuth2ConfigSchema, { + clientId: "", + clientSecret: "", + authUrl: "https://accounts.google.com/o/oauth2/v2/auth", + tokenUrl: "https://oauth2.googleapis.com/token", + userInfoUrl: "https://www.googleapis.com/oauth2/v2/userinfo", + scopes: ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"], + fieldMapping: create(FieldMappingSchema, { + identifier: "email", + displayName: "name", + email: "email", + }), }), }, - }, - }, - { + }), + }), + create(IdentityProviderSchema, { name: "", title: "Custom", type: IdentityProvider_Type.OAUTH2, identifierFilter: "", - config: { - oauth2Config: { - clientId: "", - clientSecret: "", - authUrl: "", - tokenUrl: "", - userInfoUrl: "", - scopes: [], - fieldMapping: FieldMapping.fromPartial({ - identifier: "", - displayName: "", - email: "", + config: create(IdentityProviderConfigSchema, { + config: { + case: "oauth2Config", + value: create(OAuth2ConfigSchema, { + clientId: "", + clientSecret: "", + authUrl: "", + tokenUrl: "", + userInfoUrl: "", + scopes: [], + fieldMapping: create(FieldMappingSchema, { + identifier: "", + displayName: "", + email: "", + }), }), }, - }, - }, + }), + }), ]; interface Props { @@ -112,19 +135,21 @@ function CreateIdentityProviderDialog({ open, onOpenChange, identityProvider, on identifierFilter: "", }); const [type, setType] = useState(IdentityProvider_Type.OAUTH2); - const [oauth2Config, setOAuth2Config] = useState({ - clientId: "", - clientSecret: "", - authUrl: "", - tokenUrl: "", - userInfoUrl: "", - scopes: [], - fieldMapping: FieldMapping.fromPartial({ - identifier: "", - displayName: "", - email: "", + const [oauth2Config, setOAuth2Config] = useState( + create(OAuth2ConfigSchema, { + clientId: "", + clientSecret: "", + authUrl: "", + tokenUrl: "", + userInfoUrl: "", + scopes: [], + fieldMapping: create(FieldMappingSchema, { + identifier: "", + displayName: "", + email: "", + }), }), - }); + ); const [oauth2Scopes, setOAuth2Scopes] = useState(""); const [selectedTemplate, setSelectedTemplate] = useState("GitHub"); const isCreating = identityProvider === undefined; @@ -138,19 +163,21 @@ function CreateIdentityProviderDialog({ open, onOpenChange, identityProvider, on identifierFilter: "", }); setType(IdentityProvider_Type.OAUTH2); - setOAuth2Config({ - clientId: "", - clientSecret: "", - authUrl: "", - tokenUrl: "", - userInfoUrl: "", - scopes: [], - fieldMapping: FieldMapping.fromPartial({ - identifier: "", - displayName: "", - email: "", + setOAuth2Config( + create(OAuth2ConfigSchema, { + clientId: "", + clientSecret: "", + authUrl: "", + tokenUrl: "", + userInfoUrl: "", + scopes: [], + fieldMapping: create(FieldMappingSchema, { + identifier: "", + displayName: "", + email: "", + }), }), - }); + ); setOAuth2Scopes(""); setSelectedTemplate("GitHub"); } @@ -164,8 +191,8 @@ function CreateIdentityProviderDialog({ open, onOpenChange, identityProvider, on identifierFilter: identityProvider.identifierFilter, }); setType(identityProvider.type); - if (identityProvider.type === IdentityProvider_Type.OAUTH2) { - const oauth2Config = OAuth2Config.fromPartial(identityProvider.config?.oauth2Config || {}); + if (identityProvider.type === IdentityProvider_Type.OAUTH2 && identityProvider.config?.config?.case === "oauth2Config") { + const oauth2Config = create(OAuth2ConfigSchema, identityProvider.config.config.value || {}); setOAuth2Config(oauth2Config); setOAuth2Scopes(oauth2Config.scopes.join(" ")); } @@ -185,8 +212,8 @@ function CreateIdentityProviderDialog({ open, onOpenChange, identityProvider, on identifierFilter: template.identifierFilter, }); setType(template.type); - if (template.type === IdentityProvider_Type.OAUTH2) { - const oauth2Config = OAuth2Config.fromPartial(template.config?.oauth2Config || {}); + if (template.type === IdentityProvider_Type.OAUTH2 && template.config?.config?.case === "oauth2Config") { + const oauth2Config = create(OAuth2ConfigSchema, template.config.config.value || {}); setOAuth2Config(oauth2Config); setOAuth2Scopes(oauth2Config.scopes.join(" ")); } @@ -201,7 +228,7 @@ function CreateIdentityProviderDialog({ open, onOpenChange, identityProvider, on if (basicInfo.title === "") { return false; } - if (type === "OAUTH2") { + if (type === IdentityProvider_Type.OAUTH2) { if ( oauth2Config.clientId === "" || oauth2Config.authUrl === "" || @@ -226,37 +253,43 @@ function CreateIdentityProviderDialog({ open, onOpenChange, identityProvider, on try { if (isCreating) { await identityProviderServiceClient.createIdentityProvider({ - identityProvider: { + identityProvider: create(IdentityProviderSchema, { ...basicInfo, type: type, - config: { - oauth2Config: { - ...oauth2Config, - scopes: oauth2Scopes.split(" "), + config: create(IdentityProviderConfigSchema, { + config: { + case: "oauth2Config", + value: { + ...oauth2Config, + scopes: oauth2Scopes.split(" "), + }, }, - }, - }, + }), + }), }); toast.success(t("setting.sso-section.sso-created", { name: basicInfo.title })); } else { await identityProviderServiceClient.updateIdentityProvider({ - identityProvider: { + identityProvider: create(IdentityProviderSchema, { ...basicInfo, name: identityProvider!.name, type: type, - config: { - oauth2Config: { - ...oauth2Config, - scopes: oauth2Scopes.split(" "), + config: create(IdentityProviderConfigSchema, { + config: { + case: "oauth2Config", + value: { + ...oauth2Config, + scopes: oauth2Scopes.split(" "), + }, }, - }, - }, - updateMask: ["title", "identifier_filter", "config"], + }), + }), + updateMask: create(FieldMaskSchema, { paths: ["title", "identifier_filter", "config"] }), }); toast.success(t("setting.sso-section.sso-updated", { name: basicInfo.title })); } } catch (error: any) { - toast.error(error.details); + toast.error(error.message); console.error(error); } onSuccess?.(); @@ -336,7 +369,7 @@ function CreateIdentityProviderDialog({ open, onOpenChange, identityProvider, on } /> - {type === "OAUTH2" && ( + {type === IdentityProvider_Type.OAUTH2 && ( <> {isCreating && (

diff --git a/web/src/components/CreateShortcutDialog.tsx b/web/src/components/CreateShortcutDialog.tsx index 3d7d05651..fe650656e 100644 --- a/web/src/components/CreateShortcutDialog.tsx +++ b/web/src/components/CreateShortcutDialog.tsx @@ -1,3 +1,5 @@ +import { create } from "@bufbuild/protobuf"; +import { FieldMaskSchema } from "@bufbuild/protobuf/wkt"; import React, { useEffect, useState } from "react"; import { toast } from "react-hot-toast"; import { Button } from "@/components/ui/button"; @@ -9,7 +11,7 @@ import { shortcutServiceClient } from "@/grpcweb"; import useCurrentUser from "@/hooks/useCurrentUser"; import useLoading from "@/hooks/useLoading"; import { userStore } from "@/store"; -import { Shortcut } from "@/types/proto/api/v1/shortcut_service"; +import { Shortcut, ShortcutSchema } from "@/types/proto/api/v1/shortcut_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { @@ -22,23 +24,27 @@ interface Props { function CreateShortcutDialog({ open, onOpenChange, shortcut: initialShortcut, onSuccess }: Props) { const t = useTranslate(); const user = useCurrentUser(); - const [shortcut, setShortcut] = useState({ - name: initialShortcut?.name || "", - title: initialShortcut?.title || "", - filter: initialShortcut?.filter || "", - }); + const [shortcut, setShortcut] = useState( + create(ShortcutSchema, { + name: initialShortcut?.name || "", + title: initialShortcut?.title || "", + filter: initialShortcut?.filter || "", + }), + ); const requestState = useLoading(false); const isCreating = !initialShortcut; useEffect(() => { if (initialShortcut) { - setShortcut({ - name: initialShortcut.name, - title: initialShortcut.title, - filter: initialShortcut.filter, - }); + setShortcut( + create(ShortcutSchema, { + name: initialShortcut.name, + title: initialShortcut.title, + filter: initialShortcut.filter, + }), + ); } else { - setShortcut({ name: "", title: "", filter: "" }); + setShortcut(create(ShortcutSchema, { name: "", title: "", filter: "" })); } }, [initialShortcut]); @@ -74,7 +80,7 @@ function CreateShortcutDialog({ open, onOpenChange, shortcut: initialShortcut, o ...shortcut, name: initialShortcut!.name, // Keep the original resource name }, - updateMask: ["title", "filter"], + updateMask: create(FieldMaskSchema, { paths: ["title", "filter"] }), }); toast.success("Update shortcut successfully"); } @@ -85,7 +91,7 @@ function CreateShortcutDialog({ open, onOpenChange, shortcut: initialShortcut, o onOpenChange(false); } catch (error: any) { console.error(error); - toast.error(error.details); + toast.error(error.message); requestState.setError(); } }; diff --git a/web/src/components/CreateUserDialog.tsx b/web/src/components/CreateUserDialog.tsx index b99cdf5c9..960dd9d61 100644 --- a/web/src/components/CreateUserDialog.tsx +++ b/web/src/components/CreateUserDialog.tsx @@ -1,3 +1,5 @@ +import { create } from "@bufbuild/protobuf"; +import { FieldMaskSchema } from "@bufbuild/protobuf/wkt"; import { useEffect, useState } from "react"; import { toast } from "react-hot-toast"; import { Button } from "@/components/ui/button"; @@ -7,7 +9,7 @@ import { Label } from "@/components/ui/label"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { userServiceClient } from "@/grpcweb"; import useLoading from "@/hooks/useLoading"; -import { User, User_Role } from "@/types/proto/api/v1/user_service"; +import { User, User_Role, UserSchema } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { @@ -19,15 +21,15 @@ interface Props { function CreateUserDialog({ open, onOpenChange, user: initialUser, onSuccess }: Props) { const t = useTranslate(); - const [user, setUser] = useState(User.fromPartial({ ...initialUser })); + const [user, setUser] = useState(create(UserSchema, initialUser ? { username: initialUser.username, role: initialUser.role } : {})); const requestState = useLoading(false); const isCreating = !initialUser; useEffect(() => { if (initialUser) { - setUser(User.fromPartial(initialUser)); + setUser(create(UserSchema, { username: initialUser.username, role: initialUser.role })); } else { - setUser(User.fromPartial({})); + setUser(create(UserSchema, {})); } }, [initialUser]); @@ -60,7 +62,7 @@ function CreateUserDialog({ open, onOpenChange, user: initialUser, onSuccess }: if (user.role !== initialUser?.role) { updateMask.push("role"); } - await userServiceClient.updateUser({ user, updateMask }); + await userServiceClient.updateUser({ user, updateMask: create(FieldMaskSchema, { paths: updateMask }) }); toast.success("Update user successfully"); } requestState.setFinish(); @@ -68,7 +70,7 @@ function CreateUserDialog({ open, onOpenChange, user: initialUser, onSuccess }: onOpenChange(false); } catch (error: any) { console.error(error); - toast.error(error.details); + toast.error(error.message); requestState.setError(); } }; @@ -112,16 +114,16 @@ function CreateUserDialog({ open, onOpenChange, user: initialUser, onSuccess }:

setPartialUser({ role: value as User_Role })} + value={String(user.role)} + onValueChange={(value) => setPartialUser({ role: Number(value) as User_Role })} className="flex flex-row gap-4" >
- +
- +
diff --git a/web/src/components/CreateWebhookDialog.tsx b/web/src/components/CreateWebhookDialog.tsx index caa66af37..b5a1e7556 100644 --- a/web/src/components/CreateWebhookDialog.tsx +++ b/web/src/components/CreateWebhookDialog.tsx @@ -1,3 +1,5 @@ +import { create } from "@bufbuild/protobuf"; +import { FieldMaskSchema } from "@bufbuild/protobuf/wkt"; import React, { useEffect, useState } from "react"; import { toast } from "react-hot-toast"; import { Button } from "@/components/ui/button"; @@ -98,7 +100,7 @@ function CreateWebhookDialog({ open, onOpenChange, webhookName, onSuccess }: Pro displayName: state.displayName, url: state.url, }, - updateMask: ["display_name", "url"], + updateMask: create(FieldMaskSchema, { paths: ["display_name", "url"] }), }); } @@ -107,7 +109,7 @@ function CreateWebhookDialog({ open, onOpenChange, webhookName, onSuccess }: Pro requestState.setFinish(); } catch (error: any) { console.error(error); - toast.error(error.details); + toast.error(error.message); requestState.setError(); } }; diff --git a/web/src/components/Inbox/MemoCommentMessage.tsx b/web/src/components/Inbox/MemoCommentMessage.tsx index 187fe88a5..4861ea8c4 100644 --- a/web/src/components/Inbox/MemoCommentMessage.tsx +++ b/web/src/components/Inbox/MemoCommentMessage.tsx @@ -1,3 +1,4 @@ +import { timestampDate } from "@bufbuild/protobuf/wkt"; import { CheckIcon, MessageCircleIcon, TrashIcon, XIcon } from "lucide-react"; import { observer } from "mobx-react-lite"; import { useState } from "react"; @@ -9,8 +10,8 @@ import useNavigateTo from "@/hooks/useNavigateTo"; import { cn } from "@/lib/utils"; import { memoStore, userStore } from "@/store"; import { activityNamePrefix } from "@/store/common"; -import { Memo } from "@/types/proto/api/v1/memo_service"; -import { User, UserNotification, UserNotification_Status } from "@/types/proto/api/v1/user_service"; +import { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import { User, UserNotification, UserNotification_Status } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { @@ -36,8 +37,8 @@ const MemoCommentMessage = observer(({ notification }: Props) => { name: `${activityNamePrefix}${notification.activityId}`, }); - if (activity.payload?.memoComment) { - const memoCommentPayload = activity.payload.memoComment; + if (activity.payload?.payload?.case === "memoComment") { + const memoCommentPayload = activity.payload.payload.value; const memo = await memoStore.getOrFetchMemoByName(memoCommentPayload.relatedMemo, { skipStore: true, }); @@ -160,8 +161,11 @@ const MemoCommentMessage = observer(({ notification }: Props) => { {sender?.displayName || sender?.username} commented on your memo - {notification.createTime?.toLocaleDateString([], { month: "short", day: "numeric" })} at{" "} - {notification.createTime?.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })} + {notification.createTime && + timestampDate(notification.createTime)?.toLocaleDateString([], { month: "short", day: "numeric" })}{" "} + at{" "} + {notification.createTime && + timestampDate(notification.createTime)?.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}
diff --git a/web/src/components/MasonryView/distributeItems.ts b/web/src/components/MasonryView/distributeItems.ts index 0fb1c22e7..c8a1e9f85 100644 --- a/web/src/components/MasonryView/distributeItems.ts +++ b/web/src/components/MasonryView/distributeItems.ts @@ -1,4 +1,4 @@ -import { Memo } from "@/types/proto/api/v1/memo_service"; +import { Memo } from "@/types/proto/api/v1/memo_service_pb"; import { DistributionResult } from "./types"; export function distributeItemsToColumns( diff --git a/web/src/components/MasonryView/types.ts b/web/src/components/MasonryView/types.ts index 61eeee7b5..862ea4ddd 100644 --- a/web/src/components/MasonryView/types.ts +++ b/web/src/components/MasonryView/types.ts @@ -1,4 +1,4 @@ -import { Memo } from "@/types/proto/api/v1/memo_service"; +import { Memo } from "@/types/proto/api/v1/memo_service_pb"; export interface MemoRenderContext { compact: boolean; diff --git a/web/src/components/MasonryView/useMasonryLayout.ts b/web/src/components/MasonryView/useMasonryLayout.ts index 07faebdcc..b85443fcb 100644 --- a/web/src/components/MasonryView/useMasonryLayout.ts +++ b/web/src/components/MasonryView/useMasonryLayout.ts @@ -1,5 +1,5 @@ import { useCallback, useEffect, useRef, useState } from "react"; -import { Memo } from "@/types/proto/api/v1/memo_service"; +import { Memo } from "@/types/proto/api/v1/memo_service_pb"; import { MINIMUM_MEMO_VIEWPORT_WIDTH, REDISTRIBUTION_DEBOUNCE_MS } from "./constants"; import { distributeItemsToColumns } from "./distributeItems"; diff --git a/web/src/components/MemoActionMenu/MemoActionMenu.tsx b/web/src/components/MemoActionMenu/MemoActionMenu.tsx index 58d069135..361e0a106 100644 --- a/web/src/components/MemoActionMenu/MemoActionMenu.tsx +++ b/web/src/components/MemoActionMenu/MemoActionMenu.tsx @@ -24,7 +24,7 @@ import { DropdownMenuSubTrigger, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; -import { State } from "@/types/proto/api/v1/common"; +import { State } from "@/types/proto/api/v1/common_pb"; import { useTranslate } from "@/utils/i18n"; import { hasCompletedTasks } from "@/utils/markdown-manipulation"; import { useMemoActionHandlers } from "./hooks"; diff --git a/web/src/components/MemoActionMenu/hooks.ts b/web/src/components/MemoActionMenu/hooks.ts index b637adc69..3f92da8f4 100644 --- a/web/src/components/MemoActionMenu/hooks.ts +++ b/web/src/components/MemoActionMenu/hooks.ts @@ -4,8 +4,8 @@ import toast from "react-hot-toast"; import { useLocation } from "react-router-dom"; import useNavigateTo from "@/hooks/useNavigateTo"; import { instanceStore, memoStore, userStore } from "@/store"; -import { State } from "@/types/proto/api/v1/common"; -import type { Memo } from "@/types/proto/api/v1/memo_service"; +import { State } from "@/types/proto/api/v1/common_pb"; +import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import { removeCompletedTasks } from "@/utils/markdown-manipulation"; diff --git a/web/src/components/MemoActionMenu/types.ts b/web/src/components/MemoActionMenu/types.ts index bca4d8794..9133f95ea 100644 --- a/web/src/components/MemoActionMenu/types.ts +++ b/web/src/components/MemoActionMenu/types.ts @@ -1,4 +1,4 @@ -import type { Memo } from "@/types/proto/api/v1/memo_service"; +import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; export interface MemoActionMenuProps { memo: Memo; diff --git a/web/src/components/MemoAttachment.tsx b/web/src/components/MemoAttachment.tsx index 2c6e318b5..7f33ce69b 100644 --- a/web/src/components/MemoAttachment.tsx +++ b/web/src/components/MemoAttachment.tsx @@ -1,4 +1,4 @@ -import { Attachment } from "@/types/proto/api/v1/attachment_service"; +import { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; import { getAttachmentUrl, isMidiFile } from "@/utils/attachment"; import AttachmentIcon from "./AttachmentIcon"; diff --git a/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx b/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx index 53f8accbc..6605e82e2 100644 --- a/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx +++ b/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx @@ -1,7 +1,8 @@ +import { create } from "@bufbuild/protobuf"; import { isEqual } from "lodash-es"; import { CheckCircleIcon, Code2Icon, HashIcon, LinkIcon } from "lucide-react"; import { cn } from "@/lib/utils"; -import { Memo, Memo_Property, MemoRelation_Type } from "@/types/proto/api/v1/memo_service"; +import { Memo, Memo_Property, Memo_PropertySchema, MemoRelation_Type } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import MemoRelationForceGraph from "../MemoRelationForceGraph"; @@ -13,7 +14,7 @@ interface Props { const MemoDetailSidebar = ({ memo, className, parentPage }: Props) => { const t = useTranslate(); - const property = Memo_Property.fromPartial(memo.property || {}); + const property = create(Memo_PropertySchema, memo.property || {}); const hasSpecialProperty = property.hasLink || property.hasTaskList || property.hasCode || property.hasIncompleteTasks; const shouldShowRelationGraph = memo.relations.filter((r) => r.type === MemoRelation_Type.REFERENCE).length > 0; diff --git a/web/src/components/MemoDetailSidebar/MemoDetailSidebarDrawer.tsx b/web/src/components/MemoDetailSidebar/MemoDetailSidebarDrawer.tsx index 4f22b3bff..3ffc92ed1 100644 --- a/web/src/components/MemoDetailSidebar/MemoDetailSidebarDrawer.tsx +++ b/web/src/components/MemoDetailSidebar/MemoDetailSidebarDrawer.tsx @@ -3,7 +3,7 @@ import { useEffect, useState } from "react"; import { useLocation } from "react-router-dom"; import { Button } from "@/components/ui/button"; import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet"; -import { Memo } from "@/types/proto/api/v1/memo_service"; +import { Memo } from "@/types/proto/api/v1/memo_service_pb"; import MemoDetailSidebar from "./MemoDetailSidebar"; interface Props { diff --git a/web/src/components/MemoEditor/Toolbar/InsertMenu.tsx b/web/src/components/MemoEditor/Toolbar/InsertMenu.tsx index 3c51a04c5..d960e999f 100644 --- a/web/src/components/MemoEditor/Toolbar/InsertMenu.tsx +++ b/web/src/components/MemoEditor/Toolbar/InsertMenu.tsx @@ -14,7 +14,7 @@ import { DropdownMenuSubTrigger, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; -import type { Location, MemoRelation } from "@/types/proto/api/v1/memo_service"; +import type { Location, MemoRelation } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import { LinkMemoDialog, LocationDialog } from "../components"; import { GEOCODING } from "../constants"; diff --git a/web/src/components/MemoEditor/Toolbar/VisibilitySelector.tsx b/web/src/components/MemoEditor/Toolbar/VisibilitySelector.tsx index 39419c06d..8f8262955 100644 --- a/web/src/components/MemoEditor/Toolbar/VisibilitySelector.tsx +++ b/web/src/components/MemoEditor/Toolbar/VisibilitySelector.tsx @@ -1,7 +1,7 @@ import { CheckIcon, ChevronDownIcon } from "lucide-react"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import VisibilityIcon from "@/components/VisibilityIcon"; -import { Visibility } from "@/types/proto/api/v1/memo_service"; +import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { diff --git a/web/src/components/MemoEditor/components/LinkMemoDialog.tsx b/web/src/components/MemoEditor/components/LinkMemoDialog.tsx index 5a53e5788..d0dc25118 100644 --- a/web/src/components/MemoEditor/components/LinkMemoDialog.tsx +++ b/web/src/components/MemoEditor/components/LinkMemoDialog.tsx @@ -1,6 +1,6 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; -import { Memo } from "@/types/proto/api/v1/memo_service"; +import { Memo } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; function highlightSearchText(content: string, searchText: string): React.ReactNode { diff --git a/web/src/components/MemoEditor/hooks/useLinkMemo.ts b/web/src/components/MemoEditor/hooks/useLinkMemo.ts index 9f641951b..1ea25924a 100644 --- a/web/src/components/MemoEditor/hooks/useLinkMemo.ts +++ b/web/src/components/MemoEditor/hooks/useLinkMemo.ts @@ -1,10 +1,18 @@ +import { create } from "@bufbuild/protobuf"; import { useState } from "react"; import useDebounce from "react-use/lib/useDebounce"; import { memoServiceClient } from "@/grpcweb"; import { DEFAULT_LIST_MEMOS_PAGE_SIZE } from "@/helpers/consts"; import useCurrentUser from "@/hooks/useCurrentUser"; import { extractUserIdFromName } from "@/store/common"; -import { Memo, MemoRelation, MemoRelation_Memo, MemoRelation_Type } from "@/types/proto/api/v1/memo_service"; +import { + Memo, + MemoRelation, + MemoRelation_Memo, + MemoRelation_MemoSchema, + MemoRelation_Type, + MemoRelationSchema, +} from "@/types/proto/api/v1/memo_service_pb"; interface UseLinkMemoParams { isOpen: boolean; @@ -49,9 +57,9 @@ export const useLinkMemo = ({ isOpen, currentMemoName, existingRelations, onAddR ); const addMemoRelation = (memo: Memo) => { - const relation = MemoRelation.fromPartial({ + const relation = create(MemoRelationSchema, { type: MemoRelation_Type.REFERENCE, - relatedMemo: MemoRelation_Memo.fromPartial({ + relatedMemo: create(MemoRelation_MemoSchema, { name: memo.name, snippet: memo.snippet, }), diff --git a/web/src/components/MemoEditor/hooks/useLocation.ts b/web/src/components/MemoEditor/hooks/useLocation.ts index 4b3a5858c..016088246 100644 --- a/web/src/components/MemoEditor/hooks/useLocation.ts +++ b/web/src/components/MemoEditor/hooks/useLocation.ts @@ -1,6 +1,7 @@ +import { create } from "@bufbuild/protobuf"; import { LatLng } from "leaflet"; import { useState } from "react"; -import { Location } from "@/types/proto/api/v1/memo_service"; +import { Location, LocationSchema } from "@/types/proto/api/v1/memo_service_pb"; import { LocationState } from "../types/insert-menu"; export const useLocation = (initialLocation?: Location) => { @@ -62,7 +63,7 @@ export const useLocation = (initialLocation?: Location) => { if (!state.position || !state.placeholder.trim()) { return undefined; } - return Location.fromPartial({ + return create(LocationSchema, { latitude: state.position.lat, longitude: state.position.lng, placeholder: state.placeholder, diff --git a/web/src/components/MemoEditor/hooks/useMemoEditorInit.ts b/web/src/components/MemoEditor/hooks/useMemoEditorInit.ts index 367297de1..209592138 100644 --- a/web/src/components/MemoEditor/hooks/useMemoEditorInit.ts +++ b/web/src/components/MemoEditor/hooks/useMemoEditorInit.ts @@ -1,9 +1,10 @@ +import { timestampDate } from "@bufbuild/protobuf/wkt"; import { useEffect, useState } from "react"; import useAsyncEffect from "@/hooks/useAsyncEffect"; import { instanceStore, memoStore, userStore } from "@/store"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service"; -import type { Location, MemoRelation } from "@/types/proto/api/v1/memo_service"; -import { Visibility } from "@/types/proto/api/v1/memo_service"; +import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Location, MemoRelation } from "@/types/proto/api/v1/memo_service_pb"; +import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; import { convertVisibilityFromString } from "@/utils/memo"; import type { EditorRefActions } from "../Editor"; @@ -68,7 +69,7 @@ export const useMemoEditorInit = (options: UseMemoEditorInitOptions): UseMemoEdi const parentMemo = await memoStore.getOrFetchMemoByName(parentMemoName); visibility = parentMemo.visibility; } - onVisibilityChange(convertVisibilityFromString(visibility)); + onVisibilityChange(visibility); }, [parentMemoName, userGeneralSetting?.memoVisibility, instanceMemoRelatedSetting.disallowPublicVisibility]); // Load existing memo if editing @@ -80,8 +81,8 @@ export const useMemoEditorInit = (options: UseMemoEditorInitOptions): UseMemoEdi const memo = await memoStore.getOrFetchMemoByName(memoName); if (memo) { onEditorFocus(); - setCreateTime(memo.createTime); - setUpdateTime(memo.updateTime); + setCreateTime(memo.createTime ? timestampDate(memo.createTime) : undefined); + setUpdateTime(memo.updateTime ? timestampDate(memo.updateTime) : undefined); onVisibilityChange(memo.visibility); onAttachmentsChange(memo.attachments); onRelationsChange(memo.relations); diff --git a/web/src/components/MemoEditor/hooks/useMemoEditorState.ts b/web/src/components/MemoEditor/hooks/useMemoEditorState.ts index 4c9335754..84d8a31e7 100644 --- a/web/src/components/MemoEditor/hooks/useMemoEditorState.ts +++ b/web/src/components/MemoEditor/hooks/useMemoEditorState.ts @@ -1,7 +1,7 @@ import { useCallback, useState } from "react"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service"; -import type { Location, MemoRelation } from "@/types/proto/api/v1/memo_service"; -import { Visibility } from "@/types/proto/api/v1/memo_service"; +import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Location, MemoRelation } from "@/types/proto/api/v1/memo_service_pb"; +import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; interface MemoEditorState { memoVisibility: Visibility; diff --git a/web/src/components/MemoEditor/hooks/useMemoSave.ts b/web/src/components/MemoEditor/hooks/useMemoSave.ts index b3b8ed8c1..b8b2ae358 100644 --- a/web/src/components/MemoEditor/hooks/useMemoSave.ts +++ b/web/src/components/MemoEditor/hooks/useMemoSave.ts @@ -1,11 +1,14 @@ +import { create } from "@bufbuild/protobuf"; +import { timestampDate, timestampFromDate } from "@bufbuild/protobuf/wkt"; import { isEqual } from "lodash-es"; import { useCallback } from "react"; import { toast } from "react-hot-toast"; import type { LocalFile } from "@/components/memo-metadata"; import { memoServiceClient } from "@/grpcweb"; import { attachmentStore, memoStore } from "@/store"; -import { Attachment } from "@/types/proto/api/v1/attachment_service"; -import type { Location, Memo, MemoRelation, Visibility } from "@/types/proto/api/v1/memo_service"; +import { Attachment, AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Location, Memo, MemoRelation, Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; import type { Translations } from "@/utils/i18n"; interface MemoSaveContext { @@ -37,15 +40,14 @@ async function uploadLocalFiles(localFiles: LocalFile[], onUploadingChange: (upl const attachments: Attachment[] = []; for (const { file } of localFiles) { const buffer = new Uint8Array(await file.arrayBuffer()); - const attachment = await attachmentStore.createAttachment({ - attachment: Attachment.fromPartial({ + const attachment = await attachmentStore.createAttachment( + create(AttachmentSchema, { filename: file.name, - size: file.size, + size: BigInt(file.size), type: file.type, content: buffer, }), - attachmentId: "", - }); + ); attachments.push(attachment); } return attachments; @@ -93,13 +95,13 @@ function buildUpdateMask( } // Handle custom timestamps - if (context.createTime && !isEqual(context.createTime, prevMemo.createTime)) { + if (context.createTime && !isEqual(context.createTime, prevMemo.createTime ? timestampDate(prevMemo.createTime) : undefined)) { mask.add("create_time"); - patch.createTime = context.createTime; + patch.createTime = timestampFromDate(context.createTime); } - if (context.updateTime && !isEqual(context.updateTime, prevMemo.updateTime)) { + if (context.updateTime && !isEqual(context.updateTime, prevMemo.updateTime ? timestampDate(prevMemo.updateTime) : undefined)) { mask.add("update_time"); - patch.updateTime = context.updateTime; + patch.updateTime = timestampFromDate(context.updateTime); } return { mask, patch }; @@ -137,24 +139,23 @@ export function useMemoSave(callbacks: MemoSaveCallbacks) { const memo = context.parentMemoName ? await memoServiceClient.createMemoComment({ name: context.parentMemoName, - comment: { + comment: create(MemoSchema, { content, visibility: context.visibility, attachments: context.attachmentList, relations: context.relationList, location: context.location, - }, + }), }) - : await memoStore.createMemo({ - memo: { + : await memoStore.createMemo( + create(MemoSchema, { content, visibility: context.visibility, attachments: allAttachments, relations: context.relationList, location: context.location, - } as Memo, - memoId: "", - }); + }), + ); onSuccess(memo.name); } diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx index f6e57b68e..7cf67c9be 100644 --- a/web/src/components/MemoEditor/index.tsx +++ b/web/src/components/MemoEditor/index.tsx @@ -10,7 +10,7 @@ import { Button } from "@/components/ui/button"; import useCurrentUser from "@/hooks/useCurrentUser"; import { cn } from "@/lib/utils"; import { extractMemoIdFromName } from "@/store/common"; -import { MemoRelation_Type } from "@/types/proto/api/v1/memo_service"; +import { MemoRelation_Type } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import DateTimeInput from "../DateTimeInput"; import { AttachmentList, LocationDisplay, RelationList } from "../memo-metadata"; diff --git a/web/src/components/MemoEditor/types/context.ts b/web/src/components/MemoEditor/types/context.ts index b6e2b4673..582d78545 100644 --- a/web/src/components/MemoEditor/types/context.ts +++ b/web/src/components/MemoEditor/types/context.ts @@ -1,6 +1,6 @@ import { createContext } from "react"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service"; -import type { MemoRelation } from "@/types/proto/api/v1/memo_service"; +import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { MemoRelation } from "@/types/proto/api/v1/memo_service_pb"; import type { LocalFile } from "../../memo-metadata"; export interface MemoEditorContextValue { diff --git a/web/src/components/MemoExplorer/ShortcutsSection.tsx b/web/src/components/MemoExplorer/ShortcutsSection.tsx index bcc56cb72..fc87f2dbd 100644 --- a/web/src/components/MemoExplorer/ShortcutsSection.tsx +++ b/web/src/components/MemoExplorer/ShortcutsSection.tsx @@ -9,7 +9,7 @@ import useAsyncEffect from "@/hooks/useAsyncEffect"; import { cn } from "@/lib/utils"; import { userStore } from "@/store"; import memoFilterStore from "@/store/memoFilter"; -import { Shortcut } from "@/types/proto/api/v1/shortcut_service"; +import { Shortcut } from "@/types/proto/api/v1/shortcut_service_pb"; import { useTranslate } from "@/utils/i18n"; import CreateShortcutDialog from "../CreateShortcutDialog"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../ui/dropdown-menu"; diff --git a/web/src/components/MemoReactionListView/MemoReactionListView.tsx b/web/src/components/MemoReactionListView/MemoReactionListView.tsx index c0a95833f..1778748a4 100644 --- a/web/src/components/MemoReactionListView/MemoReactionListView.tsx +++ b/web/src/components/MemoReactionListView/MemoReactionListView.tsx @@ -1,8 +1,8 @@ import { observer } from "mobx-react-lite"; import { memo } from "react"; import useCurrentUser from "@/hooks/useCurrentUser"; -import { State } from "@/types/proto/api/v1/common"; -import type { Memo, Reaction } from "@/types/proto/api/v1/memo_service"; +import { State } from "@/types/proto/api/v1/common_pb"; +import type { Memo, Reaction } from "@/types/proto/api/v1/memo_service_pb"; import { useReactionGroups } from "./hooks"; import ReactionSelector from "./ReactionSelector"; import ReactionView from "./ReactionView"; diff --git a/web/src/components/MemoReactionListView/ReactionSelector.tsx b/web/src/components/MemoReactionListView/ReactionSelector.tsx index db3acc8b1..99d6e234e 100644 --- a/web/src/components/MemoReactionListView/ReactionSelector.tsx +++ b/web/src/components/MemoReactionListView/ReactionSelector.tsx @@ -4,7 +4,7 @@ import { useState } from "react"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { cn } from "@/lib/utils"; import { instanceStore } from "@/store"; -import type { Memo } from "@/types/proto/api/v1/memo_service"; +import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; import { useReactionActions } from "./hooks"; interface Props { diff --git a/web/src/components/MemoReactionListView/ReactionView.tsx b/web/src/components/MemoReactionListView/ReactionView.tsx index f8d20367c..ee28d5d45 100644 --- a/web/src/components/MemoReactionListView/ReactionView.tsx +++ b/web/src/components/MemoReactionListView/ReactionView.tsx @@ -2,9 +2,9 @@ import { observer } from "mobx-react-lite"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import useCurrentUser from "@/hooks/useCurrentUser"; import { cn } from "@/lib/utils"; -import { State } from "@/types/proto/api/v1/common"; -import type { Memo } from "@/types/proto/api/v1/memo_service"; -import type { User } from "@/types/proto/api/v1/user_service"; +import { State } from "@/types/proto/api/v1/common_pb"; +import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { User } from "@/types/proto/api/v1/user_service_pb"; import { formatReactionTooltip, useReactionActions } from "./hooks"; interface Props { diff --git a/web/src/components/MemoReactionListView/hooks.ts b/web/src/components/MemoReactionListView/hooks.ts index a89f00317..da52f3159 100644 --- a/web/src/components/MemoReactionListView/hooks.ts +++ b/web/src/components/MemoReactionListView/hooks.ts @@ -3,8 +3,8 @@ import { useEffect, useState } from "react"; import { memoServiceClient } from "@/grpcweb"; import useCurrentUser from "@/hooks/useCurrentUser"; import { memoStore, userStore } from "@/store"; -import type { Memo, Reaction } from "@/types/proto/api/v1/memo_service"; -import type { User } from "@/types/proto/api/v1/user_service"; +import type { Memo, Reaction } from "@/types/proto/api/v1/memo_service_pb"; +import type { User } from "@/types/proto/api/v1/user_service_pb"; export type ReactionGroup = Map; diff --git a/web/src/components/MemoRelationForceGraph/MemoRelationForceGraph.tsx b/web/src/components/MemoRelationForceGraph/MemoRelationForceGraph.tsx index 0bcb8a939..f90c32ff1 100644 --- a/web/src/components/MemoRelationForceGraph/MemoRelationForceGraph.tsx +++ b/web/src/components/MemoRelationForceGraph/MemoRelationForceGraph.tsx @@ -3,7 +3,7 @@ import ForceGraph2D, { ForceGraphMethods, LinkObject, NodeObject } from "react-f import useNavigateTo from "@/hooks/useNavigateTo"; import { cn } from "@/lib/utils"; import { extractMemoIdFromName } from "@/store/common"; -import { Memo, MemoRelation_Type } from "@/types/proto/api/v1/memo_service"; +import { Memo, MemoRelation_Type } from "@/types/proto/api/v1/memo_service_pb"; import { LinkType, NodeType } from "./types"; import { convertMemoRelationsToGraphData } from "./utils"; diff --git a/web/src/components/MemoRelationForceGraph/types.ts b/web/src/components/MemoRelationForceGraph/types.ts index 3860ef49d..6786b7cd0 100644 --- a/web/src/components/MemoRelationForceGraph/types.ts +++ b/web/src/components/MemoRelationForceGraph/types.ts @@ -1,4 +1,4 @@ -import { MemoRelation_Memo } from "@/types/proto/api/v1/memo_service"; +import { MemoRelation_Memo } from "@/types/proto/api/v1/memo_service_pb"; export interface NodeType { memo: MemoRelation_Memo; diff --git a/web/src/components/MemoRelationForceGraph/utils.ts b/web/src/components/MemoRelationForceGraph/utils.ts index 610da5e7f..f65f410a4 100644 --- a/web/src/components/MemoRelationForceGraph/utils.ts +++ b/web/src/components/MemoRelationForceGraph/utils.ts @@ -1,5 +1,5 @@ import { GraphData, LinkObject, NodeObject } from "react-force-graph-2d"; -import { MemoRelation, MemoRelation_Memo } from "@/types/proto/api/v1/memo_service"; +import { MemoRelation, MemoRelation_Memo } from "@/types/proto/api/v1/memo_service_pb"; import { LinkType, NodeType } from "./types"; export const convertMemoRelationsToGraphData = (memoRelations: MemoRelation[]): GraphData => { diff --git a/web/src/components/MemoView/MemoView.tsx b/web/src/components/MemoView/MemoView.tsx index 14addba0e..549a0e215 100644 --- a/web/src/components/MemoView/MemoView.tsx +++ b/web/src/components/MemoView/MemoView.tsx @@ -1,7 +1,7 @@ import { observer } from "mobx-react-lite"; import { memo, useMemo, useRef, useState } from "react"; import { cn } from "@/lib/utils"; -import type { Memo } from "@/types/proto/api/v1/memo_service"; +import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; import MemoEditor from "../MemoEditor"; import PreviewImageDialog from "../PreviewImageDialog"; import { MemoBody, MemoHeader } from "./components"; diff --git a/web/src/components/MemoView/MemoViewContext.tsx b/web/src/components/MemoView/MemoViewContext.tsx index 4328e4ea9..25cd6f39f 100644 --- a/web/src/components/MemoView/MemoViewContext.tsx +++ b/web/src/components/MemoView/MemoViewContext.tsx @@ -1,6 +1,6 @@ import { createContext, useContext } from "react"; -import type { Memo } from "@/types/proto/api/v1/memo_service"; -import type { User } from "@/types/proto/api/v1/user_service"; +import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { User } from "@/types/proto/api/v1/user_service_pb"; export interface MemoViewContextValue { memo: Memo; diff --git a/web/src/components/MemoView/components/MemoBody.tsx b/web/src/components/MemoView/components/MemoBody.tsx index 5841998bc..d17d16080 100644 --- a/web/src/components/MemoView/components/MemoBody.tsx +++ b/web/src/components/MemoView/components/MemoBody.tsx @@ -1,5 +1,5 @@ import { cn } from "@/lib/utils"; -import { MemoRelation_Type } from "@/types/proto/api/v1/memo_service"; +import { MemoRelation_Type } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import MemoContent from "../../MemoContent"; import { MemoReactionListView } from "../../MemoReactionListView"; diff --git a/web/src/components/MemoView/components/MemoHeader.tsx b/web/src/components/MemoView/components/MemoHeader.tsx index b4e667b61..bb3a782bb 100644 --- a/web/src/components/MemoView/components/MemoHeader.tsx +++ b/web/src/components/MemoView/components/MemoHeader.tsx @@ -1,10 +1,11 @@ +import { timestampDate } from "@bufbuild/protobuf/wkt"; import { BookmarkIcon, EyeOffIcon, MessageCircleMoreIcon } from "lucide-react"; import { Link } from "react-router-dom"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import i18n from "@/i18n"; import { cn } from "@/lib/utils"; -import { Visibility } from "@/types/proto/api/v1/memo_service"; -import type { User } from "@/types/proto/api/v1/user_service"; +import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import type { User } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import { convertVisibilityToString } from "@/utils/memo"; import MemoActionMenu from "../../MemoActionMenu"; @@ -43,9 +44,13 @@ const MemoHeader: React.FC = ({ useMemoViewContext(); const displayTime = isArchived ? ( - memo.displayTime?.toLocaleString(i18n.language) + (memo.displayTime ? timestampDate(memo.displayTime) : undefined)?.toLocaleString(i18n.language) ) : ( - + ); return ( diff --git a/web/src/components/MemoView/hooks/useMemoViewDerivedState.ts b/web/src/components/MemoView/hooks/useMemoViewDerivedState.ts index 439804cf4..22b50a5f5 100644 --- a/web/src/components/MemoView/hooks/useMemoViewDerivedState.ts +++ b/web/src/components/MemoView/hooks/useMemoViewDerivedState.ts @@ -1,8 +1,9 @@ +import { timestampDate } from "@bufbuild/protobuf/wkt"; import { useLocation } from "react-router-dom"; import useCurrentUser from "@/hooks/useCurrentUser"; -import { State } from "@/types/proto/api/v1/common"; -import type { Memo } from "@/types/proto/api/v1/memo_service"; -import { MemoRelation_Type } from "@/types/proto/api/v1/memo_service"; +import { State } from "@/types/proto/api/v1/common_pb"; +import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import { MemoRelation_Type } from "@/types/proto/api/v1/memo_service_pb"; import { isSuperUser } from "@/utils/user"; import { RELATIVE_TIME_THRESHOLD_MS } from "../constants"; @@ -14,8 +15,9 @@ export const useMemoViewDerivedState = (memo: Memo, parentPageProp?: string) => (relation) => relation.type === MemoRelation_Type.COMMENT && relation.relatedMemo?.name === memo.name, ).length; + const displayTime = memo.displayTime ? timestampDate(memo.displayTime) : undefined; const relativeTimeFormat: "datetime" | "auto" = - memo.displayTime && Date.now() - memo.displayTime.getTime() > RELATIVE_TIME_THRESHOLD_MS ? "datetime" : "auto"; + displayTime && Date.now() - displayTime.getTime() > RELATIVE_TIME_THRESHOLD_MS ? "datetime" : "auto"; const isArchived = memo.state === State.ARCHIVED; const readonly = memo.creator !== user?.name && !isSuperUser(user); diff --git a/web/src/components/MemoView/hooks/useMemoViewState.ts b/web/src/components/MemoView/hooks/useMemoViewState.ts index 7640c170f..95f0cf8b5 100644 --- a/web/src/components/MemoView/hooks/useMemoViewState.ts +++ b/web/src/components/MemoView/hooks/useMemoViewState.ts @@ -1,8 +1,8 @@ import { useEffect, useRef, useState } from "react"; import toast from "react-hot-toast"; import { instanceStore, memoStore, userStore } from "@/store"; -import { State } from "@/types/proto/api/v1/common"; -import type { Memo } from "@/types/proto/api/v1/memo_service"; +import { State } from "@/types/proto/api/v1/common_pb"; +import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import { KEYBOARD_SHORTCUTS, TEXT_INPUT_TYPES } from "../constants"; diff --git a/web/src/components/MemoView/types.ts b/web/src/components/MemoView/types.ts index 6a1852294..07d86dd72 100644 --- a/web/src/components/MemoView/types.ts +++ b/web/src/components/MemoView/types.ts @@ -1,5 +1,5 @@ -import type { Memo } from "@/types/proto/api/v1/memo_service"; -import type { User } from "@/types/proto/api/v1/user_service"; +import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { User } from "@/types/proto/api/v1/user_service_pb"; export interface MemoViewProps { memo: Memo; diff --git a/web/src/components/Navigation.tsx b/web/src/components/Navigation.tsx index a0de9c719..435ac2bec 100644 --- a/web/src/components/Navigation.tsx +++ b/web/src/components/Navigation.tsx @@ -7,6 +7,7 @@ import useCurrentUser from "@/hooks/useCurrentUser"; import { cn } from "@/lib/utils"; import { Routes } from "@/router"; import { userStore } from "@/store"; +import { UserNotification_Status } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import MemosLogo from "./MemosLogo"; import UserMenu from "./UserMenu"; @@ -54,7 +55,7 @@ const Navigation = observer((props: Props) => { title: t("common.attachments"), icon: , }; - const unreadCount = userStore.state.notifications.filter((n) => n.status === "UNREAD").length; + const unreadCount = userStore.state.notifications.filter((n) => n.status === UserNotification_Status.UNREAD).length; const inboxNavLink: NavLinkItem = { id: "header-inbox", path: Routes.INBOX, diff --git a/web/src/components/PagedMemoList/PagedMemoList.tsx b/web/src/components/PagedMemoList/PagedMemoList.tsx index 1bdb1a5e5..1cb49178e 100644 --- a/web/src/components/PagedMemoList/PagedMemoList.tsx +++ b/web/src/components/PagedMemoList/PagedMemoList.tsx @@ -8,8 +8,8 @@ import { DEFAULT_LIST_MEMOS_PAGE_SIZE } from "@/helpers/consts"; import useResponsiveWidth from "@/hooks/useResponsiveWidth"; import { Routes } from "@/router"; import { memoStore, userStore, viewStore } from "@/store"; -import { State } from "@/types/proto/api/v1/common"; -import type { Memo } from "@/types/proto/api/v1/memo_service"; +import { State } from "@/types/proto/api/v1/common_pb"; +import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import Empty from "../Empty"; import type { MemoRenderContext } from "../MasonryView"; diff --git a/web/src/components/PasswordSignInForm.tsx b/web/src/components/PasswordSignInForm.tsx index 749e7ff09..ce0c223c1 100644 --- a/web/src/components/PasswordSignInForm.tsx +++ b/web/src/components/PasswordSignInForm.tsx @@ -1,6 +1,6 @@ +import { ConnectError } from "@connectrpc/connect"; import { LoaderIcon } from "lucide-react"; import { observer } from "mobx-react-lite"; -import { ClientError } from "nice-grpc-web"; import { useState } from "react"; import { toast } from "react-hot-toast"; import { Button } from "@/components/ui/button"; @@ -46,13 +46,16 @@ const PasswordSignInForm = observer(() => { try { actionBtnLoadingState.setLoading(); await authServiceClient.createSession({ - passwordCredentials: { username, password }, + credentials: { + case: "passwordCredentials", + value: { username, password }, + }, }); await initialUserStore(); navigateTo("/"); } catch (error: any) { console.error(error); - toast.error((error as ClientError).details || "Failed to sign in."); + toast.error((error as ConnectError).message || "Failed to sign in."); } actionBtnLoadingState.setFinish(); }; diff --git a/web/src/components/Settings/AccessTokenSection.tsx b/web/src/components/Settings/AccessTokenSection.tsx index f3191d2a6..a1c42143b 100644 --- a/web/src/components/Settings/AccessTokenSection.tsx +++ b/web/src/components/Settings/AccessTokenSection.tsx @@ -1,3 +1,4 @@ +import { timestampDate } from "@bufbuild/protobuf/wkt"; import copy from "copy-to-clipboard"; import { ClipboardIcon, PlusIcon, TrashIcon } from "lucide-react"; import { useEffect, useState } from "react"; @@ -7,14 +8,18 @@ import { Button } from "@/components/ui/button"; import { userServiceClient } from "@/grpcweb"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useDialog } from "@/hooks/useDialog"; -import { UserAccessToken } from "@/types/proto/api/v1/user_service"; +import { UserAccessToken } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import CreateAccessTokenDialog from "../CreateAccessTokenDialog"; import SettingTable from "./SettingTable"; const listAccessTokens = async (parent: string) => { const { accessTokens } = await userServiceClient.listUserAccessTokens({ parent }); - return accessTokens.sort((a, b) => (b.issuedAt?.getTime() ?? 0) - (a.issuedAt?.getTime() ?? 0)); + return accessTokens.sort( + (a, b) => + ((b.issuedAt ? timestampDate(b.issuedAt) : undefined)?.getTime() ?? 0) - + ((a.issuedAt ? timestampDate(a.issuedAt) : undefined)?.getTime() ?? 0), + ); }; const AccessTokenSection = () => { @@ -98,13 +103,14 @@ const AccessTokenSection = () => { { key: "issuedAt", header: t("setting.access-token-section.create-dialog.created-at"), - render: (_, token: UserAccessToken) => token.issuedAt?.toLocaleString(), + render: (_, token: UserAccessToken) => (token.issuedAt ? timestampDate(token.issuedAt) : undefined)?.toLocaleString(), }, { key: "expiresAt", header: t("setting.access-token-section.create-dialog.expires-at"), render: (_, token: UserAccessToken) => - token.expiresAt?.toLocaleString() ?? t("setting.access-token-section.create-dialog.duration-never"), + (token.expiresAt ? timestampDate(token.expiresAt) : undefined)?.toLocaleString() ?? + t("setting.access-token-section.create-dialog.duration-never"), }, { key: "actions", diff --git a/web/src/components/Settings/InstanceSection.tsx b/web/src/components/Settings/InstanceSection.tsx index e0e2203aa..c43abcb4c 100644 --- a/web/src/components/Settings/InstanceSection.tsx +++ b/web/src/components/Settings/InstanceSection.tsx @@ -1,3 +1,4 @@ +import { create } from "@bufbuild/protobuf"; import { isEqual } from "lodash-es"; import { observer } from "mobx-react-lite"; import { useEffect, useState } from "react"; @@ -10,19 +11,33 @@ import { identityProviderServiceClient } from "@/grpcweb"; import useDialog from "@/hooks/useDialog"; import { instanceStore } from "@/store"; import { instanceSettingNamePrefix } from "@/store/common"; -import { IdentityProvider } from "@/types/proto/api/v1/idp_service"; -import { InstanceSetting_GeneralSetting, InstanceSetting_Key } from "@/types/proto/api/v1/instance_service"; +import { IdentityProvider } from "@/types/proto/api/v1/idp_service_pb"; +import { + InstanceSetting_GeneralSetting, + InstanceSetting_GeneralSettingSchema, + InstanceSetting_Key, + InstanceSettingSchema, +} from "@/types/proto/api/v1/instance_service_pb"; import { useTranslate } from "@/utils/i18n"; import UpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog"; import SettingGroup from "./SettingGroup"; import SettingRow from "./SettingRow"; import SettingSection from "./SettingSection"; +// Helper to extract general setting value from InstanceSetting oneof +function getGeneralSetting(setting: any): InstanceSetting_GeneralSetting | undefined { + if (setting?.value?.case === "generalSetting") { + return setting.value.value; + } + return undefined; +} + const InstanceSection = observer(() => { const t = useTranslate(); const customizeDialog = useDialog(); - const originalSetting = InstanceSetting_GeneralSetting.fromPartial( - instanceStore.getInstanceSettingByKey(InstanceSetting_Key.GENERAL)?.generalSetting || {}, + const originalSetting = create( + InstanceSetting_GeneralSettingSchema, + getGeneralSetting(instanceStore.getInstanceSettingByKey(InstanceSetting_Key.GENERAL)) || {}, ); const [instanceGeneralSetting, setInstanceGeneralSetting] = useState(originalSetting); const [identityProviderList, setIdentityProviderList] = useState([]); @@ -37,7 +52,7 @@ const InstanceSection = observer(() => { const updatePartialSetting = (partial: Partial) => { setInstanceGeneralSetting( - InstanceSetting_GeneralSetting.fromPartial({ + create(InstanceSetting_GeneralSettingSchema, { ...instanceGeneralSetting, ...partial, }), @@ -46,12 +61,17 @@ const InstanceSection = observer(() => { const handleSaveGeneralSetting = async () => { try { - await instanceStore.upsertInstanceSetting({ - name: `${instanceSettingNamePrefix}${InstanceSetting_Key.GENERAL}`, - generalSetting: instanceGeneralSetting, - }); + await instanceStore.upsertInstanceSetting( + create(InstanceSettingSchema, { + name: `${instanceSettingNamePrefix}${InstanceSetting_Key.GENERAL}`, + value: { + case: "generalSetting", + value: instanceGeneralSetting, + }, + }), + ); } catch (error: any) { - toast.error(error.details); + toast.error(error.message); console.error(error); return; } diff --git a/web/src/components/Settings/MemberSection.tsx b/web/src/components/Settings/MemberSection.tsx index 2f4177625..0443c18f8 100644 --- a/web/src/components/Settings/MemberSection.tsx +++ b/web/src/components/Settings/MemberSection.tsx @@ -1,3 +1,5 @@ +import { create } from "@bufbuild/protobuf"; +import { FieldMaskSchema } from "@bufbuild/protobuf/wkt"; import { sortBy } from "lodash-es"; import { MoreVerticalIcon, PlusIcon } from "lucide-react"; import { observer } from "mobx-react-lite"; @@ -9,8 +11,8 @@ import { userServiceClient } from "@/grpcweb"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useDialog } from "@/hooks/useDialog"; import { userStore } from "@/store"; -import { State } from "@/types/proto/api/v1/common"; -import { User, User_Role } from "@/types/proto/api/v1/user_service"; +import { State } from "@/types/proto/api/v1/common_pb"; +import { User, User_Role } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import CreateUserDialog from "../CreateUserDialog"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../ui/dropdown-menu"; @@ -69,7 +71,7 @@ const MemberSection = observer(() => { name: archiveTarget.name, state: State.ARCHIVED, }, - updateMask: ["state"], + updateMask: create(FieldMaskSchema, { paths: ["state"] }), }); setArchiveTarget(undefined); toast.success(t("setting.member-section.archive-success", { username })); @@ -83,7 +85,7 @@ const MemberSection = observer(() => { name: user.name, state: State.NORMAL, }, - updateMask: ["state"], + updateMask: create(FieldMaskSchema, { paths: ["state"] }), }); toast.success(t("setting.member-section.restore-success", { username })); await fetchUsers(); diff --git a/web/src/components/Settings/MemoRelatedSettings.tsx b/web/src/components/Settings/MemoRelatedSettings.tsx index aaa7940c9..ebf93d385 100644 --- a/web/src/components/Settings/MemoRelatedSettings.tsx +++ b/web/src/components/Settings/MemoRelatedSettings.tsx @@ -1,3 +1,4 @@ +import { create } from "@bufbuild/protobuf"; import { isEqual, uniq } from "lodash-es"; import { CheckIcon, X } from "lucide-react"; import { observer } from "mobx-react-lite"; @@ -9,7 +10,12 @@ import { Input } from "@/components/ui/input"; import { Switch } from "@/components/ui/switch"; import { instanceStore } from "@/store"; import { instanceSettingNamePrefix } from "@/store/common"; -import { InstanceSetting_Key, InstanceSetting_MemoRelatedSetting } from "@/types/proto/api/v1/instance_service"; +import { + InstanceSetting_Key, + InstanceSetting_MemoRelatedSetting, + InstanceSetting_MemoRelatedSettingSchema, + InstanceSettingSchema, +} from "@/types/proto/api/v1/instance_service_pb"; import { useTranslate } from "@/utils/i18n"; import SettingGroup from "./SettingGroup"; import SettingRow from "./SettingRow"; @@ -23,7 +29,7 @@ const MemoRelatedSettings = observer(() => { const [editingNsfwTag, setEditingNsfwTag] = useState(""); const updatePartialSetting = (partial: Partial) => { - const newInstanceMemoRelatedSetting = InstanceSetting_MemoRelatedSetting.fromPartial({ + const newInstanceMemoRelatedSetting = create(InstanceSetting_MemoRelatedSettingSchema, { ...memoRelatedSetting, ...partial, }); @@ -55,14 +61,19 @@ const MemoRelatedSettings = observer(() => { } try { - await instanceStore.upsertInstanceSetting({ - name: `${instanceSettingNamePrefix}${InstanceSetting_Key.MEMO_RELATED}`, - memoRelatedSetting, - }); + await instanceStore.upsertInstanceSetting( + create(InstanceSettingSchema, { + name: `${instanceSettingNamePrefix}${InstanceSetting_Key.MEMO_RELATED}`, + value: { + case: "memoRelatedSetting", + value: memoRelatedSetting, + }, + }), + ); setOriginalSetting(memoRelatedSetting); toast.success(t("message.update-succeed")); } catch (error: any) { - toast.error(error.details); + toast.error(error.message); console.error(error); } }; diff --git a/web/src/components/Settings/PreferencesSection.tsx b/web/src/components/Settings/PreferencesSection.tsx index d6f2ac72b..1b11cfe37 100644 --- a/web/src/components/Settings/PreferencesSection.tsx +++ b/web/src/components/Settings/PreferencesSection.tsx @@ -1,8 +1,9 @@ +import { create } from "@bufbuild/protobuf"; import { observer } from "mobx-react-lite"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { userStore } from "@/store"; -import { Visibility } from "@/types/proto/api/v1/memo_service"; -import { UserSetting_GeneralSetting } from "@/types/proto/api/v1/user_service"; +import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { UserSetting_GeneralSetting, UserSetting_GeneralSettingSchema } from "@/types/proto/api/v1/user_service_pb"; import { loadLocale, useTranslate } from "@/utils/i18n"; import { convertVisibilityFromString, convertVisibilityToString } from "@/utils/memo"; import { loadTheme } from "@/utils/theme"; @@ -37,11 +38,13 @@ const PreferencesSection = observer(() => { }; // Provide default values if setting is not loaded yet - const setting: UserSetting_GeneralSetting = generalSetting || { - locale: "en", - memoVisibility: "PRIVATE", - theme: "system", - }; + const setting: UserSetting_GeneralSetting = + generalSetting || + create(UserSetting_GeneralSettingSchema, { + locale: "en", + memoVisibility: "PRIVATE", + theme: "system", + }); return ( diff --git a/web/src/components/Settings/SSOSection.tsx b/web/src/components/Settings/SSOSection.tsx index b50a6ad12..bc6853cfa 100644 --- a/web/src/components/Settings/SSOSection.tsx +++ b/web/src/components/Settings/SSOSection.tsx @@ -5,7 +5,7 @@ import ConfirmDialog from "@/components/ConfirmDialog"; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import { identityProviderServiceClient } from "@/grpcweb"; -import { IdentityProvider } from "@/types/proto/api/v1/idp_service"; +import { IdentityProvider } from "@/types/proto/api/v1/idp_service_pb"; import { useTranslate } from "@/utils/i18n"; import CreateIdentityProviderDialog from "../CreateIdentityProviderDialog"; import LearnMore from "../LearnMore"; @@ -38,7 +38,7 @@ const SSOSection = () => { await identityProviderServiceClient.deleteIdentityProvider({ name: deleteTarget.name }); } catch (error: any) { console.error(error); - toast.error(error.details); + toast.error(error.message); } await fetchIdentityProviderList(); setDeleteTarget(undefined); diff --git a/web/src/components/Settings/StorageSection.tsx b/web/src/components/Settings/StorageSection.tsx index 3233d1010..c6f2d01cb 100644 --- a/web/src/components/Settings/StorageSection.tsx +++ b/web/src/components/Settings/StorageSection.tsx @@ -1,3 +1,4 @@ +import { create } from "@bufbuild/protobuf"; import { isEqual } from "lodash-es"; import { observer } from "mobx-react-lite"; import React, { useEffect, useMemo, useState } from "react"; @@ -13,22 +14,39 @@ import { InstanceSetting_Key, InstanceSetting_StorageSetting, InstanceSetting_StorageSetting_S3Config, + InstanceSetting_StorageSetting_S3ConfigSchema, InstanceSetting_StorageSetting_StorageType, -} from "@/types/proto/api/v1/instance_service"; + InstanceSetting_StorageSettingSchema, + InstanceSettingSchema, +} from "@/types/proto/api/v1/instance_service_pb"; import { useTranslate } from "@/utils/i18n"; import SettingGroup from "./SettingGroup"; import SettingRow from "./SettingRow"; import SettingSection from "./SettingSection"; +// Helper to extract storage setting value from InstanceSetting oneof +function getStorageSetting(setting: any): InstanceSetting_StorageSetting | undefined { + if (setting?.value?.case === "storageSetting") { + return setting.value.value; + } + return undefined; +} + const StorageSection = observer(() => { const t = useTranslate(); const [instanceStorageSetting, setInstanceStorageSetting] = useState( - InstanceSetting_StorageSetting.fromPartial(instanceStore.getInstanceSettingByKey(InstanceSetting_Key.STORAGE)?.storageSetting || {}), + create( + InstanceSetting_StorageSettingSchema, + getStorageSetting(instanceStore.getInstanceSettingByKey(InstanceSetting_Key.STORAGE)) || {}, + ), ); useEffect(() => { setInstanceStorageSetting( - InstanceSetting_StorageSetting.fromPartial(instanceStore.getInstanceSettingByKey(InstanceSetting_Key.STORAGE)?.storageSetting || {}), + create( + InstanceSetting_StorageSettingSchema, + getStorageSetting(instanceStore.getInstanceSettingByKey(InstanceSetting_Key.STORAGE)) || {}, + ), ); }, [instanceStore.getInstanceSettingByKey(InstanceSetting_Key.STORAGE)]); @@ -37,8 +55,9 @@ const StorageSection = observer(() => { return false; } - const origin = InstanceSetting_StorageSetting.fromPartial( - instanceStore.getInstanceSettingByKey(InstanceSetting_Key.STORAGE)?.storageSetting || {}, + const origin = create( + InstanceSetting_StorageSettingSchema, + getStorageSetting(instanceStore.getInstanceSettingByKey(InstanceSetting_Key.STORAGE)) || {}, ); if (instanceStorageSetting.storageType === InstanceSetting_StorageSetting_StorageType.LOCAL) { if (instanceStorageSetting.filepathTemplate.length === 0) { @@ -63,29 +82,38 @@ const StorageSection = observer(() => { if (Number.isNaN(num)) { num = 0; } - const update: InstanceSetting_StorageSetting = { + const update = create(InstanceSetting_StorageSettingSchema, { ...instanceStorageSetting, - uploadSizeLimitMb: num, - }; + uploadSizeLimitMb: BigInt(num), + }); setInstanceStorageSetting(update); }; const handleFilepathTemplateChanged = async (event: React.FocusEvent) => { - const update: InstanceSetting_StorageSetting = { + const update = create(InstanceSetting_StorageSettingSchema, { ...instanceStorageSetting, filepathTemplate: event.target.value, - }; + }); setInstanceStorageSetting(update); }; const handlePartialS3ConfigChanged = async (s3Config: Partial) => { - const update: InstanceSetting_StorageSetting = { - ...instanceStorageSetting, - s3Config: InstanceSetting_StorageSetting_S3Config.fromPartial({ - ...instanceStorageSetting.s3Config, - ...s3Config, - }), + const existingS3Config = instanceStorageSetting.s3Config; + const s3ConfigInit = { + accessKeyId: existingS3Config?.accessKeyId ?? "", + accessKeySecret: existingS3Config?.accessKeySecret ?? "", + endpoint: existingS3Config?.endpoint ?? "", + region: existingS3Config?.region ?? "", + bucket: existingS3Config?.bucket ?? "", + usePathStyle: existingS3Config?.usePathStyle ?? false, + ...s3Config, }; + const update = create(InstanceSetting_StorageSettingSchema, { + storageType: instanceStorageSetting.storageType, + filepathTemplate: instanceStorageSetting.filepathTemplate, + uploadSizeLimitMb: instanceStorageSetting.uploadSizeLimitMb, + s3Config: create(InstanceSetting_StorageSetting_S3ConfigSchema, s3ConfigInit), + }); setInstanceStorageSetting(update); }; @@ -116,18 +144,23 @@ const StorageSection = observer(() => { }; const handleStorageTypeChanged = async (storageType: InstanceSetting_StorageSetting_StorageType) => { - const update: InstanceSetting_StorageSetting = { + const update = create(InstanceSetting_StorageSettingSchema, { ...instanceStorageSetting, storageType: storageType, - }; + }); setInstanceStorageSetting(update); }; const saveInstanceStorageSetting = async () => { - await instanceStore.upsertInstanceSetting({ - name: `${instanceSettingNamePrefix}${InstanceSetting_Key.STORAGE}`, - storageSetting: instanceStorageSetting, - }); + await instanceStore.upsertInstanceSetting( + create(InstanceSettingSchema, { + name: `${instanceSettingNamePrefix}${InstanceSetting_Key.STORAGE}`, + value: { + case: "storageSetting", + value: instanceStorageSetting, + }, + }), + ); toast.success("Updated"); }; @@ -136,29 +169,33 @@ const StorageSection = observer(() => {
{ - handleStorageTypeChanged(value as InstanceSetting_StorageSetting_StorageType); + handleStorageTypeChanged(Number(value) as InstanceSetting_StorageSetting_StorageType); }} className="flex flex-row gap-4" >
- +
- +
- +
- + {instanceStorageSetting.storageType !== InstanceSetting_StorageSetting_StorageType.DATABASE && ( diff --git a/web/src/components/Settings/UserSessionsSection.tsx b/web/src/components/Settings/UserSessionsSection.tsx index c4bb76f4e..ab4753928 100644 --- a/web/src/components/Settings/UserSessionsSection.tsx +++ b/web/src/components/Settings/UserSessionsSection.tsx @@ -1,3 +1,4 @@ +import { timestampDate } from "@bufbuild/protobuf/wkt"; import { ClockIcon, MonitorIcon, SmartphoneIcon, TabletIcon, TrashIcon, WifiIcon } from "lucide-react"; import { useEffect, useState } from "react"; import { toast } from "react-hot-toast"; @@ -5,13 +6,17 @@ import ConfirmDialog from "@/components/ConfirmDialog"; import { Button } from "@/components/ui/button"; import { userServiceClient } from "@/grpcweb"; import useCurrentUser from "@/hooks/useCurrentUser"; -import { UserSession } from "@/types/proto/api/v1/user_service"; +import { UserSession } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import SettingTable from "./SettingTable"; const listUserSessions = async (parent: string) => { const { sessions } = await userServiceClient.listUserSessions({ parent }); - return sessions.sort((a, b) => (b.lastAccessedTime?.getTime() ?? 0) - (a.lastAccessedTime?.getTime() ?? 0)); + return sessions.sort( + (a, b) => + ((b.lastAccessedTime ? timestampDate(b.lastAccessedTime) : undefined)?.getTime() ?? 0) - + ((a.lastAccessedTime ? timestampDate(a.lastAccessedTime) : undefined)?.getTime() ?? 0), + ); }; const UserSessionsSection = () => { @@ -107,7 +112,7 @@ const UserSessionsSection = () => { render: (_, session: UserSession) => (
- {session.lastAccessedTime?.toLocaleString()} + {(session.lastAccessedTime ? timestampDate(session.lastAccessedTime) : undefined)?.toLocaleString()}
), }, diff --git a/web/src/components/Settings/WebhookSection.tsx b/web/src/components/Settings/WebhookSection.tsx index 3838cf173..00e5075a2 100644 --- a/web/src/components/Settings/WebhookSection.tsx +++ b/web/src/components/Settings/WebhookSection.tsx @@ -6,7 +6,7 @@ import ConfirmDialog from "@/components/ConfirmDialog"; import { Button } from "@/components/ui/button"; import { userServiceClient } from "@/grpcweb"; import useCurrentUser from "@/hooks/useCurrentUser"; -import { UserWebhook } from "@/types/proto/api/v1/user_service"; +import { UserWebhook } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import CreateWebhookDialog from "../CreateWebhookDialog"; import SettingTable from "./SettingTable"; diff --git a/web/src/components/UpdateAccountDialog.tsx b/web/src/components/UpdateAccountDialog.tsx index 033f8b480..6ff44a8f1 100644 --- a/web/src/components/UpdateAccountDialog.tsx +++ b/web/src/components/UpdateAccountDialog.tsx @@ -1,3 +1,4 @@ +import { create } from "@bufbuild/protobuf"; import { isEqual } from "lodash-es"; import { XIcon } from "lucide-react"; import { useState } from "react"; @@ -10,7 +11,7 @@ import { Textarea } from "@/components/ui/textarea"; import { convertFileToBase64 } from "@/helpers/utils"; import useCurrentUser from "@/hooks/useCurrentUser"; import { instanceStore, userStore } from "@/store"; -import { User as UserPb } from "@/types/proto/api/v1/user_service"; +import { User as UserPb, UserSchema } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import UserAvatar from "./UserAvatar"; @@ -127,7 +128,7 @@ function UpdateAccountDialog({ open, onOpenChange, onSuccess }: Props) { updateMask.push("description"); } await userStore.updateUser( - UserPb.fromPartial({ + create(UserSchema, { name: currentUser.name, username: state.username, displayName: state.displayName, @@ -142,7 +143,7 @@ function UpdateAccountDialog({ open, onOpenChange, onSuccess }: Props) { onOpenChange(false); } catch (error: any) { console.error(error); - toast.error(error.details); + toast.error(error.message); } }; diff --git a/web/src/components/UpdateCustomizedProfileDialog.tsx b/web/src/components/UpdateCustomizedProfileDialog.tsx index d390ff3b3..1c1f5c4db 100644 --- a/web/src/components/UpdateCustomizedProfileDialog.tsx +++ b/web/src/components/UpdateCustomizedProfileDialog.tsx @@ -1,3 +1,4 @@ +import { create } from "@bufbuild/protobuf"; import { useState } from "react"; import { toast } from "react-hot-toast"; import { Button } from "@/components/ui/button"; @@ -7,7 +8,12 @@ import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { instanceStore } from "@/store"; import { instanceSettingNamePrefix } from "@/store/common"; -import { InstanceSetting_GeneralSetting_CustomProfile, InstanceSetting_Key } from "@/types/proto/api/v1/instance_service"; +import { + InstanceSetting_GeneralSetting_CustomProfile, + InstanceSetting_GeneralSetting_CustomProfileSchema, + InstanceSetting_Key, + InstanceSettingSchema, +} from "@/types/proto/api/v1/instance_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { @@ -20,7 +26,7 @@ function UpdateCustomizedProfileDialog({ open, onOpenChange, onSuccess }: Props) const t = useTranslate(); const instanceGeneralSetting = instanceStore.state.generalSetting; const [customProfile, setCustomProfile] = useState( - InstanceSetting_GeneralSetting_CustomProfile.fromPartial(instanceGeneralSetting.customProfile || {}), + create(InstanceSetting_GeneralSetting_CustomProfileSchema, instanceGeneralSetting.customProfile || {}), ); const [isLoading, setIsLoading] = useState(false); @@ -70,13 +76,18 @@ function UpdateCustomizedProfileDialog({ open, onOpenChange, onSuccess }: Props) setIsLoading(true); try { - await instanceStore.upsertInstanceSetting({ - name: `${instanceSettingNamePrefix}${InstanceSetting_Key.GENERAL}`, - generalSetting: { - ...instanceGeneralSetting, - customProfile: customProfile, - }, - }); + await instanceStore.upsertInstanceSetting( + create(InstanceSettingSchema, { + name: `${instanceSettingNamePrefix}${InstanceSetting_Key.GENERAL}`, + value: { + case: "generalSetting", + value: { + ...instanceGeneralSetting, + customProfile: customProfile, + }, + }, + }), + ); toast.success(t("message.update-succeed")); onSuccess?.(); onOpenChange(false); diff --git a/web/src/components/VisibilityIcon.tsx b/web/src/components/VisibilityIcon.tsx index 7f5d929f7..84f8762ee 100644 --- a/web/src/components/VisibilityIcon.tsx +++ b/web/src/components/VisibilityIcon.tsx @@ -1,6 +1,6 @@ import { Globe2Icon, LockIcon, UsersIcon } from "lucide-react"; import { cn } from "@/lib/utils"; -import { Visibility } from "@/types/proto/api/v1/memo_service"; +import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; interface Props { visibility: Visibility; diff --git a/web/src/components/memo-metadata/AttachmentList.tsx b/web/src/components/memo-metadata/AttachmentList.tsx index f660dfe6b..0ec08d75b 100644 --- a/web/src/components/memo-metadata/AttachmentList.tsx +++ b/web/src/components/memo-metadata/AttachmentList.tsx @@ -1,7 +1,7 @@ import { closestCenter, DndContext, type DragEndEvent, MouseSensor, TouchSensor, useSensor, useSensors } from "@dnd-kit/core"; import { arrayMove, SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable"; import { useState } from "react"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service"; +import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; import { getAttachmentType, getAttachmentUrl } from "@/utils/attachment"; import MemoAttachment from "../MemoAttachment"; import PreviewImageDialog from "../PreviewImageDialog"; diff --git a/web/src/components/memo-metadata/LocationDisplay.tsx b/web/src/components/memo-metadata/LocationDisplay.tsx index dc1118fd7..50bc7f98f 100644 --- a/web/src/components/memo-metadata/LocationDisplay.tsx +++ b/web/src/components/memo-metadata/LocationDisplay.tsx @@ -2,7 +2,7 @@ import { LatLng } from "leaflet"; import { MapPinIcon, XIcon } from "lucide-react"; import { useState } from "react"; import { cn } from "@/lib/utils"; -import { Location } from "@/types/proto/api/v1/memo_service"; +import { Location } from "@/types/proto/api/v1/memo_service_pb"; import LeafletMap from "../LeafletMap"; import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"; import { BaseMetadataProps } from "./types"; diff --git a/web/src/components/memo-metadata/RelationCard.tsx b/web/src/components/memo-metadata/RelationCard.tsx index a2984a10b..bb6af2cf0 100644 --- a/web/src/components/memo-metadata/RelationCard.tsx +++ b/web/src/components/memo-metadata/RelationCard.tsx @@ -2,7 +2,7 @@ import { LinkIcon, XIcon } from "lucide-react"; import { Link } from "react-router-dom"; import { cn } from "@/lib/utils"; import { extractMemoIdFromName } from "@/store/common"; -import { MemoRelation_Memo } from "@/types/proto/api/v1/memo_service"; +import { MemoRelation_Memo } from "@/types/proto/api/v1/memo_service_pb"; import { DisplayMode } from "./types"; interface RelationCardProps { diff --git a/web/src/components/memo-metadata/RelationList.tsx b/web/src/components/memo-metadata/RelationList.tsx index 2ebb1738e..2abda6bbe 100644 --- a/web/src/components/memo-metadata/RelationList.tsx +++ b/web/src/components/memo-metadata/RelationList.tsx @@ -1,9 +1,10 @@ +import { create } from "@bufbuild/protobuf"; import { LinkIcon, MilestoneIcon } from "lucide-react"; import { observer } from "mobx-react-lite"; import { useEffect, useState } from "react"; import { cn } from "@/lib/utils"; import { memoStore } from "@/store"; -import { Memo, MemoRelation, MemoRelation_Type } from "@/types/proto/api/v1/memo_service"; +import { Memo, MemoRelation, MemoRelation_MemoSchema, MemoRelation_Type } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import MetadataCard from "./MetadataCard"; import RelationCard from "./RelationCard"; @@ -70,7 +71,7 @@ const RelationList = observer(({ relations, currentMemoName, mode, onRelationsCh {referencingMemos.map((memo) => ( handleDeleteRelation(memo.name)} /> diff --git a/web/src/components/memo-metadata/types.ts b/web/src/components/memo-metadata/types.ts index 67f66fd90..1e7a6bf90 100644 --- a/web/src/components/memo-metadata/types.ts +++ b/web/src/components/memo-metadata/types.ts @@ -1,4 +1,4 @@ -import type { Attachment } from "@/types/proto/api/v1/attachment_service"; +import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; import { getAttachmentThumbnailUrl, getAttachmentType, getAttachmentUrl } from "@/utils/attachment"; export type DisplayMode = "edit" | "view"; @@ -39,7 +39,7 @@ export function attachmentToItem(attachment: Attachment): AttachmentItem { mimeType: attachment.type, thumbnailUrl: attachmentType === "image/*" ? getAttachmentThumbnailUrl(attachment) : sourceUrl, sourceUrl, - size: attachment.size, + size: Number(attachment.size), isLocal: false, }; } diff --git a/web/src/grpcweb.ts b/web/src/grpcweb.ts index 1457848b3..fdc041624 100644 --- a/web/src/grpcweb.ts +++ b/web/src/grpcweb.ts @@ -1,34 +1,32 @@ -import { createChannel, createClientFactory, FetchTransport } from "nice-grpc-web"; -import { ActivityServiceDefinition } from "./types/proto/api/v1/activity_service"; -import { AttachmentServiceDefinition } from "./types/proto/api/v1/attachment_service"; -import { AuthServiceDefinition } from "./types/proto/api/v1/auth_service"; -import { IdentityProviderServiceDefinition } from "./types/proto/api/v1/idp_service"; -import { InstanceServiceDefinition } from "./types/proto/api/v1/instance_service"; -import { MemoServiceDefinition } from "./types/proto/api/v1/memo_service"; -import { ShortcutServiceDefinition } from "./types/proto/api/v1/shortcut_service"; -import { UserServiceDefinition } from "./types/proto/api/v1/user_service"; +import { createClient } from "@connectrpc/connect"; +import { createConnectTransport } from "@connectrpc/connect-web"; +import { ActivityService } from "./types/proto/api/v1/activity_service_pb"; +import { AttachmentService } from "./types/proto/api/v1/attachment_service_pb"; +import { AuthService } from "./types/proto/api/v1/auth_service_pb"; +import { IdentityProviderService } from "./types/proto/api/v1/idp_service_pb"; +import { InstanceService } from "./types/proto/api/v1/instance_service_pb"; +import { MemoService } from "./types/proto/api/v1/memo_service_pb"; +import { ShortcutService } from "./types/proto/api/v1/shortcut_service_pb"; +import { UserService } from "./types/proto/api/v1/user_service_pb"; -const channel = createChannel( - window.location.origin, - FetchTransport({ - credentials: "include", - }), -); +const transport = createConnectTransport({ + baseUrl: window.location.origin, + // Include cookies in requests for session auth + fetch: (input, init) => fetch(input, { ...init, credentials: "include" }), +}); -const clientFactory = createClientFactory(); +export const instanceServiceClient = createClient(InstanceService, transport); -export const instanceServiceClient = clientFactory.create(InstanceServiceDefinition, channel); +export const authServiceClient = createClient(AuthService, transport); -export const authServiceClient = clientFactory.create(AuthServiceDefinition, channel); +export const userServiceClient = createClient(UserService, transport); -export const userServiceClient = clientFactory.create(UserServiceDefinition, channel); +export const memoServiceClient = createClient(MemoService, transport); -export const memoServiceClient = clientFactory.create(MemoServiceDefinition, channel); +export const attachmentServiceClient = createClient(AttachmentService, transport); -export const attachmentServiceClient = clientFactory.create(AttachmentServiceDefinition, channel); +export const shortcutServiceClient = createClient(ShortcutService, transport); -export const shortcutServiceClient = clientFactory.create(ShortcutServiceDefinition, channel); +export const activityServiceClient = createClient(ActivityService, transport); -export const activityServiceClient = clientFactory.create(ActivityServiceDefinition, channel); - -export const identityProviderServiceClient = clientFactory.create(IdentityProviderServiceDefinition, channel); +export const identityProviderServiceClient = createClient(IdentityProviderService, transport); diff --git a/web/src/hooks/useFilteredMemoStats.ts b/web/src/hooks/useFilteredMemoStats.ts index a1272fca2..dadff0991 100644 --- a/web/src/hooks/useFilteredMemoStats.ts +++ b/web/src/hooks/useFilteredMemoStats.ts @@ -1,3 +1,4 @@ +import { timestampDate } from "@bufbuild/protobuf/wkt"; import dayjs from "dayjs"; import { countBy } from "lodash-es"; import { useEffect, useState } from "react"; @@ -57,7 +58,12 @@ export const useFilteredMemoStats = (options: UseFilteredMemoStatsOptions = {}): if (userStats) { // Use activity timestamps from user stats if (userStats.memoDisplayTimestamps && userStats.memoDisplayTimestamps.length > 0) { - activityStats = countBy(userStats.memoDisplayTimestamps.map((date) => dayjs(date).format("YYYY-MM-DD"))); + activityStats = countBy( + userStats.memoDisplayTimestamps + .map((ts) => (ts ? timestampDate(ts) : undefined)) + .filter((date): date is Date => date !== undefined) + .map((date) => dayjs(date).format("YYYY-MM-DD")), + ); } // Use tag counts from user stats if (userStats.tagCount) { @@ -75,8 +81,9 @@ export const useFilteredMemoStats = (options: UseFilteredMemoStatsOptions = {}): for (const memo of memos) { // Collect display timestamps for activity calendar - if (memo.displayTime) { - displayTimeList.push(memo.displayTime); + const displayTime = memo.displayTime ? timestampDate(memo.displayTime) : undefined; + if (displayTime) { + displayTimeList.push(displayTime); } // Count tags if (memo.tags && memo.tags.length > 0) { diff --git a/web/src/hooks/useMemoFilters.ts b/web/src/hooks/useMemoFilters.ts index 1289cc42f..50f389022 100644 --- a/web/src/hooks/useMemoFilters.ts +++ b/web/src/hooks/useMemoFilters.ts @@ -2,8 +2,8 @@ import { useMemo } from "react"; import { instanceStore, userStore } from "@/store"; import { extractUserIdFromName } from "@/store/common"; import memoFilterStore from "@/store/memoFilter"; -import { InstanceSetting_Key } from "@/types/proto/api/v1/instance_service"; -import { Visibility } from "@/types/proto/api/v1/memo_service"; +import { InstanceSetting_Key } from "@/types/proto/api/v1/instance_service_pb"; +import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; const getShortcutId = (name: string): string => { const parts = name.split("/"); @@ -64,8 +64,8 @@ export const useMemoFilters = (options: UseMemoFiltersOptions = {}): string | un conditions.push(`has_code`); } else if (filter.factor === "displayTime") { // Check instance setting for display time factor - const displayWithUpdateTime = instanceStore.getInstanceSettingByKey(InstanceSetting_Key.MEMO_RELATED).memoRelatedSetting - ?.displayWithUpdateTime; + const setting = instanceStore.getInstanceSettingByKey(InstanceSetting_Key.MEMO_RELATED); + const displayWithUpdateTime = setting?.value.case === "memoRelatedSetting" ? setting.value.value.displayWithUpdateTime : false; const factor = displayWithUpdateTime ? "updated_ts" : "created_ts"; // Convert date to UTC timestamp range diff --git a/web/src/hooks/useMemoSorting.ts b/web/src/hooks/useMemoSorting.ts index 1180ebb63..ac6cd88a5 100644 --- a/web/src/hooks/useMemoSorting.ts +++ b/web/src/hooks/useMemoSorting.ts @@ -1,8 +1,9 @@ +import { timestampDate } from "@bufbuild/protobuf/wkt"; import dayjs from "dayjs"; import { useMemo } from "react"; import { viewStore } from "@/store"; -import { State } from "@/types/proto/api/v1/common"; -import { Memo } from "@/types/proto/api/v1/memo_service"; +import { State } from "@/types/proto/api/v1/common_pb"; +import { Memo } from "@/types/proto/api/v1/memo_service_pb"; export interface UseMemoSortingOptions { pinnedFirst?: boolean; @@ -38,9 +39,9 @@ export const useMemoSorting = (options: UseMemoSortingOptions = {}): UseMemoSort } // Then sort by display time - return orderByTimeAsc - ? dayjs(a.displayTime).unix() - dayjs(b.displayTime).unix() - : dayjs(b.displayTime).unix() - dayjs(a.displayTime).unix(); + const aTime = a.displayTime ? timestampDate(a.displayTime) : undefined; + const bTime = b.displayTime ? timestampDate(b.displayTime) : undefined; + return orderByTimeAsc ? dayjs(aTime).unix() - dayjs(bTime).unix() : dayjs(bTime).unix() - dayjs(aTime).unix(); }); }; }, [pinnedFirst, state, orderByTimeAsc]); diff --git a/web/src/pages/Archived.tsx b/web/src/pages/Archived.tsx index 4fa5f6514..615cae40e 100644 --- a/web/src/pages/Archived.tsx +++ b/web/src/pages/Archived.tsx @@ -4,8 +4,8 @@ import MemoView from "@/components/MemoView"; import PagedMemoList from "@/components/PagedMemoList"; import { useMemoFilters, useMemoSorting } from "@/hooks"; import useCurrentUser from "@/hooks/useCurrentUser"; -import { State } from "@/types/proto/api/v1/common"; -import { Memo } from "@/types/proto/api/v1/memo_service"; +import { State } from "@/types/proto/api/v1/common_pb"; +import { Memo } from "@/types/proto/api/v1/memo_service_pb"; const Archived = observer(() => { const user = useCurrentUser(); diff --git a/web/src/pages/Attachments.tsx b/web/src/pages/Attachments.tsx index 6dc806a47..be334a7de 100644 --- a/web/src/pages/Attachments.tsx +++ b/web/src/pages/Attachments.tsx @@ -1,3 +1,4 @@ +import { timestampDate } from "@bufbuild/protobuf/wkt"; import dayjs from "dayjs"; import { ExternalLinkIcon, PaperclipIcon, SearchIcon, Trash } from "lucide-react"; import { observer } from "mobx-react-lite"; @@ -17,17 +18,22 @@ import useLoading from "@/hooks/useLoading"; import useResponsiveWidth from "@/hooks/useResponsiveWidth"; import i18n from "@/i18n"; import { attachmentStore } from "@/store"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service"; +import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; import { useTranslate } from "@/utils/i18n"; const PAGE_SIZE = 50; const groupAttachmentsByDate = (attachments: Attachment[]): Map => { const grouped = new Map(); - const sorted = [...attachments].sort((a, b) => dayjs(b.createTime).unix() - dayjs(a.createTime).unix()); + const sorted = [...attachments].sort((a, b) => { + const aTime = a.createTime ? timestampDate(a.createTime) : undefined; + const bTime = b.createTime ? timestampDate(b.createTime) : undefined; + return dayjs(bTime).unix() - dayjs(aTime).unix(); + }); for (const attachment of sorted) { - const monthKey = dayjs(attachment.createTime).format("YYYY-MM"); + const createTime = attachment.createTime ? timestampDate(attachment.createTime) : undefined; + const monthKey = dayjs(createTime).format("YYYY-MM"); const group = grouped.get(monthKey) ?? []; group.push(attachment); grouped.set(monthKey, group); diff --git a/web/src/pages/AuthCallback.tsx b/web/src/pages/AuthCallback.tsx index 6f61e6086..66919be84 100644 --- a/web/src/pages/AuthCallback.tsx +++ b/web/src/pages/AuthCallback.tsx @@ -1,6 +1,6 @@ +import { ConnectError } from "@connectrpc/connect"; import { LoaderIcon } from "lucide-react"; import { observer } from "mobx-react-lite"; -import { ClientError } from "nice-grpc-web"; import { useEffect, useState } from "react"; import { useSearchParams } from "react-router-dom"; import { authServiceClient } from "@/grpcweb"; @@ -72,11 +72,14 @@ const AuthCallback = observer(() => { (async () => { try { await authServiceClient.createSession({ - ssoCredentials: { - idpId: identityProviderId, - code, - redirectUri, - codeVerifier: codeVerifier || "", // Pass PKCE code_verifier for token exchange + credentials: { + case: "ssoCredentials", + value: { + idpId: identityProviderId, + code, + redirectUri, + codeVerifier: codeVerifier || "", // Pass PKCE code_verifier for token exchange + }, }, }); setState({ @@ -90,7 +93,7 @@ const AuthCallback = observer(() => { console.error(error); setState({ loading: false, - errorMessage: (error as ClientError).details, + errorMessage: (error as ConnectError).message, }); } })(); diff --git a/web/src/pages/Explore.tsx b/web/src/pages/Explore.tsx index adeeb1021..9d4b85e5a 100644 --- a/web/src/pages/Explore.tsx +++ b/web/src/pages/Explore.tsx @@ -4,8 +4,8 @@ import MemoView from "@/components/MemoView"; import PagedMemoList from "@/components/PagedMemoList"; import { useMemoFilters, useMemoSorting } from "@/hooks"; import useCurrentUser from "@/hooks/useCurrentUser"; -import { State } from "@/types/proto/api/v1/common"; -import { Memo, Visibility } from "@/types/proto/api/v1/memo_service"; +import { State } from "@/types/proto/api/v1/common_pb"; +import { Memo, Visibility } from "@/types/proto/api/v1/memo_service_pb"; const Explore = observer(() => { const currentUser = useCurrentUser(); diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx index 93b39e0fe..e3ab86b73 100644 --- a/web/src/pages/Home.tsx +++ b/web/src/pages/Home.tsx @@ -4,8 +4,8 @@ import MemoView from "@/components/MemoView"; import PagedMemoList from "@/components/PagedMemoList"; import { useMemoFilters, useMemoSorting } from "@/hooks"; import useCurrentUser from "@/hooks/useCurrentUser"; -import { State } from "@/types/proto/api/v1/common"; -import { Memo } from "@/types/proto/api/v1/memo_service"; +import { State } from "@/types/proto/api/v1/common_pb"; +import { Memo } from "@/types/proto/api/v1/memo_service_pb"; const Home = observer(() => { const user = useCurrentUser(); diff --git a/web/src/pages/Inboxes.tsx b/web/src/pages/Inboxes.tsx index 169897101..c153c4b5d 100644 --- a/web/src/pages/Inboxes.tsx +++ b/web/src/pages/Inboxes.tsx @@ -1,3 +1,4 @@ +import { timestampDate } from "@bufbuild/protobuf/wkt"; import { sortBy } from "lodash-es"; import { ArchiveIcon, BellIcon, InboxIcon } from "lucide-react"; import { observer } from "mobx-react-lite"; @@ -8,7 +9,7 @@ import MobileHeader from "@/components/MobileHeader"; import useResponsiveWidth from "@/hooks/useResponsiveWidth"; import { cn } from "@/lib/utils"; import { userStore } from "@/store"; -import { UserNotification, UserNotification_Status, UserNotification_Type } from "@/types/proto/api/v1/user_service"; +import { UserNotification, UserNotification_Status, UserNotification_Type } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; const Inboxes = observer(() => { @@ -17,7 +18,7 @@ const Inboxes = observer(() => { const [filter, setFilter] = useState<"all" | "unread" | "archived">("all"); const allNotifications = sortBy(userStore.state.notifications, (notification: UserNotification) => { - return -(notification.createTime?.getTime() || 0); + return -((notification.createTime ? timestampDate(notification.createTime) : undefined)?.getTime() || 0); }); const notifications = allNotifications.filter((notification) => { diff --git a/web/src/pages/MemoDetail.tsx b/web/src/pages/MemoDetail.tsx index 2444826e8..4a56e0c4a 100644 --- a/web/src/pages/MemoDetail.tsx +++ b/web/src/pages/MemoDetail.tsx @@ -1,6 +1,6 @@ +import { ConnectError } from "@connectrpc/connect"; import { ArrowUpLeftFromCircleIcon, MessageCircleIcon } from "lucide-react"; import { observer } from "mobx-react-lite"; -import { ClientError } from "nice-grpc-web"; import { useEffect, useState } from "react"; import { toast } from "react-hot-toast"; import { Link, useLocation, useParams } from "react-router-dom"; @@ -15,7 +15,7 @@ import useResponsiveWidth from "@/hooks/useResponsiveWidth"; import { cn } from "@/lib/utils"; import { memoStore } from "@/store"; import { memoNamePrefix } from "@/store/common"; -import { Memo, MemoRelation_Type } from "@/types/proto/api/v1/memo_service"; +import { Memo, MemoRelation_Type } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; const MemoDetail = observer(() => { @@ -38,8 +38,8 @@ const MemoDetail = observer(() => { // Prepare memo. useEffect(() => { if (memoName) { - memoStore.getOrFetchMemoByName(memoName).catch((error: ClientError) => { - toast.error(error.details); + memoStore.getOrFetchMemoByName(memoName).catch((error: ConnectError) => { + toast.error(error.message); navigateTo("/403"); }); } else { diff --git a/web/src/pages/Setting.tsx b/web/src/pages/Setting.tsx index 527642433..e80f13b4e 100644 --- a/web/src/pages/Setting.tsx +++ b/web/src/pages/Setting.tsx @@ -15,8 +15,8 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@ import useCurrentUser from "@/hooks/useCurrentUser"; import useResponsiveWidth from "@/hooks/useResponsiveWidth"; import { instanceStore } from "@/store"; -import { InstanceSetting_Key } from "@/types/proto/api/v1/instance_service"; -import { User_Role } from "@/types/proto/api/v1/user_service"; +import { InstanceSetting_Key } from "@/types/proto/api/v1/instance_service_pb"; +import { User_Role } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; type SettingSection = "my-account" | "preference" | "member" | "system" | "memo-related" | "storage" | "sso"; diff --git a/web/src/pages/SignIn.tsx b/web/src/pages/SignIn.tsx index d1b29bcf5..7eb043e3d 100644 --- a/web/src/pages/SignIn.tsx +++ b/web/src/pages/SignIn.tsx @@ -12,7 +12,7 @@ import useCurrentUser from "@/hooks/useCurrentUser"; import { Routes } from "@/router"; import { instanceStore } from "@/store"; import { extractIdentityProviderIdFromName } from "@/store/common"; -import { IdentityProvider, IdentityProvider_Type } from "@/types/proto/api/v1/idp_service"; +import { IdentityProvider, IdentityProvider_Type } from "@/types/proto/api/v1/idp_service_pb"; import { useTranslate } from "@/utils/i18n"; import { storeOAuthState } from "@/utils/oauth"; @@ -41,7 +41,7 @@ const SignIn = observer(() => { const handleSignInWithIdentityProvider = async (identityProvider: IdentityProvider) => { if (identityProvider.type === IdentityProvider_Type.OAUTH2) { const redirectUri = absolutifyLink("/auth/callback"); - const oauth2Config = identityProvider.config?.oauth2Config; + const oauth2Config = identityProvider.config?.config?.case === "oauth2Config" ? identityProvider.config.config.value : undefined; if (!oauth2Config) { toast.error("Identity provider configuration is invalid."); return; diff --git a/web/src/pages/SignUp.tsx b/web/src/pages/SignUp.tsx index 93647af9b..d2b6717a6 100644 --- a/web/src/pages/SignUp.tsx +++ b/web/src/pages/SignUp.tsx @@ -1,6 +1,7 @@ +import { create } from "@bufbuild/protobuf"; +import { ConnectError } from "@connectrpc/connect"; import { LoaderIcon } from "lucide-react"; import { observer } from "mobx-react-lite"; -import { ClientError } from "nice-grpc-web"; import { useState } from "react"; import { toast } from "react-hot-toast"; import { Link } from "react-router-dom"; @@ -12,7 +13,7 @@ import useLoading from "@/hooks/useLoading"; import useNavigateTo from "@/hooks/useNavigateTo"; import { instanceStore } from "@/store"; import { initialUserStore } from "@/store/user"; -import { User, User_Role } from "@/types/proto/api/v1/user_service"; +import { User, User_Role, UserSchema } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; const SignUp = observer(() => { @@ -49,20 +50,23 @@ const SignUp = observer(() => { try { actionBtnLoadingState.setLoading(); - const user = User.fromPartial({ + const user = create(UserSchema, { username, password, role: User_Role.USER, }); await userServiceClient.createUser({ user }); await authServiceClient.createSession({ - passwordCredentials: { username, password }, + credentials: { + case: "passwordCredentials", + value: { username, password }, + }, }); await initialUserStore(); navigateTo("/"); } catch (error: any) { console.error(error); - toast.error((error as ClientError).details || "Sign up failed"); + toast.error((error as ConnectError).message || "Sign up failed"); } actionBtnLoadingState.setFinish(); }; diff --git a/web/src/pages/UserProfile.tsx b/web/src/pages/UserProfile.tsx index 27addd638..ea514cc97 100644 --- a/web/src/pages/UserProfile.tsx +++ b/web/src/pages/UserProfile.tsx @@ -12,9 +12,9 @@ import { Button } from "@/components/ui/button"; import { useMemoFilters, useMemoSorting } from "@/hooks"; import useLoading from "@/hooks/useLoading"; import { userStore } from "@/store"; -import { State } from "@/types/proto/api/v1/common"; -import { Memo } from "@/types/proto/api/v1/memo_service"; -import { User } from "@/types/proto/api/v1/user_service"; +import { State } from "@/types/proto/api/v1/common_pb"; +import { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import { User } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; const UserProfile = observer(() => { diff --git a/web/src/store/attachment.ts b/web/src/store/attachment.ts index 2d53d73cb..f81b727a9 100644 --- a/web/src/store/attachment.ts +++ b/web/src/store/attachment.ts @@ -1,7 +1,7 @@ // Attachment Store - manages file attachment state including uploads and metadata import { computed, makeObservable, observable } from "mobx"; import { attachmentServiceClient } from "@/grpcweb"; -import { Attachment, CreateAttachmentRequest, UpdateAttachmentRequest } from "@/types/proto/api/v1/attachment_service"; +import { Attachment, CreateAttachmentRequest, UpdateAttachmentRequest } from "@/types/proto/api/v1/attachment_service_pb"; import { createServerStore, StandardState } from "./base-store"; import { createRequestKey } from "./store-utils"; @@ -69,21 +69,21 @@ const attachmentStore = (() => { return fetchAttachmentByName(name); }; - const createAttachment = async (request: CreateAttachmentRequest): Promise => { + const createAttachment = async (attachment: Attachment): Promise => { return executeRequest( "", // No deduplication for creates async () => { - const attachment = await attachmentServiceClient.createAttachment(request); + const result = await attachmentServiceClient.createAttachment({ attachment }); // Add to cache state.setPartial({ attachmentMapByName: { ...state.attachmentMapByName, - [attachment.name]: attachment, + [result.name]: result, }, }); - return attachment; + return result; }, "CREATE_ATTACHMENT_FAILED", ); diff --git a/web/src/store/instance.ts b/web/src/store/instance.ts index 68900b832..b62202d78 100644 --- a/web/src/store/instance.ts +++ b/web/src/store/instance.ts @@ -1,27 +1,35 @@ // Instance Store - manages instance-level configuration and settings +import { create } from "@bufbuild/protobuf"; import { uniqBy } from "lodash-es"; import { computed } from "mobx"; import { instanceServiceClient } from "@/grpcweb"; import { InstanceProfile, + InstanceProfileSchema, InstanceSetting, InstanceSetting_GeneralSetting, + InstanceSetting_GeneralSettingSchema, InstanceSetting_Key, InstanceSetting_MemoRelatedSetting, -} from "@/types/proto/api/v1/instance_service"; + InstanceSetting_MemoRelatedSettingSchema, + InstanceSettingSchema, +} from "@/types/proto/api/v1/instance_service_pb"; import { createServerStore, StandardState } from "./base-store"; import { instanceSettingNamePrefix } from "./common"; import { createRequestKey } from "./store-utils"; class InstanceState extends StandardState { - profile: InstanceProfile = InstanceProfile.fromPartial({}); + profile: InstanceProfile = create(InstanceProfileSchema, {}); settings: InstanceSetting[] = []; // Computed property for general settings (memoized) get generalSetting(): InstanceSetting_GeneralSetting { return computed(() => { const setting = this.settings.find((s) => s.name === `${instanceSettingNamePrefix}${InstanceSetting_Key.GENERAL}`); - return setting?.generalSetting || InstanceSetting_GeneralSetting.fromPartial({}); + if (setting?.value.case === "generalSetting") { + return setting.value.value; + } + return create(InstanceSetting_GeneralSettingSchema, {}); }).get(); } @@ -29,7 +37,10 @@ class InstanceState extends StandardState { get memoRelatedSetting(): InstanceSetting_MemoRelatedSetting { return computed(() => { const setting = this.settings.find((s) => s.name === `${instanceSettingNamePrefix}${InstanceSetting_Key.MEMO_RELATED}`); - return setting?.memoRelatedSetting || InstanceSetting_MemoRelatedSetting.fromPartial({}); + if (setting?.value.case === "memoRelatedSetting") { + return setting.value.value; + } + return create(InstanceSetting_MemoRelatedSettingSchema, {}); }).get(); } } @@ -78,7 +89,7 @@ const instanceStore = (() => { const getInstanceSettingByKey = (settingKey: InstanceSetting_Key): InstanceSetting => { const setting = state.settings.find((s) => s.name === `${instanceSettingNamePrefix}${settingKey}`); - return setting || InstanceSetting.fromPartial({}); + return setting || create(InstanceSettingSchema, {}); }; const fetchInstanceProfile = async (): Promise => { diff --git a/web/src/store/memo.ts b/web/src/store/memo.ts index 86ee1b233..ee8f2fa0b 100644 --- a/web/src/store/memo.ts +++ b/web/src/store/memo.ts @@ -1,7 +1,9 @@ +import { create } from "@bufbuild/protobuf"; +import { FieldMaskSchema } from "@bufbuild/protobuf/wkt"; import { uniqueId } from "lodash-es"; import { makeAutoObservable } from "mobx"; import { memoServiceClient } from "@/grpcweb"; -import { CreateMemoRequest, ListMemosRequest, Memo } from "@/types/proto/api/v1/memo_service"; +import { CreateMemoRequest, ListMemosRequest, ListMemosRequestSchema, Memo, MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; import { createRequestKey, RequestDeduplicator, StoreError } from "./store-utils"; import userStore from "./user"; @@ -49,9 +51,7 @@ const memoStore = (() => { try { const { memos, nextPageToken } = await memoServiceClient.listMemos( - { - ...request, - }, + create(ListMemosRequestSchema, request as Record), { signal: controller.signal }, ); @@ -105,8 +105,8 @@ const memoStore = (() => { return state.memoMapByName[name]; }; - const createMemo = async (request: CreateMemoRequest) => { - const memo = await memoServiceClient.createMemo(request); + const createMemo = async (memoToCreate: Memo) => { + const memo = await memoServiceClient.createMemo({ memo: memoToCreate }); const memoMap = { ...state.memoMapByName }; memoMap[memo.name] = memo; state.setPartial({ @@ -134,8 +134,8 @@ const memoStore = (() => { try { // Perform actual server update const memo = await memoServiceClient.updateMemo({ - memo: update, - updateMask, + memo: create(MemoSchema, update as Record), + updateMask: create(FieldMaskSchema, { paths: updateMask }), }); // Confirm with server response diff --git a/web/src/store/user.ts b/web/src/store/user.ts index bf80bce74..94cb47e23 100644 --- a/web/src/store/user.ts +++ b/web/src/store/user.ts @@ -1,7 +1,9 @@ +import { create } from "@bufbuild/protobuf"; +import { FieldMaskSchema } from "@bufbuild/protobuf/wkt"; import { uniqueId } from "lodash-es"; import { computed, makeAutoObservable } from "mobx"; import { authServiceClient, shortcutServiceClient, userServiceClient } from "@/grpcweb"; -import { Shortcut } from "@/types/proto/api/v1/shortcut_service"; +import { Shortcut } from "@/types/proto/api/v1/shortcut_service_pb"; import { User, UserNotification, @@ -11,10 +13,19 @@ import { UserSetting_Key, UserSetting_SessionsSetting, UserSetting_WebhooksSetting, + UserSettingSchema, UserStats, -} from "@/types/proto/api/v1/user_service"; +} from "@/types/proto/api/v1/user_service_pb"; import { createRequestKey, RequestDeduplicator, StoreError } from "./store-utils"; +// Helper to extract setting value from UserSetting oneof +function getSettingValue(setting: UserSetting, caseType: string): T | undefined { + if (setting.value.case === caseType) { + return setting.value.value as T; + } + return undefined; +} + class LocalState { currentUser?: string; userGeneralSetting?: UserSetting_GeneralSetting; @@ -126,10 +137,10 @@ const userStore = (() => { }); }; - const updateUser = async (user: Partial, updateMask: string[]) => { + const updateUser = async (user: Partial, updateMaskPaths: string[]) => { const updatedUser = await userServiceClient.updateUser({ - user, - updateMask, + user: user as User, + updateMask: create(FieldMaskSchema, { paths: updateMaskPaths }), }); state.setPartial({ userMapByName: { @@ -148,24 +159,27 @@ const userStore = (() => { }); }; - const updateUserGeneralSetting = async (generalSetting: Partial, updateMask: string[]) => { + const updateUserGeneralSetting = async (generalSetting: Partial, updateMaskPaths: string[]) => { if (!state.currentUser) { throw new Error("No current user"); } const settingName = `${state.currentUser}/settings/${UserSetting_Key.GENERAL}`; - const userSetting: UserSetting = { + const userSetting = create(UserSettingSchema, { name: settingName, - generalSetting: generalSetting as UserSetting_GeneralSetting, - }; + value: { + case: "generalSetting", + value: generalSetting as UserSetting_GeneralSetting, + }, + }); const updatedUserSetting = await userServiceClient.updateUserSetting({ setting: userSetting, - updateMask: updateMask, + updateMask: create(FieldMaskSchema, { paths: updateMaskPaths }), }); state.setPartial({ - userGeneralSetting: updatedUserSetting.generalSetting, + userGeneralSetting: getSettingValue(updatedUserSetting, "generalSetting"), }); }; @@ -176,12 +190,13 @@ const userStore = (() => { const settingName = `${state.currentUser}/settings/${UserSetting_Key.GENERAL}`; const userSetting = await userServiceClient.getUserSetting({ name: settingName }); + const generalSetting = getSettingValue(userSetting, "generalSetting"); state.setPartial({ - userGeneralSetting: userSetting.generalSetting, + userGeneralSetting: generalSetting, }); - return userSetting.generalSetting; + return generalSetting; }; const fetchUserSettings = async () => { @@ -195,17 +210,19 @@ const userStore = (() => { shortcutServiceClient.listShortcuts({ parent: state.currentUser }), ]); - // Extract and store each setting type - const generalSetting = settings.find((s) => s.generalSetting)?.generalSetting; - const sessionsSetting = settings.find((s) => s.sessionsSetting)?.sessionsSetting; - const accessTokensSetting = settings.find((s) => s.accessTokensSetting)?.accessTokensSetting; - const webhooksSetting = settings.find((s) => s.webhooksSetting)?.webhooksSetting; + // Extract and store each setting type using the oneof pattern + const generalSetting = settings.find((s) => s.value.case === "generalSetting"); + const sessionsSetting = settings.find((s) => s.value.case === "sessionsSetting"); + const accessTokensSetting = settings.find((s) => s.value.case === "accessTokensSetting"); + const webhooksSetting = settings.find((s) => s.value.case === "webhooksSetting"); state.setPartial({ - userGeneralSetting: generalSetting, - userSessionsSetting: sessionsSetting, - userAccessTokensSetting: accessTokensSetting, - userWebhooksSetting: webhooksSetting, + userGeneralSetting: generalSetting ? getSettingValue(generalSetting, "generalSetting") : undefined, + userSessionsSetting: sessionsSetting ? getSettingValue(sessionsSetting, "sessionsSetting") : undefined, + userAccessTokensSetting: accessTokensSetting + ? getSettingValue(accessTokensSetting, "accessTokensSetting") + : undefined, + userWebhooksSetting: webhooksSetting ? getSettingValue(webhooksSetting, "webhooksSetting") : undefined, shortcuts: shortcuts, }); }; @@ -227,10 +244,10 @@ const userStore = (() => { }); }; - const updateNotification = async (notification: Partial, updateMask: string[]) => { + const updateNotification = async (notification: Partial, updateMaskPaths: string[]) => { const updatedNotification = await userServiceClient.updateUserNotification({ - notification, - updateMask, + notification: notification as UserNotification, + updateMask: create(FieldMaskSchema, { paths: updateMaskPaths }), }); state.setPartial({ notifications: state.notifications.map((n) => { diff --git a/web/src/types/proto/api/v1/activity_service.ts b/web/src/types/proto/api/v1/activity_service.ts deleted file mode 100644 index cfdceac74..000000000 --- a/web/src/types/proto/api/v1/activity_service.ts +++ /dev/null @@ -1,675 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: api/v1/activity_service.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { Timestamp } from "../../google/protobuf/timestamp"; - -export const protobufPackage = "memos.api.v1"; - -export interface Activity { - /** - * The name of the activity. - * Format: activities/{id} - */ - name: string; - /** - * The name of the creator. - * Format: users/{user} - */ - creator: string; - /** The type of the activity. */ - type: Activity_Type; - /** The level of the activity. */ - level: Activity_Level; - /** The create time of the activity. */ - createTime?: - | Date - | undefined; - /** The payload of the activity. */ - payload?: ActivityPayload | undefined; -} - -/** Activity types. */ -export enum Activity_Type { - /** TYPE_UNSPECIFIED - Unspecified type. */ - TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED", - /** MEMO_COMMENT - Memo comment activity. */ - MEMO_COMMENT = "MEMO_COMMENT", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function activity_TypeFromJSON(object: any): Activity_Type { - switch (object) { - case 0: - case "TYPE_UNSPECIFIED": - return Activity_Type.TYPE_UNSPECIFIED; - case 1: - case "MEMO_COMMENT": - return Activity_Type.MEMO_COMMENT; - case -1: - case "UNRECOGNIZED": - default: - return Activity_Type.UNRECOGNIZED; - } -} - -export function activity_TypeToNumber(object: Activity_Type): number { - switch (object) { - case Activity_Type.TYPE_UNSPECIFIED: - return 0; - case Activity_Type.MEMO_COMMENT: - return 1; - case Activity_Type.UNRECOGNIZED: - default: - return -1; - } -} - -/** Activity levels. */ -export enum Activity_Level { - /** LEVEL_UNSPECIFIED - Unspecified level. */ - LEVEL_UNSPECIFIED = "LEVEL_UNSPECIFIED", - /** INFO - Info level. */ - INFO = "INFO", - /** WARN - Warn level. */ - WARN = "WARN", - /** ERROR - Error level. */ - ERROR = "ERROR", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function activity_LevelFromJSON(object: any): Activity_Level { - switch (object) { - case 0: - case "LEVEL_UNSPECIFIED": - return Activity_Level.LEVEL_UNSPECIFIED; - case 1: - case "INFO": - return Activity_Level.INFO; - case 2: - case "WARN": - return Activity_Level.WARN; - case 3: - case "ERROR": - return Activity_Level.ERROR; - case -1: - case "UNRECOGNIZED": - default: - return Activity_Level.UNRECOGNIZED; - } -} - -export function activity_LevelToNumber(object: Activity_Level): number { - switch (object) { - case Activity_Level.LEVEL_UNSPECIFIED: - return 0; - case Activity_Level.INFO: - return 1; - case Activity_Level.WARN: - return 2; - case Activity_Level.ERROR: - return 3; - case Activity_Level.UNRECOGNIZED: - default: - return -1; - } -} - -export interface ActivityPayload { - /** Memo comment activity payload. */ - memoComment?: ActivityMemoCommentPayload | undefined; -} - -/** ActivityMemoCommentPayload represents the payload of a memo comment activity. */ -export interface ActivityMemoCommentPayload { - /** - * The memo name of comment. - * Format: memos/{memo} - */ - memo: string; - /** - * The name of related memo. - * Format: memos/{memo} - */ - relatedMemo: string; -} - -export interface ListActivitiesRequest { - /** - * The maximum number of activities to return. - * The service may return fewer than this value. - * If unspecified, at most 100 activities will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - pageSize: number; - /** - * A page token, received from a previous `ListActivities` call. - * Provide this to retrieve the subsequent page. - */ - pageToken: string; -} - -export interface ListActivitiesResponse { - /** The activities. */ - activities: Activity[]; - /** - * A token to retrieve the next page of results. - * Pass this value in the page_token field in the subsequent call to `ListActivities` - * method to retrieve the next page of results. - */ - nextPageToken: string; -} - -export interface GetActivityRequest { - /** - * The name of the activity. - * Format: activities/{id}, id is the system generated auto-incremented id. - */ - name: string; -} - -function createBaseActivity(): Activity { - return { - name: "", - creator: "", - type: Activity_Type.TYPE_UNSPECIFIED, - level: Activity_Level.LEVEL_UNSPECIFIED, - createTime: undefined, - payload: undefined, - }; -} - -export const Activity: MessageFns = { - encode(message: Activity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.creator !== "") { - writer.uint32(18).string(message.creator); - } - if (message.type !== Activity_Type.TYPE_UNSPECIFIED) { - writer.uint32(24).int32(activity_TypeToNumber(message.type)); - } - if (message.level !== Activity_Level.LEVEL_UNSPECIFIED) { - writer.uint32(32).int32(activity_LevelToNumber(message.level)); - } - if (message.createTime !== undefined) { - Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).join(); - } - if (message.payload !== undefined) { - ActivityPayload.encode(message.payload, writer.uint32(50).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Activity { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseActivity(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.creator = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.type = activity_TypeFromJSON(reader.int32()); - continue; - } - case 4: { - if (tag !== 32) { - break; - } - - message.level = activity_LevelFromJSON(reader.int32()); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.payload = ActivityPayload.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): Activity { - return Activity.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): Activity { - const message = createBaseActivity(); - message.name = object.name ?? ""; - message.creator = object.creator ?? ""; - message.type = object.type ?? Activity_Type.TYPE_UNSPECIFIED; - message.level = object.level ?? Activity_Level.LEVEL_UNSPECIFIED; - message.createTime = object.createTime ?? undefined; - message.payload = (object.payload !== undefined && object.payload !== null) - ? ActivityPayload.fromPartial(object.payload) - : undefined; - return message; - }, -}; - -function createBaseActivityPayload(): ActivityPayload { - return { memoComment: undefined }; -} - -export const ActivityPayload: MessageFns = { - encode(message: ActivityPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.memoComment !== undefined) { - ActivityMemoCommentPayload.encode(message.memoComment, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ActivityPayload { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseActivityPayload(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.memoComment = ActivityMemoCommentPayload.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ActivityPayload { - return ActivityPayload.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ActivityPayload { - const message = createBaseActivityPayload(); - message.memoComment = (object.memoComment !== undefined && object.memoComment !== null) - ? ActivityMemoCommentPayload.fromPartial(object.memoComment) - : undefined; - return message; - }, -}; - -function createBaseActivityMemoCommentPayload(): ActivityMemoCommentPayload { - return { memo: "", relatedMemo: "" }; -} - -export const ActivityMemoCommentPayload: MessageFns = { - encode(message: ActivityMemoCommentPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.memo !== "") { - writer.uint32(10).string(message.memo); - } - if (message.relatedMemo !== "") { - writer.uint32(18).string(message.relatedMemo); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ActivityMemoCommentPayload { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseActivityMemoCommentPayload(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.memo = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.relatedMemo = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ActivityMemoCommentPayload { - return ActivityMemoCommentPayload.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ActivityMemoCommentPayload { - const message = createBaseActivityMemoCommentPayload(); - message.memo = object.memo ?? ""; - message.relatedMemo = object.relatedMemo ?? ""; - return message; - }, -}; - -function createBaseListActivitiesRequest(): ListActivitiesRequest { - return { pageSize: 0, pageToken: "" }; -} - -export const ListActivitiesRequest: MessageFns = { - encode(message: ListActivitiesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.pageSize !== 0) { - writer.uint32(8).int32(message.pageSize); - } - if (message.pageToken !== "") { - writer.uint32(18).string(message.pageToken); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListActivitiesRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListActivitiesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.pageToken = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListActivitiesRequest { - return ListActivitiesRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListActivitiesRequest { - const message = createBaseListActivitiesRequest(); - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; - return message; - }, -}; - -function createBaseListActivitiesResponse(): ListActivitiesResponse { - return { activities: [], nextPageToken: "" }; -} - -export const ListActivitiesResponse: MessageFns = { - encode(message: ListActivitiesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.activities) { - Activity.encode(v!, writer.uint32(10).fork()).join(); - } - if (message.nextPageToken !== "") { - writer.uint32(18).string(message.nextPageToken); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListActivitiesResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListActivitiesResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.activities.push(Activity.decode(reader, reader.uint32())); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.nextPageToken = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListActivitiesResponse { - return ListActivitiesResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListActivitiesResponse { - const message = createBaseListActivitiesResponse(); - message.activities = object.activities?.map((e) => Activity.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - return message; - }, -}; - -function createBaseGetActivityRequest(): GetActivityRequest { - return { name: "" }; -} - -export const GetActivityRequest: MessageFns = { - encode(message: GetActivityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GetActivityRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetActivityRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GetActivityRequest { - return GetActivityRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GetActivityRequest { - const message = createBaseGetActivityRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -export type ActivityServiceDefinition = typeof ActivityServiceDefinition; -export const ActivityServiceDefinition = { - name: "ActivityService", - fullName: "memos.api.v1.ActivityService", - methods: { - /** ListActivities returns a list of activities. */ - listActivities: { - name: "ListActivities", - requestType: ListActivitiesRequest, - requestStream: false, - responseType: ListActivitiesResponse, - responseStream: false, - options: { - _unknownFields: { - 578365826: [ - new Uint8Array([ - 20, - 18, - 18, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 97, - 99, - 116, - 105, - 118, - 105, - 116, - 105, - 101, - 115, - ]), - ], - }, - }, - }, - /** GetActivity returns the activity with the given id. */ - getActivity: { - name: "GetActivity", - requestType: GetActivityRequest, - requestStream: false, - responseType: Activity, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 29, - 18, - 27, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 97, - 99, - 116, - 105, - 118, - 105, - 116, - 105, - 101, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - }, -} as const; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -function toTimestamp(date: Date): Timestamp { - const seconds = Math.trunc(date.getTime() / 1_000); - const nanos = (date.getTime() % 1_000) * 1_000_000; - return { seconds, nanos }; -} - -function fromTimestamp(t: Timestamp): Date { - let millis = (t.seconds || 0) * 1_000; - millis += (t.nanos || 0) / 1_000_000; - return new globalThis.Date(millis); -} - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/api/v1/activity_service_pb.ts b/web/src/types/proto/api/v1/activity_service_pb.ts new file mode 100644 index 000000000..56fe567be --- /dev/null +++ b/web/src/types/proto/api/v1/activity_service_pb.ts @@ -0,0 +1,304 @@ +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file api/v1/activity_service.proto (package memos.api.v1, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import { file_google_api_annotations } from "../../google/api/annotations_pb"; +import { file_google_api_client } from "../../google/api/client_pb"; +import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; +import { file_google_api_resource } from "../../google/api/resource_pb"; +import type { Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/v1/activity_service.proto. + */ +export const file_api_v1_activity_service: GenFile = /*@__PURE__*/ + fileDesc("Ch1hcGkvdjEvYWN0aXZpdHlfc2VydmljZS5wcm90bxIMbWVtb3MuYXBpLnYxIsEDCghBY3Rpdml0eRIUCgRuYW1lGAEgASgJQgbgQQPgQQgSFAoHY3JlYXRvchgCIAEoCUID4EEDEi4KBHR5cGUYAyABKA4yGy5tZW1vcy5hcGkudjEuQWN0aXZpdHkuVHlwZUID4EEDEjAKBWxldmVsGAQgASgOMhwubWVtb3MuYXBpLnYxLkFjdGl2aXR5LkxldmVsQgPgQQMSNAoLY3JlYXRlX3RpbWUYBSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQMSMwoHcGF5bG9hZBgGIAEoCzIdLm1lbW9zLmFwaS52MS5BY3Rpdml0eVBheWxvYWRCA+BBAyIuCgRUeXBlEhQKEFRZUEVfVU5TUEVDSUZJRUQQABIQCgxNRU1PX0NPTU1FTlQQASI9CgVMZXZlbBIVChFMRVZFTF9VTlNQRUNJRklFRBAAEggKBElORk8QARIICgRXQVJOEAISCQoFRVJST1IQAzpN6kFKChVtZW1vcy5hcGkudjEvQWN0aXZpdHkSFWFjdGl2aXRpZXMve2FjdGl2aXR5fRoEbmFtZSoKYWN0aXZpdGllczIIYWN0aXZpdHkiXgoPQWN0aXZpdHlQYXlsb2FkEkAKDG1lbW9fY29tbWVudBgBIAEoCzIoLm1lbW9zLmFwaS52MS5BY3Rpdml0eU1lbW9Db21tZW50UGF5bG9hZEgAQgkKB3BheWxvYWQiQAoaQWN0aXZpdHlNZW1vQ29tbWVudFBheWxvYWQSDAoEbWVtbxgBIAEoCRIUCgxyZWxhdGVkX21lbW8YAiABKAkiPgoVTGlzdEFjdGl2aXRpZXNSZXF1ZXN0EhEKCXBhZ2Vfc2l6ZRgBIAEoBRISCgpwYWdlX3Rva2VuGAIgASgJIl0KFkxpc3RBY3Rpdml0aWVzUmVzcG9uc2USKgoKYWN0aXZpdGllcxgBIAMoCzIWLm1lbW9zLmFwaS52MS5BY3Rpdml0eRIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkiQQoSR2V0QWN0aXZpdHlSZXF1ZXN0EisKBG5hbWUYASABKAlCHeBBAvpBFwoVbWVtb3MuYXBpLnYxL0FjdGl2aXR5Mv8BCg9BY3Rpdml0eVNlcnZpY2USdwoOTGlzdEFjdGl2aXRpZXMSIy5tZW1vcy5hcGkudjEuTGlzdEFjdGl2aXRpZXNSZXF1ZXN0GiQubWVtb3MuYXBpLnYxLkxpc3RBY3Rpdml0aWVzUmVzcG9uc2UiGoLT5JMCFBISL2FwaS92MS9hY3Rpdml0aWVzEnMKC0dldEFjdGl2aXR5EiAubWVtb3MuYXBpLnYxLkdldEFjdGl2aXR5UmVxdWVzdBoWLm1lbW9zLmFwaS52MS5BY3Rpdml0eSIq2kEEbmFtZYLT5JMCHRIbL2FwaS92MS97bmFtZT1hY3Rpdml0aWVzLyp9QqwBChBjb20ubWVtb3MuYXBpLnYxQhRBY3Rpdml0eVNlcnZpY2VQcm90b1ABWjBnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGkvdjE7YXBpdjGiAgNNQViqAgxNZW1vcy5BcGkuVjHKAgxNZW1vc1xBcGlcVjHiAhhNZW1vc1xBcGlcVjFcR1BCTWV0YWRhdGHqAg5NZW1vczo6QXBpOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_timestamp]); + +/** + * @generated from message memos.api.v1.Activity + */ +export type Activity = Message<"memos.api.v1.Activity"> & { + /** + * The name of the activity. + * Format: activities/{id} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * The name of the creator. + * Format: users/{user} + * + * @generated from field: string creator = 2; + */ + creator: string; + + /** + * The type of the activity. + * + * @generated from field: memos.api.v1.Activity.Type type = 3; + */ + type: Activity_Type; + + /** + * The level of the activity. + * + * @generated from field: memos.api.v1.Activity.Level level = 4; + */ + level: Activity_Level; + + /** + * The create time of the activity. + * + * @generated from field: google.protobuf.Timestamp create_time = 5; + */ + createTime?: Timestamp; + + /** + * The payload of the activity. + * + * @generated from field: memos.api.v1.ActivityPayload payload = 6; + */ + payload?: ActivityPayload; +}; + +/** + * Describes the message memos.api.v1.Activity. + * Use `create(ActivitySchema)` to create a new message. + */ +export const ActivitySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_activity_service, 0); + +/** + * Activity types. + * + * @generated from enum memos.api.v1.Activity.Type + */ +export enum Activity_Type { + /** + * Unspecified type. + * + * @generated from enum value: TYPE_UNSPECIFIED = 0; + */ + TYPE_UNSPECIFIED = 0, + + /** + * Memo comment activity. + * + * @generated from enum value: MEMO_COMMENT = 1; + */ + MEMO_COMMENT = 1, +} + +/** + * Describes the enum memos.api.v1.Activity.Type. + */ +export const Activity_TypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_v1_activity_service, 0, 0); + +/** + * Activity levels. + * + * @generated from enum memos.api.v1.Activity.Level + */ +export enum Activity_Level { + /** + * Unspecified level. + * + * @generated from enum value: LEVEL_UNSPECIFIED = 0; + */ + LEVEL_UNSPECIFIED = 0, + + /** + * Info level. + * + * @generated from enum value: INFO = 1; + */ + INFO = 1, + + /** + * Warn level. + * + * @generated from enum value: WARN = 2; + */ + WARN = 2, + + /** + * Error level. + * + * @generated from enum value: ERROR = 3; + */ + ERROR = 3, +} + +/** + * Describes the enum memos.api.v1.Activity.Level. + */ +export const Activity_LevelSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_v1_activity_service, 0, 1); + +/** + * @generated from message memos.api.v1.ActivityPayload + */ +export type ActivityPayload = Message<"memos.api.v1.ActivityPayload"> & { + /** + * @generated from oneof memos.api.v1.ActivityPayload.payload + */ + payload: { + /** + * Memo comment activity payload. + * + * @generated from field: memos.api.v1.ActivityMemoCommentPayload memo_comment = 1; + */ + value: ActivityMemoCommentPayload; + case: "memoComment"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.v1.ActivityPayload. + * Use `create(ActivityPayloadSchema)` to create a new message. + */ +export const ActivityPayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_activity_service, 1); + +/** + * ActivityMemoCommentPayload represents the payload of a memo comment activity. + * + * @generated from message memos.api.v1.ActivityMemoCommentPayload + */ +export type ActivityMemoCommentPayload = Message<"memos.api.v1.ActivityMemoCommentPayload"> & { + /** + * The memo name of comment. + * Format: memos/{memo} + * + * @generated from field: string memo = 1; + */ + memo: string; + + /** + * The name of related memo. + * Format: memos/{memo} + * + * @generated from field: string related_memo = 2; + */ + relatedMemo: string; +}; + +/** + * Describes the message memos.api.v1.ActivityMemoCommentPayload. + * Use `create(ActivityMemoCommentPayloadSchema)` to create a new message. + */ +export const ActivityMemoCommentPayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_activity_service, 2); + +/** + * @generated from message memos.api.v1.ListActivitiesRequest + */ +export type ListActivitiesRequest = Message<"memos.api.v1.ListActivitiesRequest"> & { + /** + * The maximum number of activities to return. + * The service may return fewer than this value. + * If unspecified, at most 100 activities will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * @generated from field: int32 page_size = 1; + */ + pageSize: number; + + /** + * A page token, received from a previous `ListActivities` call. + * Provide this to retrieve the subsequent page. + * + * @generated from field: string page_token = 2; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.v1.ListActivitiesRequest. + * Use `create(ListActivitiesRequestSchema)` to create a new message. + */ +export const ListActivitiesRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_activity_service, 3); + +/** + * @generated from message memos.api.v1.ListActivitiesResponse + */ +export type ListActivitiesResponse = Message<"memos.api.v1.ListActivitiesResponse"> & { + /** + * The activities. + * + * @generated from field: repeated memos.api.v1.Activity activities = 1; + */ + activities: Activity[]; + + /** + * A token to retrieve the next page of results. + * Pass this value in the page_token field in the subsequent call to `ListActivities` + * method to retrieve the next page of results. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.v1.ListActivitiesResponse. + * Use `create(ListActivitiesResponseSchema)` to create a new message. + */ +export const ListActivitiesResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_activity_service, 4); + +/** + * @generated from message memos.api.v1.GetActivityRequest + */ +export type GetActivityRequest = Message<"memos.api.v1.GetActivityRequest"> & { + /** + * The name of the activity. + * Format: activities/{id}, id is the system generated auto-incremented id. + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.GetActivityRequest. + * Use `create(GetActivityRequestSchema)` to create a new message. + */ +export const GetActivityRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_activity_service, 5); + +/** + * @generated from service memos.api.v1.ActivityService + */ +export const ActivityService: GenService<{ + /** + * ListActivities returns a list of activities. + * + * @generated from rpc memos.api.v1.ActivityService.ListActivities + */ + listActivities: { + methodKind: "unary"; + input: typeof ListActivitiesRequestSchema; + output: typeof ListActivitiesResponseSchema; + }, + /** + * GetActivity returns the activity with the given id. + * + * @generated from rpc memos.api.v1.ActivityService.GetActivity + */ + getActivity: { + methodKind: "unary"; + input: typeof GetActivityRequestSchema; + output: typeof ActivitySchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_v1_activity_service, 0); + diff --git a/web/src/types/proto/api/v1/attachment_service.ts b/web/src/types/proto/api/v1/attachment_service.ts deleted file mode 100644 index 0e536a94b..000000000 --- a/web/src/types/proto/api/v1/attachment_service.ts +++ /dev/null @@ -1,947 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: api/v1/attachment_service.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { Empty } from "../../google/protobuf/empty"; -import { FieldMask } from "../../google/protobuf/field_mask"; -import { Timestamp } from "../../google/protobuf/timestamp"; - -export const protobufPackage = "memos.api.v1"; - -export interface Attachment { - /** - * The name of the attachment. - * Format: attachments/{attachment} - */ - name: string; - /** Output only. The creation timestamp. */ - createTime?: - | Date - | undefined; - /** The filename of the attachment. */ - filename: string; - /** Input only. The content of the attachment. */ - content: Uint8Array; - /** Optional. The external link of the attachment. */ - externalLink: string; - /** The MIME type of the attachment. */ - type: string; - /** Output only. The size of the attachment in bytes. */ - size: number; - /** - * Optional. The related memo. Refer to `Memo.name`. - * Format: memos/{memo} - */ - memo?: string | undefined; -} - -export interface CreateAttachmentRequest { - /** Required. The attachment to create. */ - attachment?: - | Attachment - | undefined; - /** - * Optional. The attachment ID to use for this attachment. - * If empty, a unique ID will be generated. - */ - attachmentId: string; -} - -export interface ListAttachmentsRequest { - /** - * Optional. The maximum number of attachments to return. - * The service may return fewer than this value. - * If unspecified, at most 50 attachments will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - pageSize: number; - /** - * Optional. A page token, received from a previous `ListAttachments` call. - * Provide this to retrieve the subsequent page. - */ - pageToken: string; - /** - * Optional. Filter to apply to the list results. - * Example: "type=image/png" or "filename:*.jpg" - * Supported operators: =, !=, <, <=, >, >=, : - * Supported fields: filename, type, size, create_time, memo - */ - filter: string; - /** - * Optional. The order to sort results by. - * Example: "create_time desc" or "filename asc" - */ - orderBy: string; -} - -export interface ListAttachmentsResponse { - /** The list of attachments. */ - attachments: Attachment[]; - /** - * A token that can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - */ - nextPageToken: string; - /** The total count of attachments (may be approximate). */ - totalSize: number; -} - -export interface GetAttachmentRequest { - /** - * Required. The attachment name of the attachment to retrieve. - * Format: attachments/{attachment} - */ - name: string; -} - -export interface UpdateAttachmentRequest { - /** Required. The attachment which replaces the attachment on the server. */ - attachment?: - | Attachment - | undefined; - /** Required. The list of fields to update. */ - updateMask?: string[] | undefined; -} - -export interface DeleteAttachmentRequest { - /** - * Required. The attachment name of the attachment to delete. - * Format: attachments/{attachment} - */ - name: string; -} - -function createBaseAttachment(): Attachment { - return { - name: "", - createTime: undefined, - filename: "", - content: new Uint8Array(0), - externalLink: "", - type: "", - size: 0, - memo: undefined, - }; -} - -export const Attachment: MessageFns = { - encode(message: Attachment, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.createTime !== undefined) { - Timestamp.encode(toTimestamp(message.createTime), writer.uint32(18).fork()).join(); - } - if (message.filename !== "") { - writer.uint32(26).string(message.filename); - } - if (message.content.length !== 0) { - writer.uint32(34).bytes(message.content); - } - if (message.externalLink !== "") { - writer.uint32(42).string(message.externalLink); - } - if (message.type !== "") { - writer.uint32(50).string(message.type); - } - if (message.size !== 0) { - writer.uint32(56).int64(message.size); - } - if (message.memo !== undefined) { - writer.uint32(66).string(message.memo); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Attachment { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAttachment(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.filename = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.content = reader.bytes(); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.externalLink = reader.string(); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.type = reader.string(); - continue; - } - case 7: { - if (tag !== 56) { - break; - } - - message.size = longToNumber(reader.int64()); - continue; - } - case 8: { - if (tag !== 66) { - break; - } - - message.memo = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): Attachment { - return Attachment.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): Attachment { - const message = createBaseAttachment(); - message.name = object.name ?? ""; - message.createTime = object.createTime ?? undefined; - message.filename = object.filename ?? ""; - message.content = object.content ?? new Uint8Array(0); - message.externalLink = object.externalLink ?? ""; - message.type = object.type ?? ""; - message.size = object.size ?? 0; - message.memo = object.memo ?? undefined; - return message; - }, -}; - -function createBaseCreateAttachmentRequest(): CreateAttachmentRequest { - return { attachment: undefined, attachmentId: "" }; -} - -export const CreateAttachmentRequest: MessageFns = { - encode(message: CreateAttachmentRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.attachment !== undefined) { - Attachment.encode(message.attachment, writer.uint32(10).fork()).join(); - } - if (message.attachmentId !== "") { - writer.uint32(18).string(message.attachmentId); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CreateAttachmentRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateAttachmentRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.attachment = Attachment.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.attachmentId = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CreateAttachmentRequest { - return CreateAttachmentRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CreateAttachmentRequest { - const message = createBaseCreateAttachmentRequest(); - message.attachment = (object.attachment !== undefined && object.attachment !== null) - ? Attachment.fromPartial(object.attachment) - : undefined; - message.attachmentId = object.attachmentId ?? ""; - return message; - }, -}; - -function createBaseListAttachmentsRequest(): ListAttachmentsRequest { - return { pageSize: 0, pageToken: "", filter: "", orderBy: "" }; -} - -export const ListAttachmentsRequest: MessageFns = { - encode(message: ListAttachmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.pageSize !== 0) { - writer.uint32(8).int32(message.pageSize); - } - if (message.pageToken !== "") { - writer.uint32(18).string(message.pageToken); - } - if (message.filter !== "") { - writer.uint32(26).string(message.filter); - } - if (message.orderBy !== "") { - writer.uint32(34).string(message.orderBy); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListAttachmentsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListAttachmentsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.pageToken = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.filter = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.orderBy = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListAttachmentsRequest { - return ListAttachmentsRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListAttachmentsRequest { - const message = createBaseListAttachmentsRequest(); - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; - message.filter = object.filter ?? ""; - message.orderBy = object.orderBy ?? ""; - return message; - }, -}; - -function createBaseListAttachmentsResponse(): ListAttachmentsResponse { - return { attachments: [], nextPageToken: "", totalSize: 0 }; -} - -export const ListAttachmentsResponse: MessageFns = { - encode(message: ListAttachmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.attachments) { - Attachment.encode(v!, writer.uint32(10).fork()).join(); - } - if (message.nextPageToken !== "") { - writer.uint32(18).string(message.nextPageToken); - } - if (message.totalSize !== 0) { - writer.uint32(24).int32(message.totalSize); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListAttachmentsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListAttachmentsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.attachments.push(Attachment.decode(reader, reader.uint32())); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.nextPageToken = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.totalSize = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListAttachmentsResponse { - return ListAttachmentsResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListAttachmentsResponse { - const message = createBaseListAttachmentsResponse(); - message.attachments = object.attachments?.map((e) => Attachment.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - message.totalSize = object.totalSize ?? 0; - return message; - }, -}; - -function createBaseGetAttachmentRequest(): GetAttachmentRequest { - return { name: "" }; -} - -export const GetAttachmentRequest: MessageFns = { - encode(message: GetAttachmentRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GetAttachmentRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAttachmentRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GetAttachmentRequest { - return GetAttachmentRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GetAttachmentRequest { - const message = createBaseGetAttachmentRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseUpdateAttachmentRequest(): UpdateAttachmentRequest { - return { attachment: undefined, updateMask: undefined }; -} - -export const UpdateAttachmentRequest: MessageFns = { - encode(message: UpdateAttachmentRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.attachment !== undefined) { - Attachment.encode(message.attachment, writer.uint32(10).fork()).join(); - } - if (message.updateMask !== undefined) { - FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UpdateAttachmentRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpdateAttachmentRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.attachment = Attachment.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UpdateAttachmentRequest { - return UpdateAttachmentRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UpdateAttachmentRequest { - const message = createBaseUpdateAttachmentRequest(); - message.attachment = (object.attachment !== undefined && object.attachment !== null) - ? Attachment.fromPartial(object.attachment) - : undefined; - message.updateMask = object.updateMask ?? undefined; - return message; - }, -}; - -function createBaseDeleteAttachmentRequest(): DeleteAttachmentRequest { - return { name: "" }; -} - -export const DeleteAttachmentRequest: MessageFns = { - encode(message: DeleteAttachmentRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DeleteAttachmentRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeleteAttachmentRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DeleteAttachmentRequest { - return DeleteAttachmentRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DeleteAttachmentRequest { - const message = createBaseDeleteAttachmentRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -export type AttachmentServiceDefinition = typeof AttachmentServiceDefinition; -export const AttachmentServiceDefinition = { - name: "AttachmentService", - fullName: "memos.api.v1.AttachmentService", - methods: { - /** CreateAttachment creates a new attachment. */ - createAttachment: { - name: "CreateAttachment", - requestType: CreateAttachmentRequest, - requestStream: false, - responseType: Attachment, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([10, 97, 116, 116, 97, 99, 104, 109, 101, 110, 116])], - 578365826: [ - new Uint8Array([ - 33, - 58, - 10, - 97, - 116, - 116, - 97, - 99, - 104, - 109, - 101, - 110, - 116, - 34, - 19, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 97, - 116, - 116, - 97, - 99, - 104, - 109, - 101, - 110, - 116, - 115, - ]), - ], - }, - }, - }, - /** ListAttachments lists all attachments. */ - listAttachments: { - name: "ListAttachments", - requestType: ListAttachmentsRequest, - requestStream: false, - responseType: ListAttachmentsResponse, - responseStream: false, - options: { - _unknownFields: { - 578365826: [ - new Uint8Array([ - 21, - 18, - 19, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 97, - 116, - 116, - 97, - 99, - 104, - 109, - 101, - 110, - 116, - 115, - ]), - ], - }, - }, - }, - /** GetAttachment returns a attachment by name. */ - getAttachment: { - name: "GetAttachment", - requestType: GetAttachmentRequest, - requestStream: false, - responseType: Attachment, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 30, - 18, - 28, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 97, - 116, - 116, - 97, - 99, - 104, - 109, - 101, - 110, - 116, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** UpdateAttachment updates a attachment. */ - updateAttachment: { - name: "UpdateAttachment", - requestType: UpdateAttachmentRequest, - requestStream: false, - responseType: Attachment, - responseStream: false, - options: { - _unknownFields: { - 8410: [ - new Uint8Array([ - 22, - 97, - 116, - 116, - 97, - 99, - 104, - 109, - 101, - 110, - 116, - 44, - 117, - 112, - 100, - 97, - 116, - 101, - 95, - 109, - 97, - 115, - 107, - ]), - ], - 578365826: [ - new Uint8Array([ - 53, - 58, - 10, - 97, - 116, - 116, - 97, - 99, - 104, - 109, - 101, - 110, - 116, - 50, - 39, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 97, - 116, - 116, - 97, - 99, - 104, - 109, - 101, - 110, - 116, - 46, - 110, - 97, - 109, - 101, - 61, - 97, - 116, - 116, - 97, - 99, - 104, - 109, - 101, - 110, - 116, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** DeleteAttachment deletes a attachment by name. */ - deleteAttachment: { - name: "DeleteAttachment", - requestType: DeleteAttachmentRequest, - requestStream: false, - responseType: Empty, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 30, - 42, - 28, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 97, - 116, - 116, - 97, - 99, - 104, - 109, - 101, - 110, - 116, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - }, -} as const; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -function toTimestamp(date: Date): Timestamp { - const seconds = Math.trunc(date.getTime() / 1_000); - const nanos = (date.getTime() % 1_000) * 1_000_000; - return { seconds, nanos }; -} - -function fromTimestamp(t: Timestamp): Date { - let millis = (t.seconds || 0) * 1_000; - millis += (t.nanos || 0) / 1_000_000; - return new globalThis.Date(millis); -} - -function longToNumber(int64: { toString(): string }): number { - const num = globalThis.Number(int64.toString()); - if (num > globalThis.Number.MAX_SAFE_INTEGER) { - throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); - } - if (num < globalThis.Number.MIN_SAFE_INTEGER) { - throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); - } - return num; -} - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/api/v1/attachment_service_pb.ts b/web/src/types/proto/api/v1/attachment_service_pb.ts new file mode 100644 index 000000000..d0a640723 --- /dev/null +++ b/web/src/types/proto/api/v1/attachment_service_pb.ts @@ -0,0 +1,322 @@ +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file api/v1/attachment_service.proto (package memos.api.v1, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import { file_google_api_annotations } from "../../google/api/annotations_pb"; +import { file_google_api_client } from "../../google/api/client_pb"; +import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; +import { file_google_api_resource } from "../../google/api/resource_pb"; +import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/v1/attachment_service.proto. + */ +export const file_api_v1_attachment_service: GenFile = /*@__PURE__*/ + fileDesc("Ch9hcGkvdjEvYXR0YWNobWVudF9zZXJ2aWNlLnByb3RvEgxtZW1vcy5hcGkudjEitgIKCkF0dGFjaG1lbnQSEQoEbmFtZRgBIAEoCUID4EEIEjQKC2NyZWF0ZV90aW1lGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDEhUKCGZpbGVuYW1lGAMgASgJQgPgQQISFAoHY29udGVudBgEIAEoDEID4EEEEhoKDWV4dGVybmFsX2xpbmsYBSABKAlCA+BBARIRCgR0eXBlGAYgASgJQgPgQQISEQoEc2l6ZRgHIAEoA0ID4EEDEhYKBG1lbW8YCCABKAlCA+BBAUgAiAEBOk/qQUwKF21lbW9zLmFwaS52MS9BdHRhY2htZW50EhhhdHRhY2htZW50cy97YXR0YWNobWVudH0qC2F0dGFjaG1lbnRzMgphdHRhY2htZW50QgcKBV9tZW1vImgKF0NyZWF0ZUF0dGFjaG1lbnRSZXF1ZXN0EjEKCmF0dGFjaG1lbnQYASABKAsyGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudEID4EECEhoKDWF0dGFjaG1lbnRfaWQYAiABKAlCA+BBASJ1ChZMaXN0QXR0YWNobWVudHNSZXF1ZXN0EhYKCXBhZ2Vfc2l6ZRgBIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAiABKAlCA+BBARITCgZmaWx0ZXIYAyABKAlCA+BBARIVCghvcmRlcl9ieRgEIAEoCUID4EEBInUKF0xpc3RBdHRhY2htZW50c1Jlc3BvbnNlEi0KC2F0dGFjaG1lbnRzGAEgAygLMhgubWVtb3MuYXBpLnYxLkF0dGFjaG1lbnQSFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJEhIKCnRvdGFsX3NpemUYAyABKAUiRQoUR2V0QXR0YWNobWVudFJlcXVlc3QSLQoEbmFtZRgBIAEoCUIf4EEC+kEZChdtZW1vcy5hcGkudjEvQXR0YWNobWVudCKCAQoXVXBkYXRlQXR0YWNobWVudFJlcXVlc3QSMQoKYXR0YWNobWVudBgBIAEoCzIYLm1lbW9zLmFwaS52MS5BdHRhY2htZW50QgPgQQISNAoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQIiSAoXRGVsZXRlQXR0YWNobWVudFJlcXVlc3QSLQoEbmFtZRgBIAEoCUIf4EEC+kEZChdtZW1vcy5hcGkudjEvQXR0YWNobWVudDLEBQoRQXR0YWNobWVudFNlcnZpY2USiQEKEENyZWF0ZUF0dGFjaG1lbnQSJS5tZW1vcy5hcGkudjEuQ3JlYXRlQXR0YWNobWVudFJlcXVlc3QaGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudCI02kEKYXR0YWNobWVudILT5JMCIToKYXR0YWNobWVudCITL2FwaS92MS9hdHRhY2htZW50cxJ7Cg9MaXN0QXR0YWNobWVudHMSJC5tZW1vcy5hcGkudjEuTGlzdEF0dGFjaG1lbnRzUmVxdWVzdBolLm1lbW9zLmFwaS52MS5MaXN0QXR0YWNobWVudHNSZXNwb25zZSIbgtPkkwIVEhMvYXBpL3YxL2F0dGFjaG1lbnRzEnoKDUdldEF0dGFjaG1lbnQSIi5tZW1vcy5hcGkudjEuR2V0QXR0YWNobWVudFJlcXVlc3QaGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudCIr2kEEbmFtZYLT5JMCHhIcL2FwaS92MS97bmFtZT1hdHRhY2htZW50cy8qfRKpAQoQVXBkYXRlQXR0YWNobWVudBIlLm1lbW9zLmFwaS52MS5VcGRhdGVBdHRhY2htZW50UmVxdWVzdBoYLm1lbW9zLmFwaS52MS5BdHRhY2htZW50IlTaQRZhdHRhY2htZW50LHVwZGF0ZV9tYXNrgtPkkwI1OgphdHRhY2htZW50MicvYXBpL3YxL3thdHRhY2htZW50Lm5hbWU9YXR0YWNobWVudHMvKn0SfgoQRGVsZXRlQXR0YWNobWVudBIlLm1lbW9zLmFwaS52MS5EZWxldGVBdHRhY2htZW50UmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIr2kEEbmFtZYLT5JMCHiocL2FwaS92MS97bmFtZT1hdHRhY2htZW50cy8qfUKuAQoQY29tLm1lbW9zLmFwaS52MUIWQXR0YWNobWVudFNlcnZpY2VQcm90b1ABWjBnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGkvdjE7YXBpdjGiAgNNQViqAgxNZW1vcy5BcGkuVjHKAgxNZW1vc1xBcGlcVjHiAhhNZW1vc1xBcGlcVjFcR1BCTWV0YWRhdGHqAg5NZW1vczo6QXBpOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp]); + +/** + * @generated from message memos.api.v1.Attachment + */ +export type Attachment = Message<"memos.api.v1.Attachment"> & { + /** + * The name of the attachment. + * Format: attachments/{attachment} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Output only. The creation timestamp. + * + * @generated from field: google.protobuf.Timestamp create_time = 2; + */ + createTime?: Timestamp; + + /** + * The filename of the attachment. + * + * @generated from field: string filename = 3; + */ + filename: string; + + /** + * Input only. The content of the attachment. + * + * @generated from field: bytes content = 4; + */ + content: Uint8Array; + + /** + * Optional. The external link of the attachment. + * + * @generated from field: string external_link = 5; + */ + externalLink: string; + + /** + * The MIME type of the attachment. + * + * @generated from field: string type = 6; + */ + type: string; + + /** + * Output only. The size of the attachment in bytes. + * + * @generated from field: int64 size = 7; + */ + size: bigint; + + /** + * Optional. The related memo. Refer to `Memo.name`. + * Format: memos/{memo} + * + * @generated from field: optional string memo = 8; + */ + memo?: string; +}; + +/** + * Describes the message memos.api.v1.Attachment. + * Use `create(AttachmentSchema)` to create a new message. + */ +export const AttachmentSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_attachment_service, 0); + +/** + * @generated from message memos.api.v1.CreateAttachmentRequest + */ +export type CreateAttachmentRequest = Message<"memos.api.v1.CreateAttachmentRequest"> & { + /** + * Required. The attachment to create. + * + * @generated from field: memos.api.v1.Attachment attachment = 1; + */ + attachment?: Attachment; + + /** + * Optional. The attachment ID to use for this attachment. + * If empty, a unique ID will be generated. + * + * @generated from field: string attachment_id = 2; + */ + attachmentId: string; +}; + +/** + * Describes the message memos.api.v1.CreateAttachmentRequest. + * Use `create(CreateAttachmentRequestSchema)` to create a new message. + */ +export const CreateAttachmentRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_attachment_service, 1); + +/** + * @generated from message memos.api.v1.ListAttachmentsRequest + */ +export type ListAttachmentsRequest = Message<"memos.api.v1.ListAttachmentsRequest"> & { + /** + * Optional. The maximum number of attachments to return. + * The service may return fewer than this value. + * If unspecified, at most 50 attachments will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * @generated from field: int32 page_size = 1; + */ + pageSize: number; + + /** + * Optional. A page token, received from a previous `ListAttachments` call. + * Provide this to retrieve the subsequent page. + * + * @generated from field: string page_token = 2; + */ + pageToken: string; + + /** + * Optional. Filter to apply to the list results. + * Example: "type=image/png" or "filename:*.jpg" + * Supported operators: =, !=, <, <=, >, >=, : + * Supported fields: filename, type, size, create_time, memo + * + * @generated from field: string filter = 3; + */ + filter: string; + + /** + * Optional. The order to sort results by. + * Example: "create_time desc" or "filename asc" + * + * @generated from field: string order_by = 4; + */ + orderBy: string; +}; + +/** + * Describes the message memos.api.v1.ListAttachmentsRequest. + * Use `create(ListAttachmentsRequestSchema)` to create a new message. + */ +export const ListAttachmentsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_attachment_service, 2); + +/** + * @generated from message memos.api.v1.ListAttachmentsResponse + */ +export type ListAttachmentsResponse = Message<"memos.api.v1.ListAttachmentsResponse"> & { + /** + * The list of attachments. + * + * @generated from field: repeated memos.api.v1.Attachment attachments = 1; + */ + attachments: Attachment[]; + + /** + * A token that can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; + + /** + * The total count of attachments (may be approximate). + * + * @generated from field: int32 total_size = 3; + */ + totalSize: number; +}; + +/** + * Describes the message memos.api.v1.ListAttachmentsResponse. + * Use `create(ListAttachmentsResponseSchema)` to create a new message. + */ +export const ListAttachmentsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_attachment_service, 3); + +/** + * @generated from message memos.api.v1.GetAttachmentRequest + */ +export type GetAttachmentRequest = Message<"memos.api.v1.GetAttachmentRequest"> & { + /** + * Required. The attachment name of the attachment to retrieve. + * Format: attachments/{attachment} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.GetAttachmentRequest. + * Use `create(GetAttachmentRequestSchema)` to create a new message. + */ +export const GetAttachmentRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_attachment_service, 4); + +/** + * @generated from message memos.api.v1.UpdateAttachmentRequest + */ +export type UpdateAttachmentRequest = Message<"memos.api.v1.UpdateAttachmentRequest"> & { + /** + * Required. The attachment which replaces the attachment on the server. + * + * @generated from field: memos.api.v1.Attachment attachment = 1; + */ + attachment?: Attachment; + + /** + * Required. The list of fields to update. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask; +}; + +/** + * Describes the message memos.api.v1.UpdateAttachmentRequest. + * Use `create(UpdateAttachmentRequestSchema)` to create a new message. + */ +export const UpdateAttachmentRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_attachment_service, 5); + +/** + * @generated from message memos.api.v1.DeleteAttachmentRequest + */ +export type DeleteAttachmentRequest = Message<"memos.api.v1.DeleteAttachmentRequest"> & { + /** + * Required. The attachment name of the attachment to delete. + * Format: attachments/{attachment} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.DeleteAttachmentRequest. + * Use `create(DeleteAttachmentRequestSchema)` to create a new message. + */ +export const DeleteAttachmentRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_attachment_service, 6); + +/** + * @generated from service memos.api.v1.AttachmentService + */ +export const AttachmentService: GenService<{ + /** + * CreateAttachment creates a new attachment. + * + * @generated from rpc memos.api.v1.AttachmentService.CreateAttachment + */ + createAttachment: { + methodKind: "unary"; + input: typeof CreateAttachmentRequestSchema; + output: typeof AttachmentSchema; + }, + /** + * ListAttachments lists all attachments. + * + * @generated from rpc memos.api.v1.AttachmentService.ListAttachments + */ + listAttachments: { + methodKind: "unary"; + input: typeof ListAttachmentsRequestSchema; + output: typeof ListAttachmentsResponseSchema; + }, + /** + * GetAttachment returns a attachment by name. + * + * @generated from rpc memos.api.v1.AttachmentService.GetAttachment + */ + getAttachment: { + methodKind: "unary"; + input: typeof GetAttachmentRequestSchema; + output: typeof AttachmentSchema; + }, + /** + * UpdateAttachment updates a attachment. + * + * @generated from rpc memos.api.v1.AttachmentService.UpdateAttachment + */ + updateAttachment: { + methodKind: "unary"; + input: typeof UpdateAttachmentRequestSchema; + output: typeof AttachmentSchema; + }, + /** + * DeleteAttachment deletes a attachment by name. + * + * @generated from rpc memos.api.v1.AttachmentService.DeleteAttachment + */ + deleteAttachment: { + methodKind: "unary"; + input: typeof DeleteAttachmentRequestSchema; + output: typeof EmptySchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_v1_attachment_service, 0); + diff --git a/web/src/types/proto/api/v1/auth_service.ts b/web/src/types/proto/api/v1/auth_service.ts deleted file mode 100644 index 37f94dc40..000000000 --- a/web/src/types/proto/api/v1/auth_service.ts +++ /dev/null @@ -1,658 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: api/v1/auth_service.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { Empty } from "../../google/protobuf/empty"; -import { Timestamp } from "../../google/protobuf/timestamp"; -import { User } from "./user_service"; - -export const protobufPackage = "memos.api.v1"; - -export interface GetCurrentSessionRequest { -} - -export interface GetCurrentSessionResponse { - user?: - | User - | undefined; - /** - * Last time the session was accessed. - * Used for sliding expiration calculation (last_accessed_time + 2 weeks). - */ - lastAccessedAt?: Date | undefined; -} - -export interface CreateSessionRequest { - /** Username and password authentication method. */ - passwordCredentials?: - | CreateSessionRequest_PasswordCredentials - | undefined; - /** SSO provider authentication method. */ - ssoCredentials?: CreateSessionRequest_SSOCredentials | undefined; -} - -/** Nested message for password-based authentication credentials. */ -export interface CreateSessionRequest_PasswordCredentials { - /** - * The username to sign in with. - * Required field for password-based authentication. - */ - username: string; - /** - * The password to sign in with. - * Required field for password-based authentication. - */ - password: string; -} - -/** Nested message for SSO authentication credentials. */ -export interface CreateSessionRequest_SSOCredentials { - /** - * The ID of the SSO provider. - * Required field to identify the SSO provider. - */ - idpId: number; - /** - * The authorization code from the SSO provider. - * Required field for completing the SSO flow. - */ - code: string; - /** - * The redirect URI used in the SSO flow. - * Required field for security validation. - */ - redirectUri: string; - /** - * The PKCE code verifier for enhanced security (RFC 7636). - * Optional field - if provided, enables PKCE flow protection against authorization code interception. - */ - codeVerifier: string; -} - -export interface CreateSessionResponse { - /** The authenticated user information. */ - user?: - | User - | undefined; - /** - * Last time the session was accessed. - * Used for sliding expiration calculation (last_accessed_time + 2 weeks). - */ - lastAccessedAt?: Date | undefined; -} - -export interface DeleteSessionRequest { -} - -function createBaseGetCurrentSessionRequest(): GetCurrentSessionRequest { - return {}; -} - -export const GetCurrentSessionRequest: MessageFns = { - encode(_: GetCurrentSessionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GetCurrentSessionRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetCurrentSessionRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GetCurrentSessionRequest { - return GetCurrentSessionRequest.fromPartial(base ?? {}); - }, - fromPartial(_: DeepPartial): GetCurrentSessionRequest { - const message = createBaseGetCurrentSessionRequest(); - return message; - }, -}; - -function createBaseGetCurrentSessionResponse(): GetCurrentSessionResponse { - return { user: undefined, lastAccessedAt: undefined }; -} - -export const GetCurrentSessionResponse: MessageFns = { - encode(message: GetCurrentSessionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.user !== undefined) { - User.encode(message.user, writer.uint32(10).fork()).join(); - } - if (message.lastAccessedAt !== undefined) { - Timestamp.encode(toTimestamp(message.lastAccessedAt), writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GetCurrentSessionResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetCurrentSessionResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.user = User.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.lastAccessedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GetCurrentSessionResponse { - return GetCurrentSessionResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GetCurrentSessionResponse { - const message = createBaseGetCurrentSessionResponse(); - message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; - message.lastAccessedAt = object.lastAccessedAt ?? undefined; - return message; - }, -}; - -function createBaseCreateSessionRequest(): CreateSessionRequest { - return { passwordCredentials: undefined, ssoCredentials: undefined }; -} - -export const CreateSessionRequest: MessageFns = { - encode(message: CreateSessionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.passwordCredentials !== undefined) { - CreateSessionRequest_PasswordCredentials.encode(message.passwordCredentials, writer.uint32(10).fork()).join(); - } - if (message.ssoCredentials !== undefined) { - CreateSessionRequest_SSOCredentials.encode(message.ssoCredentials, writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CreateSessionRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateSessionRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.passwordCredentials = CreateSessionRequest_PasswordCredentials.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.ssoCredentials = CreateSessionRequest_SSOCredentials.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CreateSessionRequest { - return CreateSessionRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CreateSessionRequest { - const message = createBaseCreateSessionRequest(); - message.passwordCredentials = (object.passwordCredentials !== undefined && object.passwordCredentials !== null) - ? CreateSessionRequest_PasswordCredentials.fromPartial(object.passwordCredentials) - : undefined; - message.ssoCredentials = (object.ssoCredentials !== undefined && object.ssoCredentials !== null) - ? CreateSessionRequest_SSOCredentials.fromPartial(object.ssoCredentials) - : undefined; - return message; - }, -}; - -function createBaseCreateSessionRequest_PasswordCredentials(): CreateSessionRequest_PasswordCredentials { - return { username: "", password: "" }; -} - -export const CreateSessionRequest_PasswordCredentials: MessageFns = { - encode(message: CreateSessionRequest_PasswordCredentials, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.username !== "") { - writer.uint32(10).string(message.username); - } - if (message.password !== "") { - writer.uint32(18).string(message.password); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CreateSessionRequest_PasswordCredentials { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateSessionRequest_PasswordCredentials(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.username = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.password = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CreateSessionRequest_PasswordCredentials { - return CreateSessionRequest_PasswordCredentials.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CreateSessionRequest_PasswordCredentials { - const message = createBaseCreateSessionRequest_PasswordCredentials(); - message.username = object.username ?? ""; - message.password = object.password ?? ""; - return message; - }, -}; - -function createBaseCreateSessionRequest_SSOCredentials(): CreateSessionRequest_SSOCredentials { - return { idpId: 0, code: "", redirectUri: "", codeVerifier: "" }; -} - -export const CreateSessionRequest_SSOCredentials: MessageFns = { - encode(message: CreateSessionRequest_SSOCredentials, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.idpId !== 0) { - writer.uint32(8).int32(message.idpId); - } - if (message.code !== "") { - writer.uint32(18).string(message.code); - } - if (message.redirectUri !== "") { - writer.uint32(26).string(message.redirectUri); - } - if (message.codeVerifier !== "") { - writer.uint32(34).string(message.codeVerifier); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CreateSessionRequest_SSOCredentials { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateSessionRequest_SSOCredentials(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.idpId = reader.int32(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.code = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.redirectUri = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.codeVerifier = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CreateSessionRequest_SSOCredentials { - return CreateSessionRequest_SSOCredentials.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CreateSessionRequest_SSOCredentials { - const message = createBaseCreateSessionRequest_SSOCredentials(); - message.idpId = object.idpId ?? 0; - message.code = object.code ?? ""; - message.redirectUri = object.redirectUri ?? ""; - message.codeVerifier = object.codeVerifier ?? ""; - return message; - }, -}; - -function createBaseCreateSessionResponse(): CreateSessionResponse { - return { user: undefined, lastAccessedAt: undefined }; -} - -export const CreateSessionResponse: MessageFns = { - encode(message: CreateSessionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.user !== undefined) { - User.encode(message.user, writer.uint32(10).fork()).join(); - } - if (message.lastAccessedAt !== undefined) { - Timestamp.encode(toTimestamp(message.lastAccessedAt), writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CreateSessionResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateSessionResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.user = User.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.lastAccessedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CreateSessionResponse { - return CreateSessionResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CreateSessionResponse { - const message = createBaseCreateSessionResponse(); - message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; - message.lastAccessedAt = object.lastAccessedAt ?? undefined; - return message; - }, -}; - -function createBaseDeleteSessionRequest(): DeleteSessionRequest { - return {}; -} - -export const DeleteSessionRequest: MessageFns = { - encode(_: DeleteSessionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DeleteSessionRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeleteSessionRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DeleteSessionRequest { - return DeleteSessionRequest.fromPartial(base ?? {}); - }, - fromPartial(_: DeepPartial): DeleteSessionRequest { - const message = createBaseDeleteSessionRequest(); - return message; - }, -}; - -export type AuthServiceDefinition = typeof AuthServiceDefinition; -export const AuthServiceDefinition = { - name: "AuthService", - fullName: "memos.api.v1.AuthService", - methods: { - /** - * GetCurrentSession returns the current active session information. - * This method is idempotent and safe, suitable for checking current session state. - */ - getCurrentSession: { - name: "GetCurrentSession", - requestType: GetCurrentSessionRequest, - requestStream: false, - responseType: GetCurrentSessionResponse, - responseStream: false, - options: { - _unknownFields: { - 578365826: [ - new Uint8Array([ - 31, - 18, - 29, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 97, - 117, - 116, - 104, - 47, - 115, - 101, - 115, - 115, - 105, - 111, - 110, - 115, - 47, - 99, - 117, - 114, - 114, - 101, - 110, - 116, - ]), - ], - }, - }, - }, - /** - * CreateSession authenticates a user and creates a new session. - * Returns the authenticated user information upon successful authentication. - */ - createSession: { - name: "CreateSession", - requestType: CreateSessionRequest, - requestStream: false, - responseType: CreateSessionResponse, - responseStream: false, - options: { - _unknownFields: { - 578365826: [ - new Uint8Array([ - 26, - 58, - 1, - 42, - 34, - 21, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 97, - 117, - 116, - 104, - 47, - 115, - 101, - 115, - 115, - 105, - 111, - 110, - 115, - ]), - ], - }, - }, - }, - /** - * DeleteSession terminates the current user session. - * This is an idempotent operation that invalidates the user's authentication. - */ - deleteSession: { - name: "DeleteSession", - requestType: DeleteSessionRequest, - requestStream: false, - responseType: Empty, - responseStream: false, - options: { - _unknownFields: { - 578365826: [ - new Uint8Array([ - 31, - 42, - 29, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 97, - 117, - 116, - 104, - 47, - 115, - 101, - 115, - 115, - 105, - 111, - 110, - 115, - 47, - 99, - 117, - 114, - 114, - 101, - 110, - 116, - ]), - ], - }, - }, - }, - }, -} as const; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -function toTimestamp(date: Date): Timestamp { - const seconds = Math.trunc(date.getTime() / 1_000); - const nanos = (date.getTime() % 1_000) * 1_000_000; - return { seconds, nanos }; -} - -function fromTimestamp(t: Timestamp): Date { - let millis = (t.seconds || 0) * 1_000; - millis += (t.nanos || 0) / 1_000_000; - return new globalThis.Date(millis); -} - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/api/v1/auth_service_pb.ts b/web/src/types/proto/api/v1/auth_service_pb.ts new file mode 100644 index 000000000..7be2f8bf4 --- /dev/null +++ b/web/src/types/proto/api/v1/auth_service_pb.ts @@ -0,0 +1,250 @@ +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file api/v1/auth_service.proto (package memos.api.v1, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import type { User } from "./user_service_pb"; +import { file_api_v1_user_service } from "./user_service_pb"; +import { file_google_api_annotations } from "../../google/api/annotations_pb"; +import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; +import type { EmptySchema, Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_empty, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/v1/auth_service.proto. + */ +export const file_api_v1_auth_service: GenFile = /*@__PURE__*/ + fileDesc("ChlhcGkvdjEvYXV0aF9zZXJ2aWNlLnByb3RvEgxtZW1vcy5hcGkudjEiGgoYR2V0Q3VycmVudFNlc3Npb25SZXF1ZXN0InMKGUdldEN1cnJlbnRTZXNzaW9uUmVzcG9uc2USIAoEdXNlchgBIAEoCzISLm1lbW9zLmFwaS52MS5Vc2VyEjQKEGxhc3RfYWNjZXNzZWRfYXQYAiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wIoEDChRDcmVhdGVTZXNzaW9uUmVxdWVzdBJWChRwYXNzd29yZF9jcmVkZW50aWFscxgBIAEoCzI2Lm1lbW9zLmFwaS52MS5DcmVhdGVTZXNzaW9uUmVxdWVzdC5QYXNzd29yZENyZWRlbnRpYWxzSAASTAoPc3NvX2NyZWRlbnRpYWxzGAIgASgLMjEubWVtb3MuYXBpLnYxLkNyZWF0ZVNlc3Npb25SZXF1ZXN0LlNTT0NyZWRlbnRpYWxzSAAaQwoTUGFzc3dvcmRDcmVkZW50aWFscxIVCgh1c2VybmFtZRgBIAEoCUID4EECEhUKCHBhc3N3b3JkGAIgASgJQgPgQQIabwoOU1NPQ3JlZGVudGlhbHMSEwoGaWRwX2lkGAEgASgFQgPgQQISEQoEY29kZRgCIAEoCUID4EECEhkKDHJlZGlyZWN0X3VyaRgDIAEoCUID4EECEhoKDWNvZGVfdmVyaWZpZXIYBCABKAlCA+BBAUINCgtjcmVkZW50aWFscyJvChVDcmVhdGVTZXNzaW9uUmVzcG9uc2USIAoEdXNlchgBIAEoCzISLm1lbW9zLmFwaS52MS5Vc2VyEjQKEGxhc3RfYWNjZXNzZWRfYXQYAiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wIhYKFERlbGV0ZVNlc3Npb25SZXF1ZXN0MosDCgtBdXRoU2VydmljZRKLAQoRR2V0Q3VycmVudFNlc3Npb24SJi5tZW1vcy5hcGkudjEuR2V0Q3VycmVudFNlc3Npb25SZXF1ZXN0GicubWVtb3MuYXBpLnYxLkdldEN1cnJlbnRTZXNzaW9uUmVzcG9uc2UiJYLT5JMCHxIdL2FwaS92MS9hdXRoL3Nlc3Npb25zL2N1cnJlbnQSegoNQ3JlYXRlU2Vzc2lvbhIiLm1lbW9zLmFwaS52MS5DcmVhdGVTZXNzaW9uUmVxdWVzdBojLm1lbW9zLmFwaS52MS5DcmVhdGVTZXNzaW9uUmVzcG9uc2UiIILT5JMCGjoBKiIVL2FwaS92MS9hdXRoL3Nlc3Npb25zEnIKDURlbGV0ZVNlc3Npb24SIi5tZW1vcy5hcGkudjEuRGVsZXRlU2Vzc2lvblJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiJYLT5JMCHyodL2FwaS92MS9hdXRoL3Nlc3Npb25zL2N1cnJlbnRCqAEKEGNvbS5tZW1vcy5hcGkudjFCEEF1dGhTZXJ2aWNlUHJvdG9QAVowZ2l0aHViLmNvbS91c2VtZW1vcy9tZW1vcy9wcm90by9nZW4vYXBpL3YxO2FwaXYxogIDTUFYqgIMTWVtb3MuQXBpLlYxygIMTWVtb3NcQXBpXFYx4gIYTWVtb3NcQXBpXFYxXEdQQk1ldGFkYXRh6gIOTWVtb3M6OkFwaTo6VjFiBnByb3RvMw", [file_api_v1_user_service, file_google_api_annotations, file_google_api_field_behavior, file_google_protobuf_empty, file_google_protobuf_timestamp]); + +/** + * @generated from message memos.api.v1.GetCurrentSessionRequest + */ +export type GetCurrentSessionRequest = Message<"memos.api.v1.GetCurrentSessionRequest"> & { +}; + +/** + * Describes the message memos.api.v1.GetCurrentSessionRequest. + * Use `create(GetCurrentSessionRequestSchema)` to create a new message. + */ +export const GetCurrentSessionRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_auth_service, 0); + +/** + * @generated from message memos.api.v1.GetCurrentSessionResponse + */ +export type GetCurrentSessionResponse = Message<"memos.api.v1.GetCurrentSessionResponse"> & { + /** + * @generated from field: memos.api.v1.User user = 1; + */ + user?: User; + + /** + * Last time the session was accessed. + * Used for sliding expiration calculation (last_accessed_time + 2 weeks). + * + * @generated from field: google.protobuf.Timestamp last_accessed_at = 2; + */ + lastAccessedAt?: Timestamp; +}; + +/** + * Describes the message memos.api.v1.GetCurrentSessionResponse. + * Use `create(GetCurrentSessionResponseSchema)` to create a new message. + */ +export const GetCurrentSessionResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_auth_service, 1); + +/** + * @generated from message memos.api.v1.CreateSessionRequest + */ +export type CreateSessionRequest = Message<"memos.api.v1.CreateSessionRequest"> & { + /** + * Provide one authentication method (username/password or SSO). + * Required field to specify the authentication method. + * + * @generated from oneof memos.api.v1.CreateSessionRequest.credentials + */ + credentials: { + /** + * Username and password authentication method. + * + * @generated from field: memos.api.v1.CreateSessionRequest.PasswordCredentials password_credentials = 1; + */ + value: CreateSessionRequest_PasswordCredentials; + case: "passwordCredentials"; + } | { + /** + * SSO provider authentication method. + * + * @generated from field: memos.api.v1.CreateSessionRequest.SSOCredentials sso_credentials = 2; + */ + value: CreateSessionRequest_SSOCredentials; + case: "ssoCredentials"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.v1.CreateSessionRequest. + * Use `create(CreateSessionRequestSchema)` to create a new message. + */ +export const CreateSessionRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_auth_service, 2); + +/** + * Nested message for password-based authentication credentials. + * + * @generated from message memos.api.v1.CreateSessionRequest.PasswordCredentials + */ +export type CreateSessionRequest_PasswordCredentials = Message<"memos.api.v1.CreateSessionRequest.PasswordCredentials"> & { + /** + * The username to sign in with. + * Required field for password-based authentication. + * + * @generated from field: string username = 1; + */ + username: string; + + /** + * The password to sign in with. + * Required field for password-based authentication. + * + * @generated from field: string password = 2; + */ + password: string; +}; + +/** + * Describes the message memos.api.v1.CreateSessionRequest.PasswordCredentials. + * Use `create(CreateSessionRequest_PasswordCredentialsSchema)` to create a new message. + */ +export const CreateSessionRequest_PasswordCredentialsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_auth_service, 2, 0); + +/** + * Nested message for SSO authentication credentials. + * + * @generated from message memos.api.v1.CreateSessionRequest.SSOCredentials + */ +export type CreateSessionRequest_SSOCredentials = Message<"memos.api.v1.CreateSessionRequest.SSOCredentials"> & { + /** + * The ID of the SSO provider. + * Required field to identify the SSO provider. + * + * @generated from field: int32 idp_id = 1; + */ + idpId: number; + + /** + * The authorization code from the SSO provider. + * Required field for completing the SSO flow. + * + * @generated from field: string code = 2; + */ + code: string; + + /** + * The redirect URI used in the SSO flow. + * Required field for security validation. + * + * @generated from field: string redirect_uri = 3; + */ + redirectUri: string; + + /** + * The PKCE code verifier for enhanced security (RFC 7636). + * Optional field - if provided, enables PKCE flow protection against authorization code interception. + * + * @generated from field: string code_verifier = 4; + */ + codeVerifier: string; +}; + +/** + * Describes the message memos.api.v1.CreateSessionRequest.SSOCredentials. + * Use `create(CreateSessionRequest_SSOCredentialsSchema)` to create a new message. + */ +export const CreateSessionRequest_SSOCredentialsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_auth_service, 2, 1); + +/** + * @generated from message memos.api.v1.CreateSessionResponse + */ +export type CreateSessionResponse = Message<"memos.api.v1.CreateSessionResponse"> & { + /** + * The authenticated user information. + * + * @generated from field: memos.api.v1.User user = 1; + */ + user?: User; + + /** + * Last time the session was accessed. + * Used for sliding expiration calculation (last_accessed_time + 2 weeks). + * + * @generated from field: google.protobuf.Timestamp last_accessed_at = 2; + */ + lastAccessedAt?: Timestamp; +}; + +/** + * Describes the message memos.api.v1.CreateSessionResponse. + * Use `create(CreateSessionResponseSchema)` to create a new message. + */ +export const CreateSessionResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_auth_service, 3); + +/** + * @generated from message memos.api.v1.DeleteSessionRequest + */ +export type DeleteSessionRequest = Message<"memos.api.v1.DeleteSessionRequest"> & { +}; + +/** + * Describes the message memos.api.v1.DeleteSessionRequest. + * Use `create(DeleteSessionRequestSchema)` to create a new message. + */ +export const DeleteSessionRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_auth_service, 4); + +/** + * @generated from service memos.api.v1.AuthService + */ +export const AuthService: GenService<{ + /** + * GetCurrentSession returns the current active session information. + * This method is idempotent and safe, suitable for checking current session state. + * + * @generated from rpc memos.api.v1.AuthService.GetCurrentSession + */ + getCurrentSession: { + methodKind: "unary"; + input: typeof GetCurrentSessionRequestSchema; + output: typeof GetCurrentSessionResponseSchema; + }, + /** + * CreateSession authenticates a user and creates a new session. + * Returns the authenticated user information upon successful authentication. + * + * @generated from rpc memos.api.v1.AuthService.CreateSession + */ + createSession: { + methodKind: "unary"; + input: typeof CreateSessionRequestSchema; + output: typeof CreateSessionResponseSchema; + }, + /** + * DeleteSession terminates the current user session. + * This is an idempotent operation that invalidates the user's authentication. + * + * @generated from rpc memos.api.v1.AuthService.DeleteSession + */ + deleteSession: { + methodKind: "unary"; + input: typeof DeleteSessionRequestSchema; + output: typeof EmptySchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_v1_auth_service, 0); + diff --git a/web/src/types/proto/api/v1/common.ts b/web/src/types/proto/api/v1/common.ts deleted file mode 100644 index d71a08a17..000000000 --- a/web/src/types/proto/api/v1/common.ts +++ /dev/null @@ -1,167 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: api/v1/common.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; - -export const protobufPackage = "memos.api.v1"; - -export enum State { - STATE_UNSPECIFIED = "STATE_UNSPECIFIED", - NORMAL = "NORMAL", - ARCHIVED = "ARCHIVED", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function stateFromJSON(object: any): State { - switch (object) { - case 0: - case "STATE_UNSPECIFIED": - return State.STATE_UNSPECIFIED; - case 1: - case "NORMAL": - return State.NORMAL; - case 2: - case "ARCHIVED": - return State.ARCHIVED; - case -1: - case "UNRECOGNIZED": - default: - return State.UNRECOGNIZED; - } -} - -export function stateToNumber(object: State): number { - switch (object) { - case State.STATE_UNSPECIFIED: - return 0; - case State.NORMAL: - return 1; - case State.ARCHIVED: - return 2; - case State.UNRECOGNIZED: - default: - return -1; - } -} - -export enum Direction { - DIRECTION_UNSPECIFIED = "DIRECTION_UNSPECIFIED", - ASC = "ASC", - DESC = "DESC", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function directionFromJSON(object: any): Direction { - switch (object) { - case 0: - case "DIRECTION_UNSPECIFIED": - return Direction.DIRECTION_UNSPECIFIED; - case 1: - case "ASC": - return Direction.ASC; - case 2: - case "DESC": - return Direction.DESC; - case -1: - case "UNRECOGNIZED": - default: - return Direction.UNRECOGNIZED; - } -} - -export function directionToNumber(object: Direction): number { - switch (object) { - case Direction.DIRECTION_UNSPECIFIED: - return 0; - case Direction.ASC: - return 1; - case Direction.DESC: - return 2; - case Direction.UNRECOGNIZED: - default: - return -1; - } -} - -/** Used internally for obfuscating the page token. */ -export interface PageToken { - limit: number; - offset: number; -} - -function createBasePageToken(): PageToken { - return { limit: 0, offset: 0 }; -} - -export const PageToken: MessageFns = { - encode(message: PageToken, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.limit !== 0) { - writer.uint32(8).int32(message.limit); - } - if (message.offset !== 0) { - writer.uint32(16).int32(message.offset); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): PageToken { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePageToken(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.limit = reader.int32(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.offset = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): PageToken { - return PageToken.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): PageToken { - const message = createBasePageToken(); - message.limit = object.limit ?? 0; - message.offset = object.offset ?? 0; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/api/v1/common_pb.ts b/web/src/types/proto/api/v1/common_pb.ts new file mode 100644 index 000000000..6d7d9feb9 --- /dev/null +++ b/web/src/types/proto/api/v1/common_pb.ts @@ -0,0 +1,90 @@ +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file api/v1/common.proto (package memos.api.v1, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/v1/common.proto. + */ +export const file_api_v1_common: GenFile = /*@__PURE__*/ + fileDesc("ChNhcGkvdjEvY29tbW9uLnByb3RvEgxtZW1vcy5hcGkudjEiKgoJUGFnZVRva2VuEg0KBWxpbWl0GAEgASgFEg4KBm9mZnNldBgCIAEoBSo4CgVTdGF0ZRIVChFTVEFURV9VTlNQRUNJRklFRBAAEgoKBk5PUk1BTBABEgwKCEFSQ0hJVkVEEAIqOQoJRGlyZWN0aW9uEhkKFURJUkVDVElPTl9VTlNQRUNJRklFRBAAEgcKA0FTQxABEggKBERFU0MQAkKjAQoQY29tLm1lbW9zLmFwaS52MUILQ29tbW9uUHJvdG9QAVowZ2l0aHViLmNvbS91c2VtZW1vcy9tZW1vcy9wcm90by9nZW4vYXBpL3YxO2FwaXYxogIDTUFYqgIMTWVtb3MuQXBpLlYxygIMTWVtb3NcQXBpXFYx4gIYTWVtb3NcQXBpXFYxXEdQQk1ldGFkYXRh6gIOTWVtb3M6OkFwaTo6VjFiBnByb3RvMw"); + +/** + * Used internally for obfuscating the page token. + * + * @generated from message memos.api.v1.PageToken + */ +export type PageToken = Message<"memos.api.v1.PageToken"> & { + /** + * @generated from field: int32 limit = 1; + */ + limit: number; + + /** + * @generated from field: int32 offset = 2; + */ + offset: number; +}; + +/** + * Describes the message memos.api.v1.PageToken. + * Use `create(PageTokenSchema)` to create a new message. + */ +export const PageTokenSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_common, 0); + +/** + * @generated from enum memos.api.v1.State + */ +export enum State { + /** + * @generated from enum value: STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED = 0, + + /** + * @generated from enum value: NORMAL = 1; + */ + NORMAL = 1, + + /** + * @generated from enum value: ARCHIVED = 2; + */ + ARCHIVED = 2, +} + +/** + * Describes the enum memos.api.v1.State. + */ +export const StateSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_v1_common, 0); + +/** + * @generated from enum memos.api.v1.Direction + */ +export enum Direction { + /** + * @generated from enum value: DIRECTION_UNSPECIFIED = 0; + */ + DIRECTION_UNSPECIFIED = 0, + + /** + * @generated from enum value: ASC = 1; + */ + ASC = 1, + + /** + * @generated from enum value: DESC = 2; + */ + DESC = 2, +} + +/** + * Describes the enum memos.api.v1.Direction. + */ +export const DirectionSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_v1_common, 1); + diff --git a/web/src/types/proto/api/v1/idp_service.ts b/web/src/types/proto/api/v1/idp_service.ts deleted file mode 100644 index e04872aa6..000000000 --- a/web/src/types/proto/api/v1/idp_service.ts +++ /dev/null @@ -1,1147 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: api/v1/idp_service.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { Empty } from "../../google/protobuf/empty"; -import { FieldMask } from "../../google/protobuf/field_mask"; - -export const protobufPackage = "memos.api.v1"; - -export interface IdentityProvider { - /** - * The resource name of the identity provider. - * Format: identity-providers/{idp} - */ - name: string; - /** Required. The type of the identity provider. */ - type: IdentityProvider_Type; - /** Required. The display title of the identity provider. */ - title: string; - /** Optional. Filter applied to user identifiers. */ - identifierFilter: string; - /** Required. Configuration for the identity provider. */ - config?: IdentityProviderConfig | undefined; -} - -export enum IdentityProvider_Type { - TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED", - /** OAUTH2 - OAuth2 identity provider. */ - OAUTH2 = "OAUTH2", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function identityProvider_TypeFromJSON(object: any): IdentityProvider_Type { - switch (object) { - case 0: - case "TYPE_UNSPECIFIED": - return IdentityProvider_Type.TYPE_UNSPECIFIED; - case 1: - case "OAUTH2": - return IdentityProvider_Type.OAUTH2; - case -1: - case "UNRECOGNIZED": - default: - return IdentityProvider_Type.UNRECOGNIZED; - } -} - -export function identityProvider_TypeToNumber(object: IdentityProvider_Type): number { - switch (object) { - case IdentityProvider_Type.TYPE_UNSPECIFIED: - return 0; - case IdentityProvider_Type.OAUTH2: - return 1; - case IdentityProvider_Type.UNRECOGNIZED: - default: - return -1; - } -} - -export interface IdentityProviderConfig { - oauth2Config?: OAuth2Config | undefined; -} - -export interface FieldMapping { - identifier: string; - displayName: string; - email: string; - avatarUrl: string; -} - -export interface OAuth2Config { - clientId: string; - clientSecret: string; - authUrl: string; - tokenUrl: string; - userInfoUrl: string; - scopes: string[]; - fieldMapping?: FieldMapping | undefined; -} - -export interface ListIdentityProvidersRequest { -} - -export interface ListIdentityProvidersResponse { - /** The list of identity providers. */ - identityProviders: IdentityProvider[]; -} - -export interface GetIdentityProviderRequest { - /** - * Required. The resource name of the identity provider to get. - * Format: identity-providers/{idp} - */ - name: string; -} - -export interface CreateIdentityProviderRequest { - /** Required. The identity provider to create. */ - identityProvider?: - | IdentityProvider - | undefined; - /** - * Optional. The ID to use for the identity provider, which will become the final component of the resource name. - * If not provided, the system will generate one. - */ - identityProviderId: string; -} - -export interface UpdateIdentityProviderRequest { - /** Required. The identity provider to update. */ - identityProvider?: - | IdentityProvider - | undefined; - /** - * Required. The update mask applies to the resource. Only the top level fields of - * IdentityProvider are supported. - */ - updateMask?: string[] | undefined; -} - -export interface DeleteIdentityProviderRequest { - /** - * Required. The resource name of the identity provider to delete. - * Format: identity-providers/{idp} - */ - name: string; -} - -function createBaseIdentityProvider(): IdentityProvider { - return { name: "", type: IdentityProvider_Type.TYPE_UNSPECIFIED, title: "", identifierFilter: "", config: undefined }; -} - -export const IdentityProvider: MessageFns = { - encode(message: IdentityProvider, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.type !== IdentityProvider_Type.TYPE_UNSPECIFIED) { - writer.uint32(16).int32(identityProvider_TypeToNumber(message.type)); - } - if (message.title !== "") { - writer.uint32(26).string(message.title); - } - if (message.identifierFilter !== "") { - writer.uint32(34).string(message.identifierFilter); - } - if (message.config !== undefined) { - IdentityProviderConfig.encode(message.config, writer.uint32(42).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): IdentityProvider { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseIdentityProvider(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.type = identityProvider_TypeFromJSON(reader.int32()); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.title = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.identifierFilter = reader.string(); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.config = IdentityProviderConfig.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): IdentityProvider { - return IdentityProvider.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): IdentityProvider { - const message = createBaseIdentityProvider(); - message.name = object.name ?? ""; - message.type = object.type ?? IdentityProvider_Type.TYPE_UNSPECIFIED; - message.title = object.title ?? ""; - message.identifierFilter = object.identifierFilter ?? ""; - message.config = (object.config !== undefined && object.config !== null) - ? IdentityProviderConfig.fromPartial(object.config) - : undefined; - return message; - }, -}; - -function createBaseIdentityProviderConfig(): IdentityProviderConfig { - return { oauth2Config: undefined }; -} - -export const IdentityProviderConfig: MessageFns = { - encode(message: IdentityProviderConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.oauth2Config !== undefined) { - OAuth2Config.encode(message.oauth2Config, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): IdentityProviderConfig { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseIdentityProviderConfig(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.oauth2Config = OAuth2Config.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): IdentityProviderConfig { - return IdentityProviderConfig.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): IdentityProviderConfig { - const message = createBaseIdentityProviderConfig(); - message.oauth2Config = (object.oauth2Config !== undefined && object.oauth2Config !== null) - ? OAuth2Config.fromPartial(object.oauth2Config) - : undefined; - return message; - }, -}; - -function createBaseFieldMapping(): FieldMapping { - return { identifier: "", displayName: "", email: "", avatarUrl: "" }; -} - -export const FieldMapping: MessageFns = { - encode(message: FieldMapping, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.identifier !== "") { - writer.uint32(10).string(message.identifier); - } - if (message.displayName !== "") { - writer.uint32(18).string(message.displayName); - } - if (message.email !== "") { - writer.uint32(26).string(message.email); - } - if (message.avatarUrl !== "") { - writer.uint32(34).string(message.avatarUrl); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): FieldMapping { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFieldMapping(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.identifier = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.displayName = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.email = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.avatarUrl = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): FieldMapping { - return FieldMapping.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): FieldMapping { - const message = createBaseFieldMapping(); - message.identifier = object.identifier ?? ""; - message.displayName = object.displayName ?? ""; - message.email = object.email ?? ""; - message.avatarUrl = object.avatarUrl ?? ""; - return message; - }, -}; - -function createBaseOAuth2Config(): OAuth2Config { - return { - clientId: "", - clientSecret: "", - authUrl: "", - tokenUrl: "", - userInfoUrl: "", - scopes: [], - fieldMapping: undefined, - }; -} - -export const OAuth2Config: MessageFns = { - encode(message: OAuth2Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.clientId !== "") { - writer.uint32(10).string(message.clientId); - } - if (message.clientSecret !== "") { - writer.uint32(18).string(message.clientSecret); - } - if (message.authUrl !== "") { - writer.uint32(26).string(message.authUrl); - } - if (message.tokenUrl !== "") { - writer.uint32(34).string(message.tokenUrl); - } - if (message.userInfoUrl !== "") { - writer.uint32(42).string(message.userInfoUrl); - } - for (const v of message.scopes) { - writer.uint32(50).string(v!); - } - if (message.fieldMapping !== undefined) { - FieldMapping.encode(message.fieldMapping, writer.uint32(58).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): OAuth2Config { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOAuth2Config(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.clientId = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.clientSecret = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.authUrl = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.tokenUrl = reader.string(); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.userInfoUrl = reader.string(); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.scopes.push(reader.string()); - continue; - } - case 7: { - if (tag !== 58) { - break; - } - - message.fieldMapping = FieldMapping.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): OAuth2Config { - return OAuth2Config.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): OAuth2Config { - const message = createBaseOAuth2Config(); - message.clientId = object.clientId ?? ""; - message.clientSecret = object.clientSecret ?? ""; - message.authUrl = object.authUrl ?? ""; - message.tokenUrl = object.tokenUrl ?? ""; - message.userInfoUrl = object.userInfoUrl ?? ""; - message.scopes = object.scopes?.map((e) => e) || []; - message.fieldMapping = (object.fieldMapping !== undefined && object.fieldMapping !== null) - ? FieldMapping.fromPartial(object.fieldMapping) - : undefined; - return message; - }, -}; - -function createBaseListIdentityProvidersRequest(): ListIdentityProvidersRequest { - return {}; -} - -export const ListIdentityProvidersRequest: MessageFns = { - encode(_: ListIdentityProvidersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListIdentityProvidersRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListIdentityProvidersRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListIdentityProvidersRequest { - return ListIdentityProvidersRequest.fromPartial(base ?? {}); - }, - fromPartial(_: DeepPartial): ListIdentityProvidersRequest { - const message = createBaseListIdentityProvidersRequest(); - return message; - }, -}; - -function createBaseListIdentityProvidersResponse(): ListIdentityProvidersResponse { - return { identityProviders: [] }; -} - -export const ListIdentityProvidersResponse: MessageFns = { - encode(message: ListIdentityProvidersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.identityProviders) { - IdentityProvider.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListIdentityProvidersResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListIdentityProvidersResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.identityProviders.push(IdentityProvider.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListIdentityProvidersResponse { - return ListIdentityProvidersResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListIdentityProvidersResponse { - const message = createBaseListIdentityProvidersResponse(); - message.identityProviders = object.identityProviders?.map((e) => IdentityProvider.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseGetIdentityProviderRequest(): GetIdentityProviderRequest { - return { name: "" }; -} - -export const GetIdentityProviderRequest: MessageFns = { - encode(message: GetIdentityProviderRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GetIdentityProviderRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetIdentityProviderRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GetIdentityProviderRequest { - return GetIdentityProviderRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GetIdentityProviderRequest { - const message = createBaseGetIdentityProviderRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseCreateIdentityProviderRequest(): CreateIdentityProviderRequest { - return { identityProvider: undefined, identityProviderId: "" }; -} - -export const CreateIdentityProviderRequest: MessageFns = { - encode(message: CreateIdentityProviderRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.identityProvider !== undefined) { - IdentityProvider.encode(message.identityProvider, writer.uint32(10).fork()).join(); - } - if (message.identityProviderId !== "") { - writer.uint32(18).string(message.identityProviderId); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CreateIdentityProviderRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateIdentityProviderRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.identityProvider = IdentityProvider.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.identityProviderId = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CreateIdentityProviderRequest { - return CreateIdentityProviderRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CreateIdentityProviderRequest { - const message = createBaseCreateIdentityProviderRequest(); - message.identityProvider = (object.identityProvider !== undefined && object.identityProvider !== null) - ? IdentityProvider.fromPartial(object.identityProvider) - : undefined; - message.identityProviderId = object.identityProviderId ?? ""; - return message; - }, -}; - -function createBaseUpdateIdentityProviderRequest(): UpdateIdentityProviderRequest { - return { identityProvider: undefined, updateMask: undefined }; -} - -export const UpdateIdentityProviderRequest: MessageFns = { - encode(message: UpdateIdentityProviderRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.identityProvider !== undefined) { - IdentityProvider.encode(message.identityProvider, writer.uint32(10).fork()).join(); - } - if (message.updateMask !== undefined) { - FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UpdateIdentityProviderRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpdateIdentityProviderRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.identityProvider = IdentityProvider.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UpdateIdentityProviderRequest { - return UpdateIdentityProviderRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UpdateIdentityProviderRequest { - const message = createBaseUpdateIdentityProviderRequest(); - message.identityProvider = (object.identityProvider !== undefined && object.identityProvider !== null) - ? IdentityProvider.fromPartial(object.identityProvider) - : undefined; - message.updateMask = object.updateMask ?? undefined; - return message; - }, -}; - -function createBaseDeleteIdentityProviderRequest(): DeleteIdentityProviderRequest { - return { name: "" }; -} - -export const DeleteIdentityProviderRequest: MessageFns = { - encode(message: DeleteIdentityProviderRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DeleteIdentityProviderRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeleteIdentityProviderRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DeleteIdentityProviderRequest { - return DeleteIdentityProviderRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DeleteIdentityProviderRequest { - const message = createBaseDeleteIdentityProviderRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -export type IdentityProviderServiceDefinition = typeof IdentityProviderServiceDefinition; -export const IdentityProviderServiceDefinition = { - name: "IdentityProviderService", - fullName: "memos.api.v1.IdentityProviderService", - methods: { - /** ListIdentityProviders lists identity providers. */ - listIdentityProviders: { - name: "ListIdentityProviders", - requestType: ListIdentityProvidersRequest, - requestStream: false, - responseType: ListIdentityProvidersResponse, - responseStream: false, - options: { - _unknownFields: { - 578365826: [ - new Uint8Array([ - 28, - 18, - 26, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 105, - 100, - 101, - 110, - 116, - 105, - 116, - 121, - 45, - 112, - 114, - 111, - 118, - 105, - 100, - 101, - 114, - 115, - ]), - ], - }, - }, - }, - /** GetIdentityProvider gets an identity provider. */ - getIdentityProvider: { - name: "GetIdentityProvider", - requestType: GetIdentityProviderRequest, - requestStream: false, - responseType: IdentityProvider, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 37, - 18, - 35, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 105, - 100, - 101, - 110, - 116, - 105, - 116, - 121, - 45, - 112, - 114, - 111, - 118, - 105, - 100, - 101, - 114, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** CreateIdentityProvider creates an identity provider. */ - createIdentityProvider: { - name: "CreateIdentityProvider", - requestType: CreateIdentityProviderRequest, - requestStream: false, - responseType: IdentityProvider, - responseStream: false, - options: { - _unknownFields: { - 8410: [ - new Uint8Array([17, 105, 100, 101, 110, 116, 105, 116, 121, 95, 112, 114, 111, 118, 105, 100, 101, 114]), - ], - 578365826: [ - new Uint8Array([ - 47, - 58, - 17, - 105, - 100, - 101, - 110, - 116, - 105, - 116, - 121, - 95, - 112, - 114, - 111, - 118, - 105, - 100, - 101, - 114, - 34, - 26, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 105, - 100, - 101, - 110, - 116, - 105, - 116, - 121, - 45, - 112, - 114, - 111, - 118, - 105, - 100, - 101, - 114, - 115, - ]), - ], - }, - }, - }, - /** UpdateIdentityProvider updates an identity provider. */ - updateIdentityProvider: { - name: "UpdateIdentityProvider", - requestType: UpdateIdentityProviderRequest, - requestStream: false, - responseType: IdentityProvider, - responseStream: false, - options: { - _unknownFields: { - 8410: [ - new Uint8Array([ - 29, - 105, - 100, - 101, - 110, - 116, - 105, - 116, - 121, - 95, - 112, - 114, - 111, - 118, - 105, - 100, - 101, - 114, - 44, - 117, - 112, - 100, - 97, - 116, - 101, - 95, - 109, - 97, - 115, - 107, - ]), - ], - 578365826: [ - new Uint8Array([ - 74, - 58, - 17, - 105, - 100, - 101, - 110, - 116, - 105, - 116, - 121, - 95, - 112, - 114, - 111, - 118, - 105, - 100, - 101, - 114, - 50, - 53, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 105, - 100, - 101, - 110, - 116, - 105, - 116, - 121, - 95, - 112, - 114, - 111, - 118, - 105, - 100, - 101, - 114, - 46, - 110, - 97, - 109, - 101, - 61, - 105, - 100, - 101, - 110, - 116, - 105, - 116, - 121, - 45, - 112, - 114, - 111, - 118, - 105, - 100, - 101, - 114, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** DeleteIdentityProvider deletes an identity provider. */ - deleteIdentityProvider: { - name: "DeleteIdentityProvider", - requestType: DeleteIdentityProviderRequest, - requestStream: false, - responseType: Empty, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 37, - 42, - 35, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 105, - 100, - 101, - 110, - 116, - 105, - 116, - 121, - 45, - 112, - 114, - 111, - 118, - 105, - 100, - 101, - 114, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - }, -} as const; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/api/v1/idp_service_pb.ts b/web/src/types/proto/api/v1/idp_service_pb.ts new file mode 100644 index 000000000..d279b786b --- /dev/null +++ b/web/src/types/proto/api/v1/idp_service_pb.ts @@ -0,0 +1,376 @@ +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file api/v1/idp_service.proto (package memos.api.v1, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import { file_google_api_annotations } from "../../google/api/annotations_pb"; +import { file_google_api_client } from "../../google/api/client_pb"; +import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; +import { file_google_api_resource } from "../../google/api/resource_pb"; +import type { EmptySchema, FieldMask } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_empty, file_google_protobuf_field_mask } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/v1/idp_service.proto. + */ +export const file_api_v1_idp_service: GenFile = /*@__PURE__*/ + fileDesc("ChhhcGkvdjEvaWRwX3NlcnZpY2UucHJvdG8SDG1lbW9zLmFwaS52MSLfAgoQSWRlbnRpdHlQcm92aWRlchIRCgRuYW1lGAEgASgJQgPgQQgSNgoEdHlwZRgCIAEoDjIjLm1lbW9zLmFwaS52MS5JZGVudGl0eVByb3ZpZGVyLlR5cGVCA+BBAhISCgV0aXRsZRgDIAEoCUID4EECEh4KEWlkZW50aWZpZXJfZmlsdGVyGAQgASgJQgPgQQESOQoGY29uZmlnGAUgASgLMiQubWVtb3MuYXBpLnYxLklkZW50aXR5UHJvdmlkZXJDb25maWdCA+BBAiIoCgRUeXBlEhQKEFRZUEVfVU5TUEVDSUZJRUQQABIKCgZPQVVUSDIQATpn6kFkCh1tZW1vcy5hcGkudjEvSWRlbnRpdHlQcm92aWRlchIYaWRlbnRpdHktcHJvdmlkZXJzL3tpZHB9GgRuYW1lKhFpZGVudGl0eVByb3ZpZGVyczIQaWRlbnRpdHlQcm92aWRlciJXChZJZGVudGl0eVByb3ZpZGVyQ29uZmlnEjMKDW9hdXRoMl9jb25maWcYASABKAsyGi5tZW1vcy5hcGkudjEuT0F1dGgyQ29uZmlnSABCCAoGY29uZmlnIlsKDEZpZWxkTWFwcGluZxISCgppZGVudGlmaWVyGAEgASgJEhQKDGRpc3BsYXlfbmFtZRgCIAEoCRINCgVlbWFpbBgDIAEoCRISCgphdmF0YXJfdXJsGAQgASgJIrcBCgxPQXV0aDJDb25maWcSEQoJY2xpZW50X2lkGAEgASgJEhUKDWNsaWVudF9zZWNyZXQYAiABKAkSEAoIYXV0aF91cmwYAyABKAkSEQoJdG9rZW5fdXJsGAQgASgJEhUKDXVzZXJfaW5mb191cmwYBSABKAkSDgoGc2NvcGVzGAYgAygJEjEKDWZpZWxkX21hcHBpbmcYByABKAsyGi5tZW1vcy5hcGkudjEuRmllbGRNYXBwaW5nIh4KHExpc3RJZGVudGl0eVByb3ZpZGVyc1JlcXVlc3QiWwodTGlzdElkZW50aXR5UHJvdmlkZXJzUmVzcG9uc2USOgoSaWRlbnRpdHlfcHJvdmlkZXJzGAEgAygLMh4ubWVtb3MuYXBpLnYxLklkZW50aXR5UHJvdmlkZXIiUQoaR2V0SWRlbnRpdHlQcm92aWRlclJlcXVlc3QSMwoEbmFtZRgBIAEoCUIl4EEC+kEfCh1tZW1vcy5hcGkudjEvSWRlbnRpdHlQcm92aWRlciKCAQodQ3JlYXRlSWRlbnRpdHlQcm92aWRlclJlcXVlc3QSPgoRaWRlbnRpdHlfcHJvdmlkZXIYASABKAsyHi5tZW1vcy5hcGkudjEuSWRlbnRpdHlQcm92aWRlckID4EECEiEKFGlkZW50aXR5X3Byb3ZpZGVyX2lkGAIgASgJQgPgQQEilQEKHVVwZGF0ZUlkZW50aXR5UHJvdmlkZXJSZXF1ZXN0Ej4KEWlkZW50aXR5X3Byb3ZpZGVyGAEgASgLMh4ubWVtb3MuYXBpLnYxLklkZW50aXR5UHJvdmlkZXJCA+BBAhI0Cgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tCA+BBAiJUCh1EZWxldGVJZGVudGl0eVByb3ZpZGVyUmVxdWVzdBIzCgRuYW1lGAEgASgJQiXgQQL6QR8KHW1lbW9zLmFwaS52MS9JZGVudGl0eVByb3ZpZGVyMucGChdJZGVudGl0eVByb3ZpZGVyU2VydmljZRKUAQoVTGlzdElkZW50aXR5UHJvdmlkZXJzEioubWVtb3MuYXBpLnYxLkxpc3RJZGVudGl0eVByb3ZpZGVyc1JlcXVlc3QaKy5tZW1vcy5hcGkudjEuTGlzdElkZW50aXR5UHJvdmlkZXJzUmVzcG9uc2UiIoLT5JMCHBIaL2FwaS92MS9pZGVudGl0eS1wcm92aWRlcnMSkwEKE0dldElkZW50aXR5UHJvdmlkZXISKC5tZW1vcy5hcGkudjEuR2V0SWRlbnRpdHlQcm92aWRlclJlcXVlc3QaHi5tZW1vcy5hcGkudjEuSWRlbnRpdHlQcm92aWRlciIy2kEEbmFtZYLT5JMCJRIjL2FwaS92MS97bmFtZT1pZGVudGl0eS1wcm92aWRlcnMvKn0SsAEKFkNyZWF0ZUlkZW50aXR5UHJvdmlkZXISKy5tZW1vcy5hcGkudjEuQ3JlYXRlSWRlbnRpdHlQcm92aWRlclJlcXVlc3QaHi5tZW1vcy5hcGkudjEuSWRlbnRpdHlQcm92aWRlciJJ2kERaWRlbnRpdHlfcHJvdmlkZXKC0+STAi86EWlkZW50aXR5X3Byb3ZpZGVyIhovYXBpL3YxL2lkZW50aXR5LXByb3ZpZGVycxLXAQoWVXBkYXRlSWRlbnRpdHlQcm92aWRlchIrLm1lbW9zLmFwaS52MS5VcGRhdGVJZGVudGl0eVByb3ZpZGVyUmVxdWVzdBoeLm1lbW9zLmFwaS52MS5JZGVudGl0eVByb3ZpZGVyInDaQR1pZGVudGl0eV9wcm92aWRlcix1cGRhdGVfbWFza4LT5JMCSjoRaWRlbnRpdHlfcHJvdmlkZXIyNS9hcGkvdjEve2lkZW50aXR5X3Byb3ZpZGVyLm5hbWU9aWRlbnRpdHktcHJvdmlkZXJzLyp9EpEBChZEZWxldGVJZGVudGl0eVByb3ZpZGVyEisubWVtb3MuYXBpLnYxLkRlbGV0ZUlkZW50aXR5UHJvdmlkZXJSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IjLaQQRuYW1lgtPkkwIlKiMvYXBpL3YxL3tuYW1lPWlkZW50aXR5LXByb3ZpZGVycy8qfUKnAQoQY29tLm1lbW9zLmFwaS52MUIPSWRwU2VydmljZVByb3RvUAFaMGdpdGh1Yi5jb20vdXNlbWVtb3MvbWVtb3MvcHJvdG8vZ2VuL2FwaS92MTthcGl2MaICA01BWKoCDE1lbW9zLkFwaS5WMcoCDE1lbW9zXEFwaVxWMeICGE1lbW9zXEFwaVxWMVxHUEJNZXRhZGF0YeoCDk1lbW9zOjpBcGk6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask]); + +/** + * @generated from message memos.api.v1.IdentityProvider + */ +export type IdentityProvider = Message<"memos.api.v1.IdentityProvider"> & { + /** + * The resource name of the identity provider. + * Format: identity-providers/{idp} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. The type of the identity provider. + * + * @generated from field: memos.api.v1.IdentityProvider.Type type = 2; + */ + type: IdentityProvider_Type; + + /** + * Required. The display title of the identity provider. + * + * @generated from field: string title = 3; + */ + title: string; + + /** + * Optional. Filter applied to user identifiers. + * + * @generated from field: string identifier_filter = 4; + */ + identifierFilter: string; + + /** + * Required. Configuration for the identity provider. + * + * @generated from field: memos.api.v1.IdentityProviderConfig config = 5; + */ + config?: IdentityProviderConfig; +}; + +/** + * Describes the message memos.api.v1.IdentityProvider. + * Use `create(IdentityProviderSchema)` to create a new message. + */ +export const IdentityProviderSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_idp_service, 0); + +/** + * @generated from enum memos.api.v1.IdentityProvider.Type + */ +export enum IdentityProvider_Type { + /** + * @generated from enum value: TYPE_UNSPECIFIED = 0; + */ + TYPE_UNSPECIFIED = 0, + + /** + * OAuth2 identity provider. + * + * @generated from enum value: OAUTH2 = 1; + */ + OAUTH2 = 1, +} + +/** + * Describes the enum memos.api.v1.IdentityProvider.Type. + */ +export const IdentityProvider_TypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_v1_idp_service, 0, 0); + +/** + * @generated from message memos.api.v1.IdentityProviderConfig + */ +export type IdentityProviderConfig = Message<"memos.api.v1.IdentityProviderConfig"> & { + /** + * @generated from oneof memos.api.v1.IdentityProviderConfig.config + */ + config: { + /** + * @generated from field: memos.api.v1.OAuth2Config oauth2_config = 1; + */ + value: OAuth2Config; + case: "oauth2Config"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.v1.IdentityProviderConfig. + * Use `create(IdentityProviderConfigSchema)` to create a new message. + */ +export const IdentityProviderConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_idp_service, 1); + +/** + * @generated from message memos.api.v1.FieldMapping + */ +export type FieldMapping = Message<"memos.api.v1.FieldMapping"> & { + /** + * @generated from field: string identifier = 1; + */ + identifier: string; + + /** + * @generated from field: string display_name = 2; + */ + displayName: string; + + /** + * @generated from field: string email = 3; + */ + email: string; + + /** + * @generated from field: string avatar_url = 4; + */ + avatarUrl: string; +}; + +/** + * Describes the message memos.api.v1.FieldMapping. + * Use `create(FieldMappingSchema)` to create a new message. + */ +export const FieldMappingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_idp_service, 2); + +/** + * @generated from message memos.api.v1.OAuth2Config + */ +export type OAuth2Config = Message<"memos.api.v1.OAuth2Config"> & { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * @generated from field: string client_secret = 2; + */ + clientSecret: string; + + /** + * @generated from field: string auth_url = 3; + */ + authUrl: string; + + /** + * @generated from field: string token_url = 4; + */ + tokenUrl: string; + + /** + * @generated from field: string user_info_url = 5; + */ + userInfoUrl: string; + + /** + * @generated from field: repeated string scopes = 6; + */ + scopes: string[]; + + /** + * @generated from field: memos.api.v1.FieldMapping field_mapping = 7; + */ + fieldMapping?: FieldMapping; +}; + +/** + * Describes the message memos.api.v1.OAuth2Config. + * Use `create(OAuth2ConfigSchema)` to create a new message. + */ +export const OAuth2ConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_idp_service, 3); + +/** + * @generated from message memos.api.v1.ListIdentityProvidersRequest + */ +export type ListIdentityProvidersRequest = Message<"memos.api.v1.ListIdentityProvidersRequest"> & { +}; + +/** + * Describes the message memos.api.v1.ListIdentityProvidersRequest. + * Use `create(ListIdentityProvidersRequestSchema)` to create a new message. + */ +export const ListIdentityProvidersRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_idp_service, 4); + +/** + * @generated from message memos.api.v1.ListIdentityProvidersResponse + */ +export type ListIdentityProvidersResponse = Message<"memos.api.v1.ListIdentityProvidersResponse"> & { + /** + * The list of identity providers. + * + * @generated from field: repeated memos.api.v1.IdentityProvider identity_providers = 1; + */ + identityProviders: IdentityProvider[]; +}; + +/** + * Describes the message memos.api.v1.ListIdentityProvidersResponse. + * Use `create(ListIdentityProvidersResponseSchema)` to create a new message. + */ +export const ListIdentityProvidersResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_idp_service, 5); + +/** + * @generated from message memos.api.v1.GetIdentityProviderRequest + */ +export type GetIdentityProviderRequest = Message<"memos.api.v1.GetIdentityProviderRequest"> & { + /** + * Required. The resource name of the identity provider to get. + * Format: identity-providers/{idp} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.GetIdentityProviderRequest. + * Use `create(GetIdentityProviderRequestSchema)` to create a new message. + */ +export const GetIdentityProviderRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_idp_service, 6); + +/** + * @generated from message memos.api.v1.CreateIdentityProviderRequest + */ +export type CreateIdentityProviderRequest = Message<"memos.api.v1.CreateIdentityProviderRequest"> & { + /** + * Required. The identity provider to create. + * + * @generated from field: memos.api.v1.IdentityProvider identity_provider = 1; + */ + identityProvider?: IdentityProvider; + + /** + * Optional. The ID to use for the identity provider, which will become the final component of the resource name. + * If not provided, the system will generate one. + * + * @generated from field: string identity_provider_id = 2; + */ + identityProviderId: string; +}; + +/** + * Describes the message memos.api.v1.CreateIdentityProviderRequest. + * Use `create(CreateIdentityProviderRequestSchema)` to create a new message. + */ +export const CreateIdentityProviderRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_idp_service, 7); + +/** + * @generated from message memos.api.v1.UpdateIdentityProviderRequest + */ +export type UpdateIdentityProviderRequest = Message<"memos.api.v1.UpdateIdentityProviderRequest"> & { + /** + * Required. The identity provider to update. + * + * @generated from field: memos.api.v1.IdentityProvider identity_provider = 1; + */ + identityProvider?: IdentityProvider; + + /** + * Required. The update mask applies to the resource. Only the top level fields of + * IdentityProvider are supported. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask; +}; + +/** + * Describes the message memos.api.v1.UpdateIdentityProviderRequest. + * Use `create(UpdateIdentityProviderRequestSchema)` to create a new message. + */ +export const UpdateIdentityProviderRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_idp_service, 8); + +/** + * @generated from message memos.api.v1.DeleteIdentityProviderRequest + */ +export type DeleteIdentityProviderRequest = Message<"memos.api.v1.DeleteIdentityProviderRequest"> & { + /** + * Required. The resource name of the identity provider to delete. + * Format: identity-providers/{idp} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.DeleteIdentityProviderRequest. + * Use `create(DeleteIdentityProviderRequestSchema)` to create a new message. + */ +export const DeleteIdentityProviderRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_idp_service, 9); + +/** + * @generated from service memos.api.v1.IdentityProviderService + */ +export const IdentityProviderService: GenService<{ + /** + * ListIdentityProviders lists identity providers. + * + * @generated from rpc memos.api.v1.IdentityProviderService.ListIdentityProviders + */ + listIdentityProviders: { + methodKind: "unary"; + input: typeof ListIdentityProvidersRequestSchema; + output: typeof ListIdentityProvidersResponseSchema; + }, + /** + * GetIdentityProvider gets an identity provider. + * + * @generated from rpc memos.api.v1.IdentityProviderService.GetIdentityProvider + */ + getIdentityProvider: { + methodKind: "unary"; + input: typeof GetIdentityProviderRequestSchema; + output: typeof IdentityProviderSchema; + }, + /** + * CreateIdentityProvider creates an identity provider. + * + * @generated from rpc memos.api.v1.IdentityProviderService.CreateIdentityProvider + */ + createIdentityProvider: { + methodKind: "unary"; + input: typeof CreateIdentityProviderRequestSchema; + output: typeof IdentityProviderSchema; + }, + /** + * UpdateIdentityProvider updates an identity provider. + * + * @generated from rpc memos.api.v1.IdentityProviderService.UpdateIdentityProvider + */ + updateIdentityProvider: { + methodKind: "unary"; + input: typeof UpdateIdentityProviderRequestSchema; + output: typeof IdentityProviderSchema; + }, + /** + * DeleteIdentityProvider deletes an identity provider. + * + * @generated from rpc memos.api.v1.IdentityProviderService.DeleteIdentityProvider + */ + deleteIdentityProvider: { + methodKind: "unary"; + input: typeof DeleteIdentityProviderRequestSchema; + output: typeof EmptySchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_v1_idp_service, 0); + diff --git a/web/src/types/proto/api/v1/instance_service.ts b/web/src/types/proto/api/v1/instance_service.ts deleted file mode 100644 index 73fb72eac..000000000 --- a/web/src/types/proto/api/v1/instance_service.ts +++ /dev/null @@ -1,1316 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: api/v1/instance_service.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { FieldMask } from "../../google/protobuf/field_mask"; - -export const protobufPackage = "memos.api.v1"; - -/** Instance profile message containing basic instance information. */ -export interface InstanceProfile { - /** - * The name of instance owner. - * Format: users/{user} - */ - owner: string; - /** Version is the current version of instance. */ - version: string; - /** Mode is the instance mode (e.g. "prod", "dev" or "demo"). */ - mode: string; - /** Instance URL is the URL of the instance. */ - instanceUrl: string; -} - -/** Request for instance profile. */ -export interface GetInstanceProfileRequest { -} - -/** An instance setting resource. */ -export interface InstanceSetting { - /** - * The name of the instance setting. - * Format: instance/settings/{setting} - */ - name: string; - generalSetting?: InstanceSetting_GeneralSetting | undefined; - storageSetting?: InstanceSetting_StorageSetting | undefined; - memoRelatedSetting?: InstanceSetting_MemoRelatedSetting | undefined; -} - -/** Enumeration of instance setting keys. */ -export enum InstanceSetting_Key { - KEY_UNSPECIFIED = "KEY_UNSPECIFIED", - /** GENERAL - GENERAL is the key for general settings. */ - GENERAL = "GENERAL", - /** STORAGE - STORAGE is the key for storage settings. */ - STORAGE = "STORAGE", - /** MEMO_RELATED - MEMO_RELATED is the key for memo related settings. */ - MEMO_RELATED = "MEMO_RELATED", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function instanceSetting_KeyFromJSON(object: any): InstanceSetting_Key { - switch (object) { - case 0: - case "KEY_UNSPECIFIED": - return InstanceSetting_Key.KEY_UNSPECIFIED; - case 1: - case "GENERAL": - return InstanceSetting_Key.GENERAL; - case 2: - case "STORAGE": - return InstanceSetting_Key.STORAGE; - case 3: - case "MEMO_RELATED": - return InstanceSetting_Key.MEMO_RELATED; - case -1: - case "UNRECOGNIZED": - default: - return InstanceSetting_Key.UNRECOGNIZED; - } -} - -export function instanceSetting_KeyToNumber(object: InstanceSetting_Key): number { - switch (object) { - case InstanceSetting_Key.KEY_UNSPECIFIED: - return 0; - case InstanceSetting_Key.GENERAL: - return 1; - case InstanceSetting_Key.STORAGE: - return 2; - case InstanceSetting_Key.MEMO_RELATED: - return 3; - case InstanceSetting_Key.UNRECOGNIZED: - default: - return -1; - } -} - -/** General instance settings configuration. */ -export interface InstanceSetting_GeneralSetting { - /** disallow_user_registration disallows user registration. */ - disallowUserRegistration: boolean; - /** disallow_password_auth disallows password authentication. */ - disallowPasswordAuth: boolean; - /** additional_script is the additional script. */ - additionalScript: string; - /** additional_style is the additional style. */ - additionalStyle: string; - /** custom_profile is the custom profile. */ - customProfile?: - | InstanceSetting_GeneralSetting_CustomProfile - | undefined; - /** - * week_start_day_offset is the week start day offset from Sunday. - * 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday - * Default is Sunday. - */ - weekStartDayOffset: number; - /** disallow_change_username disallows changing username. */ - disallowChangeUsername: boolean; - /** disallow_change_nickname disallows changing nickname. */ - disallowChangeNickname: boolean; -} - -/** Custom profile configuration for instance branding. */ -export interface InstanceSetting_GeneralSetting_CustomProfile { - title: string; - description: string; - logoUrl: string; -} - -/** Storage configuration settings for instance attachments. */ -export interface InstanceSetting_StorageSetting { - /** storage_type is the storage type. */ - storageType: InstanceSetting_StorageSetting_StorageType; - /** - * The template of file path. - * e.g. assets/{timestamp}_{filename} - */ - filepathTemplate: string; - /** The max upload size in megabytes. */ - uploadSizeLimitMb: number; - /** The S3 config. */ - s3Config?: InstanceSetting_StorageSetting_S3Config | undefined; -} - -/** Storage type enumeration for different storage backends. */ -export enum InstanceSetting_StorageSetting_StorageType { - STORAGE_TYPE_UNSPECIFIED = "STORAGE_TYPE_UNSPECIFIED", - /** DATABASE - DATABASE is the database storage type. */ - DATABASE = "DATABASE", - /** LOCAL - LOCAL is the local storage type. */ - LOCAL = "LOCAL", - /** S3 - S3 is the S3 storage type. */ - S3 = "S3", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function instanceSetting_StorageSetting_StorageTypeFromJSON( - object: any, -): InstanceSetting_StorageSetting_StorageType { - switch (object) { - case 0: - case "STORAGE_TYPE_UNSPECIFIED": - return InstanceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED; - case 1: - case "DATABASE": - return InstanceSetting_StorageSetting_StorageType.DATABASE; - case 2: - case "LOCAL": - return InstanceSetting_StorageSetting_StorageType.LOCAL; - case 3: - case "S3": - return InstanceSetting_StorageSetting_StorageType.S3; - case -1: - case "UNRECOGNIZED": - default: - return InstanceSetting_StorageSetting_StorageType.UNRECOGNIZED; - } -} - -export function instanceSetting_StorageSetting_StorageTypeToNumber( - object: InstanceSetting_StorageSetting_StorageType, -): number { - switch (object) { - case InstanceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED: - return 0; - case InstanceSetting_StorageSetting_StorageType.DATABASE: - return 1; - case InstanceSetting_StorageSetting_StorageType.LOCAL: - return 2; - case InstanceSetting_StorageSetting_StorageType.S3: - return 3; - case InstanceSetting_StorageSetting_StorageType.UNRECOGNIZED: - default: - return -1; - } -} - -/** - * S3 configuration for cloud storage backend. - * Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ - */ -export interface InstanceSetting_StorageSetting_S3Config { - accessKeyId: string; - accessKeySecret: string; - endpoint: string; - region: string; - bucket: string; - usePathStyle: boolean; -} - -/** Memo-related instance settings and policies. */ -export interface InstanceSetting_MemoRelatedSetting { - /** disallow_public_visibility disallows set memo as public visibility. */ - disallowPublicVisibility: boolean; - /** display_with_update_time orders and displays memo with update time. */ - displayWithUpdateTime: boolean; - /** content_length_limit is the limit of content length. Unit is byte. */ - contentLengthLimit: number; - /** enable_double_click_edit enables editing on double click. */ - enableDoubleClickEdit: boolean; - /** reactions is the list of reactions. */ - reactions: string[]; - /** enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW). */ - enableBlurNsfwContent: boolean; - /** nsfw_tags is the list of tags that mark content as NSFW for blurring. */ - nsfwTags: string[]; -} - -/** Request message for GetInstanceSetting method. */ -export interface GetInstanceSettingRequest { - /** - * The resource name of the instance setting. - * Format: instance/settings/{setting} - */ - name: string; -} - -/** Request message for UpdateInstanceSetting method. */ -export interface UpdateInstanceSettingRequest { - /** The instance setting resource which replaces the resource on the server. */ - setting?: - | InstanceSetting - | undefined; - /** The list of fields to update. */ - updateMask?: string[] | undefined; -} - -function createBaseInstanceProfile(): InstanceProfile { - return { owner: "", version: "", mode: "", instanceUrl: "" }; -} - -export const InstanceProfile: MessageFns = { - encode(message: InstanceProfile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.owner !== "") { - writer.uint32(10).string(message.owner); - } - if (message.version !== "") { - writer.uint32(18).string(message.version); - } - if (message.mode !== "") { - writer.uint32(26).string(message.mode); - } - if (message.instanceUrl !== "") { - writer.uint32(50).string(message.instanceUrl); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): InstanceProfile { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInstanceProfile(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.owner = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.version = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.mode = reader.string(); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.instanceUrl = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): InstanceProfile { - return InstanceProfile.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): InstanceProfile { - const message = createBaseInstanceProfile(); - message.owner = object.owner ?? ""; - message.version = object.version ?? ""; - message.mode = object.mode ?? ""; - message.instanceUrl = object.instanceUrl ?? ""; - return message; - }, -}; - -function createBaseGetInstanceProfileRequest(): GetInstanceProfileRequest { - return {}; -} - -export const GetInstanceProfileRequest: MessageFns = { - encode(_: GetInstanceProfileRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GetInstanceProfileRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetInstanceProfileRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GetInstanceProfileRequest { - return GetInstanceProfileRequest.fromPartial(base ?? {}); - }, - fromPartial(_: DeepPartial): GetInstanceProfileRequest { - const message = createBaseGetInstanceProfileRequest(); - return message; - }, -}; - -function createBaseInstanceSetting(): InstanceSetting { - return { name: "", generalSetting: undefined, storageSetting: undefined, memoRelatedSetting: undefined }; -} - -export const InstanceSetting: MessageFns = { - encode(message: InstanceSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.generalSetting !== undefined) { - InstanceSetting_GeneralSetting.encode(message.generalSetting, writer.uint32(18).fork()).join(); - } - if (message.storageSetting !== undefined) { - InstanceSetting_StorageSetting.encode(message.storageSetting, writer.uint32(26).fork()).join(); - } - if (message.memoRelatedSetting !== undefined) { - InstanceSetting_MemoRelatedSetting.encode(message.memoRelatedSetting, writer.uint32(34).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): InstanceSetting { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInstanceSetting(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.generalSetting = InstanceSetting_GeneralSetting.decode(reader, reader.uint32()); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.storageSetting = InstanceSetting_StorageSetting.decode(reader, reader.uint32()); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.memoRelatedSetting = InstanceSetting_MemoRelatedSetting.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): InstanceSetting { - return InstanceSetting.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): InstanceSetting { - const message = createBaseInstanceSetting(); - message.name = object.name ?? ""; - message.generalSetting = (object.generalSetting !== undefined && object.generalSetting !== null) - ? InstanceSetting_GeneralSetting.fromPartial(object.generalSetting) - : undefined; - message.storageSetting = (object.storageSetting !== undefined && object.storageSetting !== null) - ? InstanceSetting_StorageSetting.fromPartial(object.storageSetting) - : undefined; - message.memoRelatedSetting = (object.memoRelatedSetting !== undefined && object.memoRelatedSetting !== null) - ? InstanceSetting_MemoRelatedSetting.fromPartial(object.memoRelatedSetting) - : undefined; - return message; - }, -}; - -function createBaseInstanceSetting_GeneralSetting(): InstanceSetting_GeneralSetting { - return { - disallowUserRegistration: false, - disallowPasswordAuth: false, - additionalScript: "", - additionalStyle: "", - customProfile: undefined, - weekStartDayOffset: 0, - disallowChangeUsername: false, - disallowChangeNickname: false, - }; -} - -export const InstanceSetting_GeneralSetting: MessageFns = { - encode(message: InstanceSetting_GeneralSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.disallowUserRegistration !== false) { - writer.uint32(16).bool(message.disallowUserRegistration); - } - if (message.disallowPasswordAuth !== false) { - writer.uint32(24).bool(message.disallowPasswordAuth); - } - if (message.additionalScript !== "") { - writer.uint32(34).string(message.additionalScript); - } - if (message.additionalStyle !== "") { - writer.uint32(42).string(message.additionalStyle); - } - if (message.customProfile !== undefined) { - InstanceSetting_GeneralSetting_CustomProfile.encode(message.customProfile, writer.uint32(50).fork()).join(); - } - if (message.weekStartDayOffset !== 0) { - writer.uint32(56).int32(message.weekStartDayOffset); - } - if (message.disallowChangeUsername !== false) { - writer.uint32(64).bool(message.disallowChangeUsername); - } - if (message.disallowChangeNickname !== false) { - writer.uint32(72).bool(message.disallowChangeNickname); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): InstanceSetting_GeneralSetting { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInstanceSetting_GeneralSetting(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 2: { - if (tag !== 16) { - break; - } - - message.disallowUserRegistration = reader.bool(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.disallowPasswordAuth = reader.bool(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.additionalScript = reader.string(); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.additionalStyle = reader.string(); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.customProfile = InstanceSetting_GeneralSetting_CustomProfile.decode(reader, reader.uint32()); - continue; - } - case 7: { - if (tag !== 56) { - break; - } - - message.weekStartDayOffset = reader.int32(); - continue; - } - case 8: { - if (tag !== 64) { - break; - } - - message.disallowChangeUsername = reader.bool(); - continue; - } - case 9: { - if (tag !== 72) { - break; - } - - message.disallowChangeNickname = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): InstanceSetting_GeneralSetting { - return InstanceSetting_GeneralSetting.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): InstanceSetting_GeneralSetting { - const message = createBaseInstanceSetting_GeneralSetting(); - message.disallowUserRegistration = object.disallowUserRegistration ?? false; - message.disallowPasswordAuth = object.disallowPasswordAuth ?? false; - message.additionalScript = object.additionalScript ?? ""; - message.additionalStyle = object.additionalStyle ?? ""; - message.customProfile = (object.customProfile !== undefined && object.customProfile !== null) - ? InstanceSetting_GeneralSetting_CustomProfile.fromPartial(object.customProfile) - : undefined; - message.weekStartDayOffset = object.weekStartDayOffset ?? 0; - message.disallowChangeUsername = object.disallowChangeUsername ?? false; - message.disallowChangeNickname = object.disallowChangeNickname ?? false; - return message; - }, -}; - -function createBaseInstanceSetting_GeneralSetting_CustomProfile(): InstanceSetting_GeneralSetting_CustomProfile { - return { title: "", description: "", logoUrl: "" }; -} - -export const InstanceSetting_GeneralSetting_CustomProfile: MessageFns = { - encode( - message: InstanceSetting_GeneralSetting_CustomProfile, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.title !== "") { - writer.uint32(10).string(message.title); - } - if (message.description !== "") { - writer.uint32(18).string(message.description); - } - if (message.logoUrl !== "") { - writer.uint32(26).string(message.logoUrl); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): InstanceSetting_GeneralSetting_CustomProfile { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInstanceSetting_GeneralSetting_CustomProfile(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.title = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.description = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.logoUrl = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create( - base?: DeepPartial, - ): InstanceSetting_GeneralSetting_CustomProfile { - return InstanceSetting_GeneralSetting_CustomProfile.fromPartial(base ?? {}); - }, - fromPartial( - object: DeepPartial, - ): InstanceSetting_GeneralSetting_CustomProfile { - const message = createBaseInstanceSetting_GeneralSetting_CustomProfile(); - message.title = object.title ?? ""; - message.description = object.description ?? ""; - message.logoUrl = object.logoUrl ?? ""; - return message; - }, -}; - -function createBaseInstanceSetting_StorageSetting(): InstanceSetting_StorageSetting { - return { - storageType: InstanceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED, - filepathTemplate: "", - uploadSizeLimitMb: 0, - s3Config: undefined, - }; -} - -export const InstanceSetting_StorageSetting: MessageFns = { - encode(message: InstanceSetting_StorageSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.storageType !== InstanceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED) { - writer.uint32(8).int32(instanceSetting_StorageSetting_StorageTypeToNumber(message.storageType)); - } - if (message.filepathTemplate !== "") { - writer.uint32(18).string(message.filepathTemplate); - } - if (message.uploadSizeLimitMb !== 0) { - writer.uint32(24).int64(message.uploadSizeLimitMb); - } - if (message.s3Config !== undefined) { - InstanceSetting_StorageSetting_S3Config.encode(message.s3Config, writer.uint32(34).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): InstanceSetting_StorageSetting { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInstanceSetting_StorageSetting(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.storageType = instanceSetting_StorageSetting_StorageTypeFromJSON(reader.int32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.filepathTemplate = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.uploadSizeLimitMb = longToNumber(reader.int64()); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.s3Config = InstanceSetting_StorageSetting_S3Config.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): InstanceSetting_StorageSetting { - return InstanceSetting_StorageSetting.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): InstanceSetting_StorageSetting { - const message = createBaseInstanceSetting_StorageSetting(); - message.storageType = object.storageType ?? InstanceSetting_StorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED; - message.filepathTemplate = object.filepathTemplate ?? ""; - message.uploadSizeLimitMb = object.uploadSizeLimitMb ?? 0; - message.s3Config = (object.s3Config !== undefined && object.s3Config !== null) - ? InstanceSetting_StorageSetting_S3Config.fromPartial(object.s3Config) - : undefined; - return message; - }, -}; - -function createBaseInstanceSetting_StorageSetting_S3Config(): InstanceSetting_StorageSetting_S3Config { - return { accessKeyId: "", accessKeySecret: "", endpoint: "", region: "", bucket: "", usePathStyle: false }; -} - -export const InstanceSetting_StorageSetting_S3Config: MessageFns = { - encode(message: InstanceSetting_StorageSetting_S3Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.accessKeyId !== "") { - writer.uint32(10).string(message.accessKeyId); - } - if (message.accessKeySecret !== "") { - writer.uint32(18).string(message.accessKeySecret); - } - if (message.endpoint !== "") { - writer.uint32(26).string(message.endpoint); - } - if (message.region !== "") { - writer.uint32(34).string(message.region); - } - if (message.bucket !== "") { - writer.uint32(42).string(message.bucket); - } - if (message.usePathStyle !== false) { - writer.uint32(48).bool(message.usePathStyle); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): InstanceSetting_StorageSetting_S3Config { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInstanceSetting_StorageSetting_S3Config(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.accessKeyId = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.accessKeySecret = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.endpoint = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.region = reader.string(); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.bucket = reader.string(); - continue; - } - case 6: { - if (tag !== 48) { - break; - } - - message.usePathStyle = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): InstanceSetting_StorageSetting_S3Config { - return InstanceSetting_StorageSetting_S3Config.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): InstanceSetting_StorageSetting_S3Config { - const message = createBaseInstanceSetting_StorageSetting_S3Config(); - message.accessKeyId = object.accessKeyId ?? ""; - message.accessKeySecret = object.accessKeySecret ?? ""; - message.endpoint = object.endpoint ?? ""; - message.region = object.region ?? ""; - message.bucket = object.bucket ?? ""; - message.usePathStyle = object.usePathStyle ?? false; - return message; - }, -}; - -function createBaseInstanceSetting_MemoRelatedSetting(): InstanceSetting_MemoRelatedSetting { - return { - disallowPublicVisibility: false, - displayWithUpdateTime: false, - contentLengthLimit: 0, - enableDoubleClickEdit: false, - reactions: [], - enableBlurNsfwContent: false, - nsfwTags: [], - }; -} - -export const InstanceSetting_MemoRelatedSetting: MessageFns = { - encode(message: InstanceSetting_MemoRelatedSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.disallowPublicVisibility !== false) { - writer.uint32(8).bool(message.disallowPublicVisibility); - } - if (message.displayWithUpdateTime !== false) { - writer.uint32(16).bool(message.displayWithUpdateTime); - } - if (message.contentLengthLimit !== 0) { - writer.uint32(24).int32(message.contentLengthLimit); - } - if (message.enableDoubleClickEdit !== false) { - writer.uint32(32).bool(message.enableDoubleClickEdit); - } - for (const v of message.reactions) { - writer.uint32(58).string(v!); - } - if (message.enableBlurNsfwContent !== false) { - writer.uint32(72).bool(message.enableBlurNsfwContent); - } - for (const v of message.nsfwTags) { - writer.uint32(82).string(v!); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): InstanceSetting_MemoRelatedSetting { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInstanceSetting_MemoRelatedSetting(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.disallowPublicVisibility = reader.bool(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.displayWithUpdateTime = reader.bool(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.contentLengthLimit = reader.int32(); - continue; - } - case 4: { - if (tag !== 32) { - break; - } - - message.enableDoubleClickEdit = reader.bool(); - continue; - } - case 7: { - if (tag !== 58) { - break; - } - - message.reactions.push(reader.string()); - continue; - } - case 9: { - if (tag !== 72) { - break; - } - - message.enableBlurNsfwContent = reader.bool(); - continue; - } - case 10: { - if (tag !== 82) { - break; - } - - message.nsfwTags.push(reader.string()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): InstanceSetting_MemoRelatedSetting { - return InstanceSetting_MemoRelatedSetting.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): InstanceSetting_MemoRelatedSetting { - const message = createBaseInstanceSetting_MemoRelatedSetting(); - message.disallowPublicVisibility = object.disallowPublicVisibility ?? false; - message.displayWithUpdateTime = object.displayWithUpdateTime ?? false; - message.contentLengthLimit = object.contentLengthLimit ?? 0; - message.enableDoubleClickEdit = object.enableDoubleClickEdit ?? false; - message.reactions = object.reactions?.map((e) => e) || []; - message.enableBlurNsfwContent = object.enableBlurNsfwContent ?? false; - message.nsfwTags = object.nsfwTags?.map((e) => e) || []; - return message; - }, -}; - -function createBaseGetInstanceSettingRequest(): GetInstanceSettingRequest { - return { name: "" }; -} - -export const GetInstanceSettingRequest: MessageFns = { - encode(message: GetInstanceSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GetInstanceSettingRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetInstanceSettingRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GetInstanceSettingRequest { - return GetInstanceSettingRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GetInstanceSettingRequest { - const message = createBaseGetInstanceSettingRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseUpdateInstanceSettingRequest(): UpdateInstanceSettingRequest { - return { setting: undefined, updateMask: undefined }; -} - -export const UpdateInstanceSettingRequest: MessageFns = { - encode(message: UpdateInstanceSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.setting !== undefined) { - InstanceSetting.encode(message.setting, writer.uint32(10).fork()).join(); - } - if (message.updateMask !== undefined) { - FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UpdateInstanceSettingRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpdateInstanceSettingRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.setting = InstanceSetting.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UpdateInstanceSettingRequest { - return UpdateInstanceSettingRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UpdateInstanceSettingRequest { - const message = createBaseUpdateInstanceSettingRequest(); - message.setting = (object.setting !== undefined && object.setting !== null) - ? InstanceSetting.fromPartial(object.setting) - : undefined; - message.updateMask = object.updateMask ?? undefined; - return message; - }, -}; - -export type InstanceServiceDefinition = typeof InstanceServiceDefinition; -export const InstanceServiceDefinition = { - name: "InstanceService", - fullName: "memos.api.v1.InstanceService", - methods: { - /** Gets the instance profile. */ - getInstanceProfile: { - name: "GetInstanceProfile", - requestType: GetInstanceProfileRequest, - requestStream: false, - responseType: InstanceProfile, - responseStream: false, - options: { - _unknownFields: { - 578365826: [ - new Uint8Array([ - 26, - 18, - 24, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 105, - 110, - 115, - 116, - 97, - 110, - 99, - 101, - 47, - 112, - 114, - 111, - 102, - 105, - 108, - 101, - ]), - ], - }, - }, - }, - /** Gets an instance setting. */ - getInstanceSetting: { - name: "GetInstanceSetting", - requestType: GetInstanceSettingRequest, - requestStream: false, - responseType: InstanceSetting, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 36, - 18, - 34, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 105, - 110, - 115, - 116, - 97, - 110, - 99, - 101, - 47, - 115, - 101, - 116, - 116, - 105, - 110, - 103, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** Updates an instance setting. */ - updateInstanceSetting: { - name: "UpdateInstanceSetting", - requestType: UpdateInstanceSettingRequest, - requestStream: false, - responseType: InstanceSetting, - responseStream: false, - options: { - _unknownFields: { - 8410: [ - new Uint8Array([ - 19, - 115, - 101, - 116, - 116, - 105, - 110, - 103, - 44, - 117, - 112, - 100, - 97, - 116, - 101, - 95, - 109, - 97, - 115, - 107, - ]), - ], - 578365826: [ - new Uint8Array([ - 53, - 58, - 7, - 115, - 101, - 116, - 116, - 105, - 110, - 103, - 50, - 42, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 115, - 101, - 116, - 116, - 105, - 110, - 103, - 46, - 110, - 97, - 109, - 101, - 61, - 105, - 110, - 115, - 116, - 97, - 110, - 99, - 101, - 47, - 115, - 101, - 116, - 116, - 105, - 110, - 103, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - }, -} as const; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -function longToNumber(int64: { toString(): string }): number { - const num = globalThis.Number(int64.toString()); - if (num > globalThis.Number.MAX_SAFE_INTEGER) { - throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); - } - if (num < globalThis.Number.MIN_SAFE_INTEGER) { - throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); - } - return num; -} - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/api/v1/instance_service_pb.ts b/web/src/types/proto/api/v1/instance_service_pb.ts new file mode 100644 index 000000000..d7bd89399 --- /dev/null +++ b/web/src/types/proto/api/v1/instance_service_pb.ts @@ -0,0 +1,540 @@ +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file api/v1/instance_service.proto (package memos.api.v1, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import { file_google_api_annotations } from "../../google/api/annotations_pb"; +import { file_google_api_client } from "../../google/api/client_pb"; +import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; +import { file_google_api_resource } from "../../google/api/resource_pb"; +import type { FieldMask } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_field_mask } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/v1/instance_service.proto. + */ +export const file_api_v1_instance_service: GenFile = /*@__PURE__*/ + fileDesc("Ch1hcGkvdjEvaW5zdGFuY2Vfc2VydmljZS5wcm90bxIMbWVtb3MuYXBpLnYxIlUKD0luc3RhbmNlUHJvZmlsZRINCgVvd25lchgBIAEoCRIPCgd2ZXJzaW9uGAIgASgJEgwKBG1vZGUYAyABKAkSFAoMaW5zdGFuY2VfdXJsGAYgASgJIhsKGUdldEluc3RhbmNlUHJvZmlsZVJlcXVlc3Qi6AsKD0luc3RhbmNlU2V0dGluZxIRCgRuYW1lGAEgASgJQgPgQQgSRwoPZ2VuZXJhbF9zZXR0aW5nGAIgASgLMiwubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5HZW5lcmFsU2V0dGluZ0gAEkcKD3N0b3JhZ2Vfc2V0dGluZxgDIAEoCzIsLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuU3RvcmFnZVNldHRpbmdIABJQChRtZW1vX3JlbGF0ZWRfc2V0dGluZxgEIAEoCzIwLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuTWVtb1JlbGF0ZWRTZXR0aW5nSAAahwMKDkdlbmVyYWxTZXR0aW5nEiIKGmRpc2FsbG93X3VzZXJfcmVnaXN0cmF0aW9uGAIgASgIEh4KFmRpc2FsbG93X3Bhc3N3b3JkX2F1dGgYAyABKAgSGQoRYWRkaXRpb25hbF9zY3JpcHQYBCABKAkSGAoQYWRkaXRpb25hbF9zdHlsZRgFIAEoCRJSCg5jdXN0b21fcHJvZmlsZRgGIAEoCzI6Lm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuR2VuZXJhbFNldHRpbmcuQ3VzdG9tUHJvZmlsZRIdChV3ZWVrX3N0YXJ0X2RheV9vZmZzZXQYByABKAUSIAoYZGlzYWxsb3dfY2hhbmdlX3VzZXJuYW1lGAggASgIEiAKGGRpc2FsbG93X2NoYW5nZV9uaWNrbmFtZRgJIAEoCBpFCg1DdXN0b21Qcm9maWxlEg0KBXRpdGxlGAEgASgJEhMKC2Rlc2NyaXB0aW9uGAIgASgJEhAKCGxvZ29fdXJsGAMgASgJGroDCg5TdG9yYWdlU2V0dGluZxJOCgxzdG9yYWdlX3R5cGUYASABKA4yOC5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLlN0b3JhZ2VTZXR0aW5nLlN0b3JhZ2VUeXBlEhkKEWZpbGVwYXRoX3RlbXBsYXRlGAIgASgJEhwKFHVwbG9hZF9zaXplX2xpbWl0X21iGAMgASgDEkgKCXMzX2NvbmZpZxgEIAEoCzI1Lm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuU3RvcmFnZVNldHRpbmcuUzNDb25maWcahgEKCFMzQ29uZmlnEhUKDWFjY2Vzc19rZXlfaWQYASABKAkSGQoRYWNjZXNzX2tleV9zZWNyZXQYAiABKAkSEAoIZW5kcG9pbnQYAyABKAkSDgoGcmVnaW9uGAQgASgJEg4KBmJ1Y2tldBgFIAEoCRIWCg51c2VfcGF0aF9zdHlsZRgGIAEoCCJMCgtTdG9yYWdlVHlwZRIcChhTVE9SQUdFX1RZUEVfVU5TUEVDSUZJRUQQABIMCghEQVRBQkFTRRABEgkKBUxPQ0FMEAISBgoCUzMQAxriAQoSTWVtb1JlbGF0ZWRTZXR0aW5nEiIKGmRpc2FsbG93X3B1YmxpY192aXNpYmlsaXR5GAEgASgIEiAKGGRpc3BsYXlfd2l0aF91cGRhdGVfdGltZRgCIAEoCBIcChRjb250ZW50X2xlbmd0aF9saW1pdBgDIAEoBRIgChhlbmFibGVfZG91YmxlX2NsaWNrX2VkaXQYBCABKAgSEQoJcmVhY3Rpb25zGAcgAygJEiAKGGVuYWJsZV9ibHVyX25zZndfY29udGVudBgJIAEoCBIRCgluc2Z3X3RhZ3MYCiADKAkiRgoDS2V5EhMKD0tFWV9VTlNQRUNJRklFRBAAEgsKB0dFTkVSQUwQARILCgdTVE9SQUdFEAISEAoMTUVNT19SRUxBVEVEEAM6YepBXgocbWVtb3MuYXBpLnYxL0luc3RhbmNlU2V0dGluZxIbaW5zdGFuY2Uvc2V0dGluZ3Mve3NldHRpbmd9KhBpbnN0YW5jZVNldHRpbmdzMg9pbnN0YW5jZVNldHRpbmdCBwoFdmFsdWUiTwoZR2V0SW5zdGFuY2VTZXR0aW5nUmVxdWVzdBIyCgRuYW1lGAEgASgJQiTgQQL6QR4KHG1lbW9zLmFwaS52MS9JbnN0YW5jZVNldHRpbmciiQEKHFVwZGF0ZUluc3RhbmNlU2V0dGluZ1JlcXVlc3QSMwoHc2V0dGluZxgBIAEoCzIdLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmdCA+BBAhI0Cgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tCA+BBATLbAwoPSW5zdGFuY2VTZXJ2aWNlEn4KEkdldEluc3RhbmNlUHJvZmlsZRInLm1lbW9zLmFwaS52MS5HZXRJbnN0YW5jZVByb2ZpbGVSZXF1ZXN0Gh0ubWVtb3MuYXBpLnYxLkluc3RhbmNlUHJvZmlsZSIggtPkkwIaEhgvYXBpL3YxL2luc3RhbmNlL3Byb2ZpbGUSjwEKEkdldEluc3RhbmNlU2V0dGluZxInLm1lbW9zLmFwaS52MS5HZXRJbnN0YW5jZVNldHRpbmdSZXF1ZXN0Gh0ubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZyIx2kEEbmFtZYLT5JMCJBIiL2FwaS92MS97bmFtZT1pbnN0YW5jZS9zZXR0aW5ncy8qfRK1AQoVVXBkYXRlSW5zdGFuY2VTZXR0aW5nEioubWVtb3MuYXBpLnYxLlVwZGF0ZUluc3RhbmNlU2V0dGluZ1JlcXVlc3QaHS5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nIlHaQRNzZXR0aW5nLHVwZGF0ZV9tYXNrgtPkkwI1OgdzZXR0aW5nMiovYXBpL3YxL3tzZXR0aW5nLm5hbWU9aW5zdGFuY2Uvc2V0dGluZ3MvKn1CrAEKEGNvbS5tZW1vcy5hcGkudjFCFEluc3RhbmNlU2VydmljZVByb3RvUAFaMGdpdGh1Yi5jb20vdXNlbWVtb3MvbWVtb3MvcHJvdG8vZ2VuL2FwaS92MTthcGl2MaICA01BWKoCDE1lbW9zLkFwaS5WMcoCDE1lbW9zXEFwaVxWMeICGE1lbW9zXEFwaVxWMVxHUEJNZXRhZGF0YeoCDk1lbW9zOjpBcGk6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask]); + +/** + * Instance profile message containing basic instance information. + * + * @generated from message memos.api.v1.InstanceProfile + */ +export type InstanceProfile = Message<"memos.api.v1.InstanceProfile"> & { + /** + * The name of instance owner. + * Format: users/{user} + * + * @generated from field: string owner = 1; + */ + owner: string; + + /** + * Version is the current version of instance. + * + * @generated from field: string version = 2; + */ + version: string; + + /** + * Mode is the instance mode (e.g. "prod", "dev" or "demo"). + * + * @generated from field: string mode = 3; + */ + mode: string; + + /** + * Instance URL is the URL of the instance. + * + * @generated from field: string instance_url = 6; + */ + instanceUrl: string; +}; + +/** + * Describes the message memos.api.v1.InstanceProfile. + * Use `create(InstanceProfileSchema)` to create a new message. + */ +export const InstanceProfileSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_instance_service, 0); + +/** + * Request for instance profile. + * + * @generated from message memos.api.v1.GetInstanceProfileRequest + */ +export type GetInstanceProfileRequest = Message<"memos.api.v1.GetInstanceProfileRequest"> & { +}; + +/** + * Describes the message memos.api.v1.GetInstanceProfileRequest. + * Use `create(GetInstanceProfileRequestSchema)` to create a new message. + */ +export const GetInstanceProfileRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_instance_service, 1); + +/** + * An instance setting resource. + * + * @generated from message memos.api.v1.InstanceSetting + */ +export type InstanceSetting = Message<"memos.api.v1.InstanceSetting"> & { + /** + * The name of the instance setting. + * Format: instance/settings/{setting} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * @generated from oneof memos.api.v1.InstanceSetting.value + */ + value: { + /** + * @generated from field: memos.api.v1.InstanceSetting.GeneralSetting general_setting = 2; + */ + value: InstanceSetting_GeneralSetting; + case: "generalSetting"; + } | { + /** + * @generated from field: memos.api.v1.InstanceSetting.StorageSetting storage_setting = 3; + */ + value: InstanceSetting_StorageSetting; + case: "storageSetting"; + } | { + /** + * @generated from field: memos.api.v1.InstanceSetting.MemoRelatedSetting memo_related_setting = 4; + */ + value: InstanceSetting_MemoRelatedSetting; + case: "memoRelatedSetting"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.v1.InstanceSetting. + * Use `create(InstanceSettingSchema)` to create a new message. + */ +export const InstanceSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_instance_service, 2); + +/** + * General instance settings configuration. + * + * @generated from message memos.api.v1.InstanceSetting.GeneralSetting + */ +export type InstanceSetting_GeneralSetting = Message<"memos.api.v1.InstanceSetting.GeneralSetting"> & { + /** + * disallow_user_registration disallows user registration. + * + * @generated from field: bool disallow_user_registration = 2; + */ + disallowUserRegistration: boolean; + + /** + * disallow_password_auth disallows password authentication. + * + * @generated from field: bool disallow_password_auth = 3; + */ + disallowPasswordAuth: boolean; + + /** + * additional_script is the additional script. + * + * @generated from field: string additional_script = 4; + */ + additionalScript: string; + + /** + * additional_style is the additional style. + * + * @generated from field: string additional_style = 5; + */ + additionalStyle: string; + + /** + * custom_profile is the custom profile. + * + * @generated from field: memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile custom_profile = 6; + */ + customProfile?: InstanceSetting_GeneralSetting_CustomProfile; + + /** + * week_start_day_offset is the week start day offset from Sunday. + * 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday + * Default is Sunday. + * + * @generated from field: int32 week_start_day_offset = 7; + */ + weekStartDayOffset: number; + + /** + * disallow_change_username disallows changing username. + * + * @generated from field: bool disallow_change_username = 8; + */ + disallowChangeUsername: boolean; + + /** + * disallow_change_nickname disallows changing nickname. + * + * @generated from field: bool disallow_change_nickname = 9; + */ + disallowChangeNickname: boolean; +}; + +/** + * Describes the message memos.api.v1.InstanceSetting.GeneralSetting. + * Use `create(InstanceSetting_GeneralSettingSchema)` to create a new message. + */ +export const InstanceSetting_GeneralSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_instance_service, 2, 0); + +/** + * Custom profile configuration for instance branding. + * + * @generated from message memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile + */ +export type InstanceSetting_GeneralSetting_CustomProfile = Message<"memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile"> & { + /** + * @generated from field: string title = 1; + */ + title: string; + + /** + * @generated from field: string description = 2; + */ + description: string; + + /** + * @generated from field: string logo_url = 3; + */ + logoUrl: string; +}; + +/** + * Describes the message memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile. + * Use `create(InstanceSetting_GeneralSetting_CustomProfileSchema)` to create a new message. + */ +export const InstanceSetting_GeneralSetting_CustomProfileSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_instance_service, 2, 0, 0); + +/** + * Storage configuration settings for instance attachments. + * + * @generated from message memos.api.v1.InstanceSetting.StorageSetting + */ +export type InstanceSetting_StorageSetting = Message<"memos.api.v1.InstanceSetting.StorageSetting"> & { + /** + * storage_type is the storage type. + * + * @generated from field: memos.api.v1.InstanceSetting.StorageSetting.StorageType storage_type = 1; + */ + storageType: InstanceSetting_StorageSetting_StorageType; + + /** + * The template of file path. + * e.g. assets/{timestamp}_{filename} + * + * @generated from field: string filepath_template = 2; + */ + filepathTemplate: string; + + /** + * The max upload size in megabytes. + * + * @generated from field: int64 upload_size_limit_mb = 3; + */ + uploadSizeLimitMb: bigint; + + /** + * The S3 config. + * + * @generated from field: memos.api.v1.InstanceSetting.StorageSetting.S3Config s3_config = 4; + */ + s3Config?: InstanceSetting_StorageSetting_S3Config; +}; + +/** + * Describes the message memos.api.v1.InstanceSetting.StorageSetting. + * Use `create(InstanceSetting_StorageSettingSchema)` to create a new message. + */ +export const InstanceSetting_StorageSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_instance_service, 2, 1); + +/** + * S3 configuration for cloud storage backend. + * Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ + * + * @generated from message memos.api.v1.InstanceSetting.StorageSetting.S3Config + */ +export type InstanceSetting_StorageSetting_S3Config = Message<"memos.api.v1.InstanceSetting.StorageSetting.S3Config"> & { + /** + * @generated from field: string access_key_id = 1; + */ + accessKeyId: string; + + /** + * @generated from field: string access_key_secret = 2; + */ + accessKeySecret: string; + + /** + * @generated from field: string endpoint = 3; + */ + endpoint: string; + + /** + * @generated from field: string region = 4; + */ + region: string; + + /** + * @generated from field: string bucket = 5; + */ + bucket: string; + + /** + * @generated from field: bool use_path_style = 6; + */ + usePathStyle: boolean; +}; + +/** + * Describes the message memos.api.v1.InstanceSetting.StorageSetting.S3Config. + * Use `create(InstanceSetting_StorageSetting_S3ConfigSchema)` to create a new message. + */ +export const InstanceSetting_StorageSetting_S3ConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_instance_service, 2, 1, 0); + +/** + * Storage type enumeration for different storage backends. + * + * @generated from enum memos.api.v1.InstanceSetting.StorageSetting.StorageType + */ +export enum InstanceSetting_StorageSetting_StorageType { + /** + * @generated from enum value: STORAGE_TYPE_UNSPECIFIED = 0; + */ + STORAGE_TYPE_UNSPECIFIED = 0, + + /** + * DATABASE is the database storage type. + * + * @generated from enum value: DATABASE = 1; + */ + DATABASE = 1, + + /** + * LOCAL is the local storage type. + * + * @generated from enum value: LOCAL = 2; + */ + LOCAL = 2, + + /** + * S3 is the S3 storage type. + * + * @generated from enum value: S3 = 3; + */ + S3 = 3, +} + +/** + * Describes the enum memos.api.v1.InstanceSetting.StorageSetting.StorageType. + */ +export const InstanceSetting_StorageSetting_StorageTypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_v1_instance_service, 2, 1, 0); + +/** + * Memo-related instance settings and policies. + * + * @generated from message memos.api.v1.InstanceSetting.MemoRelatedSetting + */ +export type InstanceSetting_MemoRelatedSetting = Message<"memos.api.v1.InstanceSetting.MemoRelatedSetting"> & { + /** + * disallow_public_visibility disallows set memo as public visibility. + * + * @generated from field: bool disallow_public_visibility = 1; + */ + disallowPublicVisibility: boolean; + + /** + * display_with_update_time orders and displays memo with update time. + * + * @generated from field: bool display_with_update_time = 2; + */ + displayWithUpdateTime: boolean; + + /** + * content_length_limit is the limit of content length. Unit is byte. + * + * @generated from field: int32 content_length_limit = 3; + */ + contentLengthLimit: number; + + /** + * enable_double_click_edit enables editing on double click. + * + * @generated from field: bool enable_double_click_edit = 4; + */ + enableDoubleClickEdit: boolean; + + /** + * reactions is the list of reactions. + * + * @generated from field: repeated string reactions = 7; + */ + reactions: string[]; + + /** + * enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW). + * + * @generated from field: bool enable_blur_nsfw_content = 9; + */ + enableBlurNsfwContent: boolean; + + /** + * nsfw_tags is the list of tags that mark content as NSFW for blurring. + * + * @generated from field: repeated string nsfw_tags = 10; + */ + nsfwTags: string[]; +}; + +/** + * Describes the message memos.api.v1.InstanceSetting.MemoRelatedSetting. + * Use `create(InstanceSetting_MemoRelatedSettingSchema)` to create a new message. + */ +export const InstanceSetting_MemoRelatedSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_instance_service, 2, 2); + +/** + * Enumeration of instance setting keys. + * + * @generated from enum memos.api.v1.InstanceSetting.Key + */ +export enum InstanceSetting_Key { + /** + * @generated from enum value: KEY_UNSPECIFIED = 0; + */ + KEY_UNSPECIFIED = 0, + + /** + * GENERAL is the key for general settings. + * + * @generated from enum value: GENERAL = 1; + */ + GENERAL = 1, + + /** + * STORAGE is the key for storage settings. + * + * @generated from enum value: STORAGE = 2; + */ + STORAGE = 2, + + /** + * MEMO_RELATED is the key for memo related settings. + * + * @generated from enum value: MEMO_RELATED = 3; + */ + MEMO_RELATED = 3, +} + +/** + * Describes the enum memos.api.v1.InstanceSetting.Key. + */ +export const InstanceSetting_KeySchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_v1_instance_service, 2, 0); + +/** + * Request message for GetInstanceSetting method. + * + * @generated from message memos.api.v1.GetInstanceSettingRequest + */ +export type GetInstanceSettingRequest = Message<"memos.api.v1.GetInstanceSettingRequest"> & { + /** + * The resource name of the instance setting. + * Format: instance/settings/{setting} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.GetInstanceSettingRequest. + * Use `create(GetInstanceSettingRequestSchema)` to create a new message. + */ +export const GetInstanceSettingRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_instance_service, 3); + +/** + * Request message for UpdateInstanceSetting method. + * + * @generated from message memos.api.v1.UpdateInstanceSettingRequest + */ +export type UpdateInstanceSettingRequest = Message<"memos.api.v1.UpdateInstanceSettingRequest"> & { + /** + * The instance setting resource which replaces the resource on the server. + * + * @generated from field: memos.api.v1.InstanceSetting setting = 1; + */ + setting?: InstanceSetting; + + /** + * The list of fields to update. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask; +}; + +/** + * Describes the message memos.api.v1.UpdateInstanceSettingRequest. + * Use `create(UpdateInstanceSettingRequestSchema)` to create a new message. + */ +export const UpdateInstanceSettingRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_instance_service, 4); + +/** + * @generated from service memos.api.v1.InstanceService + */ +export const InstanceService: GenService<{ + /** + * Gets the instance profile. + * + * @generated from rpc memos.api.v1.InstanceService.GetInstanceProfile + */ + getInstanceProfile: { + methodKind: "unary"; + input: typeof GetInstanceProfileRequestSchema; + output: typeof InstanceProfileSchema; + }, + /** + * Gets an instance setting. + * + * @generated from rpc memos.api.v1.InstanceService.GetInstanceSetting + */ + getInstanceSetting: { + methodKind: "unary"; + input: typeof GetInstanceSettingRequestSchema; + output: typeof InstanceSettingSchema; + }, + /** + * Updates an instance setting. + * + * @generated from rpc memos.api.v1.InstanceService.UpdateInstanceSetting + */ + updateInstanceSetting: { + methodKind: "unary"; + input: typeof UpdateInstanceSettingRequestSchema; + output: typeof InstanceSettingSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_v1_instance_service, 0); + diff --git a/web/src/types/proto/api/v1/memo_service.ts b/web/src/types/proto/api/v1/memo_service.ts deleted file mode 100644 index 412d5bd02..000000000 --- a/web/src/types/proto/api/v1/memo_service.ts +++ /dev/null @@ -1,3010 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: api/v1/memo_service.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { Empty } from "../../google/protobuf/empty"; -import { FieldMask } from "../../google/protobuf/field_mask"; -import { Timestamp } from "../../google/protobuf/timestamp"; -import { Attachment } from "./attachment_service"; -import { State, stateFromJSON, stateToNumber } from "./common"; - -export const protobufPackage = "memos.api.v1"; - -export enum Visibility { - VISIBILITY_UNSPECIFIED = "VISIBILITY_UNSPECIFIED", - PRIVATE = "PRIVATE", - PROTECTED = "PROTECTED", - PUBLIC = "PUBLIC", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function visibilityFromJSON(object: any): Visibility { - switch (object) { - case 0: - case "VISIBILITY_UNSPECIFIED": - return Visibility.VISIBILITY_UNSPECIFIED; - case 1: - case "PRIVATE": - return Visibility.PRIVATE; - case 2: - case "PROTECTED": - return Visibility.PROTECTED; - case 3: - case "PUBLIC": - return Visibility.PUBLIC; - case -1: - case "UNRECOGNIZED": - default: - return Visibility.UNRECOGNIZED; - } -} - -export function visibilityToNumber(object: Visibility): number { - switch (object) { - case Visibility.VISIBILITY_UNSPECIFIED: - return 0; - case Visibility.PRIVATE: - return 1; - case Visibility.PROTECTED: - return 2; - case Visibility.PUBLIC: - return 3; - case Visibility.UNRECOGNIZED: - default: - return -1; - } -} - -export interface Reaction { - /** - * The resource name of the reaction. - * Format: reactions/{reaction} - */ - name: string; - /** - * The resource name of the creator. - * Format: users/{user} - */ - creator: string; - /** - * The resource name of the content. - * For memo reactions, this should be the memo's resource name. - * Format: memos/{memo} - */ - contentId: string; - /** Required. The type of reaction (e.g., "👍", "❤️", "😄"). */ - reactionType: string; - /** Output only. The creation timestamp. */ - createTime?: Date | undefined; -} - -export interface Memo { - /** - * The resource name of the memo. - * Format: memos/{memo}, memo is the user defined id or uuid. - */ - name: string; - /** The state of the memo. */ - state: State; - /** - * The name of the creator. - * Format: users/{user} - */ - creator: string; - /** Output only. The creation timestamp. */ - createTime?: - | Date - | undefined; - /** Output only. The last update timestamp. */ - updateTime?: - | Date - | undefined; - /** The display timestamp of the memo. */ - displayTime?: - | Date - | undefined; - /** Required. The content of the memo in Markdown format. */ - content: string; - /** The visibility of the memo. */ - visibility: Visibility; - /** Output only. The tags extracted from the content. */ - tags: string[]; - /** Whether the memo is pinned. */ - pinned: boolean; - /** Optional. The attachments of the memo. */ - attachments: Attachment[]; - /** Optional. The relations of the memo. */ - relations: MemoRelation[]; - /** Output only. The reactions to the memo. */ - reactions: Reaction[]; - /** Output only. The computed properties of the memo. */ - property?: - | Memo_Property - | undefined; - /** - * Output only. The name of the parent memo. - * Format: memos/{memo} - */ - parent?: - | string - | undefined; - /** Output only. The snippet of the memo content. Plain text only. */ - snippet: string; - /** Optional. The location of the memo. */ - location?: Location | undefined; -} - -/** Computed properties of a memo. */ -export interface Memo_Property { - hasLink: boolean; - hasTaskList: boolean; - hasCode: boolean; - hasIncompleteTasks: boolean; -} - -export interface Location { - /** A placeholder text for the location. */ - placeholder: string; - /** The latitude of the location. */ - latitude: number; - /** The longitude of the location. */ - longitude: number; -} - -export interface CreateMemoRequest { - /** Required. The memo to create. */ - memo?: - | Memo - | undefined; - /** - * Optional. The memo ID to use for this memo. - * If empty, a unique ID will be generated. - */ - memoId: string; -} - -export interface ListMemosRequest { - /** - * Optional. The maximum number of memos to return. - * The service may return fewer than this value. - * If unspecified, at most 50 memos will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - pageSize: number; - /** - * Optional. A page token, received from a previous `ListMemos` call. - * Provide this to retrieve the subsequent page. - */ - pageToken: string; - /** - * Optional. The state of the memos to list. - * Default to `NORMAL`. Set to `ARCHIVED` to list archived memos. - */ - state: State; - /** - * Optional. The order to sort results by. - * Default to "display_time desc". - * Supports comma-separated list of fields following AIP-132. - * Example: "pinned desc, display_time desc" or "create_time asc" - * Supported fields: pinned, display_time, create_time, update_time, name - */ - orderBy: string; - /** - * Optional. Filter to apply to the list results. - * Filter is a CEL expression to filter memos. - * Refer to `Shortcut.filter`. - */ - filter: string; - /** Optional. If true, show deleted memos in the response. */ - showDeleted: boolean; -} - -export interface ListMemosResponse { - /** The list of memos. */ - memos: Memo[]; - /** - * A token that can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - */ - nextPageToken: string; -} - -export interface GetMemoRequest { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - */ - name: string; -} - -export interface UpdateMemoRequest { - /** - * Required. The memo to update. - * The `name` field is required. - */ - memo?: - | Memo - | undefined; - /** Required. The list of fields to update. */ - updateMask?: string[] | undefined; -} - -export interface DeleteMemoRequest { - /** - * Required. The resource name of the memo to delete. - * Format: memos/{memo} - */ - name: string; - /** Optional. If set to true, the memo will be deleted even if it has associated data. */ - force: boolean; -} - -export interface SetMemoAttachmentsRequest { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - */ - name: string; - /** Required. The attachments to set for the memo. */ - attachments: Attachment[]; -} - -export interface ListMemoAttachmentsRequest { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - */ - name: string; - /** Optional. The maximum number of attachments to return. */ - pageSize: number; - /** Optional. A page token for pagination. */ - pageToken: string; -} - -export interface ListMemoAttachmentsResponse { - /** The list of attachments. */ - attachments: Attachment[]; - /** A token for the next page of results. */ - nextPageToken: string; -} - -export interface MemoRelation { - /** The memo in the relation. */ - memo?: - | MemoRelation_Memo - | undefined; - /** The related memo. */ - relatedMemo?: MemoRelation_Memo | undefined; - type: MemoRelation_Type; -} - -/** The type of the relation. */ -export enum MemoRelation_Type { - TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED", - REFERENCE = "REFERENCE", - COMMENT = "COMMENT", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function memoRelation_TypeFromJSON(object: any): MemoRelation_Type { - switch (object) { - case 0: - case "TYPE_UNSPECIFIED": - return MemoRelation_Type.TYPE_UNSPECIFIED; - case 1: - case "REFERENCE": - return MemoRelation_Type.REFERENCE; - case 2: - case "COMMENT": - return MemoRelation_Type.COMMENT; - case -1: - case "UNRECOGNIZED": - default: - return MemoRelation_Type.UNRECOGNIZED; - } -} - -export function memoRelation_TypeToNumber(object: MemoRelation_Type): number { - switch (object) { - case MemoRelation_Type.TYPE_UNSPECIFIED: - return 0; - case MemoRelation_Type.REFERENCE: - return 1; - case MemoRelation_Type.COMMENT: - return 2; - case MemoRelation_Type.UNRECOGNIZED: - default: - return -1; - } -} - -/** Memo reference in relations. */ -export interface MemoRelation_Memo { - /** - * The resource name of the memo. - * Format: memos/{memo} - */ - name: string; - /** Output only. The snippet of the memo content. Plain text only. */ - snippet: string; -} - -export interface SetMemoRelationsRequest { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - */ - name: string; - /** Required. The relations to set for the memo. */ - relations: MemoRelation[]; -} - -export interface ListMemoRelationsRequest { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - */ - name: string; - /** Optional. The maximum number of relations to return. */ - pageSize: number; - /** Optional. A page token for pagination. */ - pageToken: string; -} - -export interface ListMemoRelationsResponse { - /** The list of relations. */ - relations: MemoRelation[]; - /** A token for the next page of results. */ - nextPageToken: string; -} - -export interface CreateMemoCommentRequest { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - */ - name: string; - /** Required. The comment to create. */ - comment?: - | Memo - | undefined; - /** Optional. The comment ID to use. */ - commentId: string; -} - -export interface ListMemoCommentsRequest { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - */ - name: string; - /** Optional. The maximum number of comments to return. */ - pageSize: number; - /** Optional. A page token for pagination. */ - pageToken: string; - /** Optional. The order to sort results by. */ - orderBy: string; -} - -export interface ListMemoCommentsResponse { - /** The list of comment memos. */ - memos: Memo[]; - /** A token for the next page of results. */ - nextPageToken: string; - /** The total count of comments. */ - totalSize: number; -} - -export interface ListMemoReactionsRequest { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - */ - name: string; - /** Optional. The maximum number of reactions to return. */ - pageSize: number; - /** Optional. A page token for pagination. */ - pageToken: string; -} - -export interface ListMemoReactionsResponse { - /** The list of reactions. */ - reactions: Reaction[]; - /** A token for the next page of results. */ - nextPageToken: string; - /** The total count of reactions. */ - totalSize: number; -} - -export interface UpsertMemoReactionRequest { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - */ - name: string; - /** Required. The reaction to upsert. */ - reaction?: Reaction | undefined; -} - -export interface DeleteMemoReactionRequest { - /** - * Required. The resource name of the reaction to delete. - * Format: reactions/{reaction} - */ - name: string; -} - -function createBaseReaction(): Reaction { - return { name: "", creator: "", contentId: "", reactionType: "", createTime: undefined }; -} - -export const Reaction: MessageFns = { - encode(message: Reaction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.creator !== "") { - writer.uint32(18).string(message.creator); - } - if (message.contentId !== "") { - writer.uint32(26).string(message.contentId); - } - if (message.reactionType !== "") { - writer.uint32(34).string(message.reactionType); - } - if (message.createTime !== undefined) { - Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Reaction { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseReaction(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.creator = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.contentId = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.reactionType = reader.string(); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): Reaction { - return Reaction.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): Reaction { - const message = createBaseReaction(); - message.name = object.name ?? ""; - message.creator = object.creator ?? ""; - message.contentId = object.contentId ?? ""; - message.reactionType = object.reactionType ?? ""; - message.createTime = object.createTime ?? undefined; - return message; - }, -}; - -function createBaseMemo(): Memo { - return { - name: "", - state: State.STATE_UNSPECIFIED, - creator: "", - createTime: undefined, - updateTime: undefined, - displayTime: undefined, - content: "", - visibility: Visibility.VISIBILITY_UNSPECIFIED, - tags: [], - pinned: false, - attachments: [], - relations: [], - reactions: [], - property: undefined, - parent: undefined, - snippet: "", - location: undefined, - }; -} - -export const Memo: MessageFns = { - encode(message: Memo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.state !== State.STATE_UNSPECIFIED) { - writer.uint32(16).int32(stateToNumber(message.state)); - } - if (message.creator !== "") { - writer.uint32(26).string(message.creator); - } - if (message.createTime !== undefined) { - Timestamp.encode(toTimestamp(message.createTime), writer.uint32(34).fork()).join(); - } - if (message.updateTime !== undefined) { - Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(42).fork()).join(); - } - if (message.displayTime !== undefined) { - Timestamp.encode(toTimestamp(message.displayTime), writer.uint32(50).fork()).join(); - } - if (message.content !== "") { - writer.uint32(58).string(message.content); - } - if (message.visibility !== Visibility.VISIBILITY_UNSPECIFIED) { - writer.uint32(72).int32(visibilityToNumber(message.visibility)); - } - for (const v of message.tags) { - writer.uint32(82).string(v!); - } - if (message.pinned !== false) { - writer.uint32(88).bool(message.pinned); - } - for (const v of message.attachments) { - Attachment.encode(v!, writer.uint32(98).fork()).join(); - } - for (const v of message.relations) { - MemoRelation.encode(v!, writer.uint32(106).fork()).join(); - } - for (const v of message.reactions) { - Reaction.encode(v!, writer.uint32(114).fork()).join(); - } - if (message.property !== undefined) { - Memo_Property.encode(message.property, writer.uint32(122).fork()).join(); - } - if (message.parent !== undefined) { - writer.uint32(130).string(message.parent); - } - if (message.snippet !== "") { - writer.uint32(138).string(message.snippet); - } - if (message.location !== undefined) { - Location.encode(message.location, writer.uint32(146).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Memo { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMemo(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.state = stateFromJSON(reader.int32()); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.creator = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.displayTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - case 7: { - if (tag !== 58) { - break; - } - - message.content = reader.string(); - continue; - } - case 9: { - if (tag !== 72) { - break; - } - - message.visibility = visibilityFromJSON(reader.int32()); - continue; - } - case 10: { - if (tag !== 82) { - break; - } - - message.tags.push(reader.string()); - continue; - } - case 11: { - if (tag !== 88) { - break; - } - - message.pinned = reader.bool(); - continue; - } - case 12: { - if (tag !== 98) { - break; - } - - message.attachments.push(Attachment.decode(reader, reader.uint32())); - continue; - } - case 13: { - if (tag !== 106) { - break; - } - - message.relations.push(MemoRelation.decode(reader, reader.uint32())); - continue; - } - case 14: { - if (tag !== 114) { - break; - } - - message.reactions.push(Reaction.decode(reader, reader.uint32())); - continue; - } - case 15: { - if (tag !== 122) { - break; - } - - message.property = Memo_Property.decode(reader, reader.uint32()); - continue; - } - case 16: { - if (tag !== 130) { - break; - } - - message.parent = reader.string(); - continue; - } - case 17: { - if (tag !== 138) { - break; - } - - message.snippet = reader.string(); - continue; - } - case 18: { - if (tag !== 146) { - break; - } - - message.location = Location.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): Memo { - return Memo.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): Memo { - const message = createBaseMemo(); - message.name = object.name ?? ""; - message.state = object.state ?? State.STATE_UNSPECIFIED; - message.creator = object.creator ?? ""; - message.createTime = object.createTime ?? undefined; - message.updateTime = object.updateTime ?? undefined; - message.displayTime = object.displayTime ?? undefined; - message.content = object.content ?? ""; - message.visibility = object.visibility ?? Visibility.VISIBILITY_UNSPECIFIED; - message.tags = object.tags?.map((e) => e) || []; - message.pinned = object.pinned ?? false; - message.attachments = object.attachments?.map((e) => Attachment.fromPartial(e)) || []; - message.relations = object.relations?.map((e) => MemoRelation.fromPartial(e)) || []; - message.reactions = object.reactions?.map((e) => Reaction.fromPartial(e)) || []; - message.property = (object.property !== undefined && object.property !== null) - ? Memo_Property.fromPartial(object.property) - : undefined; - message.parent = object.parent ?? undefined; - message.snippet = object.snippet ?? ""; - message.location = (object.location !== undefined && object.location !== null) - ? Location.fromPartial(object.location) - : undefined; - return message; - }, -}; - -function createBaseMemo_Property(): Memo_Property { - return { hasLink: false, hasTaskList: false, hasCode: false, hasIncompleteTasks: false }; -} - -export const Memo_Property: MessageFns = { - encode(message: Memo_Property, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.hasLink !== false) { - writer.uint32(8).bool(message.hasLink); - } - if (message.hasTaskList !== false) { - writer.uint32(16).bool(message.hasTaskList); - } - if (message.hasCode !== false) { - writer.uint32(24).bool(message.hasCode); - } - if (message.hasIncompleteTasks !== false) { - writer.uint32(32).bool(message.hasIncompleteTasks); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Memo_Property { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMemo_Property(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.hasLink = reader.bool(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.hasTaskList = reader.bool(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.hasCode = reader.bool(); - continue; - } - case 4: { - if (tag !== 32) { - break; - } - - message.hasIncompleteTasks = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): Memo_Property { - return Memo_Property.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): Memo_Property { - const message = createBaseMemo_Property(); - message.hasLink = object.hasLink ?? false; - message.hasTaskList = object.hasTaskList ?? false; - message.hasCode = object.hasCode ?? false; - message.hasIncompleteTasks = object.hasIncompleteTasks ?? false; - return message; - }, -}; - -function createBaseLocation(): Location { - return { placeholder: "", latitude: 0, longitude: 0 }; -} - -export const Location: MessageFns = { - encode(message: Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.placeholder !== "") { - writer.uint32(10).string(message.placeholder); - } - if (message.latitude !== 0) { - writer.uint32(17).double(message.latitude); - } - if (message.longitude !== 0) { - writer.uint32(25).double(message.longitude); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Location { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseLocation(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.placeholder = reader.string(); - continue; - } - case 2: { - if (tag !== 17) { - break; - } - - message.latitude = reader.double(); - continue; - } - case 3: { - if (tag !== 25) { - break; - } - - message.longitude = reader.double(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): Location { - return Location.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): Location { - const message = createBaseLocation(); - message.placeholder = object.placeholder ?? ""; - message.latitude = object.latitude ?? 0; - message.longitude = object.longitude ?? 0; - return message; - }, -}; - -function createBaseCreateMemoRequest(): CreateMemoRequest { - return { memo: undefined, memoId: "" }; -} - -export const CreateMemoRequest: MessageFns = { - encode(message: CreateMemoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.memo !== undefined) { - Memo.encode(message.memo, writer.uint32(10).fork()).join(); - } - if (message.memoId !== "") { - writer.uint32(18).string(message.memoId); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CreateMemoRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateMemoRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.memo = Memo.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.memoId = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CreateMemoRequest { - return CreateMemoRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CreateMemoRequest { - const message = createBaseCreateMemoRequest(); - message.memo = (object.memo !== undefined && object.memo !== null) ? Memo.fromPartial(object.memo) : undefined; - message.memoId = object.memoId ?? ""; - return message; - }, -}; - -function createBaseListMemosRequest(): ListMemosRequest { - return { pageSize: 0, pageToken: "", state: State.STATE_UNSPECIFIED, orderBy: "", filter: "", showDeleted: false }; -} - -export const ListMemosRequest: MessageFns = { - encode(message: ListMemosRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.pageSize !== 0) { - writer.uint32(8).int32(message.pageSize); - } - if (message.pageToken !== "") { - writer.uint32(18).string(message.pageToken); - } - if (message.state !== State.STATE_UNSPECIFIED) { - writer.uint32(24).int32(stateToNumber(message.state)); - } - if (message.orderBy !== "") { - writer.uint32(34).string(message.orderBy); - } - if (message.filter !== "") { - writer.uint32(42).string(message.filter); - } - if (message.showDeleted !== false) { - writer.uint32(48).bool(message.showDeleted); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListMemosRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListMemosRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.pageToken = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.state = stateFromJSON(reader.int32()); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.orderBy = reader.string(); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.filter = reader.string(); - continue; - } - case 6: { - if (tag !== 48) { - break; - } - - message.showDeleted = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListMemosRequest { - return ListMemosRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListMemosRequest { - const message = createBaseListMemosRequest(); - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; - message.state = object.state ?? State.STATE_UNSPECIFIED; - message.orderBy = object.orderBy ?? ""; - message.filter = object.filter ?? ""; - message.showDeleted = object.showDeleted ?? false; - return message; - }, -}; - -function createBaseListMemosResponse(): ListMemosResponse { - return { memos: [], nextPageToken: "" }; -} - -export const ListMemosResponse: MessageFns = { - encode(message: ListMemosResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.memos) { - Memo.encode(v!, writer.uint32(10).fork()).join(); - } - if (message.nextPageToken !== "") { - writer.uint32(18).string(message.nextPageToken); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListMemosResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListMemosResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.memos.push(Memo.decode(reader, reader.uint32())); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.nextPageToken = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListMemosResponse { - return ListMemosResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListMemosResponse { - const message = createBaseListMemosResponse(); - message.memos = object.memos?.map((e) => Memo.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - return message; - }, -}; - -function createBaseGetMemoRequest(): GetMemoRequest { - return { name: "" }; -} - -export const GetMemoRequest: MessageFns = { - encode(message: GetMemoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GetMemoRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetMemoRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GetMemoRequest { - return GetMemoRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GetMemoRequest { - const message = createBaseGetMemoRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseUpdateMemoRequest(): UpdateMemoRequest { - return { memo: undefined, updateMask: undefined }; -} - -export const UpdateMemoRequest: MessageFns = { - encode(message: UpdateMemoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.memo !== undefined) { - Memo.encode(message.memo, writer.uint32(10).fork()).join(); - } - if (message.updateMask !== undefined) { - FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UpdateMemoRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpdateMemoRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.memo = Memo.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UpdateMemoRequest { - return UpdateMemoRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UpdateMemoRequest { - const message = createBaseUpdateMemoRequest(); - message.memo = (object.memo !== undefined && object.memo !== null) ? Memo.fromPartial(object.memo) : undefined; - message.updateMask = object.updateMask ?? undefined; - return message; - }, -}; - -function createBaseDeleteMemoRequest(): DeleteMemoRequest { - return { name: "", force: false }; -} - -export const DeleteMemoRequest: MessageFns = { - encode(message: DeleteMemoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.force !== false) { - writer.uint32(16).bool(message.force); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DeleteMemoRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeleteMemoRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.force = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DeleteMemoRequest { - return DeleteMemoRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DeleteMemoRequest { - const message = createBaseDeleteMemoRequest(); - message.name = object.name ?? ""; - message.force = object.force ?? false; - return message; - }, -}; - -function createBaseSetMemoAttachmentsRequest(): SetMemoAttachmentsRequest { - return { name: "", attachments: [] }; -} - -export const SetMemoAttachmentsRequest: MessageFns = { - encode(message: SetMemoAttachmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - for (const v of message.attachments) { - Attachment.encode(v!, writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): SetMemoAttachmentsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSetMemoAttachmentsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.attachments.push(Attachment.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): SetMemoAttachmentsRequest { - return SetMemoAttachmentsRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): SetMemoAttachmentsRequest { - const message = createBaseSetMemoAttachmentsRequest(); - message.name = object.name ?? ""; - message.attachments = object.attachments?.map((e) => Attachment.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseListMemoAttachmentsRequest(): ListMemoAttachmentsRequest { - return { name: "", pageSize: 0, pageToken: "" }; -} - -export const ListMemoAttachmentsRequest: MessageFns = { - encode(message: ListMemoAttachmentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.pageSize !== 0) { - writer.uint32(16).int32(message.pageSize); - } - if (message.pageToken !== "") { - writer.uint32(26).string(message.pageToken); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListMemoAttachmentsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListMemoAttachmentsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.pageToken = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListMemoAttachmentsRequest { - return ListMemoAttachmentsRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListMemoAttachmentsRequest { - const message = createBaseListMemoAttachmentsRequest(); - message.name = object.name ?? ""; - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; - return message; - }, -}; - -function createBaseListMemoAttachmentsResponse(): ListMemoAttachmentsResponse { - return { attachments: [], nextPageToken: "" }; -} - -export const ListMemoAttachmentsResponse: MessageFns = { - encode(message: ListMemoAttachmentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.attachments) { - Attachment.encode(v!, writer.uint32(10).fork()).join(); - } - if (message.nextPageToken !== "") { - writer.uint32(18).string(message.nextPageToken); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListMemoAttachmentsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListMemoAttachmentsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.attachments.push(Attachment.decode(reader, reader.uint32())); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.nextPageToken = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListMemoAttachmentsResponse { - return ListMemoAttachmentsResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListMemoAttachmentsResponse { - const message = createBaseListMemoAttachmentsResponse(); - message.attachments = object.attachments?.map((e) => Attachment.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - return message; - }, -}; - -function createBaseMemoRelation(): MemoRelation { - return { memo: undefined, relatedMemo: undefined, type: MemoRelation_Type.TYPE_UNSPECIFIED }; -} - -export const MemoRelation: MessageFns = { - encode(message: MemoRelation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.memo !== undefined) { - MemoRelation_Memo.encode(message.memo, writer.uint32(10).fork()).join(); - } - if (message.relatedMemo !== undefined) { - MemoRelation_Memo.encode(message.relatedMemo, writer.uint32(18).fork()).join(); - } - if (message.type !== MemoRelation_Type.TYPE_UNSPECIFIED) { - writer.uint32(24).int32(memoRelation_TypeToNumber(message.type)); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): MemoRelation { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMemoRelation(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.memo = MemoRelation_Memo.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.relatedMemo = MemoRelation_Memo.decode(reader, reader.uint32()); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.type = memoRelation_TypeFromJSON(reader.int32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): MemoRelation { - return MemoRelation.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): MemoRelation { - const message = createBaseMemoRelation(); - message.memo = (object.memo !== undefined && object.memo !== null) - ? MemoRelation_Memo.fromPartial(object.memo) - : undefined; - message.relatedMemo = (object.relatedMemo !== undefined && object.relatedMemo !== null) - ? MemoRelation_Memo.fromPartial(object.relatedMemo) - : undefined; - message.type = object.type ?? MemoRelation_Type.TYPE_UNSPECIFIED; - return message; - }, -}; - -function createBaseMemoRelation_Memo(): MemoRelation_Memo { - return { name: "", snippet: "" }; -} - -export const MemoRelation_Memo: MessageFns = { - encode(message: MemoRelation_Memo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.snippet !== "") { - writer.uint32(18).string(message.snippet); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): MemoRelation_Memo { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMemoRelation_Memo(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.snippet = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): MemoRelation_Memo { - return MemoRelation_Memo.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): MemoRelation_Memo { - const message = createBaseMemoRelation_Memo(); - message.name = object.name ?? ""; - message.snippet = object.snippet ?? ""; - return message; - }, -}; - -function createBaseSetMemoRelationsRequest(): SetMemoRelationsRequest { - return { name: "", relations: [] }; -} - -export const SetMemoRelationsRequest: MessageFns = { - encode(message: SetMemoRelationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - for (const v of message.relations) { - MemoRelation.encode(v!, writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): SetMemoRelationsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSetMemoRelationsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.relations.push(MemoRelation.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): SetMemoRelationsRequest { - return SetMemoRelationsRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): SetMemoRelationsRequest { - const message = createBaseSetMemoRelationsRequest(); - message.name = object.name ?? ""; - message.relations = object.relations?.map((e) => MemoRelation.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseListMemoRelationsRequest(): ListMemoRelationsRequest { - return { name: "", pageSize: 0, pageToken: "" }; -} - -export const ListMemoRelationsRequest: MessageFns = { - encode(message: ListMemoRelationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.pageSize !== 0) { - writer.uint32(16).int32(message.pageSize); - } - if (message.pageToken !== "") { - writer.uint32(26).string(message.pageToken); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListMemoRelationsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListMemoRelationsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.pageToken = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListMemoRelationsRequest { - return ListMemoRelationsRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListMemoRelationsRequest { - const message = createBaseListMemoRelationsRequest(); - message.name = object.name ?? ""; - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; - return message; - }, -}; - -function createBaseListMemoRelationsResponse(): ListMemoRelationsResponse { - return { relations: [], nextPageToken: "" }; -} - -export const ListMemoRelationsResponse: MessageFns = { - encode(message: ListMemoRelationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.relations) { - MemoRelation.encode(v!, writer.uint32(10).fork()).join(); - } - if (message.nextPageToken !== "") { - writer.uint32(18).string(message.nextPageToken); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListMemoRelationsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListMemoRelationsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.relations.push(MemoRelation.decode(reader, reader.uint32())); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.nextPageToken = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListMemoRelationsResponse { - return ListMemoRelationsResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListMemoRelationsResponse { - const message = createBaseListMemoRelationsResponse(); - message.relations = object.relations?.map((e) => MemoRelation.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - return message; - }, -}; - -function createBaseCreateMemoCommentRequest(): CreateMemoCommentRequest { - return { name: "", comment: undefined, commentId: "" }; -} - -export const CreateMemoCommentRequest: MessageFns = { - encode(message: CreateMemoCommentRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.comment !== undefined) { - Memo.encode(message.comment, writer.uint32(18).fork()).join(); - } - if (message.commentId !== "") { - writer.uint32(26).string(message.commentId); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CreateMemoCommentRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateMemoCommentRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.comment = Memo.decode(reader, reader.uint32()); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.commentId = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CreateMemoCommentRequest { - return CreateMemoCommentRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CreateMemoCommentRequest { - const message = createBaseCreateMemoCommentRequest(); - message.name = object.name ?? ""; - message.comment = (object.comment !== undefined && object.comment !== null) - ? Memo.fromPartial(object.comment) - : undefined; - message.commentId = object.commentId ?? ""; - return message; - }, -}; - -function createBaseListMemoCommentsRequest(): ListMemoCommentsRequest { - return { name: "", pageSize: 0, pageToken: "", orderBy: "" }; -} - -export const ListMemoCommentsRequest: MessageFns = { - encode(message: ListMemoCommentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.pageSize !== 0) { - writer.uint32(16).int32(message.pageSize); - } - if (message.pageToken !== "") { - writer.uint32(26).string(message.pageToken); - } - if (message.orderBy !== "") { - writer.uint32(34).string(message.orderBy); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListMemoCommentsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListMemoCommentsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.pageToken = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.orderBy = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListMemoCommentsRequest { - return ListMemoCommentsRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListMemoCommentsRequest { - const message = createBaseListMemoCommentsRequest(); - message.name = object.name ?? ""; - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; - message.orderBy = object.orderBy ?? ""; - return message; - }, -}; - -function createBaseListMemoCommentsResponse(): ListMemoCommentsResponse { - return { memos: [], nextPageToken: "", totalSize: 0 }; -} - -export const ListMemoCommentsResponse: MessageFns = { - encode(message: ListMemoCommentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.memos) { - Memo.encode(v!, writer.uint32(10).fork()).join(); - } - if (message.nextPageToken !== "") { - writer.uint32(18).string(message.nextPageToken); - } - if (message.totalSize !== 0) { - writer.uint32(24).int32(message.totalSize); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListMemoCommentsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListMemoCommentsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.memos.push(Memo.decode(reader, reader.uint32())); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.nextPageToken = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.totalSize = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListMemoCommentsResponse { - return ListMemoCommentsResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListMemoCommentsResponse { - const message = createBaseListMemoCommentsResponse(); - message.memos = object.memos?.map((e) => Memo.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - message.totalSize = object.totalSize ?? 0; - return message; - }, -}; - -function createBaseListMemoReactionsRequest(): ListMemoReactionsRequest { - return { name: "", pageSize: 0, pageToken: "" }; -} - -export const ListMemoReactionsRequest: MessageFns = { - encode(message: ListMemoReactionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.pageSize !== 0) { - writer.uint32(16).int32(message.pageSize); - } - if (message.pageToken !== "") { - writer.uint32(26).string(message.pageToken); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListMemoReactionsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListMemoReactionsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.pageToken = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListMemoReactionsRequest { - return ListMemoReactionsRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListMemoReactionsRequest { - const message = createBaseListMemoReactionsRequest(); - message.name = object.name ?? ""; - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; - return message; - }, -}; - -function createBaseListMemoReactionsResponse(): ListMemoReactionsResponse { - return { reactions: [], nextPageToken: "", totalSize: 0 }; -} - -export const ListMemoReactionsResponse: MessageFns = { - encode(message: ListMemoReactionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.reactions) { - Reaction.encode(v!, writer.uint32(10).fork()).join(); - } - if (message.nextPageToken !== "") { - writer.uint32(18).string(message.nextPageToken); - } - if (message.totalSize !== 0) { - writer.uint32(24).int32(message.totalSize); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListMemoReactionsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListMemoReactionsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.reactions.push(Reaction.decode(reader, reader.uint32())); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.nextPageToken = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.totalSize = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListMemoReactionsResponse { - return ListMemoReactionsResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListMemoReactionsResponse { - const message = createBaseListMemoReactionsResponse(); - message.reactions = object.reactions?.map((e) => Reaction.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - message.totalSize = object.totalSize ?? 0; - return message; - }, -}; - -function createBaseUpsertMemoReactionRequest(): UpsertMemoReactionRequest { - return { name: "", reaction: undefined }; -} - -export const UpsertMemoReactionRequest: MessageFns = { - encode(message: UpsertMemoReactionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.reaction !== undefined) { - Reaction.encode(message.reaction, writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UpsertMemoReactionRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpsertMemoReactionRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.reaction = Reaction.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UpsertMemoReactionRequest { - return UpsertMemoReactionRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UpsertMemoReactionRequest { - const message = createBaseUpsertMemoReactionRequest(); - message.name = object.name ?? ""; - message.reaction = (object.reaction !== undefined && object.reaction !== null) - ? Reaction.fromPartial(object.reaction) - : undefined; - return message; - }, -}; - -function createBaseDeleteMemoReactionRequest(): DeleteMemoReactionRequest { - return { name: "" }; -} - -export const DeleteMemoReactionRequest: MessageFns = { - encode(message: DeleteMemoReactionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DeleteMemoReactionRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeleteMemoReactionRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DeleteMemoReactionRequest { - return DeleteMemoReactionRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DeleteMemoReactionRequest { - const message = createBaseDeleteMemoReactionRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -export type MemoServiceDefinition = typeof MemoServiceDefinition; -export const MemoServiceDefinition = { - name: "MemoService", - fullName: "memos.api.v1.MemoService", - methods: { - /** CreateMemo creates a memo. */ - createMemo: { - name: "CreateMemo", - requestType: CreateMemoRequest, - requestStream: false, - responseType: Memo, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 109, 101, 109, 111])], - 578365826: [ - new Uint8Array([ - 21, - 58, - 4, - 109, - 101, - 109, - 111, - 34, - 13, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 109, - 101, - 109, - 111, - 115, - ]), - ], - }, - }, - }, - /** ListMemos lists memos with pagination and filter. */ - listMemos: { - name: "ListMemos", - requestType: ListMemosRequest, - requestStream: false, - responseType: ListMemosResponse, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([0])], - 578365826: [new Uint8Array([15, 18, 13, 47, 97, 112, 105, 47, 118, 49, 47, 109, 101, 109, 111, 115])], - }, - }, - }, - /** GetMemo gets a memo. */ - getMemo: { - name: "GetMemo", - requestType: GetMemoRequest, - requestStream: false, - responseType: Memo, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 24, - 18, - 22, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 109, - 101, - 109, - 111, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** UpdateMemo updates a memo. */ - updateMemo: { - name: "UpdateMemo", - requestType: UpdateMemoRequest, - requestStream: false, - responseType: Memo, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([16, 109, 101, 109, 111, 44, 117, 112, 100, 97, 116, 101, 95, 109, 97, 115, 107])], - 578365826: [ - new Uint8Array([ - 35, - 58, - 4, - 109, - 101, - 109, - 111, - 50, - 27, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 109, - 101, - 109, - 111, - 46, - 110, - 97, - 109, - 101, - 61, - 109, - 101, - 109, - 111, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** DeleteMemo deletes a memo. */ - deleteMemo: { - name: "DeleteMemo", - requestType: DeleteMemoRequest, - requestStream: false, - responseType: Empty, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 24, - 42, - 22, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 109, - 101, - 109, - 111, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** SetMemoAttachments sets attachments for a memo. */ - setMemoAttachments: { - name: "SetMemoAttachments", - requestType: SetMemoAttachmentsRequest, - requestStream: false, - responseType: Empty, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 39, - 58, - 1, - 42, - 50, - 34, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 109, - 101, - 109, - 111, - 115, - 47, - 42, - 125, - 47, - 97, - 116, - 116, - 97, - 99, - 104, - 109, - 101, - 110, - 116, - 115, - ]), - ], - }, - }, - }, - /** ListMemoAttachments lists attachments for a memo. */ - listMemoAttachments: { - name: "ListMemoAttachments", - requestType: ListMemoAttachmentsRequest, - requestStream: false, - responseType: ListMemoAttachmentsResponse, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 36, - 18, - 34, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 109, - 101, - 109, - 111, - 115, - 47, - 42, - 125, - 47, - 97, - 116, - 116, - 97, - 99, - 104, - 109, - 101, - 110, - 116, - 115, - ]), - ], - }, - }, - }, - /** SetMemoRelations sets relations for a memo. */ - setMemoRelations: { - name: "SetMemoRelations", - requestType: SetMemoRelationsRequest, - requestStream: false, - responseType: Empty, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 37, - 58, - 1, - 42, - 50, - 32, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 109, - 101, - 109, - 111, - 115, - 47, - 42, - 125, - 47, - 114, - 101, - 108, - 97, - 116, - 105, - 111, - 110, - 115, - ]), - ], - }, - }, - }, - /** ListMemoRelations lists relations for a memo. */ - listMemoRelations: { - name: "ListMemoRelations", - requestType: ListMemoRelationsRequest, - requestStream: false, - responseType: ListMemoRelationsResponse, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 34, - 18, - 32, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 109, - 101, - 109, - 111, - 115, - 47, - 42, - 125, - 47, - 114, - 101, - 108, - 97, - 116, - 105, - 111, - 110, - 115, - ]), - ], - }, - }, - }, - /** CreateMemoComment creates a comment for a memo. */ - createMemoComment: { - name: "CreateMemoComment", - requestType: CreateMemoCommentRequest, - requestStream: false, - responseType: Memo, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([12, 110, 97, 109, 101, 44, 99, 111, 109, 109, 101, 110, 116])], - 578365826: [ - new Uint8Array([ - 42, - 58, - 7, - 99, - 111, - 109, - 109, - 101, - 110, - 116, - 34, - 31, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 109, - 101, - 109, - 111, - 115, - 47, - 42, - 125, - 47, - 99, - 111, - 109, - 109, - 101, - 110, - 116, - 115, - ]), - ], - }, - }, - }, - /** ListMemoComments lists comments for a memo. */ - listMemoComments: { - name: "ListMemoComments", - requestType: ListMemoCommentsRequest, - requestStream: false, - responseType: ListMemoCommentsResponse, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 33, - 18, - 31, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 109, - 101, - 109, - 111, - 115, - 47, - 42, - 125, - 47, - 99, - 111, - 109, - 109, - 101, - 110, - 116, - 115, - ]), - ], - }, - }, - }, - /** ListMemoReactions lists reactions for a memo. */ - listMemoReactions: { - name: "ListMemoReactions", - requestType: ListMemoReactionsRequest, - requestStream: false, - responseType: ListMemoReactionsResponse, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 34, - 18, - 32, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 109, - 101, - 109, - 111, - 115, - 47, - 42, - 125, - 47, - 114, - 101, - 97, - 99, - 116, - 105, - 111, - 110, - 115, - ]), - ], - }, - }, - }, - /** UpsertMemoReaction upserts a reaction for a memo. */ - upsertMemoReaction: { - name: "UpsertMemoReaction", - requestType: UpsertMemoReactionRequest, - requestStream: false, - responseType: Reaction, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 37, - 58, - 1, - 42, - 34, - 32, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 109, - 101, - 109, - 111, - 115, - 47, - 42, - 125, - 47, - 114, - 101, - 97, - 99, - 116, - 105, - 111, - 110, - 115, - ]), - ], - }, - }, - }, - /** DeleteMemoReaction deletes a reaction for a memo. */ - deleteMemoReaction: { - name: "DeleteMemoReaction", - requestType: DeleteMemoReactionRequest, - requestStream: false, - responseType: Empty, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 28, - 42, - 26, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 114, - 101, - 97, - 99, - 116, - 105, - 111, - 110, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - }, -} as const; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -function toTimestamp(date: Date): Timestamp { - const seconds = Math.trunc(date.getTime() / 1_000); - const nanos = (date.getTime() % 1_000) * 1_000_000; - return { seconds, nanos }; -} - -function fromTimestamp(t: Timestamp): Date { - let millis = (t.seconds || 0) * 1_000; - millis += (t.nanos || 0) / 1_000_000; - return new globalThis.Date(millis); -} - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/api/v1/memo_service_pb.ts b/web/src/types/proto/api/v1/memo_service_pb.ts new file mode 100644 index 000000000..5b961fd6f --- /dev/null +++ b/web/src/types/proto/api/v1/memo_service_pb.ts @@ -0,0 +1,1131 @@ +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file api/v1/memo_service.proto (package memos.api.v1, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import type { Attachment } from "./attachment_service_pb"; +import { file_api_v1_attachment_service } from "./attachment_service_pb"; +import type { State } from "./common_pb"; +import { file_api_v1_common } from "./common_pb"; +import { file_google_api_annotations } from "../../google/api/annotations_pb"; +import { file_google_api_client } from "../../google/api/client_pb"; +import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; +import { file_google_api_resource } from "../../google/api/resource_pb"; +import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/v1/memo_service.proto. + */ +export const file_api_v1_memo_service: GenFile = /*@__PURE__*/ + fileDesc("ChlhcGkvdjEvbWVtb19zZXJ2aWNlLnByb3RvEgxtZW1vcy5hcGkudjEimgIKCFJlYWN0aW9uEhQKBG5hbWUYASABKAlCBuBBA+BBCBIqCgdjcmVhdG9yGAIgASgJQhngQQP6QRMKEW1lbW9zLmFwaS52MS9Vc2VyEi0KCmNvbnRlbnRfaWQYAyABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL01lbW8SGgoNcmVhY3Rpb25fdHlwZRgEIAEoCUID4EECEjQKC2NyZWF0ZV90aW1lGAUgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDOkvqQUgKFW1lbW9zLmFwaS52MS9SZWFjdGlvbhIUcmVhY3Rpb25zL3tyZWFjdGlvbn0aBG5hbWUqCXJlYWN0aW9uczIIcmVhY3Rpb24i/gYKBE1lbW8SEQoEbmFtZRgBIAEoCUID4EEIEicKBXN0YXRlGAIgASgOMhMubWVtb3MuYXBpLnYxLlN0YXRlQgPgQQISKgoHY3JlYXRvchgDIAEoCUIZ4EED+kETChFtZW1vcy5hcGkudjEvVXNlchI0CgtjcmVhdGVfdGltZRgEIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI0Cgt1cGRhdGVfdGltZRgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI1CgxkaXNwbGF5X3RpbWUYBiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQESFAoHY29udGVudBgHIAEoCUID4EECEjEKCnZpc2liaWxpdHkYCSABKA4yGC5tZW1vcy5hcGkudjEuVmlzaWJpbGl0eUID4EECEhEKBHRhZ3MYCiADKAlCA+BBAxITCgZwaW5uZWQYCyABKAhCA+BBARIyCgthdHRhY2htZW50cxgMIAMoCzIYLm1lbW9zLmFwaS52MS5BdHRhY2htZW50QgPgQQESMgoJcmVsYXRpb25zGA0gAygLMhoubWVtb3MuYXBpLnYxLk1lbW9SZWxhdGlvbkID4EEBEi4KCXJlYWN0aW9ucxgOIAMoCzIWLm1lbW9zLmFwaS52MS5SZWFjdGlvbkID4EEDEjIKCHByb3BlcnR5GA8gASgLMhsubWVtb3MuYXBpLnYxLk1lbW8uUHJvcGVydHlCA+BBAxIuCgZwYXJlbnQYECABKAlCGeBBA/pBEwoRbWVtb3MuYXBpLnYxL01lbW9IAIgBARIUCgdzbmlwcGV0GBEgASgJQgPgQQMSMgoIbG9jYXRpb24YEiABKAsyFi5tZW1vcy5hcGkudjEuTG9jYXRpb25CA+BBAUgBiAEBGmMKCFByb3BlcnR5EhAKCGhhc19saW5rGAEgASgIEhUKDWhhc190YXNrX2xpc3QYAiABKAgSEAoIaGFzX2NvZGUYAyABKAgSHAoUaGFzX2luY29tcGxldGVfdGFza3MYBCABKAg6N+pBNAoRbWVtb3MuYXBpLnYxL01lbW8SDG1lbW9zL3ttZW1vfRoEbmFtZSoFbWVtb3MyBG1lbW9CCQoHX3BhcmVudEILCglfbG9jYXRpb24iUwoITG9jYXRpb24SGAoLcGxhY2Vob2xkZXIYASABKAlCA+BBARIVCghsYXRpdHVkZRgCIAEoAUID4EEBEhYKCWxvbmdpdHVkZRgDIAEoAUID4EEBIlAKEUNyZWF0ZU1lbW9SZXF1ZXN0EiUKBG1lbW8YASABKAsyEi5tZW1vcy5hcGkudjEuTWVtb0ID4EECEhQKB21lbW9faWQYAiABKAlCA+BBASKzAQoQTGlzdE1lbW9zUmVxdWVzdBIWCglwYWdlX3NpemUYASABKAVCA+BBARIXCgpwYWdlX3Rva2VuGAIgASgJQgPgQQESJwoFc3RhdGUYAyABKA4yEy5tZW1vcy5hcGkudjEuU3RhdGVCA+BBARIVCghvcmRlcl9ieRgEIAEoCUID4EEBEhMKBmZpbHRlchgFIAEoCUID4EEBEhkKDHNob3dfZGVsZXRlZBgGIAEoCEID4EEBIk8KEUxpc3RNZW1vc1Jlc3BvbnNlEiEKBW1lbW9zGAEgAygLMhIubWVtb3MuYXBpLnYxLk1lbW8SFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIjkKDkdldE1lbW9SZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL01lbW8icAoRVXBkYXRlTWVtb1JlcXVlc3QSJQoEbWVtbxgBIAEoCzISLm1lbW9zLmFwaS52MS5NZW1vQgPgQQISNAoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQIiUAoRRGVsZXRlTWVtb1JlcXVlc3QSJwoEbmFtZRgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvTWVtbxISCgVmb3JjZRgCIAEoCEID4EEBIngKGVNldE1lbW9BdHRhY2htZW50c1JlcXVlc3QSJwoEbmFtZRgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvTWVtbxIyCgthdHRhY2htZW50cxgCIAMoCzIYLm1lbW9zLmFwaS52MS5BdHRhY2htZW50QgPgQQIidgoaTGlzdE1lbW9BdHRhY2htZW50c1JlcXVlc3QSJwoEbmFtZRgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvTWVtbxIWCglwYWdlX3NpemUYAiABKAVCA+BBARIXCgpwYWdlX3Rva2VuGAMgASgJQgPgQQEiZQobTGlzdE1lbW9BdHRhY2htZW50c1Jlc3BvbnNlEi0KC2F0dGFjaG1lbnRzGAEgAygLMhgubWVtb3MuYXBpLnYxLkF0dGFjaG1lbnQSFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIrMCCgxNZW1vUmVsYXRpb24SMgoEbWVtbxgBIAEoCzIfLm1lbW9zLmFwaS52MS5NZW1vUmVsYXRpb24uTWVtb0ID4EECEjoKDHJlbGF0ZWRfbWVtbxgCIAEoCzIfLm1lbW9zLmFwaS52MS5NZW1vUmVsYXRpb24uTWVtb0ID4EECEjIKBHR5cGUYAyABKA4yHy5tZW1vcy5hcGkudjEuTWVtb1JlbGF0aW9uLlR5cGVCA+BBAhpFCgRNZW1vEicKBG5hbWUYASABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL01lbW8SFAoHc25pcHBldBgCIAEoCUID4EEDIjgKBFR5cGUSFAoQVFlQRV9VTlNQRUNJRklFRBAAEg0KCVJFRkVSRU5DRRABEgsKB0NPTU1FTlQQAiJ2ChdTZXRNZW1vUmVsYXRpb25zUmVxdWVzdBInCgRuYW1lGAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9NZW1vEjIKCXJlbGF0aW9ucxgCIAMoCzIaLm1lbW9zLmFwaS52MS5NZW1vUmVsYXRpb25CA+BBAiJ0ChhMaXN0TWVtb1JlbGF0aW9uc1JlcXVlc3QSJwoEbmFtZRgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvTWVtbxIWCglwYWdlX3NpemUYAiABKAVCA+BBARIXCgpwYWdlX3Rva2VuGAMgASgJQgPgQQEiYwoZTGlzdE1lbW9SZWxhdGlvbnNSZXNwb25zZRItCglyZWxhdGlvbnMYASADKAsyGi5tZW1vcy5hcGkudjEuTWVtb1JlbGF0aW9uEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSKGAQoYQ3JlYXRlTWVtb0NvbW1lbnRSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL01lbW8SKAoHY29tbWVudBgCIAEoCzISLm1lbW9zLmFwaS52MS5NZW1vQgPgQQISFwoKY29tbWVudF9pZBgDIAEoCUID4EEBIooBChdMaXN0TWVtb0NvbW1lbnRzUmVxdWVzdBInCgRuYW1lGAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9NZW1vEhYKCXBhZ2Vfc2l6ZRgCIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAyABKAlCA+BBARIVCghvcmRlcl9ieRgEIAEoCUID4EEBImoKGExpc3RNZW1vQ29tbWVudHNSZXNwb25zZRIhCgVtZW1vcxgBIAMoCzISLm1lbW9zLmFwaS52MS5NZW1vEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCRISCgp0b3RhbF9zaXplGAMgASgFInQKGExpc3RNZW1vUmVhY3Rpb25zUmVxdWVzdBInCgRuYW1lGAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9NZW1vEhYKCXBhZ2Vfc2l6ZRgCIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAyABKAlCA+BBASJzChlMaXN0TWVtb1JlYWN0aW9uc1Jlc3BvbnNlEikKCXJlYWN0aW9ucxgBIAMoCzIWLm1lbW9zLmFwaS52MS5SZWFjdGlvbhIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkSEgoKdG90YWxfc2l6ZRgDIAEoBSJzChlVcHNlcnRNZW1vUmVhY3Rpb25SZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL01lbW8SLQoIcmVhY3Rpb24YAiABKAsyFi5tZW1vcy5hcGkudjEuUmVhY3Rpb25CA+BBAiJIChlEZWxldGVNZW1vUmVhY3Rpb25SZXF1ZXN0EisKBG5hbWUYASABKAlCHeBBAvpBFwoVbWVtb3MuYXBpLnYxL1JlYWN0aW9uKlAKClZpc2liaWxpdHkSGgoWVklTSUJJTElUWV9VTlNQRUNJRklFRBAAEgsKB1BSSVZBVEUQARINCglQUk9URUNURUQQAhIKCgZQVUJMSUMQAzLLDgoLTWVtb1NlcnZpY2USZQoKQ3JlYXRlTWVtbxIfLm1lbW9zLmFwaS52MS5DcmVhdGVNZW1vUmVxdWVzdBoSLm1lbW9zLmFwaS52MS5NZW1vIiLaQQRtZW1vgtPkkwIVOgRtZW1vIg0vYXBpL3YxL21lbW9zEmYKCUxpc3RNZW1vcxIeLm1lbW9zLmFwaS52MS5MaXN0TWVtb3NSZXF1ZXN0Gh8ubWVtb3MuYXBpLnYxLkxpc3RNZW1vc1Jlc3BvbnNlIhjaQQCC0+STAg8SDS9hcGkvdjEvbWVtb3MSYgoHR2V0TWVtbxIcLm1lbW9zLmFwaS52MS5HZXRNZW1vUmVxdWVzdBoSLm1lbW9zLmFwaS52MS5NZW1vIiXaQQRuYW1lgtPkkwIYEhYvYXBpL3YxL3tuYW1lPW1lbW9zLyp9En8KClVwZGF0ZU1lbW8SHy5tZW1vcy5hcGkudjEuVXBkYXRlTWVtb1JlcXVlc3QaEi5tZW1vcy5hcGkudjEuTWVtbyI82kEQbWVtbyx1cGRhdGVfbWFza4LT5JMCIzoEbWVtbzIbL2FwaS92MS97bWVtby5uYW1lPW1lbW9zLyp9EmwKCkRlbGV0ZU1lbW8SHy5tZW1vcy5hcGkudjEuRGVsZXRlTWVtb1JlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiJdpBBG5hbWWC0+STAhgqFi9hcGkvdjEve25hbWU9bWVtb3MvKn0SiwEKElNldE1lbW9BdHRhY2htZW50cxInLm1lbW9zLmFwaS52MS5TZXRNZW1vQXR0YWNobWVudHNSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IjTaQQRuYW1lgtPkkwInOgEqMiIvYXBpL3YxL3tuYW1lPW1lbW9zLyp9L2F0dGFjaG1lbnRzEp0BChNMaXN0TWVtb0F0dGFjaG1lbnRzEigubWVtb3MuYXBpLnYxLkxpc3RNZW1vQXR0YWNobWVudHNSZXF1ZXN0GikubWVtb3MuYXBpLnYxLkxpc3RNZW1vQXR0YWNobWVudHNSZXNwb25zZSIx2kEEbmFtZYLT5JMCJBIiL2FwaS92MS97bmFtZT1tZW1vcy8qfS9hdHRhY2htZW50cxKFAQoQU2V0TWVtb1JlbGF0aW9ucxIlLm1lbW9zLmFwaS52MS5TZXRNZW1vUmVsYXRpb25zUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIy2kEEbmFtZYLT5JMCJToBKjIgL2FwaS92MS97bmFtZT1tZW1vcy8qfS9yZWxhdGlvbnMSlQEKEUxpc3RNZW1vUmVsYXRpb25zEiYubWVtb3MuYXBpLnYxLkxpc3RNZW1vUmVsYXRpb25zUmVxdWVzdBonLm1lbW9zLmFwaS52MS5MaXN0TWVtb1JlbGF0aW9uc1Jlc3BvbnNlIi/aQQRuYW1lgtPkkwIiEiAvYXBpL3YxL3tuYW1lPW1lbW9zLyp9L3JlbGF0aW9ucxKQAQoRQ3JlYXRlTWVtb0NvbW1lbnQSJi5tZW1vcy5hcGkudjEuQ3JlYXRlTWVtb0NvbW1lbnRSZXF1ZXN0GhIubWVtb3MuYXBpLnYxLk1lbW8iP9pBDG5hbWUsY29tbWVudILT5JMCKjoHY29tbWVudCIfL2FwaS92MS97bmFtZT1tZW1vcy8qfS9jb21tZW50cxKRAQoQTGlzdE1lbW9Db21tZW50cxIlLm1lbW9zLmFwaS52MS5MaXN0TWVtb0NvbW1lbnRzUmVxdWVzdBomLm1lbW9zLmFwaS52MS5MaXN0TWVtb0NvbW1lbnRzUmVzcG9uc2UiLtpBBG5hbWWC0+STAiESHy9hcGkvdjEve25hbWU9bWVtb3MvKn0vY29tbWVudHMSlQEKEUxpc3RNZW1vUmVhY3Rpb25zEiYubWVtb3MuYXBpLnYxLkxpc3RNZW1vUmVhY3Rpb25zUmVxdWVzdBonLm1lbW9zLmFwaS52MS5MaXN0TWVtb1JlYWN0aW9uc1Jlc3BvbnNlIi/aQQRuYW1lgtPkkwIiEiAvYXBpL3YxL3tuYW1lPW1lbW9zLyp9L3JlYWN0aW9ucxKJAQoSVXBzZXJ0TWVtb1JlYWN0aW9uEicubWVtb3MuYXBpLnYxLlVwc2VydE1lbW9SZWFjdGlvblJlcXVlc3QaFi5tZW1vcy5hcGkudjEuUmVhY3Rpb24iMtpBBG5hbWWC0+STAiU6ASoiIC9hcGkvdjEve25hbWU9bWVtb3MvKn0vcmVhY3Rpb25zEoABChJEZWxldGVNZW1vUmVhY3Rpb24SJy5tZW1vcy5hcGkudjEuRGVsZXRlTWVtb1JlYWN0aW9uUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIp2kEEbmFtZYLT5JMCHCoaL2FwaS92MS97bmFtZT1yZWFjdGlvbnMvKn1CqAEKEGNvbS5tZW1vcy5hcGkudjFCEE1lbW9TZXJ2aWNlUHJvdG9QAVowZ2l0aHViLmNvbS91c2VtZW1vcy9tZW1vcy9wcm90by9nZW4vYXBpL3YxO2FwaXYxogIDTUFYqgIMTWVtb3MuQXBpLlYxygIMTWVtb3NcQXBpXFYx4gIYTWVtb3NcQXBpXFYxXEdQQk1ldGFkYXRh6gIOTWVtb3M6OkFwaTo6VjFiBnByb3RvMw", [file_api_v1_attachment_service, file_api_v1_common, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp]); + +/** + * @generated from message memos.api.v1.Reaction + */ +export type Reaction = Message<"memos.api.v1.Reaction"> & { + /** + * The resource name of the reaction. + * Format: reactions/{reaction} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * The resource name of the creator. + * Format: users/{user} + * + * @generated from field: string creator = 2; + */ + creator: string; + + /** + * The resource name of the content. + * For memo reactions, this should be the memo's resource name. + * Format: memos/{memo} + * + * @generated from field: string content_id = 3; + */ + contentId: string; + + /** + * Required. The type of reaction (e.g., "👍", "❤️", "😄"). + * + * @generated from field: string reaction_type = 4; + */ + reactionType: string; + + /** + * Output only. The creation timestamp. + * + * @generated from field: google.protobuf.Timestamp create_time = 5; + */ + createTime?: Timestamp; +}; + +/** + * Describes the message memos.api.v1.Reaction. + * Use `create(ReactionSchema)` to create a new message. + */ +export const ReactionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 0); + +/** + * @generated from message memos.api.v1.Memo + */ +export type Memo = Message<"memos.api.v1.Memo"> & { + /** + * The resource name of the memo. + * Format: memos/{memo}, memo is the user defined id or uuid. + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * The state of the memo. + * + * @generated from field: memos.api.v1.State state = 2; + */ + state: State; + + /** + * The name of the creator. + * Format: users/{user} + * + * @generated from field: string creator = 3; + */ + creator: string; + + /** + * Output only. The creation timestamp. + * + * @generated from field: google.protobuf.Timestamp create_time = 4; + */ + createTime?: Timestamp; + + /** + * Output only. The last update timestamp. + * + * @generated from field: google.protobuf.Timestamp update_time = 5; + */ + updateTime?: Timestamp; + + /** + * The display timestamp of the memo. + * + * @generated from field: google.protobuf.Timestamp display_time = 6; + */ + displayTime?: Timestamp; + + /** + * Required. The content of the memo in Markdown format. + * + * @generated from field: string content = 7; + */ + content: string; + + /** + * The visibility of the memo. + * + * @generated from field: memos.api.v1.Visibility visibility = 9; + */ + visibility: Visibility; + + /** + * Output only. The tags extracted from the content. + * + * @generated from field: repeated string tags = 10; + */ + tags: string[]; + + /** + * Whether the memo is pinned. + * + * @generated from field: bool pinned = 11; + */ + pinned: boolean; + + /** + * Optional. The attachments of the memo. + * + * @generated from field: repeated memos.api.v1.Attachment attachments = 12; + */ + attachments: Attachment[]; + + /** + * Optional. The relations of the memo. + * + * @generated from field: repeated memos.api.v1.MemoRelation relations = 13; + */ + relations: MemoRelation[]; + + /** + * Output only. The reactions to the memo. + * + * @generated from field: repeated memos.api.v1.Reaction reactions = 14; + */ + reactions: Reaction[]; + + /** + * Output only. The computed properties of the memo. + * + * @generated from field: memos.api.v1.Memo.Property property = 15; + */ + property?: Memo_Property; + + /** + * Output only. The name of the parent memo. + * Format: memos/{memo} + * + * @generated from field: optional string parent = 16; + */ + parent?: string; + + /** + * Output only. The snippet of the memo content. Plain text only. + * + * @generated from field: string snippet = 17; + */ + snippet: string; + + /** + * Optional. The location of the memo. + * + * @generated from field: optional memos.api.v1.Location location = 18; + */ + location?: Location; +}; + +/** + * Describes the message memos.api.v1.Memo. + * Use `create(MemoSchema)` to create a new message. + */ +export const MemoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 1); + +/** + * Computed properties of a memo. + * + * @generated from message memos.api.v1.Memo.Property + */ +export type Memo_Property = Message<"memos.api.v1.Memo.Property"> & { + /** + * @generated from field: bool has_link = 1; + */ + hasLink: boolean; + + /** + * @generated from field: bool has_task_list = 2; + */ + hasTaskList: boolean; + + /** + * @generated from field: bool has_code = 3; + */ + hasCode: boolean; + + /** + * @generated from field: bool has_incomplete_tasks = 4; + */ + hasIncompleteTasks: boolean; +}; + +/** + * Describes the message memos.api.v1.Memo.Property. + * Use `create(Memo_PropertySchema)` to create a new message. + */ +export const Memo_PropertySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 1, 0); + +/** + * @generated from message memos.api.v1.Location + */ +export type Location = Message<"memos.api.v1.Location"> & { + /** + * A placeholder text for the location. + * + * @generated from field: string placeholder = 1; + */ + placeholder: string; + + /** + * The latitude of the location. + * + * @generated from field: double latitude = 2; + */ + latitude: number; + + /** + * The longitude of the location. + * + * @generated from field: double longitude = 3; + */ + longitude: number; +}; + +/** + * Describes the message memos.api.v1.Location. + * Use `create(LocationSchema)` to create a new message. + */ +export const LocationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 2); + +/** + * @generated from message memos.api.v1.CreateMemoRequest + */ +export type CreateMemoRequest = Message<"memos.api.v1.CreateMemoRequest"> & { + /** + * Required. The memo to create. + * + * @generated from field: memos.api.v1.Memo memo = 1; + */ + memo?: Memo; + + /** + * Optional. The memo ID to use for this memo. + * If empty, a unique ID will be generated. + * + * @generated from field: string memo_id = 2; + */ + memoId: string; +}; + +/** + * Describes the message memos.api.v1.CreateMemoRequest. + * Use `create(CreateMemoRequestSchema)` to create a new message. + */ +export const CreateMemoRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 3); + +/** + * @generated from message memos.api.v1.ListMemosRequest + */ +export type ListMemosRequest = Message<"memos.api.v1.ListMemosRequest"> & { + /** + * Optional. The maximum number of memos to return. + * The service may return fewer than this value. + * If unspecified, at most 50 memos will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * @generated from field: int32 page_size = 1; + */ + pageSize: number; + + /** + * Optional. A page token, received from a previous `ListMemos` call. + * Provide this to retrieve the subsequent page. + * + * @generated from field: string page_token = 2; + */ + pageToken: string; + + /** + * Optional. The state of the memos to list. + * Default to `NORMAL`. Set to `ARCHIVED` to list archived memos. + * + * @generated from field: memos.api.v1.State state = 3; + */ + state: State; + + /** + * Optional. The order to sort results by. + * Default to "display_time desc". + * Supports comma-separated list of fields following AIP-132. + * Example: "pinned desc, display_time desc" or "create_time asc" + * Supported fields: pinned, display_time, create_time, update_time, name + * + * @generated from field: string order_by = 4; + */ + orderBy: string; + + /** + * Optional. Filter to apply to the list results. + * Filter is a CEL expression to filter memos. + * Refer to `Shortcut.filter`. + * + * @generated from field: string filter = 5; + */ + filter: string; + + /** + * Optional. If true, show deleted memos in the response. + * + * @generated from field: bool show_deleted = 6; + */ + showDeleted: boolean; +}; + +/** + * Describes the message memos.api.v1.ListMemosRequest. + * Use `create(ListMemosRequestSchema)` to create a new message. + */ +export const ListMemosRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 4); + +/** + * @generated from message memos.api.v1.ListMemosResponse + */ +export type ListMemosResponse = Message<"memos.api.v1.ListMemosResponse"> & { + /** + * The list of memos. + * + * @generated from field: repeated memos.api.v1.Memo memos = 1; + */ + memos: Memo[]; + + /** + * A token that can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.v1.ListMemosResponse. + * Use `create(ListMemosResponseSchema)` to create a new message. + */ +export const ListMemosResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 5); + +/** + * @generated from message memos.api.v1.GetMemoRequest + */ +export type GetMemoRequest = Message<"memos.api.v1.GetMemoRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.GetMemoRequest. + * Use `create(GetMemoRequestSchema)` to create a new message. + */ +export const GetMemoRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 6); + +/** + * @generated from message memos.api.v1.UpdateMemoRequest + */ +export type UpdateMemoRequest = Message<"memos.api.v1.UpdateMemoRequest"> & { + /** + * Required. The memo to update. + * The `name` field is required. + * + * @generated from field: memos.api.v1.Memo memo = 1; + */ + memo?: Memo; + + /** + * Required. The list of fields to update. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask; +}; + +/** + * Describes the message memos.api.v1.UpdateMemoRequest. + * Use `create(UpdateMemoRequestSchema)` to create a new message. + */ +export const UpdateMemoRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 7); + +/** + * @generated from message memos.api.v1.DeleteMemoRequest + */ +export type DeleteMemoRequest = Message<"memos.api.v1.DeleteMemoRequest"> & { + /** + * Required. The resource name of the memo to delete. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Optional. If set to true, the memo will be deleted even if it has associated data. + * + * @generated from field: bool force = 2; + */ + force: boolean; +}; + +/** + * Describes the message memos.api.v1.DeleteMemoRequest. + * Use `create(DeleteMemoRequestSchema)` to create a new message. + */ +export const DeleteMemoRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 8); + +/** + * @generated from message memos.api.v1.SetMemoAttachmentsRequest + */ +export type SetMemoAttachmentsRequest = Message<"memos.api.v1.SetMemoAttachmentsRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. The attachments to set for the memo. + * + * @generated from field: repeated memos.api.v1.Attachment attachments = 2; + */ + attachments: Attachment[]; +}; + +/** + * Describes the message memos.api.v1.SetMemoAttachmentsRequest. + * Use `create(SetMemoAttachmentsRequestSchema)` to create a new message. + */ +export const SetMemoAttachmentsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 9); + +/** + * @generated from message memos.api.v1.ListMemoAttachmentsRequest + */ +export type ListMemoAttachmentsRequest = Message<"memos.api.v1.ListMemoAttachmentsRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Optional. The maximum number of attachments to return. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token for pagination. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.v1.ListMemoAttachmentsRequest. + * Use `create(ListMemoAttachmentsRequestSchema)` to create a new message. + */ +export const ListMemoAttachmentsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 10); + +/** + * @generated from message memos.api.v1.ListMemoAttachmentsResponse + */ +export type ListMemoAttachmentsResponse = Message<"memos.api.v1.ListMemoAttachmentsResponse"> & { + /** + * The list of attachments. + * + * @generated from field: repeated memos.api.v1.Attachment attachments = 1; + */ + attachments: Attachment[]; + + /** + * A token for the next page of results. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.v1.ListMemoAttachmentsResponse. + * Use `create(ListMemoAttachmentsResponseSchema)` to create a new message. + */ +export const ListMemoAttachmentsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 11); + +/** + * @generated from message memos.api.v1.MemoRelation + */ +export type MemoRelation = Message<"memos.api.v1.MemoRelation"> & { + /** + * The memo in the relation. + * + * @generated from field: memos.api.v1.MemoRelation.Memo memo = 1; + */ + memo?: MemoRelation_Memo; + + /** + * The related memo. + * + * @generated from field: memos.api.v1.MemoRelation.Memo related_memo = 2; + */ + relatedMemo?: MemoRelation_Memo; + + /** + * @generated from field: memos.api.v1.MemoRelation.Type type = 3; + */ + type: MemoRelation_Type; +}; + +/** + * Describes the message memos.api.v1.MemoRelation. + * Use `create(MemoRelationSchema)` to create a new message. + */ +export const MemoRelationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 12); + +/** + * Memo reference in relations. + * + * @generated from message memos.api.v1.MemoRelation.Memo + */ +export type MemoRelation_Memo = Message<"memos.api.v1.MemoRelation.Memo"> & { + /** + * The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Output only. The snippet of the memo content. Plain text only. + * + * @generated from field: string snippet = 2; + */ + snippet: string; +}; + +/** + * Describes the message memos.api.v1.MemoRelation.Memo. + * Use `create(MemoRelation_MemoSchema)` to create a new message. + */ +export const MemoRelation_MemoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 12, 0); + +/** + * The type of the relation. + * + * @generated from enum memos.api.v1.MemoRelation.Type + */ +export enum MemoRelation_Type { + /** + * @generated from enum value: TYPE_UNSPECIFIED = 0; + */ + TYPE_UNSPECIFIED = 0, + + /** + * @generated from enum value: REFERENCE = 1; + */ + REFERENCE = 1, + + /** + * @generated from enum value: COMMENT = 2; + */ + COMMENT = 2, +} + +/** + * Describes the enum memos.api.v1.MemoRelation.Type. + */ +export const MemoRelation_TypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_v1_memo_service, 12, 0); + +/** + * @generated from message memos.api.v1.SetMemoRelationsRequest + */ +export type SetMemoRelationsRequest = Message<"memos.api.v1.SetMemoRelationsRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. The relations to set for the memo. + * + * @generated from field: repeated memos.api.v1.MemoRelation relations = 2; + */ + relations: MemoRelation[]; +}; + +/** + * Describes the message memos.api.v1.SetMemoRelationsRequest. + * Use `create(SetMemoRelationsRequestSchema)` to create a new message. + */ +export const SetMemoRelationsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 13); + +/** + * @generated from message memos.api.v1.ListMemoRelationsRequest + */ +export type ListMemoRelationsRequest = Message<"memos.api.v1.ListMemoRelationsRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Optional. The maximum number of relations to return. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token for pagination. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.v1.ListMemoRelationsRequest. + * Use `create(ListMemoRelationsRequestSchema)` to create a new message. + */ +export const ListMemoRelationsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 14); + +/** + * @generated from message memos.api.v1.ListMemoRelationsResponse + */ +export type ListMemoRelationsResponse = Message<"memos.api.v1.ListMemoRelationsResponse"> & { + /** + * The list of relations. + * + * @generated from field: repeated memos.api.v1.MemoRelation relations = 1; + */ + relations: MemoRelation[]; + + /** + * A token for the next page of results. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.v1.ListMemoRelationsResponse. + * Use `create(ListMemoRelationsResponseSchema)` to create a new message. + */ +export const ListMemoRelationsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 15); + +/** + * @generated from message memos.api.v1.CreateMemoCommentRequest + */ +export type CreateMemoCommentRequest = Message<"memos.api.v1.CreateMemoCommentRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. The comment to create. + * + * @generated from field: memos.api.v1.Memo comment = 2; + */ + comment?: Memo; + + /** + * Optional. The comment ID to use. + * + * @generated from field: string comment_id = 3; + */ + commentId: string; +}; + +/** + * Describes the message memos.api.v1.CreateMemoCommentRequest. + * Use `create(CreateMemoCommentRequestSchema)` to create a new message. + */ +export const CreateMemoCommentRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 16); + +/** + * @generated from message memos.api.v1.ListMemoCommentsRequest + */ +export type ListMemoCommentsRequest = Message<"memos.api.v1.ListMemoCommentsRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Optional. The maximum number of comments to return. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token for pagination. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; + + /** + * Optional. The order to sort results by. + * + * @generated from field: string order_by = 4; + */ + orderBy: string; +}; + +/** + * Describes the message memos.api.v1.ListMemoCommentsRequest. + * Use `create(ListMemoCommentsRequestSchema)` to create a new message. + */ +export const ListMemoCommentsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 17); + +/** + * @generated from message memos.api.v1.ListMemoCommentsResponse + */ +export type ListMemoCommentsResponse = Message<"memos.api.v1.ListMemoCommentsResponse"> & { + /** + * The list of comment memos. + * + * @generated from field: repeated memos.api.v1.Memo memos = 1; + */ + memos: Memo[]; + + /** + * A token for the next page of results. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; + + /** + * The total count of comments. + * + * @generated from field: int32 total_size = 3; + */ + totalSize: number; +}; + +/** + * Describes the message memos.api.v1.ListMemoCommentsResponse. + * Use `create(ListMemoCommentsResponseSchema)` to create a new message. + */ +export const ListMemoCommentsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 18); + +/** + * @generated from message memos.api.v1.ListMemoReactionsRequest + */ +export type ListMemoReactionsRequest = Message<"memos.api.v1.ListMemoReactionsRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Optional. The maximum number of reactions to return. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token for pagination. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.v1.ListMemoReactionsRequest. + * Use `create(ListMemoReactionsRequestSchema)` to create a new message. + */ +export const ListMemoReactionsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 19); + +/** + * @generated from message memos.api.v1.ListMemoReactionsResponse + */ +export type ListMemoReactionsResponse = Message<"memos.api.v1.ListMemoReactionsResponse"> & { + /** + * The list of reactions. + * + * @generated from field: repeated memos.api.v1.Reaction reactions = 1; + */ + reactions: Reaction[]; + + /** + * A token for the next page of results. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; + + /** + * The total count of reactions. + * + * @generated from field: int32 total_size = 3; + */ + totalSize: number; +}; + +/** + * Describes the message memos.api.v1.ListMemoReactionsResponse. + * Use `create(ListMemoReactionsResponseSchema)` to create a new message. + */ +export const ListMemoReactionsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 20); + +/** + * @generated from message memos.api.v1.UpsertMemoReactionRequest + */ +export type UpsertMemoReactionRequest = Message<"memos.api.v1.UpsertMemoReactionRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. The reaction to upsert. + * + * @generated from field: memos.api.v1.Reaction reaction = 2; + */ + reaction?: Reaction; +}; + +/** + * Describes the message memos.api.v1.UpsertMemoReactionRequest. + * Use `create(UpsertMemoReactionRequestSchema)` to create a new message. + */ +export const UpsertMemoReactionRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 21); + +/** + * @generated from message memos.api.v1.DeleteMemoReactionRequest + */ +export type DeleteMemoReactionRequest = Message<"memos.api.v1.DeleteMemoReactionRequest"> & { + /** + * Required. The resource name of the reaction to delete. + * Format: reactions/{reaction} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.DeleteMemoReactionRequest. + * Use `create(DeleteMemoReactionRequestSchema)` to create a new message. + */ +export const DeleteMemoReactionRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_memo_service, 22); + +/** + * @generated from enum memos.api.v1.Visibility + */ +export enum Visibility { + /** + * @generated from enum value: VISIBILITY_UNSPECIFIED = 0; + */ + VISIBILITY_UNSPECIFIED = 0, + + /** + * @generated from enum value: PRIVATE = 1; + */ + PRIVATE = 1, + + /** + * @generated from enum value: PROTECTED = 2; + */ + PROTECTED = 2, + + /** + * @generated from enum value: PUBLIC = 3; + */ + PUBLIC = 3, +} + +/** + * Describes the enum memos.api.v1.Visibility. + */ +export const VisibilitySchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_v1_memo_service, 0); + +/** + * @generated from service memos.api.v1.MemoService + */ +export const MemoService: GenService<{ + /** + * CreateMemo creates a memo. + * + * @generated from rpc memos.api.v1.MemoService.CreateMemo + */ + createMemo: { + methodKind: "unary"; + input: typeof CreateMemoRequestSchema; + output: typeof MemoSchema; + }, + /** + * ListMemos lists memos with pagination and filter. + * + * @generated from rpc memos.api.v1.MemoService.ListMemos + */ + listMemos: { + methodKind: "unary"; + input: typeof ListMemosRequestSchema; + output: typeof ListMemosResponseSchema; + }, + /** + * GetMemo gets a memo. + * + * @generated from rpc memos.api.v1.MemoService.GetMemo + */ + getMemo: { + methodKind: "unary"; + input: typeof GetMemoRequestSchema; + output: typeof MemoSchema; + }, + /** + * UpdateMemo updates a memo. + * + * @generated from rpc memos.api.v1.MemoService.UpdateMemo + */ + updateMemo: { + methodKind: "unary"; + input: typeof UpdateMemoRequestSchema; + output: typeof MemoSchema; + }, + /** + * DeleteMemo deletes a memo. + * + * @generated from rpc memos.api.v1.MemoService.DeleteMemo + */ + deleteMemo: { + methodKind: "unary"; + input: typeof DeleteMemoRequestSchema; + output: typeof EmptySchema; + }, + /** + * SetMemoAttachments sets attachments for a memo. + * + * @generated from rpc memos.api.v1.MemoService.SetMemoAttachments + */ + setMemoAttachments: { + methodKind: "unary"; + input: typeof SetMemoAttachmentsRequestSchema; + output: typeof EmptySchema; + }, + /** + * ListMemoAttachments lists attachments for a memo. + * + * @generated from rpc memos.api.v1.MemoService.ListMemoAttachments + */ + listMemoAttachments: { + methodKind: "unary"; + input: typeof ListMemoAttachmentsRequestSchema; + output: typeof ListMemoAttachmentsResponseSchema; + }, + /** + * SetMemoRelations sets relations for a memo. + * + * @generated from rpc memos.api.v1.MemoService.SetMemoRelations + */ + setMemoRelations: { + methodKind: "unary"; + input: typeof SetMemoRelationsRequestSchema; + output: typeof EmptySchema; + }, + /** + * ListMemoRelations lists relations for a memo. + * + * @generated from rpc memos.api.v1.MemoService.ListMemoRelations + */ + listMemoRelations: { + methodKind: "unary"; + input: typeof ListMemoRelationsRequestSchema; + output: typeof ListMemoRelationsResponseSchema; + }, + /** + * CreateMemoComment creates a comment for a memo. + * + * @generated from rpc memos.api.v1.MemoService.CreateMemoComment + */ + createMemoComment: { + methodKind: "unary"; + input: typeof CreateMemoCommentRequestSchema; + output: typeof MemoSchema; + }, + /** + * ListMemoComments lists comments for a memo. + * + * @generated from rpc memos.api.v1.MemoService.ListMemoComments + */ + listMemoComments: { + methodKind: "unary"; + input: typeof ListMemoCommentsRequestSchema; + output: typeof ListMemoCommentsResponseSchema; + }, + /** + * ListMemoReactions lists reactions for a memo. + * + * @generated from rpc memos.api.v1.MemoService.ListMemoReactions + */ + listMemoReactions: { + methodKind: "unary"; + input: typeof ListMemoReactionsRequestSchema; + output: typeof ListMemoReactionsResponseSchema; + }, + /** + * UpsertMemoReaction upserts a reaction for a memo. + * + * @generated from rpc memos.api.v1.MemoService.UpsertMemoReaction + */ + upsertMemoReaction: { + methodKind: "unary"; + input: typeof UpsertMemoReactionRequestSchema; + output: typeof ReactionSchema; + }, + /** + * DeleteMemoReaction deletes a reaction for a memo. + * + * @generated from rpc memos.api.v1.MemoService.DeleteMemoReaction + */ + deleteMemoReaction: { + methodKind: "unary"; + input: typeof DeleteMemoReactionRequestSchema; + output: typeof EmptySchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_v1_memo_service, 0); + diff --git a/web/src/types/proto/api/v1/shortcut_service.ts b/web/src/types/proto/api/v1/shortcut_service.ts deleted file mode 100644 index b8ebb343d..000000000 --- a/web/src/types/proto/api/v1/shortcut_service.ts +++ /dev/null @@ -1,808 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: api/v1/shortcut_service.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { Empty } from "../../google/protobuf/empty"; -import { FieldMask } from "../../google/protobuf/field_mask"; - -export const protobufPackage = "memos.api.v1"; - -export interface Shortcut { - /** - * The resource name of the shortcut. - * Format: users/{user}/shortcuts/{shortcut} - */ - name: string; - /** The title of the shortcut. */ - title: string; - /** The filter expression for the shortcut. */ - filter: string; -} - -export interface ListShortcutsRequest { - /** - * Required. The parent resource where shortcuts are listed. - * Format: users/{user} - */ - parent: string; -} - -export interface ListShortcutsResponse { - /** The list of shortcuts. */ - shortcuts: Shortcut[]; -} - -export interface GetShortcutRequest { - /** - * Required. The resource name of the shortcut to retrieve. - * Format: users/{user}/shortcuts/{shortcut} - */ - name: string; -} - -export interface CreateShortcutRequest { - /** - * Required. The parent resource where this shortcut will be created. - * Format: users/{user} - */ - parent: string; - /** Required. The shortcut to create. */ - shortcut?: - | Shortcut - | undefined; - /** Optional. If set, validate the request, but do not actually create the shortcut. */ - validateOnly: boolean; -} - -export interface UpdateShortcutRequest { - /** Required. The shortcut resource which replaces the resource on the server. */ - shortcut?: - | Shortcut - | undefined; - /** Optional. The list of fields to update. */ - updateMask?: string[] | undefined; -} - -export interface DeleteShortcutRequest { - /** - * Required. The resource name of the shortcut to delete. - * Format: users/{user}/shortcuts/{shortcut} - */ - name: string; -} - -function createBaseShortcut(): Shortcut { - return { name: "", title: "", filter: "" }; -} - -export const Shortcut: MessageFns = { - encode(message: Shortcut, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.title !== "") { - writer.uint32(18).string(message.title); - } - if (message.filter !== "") { - writer.uint32(26).string(message.filter); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Shortcut { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseShortcut(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.title = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.filter = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): Shortcut { - return Shortcut.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): Shortcut { - const message = createBaseShortcut(); - message.name = object.name ?? ""; - message.title = object.title ?? ""; - message.filter = object.filter ?? ""; - return message; - }, -}; - -function createBaseListShortcutsRequest(): ListShortcutsRequest { - return { parent: "" }; -} - -export const ListShortcutsRequest: MessageFns = { - encode(message: ListShortcutsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.parent !== "") { - writer.uint32(10).string(message.parent); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListShortcutsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListShortcutsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.parent = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListShortcutsRequest { - return ListShortcutsRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListShortcutsRequest { - const message = createBaseListShortcutsRequest(); - message.parent = object.parent ?? ""; - return message; - }, -}; - -function createBaseListShortcutsResponse(): ListShortcutsResponse { - return { shortcuts: [] }; -} - -export const ListShortcutsResponse: MessageFns = { - encode(message: ListShortcutsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.shortcuts) { - Shortcut.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListShortcutsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListShortcutsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.shortcuts.push(Shortcut.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListShortcutsResponse { - return ListShortcutsResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListShortcutsResponse { - const message = createBaseListShortcutsResponse(); - message.shortcuts = object.shortcuts?.map((e) => Shortcut.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseGetShortcutRequest(): GetShortcutRequest { - return { name: "" }; -} - -export const GetShortcutRequest: MessageFns = { - encode(message: GetShortcutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GetShortcutRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetShortcutRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GetShortcutRequest { - return GetShortcutRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GetShortcutRequest { - const message = createBaseGetShortcutRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseCreateShortcutRequest(): CreateShortcutRequest { - return { parent: "", shortcut: undefined, validateOnly: false }; -} - -export const CreateShortcutRequest: MessageFns = { - encode(message: CreateShortcutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.parent !== "") { - writer.uint32(10).string(message.parent); - } - if (message.shortcut !== undefined) { - Shortcut.encode(message.shortcut, writer.uint32(18).fork()).join(); - } - if (message.validateOnly !== false) { - writer.uint32(24).bool(message.validateOnly); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CreateShortcutRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateShortcutRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.parent = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.shortcut = Shortcut.decode(reader, reader.uint32()); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.validateOnly = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CreateShortcutRequest { - return CreateShortcutRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CreateShortcutRequest { - const message = createBaseCreateShortcutRequest(); - message.parent = object.parent ?? ""; - message.shortcut = (object.shortcut !== undefined && object.shortcut !== null) - ? Shortcut.fromPartial(object.shortcut) - : undefined; - message.validateOnly = object.validateOnly ?? false; - return message; - }, -}; - -function createBaseUpdateShortcutRequest(): UpdateShortcutRequest { - return { shortcut: undefined, updateMask: undefined }; -} - -export const UpdateShortcutRequest: MessageFns = { - encode(message: UpdateShortcutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.shortcut !== undefined) { - Shortcut.encode(message.shortcut, writer.uint32(10).fork()).join(); - } - if (message.updateMask !== undefined) { - FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UpdateShortcutRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpdateShortcutRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.shortcut = Shortcut.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UpdateShortcutRequest { - return UpdateShortcutRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UpdateShortcutRequest { - const message = createBaseUpdateShortcutRequest(); - message.shortcut = (object.shortcut !== undefined && object.shortcut !== null) - ? Shortcut.fromPartial(object.shortcut) - : undefined; - message.updateMask = object.updateMask ?? undefined; - return message; - }, -}; - -function createBaseDeleteShortcutRequest(): DeleteShortcutRequest { - return { name: "" }; -} - -export const DeleteShortcutRequest: MessageFns = { - encode(message: DeleteShortcutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DeleteShortcutRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeleteShortcutRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DeleteShortcutRequest { - return DeleteShortcutRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DeleteShortcutRequest { - const message = createBaseDeleteShortcutRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -export type ShortcutServiceDefinition = typeof ShortcutServiceDefinition; -export const ShortcutServiceDefinition = { - name: "ShortcutService", - fullName: "memos.api.v1.ShortcutService", - methods: { - /** ListShortcuts returns a list of shortcuts for a user. */ - listShortcuts: { - name: "ListShortcuts", - requestType: ListShortcutsRequest, - requestStream: false, - responseType: ListShortcutsResponse, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])], - 578365826: [ - new Uint8Array([ - 36, - 18, - 34, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 112, - 97, - 114, - 101, - 110, - 116, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 125, - 47, - 115, - 104, - 111, - 114, - 116, - 99, - 117, - 116, - 115, - ]), - ], - }, - }, - }, - /** GetShortcut gets a shortcut by name. */ - getShortcut: { - name: "GetShortcut", - requestType: GetShortcutRequest, - requestStream: false, - responseType: Shortcut, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 36, - 18, - 34, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 47, - 115, - 104, - 111, - 114, - 116, - 99, - 117, - 116, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** CreateShortcut creates a new shortcut for a user. */ - createShortcut: { - name: "CreateShortcut", - requestType: CreateShortcutRequest, - requestStream: false, - responseType: Shortcut, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([15, 112, 97, 114, 101, 110, 116, 44, 115, 104, 111, 114, 116, 99, 117, 116])], - 578365826: [ - new Uint8Array([ - 46, - 58, - 8, - 115, - 104, - 111, - 114, - 116, - 99, - 117, - 116, - 34, - 34, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 112, - 97, - 114, - 101, - 110, - 116, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 125, - 47, - 115, - 104, - 111, - 114, - 116, - 99, - 117, - 116, - 115, - ]), - ], - }, - }, - }, - /** UpdateShortcut updates a shortcut for a user. */ - updateShortcut: { - name: "UpdateShortcut", - requestType: UpdateShortcutRequest, - requestStream: false, - responseType: Shortcut, - responseStream: false, - options: { - _unknownFields: { - 8410: [ - new Uint8Array([ - 20, - 115, - 104, - 111, - 114, - 116, - 99, - 117, - 116, - 44, - 117, - 112, - 100, - 97, - 116, - 101, - 95, - 109, - 97, - 115, - 107, - ]), - ], - 578365826: [ - new Uint8Array([ - 55, - 58, - 8, - 115, - 104, - 111, - 114, - 116, - 99, - 117, - 116, - 50, - 43, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 115, - 104, - 111, - 114, - 116, - 99, - 117, - 116, - 46, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 47, - 115, - 104, - 111, - 114, - 116, - 99, - 117, - 116, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** DeleteShortcut deletes a shortcut for a user. */ - deleteShortcut: { - name: "DeleteShortcut", - requestType: DeleteShortcutRequest, - requestStream: false, - responseType: Empty, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 36, - 42, - 34, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 47, - 115, - 104, - 111, - 114, - 116, - 99, - 117, - 116, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - }, -} as const; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/api/v1/shortcut_service_pb.ts b/web/src/types/proto/api/v1/shortcut_service_pb.ts new file mode 100644 index 000000000..fa6ec891c --- /dev/null +++ b/web/src/types/proto/api/v1/shortcut_service_pb.ts @@ -0,0 +1,250 @@ +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file api/v1/shortcut_service.proto (package memos.api.v1, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import { file_google_api_annotations } from "../../google/api/annotations_pb"; +import { file_google_api_client } from "../../google/api/client_pb"; +import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; +import { file_google_api_resource } from "../../google/api/resource_pb"; +import type { EmptySchema, FieldMask } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_empty, file_google_protobuf_field_mask } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/v1/shortcut_service.proto. + */ +export const file_api_v1_shortcut_service: GenFile = /*@__PURE__*/ + fileDesc("Ch1hcGkvdjEvc2hvcnRjdXRfc2VydmljZS5wcm90bxIMbWVtb3MuYXBpLnYxIpoBCghTaG9ydGN1dBIRCgRuYW1lGAEgASgJQgPgQQgSEgoFdGl0bGUYAiABKAlCA+BBAhITCgZmaWx0ZXIYAyABKAlCA+BBATpS6kFPChVtZW1vcy5hcGkudjEvU2hvcnRjdXQSIXVzZXJzL3t1c2VyfS9zaG9ydGN1dHMve3Nob3J0Y3V0fSoJc2hvcnRjdXRzMghzaG9ydGN1dCJFChRMaXN0U2hvcnRjdXRzUmVxdWVzdBItCgZwYXJlbnQYASABKAlCHeBBAvpBFxIVbWVtb3MuYXBpLnYxL1Nob3J0Y3V0IkIKFUxpc3RTaG9ydGN1dHNSZXNwb25zZRIpCglzaG9ydGN1dHMYASADKAsyFi5tZW1vcy5hcGkudjEuU2hvcnRjdXQiQQoSR2V0U2hvcnRjdXRSZXF1ZXN0EisKBG5hbWUYASABKAlCHeBBAvpBFwoVbWVtb3MuYXBpLnYxL1Nob3J0Y3V0IpEBChVDcmVhdGVTaG9ydGN1dFJlcXVlc3QSLQoGcGFyZW50GAEgASgJQh3gQQL6QRcSFW1lbW9zLmFwaS52MS9TaG9ydGN1dBItCghzaG9ydGN1dBgCIAEoCzIWLm1lbW9zLmFwaS52MS5TaG9ydGN1dEID4EECEhoKDXZhbGlkYXRlX29ubHkYAyABKAhCA+BBASJ8ChVVcGRhdGVTaG9ydGN1dFJlcXVlc3QSLQoIc2hvcnRjdXQYASABKAsyFi5tZW1vcy5hcGkudjEuU2hvcnRjdXRCA+BBAhI0Cgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tCA+BBASJEChVEZWxldGVTaG9ydGN1dFJlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVtZW1vcy5hcGkudjEvU2hvcnRjdXQy3gUKD1Nob3J0Y3V0U2VydmljZRKNAQoNTGlzdFNob3J0Y3V0cxIiLm1lbW9zLmFwaS52MS5MaXN0U2hvcnRjdXRzUmVxdWVzdBojLm1lbW9zLmFwaS52MS5MaXN0U2hvcnRjdXRzUmVzcG9uc2UiM9pBBnBhcmVudILT5JMCJBIiL2FwaS92MS97cGFyZW50PXVzZXJzLyp9L3Nob3J0Y3V0cxJ6CgtHZXRTaG9ydGN1dBIgLm1lbW9zLmFwaS52MS5HZXRTaG9ydGN1dFJlcXVlc3QaFi5tZW1vcy5hcGkudjEuU2hvcnRjdXQiMdpBBG5hbWWC0+STAiQSIi9hcGkvdjEve25hbWU9dXNlcnMvKi9zaG9ydGN1dHMvKn0SlQEKDkNyZWF0ZVNob3J0Y3V0EiMubWVtb3MuYXBpLnYxLkNyZWF0ZVNob3J0Y3V0UmVxdWVzdBoWLm1lbW9zLmFwaS52MS5TaG9ydGN1dCJG2kEPcGFyZW50LHNob3J0Y3V0gtPkkwIuOghzaG9ydGN1dCIiL2FwaS92MS97cGFyZW50PXVzZXJzLyp9L3Nob3J0Y3V0cxKjAQoOVXBkYXRlU2hvcnRjdXQSIy5tZW1vcy5hcGkudjEuVXBkYXRlU2hvcnRjdXRSZXF1ZXN0GhYubWVtb3MuYXBpLnYxLlNob3J0Y3V0IlTaQRRzaG9ydGN1dCx1cGRhdGVfbWFza4LT5JMCNzoIc2hvcnRjdXQyKy9hcGkvdjEve3Nob3J0Y3V0Lm5hbWU9dXNlcnMvKi9zaG9ydGN1dHMvKn0SgAEKDkRlbGV0ZVNob3J0Y3V0EiMubWVtb3MuYXBpLnYxLkRlbGV0ZVNob3J0Y3V0UmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIx2kEEbmFtZYLT5JMCJCoiL2FwaS92MS97bmFtZT11c2Vycy8qL3Nob3J0Y3V0cy8qfUKsAQoQY29tLm1lbW9zLmFwaS52MUIUU2hvcnRjdXRTZXJ2aWNlUHJvdG9QAVowZ2l0aHViLmNvbS91c2VtZW1vcy9tZW1vcy9wcm90by9nZW4vYXBpL3YxO2FwaXYxogIDTUFYqgIMTWVtb3MuQXBpLlYxygIMTWVtb3NcQXBpXFYx4gIYTWVtb3NcQXBpXFYxXEdQQk1ldGFkYXRh6gIOTWVtb3M6OkFwaTo6VjFiBnByb3RvMw", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask]); + +/** + * @generated from message memos.api.v1.Shortcut + */ +export type Shortcut = Message<"memos.api.v1.Shortcut"> & { + /** + * The resource name of the shortcut. + * Format: users/{user}/shortcuts/{shortcut} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * The title of the shortcut. + * + * @generated from field: string title = 2; + */ + title: string; + + /** + * The filter expression for the shortcut. + * + * @generated from field: string filter = 3; + */ + filter: string; +}; + +/** + * Describes the message memos.api.v1.Shortcut. + * Use `create(ShortcutSchema)` to create a new message. + */ +export const ShortcutSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_shortcut_service, 0); + +/** + * @generated from message memos.api.v1.ListShortcutsRequest + */ +export type ListShortcutsRequest = Message<"memos.api.v1.ListShortcutsRequest"> & { + /** + * Required. The parent resource where shortcuts are listed. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; +}; + +/** + * Describes the message memos.api.v1.ListShortcutsRequest. + * Use `create(ListShortcutsRequestSchema)` to create a new message. + */ +export const ListShortcutsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_shortcut_service, 1); + +/** + * @generated from message memos.api.v1.ListShortcutsResponse + */ +export type ListShortcutsResponse = Message<"memos.api.v1.ListShortcutsResponse"> & { + /** + * The list of shortcuts. + * + * @generated from field: repeated memos.api.v1.Shortcut shortcuts = 1; + */ + shortcuts: Shortcut[]; +}; + +/** + * Describes the message memos.api.v1.ListShortcutsResponse. + * Use `create(ListShortcutsResponseSchema)` to create a new message. + */ +export const ListShortcutsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_shortcut_service, 2); + +/** + * @generated from message memos.api.v1.GetShortcutRequest + */ +export type GetShortcutRequest = Message<"memos.api.v1.GetShortcutRequest"> & { + /** + * Required. The resource name of the shortcut to retrieve. + * Format: users/{user}/shortcuts/{shortcut} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.GetShortcutRequest. + * Use `create(GetShortcutRequestSchema)` to create a new message. + */ +export const GetShortcutRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_shortcut_service, 3); + +/** + * @generated from message memos.api.v1.CreateShortcutRequest + */ +export type CreateShortcutRequest = Message<"memos.api.v1.CreateShortcutRequest"> & { + /** + * Required. The parent resource where this shortcut will be created. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Required. The shortcut to create. + * + * @generated from field: memos.api.v1.Shortcut shortcut = 2; + */ + shortcut?: Shortcut; + + /** + * Optional. If set, validate the request, but do not actually create the shortcut. + * + * @generated from field: bool validate_only = 3; + */ + validateOnly: boolean; +}; + +/** + * Describes the message memos.api.v1.CreateShortcutRequest. + * Use `create(CreateShortcutRequestSchema)` to create a new message. + */ +export const CreateShortcutRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_shortcut_service, 4); + +/** + * @generated from message memos.api.v1.UpdateShortcutRequest + */ +export type UpdateShortcutRequest = Message<"memos.api.v1.UpdateShortcutRequest"> & { + /** + * Required. The shortcut resource which replaces the resource on the server. + * + * @generated from field: memos.api.v1.Shortcut shortcut = 1; + */ + shortcut?: Shortcut; + + /** + * Optional. The list of fields to update. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask; +}; + +/** + * Describes the message memos.api.v1.UpdateShortcutRequest. + * Use `create(UpdateShortcutRequestSchema)` to create a new message. + */ +export const UpdateShortcutRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_shortcut_service, 5); + +/** + * @generated from message memos.api.v1.DeleteShortcutRequest + */ +export type DeleteShortcutRequest = Message<"memos.api.v1.DeleteShortcutRequest"> & { + /** + * Required. The resource name of the shortcut to delete. + * Format: users/{user}/shortcuts/{shortcut} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.DeleteShortcutRequest. + * Use `create(DeleteShortcutRequestSchema)` to create a new message. + */ +export const DeleteShortcutRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_shortcut_service, 6); + +/** + * @generated from service memos.api.v1.ShortcutService + */ +export const ShortcutService: GenService<{ + /** + * ListShortcuts returns a list of shortcuts for a user. + * + * @generated from rpc memos.api.v1.ShortcutService.ListShortcuts + */ + listShortcuts: { + methodKind: "unary"; + input: typeof ListShortcutsRequestSchema; + output: typeof ListShortcutsResponseSchema; + }, + /** + * GetShortcut gets a shortcut by name. + * + * @generated from rpc memos.api.v1.ShortcutService.GetShortcut + */ + getShortcut: { + methodKind: "unary"; + input: typeof GetShortcutRequestSchema; + output: typeof ShortcutSchema; + }, + /** + * CreateShortcut creates a new shortcut for a user. + * + * @generated from rpc memos.api.v1.ShortcutService.CreateShortcut + */ + createShortcut: { + methodKind: "unary"; + input: typeof CreateShortcutRequestSchema; + output: typeof ShortcutSchema; + }, + /** + * UpdateShortcut updates a shortcut for a user. + * + * @generated from rpc memos.api.v1.ShortcutService.UpdateShortcut + */ + updateShortcut: { + methodKind: "unary"; + input: typeof UpdateShortcutRequestSchema; + output: typeof ShortcutSchema; + }, + /** + * DeleteShortcut deletes a shortcut for a user. + * + * @generated from rpc memos.api.v1.ShortcutService.DeleteShortcut + */ + deleteShortcut: { + methodKind: "unary"; + input: typeof DeleteShortcutRequestSchema; + output: typeof EmptySchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_v1_shortcut_service, 0); + diff --git a/web/src/types/proto/api/v1/user_service.ts b/web/src/types/proto/api/v1/user_service.ts deleted file mode 100644 index abc8cb140..000000000 --- a/web/src/types/proto/api/v1/user_service.ts +++ /dev/null @@ -1,4953 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: api/v1/user_service.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { Empty } from "../../google/protobuf/empty"; -import { FieldMask } from "../../google/protobuf/field_mask"; -import { Timestamp } from "../../google/protobuf/timestamp"; -import { State, stateFromJSON, stateToNumber } from "./common"; - -export const protobufPackage = "memos.api.v1"; - -export interface User { - /** - * The resource name of the user. - * Format: users/{user} - */ - name: string; - /** The role of the user. */ - role: User_Role; - /** Required. The unique username for login. */ - username: string; - /** Optional. The email address of the user. */ - email: string; - /** Optional. The display name of the user. */ - displayName: string; - /** Optional. The avatar URL of the user. */ - avatarUrl: string; - /** Optional. The description of the user. */ - description: string; - /** Input only. The password for the user. */ - password: string; - /** The state of the user. */ - state: State; - /** Output only. The creation timestamp. */ - createTime?: - | Date - | undefined; - /** Output only. The last update timestamp. */ - updateTime?: Date | undefined; -} - -/** User role enumeration. */ -export enum User_Role { - /** ROLE_UNSPECIFIED - Unspecified role. */ - ROLE_UNSPECIFIED = "ROLE_UNSPECIFIED", - /** HOST - Host role with full system access. */ - HOST = "HOST", - /** ADMIN - Admin role with administrative privileges. */ - ADMIN = "ADMIN", - /** USER - Regular user role. */ - USER = "USER", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function user_RoleFromJSON(object: any): User_Role { - switch (object) { - case 0: - case "ROLE_UNSPECIFIED": - return User_Role.ROLE_UNSPECIFIED; - case 1: - case "HOST": - return User_Role.HOST; - case 2: - case "ADMIN": - return User_Role.ADMIN; - case 3: - case "USER": - return User_Role.USER; - case -1: - case "UNRECOGNIZED": - default: - return User_Role.UNRECOGNIZED; - } -} - -export function user_RoleToNumber(object: User_Role): number { - switch (object) { - case User_Role.ROLE_UNSPECIFIED: - return 0; - case User_Role.HOST: - return 1; - case User_Role.ADMIN: - return 2; - case User_Role.USER: - return 3; - case User_Role.UNRECOGNIZED: - default: - return -1; - } -} - -export interface ListUsersRequest { - /** - * Optional. The maximum number of users to return. - * The service may return fewer than this value. - * If unspecified, at most 50 users will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - pageSize: number; - /** - * Optional. A page token, received from a previous `ListUsers` call. - * Provide this to retrieve the subsequent page. - */ - pageToken: string; - /** - * Optional. Filter to apply to the list results. - * Example: "username == 'steven'" - * Supported operators: == - * Supported fields: username - */ - filter: string; - /** Optional. If true, show deleted users in the response. */ - showDeleted: boolean; -} - -export interface ListUsersResponse { - /** The list of users. */ - users: User[]; - /** - * A token that can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - */ - nextPageToken: string; - /** The total count of users (may be approximate). */ - totalSize: number; -} - -export interface GetUserRequest { - /** - * Required. The resource name of the user. - * Supports both numeric IDs and username strings: - * - users/{id} (e.g., users/101) - * - users/{username} (e.g., users/steven) - * Format: users/{id_or_username} - */ - name: string; - /** - * Optional. The fields to return in the response. - * If not specified, all fields are returned. - */ - readMask?: string[] | undefined; -} - -export interface CreateUserRequest { - /** Required. The user to create. */ - user?: - | User - | undefined; - /** - * Optional. The user ID to use for this user. - * If empty, a unique ID will be generated. - * Must match the pattern [a-z0-9-]+ - */ - userId: string; - /** Optional. If set, validate the request but don't actually create the user. */ - validateOnly: boolean; - /** - * Optional. An idempotency token that can be used to ensure that multiple - * requests to create a user have the same result. - */ - requestId: string; -} - -export interface UpdateUserRequest { - /** Required. The user to update. */ - user?: - | User - | undefined; - /** Required. The list of fields to update. */ - updateMask?: - | string[] - | undefined; - /** Optional. If set to true, allows updating sensitive fields. */ - allowMissing: boolean; -} - -export interface DeleteUserRequest { - /** - * Required. The resource name of the user to delete. - * Format: users/{user} - */ - name: string; - /** Optional. If set to true, the user will be deleted even if they have associated data. */ - force: boolean; -} - -/** User statistics messages */ -export interface UserStats { - /** - * The resource name of the user whose stats these are. - * Format: users/{user} - */ - name: string; - /** The timestamps when the memos were displayed. */ - memoDisplayTimestamps: Date[]; - /** The stats of memo types. */ - memoTypeStats?: - | UserStats_MemoTypeStats - | undefined; - /** The count of tags. */ - tagCount: { [key: string]: number }; - /** The pinned memos of the user. */ - pinnedMemos: string[]; - /** Total memo count. */ - totalMemoCount: number; -} - -export interface UserStats_TagCountEntry { - key: string; - value: number; -} - -/** Memo type statistics. */ -export interface UserStats_MemoTypeStats { - linkCount: number; - codeCount: number; - todoCount: number; - undoCount: number; -} - -export interface GetUserStatsRequest { - /** - * Required. The resource name of the user. - * Format: users/{user} - */ - name: string; -} - -/** This endpoint doesn't take any parameters. */ -export interface ListAllUserStatsRequest { -} - -export interface ListAllUserStatsResponse { - /** The list of user statistics. */ - stats: UserStats[]; -} - -/** User settings message */ -export interface UserSetting { - /** - * The name of the user setting. - * Format: users/{user}/settings/{setting}, {setting} is the key for the setting. - * For example, "users/123/settings/GENERAL" for general settings. - */ - name: string; - generalSetting?: UserSetting_GeneralSetting | undefined; - sessionsSetting?: UserSetting_SessionsSetting | undefined; - accessTokensSetting?: UserSetting_AccessTokensSetting | undefined; - webhooksSetting?: UserSetting_WebhooksSetting | undefined; -} - -/** Enumeration of user setting keys. */ -export enum UserSetting_Key { - KEY_UNSPECIFIED = "KEY_UNSPECIFIED", - /** GENERAL - GENERAL is the key for general user settings. */ - GENERAL = "GENERAL", - /** SESSIONS - SESSIONS is the key for user authentication sessions. */ - SESSIONS = "SESSIONS", - /** ACCESS_TOKENS - ACCESS_TOKENS is the key for access tokens. */ - ACCESS_TOKENS = "ACCESS_TOKENS", - /** WEBHOOKS - WEBHOOKS is the key for user webhooks. */ - WEBHOOKS = "WEBHOOKS", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function userSetting_KeyFromJSON(object: any): UserSetting_Key { - switch (object) { - case 0: - case "KEY_UNSPECIFIED": - return UserSetting_Key.KEY_UNSPECIFIED; - case 1: - case "GENERAL": - return UserSetting_Key.GENERAL; - case 2: - case "SESSIONS": - return UserSetting_Key.SESSIONS; - case 3: - case "ACCESS_TOKENS": - return UserSetting_Key.ACCESS_TOKENS; - case 4: - case "WEBHOOKS": - return UserSetting_Key.WEBHOOKS; - case -1: - case "UNRECOGNIZED": - default: - return UserSetting_Key.UNRECOGNIZED; - } -} - -export function userSetting_KeyToNumber(object: UserSetting_Key): number { - switch (object) { - case UserSetting_Key.KEY_UNSPECIFIED: - return 0; - case UserSetting_Key.GENERAL: - return 1; - case UserSetting_Key.SESSIONS: - return 2; - case UserSetting_Key.ACCESS_TOKENS: - return 3; - case UserSetting_Key.WEBHOOKS: - return 4; - case UserSetting_Key.UNRECOGNIZED: - default: - return -1; - } -} - -/** General user settings configuration. */ -export interface UserSetting_GeneralSetting { - /** The preferred locale of the user. */ - locale: string; - /** The default visibility of the memo. */ - memoVisibility: string; - /** - * The preferred theme of the user. - * This references a CSS file in the web/public/themes/ directory. - * If not set, the default theme will be used. - */ - theme: string; -} - -/** User authentication sessions configuration. */ -export interface UserSetting_SessionsSetting { - /** List of active user sessions. */ - sessions: UserSession[]; -} - -/** User access tokens configuration. */ -export interface UserSetting_AccessTokensSetting { - /** List of user access tokens. */ - accessTokens: UserAccessToken[]; -} - -/** User webhooks configuration. */ -export interface UserSetting_WebhooksSetting { - /** List of user webhooks. */ - webhooks: UserWebhook[]; -} - -export interface GetUserSettingRequest { - /** - * Required. The resource name of the user setting. - * Format: users/{user}/settings/{setting} - */ - name: string; -} - -export interface UpdateUserSettingRequest { - /** Required. The user setting to update. */ - setting?: - | UserSetting - | undefined; - /** Required. The list of fields to update. */ - updateMask?: string[] | undefined; -} - -/** Request message for ListUserSettings method. */ -export interface ListUserSettingsRequest { - /** - * Required. The parent resource whose settings will be listed. - * Format: users/{user} - */ - parent: string; - /** - * Optional. The maximum number of settings to return. - * The service may return fewer than this value. - * If unspecified, at most 50 settings will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - pageSize: number; - /** - * Optional. A page token, received from a previous `ListUserSettings` call. - * Provide this to retrieve the subsequent page. - */ - pageToken: string; -} - -/** Response message for ListUserSettings method. */ -export interface ListUserSettingsResponse { - /** The list of user settings. */ - settings: UserSetting[]; - /** - * A token that can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - */ - nextPageToken: string; - /** The total count of settings (may be approximate). */ - totalSize: number; -} - -/** User access token message */ -export interface UserAccessToken { - /** - * The resource name of the access token. - * Format: users/{user}/accessTokens/{access_token} - */ - name: string; - /** Output only. The access token value. */ - accessToken: string; - /** The description of the access token. */ - description: string; - /** Output only. The issued timestamp. */ - issuedAt?: - | Date - | undefined; - /** Optional. The expiration timestamp. */ - expiresAt?: Date | undefined; -} - -export interface ListUserAccessTokensRequest { - /** - * Required. The parent resource whose access tokens will be listed. - * Format: users/{user} - */ - parent: string; - /** Optional. The maximum number of access tokens to return. */ - pageSize: number; - /** Optional. A page token for pagination. */ - pageToken: string; -} - -export interface ListUserAccessTokensResponse { - /** The list of access tokens. */ - accessTokens: UserAccessToken[]; - /** A token for the next page of results. */ - nextPageToken: string; - /** The total count of access tokens. */ - totalSize: number; -} - -export interface CreateUserAccessTokenRequest { - /** - * Required. The parent resource where this access token will be created. - * Format: users/{user} - */ - parent: string; - /** Required. The access token to create. */ - accessToken?: - | UserAccessToken - | undefined; - /** Optional. The access token ID to use. */ - accessTokenId: string; -} - -export interface DeleteUserAccessTokenRequest { - /** - * Required. The resource name of the access token to delete. - * Format: users/{user}/accessTokens/{access_token} - */ - name: string; -} - -export interface UserSession { - /** - * The resource name of the session. - * Format: users/{user}/sessions/{session} - */ - name: string; - /** The session ID. */ - sessionId: string; - /** The timestamp when the session was created. */ - createTime?: - | Date - | undefined; - /** - * The timestamp when the session was last accessed. - * Used for sliding expiration calculation (last_accessed_time + 2 weeks). - */ - lastAccessedTime?: - | Date - | undefined; - /** Client information associated with this session. */ - clientInfo?: UserSession_ClientInfo | undefined; -} - -export interface UserSession_ClientInfo { - /** User agent string of the client. */ - userAgent: string; - /** IP address of the client. */ - ipAddress: string; - /** Optional. Device type (e.g., "mobile", "desktop", "tablet"). */ - deviceType: string; - /** Optional. Operating system (e.g., "iOS 17.0", "Windows 11"). */ - os: string; - /** Optional. Browser name and version (e.g., "Chrome 119.0"). */ - browser: string; -} - -export interface ListUserSessionsRequest { - /** - * Required. The resource name of the parent. - * Format: users/{user} - */ - parent: string; -} - -export interface ListUserSessionsResponse { - /** The list of user sessions. */ - sessions: UserSession[]; -} - -export interface RevokeUserSessionRequest { - /** - * The name of the session to revoke. - * Format: users/{user}/sessions/{session} - */ - name: string; -} - -/** UserWebhook represents a webhook owned by a user. */ -export interface UserWebhook { - /** - * The name of the webhook. - * Format: users/{user}/webhooks/{webhook} - */ - name: string; - /** The URL to send the webhook to. */ - url: string; - /** Optional. Human-readable name for the webhook. */ - displayName: string; - /** The creation time of the webhook. */ - createTime?: - | Date - | undefined; - /** The last update time of the webhook. */ - updateTime?: Date | undefined; -} - -export interface ListUserWebhooksRequest { - /** - * The parent user resource. - * Format: users/{user} - */ - parent: string; -} - -export interface ListUserWebhooksResponse { - /** The list of webhooks. */ - webhooks: UserWebhook[]; -} - -export interface CreateUserWebhookRequest { - /** - * The parent user resource. - * Format: users/{user} - */ - parent: string; - /** The webhook to create. */ - webhook?: UserWebhook | undefined; -} - -export interface UpdateUserWebhookRequest { - /** The webhook to update. */ - webhook?: - | UserWebhook - | undefined; - /** The list of fields to update. */ - updateMask?: string[] | undefined; -} - -export interface DeleteUserWebhookRequest { - /** - * The name of the webhook to delete. - * Format: users/{user}/webhooks/{webhook} - */ - name: string; -} - -export interface UserNotification { - /** - * The resource name of the notification. - * Format: users/{user}/notifications/{notification} - */ - name: string; - /** - * The sender of the notification. - * Format: users/{user} - */ - sender: string; - /** The status of the notification. */ - status: UserNotification_Status; - /** The creation timestamp. */ - createTime?: - | Date - | undefined; - /** The type of the notification. */ - type: UserNotification_Type; - /** The activity ID associated with this notification. */ - activityId?: number | undefined; -} - -export enum UserNotification_Status { - STATUS_UNSPECIFIED = "STATUS_UNSPECIFIED", - UNREAD = "UNREAD", - ARCHIVED = "ARCHIVED", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function userNotification_StatusFromJSON(object: any): UserNotification_Status { - switch (object) { - case 0: - case "STATUS_UNSPECIFIED": - return UserNotification_Status.STATUS_UNSPECIFIED; - case 1: - case "UNREAD": - return UserNotification_Status.UNREAD; - case 2: - case "ARCHIVED": - return UserNotification_Status.ARCHIVED; - case -1: - case "UNRECOGNIZED": - default: - return UserNotification_Status.UNRECOGNIZED; - } -} - -export function userNotification_StatusToNumber(object: UserNotification_Status): number { - switch (object) { - case UserNotification_Status.STATUS_UNSPECIFIED: - return 0; - case UserNotification_Status.UNREAD: - return 1; - case UserNotification_Status.ARCHIVED: - return 2; - case UserNotification_Status.UNRECOGNIZED: - default: - return -1; - } -} - -export enum UserNotification_Type { - TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED", - MEMO_COMMENT = "MEMO_COMMENT", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function userNotification_TypeFromJSON(object: any): UserNotification_Type { - switch (object) { - case 0: - case "TYPE_UNSPECIFIED": - return UserNotification_Type.TYPE_UNSPECIFIED; - case 1: - case "MEMO_COMMENT": - return UserNotification_Type.MEMO_COMMENT; - case -1: - case "UNRECOGNIZED": - default: - return UserNotification_Type.UNRECOGNIZED; - } -} - -export function userNotification_TypeToNumber(object: UserNotification_Type): number { - switch (object) { - case UserNotification_Type.TYPE_UNSPECIFIED: - return 0; - case UserNotification_Type.MEMO_COMMENT: - return 1; - case UserNotification_Type.UNRECOGNIZED: - default: - return -1; - } -} - -export interface ListUserNotificationsRequest { - /** - * The parent user resource. - * Format: users/{user} - */ - parent: string; - pageSize: number; - pageToken: string; - filter: string; -} - -export interface ListUserNotificationsResponse { - notifications: UserNotification[]; - nextPageToken: string; -} - -export interface UpdateUserNotificationRequest { - notification?: UserNotification | undefined; - updateMask?: string[] | undefined; -} - -export interface DeleteUserNotificationRequest { - /** Format: users/{user}/notifications/{notification} */ - name: string; -} - -function createBaseUser(): User { - return { - name: "", - role: User_Role.ROLE_UNSPECIFIED, - username: "", - email: "", - displayName: "", - avatarUrl: "", - description: "", - password: "", - state: State.STATE_UNSPECIFIED, - createTime: undefined, - updateTime: undefined, - }; -} - -export const User: MessageFns = { - encode(message: User, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.role !== User_Role.ROLE_UNSPECIFIED) { - writer.uint32(16).int32(user_RoleToNumber(message.role)); - } - if (message.username !== "") { - writer.uint32(26).string(message.username); - } - if (message.email !== "") { - writer.uint32(34).string(message.email); - } - if (message.displayName !== "") { - writer.uint32(42).string(message.displayName); - } - if (message.avatarUrl !== "") { - writer.uint32(50).string(message.avatarUrl); - } - if (message.description !== "") { - writer.uint32(58).string(message.description); - } - if (message.password !== "") { - writer.uint32(66).string(message.password); - } - if (message.state !== State.STATE_UNSPECIFIED) { - writer.uint32(72).int32(stateToNumber(message.state)); - } - if (message.createTime !== undefined) { - Timestamp.encode(toTimestamp(message.createTime), writer.uint32(82).fork()).join(); - } - if (message.updateTime !== undefined) { - Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(90).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): User { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUser(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.role = user_RoleFromJSON(reader.int32()); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.username = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.email = reader.string(); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.displayName = reader.string(); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.avatarUrl = reader.string(); - continue; - } - case 7: { - if (tag !== 58) { - break; - } - - message.description = reader.string(); - continue; - } - case 8: { - if (tag !== 66) { - break; - } - - message.password = reader.string(); - continue; - } - case 9: { - if (tag !== 72) { - break; - } - - message.state = stateFromJSON(reader.int32()); - continue; - } - case 10: { - if (tag !== 82) { - break; - } - - message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - case 11: { - if (tag !== 90) { - break; - } - - message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): User { - return User.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): User { - const message = createBaseUser(); - message.name = object.name ?? ""; - message.role = object.role ?? User_Role.ROLE_UNSPECIFIED; - message.username = object.username ?? ""; - message.email = object.email ?? ""; - message.displayName = object.displayName ?? ""; - message.avatarUrl = object.avatarUrl ?? ""; - message.description = object.description ?? ""; - message.password = object.password ?? ""; - message.state = object.state ?? State.STATE_UNSPECIFIED; - message.createTime = object.createTime ?? undefined; - message.updateTime = object.updateTime ?? undefined; - return message; - }, -}; - -function createBaseListUsersRequest(): ListUsersRequest { - return { pageSize: 0, pageToken: "", filter: "", showDeleted: false }; -} - -export const ListUsersRequest: MessageFns = { - encode(message: ListUsersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.pageSize !== 0) { - writer.uint32(8).int32(message.pageSize); - } - if (message.pageToken !== "") { - writer.uint32(18).string(message.pageToken); - } - if (message.filter !== "") { - writer.uint32(26).string(message.filter); - } - if (message.showDeleted !== false) { - writer.uint32(32).bool(message.showDeleted); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListUsersRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListUsersRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.pageToken = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.filter = reader.string(); - continue; - } - case 4: { - if (tag !== 32) { - break; - } - - message.showDeleted = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListUsersRequest { - return ListUsersRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListUsersRequest { - const message = createBaseListUsersRequest(); - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; - message.filter = object.filter ?? ""; - message.showDeleted = object.showDeleted ?? false; - return message; - }, -}; - -function createBaseListUsersResponse(): ListUsersResponse { - return { users: [], nextPageToken: "", totalSize: 0 }; -} - -export const ListUsersResponse: MessageFns = { - encode(message: ListUsersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.users) { - User.encode(v!, writer.uint32(10).fork()).join(); - } - if (message.nextPageToken !== "") { - writer.uint32(18).string(message.nextPageToken); - } - if (message.totalSize !== 0) { - writer.uint32(24).int32(message.totalSize); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListUsersResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListUsersResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.users.push(User.decode(reader, reader.uint32())); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.nextPageToken = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.totalSize = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListUsersResponse { - return ListUsersResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListUsersResponse { - const message = createBaseListUsersResponse(); - message.users = object.users?.map((e) => User.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - message.totalSize = object.totalSize ?? 0; - return message; - }, -}; - -function createBaseGetUserRequest(): GetUserRequest { - return { name: "", readMask: undefined }; -} - -export const GetUserRequest: MessageFns = { - encode(message: GetUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.readMask !== undefined) { - FieldMask.encode(FieldMask.wrap(message.readMask), writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GetUserRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetUserRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.readMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GetUserRequest { - return GetUserRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GetUserRequest { - const message = createBaseGetUserRequest(); - message.name = object.name ?? ""; - message.readMask = object.readMask ?? undefined; - return message; - }, -}; - -function createBaseCreateUserRequest(): CreateUserRequest { - return { user: undefined, userId: "", validateOnly: false, requestId: "" }; -} - -export const CreateUserRequest: MessageFns = { - encode(message: CreateUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.user !== undefined) { - User.encode(message.user, writer.uint32(10).fork()).join(); - } - if (message.userId !== "") { - writer.uint32(18).string(message.userId); - } - if (message.validateOnly !== false) { - writer.uint32(24).bool(message.validateOnly); - } - if (message.requestId !== "") { - writer.uint32(34).string(message.requestId); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CreateUserRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateUserRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.user = User.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.userId = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.validateOnly = reader.bool(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.requestId = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CreateUserRequest { - return CreateUserRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CreateUserRequest { - const message = createBaseCreateUserRequest(); - message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; - message.userId = object.userId ?? ""; - message.validateOnly = object.validateOnly ?? false; - message.requestId = object.requestId ?? ""; - return message; - }, -}; - -function createBaseUpdateUserRequest(): UpdateUserRequest { - return { user: undefined, updateMask: undefined, allowMissing: false }; -} - -export const UpdateUserRequest: MessageFns = { - encode(message: UpdateUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.user !== undefined) { - User.encode(message.user, writer.uint32(10).fork()).join(); - } - if (message.updateMask !== undefined) { - FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); - } - if (message.allowMissing !== false) { - writer.uint32(24).bool(message.allowMissing); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpdateUserRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.user = User.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.allowMissing = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UpdateUserRequest { - return UpdateUserRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UpdateUserRequest { - const message = createBaseUpdateUserRequest(); - message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; - message.updateMask = object.updateMask ?? undefined; - message.allowMissing = object.allowMissing ?? false; - return message; - }, -}; - -function createBaseDeleteUserRequest(): DeleteUserRequest { - return { name: "", force: false }; -} - -export const DeleteUserRequest: MessageFns = { - encode(message: DeleteUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.force !== false) { - writer.uint32(16).bool(message.force); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DeleteUserRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeleteUserRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.force = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DeleteUserRequest { - return DeleteUserRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DeleteUserRequest { - const message = createBaseDeleteUserRequest(); - message.name = object.name ?? ""; - message.force = object.force ?? false; - return message; - }, -}; - -function createBaseUserStats(): UserStats { - return { - name: "", - memoDisplayTimestamps: [], - memoTypeStats: undefined, - tagCount: {}, - pinnedMemos: [], - totalMemoCount: 0, - }; -} - -export const UserStats: MessageFns = { - encode(message: UserStats, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - for (const v of message.memoDisplayTimestamps) { - Timestamp.encode(toTimestamp(v!), writer.uint32(18).fork()).join(); - } - if (message.memoTypeStats !== undefined) { - UserStats_MemoTypeStats.encode(message.memoTypeStats, writer.uint32(26).fork()).join(); - } - Object.entries(message.tagCount).forEach(([key, value]) => { - UserStats_TagCountEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join(); - }); - for (const v of message.pinnedMemos) { - writer.uint32(42).string(v!); - } - if (message.totalMemoCount !== 0) { - writer.uint32(48).int32(message.totalMemoCount); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserStats { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserStats(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.memoDisplayTimestamps.push(fromTimestamp(Timestamp.decode(reader, reader.uint32()))); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.memoTypeStats = UserStats_MemoTypeStats.decode(reader, reader.uint32()); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - const entry4 = UserStats_TagCountEntry.decode(reader, reader.uint32()); - if (entry4.value !== undefined) { - message.tagCount[entry4.key] = entry4.value; - } - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.pinnedMemos.push(reader.string()); - continue; - } - case 6: { - if (tag !== 48) { - break; - } - - message.totalMemoCount = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserStats { - return UserStats.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserStats { - const message = createBaseUserStats(); - message.name = object.name ?? ""; - message.memoDisplayTimestamps = object.memoDisplayTimestamps?.map((e) => e) || []; - message.memoTypeStats = (object.memoTypeStats !== undefined && object.memoTypeStats !== null) - ? UserStats_MemoTypeStats.fromPartial(object.memoTypeStats) - : undefined; - message.tagCount = Object.entries(object.tagCount ?? {}).reduce<{ [key: string]: number }>((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = globalThis.Number(value); - } - return acc; - }, {}); - message.pinnedMemos = object.pinnedMemos?.map((e) => e) || []; - message.totalMemoCount = object.totalMemoCount ?? 0; - return message; - }, -}; - -function createBaseUserStats_TagCountEntry(): UserStats_TagCountEntry { - return { key: "", value: 0 }; -} - -export const UserStats_TagCountEntry: MessageFns = { - encode(message: UserStats_TagCountEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value !== 0) { - writer.uint32(16).int32(message.value); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserStats_TagCountEntry { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserStats_TagCountEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.key = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.value = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserStats_TagCountEntry { - return UserStats_TagCountEntry.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserStats_TagCountEntry { - const message = createBaseUserStats_TagCountEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? 0; - return message; - }, -}; - -function createBaseUserStats_MemoTypeStats(): UserStats_MemoTypeStats { - return { linkCount: 0, codeCount: 0, todoCount: 0, undoCount: 0 }; -} - -export const UserStats_MemoTypeStats: MessageFns = { - encode(message: UserStats_MemoTypeStats, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.linkCount !== 0) { - writer.uint32(8).int32(message.linkCount); - } - if (message.codeCount !== 0) { - writer.uint32(16).int32(message.codeCount); - } - if (message.todoCount !== 0) { - writer.uint32(24).int32(message.todoCount); - } - if (message.undoCount !== 0) { - writer.uint32(32).int32(message.undoCount); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserStats_MemoTypeStats { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserStats_MemoTypeStats(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.linkCount = reader.int32(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.codeCount = reader.int32(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.todoCount = reader.int32(); - continue; - } - case 4: { - if (tag !== 32) { - break; - } - - message.undoCount = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserStats_MemoTypeStats { - return UserStats_MemoTypeStats.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserStats_MemoTypeStats { - const message = createBaseUserStats_MemoTypeStats(); - message.linkCount = object.linkCount ?? 0; - message.codeCount = object.codeCount ?? 0; - message.todoCount = object.todoCount ?? 0; - message.undoCount = object.undoCount ?? 0; - return message; - }, -}; - -function createBaseGetUserStatsRequest(): GetUserStatsRequest { - return { name: "" }; -} - -export const GetUserStatsRequest: MessageFns = { - encode(message: GetUserStatsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GetUserStatsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetUserStatsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GetUserStatsRequest { - return GetUserStatsRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GetUserStatsRequest { - const message = createBaseGetUserStatsRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseListAllUserStatsRequest(): ListAllUserStatsRequest { - return {}; -} - -export const ListAllUserStatsRequest: MessageFns = { - encode(_: ListAllUserStatsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListAllUserStatsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListAllUserStatsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListAllUserStatsRequest { - return ListAllUserStatsRequest.fromPartial(base ?? {}); - }, - fromPartial(_: DeepPartial): ListAllUserStatsRequest { - const message = createBaseListAllUserStatsRequest(); - return message; - }, -}; - -function createBaseListAllUserStatsResponse(): ListAllUserStatsResponse { - return { stats: [] }; -} - -export const ListAllUserStatsResponse: MessageFns = { - encode(message: ListAllUserStatsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.stats) { - UserStats.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListAllUserStatsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListAllUserStatsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.stats.push(UserStats.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListAllUserStatsResponse { - return ListAllUserStatsResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListAllUserStatsResponse { - const message = createBaseListAllUserStatsResponse(); - message.stats = object.stats?.map((e) => UserStats.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseUserSetting(): UserSetting { - return { - name: "", - generalSetting: undefined, - sessionsSetting: undefined, - accessTokensSetting: undefined, - webhooksSetting: undefined, - }; -} - -export const UserSetting: MessageFns = { - encode(message: UserSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.generalSetting !== undefined) { - UserSetting_GeneralSetting.encode(message.generalSetting, writer.uint32(18).fork()).join(); - } - if (message.sessionsSetting !== undefined) { - UserSetting_SessionsSetting.encode(message.sessionsSetting, writer.uint32(26).fork()).join(); - } - if (message.accessTokensSetting !== undefined) { - UserSetting_AccessTokensSetting.encode(message.accessTokensSetting, writer.uint32(34).fork()).join(); - } - if (message.webhooksSetting !== undefined) { - UserSetting_WebhooksSetting.encode(message.webhooksSetting, writer.uint32(42).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserSetting { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserSetting(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.generalSetting = UserSetting_GeneralSetting.decode(reader, reader.uint32()); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.sessionsSetting = UserSetting_SessionsSetting.decode(reader, reader.uint32()); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.accessTokensSetting = UserSetting_AccessTokensSetting.decode(reader, reader.uint32()); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.webhooksSetting = UserSetting_WebhooksSetting.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserSetting { - return UserSetting.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserSetting { - const message = createBaseUserSetting(); - message.name = object.name ?? ""; - message.generalSetting = (object.generalSetting !== undefined && object.generalSetting !== null) - ? UserSetting_GeneralSetting.fromPartial(object.generalSetting) - : undefined; - message.sessionsSetting = (object.sessionsSetting !== undefined && object.sessionsSetting !== null) - ? UserSetting_SessionsSetting.fromPartial(object.sessionsSetting) - : undefined; - message.accessTokensSetting = (object.accessTokensSetting !== undefined && object.accessTokensSetting !== null) - ? UserSetting_AccessTokensSetting.fromPartial(object.accessTokensSetting) - : undefined; - message.webhooksSetting = (object.webhooksSetting !== undefined && object.webhooksSetting !== null) - ? UserSetting_WebhooksSetting.fromPartial(object.webhooksSetting) - : undefined; - return message; - }, -}; - -function createBaseUserSetting_GeneralSetting(): UserSetting_GeneralSetting { - return { locale: "", memoVisibility: "", theme: "" }; -} - -export const UserSetting_GeneralSetting: MessageFns = { - encode(message: UserSetting_GeneralSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.locale !== "") { - writer.uint32(10).string(message.locale); - } - if (message.memoVisibility !== "") { - writer.uint32(26).string(message.memoVisibility); - } - if (message.theme !== "") { - writer.uint32(34).string(message.theme); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_GeneralSetting { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserSetting_GeneralSetting(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.locale = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.memoVisibility = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.theme = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserSetting_GeneralSetting { - return UserSetting_GeneralSetting.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserSetting_GeneralSetting { - const message = createBaseUserSetting_GeneralSetting(); - message.locale = object.locale ?? ""; - message.memoVisibility = object.memoVisibility ?? ""; - message.theme = object.theme ?? ""; - return message; - }, -}; - -function createBaseUserSetting_SessionsSetting(): UserSetting_SessionsSetting { - return { sessions: [] }; -} - -export const UserSetting_SessionsSetting: MessageFns = { - encode(message: UserSetting_SessionsSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.sessions) { - UserSession.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_SessionsSetting { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserSetting_SessionsSetting(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.sessions.push(UserSession.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserSetting_SessionsSetting { - return UserSetting_SessionsSetting.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserSetting_SessionsSetting { - const message = createBaseUserSetting_SessionsSetting(); - message.sessions = object.sessions?.map((e) => UserSession.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseUserSetting_AccessTokensSetting(): UserSetting_AccessTokensSetting { - return { accessTokens: [] }; -} - -export const UserSetting_AccessTokensSetting: MessageFns = { - encode(message: UserSetting_AccessTokensSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.accessTokens) { - UserAccessToken.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_AccessTokensSetting { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserSetting_AccessTokensSetting(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.accessTokens.push(UserAccessToken.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserSetting_AccessTokensSetting { - return UserSetting_AccessTokensSetting.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserSetting_AccessTokensSetting { - const message = createBaseUserSetting_AccessTokensSetting(); - message.accessTokens = object.accessTokens?.map((e) => UserAccessToken.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseUserSetting_WebhooksSetting(): UserSetting_WebhooksSetting { - return { webhooks: [] }; -} - -export const UserSetting_WebhooksSetting: MessageFns = { - encode(message: UserSetting_WebhooksSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.webhooks) { - UserWebhook.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_WebhooksSetting { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserSetting_WebhooksSetting(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.webhooks.push(UserWebhook.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserSetting_WebhooksSetting { - return UserSetting_WebhooksSetting.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserSetting_WebhooksSetting { - const message = createBaseUserSetting_WebhooksSetting(); - message.webhooks = object.webhooks?.map((e) => UserWebhook.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseGetUserSettingRequest(): GetUserSettingRequest { - return { name: "" }; -} - -export const GetUserSettingRequest: MessageFns = { - encode(message: GetUserSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GetUserSettingRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetUserSettingRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GetUserSettingRequest { - return GetUserSettingRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GetUserSettingRequest { - const message = createBaseGetUserSettingRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseUpdateUserSettingRequest(): UpdateUserSettingRequest { - return { setting: undefined, updateMask: undefined }; -} - -export const UpdateUserSettingRequest: MessageFns = { - encode(message: UpdateUserSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.setting !== undefined) { - UserSetting.encode(message.setting, writer.uint32(10).fork()).join(); - } - if (message.updateMask !== undefined) { - FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserSettingRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpdateUserSettingRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.setting = UserSetting.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UpdateUserSettingRequest { - return UpdateUserSettingRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UpdateUserSettingRequest { - const message = createBaseUpdateUserSettingRequest(); - message.setting = (object.setting !== undefined && object.setting !== null) - ? UserSetting.fromPartial(object.setting) - : undefined; - message.updateMask = object.updateMask ?? undefined; - return message; - }, -}; - -function createBaseListUserSettingsRequest(): ListUserSettingsRequest { - return { parent: "", pageSize: 0, pageToken: "" }; -} - -export const ListUserSettingsRequest: MessageFns = { - encode(message: ListUserSettingsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.parent !== "") { - writer.uint32(10).string(message.parent); - } - if (message.pageSize !== 0) { - writer.uint32(16).int32(message.pageSize); - } - if (message.pageToken !== "") { - writer.uint32(26).string(message.pageToken); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListUserSettingsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListUserSettingsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.parent = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.pageToken = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListUserSettingsRequest { - return ListUserSettingsRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListUserSettingsRequest { - const message = createBaseListUserSettingsRequest(); - message.parent = object.parent ?? ""; - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; - return message; - }, -}; - -function createBaseListUserSettingsResponse(): ListUserSettingsResponse { - return { settings: [], nextPageToken: "", totalSize: 0 }; -} - -export const ListUserSettingsResponse: MessageFns = { - encode(message: ListUserSettingsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.settings) { - UserSetting.encode(v!, writer.uint32(10).fork()).join(); - } - if (message.nextPageToken !== "") { - writer.uint32(18).string(message.nextPageToken); - } - if (message.totalSize !== 0) { - writer.uint32(24).int32(message.totalSize); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListUserSettingsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListUserSettingsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.settings.push(UserSetting.decode(reader, reader.uint32())); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.nextPageToken = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.totalSize = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListUserSettingsResponse { - return ListUserSettingsResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListUserSettingsResponse { - const message = createBaseListUserSettingsResponse(); - message.settings = object.settings?.map((e) => UserSetting.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - message.totalSize = object.totalSize ?? 0; - return message; - }, -}; - -function createBaseUserAccessToken(): UserAccessToken { - return { name: "", accessToken: "", description: "", issuedAt: undefined, expiresAt: undefined }; -} - -export const UserAccessToken: MessageFns = { - encode(message: UserAccessToken, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.accessToken !== "") { - writer.uint32(18).string(message.accessToken); - } - if (message.description !== "") { - writer.uint32(26).string(message.description); - } - if (message.issuedAt !== undefined) { - Timestamp.encode(toTimestamp(message.issuedAt), writer.uint32(34).fork()).join(); - } - if (message.expiresAt !== undefined) { - Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(42).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserAccessToken { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserAccessToken(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.accessToken = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.description = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.issuedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.expiresAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserAccessToken { - return UserAccessToken.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserAccessToken { - const message = createBaseUserAccessToken(); - message.name = object.name ?? ""; - message.accessToken = object.accessToken ?? ""; - message.description = object.description ?? ""; - message.issuedAt = object.issuedAt ?? undefined; - message.expiresAt = object.expiresAt ?? undefined; - return message; - }, -}; - -function createBaseListUserAccessTokensRequest(): ListUserAccessTokensRequest { - return { parent: "", pageSize: 0, pageToken: "" }; -} - -export const ListUserAccessTokensRequest: MessageFns = { - encode(message: ListUserAccessTokensRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.parent !== "") { - writer.uint32(10).string(message.parent); - } - if (message.pageSize !== 0) { - writer.uint32(16).int32(message.pageSize); - } - if (message.pageToken !== "") { - writer.uint32(26).string(message.pageToken); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListUserAccessTokensRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListUserAccessTokensRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.parent = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.pageToken = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListUserAccessTokensRequest { - return ListUserAccessTokensRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListUserAccessTokensRequest { - const message = createBaseListUserAccessTokensRequest(); - message.parent = object.parent ?? ""; - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; - return message; - }, -}; - -function createBaseListUserAccessTokensResponse(): ListUserAccessTokensResponse { - return { accessTokens: [], nextPageToken: "", totalSize: 0 }; -} - -export const ListUserAccessTokensResponse: MessageFns = { - encode(message: ListUserAccessTokensResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.accessTokens) { - UserAccessToken.encode(v!, writer.uint32(10).fork()).join(); - } - if (message.nextPageToken !== "") { - writer.uint32(18).string(message.nextPageToken); - } - if (message.totalSize !== 0) { - writer.uint32(24).int32(message.totalSize); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListUserAccessTokensResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListUserAccessTokensResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.accessTokens.push(UserAccessToken.decode(reader, reader.uint32())); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.nextPageToken = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.totalSize = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListUserAccessTokensResponse { - return ListUserAccessTokensResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListUserAccessTokensResponse { - const message = createBaseListUserAccessTokensResponse(); - message.accessTokens = object.accessTokens?.map((e) => UserAccessToken.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - message.totalSize = object.totalSize ?? 0; - return message; - }, -}; - -function createBaseCreateUserAccessTokenRequest(): CreateUserAccessTokenRequest { - return { parent: "", accessToken: undefined, accessTokenId: "" }; -} - -export const CreateUserAccessTokenRequest: MessageFns = { - encode(message: CreateUserAccessTokenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.parent !== "") { - writer.uint32(10).string(message.parent); - } - if (message.accessToken !== undefined) { - UserAccessToken.encode(message.accessToken, writer.uint32(18).fork()).join(); - } - if (message.accessTokenId !== "") { - writer.uint32(26).string(message.accessTokenId); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CreateUserAccessTokenRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateUserAccessTokenRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.parent = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.accessToken = UserAccessToken.decode(reader, reader.uint32()); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.accessTokenId = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CreateUserAccessTokenRequest { - return CreateUserAccessTokenRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CreateUserAccessTokenRequest { - const message = createBaseCreateUserAccessTokenRequest(); - message.parent = object.parent ?? ""; - message.accessToken = (object.accessToken !== undefined && object.accessToken !== null) - ? UserAccessToken.fromPartial(object.accessToken) - : undefined; - message.accessTokenId = object.accessTokenId ?? ""; - return message; - }, -}; - -function createBaseDeleteUserAccessTokenRequest(): DeleteUserAccessTokenRequest { - return { name: "" }; -} - -export const DeleteUserAccessTokenRequest: MessageFns = { - encode(message: DeleteUserAccessTokenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DeleteUserAccessTokenRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeleteUserAccessTokenRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DeleteUserAccessTokenRequest { - return DeleteUserAccessTokenRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DeleteUserAccessTokenRequest { - const message = createBaseDeleteUserAccessTokenRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseUserSession(): UserSession { - return { name: "", sessionId: "", createTime: undefined, lastAccessedTime: undefined, clientInfo: undefined }; -} - -export const UserSession: MessageFns = { - encode(message: UserSession, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.sessionId !== "") { - writer.uint32(18).string(message.sessionId); - } - if (message.createTime !== undefined) { - Timestamp.encode(toTimestamp(message.createTime), writer.uint32(26).fork()).join(); - } - if (message.lastAccessedTime !== undefined) { - Timestamp.encode(toTimestamp(message.lastAccessedTime), writer.uint32(34).fork()).join(); - } - if (message.clientInfo !== undefined) { - UserSession_ClientInfo.encode(message.clientInfo, writer.uint32(42).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserSession { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserSession(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.sessionId = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.lastAccessedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.clientInfo = UserSession_ClientInfo.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserSession { - return UserSession.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserSession { - const message = createBaseUserSession(); - message.name = object.name ?? ""; - message.sessionId = object.sessionId ?? ""; - message.createTime = object.createTime ?? undefined; - message.lastAccessedTime = object.lastAccessedTime ?? undefined; - message.clientInfo = (object.clientInfo !== undefined && object.clientInfo !== null) - ? UserSession_ClientInfo.fromPartial(object.clientInfo) - : undefined; - return message; - }, -}; - -function createBaseUserSession_ClientInfo(): UserSession_ClientInfo { - return { userAgent: "", ipAddress: "", deviceType: "", os: "", browser: "" }; -} - -export const UserSession_ClientInfo: MessageFns = { - encode(message: UserSession_ClientInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.userAgent !== "") { - writer.uint32(10).string(message.userAgent); - } - if (message.ipAddress !== "") { - writer.uint32(18).string(message.ipAddress); - } - if (message.deviceType !== "") { - writer.uint32(26).string(message.deviceType); - } - if (message.os !== "") { - writer.uint32(34).string(message.os); - } - if (message.browser !== "") { - writer.uint32(42).string(message.browser); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserSession_ClientInfo { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserSession_ClientInfo(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.userAgent = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.ipAddress = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.deviceType = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.os = reader.string(); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.browser = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserSession_ClientInfo { - return UserSession_ClientInfo.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserSession_ClientInfo { - const message = createBaseUserSession_ClientInfo(); - message.userAgent = object.userAgent ?? ""; - message.ipAddress = object.ipAddress ?? ""; - message.deviceType = object.deviceType ?? ""; - message.os = object.os ?? ""; - message.browser = object.browser ?? ""; - return message; - }, -}; - -function createBaseListUserSessionsRequest(): ListUserSessionsRequest { - return { parent: "" }; -} - -export const ListUserSessionsRequest: MessageFns = { - encode(message: ListUserSessionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.parent !== "") { - writer.uint32(10).string(message.parent); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListUserSessionsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListUserSessionsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.parent = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListUserSessionsRequest { - return ListUserSessionsRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListUserSessionsRequest { - const message = createBaseListUserSessionsRequest(); - message.parent = object.parent ?? ""; - return message; - }, -}; - -function createBaseListUserSessionsResponse(): ListUserSessionsResponse { - return { sessions: [] }; -} - -export const ListUserSessionsResponse: MessageFns = { - encode(message: ListUserSessionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.sessions) { - UserSession.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListUserSessionsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListUserSessionsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.sessions.push(UserSession.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListUserSessionsResponse { - return ListUserSessionsResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListUserSessionsResponse { - const message = createBaseListUserSessionsResponse(); - message.sessions = object.sessions?.map((e) => UserSession.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseRevokeUserSessionRequest(): RevokeUserSessionRequest { - return { name: "" }; -} - -export const RevokeUserSessionRequest: MessageFns = { - encode(message: RevokeUserSessionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): RevokeUserSessionRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRevokeUserSessionRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): RevokeUserSessionRequest { - return RevokeUserSessionRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): RevokeUserSessionRequest { - const message = createBaseRevokeUserSessionRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseUserWebhook(): UserWebhook { - return { name: "", url: "", displayName: "", createTime: undefined, updateTime: undefined }; -} - -export const UserWebhook: MessageFns = { - encode(message: UserWebhook, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.url !== "") { - writer.uint32(18).string(message.url); - } - if (message.displayName !== "") { - writer.uint32(26).string(message.displayName); - } - if (message.createTime !== undefined) { - Timestamp.encode(toTimestamp(message.createTime), writer.uint32(34).fork()).join(); - } - if (message.updateTime !== undefined) { - Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(42).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserWebhook { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserWebhook(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.url = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.displayName = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserWebhook { - return UserWebhook.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserWebhook { - const message = createBaseUserWebhook(); - message.name = object.name ?? ""; - message.url = object.url ?? ""; - message.displayName = object.displayName ?? ""; - message.createTime = object.createTime ?? undefined; - message.updateTime = object.updateTime ?? undefined; - return message; - }, -}; - -function createBaseListUserWebhooksRequest(): ListUserWebhooksRequest { - return { parent: "" }; -} - -export const ListUserWebhooksRequest: MessageFns = { - encode(message: ListUserWebhooksRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.parent !== "") { - writer.uint32(10).string(message.parent); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListUserWebhooksRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListUserWebhooksRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.parent = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListUserWebhooksRequest { - return ListUserWebhooksRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListUserWebhooksRequest { - const message = createBaseListUserWebhooksRequest(); - message.parent = object.parent ?? ""; - return message; - }, -}; - -function createBaseListUserWebhooksResponse(): ListUserWebhooksResponse { - return { webhooks: [] }; -} - -export const ListUserWebhooksResponse: MessageFns = { - encode(message: ListUserWebhooksResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.webhooks) { - UserWebhook.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListUserWebhooksResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListUserWebhooksResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.webhooks.push(UserWebhook.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListUserWebhooksResponse { - return ListUserWebhooksResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListUserWebhooksResponse { - const message = createBaseListUserWebhooksResponse(); - message.webhooks = object.webhooks?.map((e) => UserWebhook.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseCreateUserWebhookRequest(): CreateUserWebhookRequest { - return { parent: "", webhook: undefined }; -} - -export const CreateUserWebhookRequest: MessageFns = { - encode(message: CreateUserWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.parent !== "") { - writer.uint32(10).string(message.parent); - } - if (message.webhook !== undefined) { - UserWebhook.encode(message.webhook, writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CreateUserWebhookRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateUserWebhookRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.parent = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.webhook = UserWebhook.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CreateUserWebhookRequest { - return CreateUserWebhookRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CreateUserWebhookRequest { - const message = createBaseCreateUserWebhookRequest(); - message.parent = object.parent ?? ""; - message.webhook = (object.webhook !== undefined && object.webhook !== null) - ? UserWebhook.fromPartial(object.webhook) - : undefined; - return message; - }, -}; - -function createBaseUpdateUserWebhookRequest(): UpdateUserWebhookRequest { - return { webhook: undefined, updateMask: undefined }; -} - -export const UpdateUserWebhookRequest: MessageFns = { - encode(message: UpdateUserWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.webhook !== undefined) { - UserWebhook.encode(message.webhook, writer.uint32(10).fork()).join(); - } - if (message.updateMask !== undefined) { - FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserWebhookRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpdateUserWebhookRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.webhook = UserWebhook.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UpdateUserWebhookRequest { - return UpdateUserWebhookRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UpdateUserWebhookRequest { - const message = createBaseUpdateUserWebhookRequest(); - message.webhook = (object.webhook !== undefined && object.webhook !== null) - ? UserWebhook.fromPartial(object.webhook) - : undefined; - message.updateMask = object.updateMask ?? undefined; - return message; - }, -}; - -function createBaseDeleteUserWebhookRequest(): DeleteUserWebhookRequest { - return { name: "" }; -} - -export const DeleteUserWebhookRequest: MessageFns = { - encode(message: DeleteUserWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DeleteUserWebhookRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeleteUserWebhookRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DeleteUserWebhookRequest { - return DeleteUserWebhookRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DeleteUserWebhookRequest { - const message = createBaseDeleteUserWebhookRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseUserNotification(): UserNotification { - return { - name: "", - sender: "", - status: UserNotification_Status.STATUS_UNSPECIFIED, - createTime: undefined, - type: UserNotification_Type.TYPE_UNSPECIFIED, - activityId: undefined, - }; -} - -export const UserNotification: MessageFns = { - encode(message: UserNotification, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.sender !== "") { - writer.uint32(18).string(message.sender); - } - if (message.status !== UserNotification_Status.STATUS_UNSPECIFIED) { - writer.uint32(24).int32(userNotification_StatusToNumber(message.status)); - } - if (message.createTime !== undefined) { - Timestamp.encode(toTimestamp(message.createTime), writer.uint32(34).fork()).join(); - } - if (message.type !== UserNotification_Type.TYPE_UNSPECIFIED) { - writer.uint32(40).int32(userNotification_TypeToNumber(message.type)); - } - if (message.activityId !== undefined) { - writer.uint32(48).int32(message.activityId); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserNotification { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserNotification(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.sender = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.status = userNotification_StatusFromJSON(reader.int32()); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - case 5: { - if (tag !== 40) { - break; - } - - message.type = userNotification_TypeFromJSON(reader.int32()); - continue; - } - case 6: { - if (tag !== 48) { - break; - } - - message.activityId = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserNotification { - return UserNotification.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserNotification { - const message = createBaseUserNotification(); - message.name = object.name ?? ""; - message.sender = object.sender ?? ""; - message.status = object.status ?? UserNotification_Status.STATUS_UNSPECIFIED; - message.createTime = object.createTime ?? undefined; - message.type = object.type ?? UserNotification_Type.TYPE_UNSPECIFIED; - message.activityId = object.activityId ?? undefined; - return message; - }, -}; - -function createBaseListUserNotificationsRequest(): ListUserNotificationsRequest { - return { parent: "", pageSize: 0, pageToken: "", filter: "" }; -} - -export const ListUserNotificationsRequest: MessageFns = { - encode(message: ListUserNotificationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.parent !== "") { - writer.uint32(10).string(message.parent); - } - if (message.pageSize !== 0) { - writer.uint32(16).int32(message.pageSize); - } - if (message.pageToken !== "") { - writer.uint32(26).string(message.pageToken); - } - if (message.filter !== "") { - writer.uint32(34).string(message.filter); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListUserNotificationsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListUserNotificationsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.parent = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.pageToken = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.filter = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListUserNotificationsRequest { - return ListUserNotificationsRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListUserNotificationsRequest { - const message = createBaseListUserNotificationsRequest(); - message.parent = object.parent ?? ""; - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; - message.filter = object.filter ?? ""; - return message; - }, -}; - -function createBaseListUserNotificationsResponse(): ListUserNotificationsResponse { - return { notifications: [], nextPageToken: "" }; -} - -export const ListUserNotificationsResponse: MessageFns = { - encode(message: ListUserNotificationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.notifications) { - UserNotification.encode(v!, writer.uint32(10).fork()).join(); - } - if (message.nextPageToken !== "") { - writer.uint32(18).string(message.nextPageToken); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ListUserNotificationsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListUserNotificationsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.notifications.push(UserNotification.decode(reader, reader.uint32())); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.nextPageToken = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ListUserNotificationsResponse { - return ListUserNotificationsResponse.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ListUserNotificationsResponse { - const message = createBaseListUserNotificationsResponse(); - message.notifications = object.notifications?.map((e) => UserNotification.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - return message; - }, -}; - -function createBaseUpdateUserNotificationRequest(): UpdateUserNotificationRequest { - return { notification: undefined, updateMask: undefined }; -} - -export const UpdateUserNotificationRequest: MessageFns = { - encode(message: UpdateUserNotificationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.notification !== undefined) { - UserNotification.encode(message.notification, writer.uint32(10).fork()).join(); - } - if (message.updateMask !== undefined) { - FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserNotificationRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpdateUserNotificationRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.notification = UserNotification.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UpdateUserNotificationRequest { - return UpdateUserNotificationRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UpdateUserNotificationRequest { - const message = createBaseUpdateUserNotificationRequest(); - message.notification = (object.notification !== undefined && object.notification !== null) - ? UserNotification.fromPartial(object.notification) - : undefined; - message.updateMask = object.updateMask ?? undefined; - return message; - }, -}; - -function createBaseDeleteUserNotificationRequest(): DeleteUserNotificationRequest { - return { name: "" }; -} - -export const DeleteUserNotificationRequest: MessageFns = { - encode(message: DeleteUserNotificationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DeleteUserNotificationRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeleteUserNotificationRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DeleteUserNotificationRequest { - return DeleteUserNotificationRequest.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DeleteUserNotificationRequest { - const message = createBaseDeleteUserNotificationRequest(); - message.name = object.name ?? ""; - return message; - }, -}; - -export type UserServiceDefinition = typeof UserServiceDefinition; -export const UserServiceDefinition = { - name: "UserService", - fullName: "memos.api.v1.UserService", - methods: { - /** ListUsers returns a list of users. */ - listUsers: { - name: "ListUsers", - requestType: ListUsersRequest, - requestStream: false, - responseType: ListUsersResponse, - responseStream: false, - options: { - _unknownFields: { - 578365826: [new Uint8Array([15, 18, 13, 47, 97, 112, 105, 47, 118, 49, 47, 117, 115, 101, 114, 115])], - }, - }, - }, - /** - * GetUser gets a user by ID or username. - * Supports both numeric IDs and username strings: - * - users/{id} (e.g., users/101) - * - users/{username} (e.g., users/steven) - */ - getUser: { - name: "GetUser", - requestType: GetUserRequest, - requestStream: false, - responseType: User, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 24, - 18, - 22, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** CreateUser creates a new user. */ - createUser: { - name: "CreateUser", - requestType: CreateUserRequest, - requestStream: false, - responseType: User, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 117, 115, 101, 114])], - 578365826: [ - new Uint8Array([ - 21, - 58, - 4, - 117, - 115, - 101, - 114, - 34, - 13, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 117, - 115, - 101, - 114, - 115, - ]), - ], - }, - }, - }, - /** UpdateUser updates a user. */ - updateUser: { - name: "UpdateUser", - requestType: UpdateUserRequest, - requestStream: false, - responseType: User, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([16, 117, 115, 101, 114, 44, 117, 112, 100, 97, 116, 101, 95, 109, 97, 115, 107])], - 578365826: [ - new Uint8Array([ - 35, - 58, - 4, - 117, - 115, - 101, - 114, - 50, - 27, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 117, - 115, - 101, - 114, - 46, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** DeleteUser deletes a user. */ - deleteUser: { - name: "DeleteUser", - requestType: DeleteUserRequest, - requestStream: false, - responseType: Empty, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 24, - 42, - 22, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** ListAllUserStats returns statistics for all users. */ - listAllUserStats: { - name: "ListAllUserStats", - requestType: ListAllUserStatsRequest, - requestStream: false, - responseType: ListAllUserStatsResponse, - responseStream: false, - options: { - _unknownFields: { - 578365826: [ - new Uint8Array([ - 21, - 18, - 19, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 117, - 115, - 101, - 114, - 115, - 58, - 115, - 116, - 97, - 116, - 115, - ]), - ], - }, - }, - }, - /** GetUserStats returns statistics for a specific user. */ - getUserStats: { - name: "GetUserStats", - requestType: GetUserStatsRequest, - requestStream: false, - responseType: UserStats, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 33, - 18, - 31, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 125, - 58, - 103, - 101, - 116, - 83, - 116, - 97, - 116, - 115, - ]), - ], - }, - }, - }, - /** GetUserSetting returns the user setting. */ - getUserSetting: { - name: "GetUserSetting", - requestType: GetUserSettingRequest, - requestStream: false, - responseType: UserSetting, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 35, - 18, - 33, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 47, - 115, - 101, - 116, - 116, - 105, - 110, - 103, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** UpdateUserSetting updates the user setting. */ - updateUserSetting: { - name: "UpdateUserSetting", - requestType: UpdateUserSettingRequest, - requestStream: false, - responseType: UserSetting, - responseStream: false, - options: { - _unknownFields: { - 8410: [ - new Uint8Array([ - 19, - 115, - 101, - 116, - 116, - 105, - 110, - 103, - 44, - 117, - 112, - 100, - 97, - 116, - 101, - 95, - 109, - 97, - 115, - 107, - ]), - ], - 578365826: [ - new Uint8Array([ - 52, - 58, - 7, - 115, - 101, - 116, - 116, - 105, - 110, - 103, - 50, - 41, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 115, - 101, - 116, - 116, - 105, - 110, - 103, - 46, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 47, - 115, - 101, - 116, - 116, - 105, - 110, - 103, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** ListUserSettings returns a list of user settings. */ - listUserSettings: { - name: "ListUserSettings", - requestType: ListUserSettingsRequest, - requestStream: false, - responseType: ListUserSettingsResponse, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])], - 578365826: [ - new Uint8Array([ - 35, - 18, - 33, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 112, - 97, - 114, - 101, - 110, - 116, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 125, - 47, - 115, - 101, - 116, - 116, - 105, - 110, - 103, - 115, - ]), - ], - }, - }, - }, - /** ListUserAccessTokens returns a list of access tokens for a user. */ - listUserAccessTokens: { - name: "ListUserAccessTokens", - requestType: ListUserAccessTokensRequest, - requestStream: false, - responseType: ListUserAccessTokensResponse, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])], - 578365826: [ - new Uint8Array([ - 39, - 18, - 37, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 112, - 97, - 114, - 101, - 110, - 116, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 125, - 47, - 97, - 99, - 99, - 101, - 115, - 115, - 84, - 111, - 107, - 101, - 110, - 115, - ]), - ], - }, - }, - }, - /** CreateUserAccessToken creates a new access token for a user. */ - createUserAccessToken: { - name: "CreateUserAccessToken", - requestType: CreateUserAccessTokenRequest, - requestStream: false, - responseType: UserAccessToken, - responseStream: false, - options: { - _unknownFields: { - 8410: [ - new Uint8Array([ - 19, - 112, - 97, - 114, - 101, - 110, - 116, - 44, - 97, - 99, - 99, - 101, - 115, - 115, - 95, - 116, - 111, - 107, - 101, - 110, - ]), - ], - 578365826: [ - new Uint8Array([ - 53, - 58, - 12, - 97, - 99, - 99, - 101, - 115, - 115, - 95, - 116, - 111, - 107, - 101, - 110, - 34, - 37, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 112, - 97, - 114, - 101, - 110, - 116, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 125, - 47, - 97, - 99, - 99, - 101, - 115, - 115, - 84, - 111, - 107, - 101, - 110, - 115, - ]), - ], - }, - }, - }, - /** DeleteUserAccessToken deletes an access token. */ - deleteUserAccessToken: { - name: "DeleteUserAccessToken", - requestType: DeleteUserAccessTokenRequest, - requestStream: false, - responseType: Empty, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 39, - 42, - 37, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 47, - 97, - 99, - 99, - 101, - 115, - 115, - 84, - 111, - 107, - 101, - 110, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** ListUserSessions returns a list of active sessions for a user. */ - listUserSessions: { - name: "ListUserSessions", - requestType: ListUserSessionsRequest, - requestStream: false, - responseType: ListUserSessionsResponse, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])], - 578365826: [ - new Uint8Array([ - 35, - 18, - 33, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 112, - 97, - 114, - 101, - 110, - 116, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 125, - 47, - 115, - 101, - 115, - 115, - 105, - 111, - 110, - 115, - ]), - ], - }, - }, - }, - /** RevokeUserSession revokes a specific session for a user. */ - revokeUserSession: { - name: "RevokeUserSession", - requestType: RevokeUserSessionRequest, - requestStream: false, - responseType: Empty, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 35, - 42, - 33, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 47, - 115, - 101, - 115, - 115, - 105, - 111, - 110, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** ListUserWebhooks returns a list of webhooks for a user. */ - listUserWebhooks: { - name: "ListUserWebhooks", - requestType: ListUserWebhooksRequest, - requestStream: false, - responseType: ListUserWebhooksResponse, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])], - 578365826: [ - new Uint8Array([ - 35, - 18, - 33, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 112, - 97, - 114, - 101, - 110, - 116, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 125, - 47, - 119, - 101, - 98, - 104, - 111, - 111, - 107, - 115, - ]), - ], - }, - }, - }, - /** CreateUserWebhook creates a new webhook for a user. */ - createUserWebhook: { - name: "CreateUserWebhook", - requestType: CreateUserWebhookRequest, - requestStream: false, - responseType: UserWebhook, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([14, 112, 97, 114, 101, 110, 116, 44, 119, 101, 98, 104, 111, 111, 107])], - 578365826: [ - new Uint8Array([ - 44, - 58, - 7, - 119, - 101, - 98, - 104, - 111, - 111, - 107, - 34, - 33, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 112, - 97, - 114, - 101, - 110, - 116, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 125, - 47, - 119, - 101, - 98, - 104, - 111, - 111, - 107, - 115, - ]), - ], - }, - }, - }, - /** UpdateUserWebhook updates an existing webhook for a user. */ - updateUserWebhook: { - name: "UpdateUserWebhook", - requestType: UpdateUserWebhookRequest, - requestStream: false, - responseType: UserWebhook, - responseStream: false, - options: { - _unknownFields: { - 8410: [ - new Uint8Array([ - 19, - 119, - 101, - 98, - 104, - 111, - 111, - 107, - 44, - 117, - 112, - 100, - 97, - 116, - 101, - 95, - 109, - 97, - 115, - 107, - ]), - ], - 578365826: [ - new Uint8Array([ - 52, - 58, - 7, - 119, - 101, - 98, - 104, - 111, - 111, - 107, - 50, - 41, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 119, - 101, - 98, - 104, - 111, - 111, - 107, - 46, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 47, - 119, - 101, - 98, - 104, - 111, - 111, - 107, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** DeleteUserWebhook deletes a webhook for a user. */ - deleteUserWebhook: { - name: "DeleteUserWebhook", - requestType: DeleteUserWebhookRequest, - requestStream: false, - responseType: Empty, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 35, - 42, - 33, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 47, - 119, - 101, - 98, - 104, - 111, - 111, - 107, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** ListUserNotifications lists notifications for a user. */ - listUserNotifications: { - name: "ListUserNotifications", - requestType: ListUserNotificationsRequest, - requestStream: false, - responseType: ListUserNotificationsResponse, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])], - 578365826: [ - new Uint8Array([ - 40, - 18, - 38, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 112, - 97, - 114, - 101, - 110, - 116, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 125, - 47, - 110, - 111, - 116, - 105, - 102, - 105, - 99, - 97, - 116, - 105, - 111, - 110, - 115, - ]), - ], - }, - }, - }, - /** UpdateUserNotification updates a notification. */ - updateUserNotification: { - name: "UpdateUserNotification", - requestType: UpdateUserNotificationRequest, - requestStream: false, - responseType: UserNotification, - responseStream: false, - options: { - _unknownFields: { - 8410: [ - new Uint8Array([ - 24, - 110, - 111, - 116, - 105, - 102, - 105, - 99, - 97, - 116, - 105, - 111, - 110, - 44, - 117, - 112, - 100, - 97, - 116, - 101, - 95, - 109, - 97, - 115, - 107, - ]), - ], - 578365826: [ - new Uint8Array([ - 67, - 58, - 12, - 110, - 111, - 116, - 105, - 102, - 105, - 99, - 97, - 116, - 105, - 111, - 110, - 50, - 51, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 111, - 116, - 105, - 102, - 105, - 99, - 97, - 116, - 105, - 111, - 110, - 46, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 47, - 110, - 111, - 116, - 105, - 102, - 105, - 99, - 97, - 116, - 105, - 111, - 110, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - /** DeleteUserNotification deletes a notification. */ - deleteUserNotification: { - name: "DeleteUserNotification", - requestType: DeleteUserNotificationRequest, - requestStream: false, - responseType: Empty, - responseStream: false, - options: { - _unknownFields: { - 8410: [new Uint8Array([4, 110, 97, 109, 101])], - 578365826: [ - new Uint8Array([ - 40, - 42, - 38, - 47, - 97, - 112, - 105, - 47, - 118, - 49, - 47, - 123, - 110, - 97, - 109, - 101, - 61, - 117, - 115, - 101, - 114, - 115, - 47, - 42, - 47, - 110, - 111, - 116, - 105, - 102, - 105, - 99, - 97, - 116, - 105, - 111, - 110, - 115, - 47, - 42, - 125, - ]), - ], - }, - }, - }, - }, -} as const; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -function toTimestamp(date: Date): Timestamp { - const seconds = Math.trunc(date.getTime() / 1_000); - const nanos = (date.getTime() % 1_000) * 1_000_000; - return { seconds, nanos }; -} - -function fromTimestamp(t: Timestamp): Date { - let millis = (t.seconds || 0) * 1_000; - millis += (t.nanos || 0) / 1_000_000; - return new globalThis.Date(millis); -} - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/api/v1/user_service_pb.ts b/web/src/types/proto/api/v1/user_service_pb.ts new file mode 100644 index 000000000..e940526b8 --- /dev/null +++ b/web/src/types/proto/api/v1/user_service_pb.ts @@ -0,0 +1,1752 @@ +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file api/v1/user_service.proto (package memos.api.v1, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import type { State } from "./common_pb"; +import { file_api_v1_common } from "./common_pb"; +import { file_google_api_annotations } from "../../google/api/annotations_pb"; +import { file_google_api_client } from "../../google/api/client_pb"; +import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; +import { file_google_api_resource } from "../../google/api/resource_pb"; +import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/v1/user_service.proto. + */ +export const file_api_v1_user_service: GenFile = /*@__PURE__*/ + fileDesc("ChlhcGkvdjEvdXNlcl9zZXJ2aWNlLnByb3RvEgxtZW1vcy5hcGkudjEi4AMKBFVzZXISEQoEbmFtZRgBIAEoCUID4EEIEioKBHJvbGUYAiABKA4yFy5tZW1vcy5hcGkudjEuVXNlci5Sb2xlQgPgQQISFQoIdXNlcm5hbWUYAyABKAlCA+BBAhISCgVlbWFpbBgEIAEoCUID4EEBEhkKDGRpc3BsYXlfbmFtZRgFIAEoCUID4EEBEhcKCmF2YXRhcl91cmwYBiABKAlCA+BBARIYCgtkZXNjcmlwdGlvbhgHIAEoCUID4EEBEhUKCHBhc3N3b3JkGAggASgJQgPgQQQSJwoFc3RhdGUYCSABKA4yEy5tZW1vcy5hcGkudjEuU3RhdGVCA+BBAhI0CgtjcmVhdGVfdGltZRgKIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI0Cgt1cGRhdGVfdGltZRgLIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAyI7CgRSb2xlEhQKEFJPTEVfVU5TUEVDSUZJRUQQABIICgRIT1NUEAESCQoFQURNSU4QAhIICgRVU0VSEAM6N+pBNAoRbWVtb3MuYXBpLnYxL1VzZXISDHVzZXJzL3t1c2VyfRoEbmFtZSoFdXNlcnMyBHVzZXIicwoQTGlzdFVzZXJzUmVxdWVzdBIWCglwYWdlX3NpemUYASABKAVCA+BBARIXCgpwYWdlX3Rva2VuGAIgASgJQgPgQQESEwoGZmlsdGVyGAMgASgJQgPgQQESGQoMc2hvd19kZWxldGVkGAQgASgIQgPgQQEiYwoRTGlzdFVzZXJzUmVzcG9uc2USIQoFdXNlcnMYASADKAsyEi5tZW1vcy5hcGkudjEuVXNlchIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkSEgoKdG90YWxfc2l6ZRgDIAEoBSJtCg5HZXRVc2VyUmVxdWVzdBInCgRuYW1lGAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9Vc2VyEjIKCXJlYWRfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tCA+BBASKIAQoRQ3JlYXRlVXNlclJlcXVlc3QSKAoEdXNlchgBIAEoCzISLm1lbW9zLmFwaS52MS5Vc2VyQgbgQQLgQQQSFAoHdXNlcl9pZBgCIAEoCUID4EEBEhoKDXZhbGlkYXRlX29ubHkYAyABKAhCA+BBARIXCgpyZXF1ZXN0X2lkGAQgASgJQgPgQQEijAEKEVVwZGF0ZVVzZXJSZXF1ZXN0EiUKBHVzZXIYASABKAsyEi5tZW1vcy5hcGkudjEuVXNlckID4EECEjQKC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFza0ID4EECEhoKDWFsbG93X21pc3NpbmcYAyABKAhCA+BBASJQChFEZWxldGVVc2VyUmVxdWVzdBInCgRuYW1lGAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9Vc2VyEhIKBWZvcmNlGAIgASgIQgPgQQEi2AMKCVVzZXJTdGF0cxIRCgRuYW1lGAEgASgJQgPgQQgSOwoXbWVtb19kaXNwbGF5X3RpbWVzdGFtcHMYAiADKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEj4KD21lbW9fdHlwZV9zdGF0cxgDIAEoCzIlLm1lbW9zLmFwaS52MS5Vc2VyU3RhdHMuTWVtb1R5cGVTdGF0cxI4Cgl0YWdfY291bnQYBCADKAsyJS5tZW1vcy5hcGkudjEuVXNlclN0YXRzLlRhZ0NvdW50RW50cnkSFAoMcGlubmVkX21lbW9zGAUgAygJEhgKEHRvdGFsX21lbW9fY291bnQYBiABKAUaLwoNVGFnQ291bnRFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAU6AjgBGl8KDU1lbW9UeXBlU3RhdHMSEgoKbGlua19jb3VudBgBIAEoBRISCgpjb2RlX2NvdW50GAIgASgFEhIKCnRvZG9fY291bnQYAyABKAUSEgoKdW5kb19jb3VudBgEIAEoBTo/6kE8ChZtZW1vcy5hcGkudjEvVXNlclN0YXRzEgx1c2Vycy97dXNlcn0qCXVzZXJTdGF0czIJdXNlclN0YXRzIj4KE0dldFVzZXJTdGF0c1JlcXVlc3QSJwoEbmFtZRgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvVXNlciIZChdMaXN0QWxsVXNlclN0YXRzUmVxdWVzdCJCChhMaXN0QWxsVXNlclN0YXRzUmVzcG9uc2USJgoFc3RhdHMYASADKAsyFy5tZW1vcy5hcGkudjEuVXNlclN0YXRzIqUGCgtVc2VyU2V0dGluZxIRCgRuYW1lGAEgASgJQgPgQQgSQwoPZ2VuZXJhbF9zZXR0aW5nGAIgASgLMigubWVtb3MuYXBpLnYxLlVzZXJTZXR0aW5nLkdlbmVyYWxTZXR0aW5nSAASRQoQc2Vzc2lvbnNfc2V0dGluZxgDIAEoCzIpLm1lbW9zLmFwaS52MS5Vc2VyU2V0dGluZy5TZXNzaW9uc1NldHRpbmdIABJOChVhY2Nlc3NfdG9rZW5zX3NldHRpbmcYBCABKAsyLS5tZW1vcy5hcGkudjEuVXNlclNldHRpbmcuQWNjZXNzVG9rZW5zU2V0dGluZ0gAEkUKEHdlYmhvb2tzX3NldHRpbmcYBSABKAsyKS5tZW1vcy5hcGkudjEuVXNlclNldHRpbmcuV2ViaG9va3NTZXR0aW5nSAAaVwoOR2VuZXJhbFNldHRpbmcSEwoGbG9jYWxlGAEgASgJQgPgQQESHAoPbWVtb192aXNpYmlsaXR5GAMgASgJQgPgQQESEgoFdGhlbWUYBCABKAlCA+BBARo+Cg9TZXNzaW9uc1NldHRpbmcSKwoIc2Vzc2lvbnMYASADKAsyGS5tZW1vcy5hcGkudjEuVXNlclNlc3Npb24aSwoTQWNjZXNzVG9rZW5zU2V0dGluZxI0Cg1hY2Nlc3NfdG9rZW5zGAEgAygLMh0ubWVtb3MuYXBpLnYxLlVzZXJBY2Nlc3NUb2tlbho+Cg9XZWJob29rc1NldHRpbmcSKwoId2ViaG9va3MYASADKAsyGS5tZW1vcy5hcGkudjEuVXNlcldlYmhvb2siVgoDS2V5EhMKD0tFWV9VTlNQRUNJRklFRBAAEgsKB0dFTkVSQUwQARIMCghTRVNTSU9OUxACEhEKDUFDQ0VTU19UT0tFTlMQAxIMCghXRUJIT09LUxAEOlnqQVYKGG1lbW9zLmFwaS52MS9Vc2VyU2V0dGluZxIfdXNlcnMve3VzZXJ9L3NldHRpbmdzL3tzZXR0aW5nfSoMdXNlclNldHRpbmdzMgt1c2VyU2V0dGluZ0IHCgV2YWx1ZSJHChVHZXRVc2VyU2V0dGluZ1JlcXVlc3QSLgoEbmFtZRgBIAEoCUIg4EEC+kEaChhtZW1vcy5hcGkudjEvVXNlclNldHRpbmcigQEKGFVwZGF0ZVVzZXJTZXR0aW5nUmVxdWVzdBIvCgdzZXR0aW5nGAEgASgLMhkubWVtb3MuYXBpLnYxLlVzZXJTZXR0aW5nQgPgQQISNAoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQIidQoXTGlzdFVzZXJTZXR0aW5nc1JlcXVlc3QSKQoGcGFyZW50GAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9Vc2VyEhYKCXBhZ2Vfc2l6ZRgCIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAyABKAlCA+BBASJ0ChhMaXN0VXNlclNldHRpbmdzUmVzcG9uc2USKwoIc2V0dGluZ3MYASADKAsyGS5tZW1vcy5hcGkudjEuVXNlclNldHRpbmcSFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJEhIKCnRvdGFsX3NpemUYAyABKAUisgIKD1VzZXJBY2Nlc3NUb2tlbhIRCgRuYW1lGAEgASgJQgPgQQgSGQoMYWNjZXNzX3Rva2VuGAIgASgJQgPgQQMSGAoLZGVzY3JpcHRpb24YAyABKAlCA+BBARIyCglpc3N1ZWRfYXQYBCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQMSMwoKZXhwaXJlc19hdBgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBATpu6kFrChxtZW1vcy5hcGkudjEvVXNlckFjY2Vzc1Rva2VuEih1c2Vycy97dXNlcn0vYWNjZXNzVG9rZW5zL3thY2Nlc3NfdG9rZW59KhB1c2VyQWNjZXNzVG9rZW5zMg91c2VyQWNjZXNzVG9rZW4ieQobTGlzdFVzZXJBY2Nlc3NUb2tlbnNSZXF1ZXN0EikKBnBhcmVudBgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvVXNlchIWCglwYWdlX3NpemUYAiABKAVCA+BBARIXCgpwYWdlX3Rva2VuGAMgASgJQgPgQQEigQEKHExpc3RVc2VyQWNjZXNzVG9rZW5zUmVzcG9uc2USNAoNYWNjZXNzX3Rva2VucxgBIAMoCzIdLm1lbW9zLmFwaS52MS5Vc2VyQWNjZXNzVG9rZW4SFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJEhIKCnRvdGFsX3NpemUYAyABKAUioQEKHENyZWF0ZVVzZXJBY2Nlc3NUb2tlblJlcXVlc3QSKQoGcGFyZW50GAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9Vc2VyEjgKDGFjY2Vzc190b2tlbhgCIAEoCzIdLm1lbW9zLmFwaS52MS5Vc2VyQWNjZXNzVG9rZW5CA+BBAhIcCg9hY2Nlc3NfdG9rZW5faWQYAyABKAlCA+BBASJSChxEZWxldGVVc2VyQWNjZXNzVG9rZW5SZXF1ZXN0EjIKBG5hbWUYASABKAlCJOBBAvpBHgocbWVtb3MuYXBpLnYxL1VzZXJBY2Nlc3NUb2tlbiKpAwoLVXNlclNlc3Npb24SEQoEbmFtZRgBIAEoCUID4EEIEhcKCnNlc3Npb25faWQYAiABKAlCA+BBAxI0CgtjcmVhdGVfdGltZRgDIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI7ChJsYXN0X2FjY2Vzc2VkX3RpbWUYBCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQMSPgoLY2xpZW50X2luZm8YBSABKAsyJC5tZW1vcy5hcGkudjEuVXNlclNlc3Npb24uQ2xpZW50SW5mb0ID4EEDGnUKCkNsaWVudEluZm8SEgoKdXNlcl9hZ2VudBgBIAEoCRISCgppcF9hZGRyZXNzGAIgASgJEhgKC2RldmljZV90eXBlGAMgASgJQgPgQQESDwoCb3MYBCABKAlCA+BBARIUCgdicm93c2VyGAUgASgJQgPgQQE6ROpBQQoYbWVtb3MuYXBpLnYxL1VzZXJTZXNzaW9uEh91c2Vycy97dXNlcn0vc2Vzc2lvbnMve3Nlc3Npb259GgRuYW1lIkQKF0xpc3RVc2VyU2Vzc2lvbnNSZXF1ZXN0EikKBnBhcmVudBgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvVXNlciJHChhMaXN0VXNlclNlc3Npb25zUmVzcG9uc2USKwoIc2Vzc2lvbnMYASADKAsyGS5tZW1vcy5hcGkudjEuVXNlclNlc3Npb24iLQoYUmV2b2tlVXNlclNlc3Npb25SZXF1ZXN0EhEKBG5hbWUYASABKAlCA+BBAiKqAQoLVXNlcldlYmhvb2sSDAoEbmFtZRgBIAEoCRILCgN1cmwYAiABKAkSFAoMZGlzcGxheV9uYW1lGAMgASgJEjQKC2NyZWF0ZV90aW1lGAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDEjQKC3VwZGF0ZV90aW1lGAUgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDIi4KF0xpc3RVc2VyV2ViaG9va3NSZXF1ZXN0EhMKBnBhcmVudBgBIAEoCUID4EECIkcKGExpc3RVc2VyV2ViaG9va3NSZXNwb25zZRIrCgh3ZWJob29rcxgBIAMoCzIZLm1lbW9zLmFwaS52MS5Vc2VyV2ViaG9vayJgChhDcmVhdGVVc2VyV2ViaG9va1JlcXVlc3QSEwoGcGFyZW50GAEgASgJQgPgQQISLwoHd2ViaG9vaxgCIAEoCzIZLm1lbW9zLmFwaS52MS5Vc2VyV2ViaG9va0ID4EECInwKGFVwZGF0ZVVzZXJXZWJob29rUmVxdWVzdBIvCgd3ZWJob29rGAEgASgLMhkubWVtb3MuYXBpLnYxLlVzZXJXZWJob29rQgPgQQISLwoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrIi0KGERlbGV0ZVVzZXJXZWJob29rUmVxdWVzdBIRCgRuYW1lGAEgASgJQgPgQQIiigQKEFVzZXJOb3RpZmljYXRpb24SFAoEbmFtZRgBIAEoCUIG4EED4EEIEikKBnNlbmRlchgCIAEoCUIZ4EED+kETChFtZW1vcy5hcGkudjEvVXNlchI6CgZzdGF0dXMYAyABKA4yJS5tZW1vcy5hcGkudjEuVXNlck5vdGlmaWNhdGlvbi5TdGF0dXNCA+BBARI0CgtjcmVhdGVfdGltZRgEIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI2CgR0eXBlGAUgASgOMiMubWVtb3MuYXBpLnYxLlVzZXJOb3RpZmljYXRpb24uVHlwZUID4EEDEh0KC2FjdGl2aXR5X2lkGAYgASgFQgPgQQFIAIgBASI6CgZTdGF0dXMSFgoSU1RBVFVTX1VOU1BFQ0lGSUVEEAASCgoGVU5SRUFEEAESDAoIQVJDSElWRUQQAiIuCgRUeXBlEhQKEFRZUEVfVU5TUEVDSUZJRUQQABIQCgxNRU1PX0NPTU1FTlQQATpw6kFtCh1tZW1vcy5hcGkudjEvVXNlck5vdGlmaWNhdGlvbhIpdXNlcnMve3VzZXJ9L25vdGlmaWNhdGlvbnMve25vdGlmaWNhdGlvbn0aBG5hbWUqDW5vdGlmaWNhdGlvbnMyDG5vdGlmaWNhdGlvbkIOCgxfYWN0aXZpdHlfaWQijwEKHExpc3RVc2VyTm90aWZpY2F0aW9uc1JlcXVlc3QSKQoGcGFyZW50GAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9Vc2VyEhYKCXBhZ2Vfc2l6ZRgCIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAyABKAlCA+BBARITCgZmaWx0ZXIYBCABKAlCA+BBASJvCh1MaXN0VXNlck5vdGlmaWNhdGlvbnNSZXNwb25zZRI1Cg1ub3RpZmljYXRpb25zGAEgAygLMh4ubWVtb3MuYXBpLnYxLlVzZXJOb3RpZmljYXRpb24SFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIpABCh1VcGRhdGVVc2VyTm90aWZpY2F0aW9uUmVxdWVzdBI5Cgxub3RpZmljYXRpb24YASABKAsyHi5tZW1vcy5hcGkudjEuVXNlck5vdGlmaWNhdGlvbkID4EECEjQKC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFza0ID4EECIlQKHURlbGV0ZVVzZXJOb3RpZmljYXRpb25SZXF1ZXN0EjMKBG5hbWUYASABKAlCJeBBAvpBHwodbWVtb3MuYXBpLnYxL1VzZXJOb3RpZmljYXRpb24y/hgKC1VzZXJTZXJ2aWNlEmMKCUxpc3RVc2VycxIeLm1lbW9zLmFwaS52MS5MaXN0VXNlcnNSZXF1ZXN0Gh8ubWVtb3MuYXBpLnYxLkxpc3RVc2Vyc1Jlc3BvbnNlIhWC0+STAg8SDS9hcGkvdjEvdXNlcnMSYgoHR2V0VXNlchIcLm1lbW9zLmFwaS52MS5HZXRVc2VyUmVxdWVzdBoSLm1lbW9zLmFwaS52MS5Vc2VyIiXaQQRuYW1lgtPkkwIYEhYvYXBpL3YxL3tuYW1lPXVzZXJzLyp9EmUKCkNyZWF0ZVVzZXISHy5tZW1vcy5hcGkudjEuQ3JlYXRlVXNlclJlcXVlc3QaEi5tZW1vcy5hcGkudjEuVXNlciIi2kEEdXNlcoLT5JMCFToEdXNlciINL2FwaS92MS91c2VycxJ/CgpVcGRhdGVVc2VyEh8ubWVtb3MuYXBpLnYxLlVwZGF0ZVVzZXJSZXF1ZXN0GhIubWVtb3MuYXBpLnYxLlVzZXIiPNpBEHVzZXIsdXBkYXRlX21hc2uC0+STAiM6BHVzZXIyGy9hcGkvdjEve3VzZXIubmFtZT11c2Vycy8qfRJsCgpEZWxldGVVc2VyEh8ubWVtb3MuYXBpLnYxLkRlbGV0ZVVzZXJSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IiXaQQRuYW1lgtPkkwIYKhYvYXBpL3YxL3tuYW1lPXVzZXJzLyp9En4KEExpc3RBbGxVc2VyU3RhdHMSJS5tZW1vcy5hcGkudjEuTGlzdEFsbFVzZXJTdGF0c1JlcXVlc3QaJi5tZW1vcy5hcGkudjEuTGlzdEFsbFVzZXJTdGF0c1Jlc3BvbnNlIhuC0+STAhUSEy9hcGkvdjEvdXNlcnM6c3RhdHMSegoMR2V0VXNlclN0YXRzEiEubWVtb3MuYXBpLnYxLkdldFVzZXJTdGF0c1JlcXVlc3QaFy5tZW1vcy5hcGkudjEuVXNlclN0YXRzIi7aQQRuYW1lgtPkkwIhEh8vYXBpL3YxL3tuYW1lPXVzZXJzLyp9OmdldFN0YXRzEoIBCg5HZXRVc2VyU2V0dGluZxIjLm1lbW9zLmFwaS52MS5HZXRVc2VyU2V0dGluZ1JlcXVlc3QaGS5tZW1vcy5hcGkudjEuVXNlclNldHRpbmciMNpBBG5hbWWC0+STAiMSIS9hcGkvdjEve25hbWU9dXNlcnMvKi9zZXR0aW5ncy8qfRKoAQoRVXBkYXRlVXNlclNldHRpbmcSJi5tZW1vcy5hcGkudjEuVXBkYXRlVXNlclNldHRpbmdSZXF1ZXN0GhkubWVtb3MuYXBpLnYxLlVzZXJTZXR0aW5nIlDaQRNzZXR0aW5nLHVwZGF0ZV9tYXNrgtPkkwI0OgdzZXR0aW5nMikvYXBpL3YxL3tzZXR0aW5nLm5hbWU9dXNlcnMvKi9zZXR0aW5ncy8qfRKVAQoQTGlzdFVzZXJTZXR0aW5ncxIlLm1lbW9zLmFwaS52MS5MaXN0VXNlclNldHRpbmdzUmVxdWVzdBomLm1lbW9zLmFwaS52MS5MaXN0VXNlclNldHRpbmdzUmVzcG9uc2UiMtpBBnBhcmVudILT5JMCIxIhL2FwaS92MS97cGFyZW50PXVzZXJzLyp9L3NldHRpbmdzEqUBChRMaXN0VXNlckFjY2Vzc1Rva2VucxIpLm1lbW9zLmFwaS52MS5MaXN0VXNlckFjY2Vzc1Rva2Vuc1JlcXVlc3QaKi5tZW1vcy5hcGkudjEuTGlzdFVzZXJBY2Nlc3NUb2tlbnNSZXNwb25zZSI22kEGcGFyZW50gtPkkwInEiUvYXBpL3YxL3twYXJlbnQ9dXNlcnMvKn0vYWNjZXNzVG9rZW5zErUBChVDcmVhdGVVc2VyQWNjZXNzVG9rZW4SKi5tZW1vcy5hcGkudjEuQ3JlYXRlVXNlckFjY2Vzc1Rva2VuUmVxdWVzdBodLm1lbW9zLmFwaS52MS5Vc2VyQWNjZXNzVG9rZW4iUdpBE3BhcmVudCxhY2Nlc3NfdG9rZW6C0+STAjU6DGFjY2Vzc190b2tlbiIlL2FwaS92MS97cGFyZW50PXVzZXJzLyp9L2FjY2Vzc1Rva2VucxKRAQoVRGVsZXRlVXNlckFjY2Vzc1Rva2VuEioubWVtb3MuYXBpLnYxLkRlbGV0ZVVzZXJBY2Nlc3NUb2tlblJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiNNpBBG5hbWWC0+STAicqJS9hcGkvdjEve25hbWU9dXNlcnMvKi9hY2Nlc3NUb2tlbnMvKn0SlQEKEExpc3RVc2VyU2Vzc2lvbnMSJS5tZW1vcy5hcGkudjEuTGlzdFVzZXJTZXNzaW9uc1JlcXVlc3QaJi5tZW1vcy5hcGkudjEuTGlzdFVzZXJTZXNzaW9uc1Jlc3BvbnNlIjLaQQZwYXJlbnSC0+STAiMSIS9hcGkvdjEve3BhcmVudD11c2Vycy8qfS9zZXNzaW9ucxKFAQoRUmV2b2tlVXNlclNlc3Npb24SJi5tZW1vcy5hcGkudjEuUmV2b2tlVXNlclNlc3Npb25SZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IjDaQQRuYW1lgtPkkwIjKiEvYXBpL3YxL3tuYW1lPXVzZXJzLyovc2Vzc2lvbnMvKn0SlQEKEExpc3RVc2VyV2ViaG9va3MSJS5tZW1vcy5hcGkudjEuTGlzdFVzZXJXZWJob29rc1JlcXVlc3QaJi5tZW1vcy5hcGkudjEuTGlzdFVzZXJXZWJob29rc1Jlc3BvbnNlIjLaQQZwYXJlbnSC0+STAiMSIS9hcGkvdjEve3BhcmVudD11c2Vycy8qfS93ZWJob29rcxKbAQoRQ3JlYXRlVXNlcldlYmhvb2sSJi5tZW1vcy5hcGkudjEuQ3JlYXRlVXNlcldlYmhvb2tSZXF1ZXN0GhkubWVtb3MuYXBpLnYxLlVzZXJXZWJob29rIkPaQQ5wYXJlbnQsd2ViaG9va4LT5JMCLDoHd2ViaG9vayIhL2FwaS92MS97cGFyZW50PXVzZXJzLyp9L3dlYmhvb2tzEqgBChFVcGRhdGVVc2VyV2ViaG9vaxImLm1lbW9zLmFwaS52MS5VcGRhdGVVc2VyV2ViaG9va1JlcXVlc3QaGS5tZW1vcy5hcGkudjEuVXNlcldlYmhvb2siUNpBE3dlYmhvb2ssdXBkYXRlX21hc2uC0+STAjQ6B3dlYmhvb2syKS9hcGkvdjEve3dlYmhvb2submFtZT11c2Vycy8qL3dlYmhvb2tzLyp9EoUBChFEZWxldGVVc2VyV2ViaG9vaxImLm1lbW9zLmFwaS52MS5EZWxldGVVc2VyV2ViaG9va1JlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiMNpBBG5hbWWC0+STAiMqIS9hcGkvdjEve25hbWU9dXNlcnMvKi93ZWJob29rcy8qfRKpAQoVTGlzdFVzZXJOb3RpZmljYXRpb25zEioubWVtb3MuYXBpLnYxLkxpc3RVc2VyTm90aWZpY2F0aW9uc1JlcXVlc3QaKy5tZW1vcy5hcGkudjEuTGlzdFVzZXJOb3RpZmljYXRpb25zUmVzcG9uc2UiN9pBBnBhcmVudILT5JMCKBImL2FwaS92MS97cGFyZW50PXVzZXJzLyp9L25vdGlmaWNhdGlvbnMSywEKFlVwZGF0ZVVzZXJOb3RpZmljYXRpb24SKy5tZW1vcy5hcGkudjEuVXBkYXRlVXNlck5vdGlmaWNhdGlvblJlcXVlc3QaHi5tZW1vcy5hcGkudjEuVXNlck5vdGlmaWNhdGlvbiJk2kEYbm90aWZpY2F0aW9uLHVwZGF0ZV9tYXNrgtPkkwJDOgxub3RpZmljYXRpb24yMy9hcGkvdjEve25vdGlmaWNhdGlvbi5uYW1lPXVzZXJzLyovbm90aWZpY2F0aW9ucy8qfRKUAQoWRGVsZXRlVXNlck5vdGlmaWNhdGlvbhIrLm1lbW9zLmFwaS52MS5EZWxldGVVc2VyTm90aWZpY2F0aW9uUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSI12kEEbmFtZYLT5JMCKComL2FwaS92MS97bmFtZT11c2Vycy8qL25vdGlmaWNhdGlvbnMvKn1CqAEKEGNvbS5tZW1vcy5hcGkudjFCEFVzZXJTZXJ2aWNlUHJvdG9QAVowZ2l0aHViLmNvbS91c2VtZW1vcy9tZW1vcy9wcm90by9nZW4vYXBpL3YxO2FwaXYxogIDTUFYqgIMTWVtb3MuQXBpLlYxygIMTWVtb3NcQXBpXFYx4gIYTWVtb3NcQXBpXFYxXEdQQk1ldGFkYXRh6gIOTWVtb3M6OkFwaTo6VjFiBnByb3RvMw", [file_api_v1_common, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp]); + +/** + * @generated from message memos.api.v1.User + */ +export type User = Message<"memos.api.v1.User"> & { + /** + * The resource name of the user. + * Format: users/{user} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * The role of the user. + * + * @generated from field: memos.api.v1.User.Role role = 2; + */ + role: User_Role; + + /** + * Required. The unique username for login. + * + * @generated from field: string username = 3; + */ + username: string; + + /** + * Optional. The email address of the user. + * + * @generated from field: string email = 4; + */ + email: string; + + /** + * Optional. The display name of the user. + * + * @generated from field: string display_name = 5; + */ + displayName: string; + + /** + * Optional. The avatar URL of the user. + * + * @generated from field: string avatar_url = 6; + */ + avatarUrl: string; + + /** + * Optional. The description of the user. + * + * @generated from field: string description = 7; + */ + description: string; + + /** + * Input only. The password for the user. + * + * @generated from field: string password = 8; + */ + password: string; + + /** + * The state of the user. + * + * @generated from field: memos.api.v1.State state = 9; + */ + state: State; + + /** + * Output only. The creation timestamp. + * + * @generated from field: google.protobuf.Timestamp create_time = 10; + */ + createTime?: Timestamp; + + /** + * Output only. The last update timestamp. + * + * @generated from field: google.protobuf.Timestamp update_time = 11; + */ + updateTime?: Timestamp; +}; + +/** + * Describes the message memos.api.v1.User. + * Use `create(UserSchema)` to create a new message. + */ +export const UserSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 0); + +/** + * User role enumeration. + * + * @generated from enum memos.api.v1.User.Role + */ +export enum User_Role { + /** + * Unspecified role. + * + * @generated from enum value: ROLE_UNSPECIFIED = 0; + */ + ROLE_UNSPECIFIED = 0, + + /** + * Host role with full system access. + * + * @generated from enum value: HOST = 1; + */ + HOST = 1, + + /** + * Admin role with administrative privileges. + * + * @generated from enum value: ADMIN = 2; + */ + ADMIN = 2, + + /** + * Regular user role. + * + * @generated from enum value: USER = 3; + */ + USER = 3, +} + +/** + * Describes the enum memos.api.v1.User.Role. + */ +export const User_RoleSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_v1_user_service, 0, 0); + +/** + * @generated from message memos.api.v1.ListUsersRequest + */ +export type ListUsersRequest = Message<"memos.api.v1.ListUsersRequest"> & { + /** + * Optional. The maximum number of users to return. + * The service may return fewer than this value. + * If unspecified, at most 50 users will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * @generated from field: int32 page_size = 1; + */ + pageSize: number; + + /** + * Optional. A page token, received from a previous `ListUsers` call. + * Provide this to retrieve the subsequent page. + * + * @generated from field: string page_token = 2; + */ + pageToken: string; + + /** + * Optional. Filter to apply to the list results. + * Example: "username == 'steven'" + * Supported operators: == + * Supported fields: username + * + * @generated from field: string filter = 3; + */ + filter: string; + + /** + * Optional. If true, show deleted users in the response. + * + * @generated from field: bool show_deleted = 4; + */ + showDeleted: boolean; +}; + +/** + * Describes the message memos.api.v1.ListUsersRequest. + * Use `create(ListUsersRequestSchema)` to create a new message. + */ +export const ListUsersRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 1); + +/** + * @generated from message memos.api.v1.ListUsersResponse + */ +export type ListUsersResponse = Message<"memos.api.v1.ListUsersResponse"> & { + /** + * The list of users. + * + * @generated from field: repeated memos.api.v1.User users = 1; + */ + users: User[]; + + /** + * A token that can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; + + /** + * The total count of users (may be approximate). + * + * @generated from field: int32 total_size = 3; + */ + totalSize: number; +}; + +/** + * Describes the message memos.api.v1.ListUsersResponse. + * Use `create(ListUsersResponseSchema)` to create a new message. + */ +export const ListUsersResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 2); + +/** + * @generated from message memos.api.v1.GetUserRequest + */ +export type GetUserRequest = Message<"memos.api.v1.GetUserRequest"> & { + /** + * Required. The resource name of the user. + * Supports both numeric IDs and username strings: + * - users/{id} (e.g., users/101) + * - users/{username} (e.g., users/steven) + * Format: users/{id_or_username} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Optional. The fields to return in the response. + * If not specified, all fields are returned. + * + * @generated from field: google.protobuf.FieldMask read_mask = 2; + */ + readMask?: FieldMask; +}; + +/** + * Describes the message memos.api.v1.GetUserRequest. + * Use `create(GetUserRequestSchema)` to create a new message. + */ +export const GetUserRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 3); + +/** + * @generated from message memos.api.v1.CreateUserRequest + */ +export type CreateUserRequest = Message<"memos.api.v1.CreateUserRequest"> & { + /** + * Required. The user to create. + * + * @generated from field: memos.api.v1.User user = 1; + */ + user?: User; + + /** + * Optional. The user ID to use for this user. + * If empty, a unique ID will be generated. + * Must match the pattern [a-z0-9-]+ + * + * @generated from field: string user_id = 2; + */ + userId: string; + + /** + * Optional. If set, validate the request but don't actually create the user. + * + * @generated from field: bool validate_only = 3; + */ + validateOnly: boolean; + + /** + * Optional. An idempotency token that can be used to ensure that multiple + * requests to create a user have the same result. + * + * @generated from field: string request_id = 4; + */ + requestId: string; +}; + +/** + * Describes the message memos.api.v1.CreateUserRequest. + * Use `create(CreateUserRequestSchema)` to create a new message. + */ +export const CreateUserRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 4); + +/** + * @generated from message memos.api.v1.UpdateUserRequest + */ +export type UpdateUserRequest = Message<"memos.api.v1.UpdateUserRequest"> & { + /** + * Required. The user to update. + * + * @generated from field: memos.api.v1.User user = 1; + */ + user?: User; + + /** + * Required. The list of fields to update. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask; + + /** + * Optional. If set to true, allows updating sensitive fields. + * + * @generated from field: bool allow_missing = 3; + */ + allowMissing: boolean; +}; + +/** + * Describes the message memos.api.v1.UpdateUserRequest. + * Use `create(UpdateUserRequestSchema)` to create a new message. + */ +export const UpdateUserRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 5); + +/** + * @generated from message memos.api.v1.DeleteUserRequest + */ +export type DeleteUserRequest = Message<"memos.api.v1.DeleteUserRequest"> & { + /** + * Required. The resource name of the user to delete. + * Format: users/{user} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Optional. If set to true, the user will be deleted even if they have associated data. + * + * @generated from field: bool force = 2; + */ + force: boolean; +}; + +/** + * Describes the message memos.api.v1.DeleteUserRequest. + * Use `create(DeleteUserRequestSchema)` to create a new message. + */ +export const DeleteUserRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 6); + +/** + * User statistics messages + * + * @generated from message memos.api.v1.UserStats + */ +export type UserStats = Message<"memos.api.v1.UserStats"> & { + /** + * The resource name of the user whose stats these are. + * Format: users/{user} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * The timestamps when the memos were displayed. + * + * @generated from field: repeated google.protobuf.Timestamp memo_display_timestamps = 2; + */ + memoDisplayTimestamps: Timestamp[]; + + /** + * The stats of memo types. + * + * @generated from field: memos.api.v1.UserStats.MemoTypeStats memo_type_stats = 3; + */ + memoTypeStats?: UserStats_MemoTypeStats; + + /** + * The count of tags. + * + * @generated from field: map tag_count = 4; + */ + tagCount: { [key: string]: number }; + + /** + * The pinned memos of the user. + * + * @generated from field: repeated string pinned_memos = 5; + */ + pinnedMemos: string[]; + + /** + * Total memo count. + * + * @generated from field: int32 total_memo_count = 6; + */ + totalMemoCount: number; +}; + +/** + * Describes the message memos.api.v1.UserStats. + * Use `create(UserStatsSchema)` to create a new message. + */ +export const UserStatsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 7); + +/** + * Memo type statistics. + * + * @generated from message memos.api.v1.UserStats.MemoTypeStats + */ +export type UserStats_MemoTypeStats = Message<"memos.api.v1.UserStats.MemoTypeStats"> & { + /** + * @generated from field: int32 link_count = 1; + */ + linkCount: number; + + /** + * @generated from field: int32 code_count = 2; + */ + codeCount: number; + + /** + * @generated from field: int32 todo_count = 3; + */ + todoCount: number; + + /** + * @generated from field: int32 undo_count = 4; + */ + undoCount: number; +}; + +/** + * Describes the message memos.api.v1.UserStats.MemoTypeStats. + * Use `create(UserStats_MemoTypeStatsSchema)` to create a new message. + */ +export const UserStats_MemoTypeStatsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 7, 0); + +/** + * @generated from message memos.api.v1.GetUserStatsRequest + */ +export type GetUserStatsRequest = Message<"memos.api.v1.GetUserStatsRequest"> & { + /** + * Required. The resource name of the user. + * Format: users/{user} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.GetUserStatsRequest. + * Use `create(GetUserStatsRequestSchema)` to create a new message. + */ +export const GetUserStatsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 8); + +/** + * This endpoint doesn't take any parameters. + * + * @generated from message memos.api.v1.ListAllUserStatsRequest + */ +export type ListAllUserStatsRequest = Message<"memos.api.v1.ListAllUserStatsRequest"> & { +}; + +/** + * Describes the message memos.api.v1.ListAllUserStatsRequest. + * Use `create(ListAllUserStatsRequestSchema)` to create a new message. + */ +export const ListAllUserStatsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 9); + +/** + * @generated from message memos.api.v1.ListAllUserStatsResponse + */ +export type ListAllUserStatsResponse = Message<"memos.api.v1.ListAllUserStatsResponse"> & { + /** + * The list of user statistics. + * + * @generated from field: repeated memos.api.v1.UserStats stats = 1; + */ + stats: UserStats[]; +}; + +/** + * Describes the message memos.api.v1.ListAllUserStatsResponse. + * Use `create(ListAllUserStatsResponseSchema)` to create a new message. + */ +export const ListAllUserStatsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 10); + +/** + * User settings message + * + * @generated from message memos.api.v1.UserSetting + */ +export type UserSetting = Message<"memos.api.v1.UserSetting"> & { + /** + * The name of the user setting. + * Format: users/{user}/settings/{setting}, {setting} is the key for the setting. + * For example, "users/123/settings/GENERAL" for general settings. + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * @generated from oneof memos.api.v1.UserSetting.value + */ + value: { + /** + * @generated from field: memos.api.v1.UserSetting.GeneralSetting general_setting = 2; + */ + value: UserSetting_GeneralSetting; + case: "generalSetting"; + } | { + /** + * @generated from field: memos.api.v1.UserSetting.SessionsSetting sessions_setting = 3; + */ + value: UserSetting_SessionsSetting; + case: "sessionsSetting"; + } | { + /** + * @generated from field: memos.api.v1.UserSetting.AccessTokensSetting access_tokens_setting = 4; + */ + value: UserSetting_AccessTokensSetting; + case: "accessTokensSetting"; + } | { + /** + * @generated from field: memos.api.v1.UserSetting.WebhooksSetting webhooks_setting = 5; + */ + value: UserSetting_WebhooksSetting; + case: "webhooksSetting"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.v1.UserSetting. + * Use `create(UserSettingSchema)` to create a new message. + */ +export const UserSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 11); + +/** + * General user settings configuration. + * + * @generated from message memos.api.v1.UserSetting.GeneralSetting + */ +export type UserSetting_GeneralSetting = Message<"memos.api.v1.UserSetting.GeneralSetting"> & { + /** + * The preferred locale of the user. + * + * @generated from field: string locale = 1; + */ + locale: string; + + /** + * The default visibility of the memo. + * + * @generated from field: string memo_visibility = 3; + */ + memoVisibility: string; + + /** + * The preferred theme of the user. + * This references a CSS file in the web/public/themes/ directory. + * If not set, the default theme will be used. + * + * @generated from field: string theme = 4; + */ + theme: string; +}; + +/** + * Describes the message memos.api.v1.UserSetting.GeneralSetting. + * Use `create(UserSetting_GeneralSettingSchema)` to create a new message. + */ +export const UserSetting_GeneralSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 11, 0); + +/** + * User authentication sessions configuration. + * + * @generated from message memos.api.v1.UserSetting.SessionsSetting + */ +export type UserSetting_SessionsSetting = Message<"memos.api.v1.UserSetting.SessionsSetting"> & { + /** + * List of active user sessions. + * + * @generated from field: repeated memos.api.v1.UserSession sessions = 1; + */ + sessions: UserSession[]; +}; + +/** + * Describes the message memos.api.v1.UserSetting.SessionsSetting. + * Use `create(UserSetting_SessionsSettingSchema)` to create a new message. + */ +export const UserSetting_SessionsSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 11, 1); + +/** + * User access tokens configuration. + * + * @generated from message memos.api.v1.UserSetting.AccessTokensSetting + */ +export type UserSetting_AccessTokensSetting = Message<"memos.api.v1.UserSetting.AccessTokensSetting"> & { + /** + * List of user access tokens. + * + * @generated from field: repeated memos.api.v1.UserAccessToken access_tokens = 1; + */ + accessTokens: UserAccessToken[]; +}; + +/** + * Describes the message memos.api.v1.UserSetting.AccessTokensSetting. + * Use `create(UserSetting_AccessTokensSettingSchema)` to create a new message. + */ +export const UserSetting_AccessTokensSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 11, 2); + +/** + * User webhooks configuration. + * + * @generated from message memos.api.v1.UserSetting.WebhooksSetting + */ +export type UserSetting_WebhooksSetting = Message<"memos.api.v1.UserSetting.WebhooksSetting"> & { + /** + * List of user webhooks. + * + * @generated from field: repeated memos.api.v1.UserWebhook webhooks = 1; + */ + webhooks: UserWebhook[]; +}; + +/** + * Describes the message memos.api.v1.UserSetting.WebhooksSetting. + * Use `create(UserSetting_WebhooksSettingSchema)` to create a new message. + */ +export const UserSetting_WebhooksSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 11, 3); + +/** + * Enumeration of user setting keys. + * + * @generated from enum memos.api.v1.UserSetting.Key + */ +export enum UserSetting_Key { + /** + * @generated from enum value: KEY_UNSPECIFIED = 0; + */ + KEY_UNSPECIFIED = 0, + + /** + * GENERAL is the key for general user settings. + * + * @generated from enum value: GENERAL = 1; + */ + GENERAL = 1, + + /** + * SESSIONS is the key for user authentication sessions. + * + * @generated from enum value: SESSIONS = 2; + */ + SESSIONS = 2, + + /** + * ACCESS_TOKENS is the key for access tokens. + * + * @generated from enum value: ACCESS_TOKENS = 3; + */ + ACCESS_TOKENS = 3, + + /** + * WEBHOOKS is the key for user webhooks. + * + * @generated from enum value: WEBHOOKS = 4; + */ + WEBHOOKS = 4, +} + +/** + * Describes the enum memos.api.v1.UserSetting.Key. + */ +export const UserSetting_KeySchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_v1_user_service, 11, 0); + +/** + * @generated from message memos.api.v1.GetUserSettingRequest + */ +export type GetUserSettingRequest = Message<"memos.api.v1.GetUserSettingRequest"> & { + /** + * Required. The resource name of the user setting. + * Format: users/{user}/settings/{setting} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.GetUserSettingRequest. + * Use `create(GetUserSettingRequestSchema)` to create a new message. + */ +export const GetUserSettingRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 12); + +/** + * @generated from message memos.api.v1.UpdateUserSettingRequest + */ +export type UpdateUserSettingRequest = Message<"memos.api.v1.UpdateUserSettingRequest"> & { + /** + * Required. The user setting to update. + * + * @generated from field: memos.api.v1.UserSetting setting = 1; + */ + setting?: UserSetting; + + /** + * Required. The list of fields to update. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask; +}; + +/** + * Describes the message memos.api.v1.UpdateUserSettingRequest. + * Use `create(UpdateUserSettingRequestSchema)` to create a new message. + */ +export const UpdateUserSettingRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 13); + +/** + * Request message for ListUserSettings method. + * + * @generated from message memos.api.v1.ListUserSettingsRequest + */ +export type ListUserSettingsRequest = Message<"memos.api.v1.ListUserSettingsRequest"> & { + /** + * Required. The parent resource whose settings will be listed. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. The maximum number of settings to return. + * The service may return fewer than this value. + * If unspecified, at most 50 settings will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token, received from a previous `ListUserSettings` call. + * Provide this to retrieve the subsequent page. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.v1.ListUserSettingsRequest. + * Use `create(ListUserSettingsRequestSchema)` to create a new message. + */ +export const ListUserSettingsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 14); + +/** + * Response message for ListUserSettings method. + * + * @generated from message memos.api.v1.ListUserSettingsResponse + */ +export type ListUserSettingsResponse = Message<"memos.api.v1.ListUserSettingsResponse"> & { + /** + * The list of user settings. + * + * @generated from field: repeated memos.api.v1.UserSetting settings = 1; + */ + settings: UserSetting[]; + + /** + * A token that can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; + + /** + * The total count of settings (may be approximate). + * + * @generated from field: int32 total_size = 3; + */ + totalSize: number; +}; + +/** + * Describes the message memos.api.v1.ListUserSettingsResponse. + * Use `create(ListUserSettingsResponseSchema)` to create a new message. + */ +export const ListUserSettingsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 15); + +/** + * User access token message + * + * @generated from message memos.api.v1.UserAccessToken + */ +export type UserAccessToken = Message<"memos.api.v1.UserAccessToken"> & { + /** + * The resource name of the access token. + * Format: users/{user}/accessTokens/{access_token} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Output only. The access token value. + * + * @generated from field: string access_token = 2; + */ + accessToken: string; + + /** + * The description of the access token. + * + * @generated from field: string description = 3; + */ + description: string; + + /** + * Output only. The issued timestamp. + * + * @generated from field: google.protobuf.Timestamp issued_at = 4; + */ + issuedAt?: Timestamp; + + /** + * Optional. The expiration timestamp. + * + * @generated from field: google.protobuf.Timestamp expires_at = 5; + */ + expiresAt?: Timestamp; +}; + +/** + * Describes the message memos.api.v1.UserAccessToken. + * Use `create(UserAccessTokenSchema)` to create a new message. + */ +export const UserAccessTokenSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 16); + +/** + * @generated from message memos.api.v1.ListUserAccessTokensRequest + */ +export type ListUserAccessTokensRequest = Message<"memos.api.v1.ListUserAccessTokensRequest"> & { + /** + * Required. The parent resource whose access tokens will be listed. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. The maximum number of access tokens to return. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token for pagination. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.v1.ListUserAccessTokensRequest. + * Use `create(ListUserAccessTokensRequestSchema)` to create a new message. + */ +export const ListUserAccessTokensRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 17); + +/** + * @generated from message memos.api.v1.ListUserAccessTokensResponse + */ +export type ListUserAccessTokensResponse = Message<"memos.api.v1.ListUserAccessTokensResponse"> & { + /** + * The list of access tokens. + * + * @generated from field: repeated memos.api.v1.UserAccessToken access_tokens = 1; + */ + accessTokens: UserAccessToken[]; + + /** + * A token for the next page of results. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; + + /** + * The total count of access tokens. + * + * @generated from field: int32 total_size = 3; + */ + totalSize: number; +}; + +/** + * Describes the message memos.api.v1.ListUserAccessTokensResponse. + * Use `create(ListUserAccessTokensResponseSchema)` to create a new message. + */ +export const ListUserAccessTokensResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 18); + +/** + * @generated from message memos.api.v1.CreateUserAccessTokenRequest + */ +export type CreateUserAccessTokenRequest = Message<"memos.api.v1.CreateUserAccessTokenRequest"> & { + /** + * Required. The parent resource where this access token will be created. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Required. The access token to create. + * + * @generated from field: memos.api.v1.UserAccessToken access_token = 2; + */ + accessToken?: UserAccessToken; + + /** + * Optional. The access token ID to use. + * + * @generated from field: string access_token_id = 3; + */ + accessTokenId: string; +}; + +/** + * Describes the message memos.api.v1.CreateUserAccessTokenRequest. + * Use `create(CreateUserAccessTokenRequestSchema)` to create a new message. + */ +export const CreateUserAccessTokenRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 19); + +/** + * @generated from message memos.api.v1.DeleteUserAccessTokenRequest + */ +export type DeleteUserAccessTokenRequest = Message<"memos.api.v1.DeleteUserAccessTokenRequest"> & { + /** + * Required. The resource name of the access token to delete. + * Format: users/{user}/accessTokens/{access_token} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.DeleteUserAccessTokenRequest. + * Use `create(DeleteUserAccessTokenRequestSchema)` to create a new message. + */ +export const DeleteUserAccessTokenRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 20); + +/** + * @generated from message memos.api.v1.UserSession + */ +export type UserSession = Message<"memos.api.v1.UserSession"> & { + /** + * The resource name of the session. + * Format: users/{user}/sessions/{session} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * The session ID. + * + * @generated from field: string session_id = 2; + */ + sessionId: string; + + /** + * The timestamp when the session was created. + * + * @generated from field: google.protobuf.Timestamp create_time = 3; + */ + createTime?: Timestamp; + + /** + * The timestamp when the session was last accessed. + * Used for sliding expiration calculation (last_accessed_time + 2 weeks). + * + * @generated from field: google.protobuf.Timestamp last_accessed_time = 4; + */ + lastAccessedTime?: Timestamp; + + /** + * Client information associated with this session. + * + * @generated from field: memos.api.v1.UserSession.ClientInfo client_info = 5; + */ + clientInfo?: UserSession_ClientInfo; +}; + +/** + * Describes the message memos.api.v1.UserSession. + * Use `create(UserSessionSchema)` to create a new message. + */ +export const UserSessionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 21); + +/** + * @generated from message memos.api.v1.UserSession.ClientInfo + */ +export type UserSession_ClientInfo = Message<"memos.api.v1.UserSession.ClientInfo"> & { + /** + * User agent string of the client. + * + * @generated from field: string user_agent = 1; + */ + userAgent: string; + + /** + * IP address of the client. + * + * @generated from field: string ip_address = 2; + */ + ipAddress: string; + + /** + * Optional. Device type (e.g., "mobile", "desktop", "tablet"). + * + * @generated from field: string device_type = 3; + */ + deviceType: string; + + /** + * Optional. Operating system (e.g., "iOS 17.0", "Windows 11"). + * + * @generated from field: string os = 4; + */ + os: string; + + /** + * Optional. Browser name and version (e.g., "Chrome 119.0"). + * + * @generated from field: string browser = 5; + */ + browser: string; +}; + +/** + * Describes the message memos.api.v1.UserSession.ClientInfo. + * Use `create(UserSession_ClientInfoSchema)` to create a new message. + */ +export const UserSession_ClientInfoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 21, 0); + +/** + * @generated from message memos.api.v1.ListUserSessionsRequest + */ +export type ListUserSessionsRequest = Message<"memos.api.v1.ListUserSessionsRequest"> & { + /** + * Required. The resource name of the parent. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; +}; + +/** + * Describes the message memos.api.v1.ListUserSessionsRequest. + * Use `create(ListUserSessionsRequestSchema)` to create a new message. + */ +export const ListUserSessionsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 22); + +/** + * @generated from message memos.api.v1.ListUserSessionsResponse + */ +export type ListUserSessionsResponse = Message<"memos.api.v1.ListUserSessionsResponse"> & { + /** + * The list of user sessions. + * + * @generated from field: repeated memos.api.v1.UserSession sessions = 1; + */ + sessions: UserSession[]; +}; + +/** + * Describes the message memos.api.v1.ListUserSessionsResponse. + * Use `create(ListUserSessionsResponseSchema)` to create a new message. + */ +export const ListUserSessionsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 23); + +/** + * @generated from message memos.api.v1.RevokeUserSessionRequest + */ +export type RevokeUserSessionRequest = Message<"memos.api.v1.RevokeUserSessionRequest"> & { + /** + * The name of the session to revoke. + * Format: users/{user}/sessions/{session} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.RevokeUserSessionRequest. + * Use `create(RevokeUserSessionRequestSchema)` to create a new message. + */ +export const RevokeUserSessionRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 24); + +/** + * UserWebhook represents a webhook owned by a user. + * + * @generated from message memos.api.v1.UserWebhook + */ +export type UserWebhook = Message<"memos.api.v1.UserWebhook"> & { + /** + * The name of the webhook. + * Format: users/{user}/webhooks/{webhook} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * The URL to send the webhook to. + * + * @generated from field: string url = 2; + */ + url: string; + + /** + * Optional. Human-readable name for the webhook. + * + * @generated from field: string display_name = 3; + */ + displayName: string; + + /** + * The creation time of the webhook. + * + * @generated from field: google.protobuf.Timestamp create_time = 4; + */ + createTime?: Timestamp; + + /** + * The last update time of the webhook. + * + * @generated from field: google.protobuf.Timestamp update_time = 5; + */ + updateTime?: Timestamp; +}; + +/** + * Describes the message memos.api.v1.UserWebhook. + * Use `create(UserWebhookSchema)` to create a new message. + */ +export const UserWebhookSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 25); + +/** + * @generated from message memos.api.v1.ListUserWebhooksRequest + */ +export type ListUserWebhooksRequest = Message<"memos.api.v1.ListUserWebhooksRequest"> & { + /** + * The parent user resource. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; +}; + +/** + * Describes the message memos.api.v1.ListUserWebhooksRequest. + * Use `create(ListUserWebhooksRequestSchema)` to create a new message. + */ +export const ListUserWebhooksRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 26); + +/** + * @generated from message memos.api.v1.ListUserWebhooksResponse + */ +export type ListUserWebhooksResponse = Message<"memos.api.v1.ListUserWebhooksResponse"> & { + /** + * The list of webhooks. + * + * @generated from field: repeated memos.api.v1.UserWebhook webhooks = 1; + */ + webhooks: UserWebhook[]; +}; + +/** + * Describes the message memos.api.v1.ListUserWebhooksResponse. + * Use `create(ListUserWebhooksResponseSchema)` to create a new message. + */ +export const ListUserWebhooksResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 27); + +/** + * @generated from message memos.api.v1.CreateUserWebhookRequest + */ +export type CreateUserWebhookRequest = Message<"memos.api.v1.CreateUserWebhookRequest"> & { + /** + * The parent user resource. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * The webhook to create. + * + * @generated from field: memos.api.v1.UserWebhook webhook = 2; + */ + webhook?: UserWebhook; +}; + +/** + * Describes the message memos.api.v1.CreateUserWebhookRequest. + * Use `create(CreateUserWebhookRequestSchema)` to create a new message. + */ +export const CreateUserWebhookRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 28); + +/** + * @generated from message memos.api.v1.UpdateUserWebhookRequest + */ +export type UpdateUserWebhookRequest = Message<"memos.api.v1.UpdateUserWebhookRequest"> & { + /** + * The webhook to update. + * + * @generated from field: memos.api.v1.UserWebhook webhook = 1; + */ + webhook?: UserWebhook; + + /** + * The list of fields to update. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask; +}; + +/** + * Describes the message memos.api.v1.UpdateUserWebhookRequest. + * Use `create(UpdateUserWebhookRequestSchema)` to create a new message. + */ +export const UpdateUserWebhookRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 29); + +/** + * @generated from message memos.api.v1.DeleteUserWebhookRequest + */ +export type DeleteUserWebhookRequest = Message<"memos.api.v1.DeleteUserWebhookRequest"> & { + /** + * The name of the webhook to delete. + * Format: users/{user}/webhooks/{webhook} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.DeleteUserWebhookRequest. + * Use `create(DeleteUserWebhookRequestSchema)` to create a new message. + */ +export const DeleteUserWebhookRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 30); + +/** + * @generated from message memos.api.v1.UserNotification + */ +export type UserNotification = Message<"memos.api.v1.UserNotification"> & { + /** + * The resource name of the notification. + * Format: users/{user}/notifications/{notification} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * The sender of the notification. + * Format: users/{user} + * + * @generated from field: string sender = 2; + */ + sender: string; + + /** + * The status of the notification. + * + * @generated from field: memos.api.v1.UserNotification.Status status = 3; + */ + status: UserNotification_Status; + + /** + * The creation timestamp. + * + * @generated from field: google.protobuf.Timestamp create_time = 4; + */ + createTime?: Timestamp; + + /** + * The type of the notification. + * + * @generated from field: memos.api.v1.UserNotification.Type type = 5; + */ + type: UserNotification_Type; + + /** + * The activity ID associated with this notification. + * + * @generated from field: optional int32 activity_id = 6; + */ + activityId?: number; +}; + +/** + * Describes the message memos.api.v1.UserNotification. + * Use `create(UserNotificationSchema)` to create a new message. + */ +export const UserNotificationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 31); + +/** + * @generated from enum memos.api.v1.UserNotification.Status + */ +export enum UserNotification_Status { + /** + * @generated from enum value: STATUS_UNSPECIFIED = 0; + */ + STATUS_UNSPECIFIED = 0, + + /** + * @generated from enum value: UNREAD = 1; + */ + UNREAD = 1, + + /** + * @generated from enum value: ARCHIVED = 2; + */ + ARCHIVED = 2, +} + +/** + * Describes the enum memos.api.v1.UserNotification.Status. + */ +export const UserNotification_StatusSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_v1_user_service, 31, 0); + +/** + * @generated from enum memos.api.v1.UserNotification.Type + */ +export enum UserNotification_Type { + /** + * @generated from enum value: TYPE_UNSPECIFIED = 0; + */ + TYPE_UNSPECIFIED = 0, + + /** + * @generated from enum value: MEMO_COMMENT = 1; + */ + MEMO_COMMENT = 1, +} + +/** + * Describes the enum memos.api.v1.UserNotification.Type. + */ +export const UserNotification_TypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_v1_user_service, 31, 1); + +/** + * @generated from message memos.api.v1.ListUserNotificationsRequest + */ +export type ListUserNotificationsRequest = Message<"memos.api.v1.ListUserNotificationsRequest"> & { + /** + * The parent user resource. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * @generated from field: string page_token = 3; + */ + pageToken: string; + + /** + * @generated from field: string filter = 4; + */ + filter: string; +}; + +/** + * Describes the message memos.api.v1.ListUserNotificationsRequest. + * Use `create(ListUserNotificationsRequestSchema)` to create a new message. + */ +export const ListUserNotificationsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 32); + +/** + * @generated from message memos.api.v1.ListUserNotificationsResponse + */ +export type ListUserNotificationsResponse = Message<"memos.api.v1.ListUserNotificationsResponse"> & { + /** + * @generated from field: repeated memos.api.v1.UserNotification notifications = 1; + */ + notifications: UserNotification[]; + + /** + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.v1.ListUserNotificationsResponse. + * Use `create(ListUserNotificationsResponseSchema)` to create a new message. + */ +export const ListUserNotificationsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 33); + +/** + * @generated from message memos.api.v1.UpdateUserNotificationRequest + */ +export type UpdateUserNotificationRequest = Message<"memos.api.v1.UpdateUserNotificationRequest"> & { + /** + * @generated from field: memos.api.v1.UserNotification notification = 1; + */ + notification?: UserNotification; + + /** + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask; +}; + +/** + * Describes the message memos.api.v1.UpdateUserNotificationRequest. + * Use `create(UpdateUserNotificationRequestSchema)` to create a new message. + */ +export const UpdateUserNotificationRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 34); + +/** + * @generated from message memos.api.v1.DeleteUserNotificationRequest + */ +export type DeleteUserNotificationRequest = Message<"memos.api.v1.DeleteUserNotificationRequest"> & { + /** + * Format: users/{user}/notifications/{notification} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.v1.DeleteUserNotificationRequest. + * Use `create(DeleteUserNotificationRequestSchema)` to create a new message. + */ +export const DeleteUserNotificationRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_v1_user_service, 35); + +/** + * @generated from service memos.api.v1.UserService + */ +export const UserService: GenService<{ + /** + * ListUsers returns a list of users. + * + * @generated from rpc memos.api.v1.UserService.ListUsers + */ + listUsers: { + methodKind: "unary"; + input: typeof ListUsersRequestSchema; + output: typeof ListUsersResponseSchema; + }, + /** + * GetUser gets a user by ID or username. + * Supports both numeric IDs and username strings: + * - users/{id} (e.g., users/101) + * - users/{username} (e.g., users/steven) + * + * @generated from rpc memos.api.v1.UserService.GetUser + */ + getUser: { + methodKind: "unary"; + input: typeof GetUserRequestSchema; + output: typeof UserSchema; + }, + /** + * CreateUser creates a new user. + * + * @generated from rpc memos.api.v1.UserService.CreateUser + */ + createUser: { + methodKind: "unary"; + input: typeof CreateUserRequestSchema; + output: typeof UserSchema; + }, + /** + * UpdateUser updates a user. + * + * @generated from rpc memos.api.v1.UserService.UpdateUser + */ + updateUser: { + methodKind: "unary"; + input: typeof UpdateUserRequestSchema; + output: typeof UserSchema; + }, + /** + * DeleteUser deletes a user. + * + * @generated from rpc memos.api.v1.UserService.DeleteUser + */ + deleteUser: { + methodKind: "unary"; + input: typeof DeleteUserRequestSchema; + output: typeof EmptySchema; + }, + /** + * ListAllUserStats returns statistics for all users. + * + * @generated from rpc memos.api.v1.UserService.ListAllUserStats + */ + listAllUserStats: { + methodKind: "unary"; + input: typeof ListAllUserStatsRequestSchema; + output: typeof ListAllUserStatsResponseSchema; + }, + /** + * GetUserStats returns statistics for a specific user. + * + * @generated from rpc memos.api.v1.UserService.GetUserStats + */ + getUserStats: { + methodKind: "unary"; + input: typeof GetUserStatsRequestSchema; + output: typeof UserStatsSchema; + }, + /** + * GetUserSetting returns the user setting. + * + * @generated from rpc memos.api.v1.UserService.GetUserSetting + */ + getUserSetting: { + methodKind: "unary"; + input: typeof GetUserSettingRequestSchema; + output: typeof UserSettingSchema; + }, + /** + * UpdateUserSetting updates the user setting. + * + * @generated from rpc memos.api.v1.UserService.UpdateUserSetting + */ + updateUserSetting: { + methodKind: "unary"; + input: typeof UpdateUserSettingRequestSchema; + output: typeof UserSettingSchema; + }, + /** + * ListUserSettings returns a list of user settings. + * + * @generated from rpc memos.api.v1.UserService.ListUserSettings + */ + listUserSettings: { + methodKind: "unary"; + input: typeof ListUserSettingsRequestSchema; + output: typeof ListUserSettingsResponseSchema; + }, + /** + * ListUserAccessTokens returns a list of access tokens for a user. + * + * @generated from rpc memos.api.v1.UserService.ListUserAccessTokens + */ + listUserAccessTokens: { + methodKind: "unary"; + input: typeof ListUserAccessTokensRequestSchema; + output: typeof ListUserAccessTokensResponseSchema; + }, + /** + * CreateUserAccessToken creates a new access token for a user. + * + * @generated from rpc memos.api.v1.UserService.CreateUserAccessToken + */ + createUserAccessToken: { + methodKind: "unary"; + input: typeof CreateUserAccessTokenRequestSchema; + output: typeof UserAccessTokenSchema; + }, + /** + * DeleteUserAccessToken deletes an access token. + * + * @generated from rpc memos.api.v1.UserService.DeleteUserAccessToken + */ + deleteUserAccessToken: { + methodKind: "unary"; + input: typeof DeleteUserAccessTokenRequestSchema; + output: typeof EmptySchema; + }, + /** + * ListUserSessions returns a list of active sessions for a user. + * + * @generated from rpc memos.api.v1.UserService.ListUserSessions + */ + listUserSessions: { + methodKind: "unary"; + input: typeof ListUserSessionsRequestSchema; + output: typeof ListUserSessionsResponseSchema; + }, + /** + * RevokeUserSession revokes a specific session for a user. + * + * @generated from rpc memos.api.v1.UserService.RevokeUserSession + */ + revokeUserSession: { + methodKind: "unary"; + input: typeof RevokeUserSessionRequestSchema; + output: typeof EmptySchema; + }, + /** + * ListUserWebhooks returns a list of webhooks for a user. + * + * @generated from rpc memos.api.v1.UserService.ListUserWebhooks + */ + listUserWebhooks: { + methodKind: "unary"; + input: typeof ListUserWebhooksRequestSchema; + output: typeof ListUserWebhooksResponseSchema; + }, + /** + * CreateUserWebhook creates a new webhook for a user. + * + * @generated from rpc memos.api.v1.UserService.CreateUserWebhook + */ + createUserWebhook: { + methodKind: "unary"; + input: typeof CreateUserWebhookRequestSchema; + output: typeof UserWebhookSchema; + }, + /** + * UpdateUserWebhook updates an existing webhook for a user. + * + * @generated from rpc memos.api.v1.UserService.UpdateUserWebhook + */ + updateUserWebhook: { + methodKind: "unary"; + input: typeof UpdateUserWebhookRequestSchema; + output: typeof UserWebhookSchema; + }, + /** + * DeleteUserWebhook deletes a webhook for a user. + * + * @generated from rpc memos.api.v1.UserService.DeleteUserWebhook + */ + deleteUserWebhook: { + methodKind: "unary"; + input: typeof DeleteUserWebhookRequestSchema; + output: typeof EmptySchema; + }, + /** + * ListUserNotifications lists notifications for a user. + * + * @generated from rpc memos.api.v1.UserService.ListUserNotifications + */ + listUserNotifications: { + methodKind: "unary"; + input: typeof ListUserNotificationsRequestSchema; + output: typeof ListUserNotificationsResponseSchema; + }, + /** + * UpdateUserNotification updates a notification. + * + * @generated from rpc memos.api.v1.UserService.UpdateUserNotification + */ + updateUserNotification: { + methodKind: "unary"; + input: typeof UpdateUserNotificationRequestSchema; + output: typeof UserNotificationSchema; + }, + /** + * DeleteUserNotification deletes a notification. + * + * @generated from rpc memos.api.v1.UserService.DeleteUserNotification + */ + deleteUserNotification: { + methodKind: "unary"; + input: typeof DeleteUserNotificationRequestSchema; + output: typeof EmptySchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_v1_user_service, 0); + diff --git a/web/src/types/proto/google/api/annotations.ts b/web/src/types/proto/google/api/annotations.ts deleted file mode 100644 index 602119967..000000000 --- a/web/src/types/proto/google/api/annotations.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: google/api/annotations.proto - -/* eslint-disable */ - -export const protobufPackage = "google.api"; diff --git a/web/src/types/proto/google/api/annotations_pb.ts b/web/src/types/proto/google/api/annotations_pb.ts new file mode 100644 index 000000000..8e8fbe08d --- /dev/null +++ b/web/src/types/proto/google/api/annotations_pb.ts @@ -0,0 +1,39 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file google/api/annotations.proto (package google.api, syntax proto3) +/* eslint-disable */ + +import type { GenExtension, GenFile } from "@bufbuild/protobuf/codegenv2"; +import { extDesc, fileDesc } from "@bufbuild/protobuf/codegenv2"; +import type { HttpRule } from "./http_pb"; +import { file_google_api_http } from "./http_pb"; +import type { MethodOptions } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_descriptor } from "@bufbuild/protobuf/wkt"; + +/** + * Describes the file google/api/annotations.proto. + */ +export const file_google_api_annotations: GenFile = /*@__PURE__*/ + fileDesc("Chxnb29nbGUvYXBpL2Fubm90YXRpb25zLnByb3RvEgpnb29nbGUuYXBpOksKBGh0dHASHi5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxiwyrwiIAEoCzIULmdvb2dsZS5hcGkuSHR0cFJ1bGVSBGh0dHBCrgEKDmNvbS5nb29nbGUuYXBpQhBBbm5vdGF0aW9uc1Byb3RvUAFaQWdvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL2dvb2dsZWFwaXMvYXBpL2Fubm90YXRpb25zO2Fubm90YXRpb25zogIDR0FYqgIKR29vZ2xlLkFwacoCCkdvb2dsZVxBcGniAhZHb29nbGVcQXBpXEdQQk1ldGFkYXRh6gILR29vZ2xlOjpBcGliBnByb3RvMw", [file_google_api_http, file_google_protobuf_descriptor]); + +/** + * See `HttpRule`. + * + * @generated from extension: google.api.HttpRule http = 72295728; + */ +export const http: GenExtension = /*@__PURE__*/ + extDesc(file_google_api_annotations, 0); + diff --git a/web/src/types/proto/google/api/client.ts b/web/src/types/proto/google/api/client.ts deleted file mode 100644 index a6cd5398c..000000000 --- a/web/src/types/proto/google/api/client.ts +++ /dev/null @@ -1,2087 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: google/api/client.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { Duration } from "../protobuf/duration"; -import { LaunchStage, launchStageFromJSON, launchStageToNumber } from "./launch_stage"; - -export const protobufPackage = "google.api"; - -/** - * The organization for which the client libraries are being published. - * Affects the url where generated docs are published, etc. - */ -export enum ClientLibraryOrganization { - /** CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED - Not useful. */ - CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED", - /** CLOUD - Google Cloud Platform Org. */ - CLOUD = "CLOUD", - /** ADS - Ads (Advertising) Org. */ - ADS = "ADS", - /** PHOTOS - Photos Org. */ - PHOTOS = "PHOTOS", - /** STREET_VIEW - Street View Org. */ - STREET_VIEW = "STREET_VIEW", - /** SHOPPING - Shopping Org. */ - SHOPPING = "SHOPPING", - /** GEO - Geo Org. */ - GEO = "GEO", - /** GENERATIVE_AI - Generative AI - https://developers.generativeai.google */ - GENERATIVE_AI = "GENERATIVE_AI", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function clientLibraryOrganizationFromJSON(object: any): ClientLibraryOrganization { - switch (object) { - case 0: - case "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": - return ClientLibraryOrganization.CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED; - case 1: - case "CLOUD": - return ClientLibraryOrganization.CLOUD; - case 2: - case "ADS": - return ClientLibraryOrganization.ADS; - case 3: - case "PHOTOS": - return ClientLibraryOrganization.PHOTOS; - case 4: - case "STREET_VIEW": - return ClientLibraryOrganization.STREET_VIEW; - case 5: - case "SHOPPING": - return ClientLibraryOrganization.SHOPPING; - case 6: - case "GEO": - return ClientLibraryOrganization.GEO; - case 7: - case "GENERATIVE_AI": - return ClientLibraryOrganization.GENERATIVE_AI; - case -1: - case "UNRECOGNIZED": - default: - return ClientLibraryOrganization.UNRECOGNIZED; - } -} - -export function clientLibraryOrganizationToNumber(object: ClientLibraryOrganization): number { - switch (object) { - case ClientLibraryOrganization.CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED: - return 0; - case ClientLibraryOrganization.CLOUD: - return 1; - case ClientLibraryOrganization.ADS: - return 2; - case ClientLibraryOrganization.PHOTOS: - return 3; - case ClientLibraryOrganization.STREET_VIEW: - return 4; - case ClientLibraryOrganization.SHOPPING: - return 5; - case ClientLibraryOrganization.GEO: - return 6; - case ClientLibraryOrganization.GENERATIVE_AI: - return 7; - case ClientLibraryOrganization.UNRECOGNIZED: - default: - return -1; - } -} - -/** To where should client libraries be published? */ -export enum ClientLibraryDestination { - /** - * CLIENT_LIBRARY_DESTINATION_UNSPECIFIED - Client libraries will neither be generated nor published to package - * managers. - */ - CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED", - /** - * GITHUB - Generate the client library in a repo under github.com/googleapis, - * but don't publish it to package managers. - */ - GITHUB = "GITHUB", - /** PACKAGE_MANAGER - Publish the library to package managers like nuget.org and npmjs.com. */ - PACKAGE_MANAGER = "PACKAGE_MANAGER", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function clientLibraryDestinationFromJSON(object: any): ClientLibraryDestination { - switch (object) { - case 0: - case "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": - return ClientLibraryDestination.CLIENT_LIBRARY_DESTINATION_UNSPECIFIED; - case 10: - case "GITHUB": - return ClientLibraryDestination.GITHUB; - case 20: - case "PACKAGE_MANAGER": - return ClientLibraryDestination.PACKAGE_MANAGER; - case -1: - case "UNRECOGNIZED": - default: - return ClientLibraryDestination.UNRECOGNIZED; - } -} - -export function clientLibraryDestinationToNumber(object: ClientLibraryDestination): number { - switch (object) { - case ClientLibraryDestination.CLIENT_LIBRARY_DESTINATION_UNSPECIFIED: - return 0; - case ClientLibraryDestination.GITHUB: - return 10; - case ClientLibraryDestination.PACKAGE_MANAGER: - return 20; - case ClientLibraryDestination.UNRECOGNIZED: - default: - return -1; - } -} - -/** Required information for every language. */ -export interface CommonLanguageSettings { - /** - * Link to automatically generated reference documentation. Example: - * https://cloud.google.com/nodejs/docs/reference/asset/latest - * - * @deprecated - */ - referenceDocsUri: string; - /** The destination where API teams want this client library to be published. */ - destinations: ClientLibraryDestination[]; - /** Configuration for which RPCs should be generated in the GAPIC client. */ - selectiveGapicGeneration?: SelectiveGapicGeneration | undefined; -} - -/** Details about how and where to publish client libraries. */ -export interface ClientLibrarySettings { - /** - * Version of the API to apply these settings to. This is the full protobuf - * package for the API, ending in the version element. - * Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1". - */ - version: string; - /** Launch stage of this version of the API. */ - launchStage: LaunchStage; - /** - * When using transport=rest, the client request will encode enums as - * numbers rather than strings. - */ - restNumericEnums: boolean; - /** Settings for legacy Java features, supported in the Service YAML. */ - javaSettings?: - | JavaSettings - | undefined; - /** Settings for C++ client libraries. */ - cppSettings?: - | CppSettings - | undefined; - /** Settings for PHP client libraries. */ - phpSettings?: - | PhpSettings - | undefined; - /** Settings for Python client libraries. */ - pythonSettings?: - | PythonSettings - | undefined; - /** Settings for Node client libraries. */ - nodeSettings?: - | NodeSettings - | undefined; - /** Settings for .NET client libraries. */ - dotnetSettings?: - | DotnetSettings - | undefined; - /** Settings for Ruby client libraries. */ - rubySettings?: - | RubySettings - | undefined; - /** Settings for Go client libraries. */ - goSettings?: GoSettings | undefined; -} - -/** - * This message configures the settings for publishing [Google Cloud Client - * libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) - * generated from the service config. - */ -export interface Publishing { - /** - * A list of API method settings, e.g. the behavior for methods that use the - * long-running operation pattern. - */ - methodSettings: MethodSettings[]; - /** - * Link to a *public* URI where users can report issues. Example: - * https://issuetracker.google.com/issues/new?component=190865&template=1161103 - */ - newIssueUri: string; - /** - * Link to product home page. Example: - * https://cloud.google.com/asset-inventory/docs/overview - */ - documentationUri: string; - /** - * Used as a tracking tag when collecting data about the APIs developer - * relations artifacts like docs, packages delivered to package managers, - * etc. Example: "speech". - */ - apiShortName: string; - /** GitHub label to apply to issues and pull requests opened for this API. */ - githubLabel: string; - /** - * GitHub teams to be added to CODEOWNERS in the directory in GitHub - * containing source code for the client libraries for this API. - */ - codeownerGithubTeams: string[]; - /** - * A prefix used in sample code when demarking regions to be included in - * documentation. - */ - docTagPrefix: string; - /** For whom the client library is being published. */ - organization: ClientLibraryOrganization; - /** - * Client library settings. If the same version string appears multiple - * times in this list, then the last one wins. Settings from earlier - * settings with the same version string are discarded. - */ - librarySettings: ClientLibrarySettings[]; - /** - * Optional link to proto reference documentation. Example: - * https://cloud.google.com/pubsub/lite/docs/reference/rpc - */ - protoReferenceDocumentationUri: string; - /** - * Optional link to REST reference documentation. Example: - * https://cloud.google.com/pubsub/lite/docs/reference/rest - */ - restReferenceDocumentationUri: string; -} - -/** Settings for Java client libraries. */ -export interface JavaSettings { - /** - * The package name to use in Java. Clobbers the java_package option - * set in the protobuf. This should be used **only** by APIs - * who have already set the language_settings.java.package_name" field - * in gapic.yaml. API teams should use the protobuf java_package option - * where possible. - * - * Example of a YAML configuration:: - * - * publishing: - * java_settings: - * library_package: com.google.cloud.pubsub.v1 - */ - libraryPackage: string; - /** - * Configure the Java class name to use instead of the service's for its - * corresponding generated GAPIC client. Keys are fully-qualified - * service names as they appear in the protobuf (including the full - * the language_settings.java.interface_names" field in gapic.yaml. API - * teams should otherwise use the service name as it appears in the - * protobuf. - * - * Example of a YAML configuration:: - * - * publishing: - * java_settings: - * service_class_names: - * - google.pubsub.v1.Publisher: TopicAdmin - * - google.pubsub.v1.Subscriber: SubscriptionAdmin - */ - serviceClassNames: { [key: string]: string }; - /** Some settings. */ - common?: CommonLanguageSettings | undefined; -} - -export interface JavaSettings_ServiceClassNamesEntry { - key: string; - value: string; -} - -/** Settings for C++ client libraries. */ -export interface CppSettings { - /** Some settings. */ - common?: CommonLanguageSettings | undefined; -} - -/** Settings for Php client libraries. */ -export interface PhpSettings { - /** Some settings. */ - common?: CommonLanguageSettings | undefined; -} - -/** Settings for Python client libraries. */ -export interface PythonSettings { - /** Some settings. */ - common?: - | CommonLanguageSettings - | undefined; - /** Experimental features to be included during client library generation. */ - experimentalFeatures?: PythonSettings_ExperimentalFeatures | undefined; -} - -/** - * Experimental features to be included during client library generation. - * These fields will be deprecated once the feature graduates and is enabled - * by default. - */ -export interface PythonSettings_ExperimentalFeatures { - /** - * Enables generation of asynchronous REST clients if `rest` transport is - * enabled. By default, asynchronous REST clients will not be generated. - * This feature will be enabled by default 1 month after launching the - * feature in preview packages. - */ - restAsyncIoEnabled: boolean; - /** - * Enables generation of protobuf code using new types that are more - * Pythonic which are included in `protobuf>=5.29.x`. This feature will be - * enabled by default 1 month after launching the feature in preview - * packages. - */ - protobufPythonicTypesEnabled: boolean; - /** - * Disables generation of an unversioned Python package for this client - * library. This means that the module names will need to be versioned in - * import statements. For example `import google.cloud.library_v2` instead - * of `import google.cloud.library`. - */ - unversionedPackageDisabled: boolean; -} - -/** Settings for Node client libraries. */ -export interface NodeSettings { - /** Some settings. */ - common?: CommonLanguageSettings | undefined; -} - -/** Settings for Dotnet client libraries. */ -export interface DotnetSettings { - /** Some settings. */ - common?: - | CommonLanguageSettings - | undefined; - /** - * Map from original service names to renamed versions. - * This is used when the default generated types - * would cause a naming conflict. (Neither name is - * fully-qualified.) - * Example: Subscriber to SubscriberServiceApi. - */ - renamedServices: { [key: string]: string }; - /** - * Map from full resource types to the effective short name - * for the resource. This is used when otherwise resource - * named from different services would cause naming collisions. - * Example entry: - * "datalabeling.googleapis.com/Dataset": "DataLabelingDataset" - */ - renamedResources: { [key: string]: string }; - /** - * List of full resource types to ignore during generation. - * This is typically used for API-specific Location resources, - * which should be handled by the generator as if they were actually - * the common Location resources. - * Example entry: "documentai.googleapis.com/Location" - */ - ignoredResources: string[]; - /** - * Namespaces which must be aliased in snippets due to - * a known (but non-generator-predictable) naming collision - */ - forcedNamespaceAliases: string[]; - /** - * Method signatures (in the form "service.method(signature)") - * which are provided separately, so shouldn't be generated. - * Snippets *calling* these methods are still generated, however. - */ - handwrittenSignatures: string[]; -} - -export interface DotnetSettings_RenamedServicesEntry { - key: string; - value: string; -} - -export interface DotnetSettings_RenamedResourcesEntry { - key: string; - value: string; -} - -/** Settings for Ruby client libraries. */ -export interface RubySettings { - /** Some settings. */ - common?: CommonLanguageSettings | undefined; -} - -/** Settings for Go client libraries. */ -export interface GoSettings { - /** Some settings. */ - common?: - | CommonLanguageSettings - | undefined; - /** - * Map of service names to renamed services. Keys are the package relative - * service names and values are the name to be used for the service client - * and call options. - * - * publishing: - * go_settings: - * renamed_services: - * Publisher: TopicAdmin - */ - renamedServices: { [key: string]: string }; -} - -export interface GoSettings_RenamedServicesEntry { - key: string; - value: string; -} - -/** Describes the generator configuration for a method. */ -export interface MethodSettings { - /** - * The fully qualified name of the method, for which the options below apply. - * This is used to find the method to apply the options. - * - * Example: - * - * publishing: - * method_settings: - * - selector: google.storage.control.v2.StorageControl.CreateFolder - * # method settings for CreateFolder... - */ - selector: string; - /** - * Describes settings to use for long-running operations when generating - * API methods for RPCs. Complements RPCs that use the annotations in - * google/longrunning/operations.proto. - * - * Example of a YAML configuration:: - * - * publishing: - * method_settings: - * - selector: google.cloud.speech.v2.Speech.BatchRecognize - * long_running: - * initial_poll_delay: 60s # 1 minute - * poll_delay_multiplier: 1.5 - * max_poll_delay: 360s # 6 minutes - * total_poll_timeout: 54000s # 90 minutes - */ - longRunning?: - | MethodSettings_LongRunning - | undefined; - /** - * List of top-level fields of the request message, that should be - * automatically populated by the client libraries based on their - * (google.api.field_info).format. Currently supported format: UUID4. - * - * Example of a YAML configuration: - * - * publishing: - * method_settings: - * - selector: google.example.v1.ExampleService.CreateExample - * auto_populated_fields: - * - request_id - */ - autoPopulatedFields: string[]; -} - -/** - * Describes settings to use when generating API methods that use the - * long-running operation pattern. - * All default values below are from those used in the client library - * generators (e.g. - * [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)). - */ -export interface MethodSettings_LongRunning { - /** - * Initial delay after which the first poll request will be made. - * Default value: 5 seconds. - */ - initialPollDelay?: - | Duration - | undefined; - /** - * Multiplier to gradually increase delay between subsequent polls until it - * reaches max_poll_delay. - * Default value: 1.5. - */ - pollDelayMultiplier: number; - /** - * Maximum time between two subsequent poll requests. - * Default value: 45 seconds. - */ - maxPollDelay?: - | Duration - | undefined; - /** - * Total polling timeout. - * Default value: 5 minutes. - */ - totalPollTimeout?: Duration | undefined; -} - -/** - * This message is used to configure the generation of a subset of the RPCs in - * a service for client libraries. - */ -export interface SelectiveGapicGeneration { - /** - * An allowlist of the fully qualified names of RPCs that should be included - * on public client surfaces. - */ - methods: string[]; - /** - * Setting this to true indicates to the client generators that methods - * that would be excluded from the generation should instead be generated - * in a way that indicates these methods should not be consumed by - * end users. How this is expressed is up to individual language - * implementations to decide. Some examples may be: added annotations, - * obfuscated identifiers, or other language idiomatic patterns. - */ - generateOmittedAsInternal: boolean; -} - -function createBaseCommonLanguageSettings(): CommonLanguageSettings { - return { referenceDocsUri: "", destinations: [], selectiveGapicGeneration: undefined }; -} - -export const CommonLanguageSettings: MessageFns = { - encode(message: CommonLanguageSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.referenceDocsUri !== "") { - writer.uint32(10).string(message.referenceDocsUri); - } - writer.uint32(18).fork(); - for (const v of message.destinations) { - writer.int32(clientLibraryDestinationToNumber(v)); - } - writer.join(); - if (message.selectiveGapicGeneration !== undefined) { - SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(26).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CommonLanguageSettings { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCommonLanguageSettings(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.referenceDocsUri = reader.string(); - continue; - } - case 2: { - if (tag === 16) { - message.destinations.push(clientLibraryDestinationFromJSON(reader.int32())); - - continue; - } - - if (tag === 18) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.destinations.push(clientLibraryDestinationFromJSON(reader.int32())); - } - - continue; - } - - break; - } - case 3: { - if (tag !== 26) { - break; - } - - message.selectiveGapicGeneration = SelectiveGapicGeneration.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CommonLanguageSettings { - return CommonLanguageSettings.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CommonLanguageSettings { - const message = createBaseCommonLanguageSettings(); - message.referenceDocsUri = object.referenceDocsUri ?? ""; - message.destinations = object.destinations?.map((e) => e) || []; - message.selectiveGapicGeneration = - (object.selectiveGapicGeneration !== undefined && object.selectiveGapicGeneration !== null) - ? SelectiveGapicGeneration.fromPartial(object.selectiveGapicGeneration) - : undefined; - return message; - }, -}; - -function createBaseClientLibrarySettings(): ClientLibrarySettings { - return { - version: "", - launchStage: LaunchStage.LAUNCH_STAGE_UNSPECIFIED, - restNumericEnums: false, - javaSettings: undefined, - cppSettings: undefined, - phpSettings: undefined, - pythonSettings: undefined, - nodeSettings: undefined, - dotnetSettings: undefined, - rubySettings: undefined, - goSettings: undefined, - }; -} - -export const ClientLibrarySettings: MessageFns = { - encode(message: ClientLibrarySettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.version !== "") { - writer.uint32(10).string(message.version); - } - if (message.launchStage !== LaunchStage.LAUNCH_STAGE_UNSPECIFIED) { - writer.uint32(16).int32(launchStageToNumber(message.launchStage)); - } - if (message.restNumericEnums !== false) { - writer.uint32(24).bool(message.restNumericEnums); - } - if (message.javaSettings !== undefined) { - JavaSettings.encode(message.javaSettings, writer.uint32(170).fork()).join(); - } - if (message.cppSettings !== undefined) { - CppSettings.encode(message.cppSettings, writer.uint32(178).fork()).join(); - } - if (message.phpSettings !== undefined) { - PhpSettings.encode(message.phpSettings, writer.uint32(186).fork()).join(); - } - if (message.pythonSettings !== undefined) { - PythonSettings.encode(message.pythonSettings, writer.uint32(194).fork()).join(); - } - if (message.nodeSettings !== undefined) { - NodeSettings.encode(message.nodeSettings, writer.uint32(202).fork()).join(); - } - if (message.dotnetSettings !== undefined) { - DotnetSettings.encode(message.dotnetSettings, writer.uint32(210).fork()).join(); - } - if (message.rubySettings !== undefined) { - RubySettings.encode(message.rubySettings, writer.uint32(218).fork()).join(); - } - if (message.goSettings !== undefined) { - GoSettings.encode(message.goSettings, writer.uint32(226).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ClientLibrarySettings { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseClientLibrarySettings(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.version = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.launchStage = launchStageFromJSON(reader.int32()); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.restNumericEnums = reader.bool(); - continue; - } - case 21: { - if (tag !== 170) { - break; - } - - message.javaSettings = JavaSettings.decode(reader, reader.uint32()); - continue; - } - case 22: { - if (tag !== 178) { - break; - } - - message.cppSettings = CppSettings.decode(reader, reader.uint32()); - continue; - } - case 23: { - if (tag !== 186) { - break; - } - - message.phpSettings = PhpSettings.decode(reader, reader.uint32()); - continue; - } - case 24: { - if (tag !== 194) { - break; - } - - message.pythonSettings = PythonSettings.decode(reader, reader.uint32()); - continue; - } - case 25: { - if (tag !== 202) { - break; - } - - message.nodeSettings = NodeSettings.decode(reader, reader.uint32()); - continue; - } - case 26: { - if (tag !== 210) { - break; - } - - message.dotnetSettings = DotnetSettings.decode(reader, reader.uint32()); - continue; - } - case 27: { - if (tag !== 218) { - break; - } - - message.rubySettings = RubySettings.decode(reader, reader.uint32()); - continue; - } - case 28: { - if (tag !== 226) { - break; - } - - message.goSettings = GoSettings.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ClientLibrarySettings { - return ClientLibrarySettings.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ClientLibrarySettings { - const message = createBaseClientLibrarySettings(); - message.version = object.version ?? ""; - message.launchStage = object.launchStage ?? LaunchStage.LAUNCH_STAGE_UNSPECIFIED; - message.restNumericEnums = object.restNumericEnums ?? false; - message.javaSettings = (object.javaSettings !== undefined && object.javaSettings !== null) - ? JavaSettings.fromPartial(object.javaSettings) - : undefined; - message.cppSettings = (object.cppSettings !== undefined && object.cppSettings !== null) - ? CppSettings.fromPartial(object.cppSettings) - : undefined; - message.phpSettings = (object.phpSettings !== undefined && object.phpSettings !== null) - ? PhpSettings.fromPartial(object.phpSettings) - : undefined; - message.pythonSettings = (object.pythonSettings !== undefined && object.pythonSettings !== null) - ? PythonSettings.fromPartial(object.pythonSettings) - : undefined; - message.nodeSettings = (object.nodeSettings !== undefined && object.nodeSettings !== null) - ? NodeSettings.fromPartial(object.nodeSettings) - : undefined; - message.dotnetSettings = (object.dotnetSettings !== undefined && object.dotnetSettings !== null) - ? DotnetSettings.fromPartial(object.dotnetSettings) - : undefined; - message.rubySettings = (object.rubySettings !== undefined && object.rubySettings !== null) - ? RubySettings.fromPartial(object.rubySettings) - : undefined; - message.goSettings = (object.goSettings !== undefined && object.goSettings !== null) - ? GoSettings.fromPartial(object.goSettings) - : undefined; - return message; - }, -}; - -function createBasePublishing(): Publishing { - return { - methodSettings: [], - newIssueUri: "", - documentationUri: "", - apiShortName: "", - githubLabel: "", - codeownerGithubTeams: [], - docTagPrefix: "", - organization: ClientLibraryOrganization.CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED, - librarySettings: [], - protoReferenceDocumentationUri: "", - restReferenceDocumentationUri: "", - }; -} - -export const Publishing: MessageFns = { - encode(message: Publishing, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.methodSettings) { - MethodSettings.encode(v!, writer.uint32(18).fork()).join(); - } - if (message.newIssueUri !== "") { - writer.uint32(810).string(message.newIssueUri); - } - if (message.documentationUri !== "") { - writer.uint32(818).string(message.documentationUri); - } - if (message.apiShortName !== "") { - writer.uint32(826).string(message.apiShortName); - } - if (message.githubLabel !== "") { - writer.uint32(834).string(message.githubLabel); - } - for (const v of message.codeownerGithubTeams) { - writer.uint32(842).string(v!); - } - if (message.docTagPrefix !== "") { - writer.uint32(850).string(message.docTagPrefix); - } - if (message.organization !== ClientLibraryOrganization.CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED) { - writer.uint32(856).int32(clientLibraryOrganizationToNumber(message.organization)); - } - for (const v of message.librarySettings) { - ClientLibrarySettings.encode(v!, writer.uint32(874).fork()).join(); - } - if (message.protoReferenceDocumentationUri !== "") { - writer.uint32(882).string(message.protoReferenceDocumentationUri); - } - if (message.restReferenceDocumentationUri !== "") { - writer.uint32(890).string(message.restReferenceDocumentationUri); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Publishing { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePublishing(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 2: { - if (tag !== 18) { - break; - } - - message.methodSettings.push(MethodSettings.decode(reader, reader.uint32())); - continue; - } - case 101: { - if (tag !== 810) { - break; - } - - message.newIssueUri = reader.string(); - continue; - } - case 102: { - if (tag !== 818) { - break; - } - - message.documentationUri = reader.string(); - continue; - } - case 103: { - if (tag !== 826) { - break; - } - - message.apiShortName = reader.string(); - continue; - } - case 104: { - if (tag !== 834) { - break; - } - - message.githubLabel = reader.string(); - continue; - } - case 105: { - if (tag !== 842) { - break; - } - - message.codeownerGithubTeams.push(reader.string()); - continue; - } - case 106: { - if (tag !== 850) { - break; - } - - message.docTagPrefix = reader.string(); - continue; - } - case 107: { - if (tag !== 856) { - break; - } - - message.organization = clientLibraryOrganizationFromJSON(reader.int32()); - continue; - } - case 109: { - if (tag !== 874) { - break; - } - - message.librarySettings.push(ClientLibrarySettings.decode(reader, reader.uint32())); - continue; - } - case 110: { - if (tag !== 882) { - break; - } - - message.protoReferenceDocumentationUri = reader.string(); - continue; - } - case 111: { - if (tag !== 890) { - break; - } - - message.restReferenceDocumentationUri = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): Publishing { - return Publishing.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): Publishing { - const message = createBasePublishing(); - message.methodSettings = object.methodSettings?.map((e) => MethodSettings.fromPartial(e)) || []; - message.newIssueUri = object.newIssueUri ?? ""; - message.documentationUri = object.documentationUri ?? ""; - message.apiShortName = object.apiShortName ?? ""; - message.githubLabel = object.githubLabel ?? ""; - message.codeownerGithubTeams = object.codeownerGithubTeams?.map((e) => e) || []; - message.docTagPrefix = object.docTagPrefix ?? ""; - message.organization = object.organization ?? ClientLibraryOrganization.CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED; - message.librarySettings = object.librarySettings?.map((e) => ClientLibrarySettings.fromPartial(e)) || []; - message.protoReferenceDocumentationUri = object.protoReferenceDocumentationUri ?? ""; - message.restReferenceDocumentationUri = object.restReferenceDocumentationUri ?? ""; - return message; - }, -}; - -function createBaseJavaSettings(): JavaSettings { - return { libraryPackage: "", serviceClassNames: {}, common: undefined }; -} - -export const JavaSettings: MessageFns = { - encode(message: JavaSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.libraryPackage !== "") { - writer.uint32(10).string(message.libraryPackage); - } - Object.entries(message.serviceClassNames).forEach(([key, value]) => { - JavaSettings_ServiceClassNamesEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); - }); - if (message.common !== undefined) { - CommonLanguageSettings.encode(message.common, writer.uint32(26).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): JavaSettings { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseJavaSettings(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.libraryPackage = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - const entry2 = JavaSettings_ServiceClassNamesEntry.decode(reader, reader.uint32()); - if (entry2.value !== undefined) { - message.serviceClassNames[entry2.key] = entry2.value; - } - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.common = CommonLanguageSettings.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): JavaSettings { - return JavaSettings.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): JavaSettings { - const message = createBaseJavaSettings(); - message.libraryPackage = object.libraryPackage ?? ""; - message.serviceClassNames = Object.entries(object.serviceClassNames ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = globalThis.String(value); - } - return acc; - }, - {}, - ); - message.common = (object.common !== undefined && object.common !== null) - ? CommonLanguageSettings.fromPartial(object.common) - : undefined; - return message; - }, -}; - -function createBaseJavaSettings_ServiceClassNamesEntry(): JavaSettings_ServiceClassNamesEntry { - return { key: "", value: "" }; -} - -export const JavaSettings_ServiceClassNamesEntry: MessageFns = { - encode(message: JavaSettings_ServiceClassNamesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): JavaSettings_ServiceClassNamesEntry { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseJavaSettings_ServiceClassNamesEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.key = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): JavaSettings_ServiceClassNamesEntry { - return JavaSettings_ServiceClassNamesEntry.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): JavaSettings_ServiceClassNamesEntry { - const message = createBaseJavaSettings_ServiceClassNamesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseCppSettings(): CppSettings { - return { common: undefined }; -} - -export const CppSettings: MessageFns = { - encode(message: CppSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.common !== undefined) { - CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CppSettings { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCppSettings(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.common = CommonLanguageSettings.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CppSettings { - return CppSettings.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CppSettings { - const message = createBaseCppSettings(); - message.common = (object.common !== undefined && object.common !== null) - ? CommonLanguageSettings.fromPartial(object.common) - : undefined; - return message; - }, -}; - -function createBasePhpSettings(): PhpSettings { - return { common: undefined }; -} - -export const PhpSettings: MessageFns = { - encode(message: PhpSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.common !== undefined) { - CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): PhpSettings { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePhpSettings(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.common = CommonLanguageSettings.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): PhpSettings { - return PhpSettings.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): PhpSettings { - const message = createBasePhpSettings(); - message.common = (object.common !== undefined && object.common !== null) - ? CommonLanguageSettings.fromPartial(object.common) - : undefined; - return message; - }, -}; - -function createBasePythonSettings(): PythonSettings { - return { common: undefined, experimentalFeatures: undefined }; -} - -export const PythonSettings: MessageFns = { - encode(message: PythonSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.common !== undefined) { - CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); - } - if (message.experimentalFeatures !== undefined) { - PythonSettings_ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): PythonSettings { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePythonSettings(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.common = CommonLanguageSettings.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.experimentalFeatures = PythonSettings_ExperimentalFeatures.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): PythonSettings { - return PythonSettings.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): PythonSettings { - const message = createBasePythonSettings(); - message.common = (object.common !== undefined && object.common !== null) - ? CommonLanguageSettings.fromPartial(object.common) - : undefined; - message.experimentalFeatures = (object.experimentalFeatures !== undefined && object.experimentalFeatures !== null) - ? PythonSettings_ExperimentalFeatures.fromPartial(object.experimentalFeatures) - : undefined; - return message; - }, -}; - -function createBasePythonSettings_ExperimentalFeatures(): PythonSettings_ExperimentalFeatures { - return { restAsyncIoEnabled: false, protobufPythonicTypesEnabled: false, unversionedPackageDisabled: false }; -} - -export const PythonSettings_ExperimentalFeatures: MessageFns = { - encode(message: PythonSettings_ExperimentalFeatures, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.restAsyncIoEnabled !== false) { - writer.uint32(8).bool(message.restAsyncIoEnabled); - } - if (message.protobufPythonicTypesEnabled !== false) { - writer.uint32(16).bool(message.protobufPythonicTypesEnabled); - } - if (message.unversionedPackageDisabled !== false) { - writer.uint32(24).bool(message.unversionedPackageDisabled); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): PythonSettings_ExperimentalFeatures { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePythonSettings_ExperimentalFeatures(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.restAsyncIoEnabled = reader.bool(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.protobufPythonicTypesEnabled = reader.bool(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.unversionedPackageDisabled = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): PythonSettings_ExperimentalFeatures { - return PythonSettings_ExperimentalFeatures.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): PythonSettings_ExperimentalFeatures { - const message = createBasePythonSettings_ExperimentalFeatures(); - message.restAsyncIoEnabled = object.restAsyncIoEnabled ?? false; - message.protobufPythonicTypesEnabled = object.protobufPythonicTypesEnabled ?? false; - message.unversionedPackageDisabled = object.unversionedPackageDisabled ?? false; - return message; - }, -}; - -function createBaseNodeSettings(): NodeSettings { - return { common: undefined }; -} - -export const NodeSettings: MessageFns = { - encode(message: NodeSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.common !== undefined) { - CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): NodeSettings { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNodeSettings(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.common = CommonLanguageSettings.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): NodeSettings { - return NodeSettings.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): NodeSettings { - const message = createBaseNodeSettings(); - message.common = (object.common !== undefined && object.common !== null) - ? CommonLanguageSettings.fromPartial(object.common) - : undefined; - return message; - }, -}; - -function createBaseDotnetSettings(): DotnetSettings { - return { - common: undefined, - renamedServices: {}, - renamedResources: {}, - ignoredResources: [], - forcedNamespaceAliases: [], - handwrittenSignatures: [], - }; -} - -export const DotnetSettings: MessageFns = { - encode(message: DotnetSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.common !== undefined) { - CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); - } - Object.entries(message.renamedServices).forEach(([key, value]) => { - DotnetSettings_RenamedServicesEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); - }); - Object.entries(message.renamedResources).forEach(([key, value]) => { - DotnetSettings_RenamedResourcesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); - }); - for (const v of message.ignoredResources) { - writer.uint32(34).string(v!); - } - for (const v of message.forcedNamespaceAliases) { - writer.uint32(42).string(v!); - } - for (const v of message.handwrittenSignatures) { - writer.uint32(50).string(v!); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DotnetSettings { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDotnetSettings(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.common = CommonLanguageSettings.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - const entry2 = DotnetSettings_RenamedServicesEntry.decode(reader, reader.uint32()); - if (entry2.value !== undefined) { - message.renamedServices[entry2.key] = entry2.value; - } - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - const entry3 = DotnetSettings_RenamedResourcesEntry.decode(reader, reader.uint32()); - if (entry3.value !== undefined) { - message.renamedResources[entry3.key] = entry3.value; - } - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.ignoredResources.push(reader.string()); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.forcedNamespaceAliases.push(reader.string()); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.handwrittenSignatures.push(reader.string()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DotnetSettings { - return DotnetSettings.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DotnetSettings { - const message = createBaseDotnetSettings(); - message.common = (object.common !== undefined && object.common !== null) - ? CommonLanguageSettings.fromPartial(object.common) - : undefined; - message.renamedServices = Object.entries(object.renamedServices ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = globalThis.String(value); - } - return acc; - }, - {}, - ); - message.renamedResources = Object.entries(object.renamedResources ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = globalThis.String(value); - } - return acc; - }, - {}, - ); - message.ignoredResources = object.ignoredResources?.map((e) => e) || []; - message.forcedNamespaceAliases = object.forcedNamespaceAliases?.map((e) => e) || []; - message.handwrittenSignatures = object.handwrittenSignatures?.map((e) => e) || []; - return message; - }, -}; - -function createBaseDotnetSettings_RenamedServicesEntry(): DotnetSettings_RenamedServicesEntry { - return { key: "", value: "" }; -} - -export const DotnetSettings_RenamedServicesEntry: MessageFns = { - encode(message: DotnetSettings_RenamedServicesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DotnetSettings_RenamedServicesEntry { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDotnetSettings_RenamedServicesEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.key = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DotnetSettings_RenamedServicesEntry { - return DotnetSettings_RenamedServicesEntry.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DotnetSettings_RenamedServicesEntry { - const message = createBaseDotnetSettings_RenamedServicesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseDotnetSettings_RenamedResourcesEntry(): DotnetSettings_RenamedResourcesEntry { - return { key: "", value: "" }; -} - -export const DotnetSettings_RenamedResourcesEntry: MessageFns = { - encode(message: DotnetSettings_RenamedResourcesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DotnetSettings_RenamedResourcesEntry { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDotnetSettings_RenamedResourcesEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.key = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DotnetSettings_RenamedResourcesEntry { - return DotnetSettings_RenamedResourcesEntry.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DotnetSettings_RenamedResourcesEntry { - const message = createBaseDotnetSettings_RenamedResourcesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseRubySettings(): RubySettings { - return { common: undefined }; -} - -export const RubySettings: MessageFns = { - encode(message: RubySettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.common !== undefined) { - CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): RubySettings { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRubySettings(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.common = CommonLanguageSettings.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): RubySettings { - return RubySettings.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): RubySettings { - const message = createBaseRubySettings(); - message.common = (object.common !== undefined && object.common !== null) - ? CommonLanguageSettings.fromPartial(object.common) - : undefined; - return message; - }, -}; - -function createBaseGoSettings(): GoSettings { - return { common: undefined, renamedServices: {} }; -} - -export const GoSettings: MessageFns = { - encode(message: GoSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.common !== undefined) { - CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); - } - Object.entries(message.renamedServices).forEach(([key, value]) => { - GoSettings_RenamedServicesEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); - }); - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GoSettings { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGoSettings(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.common = CommonLanguageSettings.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - const entry2 = GoSettings_RenamedServicesEntry.decode(reader, reader.uint32()); - if (entry2.value !== undefined) { - message.renamedServices[entry2.key] = entry2.value; - } - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GoSettings { - return GoSettings.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GoSettings { - const message = createBaseGoSettings(); - message.common = (object.common !== undefined && object.common !== null) - ? CommonLanguageSettings.fromPartial(object.common) - : undefined; - message.renamedServices = Object.entries(object.renamedServices ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = globalThis.String(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseGoSettings_RenamedServicesEntry(): GoSettings_RenamedServicesEntry { - return { key: "", value: "" }; -} - -export const GoSettings_RenamedServicesEntry: MessageFns = { - encode(message: GoSettings_RenamedServicesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GoSettings_RenamedServicesEntry { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGoSettings_RenamedServicesEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.key = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GoSettings_RenamedServicesEntry { - return GoSettings_RenamedServicesEntry.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GoSettings_RenamedServicesEntry { - const message = createBaseGoSettings_RenamedServicesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseMethodSettings(): MethodSettings { - return { selector: "", longRunning: undefined, autoPopulatedFields: [] }; -} - -export const MethodSettings: MessageFns = { - encode(message: MethodSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.selector !== "") { - writer.uint32(10).string(message.selector); - } - if (message.longRunning !== undefined) { - MethodSettings_LongRunning.encode(message.longRunning, writer.uint32(18).fork()).join(); - } - for (const v of message.autoPopulatedFields) { - writer.uint32(26).string(v!); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): MethodSettings { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMethodSettings(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.selector = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.longRunning = MethodSettings_LongRunning.decode(reader, reader.uint32()); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.autoPopulatedFields.push(reader.string()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): MethodSettings { - return MethodSettings.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): MethodSettings { - const message = createBaseMethodSettings(); - message.selector = object.selector ?? ""; - message.longRunning = (object.longRunning !== undefined && object.longRunning !== null) - ? MethodSettings_LongRunning.fromPartial(object.longRunning) - : undefined; - message.autoPopulatedFields = object.autoPopulatedFields?.map((e) => e) || []; - return message; - }, -}; - -function createBaseMethodSettings_LongRunning(): MethodSettings_LongRunning { - return { initialPollDelay: undefined, pollDelayMultiplier: 0, maxPollDelay: undefined, totalPollTimeout: undefined }; -} - -export const MethodSettings_LongRunning: MessageFns = { - encode(message: MethodSettings_LongRunning, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.initialPollDelay !== undefined) { - Duration.encode(message.initialPollDelay, writer.uint32(10).fork()).join(); - } - if (message.pollDelayMultiplier !== 0) { - writer.uint32(21).float(message.pollDelayMultiplier); - } - if (message.maxPollDelay !== undefined) { - Duration.encode(message.maxPollDelay, writer.uint32(26).fork()).join(); - } - if (message.totalPollTimeout !== undefined) { - Duration.encode(message.totalPollTimeout, writer.uint32(34).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): MethodSettings_LongRunning { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMethodSettings_LongRunning(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.initialPollDelay = Duration.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 21) { - break; - } - - message.pollDelayMultiplier = reader.float(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.maxPollDelay = Duration.decode(reader, reader.uint32()); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.totalPollTimeout = Duration.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): MethodSettings_LongRunning { - return MethodSettings_LongRunning.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): MethodSettings_LongRunning { - const message = createBaseMethodSettings_LongRunning(); - message.initialPollDelay = (object.initialPollDelay !== undefined && object.initialPollDelay !== null) - ? Duration.fromPartial(object.initialPollDelay) - : undefined; - message.pollDelayMultiplier = object.pollDelayMultiplier ?? 0; - message.maxPollDelay = (object.maxPollDelay !== undefined && object.maxPollDelay !== null) - ? Duration.fromPartial(object.maxPollDelay) - : undefined; - message.totalPollTimeout = (object.totalPollTimeout !== undefined && object.totalPollTimeout !== null) - ? Duration.fromPartial(object.totalPollTimeout) - : undefined; - return message; - }, -}; - -function createBaseSelectiveGapicGeneration(): SelectiveGapicGeneration { - return { methods: [], generateOmittedAsInternal: false }; -} - -export const SelectiveGapicGeneration: MessageFns = { - encode(message: SelectiveGapicGeneration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.methods) { - writer.uint32(10).string(v!); - } - if (message.generateOmittedAsInternal !== false) { - writer.uint32(16).bool(message.generateOmittedAsInternal); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): SelectiveGapicGeneration { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSelectiveGapicGeneration(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.methods.push(reader.string()); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.generateOmittedAsInternal = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): SelectiveGapicGeneration { - return SelectiveGapicGeneration.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): SelectiveGapicGeneration { - const message = createBaseSelectiveGapicGeneration(); - message.methods = object.methods?.map((e) => e) || []; - message.generateOmittedAsInternal = object.generateOmittedAsInternal ?? false; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/google/api/client_pb.ts b/web/src/types/proto/google/api/client_pb.ts new file mode 100644 index 000000000..8a1aa0a94 --- /dev/null +++ b/web/src/types/proto/google/api/client_pb.ts @@ -0,0 +1,953 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file google/api/client.proto (package google.api, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenExtension, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, extDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import type { LaunchStage } from "./launch_stage_pb"; +import { file_google_api_launch_stage } from "./launch_stage_pb"; +import type { Duration, MethodOptions, ServiceOptions } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_descriptor, file_google_protobuf_duration } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file google/api/client.proto. + */ +export const file_google_api_client: GenFile = /*@__PURE__*/ + fileDesc("Chdnb29nbGUvYXBpL2NsaWVudC5wcm90bxIKZ29vZ2xlLmFwaSK+AQoWQ29tbW9uTGFuZ3VhZ2VTZXR0aW5ncxIeChJyZWZlcmVuY2VfZG9jc191cmkYASABKAlCAhgBEjoKDGRlc3RpbmF0aW9ucxgCIAMoDjIkLmdvb2dsZS5hcGkuQ2xpZW50TGlicmFyeURlc3RpbmF0aW9uEkgKGnNlbGVjdGl2ZV9nYXBpY19nZW5lcmF0aW9uGAMgASgLMiQuZ29vZ2xlLmFwaS5TZWxlY3RpdmVHYXBpY0dlbmVyYXRpb24i+wMKFUNsaWVudExpYnJhcnlTZXR0aW5ncxIPCgd2ZXJzaW9uGAEgASgJEi0KDGxhdW5jaF9zdGFnZRgCIAEoDjIXLmdvb2dsZS5hcGkuTGF1bmNoU3RhZ2USGgoScmVzdF9udW1lcmljX2VudW1zGAMgASgIEi8KDWphdmFfc2V0dGluZ3MYFSABKAsyGC5nb29nbGUuYXBpLkphdmFTZXR0aW5ncxItCgxjcHBfc2V0dGluZ3MYFiABKAsyFy5nb29nbGUuYXBpLkNwcFNldHRpbmdzEi0KDHBocF9zZXR0aW5ncxgXIAEoCzIXLmdvb2dsZS5hcGkuUGhwU2V0dGluZ3MSMwoPcHl0aG9uX3NldHRpbmdzGBggASgLMhouZ29vZ2xlLmFwaS5QeXRob25TZXR0aW5ncxIvCg1ub2RlX3NldHRpbmdzGBkgASgLMhguZ29vZ2xlLmFwaS5Ob2RlU2V0dGluZ3MSMwoPZG90bmV0X3NldHRpbmdzGBogASgLMhouZ29vZ2xlLmFwaS5Eb3RuZXRTZXR0aW5ncxIvCg1ydWJ5X3NldHRpbmdzGBsgASgLMhguZ29vZ2xlLmFwaS5SdWJ5U2V0dGluZ3MSKwoLZ29fc2V0dGluZ3MYHCABKAsyFi5nb29nbGUuYXBpLkdvU2V0dGluZ3MiqAMKClB1Ymxpc2hpbmcSMwoPbWV0aG9kX3NldHRpbmdzGAIgAygLMhouZ29vZ2xlLmFwaS5NZXRob2RTZXR0aW5ncxIVCg1uZXdfaXNzdWVfdXJpGGUgASgJEhkKEWRvY3VtZW50YXRpb25fdXJpGGYgASgJEhYKDmFwaV9zaG9ydF9uYW1lGGcgASgJEhQKDGdpdGh1Yl9sYWJlbBhoIAEoCRIeChZjb2Rlb3duZXJfZ2l0aHViX3RlYW1zGGkgAygJEhYKDmRvY190YWdfcHJlZml4GGogASgJEjsKDG9yZ2FuaXphdGlvbhhrIAEoDjIlLmdvb2dsZS5hcGkuQ2xpZW50TGlicmFyeU9yZ2FuaXphdGlvbhI7ChBsaWJyYXJ5X3NldHRpbmdzGG0gAygLMiEuZ29vZ2xlLmFwaS5DbGllbnRMaWJyYXJ5U2V0dGluZ3MSKQohcHJvdG9fcmVmZXJlbmNlX2RvY3VtZW50YXRpb25fdXJpGG4gASgJEigKIHJlc3RfcmVmZXJlbmNlX2RvY3VtZW50YXRpb25fdXJpGG8gASgJIuMBCgxKYXZhU2V0dGluZ3MSFwoPbGlicmFyeV9wYWNrYWdlGAEgASgJEkwKE3NlcnZpY2VfY2xhc3NfbmFtZXMYAiADKAsyLy5nb29nbGUuYXBpLkphdmFTZXR0aW5ncy5TZXJ2aWNlQ2xhc3NOYW1lc0VudHJ5EjIKBmNvbW1vbhgDIAEoCzIiLmdvb2dsZS5hcGkuQ29tbW9uTGFuZ3VhZ2VTZXR0aW5ncxo4ChZTZXJ2aWNlQ2xhc3NOYW1lc0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEiQQoLQ3BwU2V0dGluZ3MSMgoGY29tbW9uGAEgASgLMiIuZ29vZ2xlLmFwaS5Db21tb25MYW5ndWFnZVNldHRpbmdzIkEKC1BocFNldHRpbmdzEjIKBmNvbW1vbhgBIAEoCzIiLmdvb2dsZS5hcGkuQ29tbW9uTGFuZ3VhZ2VTZXR0aW5ncyKbAgoOUHl0aG9uU2V0dGluZ3MSMgoGY29tbW9uGAEgASgLMiIuZ29vZ2xlLmFwaS5Db21tb25MYW5ndWFnZVNldHRpbmdzEk4KFWV4cGVyaW1lbnRhbF9mZWF0dXJlcxgCIAEoCzIvLmdvb2dsZS5hcGkuUHl0aG9uU2V0dGluZ3MuRXhwZXJpbWVudGFsRmVhdHVyZXMahAEKFEV4cGVyaW1lbnRhbEZlYXR1cmVzEh0KFXJlc3RfYXN5bmNfaW9fZW5hYmxlZBgBIAEoCBInCh9wcm90b2J1Zl9weXRob25pY190eXBlc19lbmFibGVkGAIgASgIEiQKHHVudmVyc2lvbmVkX3BhY2thZ2VfZGlzYWJsZWQYAyABKAgiQgoMTm9kZVNldHRpbmdzEjIKBmNvbW1vbhgBIAEoCzIiLmdvb2dsZS5hcGkuQ29tbW9uTGFuZ3VhZ2VTZXR0aW5ncyKqAwoORG90bmV0U2V0dGluZ3MSMgoGY29tbW9uGAEgASgLMiIuZ29vZ2xlLmFwaS5Db21tb25MYW5ndWFnZVNldHRpbmdzEkkKEHJlbmFtZWRfc2VydmljZXMYAiADKAsyLy5nb29nbGUuYXBpLkRvdG5ldFNldHRpbmdzLlJlbmFtZWRTZXJ2aWNlc0VudHJ5EksKEXJlbmFtZWRfcmVzb3VyY2VzGAMgAygLMjAuZ29vZ2xlLmFwaS5Eb3RuZXRTZXR0aW5ncy5SZW5hbWVkUmVzb3VyY2VzRW50cnkSGQoRaWdub3JlZF9yZXNvdXJjZXMYBCADKAkSIAoYZm9yY2VkX25hbWVzcGFjZV9hbGlhc2VzGAUgAygJEh4KFmhhbmR3cml0dGVuX3NpZ25hdHVyZXMYBiADKAkaNgoUUmVuYW1lZFNlcnZpY2VzRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ARo3ChVSZW5hbWVkUmVzb3VyY2VzRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ASJCCgxSdWJ5U2V0dGluZ3MSMgoGY29tbW9uGAEgASgLMiIuZ29vZ2xlLmFwaS5Db21tb25MYW5ndWFnZVNldHRpbmdzIr8BCgpHb1NldHRpbmdzEjIKBmNvbW1vbhgBIAEoCzIiLmdvb2dsZS5hcGkuQ29tbW9uTGFuZ3VhZ2VTZXR0aW5ncxJFChByZW5hbWVkX3NlcnZpY2VzGAIgAygLMisuZ29vZ2xlLmFwaS5Hb1NldHRpbmdzLlJlbmFtZWRTZXJ2aWNlc0VudHJ5GjYKFFJlbmFtZWRTZXJ2aWNlc0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEizwIKDk1ldGhvZFNldHRpbmdzEhAKCHNlbGVjdG9yGAEgASgJEjwKDGxvbmdfcnVubmluZxgCIAEoCzImLmdvb2dsZS5hcGkuTWV0aG9kU2V0dGluZ3MuTG9uZ1J1bm5pbmcSHQoVYXV0b19wb3B1bGF0ZWRfZmllbGRzGAMgAygJGs0BCgtMb25nUnVubmluZxI1ChJpbml0aWFsX3BvbGxfZGVsYXkYASABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb24SHQoVcG9sbF9kZWxheV9tdWx0aXBsaWVyGAIgASgCEjEKDm1heF9wb2xsX2RlbGF5GAMgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uEjUKEnRvdGFsX3BvbGxfdGltZW91dBgEIAEoCzIZLmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbiJRChhTZWxlY3RpdmVHYXBpY0dlbmVyYXRpb24SDwoHbWV0aG9kcxgBIAMoCRIkChxnZW5lcmF0ZV9vbWl0dGVkX2FzX2ludGVybmFsGAIgASgIKqMBChlDbGllbnRMaWJyYXJ5T3JnYW5pemF0aW9uEisKJ0NMSUVOVF9MSUJSQVJZX09SR0FOSVpBVElPTl9VTlNQRUNJRklFRBAAEgkKBUNMT1VEEAESBwoDQURTEAISCgoGUEhPVE9TEAMSDwoLU1RSRUVUX1ZJRVcQBBIMCghTSE9QUElORxAFEgcKA0dFTxAGEhEKDUdFTkVSQVRJVkVfQUkQBypnChhDbGllbnRMaWJyYXJ5RGVzdGluYXRpb24SKgomQ0xJRU5UX0xJQlJBUllfREVTVElOQVRJT05fVU5TUEVDSUZJRUQQABIKCgZHSVRIVUIQChITCg9QQUNLQUdFX01BTkFHRVIQFDpKChBtZXRob2Rfc2lnbmF0dXJlEh4uZ29vZ2xlLnByb3RvYnVmLk1ldGhvZE9wdGlvbnMYmwggAygJUg9tZXRob2RTaWduYXR1cmU6QwoMZGVmYXVsdF9ob3N0Eh8uZ29vZ2xlLnByb3RvYnVmLlNlcnZpY2VPcHRpb25zGJkIIAEoCVILZGVmYXVsdEhvc3Q6QwoMb2F1dGhfc2NvcGVzEh8uZ29vZ2xlLnByb3RvYnVmLlNlcnZpY2VPcHRpb25zGJoIIAEoCVILb2F1dGhTY29wZXM6RAoLYXBpX3ZlcnNpb24SHy5nb29nbGUucHJvdG9idWYuU2VydmljZU9wdGlvbnMYwbqr+gEgASgJUgphcGlWZXJzaW9uQqkBCg5jb20uZ29vZ2xlLmFwaUILQ2xpZW50UHJvdG9QAVpBZ29vZ2xlLmdvbGFuZy5vcmcvZ2VucHJvdG8vZ29vZ2xlYXBpcy9hcGkvYW5ub3RhdGlvbnM7YW5ub3RhdGlvbnOiAgNHQViqAgpHb29nbGUuQXBpygIKR29vZ2xlXEFwaeICFkdvb2dsZVxBcGlcR1BCTWV0YWRhdGHqAgtHb29nbGU6OkFwaWIGcHJvdG8z", [file_google_api_launch_stage, file_google_protobuf_descriptor, file_google_protobuf_duration]); + +/** + * Required information for every language. + * + * @generated from message google.api.CommonLanguageSettings + */ +export type CommonLanguageSettings = Message<"google.api.CommonLanguageSettings"> & { + /** + * Link to automatically generated reference documentation. Example: + * https://cloud.google.com/nodejs/docs/reference/asset/latest + * + * @generated from field: string reference_docs_uri = 1 [deprecated = true]; + * @deprecated + */ + referenceDocsUri: string; + + /** + * The destination where API teams want this client library to be published. + * + * @generated from field: repeated google.api.ClientLibraryDestination destinations = 2; + */ + destinations: ClientLibraryDestination[]; + + /** + * Configuration for which RPCs should be generated in the GAPIC client. + * + * @generated from field: google.api.SelectiveGapicGeneration selective_gapic_generation = 3; + */ + selectiveGapicGeneration?: SelectiveGapicGeneration; +}; + +/** + * Describes the message google.api.CommonLanguageSettings. + * Use `create(CommonLanguageSettingsSchema)` to create a new message. + */ +export const CommonLanguageSettingsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 0); + +/** + * Details about how and where to publish client libraries. + * + * @generated from message google.api.ClientLibrarySettings + */ +export type ClientLibrarySettings = Message<"google.api.ClientLibrarySettings"> & { + /** + * Version of the API to apply these settings to. This is the full protobuf + * package for the API, ending in the version element. + * Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1". + * + * @generated from field: string version = 1; + */ + version: string; + + /** + * Launch stage of this version of the API. + * + * @generated from field: google.api.LaunchStage launch_stage = 2; + */ + launchStage: LaunchStage; + + /** + * When using transport=rest, the client request will encode enums as + * numbers rather than strings. + * + * @generated from field: bool rest_numeric_enums = 3; + */ + restNumericEnums: boolean; + + /** + * Settings for legacy Java features, supported in the Service YAML. + * + * @generated from field: google.api.JavaSettings java_settings = 21; + */ + javaSettings?: JavaSettings; + + /** + * Settings for C++ client libraries. + * + * @generated from field: google.api.CppSettings cpp_settings = 22; + */ + cppSettings?: CppSettings; + + /** + * Settings for PHP client libraries. + * + * @generated from field: google.api.PhpSettings php_settings = 23; + */ + phpSettings?: PhpSettings; + + /** + * Settings for Python client libraries. + * + * @generated from field: google.api.PythonSettings python_settings = 24; + */ + pythonSettings?: PythonSettings; + + /** + * Settings for Node client libraries. + * + * @generated from field: google.api.NodeSettings node_settings = 25; + */ + nodeSettings?: NodeSettings; + + /** + * Settings for .NET client libraries. + * + * @generated from field: google.api.DotnetSettings dotnet_settings = 26; + */ + dotnetSettings?: DotnetSettings; + + /** + * Settings for Ruby client libraries. + * + * @generated from field: google.api.RubySettings ruby_settings = 27; + */ + rubySettings?: RubySettings; + + /** + * Settings for Go client libraries. + * + * @generated from field: google.api.GoSettings go_settings = 28; + */ + goSettings?: GoSettings; +}; + +/** + * Describes the message google.api.ClientLibrarySettings. + * Use `create(ClientLibrarySettingsSchema)` to create a new message. + */ +export const ClientLibrarySettingsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 1); + +/** + * This message configures the settings for publishing [Google Cloud Client + * libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) + * generated from the service config. + * + * @generated from message google.api.Publishing + */ +export type Publishing = Message<"google.api.Publishing"> & { + /** + * A list of API method settings, e.g. the behavior for methods that use the + * long-running operation pattern. + * + * @generated from field: repeated google.api.MethodSettings method_settings = 2; + */ + methodSettings: MethodSettings[]; + + /** + * Link to a *public* URI where users can report issues. Example: + * https://issuetracker.google.com/issues/new?component=190865&template=1161103 + * + * @generated from field: string new_issue_uri = 101; + */ + newIssueUri: string; + + /** + * Link to product home page. Example: + * https://cloud.google.com/asset-inventory/docs/overview + * + * @generated from field: string documentation_uri = 102; + */ + documentationUri: string; + + /** + * Used as a tracking tag when collecting data about the APIs developer + * relations artifacts like docs, packages delivered to package managers, + * etc. Example: "speech". + * + * @generated from field: string api_short_name = 103; + */ + apiShortName: string; + + /** + * GitHub label to apply to issues and pull requests opened for this API. + * + * @generated from field: string github_label = 104; + */ + githubLabel: string; + + /** + * GitHub teams to be added to CODEOWNERS in the directory in GitHub + * containing source code for the client libraries for this API. + * + * @generated from field: repeated string codeowner_github_teams = 105; + */ + codeownerGithubTeams: string[]; + + /** + * A prefix used in sample code when demarking regions to be included in + * documentation. + * + * @generated from field: string doc_tag_prefix = 106; + */ + docTagPrefix: string; + + /** + * For whom the client library is being published. + * + * @generated from field: google.api.ClientLibraryOrganization organization = 107; + */ + organization: ClientLibraryOrganization; + + /** + * Client library settings. If the same version string appears multiple + * times in this list, then the last one wins. Settings from earlier + * settings with the same version string are discarded. + * + * @generated from field: repeated google.api.ClientLibrarySettings library_settings = 109; + */ + librarySettings: ClientLibrarySettings[]; + + /** + * Optional link to proto reference documentation. Example: + * https://cloud.google.com/pubsub/lite/docs/reference/rpc + * + * @generated from field: string proto_reference_documentation_uri = 110; + */ + protoReferenceDocumentationUri: string; + + /** + * Optional link to REST reference documentation. Example: + * https://cloud.google.com/pubsub/lite/docs/reference/rest + * + * @generated from field: string rest_reference_documentation_uri = 111; + */ + restReferenceDocumentationUri: string; +}; + +/** + * Describes the message google.api.Publishing. + * Use `create(PublishingSchema)` to create a new message. + */ +export const PublishingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 2); + +/** + * Settings for Java client libraries. + * + * @generated from message google.api.JavaSettings + */ +export type JavaSettings = Message<"google.api.JavaSettings"> & { + /** + * The package name to use in Java. Clobbers the java_package option + * set in the protobuf. This should be used **only** by APIs + * who have already set the language_settings.java.package_name" field + * in gapic.yaml. API teams should use the protobuf java_package option + * where possible. + * + * Example of a YAML configuration:: + * + * publishing: + * java_settings: + * library_package: com.google.cloud.pubsub.v1 + * + * @generated from field: string library_package = 1; + */ + libraryPackage: string; + + /** + * Configure the Java class name to use instead of the service's for its + * corresponding generated GAPIC client. Keys are fully-qualified + * service names as they appear in the protobuf (including the full + * the language_settings.java.interface_names" field in gapic.yaml. API + * teams should otherwise use the service name as it appears in the + * protobuf. + * + * Example of a YAML configuration:: + * + * publishing: + * java_settings: + * service_class_names: + * - google.pubsub.v1.Publisher: TopicAdmin + * - google.pubsub.v1.Subscriber: SubscriptionAdmin + * + * @generated from field: map service_class_names = 2; + */ + serviceClassNames: { [key: string]: string }; + + /** + * Some settings. + * + * @generated from field: google.api.CommonLanguageSettings common = 3; + */ + common?: CommonLanguageSettings; +}; + +/** + * Describes the message google.api.JavaSettings. + * Use `create(JavaSettingsSchema)` to create a new message. + */ +export const JavaSettingsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 3); + +/** + * Settings for C++ client libraries. + * + * @generated from message google.api.CppSettings + */ +export type CppSettings = Message<"google.api.CppSettings"> & { + /** + * Some settings. + * + * @generated from field: google.api.CommonLanguageSettings common = 1; + */ + common?: CommonLanguageSettings; +}; + +/** + * Describes the message google.api.CppSettings. + * Use `create(CppSettingsSchema)` to create a new message. + */ +export const CppSettingsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 4); + +/** + * Settings for Php client libraries. + * + * @generated from message google.api.PhpSettings + */ +export type PhpSettings = Message<"google.api.PhpSettings"> & { + /** + * Some settings. + * + * @generated from field: google.api.CommonLanguageSettings common = 1; + */ + common?: CommonLanguageSettings; +}; + +/** + * Describes the message google.api.PhpSettings. + * Use `create(PhpSettingsSchema)` to create a new message. + */ +export const PhpSettingsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 5); + +/** + * Settings for Python client libraries. + * + * @generated from message google.api.PythonSettings + */ +export type PythonSettings = Message<"google.api.PythonSettings"> & { + /** + * Some settings. + * + * @generated from field: google.api.CommonLanguageSettings common = 1; + */ + common?: CommonLanguageSettings; + + /** + * Experimental features to be included during client library generation. + * + * @generated from field: google.api.PythonSettings.ExperimentalFeatures experimental_features = 2; + */ + experimentalFeatures?: PythonSettings_ExperimentalFeatures; +}; + +/** + * Describes the message google.api.PythonSettings. + * Use `create(PythonSettingsSchema)` to create a new message. + */ +export const PythonSettingsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 6); + +/** + * Experimental features to be included during client library generation. + * These fields will be deprecated once the feature graduates and is enabled + * by default. + * + * @generated from message google.api.PythonSettings.ExperimentalFeatures + */ +export type PythonSettings_ExperimentalFeatures = Message<"google.api.PythonSettings.ExperimentalFeatures"> & { + /** + * Enables generation of asynchronous REST clients if `rest` transport is + * enabled. By default, asynchronous REST clients will not be generated. + * This feature will be enabled by default 1 month after launching the + * feature in preview packages. + * + * @generated from field: bool rest_async_io_enabled = 1; + */ + restAsyncIoEnabled: boolean; + + /** + * Enables generation of protobuf code using new types that are more + * Pythonic which are included in `protobuf>=5.29.x`. This feature will be + * enabled by default 1 month after launching the feature in preview + * packages. + * + * @generated from field: bool protobuf_pythonic_types_enabled = 2; + */ + protobufPythonicTypesEnabled: boolean; + + /** + * Disables generation of an unversioned Python package for this client + * library. This means that the module names will need to be versioned in + * import statements. For example `import google.cloud.library_v2` instead + * of `import google.cloud.library`. + * + * @generated from field: bool unversioned_package_disabled = 3; + */ + unversionedPackageDisabled: boolean; +}; + +/** + * Describes the message google.api.PythonSettings.ExperimentalFeatures. + * Use `create(PythonSettings_ExperimentalFeaturesSchema)` to create a new message. + */ +export const PythonSettings_ExperimentalFeaturesSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 6, 0); + +/** + * Settings for Node client libraries. + * + * @generated from message google.api.NodeSettings + */ +export type NodeSettings = Message<"google.api.NodeSettings"> & { + /** + * Some settings. + * + * @generated from field: google.api.CommonLanguageSettings common = 1; + */ + common?: CommonLanguageSettings; +}; + +/** + * Describes the message google.api.NodeSettings. + * Use `create(NodeSettingsSchema)` to create a new message. + */ +export const NodeSettingsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 7); + +/** + * Settings for Dotnet client libraries. + * + * @generated from message google.api.DotnetSettings + */ +export type DotnetSettings = Message<"google.api.DotnetSettings"> & { + /** + * Some settings. + * + * @generated from field: google.api.CommonLanguageSettings common = 1; + */ + common?: CommonLanguageSettings; + + /** + * Map from original service names to renamed versions. + * This is used when the default generated types + * would cause a naming conflict. (Neither name is + * fully-qualified.) + * Example: Subscriber to SubscriberServiceApi. + * + * @generated from field: map renamed_services = 2; + */ + renamedServices: { [key: string]: string }; + + /** + * Map from full resource types to the effective short name + * for the resource. This is used when otherwise resource + * named from different services would cause naming collisions. + * Example entry: + * "datalabeling.googleapis.com/Dataset": "DataLabelingDataset" + * + * @generated from field: map renamed_resources = 3; + */ + renamedResources: { [key: string]: string }; + + /** + * List of full resource types to ignore during generation. + * This is typically used for API-specific Location resources, + * which should be handled by the generator as if they were actually + * the common Location resources. + * Example entry: "documentai.googleapis.com/Location" + * + * @generated from field: repeated string ignored_resources = 4; + */ + ignoredResources: string[]; + + /** + * Namespaces which must be aliased in snippets due to + * a known (but non-generator-predictable) naming collision + * + * @generated from field: repeated string forced_namespace_aliases = 5; + */ + forcedNamespaceAliases: string[]; + + /** + * Method signatures (in the form "service.method(signature)") + * which are provided separately, so shouldn't be generated. + * Snippets *calling* these methods are still generated, however. + * + * @generated from field: repeated string handwritten_signatures = 6; + */ + handwrittenSignatures: string[]; +}; + +/** + * Describes the message google.api.DotnetSettings. + * Use `create(DotnetSettingsSchema)` to create a new message. + */ +export const DotnetSettingsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 8); + +/** + * Settings for Ruby client libraries. + * + * @generated from message google.api.RubySettings + */ +export type RubySettings = Message<"google.api.RubySettings"> & { + /** + * Some settings. + * + * @generated from field: google.api.CommonLanguageSettings common = 1; + */ + common?: CommonLanguageSettings; +}; + +/** + * Describes the message google.api.RubySettings. + * Use `create(RubySettingsSchema)` to create a new message. + */ +export const RubySettingsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 9); + +/** + * Settings for Go client libraries. + * + * @generated from message google.api.GoSettings + */ +export type GoSettings = Message<"google.api.GoSettings"> & { + /** + * Some settings. + * + * @generated from field: google.api.CommonLanguageSettings common = 1; + */ + common?: CommonLanguageSettings; + + /** + * Map of service names to renamed services. Keys are the package relative + * service names and values are the name to be used for the service client + * and call options. + * + * publishing: + * go_settings: + * renamed_services: + * Publisher: TopicAdmin + * + * @generated from field: map renamed_services = 2; + */ + renamedServices: { [key: string]: string }; +}; + +/** + * Describes the message google.api.GoSettings. + * Use `create(GoSettingsSchema)` to create a new message. + */ +export const GoSettingsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 10); + +/** + * Describes the generator configuration for a method. + * + * @generated from message google.api.MethodSettings + */ +export type MethodSettings = Message<"google.api.MethodSettings"> & { + /** + * The fully qualified name of the method, for which the options below apply. + * This is used to find the method to apply the options. + * + * Example: + * + * publishing: + * method_settings: + * - selector: google.storage.control.v2.StorageControl.CreateFolder + * # method settings for CreateFolder... + * + * @generated from field: string selector = 1; + */ + selector: string; + + /** + * Describes settings to use for long-running operations when generating + * API methods for RPCs. Complements RPCs that use the annotations in + * google/longrunning/operations.proto. + * + * Example of a YAML configuration:: + * + * publishing: + * method_settings: + * - selector: google.cloud.speech.v2.Speech.BatchRecognize + * long_running: + * initial_poll_delay: 60s # 1 minute + * poll_delay_multiplier: 1.5 + * max_poll_delay: 360s # 6 minutes + * total_poll_timeout: 54000s # 90 minutes + * + * @generated from field: google.api.MethodSettings.LongRunning long_running = 2; + */ + longRunning?: MethodSettings_LongRunning; + + /** + * List of top-level fields of the request message, that should be + * automatically populated by the client libraries based on their + * (google.api.field_info).format. Currently supported format: UUID4. + * + * Example of a YAML configuration: + * + * publishing: + * method_settings: + * - selector: google.example.v1.ExampleService.CreateExample + * auto_populated_fields: + * - request_id + * + * @generated from field: repeated string auto_populated_fields = 3; + */ + autoPopulatedFields: string[]; +}; + +/** + * Describes the message google.api.MethodSettings. + * Use `create(MethodSettingsSchema)` to create a new message. + */ +export const MethodSettingsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 11); + +/** + * Describes settings to use when generating API methods that use the + * long-running operation pattern. + * All default values below are from those used in the client library + * generators (e.g. + * [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)). + * + * @generated from message google.api.MethodSettings.LongRunning + */ +export type MethodSettings_LongRunning = Message<"google.api.MethodSettings.LongRunning"> & { + /** + * Initial delay after which the first poll request will be made. + * Default value: 5 seconds. + * + * @generated from field: google.protobuf.Duration initial_poll_delay = 1; + */ + initialPollDelay?: Duration; + + /** + * Multiplier to gradually increase delay between subsequent polls until it + * reaches max_poll_delay. + * Default value: 1.5. + * + * @generated from field: float poll_delay_multiplier = 2; + */ + pollDelayMultiplier: number; + + /** + * Maximum time between two subsequent poll requests. + * Default value: 45 seconds. + * + * @generated from field: google.protobuf.Duration max_poll_delay = 3; + */ + maxPollDelay?: Duration; + + /** + * Total polling timeout. + * Default value: 5 minutes. + * + * @generated from field: google.protobuf.Duration total_poll_timeout = 4; + */ + totalPollTimeout?: Duration; +}; + +/** + * Describes the message google.api.MethodSettings.LongRunning. + * Use `create(MethodSettings_LongRunningSchema)` to create a new message. + */ +export const MethodSettings_LongRunningSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 11, 0); + +/** + * This message is used to configure the generation of a subset of the RPCs in + * a service for client libraries. + * + * @generated from message google.api.SelectiveGapicGeneration + */ +export type SelectiveGapicGeneration = Message<"google.api.SelectiveGapicGeneration"> & { + /** + * An allowlist of the fully qualified names of RPCs that should be included + * on public client surfaces. + * + * @generated from field: repeated string methods = 1; + */ + methods: string[]; + + /** + * Setting this to true indicates to the client generators that methods + * that would be excluded from the generation should instead be generated + * in a way that indicates these methods should not be consumed by + * end users. How this is expressed is up to individual language + * implementations to decide. Some examples may be: added annotations, + * obfuscated identifiers, or other language idiomatic patterns. + * + * @generated from field: bool generate_omitted_as_internal = 2; + */ + generateOmittedAsInternal: boolean; +}; + +/** + * Describes the message google.api.SelectiveGapicGeneration. + * Use `create(SelectiveGapicGenerationSchema)` to create a new message. + */ +export const SelectiveGapicGenerationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_client, 12); + +/** + * The organization for which the client libraries are being published. + * Affects the url where generated docs are published, etc. + * + * @generated from enum google.api.ClientLibraryOrganization + */ +export enum ClientLibraryOrganization { + /** + * Not useful. + * + * @generated from enum value: CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0; + */ + CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0, + + /** + * Google Cloud Platform Org. + * + * @generated from enum value: CLOUD = 1; + */ + CLOUD = 1, + + /** + * Ads (Advertising) Org. + * + * @generated from enum value: ADS = 2; + */ + ADS = 2, + + /** + * Photos Org. + * + * @generated from enum value: PHOTOS = 3; + */ + PHOTOS = 3, + + /** + * Street View Org. + * + * @generated from enum value: STREET_VIEW = 4; + */ + STREET_VIEW = 4, + + /** + * Shopping Org. + * + * @generated from enum value: SHOPPING = 5; + */ + SHOPPING = 5, + + /** + * Geo Org. + * + * @generated from enum value: GEO = 6; + */ + GEO = 6, + + /** + * Generative AI - https://developers.generativeai.google + * + * @generated from enum value: GENERATIVE_AI = 7; + */ + GENERATIVE_AI = 7, +} + +/** + * Describes the enum google.api.ClientLibraryOrganization. + */ +export const ClientLibraryOrganizationSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_google_api_client, 0); + +/** + * To where should client libraries be published? + * + * @generated from enum google.api.ClientLibraryDestination + */ +export enum ClientLibraryDestination { + /** + * Client libraries will neither be generated nor published to package + * managers. + * + * @generated from enum value: CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0; + */ + CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0, + + /** + * Generate the client library in a repo under github.com/googleapis, + * but don't publish it to package managers. + * + * @generated from enum value: GITHUB = 10; + */ + GITHUB = 10, + + /** + * Publish the library to package managers like nuget.org and npmjs.com. + * + * @generated from enum value: PACKAGE_MANAGER = 20; + */ + PACKAGE_MANAGER = 20, +} + +/** + * Describes the enum google.api.ClientLibraryDestination. + */ +export const ClientLibraryDestinationSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_google_api_client, 1); + +/** + * A definition of a client library method signature. + * + * In client libraries, each proto RPC corresponds to one or more methods + * which the end user is able to call, and calls the underlying RPC. + * Normally, this method receives a single argument (a struct or instance + * corresponding to the RPC request object). Defining this field will + * add one or more overloads providing flattened or simpler method signatures + * in some languages. + * + * The fields on the method signature are provided as a comma-separated + * string. + * + * For example, the proto RPC and annotation: + * + * rpc CreateSubscription(CreateSubscriptionRequest) + * returns (Subscription) { + * option (google.api.method_signature) = "name,topic"; + * } + * + * Would add the following Java overload (in addition to the method accepting + * the request object): + * + * public final Subscription createSubscription(String name, String topic) + * + * The following backwards-compatibility guidelines apply: + * + * * Adding this annotation to an unannotated method is backwards + * compatible. + * * Adding this annotation to a method which already has existing + * method signature annotations is backwards compatible if and only if + * the new method signature annotation is last in the sequence. + * * Modifying or removing an existing method signature annotation is + * a breaking change. + * * Re-ordering existing method signature annotations is a breaking + * change. + * + * @generated from extension: repeated string method_signature = 1051; + */ +export const method_signature: GenExtension = /*@__PURE__*/ + extDesc(file_google_api_client, 0); + +/** + * The hostname for this service. + * This should be specified with no prefix or protocol. + * + * Example: + * + * service Foo { + * option (google.api.default_host) = "foo.googleapi.com"; + * ... + * } + * + * @generated from extension: string default_host = 1049; + */ +export const default_host: GenExtension = /*@__PURE__*/ + extDesc(file_google_api_client, 1); + +/** + * OAuth scopes needed for the client. + * + * Example: + * + * service Foo { + * option (google.api.oauth_scopes) = \ + * "https://www.googleapis.com/auth/cloud-platform"; + * ... + * } + * + * If there is more than one scope, use a comma-separated string: + * + * Example: + * + * service Foo { + * option (google.api.oauth_scopes) = \ + * "https://www.googleapis.com/auth/cloud-platform," + * "https://www.googleapis.com/auth/monitoring"; + * ... + * } + * + * @generated from extension: string oauth_scopes = 1050; + */ +export const oauth_scopes: GenExtension = /*@__PURE__*/ + extDesc(file_google_api_client, 2); + +/** + * The API version of this service, which should be sent by version-aware + * clients to the service. This allows services to abide by the schema and + * behavior of the service at the time this API version was deployed. + * The format of the API version must be treated as opaque by clients. + * Services may use a format with an apparent structure, but clients must + * not rely on this to determine components within an API version, or attempt + * to construct other valid API versions. Note that this is for upcoming + * functionality and may not be implemented for all services. + * + * Example: + * + * service Foo { + * option (google.api.api_version) = "v1_20230821_preview"; + * } + * + * @generated from extension: string api_version = 525000001; + */ +export const api_version: GenExtension = /*@__PURE__*/ + extDesc(file_google_api_client, 3); + diff --git a/web/src/types/proto/google/api/field_behavior.ts b/web/src/types/proto/google/api/field_behavior.ts deleted file mode 100644 index 2a624a7c6..000000000 --- a/web/src/types/proto/google/api/field_behavior.ts +++ /dev/null @@ -1,145 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: google/api/field_behavior.proto - -/* eslint-disable */ - -export const protobufPackage = "google.api"; - -/** - * An indicator of the behavior of a given field (for example, that a field - * is required in requests, or given as output but ignored as input). - * This **does not** change the behavior in protocol buffers itself; it only - * denotes the behavior and may affect how API tooling handles the field. - * - * Note: This enum **may** receive new values in the future. - */ -export enum FieldBehavior { - /** FIELD_BEHAVIOR_UNSPECIFIED - Conventional default for enums. Do not use this. */ - FIELD_BEHAVIOR_UNSPECIFIED = "FIELD_BEHAVIOR_UNSPECIFIED", - /** - * OPTIONAL - Specifically denotes a field as optional. - * While all fields in protocol buffers are optional, this may be specified - * for emphasis if appropriate. - */ - OPTIONAL = "OPTIONAL", - /** - * REQUIRED - Denotes a field as required. - * This indicates that the field **must** be provided as part of the request, - * and failure to do so will cause an error (usually `INVALID_ARGUMENT`). - */ - REQUIRED = "REQUIRED", - /** - * OUTPUT_ONLY - Denotes a field as output only. - * This indicates that the field is provided in responses, but including the - * field in a request does nothing (the server *must* ignore it and - * *must not* throw an error as a result of the field's presence). - */ - OUTPUT_ONLY = "OUTPUT_ONLY", - /** - * INPUT_ONLY - Denotes a field as input only. - * This indicates that the field is provided in requests, and the - * corresponding field is not included in output. - */ - INPUT_ONLY = "INPUT_ONLY", - /** - * IMMUTABLE - Denotes a field as immutable. - * This indicates that the field may be set once in a request to create a - * resource, but may not be changed thereafter. - */ - IMMUTABLE = "IMMUTABLE", - /** - * UNORDERED_LIST - Denotes that a (repeated) field is an unordered list. - * This indicates that the service may provide the elements of the list - * in any arbitrary order, rather than the order the user originally - * provided. Additionally, the list's order may or may not be stable. - */ - UNORDERED_LIST = "UNORDERED_LIST", - /** - * NON_EMPTY_DEFAULT - Denotes that this field returns a non-empty default value if not set. - * This indicates that if the user provides the empty value in a request, - * a non-empty value will be returned. The user will not be aware of what - * non-empty value to expect. - */ - NON_EMPTY_DEFAULT = "NON_EMPTY_DEFAULT", - /** - * IDENTIFIER - Denotes that the field in a resource (a message annotated with - * google.api.resource) is used in the resource name to uniquely identify the - * resource. For AIP-compliant APIs, this should only be applied to the - * `name` field on the resource. - * - * This behavior should not be applied to references to other resources within - * the message. - * - * The identifier field of resources often have different field behavior - * depending on the request it is embedded in (e.g. for Create methods name - * is optional and unused, while for Update methods it is required). Instead - * of method-specific annotations, only `IDENTIFIER` is required. - */ - IDENTIFIER = "IDENTIFIER", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function fieldBehaviorFromJSON(object: any): FieldBehavior { - switch (object) { - case 0: - case "FIELD_BEHAVIOR_UNSPECIFIED": - return FieldBehavior.FIELD_BEHAVIOR_UNSPECIFIED; - case 1: - case "OPTIONAL": - return FieldBehavior.OPTIONAL; - case 2: - case "REQUIRED": - return FieldBehavior.REQUIRED; - case 3: - case "OUTPUT_ONLY": - return FieldBehavior.OUTPUT_ONLY; - case 4: - case "INPUT_ONLY": - return FieldBehavior.INPUT_ONLY; - case 5: - case "IMMUTABLE": - return FieldBehavior.IMMUTABLE; - case 6: - case "UNORDERED_LIST": - return FieldBehavior.UNORDERED_LIST; - case 7: - case "NON_EMPTY_DEFAULT": - return FieldBehavior.NON_EMPTY_DEFAULT; - case 8: - case "IDENTIFIER": - return FieldBehavior.IDENTIFIER; - case -1: - case "UNRECOGNIZED": - default: - return FieldBehavior.UNRECOGNIZED; - } -} - -export function fieldBehaviorToNumber(object: FieldBehavior): number { - switch (object) { - case FieldBehavior.FIELD_BEHAVIOR_UNSPECIFIED: - return 0; - case FieldBehavior.OPTIONAL: - return 1; - case FieldBehavior.REQUIRED: - return 2; - case FieldBehavior.OUTPUT_ONLY: - return 3; - case FieldBehavior.INPUT_ONLY: - return 4; - case FieldBehavior.IMMUTABLE: - return 5; - case FieldBehavior.UNORDERED_LIST: - return 6; - case FieldBehavior.NON_EMPTY_DEFAULT: - return 7; - case FieldBehavior.IDENTIFIER: - return 8; - case FieldBehavior.UNRECOGNIZED: - default: - return -1; - } -} diff --git a/web/src/types/proto/google/api/field_behavior_pb.ts b/web/src/types/proto/google/api/field_behavior_pb.ts new file mode 100644 index 000000000..687b3b66d --- /dev/null +++ b/web/src/types/proto/google/api/field_behavior_pb.ts @@ -0,0 +1,157 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file google/api/field_behavior.proto (package google.api, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenExtension, GenFile } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, extDesc, fileDesc } from "@bufbuild/protobuf/codegenv2"; +import type { FieldOptions } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_descriptor } from "@bufbuild/protobuf/wkt"; + +/** + * Describes the file google/api/field_behavior.proto. + */ +export const file_google_api_field_behavior: GenFile = /*@__PURE__*/ + fileDesc("Ch9nb29nbGUvYXBpL2ZpZWxkX2JlaGF2aW9yLnByb3RvEgpnb29nbGUuYXBpKrYBCg1GaWVsZEJlaGF2aW9yEh4KGkZJRUxEX0JFSEFWSU9SX1VOU1BFQ0lGSUVEEAASDAoIT1BUSU9OQUwQARIMCghSRVFVSVJFRBACEg8KC09VVFBVVF9PTkxZEAMSDgoKSU5QVVRfT05MWRAEEg0KCUlNTVVUQUJMRRAFEhIKDlVOT1JERVJFRF9MSVNUEAYSFQoRTk9OX0VNUFRZX0RFRkFVTFQQBxIOCgpJREVOVElGSUVSEAg6ZAoOZmllbGRfYmVoYXZpb3ISHS5nb29nbGUucHJvdG9idWYuRmllbGRPcHRpb25zGJwIIAMoDjIZLmdvb2dsZS5hcGkuRmllbGRCZWhhdmlvckICEABSDWZpZWxkQmVoYXZpb3JCsAEKDmNvbS5nb29nbGUuYXBpQhJGaWVsZEJlaGF2aW9yUHJvdG9QAVpBZ29vZ2xlLmdvbGFuZy5vcmcvZ2VucHJvdG8vZ29vZ2xlYXBpcy9hcGkvYW5ub3RhdGlvbnM7YW5ub3RhdGlvbnOiAgNHQViqAgpHb29nbGUuQXBpygIKR29vZ2xlXEFwaeICFkdvb2dsZVxBcGlcR1BCTWV0YWRhdGHqAgtHb29nbGU6OkFwaWIGcHJvdG8z", [file_google_protobuf_descriptor]); + +/** + * An indicator of the behavior of a given field (for example, that a field + * is required in requests, or given as output but ignored as input). + * This **does not** change the behavior in protocol buffers itself; it only + * denotes the behavior and may affect how API tooling handles the field. + * + * Note: This enum **may** receive new values in the future. + * + * @generated from enum google.api.FieldBehavior + */ +export enum FieldBehavior { + /** + * Conventional default for enums. Do not use this. + * + * @generated from enum value: FIELD_BEHAVIOR_UNSPECIFIED = 0; + */ + FIELD_BEHAVIOR_UNSPECIFIED = 0, + + /** + * Specifically denotes a field as optional. + * While all fields in protocol buffers are optional, this may be specified + * for emphasis if appropriate. + * + * @generated from enum value: OPTIONAL = 1; + */ + OPTIONAL = 1, + + /** + * Denotes a field as required. + * This indicates that the field **must** be provided as part of the request, + * and failure to do so will cause an error (usually `INVALID_ARGUMENT`). + * + * @generated from enum value: REQUIRED = 2; + */ + REQUIRED = 2, + + /** + * Denotes a field as output only. + * This indicates that the field is provided in responses, but including the + * field in a request does nothing (the server *must* ignore it and + * *must not* throw an error as a result of the field's presence). + * + * @generated from enum value: OUTPUT_ONLY = 3; + */ + OUTPUT_ONLY = 3, + + /** + * Denotes a field as input only. + * This indicates that the field is provided in requests, and the + * corresponding field is not included in output. + * + * @generated from enum value: INPUT_ONLY = 4; + */ + INPUT_ONLY = 4, + + /** + * Denotes a field as immutable. + * This indicates that the field may be set once in a request to create a + * resource, but may not be changed thereafter. + * + * @generated from enum value: IMMUTABLE = 5; + */ + IMMUTABLE = 5, + + /** + * Denotes that a (repeated) field is an unordered list. + * This indicates that the service may provide the elements of the list + * in any arbitrary order, rather than the order the user originally + * provided. Additionally, the list's order may or may not be stable. + * + * @generated from enum value: UNORDERED_LIST = 6; + */ + UNORDERED_LIST = 6, + + /** + * Denotes that this field returns a non-empty default value if not set. + * This indicates that if the user provides the empty value in a request, + * a non-empty value will be returned. The user will not be aware of what + * non-empty value to expect. + * + * @generated from enum value: NON_EMPTY_DEFAULT = 7; + */ + NON_EMPTY_DEFAULT = 7, + + /** + * Denotes that the field in a resource (a message annotated with + * google.api.resource) is used in the resource name to uniquely identify the + * resource. For AIP-compliant APIs, this should only be applied to the + * `name` field on the resource. + * + * This behavior should not be applied to references to other resources within + * the message. + * + * The identifier field of resources often have different field behavior + * depending on the request it is embedded in (e.g. for Create methods name + * is optional and unused, while for Update methods it is required). Instead + * of method-specific annotations, only `IDENTIFIER` is required. + * + * @generated from enum value: IDENTIFIER = 8; + */ + IDENTIFIER = 8, +} + +/** + * Describes the enum google.api.FieldBehavior. + */ +export const FieldBehaviorSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_google_api_field_behavior, 0); + +/** + * A designation of a specific field behavior (required, output only, etc.) + * in protobuf messages. + * + * Examples: + * + * string name = 1 [(google.api.field_behavior) = REQUIRED]; + * State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + * google.protobuf.Duration ttl = 1 + * [(google.api.field_behavior) = INPUT_ONLY]; + * google.protobuf.Timestamp expire_time = 1 + * [(google.api.field_behavior) = OUTPUT_ONLY, + * (google.api.field_behavior) = IMMUTABLE]; + * + * @generated from extension: repeated google.api.FieldBehavior field_behavior = 1052 [packed = false]; + */ +export const field_behavior: GenExtension = /*@__PURE__*/ + extDesc(file_google_api_field_behavior, 0); + diff --git a/web/src/types/proto/google/api/http.ts b/web/src/types/proto/google/api/http_pb.ts similarity index 57% rename from web/src/types/proto/google/api/http.ts rename to web/src/types/proto/google/api/http_pb.ts index 4901d767b..9d931e0e3 100644 --- a/web/src/types/proto/google/api/http.ts +++ b/web/src/types/proto/google/api/http_pb.ts @@ -1,26 +1,48 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: google/api/http.proto +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file google/api/http.proto (package google.api, syntax proto3) /* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -export const protobufPackage = "google.api"; +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file google/api/http.proto. + */ +export const file_google_api_http: GenFile = /*@__PURE__*/ + fileDesc("ChVnb29nbGUvYXBpL2h0dHAucHJvdG8SCmdvb2dsZS5hcGkiVAoESHR0cBIjCgVydWxlcxgBIAMoCzIULmdvb2dsZS5hcGkuSHR0cFJ1bGUSJwofZnVsbHlfZGVjb2RlX3Jlc2VydmVkX2V4cGFuc2lvbhgCIAEoCCKBAgoISHR0cFJ1bGUSEAoIc2VsZWN0b3IYASABKAkSDQoDZ2V0GAIgASgJSAASDQoDcHV0GAMgASgJSAASDgoEcG9zdBgEIAEoCUgAEhAKBmRlbGV0ZRgFIAEoCUgAEg8KBXBhdGNoGAYgASgJSAASLwoGY3VzdG9tGAggASgLMh0uZ29vZ2xlLmFwaS5DdXN0b21IdHRwUGF0dGVybkgAEgwKBGJvZHkYByABKAkSFQoNcmVzcG9uc2VfYm9keRgMIAEoCRIxChNhZGRpdGlvbmFsX2JpbmRpbmdzGAsgAygLMhQuZ29vZ2xlLmFwaS5IdHRwUnVsZUIJCgdwYXR0ZXJuIi8KEUN1c3RvbUh0dHBQYXR0ZXJuEgwKBGtpbmQYASABKAkSDAoEcGF0aBgCIAEoCUKnAQoOY29tLmdvb2dsZS5hcGlCCUh0dHBQcm90b1ABWkFnb29nbGUuZ29sYW5nLm9yZy9nZW5wcm90by9nb29nbGVhcGlzL2FwaS9hbm5vdGF0aW9uczthbm5vdGF0aW9uc6ICA0dBWKoCCkdvb2dsZS5BcGnKAgpHb29nbGVcQXBp4gIWR29vZ2xlXEFwaVxHUEJNZXRhZGF0YeoCC0dvb2dsZTo6QXBpYgZwcm90bzM"); /** * Defines the HTTP configuration for an API service. It contains a list of * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method * to one or more HTTP REST API methods. + * + * @generated from message google.api.Http */ -export interface Http { +export type Http = Message<"google.api.Http"> & { /** * A list of HTTP configuration rules that apply to individual API methods. * * **NOTE:** All service configuration rules follow "last one wins" order. + * + * @generated from field: repeated google.api.HttpRule rules = 1; */ rules: HttpRule[]; + /** * When set to true, URL path parameters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be @@ -28,9 +50,18 @@ export interface Http { * * The default behavior is to not decode RFC 6570 reserved characters in multi * segment matches. + * + * @generated from field: bool fully_decode_reserved_expansion = 2; */ fullyDecodeReservedExpansion: boolean; -} +}; + +/** + * Describes the message google.api.Http. + * Use `create(HttpSchema)` to create a new message. + */ +export const HttpSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_http, 0); /** * gRPC Transcoding @@ -152,6 +183,7 @@ export interface Http { * string text = 2; * } * + * * The following HTTP JSON to RPC mapping is enabled: * * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` @@ -296,47 +328,81 @@ export interface Http { * If an API needs to use a JSON array for request or response body, it can map * the request or response body to a repeated field. However, some gRPC * Transcoding implementations may not support this feature. + * + * @generated from message google.api.HttpRule */ -export interface HttpRule { +export type HttpRule = Message<"google.api.HttpRule"> & { /** * Selects a method to which this rule applies. * * Refer to [selector][google.api.DocumentationRule.selector] for syntax * details. + * + * @generated from field: string selector = 1; */ selector: string; + /** - * Maps to HTTP GET. Used for listing and getting information about - * resources. + * Determines the URL pattern is matched by this rules. This pattern can be + * used with any of the {get|put|post|delete|patch} methods. A custom method + * can be defined using the 'custom' field. + * + * @generated from oneof google.api.HttpRule.pattern */ - get?: - | string - | undefined; - /** Maps to HTTP PUT. Used for replacing a resource. */ - put?: - | string - | undefined; - /** Maps to HTTP POST. Used for creating a resource or performing an action. */ - post?: - | string - | undefined; - /** Maps to HTTP DELETE. Used for deleting a resource. */ - delete?: - | string - | undefined; - /** Maps to HTTP PATCH. Used for updating a resource. */ - patch?: - | string - | undefined; - /** - * The custom pattern is used for specifying an HTTP method that is not - * included in the `pattern` field, such as HEAD, or "*" to leave the - * HTTP method unspecified for this rule. The wild-card rule is useful - * for services that provide content to Web (HTML) clients. - */ - custom?: - | CustomHttpPattern - | undefined; + pattern: { + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + * + * @generated from field: string get = 2; + */ + value: string; + case: "get"; + } | { + /** + * Maps to HTTP PUT. Used for replacing a resource. + * + * @generated from field: string put = 3; + */ + value: string; + case: "put"; + } | { + /** + * Maps to HTTP POST. Used for creating a resource or performing an action. + * + * @generated from field: string post = 4; + */ + value: string; + case: "post"; + } | { + /** + * Maps to HTTP DELETE. Used for deleting a resource. + * + * @generated from field: string delete = 5; + */ + value: string; + case: "delete"; + } | { + /** + * Maps to HTTP PATCH. Used for updating a resource. + * + * @generated from field: string patch = 6; + */ + value: string; + case: "patch"; + } | { + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + * + * @generated from field: google.api.CustomHttpPattern custom = 8; + */ + value: CustomHttpPattern; + case: "custom"; + } | { case: undefined; value?: undefined }; + /** * The name of the request field whose value is mapped to the HTTP request * body, or `*` for mapping all request fields not captured by the path @@ -344,8 +410,11 @@ export interface HttpRule { * * NOTE: the referred field must be present at the top-level of the request * message type. + * + * @generated from field: string body = 7; */ body: string; + /** * Optional. The name of the response field whose value is mapped to the HTTP * response body. When omitted, the entire response message will be used @@ -353,318 +422,53 @@ export interface HttpRule { * * NOTE: The referred field must be present at the top-level of the response * message type. + * + * @generated from field: string response_body = 12; */ responseBody: string; + /** * Additional HTTP bindings for the selector. Nested bindings must * not contain an `additional_bindings` field themselves (that is, * the nesting may only be one level deep). + * + * @generated from field: repeated google.api.HttpRule additional_bindings = 11; */ additionalBindings: HttpRule[]; -} +}; -/** A custom pattern is used for defining custom HTTP verb. */ -export interface CustomHttpPattern { - /** The name of this custom HTTP verb. */ +/** + * Describes the message google.api.HttpRule. + * Use `create(HttpRuleSchema)` to create a new message. + */ +export const HttpRuleSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_http, 1); + +/** + * A custom pattern is used for defining custom HTTP verb. + * + * @generated from message google.api.CustomHttpPattern + */ +export type CustomHttpPattern = Message<"google.api.CustomHttpPattern"> & { + /** + * The name of this custom HTTP verb. + * + * @generated from field: string kind = 1; + */ kind: string; - /** The path matched by this custom verb. */ + + /** + * The path matched by this custom verb. + * + * @generated from field: string path = 2; + */ path: string; -} - -function createBaseHttp(): Http { - return { rules: [], fullyDecodeReservedExpansion: false }; -} - -export const Http: MessageFns = { - encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).join(); - } - if (message.fullyDecodeReservedExpansion !== false) { - writer.uint32(16).bool(message.fullyDecodeReservedExpansion); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Http { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseHttp(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.rules.push(HttpRule.decode(reader, reader.uint32())); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.fullyDecodeReservedExpansion = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): Http { - return Http.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): Http { - const message = createBaseHttp(); - message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || []; - message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false; - return message; - }, }; -function createBaseHttpRule(): HttpRule { - return { - selector: "", - get: undefined, - put: undefined, - post: undefined, - delete: undefined, - patch: undefined, - custom: undefined, - body: "", - responseBody: "", - additionalBindings: [], - }; -} +/** + * Describes the message google.api.CustomHttpPattern. + * Use `create(CustomHttpPatternSchema)` to create a new message. + */ +export const CustomHttpPatternSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_http, 2); -export const HttpRule: MessageFns = { - encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.selector !== "") { - writer.uint32(10).string(message.selector); - } - if (message.get !== undefined) { - writer.uint32(18).string(message.get); - } - if (message.put !== undefined) { - writer.uint32(26).string(message.put); - } - if (message.post !== undefined) { - writer.uint32(34).string(message.post); - } - if (message.delete !== undefined) { - writer.uint32(42).string(message.delete); - } - if (message.patch !== undefined) { - writer.uint32(50).string(message.patch); - } - if (message.custom !== undefined) { - CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); - } - if (message.body !== "") { - writer.uint32(58).string(message.body); - } - if (message.responseBody !== "") { - writer.uint32(98).string(message.responseBody); - } - for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseHttpRule(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.selector = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.get = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.put = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.post = reader.string(); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.delete = reader.string(); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.patch = reader.string(); - continue; - } - case 8: { - if (tag !== 66) { - break; - } - - message.custom = CustomHttpPattern.decode(reader, reader.uint32()); - continue; - } - case 7: { - if (tag !== 58) { - break; - } - - message.body = reader.string(); - continue; - } - case 12: { - if (tag !== 98) { - break; - } - - message.responseBody = reader.string(); - continue; - } - case 11: { - if (tag !== 90) { - break; - } - - message.additionalBindings.push(HttpRule.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): HttpRule { - return HttpRule.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): HttpRule { - const message = createBaseHttpRule(); - message.selector = object.selector ?? ""; - message.get = object.get ?? undefined; - message.put = object.put ?? undefined; - message.post = object.post ?? undefined; - message.delete = object.delete ?? undefined; - message.patch = object.patch ?? undefined; - message.custom = (object.custom !== undefined && object.custom !== null) - ? CustomHttpPattern.fromPartial(object.custom) - : undefined; - message.body = object.body ?? ""; - message.responseBody = object.responseBody ?? ""; - message.additionalBindings = object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseCustomHttpPattern(): CustomHttpPattern { - return { kind: "", path: "" }; -} - -export const CustomHttpPattern: MessageFns = { - encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.kind !== "") { - writer.uint32(10).string(message.kind); - } - if (message.path !== "") { - writer.uint32(18).string(message.path); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCustomHttpPattern(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.kind = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.path = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): CustomHttpPattern { - return CustomHttpPattern.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): CustomHttpPattern { - const message = createBaseCustomHttpPattern(); - message.kind = object.kind ?? ""; - message.path = object.path ?? ""; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/google/api/launch_stage.ts b/web/src/types/proto/google/api/launch_stage.ts deleted file mode 100644 index 0c905fd24..000000000 --- a/web/src/types/proto/google/api/launch_stage.ts +++ /dev/null @@ -1,121 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: google/api/launch_stage.proto - -/* eslint-disable */ - -export const protobufPackage = "google.api"; - -/** - * The launch stage as defined by [Google Cloud Platform - * Launch Stages](https://cloud.google.com/terms/launch-stages). - */ -export enum LaunchStage { - /** LAUNCH_STAGE_UNSPECIFIED - Do not use this default value. */ - LAUNCH_STAGE_UNSPECIFIED = "LAUNCH_STAGE_UNSPECIFIED", - /** UNIMPLEMENTED - The feature is not yet implemented. Users can not use it. */ - UNIMPLEMENTED = "UNIMPLEMENTED", - /** PRELAUNCH - Prelaunch features are hidden from users and are only visible internally. */ - PRELAUNCH = "PRELAUNCH", - /** - * EARLY_ACCESS - Early Access features are limited to a closed group of testers. To use - * these features, you must sign up in advance and sign a Trusted Tester - * agreement (which includes confidentiality provisions). These features may - * be unstable, changed in backward-incompatible ways, and are not - * guaranteed to be released. - */ - EARLY_ACCESS = "EARLY_ACCESS", - /** - * ALPHA - Alpha is a limited availability test for releases before they are cleared - * for widespread use. By Alpha, all significant design issues are resolved - * and we are in the process of verifying functionality. Alpha customers - * need to apply for access, agree to applicable terms, and have their - * projects allowlisted. Alpha releases don't have to be feature complete, - * no SLAs are provided, and there are no technical support obligations, but - * they will be far enough along that customers can actually use them in - * test environments or for limited-use tests -- just like they would in - * normal production cases. - */ - ALPHA = "ALPHA", - /** - * BETA - Beta is the point at which we are ready to open a release for any - * customer to use. There are no SLA or technical support obligations in a - * Beta release. Products will be complete from a feature perspective, but - * may have some open outstanding issues. Beta releases are suitable for - * limited production use cases. - */ - BETA = "BETA", - /** - * GA - GA features are open to all developers and are considered stable and - * fully qualified for production use. - */ - GA = "GA", - /** - * DEPRECATED - Deprecated features are scheduled to be shut down and removed. For more - * information, see the "Deprecation Policy" section of our [Terms of - * Service](https://cloud.google.com/terms/) - * and the [Google Cloud Platform Subject to the Deprecation - * Policy](https://cloud.google.com/terms/deprecation) documentation. - */ - DEPRECATED = "DEPRECATED", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function launchStageFromJSON(object: any): LaunchStage { - switch (object) { - case 0: - case "LAUNCH_STAGE_UNSPECIFIED": - return LaunchStage.LAUNCH_STAGE_UNSPECIFIED; - case 6: - case "UNIMPLEMENTED": - return LaunchStage.UNIMPLEMENTED; - case 7: - case "PRELAUNCH": - return LaunchStage.PRELAUNCH; - case 1: - case "EARLY_ACCESS": - return LaunchStage.EARLY_ACCESS; - case 2: - case "ALPHA": - return LaunchStage.ALPHA; - case 3: - case "BETA": - return LaunchStage.BETA; - case 4: - case "GA": - return LaunchStage.GA; - case 5: - case "DEPRECATED": - return LaunchStage.DEPRECATED; - case -1: - case "UNRECOGNIZED": - default: - return LaunchStage.UNRECOGNIZED; - } -} - -export function launchStageToNumber(object: LaunchStage): number { - switch (object) { - case LaunchStage.LAUNCH_STAGE_UNSPECIFIED: - return 0; - case LaunchStage.UNIMPLEMENTED: - return 6; - case LaunchStage.PRELAUNCH: - return 7; - case LaunchStage.EARLY_ACCESS: - return 1; - case LaunchStage.ALPHA: - return 2; - case LaunchStage.BETA: - return 3; - case LaunchStage.GA: - return 4; - case LaunchStage.DEPRECATED: - return 5; - case LaunchStage.UNRECOGNIZED: - default: - return -1; - } -} diff --git a/web/src/types/proto/google/api/launch_stage_pb.ts b/web/src/types/proto/google/api/launch_stage_pb.ts new file mode 100644 index 000000000..3f6e6bf98 --- /dev/null +++ b/web/src/types/proto/google/api/launch_stage_pb.ts @@ -0,0 +1,118 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file google/api/launch_stage.proto (package google.api, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc } from "@bufbuild/protobuf/codegenv2"; + +/** + * Describes the file google/api/launch_stage.proto. + */ +export const file_google_api_launch_stage: GenFile = /*@__PURE__*/ + fileDesc("Ch1nb29nbGUvYXBpL2xhdW5jaF9zdGFnZS5wcm90bxIKZ29vZ2xlLmFwaSqMAQoLTGF1bmNoU3RhZ2USHAoYTEFVTkNIX1NUQUdFX1VOU1BFQ0lGSUVEEAASEQoNVU5JTVBMRU1FTlRFRBAGEg0KCVBSRUxBVU5DSBAHEhAKDEVBUkxZX0FDQ0VTUxABEgkKBUFMUEhBEAISCAoEQkVUQRADEgYKAkdBEAQSDgoKREVQUkVDQVRFRBAFQpoBCg5jb20uZ29vZ2xlLmFwaUIQTGF1bmNoU3RhZ2VQcm90b1ABWi1nb29nbGUuZ29sYW5nLm9yZy9nZW5wcm90by9nb29nbGVhcGlzL2FwaTthcGmiAgNHQViqAgpHb29nbGUuQXBpygIKR29vZ2xlXEFwaeICFkdvb2dsZVxBcGlcR1BCTWV0YWRhdGHqAgtHb29nbGU6OkFwaWIGcHJvdG8z"); + +/** + * The launch stage as defined by [Google Cloud Platform + * Launch Stages](https://cloud.google.com/terms/launch-stages). + * + * @generated from enum google.api.LaunchStage + */ +export enum LaunchStage { + /** + * Do not use this default value. + * + * @generated from enum value: LAUNCH_STAGE_UNSPECIFIED = 0; + */ + LAUNCH_STAGE_UNSPECIFIED = 0, + + /** + * The feature is not yet implemented. Users can not use it. + * + * @generated from enum value: UNIMPLEMENTED = 6; + */ + UNIMPLEMENTED = 6, + + /** + * Prelaunch features are hidden from users and are only visible internally. + * + * @generated from enum value: PRELAUNCH = 7; + */ + PRELAUNCH = 7, + + /** + * Early Access features are limited to a closed group of testers. To use + * these features, you must sign up in advance and sign a Trusted Tester + * agreement (which includes confidentiality provisions). These features may + * be unstable, changed in backward-incompatible ways, and are not + * guaranteed to be released. + * + * @generated from enum value: EARLY_ACCESS = 1; + */ + EARLY_ACCESS = 1, + + /** + * Alpha is a limited availability test for releases before they are cleared + * for widespread use. By Alpha, all significant design issues are resolved + * and we are in the process of verifying functionality. Alpha customers + * need to apply for access, agree to applicable terms, and have their + * projects allowlisted. Alpha releases don't have to be feature complete, + * no SLAs are provided, and there are no technical support obligations, but + * they will be far enough along that customers can actually use them in + * test environments or for limited-use tests -- just like they would in + * normal production cases. + * + * @generated from enum value: ALPHA = 2; + */ + ALPHA = 2, + + /** + * Beta is the point at which we are ready to open a release for any + * customer to use. There are no SLA or technical support obligations in a + * Beta release. Products will be complete from a feature perspective, but + * may have some open outstanding issues. Beta releases are suitable for + * limited production use cases. + * + * @generated from enum value: BETA = 3; + */ + BETA = 3, + + /** + * GA features are open to all developers and are considered stable and + * fully qualified for production use. + * + * @generated from enum value: GA = 4; + */ + GA = 4, + + /** + * Deprecated features are scheduled to be shut down and removed. For more + * information, see the "Deprecation Policy" section of our [Terms of + * Service](https://cloud.google.com/terms/) + * and the [Google Cloud Platform Subject to the Deprecation + * Policy](https://cloud.google.com/terms/deprecation) documentation. + * + * @generated from enum value: DEPRECATED = 5; + */ + DEPRECATED = 5, +} + +/** + * Describes the enum google.api.LaunchStage. + */ +export const LaunchStageSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_google_api_launch_stage, 0); + diff --git a/web/src/types/proto/google/api/resource.ts b/web/src/types/proto/google/api/resource.ts deleted file mode 100644 index 6dab32d83..000000000 --- a/web/src/types/proto/google/api/resource.ts +++ /dev/null @@ -1,501 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: google/api/resource.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; - -export const protobufPackage = "google.api"; - -/** - * A simple descriptor of a resource type. - * - * ResourceDescriptor annotates a resource message (either by means of a - * protobuf annotation or use in the service config), and associates the - * resource's schema, the resource type, and the pattern of the resource name. - * - * Example: - * - * message Topic { - * // Indicates this message defines a resource schema. - * // Declares the resource type in the format of {service}/{kind}. - * // For Kubernetes resources, the format is {api group}/{kind}. - * option (google.api.resource) = { - * type: "pubsub.googleapis.com/Topic" - * pattern: "projects/{project}/topics/{topic}" - * }; - * } - * - * The ResourceDescriptor Yaml config will look like: - * - * resources: - * - type: "pubsub.googleapis.com/Topic" - * pattern: "projects/{project}/topics/{topic}" - * - * Sometimes, resources have multiple patterns, typically because they can - * live under multiple parents. - * - * Example: - * - * message LogEntry { - * option (google.api.resource) = { - * type: "logging.googleapis.com/LogEntry" - * pattern: "projects/{project}/logs/{log}" - * pattern: "folders/{folder}/logs/{log}" - * pattern: "organizations/{organization}/logs/{log}" - * pattern: "billingAccounts/{billing_account}/logs/{log}" - * }; - * } - * - * The ResourceDescriptor Yaml config will look like: - * - * resources: - * - type: 'logging.googleapis.com/LogEntry' - * pattern: "projects/{project}/logs/{log}" - * pattern: "folders/{folder}/logs/{log}" - * pattern: "organizations/{organization}/logs/{log}" - * pattern: "billingAccounts/{billing_account}/logs/{log}" - */ -export interface ResourceDescriptor { - /** - * The resource type. It must be in the format of - * {service_name}/{resource_type_kind}. The `resource_type_kind` must be - * singular and must not include version numbers. - * - * Example: `storage.googleapis.com/Bucket` - * - * The value of the resource_type_kind must follow the regular expression - * /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and - * should use PascalCase (UpperCamelCase). The maximum number of - * characters allowed for the `resource_type_kind` is 100. - */ - type: string; - /** - * Optional. The relative resource name pattern associated with this resource - * type. The DNS prefix of the full resource name shouldn't be specified here. - * - * The path pattern must follow the syntax, which aligns with HTTP binding - * syntax: - * - * Template = Segment { "/" Segment } ; - * Segment = LITERAL | Variable ; - * Variable = "{" LITERAL "}" ; - * - * Examples: - * - * - "projects/{project}/topics/{topic}" - * - "projects/{project}/knowledgeBases/{knowledge_base}" - * - * The components in braces correspond to the IDs for each resource in the - * hierarchy. It is expected that, if multiple patterns are provided, - * the same component name (e.g. "project") refers to IDs of the same - * type of resource. - */ - pattern: string[]; - /** - * Optional. The field on the resource that designates the resource name - * field. If omitted, this is assumed to be "name". - */ - nameField: string; - /** - * Optional. The historical or future-looking state of the resource pattern. - * - * Example: - * - * // The InspectTemplate message originally only supported resource - * // names with organization, and project was added later. - * message InspectTemplate { - * option (google.api.resource) = { - * type: "dlp.googleapis.com/InspectTemplate" - * pattern: - * "organizations/{organization}/inspectTemplates/{inspect_template}" - * pattern: "projects/{project}/inspectTemplates/{inspect_template}" - * history: ORIGINALLY_SINGLE_PATTERN - * }; - * } - */ - history: ResourceDescriptor_History; - /** - * The plural name used in the resource name and permission names, such as - * 'projects' for the resource name of 'projects/{project}' and the permission - * name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception - * to this is for Nested Collections that have stuttering names, as defined - * in [AIP-122](https://google.aip.dev/122#nested-collections), where the - * collection ID in the resource name pattern does not necessarily directly - * match the `plural` value. - * - * It is the same concept of the `plural` field in k8s CRD spec - * https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ - * - * Note: The plural form is required even for singleton resources. See - * https://aip.dev/156 - */ - plural: string; - /** - * The same concept of the `singular` field in k8s CRD spec - * https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ - * Such as "project" for the `resourcemanager.googleapis.com/Project` type. - */ - singular: string; - /** - * Style flag(s) for this resource. - * These indicate that a resource is expected to conform to a given - * style. See the specific style flags for additional information. - */ - style: ResourceDescriptor_Style[]; -} - -/** - * A description of the historical or future-looking state of the - * resource pattern. - */ -export enum ResourceDescriptor_History { - /** HISTORY_UNSPECIFIED - The "unset" value. */ - HISTORY_UNSPECIFIED = "HISTORY_UNSPECIFIED", - /** - * ORIGINALLY_SINGLE_PATTERN - The resource originally had one pattern and launched as such, and - * additional patterns were added later. - */ - ORIGINALLY_SINGLE_PATTERN = "ORIGINALLY_SINGLE_PATTERN", - /** - * FUTURE_MULTI_PATTERN - The resource has one pattern, but the API owner expects to add more - * later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents - * that from being necessary once there are multiple patterns.) - */ - FUTURE_MULTI_PATTERN = "FUTURE_MULTI_PATTERN", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function resourceDescriptor_HistoryFromJSON(object: any): ResourceDescriptor_History { - switch (object) { - case 0: - case "HISTORY_UNSPECIFIED": - return ResourceDescriptor_History.HISTORY_UNSPECIFIED; - case 1: - case "ORIGINALLY_SINGLE_PATTERN": - return ResourceDescriptor_History.ORIGINALLY_SINGLE_PATTERN; - case 2: - case "FUTURE_MULTI_PATTERN": - return ResourceDescriptor_History.FUTURE_MULTI_PATTERN; - case -1: - case "UNRECOGNIZED": - default: - return ResourceDescriptor_History.UNRECOGNIZED; - } -} - -export function resourceDescriptor_HistoryToNumber(object: ResourceDescriptor_History): number { - switch (object) { - case ResourceDescriptor_History.HISTORY_UNSPECIFIED: - return 0; - case ResourceDescriptor_History.ORIGINALLY_SINGLE_PATTERN: - return 1; - case ResourceDescriptor_History.FUTURE_MULTI_PATTERN: - return 2; - case ResourceDescriptor_History.UNRECOGNIZED: - default: - return -1; - } -} - -/** A flag representing a specific style that a resource claims to conform to. */ -export enum ResourceDescriptor_Style { - /** STYLE_UNSPECIFIED - The unspecified value. Do not use. */ - STYLE_UNSPECIFIED = "STYLE_UNSPECIFIED", - /** - * DECLARATIVE_FRIENDLY - This resource is intended to be "declarative-friendly". - * - * Declarative-friendly resources must be more strictly consistent, and - * setting this to true communicates to tools that this resource should - * adhere to declarative-friendly expectations. - * - * Note: This is used by the API linter (linter.aip.dev) to enable - * additional checks. - */ - DECLARATIVE_FRIENDLY = "DECLARATIVE_FRIENDLY", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function resourceDescriptor_StyleFromJSON(object: any): ResourceDescriptor_Style { - switch (object) { - case 0: - case "STYLE_UNSPECIFIED": - return ResourceDescriptor_Style.STYLE_UNSPECIFIED; - case 1: - case "DECLARATIVE_FRIENDLY": - return ResourceDescriptor_Style.DECLARATIVE_FRIENDLY; - case -1: - case "UNRECOGNIZED": - default: - return ResourceDescriptor_Style.UNRECOGNIZED; - } -} - -export function resourceDescriptor_StyleToNumber(object: ResourceDescriptor_Style): number { - switch (object) { - case ResourceDescriptor_Style.STYLE_UNSPECIFIED: - return 0; - case ResourceDescriptor_Style.DECLARATIVE_FRIENDLY: - return 1; - case ResourceDescriptor_Style.UNRECOGNIZED: - default: - return -1; - } -} - -/** - * Defines a proto annotation that describes a string field that refers to - * an API resource. - */ -export interface ResourceReference { - /** - * The resource type that the annotated field references. - * - * Example: - * - * message Subscription { - * string topic = 2 [(google.api.resource_reference) = { - * type: "pubsub.googleapis.com/Topic" - * }]; - * } - * - * Occasionally, a field may reference an arbitrary resource. In this case, - * APIs use the special value * in their resource reference. - * - * Example: - * - * message GetIamPolicyRequest { - * string resource = 2 [(google.api.resource_reference) = { - * type: "*" - * }]; - * } - */ - type: string; - /** - * The resource type of a child collection that the annotated field - * references. This is useful for annotating the `parent` field that - * doesn't have a fixed resource type. - * - * Example: - * - * message ListLogEntriesRequest { - * string parent = 1 [(google.api.resource_reference) = { - * child_type: "logging.googleapis.com/LogEntry" - * }; - * } - */ - childType: string; -} - -function createBaseResourceDescriptor(): ResourceDescriptor { - return { - type: "", - pattern: [], - nameField: "", - history: ResourceDescriptor_History.HISTORY_UNSPECIFIED, - plural: "", - singular: "", - style: [], - }; -} - -export const ResourceDescriptor: MessageFns = { - encode(message: ResourceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.type !== "") { - writer.uint32(10).string(message.type); - } - for (const v of message.pattern) { - writer.uint32(18).string(v!); - } - if (message.nameField !== "") { - writer.uint32(26).string(message.nameField); - } - if (message.history !== ResourceDescriptor_History.HISTORY_UNSPECIFIED) { - writer.uint32(32).int32(resourceDescriptor_HistoryToNumber(message.history)); - } - if (message.plural !== "") { - writer.uint32(42).string(message.plural); - } - if (message.singular !== "") { - writer.uint32(50).string(message.singular); - } - writer.uint32(82).fork(); - for (const v of message.style) { - writer.int32(resourceDescriptor_StyleToNumber(v)); - } - writer.join(); - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ResourceDescriptor { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseResourceDescriptor(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.type = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.pattern.push(reader.string()); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.nameField = reader.string(); - continue; - } - case 4: { - if (tag !== 32) { - break; - } - - message.history = resourceDescriptor_HistoryFromJSON(reader.int32()); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.plural = reader.string(); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.singular = reader.string(); - continue; - } - case 10: { - if (tag === 80) { - message.style.push(resourceDescriptor_StyleFromJSON(reader.int32())); - - continue; - } - - if (tag === 82) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.style.push(resourceDescriptor_StyleFromJSON(reader.int32())); - } - - continue; - } - - break; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ResourceDescriptor { - return ResourceDescriptor.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ResourceDescriptor { - const message = createBaseResourceDescriptor(); - message.type = object.type ?? ""; - message.pattern = object.pattern?.map((e) => e) || []; - message.nameField = object.nameField ?? ""; - message.history = object.history ?? ResourceDescriptor_History.HISTORY_UNSPECIFIED; - message.plural = object.plural ?? ""; - message.singular = object.singular ?? ""; - message.style = object.style?.map((e) => e) || []; - return message; - }, -}; - -function createBaseResourceReference(): ResourceReference { - return { type: "", childType: "" }; -} - -export const ResourceReference: MessageFns = { - encode(message: ResourceReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.type !== "") { - writer.uint32(10).string(message.type); - } - if (message.childType !== "") { - writer.uint32(18).string(message.childType); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ResourceReference { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseResourceReference(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.type = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.childType = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ResourceReference { - return ResourceReference.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ResourceReference { - const message = createBaseResourceReference(); - message.type = object.type ?? ""; - message.childType = object.childType ?? ""; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/google/api/resource_pb.ts b/web/src/types/proto/google/api/resource_pb.ts new file mode 100644 index 000000000..dfbdced0c --- /dev/null +++ b/web/src/types/proto/google/api/resource_pb.ts @@ -0,0 +1,354 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.10.1 with parameter "target=ts" +// @generated from file google/api/resource.proto (package google.api, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenExtension, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, extDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import type { FieldOptions, FileOptions, MessageOptions } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_descriptor } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file google/api/resource.proto. + */ +export const file_google_api_resource: GenFile = /*@__PURE__*/ + fileDesc("Chlnb29nbGUvYXBpL3Jlc291cmNlLnByb3RvEgpnb29nbGUuYXBpIu4CChJSZXNvdXJjZURlc2NyaXB0b3ISDAoEdHlwZRgBIAEoCRIPCgdwYXR0ZXJuGAIgAygJEhIKCm5hbWVfZmllbGQYAyABKAkSNwoHaGlzdG9yeRgEIAEoDjImLmdvb2dsZS5hcGkuUmVzb3VyY2VEZXNjcmlwdG9yLkhpc3RvcnkSDgoGcGx1cmFsGAUgASgJEhAKCHNpbmd1bGFyGAYgASgJEjMKBXN0eWxlGAogAygOMiQuZ29vZ2xlLmFwaS5SZXNvdXJjZURlc2NyaXB0b3IuU3R5bGUiWwoHSGlzdG9yeRIXChNISVNUT1JZX1VOU1BFQ0lGSUVEEAASHQoZT1JJR0lOQUxMWV9TSU5HTEVfUEFUVEVSThABEhgKFEZVVFVSRV9NVUxUSV9QQVRURVJOEAIiOAoFU3R5bGUSFQoRU1RZTEVfVU5TUEVDSUZJRUQQABIYChRERUNMQVJBVElWRV9GUklFTkRMWRABIjUKEVJlc291cmNlUmVmZXJlbmNlEgwKBHR5cGUYASABKAkSEgoKY2hpbGRfdHlwZRgCIAEoCTpsChJyZXNvdXJjZV9yZWZlcmVuY2USHS5nb29nbGUucHJvdG9idWYuRmllbGRPcHRpb25zGJ8IIAEoCzIdLmdvb2dsZS5hcGkuUmVzb3VyY2VSZWZlcmVuY2VSEXJlc291cmNlUmVmZXJlbmNlOm4KE3Jlc291cmNlX2RlZmluaXRpb24SHC5nb29nbGUucHJvdG9idWYuRmlsZU9wdGlvbnMYnQggAygLMh4uZ29vZ2xlLmFwaS5SZXNvdXJjZURlc2NyaXB0b3JSEnJlc291cmNlRGVmaW5pdGlvbjpcCghyZXNvdXJjZRIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxidCCABKAsyHi5nb29nbGUuYXBpLlJlc291cmNlRGVzY3JpcHRvclIIcmVzb3VyY2VCqwEKDmNvbS5nb29nbGUuYXBpQg1SZXNvdXJjZVByb3RvUAFaQWdvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL2dvb2dsZWFwaXMvYXBpL2Fubm90YXRpb25zO2Fubm90YXRpb25zogIDR0FYqgIKR29vZ2xlLkFwacoCCkdvb2dsZVxBcGniAhZHb29nbGVcQXBpXEdQQk1ldGFkYXRh6gILR29vZ2xlOjpBcGliBnByb3RvMw", [file_google_protobuf_descriptor]); + +/** + * A simple descriptor of a resource type. + * + * ResourceDescriptor annotates a resource message (either by means of a + * protobuf annotation or use in the service config), and associates the + * resource's schema, the resource type, and the pattern of the resource name. + * + * Example: + * + * message Topic { + * // Indicates this message defines a resource schema. + * // Declares the resource type in the format of {service}/{kind}. + * // For Kubernetes resources, the format is {api group}/{kind}. + * option (google.api.resource) = { + * type: "pubsub.googleapis.com/Topic" + * pattern: "projects/{project}/topics/{topic}" + * }; + * } + * + * The ResourceDescriptor Yaml config will look like: + * + * resources: + * - type: "pubsub.googleapis.com/Topic" + * pattern: "projects/{project}/topics/{topic}" + * + * Sometimes, resources have multiple patterns, typically because they can + * live under multiple parents. + * + * Example: + * + * message LogEntry { + * option (google.api.resource) = { + * type: "logging.googleapis.com/LogEntry" + * pattern: "projects/{project}/logs/{log}" + * pattern: "folders/{folder}/logs/{log}" + * pattern: "organizations/{organization}/logs/{log}" + * pattern: "billingAccounts/{billing_account}/logs/{log}" + * }; + * } + * + * The ResourceDescriptor Yaml config will look like: + * + * resources: + * - type: 'logging.googleapis.com/LogEntry' + * pattern: "projects/{project}/logs/{log}" + * pattern: "folders/{folder}/logs/{log}" + * pattern: "organizations/{organization}/logs/{log}" + * pattern: "billingAccounts/{billing_account}/logs/{log}" + * + * @generated from message google.api.ResourceDescriptor + */ +export type ResourceDescriptor = Message<"google.api.ResourceDescriptor"> & { + /** + * The resource type. It must be in the format of + * {service_name}/{resource_type_kind}. The `resource_type_kind` must be + * singular and must not include version numbers. + * + * Example: `storage.googleapis.com/Bucket` + * + * The value of the resource_type_kind must follow the regular expression + * /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + * should use PascalCase (UpperCamelCase). The maximum number of + * characters allowed for the `resource_type_kind` is 100. + * + * @generated from field: string type = 1; + */ + type: string; + + /** + * Optional. The relative resource name pattern associated with this resource + * type. The DNS prefix of the full resource name shouldn't be specified here. + * + * The path pattern must follow the syntax, which aligns with HTTP binding + * syntax: + * + * Template = Segment { "/" Segment } ; + * Segment = LITERAL | Variable ; + * Variable = "{" LITERAL "}" ; + * + * Examples: + * + * - "projects/{project}/topics/{topic}" + * - "projects/{project}/knowledgeBases/{knowledge_base}" + * + * The components in braces correspond to the IDs for each resource in the + * hierarchy. It is expected that, if multiple patterns are provided, + * the same component name (e.g. "project") refers to IDs of the same + * type of resource. + * + * @generated from field: repeated string pattern = 2; + */ + pattern: string[]; + + /** + * Optional. The field on the resource that designates the resource name + * field. If omitted, this is assumed to be "name". + * + * @generated from field: string name_field = 3; + */ + nameField: string; + + /** + * Optional. The historical or future-looking state of the resource pattern. + * + * Example: + * + * // The InspectTemplate message originally only supported resource + * // names with organization, and project was added later. + * message InspectTemplate { + * option (google.api.resource) = { + * type: "dlp.googleapis.com/InspectTemplate" + * pattern: + * "organizations/{organization}/inspectTemplates/{inspect_template}" + * pattern: "projects/{project}/inspectTemplates/{inspect_template}" + * history: ORIGINALLY_SINGLE_PATTERN + * }; + * } + * + * @generated from field: google.api.ResourceDescriptor.History history = 4; + */ + history: ResourceDescriptor_History; + + /** + * The plural name used in the resource name and permission names, such as + * 'projects' for the resource name of 'projects/{project}' and the permission + * name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception + * to this is for Nested Collections that have stuttering names, as defined + * in [AIP-122](https://google.aip.dev/122#nested-collections), where the + * collection ID in the resource name pattern does not necessarily directly + * match the `plural` value. + * + * It is the same concept of the `plural` field in k8s CRD spec + * https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + * + * Note: The plural form is required even for singleton resources. See + * https://aip.dev/156 + * + * @generated from field: string plural = 5; + */ + plural: string; + + /** + * The same concept of the `singular` field in k8s CRD spec + * https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + * Such as "project" for the `resourcemanager.googleapis.com/Project` type. + * + * @generated from field: string singular = 6; + */ + singular: string; + + /** + * Style flag(s) for this resource. + * These indicate that a resource is expected to conform to a given + * style. See the specific style flags for additional information. + * + * @generated from field: repeated google.api.ResourceDescriptor.Style style = 10; + */ + style: ResourceDescriptor_Style[]; +}; + +/** + * Describes the message google.api.ResourceDescriptor. + * Use `create(ResourceDescriptorSchema)` to create a new message. + */ +export const ResourceDescriptorSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_resource, 0); + +/** + * A description of the historical or future-looking state of the + * resource pattern. + * + * @generated from enum google.api.ResourceDescriptor.History + */ +export enum ResourceDescriptor_History { + /** + * The "unset" value. + * + * @generated from enum value: HISTORY_UNSPECIFIED = 0; + */ + HISTORY_UNSPECIFIED = 0, + + /** + * The resource originally had one pattern and launched as such, and + * additional patterns were added later. + * + * @generated from enum value: ORIGINALLY_SINGLE_PATTERN = 1; + */ + ORIGINALLY_SINGLE_PATTERN = 1, + + /** + * The resource has one pattern, but the API owner expects to add more + * later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents + * that from being necessary once there are multiple patterns.) + * + * @generated from enum value: FUTURE_MULTI_PATTERN = 2; + */ + FUTURE_MULTI_PATTERN = 2, +} + +/** + * Describes the enum google.api.ResourceDescriptor.History. + */ +export const ResourceDescriptor_HistorySchema: GenEnum = /*@__PURE__*/ + enumDesc(file_google_api_resource, 0, 0); + +/** + * A flag representing a specific style that a resource claims to conform to. + * + * @generated from enum google.api.ResourceDescriptor.Style + */ +export enum ResourceDescriptor_Style { + /** + * The unspecified value. Do not use. + * + * @generated from enum value: STYLE_UNSPECIFIED = 0; + */ + STYLE_UNSPECIFIED = 0, + + /** + * This resource is intended to be "declarative-friendly". + * + * Declarative-friendly resources must be more strictly consistent, and + * setting this to true communicates to tools that this resource should + * adhere to declarative-friendly expectations. + * + * Note: This is used by the API linter (linter.aip.dev) to enable + * additional checks. + * + * @generated from enum value: DECLARATIVE_FRIENDLY = 1; + */ + DECLARATIVE_FRIENDLY = 1, +} + +/** + * Describes the enum google.api.ResourceDescriptor.Style. + */ +export const ResourceDescriptor_StyleSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_google_api_resource, 0, 1); + +/** + * Defines a proto annotation that describes a string field that refers to + * an API resource. + * + * @generated from message google.api.ResourceReference + */ +export type ResourceReference = Message<"google.api.ResourceReference"> & { + /** + * The resource type that the annotated field references. + * + * Example: + * + * message Subscription { + * string topic = 2 [(google.api.resource_reference) = { + * type: "pubsub.googleapis.com/Topic" + * }]; + * } + * + * Occasionally, a field may reference an arbitrary resource. In this case, + * APIs use the special value * in their resource reference. + * + * Example: + * + * message GetIamPolicyRequest { + * string resource = 2 [(google.api.resource_reference) = { + * type: "*" + * }]; + * } + * + * @generated from field: string type = 1; + */ + type: string; + + /** + * The resource type of a child collection that the annotated field + * references. This is useful for annotating the `parent` field that + * doesn't have a fixed resource type. + * + * Example: + * + * message ListLogEntriesRequest { + * string parent = 1 [(google.api.resource_reference) = { + * child_type: "logging.googleapis.com/LogEntry" + * }; + * } + * + * @generated from field: string child_type = 2; + */ + childType: string; +}; + +/** + * Describes the message google.api.ResourceReference. + * Use `create(ResourceReferenceSchema)` to create a new message. + */ +export const ResourceReferenceSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_google_api_resource, 1); + +/** + * An annotation that describes a resource reference, see + * [ResourceReference][]. + * + * @generated from extension: google.api.ResourceReference resource_reference = 1055; + */ +export const resource_reference: GenExtension = /*@__PURE__*/ + extDesc(file_google_api_resource, 0); + +/** + * An annotation that describes a resource definition without a corresponding + * message; see [ResourceDescriptor][]. + * + * @generated from extension: repeated google.api.ResourceDescriptor resource_definition = 1053; + */ +export const resource_definition: GenExtension = /*@__PURE__*/ + extDesc(file_google_api_resource, 1); + +/** + * An annotation that describes a resource definition, see + * [ResourceDescriptor][]. + * + * @generated from extension: google.api.ResourceDescriptor resource = 1053; + */ +export const resource: GenExtension = /*@__PURE__*/ + extDesc(file_google_api_resource, 2); + diff --git a/web/src/types/proto/google/protobuf/descriptor.ts b/web/src/types/proto/google/protobuf/descriptor.ts deleted file mode 100644 index db1d2d4a3..000000000 --- a/web/src/types/proto/google/protobuf/descriptor.ts +++ /dev/null @@ -1,5847 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: google/protobuf/descriptor.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; - -export const protobufPackage = "google.protobuf"; - -/** The full set of known editions. */ -export enum Edition { - /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ - EDITION_UNKNOWN = "EDITION_UNKNOWN", - /** - * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature - * was first introduced. This is effectively an "infinite past". - */ - EDITION_LEGACY = "EDITION_LEGACY", - /** - * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like - * distinct editions. These can't be used to specify the edition of proto - * files, but feature definitions must supply proto2/proto3 defaults for - * backwards compatibility. - */ - EDITION_PROTO2 = "EDITION_PROTO2", - EDITION_PROTO3 = "EDITION_PROTO3", - /** - * EDITION_2023 - Editions that have been released. The specific values are arbitrary and - * should not be depended on, but they will always be time-ordered for easy - * comparison. - */ - EDITION_2023 = "EDITION_2023", - EDITION_2024 = "EDITION_2024", - /** - * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be - * used or relied on outside of tests. - */ - EDITION_1_TEST_ONLY = "EDITION_1_TEST_ONLY", - EDITION_2_TEST_ONLY = "EDITION_2_TEST_ONLY", - EDITION_99997_TEST_ONLY = "EDITION_99997_TEST_ONLY", - EDITION_99998_TEST_ONLY = "EDITION_99998_TEST_ONLY", - EDITION_99999_TEST_ONLY = "EDITION_99999_TEST_ONLY", - /** - * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only - * ever be used by plugins that can expect to never require any changes to - * support a new edition. - */ - EDITION_MAX = "EDITION_MAX", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function editionFromJSON(object: any): Edition { - switch (object) { - case 0: - case "EDITION_UNKNOWN": - return Edition.EDITION_UNKNOWN; - case 900: - case "EDITION_LEGACY": - return Edition.EDITION_LEGACY; - case 998: - case "EDITION_PROTO2": - return Edition.EDITION_PROTO2; - case 999: - case "EDITION_PROTO3": - return Edition.EDITION_PROTO3; - case 1000: - case "EDITION_2023": - return Edition.EDITION_2023; - case 1001: - case "EDITION_2024": - return Edition.EDITION_2024; - case 1: - case "EDITION_1_TEST_ONLY": - return Edition.EDITION_1_TEST_ONLY; - case 2: - case "EDITION_2_TEST_ONLY": - return Edition.EDITION_2_TEST_ONLY; - case 99997: - case "EDITION_99997_TEST_ONLY": - return Edition.EDITION_99997_TEST_ONLY; - case 99998: - case "EDITION_99998_TEST_ONLY": - return Edition.EDITION_99998_TEST_ONLY; - case 99999: - case "EDITION_99999_TEST_ONLY": - return Edition.EDITION_99999_TEST_ONLY; - case 2147483647: - case "EDITION_MAX": - return Edition.EDITION_MAX; - case -1: - case "UNRECOGNIZED": - default: - return Edition.UNRECOGNIZED; - } -} - -export function editionToNumber(object: Edition): number { - switch (object) { - case Edition.EDITION_UNKNOWN: - return 0; - case Edition.EDITION_LEGACY: - return 900; - case Edition.EDITION_PROTO2: - return 998; - case Edition.EDITION_PROTO3: - return 999; - case Edition.EDITION_2023: - return 1000; - case Edition.EDITION_2024: - return 1001; - case Edition.EDITION_1_TEST_ONLY: - return 1; - case Edition.EDITION_2_TEST_ONLY: - return 2; - case Edition.EDITION_99997_TEST_ONLY: - return 99997; - case Edition.EDITION_99998_TEST_ONLY: - return 99998; - case Edition.EDITION_99999_TEST_ONLY: - return 99999; - case Edition.EDITION_MAX: - return 2147483647; - case Edition.UNRECOGNIZED: - default: - return -1; - } -} - -/** - * Describes the 'visibility' of a symbol with respect to the proto import - * system. Symbols can only be imported when the visibility rules do not prevent - * it (ex: local symbols cannot be imported). Visibility modifiers can only set - * on `message` and `enum` as they are the only types available to be referenced - * from other files. - */ -export enum SymbolVisibility { - VISIBILITY_UNSET = "VISIBILITY_UNSET", - VISIBILITY_LOCAL = "VISIBILITY_LOCAL", - VISIBILITY_EXPORT = "VISIBILITY_EXPORT", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function symbolVisibilityFromJSON(object: any): SymbolVisibility { - switch (object) { - case 0: - case "VISIBILITY_UNSET": - return SymbolVisibility.VISIBILITY_UNSET; - case 1: - case "VISIBILITY_LOCAL": - return SymbolVisibility.VISIBILITY_LOCAL; - case 2: - case "VISIBILITY_EXPORT": - return SymbolVisibility.VISIBILITY_EXPORT; - case -1: - case "UNRECOGNIZED": - default: - return SymbolVisibility.UNRECOGNIZED; - } -} - -export function symbolVisibilityToNumber(object: SymbolVisibility): number { - switch (object) { - case SymbolVisibility.VISIBILITY_UNSET: - return 0; - case SymbolVisibility.VISIBILITY_LOCAL: - return 1; - case SymbolVisibility.VISIBILITY_EXPORT: - return 2; - case SymbolVisibility.UNRECOGNIZED: - default: - return -1; - } -} - -/** - * The protocol compiler can output a FileDescriptorSet containing the .proto - * files it parses. - */ -export interface FileDescriptorSet { - file: FileDescriptorProto[]; -} - -/** Describes a complete .proto file. */ -export interface FileDescriptorProto { - /** file name, relative to root of source tree */ - name?: - | string - | undefined; - /** e.g. "foo", "foo.bar", etc. */ - package?: - | string - | undefined; - /** Names of files imported by this file. */ - dependency: string[]; - /** Indexes of the public imported files in the dependency list above. */ - publicDependency: number[]; - /** - * Indexes of the weak imported files in the dependency list. - * For Google-internal migration only. Do not use. - */ - weakDependency: number[]; - /** - * Names of files imported by this file purely for the purpose of providing - * option extensions. These are excluded from the dependency list above. - */ - optionDependency: string[]; - /** All top-level definitions in this file. */ - messageType: DescriptorProto[]; - enumType: EnumDescriptorProto[]; - service: ServiceDescriptorProto[]; - extension: FieldDescriptorProto[]; - options?: - | FileOptions - | undefined; - /** - * This field contains optional information about the original source code. - * You may safely remove this entire field without harming runtime - * functionality of the descriptors -- the information is needed only by - * development tools. - */ - sourceCodeInfo?: - | SourceCodeInfo - | undefined; - /** - * The syntax of the proto file. - * The supported values are "proto2", "proto3", and "editions". - * - * If `edition` is present, this value must be "editions". - * WARNING: This field should only be used by protobuf plugins or special - * cases like the proto compiler. Other uses are discouraged and - * developers should rely on the protoreflect APIs for their client language. - */ - syntax?: - | string - | undefined; - /** - * The edition of the proto file. - * WARNING: This field should only be used by protobuf plugins or special - * cases like the proto compiler. Other uses are discouraged and - * developers should rely on the protoreflect APIs for their client language. - */ - edition?: Edition | undefined; -} - -/** Describes a message type. */ -export interface DescriptorProto { - name?: string | undefined; - field: FieldDescriptorProto[]; - extension: FieldDescriptorProto[]; - nestedType: DescriptorProto[]; - enumType: EnumDescriptorProto[]; - extensionRange: DescriptorProto_ExtensionRange[]; - oneofDecl: OneofDescriptorProto[]; - options?: MessageOptions | undefined; - reservedRange: DescriptorProto_ReservedRange[]; - /** - * Reserved field names, which may not be used by fields in the same message. - * A given name may only be reserved once. - */ - reservedName: string[]; - /** Support for `export` and `local` keywords on enums. */ - visibility?: SymbolVisibility | undefined; -} - -export interface DescriptorProto_ExtensionRange { - /** Inclusive. */ - start?: - | number - | undefined; - /** Exclusive. */ - end?: number | undefined; - options?: ExtensionRangeOptions | undefined; -} - -/** - * Range of reserved tag numbers. Reserved tag numbers may not be used by - * fields or extension ranges in the same message. Reserved ranges may - * not overlap. - */ -export interface DescriptorProto_ReservedRange { - /** Inclusive. */ - start?: - | number - | undefined; - /** Exclusive. */ - end?: number | undefined; -} - -export interface ExtensionRangeOptions { - /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; - /** - * For external users: DO NOT USE. We are in the process of open sourcing - * extension declaration and executing internal cleanups before it can be - * used externally. - */ - declaration: ExtensionRangeOptions_Declaration[]; - /** Any features defined in the specific edition. */ - features?: - | FeatureSet - | undefined; - /** - * The verification state of the range. - * TODO: flip the default to DECLARATION once all empty ranges - * are marked as UNVERIFIED. - */ - verification?: ExtensionRangeOptions_VerificationState | undefined; -} - -/** The verification state of the extension range. */ -export enum ExtensionRangeOptions_VerificationState { - /** DECLARATION - All the extensions of the range must be declared. */ - DECLARATION = "DECLARATION", - UNVERIFIED = "UNVERIFIED", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { - switch (object) { - case 0: - case "DECLARATION": - return ExtensionRangeOptions_VerificationState.DECLARATION; - case 1: - case "UNVERIFIED": - return ExtensionRangeOptions_VerificationState.UNVERIFIED; - case -1: - case "UNRECOGNIZED": - default: - return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; - } -} - -export function extensionRangeOptions_VerificationStateToNumber( - object: ExtensionRangeOptions_VerificationState, -): number { - switch (object) { - case ExtensionRangeOptions_VerificationState.DECLARATION: - return 0; - case ExtensionRangeOptions_VerificationState.UNVERIFIED: - return 1; - case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: - default: - return -1; - } -} - -export interface ExtensionRangeOptions_Declaration { - /** The extension number declared within the extension range. */ - number?: - | number - | undefined; - /** - * The fully-qualified name of the extension field. There must be a leading - * dot in front of the full name. - */ - fullName?: - | string - | undefined; - /** - * The fully-qualified type name of the extension field. Unlike - * Metadata.type, Declaration.type must have a leading dot for messages - * and enums. - */ - type?: - | string - | undefined; - /** - * If true, indicates that the number is reserved in the extension range, - * and any extension field with the number will fail to compile. Set this - * when a declared extension field is deleted. - */ - reserved?: - | boolean - | undefined; - /** - * If true, indicates that the extension must be defined as repeated. - * Otherwise the extension must be defined as optional. - */ - repeated?: boolean | undefined; -} - -/** Describes a field within a message. */ -export interface FieldDescriptorProto { - name?: string | undefined; - number?: number | undefined; - label?: - | FieldDescriptorProto_Label - | undefined; - /** - * If type_name is set, this need not be set. If both this and type_name - * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - */ - type?: - | FieldDescriptorProto_Type - | undefined; - /** - * For message and enum types, this is the name of the type. If the name - * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - * rules are used to find the type (i.e. first the nested types within this - * message are searched, then within the parent, on up to the root - * namespace). - */ - typeName?: - | string - | undefined; - /** - * For extensions, this is the name of the type being extended. It is - * resolved in the same manner as type_name. - */ - extendee?: - | string - | undefined; - /** - * For numeric types, contains the original text representation of the value. - * For booleans, "true" or "false". - * For strings, contains the default text contents (not escaped in any way). - * For bytes, contains the C escaped value. All bytes >= 128 are escaped. - */ - defaultValue?: - | string - | undefined; - /** - * If set, gives the index of a oneof in the containing type's oneof_decl - * list. This field is a member of that oneof. - */ - oneofIndex?: - | number - | undefined; - /** - * JSON name of this field. The value is set by protocol compiler. If the - * user has set a "json_name" option on this field, that option's value - * will be used. Otherwise, it's deduced from the field's name by converting - * it to camelCase. - */ - jsonName?: string | undefined; - options?: - | FieldOptions - | undefined; - /** - * If true, this is a proto3 "optional". When a proto3 field is optional, it - * tracks presence regardless of field type. - * - * When proto3_optional is true, this field must belong to a oneof to signal - * to old proto3 clients that presence is tracked for this field. This oneof - * is known as a "synthetic" oneof, and this field must be its sole member - * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs - * exist in the descriptor only, and do not generate any API. Synthetic oneofs - * must be ordered after all "real" oneofs. - * - * For message fields, proto3_optional doesn't create any semantic change, - * since non-repeated message fields always track presence. However it still - * indicates the semantic detail of whether the user wrote "optional" or not. - * This can be useful for round-tripping the .proto file. For consistency we - * give message fields a synthetic oneof also, even though it is not required - * to track presence. This is especially important because the parser can't - * tell if a field is a message or an enum, so it must always create a - * synthetic oneof. - * - * Proto2 optional fields do not set this flag, because they already indicate - * optional with `LABEL_OPTIONAL`. - */ - proto3Optional?: boolean | undefined; -} - -export enum FieldDescriptorProto_Type { - /** - * TYPE_DOUBLE - 0 is reserved for errors. - * Order is weird for historical reasons. - */ - TYPE_DOUBLE = "TYPE_DOUBLE", - TYPE_FLOAT = "TYPE_FLOAT", - /** - * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - * negative values are likely. - */ - TYPE_INT64 = "TYPE_INT64", - TYPE_UINT64 = "TYPE_UINT64", - /** - * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - * negative values are likely. - */ - TYPE_INT32 = "TYPE_INT32", - TYPE_FIXED64 = "TYPE_FIXED64", - TYPE_FIXED32 = "TYPE_FIXED32", - TYPE_BOOL = "TYPE_BOOL", - TYPE_STRING = "TYPE_STRING", - /** - * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported after google.protobuf. However, Proto3 - * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. In Editions, the group wire format - * can be enabled via the `message_encoding` feature. - */ - TYPE_GROUP = "TYPE_GROUP", - /** TYPE_MESSAGE - Length-delimited aggregate. */ - TYPE_MESSAGE = "TYPE_MESSAGE", - /** TYPE_BYTES - New in version 2. */ - TYPE_BYTES = "TYPE_BYTES", - TYPE_UINT32 = "TYPE_UINT32", - TYPE_ENUM = "TYPE_ENUM", - TYPE_SFIXED32 = "TYPE_SFIXED32", - TYPE_SFIXED64 = "TYPE_SFIXED64", - /** TYPE_SINT32 - Uses ZigZag encoding. */ - TYPE_SINT32 = "TYPE_SINT32", - /** TYPE_SINT64 - Uses ZigZag encoding. */ - TYPE_SINT64 = "TYPE_SINT64", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function fieldDescriptorProto_TypeFromJSON(object: any): FieldDescriptorProto_Type { - switch (object) { - case 1: - case "TYPE_DOUBLE": - return FieldDescriptorProto_Type.TYPE_DOUBLE; - case 2: - case "TYPE_FLOAT": - return FieldDescriptorProto_Type.TYPE_FLOAT; - case 3: - case "TYPE_INT64": - return FieldDescriptorProto_Type.TYPE_INT64; - case 4: - case "TYPE_UINT64": - return FieldDescriptorProto_Type.TYPE_UINT64; - case 5: - case "TYPE_INT32": - return FieldDescriptorProto_Type.TYPE_INT32; - case 6: - case "TYPE_FIXED64": - return FieldDescriptorProto_Type.TYPE_FIXED64; - case 7: - case "TYPE_FIXED32": - return FieldDescriptorProto_Type.TYPE_FIXED32; - case 8: - case "TYPE_BOOL": - return FieldDescriptorProto_Type.TYPE_BOOL; - case 9: - case "TYPE_STRING": - return FieldDescriptorProto_Type.TYPE_STRING; - case 10: - case "TYPE_GROUP": - return FieldDescriptorProto_Type.TYPE_GROUP; - case 11: - case "TYPE_MESSAGE": - return FieldDescriptorProto_Type.TYPE_MESSAGE; - case 12: - case "TYPE_BYTES": - return FieldDescriptorProto_Type.TYPE_BYTES; - case 13: - case "TYPE_UINT32": - return FieldDescriptorProto_Type.TYPE_UINT32; - case 14: - case "TYPE_ENUM": - return FieldDescriptorProto_Type.TYPE_ENUM; - case 15: - case "TYPE_SFIXED32": - return FieldDescriptorProto_Type.TYPE_SFIXED32; - case 16: - case "TYPE_SFIXED64": - return FieldDescriptorProto_Type.TYPE_SFIXED64; - case 17: - case "TYPE_SINT32": - return FieldDescriptorProto_Type.TYPE_SINT32; - case 18: - case "TYPE_SINT64": - return FieldDescriptorProto_Type.TYPE_SINT64; - case -1: - case "UNRECOGNIZED": - default: - return FieldDescriptorProto_Type.UNRECOGNIZED; - } -} - -export function fieldDescriptorProto_TypeToNumber(object: FieldDescriptorProto_Type): number { - switch (object) { - case FieldDescriptorProto_Type.TYPE_DOUBLE: - return 1; - case FieldDescriptorProto_Type.TYPE_FLOAT: - return 2; - case FieldDescriptorProto_Type.TYPE_INT64: - return 3; - case FieldDescriptorProto_Type.TYPE_UINT64: - return 4; - case FieldDescriptorProto_Type.TYPE_INT32: - return 5; - case FieldDescriptorProto_Type.TYPE_FIXED64: - return 6; - case FieldDescriptorProto_Type.TYPE_FIXED32: - return 7; - case FieldDescriptorProto_Type.TYPE_BOOL: - return 8; - case FieldDescriptorProto_Type.TYPE_STRING: - return 9; - case FieldDescriptorProto_Type.TYPE_GROUP: - return 10; - case FieldDescriptorProto_Type.TYPE_MESSAGE: - return 11; - case FieldDescriptorProto_Type.TYPE_BYTES: - return 12; - case FieldDescriptorProto_Type.TYPE_UINT32: - return 13; - case FieldDescriptorProto_Type.TYPE_ENUM: - return 14; - case FieldDescriptorProto_Type.TYPE_SFIXED32: - return 15; - case FieldDescriptorProto_Type.TYPE_SFIXED64: - return 16; - case FieldDescriptorProto_Type.TYPE_SINT32: - return 17; - case FieldDescriptorProto_Type.TYPE_SINT64: - return 18; - case FieldDescriptorProto_Type.UNRECOGNIZED: - default: - return -1; - } -} - -export enum FieldDescriptorProto_Label { - /** LABEL_OPTIONAL - 0 is reserved for errors */ - LABEL_OPTIONAL = "LABEL_OPTIONAL", - LABEL_REPEATED = "LABEL_REPEATED", - /** - * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions - * it's explicitly prohibited. In Editions, the `field_presence` feature - * can be used to get this behavior. - */ - LABEL_REQUIRED = "LABEL_REQUIRED", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label { - switch (object) { - case 1: - case "LABEL_OPTIONAL": - return FieldDescriptorProto_Label.LABEL_OPTIONAL; - case 3: - case "LABEL_REPEATED": - return FieldDescriptorProto_Label.LABEL_REPEATED; - case 2: - case "LABEL_REQUIRED": - return FieldDescriptorProto_Label.LABEL_REQUIRED; - case -1: - case "UNRECOGNIZED": - default: - return FieldDescriptorProto_Label.UNRECOGNIZED; - } -} - -export function fieldDescriptorProto_LabelToNumber(object: FieldDescriptorProto_Label): number { - switch (object) { - case FieldDescriptorProto_Label.LABEL_OPTIONAL: - return 1; - case FieldDescriptorProto_Label.LABEL_REPEATED: - return 3; - case FieldDescriptorProto_Label.LABEL_REQUIRED: - return 2; - case FieldDescriptorProto_Label.UNRECOGNIZED: - default: - return -1; - } -} - -/** Describes a oneof. */ -export interface OneofDescriptorProto { - name?: string | undefined; - options?: OneofOptions | undefined; -} - -/** Describes an enum type. */ -export interface EnumDescriptorProto { - name?: string | undefined; - value: EnumValueDescriptorProto[]; - options?: - | EnumOptions - | undefined; - /** - * Range of reserved numeric values. Reserved numeric values may not be used - * by enum values in the same enum declaration. Reserved ranges may not - * overlap. - */ - reservedRange: EnumDescriptorProto_EnumReservedRange[]; - /** - * Reserved enum value names, which may not be reused. A given name may only - * be reserved once. - */ - reservedName: string[]; - /** Support for `export` and `local` keywords on enums. */ - visibility?: SymbolVisibility | undefined; -} - -/** - * Range of reserved numeric values. Reserved values may not be used by - * entries in the same enum. Reserved ranges may not overlap. - * - * Note that this is distinct from DescriptorProto.ReservedRange in that it - * is inclusive such that it can appropriately represent the entire int32 - * domain. - */ -export interface EnumDescriptorProto_EnumReservedRange { - /** Inclusive. */ - start?: - | number - | undefined; - /** Inclusive. */ - end?: number | undefined; -} - -/** Describes a value within an enum. */ -export interface EnumValueDescriptorProto { - name?: string | undefined; - number?: number | undefined; - options?: EnumValueOptions | undefined; -} - -/** Describes a service. */ -export interface ServiceDescriptorProto { - name?: string | undefined; - method: MethodDescriptorProto[]; - options?: ServiceOptions | undefined; -} - -/** Describes a method of a service. */ -export interface MethodDescriptorProto { - name?: - | string - | undefined; - /** - * Input and output type names. These are resolved in the same way as - * FieldDescriptorProto.type_name, but must refer to a message type. - */ - inputType?: string | undefined; - outputType?: string | undefined; - options?: - | MethodOptions - | undefined; - /** Identifies if client streams multiple client messages */ - clientStreaming?: - | boolean - | undefined; - /** Identifies if server streams multiple server messages */ - serverStreaming?: boolean | undefined; -} - -export interface FileOptions { - /** - * Sets the Java package where classes generated from this .proto will be - * placed. By default, the proto package is used, but this is often - * inappropriate because proto packages do not normally start with backwards - * domain names. - */ - javaPackage?: - | string - | undefined; - /** - * Controls the name of the wrapper Java class generated for the .proto file. - * That class will always contain the .proto file's getDescriptor() method as - * well as any top-level extensions defined in the .proto file. - * If java_multiple_files is disabled, then all the other classes from the - * .proto file will be nested inside the single wrapper outer class. - */ - javaOuterClassname?: - | string - | undefined; - /** - * If enabled, then the Java code generator will generate a separate .java - * file for each top-level message, enum, and service defined in the .proto - * file. Thus, these types will *not* be nested inside the wrapper class - * named by java_outer_classname. However, the wrapper class will still be - * generated to contain the file's getDescriptor() method as well as any - * top-level extensions defined in the file. - */ - javaMultipleFiles?: - | boolean - | undefined; - /** - * This option does nothing. - * - * @deprecated - */ - javaGenerateEqualsAndHash?: - | boolean - | undefined; - /** - * A proto2 file can set this to true to opt in to UTF-8 checking for Java, - * which will throw an exception if invalid UTF-8 is parsed from the wire or - * assigned to a string field. - * - * TODO: clarify exactly what kinds of field types this option - * applies to, and update these docs accordingly. - * - * Proto3 files already perform these checks. Setting the option explicitly to - * false has no effect: it cannot be used to opt proto3 files out of UTF-8 - * checks. - */ - javaStringCheckUtf8?: boolean | undefined; - optimizeFor?: - | FileOptions_OptimizeMode - | undefined; - /** - * Sets the Go package where structs generated from this .proto will be - * placed. If omitted, the Go package will be derived from the following: - * - The basename of the package import path, if provided. - * - Otherwise, the package statement in the .proto file, if present. - * - Otherwise, the basename of the .proto file, without extension. - */ - goPackage?: - | string - | undefined; - /** - * Should generic services be generated in each language? "Generic" services - * are not specific to any particular RPC system. They are generated by the - * main code generators in each language (without additional plugins). - * Generic services were the only kind of service generation supported by - * early versions of google.protobuf. - * - * Generic services are now considered deprecated in favor of using plugins - * that generate code specific to your particular RPC system. Therefore, - * these default to false. Old code which depends on generic services should - * explicitly set them to true. - */ - ccGenericServices?: boolean | undefined; - javaGenericServices?: boolean | undefined; - pyGenericServices?: - | boolean - | undefined; - /** - * Is this file deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for everything in the file, or it will be completely ignored; in the very - * least, this is a formalization for deprecating files. - */ - deprecated?: - | boolean - | undefined; - /** - * Enables the use of arenas for the proto messages in this file. This applies - * only to generated classes for C++. - */ - ccEnableArenas?: - | boolean - | undefined; - /** - * Sets the objective c class prefix which is prepended to all objective c - * generated classes from this .proto. There is no default. - */ - objcClassPrefix?: - | string - | undefined; - /** Namespace for generated classes; defaults to the package. */ - csharpNamespace?: - | string - | undefined; - /** - * By default Swift generators will take the proto package and CamelCase it - * replacing '.' with underscore and use that to prefix the types/symbols - * defined. When this options is provided, they will use this value instead - * to prefix the types/symbols defined. - */ - swiftPrefix?: - | string - | undefined; - /** - * Sets the php class prefix which is prepended to all php generated classes - * from this .proto. Default is empty. - */ - phpClassPrefix?: - | string - | undefined; - /** - * Use this option to change the namespace of php generated classes. Default - * is empty. When this option is empty, the package name will be used for - * determining the namespace. - */ - phpNamespace?: - | string - | undefined; - /** - * Use this option to change the namespace of php generated metadata classes. - * Default is empty. When this option is empty, the proto file name will be - * used for determining the namespace. - */ - phpMetadataNamespace?: - | string - | undefined; - /** - * Use this option to change the package of ruby generated classes. Default - * is empty. When this option is not set, the package name will be used for - * determining the ruby package. - */ - rubyPackage?: - | string - | undefined; - /** - * Any features defined in the specific edition. - * WARNING: This field should only be used by protobuf plugins or special - * cases like the proto compiler. Other uses are discouraged and - * developers should rely on the protoreflect APIs for their client language. - */ - features?: - | FeatureSet - | undefined; - /** - * The parser stores options it doesn't recognize here. - * See the documentation for the "Options" section above. - */ - uninterpretedOption: UninterpretedOption[]; -} - -/** Generated classes can be optimized for speed or code size. */ -export enum FileOptions_OptimizeMode { - /** SPEED - Generate complete code for parsing, serialization, */ - SPEED = "SPEED", - /** CODE_SIZE - etc. */ - CODE_SIZE = "CODE_SIZE", - /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ - LITE_RUNTIME = "LITE_RUNTIME", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function fileOptions_OptimizeModeFromJSON(object: any): FileOptions_OptimizeMode { - switch (object) { - case 1: - case "SPEED": - return FileOptions_OptimizeMode.SPEED; - case 2: - case "CODE_SIZE": - return FileOptions_OptimizeMode.CODE_SIZE; - case 3: - case "LITE_RUNTIME": - return FileOptions_OptimizeMode.LITE_RUNTIME; - case -1: - case "UNRECOGNIZED": - default: - return FileOptions_OptimizeMode.UNRECOGNIZED; - } -} - -export function fileOptions_OptimizeModeToNumber(object: FileOptions_OptimizeMode): number { - switch (object) { - case FileOptions_OptimizeMode.SPEED: - return 1; - case FileOptions_OptimizeMode.CODE_SIZE: - return 2; - case FileOptions_OptimizeMode.LITE_RUNTIME: - return 3; - case FileOptions_OptimizeMode.UNRECOGNIZED: - default: - return -1; - } -} - -export interface MessageOptions { - /** - * Set true to use the old proto1 MessageSet wire format for extensions. - * This is provided for backwards-compatibility with the MessageSet wire - * format. You should not use this for any other reason: It's less - * efficient, has fewer features, and is more complicated. - * - * The message must be defined exactly as follows: - * message Foo { - * option message_set_wire_format = true; - * extensions 4 to max; - * } - * Note that the message cannot have any defined fields; MessageSets only - * have extensions. - * - * All extensions of your type must be singular messages; e.g. they cannot - * be int32s, enums, or repeated messages. - * - * Because this is an option, the above two restrictions are not enforced by - * the protocol compiler. - */ - messageSetWireFormat?: - | boolean - | undefined; - /** - * Disables the generation of the standard "descriptor()" accessor, which can - * conflict with a field of the same name. This is meant to make migration - * from proto1 easier; new code should avoid fields named "descriptor". - */ - noStandardDescriptorAccessor?: - | boolean - | undefined; - /** - * Is this message deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the message, or it will be completely ignored; in the very least, - * this is a formalization for deprecating messages. - */ - deprecated?: - | boolean - | undefined; - /** - * Whether the message is an automatically generated map entry type for the - * maps field. - * - * For maps fields: - * map map_field = 1; - * The parsed descriptor looks like: - * message MapFieldEntry { - * option map_entry = true; - * optional KeyType key = 1; - * optional ValueType value = 2; - * } - * repeated MapFieldEntry map_field = 1; - * - * Implementations may choose not to generate the map_entry=true message, but - * use a native map in the target language to hold the keys and values. - * The reflection APIs in such implementations still need to work as - * if the field is a repeated message field. - * - * NOTE: Do not set the option in .proto files. Always use the maps syntax - * instead. The option should only be implicitly set by the proto compiler - * parser. - */ - mapEntry?: - | boolean - | undefined; - /** - * Enable the legacy handling of JSON field name conflicts. This lowercases - * and strips underscored from the fields before comparison in proto3 only. - * The new behavior takes `json_name` into account and applies to proto2 as - * well. - * - * This should only be used as a temporary measure against broken builds due - * to the change in behavior for JSON field name conflicts. - * - * TODO This is legacy behavior we plan to remove once downstream - * teams have had time to migrate. - * - * @deprecated - */ - deprecatedLegacyJsonFieldConflicts?: - | boolean - | undefined; - /** - * Any features defined in the specific edition. - * WARNING: This field should only be used by protobuf plugins or special - * cases like the proto compiler. Other uses are discouraged and - * developers should rely on the protoreflect APIs for their client language. - */ - features?: - | FeatureSet - | undefined; - /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; -} - -export interface FieldOptions { - /** - * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. - * The ctype option instructs the C++ code generator to use a different - * representation of the field than it normally would. See the specific - * options below. This option is only implemented to support use of - * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of - * type "bytes" in the open source release. - * TODO: make ctype actually deprecated. - */ - ctype?: - | FieldOptions_CType - | undefined; - /** - * The packed option can be enabled for repeated primitive fields to enable - * a more efficient representation on the wire. Rather than repeatedly - * writing the tag and type for each element, the entire array is encoded as - * a single length-delimited blob. In proto3, only explicit setting it to - * false will avoid using packed encoding. This option is prohibited in - * Editions, but the `repeated_field_encoding` feature can be used to control - * the behavior. - */ - packed?: - | boolean - | undefined; - /** - * The jstype option determines the JavaScript type used for values of the - * field. The option is permitted only for 64 bit integral and fixed types - * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - * is represented as JavaScript string, which avoids loss of precision that - * can happen when a large value is converted to a floating point JavaScript. - * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - * use the JavaScript "number" type. The behavior of the default option - * JS_NORMAL is implementation dependent. - * - * This option is an enum to permit additional types to be added, e.g. - * goog.math.Integer. - */ - jstype?: - | FieldOptions_JSType - | undefined; - /** - * Should this field be parsed lazily? Lazy applies only to message-type - * fields. It means that when the outer message is initially parsed, the - * inner message's contents will not be parsed but instead stored in encoded - * form. The inner message will actually be parsed when it is first accessed. - * - * This is only a hint. Implementations are free to choose whether to use - * eager or lazy parsing regardless of the value of this option. However, - * setting this option true suggests that the protocol author believes that - * using lazy parsing on this field is worth the additional bookkeeping - * overhead typically needed to implement it. - * - * This option does not affect the public interface of any generated code; - * all method signatures remain the same. Furthermore, thread-safety of the - * interface is not affected by this option; const methods remain safe to - * call from multiple threads concurrently, while non-const methods continue - * to require exclusive access. - * - * Note that lazy message fields are still eagerly verified to check - * ill-formed wireformat or missing required fields. Calling IsInitialized() - * on the outer message would fail if the inner message has missing required - * fields. Failed verification would result in parsing failure (except when - * uninitialized messages are acceptable). - */ - lazy?: - | boolean - | undefined; - /** - * unverified_lazy does no correctness checks on the byte stream. This should - * only be used where lazy with verification is prohibitive for performance - * reasons. - */ - unverifiedLazy?: - | boolean - | undefined; - /** - * Is this field deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for accessors, or it will be completely ignored; in the very least, this - * is a formalization for deprecating fields. - */ - deprecated?: - | boolean - | undefined; - /** For Google-internal migration only. Do not use. */ - weak?: - | boolean - | undefined; - /** - * Indicate that the field value should not be printed out when using debug - * formats, e.g. when the field contains sensitive credentials. - */ - debugRedact?: boolean | undefined; - retention?: FieldOptions_OptionRetention | undefined; - targets: FieldOptions_OptionTargetType[]; - editionDefaults: FieldOptions_EditionDefault[]; - /** - * Any features defined in the specific edition. - * WARNING: This field should only be used by protobuf plugins or special - * cases like the proto compiler. Other uses are discouraged and - * developers should rely on the protoreflect APIs for their client language. - */ - features?: FeatureSet | undefined; - featureSupport?: - | FieldOptions_FeatureSupport - | undefined; - /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; -} - -export enum FieldOptions_CType { - /** STRING - Default mode. */ - STRING = "STRING", - /** - * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type - * "bytes". It indicates that in C++, the data should be stored in a Cord - * instead of a string. For very large strings, this may reduce memory - * fragmentation. It may also allow better performance when parsing from a - * Cord, or when parsing with aliasing enabled, as the parsed Cord may then - * alias the original buffer. - */ - CORD = "CORD", - STRING_PIECE = "STRING_PIECE", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function fieldOptions_CTypeFromJSON(object: any): FieldOptions_CType { - switch (object) { - case 0: - case "STRING": - return FieldOptions_CType.STRING; - case 1: - case "CORD": - return FieldOptions_CType.CORD; - case 2: - case "STRING_PIECE": - return FieldOptions_CType.STRING_PIECE; - case -1: - case "UNRECOGNIZED": - default: - return FieldOptions_CType.UNRECOGNIZED; - } -} - -export function fieldOptions_CTypeToNumber(object: FieldOptions_CType): number { - switch (object) { - case FieldOptions_CType.STRING: - return 0; - case FieldOptions_CType.CORD: - return 1; - case FieldOptions_CType.STRING_PIECE: - return 2; - case FieldOptions_CType.UNRECOGNIZED: - default: - return -1; - } -} - -export enum FieldOptions_JSType { - /** JS_NORMAL - Use the default type. */ - JS_NORMAL = "JS_NORMAL", - /** JS_STRING - Use JavaScript strings. */ - JS_STRING = "JS_STRING", - /** JS_NUMBER - Use JavaScript numbers. */ - JS_NUMBER = "JS_NUMBER", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function fieldOptions_JSTypeFromJSON(object: any): FieldOptions_JSType { - switch (object) { - case 0: - case "JS_NORMAL": - return FieldOptions_JSType.JS_NORMAL; - case 1: - case "JS_STRING": - return FieldOptions_JSType.JS_STRING; - case 2: - case "JS_NUMBER": - return FieldOptions_JSType.JS_NUMBER; - case -1: - case "UNRECOGNIZED": - default: - return FieldOptions_JSType.UNRECOGNIZED; - } -} - -export function fieldOptions_JSTypeToNumber(object: FieldOptions_JSType): number { - switch (object) { - case FieldOptions_JSType.JS_NORMAL: - return 0; - case FieldOptions_JSType.JS_STRING: - return 1; - case FieldOptions_JSType.JS_NUMBER: - return 2; - case FieldOptions_JSType.UNRECOGNIZED: - default: - return -1; - } -} - -/** If set to RETENTION_SOURCE, the option will be omitted from the binary. */ -export enum FieldOptions_OptionRetention { - RETENTION_UNKNOWN = "RETENTION_UNKNOWN", - RETENTION_RUNTIME = "RETENTION_RUNTIME", - RETENTION_SOURCE = "RETENTION_SOURCE", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { - switch (object) { - case 0: - case "RETENTION_UNKNOWN": - return FieldOptions_OptionRetention.RETENTION_UNKNOWN; - case 1: - case "RETENTION_RUNTIME": - return FieldOptions_OptionRetention.RETENTION_RUNTIME; - case 2: - case "RETENTION_SOURCE": - return FieldOptions_OptionRetention.RETENTION_SOURCE; - case -1: - case "UNRECOGNIZED": - default: - return FieldOptions_OptionRetention.UNRECOGNIZED; - } -} - -export function fieldOptions_OptionRetentionToNumber(object: FieldOptions_OptionRetention): number { - switch (object) { - case FieldOptions_OptionRetention.RETENTION_UNKNOWN: - return 0; - case FieldOptions_OptionRetention.RETENTION_RUNTIME: - return 1; - case FieldOptions_OptionRetention.RETENTION_SOURCE: - return 2; - case FieldOptions_OptionRetention.UNRECOGNIZED: - default: - return -1; - } -} - -/** - * This indicates the types of entities that the field may apply to when used - * as an option. If it is unset, then the field may be freely used as an - * option on any kind of entity. - */ -export enum FieldOptions_OptionTargetType { - TARGET_TYPE_UNKNOWN = "TARGET_TYPE_UNKNOWN", - TARGET_TYPE_FILE = "TARGET_TYPE_FILE", - TARGET_TYPE_EXTENSION_RANGE = "TARGET_TYPE_EXTENSION_RANGE", - TARGET_TYPE_MESSAGE = "TARGET_TYPE_MESSAGE", - TARGET_TYPE_FIELD = "TARGET_TYPE_FIELD", - TARGET_TYPE_ONEOF = "TARGET_TYPE_ONEOF", - TARGET_TYPE_ENUM = "TARGET_TYPE_ENUM", - TARGET_TYPE_ENUM_ENTRY = "TARGET_TYPE_ENUM_ENTRY", - TARGET_TYPE_SERVICE = "TARGET_TYPE_SERVICE", - TARGET_TYPE_METHOD = "TARGET_TYPE_METHOD", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { - switch (object) { - case 0: - case "TARGET_TYPE_UNKNOWN": - return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; - case 1: - case "TARGET_TYPE_FILE": - return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; - case 2: - case "TARGET_TYPE_EXTENSION_RANGE": - return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; - case 3: - case "TARGET_TYPE_MESSAGE": - return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; - case 4: - case "TARGET_TYPE_FIELD": - return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; - case 5: - case "TARGET_TYPE_ONEOF": - return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; - case 6: - case "TARGET_TYPE_ENUM": - return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; - case 7: - case "TARGET_TYPE_ENUM_ENTRY": - return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; - case 8: - case "TARGET_TYPE_SERVICE": - return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; - case 9: - case "TARGET_TYPE_METHOD": - return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; - case -1: - case "UNRECOGNIZED": - default: - return FieldOptions_OptionTargetType.UNRECOGNIZED; - } -} - -export function fieldOptions_OptionTargetTypeToNumber(object: FieldOptions_OptionTargetType): number { - switch (object) { - case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: - return 0; - case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: - return 1; - case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: - return 2; - case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: - return 3; - case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: - return 4; - case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: - return 5; - case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: - return 6; - case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: - return 7; - case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: - return 8; - case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: - return 9; - case FieldOptions_OptionTargetType.UNRECOGNIZED: - default: - return -1; - } -} - -export interface FieldOptions_EditionDefault { - edition?: - | Edition - | undefined; - /** Textproto value. */ - value?: string | undefined; -} - -/** Information about the support window of a feature. */ -export interface FieldOptions_FeatureSupport { - /** - * The edition that this feature was first available in. In editions - * earlier than this one, the default assigned to EDITION_LEGACY will be - * used, and proto files will not be able to override it. - */ - editionIntroduced?: - | Edition - | undefined; - /** - * The edition this feature becomes deprecated in. Using this after this - * edition may trigger warnings. - */ - editionDeprecated?: - | Edition - | undefined; - /** - * The deprecation warning text if this feature is used after the edition it - * was marked deprecated in. - */ - deprecationWarning?: - | string - | undefined; - /** - * The edition this feature is no longer available in. In editions after - * this one, the last default assigned will be used, and proto files will - * not be able to override it. - */ - editionRemoved?: Edition | undefined; -} - -export interface OneofOptions { - /** - * Any features defined in the specific edition. - * WARNING: This field should only be used by protobuf plugins or special - * cases like the proto compiler. Other uses are discouraged and - * developers should rely on the protoreflect APIs for their client language. - */ - features?: - | FeatureSet - | undefined; - /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; -} - -export interface EnumOptions { - /** - * Set this option to true to allow mapping different tag names to the same - * value. - */ - allowAlias?: - | boolean - | undefined; - /** - * Is this enum deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the enum, or it will be completely ignored; in the very least, this - * is a formalization for deprecating enums. - */ - deprecated?: - | boolean - | undefined; - /** - * Enable the legacy handling of JSON field name conflicts. This lowercases - * and strips underscored from the fields before comparison in proto3 only. - * The new behavior takes `json_name` into account and applies to proto2 as - * well. - * TODO Remove this legacy behavior once downstream teams have - * had time to migrate. - * - * @deprecated - */ - deprecatedLegacyJsonFieldConflicts?: - | boolean - | undefined; - /** - * Any features defined in the specific edition. - * WARNING: This field should only be used by protobuf plugins or special - * cases like the proto compiler. Other uses are discouraged and - * developers should rely on the protoreflect APIs for their client language. - */ - features?: - | FeatureSet - | undefined; - /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; -} - -export interface EnumValueOptions { - /** - * Is this enum value deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the enum value, or it will be completely ignored; in the very least, - * this is a formalization for deprecating enum values. - */ - deprecated?: - | boolean - | undefined; - /** - * Any features defined in the specific edition. - * WARNING: This field should only be used by protobuf plugins or special - * cases like the proto compiler. Other uses are discouraged and - * developers should rely on the protoreflect APIs for their client language. - */ - features?: - | FeatureSet - | undefined; - /** - * Indicate that fields annotated with this enum value should not be printed - * out when using debug formats, e.g. when the field contains sensitive - * credentials. - */ - debugRedact?: - | boolean - | undefined; - /** Information about the support window of a feature value. */ - featureSupport?: - | FieldOptions_FeatureSupport - | undefined; - /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; -} - -export interface ServiceOptions { - /** - * Any features defined in the specific edition. - * WARNING: This field should only be used by protobuf plugins or special - * cases like the proto compiler. Other uses are discouraged and - * developers should rely on the protoreflect APIs for their client language. - */ - features?: - | FeatureSet - | undefined; - /** - * Is this service deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the service, or it will be completely ignored; in the very least, - * this is a formalization for deprecating services. - */ - deprecated?: - | boolean - | undefined; - /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; -} - -export interface MethodOptions { - /** - * Is this method deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the method, or it will be completely ignored; in the very least, - * this is a formalization for deprecating methods. - */ - deprecated?: boolean | undefined; - idempotencyLevel?: - | MethodOptions_IdempotencyLevel - | undefined; - /** - * Any features defined in the specific edition. - * WARNING: This field should only be used by protobuf plugins or special - * cases like the proto compiler. Other uses are discouraged and - * developers should rely on the protoreflect APIs for their client language. - */ - features?: - | FeatureSet - | undefined; - /** The parser stores options it doesn't recognize here. See above. */ - uninterpretedOption: UninterpretedOption[]; -} - -/** - * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, - * or neither? HTTP based RPC implementation may choose GET verb for safe - * methods, and PUT verb for idempotent methods instead of the default POST. - */ -export enum MethodOptions_IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = "IDEMPOTENCY_UNKNOWN", - /** NO_SIDE_EFFECTS - implies idempotent */ - NO_SIDE_EFFECTS = "NO_SIDE_EFFECTS", - /** IDEMPOTENT - idempotent, but may have side effects */ - IDEMPOTENT = "IDEMPOTENT", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function methodOptions_IdempotencyLevelFromJSON(object: any): MethodOptions_IdempotencyLevel { - switch (object) { - case 0: - case "IDEMPOTENCY_UNKNOWN": - return MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN; - case 1: - case "NO_SIDE_EFFECTS": - return MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS; - case 2: - case "IDEMPOTENT": - return MethodOptions_IdempotencyLevel.IDEMPOTENT; - case -1: - case "UNRECOGNIZED": - default: - return MethodOptions_IdempotencyLevel.UNRECOGNIZED; - } -} - -export function methodOptions_IdempotencyLevelToNumber(object: MethodOptions_IdempotencyLevel): number { - switch (object) { - case MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN: - return 0; - case MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS: - return 1; - case MethodOptions_IdempotencyLevel.IDEMPOTENT: - return 2; - case MethodOptions_IdempotencyLevel.UNRECOGNIZED: - default: - return -1; - } -} - -/** - * A message representing a option the parser does not recognize. This only - * appears in options protos created by the compiler::Parser class. - * DescriptorPool resolves these when building Descriptor objects. Therefore, - * options protos in descriptor objects (e.g. returned by Descriptor::options(), - * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions - * in them. - */ -export interface UninterpretedOption { - name: UninterpretedOption_NamePart[]; - /** - * The value of the uninterpreted option, in whatever type the tokenizer - * identified it as during parsing. Exactly one of these should be set. - */ - identifierValue?: string | undefined; - positiveIntValue?: number | undefined; - negativeIntValue?: number | undefined; - doubleValue?: number | undefined; - stringValue?: Uint8Array | undefined; - aggregateValue?: string | undefined; -} - -/** - * The name of the uninterpreted option. Each string represents a segment in - * a dot-separated name. is_extension is true iff a segment represents an - * extension (denoted with parentheses in options specs in .proto files). - * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents - * "foo.(bar.baz).moo". - */ -export interface UninterpretedOption_NamePart { - namePart: string; - isExtension: boolean; -} - -/** - * TODO Enums in C++ gencode (and potentially other languages) are - * not well scoped. This means that each of the feature enums below can clash - * with each other. The short names we've chosen maximize call-site - * readability, but leave us very open to this scenario. A future feature will - * be designed and implemented to handle this, hopefully before we ever hit a - * conflict here. - */ -export interface FeatureSet { - fieldPresence?: FeatureSet_FieldPresence | undefined; - enumType?: FeatureSet_EnumType | undefined; - repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; - utf8Validation?: FeatureSet_Utf8Validation | undefined; - messageEncoding?: FeatureSet_MessageEncoding | undefined; - jsonFormat?: FeatureSet_JsonFormat | undefined; - enforceNamingStyle?: FeatureSet_EnforceNamingStyle | undefined; - defaultSymbolVisibility?: FeatureSet_VisibilityFeature_DefaultSymbolVisibility | undefined; -} - -export enum FeatureSet_FieldPresence { - FIELD_PRESENCE_UNKNOWN = "FIELD_PRESENCE_UNKNOWN", - EXPLICIT = "EXPLICIT", - IMPLICIT = "IMPLICIT", - LEGACY_REQUIRED = "LEGACY_REQUIRED", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { - switch (object) { - case 0: - case "FIELD_PRESENCE_UNKNOWN": - return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; - case 1: - case "EXPLICIT": - return FeatureSet_FieldPresence.EXPLICIT; - case 2: - case "IMPLICIT": - return FeatureSet_FieldPresence.IMPLICIT; - case 3: - case "LEGACY_REQUIRED": - return FeatureSet_FieldPresence.LEGACY_REQUIRED; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_FieldPresence.UNRECOGNIZED; - } -} - -export function featureSet_FieldPresenceToNumber(object: FeatureSet_FieldPresence): number { - switch (object) { - case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: - return 0; - case FeatureSet_FieldPresence.EXPLICIT: - return 1; - case FeatureSet_FieldPresence.IMPLICIT: - return 2; - case FeatureSet_FieldPresence.LEGACY_REQUIRED: - return 3; - case FeatureSet_FieldPresence.UNRECOGNIZED: - default: - return -1; - } -} - -export enum FeatureSet_EnumType { - ENUM_TYPE_UNKNOWN = "ENUM_TYPE_UNKNOWN", - OPEN = "OPEN", - CLOSED = "CLOSED", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { - switch (object) { - case 0: - case "ENUM_TYPE_UNKNOWN": - return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; - case 1: - case "OPEN": - return FeatureSet_EnumType.OPEN; - case 2: - case "CLOSED": - return FeatureSet_EnumType.CLOSED; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_EnumType.UNRECOGNIZED; - } -} - -export function featureSet_EnumTypeToNumber(object: FeatureSet_EnumType): number { - switch (object) { - case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: - return 0; - case FeatureSet_EnumType.OPEN: - return 1; - case FeatureSet_EnumType.CLOSED: - return 2; - case FeatureSet_EnumType.UNRECOGNIZED: - default: - return -1; - } -} - -export enum FeatureSet_RepeatedFieldEncoding { - REPEATED_FIELD_ENCODING_UNKNOWN = "REPEATED_FIELD_ENCODING_UNKNOWN", - PACKED = "PACKED", - EXPANDED = "EXPANDED", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { - switch (object) { - case 0: - case "REPEATED_FIELD_ENCODING_UNKNOWN": - return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; - case 1: - case "PACKED": - return FeatureSet_RepeatedFieldEncoding.PACKED; - case 2: - case "EXPANDED": - return FeatureSet_RepeatedFieldEncoding.EXPANDED; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; - } -} - -export function featureSet_RepeatedFieldEncodingToNumber(object: FeatureSet_RepeatedFieldEncoding): number { - switch (object) { - case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: - return 0; - case FeatureSet_RepeatedFieldEncoding.PACKED: - return 1; - case FeatureSet_RepeatedFieldEncoding.EXPANDED: - return 2; - case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: - default: - return -1; - } -} - -export enum FeatureSet_Utf8Validation { - UTF8_VALIDATION_UNKNOWN = "UTF8_VALIDATION_UNKNOWN", - VERIFY = "VERIFY", - NONE = "NONE", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { - switch (object) { - case 0: - case "UTF8_VALIDATION_UNKNOWN": - return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; - case 2: - case "VERIFY": - return FeatureSet_Utf8Validation.VERIFY; - case 3: - case "NONE": - return FeatureSet_Utf8Validation.NONE; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_Utf8Validation.UNRECOGNIZED; - } -} - -export function featureSet_Utf8ValidationToNumber(object: FeatureSet_Utf8Validation): number { - switch (object) { - case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: - return 0; - case FeatureSet_Utf8Validation.VERIFY: - return 2; - case FeatureSet_Utf8Validation.NONE: - return 3; - case FeatureSet_Utf8Validation.UNRECOGNIZED: - default: - return -1; - } -} - -export enum FeatureSet_MessageEncoding { - MESSAGE_ENCODING_UNKNOWN = "MESSAGE_ENCODING_UNKNOWN", - LENGTH_PREFIXED = "LENGTH_PREFIXED", - DELIMITED = "DELIMITED", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { - switch (object) { - case 0: - case "MESSAGE_ENCODING_UNKNOWN": - return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; - case 1: - case "LENGTH_PREFIXED": - return FeatureSet_MessageEncoding.LENGTH_PREFIXED; - case 2: - case "DELIMITED": - return FeatureSet_MessageEncoding.DELIMITED; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_MessageEncoding.UNRECOGNIZED; - } -} - -export function featureSet_MessageEncodingToNumber(object: FeatureSet_MessageEncoding): number { - switch (object) { - case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: - return 0; - case FeatureSet_MessageEncoding.LENGTH_PREFIXED: - return 1; - case FeatureSet_MessageEncoding.DELIMITED: - return 2; - case FeatureSet_MessageEncoding.UNRECOGNIZED: - default: - return -1; - } -} - -export enum FeatureSet_JsonFormat { - JSON_FORMAT_UNKNOWN = "JSON_FORMAT_UNKNOWN", - ALLOW = "ALLOW", - LEGACY_BEST_EFFORT = "LEGACY_BEST_EFFORT", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { - switch (object) { - case 0: - case "JSON_FORMAT_UNKNOWN": - return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; - case 1: - case "ALLOW": - return FeatureSet_JsonFormat.ALLOW; - case 2: - case "LEGACY_BEST_EFFORT": - return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_JsonFormat.UNRECOGNIZED; - } -} - -export function featureSet_JsonFormatToNumber(object: FeatureSet_JsonFormat): number { - switch (object) { - case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: - return 0; - case FeatureSet_JsonFormat.ALLOW: - return 1; - case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: - return 2; - case FeatureSet_JsonFormat.UNRECOGNIZED: - default: - return -1; - } -} - -export enum FeatureSet_EnforceNamingStyle { - ENFORCE_NAMING_STYLE_UNKNOWN = "ENFORCE_NAMING_STYLE_UNKNOWN", - STYLE2024 = "STYLE2024", - STYLE_LEGACY = "STYLE_LEGACY", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function featureSet_EnforceNamingStyleFromJSON(object: any): FeatureSet_EnforceNamingStyle { - switch (object) { - case 0: - case "ENFORCE_NAMING_STYLE_UNKNOWN": - return FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN; - case 1: - case "STYLE2024": - return FeatureSet_EnforceNamingStyle.STYLE2024; - case 2: - case "STYLE_LEGACY": - return FeatureSet_EnforceNamingStyle.STYLE_LEGACY; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_EnforceNamingStyle.UNRECOGNIZED; - } -} - -export function featureSet_EnforceNamingStyleToNumber(object: FeatureSet_EnforceNamingStyle): number { - switch (object) { - case FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN: - return 0; - case FeatureSet_EnforceNamingStyle.STYLE2024: - return 1; - case FeatureSet_EnforceNamingStyle.STYLE_LEGACY: - return 2; - case FeatureSet_EnforceNamingStyle.UNRECOGNIZED: - default: - return -1; - } -} - -export interface FeatureSet_VisibilityFeature { -} - -export enum FeatureSet_VisibilityFeature_DefaultSymbolVisibility { - DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN", - /** EXPORT_ALL - Default pre-EDITION_2024, all UNSET visibility are export. */ - EXPORT_ALL = "EXPORT_ALL", - /** EXPORT_TOP_LEVEL - All top-level symbols default to export, nested default to local. */ - EXPORT_TOP_LEVEL = "EXPORT_TOP_LEVEL", - /** LOCAL_ALL - All symbols default to local. */ - LOCAL_ALL = "LOCAL_ALL", - /** - * STRICT - All symbols local by default. Nested types cannot be exported. - * With special case caveat for message { enum {} reserved 1 to max; } - * This is the recommended setting for new protos. - */ - STRICT = "STRICT", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON( - object: any, -): FeatureSet_VisibilityFeature_DefaultSymbolVisibility { - switch (object) { - case 0: - case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": - return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN; - case 1: - case "EXPORT_ALL": - return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_ALL; - case 2: - case "EXPORT_TOP_LEVEL": - return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_TOP_LEVEL; - case 3: - case "LOCAL_ALL": - return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.LOCAL_ALL; - case 4: - case "STRICT": - return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.STRICT; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.UNRECOGNIZED; - } -} - -export function featureSet_VisibilityFeature_DefaultSymbolVisibilityToNumber( - object: FeatureSet_VisibilityFeature_DefaultSymbolVisibility, -): number { - switch (object) { - case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN: - return 0; - case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_ALL: - return 1; - case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_TOP_LEVEL: - return 2; - case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.LOCAL_ALL: - return 3; - case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.STRICT: - return 4; - case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.UNRECOGNIZED: - default: - return -1; - } -} - -/** - * A compiled specification for the defaults of a set of features. These - * messages are generated from FeatureSet extensions and can be used to seed - * feature resolution. The resolution with this object becomes a simple search - * for the closest matching edition, followed by proto merges. - */ -export interface FeatureSetDefaults { - defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; - /** - * The minimum supported edition (inclusive) when this was constructed. - * Editions before this will not have defaults. - */ - minimumEdition?: - | Edition - | undefined; - /** - * The maximum known edition (inclusive) when this was constructed. Editions - * after this will not have reliable defaults. - */ - maximumEdition?: Edition | undefined; -} - -/** - * A map from every known edition with a unique set of defaults to its - * defaults. Not all editions may be contained here. For a given edition, - * the defaults at the closest matching edition ordered at or before it should - * be used. This field must be in strict ascending order by edition. - */ -export interface FeatureSetDefaults_FeatureSetEditionDefault { - edition?: - | Edition - | undefined; - /** Defaults of features that can be overridden in this edition. */ - overridableFeatures?: - | FeatureSet - | undefined; - /** Defaults of features that can't be overridden in this edition. */ - fixedFeatures?: FeatureSet | undefined; -} - -/** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. - */ -export interface SourceCodeInfo { - /** - * A Location identifies a piece of source code in a .proto file which - * corresponds to a particular definition. This information is intended - * to be useful to IDEs, code indexers, documentation generators, and similar - * tools. - * - * For example, say we have a file like: - * message Foo { - * optional string foo = 1; - * } - * Let's look at just the field definition: - * optional string foo = 1; - * ^ ^^ ^^ ^ ^^^ - * a bc de f ghi - * We have the following locations: - * span path represents - * [a,i) [ 4, 0, 2, 0 ] The whole field definition. - * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - * - * Notes: - * - A location may refer to a repeated field itself (i.e. not to any - * particular index within it). This is used whenever a set of elements are - * logically enclosed in a single code segment. For example, an entire - * extend block (possibly containing multiple extension definitions) will - * have an outer location whose path refers to the "extensions" repeated - * field without an index. - * - Multiple locations may have the same path. This happens when a single - * logical declaration is spread out across multiple places. The most - * obvious example is the "extend" block again -- there may be multiple - * extend blocks in the same scope, each of which will have the same path. - * - A location's span is not always a subset of its parent's span. For - * example, the "extendee" of an extension declaration appears at the - * beginning of the "extend" block and is shared by all extensions within - * the block. - * - Just because a location's span is a subset of some other location's span - * does not mean that it is a descendant. For example, a "group" defines - * both a type and a field in a single declaration. Thus, the locations - * corresponding to the type and field and their components will overlap. - * - Code which tries to interpret locations should probably be designed to - * ignore those that it doesn't understand, as more types of locations could - * be recorded in the future. - */ - location: SourceCodeInfo_Location[]; -} - -export interface SourceCodeInfo_Location { - /** - * Identifies which part of the FileDescriptorProto was defined at this - * location. - * - * Each element is a field number or an index. They form a path from - * the root FileDescriptorProto to the place where the definition appears. - * For example, this path: - * [ 4, 3, 2, 7, 1 ] - * refers to: - * file.message_type(3) // 4, 3 - * .field(7) // 2, 7 - * .name() // 1 - * This is because FileDescriptorProto.message_type has field number 4: - * repeated DescriptorProto message_type = 4; - * and DescriptorProto.field has field number 2: - * repeated FieldDescriptorProto field = 2; - * and FieldDescriptorProto.name has field number 1: - * optional string name = 1; - * - * Thus, the above path gives the location of a field name. If we removed - * the last element: - * [ 4, 3, 2, 7 ] - * this path refers to the whole field declaration (from the beginning - * of the label to the terminating semicolon). - */ - path: number[]; - /** - * Always has exactly three or four elements: start line, start column, - * end line (optional, otherwise assumed same as start line), end column. - * These are packed into a single field for efficiency. Note that line - * and column numbers are zero-based -- typically you will want to add - * 1 to each before displaying to a user. - */ - span: number[]; - /** - * If this SourceCodeInfo represents a complete declaration, these are any - * comments appearing before and after the declaration which appear to be - * attached to the declaration. - * - * A series of line comments appearing on consecutive lines, with no other - * tokens appearing on those lines, will be treated as a single comment. - * - * leading_detached_comments will keep paragraphs of comments that appear - * before (but not connected to) the current element. Each paragraph, - * separated by empty lines, will be one comment element in the repeated - * field. - * - * Only the comment content is provided; comment markers (e.g. //) are - * stripped out. For block comments, leading whitespace and an asterisk - * will be stripped from the beginning of each line other than the first. - * Newlines are included in the output. - * - * Examples: - * - * optional int32 foo = 1; // Comment attached to foo. - * // Comment attached to bar. - * optional int32 bar = 2; - * - * optional string baz = 3; - * // Comment attached to baz. - * // Another line attached to baz. - * - * // Comment attached to moo. - * // - * // Another line attached to moo. - * optional double moo = 4; - * - * // Detached comment for corge. This is not leading or trailing comments - * // to moo or corge because there are blank lines separating it from - * // both. - * - * // Detached comment for corge paragraph 2. - * - * optional string corge = 5; - * /* Block comment attached - * * to corge. Leading asterisks - * * will be removed. * / - * /* Block comment attached to - * * grault. * / - * optional int32 grault = 6; - * - * // ignored detached comments. - */ - leadingComments?: string | undefined; - trailingComments?: string | undefined; - leadingDetachedComments: string[]; -} - -/** - * Describes the relationship between generated code and its original source - * file. A GeneratedCodeInfo message is associated with only one generated - * source file, but may contain references to different source .proto files. - */ -export interface GeneratedCodeInfo { - /** - * An Annotation connects some span of text in generated code to an element - * of its generating .proto file. - */ - annotation: GeneratedCodeInfo_Annotation[]; -} - -export interface GeneratedCodeInfo_Annotation { - /** - * Identifies the element in the original source .proto file. This field - * is formatted the same as SourceCodeInfo.Location.path. - */ - path: number[]; - /** Identifies the filesystem path to the original source .proto. */ - sourceFile?: - | string - | undefined; - /** - * Identifies the starting offset in bytes in the generated code - * that relates to the identified object. - */ - begin?: - | number - | undefined; - /** - * Identifies the ending offset in bytes in the generated code that - * relates to the identified object. The end offset should be one past - * the last relevant byte (so the length of the text = end - begin). - */ - end?: number | undefined; - semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; -} - -/** - * Represents the identified object's effect on the element in the original - * .proto file. - */ -export enum GeneratedCodeInfo_Annotation_Semantic { - /** NONE - There is no effect or the effect is indescribable. */ - NONE = "NONE", - /** SET - The element is set or otherwise mutated. */ - SET = "SET", - /** ALIAS - An alias to the element is returned. */ - ALIAS = "ALIAS", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { - switch (object) { - case 0: - case "NONE": - return GeneratedCodeInfo_Annotation_Semantic.NONE; - case 1: - case "SET": - return GeneratedCodeInfo_Annotation_Semantic.SET; - case 2: - case "ALIAS": - return GeneratedCodeInfo_Annotation_Semantic.ALIAS; - case -1: - case "UNRECOGNIZED": - default: - return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; - } -} - -export function generatedCodeInfo_Annotation_SemanticToNumber(object: GeneratedCodeInfo_Annotation_Semantic): number { - switch (object) { - case GeneratedCodeInfo_Annotation_Semantic.NONE: - return 0; - case GeneratedCodeInfo_Annotation_Semantic.SET: - return 1; - case GeneratedCodeInfo_Annotation_Semantic.ALIAS: - return 2; - case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: - default: - return -1; - } -} - -function createBaseFileDescriptorSet(): FileDescriptorSet { - return { file: [] }; -} - -export const FileDescriptorSet: MessageFns = { - encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.file) { - FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFileDescriptorSet(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.file.push(FileDescriptorProto.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): FileDescriptorSet { - return FileDescriptorSet.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): FileDescriptorSet { - const message = createBaseFileDescriptorSet(); - message.file = object.file?.map((e) => FileDescriptorProto.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseFileDescriptorProto(): FileDescriptorProto { - return { - name: "", - package: "", - dependency: [], - publicDependency: [], - weakDependency: [], - optionDependency: [], - messageType: [], - enumType: [], - service: [], - extension: [], - options: undefined, - sourceCodeInfo: undefined, - syntax: "", - edition: Edition.EDITION_UNKNOWN, - }; -} - -export const FileDescriptorProto: MessageFns = { - encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== undefined && message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.package !== undefined && message.package !== "") { - writer.uint32(18).string(message.package); - } - for (const v of message.dependency) { - writer.uint32(26).string(v!); - } - writer.uint32(82).fork(); - for (const v of message.publicDependency) { - writer.int32(v); - } - writer.join(); - writer.uint32(90).fork(); - for (const v of message.weakDependency) { - writer.int32(v); - } - writer.join(); - for (const v of message.optionDependency) { - writer.uint32(122).string(v!); - } - for (const v of message.messageType) { - DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); - } - for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); - } - for (const v of message.service) { - ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); - } - for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); - } - if (message.options !== undefined) { - FileOptions.encode(message.options, writer.uint32(66).fork()).join(); - } - if (message.sourceCodeInfo !== undefined) { - SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); - } - if (message.syntax !== undefined && message.syntax !== "") { - writer.uint32(98).string(message.syntax); - } - if (message.edition !== undefined && message.edition !== Edition.EDITION_UNKNOWN) { - writer.uint32(112).int32(editionToNumber(message.edition)); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFileDescriptorProto(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.package = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.dependency.push(reader.string()); - continue; - } - case 10: { - if (tag === 80) { - message.publicDependency.push(reader.int32()); - - continue; - } - - if (tag === 82) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.publicDependency.push(reader.int32()); - } - - continue; - } - - break; - } - case 11: { - if (tag === 88) { - message.weakDependency.push(reader.int32()); - - continue; - } - - if (tag === 90) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.weakDependency.push(reader.int32()); - } - - continue; - } - - break; - } - case 15: { - if (tag !== 122) { - break; - } - - message.optionDependency.push(reader.string()); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.messageType.push(DescriptorProto.decode(reader, reader.uint32())); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.service.push(ServiceDescriptorProto.decode(reader, reader.uint32())); - continue; - } - case 7: { - if (tag !== 58) { - break; - } - - message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); - continue; - } - case 8: { - if (tag !== 66) { - break; - } - - message.options = FileOptions.decode(reader, reader.uint32()); - continue; - } - case 9: { - if (tag !== 74) { - break; - } - - message.sourceCodeInfo = SourceCodeInfo.decode(reader, reader.uint32()); - continue; - } - case 12: { - if (tag !== 98) { - break; - } - - message.syntax = reader.string(); - continue; - } - case 14: { - if (tag !== 112) { - break; - } - - message.edition = editionFromJSON(reader.int32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): FileDescriptorProto { - return FileDescriptorProto.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): FileDescriptorProto { - const message = createBaseFileDescriptorProto(); - message.name = object.name ?? ""; - message.package = object.package ?? ""; - message.dependency = object.dependency?.map((e) => e) || []; - message.publicDependency = object.publicDependency?.map((e) => e) || []; - message.weakDependency = object.weakDependency?.map((e) => e) || []; - message.optionDependency = object.optionDependency?.map((e) => e) || []; - message.messageType = object.messageType?.map((e) => DescriptorProto.fromPartial(e)) || []; - message.enumType = object.enumType?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; - message.service = object.service?.map((e) => ServiceDescriptorProto.fromPartial(e)) || []; - message.extension = object.extension?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; - message.options = (object.options !== undefined && object.options !== null) - ? FileOptions.fromPartial(object.options) - : undefined; - message.sourceCodeInfo = (object.sourceCodeInfo !== undefined && object.sourceCodeInfo !== null) - ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) - : undefined; - message.syntax = object.syntax ?? ""; - message.edition = object.edition ?? Edition.EDITION_UNKNOWN; - return message; - }, -}; - -function createBaseDescriptorProto(): DescriptorProto { - return { - name: "", - field: [], - extension: [], - nestedType: [], - enumType: [], - extensionRange: [], - oneofDecl: [], - options: undefined, - reservedRange: [], - reservedName: [], - visibility: SymbolVisibility.VISIBILITY_UNSET, - }; -} - -export const DescriptorProto: MessageFns = { - encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== undefined && message.name !== "") { - writer.uint32(10).string(message.name); - } - for (const v of message.field) { - FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); - } - for (const v of message.extension) { - FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); - } - for (const v of message.nestedType) { - DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); - } - for (const v of message.enumType) { - EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); - } - for (const v of message.extensionRange) { - DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); - } - for (const v of message.oneofDecl) { - OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); - } - if (message.options !== undefined) { - MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); - } - for (const v of message.reservedRange) { - DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); - } - for (const v of message.reservedName) { - writer.uint32(82).string(v!); - } - if (message.visibility !== undefined && message.visibility !== SymbolVisibility.VISIBILITY_UNSET) { - writer.uint32(88).int32(symbolVisibilityToNumber(message.visibility)); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDescriptorProto(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.field.push(FieldDescriptorProto.decode(reader, reader.uint32())); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.nestedType.push(DescriptorProto.decode(reader, reader.uint32())); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.extensionRange.push(DescriptorProto_ExtensionRange.decode(reader, reader.uint32())); - continue; - } - case 8: { - if (tag !== 66) { - break; - } - - message.oneofDecl.push(OneofDescriptorProto.decode(reader, reader.uint32())); - continue; - } - case 7: { - if (tag !== 58) { - break; - } - - message.options = MessageOptions.decode(reader, reader.uint32()); - continue; - } - case 9: { - if (tag !== 74) { - break; - } - - message.reservedRange.push(DescriptorProto_ReservedRange.decode(reader, reader.uint32())); - continue; - } - case 10: { - if (tag !== 82) { - break; - } - - message.reservedName.push(reader.string()); - continue; - } - case 11: { - if (tag !== 88) { - break; - } - - message.visibility = symbolVisibilityFromJSON(reader.int32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DescriptorProto { - return DescriptorProto.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DescriptorProto { - const message = createBaseDescriptorProto(); - message.name = object.name ?? ""; - message.field = object.field?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; - message.extension = object.extension?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; - message.nestedType = object.nestedType?.map((e) => DescriptorProto.fromPartial(e)) || []; - message.enumType = object.enumType?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; - message.extensionRange = object.extensionRange?.map((e) => DescriptorProto_ExtensionRange.fromPartial(e)) || []; - message.oneofDecl = object.oneofDecl?.map((e) => OneofDescriptorProto.fromPartial(e)) || []; - message.options = (object.options !== undefined && object.options !== null) - ? MessageOptions.fromPartial(object.options) - : undefined; - message.reservedRange = object.reservedRange?.map((e) => DescriptorProto_ReservedRange.fromPartial(e)) || []; - message.reservedName = object.reservedName?.map((e) => e) || []; - message.visibility = object.visibility ?? SymbolVisibility.VISIBILITY_UNSET; - return message; - }, -}; - -function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { - return { start: 0, end: 0, options: undefined }; -} - -export const DescriptorProto_ExtensionRange: MessageFns = { - encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.start !== undefined && message.start !== 0) { - writer.uint32(8).int32(message.start); - } - if (message.end !== undefined && message.end !== 0) { - writer.uint32(16).int32(message.end); - } - if (message.options !== undefined) { - ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDescriptorProto_ExtensionRange(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.start = reader.int32(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.end = reader.int32(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.options = ExtensionRangeOptions.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DescriptorProto_ExtensionRange { - return DescriptorProto_ExtensionRange.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DescriptorProto_ExtensionRange { - const message = createBaseDescriptorProto_ExtensionRange(); - message.start = object.start ?? 0; - message.end = object.end ?? 0; - message.options = (object.options !== undefined && object.options !== null) - ? ExtensionRangeOptions.fromPartial(object.options) - : undefined; - return message; - }, -}; - -function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { - return { start: 0, end: 0 }; -} - -export const DescriptorProto_ReservedRange: MessageFns = { - encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.start !== undefined && message.start !== 0) { - writer.uint32(8).int32(message.start); - } - if (message.end !== undefined && message.end !== 0) { - writer.uint32(16).int32(message.end); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDescriptorProto_ReservedRange(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.start = reader.int32(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.end = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): DescriptorProto_ReservedRange { - return DescriptorProto_ReservedRange.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): DescriptorProto_ReservedRange { - const message = createBaseDescriptorProto_ReservedRange(); - message.start = object.start ?? 0; - message.end = object.end ?? 0; - return message; - }, -}; - -function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { - uninterpretedOption: [], - declaration: [], - features: undefined, - verification: ExtensionRangeOptions_VerificationState.UNVERIFIED, - }; -} - -export const ExtensionRangeOptions: MessageFns = { - encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); - } - for (const v of message.declaration) { - ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); - } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); - } - if ( - message.verification !== undefined && message.verification !== ExtensionRangeOptions_VerificationState.DECLARATION - ) { - writer.uint32(24).int32(extensionRangeOptions_VerificationStateToNumber(message.verification)); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseExtensionRangeOptions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 999: { - if (tag !== 7994) { - break; - } - - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); - continue; - } - case 50: { - if (tag !== 402) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.verification = extensionRangeOptions_VerificationStateFromJSON(reader.int32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ExtensionRangeOptions { - return ExtensionRangeOptions.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ExtensionRangeOptions { - const message = createBaseExtensionRangeOptions(); - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; - message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; - message.verification = object.verification ?? ExtensionRangeOptions_VerificationState.UNVERIFIED; - return message; - }, -}; - -function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { - return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; -} - -export const ExtensionRangeOptions_Declaration: MessageFns = { - encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.number !== undefined && message.number !== 0) { - writer.uint32(8).int32(message.number); - } - if (message.fullName !== undefined && message.fullName !== "") { - writer.uint32(18).string(message.fullName); - } - if (message.type !== undefined && message.type !== "") { - writer.uint32(26).string(message.type); - } - if (message.reserved !== undefined && message.reserved !== false) { - writer.uint32(40).bool(message.reserved); - } - if (message.repeated !== undefined && message.repeated !== false) { - writer.uint32(48).bool(message.repeated); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseExtensionRangeOptions_Declaration(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.number = reader.int32(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.fullName = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.type = reader.string(); - continue; - } - case 5: { - if (tag !== 40) { - break; - } - - message.reserved = reader.bool(); - continue; - } - case 6: { - if (tag !== 48) { - break; - } - - message.repeated = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ExtensionRangeOptions_Declaration { - return ExtensionRangeOptions_Declaration.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ExtensionRangeOptions_Declaration { - const message = createBaseExtensionRangeOptions_Declaration(); - message.number = object.number ?? 0; - message.fullName = object.fullName ?? ""; - message.type = object.type ?? ""; - message.reserved = object.reserved ?? false; - message.repeated = object.repeated ?? false; - return message; - }, -}; - -function createBaseFieldDescriptorProto(): FieldDescriptorProto { - return { - name: "", - number: 0, - label: FieldDescriptorProto_Label.LABEL_OPTIONAL, - type: FieldDescriptorProto_Type.TYPE_DOUBLE, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - options: undefined, - proto3Optional: false, - }; -} - -export const FieldDescriptorProto: MessageFns = { - encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== undefined && message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.number !== undefined && message.number !== 0) { - writer.uint32(24).int32(message.number); - } - if (message.label !== undefined && message.label !== FieldDescriptorProto_Label.LABEL_OPTIONAL) { - writer.uint32(32).int32(fieldDescriptorProto_LabelToNumber(message.label)); - } - if (message.type !== undefined && message.type !== FieldDescriptorProto_Type.TYPE_DOUBLE) { - writer.uint32(40).int32(fieldDescriptorProto_TypeToNumber(message.type)); - } - if (message.typeName !== undefined && message.typeName !== "") { - writer.uint32(50).string(message.typeName); - } - if (message.extendee !== undefined && message.extendee !== "") { - writer.uint32(18).string(message.extendee); - } - if (message.defaultValue !== undefined && message.defaultValue !== "") { - writer.uint32(58).string(message.defaultValue); - } - if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { - writer.uint32(72).int32(message.oneofIndex); - } - if (message.jsonName !== undefined && message.jsonName !== "") { - writer.uint32(82).string(message.jsonName); - } - if (message.options !== undefined) { - FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); - } - if (message.proto3Optional !== undefined && message.proto3Optional !== false) { - writer.uint32(136).bool(message.proto3Optional); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFieldDescriptorProto(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.number = reader.int32(); - continue; - } - case 4: { - if (tag !== 32) { - break; - } - - message.label = fieldDescriptorProto_LabelFromJSON(reader.int32()); - continue; - } - case 5: { - if (tag !== 40) { - break; - } - - message.type = fieldDescriptorProto_TypeFromJSON(reader.int32()); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.typeName = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.extendee = reader.string(); - continue; - } - case 7: { - if (tag !== 58) { - break; - } - - message.defaultValue = reader.string(); - continue; - } - case 9: { - if (tag !== 72) { - break; - } - - message.oneofIndex = reader.int32(); - continue; - } - case 10: { - if (tag !== 82) { - break; - } - - message.jsonName = reader.string(); - continue; - } - case 8: { - if (tag !== 66) { - break; - } - - message.options = FieldOptions.decode(reader, reader.uint32()); - continue; - } - case 17: { - if (tag !== 136) { - break; - } - - message.proto3Optional = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): FieldDescriptorProto { - return FieldDescriptorProto.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): FieldDescriptorProto { - const message = createBaseFieldDescriptorProto(); - message.name = object.name ?? ""; - message.number = object.number ?? 0; - message.label = object.label ?? FieldDescriptorProto_Label.LABEL_OPTIONAL; - message.type = object.type ?? FieldDescriptorProto_Type.TYPE_DOUBLE; - message.typeName = object.typeName ?? ""; - message.extendee = object.extendee ?? ""; - message.defaultValue = object.defaultValue ?? ""; - message.oneofIndex = object.oneofIndex ?? 0; - message.jsonName = object.jsonName ?? ""; - message.options = (object.options !== undefined && object.options !== null) - ? FieldOptions.fromPartial(object.options) - : undefined; - message.proto3Optional = object.proto3Optional ?? false; - return message; - }, -}; - -function createBaseOneofDescriptorProto(): OneofDescriptorProto { - return { name: "", options: undefined }; -} - -export const OneofDescriptorProto: MessageFns = { - encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== undefined && message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.options !== undefined) { - OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofDescriptorProto(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.options = OneofOptions.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): OneofDescriptorProto { - return OneofDescriptorProto.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): OneofDescriptorProto { - const message = createBaseOneofDescriptorProto(); - message.name = object.name ?? ""; - message.options = (object.options !== undefined && object.options !== null) - ? OneofOptions.fromPartial(object.options) - : undefined; - return message; - }, -}; - -function createBaseEnumDescriptorProto(): EnumDescriptorProto { - return { - name: "", - value: [], - options: undefined, - reservedRange: [], - reservedName: [], - visibility: SymbolVisibility.VISIBILITY_UNSET, - }; -} - -export const EnumDescriptorProto: MessageFns = { - encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== undefined && message.name !== "") { - writer.uint32(10).string(message.name); - } - for (const v of message.value) { - EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); - } - if (message.options !== undefined) { - EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); - } - for (const v of message.reservedRange) { - EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); - } - for (const v of message.reservedName) { - writer.uint32(42).string(v!); - } - if (message.visibility !== undefined && message.visibility !== SymbolVisibility.VISIBILITY_UNSET) { - writer.uint32(48).int32(symbolVisibilityToNumber(message.visibility)); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumDescriptorProto(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value.push(EnumValueDescriptorProto.decode(reader, reader.uint32())); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.options = EnumOptions.decode(reader, reader.uint32()); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.reservedRange.push(EnumDescriptorProto_EnumReservedRange.decode(reader, reader.uint32())); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.reservedName.push(reader.string()); - continue; - } - case 6: { - if (tag !== 48) { - break; - } - - message.visibility = symbolVisibilityFromJSON(reader.int32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): EnumDescriptorProto { - return EnumDescriptorProto.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): EnumDescriptorProto { - const message = createBaseEnumDescriptorProto(); - message.name = object.name ?? ""; - message.value = object.value?.map((e) => EnumValueDescriptorProto.fromPartial(e)) || []; - message.options = (object.options !== undefined && object.options !== null) - ? EnumOptions.fromPartial(object.options) - : undefined; - message.reservedRange = object.reservedRange?.map((e) => EnumDescriptorProto_EnumReservedRange.fromPartial(e)) || - []; - message.reservedName = object.reservedName?.map((e) => e) || []; - message.visibility = object.visibility ?? SymbolVisibility.VISIBILITY_UNSET; - return message; - }, -}; - -function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { - return { start: 0, end: 0 }; -} - -export const EnumDescriptorProto_EnumReservedRange: MessageFns = { - encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.start !== undefined && message.start !== 0) { - writer.uint32(8).int32(message.start); - } - if (message.end !== undefined && message.end !== 0) { - writer.uint32(16).int32(message.end); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumDescriptorProto_EnumReservedRange(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.start = reader.int32(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.end = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): EnumDescriptorProto_EnumReservedRange { - return EnumDescriptorProto_EnumReservedRange.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): EnumDescriptorProto_EnumReservedRange { - const message = createBaseEnumDescriptorProto_EnumReservedRange(); - message.start = object.start ?? 0; - message.end = object.end ?? 0; - return message; - }, -}; - -function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { - return { name: "", number: 0, options: undefined }; -} - -export const EnumValueDescriptorProto: MessageFns = { - encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== undefined && message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.number !== undefined && message.number !== 0) { - writer.uint32(16).int32(message.number); - } - if (message.options !== undefined) { - EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumValueDescriptorProto(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.number = reader.int32(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.options = EnumValueOptions.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): EnumValueDescriptorProto { - return EnumValueDescriptorProto.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): EnumValueDescriptorProto { - const message = createBaseEnumValueDescriptorProto(); - message.name = object.name ?? ""; - message.number = object.number ?? 0; - message.options = (object.options !== undefined && object.options !== null) - ? EnumValueOptions.fromPartial(object.options) - : undefined; - return message; - }, -}; - -function createBaseServiceDescriptorProto(): ServiceDescriptorProto { - return { name: "", method: [], options: undefined }; -} - -export const ServiceDescriptorProto: MessageFns = { - encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== undefined && message.name !== "") { - writer.uint32(10).string(message.name); - } - for (const v of message.method) { - MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); - } - if (message.options !== undefined) { - ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseServiceDescriptorProto(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.method.push(MethodDescriptorProto.decode(reader, reader.uint32())); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.options = ServiceOptions.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ServiceDescriptorProto { - return ServiceDescriptorProto.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ServiceDescriptorProto { - const message = createBaseServiceDescriptorProto(); - message.name = object.name ?? ""; - message.method = object.method?.map((e) => MethodDescriptorProto.fromPartial(e)) || []; - message.options = (object.options !== undefined && object.options !== null) - ? ServiceOptions.fromPartial(object.options) - : undefined; - return message; - }, -}; - -function createBaseMethodDescriptorProto(): MethodDescriptorProto { - return { - name: "", - inputType: "", - outputType: "", - options: undefined, - clientStreaming: false, - serverStreaming: false, - }; -} - -export const MethodDescriptorProto: MessageFns = { - encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.name !== undefined && message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.inputType !== undefined && message.inputType !== "") { - writer.uint32(18).string(message.inputType); - } - if (message.outputType !== undefined && message.outputType !== "") { - writer.uint32(26).string(message.outputType); - } - if (message.options !== undefined) { - MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); - } - if (message.clientStreaming !== undefined && message.clientStreaming !== false) { - writer.uint32(40).bool(message.clientStreaming); - } - if (message.serverStreaming !== undefined && message.serverStreaming !== false) { - writer.uint32(48).bool(message.serverStreaming); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMethodDescriptorProto(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.name = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.inputType = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.outputType = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.options = MethodOptions.decode(reader, reader.uint32()); - continue; - } - case 5: { - if (tag !== 40) { - break; - } - - message.clientStreaming = reader.bool(); - continue; - } - case 6: { - if (tag !== 48) { - break; - } - - message.serverStreaming = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): MethodDescriptorProto { - return MethodDescriptorProto.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): MethodDescriptorProto { - const message = createBaseMethodDescriptorProto(); - message.name = object.name ?? ""; - message.inputType = object.inputType ?? ""; - message.outputType = object.outputType ?? ""; - message.options = (object.options !== undefined && object.options !== null) - ? MethodOptions.fromPartial(object.options) - : undefined; - message.clientStreaming = object.clientStreaming ?? false; - message.serverStreaming = object.serverStreaming ?? false; - return message; - }, -}; - -function createBaseFileOptions(): FileOptions { - return { - javaPackage: "", - javaOuterClassname: "", - javaMultipleFiles: false, - javaGenerateEqualsAndHash: false, - javaStringCheckUtf8: false, - optimizeFor: FileOptions_OptimizeMode.SPEED, - goPackage: "", - ccGenericServices: false, - javaGenericServices: false, - pyGenericServices: false, - deprecated: false, - ccEnableArenas: true, - objcClassPrefix: "", - csharpNamespace: "", - swiftPrefix: "", - phpClassPrefix: "", - phpNamespace: "", - phpMetadataNamespace: "", - rubyPackage: "", - features: undefined, - uninterpretedOption: [], - }; -} - -export const FileOptions: MessageFns = { - encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.javaPackage !== undefined && message.javaPackage !== "") { - writer.uint32(10).string(message.javaPackage); - } - if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { - writer.uint32(66).string(message.javaOuterClassname); - } - if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { - writer.uint32(80).bool(message.javaMultipleFiles); - } - if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { - writer.uint32(160).bool(message.javaGenerateEqualsAndHash); - } - if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { - writer.uint32(216).bool(message.javaStringCheckUtf8); - } - if (message.optimizeFor !== undefined && message.optimizeFor !== FileOptions_OptimizeMode.SPEED) { - writer.uint32(72).int32(fileOptions_OptimizeModeToNumber(message.optimizeFor)); - } - if (message.goPackage !== undefined && message.goPackage !== "") { - writer.uint32(90).string(message.goPackage); - } - if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { - writer.uint32(128).bool(message.ccGenericServices); - } - if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { - writer.uint32(136).bool(message.javaGenericServices); - } - if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { - writer.uint32(144).bool(message.pyGenericServices); - } - if (message.deprecated !== undefined && message.deprecated !== false) { - writer.uint32(184).bool(message.deprecated); - } - if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { - writer.uint32(248).bool(message.ccEnableArenas); - } - if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { - writer.uint32(290).string(message.objcClassPrefix); - } - if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { - writer.uint32(298).string(message.csharpNamespace); - } - if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { - writer.uint32(314).string(message.swiftPrefix); - } - if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { - writer.uint32(322).string(message.phpClassPrefix); - } - if (message.phpNamespace !== undefined && message.phpNamespace !== "") { - writer.uint32(330).string(message.phpNamespace); - } - if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { - writer.uint32(354).string(message.phpMetadataNamespace); - } - if (message.rubyPackage !== undefined && message.rubyPackage !== "") { - writer.uint32(362).string(message.rubyPackage); - } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); - } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFileOptions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.javaPackage = reader.string(); - continue; - } - case 8: { - if (tag !== 66) { - break; - } - - message.javaOuterClassname = reader.string(); - continue; - } - case 10: { - if (tag !== 80) { - break; - } - - message.javaMultipleFiles = reader.bool(); - continue; - } - case 20: { - if (tag !== 160) { - break; - } - - message.javaGenerateEqualsAndHash = reader.bool(); - continue; - } - case 27: { - if (tag !== 216) { - break; - } - - message.javaStringCheckUtf8 = reader.bool(); - continue; - } - case 9: { - if (tag !== 72) { - break; - } - - message.optimizeFor = fileOptions_OptimizeModeFromJSON(reader.int32()); - continue; - } - case 11: { - if (tag !== 90) { - break; - } - - message.goPackage = reader.string(); - continue; - } - case 16: { - if (tag !== 128) { - break; - } - - message.ccGenericServices = reader.bool(); - continue; - } - case 17: { - if (tag !== 136) { - break; - } - - message.javaGenericServices = reader.bool(); - continue; - } - case 18: { - if (tag !== 144) { - break; - } - - message.pyGenericServices = reader.bool(); - continue; - } - case 23: { - if (tag !== 184) { - break; - } - - message.deprecated = reader.bool(); - continue; - } - case 31: { - if (tag !== 248) { - break; - } - - message.ccEnableArenas = reader.bool(); - continue; - } - case 36: { - if (tag !== 290) { - break; - } - - message.objcClassPrefix = reader.string(); - continue; - } - case 37: { - if (tag !== 298) { - break; - } - - message.csharpNamespace = reader.string(); - continue; - } - case 39: { - if (tag !== 314) { - break; - } - - message.swiftPrefix = reader.string(); - continue; - } - case 40: { - if (tag !== 322) { - break; - } - - message.phpClassPrefix = reader.string(); - continue; - } - case 41: { - if (tag !== 330) { - break; - } - - message.phpNamespace = reader.string(); - continue; - } - case 44: { - if (tag !== 354) { - break; - } - - message.phpMetadataNamespace = reader.string(); - continue; - } - case 45: { - if (tag !== 362) { - break; - } - - message.rubyPackage = reader.string(); - continue; - } - case 50: { - if (tag !== 402) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; - } - case 999: { - if (tag !== 7994) { - break; - } - - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): FileOptions { - return FileOptions.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): FileOptions { - const message = createBaseFileOptions(); - message.javaPackage = object.javaPackage ?? ""; - message.javaOuterClassname = object.javaOuterClassname ?? ""; - message.javaMultipleFiles = object.javaMultipleFiles ?? false; - message.javaGenerateEqualsAndHash = object.javaGenerateEqualsAndHash ?? false; - message.javaStringCheckUtf8 = object.javaStringCheckUtf8 ?? false; - message.optimizeFor = object.optimizeFor ?? FileOptions_OptimizeMode.SPEED; - message.goPackage = object.goPackage ?? ""; - message.ccGenericServices = object.ccGenericServices ?? false; - message.javaGenericServices = object.javaGenericServices ?? false; - message.pyGenericServices = object.pyGenericServices ?? false; - message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? true; - message.objcClassPrefix = object.objcClassPrefix ?? ""; - message.csharpNamespace = object.csharpNamespace ?? ""; - message.swiftPrefix = object.swiftPrefix ?? ""; - message.phpClassPrefix = object.phpClassPrefix ?? ""; - message.phpNamespace = object.phpNamespace ?? ""; - message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; - message.rubyPackage = object.rubyPackage ?? ""; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseMessageOptions(): MessageOptions { - return { - messageSetWireFormat: false, - noStandardDescriptorAccessor: false, - deprecated: false, - mapEntry: false, - deprecatedLegacyJsonFieldConflicts: false, - features: undefined, - uninterpretedOption: [], - }; -} - -export const MessageOptions: MessageFns = { - encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { - writer.uint32(8).bool(message.messageSetWireFormat); - } - if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { - writer.uint32(16).bool(message.noStandardDescriptorAccessor); - } - if (message.deprecated !== undefined && message.deprecated !== false) { - writer.uint32(24).bool(message.deprecated); - } - if (message.mapEntry !== undefined && message.mapEntry !== false) { - writer.uint32(56).bool(message.mapEntry); - } - if ( - message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false - ) { - writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); - } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); - } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMessageOptions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.messageSetWireFormat = reader.bool(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.noStandardDescriptorAccessor = reader.bool(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.deprecated = reader.bool(); - continue; - } - case 7: { - if (tag !== 56) { - break; - } - - message.mapEntry = reader.bool(); - continue; - } - case 11: { - if (tag !== 88) { - break; - } - - message.deprecatedLegacyJsonFieldConflicts = reader.bool(); - continue; - } - case 12: { - if (tag !== 98) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; - } - case 999: { - if (tag !== 7994) { - break; - } - - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): MessageOptions { - return MessageOptions.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): MessageOptions { - const message = createBaseMessageOptions(); - message.messageSetWireFormat = object.messageSetWireFormat ?? false; - message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; - message.deprecated = object.deprecated ?? false; - message.mapEntry = object.mapEntry ?? false; - message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseFieldOptions(): FieldOptions { - return { - ctype: FieldOptions_CType.STRING, - packed: false, - jstype: FieldOptions_JSType.JS_NORMAL, - lazy: false, - unverifiedLazy: false, - deprecated: false, - weak: false, - debugRedact: false, - retention: FieldOptions_OptionRetention.RETENTION_UNKNOWN, - targets: [], - editionDefaults: [], - features: undefined, - featureSupport: undefined, - uninterpretedOption: [], - }; -} - -export const FieldOptions: MessageFns = { - encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.ctype !== undefined && message.ctype !== FieldOptions_CType.STRING) { - writer.uint32(8).int32(fieldOptions_CTypeToNumber(message.ctype)); - } - if (message.packed !== undefined && message.packed !== false) { - writer.uint32(16).bool(message.packed); - } - if (message.jstype !== undefined && message.jstype !== FieldOptions_JSType.JS_NORMAL) { - writer.uint32(48).int32(fieldOptions_JSTypeToNumber(message.jstype)); - } - if (message.lazy !== undefined && message.lazy !== false) { - writer.uint32(40).bool(message.lazy); - } - if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { - writer.uint32(120).bool(message.unverifiedLazy); - } - if (message.deprecated !== undefined && message.deprecated !== false) { - writer.uint32(24).bool(message.deprecated); - } - if (message.weak !== undefined && message.weak !== false) { - writer.uint32(80).bool(message.weak); - } - if (message.debugRedact !== undefined && message.debugRedact !== false) { - writer.uint32(128).bool(message.debugRedact); - } - if (message.retention !== undefined && message.retention !== FieldOptions_OptionRetention.RETENTION_UNKNOWN) { - writer.uint32(136).int32(fieldOptions_OptionRetentionToNumber(message.retention)); - } - writer.uint32(154).fork(); - for (const v of message.targets) { - writer.int32(fieldOptions_OptionTargetTypeToNumber(v)); - } - writer.join(); - for (const v of message.editionDefaults) { - FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); - } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); - } - if (message.featureSupport !== undefined) { - FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); - } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFieldOptions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.ctype = fieldOptions_CTypeFromJSON(reader.int32()); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.packed = reader.bool(); - continue; - } - case 6: { - if (tag !== 48) { - break; - } - - message.jstype = fieldOptions_JSTypeFromJSON(reader.int32()); - continue; - } - case 5: { - if (tag !== 40) { - break; - } - - message.lazy = reader.bool(); - continue; - } - case 15: { - if (tag !== 120) { - break; - } - - message.unverifiedLazy = reader.bool(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.deprecated = reader.bool(); - continue; - } - case 10: { - if (tag !== 80) { - break; - } - - message.weak = reader.bool(); - continue; - } - case 16: { - if (tag !== 128) { - break; - } - - message.debugRedact = reader.bool(); - continue; - } - case 17: { - if (tag !== 136) { - break; - } - - message.retention = fieldOptions_OptionRetentionFromJSON(reader.int32()); - continue; - } - case 19: { - if (tag === 152) { - message.targets.push(fieldOptions_OptionTargetTypeFromJSON(reader.int32())); - - continue; - } - - if (tag === 154) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.targets.push(fieldOptions_OptionTargetTypeFromJSON(reader.int32())); - } - - continue; - } - - break; - } - case 20: { - if (tag !== 162) { - break; - } - - message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); - continue; - } - case 21: { - if (tag !== 170) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; - } - case 22: { - if (tag !== 178) { - break; - } - - message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); - continue; - } - case 999: { - if (tag !== 7994) { - break; - } - - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): FieldOptions { - return FieldOptions.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): FieldOptions { - const message = createBaseFieldOptions(); - message.ctype = object.ctype ?? FieldOptions_CType.STRING; - message.packed = object.packed ?? false; - message.jstype = object.jstype ?? FieldOptions_JSType.JS_NORMAL; - message.lazy = object.lazy ?? false; - message.unverifiedLazy = object.unverifiedLazy ?? false; - message.deprecated = object.deprecated ?? false; - message.weak = object.weak ?? false; - message.debugRedact = object.debugRedact ?? false; - message.retention = object.retention ?? FieldOptions_OptionRetention.RETENTION_UNKNOWN; - message.targets = object.targets?.map((e) => e) || []; - message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; - message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) - ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) - : undefined; - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { - return { edition: Edition.EDITION_UNKNOWN, value: "" }; -} - -export const FieldOptions_EditionDefault: MessageFns = { - encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.edition !== undefined && message.edition !== Edition.EDITION_UNKNOWN) { - writer.uint32(24).int32(editionToNumber(message.edition)); - } - if (message.value !== undefined && message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFieldOptions_EditionDefault(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 3: { - if (tag !== 24) { - break; - } - - message.edition = editionFromJSON(reader.int32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): FieldOptions_EditionDefault { - return FieldOptions_EditionDefault.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): FieldOptions_EditionDefault { - const message = createBaseFieldOptions_EditionDefault(); - message.edition = object.edition ?? Edition.EDITION_UNKNOWN; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { - return { - editionIntroduced: Edition.EDITION_UNKNOWN, - editionDeprecated: Edition.EDITION_UNKNOWN, - deprecationWarning: "", - editionRemoved: Edition.EDITION_UNKNOWN, - }; -} - -export const FieldOptions_FeatureSupport: MessageFns = { - encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.editionIntroduced !== undefined && message.editionIntroduced !== Edition.EDITION_UNKNOWN) { - writer.uint32(8).int32(editionToNumber(message.editionIntroduced)); - } - if (message.editionDeprecated !== undefined && message.editionDeprecated !== Edition.EDITION_UNKNOWN) { - writer.uint32(16).int32(editionToNumber(message.editionDeprecated)); - } - if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { - writer.uint32(26).string(message.deprecationWarning); - } - if (message.editionRemoved !== undefined && message.editionRemoved !== Edition.EDITION_UNKNOWN) { - writer.uint32(32).int32(editionToNumber(message.editionRemoved)); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFieldOptions_FeatureSupport(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.editionIntroduced = editionFromJSON(reader.int32()); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.editionDeprecated = editionFromJSON(reader.int32()); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.deprecationWarning = reader.string(); - continue; - } - case 4: { - if (tag !== 32) { - break; - } - - message.editionRemoved = editionFromJSON(reader.int32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): FieldOptions_FeatureSupport { - return FieldOptions_FeatureSupport.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): FieldOptions_FeatureSupport { - const message = createBaseFieldOptions_FeatureSupport(); - message.editionIntroduced = object.editionIntroduced ?? Edition.EDITION_UNKNOWN; - message.editionDeprecated = object.editionDeprecated ?? Edition.EDITION_UNKNOWN; - message.deprecationWarning = object.deprecationWarning ?? ""; - message.editionRemoved = object.editionRemoved ?? Edition.EDITION_UNKNOWN; - return message; - }, -}; - -function createBaseOneofOptions(): OneofOptions { - return { features: undefined, uninterpretedOption: [] }; -} - -export const OneofOptions: MessageFns = { - encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); - } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOneofOptions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; - } - case 999: { - if (tag !== 7994) { - break; - } - - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): OneofOptions { - return OneofOptions.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): OneofOptions { - const message = createBaseOneofOptions(); - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseEnumOptions(): EnumOptions { - return { - allowAlias: false, - deprecated: false, - deprecatedLegacyJsonFieldConflicts: false, - features: undefined, - uninterpretedOption: [], - }; -} - -export const EnumOptions: MessageFns = { - encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.allowAlias !== undefined && message.allowAlias !== false) { - writer.uint32(16).bool(message.allowAlias); - } - if (message.deprecated !== undefined && message.deprecated !== false) { - writer.uint32(24).bool(message.deprecated); - } - if ( - message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false - ) { - writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); - } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); - } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumOptions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 2: { - if (tag !== 16) { - break; - } - - message.allowAlias = reader.bool(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.deprecated = reader.bool(); - continue; - } - case 6: { - if (tag !== 48) { - break; - } - - message.deprecatedLegacyJsonFieldConflicts = reader.bool(); - continue; - } - case 7: { - if (tag !== 58) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; - } - case 999: { - if (tag !== 7994) { - break; - } - - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): EnumOptions { - return EnumOptions.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): EnumOptions { - const message = createBaseEnumOptions(); - message.allowAlias = object.allowAlias ?? false; - message.deprecated = object.deprecated ?? false; - message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseEnumValueOptions(): EnumValueOptions { - return { - deprecated: false, - features: undefined, - debugRedact: false, - featureSupport: undefined, - uninterpretedOption: [], - }; -} - -export const EnumValueOptions: MessageFns = { - encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.deprecated !== undefined && message.deprecated !== false) { - writer.uint32(8).bool(message.deprecated); - } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); - } - if (message.debugRedact !== undefined && message.debugRedact !== false) { - writer.uint32(24).bool(message.debugRedact); - } - if (message.featureSupport !== undefined) { - FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); - } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEnumValueOptions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.deprecated = reader.bool(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.debugRedact = reader.bool(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); - continue; - } - case 999: { - if (tag !== 7994) { - break; - } - - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): EnumValueOptions { - return EnumValueOptions.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): EnumValueOptions { - const message = createBaseEnumValueOptions(); - message.deprecated = object.deprecated ?? false; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; - message.debugRedact = object.debugRedact ?? false; - message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) - ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) - : undefined; - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseServiceOptions(): ServiceOptions { - return { features: undefined, deprecated: false, uninterpretedOption: [] }; -} - -export const ServiceOptions: MessageFns = { - encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); - } - if (message.deprecated !== undefined && message.deprecated !== false) { - writer.uint32(264).bool(message.deprecated); - } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseServiceOptions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 34: { - if (tag !== 274) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; - } - case 33: { - if (tag !== 264) { - break; - } - - message.deprecated = reader.bool(); - continue; - } - case 999: { - if (tag !== 7994) { - break; - } - - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): ServiceOptions { - return ServiceOptions.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): ServiceOptions { - const message = createBaseServiceOptions(); - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; - message.deprecated = object.deprecated ?? false; - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseMethodOptions(): MethodOptions { - return { - deprecated: false, - idempotencyLevel: MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN, - features: undefined, - uninterpretedOption: [], - }; -} - -export const MethodOptions: MessageFns = { - encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.deprecated !== undefined && message.deprecated !== false) { - writer.uint32(264).bool(message.deprecated); - } - if ( - message.idempotencyLevel !== undefined && - message.idempotencyLevel !== MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN - ) { - writer.uint32(272).int32(methodOptions_IdempotencyLevelToNumber(message.idempotencyLevel)); - } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); - } - for (const v of message.uninterpretedOption) { - UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMethodOptions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 33: { - if (tag !== 264) { - break; - } - - message.deprecated = reader.bool(); - continue; - } - case 34: { - if (tag !== 272) { - break; - } - - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(reader.int32()); - continue; - } - case 35: { - if (tag !== 282) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; - } - case 999: { - if (tag !== 7994) { - break; - } - - message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): MethodOptions { - return MethodOptions.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): MethodOptions { - const message = createBaseMethodOptions(); - message.deprecated = object.deprecated ?? false; - message.idempotencyLevel = object.idempotencyLevel ?? MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; - message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseUninterpretedOption(): UninterpretedOption { - return { - name: [], - identifierValue: "", - positiveIntValue: 0, - negativeIntValue: 0, - doubleValue: 0, - stringValue: new Uint8Array(0), - aggregateValue: "", - }; -} - -export const UninterpretedOption: MessageFns = { - encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.name) { - UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); - } - if (message.identifierValue !== undefined && message.identifierValue !== "") { - writer.uint32(26).string(message.identifierValue); - } - if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { - writer.uint32(32).uint64(message.positiveIntValue); - } - if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { - writer.uint32(40).int64(message.negativeIntValue); - } - if (message.doubleValue !== undefined && message.doubleValue !== 0) { - writer.uint32(49).double(message.doubleValue); - } - if (message.stringValue !== undefined && message.stringValue.length !== 0) { - writer.uint32(58).bytes(message.stringValue); - } - if (message.aggregateValue !== undefined && message.aggregateValue !== "") { - writer.uint32(66).string(message.aggregateValue); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUninterpretedOption(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 2: { - if (tag !== 18) { - break; - } - - message.name.push(UninterpretedOption_NamePart.decode(reader, reader.uint32())); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.identifierValue = reader.string(); - continue; - } - case 4: { - if (tag !== 32) { - break; - } - - message.positiveIntValue = longToNumber(reader.uint64()); - continue; - } - case 5: { - if (tag !== 40) { - break; - } - - message.negativeIntValue = longToNumber(reader.int64()); - continue; - } - case 6: { - if (tag !== 49) { - break; - } - - message.doubleValue = reader.double(); - continue; - } - case 7: { - if (tag !== 58) { - break; - } - - message.stringValue = reader.bytes(); - continue; - } - case 8: { - if (tag !== 66) { - break; - } - - message.aggregateValue = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UninterpretedOption { - return UninterpretedOption.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UninterpretedOption { - const message = createBaseUninterpretedOption(); - message.name = object.name?.map((e) => UninterpretedOption_NamePart.fromPartial(e)) || []; - message.identifierValue = object.identifierValue ?? ""; - message.positiveIntValue = object.positiveIntValue ?? 0; - message.negativeIntValue = object.negativeIntValue ?? 0; - message.doubleValue = object.doubleValue ?? 0; - message.stringValue = object.stringValue ?? new Uint8Array(0); - message.aggregateValue = object.aggregateValue ?? ""; - return message; - }, -}; - -function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { - return { namePart: "", isExtension: false }; -} - -export const UninterpretedOption_NamePart: MessageFns = { - encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.namePart !== "") { - writer.uint32(10).string(message.namePart); - } - if (message.isExtension !== false) { - writer.uint32(16).bool(message.isExtension); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUninterpretedOption_NamePart(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.namePart = reader.string(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.isExtension = reader.bool(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UninterpretedOption_NamePart { - return UninterpretedOption_NamePart.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UninterpretedOption_NamePart { - const message = createBaseUninterpretedOption_NamePart(); - message.namePart = object.namePart ?? ""; - message.isExtension = object.isExtension ?? false; - return message; - }, -}; - -function createBaseFeatureSet(): FeatureSet { - return { - fieldPresence: FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN, - enumType: FeatureSet_EnumType.ENUM_TYPE_UNKNOWN, - repeatedFieldEncoding: FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN, - utf8Validation: FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN, - messageEncoding: FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN, - jsonFormat: FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN, - enforceNamingStyle: FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN, - defaultSymbolVisibility: FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN, - }; -} - -export const FeatureSet: MessageFns = { - encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if ( - message.fieldPresence !== undefined && message.fieldPresence !== FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN - ) { - writer.uint32(8).int32(featureSet_FieldPresenceToNumber(message.fieldPresence)); - } - if (message.enumType !== undefined && message.enumType !== FeatureSet_EnumType.ENUM_TYPE_UNKNOWN) { - writer.uint32(16).int32(featureSet_EnumTypeToNumber(message.enumType)); - } - if ( - message.repeatedFieldEncoding !== undefined && - message.repeatedFieldEncoding !== FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN - ) { - writer.uint32(24).int32(featureSet_RepeatedFieldEncodingToNumber(message.repeatedFieldEncoding)); - } - if ( - message.utf8Validation !== undefined && - message.utf8Validation !== FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN - ) { - writer.uint32(32).int32(featureSet_Utf8ValidationToNumber(message.utf8Validation)); - } - if ( - message.messageEncoding !== undefined && - message.messageEncoding !== FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN - ) { - writer.uint32(40).int32(featureSet_MessageEncodingToNumber(message.messageEncoding)); - } - if (message.jsonFormat !== undefined && message.jsonFormat !== FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN) { - writer.uint32(48).int32(featureSet_JsonFormatToNumber(message.jsonFormat)); - } - if ( - message.enforceNamingStyle !== undefined && - message.enforceNamingStyle !== FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN - ) { - writer.uint32(56).int32(featureSet_EnforceNamingStyleToNumber(message.enforceNamingStyle)); - } - if ( - message.defaultSymbolVisibility !== undefined && - message.defaultSymbolVisibility !== - FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN - ) { - writer.uint32(64).int32( - featureSet_VisibilityFeature_DefaultSymbolVisibilityToNumber(message.defaultSymbolVisibility), - ); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFeatureSet(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.fieldPresence = featureSet_FieldPresenceFromJSON(reader.int32()); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.enumType = featureSet_EnumTypeFromJSON(reader.int32()); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingFromJSON(reader.int32()); - continue; - } - case 4: { - if (tag !== 32) { - break; - } - - message.utf8Validation = featureSet_Utf8ValidationFromJSON(reader.int32()); - continue; - } - case 5: { - if (tag !== 40) { - break; - } - - message.messageEncoding = featureSet_MessageEncodingFromJSON(reader.int32()); - continue; - } - case 6: { - if (tag !== 48) { - break; - } - - message.jsonFormat = featureSet_JsonFormatFromJSON(reader.int32()); - continue; - } - case 7: { - if (tag !== 56) { - break; - } - - message.enforceNamingStyle = featureSet_EnforceNamingStyleFromJSON(reader.int32()); - continue; - } - case 8: { - if (tag !== 64) { - break; - } - - message.defaultSymbolVisibility = featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON( - reader.int32(), - ); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): FeatureSet { - return FeatureSet.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): FeatureSet { - const message = createBaseFeatureSet(); - message.fieldPresence = object.fieldPresence ?? FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; - message.enumType = object.enumType ?? FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; - message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? - FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; - message.utf8Validation = object.utf8Validation ?? FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; - message.messageEncoding = object.messageEncoding ?? FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; - message.jsonFormat = object.jsonFormat ?? FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; - message.enforceNamingStyle = object.enforceNamingStyle ?? - FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN; - message.defaultSymbolVisibility = object.defaultSymbolVisibility ?? - FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN; - return message; - }, -}; - -function createBaseFeatureSet_VisibilityFeature(): FeatureSet_VisibilityFeature { - return {}; -} - -export const FeatureSet_VisibilityFeature: MessageFns = { - encode(_: FeatureSet_VisibilityFeature, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet_VisibilityFeature { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFeatureSet_VisibilityFeature(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): FeatureSet_VisibilityFeature { - return FeatureSet_VisibilityFeature.fromPartial(base ?? {}); - }, - fromPartial(_: DeepPartial): FeatureSet_VisibilityFeature { - const message = createBaseFeatureSet_VisibilityFeature(); - return message; - }, -}; - -function createBaseFeatureSetDefaults(): FeatureSetDefaults { - return { defaults: [], minimumEdition: Edition.EDITION_UNKNOWN, maximumEdition: Edition.EDITION_UNKNOWN }; -} - -export const FeatureSetDefaults: MessageFns = { - encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.defaults) { - FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); - } - if (message.minimumEdition !== undefined && message.minimumEdition !== Edition.EDITION_UNKNOWN) { - writer.uint32(32).int32(editionToNumber(message.minimumEdition)); - } - if (message.maximumEdition !== undefined && message.maximumEdition !== Edition.EDITION_UNKNOWN) { - writer.uint32(40).int32(editionToNumber(message.maximumEdition)); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFeatureSetDefaults(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); - continue; - } - case 4: { - if (tag !== 32) { - break; - } - - message.minimumEdition = editionFromJSON(reader.int32()); - continue; - } - case 5: { - if (tag !== 40) { - break; - } - - message.maximumEdition = editionFromJSON(reader.int32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): FeatureSetDefaults { - return FeatureSetDefaults.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): FeatureSetDefaults { - const message = createBaseFeatureSetDefaults(); - message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; - message.minimumEdition = object.minimumEdition ?? Edition.EDITION_UNKNOWN; - message.maximumEdition = object.maximumEdition ?? Edition.EDITION_UNKNOWN; - return message; - }, -}; - -function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { - return { edition: Edition.EDITION_UNKNOWN, overridableFeatures: undefined, fixedFeatures: undefined }; -} - -export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { - encode( - message: FeatureSetDefaults_FeatureSetEditionDefault, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.edition !== undefined && message.edition !== Edition.EDITION_UNKNOWN) { - writer.uint32(24).int32(editionToNumber(message.edition)); - } - if (message.overridableFeatures !== undefined) { - FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); - } - if (message.fixedFeatures !== undefined) { - FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 3: { - if (tag !== 24) { - break; - } - - message.edition = editionFromJSON(reader.int32()); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): FeatureSetDefaults_FeatureSetEditionDefault { - return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? {}); - }, - fromPartial( - object: DeepPartial, - ): FeatureSetDefaults_FeatureSetEditionDefault { - const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); - message.edition = object.edition ?? Edition.EDITION_UNKNOWN; - message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) - ? FeatureSet.fromPartial(object.overridableFeatures) - : undefined; - message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) - ? FeatureSet.fromPartial(object.fixedFeatures) - : undefined; - return message; - }, -}; - -function createBaseSourceCodeInfo(): SourceCodeInfo { - return { location: [] }; -} - -export const SourceCodeInfo: MessageFns = { - encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.location) { - SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSourceCodeInfo(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.location.push(SourceCodeInfo_Location.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): SourceCodeInfo { - return SourceCodeInfo.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): SourceCodeInfo { - const message = createBaseSourceCodeInfo(); - message.location = object.location?.map((e) => SourceCodeInfo_Location.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { - return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; -} - -export const SourceCodeInfo_Location: MessageFns = { - encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - writer.uint32(10).fork(); - for (const v of message.path) { - writer.int32(v); - } - writer.join(); - writer.uint32(18).fork(); - for (const v of message.span) { - writer.int32(v); - } - writer.join(); - if (message.leadingComments !== undefined && message.leadingComments !== "") { - writer.uint32(26).string(message.leadingComments); - } - if (message.trailingComments !== undefined && message.trailingComments !== "") { - writer.uint32(34).string(message.trailingComments); - } - for (const v of message.leadingDetachedComments) { - writer.uint32(50).string(v!); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSourceCodeInfo_Location(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag === 8) { - message.path.push(reader.int32()); - - continue; - } - - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.path.push(reader.int32()); - } - - continue; - } - - break; - } - case 2: { - if (tag === 16) { - message.span.push(reader.int32()); - - continue; - } - - if (tag === 18) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.span.push(reader.int32()); - } - - continue; - } - - break; - } - case 3: { - if (tag !== 26) { - break; - } - - message.leadingComments = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.trailingComments = reader.string(); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - - message.leadingDetachedComments.push(reader.string()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): SourceCodeInfo_Location { - return SourceCodeInfo_Location.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): SourceCodeInfo_Location { - const message = createBaseSourceCodeInfo_Location(); - message.path = object.path?.map((e) => e) || []; - message.span = object.span?.map((e) => e) || []; - message.leadingComments = object.leadingComments ?? ""; - message.trailingComments = object.trailingComments ?? ""; - message.leadingDetachedComments = object.leadingDetachedComments?.map((e) => e) || []; - return message; - }, -}; - -function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { - return { annotation: [] }; -} - -export const GeneratedCodeInfo: MessageFns = { - encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.annotation) { - GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGeneratedCodeInfo(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.annotation.push(GeneratedCodeInfo_Annotation.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GeneratedCodeInfo { - return GeneratedCodeInfo.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GeneratedCodeInfo { - const message = createBaseGeneratedCodeInfo(); - message.annotation = object.annotation?.map((e) => GeneratedCodeInfo_Annotation.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { - return { path: [], sourceFile: "", begin: 0, end: 0, semantic: GeneratedCodeInfo_Annotation_Semantic.NONE }; -} - -export const GeneratedCodeInfo_Annotation: MessageFns = { - encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - writer.uint32(10).fork(); - for (const v of message.path) { - writer.int32(v); - } - writer.join(); - if (message.sourceFile !== undefined && message.sourceFile !== "") { - writer.uint32(18).string(message.sourceFile); - } - if (message.begin !== undefined && message.begin !== 0) { - writer.uint32(24).int32(message.begin); - } - if (message.end !== undefined && message.end !== 0) { - writer.uint32(32).int32(message.end); - } - if (message.semantic !== undefined && message.semantic !== GeneratedCodeInfo_Annotation_Semantic.NONE) { - writer.uint32(40).int32(generatedCodeInfo_Annotation_SemanticToNumber(message.semantic)); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGeneratedCodeInfo_Annotation(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag === 8) { - message.path.push(reader.int32()); - - continue; - } - - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.path.push(reader.int32()); - } - - continue; - } - - break; - } - case 2: { - if (tag !== 18) { - break; - } - - message.sourceFile = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.begin = reader.int32(); - continue; - } - case 4: { - if (tag !== 32) { - break; - } - - message.end = reader.int32(); - continue; - } - case 5: { - if (tag !== 40) { - break; - } - - message.semantic = generatedCodeInfo_Annotation_SemanticFromJSON(reader.int32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): GeneratedCodeInfo_Annotation { - return GeneratedCodeInfo_Annotation.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): GeneratedCodeInfo_Annotation { - const message = createBaseGeneratedCodeInfo_Annotation(); - message.path = object.path?.map((e) => e) || []; - message.sourceFile = object.sourceFile ?? ""; - message.begin = object.begin ?? 0; - message.end = object.end ?? 0; - message.semantic = object.semantic ?? GeneratedCodeInfo_Annotation_Semantic.NONE; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -function longToNumber(int64: { toString(): string }): number { - const num = globalThis.Number(int64.toString()); - if (num > globalThis.Number.MAX_SAFE_INTEGER) { - throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); - } - if (num < globalThis.Number.MIN_SAFE_INTEGER) { - throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); - } - return num; -} - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/google/protobuf/duration.ts b/web/src/types/proto/google/protobuf/duration.ts deleted file mode 100644 index 8ad3d7415..000000000 --- a/web/src/types/proto/google/protobuf/duration.ts +++ /dev/null @@ -1,172 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: google/protobuf/duration.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; - -export const protobufPackage = "google.protobuf"; - -/** - * A Duration represents a signed, fixed-length span of time represented - * as a count of seconds and fractions of seconds at nanosecond - * resolution. It is independent of any calendar and concepts like "day" - * or "month". It is related to Timestamp in that the difference between - * two Timestamp values is a Duration and it can be added or subtracted - * from a Timestamp. Range is approximately +-10,000 years. - * - * # Examples - * - * Example 1: Compute Duration from two Timestamps in pseudo code. - * - * Timestamp start = ...; - * Timestamp end = ...; - * Duration duration = ...; - * - * duration.seconds = end.seconds - start.seconds; - * duration.nanos = end.nanos - start.nanos; - * - * if (duration.seconds < 0 && duration.nanos > 0) { - * duration.seconds += 1; - * duration.nanos -= 1000000000; - * } else if (duration.seconds > 0 && duration.nanos < 0) { - * duration.seconds -= 1; - * duration.nanos += 1000000000; - * } - * - * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. - * - * Timestamp start = ...; - * Duration duration = ...; - * Timestamp end = ...; - * - * end.seconds = start.seconds + duration.seconds; - * end.nanos = start.nanos + duration.nanos; - * - * if (end.nanos < 0) { - * end.seconds -= 1; - * end.nanos += 1000000000; - * } else if (end.nanos >= 1000000000) { - * end.seconds += 1; - * end.nanos -= 1000000000; - * } - * - * Example 3: Compute Duration from datetime.timedelta in Python. - * - * td = datetime.timedelta(days=3, minutes=10) - * duration = Duration() - * duration.FromTimedelta(td) - * - * # JSON Mapping - * - * In JSON format, the Duration type is encoded as a string rather than an - * object, where the string ends in the suffix "s" (indicating seconds) and - * is preceded by the number of seconds, with nanoseconds expressed as - * fractional seconds. For example, 3 seconds with 0 nanoseconds should be - * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should - * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 - * microsecond should be expressed in JSON format as "3.000001s". - */ -export interface Duration { - /** - * Signed seconds of the span of time. Must be from -315,576,000,000 - * to +315,576,000,000 inclusive. Note: these bounds are computed from: - * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - */ - seconds: number; - /** - * Signed fractions of a second at nanosecond resolution of the span - * of time. Durations less than one second are represented with a 0 - * `seconds` field and a positive or negative `nanos` field. For durations - * of one second or more, a non-zero value for the `nanos` field must be - * of the same sign as the `seconds` field. Must be from -999,999,999 - * to +999,999,999 inclusive. - */ - nanos: number; -} - -function createBaseDuration(): Duration { - return { seconds: 0, nanos: 0 }; -} - -export const Duration: MessageFns = { - encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.seconds !== 0) { - writer.uint32(8).int64(message.seconds); - } - if (message.nanos !== 0) { - writer.uint32(16).int32(message.nanos); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Duration { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDuration(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.seconds = longToNumber(reader.int64()); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.nanos = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): Duration { - return Duration.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): Duration { - const message = createBaseDuration(); - message.seconds = object.seconds ?? 0; - message.nanos = object.nanos ?? 0; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -function longToNumber(int64: { toString(): string }): number { - const num = globalThis.Number(int64.toString()); - if (num > globalThis.Number.MAX_SAFE_INTEGER) { - throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); - } - if (num < globalThis.Number.MIN_SAFE_INTEGER) { - throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); - } - return num; -} - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/google/protobuf/empty.ts b/web/src/types/proto/google/protobuf/empty.ts deleted file mode 100644 index bf1bfaab8..000000000 --- a/web/src/types/proto/google/protobuf/empty.ts +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: google/protobuf/empty.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; - -export const protobufPackage = "google.protobuf"; - -/** - * A generic empty message that you can re-use to avoid defining duplicated - * empty messages in your APIs. A typical example is to use it as the request - * or the response type of an API method. For instance: - * - * service Foo { - * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - * } - */ -export interface Empty { -} - -function createBaseEmpty(): Empty { - return {}; -} - -export const Empty: MessageFns = { - encode(_: Empty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Empty { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEmpty(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): Empty { - return Empty.fromPartial(base ?? {}); - }, - fromPartial(_: DeepPartial): Empty { - const message = createBaseEmpty(); - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/types/proto/google/protobuf/field_mask.ts b/web/src/types/proto/google/protobuf/field_mask.ts deleted file mode 100644 index 82f80a732..000000000 --- a/web/src/types/proto/google/protobuf/field_mask.ts +++ /dev/null @@ -1,291 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: google/protobuf/field_mask.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; - -export const protobufPackage = "google.protobuf"; - -/** - * `FieldMask` represents a set of symbolic field paths, for example: - * - * paths: "f.a" - * paths: "f.b.d" - * - * Here `f` represents a field in some root message, `a` and `b` - * fields in the message found in `f`, and `d` a field found in the - * message in `f.b`. - * - * Field masks are used to specify a subset of fields that should be - * returned by a get operation or modified by an update operation. - * Field masks also have a custom JSON encoding (see below). - * - * # Field Masks in Projections - * - * When used in the context of a projection, a response message or - * sub-message is filtered by the API to only contain those fields as - * specified in the mask. For example, if the mask in the previous - * example is applied to a response message as follows: - * - * f { - * a : 22 - * b { - * d : 1 - * x : 2 - * } - * y : 13 - * } - * z: 8 - * - * The result will not contain specific values for fields x,y and z - * (their value will be set to the default, and omitted in proto text - * output): - * - * f { - * a : 22 - * b { - * d : 1 - * } - * } - * - * A repeated field is not allowed except at the last position of a - * paths string. - * - * If a FieldMask object is not present in a get operation, the - * operation applies to all fields (as if a FieldMask of all fields - * had been specified). - * - * Note that a field mask does not necessarily apply to the - * top-level response message. In case of a REST get operation, the - * field mask applies directly to the response, but in case of a REST - * list operation, the mask instead applies to each individual message - * in the returned resource list. In case of a REST custom method, - * other definitions may be used. Where the mask applies will be - * clearly documented together with its declaration in the API. In - * any case, the effect on the returned resource/resources is required - * behavior for APIs. - * - * # Field Masks in Update Operations - * - * A field mask in update operations specifies which fields of the - * targeted resource are going to be updated. The API is required - * to only change the values of the fields as specified in the mask - * and leave the others untouched. If a resource is passed in to - * describe the updated values, the API ignores the values of all - * fields not covered by the mask. - * - * If a repeated field is specified for an update operation, new values will - * be appended to the existing repeated field in the target resource. Note that - * a repeated field is only allowed in the last position of a `paths` string. - * - * If a sub-message is specified in the last position of the field mask for an - * update operation, then new value will be merged into the existing sub-message - * in the target resource. - * - * For example, given the target message: - * - * f { - * b { - * d: 1 - * x: 2 - * } - * c: [1] - * } - * - * And an update message: - * - * f { - * b { - * d: 10 - * } - * c: [2] - * } - * - * then if the field mask is: - * - * paths: ["f.b", "f.c"] - * - * then the result will be: - * - * f { - * b { - * d: 10 - * x: 2 - * } - * c: [1, 2] - * } - * - * An implementation may provide options to override this default behavior for - * repeated and message fields. - * - * In order to reset a field's value to the default, the field must - * be in the mask and set to the default value in the provided resource. - * Hence, in order to reset all fields of a resource, provide a default - * instance of the resource and set all fields in the mask, or do - * not provide a mask as described below. - * - * If a field mask is not present on update, the operation applies to - * all fields (as if a field mask of all fields has been specified). - * Note that in the presence of schema evolution, this may mean that - * fields the client does not know and has therefore not filled into - * the request will be reset to their default. If this is unwanted - * behavior, a specific service may require a client to always specify - * a field mask, producing an error if not. - * - * As with get operations, the location of the resource which - * describes the updated values in the request message depends on the - * operation kind. In any case, the effect of the field mask is - * required to be honored by the API. - * - * ## Considerations for HTTP REST - * - * The HTTP kind of an update operation which uses a field mask must - * be set to PATCH instead of PUT in order to satisfy HTTP semantics - * (PUT must only be used for full updates). - * - * # JSON Encoding of Field Masks - * - * In JSON, a field mask is encoded as a single string where paths are - * separated by a comma. Fields name in each path are converted - * to/from lower-camel naming conventions. - * - * As an example, consider the following message declarations: - * - * message Profile { - * User user = 1; - * Photo photo = 2; - * } - * message User { - * string display_name = 1; - * string address = 2; - * } - * - * In proto a field mask for `Profile` may look as such: - * - * mask { - * paths: "user.display_name" - * paths: "photo" - * } - * - * In JSON, the same mask is represented as below: - * - * { - * mask: "user.displayName,photo" - * } - * - * # Field Masks and Oneof Fields - * - * Field masks treat fields in oneofs just as regular fields. Consider the - * following message: - * - * message SampleMessage { - * oneof test_oneof { - * string name = 4; - * SubMessage sub_message = 9; - * } - * } - * - * The field mask can be: - * - * mask { - * paths: "name" - * } - * - * Or: - * - * mask { - * paths: "sub_message" - * } - * - * Note that oneof type names ("test_oneof" in this case) cannot be used in - * paths. - * - * ## Field Mask Verification - * - * The implementation of any API method which has a FieldMask type field in the - * request should verify the included field paths, and return an - * `INVALID_ARGUMENT` error if any path is unmappable. - */ -export interface FieldMask { - /** The set of field mask paths. */ - paths: string[]; -} - -function createBaseFieldMask(): FieldMask { - return { paths: [] }; -} - -export const FieldMask: MessageFns & FieldMaskWrapperFns = { - encode(message: FieldMask, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.paths) { - writer.uint32(10).string(v!); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): FieldMask { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFieldMask(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.paths.push(reader.string()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): FieldMask { - return FieldMask.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): FieldMask { - const message = createBaseFieldMask(); - message.paths = object.paths?.map((e) => e) || []; - return message; - }, - - wrap(paths: string[]): FieldMask { - const result = createBaseFieldMask(); - result.paths = paths; - return result; - }, - - unwrap(message: FieldMask): string[] { - return message.paths; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} - -export interface FieldMaskWrapperFns { - wrap(paths: string[]): FieldMask; - unwrap(message: FieldMask): string[]; -} diff --git a/web/src/types/proto/google/protobuf/timestamp.ts b/web/src/types/proto/google/protobuf/timestamp.ts deleted file mode 100644 index 76c6bcbb5..000000000 --- a/web/src/types/proto/google/protobuf/timestamp.ts +++ /dev/null @@ -1,201 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.6.1 -// protoc unknown -// source: google/protobuf/timestamp.proto - -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; - -export const protobufPackage = "google.protobuf"; - -/** - * A Timestamp represents a point in time independent of any time zone or local - * calendar, encoded as a count of seconds and fractions of seconds at - * nanosecond resolution. The count is relative to an epoch at UTC midnight on - * January 1, 1970, in the proleptic Gregorian calendar which extends the - * Gregorian calendar backwards to year one. - * - * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - * second table is needed for interpretation, using a [24-hour linear - * smear](https://developers.google.com/time/smear). - * - * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - * restricting to that range, we ensure that we can convert to and from [RFC - * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - * - * # Examples - * - * Example 1: Compute Timestamp from POSIX `time()`. - * - * Timestamp timestamp; - * timestamp.set_seconds(time(NULL)); - * timestamp.set_nanos(0); - * - * Example 2: Compute Timestamp from POSIX `gettimeofday()`. - * - * struct timeval tv; - * gettimeofday(&tv, NULL); - * - * Timestamp timestamp; - * timestamp.set_seconds(tv.tv_sec); - * timestamp.set_nanos(tv.tv_usec * 1000); - * - * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - * - * FILETIME ft; - * GetSystemTimeAsFileTime(&ft); - * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - * - * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - * Timestamp timestamp; - * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - * - * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - * - * long millis = System.currentTimeMillis(); - * - * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - * .setNanos((int) ((millis % 1000) * 1000000)).build(); - * - * Example 5: Compute Timestamp from Java `Instant.now()`. - * - * Instant now = Instant.now(); - * - * Timestamp timestamp = - * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - * .setNanos(now.getNano()).build(); - * - * Example 6: Compute Timestamp from current time in Python. - * - * timestamp = Timestamp() - * timestamp.GetCurrentTime() - * - * # JSON Mapping - * - * In JSON format, the Timestamp type is encoded as a string in the - * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the - * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" - * where {year} is always expressed using four digits while {month}, {day}, - * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional - * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), - * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone - * is required. A proto3 JSON serializer should always use UTC (as indicated by - * "Z") when printing the Timestamp type and a proto3 JSON parser should be - * able to accept both UTC and other timezones (as indicated by an offset). - * - * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past - * 01:30 UTC on January 15, 2017. - * - * In JavaScript, one can convert a Date object to this format using the - * standard - * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - * method. In Python, a standard `datetime.datetime` object can be converted - * to this format using - * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with - * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use - * the Joda Time's [`ISODateTimeFormat.dateTime()`]( - * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() - * ) to obtain a formatter capable of generating timestamps in this format. - */ -export interface Timestamp { - /** - * Represents seconds of UTC time since Unix epoch - * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - * 9999-12-31T23:59:59Z inclusive. - */ - seconds: number; - /** - * Non-negative fractions of a second at nanosecond resolution. Negative - * second values with fractions must still have non-negative nanos values - * that count forward in time. Must be from 0 to 999,999,999 - * inclusive. - */ - nanos: number; -} - -function createBaseTimestamp(): Timestamp { - return { seconds: 0, nanos: 0 }; -} - -export const Timestamp: MessageFns = { - encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.seconds !== 0) { - writer.uint32(8).int64(message.seconds); - } - if (message.nanos !== 0) { - writer.uint32(16).int32(message.nanos); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTimestamp(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.seconds = longToNumber(reader.int64()); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.nanos = reader.int32(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): Timestamp { - return Timestamp.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): Timestamp { - const message = createBaseTimestamp(); - message.seconds = object.seconds ?? 0; - message.nanos = object.nanos ?? 0; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -function longToNumber(int64: { toString(): string }): number { - const num = globalThis.Number(int64.toString()); - if (num > globalThis.Number.MAX_SAFE_INTEGER) { - throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); - } - if (num < globalThis.Number.MIN_SAFE_INTEGER) { - throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); - } - return num; -} - -export interface MessageFns { - encode(message: T, writer?: BinaryWriter): BinaryWriter; - decode(input: BinaryReader | Uint8Array, length?: number): T; - create(base?: DeepPartial): T; - fromPartial(object: DeepPartial): T; -} diff --git a/web/src/utils/attachment.ts b/web/src/utils/attachment.ts index a2cfe1dda..5f3f1c64e 100644 --- a/web/src/utils/attachment.ts +++ b/web/src/utils/attachment.ts @@ -1,4 +1,4 @@ -import { Attachment } from "@/types/proto/api/v1/attachment_service"; +import { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; export const getAttachmentUrl = (attachment: Attachment) => { if (attachment.externalLink) { diff --git a/web/src/utils/memo.ts b/web/src/utils/memo.ts index fc944e330..73327a9f8 100644 --- a/web/src/utils/memo.ts +++ b/web/src/utils/memo.ts @@ -1,4 +1,4 @@ -import { Visibility } from "@/types/proto/api/v1/memo_service"; +import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; export const convertVisibilityFromString = (visibility: string) => { switch (visibility) { diff --git a/web/src/utils/user.ts b/web/src/utils/user.ts index 4edaee3b7..f8d1280b1 100644 --- a/web/src/utils/user.ts +++ b/web/src/utils/user.ts @@ -1,4 +1,4 @@ -import { User, User_Role } from "@/types/proto/api/v1/user_service"; +import { User, User_Role } from "@/types/proto/api/v1/user_service_pb"; export const isSuperUser = (user: User | undefined) => { return user && (user.role === User_Role.ADMIN || user.role === User_Role.HOST);