The code and data behind xeiaso.net
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: migrate to buf (#1188)

* chore: move patreon-saasproxy to use buf

Signed-off-by: Xe Iaso <me@xeiaso.net>

* chore(proto): migrate other types over

Signed-off-by: Xe Iaso <me@xeiaso.net>

* chore: delete old pb folder

Signed-off-by: Xe Iaso <me@xeiaso.net>

* ci: add buf CI step

Signed-off-by: Xe Iaso <me@xeiaso.net>

* chore: buf format

Signed-off-by: Xe Iaso <me@xeiaso.net>

* fix(proto): resolve buf lint errors for xeiaso/net protos

Rename services to use Service suffix (Meta→MetaService,
Feed→FeedService, Patreon→PatreonService, Admin→AdminService).
Add dedicated request/response wrapper types for each RPC instead
of reusing google.protobuf.Empty and shared message types.
Silence lint rules for external within/website and protofeed protos
via ignore_only in buf.yaml. Regenerate code and update all Go
callers to match new types.

Assisted-by: Claude Opus 4.6 via Claude Code
Signed-off-by: Xe Iaso <me@xeiaso.net>

* ci(buf): disable breaking change detection temporarily

Will re-enable after merging the service rename changes.

Assisted-by: Claude Opus 4.6 via Claude Code
Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>

authored by

Xe Iaso and committed by
GitHub
941e38b2 ed64108e

+7643 -1445
+34
.github/workflows/buf-build.yml
··· 1 + name: Buf 2 + 3 + on: 4 + push: 5 + branches: ["main"] 6 + pull_request: 7 + branches: ["main"] 8 + 9 + jobs: 10 + protobuf: 11 + runs-on: ubuntu-latest 12 + if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} 13 + steps: 14 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 15 + with: 16 + persist-credentials: false 17 + fetch-tags: true 18 + fetch-depth: 0 19 + 20 + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 21 + with: 22 + node-version: latest 23 + 24 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 25 + with: 26 + go-version: stable 27 + 28 + - run: | 29 + go install github.com/twitchtv/twirp/protoc-gen-twirp 30 + 31 + - uses: bufbuild/buf-action@8f4a1456a0ab6a1eb80ba68e53832e6fcfacc16c # v1.3.0 32 + with: 33 + token: ${{ secrets.BUF_TOKEN }} 34 + breaking: false
+26
buf.gen.yaml
··· 1 + version: v2 2 + 3 + managed: 4 + enabled: true 5 + override: 6 + - file_option: go_package_prefix 7 + value: xeiaso.net/v4/gen 8 + disable: 9 + - module: buf.build/bufbuild/protovalidate 10 + file_option: go_package_prefix 11 + 12 + plugins: 13 + - remote: buf.build/protocolbuffers/go 14 + out: gen 15 + opt: 16 + - paths=source_relative 17 + 18 + - remote: buf.build/grpc/go 19 + out: gen 20 + opt: 21 + - paths=source_relative 22 + 23 + - local: protoc-gen-twirp 24 + out: gen 25 + opt: 26 + - paths=source_relative
+6
buf.lock
··· 1 + # Generated by buf. DO NOT EDIT. 2 + version: v2 3 + deps: 4 + - name: buf.build/bufbuild/protovalidate 5 + commit: 80ab13bee0bf4272b6161a72bf7034e0 6 + digest: b5:1aa6a965be5d02d64e1d81954fa2e78ef9d1e33a0c30f92bc2626039006a94deb3a5b05f14ed8893f5c3ffce444ac008f7e968188ad225c4c29c813aa5f2daa1
+28
buf.yaml
··· 1 + version: v2 2 + modules: 3 + - path: proto 4 + deps: 5 + - buf.build/bufbuild/protovalidate 6 + lint: 7 + use: 8 + - STANDARD 9 + ignore_only: 10 + PACKAGE_DIRECTORY_MATCH: 11 + - proto/external/protofeed/v1/protofeed.proto 12 + PACKAGE_VERSION_SUFFIX: 13 + - proto/external/protofeed/v1/protofeed.proto 14 + SERVICE_SUFFIX: 15 + - proto/within/website/x/mi/v1/mi.proto 16 + - proto/within/website/x/mimi/announce/v1/announce.proto 17 + RPC_REQUEST_STANDARD_NAME: 18 + - proto/within/website/x/mi/v1/mi.proto 19 + - proto/within/website/x/mimi/announce/v1/announce.proto 20 + RPC_RESPONSE_STANDARD_NAME: 21 + - proto/within/website/x/mi/v1/mi.proto 22 + - proto/within/website/x/mimi/announce/v1/announce.proto 23 + RPC_REQUEST_RESPONSE_UNIQUE: 24 + - proto/within/website/x/mi/v1/mi.proto 25 + - proto/within/website/x/mimi/announce/v1/announce.proto 26 + breaking: 27 + use: 28 + - FILE
+11 -10
cmd/patreon-saasproxy/main.go
··· 14 14 _ "github.com/joho/godotenv/autoload" 15 15 "github.com/twitchtv/twirp" 16 16 "golang.org/x/oauth2" 17 - "google.golang.org/protobuf/types/known/emptypb" 18 17 "google.golang.org/protobuf/types/known/timestamppb" 19 18 "gopkg.in/mxpv/patreon-go.v1" 19 + adminpb "xeiaso.net/v4/gen/xeiaso/net/admin/v1" 20 20 "xeiaso.net/v4/internal" 21 - "xeiaso.net/v4/internal/adminpb" 22 21 "xeiaso.net/v4/internal/k8s" 23 22 ) 24 23 ··· 57 56 cts: cts, 58 57 } 59 58 60 - ph := adminpb.NewPatreonServer(s) 61 - http.Handle(adminpb.PatreonPathPrefix, ph) 59 + ph := adminpb.NewPatreonServiceServer(s) 60 + http.Handle(adminpb.PatreonServicePathPrefix, ph) 62 61 63 62 http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { 64 63 fmt.Fprintln(w, "OK") ··· 79 78 cts oauth2.TokenSource 80 79 } 81 80 82 - func (s *Server) GetToken(ctx context.Context, _ *emptypb.Empty) (*adminpb.PatreonToken, error) { 81 + func (s *Server) GetToken(ctx context.Context, _ *adminpb.GetTokenRequest) (*adminpb.GetTokenResponse, error) { 83 82 token, err := s.cts.Token() 84 83 if err != nil { 85 84 slog.Error("token fetch failed", "err", err) 86 85 return nil, twirp.InternalErrorWith(err) 87 86 } 88 87 89 - return &adminpb.PatreonToken{ 90 - AccessToken: token.AccessToken, 91 - TokenType: token.TokenType, 92 - RefreshToken: token.RefreshToken, 93 - Expiry: timestamppb.New(token.Expiry), 88 + return &adminpb.GetTokenResponse{ 89 + Token: &adminpb.PatreonToken{ 90 + AccessToken: token.AccessToken, 91 + TokenType: token.TokenType, 92 + RefreshToken: token.RefreshToken, 93 + Expiry: timestamppb.New(token.Expiry), 94 + }, 94 95 }, nil 95 96 }
+9 -7
cmd/xesite/api.go
··· 8 8 "strings" 9 9 10 10 "github.com/twitchtv/twirp" 11 - "google.golang.org/protobuf/types/known/emptypb" 12 11 "google.golang.org/protobuf/types/known/timestamppb" 12 + pb "xeiaso.net/v4/gen/xeiaso/net/v1" 13 13 "xeiaso.net/v4/internal/lume" 14 - "xeiaso.net/v4/pb" 15 - "xeiaso.net/v4/pb/external/protofeed" 16 14 ) 17 15 18 16 var denoVersion string ··· 31 29 fs *lume.FS 32 30 } 33 31 34 - func (ms *MetaServer) Metadata(ctx context.Context, _ *emptypb.Empty) (*pb.BuildInfo, error) { 32 + func (ms *MetaServer) Metadata(ctx context.Context, _ *pb.MetadataRequest) (*pb.MetadataResponse, error) { 35 33 commit, err := ms.fs.Commit() 36 34 if err != nil { 37 35 return nil, twirp.InternalErrorf("can't get commit hash: %w", err) ··· 49 47 result.XesiteVersion = "devel" 50 48 } 51 49 52 - return result, nil 50 + return &pb.MetadataResponse{BuildInfo: result}, nil 53 51 } 54 52 55 53 type FeedServer struct { 56 54 fs *lume.FS 57 55 } 58 56 59 - func (f *FeedServer) Get(ctx context.Context, _ *emptypb.Empty) (*protofeed.Feed, error) { 60 - return f.fs.LoadProtoFeed() 57 + func (f *FeedServer) Get(ctx context.Context, _ *pb.FeedServiceGetRequest) (*pb.FeedServiceGetResponse, error) { 58 + feed, err := f.fs.LoadProtoFeed() 59 + if err != nil { 60 + return nil, err 61 + } 62 + return &pb.FeedServiceGetResponse{Feed: feed}, nil 61 63 }
+5 -6
cmd/xesite/internalapi.go
··· 13 13 "runtime" 14 14 15 15 "github.com/twitchtv/twirp" 16 - "google.golang.org/protobuf/types/known/emptypb" 17 16 "google.golang.org/protobuf/types/known/timestamppb" 18 - "xeiaso.net/v4/internal/adminpb" 17 + adminpb "xeiaso.net/v4/gen/xeiaso/net/admin/v1" 18 + pb "xeiaso.net/v4/gen/xeiaso/net/v1" 19 19 "xeiaso.net/v4/internal/lume" 20 - "xeiaso.net/v4/pb" 21 20 ) 22 21 23 22 func internalAPI(fs *lume.FS) { ··· 38 37 http.ServeFile(w, r, filepath.Join(*dataDir, "site.zip")) 39 38 }) 40 39 41 - mux.Handle(adminpb.AdminPathPrefix, adminpb.NewAdminServer(&AdminAPI{fs: fs})) 40 + mux.Handle(adminpb.AdminServicePathPrefix, adminpb.NewAdminServiceServer(&AdminAPI{fs: fs})) 42 41 43 42 ln, err := net.Listen("tcp", *internalAPIBind) 44 43 if err != nil { ··· 52 51 fs *lume.FS 53 52 } 54 53 55 - func (aa *AdminAPI) Rebuild(ctx context.Context, _ *emptypb.Empty) (*pb.BuildInfo, error) { 54 + func (aa *AdminAPI) Rebuild(ctx context.Context, _ *adminpb.RebuildRequest) (*adminpb.RebuildResponse, error) { 56 55 deno, err := exec.LookPath("deno") 57 56 if err != nil { 58 57 return nil, twirp.InternalErrorf("can't find deno in $PATH: %w", err) ··· 70 69 71 70 result.BuildTime = timestamppb.Now() 72 71 73 - return result, nil 72 + return &adminpb.RebuildResponse{BuildInfo: result}, nil 74 73 }
+4 -5
cmd/xesite/main.go
··· 14 14 "github.com/facebookgo/flagenv" 15 15 _ "github.com/joho/godotenv/autoload" 16 16 "github.com/twitchtv/twirp" 17 + mi "xeiaso.net/v4/gen/within/website/x/mi/v1" 18 + pb "xeiaso.net/v4/gen/xeiaso/net/v1" 17 19 "xeiaso.net/v4/internal" 18 20 "xeiaso.net/v4/internal/lume" 19 - "xeiaso.net/v4/pb" 20 - "xeiaso.net/v4/pb/external/mi" 21 21 ) 22 22 23 23 var ( ··· 83 83 84 84 mux := http.NewServeMux() 85 85 mux.Handle("/", http.FileServerFS(fs)) 86 - mux.Handle("/api/defs/", http.StripPrefix("/api/defs/", http.FileServer(http.FS(pb.Proto)))) 87 86 88 - ms := pb.NewMetaServer(&MetaServer{fs}, twirp.WithServerPathPrefix("/api")) 87 + ms := pb.NewMetaServiceServer(&MetaServer{fs}, twirp.WithServerPathPrefix("/api")) 89 88 mux.Handle(ms.PathPrefix(), ms) 90 89 91 - fsrv := pb.NewFeedServer(&FeedServer{fs}, twirp.WithServerPathPrefix("/api")) 90 + fsrv := pb.NewFeedServiceServer(&FeedServer{fs}, twirp.WithServerPathPrefix("/api")) 92 91 mux.Handle(fsrv.PathPrefix(), fsrv) 93 92 94 93 es := mi.NewEventsServer(
+622
gen/techaro/thoth/auth/admin/v1/admin.pb.go
··· 1 + // Code generated by protoc-gen-go. DO NOT EDIT. 2 + // versions: 3 + // protoc-gen-go v1.36.11 4 + // protoc (unknown) 5 + // source: techaro/thoth/auth/admin/v1/admin.proto 6 + 7 + package adminv1 8 + 9 + import ( 10 + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" 11 + protoreflect "google.golang.org/protobuf/reflect/protoreflect" 12 + protoimpl "google.golang.org/protobuf/runtime/protoimpl" 13 + timestamppb "google.golang.org/protobuf/types/known/timestamppb" 14 + reflect "reflect" 15 + sync "sync" 16 + unsafe "unsafe" 17 + v1 "xeiaso.net/v4/gen/techaro/thoth/auth/v1" 18 + ) 19 + 20 + const ( 21 + // Verify that this generated code is sufficiently up-to-date. 22 + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 23 + // Verify that runtime/protoimpl is sufficiently up-to-date. 24 + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 25 + ) 26 + 27 + type User struct { 28 + state protoimpl.MessageState `protogen:"open.v1"` 29 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 30 + EmailAddress string `protobuf:"bytes,2,opt,name=email_address,json=emailAddress,proto3" json:"email_address,omitempty"` 31 + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` 32 + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` 33 + DeletedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"` 34 + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` 35 + IsAdmin bool `protobuf:"varint,7,opt,name=is_admin,json=isAdmin,proto3" json:"is_admin,omitempty"` 36 + CustomerId string `protobuf:"bytes,8,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"` 37 + unknownFields protoimpl.UnknownFields 38 + sizeCache protoimpl.SizeCache 39 + } 40 + 41 + func (x *User) Reset() { 42 + *x = User{} 43 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[0] 44 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 45 + ms.StoreMessageInfo(mi) 46 + } 47 + 48 + func (x *User) String() string { 49 + return protoimpl.X.MessageStringOf(x) 50 + } 51 + 52 + func (*User) ProtoMessage() {} 53 + 54 + func (x *User) ProtoReflect() protoreflect.Message { 55 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[0] 56 + if x != nil { 57 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 58 + if ms.LoadMessageInfo() == nil { 59 + ms.StoreMessageInfo(mi) 60 + } 61 + return ms 62 + } 63 + return mi.MessageOf(x) 64 + } 65 + 66 + // Deprecated: Use User.ProtoReflect.Descriptor instead. 67 + func (*User) Descriptor() ([]byte, []int) { 68 + return file_techaro_thoth_auth_admin_v1_admin_proto_rawDescGZIP(), []int{0} 69 + } 70 + 71 + func (x *User) GetId() string { 72 + if x != nil { 73 + return x.Id 74 + } 75 + return "" 76 + } 77 + 78 + func (x *User) GetEmailAddress() string { 79 + if x != nil { 80 + return x.EmailAddress 81 + } 82 + return "" 83 + } 84 + 85 + func (x *User) GetName() string { 86 + if x != nil { 87 + return x.Name 88 + } 89 + return "" 90 + } 91 + 92 + func (x *User) GetCreatedAt() *timestamppb.Timestamp { 93 + if x != nil { 94 + return x.CreatedAt 95 + } 96 + return nil 97 + } 98 + 99 + func (x *User) GetDeletedAt() *timestamppb.Timestamp { 100 + if x != nil { 101 + return x.DeletedAt 102 + } 103 + return nil 104 + } 105 + 106 + func (x *User) GetUpdatedAt() *timestamppb.Timestamp { 107 + if x != nil { 108 + return x.UpdatedAt 109 + } 110 + return nil 111 + } 112 + 113 + func (x *User) GetIsAdmin() bool { 114 + if x != nil { 115 + return x.IsAdmin 116 + } 117 + return false 118 + } 119 + 120 + func (x *User) GetCustomerId() string { 121 + if x != nil { 122 + return x.CustomerId 123 + } 124 + return "" 125 + } 126 + 127 + type UsersServiceCreateRequest struct { 128 + state protoimpl.MessageState `protogen:"open.v1"` 129 + EmailAddress string `protobuf:"bytes,1,opt,name=email_address,json=emailAddress,proto3" json:"email_address,omitempty"` 130 + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` 131 + CustomerId string `protobuf:"bytes,3,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"` 132 + unknownFields protoimpl.UnknownFields 133 + sizeCache protoimpl.SizeCache 134 + } 135 + 136 + func (x *UsersServiceCreateRequest) Reset() { 137 + *x = UsersServiceCreateRequest{} 138 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[1] 139 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 140 + ms.StoreMessageInfo(mi) 141 + } 142 + 143 + func (x *UsersServiceCreateRequest) String() string { 144 + return protoimpl.X.MessageStringOf(x) 145 + } 146 + 147 + func (*UsersServiceCreateRequest) ProtoMessage() {} 148 + 149 + func (x *UsersServiceCreateRequest) ProtoReflect() protoreflect.Message { 150 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[1] 151 + if x != nil { 152 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 153 + if ms.LoadMessageInfo() == nil { 154 + ms.StoreMessageInfo(mi) 155 + } 156 + return ms 157 + } 158 + return mi.MessageOf(x) 159 + } 160 + 161 + // Deprecated: Use UsersServiceCreateRequest.ProtoReflect.Descriptor instead. 162 + func (*UsersServiceCreateRequest) Descriptor() ([]byte, []int) { 163 + return file_techaro_thoth_auth_admin_v1_admin_proto_rawDescGZIP(), []int{1} 164 + } 165 + 166 + func (x *UsersServiceCreateRequest) GetEmailAddress() string { 167 + if x != nil { 168 + return x.EmailAddress 169 + } 170 + return "" 171 + } 172 + 173 + func (x *UsersServiceCreateRequest) GetName() string { 174 + if x != nil { 175 + return x.Name 176 + } 177 + return "" 178 + } 179 + 180 + func (x *UsersServiceCreateRequest) GetCustomerId() string { 181 + if x != nil { 182 + return x.CustomerId 183 + } 184 + return "" 185 + } 186 + 187 + type UsersServiceCreateResponse struct { 188 + state protoimpl.MessageState `protogen:"open.v1"` 189 + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` 190 + unknownFields protoimpl.UnknownFields 191 + sizeCache protoimpl.SizeCache 192 + } 193 + 194 + func (x *UsersServiceCreateResponse) Reset() { 195 + *x = UsersServiceCreateResponse{} 196 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[2] 197 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 198 + ms.StoreMessageInfo(mi) 199 + } 200 + 201 + func (x *UsersServiceCreateResponse) String() string { 202 + return protoimpl.X.MessageStringOf(x) 203 + } 204 + 205 + func (*UsersServiceCreateResponse) ProtoMessage() {} 206 + 207 + func (x *UsersServiceCreateResponse) ProtoReflect() protoreflect.Message { 208 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[2] 209 + if x != nil { 210 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 211 + if ms.LoadMessageInfo() == nil { 212 + ms.StoreMessageInfo(mi) 213 + } 214 + return ms 215 + } 216 + return mi.MessageOf(x) 217 + } 218 + 219 + // Deprecated: Use UsersServiceCreateResponse.ProtoReflect.Descriptor instead. 220 + func (*UsersServiceCreateResponse) Descriptor() ([]byte, []int) { 221 + return file_techaro_thoth_auth_admin_v1_admin_proto_rawDescGZIP(), []int{2} 222 + } 223 + 224 + func (x *UsersServiceCreateResponse) GetUser() *User { 225 + if x != nil { 226 + return x.User 227 + } 228 + return nil 229 + } 230 + 231 + type UsersServiceDisableRequest struct { 232 + state protoimpl.MessageState `protogen:"open.v1"` 233 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 234 + unknownFields protoimpl.UnknownFields 235 + sizeCache protoimpl.SizeCache 236 + } 237 + 238 + func (x *UsersServiceDisableRequest) Reset() { 239 + *x = UsersServiceDisableRequest{} 240 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[3] 241 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 242 + ms.StoreMessageInfo(mi) 243 + } 244 + 245 + func (x *UsersServiceDisableRequest) String() string { 246 + return protoimpl.X.MessageStringOf(x) 247 + } 248 + 249 + func (*UsersServiceDisableRequest) ProtoMessage() {} 250 + 251 + func (x *UsersServiceDisableRequest) ProtoReflect() protoreflect.Message { 252 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[3] 253 + if x != nil { 254 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 255 + if ms.LoadMessageInfo() == nil { 256 + ms.StoreMessageInfo(mi) 257 + } 258 + return ms 259 + } 260 + return mi.MessageOf(x) 261 + } 262 + 263 + // Deprecated: Use UsersServiceDisableRequest.ProtoReflect.Descriptor instead. 264 + func (*UsersServiceDisableRequest) Descriptor() ([]byte, []int) { 265 + return file_techaro_thoth_auth_admin_v1_admin_proto_rawDescGZIP(), []int{3} 266 + } 267 + 268 + func (x *UsersServiceDisableRequest) GetId() string { 269 + if x != nil { 270 + return x.Id 271 + } 272 + return "" 273 + } 274 + 275 + type UsersServiceDisableResponse struct { 276 + state protoimpl.MessageState `protogen:"open.v1"` 277 + unknownFields protoimpl.UnknownFields 278 + sizeCache protoimpl.SizeCache 279 + } 280 + 281 + func (x *UsersServiceDisableResponse) Reset() { 282 + *x = UsersServiceDisableResponse{} 283 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[4] 284 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 285 + ms.StoreMessageInfo(mi) 286 + } 287 + 288 + func (x *UsersServiceDisableResponse) String() string { 289 + return protoimpl.X.MessageStringOf(x) 290 + } 291 + 292 + func (*UsersServiceDisableResponse) ProtoMessage() {} 293 + 294 + func (x *UsersServiceDisableResponse) ProtoReflect() protoreflect.Message { 295 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[4] 296 + if x != nil { 297 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 298 + if ms.LoadMessageInfo() == nil { 299 + ms.StoreMessageInfo(mi) 300 + } 301 + return ms 302 + } 303 + return mi.MessageOf(x) 304 + } 305 + 306 + // Deprecated: Use UsersServiceDisableResponse.ProtoReflect.Descriptor instead. 307 + func (*UsersServiceDisableResponse) Descriptor() ([]byte, []int) { 308 + return file_techaro_thoth_auth_admin_v1_admin_proto_rawDescGZIP(), []int{4} 309 + } 310 + 311 + type UsersServiceListRequest struct { 312 + state protoimpl.MessageState `protogen:"open.v1"` 313 + Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` 314 + Page int32 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"` 315 + unknownFields protoimpl.UnknownFields 316 + sizeCache protoimpl.SizeCache 317 + } 318 + 319 + func (x *UsersServiceListRequest) Reset() { 320 + *x = UsersServiceListRequest{} 321 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[5] 322 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 323 + ms.StoreMessageInfo(mi) 324 + } 325 + 326 + func (x *UsersServiceListRequest) String() string { 327 + return protoimpl.X.MessageStringOf(x) 328 + } 329 + 330 + func (*UsersServiceListRequest) ProtoMessage() {} 331 + 332 + func (x *UsersServiceListRequest) ProtoReflect() protoreflect.Message { 333 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[5] 334 + if x != nil { 335 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 336 + if ms.LoadMessageInfo() == nil { 337 + ms.StoreMessageInfo(mi) 338 + } 339 + return ms 340 + } 341 + return mi.MessageOf(x) 342 + } 343 + 344 + // Deprecated: Use UsersServiceListRequest.ProtoReflect.Descriptor instead. 345 + func (*UsersServiceListRequest) Descriptor() ([]byte, []int) { 346 + return file_techaro_thoth_auth_admin_v1_admin_proto_rawDescGZIP(), []int{5} 347 + } 348 + 349 + func (x *UsersServiceListRequest) GetCount() int32 { 350 + if x != nil { 351 + return x.Count 352 + } 353 + return 0 354 + } 355 + 356 + func (x *UsersServiceListRequest) GetPage() int32 { 357 + if x != nil { 358 + return x.Page 359 + } 360 + return 0 361 + } 362 + 363 + type UsersServiceListResponse struct { 364 + state protoimpl.MessageState `protogen:"open.v1"` 365 + Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` 366 + unknownFields protoimpl.UnknownFields 367 + sizeCache protoimpl.SizeCache 368 + } 369 + 370 + func (x *UsersServiceListResponse) Reset() { 371 + *x = UsersServiceListResponse{} 372 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[6] 373 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 374 + ms.StoreMessageInfo(mi) 375 + } 376 + 377 + func (x *UsersServiceListResponse) String() string { 378 + return protoimpl.X.MessageStringOf(x) 379 + } 380 + 381 + func (*UsersServiceListResponse) ProtoMessage() {} 382 + 383 + func (x *UsersServiceListResponse) ProtoReflect() protoreflect.Message { 384 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[6] 385 + if x != nil { 386 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 387 + if ms.LoadMessageInfo() == nil { 388 + ms.StoreMessageInfo(mi) 389 + } 390 + return ms 391 + } 392 + return mi.MessageOf(x) 393 + } 394 + 395 + // Deprecated: Use UsersServiceListResponse.ProtoReflect.Descriptor instead. 396 + func (*UsersServiceListResponse) Descriptor() ([]byte, []int) { 397 + return file_techaro_thoth_auth_admin_v1_admin_proto_rawDescGZIP(), []int{6} 398 + } 399 + 400 + func (x *UsersServiceListResponse) GetUsers() []*User { 401 + if x != nil { 402 + return x.Users 403 + } 404 + return nil 405 + } 406 + 407 + type UsersServiceMakeJWTRequest struct { 408 + state protoimpl.MessageState `protogen:"open.v1"` 409 + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` 410 + Comment string `protobuf:"bytes,2,opt,name=comment,proto3" json:"comment,omitempty"` 411 + unknownFields protoimpl.UnknownFields 412 + sizeCache protoimpl.SizeCache 413 + } 414 + 415 + func (x *UsersServiceMakeJWTRequest) Reset() { 416 + *x = UsersServiceMakeJWTRequest{} 417 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[7] 418 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 419 + ms.StoreMessageInfo(mi) 420 + } 421 + 422 + func (x *UsersServiceMakeJWTRequest) String() string { 423 + return protoimpl.X.MessageStringOf(x) 424 + } 425 + 426 + func (*UsersServiceMakeJWTRequest) ProtoMessage() {} 427 + 428 + func (x *UsersServiceMakeJWTRequest) ProtoReflect() protoreflect.Message { 429 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[7] 430 + if x != nil { 431 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 432 + if ms.LoadMessageInfo() == nil { 433 + ms.StoreMessageInfo(mi) 434 + } 435 + return ms 436 + } 437 + return mi.MessageOf(x) 438 + } 439 + 440 + // Deprecated: Use UsersServiceMakeJWTRequest.ProtoReflect.Descriptor instead. 441 + func (*UsersServiceMakeJWTRequest) Descriptor() ([]byte, []int) { 442 + return file_techaro_thoth_auth_admin_v1_admin_proto_rawDescGZIP(), []int{7} 443 + } 444 + 445 + func (x *UsersServiceMakeJWTRequest) GetUserId() string { 446 + if x != nil { 447 + return x.UserId 448 + } 449 + return "" 450 + } 451 + 452 + func (x *UsersServiceMakeJWTRequest) GetComment() string { 453 + if x != nil { 454 + return x.Comment 455 + } 456 + return "" 457 + } 458 + 459 + type UsersServiceMakeJWTResponse struct { 460 + state protoimpl.MessageState `protogen:"open.v1"` 461 + TokenInfo *v1.JWTServiceCreateResponse `protobuf:"bytes,1,opt,name=token_info,json=tokenInfo,proto3" json:"token_info,omitempty"` 462 + unknownFields protoimpl.UnknownFields 463 + sizeCache protoimpl.SizeCache 464 + } 465 + 466 + func (x *UsersServiceMakeJWTResponse) Reset() { 467 + *x = UsersServiceMakeJWTResponse{} 468 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[8] 469 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 470 + ms.StoreMessageInfo(mi) 471 + } 472 + 473 + func (x *UsersServiceMakeJWTResponse) String() string { 474 + return protoimpl.X.MessageStringOf(x) 475 + } 476 + 477 + func (*UsersServiceMakeJWTResponse) ProtoMessage() {} 478 + 479 + func (x *UsersServiceMakeJWTResponse) ProtoReflect() protoreflect.Message { 480 + mi := &file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes[8] 481 + if x != nil { 482 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 483 + if ms.LoadMessageInfo() == nil { 484 + ms.StoreMessageInfo(mi) 485 + } 486 + return ms 487 + } 488 + return mi.MessageOf(x) 489 + } 490 + 491 + // Deprecated: Use UsersServiceMakeJWTResponse.ProtoReflect.Descriptor instead. 492 + func (*UsersServiceMakeJWTResponse) Descriptor() ([]byte, []int) { 493 + return file_techaro_thoth_auth_admin_v1_admin_proto_rawDescGZIP(), []int{8} 494 + } 495 + 496 + func (x *UsersServiceMakeJWTResponse) GetTokenInfo() *v1.JWTServiceCreateResponse { 497 + if x != nil { 498 + return x.TokenInfo 499 + } 500 + return nil 501 + } 502 + 503 + var File_techaro_thoth_auth_admin_v1_admin_proto protoreflect.FileDescriptor 504 + 505 + const file_techaro_thoth_auth_admin_v1_admin_proto_rawDesc = "" + 506 + "\n" + 507 + "'techaro/thoth/auth/admin/v1/admin.proto\x12\x1btecharo.thoth.auth.admin.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a techaro/thoth/auth/v1/auth.proto\"\xb8\x03\n" + 508 + "\x04User\x12\x16\n" + 509 + "\x02id\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x02id\x12\x86\x01\n" + 510 + "\remail_address\x18\x02 \x01(\tBa\xbaH^\xba\x01X\n" + 511 + "\x1eemail_address.is_email_address\x12&email_address must be an email address\x1a\x0ethis.isEmail()\xc8\x01\x01R\femailAddress\x12\x1a\n" + 512 + "\x04name\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x04name\x129\n" + 513 + "\n" + 514 + "created_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" + 515 + "\n" + 516 + "deleted_at\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\tdeletedAt\x129\n" + 517 + "\n" + 518 + "updated_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\x12\x19\n" + 519 + "\bis_admin\x18\a \x01(\bR\aisAdmin\x12'\n" + 520 + "\vcustomer_id\x18\b \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\n" + 521 + "customerId\"\xe9\x01\n" + 522 + "\x19UsersServiceCreateRequest\x12\x86\x01\n" + 523 + "\remail_address\x18\x01 \x01(\tBa\xbaH^\xba\x01X\n" + 524 + "\x1eemail_address.is_email_address\x12&email_address must be an email address\x1a\x0ethis.isEmail()\xc8\x01\x01R\femailAddress\x12\x1a\n" + 525 + "\x04name\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x04name\x12'\n" + 526 + "\vcustomer_id\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\n" + 527 + "customerId\"S\n" + 528 + "\x1aUsersServiceCreateResponse\x125\n" + 529 + "\x04user\x18\x01 \x01(\v2!.techaro.thoth.auth.admin.v1.UserR\x04user\"4\n" + 530 + "\x1aUsersServiceDisableRequest\x12\x16\n" + 531 + "\x02id\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x02id\"\x1d\n" + 532 + "\x1bUsersServiceDisableResponse\"C\n" + 533 + "\x17UsersServiceListRequest\x12\x14\n" + 534 + "\x05count\x18\x01 \x01(\x05R\x05count\x12\x12\n" + 535 + "\x04page\x18\x02 \x01(\x05R\x04page\"S\n" + 536 + "\x18UsersServiceListResponse\x127\n" + 537 + "\x05users\x18\x01 \x03(\v2!.techaro.thoth.auth.admin.v1.UserR\x05users\"_\n" + 538 + "\x1aUsersServiceMakeJWTRequest\x12\x1f\n" + 539 + "\auser_id\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x06userId\x12 \n" + 540 + "\acomment\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\acomment\"m\n" + 541 + "\x1bUsersServiceMakeJWTResponse\x12N\n" + 542 + "\n" + 543 + "token_info\x18\x01 \x01(\v2/.techaro.thoth.auth.v1.JWTServiceCreateResponseR\ttokenInfo2\xfa\x03\n" + 544 + "\fUsersService\x12y\n" + 545 + "\x06Create\x126.techaro.thoth.auth.admin.v1.UsersServiceCreateRequest\x1a7.techaro.thoth.auth.admin.v1.UsersServiceCreateResponse\x12|\n" + 546 + "\aDisable\x127.techaro.thoth.auth.admin.v1.UsersServiceDisableRequest\x1a8.techaro.thoth.auth.admin.v1.UsersServiceDisableResponse\x12s\n" + 547 + "\x04List\x124.techaro.thoth.auth.admin.v1.UsersServiceListRequest\x1a5.techaro.thoth.auth.admin.v1.UsersServiceListResponse\x12|\n" + 548 + "\aMakeJWT\x127.techaro.thoth.auth.admin.v1.UsersServiceMakeJWTRequest\x1a8.techaro.thoth.auth.admin.v1.UsersServiceMakeJWTResponseB\xf5\x01\n" + 549 + "\x1fcom.techaro.thoth.auth.admin.v1B\n" + 550 + "AdminProtoP\x01Z5xeiaso.net/v4/gen/techaro/thoth/auth/admin/v1;adminv1\xa2\x02\x04TTAA\xaa\x02\x1bTecharo.Thoth.Auth.Admin.V1\xca\x02\x1bTecharo\\Thoth\\Auth\\Admin\\V1\xe2\x02'Techaro\\Thoth\\Auth\\Admin\\V1\\GPBMetadata\xea\x02\x1fTecharo::Thoth::Auth::Admin::V1b\x06proto3" 551 + 552 + var ( 553 + file_techaro_thoth_auth_admin_v1_admin_proto_rawDescOnce sync.Once 554 + file_techaro_thoth_auth_admin_v1_admin_proto_rawDescData []byte 555 + ) 556 + 557 + func file_techaro_thoth_auth_admin_v1_admin_proto_rawDescGZIP() []byte { 558 + file_techaro_thoth_auth_admin_v1_admin_proto_rawDescOnce.Do(func() { 559 + file_techaro_thoth_auth_admin_v1_admin_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_techaro_thoth_auth_admin_v1_admin_proto_rawDesc), len(file_techaro_thoth_auth_admin_v1_admin_proto_rawDesc))) 560 + }) 561 + return file_techaro_thoth_auth_admin_v1_admin_proto_rawDescData 562 + } 563 + 564 + var file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 9) 565 + var file_techaro_thoth_auth_admin_v1_admin_proto_goTypes = []any{ 566 + (*User)(nil), // 0: techaro.thoth.auth.admin.v1.User 567 + (*UsersServiceCreateRequest)(nil), // 1: techaro.thoth.auth.admin.v1.UsersServiceCreateRequest 568 + (*UsersServiceCreateResponse)(nil), // 2: techaro.thoth.auth.admin.v1.UsersServiceCreateResponse 569 + (*UsersServiceDisableRequest)(nil), // 3: techaro.thoth.auth.admin.v1.UsersServiceDisableRequest 570 + (*UsersServiceDisableResponse)(nil), // 4: techaro.thoth.auth.admin.v1.UsersServiceDisableResponse 571 + (*UsersServiceListRequest)(nil), // 5: techaro.thoth.auth.admin.v1.UsersServiceListRequest 572 + (*UsersServiceListResponse)(nil), // 6: techaro.thoth.auth.admin.v1.UsersServiceListResponse 573 + (*UsersServiceMakeJWTRequest)(nil), // 7: techaro.thoth.auth.admin.v1.UsersServiceMakeJWTRequest 574 + (*UsersServiceMakeJWTResponse)(nil), // 8: techaro.thoth.auth.admin.v1.UsersServiceMakeJWTResponse 575 + (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp 576 + (*v1.JWTServiceCreateResponse)(nil), // 10: techaro.thoth.auth.v1.JWTServiceCreateResponse 577 + } 578 + var file_techaro_thoth_auth_admin_v1_admin_proto_depIdxs = []int32{ 579 + 9, // 0: techaro.thoth.auth.admin.v1.User.created_at:type_name -> google.protobuf.Timestamp 580 + 9, // 1: techaro.thoth.auth.admin.v1.User.deleted_at:type_name -> google.protobuf.Timestamp 581 + 9, // 2: techaro.thoth.auth.admin.v1.User.updated_at:type_name -> google.protobuf.Timestamp 582 + 0, // 3: techaro.thoth.auth.admin.v1.UsersServiceCreateResponse.user:type_name -> techaro.thoth.auth.admin.v1.User 583 + 0, // 4: techaro.thoth.auth.admin.v1.UsersServiceListResponse.users:type_name -> techaro.thoth.auth.admin.v1.User 584 + 10, // 5: techaro.thoth.auth.admin.v1.UsersServiceMakeJWTResponse.token_info:type_name -> techaro.thoth.auth.v1.JWTServiceCreateResponse 585 + 1, // 6: techaro.thoth.auth.admin.v1.UsersService.Create:input_type -> techaro.thoth.auth.admin.v1.UsersServiceCreateRequest 586 + 3, // 7: techaro.thoth.auth.admin.v1.UsersService.Disable:input_type -> techaro.thoth.auth.admin.v1.UsersServiceDisableRequest 587 + 5, // 8: techaro.thoth.auth.admin.v1.UsersService.List:input_type -> techaro.thoth.auth.admin.v1.UsersServiceListRequest 588 + 7, // 9: techaro.thoth.auth.admin.v1.UsersService.MakeJWT:input_type -> techaro.thoth.auth.admin.v1.UsersServiceMakeJWTRequest 589 + 2, // 10: techaro.thoth.auth.admin.v1.UsersService.Create:output_type -> techaro.thoth.auth.admin.v1.UsersServiceCreateResponse 590 + 4, // 11: techaro.thoth.auth.admin.v1.UsersService.Disable:output_type -> techaro.thoth.auth.admin.v1.UsersServiceDisableResponse 591 + 6, // 12: techaro.thoth.auth.admin.v1.UsersService.List:output_type -> techaro.thoth.auth.admin.v1.UsersServiceListResponse 592 + 8, // 13: techaro.thoth.auth.admin.v1.UsersService.MakeJWT:output_type -> techaro.thoth.auth.admin.v1.UsersServiceMakeJWTResponse 593 + 10, // [10:14] is the sub-list for method output_type 594 + 6, // [6:10] is the sub-list for method input_type 595 + 6, // [6:6] is the sub-list for extension type_name 596 + 6, // [6:6] is the sub-list for extension extendee 597 + 0, // [0:6] is the sub-list for field type_name 598 + } 599 + 600 + func init() { file_techaro_thoth_auth_admin_v1_admin_proto_init() } 601 + func file_techaro_thoth_auth_admin_v1_admin_proto_init() { 602 + if File_techaro_thoth_auth_admin_v1_admin_proto != nil { 603 + return 604 + } 605 + type x struct{} 606 + out := protoimpl.TypeBuilder{ 607 + File: protoimpl.DescBuilder{ 608 + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 609 + RawDescriptor: unsafe.Slice(unsafe.StringData(file_techaro_thoth_auth_admin_v1_admin_proto_rawDesc), len(file_techaro_thoth_auth_admin_v1_admin_proto_rawDesc)), 610 + NumEnums: 0, 611 + NumMessages: 9, 612 + NumExtensions: 0, 613 + NumServices: 1, 614 + }, 615 + GoTypes: file_techaro_thoth_auth_admin_v1_admin_proto_goTypes, 616 + DependencyIndexes: file_techaro_thoth_auth_admin_v1_admin_proto_depIdxs, 617 + MessageInfos: file_techaro_thoth_auth_admin_v1_admin_proto_msgTypes, 618 + }.Build() 619 + File_techaro_thoth_auth_admin_v1_admin_proto = out.File 620 + file_techaro_thoth_auth_admin_v1_admin_proto_goTypes = nil 621 + file_techaro_thoth_auth_admin_v1_admin_proto_depIdxs = nil 622 + }
+1976
gen/techaro/thoth/auth/admin/v1/admin.twirp.go
··· 1 + // Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT. 2 + // source: techaro/thoth/auth/admin/v1/admin.proto 3 + 4 + package adminv1 5 + 6 + import context "context" 7 + import fmt "fmt" 8 + import http "net/http" 9 + import io "io" 10 + import json "encoding/json" 11 + import strconv "strconv" 12 + import strings "strings" 13 + 14 + import protojson "google.golang.org/protobuf/encoding/protojson" 15 + import proto "google.golang.org/protobuf/proto" 16 + import twirp "github.com/twitchtv/twirp" 17 + import ctxsetters "github.com/twitchtv/twirp/ctxsetters" 18 + 19 + import bytes "bytes" 20 + import errors "errors" 21 + import path "path" 22 + import url "net/url" 23 + 24 + // Version compatibility assertion. 25 + // If the constant is not defined in the package, that likely means 26 + // the package needs to be updated to work with this generated code. 27 + // See https://twitchtv.github.io/twirp/docs/version_matrix.html 28 + const _ = twirp.TwirpPackageMinVersion_8_1_0 29 + 30 + // ====================== 31 + // UsersService Interface 32 + // ====================== 33 + 34 + type UsersService interface { 35 + Create(context.Context, *UsersServiceCreateRequest) (*UsersServiceCreateResponse, error) 36 + 37 + Disable(context.Context, *UsersServiceDisableRequest) (*UsersServiceDisableResponse, error) 38 + 39 + List(context.Context, *UsersServiceListRequest) (*UsersServiceListResponse, error) 40 + 41 + MakeJWT(context.Context, *UsersServiceMakeJWTRequest) (*UsersServiceMakeJWTResponse, error) 42 + } 43 + 44 + // ============================ 45 + // UsersService Protobuf Client 46 + // ============================ 47 + 48 + type usersServiceProtobufClient struct { 49 + client HTTPClient 50 + urls [4]string 51 + interceptor twirp.Interceptor 52 + opts twirp.ClientOptions 53 + } 54 + 55 + // NewUsersServiceProtobufClient creates a Protobuf client that implements the UsersService interface. 56 + // It communicates using Protobuf and can be configured with a custom HTTPClient. 57 + func NewUsersServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) UsersService { 58 + if c, ok := client.(*http.Client); ok { 59 + client = withoutRedirects(c) 60 + } 61 + 62 + clientOpts := twirp.ClientOptions{} 63 + for _, o := range opts { 64 + o(&clientOpts) 65 + } 66 + 67 + // Using ReadOpt allows backwards and forwards compatibility with new options in the future 68 + literalURLs := false 69 + _ = clientOpts.ReadOpt("literalURLs", &literalURLs) 70 + var pathPrefix string 71 + if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { 72 + pathPrefix = "/twirp" // default prefix 73 + } 74 + 75 + // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 76 + serviceURL := sanitizeBaseURL(baseURL) 77 + serviceURL += baseServicePath(pathPrefix, "techaro.thoth.auth.admin.v1", "UsersService") 78 + urls := [4]string{ 79 + serviceURL + "Create", 80 + serviceURL + "Disable", 81 + serviceURL + "List", 82 + serviceURL + "MakeJWT", 83 + } 84 + 85 + return &usersServiceProtobufClient{ 86 + client: client, 87 + urls: urls, 88 + interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), 89 + opts: clientOpts, 90 + } 91 + } 92 + 93 + func (c *usersServiceProtobufClient) Create(ctx context.Context, in *UsersServiceCreateRequest) (*UsersServiceCreateResponse, error) { 94 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.admin.v1") 95 + ctx = ctxsetters.WithServiceName(ctx, "UsersService") 96 + ctx = ctxsetters.WithMethodName(ctx, "Create") 97 + caller := c.callCreate 98 + if c.interceptor != nil { 99 + caller = func(ctx context.Context, req *UsersServiceCreateRequest) (*UsersServiceCreateResponse, error) { 100 + resp, err := c.interceptor( 101 + func(ctx context.Context, req interface{}) (interface{}, error) { 102 + typedReq, ok := req.(*UsersServiceCreateRequest) 103 + if !ok { 104 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceCreateRequest) when calling interceptor") 105 + } 106 + return c.callCreate(ctx, typedReq) 107 + }, 108 + )(ctx, req) 109 + if resp != nil { 110 + typedResp, ok := resp.(*UsersServiceCreateResponse) 111 + if !ok { 112 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceCreateResponse) when calling interceptor") 113 + } 114 + return typedResp, err 115 + } 116 + return nil, err 117 + } 118 + } 119 + return caller(ctx, in) 120 + } 121 + 122 + func (c *usersServiceProtobufClient) callCreate(ctx context.Context, in *UsersServiceCreateRequest) (*UsersServiceCreateResponse, error) { 123 + out := new(UsersServiceCreateResponse) 124 + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 125 + if err != nil { 126 + twerr, ok := err.(twirp.Error) 127 + if !ok { 128 + twerr = twirp.InternalErrorWith(err) 129 + } 130 + callClientError(ctx, c.opts.Hooks, twerr) 131 + return nil, err 132 + } 133 + 134 + callClientResponseReceived(ctx, c.opts.Hooks) 135 + 136 + return out, nil 137 + } 138 + 139 + func (c *usersServiceProtobufClient) Disable(ctx context.Context, in *UsersServiceDisableRequest) (*UsersServiceDisableResponse, error) { 140 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.admin.v1") 141 + ctx = ctxsetters.WithServiceName(ctx, "UsersService") 142 + ctx = ctxsetters.WithMethodName(ctx, "Disable") 143 + caller := c.callDisable 144 + if c.interceptor != nil { 145 + caller = func(ctx context.Context, req *UsersServiceDisableRequest) (*UsersServiceDisableResponse, error) { 146 + resp, err := c.interceptor( 147 + func(ctx context.Context, req interface{}) (interface{}, error) { 148 + typedReq, ok := req.(*UsersServiceDisableRequest) 149 + if !ok { 150 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceDisableRequest) when calling interceptor") 151 + } 152 + return c.callDisable(ctx, typedReq) 153 + }, 154 + )(ctx, req) 155 + if resp != nil { 156 + typedResp, ok := resp.(*UsersServiceDisableResponse) 157 + if !ok { 158 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceDisableResponse) when calling interceptor") 159 + } 160 + return typedResp, err 161 + } 162 + return nil, err 163 + } 164 + } 165 + return caller(ctx, in) 166 + } 167 + 168 + func (c *usersServiceProtobufClient) callDisable(ctx context.Context, in *UsersServiceDisableRequest) (*UsersServiceDisableResponse, error) { 169 + out := new(UsersServiceDisableResponse) 170 + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) 171 + if err != nil { 172 + twerr, ok := err.(twirp.Error) 173 + if !ok { 174 + twerr = twirp.InternalErrorWith(err) 175 + } 176 + callClientError(ctx, c.opts.Hooks, twerr) 177 + return nil, err 178 + } 179 + 180 + callClientResponseReceived(ctx, c.opts.Hooks) 181 + 182 + return out, nil 183 + } 184 + 185 + func (c *usersServiceProtobufClient) List(ctx context.Context, in *UsersServiceListRequest) (*UsersServiceListResponse, error) { 186 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.admin.v1") 187 + ctx = ctxsetters.WithServiceName(ctx, "UsersService") 188 + ctx = ctxsetters.WithMethodName(ctx, "List") 189 + caller := c.callList 190 + if c.interceptor != nil { 191 + caller = func(ctx context.Context, req *UsersServiceListRequest) (*UsersServiceListResponse, error) { 192 + resp, err := c.interceptor( 193 + func(ctx context.Context, req interface{}) (interface{}, error) { 194 + typedReq, ok := req.(*UsersServiceListRequest) 195 + if !ok { 196 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceListRequest) when calling interceptor") 197 + } 198 + return c.callList(ctx, typedReq) 199 + }, 200 + )(ctx, req) 201 + if resp != nil { 202 + typedResp, ok := resp.(*UsersServiceListResponse) 203 + if !ok { 204 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceListResponse) when calling interceptor") 205 + } 206 + return typedResp, err 207 + } 208 + return nil, err 209 + } 210 + } 211 + return caller(ctx, in) 212 + } 213 + 214 + func (c *usersServiceProtobufClient) callList(ctx context.Context, in *UsersServiceListRequest) (*UsersServiceListResponse, error) { 215 + out := new(UsersServiceListResponse) 216 + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out) 217 + if err != nil { 218 + twerr, ok := err.(twirp.Error) 219 + if !ok { 220 + twerr = twirp.InternalErrorWith(err) 221 + } 222 + callClientError(ctx, c.opts.Hooks, twerr) 223 + return nil, err 224 + } 225 + 226 + callClientResponseReceived(ctx, c.opts.Hooks) 227 + 228 + return out, nil 229 + } 230 + 231 + func (c *usersServiceProtobufClient) MakeJWT(ctx context.Context, in *UsersServiceMakeJWTRequest) (*UsersServiceMakeJWTResponse, error) { 232 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.admin.v1") 233 + ctx = ctxsetters.WithServiceName(ctx, "UsersService") 234 + ctx = ctxsetters.WithMethodName(ctx, "MakeJWT") 235 + caller := c.callMakeJWT 236 + if c.interceptor != nil { 237 + caller = func(ctx context.Context, req *UsersServiceMakeJWTRequest) (*UsersServiceMakeJWTResponse, error) { 238 + resp, err := c.interceptor( 239 + func(ctx context.Context, req interface{}) (interface{}, error) { 240 + typedReq, ok := req.(*UsersServiceMakeJWTRequest) 241 + if !ok { 242 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceMakeJWTRequest) when calling interceptor") 243 + } 244 + return c.callMakeJWT(ctx, typedReq) 245 + }, 246 + )(ctx, req) 247 + if resp != nil { 248 + typedResp, ok := resp.(*UsersServiceMakeJWTResponse) 249 + if !ok { 250 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceMakeJWTResponse) when calling interceptor") 251 + } 252 + return typedResp, err 253 + } 254 + return nil, err 255 + } 256 + } 257 + return caller(ctx, in) 258 + } 259 + 260 + func (c *usersServiceProtobufClient) callMakeJWT(ctx context.Context, in *UsersServiceMakeJWTRequest) (*UsersServiceMakeJWTResponse, error) { 261 + out := new(UsersServiceMakeJWTResponse) 262 + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out) 263 + if err != nil { 264 + twerr, ok := err.(twirp.Error) 265 + if !ok { 266 + twerr = twirp.InternalErrorWith(err) 267 + } 268 + callClientError(ctx, c.opts.Hooks, twerr) 269 + return nil, err 270 + } 271 + 272 + callClientResponseReceived(ctx, c.opts.Hooks) 273 + 274 + return out, nil 275 + } 276 + 277 + // ======================== 278 + // UsersService JSON Client 279 + // ======================== 280 + 281 + type usersServiceJSONClient struct { 282 + client HTTPClient 283 + urls [4]string 284 + interceptor twirp.Interceptor 285 + opts twirp.ClientOptions 286 + } 287 + 288 + // NewUsersServiceJSONClient creates a JSON client that implements the UsersService interface. 289 + // It communicates using JSON and can be configured with a custom HTTPClient. 290 + func NewUsersServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) UsersService { 291 + if c, ok := client.(*http.Client); ok { 292 + client = withoutRedirects(c) 293 + } 294 + 295 + clientOpts := twirp.ClientOptions{} 296 + for _, o := range opts { 297 + o(&clientOpts) 298 + } 299 + 300 + // Using ReadOpt allows backwards and forwards compatibility with new options in the future 301 + literalURLs := false 302 + _ = clientOpts.ReadOpt("literalURLs", &literalURLs) 303 + var pathPrefix string 304 + if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { 305 + pathPrefix = "/twirp" // default prefix 306 + } 307 + 308 + // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 309 + serviceURL := sanitizeBaseURL(baseURL) 310 + serviceURL += baseServicePath(pathPrefix, "techaro.thoth.auth.admin.v1", "UsersService") 311 + urls := [4]string{ 312 + serviceURL + "Create", 313 + serviceURL + "Disable", 314 + serviceURL + "List", 315 + serviceURL + "MakeJWT", 316 + } 317 + 318 + return &usersServiceJSONClient{ 319 + client: client, 320 + urls: urls, 321 + interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), 322 + opts: clientOpts, 323 + } 324 + } 325 + 326 + func (c *usersServiceJSONClient) Create(ctx context.Context, in *UsersServiceCreateRequest) (*UsersServiceCreateResponse, error) { 327 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.admin.v1") 328 + ctx = ctxsetters.WithServiceName(ctx, "UsersService") 329 + ctx = ctxsetters.WithMethodName(ctx, "Create") 330 + caller := c.callCreate 331 + if c.interceptor != nil { 332 + caller = func(ctx context.Context, req *UsersServiceCreateRequest) (*UsersServiceCreateResponse, error) { 333 + resp, err := c.interceptor( 334 + func(ctx context.Context, req interface{}) (interface{}, error) { 335 + typedReq, ok := req.(*UsersServiceCreateRequest) 336 + if !ok { 337 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceCreateRequest) when calling interceptor") 338 + } 339 + return c.callCreate(ctx, typedReq) 340 + }, 341 + )(ctx, req) 342 + if resp != nil { 343 + typedResp, ok := resp.(*UsersServiceCreateResponse) 344 + if !ok { 345 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceCreateResponse) when calling interceptor") 346 + } 347 + return typedResp, err 348 + } 349 + return nil, err 350 + } 351 + } 352 + return caller(ctx, in) 353 + } 354 + 355 + func (c *usersServiceJSONClient) callCreate(ctx context.Context, in *UsersServiceCreateRequest) (*UsersServiceCreateResponse, error) { 356 + out := new(UsersServiceCreateResponse) 357 + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 358 + if err != nil { 359 + twerr, ok := err.(twirp.Error) 360 + if !ok { 361 + twerr = twirp.InternalErrorWith(err) 362 + } 363 + callClientError(ctx, c.opts.Hooks, twerr) 364 + return nil, err 365 + } 366 + 367 + callClientResponseReceived(ctx, c.opts.Hooks) 368 + 369 + return out, nil 370 + } 371 + 372 + func (c *usersServiceJSONClient) Disable(ctx context.Context, in *UsersServiceDisableRequest) (*UsersServiceDisableResponse, error) { 373 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.admin.v1") 374 + ctx = ctxsetters.WithServiceName(ctx, "UsersService") 375 + ctx = ctxsetters.WithMethodName(ctx, "Disable") 376 + caller := c.callDisable 377 + if c.interceptor != nil { 378 + caller = func(ctx context.Context, req *UsersServiceDisableRequest) (*UsersServiceDisableResponse, error) { 379 + resp, err := c.interceptor( 380 + func(ctx context.Context, req interface{}) (interface{}, error) { 381 + typedReq, ok := req.(*UsersServiceDisableRequest) 382 + if !ok { 383 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceDisableRequest) when calling interceptor") 384 + } 385 + return c.callDisable(ctx, typedReq) 386 + }, 387 + )(ctx, req) 388 + if resp != nil { 389 + typedResp, ok := resp.(*UsersServiceDisableResponse) 390 + if !ok { 391 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceDisableResponse) when calling interceptor") 392 + } 393 + return typedResp, err 394 + } 395 + return nil, err 396 + } 397 + } 398 + return caller(ctx, in) 399 + } 400 + 401 + func (c *usersServiceJSONClient) callDisable(ctx context.Context, in *UsersServiceDisableRequest) (*UsersServiceDisableResponse, error) { 402 + out := new(UsersServiceDisableResponse) 403 + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) 404 + if err != nil { 405 + twerr, ok := err.(twirp.Error) 406 + if !ok { 407 + twerr = twirp.InternalErrorWith(err) 408 + } 409 + callClientError(ctx, c.opts.Hooks, twerr) 410 + return nil, err 411 + } 412 + 413 + callClientResponseReceived(ctx, c.opts.Hooks) 414 + 415 + return out, nil 416 + } 417 + 418 + func (c *usersServiceJSONClient) List(ctx context.Context, in *UsersServiceListRequest) (*UsersServiceListResponse, error) { 419 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.admin.v1") 420 + ctx = ctxsetters.WithServiceName(ctx, "UsersService") 421 + ctx = ctxsetters.WithMethodName(ctx, "List") 422 + caller := c.callList 423 + if c.interceptor != nil { 424 + caller = func(ctx context.Context, req *UsersServiceListRequest) (*UsersServiceListResponse, error) { 425 + resp, err := c.interceptor( 426 + func(ctx context.Context, req interface{}) (interface{}, error) { 427 + typedReq, ok := req.(*UsersServiceListRequest) 428 + if !ok { 429 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceListRequest) when calling interceptor") 430 + } 431 + return c.callList(ctx, typedReq) 432 + }, 433 + )(ctx, req) 434 + if resp != nil { 435 + typedResp, ok := resp.(*UsersServiceListResponse) 436 + if !ok { 437 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceListResponse) when calling interceptor") 438 + } 439 + return typedResp, err 440 + } 441 + return nil, err 442 + } 443 + } 444 + return caller(ctx, in) 445 + } 446 + 447 + func (c *usersServiceJSONClient) callList(ctx context.Context, in *UsersServiceListRequest) (*UsersServiceListResponse, error) { 448 + out := new(UsersServiceListResponse) 449 + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out) 450 + if err != nil { 451 + twerr, ok := err.(twirp.Error) 452 + if !ok { 453 + twerr = twirp.InternalErrorWith(err) 454 + } 455 + callClientError(ctx, c.opts.Hooks, twerr) 456 + return nil, err 457 + } 458 + 459 + callClientResponseReceived(ctx, c.opts.Hooks) 460 + 461 + return out, nil 462 + } 463 + 464 + func (c *usersServiceJSONClient) MakeJWT(ctx context.Context, in *UsersServiceMakeJWTRequest) (*UsersServiceMakeJWTResponse, error) { 465 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.admin.v1") 466 + ctx = ctxsetters.WithServiceName(ctx, "UsersService") 467 + ctx = ctxsetters.WithMethodName(ctx, "MakeJWT") 468 + caller := c.callMakeJWT 469 + if c.interceptor != nil { 470 + caller = func(ctx context.Context, req *UsersServiceMakeJWTRequest) (*UsersServiceMakeJWTResponse, error) { 471 + resp, err := c.interceptor( 472 + func(ctx context.Context, req interface{}) (interface{}, error) { 473 + typedReq, ok := req.(*UsersServiceMakeJWTRequest) 474 + if !ok { 475 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceMakeJWTRequest) when calling interceptor") 476 + } 477 + return c.callMakeJWT(ctx, typedReq) 478 + }, 479 + )(ctx, req) 480 + if resp != nil { 481 + typedResp, ok := resp.(*UsersServiceMakeJWTResponse) 482 + if !ok { 483 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceMakeJWTResponse) when calling interceptor") 484 + } 485 + return typedResp, err 486 + } 487 + return nil, err 488 + } 489 + } 490 + return caller(ctx, in) 491 + } 492 + 493 + func (c *usersServiceJSONClient) callMakeJWT(ctx context.Context, in *UsersServiceMakeJWTRequest) (*UsersServiceMakeJWTResponse, error) { 494 + out := new(UsersServiceMakeJWTResponse) 495 + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out) 496 + if err != nil { 497 + twerr, ok := err.(twirp.Error) 498 + if !ok { 499 + twerr = twirp.InternalErrorWith(err) 500 + } 501 + callClientError(ctx, c.opts.Hooks, twerr) 502 + return nil, err 503 + } 504 + 505 + callClientResponseReceived(ctx, c.opts.Hooks) 506 + 507 + return out, nil 508 + } 509 + 510 + // =========================== 511 + // UsersService Server Handler 512 + // =========================== 513 + 514 + type usersServiceServer struct { 515 + UsersService 516 + interceptor twirp.Interceptor 517 + hooks *twirp.ServerHooks 518 + pathPrefix string // prefix for routing 519 + jsonSkipDefaults bool // do not include unpopulated fields (default values) in the response 520 + jsonCamelCase bool // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names 521 + } 522 + 523 + // NewUsersServiceServer builds a TwirpServer that can be used as an http.Handler to handle 524 + // HTTP requests that are routed to the right method in the provided svc implementation. 525 + // The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks). 526 + func NewUsersServiceServer(svc UsersService, opts ...interface{}) TwirpServer { 527 + serverOpts := newServerOpts(opts) 528 + 529 + // Using ReadOpt allows backwards and forwards compatibility with new options in the future 530 + jsonSkipDefaults := false 531 + _ = serverOpts.ReadOpt("jsonSkipDefaults", &jsonSkipDefaults) 532 + jsonCamelCase := false 533 + _ = serverOpts.ReadOpt("jsonCamelCase", &jsonCamelCase) 534 + var pathPrefix string 535 + if ok := serverOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { 536 + pathPrefix = "/twirp" // default prefix 537 + } 538 + 539 + return &usersServiceServer{ 540 + UsersService: svc, 541 + hooks: serverOpts.Hooks, 542 + interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...), 543 + pathPrefix: pathPrefix, 544 + jsonSkipDefaults: jsonSkipDefaults, 545 + jsonCamelCase: jsonCamelCase, 546 + } 547 + } 548 + 549 + // writeError writes an HTTP response with a valid Twirp error format, and triggers hooks. 550 + // If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) 551 + func (s *usersServiceServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { 552 + writeError(ctx, resp, err, s.hooks) 553 + } 554 + 555 + // handleRequestBodyError is used to handle error when the twirp server cannot read request 556 + func (s *usersServiceServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { 557 + if context.Canceled == ctx.Err() { 558 + s.writeError(ctx, resp, twirp.NewError(twirp.Canceled, "failed to read request: context canceled")) 559 + return 560 + } 561 + if context.DeadlineExceeded == ctx.Err() { 562 + s.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, "failed to read request: deadline exceeded")) 563 + return 564 + } 565 + s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err)) 566 + } 567 + 568 + // UsersServicePathPrefix is a convenience constant that may identify URL paths. 569 + // Should be used with caution, it only matches routes generated by Twirp Go clients, 570 + // with the default "/twirp" prefix and default CamelCase service and method names. 571 + // More info: https://twitchtv.github.io/twirp/docs/routing.html 572 + const UsersServicePathPrefix = "/twirp/techaro.thoth.auth.admin.v1.UsersService/" 573 + 574 + func (s *usersServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { 575 + ctx := req.Context() 576 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.admin.v1") 577 + ctx = ctxsetters.WithServiceName(ctx, "UsersService") 578 + ctx = ctxsetters.WithResponseWriter(ctx, resp) 579 + 580 + var err error 581 + ctx, err = callRequestReceived(ctx, s.hooks) 582 + if err != nil { 583 + s.writeError(ctx, resp, err) 584 + return 585 + } 586 + 587 + if req.Method != "POST" { 588 + msg := fmt.Sprintf("unsupported method %q (only POST is allowed)", req.Method) 589 + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) 590 + return 591 + } 592 + 593 + // Verify path format: [<prefix>]/<package>.<Service>/<Method> 594 + prefix, pkgService, method := parseTwirpPath(req.URL.Path) 595 + if pkgService != "techaro.thoth.auth.admin.v1.UsersService" { 596 + msg := fmt.Sprintf("no handler for path %q", req.URL.Path) 597 + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) 598 + return 599 + } 600 + if prefix != s.pathPrefix { 601 + msg := fmt.Sprintf("invalid path prefix %q, expected %q, on path %q", prefix, s.pathPrefix, req.URL.Path) 602 + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) 603 + return 604 + } 605 + 606 + switch method { 607 + case "Create": 608 + s.serveCreate(ctx, resp, req) 609 + return 610 + case "Disable": 611 + s.serveDisable(ctx, resp, req) 612 + return 613 + case "List": 614 + s.serveList(ctx, resp, req) 615 + return 616 + case "MakeJWT": 617 + s.serveMakeJWT(ctx, resp, req) 618 + return 619 + default: 620 + msg := fmt.Sprintf("no handler for path %q", req.URL.Path) 621 + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) 622 + return 623 + } 624 + } 625 + 626 + func (s *usersServiceServer) serveCreate(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 627 + header := req.Header.Get("Content-Type") 628 + i := strings.Index(header, ";") 629 + if i == -1 { 630 + i = len(header) 631 + } 632 + switch strings.TrimSpace(strings.ToLower(header[:i])) { 633 + case "application/json": 634 + s.serveCreateJSON(ctx, resp, req) 635 + case "application/protobuf": 636 + s.serveCreateProtobuf(ctx, resp, req) 637 + default: 638 + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) 639 + twerr := badRouteError(msg, req.Method, req.URL.Path) 640 + s.writeError(ctx, resp, twerr) 641 + } 642 + } 643 + 644 + func (s *usersServiceServer) serveCreateJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 645 + var err error 646 + ctx = ctxsetters.WithMethodName(ctx, "Create") 647 + ctx, err = callRequestRouted(ctx, s.hooks) 648 + if err != nil { 649 + s.writeError(ctx, resp, err) 650 + return 651 + } 652 + 653 + d := json.NewDecoder(req.Body) 654 + rawReqBody := json.RawMessage{} 655 + if err := d.Decode(&rawReqBody); err != nil { 656 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 657 + return 658 + } 659 + reqContent := new(UsersServiceCreateRequest) 660 + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} 661 + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { 662 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 663 + return 664 + } 665 + 666 + handler := s.UsersService.Create 667 + if s.interceptor != nil { 668 + handler = func(ctx context.Context, req *UsersServiceCreateRequest) (*UsersServiceCreateResponse, error) { 669 + resp, err := s.interceptor( 670 + func(ctx context.Context, req interface{}) (interface{}, error) { 671 + typedReq, ok := req.(*UsersServiceCreateRequest) 672 + if !ok { 673 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceCreateRequest) when calling interceptor") 674 + } 675 + return s.UsersService.Create(ctx, typedReq) 676 + }, 677 + )(ctx, req) 678 + if resp != nil { 679 + typedResp, ok := resp.(*UsersServiceCreateResponse) 680 + if !ok { 681 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceCreateResponse) when calling interceptor") 682 + } 683 + return typedResp, err 684 + } 685 + return nil, err 686 + } 687 + } 688 + 689 + // Call service method 690 + var respContent *UsersServiceCreateResponse 691 + func() { 692 + defer ensurePanicResponses(ctx, resp, s.hooks) 693 + respContent, err = handler(ctx, reqContent) 694 + }() 695 + 696 + if err != nil { 697 + s.writeError(ctx, resp, err) 698 + return 699 + } 700 + if respContent == nil { 701 + s.writeError(ctx, resp, twirp.InternalError("received a nil *UsersServiceCreateResponse and nil error while calling Create. nil responses are not supported")) 702 + return 703 + } 704 + 705 + ctx = callResponsePrepared(ctx, s.hooks) 706 + 707 + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} 708 + respBytes, err := marshaler.Marshal(respContent) 709 + if err != nil { 710 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) 711 + return 712 + } 713 + 714 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 715 + resp.Header().Set("Content-Type", "application/json") 716 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 717 + resp.WriteHeader(http.StatusOK) 718 + 719 + if n, err := resp.Write(respBytes); err != nil { 720 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 721 + twerr := twirp.NewError(twirp.Unknown, msg) 722 + ctx = callError(ctx, s.hooks, twerr) 723 + } 724 + callResponseSent(ctx, s.hooks) 725 + } 726 + 727 + func (s *usersServiceServer) serveCreateProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 728 + var err error 729 + ctx = ctxsetters.WithMethodName(ctx, "Create") 730 + ctx, err = callRequestRouted(ctx, s.hooks) 731 + if err != nil { 732 + s.writeError(ctx, resp, err) 733 + return 734 + } 735 + 736 + buf, err := io.ReadAll(req.Body) 737 + if err != nil { 738 + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) 739 + return 740 + } 741 + reqContent := new(UsersServiceCreateRequest) 742 + if err = proto.Unmarshal(buf, reqContent); err != nil { 743 + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) 744 + return 745 + } 746 + 747 + handler := s.UsersService.Create 748 + if s.interceptor != nil { 749 + handler = func(ctx context.Context, req *UsersServiceCreateRequest) (*UsersServiceCreateResponse, error) { 750 + resp, err := s.interceptor( 751 + func(ctx context.Context, req interface{}) (interface{}, error) { 752 + typedReq, ok := req.(*UsersServiceCreateRequest) 753 + if !ok { 754 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceCreateRequest) when calling interceptor") 755 + } 756 + return s.UsersService.Create(ctx, typedReq) 757 + }, 758 + )(ctx, req) 759 + if resp != nil { 760 + typedResp, ok := resp.(*UsersServiceCreateResponse) 761 + if !ok { 762 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceCreateResponse) when calling interceptor") 763 + } 764 + return typedResp, err 765 + } 766 + return nil, err 767 + } 768 + } 769 + 770 + // Call service method 771 + var respContent *UsersServiceCreateResponse 772 + func() { 773 + defer ensurePanicResponses(ctx, resp, s.hooks) 774 + respContent, err = handler(ctx, reqContent) 775 + }() 776 + 777 + if err != nil { 778 + s.writeError(ctx, resp, err) 779 + return 780 + } 781 + if respContent == nil { 782 + s.writeError(ctx, resp, twirp.InternalError("received a nil *UsersServiceCreateResponse and nil error while calling Create. nil responses are not supported")) 783 + return 784 + } 785 + 786 + ctx = callResponsePrepared(ctx, s.hooks) 787 + 788 + respBytes, err := proto.Marshal(respContent) 789 + if err != nil { 790 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) 791 + return 792 + } 793 + 794 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 795 + resp.Header().Set("Content-Type", "application/protobuf") 796 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 797 + resp.WriteHeader(http.StatusOK) 798 + if n, err := resp.Write(respBytes); err != nil { 799 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 800 + twerr := twirp.NewError(twirp.Unknown, msg) 801 + ctx = callError(ctx, s.hooks, twerr) 802 + } 803 + callResponseSent(ctx, s.hooks) 804 + } 805 + 806 + func (s *usersServiceServer) serveDisable(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 807 + header := req.Header.Get("Content-Type") 808 + i := strings.Index(header, ";") 809 + if i == -1 { 810 + i = len(header) 811 + } 812 + switch strings.TrimSpace(strings.ToLower(header[:i])) { 813 + case "application/json": 814 + s.serveDisableJSON(ctx, resp, req) 815 + case "application/protobuf": 816 + s.serveDisableProtobuf(ctx, resp, req) 817 + default: 818 + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) 819 + twerr := badRouteError(msg, req.Method, req.URL.Path) 820 + s.writeError(ctx, resp, twerr) 821 + } 822 + } 823 + 824 + func (s *usersServiceServer) serveDisableJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 825 + var err error 826 + ctx = ctxsetters.WithMethodName(ctx, "Disable") 827 + ctx, err = callRequestRouted(ctx, s.hooks) 828 + if err != nil { 829 + s.writeError(ctx, resp, err) 830 + return 831 + } 832 + 833 + d := json.NewDecoder(req.Body) 834 + rawReqBody := json.RawMessage{} 835 + if err := d.Decode(&rawReqBody); err != nil { 836 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 837 + return 838 + } 839 + reqContent := new(UsersServiceDisableRequest) 840 + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} 841 + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { 842 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 843 + return 844 + } 845 + 846 + handler := s.UsersService.Disable 847 + if s.interceptor != nil { 848 + handler = func(ctx context.Context, req *UsersServiceDisableRequest) (*UsersServiceDisableResponse, error) { 849 + resp, err := s.interceptor( 850 + func(ctx context.Context, req interface{}) (interface{}, error) { 851 + typedReq, ok := req.(*UsersServiceDisableRequest) 852 + if !ok { 853 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceDisableRequest) when calling interceptor") 854 + } 855 + return s.UsersService.Disable(ctx, typedReq) 856 + }, 857 + )(ctx, req) 858 + if resp != nil { 859 + typedResp, ok := resp.(*UsersServiceDisableResponse) 860 + if !ok { 861 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceDisableResponse) when calling interceptor") 862 + } 863 + return typedResp, err 864 + } 865 + return nil, err 866 + } 867 + } 868 + 869 + // Call service method 870 + var respContent *UsersServiceDisableResponse 871 + func() { 872 + defer ensurePanicResponses(ctx, resp, s.hooks) 873 + respContent, err = handler(ctx, reqContent) 874 + }() 875 + 876 + if err != nil { 877 + s.writeError(ctx, resp, err) 878 + return 879 + } 880 + if respContent == nil { 881 + s.writeError(ctx, resp, twirp.InternalError("received a nil *UsersServiceDisableResponse and nil error while calling Disable. nil responses are not supported")) 882 + return 883 + } 884 + 885 + ctx = callResponsePrepared(ctx, s.hooks) 886 + 887 + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} 888 + respBytes, err := marshaler.Marshal(respContent) 889 + if err != nil { 890 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) 891 + return 892 + } 893 + 894 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 895 + resp.Header().Set("Content-Type", "application/json") 896 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 897 + resp.WriteHeader(http.StatusOK) 898 + 899 + if n, err := resp.Write(respBytes); err != nil { 900 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 901 + twerr := twirp.NewError(twirp.Unknown, msg) 902 + ctx = callError(ctx, s.hooks, twerr) 903 + } 904 + callResponseSent(ctx, s.hooks) 905 + } 906 + 907 + func (s *usersServiceServer) serveDisableProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 908 + var err error 909 + ctx = ctxsetters.WithMethodName(ctx, "Disable") 910 + ctx, err = callRequestRouted(ctx, s.hooks) 911 + if err != nil { 912 + s.writeError(ctx, resp, err) 913 + return 914 + } 915 + 916 + buf, err := io.ReadAll(req.Body) 917 + if err != nil { 918 + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) 919 + return 920 + } 921 + reqContent := new(UsersServiceDisableRequest) 922 + if err = proto.Unmarshal(buf, reqContent); err != nil { 923 + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) 924 + return 925 + } 926 + 927 + handler := s.UsersService.Disable 928 + if s.interceptor != nil { 929 + handler = func(ctx context.Context, req *UsersServiceDisableRequest) (*UsersServiceDisableResponse, error) { 930 + resp, err := s.interceptor( 931 + func(ctx context.Context, req interface{}) (interface{}, error) { 932 + typedReq, ok := req.(*UsersServiceDisableRequest) 933 + if !ok { 934 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceDisableRequest) when calling interceptor") 935 + } 936 + return s.UsersService.Disable(ctx, typedReq) 937 + }, 938 + )(ctx, req) 939 + if resp != nil { 940 + typedResp, ok := resp.(*UsersServiceDisableResponse) 941 + if !ok { 942 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceDisableResponse) when calling interceptor") 943 + } 944 + return typedResp, err 945 + } 946 + return nil, err 947 + } 948 + } 949 + 950 + // Call service method 951 + var respContent *UsersServiceDisableResponse 952 + func() { 953 + defer ensurePanicResponses(ctx, resp, s.hooks) 954 + respContent, err = handler(ctx, reqContent) 955 + }() 956 + 957 + if err != nil { 958 + s.writeError(ctx, resp, err) 959 + return 960 + } 961 + if respContent == nil { 962 + s.writeError(ctx, resp, twirp.InternalError("received a nil *UsersServiceDisableResponse and nil error while calling Disable. nil responses are not supported")) 963 + return 964 + } 965 + 966 + ctx = callResponsePrepared(ctx, s.hooks) 967 + 968 + respBytes, err := proto.Marshal(respContent) 969 + if err != nil { 970 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) 971 + return 972 + } 973 + 974 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 975 + resp.Header().Set("Content-Type", "application/protobuf") 976 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 977 + resp.WriteHeader(http.StatusOK) 978 + if n, err := resp.Write(respBytes); err != nil { 979 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 980 + twerr := twirp.NewError(twirp.Unknown, msg) 981 + ctx = callError(ctx, s.hooks, twerr) 982 + } 983 + callResponseSent(ctx, s.hooks) 984 + } 985 + 986 + func (s *usersServiceServer) serveList(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 987 + header := req.Header.Get("Content-Type") 988 + i := strings.Index(header, ";") 989 + if i == -1 { 990 + i = len(header) 991 + } 992 + switch strings.TrimSpace(strings.ToLower(header[:i])) { 993 + case "application/json": 994 + s.serveListJSON(ctx, resp, req) 995 + case "application/protobuf": 996 + s.serveListProtobuf(ctx, resp, req) 997 + default: 998 + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) 999 + twerr := badRouteError(msg, req.Method, req.URL.Path) 1000 + s.writeError(ctx, resp, twerr) 1001 + } 1002 + } 1003 + 1004 + func (s *usersServiceServer) serveListJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 1005 + var err error 1006 + ctx = ctxsetters.WithMethodName(ctx, "List") 1007 + ctx, err = callRequestRouted(ctx, s.hooks) 1008 + if err != nil { 1009 + s.writeError(ctx, resp, err) 1010 + return 1011 + } 1012 + 1013 + d := json.NewDecoder(req.Body) 1014 + rawReqBody := json.RawMessage{} 1015 + if err := d.Decode(&rawReqBody); err != nil { 1016 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 1017 + return 1018 + } 1019 + reqContent := new(UsersServiceListRequest) 1020 + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} 1021 + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { 1022 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 1023 + return 1024 + } 1025 + 1026 + handler := s.UsersService.List 1027 + if s.interceptor != nil { 1028 + handler = func(ctx context.Context, req *UsersServiceListRequest) (*UsersServiceListResponse, error) { 1029 + resp, err := s.interceptor( 1030 + func(ctx context.Context, req interface{}) (interface{}, error) { 1031 + typedReq, ok := req.(*UsersServiceListRequest) 1032 + if !ok { 1033 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceListRequest) when calling interceptor") 1034 + } 1035 + return s.UsersService.List(ctx, typedReq) 1036 + }, 1037 + )(ctx, req) 1038 + if resp != nil { 1039 + typedResp, ok := resp.(*UsersServiceListResponse) 1040 + if !ok { 1041 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceListResponse) when calling interceptor") 1042 + } 1043 + return typedResp, err 1044 + } 1045 + return nil, err 1046 + } 1047 + } 1048 + 1049 + // Call service method 1050 + var respContent *UsersServiceListResponse 1051 + func() { 1052 + defer ensurePanicResponses(ctx, resp, s.hooks) 1053 + respContent, err = handler(ctx, reqContent) 1054 + }() 1055 + 1056 + if err != nil { 1057 + s.writeError(ctx, resp, err) 1058 + return 1059 + } 1060 + if respContent == nil { 1061 + s.writeError(ctx, resp, twirp.InternalError("received a nil *UsersServiceListResponse and nil error while calling List. nil responses are not supported")) 1062 + return 1063 + } 1064 + 1065 + ctx = callResponsePrepared(ctx, s.hooks) 1066 + 1067 + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} 1068 + respBytes, err := marshaler.Marshal(respContent) 1069 + if err != nil { 1070 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) 1071 + return 1072 + } 1073 + 1074 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 1075 + resp.Header().Set("Content-Type", "application/json") 1076 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 1077 + resp.WriteHeader(http.StatusOK) 1078 + 1079 + if n, err := resp.Write(respBytes); err != nil { 1080 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 1081 + twerr := twirp.NewError(twirp.Unknown, msg) 1082 + ctx = callError(ctx, s.hooks, twerr) 1083 + } 1084 + callResponseSent(ctx, s.hooks) 1085 + } 1086 + 1087 + func (s *usersServiceServer) serveListProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 1088 + var err error 1089 + ctx = ctxsetters.WithMethodName(ctx, "List") 1090 + ctx, err = callRequestRouted(ctx, s.hooks) 1091 + if err != nil { 1092 + s.writeError(ctx, resp, err) 1093 + return 1094 + } 1095 + 1096 + buf, err := io.ReadAll(req.Body) 1097 + if err != nil { 1098 + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) 1099 + return 1100 + } 1101 + reqContent := new(UsersServiceListRequest) 1102 + if err = proto.Unmarshal(buf, reqContent); err != nil { 1103 + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) 1104 + return 1105 + } 1106 + 1107 + handler := s.UsersService.List 1108 + if s.interceptor != nil { 1109 + handler = func(ctx context.Context, req *UsersServiceListRequest) (*UsersServiceListResponse, error) { 1110 + resp, err := s.interceptor( 1111 + func(ctx context.Context, req interface{}) (interface{}, error) { 1112 + typedReq, ok := req.(*UsersServiceListRequest) 1113 + if !ok { 1114 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceListRequest) when calling interceptor") 1115 + } 1116 + return s.UsersService.List(ctx, typedReq) 1117 + }, 1118 + )(ctx, req) 1119 + if resp != nil { 1120 + typedResp, ok := resp.(*UsersServiceListResponse) 1121 + if !ok { 1122 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceListResponse) when calling interceptor") 1123 + } 1124 + return typedResp, err 1125 + } 1126 + return nil, err 1127 + } 1128 + } 1129 + 1130 + // Call service method 1131 + var respContent *UsersServiceListResponse 1132 + func() { 1133 + defer ensurePanicResponses(ctx, resp, s.hooks) 1134 + respContent, err = handler(ctx, reqContent) 1135 + }() 1136 + 1137 + if err != nil { 1138 + s.writeError(ctx, resp, err) 1139 + return 1140 + } 1141 + if respContent == nil { 1142 + s.writeError(ctx, resp, twirp.InternalError("received a nil *UsersServiceListResponse and nil error while calling List. nil responses are not supported")) 1143 + return 1144 + } 1145 + 1146 + ctx = callResponsePrepared(ctx, s.hooks) 1147 + 1148 + respBytes, err := proto.Marshal(respContent) 1149 + if err != nil { 1150 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) 1151 + return 1152 + } 1153 + 1154 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 1155 + resp.Header().Set("Content-Type", "application/protobuf") 1156 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 1157 + resp.WriteHeader(http.StatusOK) 1158 + if n, err := resp.Write(respBytes); err != nil { 1159 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 1160 + twerr := twirp.NewError(twirp.Unknown, msg) 1161 + ctx = callError(ctx, s.hooks, twerr) 1162 + } 1163 + callResponseSent(ctx, s.hooks) 1164 + } 1165 + 1166 + func (s *usersServiceServer) serveMakeJWT(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 1167 + header := req.Header.Get("Content-Type") 1168 + i := strings.Index(header, ";") 1169 + if i == -1 { 1170 + i = len(header) 1171 + } 1172 + switch strings.TrimSpace(strings.ToLower(header[:i])) { 1173 + case "application/json": 1174 + s.serveMakeJWTJSON(ctx, resp, req) 1175 + case "application/protobuf": 1176 + s.serveMakeJWTProtobuf(ctx, resp, req) 1177 + default: 1178 + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) 1179 + twerr := badRouteError(msg, req.Method, req.URL.Path) 1180 + s.writeError(ctx, resp, twerr) 1181 + } 1182 + } 1183 + 1184 + func (s *usersServiceServer) serveMakeJWTJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 1185 + var err error 1186 + ctx = ctxsetters.WithMethodName(ctx, "MakeJWT") 1187 + ctx, err = callRequestRouted(ctx, s.hooks) 1188 + if err != nil { 1189 + s.writeError(ctx, resp, err) 1190 + return 1191 + } 1192 + 1193 + d := json.NewDecoder(req.Body) 1194 + rawReqBody := json.RawMessage{} 1195 + if err := d.Decode(&rawReqBody); err != nil { 1196 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 1197 + return 1198 + } 1199 + reqContent := new(UsersServiceMakeJWTRequest) 1200 + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} 1201 + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { 1202 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 1203 + return 1204 + } 1205 + 1206 + handler := s.UsersService.MakeJWT 1207 + if s.interceptor != nil { 1208 + handler = func(ctx context.Context, req *UsersServiceMakeJWTRequest) (*UsersServiceMakeJWTResponse, error) { 1209 + resp, err := s.interceptor( 1210 + func(ctx context.Context, req interface{}) (interface{}, error) { 1211 + typedReq, ok := req.(*UsersServiceMakeJWTRequest) 1212 + if !ok { 1213 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceMakeJWTRequest) when calling interceptor") 1214 + } 1215 + return s.UsersService.MakeJWT(ctx, typedReq) 1216 + }, 1217 + )(ctx, req) 1218 + if resp != nil { 1219 + typedResp, ok := resp.(*UsersServiceMakeJWTResponse) 1220 + if !ok { 1221 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceMakeJWTResponse) when calling interceptor") 1222 + } 1223 + return typedResp, err 1224 + } 1225 + return nil, err 1226 + } 1227 + } 1228 + 1229 + // Call service method 1230 + var respContent *UsersServiceMakeJWTResponse 1231 + func() { 1232 + defer ensurePanicResponses(ctx, resp, s.hooks) 1233 + respContent, err = handler(ctx, reqContent) 1234 + }() 1235 + 1236 + if err != nil { 1237 + s.writeError(ctx, resp, err) 1238 + return 1239 + } 1240 + if respContent == nil { 1241 + s.writeError(ctx, resp, twirp.InternalError("received a nil *UsersServiceMakeJWTResponse and nil error while calling MakeJWT. nil responses are not supported")) 1242 + return 1243 + } 1244 + 1245 + ctx = callResponsePrepared(ctx, s.hooks) 1246 + 1247 + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} 1248 + respBytes, err := marshaler.Marshal(respContent) 1249 + if err != nil { 1250 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) 1251 + return 1252 + } 1253 + 1254 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 1255 + resp.Header().Set("Content-Type", "application/json") 1256 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 1257 + resp.WriteHeader(http.StatusOK) 1258 + 1259 + if n, err := resp.Write(respBytes); err != nil { 1260 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 1261 + twerr := twirp.NewError(twirp.Unknown, msg) 1262 + ctx = callError(ctx, s.hooks, twerr) 1263 + } 1264 + callResponseSent(ctx, s.hooks) 1265 + } 1266 + 1267 + func (s *usersServiceServer) serveMakeJWTProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 1268 + var err error 1269 + ctx = ctxsetters.WithMethodName(ctx, "MakeJWT") 1270 + ctx, err = callRequestRouted(ctx, s.hooks) 1271 + if err != nil { 1272 + s.writeError(ctx, resp, err) 1273 + return 1274 + } 1275 + 1276 + buf, err := io.ReadAll(req.Body) 1277 + if err != nil { 1278 + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) 1279 + return 1280 + } 1281 + reqContent := new(UsersServiceMakeJWTRequest) 1282 + if err = proto.Unmarshal(buf, reqContent); err != nil { 1283 + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) 1284 + return 1285 + } 1286 + 1287 + handler := s.UsersService.MakeJWT 1288 + if s.interceptor != nil { 1289 + handler = func(ctx context.Context, req *UsersServiceMakeJWTRequest) (*UsersServiceMakeJWTResponse, error) { 1290 + resp, err := s.interceptor( 1291 + func(ctx context.Context, req interface{}) (interface{}, error) { 1292 + typedReq, ok := req.(*UsersServiceMakeJWTRequest) 1293 + if !ok { 1294 + return nil, twirp.InternalError("failed type assertion req.(*UsersServiceMakeJWTRequest) when calling interceptor") 1295 + } 1296 + return s.UsersService.MakeJWT(ctx, typedReq) 1297 + }, 1298 + )(ctx, req) 1299 + if resp != nil { 1300 + typedResp, ok := resp.(*UsersServiceMakeJWTResponse) 1301 + if !ok { 1302 + return nil, twirp.InternalError("failed type assertion resp.(*UsersServiceMakeJWTResponse) when calling interceptor") 1303 + } 1304 + return typedResp, err 1305 + } 1306 + return nil, err 1307 + } 1308 + } 1309 + 1310 + // Call service method 1311 + var respContent *UsersServiceMakeJWTResponse 1312 + func() { 1313 + defer ensurePanicResponses(ctx, resp, s.hooks) 1314 + respContent, err = handler(ctx, reqContent) 1315 + }() 1316 + 1317 + if err != nil { 1318 + s.writeError(ctx, resp, err) 1319 + return 1320 + } 1321 + if respContent == nil { 1322 + s.writeError(ctx, resp, twirp.InternalError("received a nil *UsersServiceMakeJWTResponse and nil error while calling MakeJWT. nil responses are not supported")) 1323 + return 1324 + } 1325 + 1326 + ctx = callResponsePrepared(ctx, s.hooks) 1327 + 1328 + respBytes, err := proto.Marshal(respContent) 1329 + if err != nil { 1330 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) 1331 + return 1332 + } 1333 + 1334 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 1335 + resp.Header().Set("Content-Type", "application/protobuf") 1336 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 1337 + resp.WriteHeader(http.StatusOK) 1338 + if n, err := resp.Write(respBytes); err != nil { 1339 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 1340 + twerr := twirp.NewError(twirp.Unknown, msg) 1341 + ctx = callError(ctx, s.hooks, twerr) 1342 + } 1343 + callResponseSent(ctx, s.hooks) 1344 + } 1345 + 1346 + func (s *usersServiceServer) ServiceDescriptor() ([]byte, int) { 1347 + return twirpFileDescriptor0, 0 1348 + } 1349 + 1350 + func (s *usersServiceServer) ProtocGenTwirpVersion() string { 1351 + return "v8.1.3" 1352 + } 1353 + 1354 + // PathPrefix returns the base service path, in the form: "/<prefix>/<package>.<Service>/" 1355 + // that is everything in a Twirp route except for the <Method>. This can be used for routing, 1356 + // for example to identify the requests that are targeted to this service in a mux. 1357 + func (s *usersServiceServer) PathPrefix() string { 1358 + return baseServicePath(s.pathPrefix, "techaro.thoth.auth.admin.v1", "UsersService") 1359 + } 1360 + 1361 + // ===== 1362 + // Utils 1363 + // ===== 1364 + 1365 + // HTTPClient is the interface used by generated clients to send HTTP requests. 1366 + // It is fulfilled by *(net/http).Client, which is sufficient for most users. 1367 + // Users can provide their own implementation for special retry policies. 1368 + // 1369 + // HTTPClient implementations should not follow redirects. Redirects are 1370 + // automatically disabled if *(net/http).Client is passed to client 1371 + // constructors. See the withoutRedirects function in this file for more 1372 + // details. 1373 + type HTTPClient interface { 1374 + Do(req *http.Request) (*http.Response, error) 1375 + } 1376 + 1377 + // TwirpServer is the interface generated server structs will support: they're 1378 + // HTTP handlers with additional methods for accessing metadata about the 1379 + // service. Those accessors are a low-level API for building reflection tools. 1380 + // Most people can think of TwirpServers as just http.Handlers. 1381 + type TwirpServer interface { 1382 + http.Handler 1383 + 1384 + // ServiceDescriptor returns gzipped bytes describing the .proto file that 1385 + // this service was generated from. Once unzipped, the bytes can be 1386 + // unmarshalled as a 1387 + // google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto. 1388 + // 1389 + // The returned integer is the index of this particular service within that 1390 + // FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a 1391 + // low-level field, expected to be used for reflection. 1392 + ServiceDescriptor() ([]byte, int) 1393 + 1394 + // ProtocGenTwirpVersion is the semantic version string of the version of 1395 + // twirp used to generate this file. 1396 + ProtocGenTwirpVersion() string 1397 + 1398 + // PathPrefix returns the HTTP URL path prefix for all methods handled by this 1399 + // service. This can be used with an HTTP mux to route Twirp requests. 1400 + // The path prefix is in the form: "/<prefix>/<package>.<Service>/" 1401 + // that is, everything in a Twirp route except for the <Method> at the end. 1402 + PathPrefix() string 1403 + } 1404 + 1405 + func newServerOpts(opts []interface{}) *twirp.ServerOptions { 1406 + serverOpts := &twirp.ServerOptions{} 1407 + for _, opt := range opts { 1408 + switch o := opt.(type) { 1409 + case twirp.ServerOption: 1410 + o(serverOpts) 1411 + case *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument 1412 + twirp.WithServerHooks(o)(serverOpts) 1413 + case nil: // backwards compatibility, allow nil value for the argument 1414 + continue 1415 + default: 1416 + panic(fmt.Sprintf("Invalid option type %T, please use a twirp.ServerOption", o)) 1417 + } 1418 + } 1419 + return serverOpts 1420 + } 1421 + 1422 + // WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). 1423 + // Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. 1424 + // If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) 1425 + func WriteError(resp http.ResponseWriter, err error) { 1426 + writeError(context.Background(), resp, err, nil) 1427 + } 1428 + 1429 + // writeError writes Twirp errors in the response and triggers hooks. 1430 + func writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) { 1431 + // Convert to a twirp.Error. Non-twirp errors are converted to internal errors. 1432 + var twerr twirp.Error 1433 + if !errors.As(err, &twerr) { 1434 + twerr = twirp.InternalErrorWith(err) 1435 + } 1436 + 1437 + statusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code()) 1438 + ctx = ctxsetters.WithStatusCode(ctx, statusCode) 1439 + ctx = callError(ctx, hooks, twerr) 1440 + 1441 + respBody := marshalErrorToJSON(twerr) 1442 + 1443 + resp.Header().Set("Content-Type", "application/json") // Error responses are always JSON 1444 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBody))) 1445 + resp.WriteHeader(statusCode) // set HTTP status code and send response 1446 + 1447 + _, writeErr := resp.Write(respBody) 1448 + if writeErr != nil { 1449 + // We have three options here. We could log the error, call the Error 1450 + // hook, or just silently ignore the error. 1451 + // 1452 + // Logging is unacceptable because we don't have a user-controlled 1453 + // logger; writing out to stderr without permission is too rude. 1454 + // 1455 + // Calling the Error hook would confuse users: it would mean the Error 1456 + // hook got called twice for one request, which is likely to lead to 1457 + // duplicated log messages and metrics, no matter how well we document 1458 + // the behavior. 1459 + // 1460 + // Silently ignoring the error is our least-bad option. It's highly 1461 + // likely that the connection is broken and the original 'err' says 1462 + // so anyway. 1463 + _ = writeErr 1464 + } 1465 + 1466 + callResponseSent(ctx, hooks) 1467 + } 1468 + 1469 + // sanitizeBaseURL parses the the baseURL, and adds the "http" scheme if needed. 1470 + // If the URL is unparsable, the baseURL is returned unchanged. 1471 + func sanitizeBaseURL(baseURL string) string { 1472 + u, err := url.Parse(baseURL) 1473 + if err != nil { 1474 + return baseURL // invalid URL will fail later when making requests 1475 + } 1476 + if u.Scheme == "" { 1477 + u.Scheme = "http" 1478 + } 1479 + return u.String() 1480 + } 1481 + 1482 + // baseServicePath composes the path prefix for the service (without <Method>). 1483 + // e.g.: baseServicePath("/twirp", "my.pkg", "MyService") 1484 + // 1485 + // returns => "/twirp/my.pkg.MyService/" 1486 + // 1487 + // e.g.: baseServicePath("", "", "MyService") 1488 + // 1489 + // returns => "/MyService/" 1490 + func baseServicePath(prefix, pkg, service string) string { 1491 + fullServiceName := service 1492 + if pkg != "" { 1493 + fullServiceName = pkg + "." + service 1494 + } 1495 + return path.Join("/", prefix, fullServiceName) + "/" 1496 + } 1497 + 1498 + // parseTwirpPath extracts path components form a valid Twirp route. 1499 + // Expected format: "[<prefix>]/<package>.<Service>/<Method>" 1500 + // e.g.: prefix, pkgService, method := parseTwirpPath("/twirp/pkg.Svc/MakeHat") 1501 + func parseTwirpPath(path string) (string, string, string) { 1502 + parts := strings.Split(path, "/") 1503 + if len(parts) < 2 { 1504 + return "", "", "" 1505 + } 1506 + method := parts[len(parts)-1] 1507 + pkgService := parts[len(parts)-2] 1508 + prefix := strings.Join(parts[0:len(parts)-2], "/") 1509 + return prefix, pkgService, method 1510 + } 1511 + 1512 + // getCustomHTTPReqHeaders retrieves a copy of any headers that are set in 1513 + // a context through the twirp.WithHTTPRequestHeaders function. 1514 + // If there are no headers set, or if they have the wrong type, nil is returned. 1515 + func getCustomHTTPReqHeaders(ctx context.Context) http.Header { 1516 + header, ok := twirp.HTTPRequestHeaders(ctx) 1517 + if !ok || header == nil { 1518 + return nil 1519 + } 1520 + copied := make(http.Header) 1521 + for k, vv := range header { 1522 + if vv == nil { 1523 + copied[k] = nil 1524 + continue 1525 + } 1526 + copied[k] = make([]string, len(vv)) 1527 + copy(copied[k], vv) 1528 + } 1529 + return copied 1530 + } 1531 + 1532 + // newRequest makes an http.Request from a client, adding common headers. 1533 + func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) { 1534 + req, err := http.NewRequest("POST", url, reqBody) 1535 + if err != nil { 1536 + return nil, err 1537 + } 1538 + req = req.WithContext(ctx) 1539 + if customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil { 1540 + req.Header = customHeader 1541 + } 1542 + req.Header.Set("Accept", contentType) 1543 + req.Header.Set("Content-Type", contentType) 1544 + req.Header.Set("Twirp-Version", "v8.1.3") 1545 + return req, nil 1546 + } 1547 + 1548 + // JSON serialization for errors 1549 + type twerrJSON struct { 1550 + Code string `json:"code"` 1551 + Msg string `json:"msg"` 1552 + Meta map[string]string `json:"meta,omitempty"` 1553 + } 1554 + 1555 + // marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body. 1556 + // If serialization fails, it will use a descriptive Internal error instead. 1557 + func marshalErrorToJSON(twerr twirp.Error) []byte { 1558 + // make sure that msg is not too large 1559 + msg := twerr.Msg() 1560 + if len(msg) > 1e6 { 1561 + msg = msg[:1e6] 1562 + } 1563 + 1564 + tj := twerrJSON{ 1565 + Code: string(twerr.Code()), 1566 + Msg: msg, 1567 + Meta: twerr.MetaMap(), 1568 + } 1569 + 1570 + buf, err := json.Marshal(&tj) 1571 + if err != nil { 1572 + buf = []byte("{\"type\": \"" + twirp.Internal + "\", \"msg\": \"There was an error but it could not be serialized into JSON\"}") // fallback 1573 + } 1574 + 1575 + return buf 1576 + } 1577 + 1578 + // errorFromResponse builds a twirp.Error from a non-200 HTTP response. 1579 + // If the response has a valid serialized Twirp error, then it's returned. 1580 + // If not, the response status code is used to generate a similar twirp 1581 + // error. See twirpErrorFromIntermediary for more info on intermediary errors. 1582 + func errorFromResponse(resp *http.Response) twirp.Error { 1583 + statusCode := resp.StatusCode 1584 + statusText := http.StatusText(statusCode) 1585 + 1586 + if isHTTPRedirect(statusCode) { 1587 + // Unexpected redirect: it must be an error from an intermediary. 1588 + // Twirp clients don't follow redirects automatically, Twirp only handles 1589 + // POST requests, redirects should only happen on GET and HEAD requests. 1590 + location := resp.Header.Get("Location") 1591 + msg := fmt.Sprintf("unexpected HTTP status code %d %q received, Location=%q", statusCode, statusText, location) 1592 + return twirpErrorFromIntermediary(statusCode, msg, location) 1593 + } 1594 + 1595 + respBodyBytes, err := io.ReadAll(resp.Body) 1596 + if err != nil { 1597 + return wrapInternal(err, "failed to read server error response body") 1598 + } 1599 + 1600 + var tj twerrJSON 1601 + dec := json.NewDecoder(bytes.NewReader(respBodyBytes)) 1602 + dec.DisallowUnknownFields() 1603 + if err := dec.Decode(&tj); err != nil || tj.Code == "" { 1604 + // Invalid JSON response; it must be an error from an intermediary. 1605 + msg := fmt.Sprintf("Error from intermediary with HTTP status code %d %q", statusCode, statusText) 1606 + return twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes)) 1607 + } 1608 + 1609 + errorCode := twirp.ErrorCode(tj.Code) 1610 + if !twirp.IsValidErrorCode(errorCode) { 1611 + msg := "invalid type returned from server error response: " + tj.Code 1612 + return twirp.InternalError(msg).WithMeta("body", string(respBodyBytes)) 1613 + } 1614 + 1615 + twerr := twirp.NewError(errorCode, tj.Msg) 1616 + for k, v := range tj.Meta { 1617 + twerr = twerr.WithMeta(k, v) 1618 + } 1619 + return twerr 1620 + } 1621 + 1622 + // twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors. 1623 + // The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md. 1624 + // Returned twirp Errors have some additional metadata for inspection. 1625 + func twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error { 1626 + var code twirp.ErrorCode 1627 + if isHTTPRedirect(status) { // 3xx 1628 + code = twirp.Internal 1629 + } else { 1630 + switch status { 1631 + case 400: // Bad Request 1632 + code = twirp.Internal 1633 + case 401: // Unauthorized 1634 + code = twirp.Unauthenticated 1635 + case 403: // Forbidden 1636 + code = twirp.PermissionDenied 1637 + case 404: // Not Found 1638 + code = twirp.BadRoute 1639 + case 429: // Too Many Requests 1640 + code = twirp.ResourceExhausted 1641 + case 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout 1642 + code = twirp.Unavailable 1643 + default: // All other codes 1644 + code = twirp.Unknown 1645 + } 1646 + } 1647 + 1648 + twerr := twirp.NewError(code, msg) 1649 + twerr = twerr.WithMeta("http_error_from_intermediary", "true") // to easily know if this error was from intermediary 1650 + twerr = twerr.WithMeta("status_code", strconv.Itoa(status)) 1651 + if isHTTPRedirect(status) { 1652 + twerr = twerr.WithMeta("location", bodyOrLocation) 1653 + } else { 1654 + twerr = twerr.WithMeta("body", bodyOrLocation) 1655 + } 1656 + return twerr 1657 + } 1658 + 1659 + func isHTTPRedirect(status int) bool { 1660 + return status >= 300 && status <= 399 1661 + } 1662 + 1663 + // wrapInternal wraps an error with a prefix as an Internal error. 1664 + // The original error cause is accessible by github.com/pkg/errors.Cause. 1665 + func wrapInternal(err error, prefix string) twirp.Error { 1666 + return twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err}) 1667 + } 1668 + 1669 + type wrappedError struct { 1670 + prefix string 1671 + cause error 1672 + } 1673 + 1674 + func (e *wrappedError) Error() string { return e.prefix + ": " + e.cause.Error() } 1675 + func (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As 1676 + func (e *wrappedError) Cause() error { return e.cause } // for github.com/pkg/errors 1677 + 1678 + // ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal 1679 + // error response (status 500), and error hooks are properly called with the panic wrapped as an error. 1680 + // The panic is re-raised so it can be handled normally with middleware. 1681 + func ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) { 1682 + if r := recover(); r != nil { 1683 + // Wrap the panic as an error so it can be passed to error hooks. 1684 + // The original error is accessible from error hooks, but not visible in the response. 1685 + err := errFromPanic(r) 1686 + twerr := &internalWithCause{msg: "Internal service panic", cause: err} 1687 + // Actually write the error 1688 + writeError(ctx, resp, twerr, hooks) 1689 + // If possible, flush the error to the wire. 1690 + f, ok := resp.(http.Flusher) 1691 + if ok { 1692 + f.Flush() 1693 + } 1694 + 1695 + panic(r) 1696 + } 1697 + } 1698 + 1699 + // errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error. 1700 + func errFromPanic(p interface{}) error { 1701 + if err, ok := p.(error); ok { 1702 + return err 1703 + } 1704 + return fmt.Errorf("panic: %v", p) 1705 + } 1706 + 1707 + // internalWithCause is a Twirp Internal error wrapping an original error cause, 1708 + // but the original error message is not exposed on Msg(). The original error 1709 + // can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap 1710 + type internalWithCause struct { 1711 + msg string 1712 + cause error 1713 + } 1714 + 1715 + func (e *internalWithCause) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As 1716 + func (e *internalWithCause) Cause() error { return e.cause } // for github.com/pkg/errors 1717 + func (e *internalWithCause) Error() string { return e.msg + ": " + e.cause.Error() } 1718 + func (e *internalWithCause) Code() twirp.ErrorCode { return twirp.Internal } 1719 + func (e *internalWithCause) Msg() string { return e.msg } 1720 + func (e *internalWithCause) Meta(key string) string { return "" } 1721 + func (e *internalWithCause) MetaMap() map[string]string { return nil } 1722 + func (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e } 1723 + 1724 + // malformedRequestError is used when the twirp server cannot unmarshal a request 1725 + func malformedRequestError(msg string) twirp.Error { 1726 + return twirp.NewError(twirp.Malformed, msg) 1727 + } 1728 + 1729 + // badRouteError is used when the twirp server cannot route a request 1730 + func badRouteError(msg string, method, url string) twirp.Error { 1731 + err := twirp.NewError(twirp.BadRoute, msg) 1732 + err = err.WithMeta("twirp_invalid_route", method+" "+url) 1733 + return err 1734 + } 1735 + 1736 + // withoutRedirects makes sure that the POST request can not be redirected. 1737 + // The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or 1738 + // 303 response, and also 301s in go1.8. It redirects by making a second request, changing the 1739 + // method to GET and removing the body. This produces very confusing error messages, so instead we 1740 + // set a redirect policy that always errors. This stops Go from executing the redirect. 1741 + // 1742 + // We have to be a little careful in case the user-provided http.Client has its own CheckRedirect 1743 + // policy - if so, we'll run through that policy first. 1744 + // 1745 + // Because this requires modifying the http.Client, we make a new copy of the client and return it. 1746 + func withoutRedirects(in *http.Client) *http.Client { 1747 + copy := *in 1748 + copy.CheckRedirect = func(req *http.Request, via []*http.Request) error { 1749 + if in.CheckRedirect != nil { 1750 + // Run the input's redirect if it exists, in case it has side effects, but ignore any error it 1751 + // returns, since we want to use ErrUseLastResponse. 1752 + err := in.CheckRedirect(req, via) 1753 + _ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use. 1754 + } 1755 + return http.ErrUseLastResponse 1756 + } 1757 + return &copy 1758 + } 1759 + 1760 + // doProtobufRequest makes a Protobuf request to the remote Twirp service. 1761 + func doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) { 1762 + reqBodyBytes, err := proto.Marshal(in) 1763 + if err != nil { 1764 + return ctx, wrapInternal(err, "failed to marshal proto request") 1765 + } 1766 + reqBody := bytes.NewBuffer(reqBodyBytes) 1767 + if err = ctx.Err(); err != nil { 1768 + return ctx, wrapInternal(err, "aborted because context was done") 1769 + } 1770 + 1771 + req, err := newRequest(ctx, url, reqBody, "application/protobuf") 1772 + if err != nil { 1773 + return ctx, wrapInternal(err, "could not build request") 1774 + } 1775 + ctx, err = callClientRequestPrepared(ctx, hooks, req) 1776 + if err != nil { 1777 + return ctx, err 1778 + } 1779 + 1780 + req = req.WithContext(ctx) 1781 + resp, err := client.Do(req) 1782 + if err != nil { 1783 + return ctx, wrapInternal(err, "failed to do request") 1784 + } 1785 + defer func() { _ = resp.Body.Close() }() 1786 + 1787 + if err = ctx.Err(); err != nil { 1788 + return ctx, wrapInternal(err, "aborted because context was done") 1789 + } 1790 + 1791 + if resp.StatusCode != 200 { 1792 + return ctx, errorFromResponse(resp) 1793 + } 1794 + 1795 + respBodyBytes, err := io.ReadAll(resp.Body) 1796 + if err != nil { 1797 + return ctx, wrapInternal(err, "failed to read response body") 1798 + } 1799 + if err = ctx.Err(); err != nil { 1800 + return ctx, wrapInternal(err, "aborted because context was done") 1801 + } 1802 + 1803 + if err = proto.Unmarshal(respBodyBytes, out); err != nil { 1804 + return ctx, wrapInternal(err, "failed to unmarshal proto response") 1805 + } 1806 + return ctx, nil 1807 + } 1808 + 1809 + // doJSONRequest makes a JSON request to the remote Twirp service. 1810 + func doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) { 1811 + marshaler := &protojson.MarshalOptions{UseProtoNames: true} 1812 + reqBytes, err := marshaler.Marshal(in) 1813 + if err != nil { 1814 + return ctx, wrapInternal(err, "failed to marshal json request") 1815 + } 1816 + if err = ctx.Err(); err != nil { 1817 + return ctx, wrapInternal(err, "aborted because context was done") 1818 + } 1819 + 1820 + req, err := newRequest(ctx, url, bytes.NewReader(reqBytes), "application/json") 1821 + if err != nil { 1822 + return ctx, wrapInternal(err, "could not build request") 1823 + } 1824 + ctx, err = callClientRequestPrepared(ctx, hooks, req) 1825 + if err != nil { 1826 + return ctx, err 1827 + } 1828 + 1829 + req = req.WithContext(ctx) 1830 + resp, err := client.Do(req) 1831 + if err != nil { 1832 + return ctx, wrapInternal(err, "failed to do request") 1833 + } 1834 + 1835 + defer func() { 1836 + cerr := resp.Body.Close() 1837 + if err == nil && cerr != nil { 1838 + err = wrapInternal(cerr, "failed to close response body") 1839 + } 1840 + }() 1841 + 1842 + if err = ctx.Err(); err != nil { 1843 + return ctx, wrapInternal(err, "aborted because context was done") 1844 + } 1845 + 1846 + if resp.StatusCode != 200 { 1847 + return ctx, errorFromResponse(resp) 1848 + } 1849 + 1850 + d := json.NewDecoder(resp.Body) 1851 + rawRespBody := json.RawMessage{} 1852 + if err := d.Decode(&rawRespBody); err != nil { 1853 + return ctx, wrapInternal(err, "failed to unmarshal json response") 1854 + } 1855 + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} 1856 + if err = unmarshaler.Unmarshal(rawRespBody, out); err != nil { 1857 + return ctx, wrapInternal(err, "failed to unmarshal json response") 1858 + } 1859 + if err = ctx.Err(); err != nil { 1860 + return ctx, wrapInternal(err, "aborted because context was done") 1861 + } 1862 + return ctx, nil 1863 + } 1864 + 1865 + // Call twirp.ServerHooks.RequestReceived if the hook is available 1866 + func callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) { 1867 + if h == nil || h.RequestReceived == nil { 1868 + return ctx, nil 1869 + } 1870 + return h.RequestReceived(ctx) 1871 + } 1872 + 1873 + // Call twirp.ServerHooks.RequestRouted if the hook is available 1874 + func callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) { 1875 + if h == nil || h.RequestRouted == nil { 1876 + return ctx, nil 1877 + } 1878 + return h.RequestRouted(ctx) 1879 + } 1880 + 1881 + // Call twirp.ServerHooks.ResponsePrepared if the hook is available 1882 + func callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context { 1883 + if h == nil || h.ResponsePrepared == nil { 1884 + return ctx 1885 + } 1886 + return h.ResponsePrepared(ctx) 1887 + } 1888 + 1889 + // Call twirp.ServerHooks.ResponseSent if the hook is available 1890 + func callResponseSent(ctx context.Context, h *twirp.ServerHooks) { 1891 + if h == nil || h.ResponseSent == nil { 1892 + return 1893 + } 1894 + h.ResponseSent(ctx) 1895 + } 1896 + 1897 + // Call twirp.ServerHooks.Error if the hook is available 1898 + func callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context { 1899 + if h == nil || h.Error == nil { 1900 + return ctx 1901 + } 1902 + return h.Error(ctx, err) 1903 + } 1904 + 1905 + func callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) { 1906 + if h == nil || h.ResponseReceived == nil { 1907 + return 1908 + } 1909 + h.ResponseReceived(ctx) 1910 + } 1911 + 1912 + func callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) { 1913 + if h == nil || h.RequestPrepared == nil { 1914 + return ctx, nil 1915 + } 1916 + return h.RequestPrepared(ctx, req) 1917 + } 1918 + 1919 + func callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) { 1920 + if h == nil || h.Error == nil { 1921 + return 1922 + } 1923 + h.Error(ctx, err) 1924 + } 1925 + 1926 + var twirpFileDescriptor0 = []byte{ 1927 + // 768 bytes of a gzipped FileDescriptorProto 1928 + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x4f, 0x6f, 0xd3, 0x48, 1929 + 0x14, 0x97, 0x9d, 0x7f, 0xed, 0x6b, 0x77, 0x0f, 0xd6, 0x6a, 0x37, 0x75, 0xb4, 0x1b, 0xaf, 0x0f, 1930 + 0xdb, 0xec, 0xc5, 0x56, 0xba, 0xed, 0x16, 0xcc, 0x29, 0x29, 0x88, 0xb6, 0xa2, 0xa8, 0x72, 0x43, 1931 + 0x8b, 0x50, 0x84, 0x35, 0x89, 0xa7, 0xc9, 0xa8, 0xb1, 0x1d, 0x3c, 0xe3, 0x08, 0x24, 0xce, 0x7c, 1932 + 0x10, 0x8e, 0x7c, 0x02, 0xd4, 0x4f, 0x80, 0xf8, 0x18, 0xdc, 0xe0, 0xce, 0x85, 0x13, 0x9a, 0xf1, 1933 + 0x24, 0xd4, 0xad, 0x9b, 0x36, 0x27, 0x2e, 0xd1, 0xcc, 0xfc, 0x7e, 0xbf, 0xf7, 0xde, 0xef, 0xbd, 1934 + 0x99, 0x18, 0xd6, 0x19, 0xee, 0x0f, 0x51, 0x1c, 0xd9, 0x6c, 0x18, 0xb1, 0xa1, 0x8d, 0x12, 0xfe, 1935 + 0xe3, 0x07, 0x24, 0xb4, 0x27, 0xcd, 0x74, 0x61, 0x8d, 0xe3, 0x88, 0x45, 0x5a, 0x4d, 0x12, 0x2d, 1936 + 0x41, 0xb4, 0x38, 0xd1, 0x4a, 0xf1, 0x49, 0x53, 0xaf, 0xf5, 0x92, 0x53, 0x7b, 0x82, 0x46, 0xc4, 1937 + 0x47, 0x0c, 0xcf, 0x16, 0xa9, 0x52, 0xaf, 0x0f, 0xa2, 0x68, 0x30, 0xc2, 0xb6, 0xd8, 0x71, 0x22, 1938 + 0x23, 0x01, 0xa6, 0x0c, 0x05, 0x63, 0x49, 0x30, 0x72, 0x6a, 0xe0, 0xd9, 0x79, 0x0a, 0xc1, 0x30, 1939 + 0xdf, 0x17, 0xa0, 0xf8, 0x84, 0xe2, 0x58, 0xfb, 0x1d, 0x54, 0xe2, 0x57, 0x15, 0x43, 0x69, 0x2c, 1940 + 0xb7, 0xcb, 0xe7, 0xbb, 0x85, 0x0f, 0x8a, 0xe2, 0xaa, 0xc4, 0xd7, 0xde, 0x28, 0xf0, 0x0b, 0x0e, 1941 + 0x10, 0x19, 0x79, 0xc8, 0xf7, 0x63, 0x4c, 0x69, 0x55, 0x15, 0x1c, 0x74, 0xbe, 0xfb, 0xfc, 0x5c, 1942 + 0x79, 0x0a, 0x7f, 0x65, 0x40, 0x8b, 0x50, 0x2f, 0x73, 0xa0, 0xfd, 0x93, 0xd9, 0x1a, 0x41, 0x42, 1943 + 0x99, 0xd1, 0xc3, 0x06, 0x0a, 0x0d, 0x01, 0x18, 0x12, 0xd0, 0x7f, 0x65, 0x43, 0xc2, 0xe5, 0x0f, 1944 + 0xf8, 0x69, 0xe3, 0x5f, 0x9e, 0x7e, 0x55, 0x30, 0x5a, 0x32, 0x90, 0x0e, 0xc5, 0x10, 0x05, 0xb8, 1945 + 0x5a, 0xc8, 0x94, 0x28, 0xce, 0xb4, 0xbb, 0x00, 0xfd, 0x18, 0x23, 0x86, 0x7d, 0x0f, 0xb1, 0x6a, 1946 + 0xd1, 0x50, 0x1a, 0x2b, 0x1b, 0xba, 0x95, 0x76, 0xc7, 0x9a, 0x76, 0xc7, 0xea, 0x4c, 0xbb, 0xe3, 1947 + 0x2e, 0x4b, 0x76, 0x8b, 0x71, 0xa9, 0x8f, 0x47, 0x58, 0x4a, 0x4b, 0x37, 0x4b, 0x25, 0x3b, 0x95, 1948 + 0x26, 0x63, 0x7f, 0x9a, 0xb5, 0x7c, 0xb3, 0x54, 0xb2, 0x5b, 0x4c, 0x5b, 0x83, 0x25, 0x42, 0x3d, 1949 + 0x31, 0xe5, 0x6a, 0xc5, 0x50, 0x1a, 0x4b, 0x6e, 0x85, 0xd0, 0x16, 0xdf, 0x6a, 0xeb, 0xb0, 0xd2, 1950 + 0x4f, 0x28, 0x8b, 0x02, 0x1c, 0x7b, 0xc4, 0xaf, 0x2e, 0x65, 0xec, 0xc2, 0x14, 0xda, 0xf3, 0xcd, 1951 + 0xcf, 0x0a, 0xac, 0xf1, 0xd1, 0xd1, 0x23, 0x1c, 0x4f, 0x48, 0x1f, 0xef, 0x08, 0x4f, 0x2e, 0x7e, 1952 + 0x91, 0x60, 0xca, 0x72, 0xe6, 0xa6, 0xfc, 0xdc, 0xb9, 0xa9, 0x39, 0x73, 0xbb, 0xe4, 0xb5, 0x70, 1953 + 0xad, 0xd7, 0x23, 0xd0, 0xf3, 0xac, 0xd2, 0x71, 0x14, 0x52, 0xac, 0x6d, 0x41, 0x31, 0xa1, 0x38, 1954 + 0x16, 0x0e, 0x57, 0x36, 0xfe, 0xb6, 0xe6, 0x3c, 0x28, 0x8b, 0x87, 0x71, 0x05, 0xdd, 0xdc, 0xcc, 1955 + 0x06, 0xbd, 0x4f, 0x28, 0xea, 0x8d, 0x66, 0x0d, 0xbc, 0xe6, 0x41, 0x98, 0x7f, 0x42, 0x2d, 0x57, 1956 + 0x95, 0xd6, 0x62, 0xee, 0xc0, 0x1f, 0x17, 0xe1, 0x47, 0x84, 0xb2, 0x69, 0xc4, 0xdf, 0xa0, 0xd4, 1957 + 0x8f, 0x92, 0x90, 0x89, 0xa0, 0x25, 0x37, 0xdd, 0x68, 0x1a, 0x14, 0xc7, 0x68, 0x90, 0xf6, 0xa7, 1958 + 0xe4, 0x8a, 0xb5, 0x79, 0x04, 0xd5, 0xab, 0x41, 0xa4, 0xd9, 0x6d, 0x28, 0xf1, 0xea, 0xf9, 0x3c, 1959 + 0x0b, 0xb7, 0x73, 0x9b, 0xf2, 0x4d, 0x2f, 0x6b, 0xf7, 0x00, 0x9d, 0xe1, 0xfd, 0x93, 0xce, 0xb4, 1960 + 0xb8, 0x3a, 0x54, 0x38, 0xcd, 0xbb, 0xe2, 0xb9, 0xcc, 0x8f, 0xf7, 0x7c, 0xcd, 0x80, 0x4a, 0x3f, 1961 + 0x0a, 0x02, 0x1c, 0xb2, 0x4b, 0xa3, 0x9c, 0x1e, 0x9b, 0x41, 0xb6, 0x33, 0xb3, 0x04, 0xb2, 0xf0, 1962 + 0xc7, 0x00, 0x2c, 0x3a, 0xc3, 0xa1, 0x47, 0xc2, 0xd3, 0x48, 0xce, 0xca, 0xce, 0xab, 0x7e, 0xd2, 1963 + 0xb4, 0xf6, 0x4f, 0x3a, 0xb9, 0xa3, 0x76, 0x97, 0x45, 0x88, 0xbd, 0xf0, 0x34, 0xda, 0xf8, 0x56, 1964 + 0x80, 0xd5, 0x8b, 0xf9, 0xb4, 0x57, 0x50, 0x4e, 0xd9, 0xda, 0xff, 0x37, 0x36, 0x25, 0xf7, 0xd1, 1965 + 0xe8, 0xdb, 0x0b, 0xeb, 0xa4, 0xb7, 0xd7, 0x50, 0x91, 0x17, 0x41, 0xbb, 0x7d, 0x8c, 0xec, 0x85, 1966 + 0xd3, 0xef, 0x2c, 0x2e, 0x94, 0xd9, 0x29, 0x14, 0xf9, 0x15, 0xd1, 0x36, 0x6f, 0x1d, 0xe1, 0xc2, 1967 + 0xb5, 0xd4, 0xb7, 0x16, 0x54, 0xfd, 0xb0, 0x2c, 0x27, 0xbc, 0x80, 0xe5, 0xec, 0xa5, 0x5b, 0xc0, 1968 + 0xf2, 0xa5, 0xcb, 0xd4, 0xfe, 0xaa, 0x40, 0xbd, 0x1f, 0x05, 0xf3, 0xf4, 0x6d, 0x10, 0x7f, 0xa8, 1969 + 0x87, 0xfc, 0x8f, 0xf8, 0x50, 0x79, 0xb6, 0xf5, 0x12, 0x13, 0x44, 0x23, 0x2b, 0xc4, 0xcc, 0x9e, 1970 + 0x6c, 0xda, 0x03, 0x1c, 0xda, 0x73, 0xbe, 0xd0, 0xf7, 0xc4, 0x62, 0xd2, 0x7c, 0xab, 0x16, 0x3b, 1971 + 0x9d, 0x56, 0xeb, 0x9d, 0x5a, 0xeb, 0xc8, 0x4c, 0x1d, 0x91, 0xa9, 0xc5, 0x33, 0x89, 0xf8, 0xd6, 1972 + 0x71, 0xf3, 0xe3, 0x0c, 0xed, 0x0a, 0xb4, 0xcb, 0xd1, 0xae, 0x40, 0xbb, 0xc7, 0xcd, 0x4f, 0xea, 1973 + 0xfa, 0x1c, 0xb4, 0xfb, 0xf0, 0xb0, 0x7d, 0x80, 0x19, 0xf2, 0x11, 0x43, 0x5f, 0xd4, 0xba, 0x64, 1974 + 0x3a, 0x8e, 0xa0, 0x3a, 0x0e, 0xe7, 0x3a, 0x8e, 0x20, 0x3b, 0xce, 0x71, 0xb3, 0x57, 0x16, 0xdf, 1975 + 0x95, 0xff, 0xbe, 0x07, 0x00, 0x00, 0xff, 0xff, 0x83, 0x58, 0xc2, 0xcf, 0x5e, 0x08, 0x00, 0x00, 1976 + }
+235
gen/techaro/thoth/auth/admin/v1/admin_grpc.pb.go
··· 1 + // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 + // versions: 3 + // - protoc-gen-go-grpc v1.6.1 4 + // - protoc (unknown) 5 + // source: techaro/thoth/auth/admin/v1/admin.proto 6 + 7 + package adminv1 8 + 9 + import ( 10 + context "context" 11 + grpc "google.golang.org/grpc" 12 + codes "google.golang.org/grpc/codes" 13 + status "google.golang.org/grpc/status" 14 + ) 15 + 16 + // This is a compile-time assertion to ensure that this generated file 17 + // is compatible with the grpc package it is being compiled against. 18 + // Requires gRPC-Go v1.64.0 or later. 19 + const _ = grpc.SupportPackageIsVersion9 20 + 21 + const ( 22 + UsersService_Create_FullMethodName = "/techaro.thoth.auth.admin.v1.UsersService/Create" 23 + UsersService_Disable_FullMethodName = "/techaro.thoth.auth.admin.v1.UsersService/Disable" 24 + UsersService_List_FullMethodName = "/techaro.thoth.auth.admin.v1.UsersService/List" 25 + UsersService_MakeJWT_FullMethodName = "/techaro.thoth.auth.admin.v1.UsersService/MakeJWT" 26 + ) 27 + 28 + // UsersServiceClient is the client API for UsersService service. 29 + // 30 + // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 31 + type UsersServiceClient interface { 32 + Create(ctx context.Context, in *UsersServiceCreateRequest, opts ...grpc.CallOption) (*UsersServiceCreateResponse, error) 33 + Disable(ctx context.Context, in *UsersServiceDisableRequest, opts ...grpc.CallOption) (*UsersServiceDisableResponse, error) 34 + List(ctx context.Context, in *UsersServiceListRequest, opts ...grpc.CallOption) (*UsersServiceListResponse, error) 35 + MakeJWT(ctx context.Context, in *UsersServiceMakeJWTRequest, opts ...grpc.CallOption) (*UsersServiceMakeJWTResponse, error) 36 + } 37 + 38 + type usersServiceClient struct { 39 + cc grpc.ClientConnInterface 40 + } 41 + 42 + func NewUsersServiceClient(cc grpc.ClientConnInterface) UsersServiceClient { 43 + return &usersServiceClient{cc} 44 + } 45 + 46 + func (c *usersServiceClient) Create(ctx context.Context, in *UsersServiceCreateRequest, opts ...grpc.CallOption) (*UsersServiceCreateResponse, error) { 47 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 48 + out := new(UsersServiceCreateResponse) 49 + err := c.cc.Invoke(ctx, UsersService_Create_FullMethodName, in, out, cOpts...) 50 + if err != nil { 51 + return nil, err 52 + } 53 + return out, nil 54 + } 55 + 56 + func (c *usersServiceClient) Disable(ctx context.Context, in *UsersServiceDisableRequest, opts ...grpc.CallOption) (*UsersServiceDisableResponse, error) { 57 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 58 + out := new(UsersServiceDisableResponse) 59 + err := c.cc.Invoke(ctx, UsersService_Disable_FullMethodName, in, out, cOpts...) 60 + if err != nil { 61 + return nil, err 62 + } 63 + return out, nil 64 + } 65 + 66 + func (c *usersServiceClient) List(ctx context.Context, in *UsersServiceListRequest, opts ...grpc.CallOption) (*UsersServiceListResponse, error) { 67 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 68 + out := new(UsersServiceListResponse) 69 + err := c.cc.Invoke(ctx, UsersService_List_FullMethodName, in, out, cOpts...) 70 + if err != nil { 71 + return nil, err 72 + } 73 + return out, nil 74 + } 75 + 76 + func (c *usersServiceClient) MakeJWT(ctx context.Context, in *UsersServiceMakeJWTRequest, opts ...grpc.CallOption) (*UsersServiceMakeJWTResponse, error) { 77 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 78 + out := new(UsersServiceMakeJWTResponse) 79 + err := c.cc.Invoke(ctx, UsersService_MakeJWT_FullMethodName, in, out, cOpts...) 80 + if err != nil { 81 + return nil, err 82 + } 83 + return out, nil 84 + } 85 + 86 + // UsersServiceServer is the server API for UsersService service. 87 + // All implementations must embed UnimplementedUsersServiceServer 88 + // for forward compatibility. 89 + type UsersServiceServer interface { 90 + Create(context.Context, *UsersServiceCreateRequest) (*UsersServiceCreateResponse, error) 91 + Disable(context.Context, *UsersServiceDisableRequest) (*UsersServiceDisableResponse, error) 92 + List(context.Context, *UsersServiceListRequest) (*UsersServiceListResponse, error) 93 + MakeJWT(context.Context, *UsersServiceMakeJWTRequest) (*UsersServiceMakeJWTResponse, error) 94 + mustEmbedUnimplementedUsersServiceServer() 95 + } 96 + 97 + // UnimplementedUsersServiceServer must be embedded to have 98 + // forward compatible implementations. 99 + // 100 + // NOTE: this should be embedded by value instead of pointer to avoid a nil 101 + // pointer dereference when methods are called. 102 + type UnimplementedUsersServiceServer struct{} 103 + 104 + func (UnimplementedUsersServiceServer) Create(context.Context, *UsersServiceCreateRequest) (*UsersServiceCreateResponse, error) { 105 + return nil, status.Error(codes.Unimplemented, "method Create not implemented") 106 + } 107 + func (UnimplementedUsersServiceServer) Disable(context.Context, *UsersServiceDisableRequest) (*UsersServiceDisableResponse, error) { 108 + return nil, status.Error(codes.Unimplemented, "method Disable not implemented") 109 + } 110 + func (UnimplementedUsersServiceServer) List(context.Context, *UsersServiceListRequest) (*UsersServiceListResponse, error) { 111 + return nil, status.Error(codes.Unimplemented, "method List not implemented") 112 + } 113 + func (UnimplementedUsersServiceServer) MakeJWT(context.Context, *UsersServiceMakeJWTRequest) (*UsersServiceMakeJWTResponse, error) { 114 + return nil, status.Error(codes.Unimplemented, "method MakeJWT not implemented") 115 + } 116 + func (UnimplementedUsersServiceServer) mustEmbedUnimplementedUsersServiceServer() {} 117 + func (UnimplementedUsersServiceServer) testEmbeddedByValue() {} 118 + 119 + // UnsafeUsersServiceServer may be embedded to opt out of forward compatibility for this service. 120 + // Use of this interface is not recommended, as added methods to UsersServiceServer will 121 + // result in compilation errors. 122 + type UnsafeUsersServiceServer interface { 123 + mustEmbedUnimplementedUsersServiceServer() 124 + } 125 + 126 + func RegisterUsersServiceServer(s grpc.ServiceRegistrar, srv UsersServiceServer) { 127 + // If the following call panics, it indicates UnimplementedUsersServiceServer was 128 + // embedded by pointer and is nil. This will cause panics if an 129 + // unimplemented method is ever invoked, so we test this at initialization 130 + // time to prevent it from happening at runtime later due to I/O. 131 + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { 132 + t.testEmbeddedByValue() 133 + } 134 + s.RegisterService(&UsersService_ServiceDesc, srv) 135 + } 136 + 137 + func _UsersService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 138 + in := new(UsersServiceCreateRequest) 139 + if err := dec(in); err != nil { 140 + return nil, err 141 + } 142 + if interceptor == nil { 143 + return srv.(UsersServiceServer).Create(ctx, in) 144 + } 145 + info := &grpc.UnaryServerInfo{ 146 + Server: srv, 147 + FullMethod: UsersService_Create_FullMethodName, 148 + } 149 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { 150 + return srv.(UsersServiceServer).Create(ctx, req.(*UsersServiceCreateRequest)) 151 + } 152 + return interceptor(ctx, in, info, handler) 153 + } 154 + 155 + func _UsersService_Disable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 156 + in := new(UsersServiceDisableRequest) 157 + if err := dec(in); err != nil { 158 + return nil, err 159 + } 160 + if interceptor == nil { 161 + return srv.(UsersServiceServer).Disable(ctx, in) 162 + } 163 + info := &grpc.UnaryServerInfo{ 164 + Server: srv, 165 + FullMethod: UsersService_Disable_FullMethodName, 166 + } 167 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { 168 + return srv.(UsersServiceServer).Disable(ctx, req.(*UsersServiceDisableRequest)) 169 + } 170 + return interceptor(ctx, in, info, handler) 171 + } 172 + 173 + func _UsersService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 174 + in := new(UsersServiceListRequest) 175 + if err := dec(in); err != nil { 176 + return nil, err 177 + } 178 + if interceptor == nil { 179 + return srv.(UsersServiceServer).List(ctx, in) 180 + } 181 + info := &grpc.UnaryServerInfo{ 182 + Server: srv, 183 + FullMethod: UsersService_List_FullMethodName, 184 + } 185 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { 186 + return srv.(UsersServiceServer).List(ctx, req.(*UsersServiceListRequest)) 187 + } 188 + return interceptor(ctx, in, info, handler) 189 + } 190 + 191 + func _UsersService_MakeJWT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 192 + in := new(UsersServiceMakeJWTRequest) 193 + if err := dec(in); err != nil { 194 + return nil, err 195 + } 196 + if interceptor == nil { 197 + return srv.(UsersServiceServer).MakeJWT(ctx, in) 198 + } 199 + info := &grpc.UnaryServerInfo{ 200 + Server: srv, 201 + FullMethod: UsersService_MakeJWT_FullMethodName, 202 + } 203 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { 204 + return srv.(UsersServiceServer).MakeJWT(ctx, req.(*UsersServiceMakeJWTRequest)) 205 + } 206 + return interceptor(ctx, in, info, handler) 207 + } 208 + 209 + // UsersService_ServiceDesc is the grpc.ServiceDesc for UsersService service. 210 + // It's only intended for direct use with grpc.RegisterService, 211 + // and not to be introspected or modified (even as a copy) 212 + var UsersService_ServiceDesc = grpc.ServiceDesc{ 213 + ServiceName: "techaro.thoth.auth.admin.v1.UsersService", 214 + HandlerType: (*UsersServiceServer)(nil), 215 + Methods: []grpc.MethodDesc{ 216 + { 217 + MethodName: "Create", 218 + Handler: _UsersService_Create_Handler, 219 + }, 220 + { 221 + MethodName: "Disable", 222 + Handler: _UsersService_Disable_Handler, 223 + }, 224 + { 225 + MethodName: "List", 226 + Handler: _UsersService_List_Handler, 227 + }, 228 + { 229 + MethodName: "MakeJWT", 230 + Handler: _UsersService_MakeJWT_Handler, 231 + }, 232 + }, 233 + Streams: []grpc.StreamDesc{}, 234 + Metadata: "techaro/thoth/auth/admin/v1/admin.proto", 235 + }
+470
gen/techaro/thoth/auth/v1/auth.pb.go
··· 1 + // Code generated by protoc-gen-go. DO NOT EDIT. 2 + // versions: 3 + // protoc-gen-go v1.36.11 4 + // protoc (unknown) 5 + // source: techaro/thoth/auth/v1/auth.proto 6 + 7 + package authv1 8 + 9 + import ( 10 + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" 11 + protoreflect "google.golang.org/protobuf/reflect/protoreflect" 12 + protoimpl "google.golang.org/protobuf/runtime/protoimpl" 13 + timestamppb "google.golang.org/protobuf/types/known/timestamppb" 14 + reflect "reflect" 15 + sync "sync" 16 + unsafe "unsafe" 17 + ) 18 + 19 + const ( 20 + // Verify that this generated code is sufficiently up-to-date. 21 + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 22 + // Verify that runtime/protoimpl is sufficiently up-to-date. 23 + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 24 + ) 25 + 26 + type JWT struct { 27 + state protoimpl.MessageState `protogen:"open.v1"` 28 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 29 + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` 30 + ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` 31 + Comment string `protobuf:"bytes,4,opt,name=comment,proto3" json:"comment,omitempty"` 32 + unknownFields protoimpl.UnknownFields 33 + sizeCache protoimpl.SizeCache 34 + } 35 + 36 + func (x *JWT) Reset() { 37 + *x = JWT{} 38 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[0] 39 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 40 + ms.StoreMessageInfo(mi) 41 + } 42 + 43 + func (x *JWT) String() string { 44 + return protoimpl.X.MessageStringOf(x) 45 + } 46 + 47 + func (*JWT) ProtoMessage() {} 48 + 49 + func (x *JWT) ProtoReflect() protoreflect.Message { 50 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[0] 51 + if x != nil { 52 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 53 + if ms.LoadMessageInfo() == nil { 54 + ms.StoreMessageInfo(mi) 55 + } 56 + return ms 57 + } 58 + return mi.MessageOf(x) 59 + } 60 + 61 + // Deprecated: Use JWT.ProtoReflect.Descriptor instead. 62 + func (*JWT) Descriptor() ([]byte, []int) { 63 + return file_techaro_thoth_auth_v1_auth_proto_rawDescGZIP(), []int{0} 64 + } 65 + 66 + func (x *JWT) GetId() string { 67 + if x != nil { 68 + return x.Id 69 + } 70 + return "" 71 + } 72 + 73 + func (x *JWT) GetCreatedAt() *timestamppb.Timestamp { 74 + if x != nil { 75 + return x.CreatedAt 76 + } 77 + return nil 78 + } 79 + 80 + func (x *JWT) GetExpiresAt() *timestamppb.Timestamp { 81 + if x != nil { 82 + return x.ExpiresAt 83 + } 84 + return nil 85 + } 86 + 87 + func (x *JWT) GetComment() string { 88 + if x != nil { 89 + return x.Comment 90 + } 91 + return "" 92 + } 93 + 94 + type JWTServiceListRequest struct { 95 + state protoimpl.MessageState `protogen:"open.v1"` 96 + Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` 97 + Page int32 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"` 98 + unknownFields protoimpl.UnknownFields 99 + sizeCache protoimpl.SizeCache 100 + } 101 + 102 + func (x *JWTServiceListRequest) Reset() { 103 + *x = JWTServiceListRequest{} 104 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[1] 105 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 106 + ms.StoreMessageInfo(mi) 107 + } 108 + 109 + func (x *JWTServiceListRequest) String() string { 110 + return protoimpl.X.MessageStringOf(x) 111 + } 112 + 113 + func (*JWTServiceListRequest) ProtoMessage() {} 114 + 115 + func (x *JWTServiceListRequest) ProtoReflect() protoreflect.Message { 116 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[1] 117 + if x != nil { 118 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 119 + if ms.LoadMessageInfo() == nil { 120 + ms.StoreMessageInfo(mi) 121 + } 122 + return ms 123 + } 124 + return mi.MessageOf(x) 125 + } 126 + 127 + // Deprecated: Use JWTServiceListRequest.ProtoReflect.Descriptor instead. 128 + func (*JWTServiceListRequest) Descriptor() ([]byte, []int) { 129 + return file_techaro_thoth_auth_v1_auth_proto_rawDescGZIP(), []int{1} 130 + } 131 + 132 + func (x *JWTServiceListRequest) GetCount() int32 { 133 + if x != nil { 134 + return x.Count 135 + } 136 + return 0 137 + } 138 + 139 + func (x *JWTServiceListRequest) GetPage() int32 { 140 + if x != nil { 141 + return x.Page 142 + } 143 + return 0 144 + } 145 + 146 + type JWTServiceListResponse struct { 147 + state protoimpl.MessageState `protogen:"open.v1"` 148 + Tokens []*JWT `protobuf:"bytes,1,rep,name=tokens,proto3" json:"tokens,omitempty"` 149 + unknownFields protoimpl.UnknownFields 150 + sizeCache protoimpl.SizeCache 151 + } 152 + 153 + func (x *JWTServiceListResponse) Reset() { 154 + *x = JWTServiceListResponse{} 155 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[2] 156 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 157 + ms.StoreMessageInfo(mi) 158 + } 159 + 160 + func (x *JWTServiceListResponse) String() string { 161 + return protoimpl.X.MessageStringOf(x) 162 + } 163 + 164 + func (*JWTServiceListResponse) ProtoMessage() {} 165 + 166 + func (x *JWTServiceListResponse) ProtoReflect() protoreflect.Message { 167 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[2] 168 + if x != nil { 169 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 170 + if ms.LoadMessageInfo() == nil { 171 + ms.StoreMessageInfo(mi) 172 + } 173 + return ms 174 + } 175 + return mi.MessageOf(x) 176 + } 177 + 178 + // Deprecated: Use JWTServiceListResponse.ProtoReflect.Descriptor instead. 179 + func (*JWTServiceListResponse) Descriptor() ([]byte, []int) { 180 + return file_techaro_thoth_auth_v1_auth_proto_rawDescGZIP(), []int{2} 181 + } 182 + 183 + func (x *JWTServiceListResponse) GetTokens() []*JWT { 184 + if x != nil { 185 + return x.Tokens 186 + } 187 + return nil 188 + } 189 + 190 + type JWTServiceCreateRequest struct { 191 + state protoimpl.MessageState `protogen:"open.v1"` 192 + Comment string `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` 193 + unknownFields protoimpl.UnknownFields 194 + sizeCache protoimpl.SizeCache 195 + } 196 + 197 + func (x *JWTServiceCreateRequest) Reset() { 198 + *x = JWTServiceCreateRequest{} 199 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[3] 200 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 201 + ms.StoreMessageInfo(mi) 202 + } 203 + 204 + func (x *JWTServiceCreateRequest) String() string { 205 + return protoimpl.X.MessageStringOf(x) 206 + } 207 + 208 + func (*JWTServiceCreateRequest) ProtoMessage() {} 209 + 210 + func (x *JWTServiceCreateRequest) ProtoReflect() protoreflect.Message { 211 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[3] 212 + if x != nil { 213 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 214 + if ms.LoadMessageInfo() == nil { 215 + ms.StoreMessageInfo(mi) 216 + } 217 + return ms 218 + } 219 + return mi.MessageOf(x) 220 + } 221 + 222 + // Deprecated: Use JWTServiceCreateRequest.ProtoReflect.Descriptor instead. 223 + func (*JWTServiceCreateRequest) Descriptor() ([]byte, []int) { 224 + return file_techaro_thoth_auth_v1_auth_proto_rawDescGZIP(), []int{3} 225 + } 226 + 227 + func (x *JWTServiceCreateRequest) GetComment() string { 228 + if x != nil { 229 + return x.Comment 230 + } 231 + return "" 232 + } 233 + 234 + type JWTServiceCreateResponse struct { 235 + state protoimpl.MessageState `protogen:"open.v1"` 236 + Jwt string `protobuf:"bytes,1,opt,name=jwt,proto3" json:"jwt,omitempty"` 237 + Expires *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=expires,proto3" json:"expires,omitempty"` 238 + Jti string `protobuf:"bytes,3,opt,name=jti,proto3" json:"jti,omitempty"` 239 + unknownFields protoimpl.UnknownFields 240 + sizeCache protoimpl.SizeCache 241 + } 242 + 243 + func (x *JWTServiceCreateResponse) Reset() { 244 + *x = JWTServiceCreateResponse{} 245 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[4] 246 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 247 + ms.StoreMessageInfo(mi) 248 + } 249 + 250 + func (x *JWTServiceCreateResponse) String() string { 251 + return protoimpl.X.MessageStringOf(x) 252 + } 253 + 254 + func (*JWTServiceCreateResponse) ProtoMessage() {} 255 + 256 + func (x *JWTServiceCreateResponse) ProtoReflect() protoreflect.Message { 257 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[4] 258 + if x != nil { 259 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 260 + if ms.LoadMessageInfo() == nil { 261 + ms.StoreMessageInfo(mi) 262 + } 263 + return ms 264 + } 265 + return mi.MessageOf(x) 266 + } 267 + 268 + // Deprecated: Use JWTServiceCreateResponse.ProtoReflect.Descriptor instead. 269 + func (*JWTServiceCreateResponse) Descriptor() ([]byte, []int) { 270 + return file_techaro_thoth_auth_v1_auth_proto_rawDescGZIP(), []int{4} 271 + } 272 + 273 + func (x *JWTServiceCreateResponse) GetJwt() string { 274 + if x != nil { 275 + return x.Jwt 276 + } 277 + return "" 278 + } 279 + 280 + func (x *JWTServiceCreateResponse) GetExpires() *timestamppb.Timestamp { 281 + if x != nil { 282 + return x.Expires 283 + } 284 + return nil 285 + } 286 + 287 + func (x *JWTServiceCreateResponse) GetJti() string { 288 + if x != nil { 289 + return x.Jti 290 + } 291 + return "" 292 + } 293 + 294 + type JWTServiceDeleteRequest struct { 295 + state protoimpl.MessageState `protogen:"open.v1"` 296 + Jti string `protobuf:"bytes,1,opt,name=jti,proto3" json:"jti,omitempty"` 297 + unknownFields protoimpl.UnknownFields 298 + sizeCache protoimpl.SizeCache 299 + } 300 + 301 + func (x *JWTServiceDeleteRequest) Reset() { 302 + *x = JWTServiceDeleteRequest{} 303 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[5] 304 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 305 + ms.StoreMessageInfo(mi) 306 + } 307 + 308 + func (x *JWTServiceDeleteRequest) String() string { 309 + return protoimpl.X.MessageStringOf(x) 310 + } 311 + 312 + func (*JWTServiceDeleteRequest) ProtoMessage() {} 313 + 314 + func (x *JWTServiceDeleteRequest) ProtoReflect() protoreflect.Message { 315 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[5] 316 + if x != nil { 317 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 318 + if ms.LoadMessageInfo() == nil { 319 + ms.StoreMessageInfo(mi) 320 + } 321 + return ms 322 + } 323 + return mi.MessageOf(x) 324 + } 325 + 326 + // Deprecated: Use JWTServiceDeleteRequest.ProtoReflect.Descriptor instead. 327 + func (*JWTServiceDeleteRequest) Descriptor() ([]byte, []int) { 328 + return file_techaro_thoth_auth_v1_auth_proto_rawDescGZIP(), []int{5} 329 + } 330 + 331 + func (x *JWTServiceDeleteRequest) GetJti() string { 332 + if x != nil { 333 + return x.Jti 334 + } 335 + return "" 336 + } 337 + 338 + type JWTServiceDeleteResponse struct { 339 + state protoimpl.MessageState `protogen:"open.v1"` 340 + unknownFields protoimpl.UnknownFields 341 + sizeCache protoimpl.SizeCache 342 + } 343 + 344 + func (x *JWTServiceDeleteResponse) Reset() { 345 + *x = JWTServiceDeleteResponse{} 346 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[6] 347 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 348 + ms.StoreMessageInfo(mi) 349 + } 350 + 351 + func (x *JWTServiceDeleteResponse) String() string { 352 + return protoimpl.X.MessageStringOf(x) 353 + } 354 + 355 + func (*JWTServiceDeleteResponse) ProtoMessage() {} 356 + 357 + func (x *JWTServiceDeleteResponse) ProtoReflect() protoreflect.Message { 358 + mi := &file_techaro_thoth_auth_v1_auth_proto_msgTypes[6] 359 + if x != nil { 360 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 361 + if ms.LoadMessageInfo() == nil { 362 + ms.StoreMessageInfo(mi) 363 + } 364 + return ms 365 + } 366 + return mi.MessageOf(x) 367 + } 368 + 369 + // Deprecated: Use JWTServiceDeleteResponse.ProtoReflect.Descriptor instead. 370 + func (*JWTServiceDeleteResponse) Descriptor() ([]byte, []int) { 371 + return file_techaro_thoth_auth_v1_auth_proto_rawDescGZIP(), []int{6} 372 + } 373 + 374 + var File_techaro_thoth_auth_v1_auth_proto protoreflect.FileDescriptor 375 + 376 + const file_techaro_thoth_auth_v1_auth_proto_rawDesc = "" + 377 + "\n" + 378 + " techaro/thoth/auth/v1/auth.proto\x12\x15techaro.thoth.auth.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa5\x01\n" + 379 + "\x03JWT\x12\x0e\n" + 380 + "\x02id\x18\x01 \x01(\tR\x02id\x129\n" + 381 + "\n" + 382 + "created_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" + 383 + "\n" + 384 + "expires_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt\x12\x18\n" + 385 + "\acomment\x18\x04 \x01(\tR\acomment\"A\n" + 386 + "\x15JWTServiceListRequest\x12\x14\n" + 387 + "\x05count\x18\x01 \x01(\x05R\x05count\x12\x12\n" + 388 + "\x04page\x18\x02 \x01(\x05R\x04page\"L\n" + 389 + "\x16JWTServiceListResponse\x122\n" + 390 + "\x06tokens\x18\x01 \x03(\v2\x1a.techaro.thoth.auth.v1.JWTR\x06tokens\";\n" + 391 + "\x17JWTServiceCreateRequest\x12 \n" + 392 + "\acomment\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\acomment\"t\n" + 393 + "\x18JWTServiceCreateResponse\x12\x10\n" + 394 + "\x03jwt\x18\x01 \x01(\tR\x03jwt\x124\n" + 395 + "\aexpires\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\aexpires\x12\x10\n" + 396 + "\x03jti\x18\x03 \x01(\tR\x03jti\"3\n" + 397 + "\x17JWTServiceDeleteRequest\x12\x18\n" + 398 + "\x03jti\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x03jti\"\x1a\n" + 399 + "\x18JWTServiceDeleteResponse2\xc7\x02\n" + 400 + "\n" + 401 + "JWTService\x12i\n" + 402 + "\x06Create\x12..techaro.thoth.auth.v1.JWTServiceCreateRequest\x1a/.techaro.thoth.auth.v1.JWTServiceCreateResponse\x12i\n" + 403 + "\x06Delete\x12..techaro.thoth.auth.v1.JWTServiceDeleteRequest\x1a/.techaro.thoth.auth.v1.JWTServiceDeleteResponse\x12c\n" + 404 + "\x04List\x12,.techaro.thoth.auth.v1.JWTServiceListRequest\x1a-.techaro.thoth.auth.v1.JWTServiceListResponseB\xcd\x01\n" + 405 + "\x19com.techaro.thoth.auth.v1B\tAuthProtoP\x01Z.xeiaso.net/v4/gen/techaro/thoth/auth/v1;authv1\xa2\x02\x03TTA\xaa\x02\x15Techaro.Thoth.Auth.V1\xca\x02\x15Techaro\\Thoth\\Auth\\V1\xe2\x02!Techaro\\Thoth\\Auth\\V1\\GPBMetadata\xea\x02\x18Techaro::Thoth::Auth::V1b\x06proto3" 406 + 407 + var ( 408 + file_techaro_thoth_auth_v1_auth_proto_rawDescOnce sync.Once 409 + file_techaro_thoth_auth_v1_auth_proto_rawDescData []byte 410 + ) 411 + 412 + func file_techaro_thoth_auth_v1_auth_proto_rawDescGZIP() []byte { 413 + file_techaro_thoth_auth_v1_auth_proto_rawDescOnce.Do(func() { 414 + file_techaro_thoth_auth_v1_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_techaro_thoth_auth_v1_auth_proto_rawDesc), len(file_techaro_thoth_auth_v1_auth_proto_rawDesc))) 415 + }) 416 + return file_techaro_thoth_auth_v1_auth_proto_rawDescData 417 + } 418 + 419 + var file_techaro_thoth_auth_v1_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 7) 420 + var file_techaro_thoth_auth_v1_auth_proto_goTypes = []any{ 421 + (*JWT)(nil), // 0: techaro.thoth.auth.v1.JWT 422 + (*JWTServiceListRequest)(nil), // 1: techaro.thoth.auth.v1.JWTServiceListRequest 423 + (*JWTServiceListResponse)(nil), // 2: techaro.thoth.auth.v1.JWTServiceListResponse 424 + (*JWTServiceCreateRequest)(nil), // 3: techaro.thoth.auth.v1.JWTServiceCreateRequest 425 + (*JWTServiceCreateResponse)(nil), // 4: techaro.thoth.auth.v1.JWTServiceCreateResponse 426 + (*JWTServiceDeleteRequest)(nil), // 5: techaro.thoth.auth.v1.JWTServiceDeleteRequest 427 + (*JWTServiceDeleteResponse)(nil), // 6: techaro.thoth.auth.v1.JWTServiceDeleteResponse 428 + (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp 429 + } 430 + var file_techaro_thoth_auth_v1_auth_proto_depIdxs = []int32{ 431 + 7, // 0: techaro.thoth.auth.v1.JWT.created_at:type_name -> google.protobuf.Timestamp 432 + 7, // 1: techaro.thoth.auth.v1.JWT.expires_at:type_name -> google.protobuf.Timestamp 433 + 0, // 2: techaro.thoth.auth.v1.JWTServiceListResponse.tokens:type_name -> techaro.thoth.auth.v1.JWT 434 + 7, // 3: techaro.thoth.auth.v1.JWTServiceCreateResponse.expires:type_name -> google.protobuf.Timestamp 435 + 3, // 4: techaro.thoth.auth.v1.JWTService.Create:input_type -> techaro.thoth.auth.v1.JWTServiceCreateRequest 436 + 5, // 5: techaro.thoth.auth.v1.JWTService.Delete:input_type -> techaro.thoth.auth.v1.JWTServiceDeleteRequest 437 + 1, // 6: techaro.thoth.auth.v1.JWTService.List:input_type -> techaro.thoth.auth.v1.JWTServiceListRequest 438 + 4, // 7: techaro.thoth.auth.v1.JWTService.Create:output_type -> techaro.thoth.auth.v1.JWTServiceCreateResponse 439 + 6, // 8: techaro.thoth.auth.v1.JWTService.Delete:output_type -> techaro.thoth.auth.v1.JWTServiceDeleteResponse 440 + 2, // 9: techaro.thoth.auth.v1.JWTService.List:output_type -> techaro.thoth.auth.v1.JWTServiceListResponse 441 + 7, // [7:10] is the sub-list for method output_type 442 + 4, // [4:7] is the sub-list for method input_type 443 + 4, // [4:4] is the sub-list for extension type_name 444 + 4, // [4:4] is the sub-list for extension extendee 445 + 0, // [0:4] is the sub-list for field type_name 446 + } 447 + 448 + func init() { file_techaro_thoth_auth_v1_auth_proto_init() } 449 + func file_techaro_thoth_auth_v1_auth_proto_init() { 450 + if File_techaro_thoth_auth_v1_auth_proto != nil { 451 + return 452 + } 453 + type x struct{} 454 + out := protoimpl.TypeBuilder{ 455 + File: protoimpl.DescBuilder{ 456 + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 457 + RawDescriptor: unsafe.Slice(unsafe.StringData(file_techaro_thoth_auth_v1_auth_proto_rawDesc), len(file_techaro_thoth_auth_v1_auth_proto_rawDesc)), 458 + NumEnums: 0, 459 + NumMessages: 7, 460 + NumExtensions: 0, 461 + NumServices: 1, 462 + }, 463 + GoTypes: file_techaro_thoth_auth_v1_auth_proto_goTypes, 464 + DependencyIndexes: file_techaro_thoth_auth_v1_auth_proto_depIdxs, 465 + MessageInfos: file_techaro_thoth_auth_v1_auth_proto_msgTypes, 466 + }.Build() 467 + File_techaro_thoth_auth_v1_auth_proto = out.File 468 + file_techaro_thoth_auth_v1_auth_proto_goTypes = nil 469 + file_techaro_thoth_auth_v1_auth_proto_depIdxs = nil 470 + }
+1683
gen/techaro/thoth/auth/v1/auth.twirp.go
··· 1 + // Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT. 2 + // source: techaro/thoth/auth/v1/auth.proto 3 + 4 + package authv1 5 + 6 + import context "context" 7 + import fmt "fmt" 8 + import http "net/http" 9 + import io "io" 10 + import json "encoding/json" 11 + import strconv "strconv" 12 + import strings "strings" 13 + 14 + import protojson "google.golang.org/protobuf/encoding/protojson" 15 + import proto "google.golang.org/protobuf/proto" 16 + import twirp "github.com/twitchtv/twirp" 17 + import ctxsetters "github.com/twitchtv/twirp/ctxsetters" 18 + 19 + import bytes "bytes" 20 + import errors "errors" 21 + import path "path" 22 + import url "net/url" 23 + 24 + // Version compatibility assertion. 25 + // If the constant is not defined in the package, that likely means 26 + // the package needs to be updated to work with this generated code. 27 + // See https://twitchtv.github.io/twirp/docs/version_matrix.html 28 + const _ = twirp.TwirpPackageMinVersion_8_1_0 29 + 30 + // ==================== 31 + // JWTService Interface 32 + // ==================== 33 + 34 + type JWTService interface { 35 + Create(context.Context, *JWTServiceCreateRequest) (*JWTServiceCreateResponse, error) 36 + 37 + Delete(context.Context, *JWTServiceDeleteRequest) (*JWTServiceDeleteResponse, error) 38 + 39 + List(context.Context, *JWTServiceListRequest) (*JWTServiceListResponse, error) 40 + } 41 + 42 + // ========================== 43 + // JWTService Protobuf Client 44 + // ========================== 45 + 46 + type jWTServiceProtobufClient struct { 47 + client HTTPClient 48 + urls [3]string 49 + interceptor twirp.Interceptor 50 + opts twirp.ClientOptions 51 + } 52 + 53 + // NewJWTServiceProtobufClient creates a Protobuf client that implements the JWTService interface. 54 + // It communicates using Protobuf and can be configured with a custom HTTPClient. 55 + func NewJWTServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) JWTService { 56 + if c, ok := client.(*http.Client); ok { 57 + client = withoutRedirects(c) 58 + } 59 + 60 + clientOpts := twirp.ClientOptions{} 61 + for _, o := range opts { 62 + o(&clientOpts) 63 + } 64 + 65 + // Using ReadOpt allows backwards and forwards compatibility with new options in the future 66 + literalURLs := false 67 + _ = clientOpts.ReadOpt("literalURLs", &literalURLs) 68 + var pathPrefix string 69 + if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { 70 + pathPrefix = "/twirp" // default prefix 71 + } 72 + 73 + // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 74 + serviceURL := sanitizeBaseURL(baseURL) 75 + serviceURL += baseServicePath(pathPrefix, "techaro.thoth.auth.v1", "JWTService") 76 + urls := [3]string{ 77 + serviceURL + "Create", 78 + serviceURL + "Delete", 79 + serviceURL + "List", 80 + } 81 + 82 + return &jWTServiceProtobufClient{ 83 + client: client, 84 + urls: urls, 85 + interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), 86 + opts: clientOpts, 87 + } 88 + } 89 + 90 + func (c *jWTServiceProtobufClient) Create(ctx context.Context, in *JWTServiceCreateRequest) (*JWTServiceCreateResponse, error) { 91 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.v1") 92 + ctx = ctxsetters.WithServiceName(ctx, "JWTService") 93 + ctx = ctxsetters.WithMethodName(ctx, "Create") 94 + caller := c.callCreate 95 + if c.interceptor != nil { 96 + caller = func(ctx context.Context, req *JWTServiceCreateRequest) (*JWTServiceCreateResponse, error) { 97 + resp, err := c.interceptor( 98 + func(ctx context.Context, req interface{}) (interface{}, error) { 99 + typedReq, ok := req.(*JWTServiceCreateRequest) 100 + if !ok { 101 + return nil, twirp.InternalError("failed type assertion req.(*JWTServiceCreateRequest) when calling interceptor") 102 + } 103 + return c.callCreate(ctx, typedReq) 104 + }, 105 + )(ctx, req) 106 + if resp != nil { 107 + typedResp, ok := resp.(*JWTServiceCreateResponse) 108 + if !ok { 109 + return nil, twirp.InternalError("failed type assertion resp.(*JWTServiceCreateResponse) when calling interceptor") 110 + } 111 + return typedResp, err 112 + } 113 + return nil, err 114 + } 115 + } 116 + return caller(ctx, in) 117 + } 118 + 119 + func (c *jWTServiceProtobufClient) callCreate(ctx context.Context, in *JWTServiceCreateRequest) (*JWTServiceCreateResponse, error) { 120 + out := new(JWTServiceCreateResponse) 121 + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 122 + if err != nil { 123 + twerr, ok := err.(twirp.Error) 124 + if !ok { 125 + twerr = twirp.InternalErrorWith(err) 126 + } 127 + callClientError(ctx, c.opts.Hooks, twerr) 128 + return nil, err 129 + } 130 + 131 + callClientResponseReceived(ctx, c.opts.Hooks) 132 + 133 + return out, nil 134 + } 135 + 136 + func (c *jWTServiceProtobufClient) Delete(ctx context.Context, in *JWTServiceDeleteRequest) (*JWTServiceDeleteResponse, error) { 137 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.v1") 138 + ctx = ctxsetters.WithServiceName(ctx, "JWTService") 139 + ctx = ctxsetters.WithMethodName(ctx, "Delete") 140 + caller := c.callDelete 141 + if c.interceptor != nil { 142 + caller = func(ctx context.Context, req *JWTServiceDeleteRequest) (*JWTServiceDeleteResponse, error) { 143 + resp, err := c.interceptor( 144 + func(ctx context.Context, req interface{}) (interface{}, error) { 145 + typedReq, ok := req.(*JWTServiceDeleteRequest) 146 + if !ok { 147 + return nil, twirp.InternalError("failed type assertion req.(*JWTServiceDeleteRequest) when calling interceptor") 148 + } 149 + return c.callDelete(ctx, typedReq) 150 + }, 151 + )(ctx, req) 152 + if resp != nil { 153 + typedResp, ok := resp.(*JWTServiceDeleteResponse) 154 + if !ok { 155 + return nil, twirp.InternalError("failed type assertion resp.(*JWTServiceDeleteResponse) when calling interceptor") 156 + } 157 + return typedResp, err 158 + } 159 + return nil, err 160 + } 161 + } 162 + return caller(ctx, in) 163 + } 164 + 165 + func (c *jWTServiceProtobufClient) callDelete(ctx context.Context, in *JWTServiceDeleteRequest) (*JWTServiceDeleteResponse, error) { 166 + out := new(JWTServiceDeleteResponse) 167 + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) 168 + if err != nil { 169 + twerr, ok := err.(twirp.Error) 170 + if !ok { 171 + twerr = twirp.InternalErrorWith(err) 172 + } 173 + callClientError(ctx, c.opts.Hooks, twerr) 174 + return nil, err 175 + } 176 + 177 + callClientResponseReceived(ctx, c.opts.Hooks) 178 + 179 + return out, nil 180 + } 181 + 182 + func (c *jWTServiceProtobufClient) List(ctx context.Context, in *JWTServiceListRequest) (*JWTServiceListResponse, error) { 183 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.v1") 184 + ctx = ctxsetters.WithServiceName(ctx, "JWTService") 185 + ctx = ctxsetters.WithMethodName(ctx, "List") 186 + caller := c.callList 187 + if c.interceptor != nil { 188 + caller = func(ctx context.Context, req *JWTServiceListRequest) (*JWTServiceListResponse, error) { 189 + resp, err := c.interceptor( 190 + func(ctx context.Context, req interface{}) (interface{}, error) { 191 + typedReq, ok := req.(*JWTServiceListRequest) 192 + if !ok { 193 + return nil, twirp.InternalError("failed type assertion req.(*JWTServiceListRequest) when calling interceptor") 194 + } 195 + return c.callList(ctx, typedReq) 196 + }, 197 + )(ctx, req) 198 + if resp != nil { 199 + typedResp, ok := resp.(*JWTServiceListResponse) 200 + if !ok { 201 + return nil, twirp.InternalError("failed type assertion resp.(*JWTServiceListResponse) when calling interceptor") 202 + } 203 + return typedResp, err 204 + } 205 + return nil, err 206 + } 207 + } 208 + return caller(ctx, in) 209 + } 210 + 211 + func (c *jWTServiceProtobufClient) callList(ctx context.Context, in *JWTServiceListRequest) (*JWTServiceListResponse, error) { 212 + out := new(JWTServiceListResponse) 213 + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out) 214 + if err != nil { 215 + twerr, ok := err.(twirp.Error) 216 + if !ok { 217 + twerr = twirp.InternalErrorWith(err) 218 + } 219 + callClientError(ctx, c.opts.Hooks, twerr) 220 + return nil, err 221 + } 222 + 223 + callClientResponseReceived(ctx, c.opts.Hooks) 224 + 225 + return out, nil 226 + } 227 + 228 + // ====================== 229 + // JWTService JSON Client 230 + // ====================== 231 + 232 + type jWTServiceJSONClient struct { 233 + client HTTPClient 234 + urls [3]string 235 + interceptor twirp.Interceptor 236 + opts twirp.ClientOptions 237 + } 238 + 239 + // NewJWTServiceJSONClient creates a JSON client that implements the JWTService interface. 240 + // It communicates using JSON and can be configured with a custom HTTPClient. 241 + func NewJWTServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) JWTService { 242 + if c, ok := client.(*http.Client); ok { 243 + client = withoutRedirects(c) 244 + } 245 + 246 + clientOpts := twirp.ClientOptions{} 247 + for _, o := range opts { 248 + o(&clientOpts) 249 + } 250 + 251 + // Using ReadOpt allows backwards and forwards compatibility with new options in the future 252 + literalURLs := false 253 + _ = clientOpts.ReadOpt("literalURLs", &literalURLs) 254 + var pathPrefix string 255 + if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { 256 + pathPrefix = "/twirp" // default prefix 257 + } 258 + 259 + // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 260 + serviceURL := sanitizeBaseURL(baseURL) 261 + serviceURL += baseServicePath(pathPrefix, "techaro.thoth.auth.v1", "JWTService") 262 + urls := [3]string{ 263 + serviceURL + "Create", 264 + serviceURL + "Delete", 265 + serviceURL + "List", 266 + } 267 + 268 + return &jWTServiceJSONClient{ 269 + client: client, 270 + urls: urls, 271 + interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), 272 + opts: clientOpts, 273 + } 274 + } 275 + 276 + func (c *jWTServiceJSONClient) Create(ctx context.Context, in *JWTServiceCreateRequest) (*JWTServiceCreateResponse, error) { 277 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.v1") 278 + ctx = ctxsetters.WithServiceName(ctx, "JWTService") 279 + ctx = ctxsetters.WithMethodName(ctx, "Create") 280 + caller := c.callCreate 281 + if c.interceptor != nil { 282 + caller = func(ctx context.Context, req *JWTServiceCreateRequest) (*JWTServiceCreateResponse, error) { 283 + resp, err := c.interceptor( 284 + func(ctx context.Context, req interface{}) (interface{}, error) { 285 + typedReq, ok := req.(*JWTServiceCreateRequest) 286 + if !ok { 287 + return nil, twirp.InternalError("failed type assertion req.(*JWTServiceCreateRequest) when calling interceptor") 288 + } 289 + return c.callCreate(ctx, typedReq) 290 + }, 291 + )(ctx, req) 292 + if resp != nil { 293 + typedResp, ok := resp.(*JWTServiceCreateResponse) 294 + if !ok { 295 + return nil, twirp.InternalError("failed type assertion resp.(*JWTServiceCreateResponse) when calling interceptor") 296 + } 297 + return typedResp, err 298 + } 299 + return nil, err 300 + } 301 + } 302 + return caller(ctx, in) 303 + } 304 + 305 + func (c *jWTServiceJSONClient) callCreate(ctx context.Context, in *JWTServiceCreateRequest) (*JWTServiceCreateResponse, error) { 306 + out := new(JWTServiceCreateResponse) 307 + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 308 + if err != nil { 309 + twerr, ok := err.(twirp.Error) 310 + if !ok { 311 + twerr = twirp.InternalErrorWith(err) 312 + } 313 + callClientError(ctx, c.opts.Hooks, twerr) 314 + return nil, err 315 + } 316 + 317 + callClientResponseReceived(ctx, c.opts.Hooks) 318 + 319 + return out, nil 320 + } 321 + 322 + func (c *jWTServiceJSONClient) Delete(ctx context.Context, in *JWTServiceDeleteRequest) (*JWTServiceDeleteResponse, error) { 323 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.v1") 324 + ctx = ctxsetters.WithServiceName(ctx, "JWTService") 325 + ctx = ctxsetters.WithMethodName(ctx, "Delete") 326 + caller := c.callDelete 327 + if c.interceptor != nil { 328 + caller = func(ctx context.Context, req *JWTServiceDeleteRequest) (*JWTServiceDeleteResponse, error) { 329 + resp, err := c.interceptor( 330 + func(ctx context.Context, req interface{}) (interface{}, error) { 331 + typedReq, ok := req.(*JWTServiceDeleteRequest) 332 + if !ok { 333 + return nil, twirp.InternalError("failed type assertion req.(*JWTServiceDeleteRequest) when calling interceptor") 334 + } 335 + return c.callDelete(ctx, typedReq) 336 + }, 337 + )(ctx, req) 338 + if resp != nil { 339 + typedResp, ok := resp.(*JWTServiceDeleteResponse) 340 + if !ok { 341 + return nil, twirp.InternalError("failed type assertion resp.(*JWTServiceDeleteResponse) when calling interceptor") 342 + } 343 + return typedResp, err 344 + } 345 + return nil, err 346 + } 347 + } 348 + return caller(ctx, in) 349 + } 350 + 351 + func (c *jWTServiceJSONClient) callDelete(ctx context.Context, in *JWTServiceDeleteRequest) (*JWTServiceDeleteResponse, error) { 352 + out := new(JWTServiceDeleteResponse) 353 + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) 354 + if err != nil { 355 + twerr, ok := err.(twirp.Error) 356 + if !ok { 357 + twerr = twirp.InternalErrorWith(err) 358 + } 359 + callClientError(ctx, c.opts.Hooks, twerr) 360 + return nil, err 361 + } 362 + 363 + callClientResponseReceived(ctx, c.opts.Hooks) 364 + 365 + return out, nil 366 + } 367 + 368 + func (c *jWTServiceJSONClient) List(ctx context.Context, in *JWTServiceListRequest) (*JWTServiceListResponse, error) { 369 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.v1") 370 + ctx = ctxsetters.WithServiceName(ctx, "JWTService") 371 + ctx = ctxsetters.WithMethodName(ctx, "List") 372 + caller := c.callList 373 + if c.interceptor != nil { 374 + caller = func(ctx context.Context, req *JWTServiceListRequest) (*JWTServiceListResponse, error) { 375 + resp, err := c.interceptor( 376 + func(ctx context.Context, req interface{}) (interface{}, error) { 377 + typedReq, ok := req.(*JWTServiceListRequest) 378 + if !ok { 379 + return nil, twirp.InternalError("failed type assertion req.(*JWTServiceListRequest) when calling interceptor") 380 + } 381 + return c.callList(ctx, typedReq) 382 + }, 383 + )(ctx, req) 384 + if resp != nil { 385 + typedResp, ok := resp.(*JWTServiceListResponse) 386 + if !ok { 387 + return nil, twirp.InternalError("failed type assertion resp.(*JWTServiceListResponse) when calling interceptor") 388 + } 389 + return typedResp, err 390 + } 391 + return nil, err 392 + } 393 + } 394 + return caller(ctx, in) 395 + } 396 + 397 + func (c *jWTServiceJSONClient) callList(ctx context.Context, in *JWTServiceListRequest) (*JWTServiceListResponse, error) { 398 + out := new(JWTServiceListResponse) 399 + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out) 400 + if err != nil { 401 + twerr, ok := err.(twirp.Error) 402 + if !ok { 403 + twerr = twirp.InternalErrorWith(err) 404 + } 405 + callClientError(ctx, c.opts.Hooks, twerr) 406 + return nil, err 407 + } 408 + 409 + callClientResponseReceived(ctx, c.opts.Hooks) 410 + 411 + return out, nil 412 + } 413 + 414 + // ========================= 415 + // JWTService Server Handler 416 + // ========================= 417 + 418 + type jWTServiceServer struct { 419 + JWTService 420 + interceptor twirp.Interceptor 421 + hooks *twirp.ServerHooks 422 + pathPrefix string // prefix for routing 423 + jsonSkipDefaults bool // do not include unpopulated fields (default values) in the response 424 + jsonCamelCase bool // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names 425 + } 426 + 427 + // NewJWTServiceServer builds a TwirpServer that can be used as an http.Handler to handle 428 + // HTTP requests that are routed to the right method in the provided svc implementation. 429 + // The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks). 430 + func NewJWTServiceServer(svc JWTService, opts ...interface{}) TwirpServer { 431 + serverOpts := newServerOpts(opts) 432 + 433 + // Using ReadOpt allows backwards and forwards compatibility with new options in the future 434 + jsonSkipDefaults := false 435 + _ = serverOpts.ReadOpt("jsonSkipDefaults", &jsonSkipDefaults) 436 + jsonCamelCase := false 437 + _ = serverOpts.ReadOpt("jsonCamelCase", &jsonCamelCase) 438 + var pathPrefix string 439 + if ok := serverOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { 440 + pathPrefix = "/twirp" // default prefix 441 + } 442 + 443 + return &jWTServiceServer{ 444 + JWTService: svc, 445 + hooks: serverOpts.Hooks, 446 + interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...), 447 + pathPrefix: pathPrefix, 448 + jsonSkipDefaults: jsonSkipDefaults, 449 + jsonCamelCase: jsonCamelCase, 450 + } 451 + } 452 + 453 + // writeError writes an HTTP response with a valid Twirp error format, and triggers hooks. 454 + // If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) 455 + func (s *jWTServiceServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { 456 + writeError(ctx, resp, err, s.hooks) 457 + } 458 + 459 + // handleRequestBodyError is used to handle error when the twirp server cannot read request 460 + func (s *jWTServiceServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { 461 + if context.Canceled == ctx.Err() { 462 + s.writeError(ctx, resp, twirp.NewError(twirp.Canceled, "failed to read request: context canceled")) 463 + return 464 + } 465 + if context.DeadlineExceeded == ctx.Err() { 466 + s.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, "failed to read request: deadline exceeded")) 467 + return 468 + } 469 + s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err)) 470 + } 471 + 472 + // JWTServicePathPrefix is a convenience constant that may identify URL paths. 473 + // Should be used with caution, it only matches routes generated by Twirp Go clients, 474 + // with the default "/twirp" prefix and default CamelCase service and method names. 475 + // More info: https://twitchtv.github.io/twirp/docs/routing.html 476 + const JWTServicePathPrefix = "/twirp/techaro.thoth.auth.v1.JWTService/" 477 + 478 + func (s *jWTServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { 479 + ctx := req.Context() 480 + ctx = ctxsetters.WithPackageName(ctx, "techaro.thoth.auth.v1") 481 + ctx = ctxsetters.WithServiceName(ctx, "JWTService") 482 + ctx = ctxsetters.WithResponseWriter(ctx, resp) 483 + 484 + var err error 485 + ctx, err = callRequestReceived(ctx, s.hooks) 486 + if err != nil { 487 + s.writeError(ctx, resp, err) 488 + return 489 + } 490 + 491 + if req.Method != "POST" { 492 + msg := fmt.Sprintf("unsupported method %q (only POST is allowed)", req.Method) 493 + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) 494 + return 495 + } 496 + 497 + // Verify path format: [<prefix>]/<package>.<Service>/<Method> 498 + prefix, pkgService, method := parseTwirpPath(req.URL.Path) 499 + if pkgService != "techaro.thoth.auth.v1.JWTService" { 500 + msg := fmt.Sprintf("no handler for path %q", req.URL.Path) 501 + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) 502 + return 503 + } 504 + if prefix != s.pathPrefix { 505 + msg := fmt.Sprintf("invalid path prefix %q, expected %q, on path %q", prefix, s.pathPrefix, req.URL.Path) 506 + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) 507 + return 508 + } 509 + 510 + switch method { 511 + case "Create": 512 + s.serveCreate(ctx, resp, req) 513 + return 514 + case "Delete": 515 + s.serveDelete(ctx, resp, req) 516 + return 517 + case "List": 518 + s.serveList(ctx, resp, req) 519 + return 520 + default: 521 + msg := fmt.Sprintf("no handler for path %q", req.URL.Path) 522 + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) 523 + return 524 + } 525 + } 526 + 527 + func (s *jWTServiceServer) serveCreate(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 528 + header := req.Header.Get("Content-Type") 529 + i := strings.Index(header, ";") 530 + if i == -1 { 531 + i = len(header) 532 + } 533 + switch strings.TrimSpace(strings.ToLower(header[:i])) { 534 + case "application/json": 535 + s.serveCreateJSON(ctx, resp, req) 536 + case "application/protobuf": 537 + s.serveCreateProtobuf(ctx, resp, req) 538 + default: 539 + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) 540 + twerr := badRouteError(msg, req.Method, req.URL.Path) 541 + s.writeError(ctx, resp, twerr) 542 + } 543 + } 544 + 545 + func (s *jWTServiceServer) serveCreateJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 546 + var err error 547 + ctx = ctxsetters.WithMethodName(ctx, "Create") 548 + ctx, err = callRequestRouted(ctx, s.hooks) 549 + if err != nil { 550 + s.writeError(ctx, resp, err) 551 + return 552 + } 553 + 554 + d := json.NewDecoder(req.Body) 555 + rawReqBody := json.RawMessage{} 556 + if err := d.Decode(&rawReqBody); err != nil { 557 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 558 + return 559 + } 560 + reqContent := new(JWTServiceCreateRequest) 561 + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} 562 + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { 563 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 564 + return 565 + } 566 + 567 + handler := s.JWTService.Create 568 + if s.interceptor != nil { 569 + handler = func(ctx context.Context, req *JWTServiceCreateRequest) (*JWTServiceCreateResponse, error) { 570 + resp, err := s.interceptor( 571 + func(ctx context.Context, req interface{}) (interface{}, error) { 572 + typedReq, ok := req.(*JWTServiceCreateRequest) 573 + if !ok { 574 + return nil, twirp.InternalError("failed type assertion req.(*JWTServiceCreateRequest) when calling interceptor") 575 + } 576 + return s.JWTService.Create(ctx, typedReq) 577 + }, 578 + )(ctx, req) 579 + if resp != nil { 580 + typedResp, ok := resp.(*JWTServiceCreateResponse) 581 + if !ok { 582 + return nil, twirp.InternalError("failed type assertion resp.(*JWTServiceCreateResponse) when calling interceptor") 583 + } 584 + return typedResp, err 585 + } 586 + return nil, err 587 + } 588 + } 589 + 590 + // Call service method 591 + var respContent *JWTServiceCreateResponse 592 + func() { 593 + defer ensurePanicResponses(ctx, resp, s.hooks) 594 + respContent, err = handler(ctx, reqContent) 595 + }() 596 + 597 + if err != nil { 598 + s.writeError(ctx, resp, err) 599 + return 600 + } 601 + if respContent == nil { 602 + s.writeError(ctx, resp, twirp.InternalError("received a nil *JWTServiceCreateResponse and nil error while calling Create. nil responses are not supported")) 603 + return 604 + } 605 + 606 + ctx = callResponsePrepared(ctx, s.hooks) 607 + 608 + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} 609 + respBytes, err := marshaler.Marshal(respContent) 610 + if err != nil { 611 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) 612 + return 613 + } 614 + 615 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 616 + resp.Header().Set("Content-Type", "application/json") 617 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 618 + resp.WriteHeader(http.StatusOK) 619 + 620 + if n, err := resp.Write(respBytes); err != nil { 621 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 622 + twerr := twirp.NewError(twirp.Unknown, msg) 623 + ctx = callError(ctx, s.hooks, twerr) 624 + } 625 + callResponseSent(ctx, s.hooks) 626 + } 627 + 628 + func (s *jWTServiceServer) serveCreateProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 629 + var err error 630 + ctx = ctxsetters.WithMethodName(ctx, "Create") 631 + ctx, err = callRequestRouted(ctx, s.hooks) 632 + if err != nil { 633 + s.writeError(ctx, resp, err) 634 + return 635 + } 636 + 637 + buf, err := io.ReadAll(req.Body) 638 + if err != nil { 639 + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) 640 + return 641 + } 642 + reqContent := new(JWTServiceCreateRequest) 643 + if err = proto.Unmarshal(buf, reqContent); err != nil { 644 + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) 645 + return 646 + } 647 + 648 + handler := s.JWTService.Create 649 + if s.interceptor != nil { 650 + handler = func(ctx context.Context, req *JWTServiceCreateRequest) (*JWTServiceCreateResponse, error) { 651 + resp, err := s.interceptor( 652 + func(ctx context.Context, req interface{}) (interface{}, error) { 653 + typedReq, ok := req.(*JWTServiceCreateRequest) 654 + if !ok { 655 + return nil, twirp.InternalError("failed type assertion req.(*JWTServiceCreateRequest) when calling interceptor") 656 + } 657 + return s.JWTService.Create(ctx, typedReq) 658 + }, 659 + )(ctx, req) 660 + if resp != nil { 661 + typedResp, ok := resp.(*JWTServiceCreateResponse) 662 + if !ok { 663 + return nil, twirp.InternalError("failed type assertion resp.(*JWTServiceCreateResponse) when calling interceptor") 664 + } 665 + return typedResp, err 666 + } 667 + return nil, err 668 + } 669 + } 670 + 671 + // Call service method 672 + var respContent *JWTServiceCreateResponse 673 + func() { 674 + defer ensurePanicResponses(ctx, resp, s.hooks) 675 + respContent, err = handler(ctx, reqContent) 676 + }() 677 + 678 + if err != nil { 679 + s.writeError(ctx, resp, err) 680 + return 681 + } 682 + if respContent == nil { 683 + s.writeError(ctx, resp, twirp.InternalError("received a nil *JWTServiceCreateResponse and nil error while calling Create. nil responses are not supported")) 684 + return 685 + } 686 + 687 + ctx = callResponsePrepared(ctx, s.hooks) 688 + 689 + respBytes, err := proto.Marshal(respContent) 690 + if err != nil { 691 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) 692 + return 693 + } 694 + 695 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 696 + resp.Header().Set("Content-Type", "application/protobuf") 697 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 698 + resp.WriteHeader(http.StatusOK) 699 + if n, err := resp.Write(respBytes); err != nil { 700 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 701 + twerr := twirp.NewError(twirp.Unknown, msg) 702 + ctx = callError(ctx, s.hooks, twerr) 703 + } 704 + callResponseSent(ctx, s.hooks) 705 + } 706 + 707 + func (s *jWTServiceServer) serveDelete(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 708 + header := req.Header.Get("Content-Type") 709 + i := strings.Index(header, ";") 710 + if i == -1 { 711 + i = len(header) 712 + } 713 + switch strings.TrimSpace(strings.ToLower(header[:i])) { 714 + case "application/json": 715 + s.serveDeleteJSON(ctx, resp, req) 716 + case "application/protobuf": 717 + s.serveDeleteProtobuf(ctx, resp, req) 718 + default: 719 + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) 720 + twerr := badRouteError(msg, req.Method, req.URL.Path) 721 + s.writeError(ctx, resp, twerr) 722 + } 723 + } 724 + 725 + func (s *jWTServiceServer) serveDeleteJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 726 + var err error 727 + ctx = ctxsetters.WithMethodName(ctx, "Delete") 728 + ctx, err = callRequestRouted(ctx, s.hooks) 729 + if err != nil { 730 + s.writeError(ctx, resp, err) 731 + return 732 + } 733 + 734 + d := json.NewDecoder(req.Body) 735 + rawReqBody := json.RawMessage{} 736 + if err := d.Decode(&rawReqBody); err != nil { 737 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 738 + return 739 + } 740 + reqContent := new(JWTServiceDeleteRequest) 741 + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} 742 + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { 743 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 744 + return 745 + } 746 + 747 + handler := s.JWTService.Delete 748 + if s.interceptor != nil { 749 + handler = func(ctx context.Context, req *JWTServiceDeleteRequest) (*JWTServiceDeleteResponse, error) { 750 + resp, err := s.interceptor( 751 + func(ctx context.Context, req interface{}) (interface{}, error) { 752 + typedReq, ok := req.(*JWTServiceDeleteRequest) 753 + if !ok { 754 + return nil, twirp.InternalError("failed type assertion req.(*JWTServiceDeleteRequest) when calling interceptor") 755 + } 756 + return s.JWTService.Delete(ctx, typedReq) 757 + }, 758 + )(ctx, req) 759 + if resp != nil { 760 + typedResp, ok := resp.(*JWTServiceDeleteResponse) 761 + if !ok { 762 + return nil, twirp.InternalError("failed type assertion resp.(*JWTServiceDeleteResponse) when calling interceptor") 763 + } 764 + return typedResp, err 765 + } 766 + return nil, err 767 + } 768 + } 769 + 770 + // Call service method 771 + var respContent *JWTServiceDeleteResponse 772 + func() { 773 + defer ensurePanicResponses(ctx, resp, s.hooks) 774 + respContent, err = handler(ctx, reqContent) 775 + }() 776 + 777 + if err != nil { 778 + s.writeError(ctx, resp, err) 779 + return 780 + } 781 + if respContent == nil { 782 + s.writeError(ctx, resp, twirp.InternalError("received a nil *JWTServiceDeleteResponse and nil error while calling Delete. nil responses are not supported")) 783 + return 784 + } 785 + 786 + ctx = callResponsePrepared(ctx, s.hooks) 787 + 788 + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} 789 + respBytes, err := marshaler.Marshal(respContent) 790 + if err != nil { 791 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) 792 + return 793 + } 794 + 795 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 796 + resp.Header().Set("Content-Type", "application/json") 797 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 798 + resp.WriteHeader(http.StatusOK) 799 + 800 + if n, err := resp.Write(respBytes); err != nil { 801 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 802 + twerr := twirp.NewError(twirp.Unknown, msg) 803 + ctx = callError(ctx, s.hooks, twerr) 804 + } 805 + callResponseSent(ctx, s.hooks) 806 + } 807 + 808 + func (s *jWTServiceServer) serveDeleteProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 809 + var err error 810 + ctx = ctxsetters.WithMethodName(ctx, "Delete") 811 + ctx, err = callRequestRouted(ctx, s.hooks) 812 + if err != nil { 813 + s.writeError(ctx, resp, err) 814 + return 815 + } 816 + 817 + buf, err := io.ReadAll(req.Body) 818 + if err != nil { 819 + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) 820 + return 821 + } 822 + reqContent := new(JWTServiceDeleteRequest) 823 + if err = proto.Unmarshal(buf, reqContent); err != nil { 824 + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) 825 + return 826 + } 827 + 828 + handler := s.JWTService.Delete 829 + if s.interceptor != nil { 830 + handler = func(ctx context.Context, req *JWTServiceDeleteRequest) (*JWTServiceDeleteResponse, error) { 831 + resp, err := s.interceptor( 832 + func(ctx context.Context, req interface{}) (interface{}, error) { 833 + typedReq, ok := req.(*JWTServiceDeleteRequest) 834 + if !ok { 835 + return nil, twirp.InternalError("failed type assertion req.(*JWTServiceDeleteRequest) when calling interceptor") 836 + } 837 + return s.JWTService.Delete(ctx, typedReq) 838 + }, 839 + )(ctx, req) 840 + if resp != nil { 841 + typedResp, ok := resp.(*JWTServiceDeleteResponse) 842 + if !ok { 843 + return nil, twirp.InternalError("failed type assertion resp.(*JWTServiceDeleteResponse) when calling interceptor") 844 + } 845 + return typedResp, err 846 + } 847 + return nil, err 848 + } 849 + } 850 + 851 + // Call service method 852 + var respContent *JWTServiceDeleteResponse 853 + func() { 854 + defer ensurePanicResponses(ctx, resp, s.hooks) 855 + respContent, err = handler(ctx, reqContent) 856 + }() 857 + 858 + if err != nil { 859 + s.writeError(ctx, resp, err) 860 + return 861 + } 862 + if respContent == nil { 863 + s.writeError(ctx, resp, twirp.InternalError("received a nil *JWTServiceDeleteResponse and nil error while calling Delete. nil responses are not supported")) 864 + return 865 + } 866 + 867 + ctx = callResponsePrepared(ctx, s.hooks) 868 + 869 + respBytes, err := proto.Marshal(respContent) 870 + if err != nil { 871 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) 872 + return 873 + } 874 + 875 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 876 + resp.Header().Set("Content-Type", "application/protobuf") 877 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 878 + resp.WriteHeader(http.StatusOK) 879 + if n, err := resp.Write(respBytes); err != nil { 880 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 881 + twerr := twirp.NewError(twirp.Unknown, msg) 882 + ctx = callError(ctx, s.hooks, twerr) 883 + } 884 + callResponseSent(ctx, s.hooks) 885 + } 886 + 887 + func (s *jWTServiceServer) serveList(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 888 + header := req.Header.Get("Content-Type") 889 + i := strings.Index(header, ";") 890 + if i == -1 { 891 + i = len(header) 892 + } 893 + switch strings.TrimSpace(strings.ToLower(header[:i])) { 894 + case "application/json": 895 + s.serveListJSON(ctx, resp, req) 896 + case "application/protobuf": 897 + s.serveListProtobuf(ctx, resp, req) 898 + default: 899 + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) 900 + twerr := badRouteError(msg, req.Method, req.URL.Path) 901 + s.writeError(ctx, resp, twerr) 902 + } 903 + } 904 + 905 + func (s *jWTServiceServer) serveListJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 906 + var err error 907 + ctx = ctxsetters.WithMethodName(ctx, "List") 908 + ctx, err = callRequestRouted(ctx, s.hooks) 909 + if err != nil { 910 + s.writeError(ctx, resp, err) 911 + return 912 + } 913 + 914 + d := json.NewDecoder(req.Body) 915 + rawReqBody := json.RawMessage{} 916 + if err := d.Decode(&rawReqBody); err != nil { 917 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 918 + return 919 + } 920 + reqContent := new(JWTServiceListRequest) 921 + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} 922 + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { 923 + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 924 + return 925 + } 926 + 927 + handler := s.JWTService.List 928 + if s.interceptor != nil { 929 + handler = func(ctx context.Context, req *JWTServiceListRequest) (*JWTServiceListResponse, error) { 930 + resp, err := s.interceptor( 931 + func(ctx context.Context, req interface{}) (interface{}, error) { 932 + typedReq, ok := req.(*JWTServiceListRequest) 933 + if !ok { 934 + return nil, twirp.InternalError("failed type assertion req.(*JWTServiceListRequest) when calling interceptor") 935 + } 936 + return s.JWTService.List(ctx, typedReq) 937 + }, 938 + )(ctx, req) 939 + if resp != nil { 940 + typedResp, ok := resp.(*JWTServiceListResponse) 941 + if !ok { 942 + return nil, twirp.InternalError("failed type assertion resp.(*JWTServiceListResponse) when calling interceptor") 943 + } 944 + return typedResp, err 945 + } 946 + return nil, err 947 + } 948 + } 949 + 950 + // Call service method 951 + var respContent *JWTServiceListResponse 952 + func() { 953 + defer ensurePanicResponses(ctx, resp, s.hooks) 954 + respContent, err = handler(ctx, reqContent) 955 + }() 956 + 957 + if err != nil { 958 + s.writeError(ctx, resp, err) 959 + return 960 + } 961 + if respContent == nil { 962 + s.writeError(ctx, resp, twirp.InternalError("received a nil *JWTServiceListResponse and nil error while calling List. nil responses are not supported")) 963 + return 964 + } 965 + 966 + ctx = callResponsePrepared(ctx, s.hooks) 967 + 968 + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} 969 + respBytes, err := marshaler.Marshal(respContent) 970 + if err != nil { 971 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) 972 + return 973 + } 974 + 975 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 976 + resp.Header().Set("Content-Type", "application/json") 977 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 978 + resp.WriteHeader(http.StatusOK) 979 + 980 + if n, err := resp.Write(respBytes); err != nil { 981 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 982 + twerr := twirp.NewError(twirp.Unknown, msg) 983 + ctx = callError(ctx, s.hooks, twerr) 984 + } 985 + callResponseSent(ctx, s.hooks) 986 + } 987 + 988 + func (s *jWTServiceServer) serveListProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 989 + var err error 990 + ctx = ctxsetters.WithMethodName(ctx, "List") 991 + ctx, err = callRequestRouted(ctx, s.hooks) 992 + if err != nil { 993 + s.writeError(ctx, resp, err) 994 + return 995 + } 996 + 997 + buf, err := io.ReadAll(req.Body) 998 + if err != nil { 999 + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) 1000 + return 1001 + } 1002 + reqContent := new(JWTServiceListRequest) 1003 + if err = proto.Unmarshal(buf, reqContent); err != nil { 1004 + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) 1005 + return 1006 + } 1007 + 1008 + handler := s.JWTService.List 1009 + if s.interceptor != nil { 1010 + handler = func(ctx context.Context, req *JWTServiceListRequest) (*JWTServiceListResponse, error) { 1011 + resp, err := s.interceptor( 1012 + func(ctx context.Context, req interface{}) (interface{}, error) { 1013 + typedReq, ok := req.(*JWTServiceListRequest) 1014 + if !ok { 1015 + return nil, twirp.InternalError("failed type assertion req.(*JWTServiceListRequest) when calling interceptor") 1016 + } 1017 + return s.JWTService.List(ctx, typedReq) 1018 + }, 1019 + )(ctx, req) 1020 + if resp != nil { 1021 + typedResp, ok := resp.(*JWTServiceListResponse) 1022 + if !ok { 1023 + return nil, twirp.InternalError("failed type assertion resp.(*JWTServiceListResponse) when calling interceptor") 1024 + } 1025 + return typedResp, err 1026 + } 1027 + return nil, err 1028 + } 1029 + } 1030 + 1031 + // Call service method 1032 + var respContent *JWTServiceListResponse 1033 + func() { 1034 + defer ensurePanicResponses(ctx, resp, s.hooks) 1035 + respContent, err = handler(ctx, reqContent) 1036 + }() 1037 + 1038 + if err != nil { 1039 + s.writeError(ctx, resp, err) 1040 + return 1041 + } 1042 + if respContent == nil { 1043 + s.writeError(ctx, resp, twirp.InternalError("received a nil *JWTServiceListResponse and nil error while calling List. nil responses are not supported")) 1044 + return 1045 + } 1046 + 1047 + ctx = callResponsePrepared(ctx, s.hooks) 1048 + 1049 + respBytes, err := proto.Marshal(respContent) 1050 + if err != nil { 1051 + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) 1052 + return 1053 + } 1054 + 1055 + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) 1056 + resp.Header().Set("Content-Type", "application/protobuf") 1057 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) 1058 + resp.WriteHeader(http.StatusOK) 1059 + if n, err := resp.Write(respBytes); err != nil { 1060 + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) 1061 + twerr := twirp.NewError(twirp.Unknown, msg) 1062 + ctx = callError(ctx, s.hooks, twerr) 1063 + } 1064 + callResponseSent(ctx, s.hooks) 1065 + } 1066 + 1067 + func (s *jWTServiceServer) ServiceDescriptor() ([]byte, int) { 1068 + return twirpFileDescriptor0, 0 1069 + } 1070 + 1071 + func (s *jWTServiceServer) ProtocGenTwirpVersion() string { 1072 + return "v8.1.3" 1073 + } 1074 + 1075 + // PathPrefix returns the base service path, in the form: "/<prefix>/<package>.<Service>/" 1076 + // that is everything in a Twirp route except for the <Method>. This can be used for routing, 1077 + // for example to identify the requests that are targeted to this service in a mux. 1078 + func (s *jWTServiceServer) PathPrefix() string { 1079 + return baseServicePath(s.pathPrefix, "techaro.thoth.auth.v1", "JWTService") 1080 + } 1081 + 1082 + // ===== 1083 + // Utils 1084 + // ===== 1085 + 1086 + // HTTPClient is the interface used by generated clients to send HTTP requests. 1087 + // It is fulfilled by *(net/http).Client, which is sufficient for most users. 1088 + // Users can provide their own implementation for special retry policies. 1089 + // 1090 + // HTTPClient implementations should not follow redirects. Redirects are 1091 + // automatically disabled if *(net/http).Client is passed to client 1092 + // constructors. See the withoutRedirects function in this file for more 1093 + // details. 1094 + type HTTPClient interface { 1095 + Do(req *http.Request) (*http.Response, error) 1096 + } 1097 + 1098 + // TwirpServer is the interface generated server structs will support: they're 1099 + // HTTP handlers with additional methods for accessing metadata about the 1100 + // service. Those accessors are a low-level API for building reflection tools. 1101 + // Most people can think of TwirpServers as just http.Handlers. 1102 + type TwirpServer interface { 1103 + http.Handler 1104 + 1105 + // ServiceDescriptor returns gzipped bytes describing the .proto file that 1106 + // this service was generated from. Once unzipped, the bytes can be 1107 + // unmarshalled as a 1108 + // google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto. 1109 + // 1110 + // The returned integer is the index of this particular service within that 1111 + // FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a 1112 + // low-level field, expected to be used for reflection. 1113 + ServiceDescriptor() ([]byte, int) 1114 + 1115 + // ProtocGenTwirpVersion is the semantic version string of the version of 1116 + // twirp used to generate this file. 1117 + ProtocGenTwirpVersion() string 1118 + 1119 + // PathPrefix returns the HTTP URL path prefix for all methods handled by this 1120 + // service. This can be used with an HTTP mux to route Twirp requests. 1121 + // The path prefix is in the form: "/<prefix>/<package>.<Service>/" 1122 + // that is, everything in a Twirp route except for the <Method> at the end. 1123 + PathPrefix() string 1124 + } 1125 + 1126 + func newServerOpts(opts []interface{}) *twirp.ServerOptions { 1127 + serverOpts := &twirp.ServerOptions{} 1128 + for _, opt := range opts { 1129 + switch o := opt.(type) { 1130 + case twirp.ServerOption: 1131 + o(serverOpts) 1132 + case *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument 1133 + twirp.WithServerHooks(o)(serverOpts) 1134 + case nil: // backwards compatibility, allow nil value for the argument 1135 + continue 1136 + default: 1137 + panic(fmt.Sprintf("Invalid option type %T, please use a twirp.ServerOption", o)) 1138 + } 1139 + } 1140 + return serverOpts 1141 + } 1142 + 1143 + // WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). 1144 + // Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. 1145 + // If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) 1146 + func WriteError(resp http.ResponseWriter, err error) { 1147 + writeError(context.Background(), resp, err, nil) 1148 + } 1149 + 1150 + // writeError writes Twirp errors in the response and triggers hooks. 1151 + func writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) { 1152 + // Convert to a twirp.Error. Non-twirp errors are converted to internal errors. 1153 + var twerr twirp.Error 1154 + if !errors.As(err, &twerr) { 1155 + twerr = twirp.InternalErrorWith(err) 1156 + } 1157 + 1158 + statusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code()) 1159 + ctx = ctxsetters.WithStatusCode(ctx, statusCode) 1160 + ctx = callError(ctx, hooks, twerr) 1161 + 1162 + respBody := marshalErrorToJSON(twerr) 1163 + 1164 + resp.Header().Set("Content-Type", "application/json") // Error responses are always JSON 1165 + resp.Header().Set("Content-Length", strconv.Itoa(len(respBody))) 1166 + resp.WriteHeader(statusCode) // set HTTP status code and send response 1167 + 1168 + _, writeErr := resp.Write(respBody) 1169 + if writeErr != nil { 1170 + // We have three options here. We could log the error, call the Error 1171 + // hook, or just silently ignore the error. 1172 + // 1173 + // Logging is unacceptable because we don't have a user-controlled 1174 + // logger; writing out to stderr without permission is too rude. 1175 + // 1176 + // Calling the Error hook would confuse users: it would mean the Error 1177 + // hook got called twice for one request, which is likely to lead to 1178 + // duplicated log messages and metrics, no matter how well we document 1179 + // the behavior. 1180 + // 1181 + // Silently ignoring the error is our least-bad option. It's highly 1182 + // likely that the connection is broken and the original 'err' says 1183 + // so anyway. 1184 + _ = writeErr 1185 + } 1186 + 1187 + callResponseSent(ctx, hooks) 1188 + } 1189 + 1190 + // sanitizeBaseURL parses the the baseURL, and adds the "http" scheme if needed. 1191 + // If the URL is unparsable, the baseURL is returned unchanged. 1192 + func sanitizeBaseURL(baseURL string) string { 1193 + u, err := url.Parse(baseURL) 1194 + if err != nil { 1195 + return baseURL // invalid URL will fail later when making requests 1196 + } 1197 + if u.Scheme == "" { 1198 + u.Scheme = "http" 1199 + } 1200 + return u.String() 1201 + } 1202 + 1203 + // baseServicePath composes the path prefix for the service (without <Method>). 1204 + // e.g.: baseServicePath("/twirp", "my.pkg", "MyService") 1205 + // 1206 + // returns => "/twirp/my.pkg.MyService/" 1207 + // 1208 + // e.g.: baseServicePath("", "", "MyService") 1209 + // 1210 + // returns => "/MyService/" 1211 + func baseServicePath(prefix, pkg, service string) string { 1212 + fullServiceName := service 1213 + if pkg != "" { 1214 + fullServiceName = pkg + "." + service 1215 + } 1216 + return path.Join("/", prefix, fullServiceName) + "/" 1217 + } 1218 + 1219 + // parseTwirpPath extracts path components form a valid Twirp route. 1220 + // Expected format: "[<prefix>]/<package>.<Service>/<Method>" 1221 + // e.g.: prefix, pkgService, method := parseTwirpPath("/twirp/pkg.Svc/MakeHat") 1222 + func parseTwirpPath(path string) (string, string, string) { 1223 + parts := strings.Split(path, "/") 1224 + if len(parts) < 2 { 1225 + return "", "", "" 1226 + } 1227 + method := parts[len(parts)-1] 1228 + pkgService := parts[len(parts)-2] 1229 + prefix := strings.Join(parts[0:len(parts)-2], "/") 1230 + return prefix, pkgService, method 1231 + } 1232 + 1233 + // getCustomHTTPReqHeaders retrieves a copy of any headers that are set in 1234 + // a context through the twirp.WithHTTPRequestHeaders function. 1235 + // If there are no headers set, or if they have the wrong type, nil is returned. 1236 + func getCustomHTTPReqHeaders(ctx context.Context) http.Header { 1237 + header, ok := twirp.HTTPRequestHeaders(ctx) 1238 + if !ok || header == nil { 1239 + return nil 1240 + } 1241 + copied := make(http.Header) 1242 + for k, vv := range header { 1243 + if vv == nil { 1244 + copied[k] = nil 1245 + continue 1246 + } 1247 + copied[k] = make([]string, len(vv)) 1248 + copy(copied[k], vv) 1249 + } 1250 + return copied 1251 + } 1252 + 1253 + // newRequest makes an http.Request from a client, adding common headers. 1254 + func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) { 1255 + req, err := http.NewRequest("POST", url, reqBody) 1256 + if err != nil { 1257 + return nil, err 1258 + } 1259 + req = req.WithContext(ctx) 1260 + if customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil { 1261 + req.Header = customHeader 1262 + } 1263 + req.Header.Set("Accept", contentType) 1264 + req.Header.Set("Content-Type", contentType) 1265 + req.Header.Set("Twirp-Version", "v8.1.3") 1266 + return req, nil 1267 + } 1268 + 1269 + // JSON serialization for errors 1270 + type twerrJSON struct { 1271 + Code string `json:"code"` 1272 + Msg string `json:"msg"` 1273 + Meta map[string]string `json:"meta,omitempty"` 1274 + } 1275 + 1276 + // marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body. 1277 + // If serialization fails, it will use a descriptive Internal error instead. 1278 + func marshalErrorToJSON(twerr twirp.Error) []byte { 1279 + // make sure that msg is not too large 1280 + msg := twerr.Msg() 1281 + if len(msg) > 1e6 { 1282 + msg = msg[:1e6] 1283 + } 1284 + 1285 + tj := twerrJSON{ 1286 + Code: string(twerr.Code()), 1287 + Msg: msg, 1288 + Meta: twerr.MetaMap(), 1289 + } 1290 + 1291 + buf, err := json.Marshal(&tj) 1292 + if err != nil { 1293 + buf = []byte("{\"type\": \"" + twirp.Internal + "\", \"msg\": \"There was an error but it could not be serialized into JSON\"}") // fallback 1294 + } 1295 + 1296 + return buf 1297 + } 1298 + 1299 + // errorFromResponse builds a twirp.Error from a non-200 HTTP response. 1300 + // If the response has a valid serialized Twirp error, then it's returned. 1301 + // If not, the response status code is used to generate a similar twirp 1302 + // error. See twirpErrorFromIntermediary for more info on intermediary errors. 1303 + func errorFromResponse(resp *http.Response) twirp.Error { 1304 + statusCode := resp.StatusCode 1305 + statusText := http.StatusText(statusCode) 1306 + 1307 + if isHTTPRedirect(statusCode) { 1308 + // Unexpected redirect: it must be an error from an intermediary. 1309 + // Twirp clients don't follow redirects automatically, Twirp only handles 1310 + // POST requests, redirects should only happen on GET and HEAD requests. 1311 + location := resp.Header.Get("Location") 1312 + msg := fmt.Sprintf("unexpected HTTP status code %d %q received, Location=%q", statusCode, statusText, location) 1313 + return twirpErrorFromIntermediary(statusCode, msg, location) 1314 + } 1315 + 1316 + respBodyBytes, err := io.ReadAll(resp.Body) 1317 + if err != nil { 1318 + return wrapInternal(err, "failed to read server error response body") 1319 + } 1320 + 1321 + var tj twerrJSON 1322 + dec := json.NewDecoder(bytes.NewReader(respBodyBytes)) 1323 + dec.DisallowUnknownFields() 1324 + if err := dec.Decode(&tj); err != nil || tj.Code == "" { 1325 + // Invalid JSON response; it must be an error from an intermediary. 1326 + msg := fmt.Sprintf("Error from intermediary with HTTP status code %d %q", statusCode, statusText) 1327 + return twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes)) 1328 + } 1329 + 1330 + errorCode := twirp.ErrorCode(tj.Code) 1331 + if !twirp.IsValidErrorCode(errorCode) { 1332 + msg := "invalid type returned from server error response: " + tj.Code 1333 + return twirp.InternalError(msg).WithMeta("body", string(respBodyBytes)) 1334 + } 1335 + 1336 + twerr := twirp.NewError(errorCode, tj.Msg) 1337 + for k, v := range tj.Meta { 1338 + twerr = twerr.WithMeta(k, v) 1339 + } 1340 + return twerr 1341 + } 1342 + 1343 + // twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors. 1344 + // The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md. 1345 + // Returned twirp Errors have some additional metadata for inspection. 1346 + func twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error { 1347 + var code twirp.ErrorCode 1348 + if isHTTPRedirect(status) { // 3xx 1349 + code = twirp.Internal 1350 + } else { 1351 + switch status { 1352 + case 400: // Bad Request 1353 + code = twirp.Internal 1354 + case 401: // Unauthorized 1355 + code = twirp.Unauthenticated 1356 + case 403: // Forbidden 1357 + code = twirp.PermissionDenied 1358 + case 404: // Not Found 1359 + code = twirp.BadRoute 1360 + case 429: // Too Many Requests 1361 + code = twirp.ResourceExhausted 1362 + case 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout 1363 + code = twirp.Unavailable 1364 + default: // All other codes 1365 + code = twirp.Unknown 1366 + } 1367 + } 1368 + 1369 + twerr := twirp.NewError(code, msg) 1370 + twerr = twerr.WithMeta("http_error_from_intermediary", "true") // to easily know if this error was from intermediary 1371 + twerr = twerr.WithMeta("status_code", strconv.Itoa(status)) 1372 + if isHTTPRedirect(status) { 1373 + twerr = twerr.WithMeta("location", bodyOrLocation) 1374 + } else { 1375 + twerr = twerr.WithMeta("body", bodyOrLocation) 1376 + } 1377 + return twerr 1378 + } 1379 + 1380 + func isHTTPRedirect(status int) bool { 1381 + return status >= 300 && status <= 399 1382 + } 1383 + 1384 + // wrapInternal wraps an error with a prefix as an Internal error. 1385 + // The original error cause is accessible by github.com/pkg/errors.Cause. 1386 + func wrapInternal(err error, prefix string) twirp.Error { 1387 + return twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err}) 1388 + } 1389 + 1390 + type wrappedError struct { 1391 + prefix string 1392 + cause error 1393 + } 1394 + 1395 + func (e *wrappedError) Error() string { return e.prefix + ": " + e.cause.Error() } 1396 + func (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As 1397 + func (e *wrappedError) Cause() error { return e.cause } // for github.com/pkg/errors 1398 + 1399 + // ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal 1400 + // error response (status 500), and error hooks are properly called with the panic wrapped as an error. 1401 + // The panic is re-raised so it can be handled normally with middleware. 1402 + func ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) { 1403 + if r := recover(); r != nil { 1404 + // Wrap the panic as an error so it can be passed to error hooks. 1405 + // The original error is accessible from error hooks, but not visible in the response. 1406 + err := errFromPanic(r) 1407 + twerr := &internalWithCause{msg: "Internal service panic", cause: err} 1408 + // Actually write the error 1409 + writeError(ctx, resp, twerr, hooks) 1410 + // If possible, flush the error to the wire. 1411 + f, ok := resp.(http.Flusher) 1412 + if ok { 1413 + f.Flush() 1414 + } 1415 + 1416 + panic(r) 1417 + } 1418 + } 1419 + 1420 + // errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error. 1421 + func errFromPanic(p interface{}) error { 1422 + if err, ok := p.(error); ok { 1423 + return err 1424 + } 1425 + return fmt.Errorf("panic: %v", p) 1426 + } 1427 + 1428 + // internalWithCause is a Twirp Internal error wrapping an original error cause, 1429 + // but the original error message is not exposed on Msg(). The original error 1430 + // can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap 1431 + type internalWithCause struct { 1432 + msg string 1433 + cause error 1434 + } 1435 + 1436 + func (e *internalWithCause) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As 1437 + func (e *internalWithCause) Cause() error { return e.cause } // for github.com/pkg/errors 1438 + func (e *internalWithCause) Error() string { return e.msg + ": " + e.cause.Error() } 1439 + func (e *internalWithCause) Code() twirp.ErrorCode { return twirp.Internal } 1440 + func (e *internalWithCause) Msg() string { return e.msg } 1441 + func (e *internalWithCause) Meta(key string) string { return "" } 1442 + func (e *internalWithCause) MetaMap() map[string]string { return nil } 1443 + func (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e } 1444 + 1445 + // malformedRequestError is used when the twirp server cannot unmarshal a request 1446 + func malformedRequestError(msg string) twirp.Error { 1447 + return twirp.NewError(twirp.Malformed, msg) 1448 + } 1449 + 1450 + // badRouteError is used when the twirp server cannot route a request 1451 + func badRouteError(msg string, method, url string) twirp.Error { 1452 + err := twirp.NewError(twirp.BadRoute, msg) 1453 + err = err.WithMeta("twirp_invalid_route", method+" "+url) 1454 + return err 1455 + } 1456 + 1457 + // withoutRedirects makes sure that the POST request can not be redirected. 1458 + // The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or 1459 + // 303 response, and also 301s in go1.8. It redirects by making a second request, changing the 1460 + // method to GET and removing the body. This produces very confusing error messages, so instead we 1461 + // set a redirect policy that always errors. This stops Go from executing the redirect. 1462 + // 1463 + // We have to be a little careful in case the user-provided http.Client has its own CheckRedirect 1464 + // policy - if so, we'll run through that policy first. 1465 + // 1466 + // Because this requires modifying the http.Client, we make a new copy of the client and return it. 1467 + func withoutRedirects(in *http.Client) *http.Client { 1468 + copy := *in 1469 + copy.CheckRedirect = func(req *http.Request, via []*http.Request) error { 1470 + if in.CheckRedirect != nil { 1471 + // Run the input's redirect if it exists, in case it has side effects, but ignore any error it 1472 + // returns, since we want to use ErrUseLastResponse. 1473 + err := in.CheckRedirect(req, via) 1474 + _ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use. 1475 + } 1476 + return http.ErrUseLastResponse 1477 + } 1478 + return &copy 1479 + } 1480 + 1481 + // doProtobufRequest makes a Protobuf request to the remote Twirp service. 1482 + func doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) { 1483 + reqBodyBytes, err := proto.Marshal(in) 1484 + if err != nil { 1485 + return ctx, wrapInternal(err, "failed to marshal proto request") 1486 + } 1487 + reqBody := bytes.NewBuffer(reqBodyBytes) 1488 + if err = ctx.Err(); err != nil { 1489 + return ctx, wrapInternal(err, "aborted because context was done") 1490 + } 1491 + 1492 + req, err := newRequest(ctx, url, reqBody, "application/protobuf") 1493 + if err != nil { 1494 + return ctx, wrapInternal(err, "could not build request") 1495 + } 1496 + ctx, err = callClientRequestPrepared(ctx, hooks, req) 1497 + if err != nil { 1498 + return ctx, err 1499 + } 1500 + 1501 + req = req.WithContext(ctx) 1502 + resp, err := client.Do(req) 1503 + if err != nil { 1504 + return ctx, wrapInternal(err, "failed to do request") 1505 + } 1506 + defer func() { _ = resp.Body.Close() }() 1507 + 1508 + if err = ctx.Err(); err != nil { 1509 + return ctx, wrapInternal(err, "aborted because context was done") 1510 + } 1511 + 1512 + if resp.StatusCode != 200 { 1513 + return ctx, errorFromResponse(resp) 1514 + } 1515 + 1516 + respBodyBytes, err := io.ReadAll(resp.Body) 1517 + if err != nil { 1518 + return ctx, wrapInternal(err, "failed to read response body") 1519 + } 1520 + if err = ctx.Err(); err != nil { 1521 + return ctx, wrapInternal(err, "aborted because context was done") 1522 + } 1523 + 1524 + if err = proto.Unmarshal(respBodyBytes, out); err != nil { 1525 + return ctx, wrapInternal(err, "failed to unmarshal proto response") 1526 + } 1527 + return ctx, nil 1528 + } 1529 + 1530 + // doJSONRequest makes a JSON request to the remote Twirp service. 1531 + func doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) { 1532 + marshaler := &protojson.MarshalOptions{UseProtoNames: true} 1533 + reqBytes, err := marshaler.Marshal(in) 1534 + if err != nil { 1535 + return ctx, wrapInternal(err, "failed to marshal json request") 1536 + } 1537 + if err = ctx.Err(); err != nil { 1538 + return ctx, wrapInternal(err, "aborted because context was done") 1539 + } 1540 + 1541 + req, err := newRequest(ctx, url, bytes.NewReader(reqBytes), "application/json") 1542 + if err != nil { 1543 + return ctx, wrapInternal(err, "could not build request") 1544 + } 1545 + ctx, err = callClientRequestPrepared(ctx, hooks, req) 1546 + if err != nil { 1547 + return ctx, err 1548 + } 1549 + 1550 + req = req.WithContext(ctx) 1551 + resp, err := client.Do(req) 1552 + if err != nil { 1553 + return ctx, wrapInternal(err, "failed to do request") 1554 + } 1555 + 1556 + defer func() { 1557 + cerr := resp.Body.Close() 1558 + if err == nil && cerr != nil { 1559 + err = wrapInternal(cerr, "failed to close response body") 1560 + } 1561 + }() 1562 + 1563 + if err = ctx.Err(); err != nil { 1564 + return ctx, wrapInternal(err, "aborted because context was done") 1565 + } 1566 + 1567 + if resp.StatusCode != 200 { 1568 + return ctx, errorFromResponse(resp) 1569 + } 1570 + 1571 + d := json.NewDecoder(resp.Body) 1572 + rawRespBody := json.RawMessage{} 1573 + if err := d.Decode(&rawRespBody); err != nil { 1574 + return ctx, wrapInternal(err, "failed to unmarshal json response") 1575 + } 1576 + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} 1577 + if err = unmarshaler.Unmarshal(rawRespBody, out); err != nil { 1578 + return ctx, wrapInternal(err, "failed to unmarshal json response") 1579 + } 1580 + if err = ctx.Err(); err != nil { 1581 + return ctx, wrapInternal(err, "aborted because context was done") 1582 + } 1583 + return ctx, nil 1584 + } 1585 + 1586 + // Call twirp.ServerHooks.RequestReceived if the hook is available 1587 + func callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) { 1588 + if h == nil || h.RequestReceived == nil { 1589 + return ctx, nil 1590 + } 1591 + return h.RequestReceived(ctx) 1592 + } 1593 + 1594 + // Call twirp.ServerHooks.RequestRouted if the hook is available 1595 + func callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) { 1596 + if h == nil || h.RequestRouted == nil { 1597 + return ctx, nil 1598 + } 1599 + return h.RequestRouted(ctx) 1600 + } 1601 + 1602 + // Call twirp.ServerHooks.ResponsePrepared if the hook is available 1603 + func callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context { 1604 + if h == nil || h.ResponsePrepared == nil { 1605 + return ctx 1606 + } 1607 + return h.ResponsePrepared(ctx) 1608 + } 1609 + 1610 + // Call twirp.ServerHooks.ResponseSent if the hook is available 1611 + func callResponseSent(ctx context.Context, h *twirp.ServerHooks) { 1612 + if h == nil || h.ResponseSent == nil { 1613 + return 1614 + } 1615 + h.ResponseSent(ctx) 1616 + } 1617 + 1618 + // Call twirp.ServerHooks.Error if the hook is available 1619 + func callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context { 1620 + if h == nil || h.Error == nil { 1621 + return ctx 1622 + } 1623 + return h.Error(ctx, err) 1624 + } 1625 + 1626 + func callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) { 1627 + if h == nil || h.ResponseReceived == nil { 1628 + return 1629 + } 1630 + h.ResponseReceived(ctx) 1631 + } 1632 + 1633 + func callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) { 1634 + if h == nil || h.RequestPrepared == nil { 1635 + return ctx, nil 1636 + } 1637 + return h.RequestPrepared(ctx, req) 1638 + } 1639 + 1640 + func callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) { 1641 + if h == nil || h.Error == nil { 1642 + return 1643 + } 1644 + h.Error(ctx, err) 1645 + } 1646 + 1647 + var twirpFileDescriptor0 = []byte{ 1648 + // 539 bytes of a gzipped FileDescriptorProto 1649 + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xd1, 0x8a, 0xd3, 0x40, 1650 + 0x14, 0x86, 0x49, 0xb2, 0xdb, 0xa5, 0x47, 0x10, 0x19, 0xac, 0xc6, 0x78, 0x61, 0xed, 0xd5, 0x5e, 1651 + 0xe8, 0x84, 0x74, 0xf7, 0xc6, 0xec, 0x55, 0xab, 0xa0, 0x94, 0x15, 0x4a, 0x0c, 0x2d, 0x48, 0x41, 1652 + 0x66, 0xd3, 0x63, 0x3b, 0xda, 0x66, 0x6a, 0x73, 0x1a, 0xf7, 0x79, 0x04, 0x6f, 0x7c, 0x04, 0x5f, 1653 + 0x40, 0x11, 0x7c, 0x09, 0x2f, 0x7d, 0x0a, 0x99, 0x49, 0xb2, 0x6d, 0xb5, 0xb2, 0xbd, 0xca, 0xcc, 1654 + 0xc9, 0xf7, 0xff, 0xf3, 0x9f, 0x93, 0x21, 0xd0, 0x24, 0x4c, 0xa6, 0x62, 0xa9, 0x7c, 0x9a, 0x2a, 1655 + 0x9a, 0xfa, 0x62, 0x45, 0x53, 0x3f, 0x0f, 0xcc, 0x93, 0x2f, 0x96, 0x8a, 0x14, 0x6b, 0x94, 0x04, 1656 + 0x37, 0x04, 0x37, 0x6f, 0xf2, 0xc0, 0xbb, 0x7f, 0xb1, 0x7a, 0xeb, 0xe7, 0x62, 0x26, 0xc7, 0x82, 1657 + 0xf0, 0x6a, 0x51, 0x68, 0xbc, 0x07, 0x13, 0xa5, 0x26, 0x33, 0xf4, 0xcd, 0x4e, 0x83, 0x24, 0xe7, 1658 + 0x98, 0x91, 0x98, 0x2f, 0x0a, 0xa0, 0xf5, 0xd9, 0x02, 0xa7, 0x37, 0x8c, 0xd9, 0x4d, 0xb0, 0xe5, 1659 + 0xd8, 0xb5, 0x9a, 0xd6, 0x71, 0x3d, 0xb2, 0xe5, 0x98, 0x3d, 0x01, 0x48, 0x96, 0x28, 0x08, 0xc7, 1660 + 0x6f, 0x04, 0xb9, 0x76, 0xd3, 0x3a, 0xbe, 0xd1, 0xf6, 0x78, 0xe1, 0xc6, 0x2b, 0x37, 0x1e, 0x57, 1661 + 0x6e, 0x51, 0xbd, 0xa4, 0x3b, 0xa4, 0xa5, 0x78, 0xb9, 0x90, 0x4b, 0xcc, 0xb4, 0xd4, 0xb9, 0x5e, 1662 + 0x5a, 0xd2, 0x1d, 0x62, 0x2e, 0x1c, 0x25, 0x6a, 0x3e, 0xc7, 0x94, 0xdc, 0x03, 0x13, 0xa5, 0xda, 1663 + 0xb6, 0x3a, 0xd0, 0xe8, 0x0d, 0xe3, 0x57, 0xb8, 0xcc, 0x65, 0x82, 0xe7, 0x32, 0xa3, 0x08, 0x3f, 1664 + 0xac, 0x30, 0x23, 0x76, 0x1b, 0x0e, 0x13, 0xb5, 0x4a, 0xc9, 0x64, 0x3f, 0x8c, 0x8a, 0x0d, 0x63, 1665 + 0x70, 0xb0, 0x10, 0x13, 0x34, 0xc1, 0x0f, 0x23, 0xb3, 0x6e, 0x9d, 0xc3, 0x9d, 0xbf, 0x2d, 0xb2, 1666 + 0x85, 0x4a, 0x33, 0x64, 0x6d, 0xa8, 0x91, 0x7a, 0x8f, 0x69, 0xe6, 0x5a, 0x4d, 0xc7, 0xa4, 0xdd, 1667 + 0x39, 0x6a, 0xde, 0x1b, 0xc6, 0x51, 0x49, 0xb6, 0xce, 0xe0, 0xee, 0xda, 0xed, 0xa9, 0x69, 0xbe, 1668 + 0x8a, 0xd4, 0x5c, 0x77, 0x61, 0x06, 0xda, 0xad, 0x7d, 0x7d, 0xe1, 0x7c, 0xb7, 0xac, 0x75, 0x37, 1669 + 0x04, 0xee, 0xbf, 0xe2, 0x32, 0xcc, 0x2d, 0x70, 0xde, 0x7d, 0x2c, 0x95, 0x91, 0x5e, 0xb2, 0x53, 1670 + 0x38, 0x2a, 0x47, 0xb4, 0xc7, 0x87, 0xa8, 0x50, 0xe3, 0x43, 0xd2, 0xcc, 0x5f, 0xfb, 0x90, 0x6c, 1671 + 0x9d, 0x6c, 0x46, 0x7e, 0x86, 0x33, 0x5c, 0x47, 0x76, 0x0b, 0x78, 0x3b, 0xae, 0x11, 0x79, 0x9b, 1672 + 0x51, 0x2b, 0x51, 0x11, 0xb5, 0xfd, 0xcd, 0x06, 0x58, 0xbf, 0x64, 0x12, 0x6a, 0x45, 0x2f, 0x8c, 1673 + 0xff, 0x7f, 0x80, 0xbb, 0x26, 0xe6, 0xf9, 0x7b, 0xf3, 0xe5, 0x90, 0x24, 0xd4, 0x8a, 0x2c, 0x7b, 1674 + 0x1c, 0xb5, 0xd5, 0xe9, 0x1e, 0x47, 0x6d, 0x37, 0xc9, 0x12, 0x38, 0xd0, 0x97, 0x85, 0x3d, 0xba, 1675 + 0x56, 0xb8, 0x71, 0x2d, 0xbd, 0xc7, 0x7b, 0xd2, 0xc5, 0x21, 0xdd, 0x9f, 0x16, 0xdc, 0x4b, 0xd4, 1676 + 0x7c, 0xb7, 0xa8, 0x5b, 0xef, 0xac, 0x68, 0xda, 0xd7, 0xdf, 0xba, 0x6f, 0xbd, 0xe6, 0x97, 0x28, 1677 + 0x45, 0xa6, 0x78, 0x8a, 0xe4, 0xe7, 0xa7, 0xfe, 0x04, 0x53, 0x7f, 0xe7, 0xaf, 0xe3, 0x4c, 0x3f, 1678 + 0xf3, 0xe0, 0x93, 0xed, 0xc4, 0x71, 0xe7, 0x8b, 0xdd, 0x88, 0x4b, 0xeb, 0xd8, 0x58, 0x6b, 0x47, 1679 + 0x3e, 0x08, 0x7e, 0x5c, 0xd5, 0x47, 0xa6, 0x3e, 0xd2, 0xf5, 0xd1, 0x20, 0xf8, 0x65, 0x3f, 0xdc, 1680 + 0x59, 0x1f, 0x3d, 0xef, 0x77, 0x5f, 0x22, 0x89, 0xb1, 0x20, 0xf1, 0xdb, 0x76, 0x4b, 0x26, 0x0c, 1681 + 0x0d, 0x14, 0x86, 0x9a, 0x0a, 0xc3, 0x41, 0x70, 0x51, 0x33, 0x37, 0xf3, 0xe4, 0x4f, 0x00, 0x00, 1682 + 0x00, 0xff, 0xff, 0x0a, 0xfc, 0x81, 0x68, 0xd6, 0x04, 0x00, 0x00, 1683 + }
+197
gen/techaro/thoth/auth/v1/auth_grpc.pb.go
··· 1 + // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 + // versions: 3 + // - protoc-gen-go-grpc v1.6.1 4 + // - protoc (unknown) 5 + // source: techaro/thoth/auth/v1/auth.proto 6 + 7 + package authv1 8 + 9 + import ( 10 + context "context" 11 + grpc "google.golang.org/grpc" 12 + codes "google.golang.org/grpc/codes" 13 + status "google.golang.org/grpc/status" 14 + ) 15 + 16 + // This is a compile-time assertion to ensure that this generated file 17 + // is compatible with the grpc package it is being compiled against. 18 + // Requires gRPC-Go v1.64.0 or later. 19 + const _ = grpc.SupportPackageIsVersion9 20 + 21 + const ( 22 + JWTService_Create_FullMethodName = "/techaro.thoth.auth.v1.JWTService/Create" 23 + JWTService_Delete_FullMethodName = "/techaro.thoth.auth.v1.JWTService/Delete" 24 + JWTService_List_FullMethodName = "/techaro.thoth.auth.v1.JWTService/List" 25 + ) 26 + 27 + // JWTServiceClient is the client API for JWTService service. 28 + // 29 + // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 30 + type JWTServiceClient interface { 31 + Create(ctx context.Context, in *JWTServiceCreateRequest, opts ...grpc.CallOption) (*JWTServiceCreateResponse, error) 32 + Delete(ctx context.Context, in *JWTServiceDeleteRequest, opts ...grpc.CallOption) (*JWTServiceDeleteResponse, error) 33 + List(ctx context.Context, in *JWTServiceListRequest, opts ...grpc.CallOption) (*JWTServiceListResponse, error) 34 + } 35 + 36 + type jWTServiceClient struct { 37 + cc grpc.ClientConnInterface 38 + } 39 + 40 + func NewJWTServiceClient(cc grpc.ClientConnInterface) JWTServiceClient { 41 + return &jWTServiceClient{cc} 42 + } 43 + 44 + func (c *jWTServiceClient) Create(ctx context.Context, in *JWTServiceCreateRequest, opts ...grpc.CallOption) (*JWTServiceCreateResponse, error) { 45 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 46 + out := new(JWTServiceCreateResponse) 47 + err := c.cc.Invoke(ctx, JWTService_Create_FullMethodName, in, out, cOpts...) 48 + if err != nil { 49 + return nil, err 50 + } 51 + return out, nil 52 + } 53 + 54 + func (c *jWTServiceClient) Delete(ctx context.Context, in *JWTServiceDeleteRequest, opts ...grpc.CallOption) (*JWTServiceDeleteResponse, error) { 55 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 56 + out := new(JWTServiceDeleteResponse) 57 + err := c.cc.Invoke(ctx, JWTService_Delete_FullMethodName, in, out, cOpts...) 58 + if err != nil { 59 + return nil, err 60 + } 61 + return out, nil 62 + } 63 + 64 + func (c *jWTServiceClient) List(ctx context.Context, in *JWTServiceListRequest, opts ...grpc.CallOption) (*JWTServiceListResponse, error) { 65 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 66 + out := new(JWTServiceListResponse) 67 + err := c.cc.Invoke(ctx, JWTService_List_FullMethodName, in, out, cOpts...) 68 + if err != nil { 69 + return nil, err 70 + } 71 + return out, nil 72 + } 73 + 74 + // JWTServiceServer is the server API for JWTService service. 75 + // All implementations must embed UnimplementedJWTServiceServer 76 + // for forward compatibility. 77 + type JWTServiceServer interface { 78 + Create(context.Context, *JWTServiceCreateRequest) (*JWTServiceCreateResponse, error) 79 + Delete(context.Context, *JWTServiceDeleteRequest) (*JWTServiceDeleteResponse, error) 80 + List(context.Context, *JWTServiceListRequest) (*JWTServiceListResponse, error) 81 + mustEmbedUnimplementedJWTServiceServer() 82 + } 83 + 84 + // UnimplementedJWTServiceServer must be embedded to have 85 + // forward compatible implementations. 86 + // 87 + // NOTE: this should be embedded by value instead of pointer to avoid a nil 88 + // pointer dereference when methods are called. 89 + type UnimplementedJWTServiceServer struct{} 90 + 91 + func (UnimplementedJWTServiceServer) Create(context.Context, *JWTServiceCreateRequest) (*JWTServiceCreateResponse, error) { 92 + return nil, status.Error(codes.Unimplemented, "method Create not implemented") 93 + } 94 + func (UnimplementedJWTServiceServer) Delete(context.Context, *JWTServiceDeleteRequest) (*JWTServiceDeleteResponse, error) { 95 + return nil, status.Error(codes.Unimplemented, "method Delete not implemented") 96 + } 97 + func (UnimplementedJWTServiceServer) List(context.Context, *JWTServiceListRequest) (*JWTServiceListResponse, error) { 98 + return nil, status.Error(codes.Unimplemented, "method List not implemented") 99 + } 100 + func (UnimplementedJWTServiceServer) mustEmbedUnimplementedJWTServiceServer() {} 101 + func (UnimplementedJWTServiceServer) testEmbeddedByValue() {} 102 + 103 + // UnsafeJWTServiceServer may be embedded to opt out of forward compatibility for this service. 104 + // Use of this interface is not recommended, as added methods to JWTServiceServer will 105 + // result in compilation errors. 106 + type UnsafeJWTServiceServer interface { 107 + mustEmbedUnimplementedJWTServiceServer() 108 + } 109 + 110 + func RegisterJWTServiceServer(s grpc.ServiceRegistrar, srv JWTServiceServer) { 111 + // If the following call panics, it indicates UnimplementedJWTServiceServer was 112 + // embedded by pointer and is nil. This will cause panics if an 113 + // unimplemented method is ever invoked, so we test this at initialization 114 + // time to prevent it from happening at runtime later due to I/O. 115 + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { 116 + t.testEmbeddedByValue() 117 + } 118 + s.RegisterService(&JWTService_ServiceDesc, srv) 119 + } 120 + 121 + func _JWTService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 122 + in := new(JWTServiceCreateRequest) 123 + if err := dec(in); err != nil { 124 + return nil, err 125 + } 126 + if interceptor == nil { 127 + return srv.(JWTServiceServer).Create(ctx, in) 128 + } 129 + info := &grpc.UnaryServerInfo{ 130 + Server: srv, 131 + FullMethod: JWTService_Create_FullMethodName, 132 + } 133 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { 134 + return srv.(JWTServiceServer).Create(ctx, req.(*JWTServiceCreateRequest)) 135 + } 136 + return interceptor(ctx, in, info, handler) 137 + } 138 + 139 + func _JWTService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 140 + in := new(JWTServiceDeleteRequest) 141 + if err := dec(in); err != nil { 142 + return nil, err 143 + } 144 + if interceptor == nil { 145 + return srv.(JWTServiceServer).Delete(ctx, in) 146 + } 147 + info := &grpc.UnaryServerInfo{ 148 + Server: srv, 149 + FullMethod: JWTService_Delete_FullMethodName, 150 + } 151 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { 152 + return srv.(JWTServiceServer).Delete(ctx, req.(*JWTServiceDeleteRequest)) 153 + } 154 + return interceptor(ctx, in, info, handler) 155 + } 156 + 157 + func _JWTService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 158 + in := new(JWTServiceListRequest) 159 + if err := dec(in); err != nil { 160 + return nil, err 161 + } 162 + if interceptor == nil { 163 + return srv.(JWTServiceServer).List(ctx, in) 164 + } 165 + info := &grpc.UnaryServerInfo{ 166 + Server: srv, 167 + FullMethod: JWTService_List_FullMethodName, 168 + } 169 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { 170 + return srv.(JWTServiceServer).List(ctx, req.(*JWTServiceListRequest)) 171 + } 172 + return interceptor(ctx, in, info, handler) 173 + } 174 + 175 + // JWTService_ServiceDesc is the grpc.ServiceDesc for JWTService service. 176 + // It's only intended for direct use with grpc.RegisterService, 177 + // and not to be introspected or modified (even as a copy) 178 + var JWTService_ServiceDesc = grpc.ServiceDesc{ 179 + ServiceName: "techaro.thoth.auth.v1.JWTService", 180 + HandlerType: (*JWTServiceServer)(nil), 181 + Methods: []grpc.MethodDesc{ 182 + { 183 + MethodName: "Create", 184 + Handler: _JWTService_Create_Handler, 185 + }, 186 + { 187 + MethodName: "Delete", 188 + Handler: _JWTService_Delete_Handler, 189 + }, 190 + { 191 + MethodName: "List", 192 + Handler: _JWTService_List_Handler, 193 + }, 194 + }, 195 + Streams: []grpc.StreamDesc{}, 196 + Metadata: "techaro/thoth/auth/v1/auth.proto", 197 + }
+130
gen/within/website/x/mi/v1/mi_grpc.pb.go
··· 1 + // This is a subset of github:Xe/x/proto/mi.proto 2 + 3 + // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 4 + // versions: 5 + // - protoc-gen-go-grpc v1.6.1 6 + // - protoc (unknown) 7 + // source: within/website/x/mi/v1/mi.proto 8 + 9 + package miv1 10 + 11 + import ( 12 + context "context" 13 + grpc "google.golang.org/grpc" 14 + codes "google.golang.org/grpc/codes" 15 + status "google.golang.org/grpc/status" 16 + emptypb "google.golang.org/protobuf/types/known/emptypb" 17 + ) 18 + 19 + // This is a compile-time assertion to ensure that this generated file 20 + // is compatible with the grpc package it is being compiled against. 21 + // Requires gRPC-Go v1.64.0 or later. 22 + const _ = grpc.SupportPackageIsVersion9 23 + 24 + const ( 25 + Events_Get_FullMethodName = "/within.website.x.mi.v1.Events/Get" 26 + ) 27 + 28 + // EventsClient is the client API for Events service. 29 + // 30 + // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 31 + // 32 + // Events lets users fetch the current feed of events that Xe will be attending. 33 + type EventsClient interface { 34 + // Get fetches the current feed of upcoming events. 35 + Get(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*EventFeed, error) 36 + } 37 + 38 + type eventsClient struct { 39 + cc grpc.ClientConnInterface 40 + } 41 + 42 + func NewEventsClient(cc grpc.ClientConnInterface) EventsClient { 43 + return &eventsClient{cc} 44 + } 45 + 46 + func (c *eventsClient) Get(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*EventFeed, error) { 47 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 48 + out := new(EventFeed) 49 + err := c.cc.Invoke(ctx, Events_Get_FullMethodName, in, out, cOpts...) 50 + if err != nil { 51 + return nil, err 52 + } 53 + return out, nil 54 + } 55 + 56 + // EventsServer is the server API for Events service. 57 + // All implementations must embed UnimplementedEventsServer 58 + // for forward compatibility. 59 + // 60 + // Events lets users fetch the current feed of events that Xe will be attending. 61 + type EventsServer interface { 62 + // Get fetches the current feed of upcoming events. 63 + Get(context.Context, *emptypb.Empty) (*EventFeed, error) 64 + mustEmbedUnimplementedEventsServer() 65 + } 66 + 67 + // UnimplementedEventsServer must be embedded to have 68 + // forward compatible implementations. 69 + // 70 + // NOTE: this should be embedded by value instead of pointer to avoid a nil 71 + // pointer dereference when methods are called. 72 + type UnimplementedEventsServer struct{} 73 + 74 + func (UnimplementedEventsServer) Get(context.Context, *emptypb.Empty) (*EventFeed, error) { 75 + return nil, status.Error(codes.Unimplemented, "method Get not implemented") 76 + } 77 + func (UnimplementedEventsServer) mustEmbedUnimplementedEventsServer() {} 78 + func (UnimplementedEventsServer) testEmbeddedByValue() {} 79 + 80 + // UnsafeEventsServer may be embedded to opt out of forward compatibility for this service. 81 + // Use of this interface is not recommended, as added methods to EventsServer will 82 + // result in compilation errors. 83 + type UnsafeEventsServer interface { 84 + mustEmbedUnimplementedEventsServer() 85 + } 86 + 87 + func RegisterEventsServer(s grpc.ServiceRegistrar, srv EventsServer) { 88 + // If the following call panics, it indicates UnimplementedEventsServer was 89 + // embedded by pointer and is nil. This will cause panics if an 90 + // unimplemented method is ever invoked, so we test this at initialization 91 + // time to prevent it from happening at runtime later due to I/O. 92 + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { 93 + t.testEmbeddedByValue() 94 + } 95 + s.RegisterService(&Events_ServiceDesc, srv) 96 + } 97 + 98 + func _Events_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 99 + in := new(emptypb.Empty) 100 + if err := dec(in); err != nil { 101 + return nil, err 102 + } 103 + if interceptor == nil { 104 + return srv.(EventsServer).Get(ctx, in) 105 + } 106 + info := &grpc.UnaryServerInfo{ 107 + Server: srv, 108 + FullMethod: Events_Get_FullMethodName, 109 + } 110 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { 111 + return srv.(EventsServer).Get(ctx, req.(*emptypb.Empty)) 112 + } 113 + return interceptor(ctx, in, info, handler) 114 + } 115 + 116 + // Events_ServiceDesc is the grpc.ServiceDesc for Events service. 117 + // It's only intended for direct use with grpc.RegisterService, 118 + // and not to be introspected or modified (even as a copy) 119 + var Events_ServiceDesc = grpc.ServiceDesc{ 120 + ServiceName: "within.website.x.mi.v1.Events", 121 + HandlerType: (*EventsServer)(nil), 122 + Methods: []grpc.MethodDesc{ 123 + { 124 + MethodName: "Get", 125 + Handler: _Events_Get_Handler, 126 + }, 127 + }, 128 + Streams: []grpc.StreamDesc{}, 129 + Metadata: "within/website/x/mi/v1/mi.proto", 130 + }
+69
gen/within/website/x/mimi/announce/v1/announce.pb.go
··· 1 + // Code generated by protoc-gen-go. DO NOT EDIT. 2 + // versions: 3 + // protoc-gen-go v1.36.11 4 + // protoc (unknown) 5 + // source: within/website/x/mimi/announce/v1/announce.proto 6 + 7 + package announcev1 8 + 9 + import ( 10 + protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 + protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 + emptypb "google.golang.org/protobuf/types/known/emptypb" 13 + reflect "reflect" 14 + unsafe "unsafe" 15 + v1 "xeiaso.net/v4/gen/external/protofeed/v1" 16 + ) 17 + 18 + const ( 19 + // Verify that this generated code is sufficiently up-to-date. 20 + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 21 + // Verify that runtime/protoimpl is sufficiently up-to-date. 22 + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 23 + ) 24 + 25 + var File_within_website_x_mimi_announce_v1_announce_proto protoreflect.FileDescriptor 26 + 27 + const file_within_website_x_mimi_announce_v1_announce_proto_rawDesc = "" + 28 + "\n" + 29 + "0within/website/x/mimi/announce/v1/announce.proto\x12!within.website.x.mimi.announce.v1\x1a%external/protofeed/v1/protofeed.proto\x1a\x1bgoogle/protobuf/empty.proto2A\n" + 30 + "\bAnnounce\x125\n" + 31 + "\bAnnounce\x12\x0f.protofeed.Item\x1a\x16.google.protobuf.Empty\"\x00B\xa1\x02\n" + 32 + "%com.within.website.x.mimi.announce.v1B\rAnnounceProtoP\x01Z>xeiaso.net/v4/gen/within/website/x/mimi/announce/v1;announcev1\xa2\x02\x05WWXMA\xaa\x02!Within.Website.X.Mimi.Announce.V1\xca\x02!Within\\Website\\X\\Mimi\\Announce\\V1\xe2\x02-Within\\Website\\X\\Mimi\\Announce\\V1\\GPBMetadata\xea\x02&Within::Website::X::Mimi::Announce::V1b\x06proto3" 33 + 34 + var file_within_website_x_mimi_announce_v1_announce_proto_goTypes = []any{ 35 + (*v1.Item)(nil), // 0: protofeed.Item 36 + (*emptypb.Empty)(nil), // 1: google.protobuf.Empty 37 + } 38 + var file_within_website_x_mimi_announce_v1_announce_proto_depIdxs = []int32{ 39 + 0, // 0: within.website.x.mimi.announce.v1.Announce.Announce:input_type -> protofeed.Item 40 + 1, // 1: within.website.x.mimi.announce.v1.Announce.Announce:output_type -> google.protobuf.Empty 41 + 1, // [1:2] is the sub-list for method output_type 42 + 0, // [0:1] is the sub-list for method input_type 43 + 0, // [0:0] is the sub-list for extension type_name 44 + 0, // [0:0] is the sub-list for extension extendee 45 + 0, // [0:0] is the sub-list for field type_name 46 + } 47 + 48 + func init() { file_within_website_x_mimi_announce_v1_announce_proto_init() } 49 + func file_within_website_x_mimi_announce_v1_announce_proto_init() { 50 + if File_within_website_x_mimi_announce_v1_announce_proto != nil { 51 + return 52 + } 53 + type x struct{} 54 + out := protoimpl.TypeBuilder{ 55 + File: protoimpl.DescBuilder{ 56 + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 57 + RawDescriptor: unsafe.Slice(unsafe.StringData(file_within_website_x_mimi_announce_v1_announce_proto_rawDesc), len(file_within_website_x_mimi_announce_v1_announce_proto_rawDesc)), 58 + NumEnums: 0, 59 + NumMessages: 0, 60 + NumExtensions: 0, 61 + NumServices: 1, 62 + }, 63 + GoTypes: file_within_website_x_mimi_announce_v1_announce_proto_goTypes, 64 + DependencyIndexes: file_within_website_x_mimi_announce_v1_announce_proto_depIdxs, 65 + }.Build() 66 + File_within_website_x_mimi_announce_v1_announce_proto = out.File 67 + file_within_website_x_mimi_announce_v1_announce_proto_goTypes = nil 68 + file_within_website_x_mimi_announce_v1_announce_proto_depIdxs = nil 69 + }
+123
gen/within/website/x/mimi/announce/v1/announce_grpc.pb.go
··· 1 + // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 + // versions: 3 + // - protoc-gen-go-grpc v1.6.1 4 + // - protoc (unknown) 5 + // source: within/website/x/mimi/announce/v1/announce.proto 6 + 7 + package announcev1 8 + 9 + import ( 10 + context "context" 11 + grpc "google.golang.org/grpc" 12 + codes "google.golang.org/grpc/codes" 13 + status "google.golang.org/grpc/status" 14 + emptypb "google.golang.org/protobuf/types/known/emptypb" 15 + v1 "xeiaso.net/v4/gen/external/protofeed/v1" 16 + ) 17 + 18 + // This is a compile-time assertion to ensure that this generated file 19 + // is compatible with the grpc package it is being compiled against. 20 + // Requires gRPC-Go v1.64.0 or later. 21 + const _ = grpc.SupportPackageIsVersion9 22 + 23 + const ( 24 + Announce_Announce_FullMethodName = "/within.website.x.mimi.announce.v1.Announce/Announce" 25 + ) 26 + 27 + // AnnounceClient is the client API for Announce service. 28 + // 29 + // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 30 + type AnnounceClient interface { 31 + Announce(ctx context.Context, in *v1.Item, opts ...grpc.CallOption) (*emptypb.Empty, error) 32 + } 33 + 34 + type announceClient struct { 35 + cc grpc.ClientConnInterface 36 + } 37 + 38 + func NewAnnounceClient(cc grpc.ClientConnInterface) AnnounceClient { 39 + return &announceClient{cc} 40 + } 41 + 42 + func (c *announceClient) Announce(ctx context.Context, in *v1.Item, opts ...grpc.CallOption) (*emptypb.Empty, error) { 43 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 44 + out := new(emptypb.Empty) 45 + err := c.cc.Invoke(ctx, Announce_Announce_FullMethodName, in, out, cOpts...) 46 + if err != nil { 47 + return nil, err 48 + } 49 + return out, nil 50 + } 51 + 52 + // AnnounceServer is the server API for Announce service. 53 + // All implementations must embed UnimplementedAnnounceServer 54 + // for forward compatibility. 55 + type AnnounceServer interface { 56 + Announce(context.Context, *v1.Item) (*emptypb.Empty, error) 57 + mustEmbedUnimplementedAnnounceServer() 58 + } 59 + 60 + // UnimplementedAnnounceServer must be embedded to have 61 + // forward compatible implementations. 62 + // 63 + // NOTE: this should be embedded by value instead of pointer to avoid a nil 64 + // pointer dereference when methods are called. 65 + type UnimplementedAnnounceServer struct{} 66 + 67 + func (UnimplementedAnnounceServer) Announce(context.Context, *v1.Item) (*emptypb.Empty, error) { 68 + return nil, status.Error(codes.Unimplemented, "method Announce not implemented") 69 + } 70 + func (UnimplementedAnnounceServer) mustEmbedUnimplementedAnnounceServer() {} 71 + func (UnimplementedAnnounceServer) testEmbeddedByValue() {} 72 + 73 + // UnsafeAnnounceServer may be embedded to opt out of forward compatibility for this service. 74 + // Use of this interface is not recommended, as added methods to AnnounceServer will 75 + // result in compilation errors. 76 + type UnsafeAnnounceServer interface { 77 + mustEmbedUnimplementedAnnounceServer() 78 + } 79 + 80 + func RegisterAnnounceServer(s grpc.ServiceRegistrar, srv AnnounceServer) { 81 + // If the following call panics, it indicates UnimplementedAnnounceServer was 82 + // embedded by pointer and is nil. This will cause panics if an 83 + // unimplemented method is ever invoked, so we test this at initialization 84 + // time to prevent it from happening at runtime later due to I/O. 85 + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { 86 + t.testEmbeddedByValue() 87 + } 88 + s.RegisterService(&Announce_ServiceDesc, srv) 89 + } 90 + 91 + func _Announce_Announce_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 92 + in := new(v1.Item) 93 + if err := dec(in); err != nil { 94 + return nil, err 95 + } 96 + if interceptor == nil { 97 + return srv.(AnnounceServer).Announce(ctx, in) 98 + } 99 + info := &grpc.UnaryServerInfo{ 100 + Server: srv, 101 + FullMethod: Announce_Announce_FullMethodName, 102 + } 103 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { 104 + return srv.(AnnounceServer).Announce(ctx, req.(*v1.Item)) 105 + } 106 + return interceptor(ctx, in, info, handler) 107 + } 108 + 109 + // Announce_ServiceDesc is the grpc.ServiceDesc for Announce service. 110 + // It's only intended for direct use with grpc.RegisterService, 111 + // and not to be introspected or modified (even as a copy) 112 + var Announce_ServiceDesc = grpc.ServiceDesc{ 113 + ServiceName: "within.website.x.mimi.announce.v1.Announce", 114 + HandlerType: (*AnnounceServer)(nil), 115 + Methods: []grpc.MethodDesc{ 116 + { 117 + MethodName: "Announce", 118 + Handler: _Announce_Announce_Handler, 119 + }, 120 + }, 121 + Streams: []grpc.StreamDesc{}, 122 + Metadata: "within/website/x/mimi/announce/v1/announce.proto", 123 + }
+345
gen/xeiaso/net/admin/v1/admin.pb.go
··· 1 + // Code generated by protoc-gen-go. DO NOT EDIT. 2 + // versions: 3 + // protoc-gen-go v1.36.11 4 + // protoc (unknown) 5 + // source: xeiaso/net/admin/v1/admin.proto 6 + 7 + package adminv1 8 + 9 + import ( 10 + protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 + protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 + timestamppb "google.golang.org/protobuf/types/known/timestamppb" 13 + reflect "reflect" 14 + sync "sync" 15 + unsafe "unsafe" 16 + v1 "xeiaso.net/v4/gen/xeiaso/net/v1" 17 + ) 18 + 19 + const ( 20 + // Verify that this generated code is sufficiently up-to-date. 21 + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 22 + // Verify that runtime/protoimpl is sufficiently up-to-date. 23 + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 24 + ) 25 + 26 + // GetTokenRequest is the request for PatreonService.GetToken. 27 + type GetTokenRequest struct { 28 + state protoimpl.MessageState `protogen:"open.v1"` 29 + unknownFields protoimpl.UnknownFields 30 + sizeCache protoimpl.SizeCache 31 + } 32 + 33 + func (x *GetTokenRequest) Reset() { 34 + *x = GetTokenRequest{} 35 + mi := &file_xeiaso_net_admin_v1_admin_proto_msgTypes[0] 36 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 37 + ms.StoreMessageInfo(mi) 38 + } 39 + 40 + func (x *GetTokenRequest) String() string { 41 + return protoimpl.X.MessageStringOf(x) 42 + } 43 + 44 + func (*GetTokenRequest) ProtoMessage() {} 45 + 46 + func (x *GetTokenRequest) ProtoReflect() protoreflect.Message { 47 + mi := &file_xeiaso_net_admin_v1_admin_proto_msgTypes[0] 48 + if x != nil { 49 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 50 + if ms.LoadMessageInfo() == nil { 51 + ms.StoreMessageInfo(mi) 52 + } 53 + return ms 54 + } 55 + return mi.MessageOf(x) 56 + } 57 + 58 + // Deprecated: Use GetTokenRequest.ProtoReflect.Descriptor instead. 59 + func (*GetTokenRequest) Descriptor() ([]byte, []int) { 60 + return file_xeiaso_net_admin_v1_admin_proto_rawDescGZIP(), []int{0} 61 + } 62 + 63 + // GetTokenResponse is the response for PatreonService.GetToken. 64 + type GetTokenResponse struct { 65 + state protoimpl.MessageState `protogen:"open.v1"` 66 + // The Patreon OAuth token. 67 + Token *PatreonToken `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` 68 + unknownFields protoimpl.UnknownFields 69 + sizeCache protoimpl.SizeCache 70 + } 71 + 72 + func (x *GetTokenResponse) Reset() { 73 + *x = GetTokenResponse{} 74 + mi := &file_xeiaso_net_admin_v1_admin_proto_msgTypes[1] 75 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 76 + ms.StoreMessageInfo(mi) 77 + } 78 + 79 + func (x *GetTokenResponse) String() string { 80 + return protoimpl.X.MessageStringOf(x) 81 + } 82 + 83 + func (*GetTokenResponse) ProtoMessage() {} 84 + 85 + func (x *GetTokenResponse) ProtoReflect() protoreflect.Message { 86 + mi := &file_xeiaso_net_admin_v1_admin_proto_msgTypes[1] 87 + if x != nil { 88 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 89 + if ms.LoadMessageInfo() == nil { 90 + ms.StoreMessageInfo(mi) 91 + } 92 + return ms 93 + } 94 + return mi.MessageOf(x) 95 + } 96 + 97 + // Deprecated: Use GetTokenResponse.ProtoReflect.Descriptor instead. 98 + func (*GetTokenResponse) Descriptor() ([]byte, []int) { 99 + return file_xeiaso_net_admin_v1_admin_proto_rawDescGZIP(), []int{1} 100 + } 101 + 102 + func (x *GetTokenResponse) GetToken() *PatreonToken { 103 + if x != nil { 104 + return x.Token 105 + } 106 + return nil 107 + } 108 + 109 + // PatreonToken contains a Patreon OAuth token. 110 + type PatreonToken struct { 111 + state protoimpl.MessageState `protogen:"open.v1"` 112 + AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` 113 + TokenType string `protobuf:"bytes,2,opt,name=token_type,json=tokenType,proto3" json:"token_type,omitempty"` 114 + RefreshToken string `protobuf:"bytes,3,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"` 115 + Expiry *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expiry,proto3" json:"expiry,omitempty"` 116 + unknownFields protoimpl.UnknownFields 117 + sizeCache protoimpl.SizeCache 118 + } 119 + 120 + func (x *PatreonToken) Reset() { 121 + *x = PatreonToken{} 122 + mi := &file_xeiaso_net_admin_v1_admin_proto_msgTypes[2] 123 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 124 + ms.StoreMessageInfo(mi) 125 + } 126 + 127 + func (x *PatreonToken) String() string { 128 + return protoimpl.X.MessageStringOf(x) 129 + } 130 + 131 + func (*PatreonToken) ProtoMessage() {} 132 + 133 + func (x *PatreonToken) ProtoReflect() protoreflect.Message { 134 + mi := &file_xeiaso_net_admin_v1_admin_proto_msgTypes[2] 135 + if x != nil { 136 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 137 + if ms.LoadMessageInfo() == nil { 138 + ms.StoreMessageInfo(mi) 139 + } 140 + return ms 141 + } 142 + return mi.MessageOf(x) 143 + } 144 + 145 + // Deprecated: Use PatreonToken.ProtoReflect.Descriptor instead. 146 + func (*PatreonToken) Descriptor() ([]byte, []int) { 147 + return file_xeiaso_net_admin_v1_admin_proto_rawDescGZIP(), []int{2} 148 + } 149 + 150 + func (x *PatreonToken) GetAccessToken() string { 151 + if x != nil { 152 + return x.AccessToken 153 + } 154 + return "" 155 + } 156 + 157 + func (x *PatreonToken) GetTokenType() string { 158 + if x != nil { 159 + return x.TokenType 160 + } 161 + return "" 162 + } 163 + 164 + func (x *PatreonToken) GetRefreshToken() string { 165 + if x != nil { 166 + return x.RefreshToken 167 + } 168 + return "" 169 + } 170 + 171 + func (x *PatreonToken) GetExpiry() *timestamppb.Timestamp { 172 + if x != nil { 173 + return x.Expiry 174 + } 175 + return nil 176 + } 177 + 178 + // RebuildRequest is the request for AdminService.Rebuild. 179 + type RebuildRequest struct { 180 + state protoimpl.MessageState `protogen:"open.v1"` 181 + unknownFields protoimpl.UnknownFields 182 + sizeCache protoimpl.SizeCache 183 + } 184 + 185 + func (x *RebuildRequest) Reset() { 186 + *x = RebuildRequest{} 187 + mi := &file_xeiaso_net_admin_v1_admin_proto_msgTypes[3] 188 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 189 + ms.StoreMessageInfo(mi) 190 + } 191 + 192 + func (x *RebuildRequest) String() string { 193 + return protoimpl.X.MessageStringOf(x) 194 + } 195 + 196 + func (*RebuildRequest) ProtoMessage() {} 197 + 198 + func (x *RebuildRequest) ProtoReflect() protoreflect.Message { 199 + mi := &file_xeiaso_net_admin_v1_admin_proto_msgTypes[3] 200 + if x != nil { 201 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 202 + if ms.LoadMessageInfo() == nil { 203 + ms.StoreMessageInfo(mi) 204 + } 205 + return ms 206 + } 207 + return mi.MessageOf(x) 208 + } 209 + 210 + // Deprecated: Use RebuildRequest.ProtoReflect.Descriptor instead. 211 + func (*RebuildRequest) Descriptor() ([]byte, []int) { 212 + return file_xeiaso_net_admin_v1_admin_proto_rawDescGZIP(), []int{3} 213 + } 214 + 215 + // RebuildResponse is the response for AdminService.Rebuild. 216 + type RebuildResponse struct { 217 + state protoimpl.MessageState `protogen:"open.v1"` 218 + // The build info of the rebuilt site. 219 + BuildInfo *v1.BuildInfo `protobuf:"bytes,1,opt,name=build_info,json=buildInfo,proto3" json:"build_info,omitempty"` 220 + unknownFields protoimpl.UnknownFields 221 + sizeCache protoimpl.SizeCache 222 + } 223 + 224 + func (x *RebuildResponse) Reset() { 225 + *x = RebuildResponse{} 226 + mi := &file_xeiaso_net_admin_v1_admin_proto_msgTypes[4] 227 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 228 + ms.StoreMessageInfo(mi) 229 + } 230 + 231 + func (x *RebuildResponse) String() string { 232 + return protoimpl.X.MessageStringOf(x) 233 + } 234 + 235 + func (*RebuildResponse) ProtoMessage() {} 236 + 237 + func (x *RebuildResponse) ProtoReflect() protoreflect.Message { 238 + mi := &file_xeiaso_net_admin_v1_admin_proto_msgTypes[4] 239 + if x != nil { 240 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 241 + if ms.LoadMessageInfo() == nil { 242 + ms.StoreMessageInfo(mi) 243 + } 244 + return ms 245 + } 246 + return mi.MessageOf(x) 247 + } 248 + 249 + // Deprecated: Use RebuildResponse.ProtoReflect.Descriptor instead. 250 + func (*RebuildResponse) Descriptor() ([]byte, []int) { 251 + return file_xeiaso_net_admin_v1_admin_proto_rawDescGZIP(), []int{4} 252 + } 253 + 254 + func (x *RebuildResponse) GetBuildInfo() *v1.BuildInfo { 255 + if x != nil { 256 + return x.BuildInfo 257 + } 258 + return nil 259 + } 260 + 261 + var File_xeiaso_net_admin_v1_admin_proto protoreflect.FileDescriptor 262 + 263 + const file_xeiaso_net_admin_v1_admin_proto_rawDesc = "" + 264 + "\n" + 265 + "\x1fxeiaso/net/admin/v1/admin.proto\x12\x13xeiaso.net.admin.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1axeiaso/net/v1/xesite.proto\"\x11\n" + 266 + "\x0fGetTokenRequest\"K\n" + 267 + "\x10GetTokenResponse\x127\n" + 268 + "\x05token\x18\x01 \x01(\v2!.xeiaso.net.admin.v1.PatreonTokenR\x05token\"\xa9\x01\n" + 269 + "\fPatreonToken\x12!\n" + 270 + "\faccess_token\x18\x01 \x01(\tR\vaccessToken\x12\x1d\n" + 271 + "\n" + 272 + "token_type\x18\x02 \x01(\tR\ttokenType\x12#\n" + 273 + "\rrefresh_token\x18\x03 \x01(\tR\frefreshToken\x122\n" + 274 + "\x06expiry\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\x06expiry\"\x10\n" + 275 + "\x0eRebuildRequest\"J\n" + 276 + "\x0fRebuildResponse\x127\n" + 277 + "\n" + 278 + "build_info\x18\x01 \x01(\v2\x18.xeiaso.net.v1.BuildInfoR\tbuildInfo2i\n" + 279 + "\x0ePatreonService\x12W\n" + 280 + "\bGetToken\x12$.xeiaso.net.admin.v1.GetTokenRequest\x1a%.xeiaso.net.admin.v1.GetTokenResponse2d\n" + 281 + "\fAdminService\x12T\n" + 282 + "\aRebuild\x12#.xeiaso.net.admin.v1.RebuildRequest\x1a$.xeiaso.net.admin.v1.RebuildResponseB\xc3\x01\n" + 283 + "\x17com.xeiaso.net.admin.v1B\n" + 284 + "AdminProtoP\x01Z-xeiaso.net/v4/gen/xeiaso/net/admin/v1;adminv1\xa2\x02\x03XNA\xaa\x02\x13Xeiaso.Net.Admin.V1\xca\x02\x13Xeiaso\\Net\\Admin\\V1\xe2\x02\x1fXeiaso\\Net\\Admin\\V1\\GPBMetadata\xea\x02\x16Xeiaso::Net::Admin::V1b\x06proto3" 285 + 286 + var ( 287 + file_xeiaso_net_admin_v1_admin_proto_rawDescOnce sync.Once 288 + file_xeiaso_net_admin_v1_admin_proto_rawDescData []byte 289 + ) 290 + 291 + func file_xeiaso_net_admin_v1_admin_proto_rawDescGZIP() []byte { 292 + file_xeiaso_net_admin_v1_admin_proto_rawDescOnce.Do(func() { 293 + file_xeiaso_net_admin_v1_admin_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_xeiaso_net_admin_v1_admin_proto_rawDesc), len(file_xeiaso_net_admin_v1_admin_proto_rawDesc))) 294 + }) 295 + return file_xeiaso_net_admin_v1_admin_proto_rawDescData 296 + } 297 + 298 + var file_xeiaso_net_admin_v1_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 5) 299 + var file_xeiaso_net_admin_v1_admin_proto_goTypes = []any{ 300 + (*GetTokenRequest)(nil), // 0: xeiaso.net.admin.v1.GetTokenRequest 301 + (*GetTokenResponse)(nil), // 1: xeiaso.net.admin.v1.GetTokenResponse 302 + (*PatreonToken)(nil), // 2: xeiaso.net.admin.v1.PatreonToken 303 + (*RebuildRequest)(nil), // 3: xeiaso.net.admin.v1.RebuildRequest 304 + (*RebuildResponse)(nil), // 4: xeiaso.net.admin.v1.RebuildResponse 305 + (*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp 306 + (*v1.BuildInfo)(nil), // 6: xeiaso.net.v1.BuildInfo 307 + } 308 + var file_xeiaso_net_admin_v1_admin_proto_depIdxs = []int32{ 309 + 2, // 0: xeiaso.net.admin.v1.GetTokenResponse.token:type_name -> xeiaso.net.admin.v1.PatreonToken 310 + 5, // 1: xeiaso.net.admin.v1.PatreonToken.expiry:type_name -> google.protobuf.Timestamp 311 + 6, // 2: xeiaso.net.admin.v1.RebuildResponse.build_info:type_name -> xeiaso.net.v1.BuildInfo 312 + 0, // 3: xeiaso.net.admin.v1.PatreonService.GetToken:input_type -> xeiaso.net.admin.v1.GetTokenRequest 313 + 3, // 4: xeiaso.net.admin.v1.AdminService.Rebuild:input_type -> xeiaso.net.admin.v1.RebuildRequest 314 + 1, // 5: xeiaso.net.admin.v1.PatreonService.GetToken:output_type -> xeiaso.net.admin.v1.GetTokenResponse 315 + 4, // 6: xeiaso.net.admin.v1.AdminService.Rebuild:output_type -> xeiaso.net.admin.v1.RebuildResponse 316 + 5, // [5:7] is the sub-list for method output_type 317 + 3, // [3:5] is the sub-list for method input_type 318 + 3, // [3:3] is the sub-list for extension type_name 319 + 3, // [3:3] is the sub-list for extension extendee 320 + 0, // [0:3] is the sub-list for field type_name 321 + } 322 + 323 + func init() { file_xeiaso_net_admin_v1_admin_proto_init() } 324 + func file_xeiaso_net_admin_v1_admin_proto_init() { 325 + if File_xeiaso_net_admin_v1_admin_proto != nil { 326 + return 327 + } 328 + type x struct{} 329 + out := protoimpl.TypeBuilder{ 330 + File: protoimpl.DescBuilder{ 331 + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 332 + RawDescriptor: unsafe.Slice(unsafe.StringData(file_xeiaso_net_admin_v1_admin_proto_rawDesc), len(file_xeiaso_net_admin_v1_admin_proto_rawDesc)), 333 + NumEnums: 0, 334 + NumMessages: 5, 335 + NumExtensions: 0, 336 + NumServices: 2, 337 + }, 338 + GoTypes: file_xeiaso_net_admin_v1_admin_proto_goTypes, 339 + DependencyIndexes: file_xeiaso_net_admin_v1_admin_proto_depIdxs, 340 + MessageInfos: file_xeiaso_net_admin_v1_admin_proto_msgTypes, 341 + }.Build() 342 + File_xeiaso_net_admin_v1_admin_proto = out.File 343 + file_xeiaso_net_admin_v1_admin_proto_goTypes = nil 344 + file_xeiaso_net_admin_v1_admin_proto_depIdxs = nil 345 + }
+235
gen/xeiaso/net/admin/v1/admin_grpc.pb.go
··· 1 + // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 + // versions: 3 + // - protoc-gen-go-grpc v1.6.1 4 + // - protoc (unknown) 5 + // source: xeiaso/net/admin/v1/admin.proto 6 + 7 + package adminv1 8 + 9 + import ( 10 + context "context" 11 + grpc "google.golang.org/grpc" 12 + codes "google.golang.org/grpc/codes" 13 + status "google.golang.org/grpc/status" 14 + ) 15 + 16 + // This is a compile-time assertion to ensure that this generated file 17 + // is compatible with the grpc package it is being compiled against. 18 + // Requires gRPC-Go v1.64.0 or later. 19 + const _ = grpc.SupportPackageIsVersion9 20 + 21 + const ( 22 + PatreonService_GetToken_FullMethodName = "/xeiaso.net.admin.v1.PatreonService/GetToken" 23 + ) 24 + 25 + // PatreonServiceClient is the client API for PatreonService service. 26 + // 27 + // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 28 + // 29 + // PatreonService provides access to Patreon OAuth tokens. 30 + type PatreonServiceClient interface { 31 + // GetToken returns the current Patreon OAuth token. 32 + GetToken(ctx context.Context, in *GetTokenRequest, opts ...grpc.CallOption) (*GetTokenResponse, error) 33 + } 34 + 35 + type patreonServiceClient struct { 36 + cc grpc.ClientConnInterface 37 + } 38 + 39 + func NewPatreonServiceClient(cc grpc.ClientConnInterface) PatreonServiceClient { 40 + return &patreonServiceClient{cc} 41 + } 42 + 43 + func (c *patreonServiceClient) GetToken(ctx context.Context, in *GetTokenRequest, opts ...grpc.CallOption) (*GetTokenResponse, error) { 44 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 45 + out := new(GetTokenResponse) 46 + err := c.cc.Invoke(ctx, PatreonService_GetToken_FullMethodName, in, out, cOpts...) 47 + if err != nil { 48 + return nil, err 49 + } 50 + return out, nil 51 + } 52 + 53 + // PatreonServiceServer is the server API for PatreonService service. 54 + // All implementations must embed UnimplementedPatreonServiceServer 55 + // for forward compatibility. 56 + // 57 + // PatreonService provides access to Patreon OAuth tokens. 58 + type PatreonServiceServer interface { 59 + // GetToken returns the current Patreon OAuth token. 60 + GetToken(context.Context, *GetTokenRequest) (*GetTokenResponse, error) 61 + mustEmbedUnimplementedPatreonServiceServer() 62 + } 63 + 64 + // UnimplementedPatreonServiceServer must be embedded to have 65 + // forward compatible implementations. 66 + // 67 + // NOTE: this should be embedded by value instead of pointer to avoid a nil 68 + // pointer dereference when methods are called. 69 + type UnimplementedPatreonServiceServer struct{} 70 + 71 + func (UnimplementedPatreonServiceServer) GetToken(context.Context, *GetTokenRequest) (*GetTokenResponse, error) { 72 + return nil, status.Error(codes.Unimplemented, "method GetToken not implemented") 73 + } 74 + func (UnimplementedPatreonServiceServer) mustEmbedUnimplementedPatreonServiceServer() {} 75 + func (UnimplementedPatreonServiceServer) testEmbeddedByValue() {} 76 + 77 + // UnsafePatreonServiceServer may be embedded to opt out of forward compatibility for this service. 78 + // Use of this interface is not recommended, as added methods to PatreonServiceServer will 79 + // result in compilation errors. 80 + type UnsafePatreonServiceServer interface { 81 + mustEmbedUnimplementedPatreonServiceServer() 82 + } 83 + 84 + func RegisterPatreonServiceServer(s grpc.ServiceRegistrar, srv PatreonServiceServer) { 85 + // If the following call panics, it indicates UnimplementedPatreonServiceServer was 86 + // embedded by pointer and is nil. This will cause panics if an 87 + // unimplemented method is ever invoked, so we test this at initialization 88 + // time to prevent it from happening at runtime later due to I/O. 89 + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { 90 + t.testEmbeddedByValue() 91 + } 92 + s.RegisterService(&PatreonService_ServiceDesc, srv) 93 + } 94 + 95 + func _PatreonService_GetToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 96 + in := new(GetTokenRequest) 97 + if err := dec(in); err != nil { 98 + return nil, err 99 + } 100 + if interceptor == nil { 101 + return srv.(PatreonServiceServer).GetToken(ctx, in) 102 + } 103 + info := &grpc.UnaryServerInfo{ 104 + Server: srv, 105 + FullMethod: PatreonService_GetToken_FullMethodName, 106 + } 107 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { 108 + return srv.(PatreonServiceServer).GetToken(ctx, req.(*GetTokenRequest)) 109 + } 110 + return interceptor(ctx, in, info, handler) 111 + } 112 + 113 + // PatreonService_ServiceDesc is the grpc.ServiceDesc for PatreonService service. 114 + // It's only intended for direct use with grpc.RegisterService, 115 + // and not to be introspected or modified (even as a copy) 116 + var PatreonService_ServiceDesc = grpc.ServiceDesc{ 117 + ServiceName: "xeiaso.net.admin.v1.PatreonService", 118 + HandlerType: (*PatreonServiceServer)(nil), 119 + Methods: []grpc.MethodDesc{ 120 + { 121 + MethodName: "GetToken", 122 + Handler: _PatreonService_GetToken_Handler, 123 + }, 124 + }, 125 + Streams: []grpc.StreamDesc{}, 126 + Metadata: "xeiaso/net/admin/v1/admin.proto", 127 + } 128 + 129 + const ( 130 + AdminService_Rebuild_FullMethodName = "/xeiaso.net.admin.v1.AdminService/Rebuild" 131 + ) 132 + 133 + // AdminServiceClient is the client API for AdminService service. 134 + // 135 + // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 136 + // 137 + // AdminService provides administrative operations. 138 + type AdminServiceClient interface { 139 + // Rebuild triggers a site rebuild. 140 + Rebuild(ctx context.Context, in *RebuildRequest, opts ...grpc.CallOption) (*RebuildResponse, error) 141 + } 142 + 143 + type adminServiceClient struct { 144 + cc grpc.ClientConnInterface 145 + } 146 + 147 + func NewAdminServiceClient(cc grpc.ClientConnInterface) AdminServiceClient { 148 + return &adminServiceClient{cc} 149 + } 150 + 151 + func (c *adminServiceClient) Rebuild(ctx context.Context, in *RebuildRequest, opts ...grpc.CallOption) (*RebuildResponse, error) { 152 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 153 + out := new(RebuildResponse) 154 + err := c.cc.Invoke(ctx, AdminService_Rebuild_FullMethodName, in, out, cOpts...) 155 + if err != nil { 156 + return nil, err 157 + } 158 + return out, nil 159 + } 160 + 161 + // AdminServiceServer is the server API for AdminService service. 162 + // All implementations must embed UnimplementedAdminServiceServer 163 + // for forward compatibility. 164 + // 165 + // AdminService provides administrative operations. 166 + type AdminServiceServer interface { 167 + // Rebuild triggers a site rebuild. 168 + Rebuild(context.Context, *RebuildRequest) (*RebuildResponse, error) 169 + mustEmbedUnimplementedAdminServiceServer() 170 + } 171 + 172 + // UnimplementedAdminServiceServer must be embedded to have 173 + // forward compatible implementations. 174 + // 175 + // NOTE: this should be embedded by value instead of pointer to avoid a nil 176 + // pointer dereference when methods are called. 177 + type UnimplementedAdminServiceServer struct{} 178 + 179 + func (UnimplementedAdminServiceServer) Rebuild(context.Context, *RebuildRequest) (*RebuildResponse, error) { 180 + return nil, status.Error(codes.Unimplemented, "method Rebuild not implemented") 181 + } 182 + func (UnimplementedAdminServiceServer) mustEmbedUnimplementedAdminServiceServer() {} 183 + func (UnimplementedAdminServiceServer) testEmbeddedByValue() {} 184 + 185 + // UnsafeAdminServiceServer may be embedded to opt out of forward compatibility for this service. 186 + // Use of this interface is not recommended, as added methods to AdminServiceServer will 187 + // result in compilation errors. 188 + type UnsafeAdminServiceServer interface { 189 + mustEmbedUnimplementedAdminServiceServer() 190 + } 191 + 192 + func RegisterAdminServiceServer(s grpc.ServiceRegistrar, srv AdminServiceServer) { 193 + // If the following call panics, it indicates UnimplementedAdminServiceServer was 194 + // embedded by pointer and is nil. This will cause panics if an 195 + // unimplemented method is ever invoked, so we test this at initialization 196 + // time to prevent it from happening at runtime later due to I/O. 197 + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { 198 + t.testEmbeddedByValue() 199 + } 200 + s.RegisterService(&AdminService_ServiceDesc, srv) 201 + } 202 + 203 + func _AdminService_Rebuild_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 204 + in := new(RebuildRequest) 205 + if err := dec(in); err != nil { 206 + return nil, err 207 + } 208 + if interceptor == nil { 209 + return srv.(AdminServiceServer).Rebuild(ctx, in) 210 + } 211 + info := &grpc.UnaryServerInfo{ 212 + Server: srv, 213 + FullMethod: AdminService_Rebuild_FullMethodName, 214 + } 215 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { 216 + return srv.(AdminServiceServer).Rebuild(ctx, req.(*RebuildRequest)) 217 + } 218 + return interceptor(ctx, in, info, handler) 219 + } 220 + 221 + // AdminService_ServiceDesc is the grpc.ServiceDesc for AdminService service. 222 + // It's only intended for direct use with grpc.RegisterService, 223 + // and not to be introspected or modified (even as a copy) 224 + var AdminService_ServiceDesc = grpc.ServiceDesc{ 225 + ServiceName: "xeiaso.net.admin.v1.AdminService", 226 + HandlerType: (*AdminServiceServer)(nil), 227 + Methods: []grpc.MethodDesc{ 228 + { 229 + MethodName: "Rebuild", 230 + Handler: _AdminService_Rebuild_Handler, 231 + }, 232 + }, 233 + Streams: []grpc.StreamDesc{}, 234 + Metadata: "xeiaso/net/admin/v1/admin.proto", 235 + }
+359
gen/xeiaso/net/v1/xesite.pb.go
··· 1 + // Code generated by protoc-gen-go. DO NOT EDIT. 2 + // versions: 3 + // protoc-gen-go v1.36.11 4 + // protoc (unknown) 5 + // source: xeiaso/net/v1/xesite.proto 6 + 7 + package netv1 8 + 9 + import ( 10 + protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 + protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 + timestamppb "google.golang.org/protobuf/types/known/timestamppb" 13 + reflect "reflect" 14 + sync "sync" 15 + unsafe "unsafe" 16 + v1 "xeiaso.net/v4/gen/external/protofeed/v1" 17 + ) 18 + 19 + const ( 20 + // Verify that this generated code is sufficiently up-to-date. 21 + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 22 + // Verify that runtime/protoimpl is sufficiently up-to-date. 23 + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 24 + ) 25 + 26 + // MetadataRequest is the request for MetaService.Metadata. 27 + type MetadataRequest struct { 28 + state protoimpl.MessageState `protogen:"open.v1"` 29 + unknownFields protoimpl.UnknownFields 30 + sizeCache protoimpl.SizeCache 31 + } 32 + 33 + func (x *MetadataRequest) Reset() { 34 + *x = MetadataRequest{} 35 + mi := &file_xeiaso_net_v1_xesite_proto_msgTypes[0] 36 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 37 + ms.StoreMessageInfo(mi) 38 + } 39 + 40 + func (x *MetadataRequest) String() string { 41 + return protoimpl.X.MessageStringOf(x) 42 + } 43 + 44 + func (*MetadataRequest) ProtoMessage() {} 45 + 46 + func (x *MetadataRequest) ProtoReflect() protoreflect.Message { 47 + mi := &file_xeiaso_net_v1_xesite_proto_msgTypes[0] 48 + if x != nil { 49 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 50 + if ms.LoadMessageInfo() == nil { 51 + ms.StoreMessageInfo(mi) 52 + } 53 + return ms 54 + } 55 + return mi.MessageOf(x) 56 + } 57 + 58 + // Deprecated: Use MetadataRequest.ProtoReflect.Descriptor instead. 59 + func (*MetadataRequest) Descriptor() ([]byte, []int) { 60 + return file_xeiaso_net_v1_xesite_proto_rawDescGZIP(), []int{0} 61 + } 62 + 63 + // MetadataResponse is the response for MetaService.Metadata. 64 + type MetadataResponse struct { 65 + state protoimpl.MessageState `protogen:"open.v1"` 66 + // The build info of the currently running xesite instance. 67 + BuildInfo *BuildInfo `protobuf:"bytes,1,opt,name=build_info,json=buildInfo,proto3" json:"build_info,omitempty"` 68 + unknownFields protoimpl.UnknownFields 69 + sizeCache protoimpl.SizeCache 70 + } 71 + 72 + func (x *MetadataResponse) Reset() { 73 + *x = MetadataResponse{} 74 + mi := &file_xeiaso_net_v1_xesite_proto_msgTypes[1] 75 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 76 + ms.StoreMessageInfo(mi) 77 + } 78 + 79 + func (x *MetadataResponse) String() string { 80 + return protoimpl.X.MessageStringOf(x) 81 + } 82 + 83 + func (*MetadataResponse) ProtoMessage() {} 84 + 85 + func (x *MetadataResponse) ProtoReflect() protoreflect.Message { 86 + mi := &file_xeiaso_net_v1_xesite_proto_msgTypes[1] 87 + if x != nil { 88 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 89 + if ms.LoadMessageInfo() == nil { 90 + ms.StoreMessageInfo(mi) 91 + } 92 + return ms 93 + } 94 + return mi.MessageOf(x) 95 + } 96 + 97 + // Deprecated: Use MetadataResponse.ProtoReflect.Descriptor instead. 98 + func (*MetadataResponse) Descriptor() ([]byte, []int) { 99 + return file_xeiaso_net_v1_xesite_proto_rawDescGZIP(), []int{1} 100 + } 101 + 102 + func (x *MetadataResponse) GetBuildInfo() *BuildInfo { 103 + if x != nil { 104 + return x.BuildInfo 105 + } 106 + return nil 107 + } 108 + 109 + // BuildInfo contains metadata about a build of the site. 110 + type BuildInfo struct { 111 + state protoimpl.MessageState `protogen:"open.v1"` 112 + // The commit of Xe/site that was built 113 + Commit string `protobuf:"bytes,1,opt,name=commit,proto3" json:"commit,omitempty"` 114 + // When the site was last rebuilt 115 + BuildTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=build_time,json=buildTime,proto3" json:"build_time,omitempty"` 116 + // The version of Go running on the server 117 + GoVersion string `protobuf:"bytes,3,opt,name=go_version,json=goVersion,proto3" json:"go_version,omitempty"` 118 + // The version of Deno used to build the site 119 + DenoVersion string `protobuf:"bytes,4,opt,name=deno_version,json=denoVersion,proto3" json:"deno_version,omitempty"` 120 + // The version of the xesite binary 121 + XesiteVersion string `protobuf:"bytes,5,opt,name=xesite_version,json=xesiteVersion,proto3" json:"xesite_version,omitempty"` 122 + unknownFields protoimpl.UnknownFields 123 + sizeCache protoimpl.SizeCache 124 + } 125 + 126 + func (x *BuildInfo) Reset() { 127 + *x = BuildInfo{} 128 + mi := &file_xeiaso_net_v1_xesite_proto_msgTypes[2] 129 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 130 + ms.StoreMessageInfo(mi) 131 + } 132 + 133 + func (x *BuildInfo) String() string { 134 + return protoimpl.X.MessageStringOf(x) 135 + } 136 + 137 + func (*BuildInfo) ProtoMessage() {} 138 + 139 + func (x *BuildInfo) ProtoReflect() protoreflect.Message { 140 + mi := &file_xeiaso_net_v1_xesite_proto_msgTypes[2] 141 + if x != nil { 142 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 143 + if ms.LoadMessageInfo() == nil { 144 + ms.StoreMessageInfo(mi) 145 + } 146 + return ms 147 + } 148 + return mi.MessageOf(x) 149 + } 150 + 151 + // Deprecated: Use BuildInfo.ProtoReflect.Descriptor instead. 152 + func (*BuildInfo) Descriptor() ([]byte, []int) { 153 + return file_xeiaso_net_v1_xesite_proto_rawDescGZIP(), []int{2} 154 + } 155 + 156 + func (x *BuildInfo) GetCommit() string { 157 + if x != nil { 158 + return x.Commit 159 + } 160 + return "" 161 + } 162 + 163 + func (x *BuildInfo) GetBuildTime() *timestamppb.Timestamp { 164 + if x != nil { 165 + return x.BuildTime 166 + } 167 + return nil 168 + } 169 + 170 + func (x *BuildInfo) GetGoVersion() string { 171 + if x != nil { 172 + return x.GoVersion 173 + } 174 + return "" 175 + } 176 + 177 + func (x *BuildInfo) GetDenoVersion() string { 178 + if x != nil { 179 + return x.DenoVersion 180 + } 181 + return "" 182 + } 183 + 184 + func (x *BuildInfo) GetXesiteVersion() string { 185 + if x != nil { 186 + return x.XesiteVersion 187 + } 188 + return "" 189 + } 190 + 191 + // FeedServiceGetRequest is the request for FeedService.Get. 192 + type FeedServiceGetRequest struct { 193 + state protoimpl.MessageState `protogen:"open.v1"` 194 + unknownFields protoimpl.UnknownFields 195 + sizeCache protoimpl.SizeCache 196 + } 197 + 198 + func (x *FeedServiceGetRequest) Reset() { 199 + *x = FeedServiceGetRequest{} 200 + mi := &file_xeiaso_net_v1_xesite_proto_msgTypes[3] 201 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 202 + ms.StoreMessageInfo(mi) 203 + } 204 + 205 + func (x *FeedServiceGetRequest) String() string { 206 + return protoimpl.X.MessageStringOf(x) 207 + } 208 + 209 + func (*FeedServiceGetRequest) ProtoMessage() {} 210 + 211 + func (x *FeedServiceGetRequest) ProtoReflect() protoreflect.Message { 212 + mi := &file_xeiaso_net_v1_xesite_proto_msgTypes[3] 213 + if x != nil { 214 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 215 + if ms.LoadMessageInfo() == nil { 216 + ms.StoreMessageInfo(mi) 217 + } 218 + return ms 219 + } 220 + return mi.MessageOf(x) 221 + } 222 + 223 + // Deprecated: Use FeedServiceGetRequest.ProtoReflect.Descriptor instead. 224 + func (*FeedServiceGetRequest) Descriptor() ([]byte, []int) { 225 + return file_xeiaso_net_v1_xesite_proto_rawDescGZIP(), []int{3} 226 + } 227 + 228 + // FeedServiceGetResponse is the response for FeedService.Get. 229 + type FeedServiceGetResponse struct { 230 + state protoimpl.MessageState `protogen:"open.v1"` 231 + // The feed of posts. 232 + Feed *v1.Feed `protobuf:"bytes,1,opt,name=feed,proto3" json:"feed,omitempty"` 233 + unknownFields protoimpl.UnknownFields 234 + sizeCache protoimpl.SizeCache 235 + } 236 + 237 + func (x *FeedServiceGetResponse) Reset() { 238 + *x = FeedServiceGetResponse{} 239 + mi := &file_xeiaso_net_v1_xesite_proto_msgTypes[4] 240 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 241 + ms.StoreMessageInfo(mi) 242 + } 243 + 244 + func (x *FeedServiceGetResponse) String() string { 245 + return protoimpl.X.MessageStringOf(x) 246 + } 247 + 248 + func (*FeedServiceGetResponse) ProtoMessage() {} 249 + 250 + func (x *FeedServiceGetResponse) ProtoReflect() protoreflect.Message { 251 + mi := &file_xeiaso_net_v1_xesite_proto_msgTypes[4] 252 + if x != nil { 253 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 254 + if ms.LoadMessageInfo() == nil { 255 + ms.StoreMessageInfo(mi) 256 + } 257 + return ms 258 + } 259 + return mi.MessageOf(x) 260 + } 261 + 262 + // Deprecated: Use FeedServiceGetResponse.ProtoReflect.Descriptor instead. 263 + func (*FeedServiceGetResponse) Descriptor() ([]byte, []int) { 264 + return file_xeiaso_net_v1_xesite_proto_rawDescGZIP(), []int{4} 265 + } 266 + 267 + func (x *FeedServiceGetResponse) GetFeed() *v1.Feed { 268 + if x != nil { 269 + return x.Feed 270 + } 271 + return nil 272 + } 273 + 274 + var File_xeiaso_net_v1_xesite_proto protoreflect.FileDescriptor 275 + 276 + const file_xeiaso_net_v1_xesite_proto_rawDesc = "" + 277 + "\n" + 278 + "\x1axeiaso/net/v1/xesite.proto\x12\rxeiaso.net.v1\x1a%external/protofeed/v1/protofeed.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x11\n" + 279 + "\x0fMetadataRequest\"K\n" + 280 + "\x10MetadataResponse\x127\n" + 281 + "\n" + 282 + "build_info\x18\x01 \x01(\v2\x18.xeiaso.net.v1.BuildInfoR\tbuildInfo\"\xc7\x01\n" + 283 + "\tBuildInfo\x12\x16\n" + 284 + "\x06commit\x18\x01 \x01(\tR\x06commit\x129\n" + 285 + "\n" + 286 + "build_time\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\tbuildTime\x12\x1d\n" + 287 + "\n" + 288 + "go_version\x18\x03 \x01(\tR\tgoVersion\x12!\n" + 289 + "\fdeno_version\x18\x04 \x01(\tR\vdenoVersion\x12%\n" + 290 + "\x0exesite_version\x18\x05 \x01(\tR\rxesiteVersion\"\x17\n" + 291 + "\x15FeedServiceGetRequest\"=\n" + 292 + "\x16FeedServiceGetResponse\x12#\n" + 293 + "\x04feed\x18\x01 \x01(\v2\x0f.protofeed.FeedR\x04feed2Z\n" + 294 + "\vMetaService\x12K\n" + 295 + "\bMetadata\x12\x1e.xeiaso.net.v1.MetadataRequest\x1a\x1f.xeiaso.net.v1.MetadataResponse2a\n" + 296 + "\vFeedService\x12R\n" + 297 + "\x03Get\x12$.xeiaso.net.v1.FeedServiceGetRequest\x1a%.xeiaso.net.v1.FeedServiceGetResponseB\x9d\x01\n" + 298 + "\x11com.xeiaso.net.v1B\vXesiteProtoP\x01Z%xeiaso.net/v4/gen/xeiaso/net/v1;netv1\xa2\x02\x03XNX\xaa\x02\rXeiaso.Net.V1\xca\x02\rXeiaso\\Net\\V1\xe2\x02\x19Xeiaso\\Net\\V1\\GPBMetadata\xea\x02\x0fXeiaso::Net::V1b\x06proto3" 299 + 300 + var ( 301 + file_xeiaso_net_v1_xesite_proto_rawDescOnce sync.Once 302 + file_xeiaso_net_v1_xesite_proto_rawDescData []byte 303 + ) 304 + 305 + func file_xeiaso_net_v1_xesite_proto_rawDescGZIP() []byte { 306 + file_xeiaso_net_v1_xesite_proto_rawDescOnce.Do(func() { 307 + file_xeiaso_net_v1_xesite_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_xeiaso_net_v1_xesite_proto_rawDesc), len(file_xeiaso_net_v1_xesite_proto_rawDesc))) 308 + }) 309 + return file_xeiaso_net_v1_xesite_proto_rawDescData 310 + } 311 + 312 + var file_xeiaso_net_v1_xesite_proto_msgTypes = make([]protoimpl.MessageInfo, 5) 313 + var file_xeiaso_net_v1_xesite_proto_goTypes = []any{ 314 + (*MetadataRequest)(nil), // 0: xeiaso.net.v1.MetadataRequest 315 + (*MetadataResponse)(nil), // 1: xeiaso.net.v1.MetadataResponse 316 + (*BuildInfo)(nil), // 2: xeiaso.net.v1.BuildInfo 317 + (*FeedServiceGetRequest)(nil), // 3: xeiaso.net.v1.FeedServiceGetRequest 318 + (*FeedServiceGetResponse)(nil), // 4: xeiaso.net.v1.FeedServiceGetResponse 319 + (*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp 320 + (*v1.Feed)(nil), // 6: protofeed.Feed 321 + } 322 + var file_xeiaso_net_v1_xesite_proto_depIdxs = []int32{ 323 + 2, // 0: xeiaso.net.v1.MetadataResponse.build_info:type_name -> xeiaso.net.v1.BuildInfo 324 + 5, // 1: xeiaso.net.v1.BuildInfo.build_time:type_name -> google.protobuf.Timestamp 325 + 6, // 2: xeiaso.net.v1.FeedServiceGetResponse.feed:type_name -> protofeed.Feed 326 + 0, // 3: xeiaso.net.v1.MetaService.Metadata:input_type -> xeiaso.net.v1.MetadataRequest 327 + 3, // 4: xeiaso.net.v1.FeedService.Get:input_type -> xeiaso.net.v1.FeedServiceGetRequest 328 + 1, // 5: xeiaso.net.v1.MetaService.Metadata:output_type -> xeiaso.net.v1.MetadataResponse 329 + 4, // 6: xeiaso.net.v1.FeedService.Get:output_type -> xeiaso.net.v1.FeedServiceGetResponse 330 + 5, // [5:7] is the sub-list for method output_type 331 + 3, // [3:5] is the sub-list for method input_type 332 + 3, // [3:3] is the sub-list for extension type_name 333 + 3, // [3:3] is the sub-list for extension extendee 334 + 0, // [0:3] is the sub-list for field type_name 335 + } 336 + 337 + func init() { file_xeiaso_net_v1_xesite_proto_init() } 338 + func file_xeiaso_net_v1_xesite_proto_init() { 339 + if File_xeiaso_net_v1_xesite_proto != nil { 340 + return 341 + } 342 + type x struct{} 343 + out := protoimpl.TypeBuilder{ 344 + File: protoimpl.DescBuilder{ 345 + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 346 + RawDescriptor: unsafe.Slice(unsafe.StringData(file_xeiaso_net_v1_xesite_proto_rawDesc), len(file_xeiaso_net_v1_xesite_proto_rawDesc)), 347 + NumEnums: 0, 348 + NumMessages: 5, 349 + NumExtensions: 0, 350 + NumServices: 2, 351 + }, 352 + GoTypes: file_xeiaso_net_v1_xesite_proto_goTypes, 353 + DependencyIndexes: file_xeiaso_net_v1_xesite_proto_depIdxs, 354 + MessageInfos: file_xeiaso_net_v1_xesite_proto_msgTypes, 355 + }.Build() 356 + File_xeiaso_net_v1_xesite_proto = out.File 357 + file_xeiaso_net_v1_xesite_proto_goTypes = nil 358 + file_xeiaso_net_v1_xesite_proto_depIdxs = nil 359 + }
+237
gen/xeiaso/net/v1/xesite_grpc.pb.go
··· 1 + // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 + // versions: 3 + // - protoc-gen-go-grpc v1.6.1 4 + // - protoc (unknown) 5 + // source: xeiaso/net/v1/xesite.proto 6 + 7 + package netv1 8 + 9 + import ( 10 + context "context" 11 + grpc "google.golang.org/grpc" 12 + codes "google.golang.org/grpc/codes" 13 + status "google.golang.org/grpc/status" 14 + ) 15 + 16 + // This is a compile-time assertion to ensure that this generated file 17 + // is compatible with the grpc package it is being compiled against. 18 + // Requires gRPC-Go v1.64.0 or later. 19 + const _ = grpc.SupportPackageIsVersion9 20 + 21 + const ( 22 + MetaService_Metadata_FullMethodName = "/xeiaso.net.v1.MetaService/Metadata" 23 + ) 24 + 25 + // MetaServiceClient is the client API for MetaService service. 26 + // 27 + // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 28 + // 29 + // MetaService lets users fetch site metadata. 30 + type MetaServiceClient interface { 31 + // Metadata fetches the build metadata of the version of xesite that is 32 + // currently running. 33 + Metadata(ctx context.Context, in *MetadataRequest, opts ...grpc.CallOption) (*MetadataResponse, error) 34 + } 35 + 36 + type metaServiceClient struct { 37 + cc grpc.ClientConnInterface 38 + } 39 + 40 + func NewMetaServiceClient(cc grpc.ClientConnInterface) MetaServiceClient { 41 + return &metaServiceClient{cc} 42 + } 43 + 44 + func (c *metaServiceClient) Metadata(ctx context.Context, in *MetadataRequest, opts ...grpc.CallOption) (*MetadataResponse, error) { 45 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 46 + out := new(MetadataResponse) 47 + err := c.cc.Invoke(ctx, MetaService_Metadata_FullMethodName, in, out, cOpts...) 48 + if err != nil { 49 + return nil, err 50 + } 51 + return out, nil 52 + } 53 + 54 + // MetaServiceServer is the server API for MetaService service. 55 + // All implementations must embed UnimplementedMetaServiceServer 56 + // for forward compatibility. 57 + // 58 + // MetaService lets users fetch site metadata. 59 + type MetaServiceServer interface { 60 + // Metadata fetches the build metadata of the version of xesite that is 61 + // currently running. 62 + Metadata(context.Context, *MetadataRequest) (*MetadataResponse, error) 63 + mustEmbedUnimplementedMetaServiceServer() 64 + } 65 + 66 + // UnimplementedMetaServiceServer must be embedded to have 67 + // forward compatible implementations. 68 + // 69 + // NOTE: this should be embedded by value instead of pointer to avoid a nil 70 + // pointer dereference when methods are called. 71 + type UnimplementedMetaServiceServer struct{} 72 + 73 + func (UnimplementedMetaServiceServer) Metadata(context.Context, *MetadataRequest) (*MetadataResponse, error) { 74 + return nil, status.Error(codes.Unimplemented, "method Metadata not implemented") 75 + } 76 + func (UnimplementedMetaServiceServer) mustEmbedUnimplementedMetaServiceServer() {} 77 + func (UnimplementedMetaServiceServer) testEmbeddedByValue() {} 78 + 79 + // UnsafeMetaServiceServer may be embedded to opt out of forward compatibility for this service. 80 + // Use of this interface is not recommended, as added methods to MetaServiceServer will 81 + // result in compilation errors. 82 + type UnsafeMetaServiceServer interface { 83 + mustEmbedUnimplementedMetaServiceServer() 84 + } 85 + 86 + func RegisterMetaServiceServer(s grpc.ServiceRegistrar, srv MetaServiceServer) { 87 + // If the following call panics, it indicates UnimplementedMetaServiceServer was 88 + // embedded by pointer and is nil. This will cause panics if an 89 + // unimplemented method is ever invoked, so we test this at initialization 90 + // time to prevent it from happening at runtime later due to I/O. 91 + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { 92 + t.testEmbeddedByValue() 93 + } 94 + s.RegisterService(&MetaService_ServiceDesc, srv) 95 + } 96 + 97 + func _MetaService_Metadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 98 + in := new(MetadataRequest) 99 + if err := dec(in); err != nil { 100 + return nil, err 101 + } 102 + if interceptor == nil { 103 + return srv.(MetaServiceServer).Metadata(ctx, in) 104 + } 105 + info := &grpc.UnaryServerInfo{ 106 + Server: srv, 107 + FullMethod: MetaService_Metadata_FullMethodName, 108 + } 109 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { 110 + return srv.(MetaServiceServer).Metadata(ctx, req.(*MetadataRequest)) 111 + } 112 + return interceptor(ctx, in, info, handler) 113 + } 114 + 115 + // MetaService_ServiceDesc is the grpc.ServiceDesc for MetaService service. 116 + // It's only intended for direct use with grpc.RegisterService, 117 + // and not to be introspected or modified (even as a copy) 118 + var MetaService_ServiceDesc = grpc.ServiceDesc{ 119 + ServiceName: "xeiaso.net.v1.MetaService", 120 + HandlerType: (*MetaServiceServer)(nil), 121 + Methods: []grpc.MethodDesc{ 122 + { 123 + MethodName: "Metadata", 124 + Handler: _MetaService_Metadata_Handler, 125 + }, 126 + }, 127 + Streams: []grpc.StreamDesc{}, 128 + Metadata: "xeiaso/net/v1/xesite.proto", 129 + } 130 + 131 + const ( 132 + FeedService_Get_FullMethodName = "/xeiaso.net.v1.FeedService/Get" 133 + ) 134 + 135 + // FeedServiceClient is the client API for FeedService service. 136 + // 137 + // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 138 + // 139 + // FeedService lets users fetch the current feed of posts. 140 + type FeedServiceClient interface { 141 + // Get fetches the current feed of posts. 142 + Get(ctx context.Context, in *FeedServiceGetRequest, opts ...grpc.CallOption) (*FeedServiceGetResponse, error) 143 + } 144 + 145 + type feedServiceClient struct { 146 + cc grpc.ClientConnInterface 147 + } 148 + 149 + func NewFeedServiceClient(cc grpc.ClientConnInterface) FeedServiceClient { 150 + return &feedServiceClient{cc} 151 + } 152 + 153 + func (c *feedServiceClient) Get(ctx context.Context, in *FeedServiceGetRequest, opts ...grpc.CallOption) (*FeedServiceGetResponse, error) { 154 + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 155 + out := new(FeedServiceGetResponse) 156 + err := c.cc.Invoke(ctx, FeedService_Get_FullMethodName, in, out, cOpts...) 157 + if err != nil { 158 + return nil, err 159 + } 160 + return out, nil 161 + } 162 + 163 + // FeedServiceServer is the server API for FeedService service. 164 + // All implementations must embed UnimplementedFeedServiceServer 165 + // for forward compatibility. 166 + // 167 + // FeedService lets users fetch the current feed of posts. 168 + type FeedServiceServer interface { 169 + // Get fetches the current feed of posts. 170 + Get(context.Context, *FeedServiceGetRequest) (*FeedServiceGetResponse, error) 171 + mustEmbedUnimplementedFeedServiceServer() 172 + } 173 + 174 + // UnimplementedFeedServiceServer must be embedded to have 175 + // forward compatible implementations. 176 + // 177 + // NOTE: this should be embedded by value instead of pointer to avoid a nil 178 + // pointer dereference when methods are called. 179 + type UnimplementedFeedServiceServer struct{} 180 + 181 + func (UnimplementedFeedServiceServer) Get(context.Context, *FeedServiceGetRequest) (*FeedServiceGetResponse, error) { 182 + return nil, status.Error(codes.Unimplemented, "method Get not implemented") 183 + } 184 + func (UnimplementedFeedServiceServer) mustEmbedUnimplementedFeedServiceServer() {} 185 + func (UnimplementedFeedServiceServer) testEmbeddedByValue() {} 186 + 187 + // UnsafeFeedServiceServer may be embedded to opt out of forward compatibility for this service. 188 + // Use of this interface is not recommended, as added methods to FeedServiceServer will 189 + // result in compilation errors. 190 + type UnsafeFeedServiceServer interface { 191 + mustEmbedUnimplementedFeedServiceServer() 192 + } 193 + 194 + func RegisterFeedServiceServer(s grpc.ServiceRegistrar, srv FeedServiceServer) { 195 + // If the following call panics, it indicates UnimplementedFeedServiceServer was 196 + // embedded by pointer and is nil. This will cause panics if an 197 + // unimplemented method is ever invoked, so we test this at initialization 198 + // time to prevent it from happening at runtime later due to I/O. 199 + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { 200 + t.testEmbeddedByValue() 201 + } 202 + s.RegisterService(&FeedService_ServiceDesc, srv) 203 + } 204 + 205 + func _FeedService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 206 + in := new(FeedServiceGetRequest) 207 + if err := dec(in); err != nil { 208 + return nil, err 209 + } 210 + if interceptor == nil { 211 + return srv.(FeedServiceServer).Get(ctx, in) 212 + } 213 + info := &grpc.UnaryServerInfo{ 214 + Server: srv, 215 + FullMethod: FeedService_Get_FullMethodName, 216 + } 217 + handler := func(ctx context.Context, req interface{}) (interface{}, error) { 218 + return srv.(FeedServiceServer).Get(ctx, req.(*FeedServiceGetRequest)) 219 + } 220 + return interceptor(ctx, in, info, handler) 221 + } 222 + 223 + // FeedService_ServiceDesc is the grpc.ServiceDesc for FeedService service. 224 + // It's only intended for direct use with grpc.RegisterService, 225 + // and not to be introspected or modified (even as a copy) 226 + var FeedService_ServiceDesc = grpc.ServiceDesc{ 227 + ServiceName: "xeiaso.net.v1.FeedService", 228 + HandlerType: (*FeedServiceServer)(nil), 229 + Methods: []grpc.MethodDesc{ 230 + { 231 + MethodName: "Get", 232 + Handler: _FeedService_Get_Handler, 233 + }, 234 + }, 235 + Streams: []grpc.StreamDesc{}, 236 + Metadata: "xeiaso/net/v1/xesite.proto", 237 + }
+3
go.mod
··· 3 3 go 1.26.1 4 4 5 5 require ( 6 + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250603165357-b52ab10f4468.1 6 7 github.com/a-h/templ v0.3.1001 7 8 github.com/aws/aws-sdk-go-v2 v1.41.5 8 9 github.com/aws/aws-sdk-go-v2/config v1.32.12 ··· 23 24 github.com/stretchr/testify v1.11.1 24 25 github.com/twitchtv/twirp v8.1.3+incompatible 25 26 golang.org/x/oauth2 v0.36.0 27 + google.golang.org/grpc v1.79.3 26 28 google.golang.org/protobuf v1.36.11 27 29 gopkg.in/fsnotify.v1 v1.4.7 28 30 gopkg.in/mxpv/patreon-go.v1 v1.0.0-20171031001022-1d2f253ac700 ··· 170 172 golang.org/x/text v0.32.0 // indirect 171 173 golang.org/x/time v0.12.0 // indirect 172 174 golang.org/x/tools v0.39.0 // indirect 175 + google.golang.org/genproto/googleapis/rpc v0.0.0-20260319201613-d00831a3d3e7 // indirect 173 176 gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect 174 177 gopkg.in/inf.v0 v0.9.1 // indirect 175 178 gopkg.in/warnings.v0 v0.1.2 // indirect
+24
go.sum
··· 1 1 al.essio.dev/pkg/shellescape v1.6.0 h1:NxFcEqzFSEVCGN2yq7Huv/9hyCEGVa/TncnOOBBeXHA= 2 2 al.essio.dev/pkg/shellescape v1.6.0/go.mod h1:6sIqp7X2P6mThCQ7twERpZTuigpr6KbZWtls1U8I890= 3 + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250603165357-b52ab10f4468.1 h1:uwSqFkn8DDTzNlaV9TxgSXY5OCaNdb4rH+Axd2FujkE= 4 + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250603165357-b52ab10f4468.1/go.mod h1:avRlCjnFzl98VPaeCtJ24RrV/wwHFzB8sWXhj26+n/U= 3 5 charm.land/lipgloss/v2 v2.0.0-beta.3.0.20251120230642-dcccabe2cd63 h1:KgI+p678truaonNOQek4i+aJdWAtdpvFzz5lqHBaDeI= 4 6 charm.land/lipgloss/v2 v2.0.0-beta.3.0.20251120230642-dcccabe2cd63/go.mod h1:bjsp2D+VGi56y8f53S7xCphcoqJb36vo3dBVh0RrpP8= 5 7 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= ··· 256 258 github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= 257 259 github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= 258 260 github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= 261 + github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= 262 + github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= 259 263 github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= 260 264 github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= 261 265 github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= ··· 304 308 github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= 305 309 github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= 306 310 github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= 311 + github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= 312 + github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= 307 313 github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 308 314 github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 309 315 github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= ··· 580 586 go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 581 587 go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 582 588 go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 589 + go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= 590 + go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= 591 + go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48= 592 + go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8= 593 + go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0= 594 + go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs= 595 + go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18= 596 + go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE= 597 + go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8= 598 + go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew= 599 + go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI= 600 + go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA= 583 601 go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= 584 602 go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= 585 603 go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= ··· 826 844 golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 827 845 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 828 846 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 847 + gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= 848 + gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= 829 849 google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= 830 850 google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= 831 851 google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= ··· 878 898 google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 879 899 google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 880 900 google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 901 + google.golang.org/genproto/googleapis/rpc v0.0.0-20260319201613-d00831a3d3e7 h1:ndE4FoJqsIceKP2oYSnUZqhTdYufCYYkqwtFzfrhI7w= 902 + google.golang.org/genproto/googleapis/rpc v0.0.0-20260319201613-d00831a3d3e7/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= 881 903 google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 882 904 google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= 883 905 google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= ··· 890 912 google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= 891 913 google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= 892 914 google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= 915 + google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= 916 + google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= 893 917 google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 894 918 google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 895 919 google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
-5
internal/adminpb/generate.go
··· 1 - package adminpb 2 - 3 - func init() {} 4 - 5 - //go:generate protoc --proto_path=. --proto_path=../../pb --go_out=. --go_opt=paths=source_relative --twirp_out=. --twirp_opt=paths=source_relative internal.proto
-165
internal/adminpb/internal.pb.go
··· 1 - // Code generated by protoc-gen-go. DO NOT EDIT. 2 - // versions: 3 - // protoc-gen-go v1.36.11 4 - // protoc v6.33.4 5 - // source: internal.proto 6 - 7 - package adminpb 8 - 9 - import ( 10 - protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 - protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 - emptypb "google.golang.org/protobuf/types/known/emptypb" 13 - timestamppb "google.golang.org/protobuf/types/known/timestamppb" 14 - reflect "reflect" 15 - sync "sync" 16 - unsafe "unsafe" 17 - pb "xeiaso.net/v4/pb" 18 - ) 19 - 20 - const ( 21 - // Verify that this generated code is sufficiently up-to-date. 22 - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 23 - // Verify that runtime/protoimpl is sufficiently up-to-date. 24 - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 25 - ) 26 - 27 - type PatreonToken struct { 28 - state protoimpl.MessageState `protogen:"open.v1"` 29 - AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` 30 - TokenType string `protobuf:"bytes,2,opt,name=token_type,json=tokenType,proto3" json:"token_type,omitempty"` 31 - RefreshToken string `protobuf:"bytes,3,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"` 32 - Expiry *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expiry,proto3" json:"expiry,omitempty"` 33 - unknownFields protoimpl.UnknownFields 34 - sizeCache protoimpl.SizeCache 35 - } 36 - 37 - func (x *PatreonToken) Reset() { 38 - *x = PatreonToken{} 39 - mi := &file_internal_proto_msgTypes[0] 40 - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 41 - ms.StoreMessageInfo(mi) 42 - } 43 - 44 - func (x *PatreonToken) String() string { 45 - return protoimpl.X.MessageStringOf(x) 46 - } 47 - 48 - func (*PatreonToken) ProtoMessage() {} 49 - 50 - func (x *PatreonToken) ProtoReflect() protoreflect.Message { 51 - mi := &file_internal_proto_msgTypes[0] 52 - if x != nil { 53 - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 54 - if ms.LoadMessageInfo() == nil { 55 - ms.StoreMessageInfo(mi) 56 - } 57 - return ms 58 - } 59 - return mi.MessageOf(x) 60 - } 61 - 62 - // Deprecated: Use PatreonToken.ProtoReflect.Descriptor instead. 63 - func (*PatreonToken) Descriptor() ([]byte, []int) { 64 - return file_internal_proto_rawDescGZIP(), []int{0} 65 - } 66 - 67 - func (x *PatreonToken) GetAccessToken() string { 68 - if x != nil { 69 - return x.AccessToken 70 - } 71 - return "" 72 - } 73 - 74 - func (x *PatreonToken) GetTokenType() string { 75 - if x != nil { 76 - return x.TokenType 77 - } 78 - return "" 79 - } 80 - 81 - func (x *PatreonToken) GetRefreshToken() string { 82 - if x != nil { 83 - return x.RefreshToken 84 - } 85 - return "" 86 - } 87 - 88 - func (x *PatreonToken) GetExpiry() *timestamppb.Timestamp { 89 - if x != nil { 90 - return x.Expiry 91 - } 92 - return nil 93 - } 94 - 95 - var File_internal_proto protoreflect.FileDescriptor 96 - 97 - const file_internal_proto_rawDesc = "" + 98 - "\n" + 99 - "\x0einternal.proto\x12\x13xeiaso.net.internal\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\fxesite.proto\"\xa9\x01\n" + 100 - "\fPatreonToken\x12!\n" + 101 - "\faccess_token\x18\x01 \x01(\tR\vaccessToken\x12\x1d\n" + 102 - "\n" + 103 - "token_type\x18\x02 \x01(\tR\ttokenType\x12#\n" + 104 - "\rrefresh_token\x18\x03 \x01(\tR\frefreshToken\x122\n" + 105 - "\x06expiry\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\x06expiry2P\n" + 106 - "\aPatreon\x12E\n" + 107 - "\bGetToken\x12\x16.google.protobuf.Empty\x1a!.xeiaso.net.internal.PatreonToken2A\n" + 108 - "\x05Admin\x128\n" + 109 - "\aRebuild\x12\x16.google.protobuf.Empty\x1a\x15.xeiaso.net.BuildInfoB Z\x1exeiaso.net/v4/internal/adminpbb\x06proto3" 110 - 111 - var ( 112 - file_internal_proto_rawDescOnce sync.Once 113 - file_internal_proto_rawDescData []byte 114 - ) 115 - 116 - func file_internal_proto_rawDescGZIP() []byte { 117 - file_internal_proto_rawDescOnce.Do(func() { 118 - file_internal_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_internal_proto_rawDesc), len(file_internal_proto_rawDesc))) 119 - }) 120 - return file_internal_proto_rawDescData 121 - } 122 - 123 - var file_internal_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 124 - var file_internal_proto_goTypes = []any{ 125 - (*PatreonToken)(nil), // 0: xeiaso.net.internal.PatreonToken 126 - (*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp 127 - (*emptypb.Empty)(nil), // 2: google.protobuf.Empty 128 - (*pb.BuildInfo)(nil), // 3: xeiaso.net.BuildInfo 129 - } 130 - var file_internal_proto_depIdxs = []int32{ 131 - 1, // 0: xeiaso.net.internal.PatreonToken.expiry:type_name -> google.protobuf.Timestamp 132 - 2, // 1: xeiaso.net.internal.Patreon.GetToken:input_type -> google.protobuf.Empty 133 - 2, // 2: xeiaso.net.internal.Admin.Rebuild:input_type -> google.protobuf.Empty 134 - 0, // 3: xeiaso.net.internal.Patreon.GetToken:output_type -> xeiaso.net.internal.PatreonToken 135 - 3, // 4: xeiaso.net.internal.Admin.Rebuild:output_type -> xeiaso.net.BuildInfo 136 - 3, // [3:5] is the sub-list for method output_type 137 - 1, // [1:3] is the sub-list for method input_type 138 - 1, // [1:1] is the sub-list for extension type_name 139 - 1, // [1:1] is the sub-list for extension extendee 140 - 0, // [0:1] is the sub-list for field type_name 141 - } 142 - 143 - func init() { file_internal_proto_init() } 144 - func file_internal_proto_init() { 145 - if File_internal_proto != nil { 146 - return 147 - } 148 - type x struct{} 149 - out := protoimpl.TypeBuilder{ 150 - File: protoimpl.DescBuilder{ 151 - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 152 - RawDescriptor: unsafe.Slice(unsafe.StringData(file_internal_proto_rawDesc), len(file_internal_proto_rawDesc)), 153 - NumEnums: 0, 154 - NumMessages: 1, 155 - NumExtensions: 0, 156 - NumServices: 2, 157 - }, 158 - GoTypes: file_internal_proto_goTypes, 159 - DependencyIndexes: file_internal_proto_depIdxs, 160 - MessageInfos: file_internal_proto_msgTypes, 161 - }.Build() 162 - File_internal_proto = out.File 163 - file_internal_proto_goTypes = nil 164 - file_internal_proto_depIdxs = nil 165 - }
-20
internal/adminpb/internal.proto
··· 1 - syntax = "proto3"; 2 - package xeiaso.net.internal; 3 - option go_package = "xeiaso.net/v4/internal/adminpb"; 4 - 5 - import "google/protobuf/empty.proto"; 6 - import "google/protobuf/timestamp.proto"; 7 - import "xesite.proto"; 8 - 9 - service Patreon { rpc GetToken(google.protobuf.Empty) returns (PatreonToken); } 10 - 11 - message PatreonToken { 12 - string access_token = 1; 13 - string token_type = 2; 14 - string refresh_token = 3; 15 - google.protobuf.Timestamp expiry = 4; 16 - } 17 - 18 - service Admin { 19 - rpc Rebuild(google.protobuf.Empty) returns (xeiaso.net.BuildInfo); 20 - }
+206 -195
internal/adminpb/internal.twirp.go gen/xeiaso/net/admin/v1/admin.twirp.go
··· 1 1 // Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT. 2 - // source: internal.proto 2 + // source: xeiaso/net/admin/v1/admin.proto 3 3 4 - package adminpb 4 + package adminv1 5 5 6 6 import context "context" 7 7 import fmt "fmt" ··· 15 15 import proto "google.golang.org/protobuf/proto" 16 16 import twirp "github.com/twitchtv/twirp" 17 17 import ctxsetters "github.com/twitchtv/twirp/ctxsetters" 18 - 19 - import google_protobuf "google.golang.org/protobuf/types/known/emptypb" 20 - import xeiaso_net "xeiaso.net/v4/pb" 21 18 22 19 import bytes "bytes" 23 20 import errors "errors" ··· 30 27 // See https://twitchtv.github.io/twirp/docs/version_matrix.html 31 28 const _ = twirp.TwirpPackageMinVersion_8_1_0 32 29 33 - // ================= 34 - // Patreon Interface 35 - // ================= 30 + // ======================== 31 + // PatreonService Interface 32 + // ======================== 36 33 37 - type Patreon interface { 38 - GetToken(context.Context, *google_protobuf.Empty) (*PatreonToken, error) 34 + // PatreonService provides access to Patreon OAuth tokens. 35 + type PatreonService interface { 36 + // GetToken returns the current Patreon OAuth token. 37 + GetToken(context.Context, *GetTokenRequest) (*GetTokenResponse, error) 39 38 } 40 39 41 - // ======================= 42 - // Patreon Protobuf Client 43 - // ======================= 40 + // ============================== 41 + // PatreonService Protobuf Client 42 + // ============================== 44 43 45 - type patreonProtobufClient struct { 44 + type patreonServiceProtobufClient struct { 46 45 client HTTPClient 47 46 urls [1]string 48 47 interceptor twirp.Interceptor 49 48 opts twirp.ClientOptions 50 49 } 51 50 52 - // NewPatreonProtobufClient creates a Protobuf client that implements the Patreon interface. 51 + // NewPatreonServiceProtobufClient creates a Protobuf client that implements the PatreonService interface. 53 52 // It communicates using Protobuf and can be configured with a custom HTTPClient. 54 - func NewPatreonProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Patreon { 53 + func NewPatreonServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) PatreonService { 55 54 if c, ok := client.(*http.Client); ok { 56 55 client = withoutRedirects(c) 57 56 } ··· 71 70 72 71 // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 73 72 serviceURL := sanitizeBaseURL(baseURL) 74 - serviceURL += baseServicePath(pathPrefix, "xeiaso.net.internal", "Patreon") 73 + serviceURL += baseServicePath(pathPrefix, "xeiaso.net.admin.v1", "PatreonService") 75 74 urls := [1]string{ 76 75 serviceURL + "GetToken", 77 76 } 78 77 79 - return &patreonProtobufClient{ 78 + return &patreonServiceProtobufClient{ 80 79 client: client, 81 80 urls: urls, 82 81 interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), ··· 84 83 } 85 84 } 86 85 87 - func (c *patreonProtobufClient) GetToken(ctx context.Context, in *google_protobuf.Empty) (*PatreonToken, error) { 88 - ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.internal") 89 - ctx = ctxsetters.WithServiceName(ctx, "Patreon") 86 + func (c *patreonServiceProtobufClient) GetToken(ctx context.Context, in *GetTokenRequest) (*GetTokenResponse, error) { 87 + ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.admin.v1") 88 + ctx = ctxsetters.WithServiceName(ctx, "PatreonService") 90 89 ctx = ctxsetters.WithMethodName(ctx, "GetToken") 91 90 caller := c.callGetToken 92 91 if c.interceptor != nil { 93 - caller = func(ctx context.Context, req *google_protobuf.Empty) (*PatreonToken, error) { 92 + caller = func(ctx context.Context, req *GetTokenRequest) (*GetTokenResponse, error) { 94 93 resp, err := c.interceptor( 95 94 func(ctx context.Context, req interface{}) (interface{}, error) { 96 - typedReq, ok := req.(*google_protobuf.Empty) 95 + typedReq, ok := req.(*GetTokenRequest) 97 96 if !ok { 98 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 97 + return nil, twirp.InternalError("failed type assertion req.(*GetTokenRequest) when calling interceptor") 99 98 } 100 99 return c.callGetToken(ctx, typedReq) 101 100 }, 102 101 )(ctx, req) 103 102 if resp != nil { 104 - typedResp, ok := resp.(*PatreonToken) 103 + typedResp, ok := resp.(*GetTokenResponse) 105 104 if !ok { 106 - return nil, twirp.InternalError("failed type assertion resp.(*PatreonToken) when calling interceptor") 105 + return nil, twirp.InternalError("failed type assertion resp.(*GetTokenResponse) when calling interceptor") 107 106 } 108 107 return typedResp, err 109 108 } ··· 113 112 return caller(ctx, in) 114 113 } 115 114 116 - func (c *patreonProtobufClient) callGetToken(ctx context.Context, in *google_protobuf.Empty) (*PatreonToken, error) { 117 - out := new(PatreonToken) 115 + func (c *patreonServiceProtobufClient) callGetToken(ctx context.Context, in *GetTokenRequest) (*GetTokenResponse, error) { 116 + out := new(GetTokenResponse) 118 117 ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 119 118 if err != nil { 120 119 twerr, ok := err.(twirp.Error) ··· 130 129 return out, nil 131 130 } 132 131 133 - // =================== 134 - // Patreon JSON Client 135 - // =================== 132 + // ========================== 133 + // PatreonService JSON Client 134 + // ========================== 136 135 137 - type patreonJSONClient struct { 136 + type patreonServiceJSONClient struct { 138 137 client HTTPClient 139 138 urls [1]string 140 139 interceptor twirp.Interceptor 141 140 opts twirp.ClientOptions 142 141 } 143 142 144 - // NewPatreonJSONClient creates a JSON client that implements the Patreon interface. 143 + // NewPatreonServiceJSONClient creates a JSON client that implements the PatreonService interface. 145 144 // It communicates using JSON and can be configured with a custom HTTPClient. 146 - func NewPatreonJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Patreon { 145 + func NewPatreonServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) PatreonService { 147 146 if c, ok := client.(*http.Client); ok { 148 147 client = withoutRedirects(c) 149 148 } ··· 163 162 164 163 // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 165 164 serviceURL := sanitizeBaseURL(baseURL) 166 - serviceURL += baseServicePath(pathPrefix, "xeiaso.net.internal", "Patreon") 165 + serviceURL += baseServicePath(pathPrefix, "xeiaso.net.admin.v1", "PatreonService") 167 166 urls := [1]string{ 168 167 serviceURL + "GetToken", 169 168 } 170 169 171 - return &patreonJSONClient{ 170 + return &patreonServiceJSONClient{ 172 171 client: client, 173 172 urls: urls, 174 173 interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), ··· 176 175 } 177 176 } 178 177 179 - func (c *patreonJSONClient) GetToken(ctx context.Context, in *google_protobuf.Empty) (*PatreonToken, error) { 180 - ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.internal") 181 - ctx = ctxsetters.WithServiceName(ctx, "Patreon") 178 + func (c *patreonServiceJSONClient) GetToken(ctx context.Context, in *GetTokenRequest) (*GetTokenResponse, error) { 179 + ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.admin.v1") 180 + ctx = ctxsetters.WithServiceName(ctx, "PatreonService") 182 181 ctx = ctxsetters.WithMethodName(ctx, "GetToken") 183 182 caller := c.callGetToken 184 183 if c.interceptor != nil { 185 - caller = func(ctx context.Context, req *google_protobuf.Empty) (*PatreonToken, error) { 184 + caller = func(ctx context.Context, req *GetTokenRequest) (*GetTokenResponse, error) { 186 185 resp, err := c.interceptor( 187 186 func(ctx context.Context, req interface{}) (interface{}, error) { 188 - typedReq, ok := req.(*google_protobuf.Empty) 187 + typedReq, ok := req.(*GetTokenRequest) 189 188 if !ok { 190 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 189 + return nil, twirp.InternalError("failed type assertion req.(*GetTokenRequest) when calling interceptor") 191 190 } 192 191 return c.callGetToken(ctx, typedReq) 193 192 }, 194 193 )(ctx, req) 195 194 if resp != nil { 196 - typedResp, ok := resp.(*PatreonToken) 195 + typedResp, ok := resp.(*GetTokenResponse) 197 196 if !ok { 198 - return nil, twirp.InternalError("failed type assertion resp.(*PatreonToken) when calling interceptor") 197 + return nil, twirp.InternalError("failed type assertion resp.(*GetTokenResponse) when calling interceptor") 199 198 } 200 199 return typedResp, err 201 200 } ··· 205 204 return caller(ctx, in) 206 205 } 207 206 208 - func (c *patreonJSONClient) callGetToken(ctx context.Context, in *google_protobuf.Empty) (*PatreonToken, error) { 209 - out := new(PatreonToken) 207 + func (c *patreonServiceJSONClient) callGetToken(ctx context.Context, in *GetTokenRequest) (*GetTokenResponse, error) { 208 + out := new(GetTokenResponse) 210 209 ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 211 210 if err != nil { 212 211 twerr, ok := err.(twirp.Error) ··· 222 221 return out, nil 223 222 } 224 223 225 - // ====================== 226 - // Patreon Server Handler 227 - // ====================== 224 + // ============================= 225 + // PatreonService Server Handler 226 + // ============================= 228 227 229 - type patreonServer struct { 230 - Patreon 228 + type patreonServiceServer struct { 229 + PatreonService 231 230 interceptor twirp.Interceptor 232 231 hooks *twirp.ServerHooks 233 232 pathPrefix string // prefix for routing ··· 235 234 jsonCamelCase bool // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names 236 235 } 237 236 238 - // NewPatreonServer builds a TwirpServer that can be used as an http.Handler to handle 237 + // NewPatreonServiceServer builds a TwirpServer that can be used as an http.Handler to handle 239 238 // HTTP requests that are routed to the right method in the provided svc implementation. 240 239 // The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks). 241 - func NewPatreonServer(svc Patreon, opts ...interface{}) TwirpServer { 240 + func NewPatreonServiceServer(svc PatreonService, opts ...interface{}) TwirpServer { 242 241 serverOpts := newServerOpts(opts) 243 242 244 243 // Using ReadOpt allows backwards and forwards compatibility with new options in the future ··· 251 250 pathPrefix = "/twirp" // default prefix 252 251 } 253 252 254 - return &patreonServer{ 255 - Patreon: svc, 253 + return &patreonServiceServer{ 254 + PatreonService: svc, 256 255 hooks: serverOpts.Hooks, 257 256 interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...), 258 257 pathPrefix: pathPrefix, ··· 263 262 264 263 // writeError writes an HTTP response with a valid Twirp error format, and triggers hooks. 265 264 // If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) 266 - func (s *patreonServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { 265 + func (s *patreonServiceServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { 267 266 writeError(ctx, resp, err, s.hooks) 268 267 } 269 268 270 269 // handleRequestBodyError is used to handle error when the twirp server cannot read request 271 - func (s *patreonServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { 270 + func (s *patreonServiceServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { 272 271 if context.Canceled == ctx.Err() { 273 272 s.writeError(ctx, resp, twirp.NewError(twirp.Canceled, "failed to read request: context canceled")) 274 273 return ··· 280 279 s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err)) 281 280 } 282 281 283 - // PatreonPathPrefix is a convenience constant that may identify URL paths. 282 + // PatreonServicePathPrefix is a convenience constant that may identify URL paths. 284 283 // Should be used with caution, it only matches routes generated by Twirp Go clients, 285 284 // with the default "/twirp" prefix and default CamelCase service and method names. 286 285 // More info: https://twitchtv.github.io/twirp/docs/routing.html 287 - const PatreonPathPrefix = "/twirp/xeiaso.net.internal.Patreon/" 286 + const PatreonServicePathPrefix = "/twirp/xeiaso.net.admin.v1.PatreonService/" 288 287 289 - func (s *patreonServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { 288 + func (s *patreonServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { 290 289 ctx := req.Context() 291 - ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.internal") 292 - ctx = ctxsetters.WithServiceName(ctx, "Patreon") 290 + ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.admin.v1") 291 + ctx = ctxsetters.WithServiceName(ctx, "PatreonService") 293 292 ctx = ctxsetters.WithResponseWriter(ctx, resp) 294 293 295 294 var err error ··· 307 306 308 307 // Verify path format: [<prefix>]/<package>.<Service>/<Method> 309 308 prefix, pkgService, method := parseTwirpPath(req.URL.Path) 310 - if pkgService != "xeiaso.net.internal.Patreon" { 309 + if pkgService != "xeiaso.net.admin.v1.PatreonService" { 311 310 msg := fmt.Sprintf("no handler for path %q", req.URL.Path) 312 311 s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) 313 312 return ··· 329 328 } 330 329 } 331 330 332 - func (s *patreonServer) serveGetToken(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 331 + func (s *patreonServiceServer) serveGetToken(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 333 332 header := req.Header.Get("Content-Type") 334 333 i := strings.Index(header, ";") 335 334 if i == -1 { ··· 347 346 } 348 347 } 349 348 350 - func (s *patreonServer) serveGetTokenJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 349 + func (s *patreonServiceServer) serveGetTokenJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 351 350 var err error 352 351 ctx = ctxsetters.WithMethodName(ctx, "GetToken") 353 352 ctx, err = callRequestRouted(ctx, s.hooks) ··· 362 361 s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 363 362 return 364 363 } 365 - reqContent := new(google_protobuf.Empty) 364 + reqContent := new(GetTokenRequest) 366 365 unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} 367 366 if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { 368 367 s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 369 368 return 370 369 } 371 370 372 - handler := s.Patreon.GetToken 371 + handler := s.PatreonService.GetToken 373 372 if s.interceptor != nil { 374 - handler = func(ctx context.Context, req *google_protobuf.Empty) (*PatreonToken, error) { 373 + handler = func(ctx context.Context, req *GetTokenRequest) (*GetTokenResponse, error) { 375 374 resp, err := s.interceptor( 376 375 func(ctx context.Context, req interface{}) (interface{}, error) { 377 - typedReq, ok := req.(*google_protobuf.Empty) 376 + typedReq, ok := req.(*GetTokenRequest) 378 377 if !ok { 379 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 378 + return nil, twirp.InternalError("failed type assertion req.(*GetTokenRequest) when calling interceptor") 380 379 } 381 - return s.Patreon.GetToken(ctx, typedReq) 380 + return s.PatreonService.GetToken(ctx, typedReq) 382 381 }, 383 382 )(ctx, req) 384 383 if resp != nil { 385 - typedResp, ok := resp.(*PatreonToken) 384 + typedResp, ok := resp.(*GetTokenResponse) 386 385 if !ok { 387 - return nil, twirp.InternalError("failed type assertion resp.(*PatreonToken) when calling interceptor") 386 + return nil, twirp.InternalError("failed type assertion resp.(*GetTokenResponse) when calling interceptor") 388 387 } 389 388 return typedResp, err 390 389 } ··· 393 392 } 394 393 395 394 // Call service method 396 - var respContent *PatreonToken 395 + var respContent *GetTokenResponse 397 396 func() { 398 397 defer ensurePanicResponses(ctx, resp, s.hooks) 399 398 respContent, err = handler(ctx, reqContent) ··· 404 403 return 405 404 } 406 405 if respContent == nil { 407 - s.writeError(ctx, resp, twirp.InternalError("received a nil *PatreonToken and nil error while calling GetToken. nil responses are not supported")) 406 + s.writeError(ctx, resp, twirp.InternalError("received a nil *GetTokenResponse and nil error while calling GetToken. nil responses are not supported")) 408 407 return 409 408 } 410 409 ··· 430 429 callResponseSent(ctx, s.hooks) 431 430 } 432 431 433 - func (s *patreonServer) serveGetTokenProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 432 + func (s *patreonServiceServer) serveGetTokenProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 434 433 var err error 435 434 ctx = ctxsetters.WithMethodName(ctx, "GetToken") 436 435 ctx, err = callRequestRouted(ctx, s.hooks) ··· 444 443 s.handleRequestBodyError(ctx, resp, "failed to read request body", err) 445 444 return 446 445 } 447 - reqContent := new(google_protobuf.Empty) 446 + reqContent := new(GetTokenRequest) 448 447 if err = proto.Unmarshal(buf, reqContent); err != nil { 449 448 s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) 450 449 return 451 450 } 452 451 453 - handler := s.Patreon.GetToken 452 + handler := s.PatreonService.GetToken 454 453 if s.interceptor != nil { 455 - handler = func(ctx context.Context, req *google_protobuf.Empty) (*PatreonToken, error) { 454 + handler = func(ctx context.Context, req *GetTokenRequest) (*GetTokenResponse, error) { 456 455 resp, err := s.interceptor( 457 456 func(ctx context.Context, req interface{}) (interface{}, error) { 458 - typedReq, ok := req.(*google_protobuf.Empty) 457 + typedReq, ok := req.(*GetTokenRequest) 459 458 if !ok { 460 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 459 + return nil, twirp.InternalError("failed type assertion req.(*GetTokenRequest) when calling interceptor") 461 460 } 462 - return s.Patreon.GetToken(ctx, typedReq) 461 + return s.PatreonService.GetToken(ctx, typedReq) 463 462 }, 464 463 )(ctx, req) 465 464 if resp != nil { 466 - typedResp, ok := resp.(*PatreonToken) 465 + typedResp, ok := resp.(*GetTokenResponse) 467 466 if !ok { 468 - return nil, twirp.InternalError("failed type assertion resp.(*PatreonToken) when calling interceptor") 467 + return nil, twirp.InternalError("failed type assertion resp.(*GetTokenResponse) when calling interceptor") 469 468 } 470 469 return typedResp, err 471 470 } ··· 474 473 } 475 474 476 475 // Call service method 477 - var respContent *PatreonToken 476 + var respContent *GetTokenResponse 478 477 func() { 479 478 defer ensurePanicResponses(ctx, resp, s.hooks) 480 479 respContent, err = handler(ctx, reqContent) ··· 485 484 return 486 485 } 487 486 if respContent == nil { 488 - s.writeError(ctx, resp, twirp.InternalError("received a nil *PatreonToken and nil error while calling GetToken. nil responses are not supported")) 487 + s.writeError(ctx, resp, twirp.InternalError("received a nil *GetTokenResponse and nil error while calling GetToken. nil responses are not supported")) 489 488 return 490 489 } 491 490 ··· 509 508 callResponseSent(ctx, s.hooks) 510 509 } 511 510 512 - func (s *patreonServer) ServiceDescriptor() ([]byte, int) { 511 + func (s *patreonServiceServer) ServiceDescriptor() ([]byte, int) { 513 512 return twirpFileDescriptor0, 0 514 513 } 515 514 516 - func (s *patreonServer) ProtocGenTwirpVersion() string { 515 + func (s *patreonServiceServer) ProtocGenTwirpVersion() string { 517 516 return "v8.1.3" 518 517 } 519 518 520 519 // PathPrefix returns the base service path, in the form: "/<prefix>/<package>.<Service>/" 521 520 // that is everything in a Twirp route except for the <Method>. This can be used for routing, 522 521 // for example to identify the requests that are targeted to this service in a mux. 523 - func (s *patreonServer) PathPrefix() string { 524 - return baseServicePath(s.pathPrefix, "xeiaso.net.internal", "Patreon") 522 + func (s *patreonServiceServer) PathPrefix() string { 523 + return baseServicePath(s.pathPrefix, "xeiaso.net.admin.v1", "PatreonService") 525 524 } 526 525 527 - // =============== 528 - // Admin Interface 529 - // =============== 526 + // ====================== 527 + // AdminService Interface 528 + // ====================== 530 529 531 - type Admin interface { 532 - Rebuild(context.Context, *google_protobuf.Empty) (*xeiaso_net.BuildInfo, error) 530 + // AdminService provides administrative operations. 531 + type AdminService interface { 532 + // Rebuild triggers a site rebuild. 533 + Rebuild(context.Context, *RebuildRequest) (*RebuildResponse, error) 533 534 } 534 535 535 - // ===================== 536 - // Admin Protobuf Client 537 - // ===================== 536 + // ============================ 537 + // AdminService Protobuf Client 538 + // ============================ 538 539 539 - type adminProtobufClient struct { 540 + type adminServiceProtobufClient struct { 540 541 client HTTPClient 541 542 urls [1]string 542 543 interceptor twirp.Interceptor 543 544 opts twirp.ClientOptions 544 545 } 545 546 546 - // NewAdminProtobufClient creates a Protobuf client that implements the Admin interface. 547 + // NewAdminServiceProtobufClient creates a Protobuf client that implements the AdminService interface. 547 548 // It communicates using Protobuf and can be configured with a custom HTTPClient. 548 - func NewAdminProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Admin { 549 + func NewAdminServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AdminService { 549 550 if c, ok := client.(*http.Client); ok { 550 551 client = withoutRedirects(c) 551 552 } ··· 565 566 566 567 // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 567 568 serviceURL := sanitizeBaseURL(baseURL) 568 - serviceURL += baseServicePath(pathPrefix, "xeiaso.net.internal", "Admin") 569 + serviceURL += baseServicePath(pathPrefix, "xeiaso.net.admin.v1", "AdminService") 569 570 urls := [1]string{ 570 571 serviceURL + "Rebuild", 571 572 } 572 573 573 - return &adminProtobufClient{ 574 + return &adminServiceProtobufClient{ 574 575 client: client, 575 576 urls: urls, 576 577 interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), ··· 578 579 } 579 580 } 580 581 581 - func (c *adminProtobufClient) Rebuild(ctx context.Context, in *google_protobuf.Empty) (*xeiaso_net.BuildInfo, error) { 582 - ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.internal") 583 - ctx = ctxsetters.WithServiceName(ctx, "Admin") 582 + func (c *adminServiceProtobufClient) Rebuild(ctx context.Context, in *RebuildRequest) (*RebuildResponse, error) { 583 + ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.admin.v1") 584 + ctx = ctxsetters.WithServiceName(ctx, "AdminService") 584 585 ctx = ctxsetters.WithMethodName(ctx, "Rebuild") 585 586 caller := c.callRebuild 586 587 if c.interceptor != nil { 587 - caller = func(ctx context.Context, req *google_protobuf.Empty) (*xeiaso_net.BuildInfo, error) { 588 + caller = func(ctx context.Context, req *RebuildRequest) (*RebuildResponse, error) { 588 589 resp, err := c.interceptor( 589 590 func(ctx context.Context, req interface{}) (interface{}, error) { 590 - typedReq, ok := req.(*google_protobuf.Empty) 591 + typedReq, ok := req.(*RebuildRequest) 591 592 if !ok { 592 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 593 + return nil, twirp.InternalError("failed type assertion req.(*RebuildRequest) when calling interceptor") 593 594 } 594 595 return c.callRebuild(ctx, typedReq) 595 596 }, 596 597 )(ctx, req) 597 598 if resp != nil { 598 - typedResp, ok := resp.(*xeiaso_net.BuildInfo) 599 + typedResp, ok := resp.(*RebuildResponse) 599 600 if !ok { 600 - return nil, twirp.InternalError("failed type assertion resp.(*xeiaso_net.BuildInfo) when calling interceptor") 601 + return nil, twirp.InternalError("failed type assertion resp.(*RebuildResponse) when calling interceptor") 601 602 } 602 603 return typedResp, err 603 604 } ··· 607 608 return caller(ctx, in) 608 609 } 609 610 610 - func (c *adminProtobufClient) callRebuild(ctx context.Context, in *google_protobuf.Empty) (*xeiaso_net.BuildInfo, error) { 611 - out := new(xeiaso_net.BuildInfo) 611 + func (c *adminServiceProtobufClient) callRebuild(ctx context.Context, in *RebuildRequest) (*RebuildResponse, error) { 612 + out := new(RebuildResponse) 612 613 ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 613 614 if err != nil { 614 615 twerr, ok := err.(twirp.Error) ··· 624 625 return out, nil 625 626 } 626 627 627 - // ================= 628 - // Admin JSON Client 629 - // ================= 628 + // ======================== 629 + // AdminService JSON Client 630 + // ======================== 630 631 631 - type adminJSONClient struct { 632 + type adminServiceJSONClient struct { 632 633 client HTTPClient 633 634 urls [1]string 634 635 interceptor twirp.Interceptor 635 636 opts twirp.ClientOptions 636 637 } 637 638 638 - // NewAdminJSONClient creates a JSON client that implements the Admin interface. 639 + // NewAdminServiceJSONClient creates a JSON client that implements the AdminService interface. 639 640 // It communicates using JSON and can be configured with a custom HTTPClient. 640 - func NewAdminJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Admin { 641 + func NewAdminServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AdminService { 641 642 if c, ok := client.(*http.Client); ok { 642 643 client = withoutRedirects(c) 643 644 } ··· 657 658 658 659 // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 659 660 serviceURL := sanitizeBaseURL(baseURL) 660 - serviceURL += baseServicePath(pathPrefix, "xeiaso.net.internal", "Admin") 661 + serviceURL += baseServicePath(pathPrefix, "xeiaso.net.admin.v1", "AdminService") 661 662 urls := [1]string{ 662 663 serviceURL + "Rebuild", 663 664 } 664 665 665 - return &adminJSONClient{ 666 + return &adminServiceJSONClient{ 666 667 client: client, 667 668 urls: urls, 668 669 interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), ··· 670 671 } 671 672 } 672 673 673 - func (c *adminJSONClient) Rebuild(ctx context.Context, in *google_protobuf.Empty) (*xeiaso_net.BuildInfo, error) { 674 - ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.internal") 675 - ctx = ctxsetters.WithServiceName(ctx, "Admin") 674 + func (c *adminServiceJSONClient) Rebuild(ctx context.Context, in *RebuildRequest) (*RebuildResponse, error) { 675 + ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.admin.v1") 676 + ctx = ctxsetters.WithServiceName(ctx, "AdminService") 676 677 ctx = ctxsetters.WithMethodName(ctx, "Rebuild") 677 678 caller := c.callRebuild 678 679 if c.interceptor != nil { 679 - caller = func(ctx context.Context, req *google_protobuf.Empty) (*xeiaso_net.BuildInfo, error) { 680 + caller = func(ctx context.Context, req *RebuildRequest) (*RebuildResponse, error) { 680 681 resp, err := c.interceptor( 681 682 func(ctx context.Context, req interface{}) (interface{}, error) { 682 - typedReq, ok := req.(*google_protobuf.Empty) 683 + typedReq, ok := req.(*RebuildRequest) 683 684 if !ok { 684 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 685 + return nil, twirp.InternalError("failed type assertion req.(*RebuildRequest) when calling interceptor") 685 686 } 686 687 return c.callRebuild(ctx, typedReq) 687 688 }, 688 689 )(ctx, req) 689 690 if resp != nil { 690 - typedResp, ok := resp.(*xeiaso_net.BuildInfo) 691 + typedResp, ok := resp.(*RebuildResponse) 691 692 if !ok { 692 - return nil, twirp.InternalError("failed type assertion resp.(*xeiaso_net.BuildInfo) when calling interceptor") 693 + return nil, twirp.InternalError("failed type assertion resp.(*RebuildResponse) when calling interceptor") 693 694 } 694 695 return typedResp, err 695 696 } ··· 699 700 return caller(ctx, in) 700 701 } 701 702 702 - func (c *adminJSONClient) callRebuild(ctx context.Context, in *google_protobuf.Empty) (*xeiaso_net.BuildInfo, error) { 703 - out := new(xeiaso_net.BuildInfo) 703 + func (c *adminServiceJSONClient) callRebuild(ctx context.Context, in *RebuildRequest) (*RebuildResponse, error) { 704 + out := new(RebuildResponse) 704 705 ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 705 706 if err != nil { 706 707 twerr, ok := err.(twirp.Error) ··· 716 717 return out, nil 717 718 } 718 719 719 - // ==================== 720 - // Admin Server Handler 721 - // ==================== 720 + // =========================== 721 + // AdminService Server Handler 722 + // =========================== 722 723 723 - type adminServer struct { 724 - Admin 724 + type adminServiceServer struct { 725 + AdminService 725 726 interceptor twirp.Interceptor 726 727 hooks *twirp.ServerHooks 727 728 pathPrefix string // prefix for routing ··· 729 730 jsonCamelCase bool // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names 730 731 } 731 732 732 - // NewAdminServer builds a TwirpServer that can be used as an http.Handler to handle 733 + // NewAdminServiceServer builds a TwirpServer that can be used as an http.Handler to handle 733 734 // HTTP requests that are routed to the right method in the provided svc implementation. 734 735 // The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks). 735 - func NewAdminServer(svc Admin, opts ...interface{}) TwirpServer { 736 + func NewAdminServiceServer(svc AdminService, opts ...interface{}) TwirpServer { 736 737 serverOpts := newServerOpts(opts) 737 738 738 739 // Using ReadOpt allows backwards and forwards compatibility with new options in the future ··· 745 746 pathPrefix = "/twirp" // default prefix 746 747 } 747 748 748 - return &adminServer{ 749 - Admin: svc, 749 + return &adminServiceServer{ 750 + AdminService: svc, 750 751 hooks: serverOpts.Hooks, 751 752 interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...), 752 753 pathPrefix: pathPrefix, ··· 757 758 758 759 // writeError writes an HTTP response with a valid Twirp error format, and triggers hooks. 759 760 // If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) 760 - func (s *adminServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { 761 + func (s *adminServiceServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { 761 762 writeError(ctx, resp, err, s.hooks) 762 763 } 763 764 764 765 // handleRequestBodyError is used to handle error when the twirp server cannot read request 765 - func (s *adminServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { 766 + func (s *adminServiceServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { 766 767 if context.Canceled == ctx.Err() { 767 768 s.writeError(ctx, resp, twirp.NewError(twirp.Canceled, "failed to read request: context canceled")) 768 769 return ··· 774 775 s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err)) 775 776 } 776 777 777 - // AdminPathPrefix is a convenience constant that may identify URL paths. 778 + // AdminServicePathPrefix is a convenience constant that may identify URL paths. 778 779 // Should be used with caution, it only matches routes generated by Twirp Go clients, 779 780 // with the default "/twirp" prefix and default CamelCase service and method names. 780 781 // More info: https://twitchtv.github.io/twirp/docs/routing.html 781 - const AdminPathPrefix = "/twirp/xeiaso.net.internal.Admin/" 782 + const AdminServicePathPrefix = "/twirp/xeiaso.net.admin.v1.AdminService/" 782 783 783 - func (s *adminServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { 784 + func (s *adminServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { 784 785 ctx := req.Context() 785 - ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.internal") 786 - ctx = ctxsetters.WithServiceName(ctx, "Admin") 786 + ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.admin.v1") 787 + ctx = ctxsetters.WithServiceName(ctx, "AdminService") 787 788 ctx = ctxsetters.WithResponseWriter(ctx, resp) 788 789 789 790 var err error ··· 801 802 802 803 // Verify path format: [<prefix>]/<package>.<Service>/<Method> 803 804 prefix, pkgService, method := parseTwirpPath(req.URL.Path) 804 - if pkgService != "xeiaso.net.internal.Admin" { 805 + if pkgService != "xeiaso.net.admin.v1.AdminService" { 805 806 msg := fmt.Sprintf("no handler for path %q", req.URL.Path) 806 807 s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) 807 808 return ··· 823 824 } 824 825 } 825 826 826 - func (s *adminServer) serveRebuild(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 827 + func (s *adminServiceServer) serveRebuild(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 827 828 header := req.Header.Get("Content-Type") 828 829 i := strings.Index(header, ";") 829 830 if i == -1 { ··· 841 842 } 842 843 } 843 844 844 - func (s *adminServer) serveRebuildJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 845 + func (s *adminServiceServer) serveRebuildJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 845 846 var err error 846 847 ctx = ctxsetters.WithMethodName(ctx, "Rebuild") 847 848 ctx, err = callRequestRouted(ctx, s.hooks) ··· 856 857 s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 857 858 return 858 859 } 859 - reqContent := new(google_protobuf.Empty) 860 + reqContent := new(RebuildRequest) 860 861 unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} 861 862 if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { 862 863 s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 863 864 return 864 865 } 865 866 866 - handler := s.Admin.Rebuild 867 + handler := s.AdminService.Rebuild 867 868 if s.interceptor != nil { 868 - handler = func(ctx context.Context, req *google_protobuf.Empty) (*xeiaso_net.BuildInfo, error) { 869 + handler = func(ctx context.Context, req *RebuildRequest) (*RebuildResponse, error) { 869 870 resp, err := s.interceptor( 870 871 func(ctx context.Context, req interface{}) (interface{}, error) { 871 - typedReq, ok := req.(*google_protobuf.Empty) 872 + typedReq, ok := req.(*RebuildRequest) 872 873 if !ok { 873 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 874 + return nil, twirp.InternalError("failed type assertion req.(*RebuildRequest) when calling interceptor") 874 875 } 875 - return s.Admin.Rebuild(ctx, typedReq) 876 + return s.AdminService.Rebuild(ctx, typedReq) 876 877 }, 877 878 )(ctx, req) 878 879 if resp != nil { 879 - typedResp, ok := resp.(*xeiaso_net.BuildInfo) 880 + typedResp, ok := resp.(*RebuildResponse) 880 881 if !ok { 881 - return nil, twirp.InternalError("failed type assertion resp.(*xeiaso_net.BuildInfo) when calling interceptor") 882 + return nil, twirp.InternalError("failed type assertion resp.(*RebuildResponse) when calling interceptor") 882 883 } 883 884 return typedResp, err 884 885 } ··· 887 888 } 888 889 889 890 // Call service method 890 - var respContent *xeiaso_net.BuildInfo 891 + var respContent *RebuildResponse 891 892 func() { 892 893 defer ensurePanicResponses(ctx, resp, s.hooks) 893 894 respContent, err = handler(ctx, reqContent) ··· 898 899 return 899 900 } 900 901 if respContent == nil { 901 - s.writeError(ctx, resp, twirp.InternalError("received a nil *xeiaso_net.BuildInfo and nil error while calling Rebuild. nil responses are not supported")) 902 + s.writeError(ctx, resp, twirp.InternalError("received a nil *RebuildResponse and nil error while calling Rebuild. nil responses are not supported")) 902 903 return 903 904 } 904 905 ··· 924 925 callResponseSent(ctx, s.hooks) 925 926 } 926 927 927 - func (s *adminServer) serveRebuildProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 928 + func (s *adminServiceServer) serveRebuildProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 928 929 var err error 929 930 ctx = ctxsetters.WithMethodName(ctx, "Rebuild") 930 931 ctx, err = callRequestRouted(ctx, s.hooks) ··· 938 939 s.handleRequestBodyError(ctx, resp, "failed to read request body", err) 939 940 return 940 941 } 941 - reqContent := new(google_protobuf.Empty) 942 + reqContent := new(RebuildRequest) 942 943 if err = proto.Unmarshal(buf, reqContent); err != nil { 943 944 s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) 944 945 return 945 946 } 946 947 947 - handler := s.Admin.Rebuild 948 + handler := s.AdminService.Rebuild 948 949 if s.interceptor != nil { 949 - handler = func(ctx context.Context, req *google_protobuf.Empty) (*xeiaso_net.BuildInfo, error) { 950 + handler = func(ctx context.Context, req *RebuildRequest) (*RebuildResponse, error) { 950 951 resp, err := s.interceptor( 951 952 func(ctx context.Context, req interface{}) (interface{}, error) { 952 - typedReq, ok := req.(*google_protobuf.Empty) 953 + typedReq, ok := req.(*RebuildRequest) 953 954 if !ok { 954 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 955 + return nil, twirp.InternalError("failed type assertion req.(*RebuildRequest) when calling interceptor") 955 956 } 956 - return s.Admin.Rebuild(ctx, typedReq) 957 + return s.AdminService.Rebuild(ctx, typedReq) 957 958 }, 958 959 )(ctx, req) 959 960 if resp != nil { 960 - typedResp, ok := resp.(*xeiaso_net.BuildInfo) 961 + typedResp, ok := resp.(*RebuildResponse) 961 962 if !ok { 962 - return nil, twirp.InternalError("failed type assertion resp.(*xeiaso_net.BuildInfo) when calling interceptor") 963 + return nil, twirp.InternalError("failed type assertion resp.(*RebuildResponse) when calling interceptor") 963 964 } 964 965 return typedResp, err 965 966 } ··· 968 969 } 969 970 970 971 // Call service method 971 - var respContent *xeiaso_net.BuildInfo 972 + var respContent *RebuildResponse 972 973 func() { 973 974 defer ensurePanicResponses(ctx, resp, s.hooks) 974 975 respContent, err = handler(ctx, reqContent) ··· 979 980 return 980 981 } 981 982 if respContent == nil { 982 - s.writeError(ctx, resp, twirp.InternalError("received a nil *xeiaso_net.BuildInfo and nil error while calling Rebuild. nil responses are not supported")) 983 + s.writeError(ctx, resp, twirp.InternalError("received a nil *RebuildResponse and nil error while calling Rebuild. nil responses are not supported")) 983 984 return 984 985 } 985 986 ··· 1003 1004 callResponseSent(ctx, s.hooks) 1004 1005 } 1005 1006 1006 - func (s *adminServer) ServiceDescriptor() ([]byte, int) { 1007 + func (s *adminServiceServer) ServiceDescriptor() ([]byte, int) { 1007 1008 return twirpFileDescriptor0, 1 1008 1009 } 1009 1010 1010 - func (s *adminServer) ProtocGenTwirpVersion() string { 1011 + func (s *adminServiceServer) ProtocGenTwirpVersion() string { 1011 1012 return "v8.1.3" 1012 1013 } 1013 1014 1014 1015 // PathPrefix returns the base service path, in the form: "/<prefix>/<package>.<Service>/" 1015 1016 // that is everything in a Twirp route except for the <Method>. This can be used for routing, 1016 1017 // for example to identify the requests that are targeted to this service in a mux. 1017 - func (s *adminServer) PathPrefix() string { 1018 - return baseServicePath(s.pathPrefix, "xeiaso.net.internal", "Admin") 1018 + func (s *adminServiceServer) PathPrefix() string { 1019 + return baseServicePath(s.pathPrefix, "xeiaso.net.admin.v1", "AdminService") 1019 1020 } 1020 1021 1021 1022 // ===== ··· 1584 1585 } 1585 1586 1586 1587 var twirpFileDescriptor0 = []byte{ 1587 - // 291 bytes of a gzipped FileDescriptorProto 1588 - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0x3d, 0x4f, 0xc3, 0x30, 1589 - 0x10, 0x86, 0x15, 0x3e, 0x5a, 0xea, 0x06, 0x86, 0x20, 0x50, 0x15, 0x04, 0xb4, 0xb0, 0x74, 0x72, 1590 - 0xa4, 0xc0, 0xc0, 0xda, 0x4a, 0x15, 0x62, 0xab, 0xa2, 0x4c, 0x2c, 0x95, 0xd3, 0x5e, 0x8a, 0x45, 1591 - 0x62, 0x5b, 0xf6, 0x15, 0x25, 0x3f, 0x89, 0x7f, 0x89, 0x62, 0x27, 0xa2, 0xe2, 0x63, 0xf4, 0x7b, 1592 - 0xcf, 0x3d, 0x79, 0x73, 0xe4, 0x8c, 0x0b, 0x04, 0x2d, 0x58, 0x41, 0x95, 0x96, 0x28, 0x83, 0xf3, 1593 - 0x0a, 0x38, 0x33, 0x92, 0x0a, 0x40, 0xda, 0x8d, 0xc2, 0xab, 0xad, 0x94, 0xdb, 0x02, 0x22, 0x8b, 1594 - 0x64, 0xbb, 0x3c, 0x82, 0x52, 0x61, 0xed, 0x36, 0xc2, 0xdb, 0x9f, 0x43, 0xe4, 0x25, 0x18, 0x64, 1595 - 0xa5, 0x6a, 0x01, 0xbf, 0x02, 0xc3, 0x11, 0xdc, 0xeb, 0xee, 0xd3, 0x23, 0xfe, 0x92, 0xa1, 0x06, 1596 - 0x29, 0x52, 0xf9, 0x0e, 0x22, 0x98, 0x10, 0x9f, 0xad, 0xd7, 0x60, 0xcc, 0x0a, 0x9b, 0xf7, 0xc8, 1597 - 0x1b, 0x7b, 0xd3, 0x41, 0x32, 0x74, 0x99, 0x43, 0xae, 0x09, 0xb1, 0xb3, 0x15, 0xd6, 0x0a, 0x46, 1598 - 0x07, 0x16, 0x18, 0xd8, 0x24, 0xad, 0x15, 0x04, 0xf7, 0xe4, 0x54, 0x43, 0xae, 0xc1, 0xbc, 0xb5, 1599 - 0x8a, 0x43, 0x4b, 0xf8, 0x6d, 0xe8, 0x1c, 0x31, 0xe9, 0x41, 0xa5, 0xb8, 0xae, 0x47, 0x47, 0x63, 1600 - 0x6f, 0x3a, 0x8c, 0x43, 0xea, 0x7a, 0xd3, 0xae, 0x37, 0x4d, 0xbb, 0xde, 0x49, 0x4b, 0xc6, 0x4b, 1601 - 0xd2, 0x6f, 0xab, 0x06, 0x0b, 0x72, 0xf2, 0x0c, 0xe8, 0x54, 0x97, 0xbf, 0x56, 0x17, 0xcd, 0x3d, 1602 - 0xc2, 0x09, 0xfd, 0xe3, 0x78, 0x74, 0xff, 0x67, 0xe3, 0x19, 0x39, 0x9e, 0x6d, 0x4a, 0x2e, 0x82, 1603 - 0x27, 0xd2, 0x4f, 0x20, 0xdb, 0xf1, 0x62, 0xf3, 0xaf, 0xee, 0x62, 0x5f, 0x37, 0x6f, 0xd0, 0x17, 1604 - 0x91, 0xcb, 0xf9, 0xf8, 0xf5, 0xe6, 0x3b, 0x8f, 0x3e, 0x1e, 0xa3, 0xee, 0x4b, 0x11, 0x6b, 0xcc, 1605 - 0x2a, 0xcb, 0x7a, 0x56, 0xf4, 0xf0, 0x15, 0x00, 0x00, 0xff, 0xff, 0x82, 0x33, 0x91, 0x6c, 0xdc, 1606 - 0x01, 0x00, 0x00, 1588 + // 463 bytes of a gzipped FileDescriptorProto 1589 + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xd1, 0x8a, 0xd3, 0x40, 1590 + 0x14, 0x86, 0x49, 0x56, 0x57, 0x7b, 0xb6, 0xee, 0xae, 0x59, 0xd0, 0x12, 0x90, 0xba, 0xdd, 0x15, 1591 + 0xbc, 0x71, 0x86, 0x54, 0x41, 0x88, 0x57, 0xdb, 0x9b, 0x45, 0xc5, 0x52, 0x62, 0xa9, 0x8b, 0x14, 1592 + 0x4a, 0xda, 0x9e, 0xd6, 0xc1, 0xed, 0x4c, 0xcc, 0x9c, 0x86, 0xf6, 0x75, 0xbc, 0xd3, 0xd7, 0xf0, 1593 + 0xce, 0xc7, 0xf0, 0xd2, 0xa7, 0x90, 0xcc, 0x24, 0x6d, 0x95, 0xe0, 0xde, 0x0d, 0xdf, 0x7c, 0xf3, 1594 + 0xcf, 0xc9, 0x9f, 0x81, 0xe6, 0x0a, 0x45, 0xac, 0x15, 0x97, 0x48, 0x3c, 0x9e, 0x2e, 0x84, 0xe4, 1595 + 0x59, 0x60, 0x17, 0x2c, 0x49, 0x15, 0x29, 0xef, 0xc4, 0x0a, 0x4c, 0x22, 0x31, 0xcb, 0xb3, 0xc0, 1596 + 0x6f, 0xce, 0x95, 0x9a, 0x5f, 0x23, 0x37, 0xca, 0x78, 0x39, 0xe3, 0x24, 0x16, 0xa8, 0x29, 0x5e, 1597 + 0x24, 0xf6, 0x94, 0xef, 0xef, 0xc4, 0x66, 0x01, 0x5f, 0xa1, 0x16, 0x84, 0x76, 0xaf, 0x75, 0x1f, 1598 + 0x8e, 0x2e, 0x91, 0xfa, 0xea, 0x33, 0xca, 0x08, 0xbf, 0x2c, 0x51, 0x53, 0xeb, 0x2d, 0x1c, 0x6f, 1599 + 0x91, 0x4e, 0x94, 0xd4, 0xe8, 0xbd, 0x84, 0xdb, 0x94, 0x83, 0x86, 0xf3, 0xd8, 0x79, 0x7a, 0xd0, 1600 + 0x3e, 0x65, 0x15, 0x83, 0xb0, 0x5e, 0x4c, 0x29, 0x2a, 0x69, 0x4f, 0x5a, 0xbf, 0xf5, 0xcd, 0x81, 1601 + 0xfa, 0x2e, 0xf7, 0x4e, 0xa1, 0x1e, 0x4f, 0x26, 0xa8, 0xf5, 0x68, 0x1b, 0x58, 0x8b, 0x0e, 0x2c, 1602 + 0xb3, 0xca, 0x23, 0x00, 0xb3, 0x37, 0xa2, 0x75, 0x82, 0x0d, 0xd7, 0x08, 0x35, 0x43, 0xfa, 0xeb, 1603 + 0x04, 0xbd, 0x33, 0xb8, 0x97, 0xe2, 0x2c, 0x45, 0xfd, 0xa9, 0x88, 0xd8, 0x33, 0x46, 0xbd, 0x80, 1604 + 0x36, 0xa3, 0x0d, 0xfb, 0xb8, 0x4a, 0x44, 0xba, 0x6e, 0xdc, 0x32, 0x13, 0xfb, 0xcc, 0xb6, 0xc4, 1605 + 0xca, 0x96, 0x58, 0xbf, 0x6c, 0x29, 0x2a, 0xcc, 0xd6, 0x31, 0x1c, 0x46, 0x38, 0x5e, 0x8a, 0xeb, 1606 + 0x69, 0x59, 0xc5, 0x1b, 0x38, 0xda, 0x90, 0x4d, 0x13, 0x60, 0xc0, 0x48, 0xc8, 0x99, 0x2a, 0xea, 1607 + 0x68, 0xec, 0xd6, 0x91, 0x05, 0xac, 0x93, 0x0b, 0xaf, 0xe5, 0x4c, 0x45, 0xb5, 0x71, 0xb9, 0x6c, 1608 + 0x0b, 0x38, 0x2c, 0x8a, 0x78, 0x8f, 0x69, 0x26, 0x26, 0xe8, 0x7d, 0x80, 0xbb, 0x65, 0xd1, 0xde, 1609 + 0x79, 0x65, 0xa3, 0xff, 0xfc, 0x1a, 0xff, 0xc9, 0x0d, 0x96, 0x9d, 0xb1, 0x3d, 0x85, 0xfa, 0x45, 1610 + 0xbe, 0x59, 0x5e, 0xd4, 0x87, 0x3b, 0xc5, 0x67, 0x78, 0x67, 0x95, 0x09, 0x7f, 0x7f, 0xb6, 0x7f, 1611 + 0xfe, 0x7f, 0xc9, 0xde, 0xd2, 0xf9, 0xe1, 0xc0, 0xc3, 0x89, 0x5a, 0x54, 0xb9, 0x1d, 0x30, 0xf7, 1612 + 0xf7, 0xf2, 0xae, 0x7b, 0xce, 0xc7, 0x67, 0x5b, 0x85, 0x67, 0x2f, 0xf8, 0x1c, 0x25, 0xaf, 0x78, 1613 + 0xe9, 0xaf, 0xcc, 0x22, 0x0b, 0xbe, 0xba, 0x7b, 0x57, 0xdd, 0x8b, 0xef, 0xee, 0xc9, 0x95, 0x3d, 1614 + 0xd5, 0x45, 0x62, 0x26, 0x8e, 0x0d, 0x82, 0x9f, 0x25, 0x1d, 0x76, 0x91, 0x86, 0x86, 0x0e, 0x07, 1615 + 0xc1, 0x2f, 0xb7, 0x59, 0x41, 0x87, 0x97, 0xbd, 0xce, 0x3b, 0xa4, 0x78, 0x1a, 0x53, 0xfc, 0xdb, 1616 + 0x7d, 0x60, 0x8d, 0x30, 0xec, 0x22, 0x85, 0xa1, 0x71, 0xc2, 0x70, 0x10, 0x8c, 0xf7, 0xcd, 0x83, 1617 + 0x78, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0xe3, 0x7a, 0x8d, 0x25, 0x7c, 0x03, 0x00, 0x00, 1607 1618 }
+3 -3
internal/lume/lume.go
··· 28 28 "gopkg.in/mxpv/patreon-go.v1" 29 29 "tailscale.com/metrics" 30 30 "within.website/x/web" 31 + protofeed "xeiaso.net/v4/gen/external/protofeed/v1" 32 + mi "xeiaso.net/v4/gen/within/website/x/mi/v1" 33 + announce "xeiaso.net/v4/gen/within/website/x/mimi/announce/v1" 31 34 "xeiaso.net/v4/internal/config" 32 35 "xeiaso.net/v4/internal/jsonfeed" 33 - "xeiaso.net/v4/pb/external/mi" 34 - "xeiaso.net/v4/pb/external/mimi/announce" 35 - "xeiaso.net/v4/pb/external/protofeed" 36 36 ) 37 37 38 38 var (
+8 -9
internal/saasproxytoken/tokensource.go
··· 7 7 "time" 8 8 9 9 "golang.org/x/oauth2" 10 - "google.golang.org/protobuf/types/known/emptypb" 11 - "xeiaso.net/v4/internal/adminpb" 10 + adminpb "xeiaso.net/v4/gen/xeiaso/net/admin/v1" 12 11 ) 13 12 14 13 type remoteTokenSource struct { ··· 16 15 lock sync.Mutex 17 16 remoteURL string 18 17 httpClient *http.Client 19 - ptc adminpb.Patreon 18 + ptc adminpb.PatreonService 20 19 } 21 20 22 21 func (r *remoteTokenSource) fetchToken() (*oauth2.Token, error) { 23 22 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) 24 23 defer cancel() 25 24 26 - resp, err := r.ptc.GetToken(ctx, &emptypb.Empty{}) 25 + resp, err := r.ptc.GetToken(ctx, &adminpb.GetTokenRequest{}) 27 26 if err != nil { 28 27 return nil, err 29 28 } 30 29 31 30 var tok oauth2.Token 32 - tok.AccessToken = resp.AccessToken 33 - tok.TokenType = resp.TokenType 34 - tok.RefreshToken = resp.RefreshToken 35 - tok.Expiry = resp.Expiry.AsTime() 31 + tok.AccessToken = resp.Token.AccessToken 32 + tok.TokenType = resp.Token.TokenType 33 + tok.RefreshToken = resp.Token.RefreshToken 34 + tok.Expiry = resp.Token.Expiry.AsTime() 36 35 37 36 return &tok, nil 38 37 } ··· 65 64 return &remoteTokenSource{ 66 65 remoteURL: remoteURL, 67 66 httpClient: httpClient, 68 - ptc: adminpb.NewPatreonProtobufClient(remoteURL, httpClient), 67 + ptc: adminpb.NewPatreonServiceProtobufClient(remoteURL, httpClient), 69 68 } 70 69 }
-5
pb/external/generate.go
··· 1 - package protofeed 2 - 3 - //go:generate protoc --proto_path=. --proto_path=.. --go_out=./protofeed --go_opt=paths=source_relative ./protofeed.proto 4 - //go:generate protoc --proto_path=. --proto_path=.. --go_out=./mimi/announce --go_opt=paths=source_relative --twirp_out=./mimi/announce --twirp_opt=paths=source_relative ./mimi-announce.proto 5 - //go:generate protoc --proto_path=. --proto_path=.. --go_out=./mi --go_opt=paths=source_relative --twirp_out=./mi --twirp_opt=paths=source_relative ./mi.proto
+4 -3
pb/external/mi.proto proto/within/website/x/mi/v1/mi.proto
··· 1 1 // This is a subset of github:Xe/x/proto/mi.proto 2 2 3 3 syntax = "proto3"; 4 - package within.website.x.mi; 5 - option go_package = "xeiaso.net/v4/pb/external/mi"; 4 + package within.website.x.mi.v1; 6 5 7 6 import "google/protobuf/empty.proto"; 8 7 import "google/protobuf/timestamp.proto"; 8 + 9 + option go_package = "miv1"; 9 10 10 11 // Event is a single event that Xe will be attending. 11 12 message Event { ··· 35 36 service Events { 36 37 // Get fetches the current feed of upcoming events. 37 38 rpc Get(google.protobuf.Empty) returns (EventFeed); 38 - } 39 + }
+44 -43
pb/external/mi/mi.pb.go gen/within/website/x/mi/v1/mi.pb.go
··· 3 3 // Code generated by protoc-gen-go. DO NOT EDIT. 4 4 // versions: 5 5 // protoc-gen-go v1.36.11 6 - // protoc v6.33.4 7 - // source: mi.proto 6 + // protoc (unknown) 7 + // source: within/website/x/mi/v1/mi.proto 8 8 9 - package mi 9 + package miv1 10 10 11 11 import ( 12 12 protoreflect "google.golang.org/protobuf/reflect/protoreflect" ··· 48 48 49 49 func (x *Event) Reset() { 50 50 *x = Event{} 51 - mi := &file_mi_proto_msgTypes[0] 51 + mi := &file_within_website_x_mi_v1_mi_proto_msgTypes[0] 52 52 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 53 53 ms.StoreMessageInfo(mi) 54 54 } ··· 60 60 func (*Event) ProtoMessage() {} 61 61 62 62 func (x *Event) ProtoReflect() protoreflect.Message { 63 - mi := &file_mi_proto_msgTypes[0] 63 + mi := &file_within_website_x_mi_v1_mi_proto_msgTypes[0] 64 64 if x != nil { 65 65 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 66 66 if ms.LoadMessageInfo() == nil { ··· 73 73 74 74 // Deprecated: Use Event.ProtoReflect.Descriptor instead. 75 75 func (*Event) Descriptor() ([]byte, []int) { 76 - return file_mi_proto_rawDescGZIP(), []int{0} 76 + return file_within_website_x_mi_v1_mi_proto_rawDescGZIP(), []int{0} 77 77 } 78 78 79 79 func (x *Event) GetName() string { ··· 136 136 137 137 func (x *EventFeed) Reset() { 138 138 *x = EventFeed{} 139 - mi := &file_mi_proto_msgTypes[1] 139 + mi := &file_within_website_x_mi_v1_mi_proto_msgTypes[1] 140 140 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 141 141 ms.StoreMessageInfo(mi) 142 142 } ··· 148 148 func (*EventFeed) ProtoMessage() {} 149 149 150 150 func (x *EventFeed) ProtoReflect() protoreflect.Message { 151 - mi := &file_mi_proto_msgTypes[1] 151 + mi := &file_within_website_x_mi_v1_mi_proto_msgTypes[1] 152 152 if x != nil { 153 153 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 154 154 if ms.LoadMessageInfo() == nil { ··· 161 161 162 162 // Deprecated: Use EventFeed.ProtoReflect.Descriptor instead. 163 163 func (*EventFeed) Descriptor() ([]byte, []int) { 164 - return file_mi_proto_rawDescGZIP(), []int{1} 164 + return file_within_website_x_mi_v1_mi_proto_rawDescGZIP(), []int{1} 165 165 } 166 166 167 167 func (x *EventFeed) GetEvents() []*Event { ··· 171 171 return nil 172 172 } 173 173 174 - var File_mi_proto protoreflect.FileDescriptor 174 + var File_within_website_x_mi_v1_mi_proto protoreflect.FileDescriptor 175 175 176 - const file_mi_proto_rawDesc = "" + 176 + const file_within_website_x_mi_v1_mi_proto_rawDesc = "" + 177 177 "\n" + 178 - "\bmi.proto\x12\x13within.website.x.mi\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xed\x01\n" + 178 + "\x1fwithin/website/x/mi/v1/mi.proto\x12\x16within.website.x.mi.v1\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xed\x01\n" + 179 179 "\x05Event\x12\x12\n" + 180 180 "\x04name\x18\x01 \x01(\tR\x04name\x12\x10\n" + 181 181 "\x03url\x18\x02 \x01(\tR\x03url\x129\n" + ··· 184 184 "\bend_date\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\aendDate\x12\x1a\n" + 185 185 "\blocation\x18\x05 \x01(\tR\blocation\x12\x0e\n" + 186 186 "\x02id\x18\x06 \x01(\x05R\x02id\x12 \n" + 187 - "\vdescription\x18\a \x01(\tR\vdescription\"?\n" + 188 - "\tEventFeed\x122\n" + 189 - "\x06events\x18\x01 \x03(\v2\x1a.within.website.x.mi.EventR\x06events2G\n" + 190 - "\x06Events\x12=\n" + 191 - "\x03Get\x12\x16.google.protobuf.Empty\x1a\x1e.within.website.x.mi.EventFeedB\x1eZ\x1cxeiaso.net/v4/pb/external/mib\x06proto3" 187 + "\vdescription\x18\a \x01(\tR\vdescription\"B\n" + 188 + "\tEventFeed\x125\n" + 189 + "\x06events\x18\x01 \x03(\v2\x1d.within.website.x.mi.v1.EventR\x06events2J\n" + 190 + "\x06Events\x12@\n" + 191 + "\x03Get\x12\x16.google.protobuf.Empty\x1a!.within.website.x.mi.v1.EventFeedB\xd1\x01\n" + 192 + "\x1acom.within.website.x.mi.v1B\aMiProtoP\x01Z-xeiaso.net/v4/gen/within/website/x/mi/v1;miv1\xa2\x02\x04WWXM\xaa\x02\x16Within.Website.X.Mi.V1\xca\x02\x16Within\\Website\\X\\Mi\\V1\xe2\x02\"Within\\Website\\X\\Mi\\V1\\GPBMetadata\xea\x02\x1aWithin::Website::X::Mi::V1b\x06proto3" 192 193 193 194 var ( 194 - file_mi_proto_rawDescOnce sync.Once 195 - file_mi_proto_rawDescData []byte 195 + file_within_website_x_mi_v1_mi_proto_rawDescOnce sync.Once 196 + file_within_website_x_mi_v1_mi_proto_rawDescData []byte 196 197 ) 197 198 198 - func file_mi_proto_rawDescGZIP() []byte { 199 - file_mi_proto_rawDescOnce.Do(func() { 200 - file_mi_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_mi_proto_rawDesc), len(file_mi_proto_rawDesc))) 199 + func file_within_website_x_mi_v1_mi_proto_rawDescGZIP() []byte { 200 + file_within_website_x_mi_v1_mi_proto_rawDescOnce.Do(func() { 201 + file_within_website_x_mi_v1_mi_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_within_website_x_mi_v1_mi_proto_rawDesc), len(file_within_website_x_mi_v1_mi_proto_rawDesc))) 201 202 }) 202 - return file_mi_proto_rawDescData 203 + return file_within_website_x_mi_v1_mi_proto_rawDescData 203 204 } 204 205 205 - var file_mi_proto_msgTypes = make([]protoimpl.MessageInfo, 2) 206 - var file_mi_proto_goTypes = []any{ 207 - (*Event)(nil), // 0: within.website.x.mi.Event 208 - (*EventFeed)(nil), // 1: within.website.x.mi.EventFeed 206 + var file_within_website_x_mi_v1_mi_proto_msgTypes = make([]protoimpl.MessageInfo, 2) 207 + var file_within_website_x_mi_v1_mi_proto_goTypes = []any{ 208 + (*Event)(nil), // 0: within.website.x.mi.v1.Event 209 + (*EventFeed)(nil), // 1: within.website.x.mi.v1.EventFeed 209 210 (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp 210 211 (*emptypb.Empty)(nil), // 3: google.protobuf.Empty 211 212 } 212 - var file_mi_proto_depIdxs = []int32{ 213 - 2, // 0: within.website.x.mi.Event.start_date:type_name -> google.protobuf.Timestamp 214 - 2, // 1: within.website.x.mi.Event.end_date:type_name -> google.protobuf.Timestamp 215 - 0, // 2: within.website.x.mi.EventFeed.events:type_name -> within.website.x.mi.Event 216 - 3, // 3: within.website.x.mi.Events.Get:input_type -> google.protobuf.Empty 217 - 1, // 4: within.website.x.mi.Events.Get:output_type -> within.website.x.mi.EventFeed 213 + var file_within_website_x_mi_v1_mi_proto_depIdxs = []int32{ 214 + 2, // 0: within.website.x.mi.v1.Event.start_date:type_name -> google.protobuf.Timestamp 215 + 2, // 1: within.website.x.mi.v1.Event.end_date:type_name -> google.protobuf.Timestamp 216 + 0, // 2: within.website.x.mi.v1.EventFeed.events:type_name -> within.website.x.mi.v1.Event 217 + 3, // 3: within.website.x.mi.v1.Events.Get:input_type -> google.protobuf.Empty 218 + 1, // 4: within.website.x.mi.v1.Events.Get:output_type -> within.website.x.mi.v1.EventFeed 218 219 4, // [4:5] is the sub-list for method output_type 219 220 3, // [3:4] is the sub-list for method input_type 220 221 3, // [3:3] is the sub-list for extension type_name ··· 222 223 0, // [0:3] is the sub-list for field type_name 223 224 } 224 225 225 - func init() { file_mi_proto_init() } 226 - func file_mi_proto_init() { 227 - if File_mi_proto != nil { 226 + func init() { file_within_website_x_mi_v1_mi_proto_init() } 227 + func file_within_website_x_mi_v1_mi_proto_init() { 228 + if File_within_website_x_mi_v1_mi_proto != nil { 228 229 return 229 230 } 230 231 type x struct{} 231 232 out := protoimpl.TypeBuilder{ 232 233 File: protoimpl.DescBuilder{ 233 234 GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 234 - RawDescriptor: unsafe.Slice(unsafe.StringData(file_mi_proto_rawDesc), len(file_mi_proto_rawDesc)), 235 + RawDescriptor: unsafe.Slice(unsafe.StringData(file_within_website_x_mi_v1_mi_proto_rawDesc), len(file_within_website_x_mi_v1_mi_proto_rawDesc)), 235 236 NumEnums: 0, 236 237 NumMessages: 2, 237 238 NumExtensions: 0, 238 239 NumServices: 1, 239 240 }, 240 - GoTypes: file_mi_proto_goTypes, 241 - DependencyIndexes: file_mi_proto_depIdxs, 242 - MessageInfos: file_mi_proto_msgTypes, 241 + GoTypes: file_within_website_x_mi_v1_mi_proto_goTypes, 242 + DependencyIndexes: file_within_website_x_mi_v1_mi_proto_depIdxs, 243 + MessageInfos: file_within_website_x_mi_v1_mi_proto_msgTypes, 243 244 }.Build() 244 - File_mi_proto = out.File 245 - file_mi_proto_goTypes = nil 246 - file_mi_proto_depIdxs = nil 245 + File_within_website_x_mi_v1_mi_proto = out.File 246 + file_within_website_x_mi_v1_mi_proto_goTypes = nil 247 + file_within_website_x_mi_v1_mi_proto_depIdxs = nil 247 248 }
+38 -31
pb/external/mi/mi.twirp.go gen/within/website/x/mi/v1/mi.twirp.go
··· 1 1 // Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT. 2 - // source: mi.proto 2 + // source: within/website/x/mi/v1/mi.proto 3 3 4 - package mi 4 + package miv1 5 5 6 6 import context "context" 7 7 import fmt "fmt" ··· 72 72 73 73 // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 74 74 serviceURL := sanitizeBaseURL(baseURL) 75 - serviceURL += baseServicePath(pathPrefix, "within.website.x.mi", "Events") 75 + serviceURL += baseServicePath(pathPrefix, "within.website.x.mi.v1", "Events") 76 76 urls := [1]string{ 77 77 serviceURL + "Get", 78 78 } ··· 86 86 } 87 87 88 88 func (c *eventsProtobufClient) Get(ctx context.Context, in *google_protobuf.Empty) (*EventFeed, error) { 89 - ctx = ctxsetters.WithPackageName(ctx, "within.website.x.mi") 89 + ctx = ctxsetters.WithPackageName(ctx, "within.website.x.mi.v1") 90 90 ctx = ctxsetters.WithServiceName(ctx, "Events") 91 91 ctx = ctxsetters.WithMethodName(ctx, "Get") 92 92 caller := c.callGet ··· 164 164 165 165 // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 166 166 serviceURL := sanitizeBaseURL(baseURL) 167 - serviceURL += baseServicePath(pathPrefix, "within.website.x.mi", "Events") 167 + serviceURL += baseServicePath(pathPrefix, "within.website.x.mi.v1", "Events") 168 168 urls := [1]string{ 169 169 serviceURL + "Get", 170 170 } ··· 178 178 } 179 179 180 180 func (c *eventsJSONClient) Get(ctx context.Context, in *google_protobuf.Empty) (*EventFeed, error) { 181 - ctx = ctxsetters.WithPackageName(ctx, "within.website.x.mi") 181 + ctx = ctxsetters.WithPackageName(ctx, "within.website.x.mi.v1") 182 182 ctx = ctxsetters.WithServiceName(ctx, "Events") 183 183 ctx = ctxsetters.WithMethodName(ctx, "Get") 184 184 caller := c.callGet ··· 285 285 // Should be used with caution, it only matches routes generated by Twirp Go clients, 286 286 // with the default "/twirp" prefix and default CamelCase service and method names. 287 287 // More info: https://twitchtv.github.io/twirp/docs/routing.html 288 - const EventsPathPrefix = "/twirp/within.website.x.mi.Events/" 288 + const EventsPathPrefix = "/twirp/within.website.x.mi.v1.Events/" 289 289 290 290 func (s *eventsServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { 291 291 ctx := req.Context() 292 - ctx = ctxsetters.WithPackageName(ctx, "within.website.x.mi") 292 + ctx = ctxsetters.WithPackageName(ctx, "within.website.x.mi.v1") 293 293 ctx = ctxsetters.WithServiceName(ctx, "Events") 294 294 ctx = ctxsetters.WithResponseWriter(ctx, resp) 295 295 ··· 308 308 309 309 // Verify path format: [<prefix>]/<package>.<Service>/<Method> 310 310 prefix, pkgService, method := parseTwirpPath(req.URL.Path) 311 - if pkgService != "within.website.x.mi.Events" { 311 + if pkgService != "within.website.x.mi.v1.Events" { 312 312 msg := fmt.Sprintf("no handler for path %q", req.URL.Path) 313 313 s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) 314 314 return ··· 522 522 // that is everything in a Twirp route except for the <Method>. This can be used for routing, 523 523 // for example to identify the requests that are targeted to this service in a mux. 524 524 func (s *eventsServer) PathPrefix() string { 525 - return baseServicePath(s.pathPrefix, "within.website.x.mi", "Events") 525 + return baseServicePath(s.pathPrefix, "within.website.x.mi.v1", "Events") 526 526 } 527 527 528 528 // ===== ··· 1091 1091 } 1092 1092 1093 1093 var twirpFileDescriptor0 = []byte{ 1094 - // 315 bytes of a gzipped FileDescriptorProto 1095 - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0x4f, 0x4b, 0xc3, 0x40, 1096 - 0x10, 0xc5, 0x49, 0xd3, 0xa6, 0xed, 0x14, 0x44, 0x56, 0x90, 0x10, 0xa5, 0x86, 0x9e, 0x7a, 0xda, 1097 - 0x40, 0xd5, 0x83, 0x07, 0x11, 0xc4, 0xda, 0x7b, 0xf0, 0xe4, 0x45, 0x36, 0xdd, 0xb1, 0x2e, 0x64, 1098 - 0x77, 0x43, 0x76, 0xfa, 0xc7, 0x0f, 0xed, 0x77, 0x90, 0x6c, 0xac, 0x88, 0x7f, 0xf0, 0x36, 0xf3, 1099 - 0xf2, 0x7b, 0xf3, 0x66, 0xb2, 0x30, 0xd0, 0x8a, 0x57, 0xb5, 0x25, 0xcb, 0x8e, 0xb6, 0x8a, 0x5e, 1100 - 0x94, 0xe1, 0x5b, 0x2c, 0x9c, 0x22, 0xe4, 0x3b, 0xae, 0x55, 0x72, 0xb2, 0xb2, 0x76, 0x55, 0x62, 1101 - 0xe6, 0x91, 0x62, 0xfd, 0x9c, 0xa1, 0xae, 0xe8, 0xb5, 0x75, 0x24, 0x67, 0xdf, 0x3f, 0x92, 0xd2, 1102 - 0xe8, 0x48, 0xe8, 0xaa, 0x05, 0x26, 0x6f, 0x01, 0xf4, 0xe6, 0x1b, 0x34, 0xc4, 0x18, 0x74, 0x8d, 1103 - 0xd0, 0x18, 0x07, 0x69, 0x30, 0x1d, 0xe6, 0xbe, 0x66, 0x87, 0x10, 0xae, 0xeb, 0x32, 0xee, 0x78, 1104 - 0xa9, 0x29, 0xd9, 0x15, 0x80, 0x23, 0x51, 0xd3, 0x93, 0x14, 0x84, 0x71, 0x98, 0x06, 0xd3, 0xd1, 1105 - 0x2c, 0xe1, 0x6d, 0x0a, 0xdf, 0xa7, 0xf0, 0x87, 0x7d, 0x4a, 0x3e, 0xf4, 0xf4, 0x9d, 0x20, 0x64, 1106 - 0x97, 0x30, 0x40, 0x23, 0x5b, 0x63, 0xf7, 0x5f, 0x63, 0x1f, 0x8d, 0xf4, 0xb6, 0x04, 0x06, 0xa5, 1107 - 0x5d, 0x0a, 0x52, 0xd6, 0xc4, 0x3d, 0xbf, 0xc8, 0x67, 0xcf, 0x0e, 0xa0, 0xa3, 0x64, 0x1c, 0xa5, 1108 - 0xc1, 0xb4, 0x97, 0x77, 0x94, 0x64, 0x29, 0x8c, 0x24, 0xba, 0x65, 0xad, 0x2a, 0x8f, 0xf7, 0x3d, 1109 - 0xfe, 0x55, 0x9a, 0xdc, 0xc0, 0xd0, 0x9f, 0x7b, 0x8f, 0x28, 0xd9, 0x0c, 0x22, 0x6c, 0x1a, 0x17, 1110 - 0x07, 0x69, 0xe8, 0xf7, 0xf9, 0xe5, 0x07, 0x73, 0xcf, 0xe7, 0x1f, 0xe4, 0x6c, 0x01, 0x91, 0x17, 1111 - 0x1c, 0xbb, 0x86, 0x70, 0x81, 0xc4, 0x8e, 0x7f, 0x1c, 0x31, 0x6f, 0x1e, 0x20, 0x19, 0xff, 0x3d, 1112 - 0xac, 0x09, 0xbf, 0x1d, 0x3f, 0x9e, 0xee, 0x50, 0x09, 0x67, 0xb9, 0x41, 0xca, 0x36, 0x17, 0x59, 1113 - 0x55, 0x64, 0xb8, 0x23, 0xac, 0x8d, 0x28, 0x33, 0xad, 0x8a, 0xc8, 0xcf, 0x3b, 0x7f, 0x0f, 0x00, 1114 - 0x00, 0xff, 0xff, 0xfd, 0x46, 0x1a, 0xf8, 0xff, 0x01, 0x00, 0x00, 1094 + // 425 bytes of a gzipped FileDescriptorProto 1095 + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcf, 0xaa, 0xd3, 0x40, 1096 + 0x14, 0xc6, 0x49, 0xfa, 0xef, 0x76, 0x0a, 0x22, 0xb3, 0x28, 0x21, 0x22, 0x37, 0x76, 0xd5, 0x8d, 1097 + 0x33, 0xa4, 0x7a, 0x17, 0xc6, 0x8d, 0x14, 0xaf, 0x17, 0x84, 0x40, 0x29, 0xd2, 0x16, 0x09, 0xc8, 1098 + 0xb4, 0x39, 0xd6, 0x03, 0x9d, 0x4c, 0x49, 0xce, 0x4d, 0xeb, 0xeb, 0xb8, 0xf4, 0x51, 0xdc, 0xf9, 1099 + 0x0a, 0x2e, 0x05, 0xdf, 0x41, 0x32, 0x49, 0x45, 0xb4, 0x7a, 0x77, 0x33, 0xe7, 0xfb, 0x7d, 0xdf, 1100 + 0x99, 0x73, 0x12, 0x76, 0x79, 0x40, 0xfa, 0x80, 0x99, 0x3c, 0xc0, 0xba, 0x40, 0x02, 0x79, 0x94, 1101 + 0x1a, 0x65, 0x19, 0x4a, 0x8d, 0x62, 0x9f, 0x1b, 0x32, 0x7c, 0x58, 0x03, 0xa2, 0x01, 0xc4, 0x51, 1102 + 0x68, 0x14, 0x65, 0xe8, 0x3f, 0xd8, 0x1a, 0xb3, 0xdd, 0x81, 0xb4, 0xd4, 0xfa, 0xf6, 0xbd, 0x04, 1103 + 0xbd, 0xa7, 0x8f, 0xb5, 0xc9, 0xbf, 0xfc, 0x53, 0x24, 0xd4, 0x50, 0x90, 0xd2, 0xfb, 0x1a, 0x18, 1104 + 0xfd, 0x70, 0x58, 0xe7, 0xba, 0x84, 0x8c, 0x38, 0x67, 0xed, 0x4c, 0x69, 0xf0, 0x9c, 0xc0, 0x19, 1105 + 0xf7, 0xe7, 0xf6, 0xcc, 0xef, 0xb3, 0xd6, 0x6d, 0xbe, 0xf3, 0x5c, 0x5b, 0xaa, 0x8e, 0xfc, 0x19, 1106 + 0x63, 0x05, 0xa9, 0x9c, 0xde, 0xa5, 0x8a, 0xc0, 0x6b, 0x05, 0xce, 0x78, 0x30, 0xf1, 0x45, 0xdd, 1107 + 0x45, 0x9c, 0xba, 0x88, 0x37, 0xa7, 0x2e, 0xf3, 0xbe, 0xa5, 0x5f, 0x2a, 0x02, 0x7e, 0xc5, 0x2e, 1108 + 0x20, 0x4b, 0x6b, 0x63, 0xfb, 0x4e, 0x63, 0x0f, 0xb2, 0xd4, 0xda, 0x7c, 0x76, 0xb1, 0x33, 0x1b, 1109 + 0x45, 0x68, 0x32, 0xaf, 0x63, 0x1f, 0xf2, 0xeb, 0xce, 0xef, 0x31, 0x17, 0x53, 0xaf, 0x1b, 0x38, 1110 + 0xe3, 0xce, 0xdc, 0xc5, 0x94, 0x07, 0x6c, 0x90, 0x42, 0xb1, 0xc9, 0x71, 0x6f, 0xf1, 0x9e, 0xc5, 1111 + 0x7f, 0x2f, 0x8d, 0xa6, 0xac, 0x6f, 0xc7, 0x7d, 0x05, 0x90, 0xf2, 0x2b, 0xd6, 0x85, 0xea, 0x52, 1112 + 0x78, 0x4e, 0xd0, 0x1a, 0x0f, 0x26, 0x0f, 0xc5, 0xf9, 0x1d, 0x0b, 0x6b, 0x99, 0x37, 0xf0, 0xe4, 1113 + 0x35, 0xeb, 0xda, 0x42, 0xc1, 0x5f, 0xb0, 0xd6, 0x0d, 0x10, 0x1f, 0xfe, 0x35, 0xc7, 0x75, 0xf5, 1114 + 0x0d, 0xfc, 0x47, 0xff, 0xcd, 0xab, 0x9e, 0x30, 0xfd, 0xea, 0x30, 0x7f, 0x63, 0xf4, 0x3f, 0xc0, 1115 + 0x69, 0x2f, 0xc6, 0x59, 0x95, 0x39, 0x73, 0xde, 0x3e, 0x3e, 0x02, 0xaa, 0xc2, 0x88, 0x0c, 0x48, 1116 + 0x96, 0x4f, 0xe5, 0x16, 0x32, 0x79, 0xfe, 0x97, 0x79, 0xae, 0xb1, 0x0c, 0x3f, 0xb9, 0xed, 0xe5, 1117 + 0x72, 0x15, 0x7f, 0x76, 0x87, 0xcb, 0x3a, 0x79, 0xd9, 0x24, 0xaf, 0x44, 0x8c, 0x62, 0x11, 0x7e, 1118 + 0x39, 0x09, 0x49, 0x23, 0x24, 0xab, 0x24, 0xc6, 0x64, 0x11, 0x7e, 0x73, 0x47, 0xe7, 0x85, 0xe4, 1119 + 0x66, 0x36, 0x8d, 0x81, 0x54, 0xaa, 0x48, 0x7d, 0x77, 0xfd, 0x1a, 0x8a, 0xa2, 0x86, 0x8a, 0xa2, 1120 + 0x55, 0x14, 0xc5, 0x18, 0x45, 0x8b, 0x70, 0xdd, 0xb5, 0x6b, 0x78, 0xf2, 0x33, 0x00, 0x00, 0xff, 1121 + 0xff, 0x59, 0x0d, 0x82, 0xcd, 0xd3, 0x02, 0x00, 0x00, 1115 1122 }
+4 -3
pb/external/mimi-announce.proto proto/within/website/x/mimi/announce/v1/announce.proto
··· 1 1 syntax = "proto3"; 2 2 package within.website.x.mimi.announce.v1; 3 - option go_package = "xeiaso.net/v4/pb/external/mimi/announce"; 4 3 4 + import "external/protofeed/v1/protofeed.proto"; 5 5 import "google/protobuf/empty.proto"; 6 - import "protofeed.proto"; 6 + 7 + option go_package = "announcev1"; 7 8 8 9 service Announce { 9 10 rpc Announce(protofeed.Item) returns (google.protobuf.Empty) {} 10 - } 11 + }
-68
pb/external/mimi/announce/mimi-announce.pb.go
··· 1 - // Code generated by protoc-gen-go. DO NOT EDIT. 2 - // versions: 3 - // protoc-gen-go v1.36.11 4 - // protoc v6.33.4 5 - // source: mimi-announce.proto 6 - 7 - package announce 8 - 9 - import ( 10 - protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 - protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 - emptypb "google.golang.org/protobuf/types/known/emptypb" 13 - reflect "reflect" 14 - unsafe "unsafe" 15 - protofeed "xeiaso.net/v4/pb/external/protofeed" 16 - ) 17 - 18 - const ( 19 - // Verify that this generated code is sufficiently up-to-date. 20 - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 21 - // Verify that runtime/protoimpl is sufficiently up-to-date. 22 - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 23 - ) 24 - 25 - var File_mimi_announce_proto protoreflect.FileDescriptor 26 - 27 - const file_mimi_announce_proto_rawDesc = "" + 28 - "\n" + 29 - "\x13mimi-announce.proto\x12!within.website.x.mimi.announce.v1\x1a\x1bgoogle/protobuf/empty.proto\x1a\x0fprotofeed.proto2A\n" + 30 - "\bAnnounce\x125\n" + 31 - "\bAnnounce\x12\x0f.protofeed.Item\x1a\x16.google.protobuf.Empty\"\x00B)Z'xeiaso.net/v4/pb/external/mimi/announceb\x06proto3" 32 - 33 - var file_mimi_announce_proto_goTypes = []any{ 34 - (*protofeed.Item)(nil), // 0: protofeed.Item 35 - (*emptypb.Empty)(nil), // 1: google.protobuf.Empty 36 - } 37 - var file_mimi_announce_proto_depIdxs = []int32{ 38 - 0, // 0: within.website.x.mimi.announce.v1.Announce.Announce:input_type -> protofeed.Item 39 - 1, // 1: within.website.x.mimi.announce.v1.Announce.Announce:output_type -> google.protobuf.Empty 40 - 1, // [1:2] is the sub-list for method output_type 41 - 0, // [0:1] is the sub-list for method input_type 42 - 0, // [0:0] is the sub-list for extension type_name 43 - 0, // [0:0] is the sub-list for extension extendee 44 - 0, // [0:0] is the sub-list for field type_name 45 - } 46 - 47 - func init() { file_mimi_announce_proto_init() } 48 - func file_mimi_announce_proto_init() { 49 - if File_mimi_announce_proto != nil { 50 - return 51 - } 52 - type x struct{} 53 - out := protoimpl.TypeBuilder{ 54 - File: protoimpl.DescBuilder{ 55 - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 56 - RawDescriptor: unsafe.Slice(unsafe.StringData(file_mimi_announce_proto_rawDesc), len(file_mimi_announce_proto_rawDesc)), 57 - NumEnums: 0, 58 - NumMessages: 0, 59 - NumExtensions: 0, 60 - NumServices: 1, 61 - }, 62 - GoTypes: file_mimi_announce_proto_goTypes, 63 - DependencyIndexes: file_mimi_announce_proto_depIdxs, 64 - }.Build() 65 - File_mimi_announce_proto = out.File 66 - file_mimi_announce_proto_goTypes = nil 67 - file_mimi_announce_proto_depIdxs = nil 68 - }
+47 -39
pb/external/mimi/announce/mimi-announce.twirp.go gen/within/website/x/mimi/announce/v1/announce.twirp.go
··· 1 1 // Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT. 2 - // source: mimi-announce.proto 2 + // source: within/website/x/mimi/announce/v1/announce.proto 3 3 4 - package announce 4 + package announcev1 5 5 6 6 import context "context" 7 7 import fmt "fmt" ··· 16 16 import twirp "github.com/twitchtv/twirp" 17 17 import ctxsetters "github.com/twitchtv/twirp/ctxsetters" 18 18 19 - import google_protobuf "google.golang.org/protobuf/types/known/emptypb" 20 - import protofeed "xeiaso.net/v4/pb/external/protofeed" 19 + import google_protobuf1 "google.golang.org/protobuf/types/known/emptypb" 20 + import protofeed "xeiaso.net/v4/gen/external/protofeed/v1" 21 21 22 22 import bytes "bytes" 23 23 import errors "errors" ··· 35 35 // ================== 36 36 37 37 type Announce interface { 38 - Announce(context.Context, *protofeed.Item) (*google_protobuf.Empty, error) 38 + Announce(context.Context, *protofeed.Item) (*google_protobuf1.Empty, error) 39 39 } 40 40 41 41 // ======================== ··· 84 84 } 85 85 } 86 86 87 - func (c *announceProtobufClient) Announce(ctx context.Context, in *protofeed.Item) (*google_protobuf.Empty, error) { 87 + func (c *announceProtobufClient) Announce(ctx context.Context, in *protofeed.Item) (*google_protobuf1.Empty, error) { 88 88 ctx = ctxsetters.WithPackageName(ctx, "within.website.x.mimi.announce.v1") 89 89 ctx = ctxsetters.WithServiceName(ctx, "Announce") 90 90 ctx = ctxsetters.WithMethodName(ctx, "Announce") 91 91 caller := c.callAnnounce 92 92 if c.interceptor != nil { 93 - caller = func(ctx context.Context, req *protofeed.Item) (*google_protobuf.Empty, error) { 93 + caller = func(ctx context.Context, req *protofeed.Item) (*google_protobuf1.Empty, error) { 94 94 resp, err := c.interceptor( 95 95 func(ctx context.Context, req interface{}) (interface{}, error) { 96 96 typedReq, ok := req.(*protofeed.Item) ··· 101 101 }, 102 102 )(ctx, req) 103 103 if resp != nil { 104 - typedResp, ok := resp.(*google_protobuf.Empty) 104 + typedResp, ok := resp.(*google_protobuf1.Empty) 105 105 if !ok { 106 - return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf.Empty) when calling interceptor") 106 + return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf1.Empty) when calling interceptor") 107 107 } 108 108 return typedResp, err 109 109 } ··· 113 113 return caller(ctx, in) 114 114 } 115 115 116 - func (c *announceProtobufClient) callAnnounce(ctx context.Context, in *protofeed.Item) (*google_protobuf.Empty, error) { 117 - out := new(google_protobuf.Empty) 116 + func (c *announceProtobufClient) callAnnounce(ctx context.Context, in *protofeed.Item) (*google_protobuf1.Empty, error) { 117 + out := new(google_protobuf1.Empty) 118 118 ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 119 119 if err != nil { 120 120 twerr, ok := err.(twirp.Error) ··· 176 176 } 177 177 } 178 178 179 - func (c *announceJSONClient) Announce(ctx context.Context, in *protofeed.Item) (*google_protobuf.Empty, error) { 179 + func (c *announceJSONClient) Announce(ctx context.Context, in *protofeed.Item) (*google_protobuf1.Empty, error) { 180 180 ctx = ctxsetters.WithPackageName(ctx, "within.website.x.mimi.announce.v1") 181 181 ctx = ctxsetters.WithServiceName(ctx, "Announce") 182 182 ctx = ctxsetters.WithMethodName(ctx, "Announce") 183 183 caller := c.callAnnounce 184 184 if c.interceptor != nil { 185 - caller = func(ctx context.Context, req *protofeed.Item) (*google_protobuf.Empty, error) { 185 + caller = func(ctx context.Context, req *protofeed.Item) (*google_protobuf1.Empty, error) { 186 186 resp, err := c.interceptor( 187 187 func(ctx context.Context, req interface{}) (interface{}, error) { 188 188 typedReq, ok := req.(*protofeed.Item) ··· 193 193 }, 194 194 )(ctx, req) 195 195 if resp != nil { 196 - typedResp, ok := resp.(*google_protobuf.Empty) 196 + typedResp, ok := resp.(*google_protobuf1.Empty) 197 197 if !ok { 198 - return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf.Empty) when calling interceptor") 198 + return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf1.Empty) when calling interceptor") 199 199 } 200 200 return typedResp, err 201 201 } ··· 205 205 return caller(ctx, in) 206 206 } 207 207 208 - func (c *announceJSONClient) callAnnounce(ctx context.Context, in *protofeed.Item) (*google_protobuf.Empty, error) { 209 - out := new(google_protobuf.Empty) 208 + func (c *announceJSONClient) callAnnounce(ctx context.Context, in *protofeed.Item) (*google_protobuf1.Empty, error) { 209 + out := new(google_protobuf1.Empty) 210 210 ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 211 211 if err != nil { 212 212 twerr, ok := err.(twirp.Error) ··· 371 371 372 372 handler := s.Announce.Announce 373 373 if s.interceptor != nil { 374 - handler = func(ctx context.Context, req *protofeed.Item) (*google_protobuf.Empty, error) { 374 + handler = func(ctx context.Context, req *protofeed.Item) (*google_protobuf1.Empty, error) { 375 375 resp, err := s.interceptor( 376 376 func(ctx context.Context, req interface{}) (interface{}, error) { 377 377 typedReq, ok := req.(*protofeed.Item) ··· 382 382 }, 383 383 )(ctx, req) 384 384 if resp != nil { 385 - typedResp, ok := resp.(*google_protobuf.Empty) 385 + typedResp, ok := resp.(*google_protobuf1.Empty) 386 386 if !ok { 387 - return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf.Empty) when calling interceptor") 387 + return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf1.Empty) when calling interceptor") 388 388 } 389 389 return typedResp, err 390 390 } ··· 393 393 } 394 394 395 395 // Call service method 396 - var respContent *google_protobuf.Empty 396 + var respContent *google_protobuf1.Empty 397 397 func() { 398 398 defer ensurePanicResponses(ctx, resp, s.hooks) 399 399 respContent, err = handler(ctx, reqContent) ··· 404 404 return 405 405 } 406 406 if respContent == nil { 407 - s.writeError(ctx, resp, twirp.InternalError("received a nil *google_protobuf.Empty and nil error while calling Announce. nil responses are not supported")) 407 + s.writeError(ctx, resp, twirp.InternalError("received a nil *google_protobuf1.Empty and nil error while calling Announce. nil responses are not supported")) 408 408 return 409 409 } 410 410 ··· 452 452 453 453 handler := s.Announce.Announce 454 454 if s.interceptor != nil { 455 - handler = func(ctx context.Context, req *protofeed.Item) (*google_protobuf.Empty, error) { 455 + handler = func(ctx context.Context, req *protofeed.Item) (*google_protobuf1.Empty, error) { 456 456 resp, err := s.interceptor( 457 457 func(ctx context.Context, req interface{}) (interface{}, error) { 458 458 typedReq, ok := req.(*protofeed.Item) ··· 463 463 }, 464 464 )(ctx, req) 465 465 if resp != nil { 466 - typedResp, ok := resp.(*google_protobuf.Empty) 466 + typedResp, ok := resp.(*google_protobuf1.Empty) 467 467 if !ok { 468 - return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf.Empty) when calling interceptor") 468 + return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf1.Empty) when calling interceptor") 469 469 } 470 470 return typedResp, err 471 471 } ··· 474 474 } 475 475 476 476 // Call service method 477 - var respContent *google_protobuf.Empty 477 + var respContent *google_protobuf1.Empty 478 478 func() { 479 479 defer ensurePanicResponses(ctx, resp, s.hooks) 480 480 respContent, err = handler(ctx, reqContent) ··· 485 485 return 486 486 } 487 487 if respContent == nil { 488 - s.writeError(ctx, resp, twirp.InternalError("received a nil *google_protobuf.Empty and nil error while calling Announce. nil responses are not supported")) 488 + s.writeError(ctx, resp, twirp.InternalError("received a nil *google_protobuf1.Empty and nil error while calling Announce. nil responses are not supported")) 489 489 return 490 490 } 491 491 ··· 1090 1090 } 1091 1091 1092 1092 var twirpFileDescriptor0 = []byte{ 1093 - // 176 bytes of a gzipped FileDescriptorProto 1094 - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xce, 0xcd, 0xcc, 0xcd, 1095 - 0xd4, 0x4d, 0xcc, 0xcb, 0xcb, 0x2f, 0xcd, 0x4b, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 1096 - 0x52, 0x2c, 0xcf, 0x2c, 0xc9, 0xc8, 0xcc, 0xd3, 0x2b, 0x4f, 0x4d, 0x2a, 0xce, 0x2c, 0x49, 0xd5, 1097 - 0xab, 0xd0, 0x03, 0xa9, 0xd2, 0x83, 0xab, 0x2a, 0x33, 0x94, 0x92, 0x4e, 0xcf, 0xcf, 0x4f, 0xcf, 1098 - 0x49, 0xd5, 0x07, 0x6b, 0x48, 0x2a, 0x4d, 0xd3, 0x4f, 0xcd, 0x2d, 0x28, 0xa9, 0x84, 0xe8, 0x97, 1099 - 0xe2, 0x07, 0x53, 0x69, 0xa9, 0xa9, 0x29, 0x10, 0x01, 0x23, 0x47, 0x2e, 0x0e, 0x47, 0xa8, 0x66, 1100 - 0x21, 0x53, 0x24, 0x36, 0xbf, 0x1e, 0x42, 0xa5, 0x67, 0x49, 0x6a, 0xae, 0x94, 0x98, 0x1e, 0xc4, 1101 - 0x5c, 0x3d, 0x98, 0xb9, 0x7a, 0xae, 0x20, 0x73, 0x95, 0x18, 0x9c, 0x34, 0xa3, 0xd4, 0x2b, 0x52, 1102 - 0x33, 0x13, 0x8b, 0xf3, 0xf5, 0xf2, 0x52, 0x4b, 0xf4, 0xcb, 0x4c, 0xf4, 0x0b, 0x92, 0xf4, 0x53, 1103 - 0x2b, 0x4a, 0x52, 0x8b, 0xf2, 0x12, 0x73, 0xf4, 0x41, 0xce, 0xd3, 0x87, 0x39, 0x2f, 0x89, 0x0d, 1104 - 0xac, 0xd9, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x71, 0x54, 0xed, 0xdc, 0x00, 0x00, 0x00, 1093 + // 295 bytes of a gzipped FileDescriptorProto 1094 + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0x4f, 0x4b, 0xc3, 0x30, 1095 + 0x18, 0xc6, 0xb5, 0xa0, 0xc8, 0x40, 0x84, 0x1d, 0x3c, 0xcc, 0xd3, 0x84, 0x79, 0xf3, 0x8d, 0xf1, 1096 + 0xcf, 0x25, 0x82, 0xd0, 0x82, 0x88, 0x87, 0x42, 0x4f, 0x6d, 0x91, 0x5c, 0xd2, 0xed, 0x5d, 0x0d, 1097 + 0xac, 0xc9, 0xd8, 0xb2, 0xae, 0x7e, 0x1c, 0x3d, 0xfa, 0x51, 0xfc, 0x18, 0x1e, 0xfd, 0x14, 0x92, 1098 + 0xa5, 0xa9, 0xde, 0x7a, 0x7b, 0x93, 0x3c, 0xbf, 0xdf, 0x13, 0xde, 0xc1, 0xd5, 0x56, 0x9a, 0x57, 1099 + 0xa9, 0xc8, 0x16, 0x8b, 0xb5, 0x34, 0x48, 0x1a, 0x52, 0xc9, 0x4a, 0x12, 0xa1, 0x94, 0xde, 0xa8, 1100 + 0x29, 0x92, 0x9a, 0x76, 0x33, 0x2c, 0x57, 0xda, 0xe8, 0xe1, 0xd8, 0x11, 0xd0, 0x12, 0xd0, 0x80, 1101 + 0x25, 0xa0, 0x4b, 0xd5, 0x74, 0x34, 0xc1, 0xc6, 0xe0, 0x4a, 0x89, 0x05, 0xd9, 0x21, 0x73, 0xc4, 1102 + 0x99, 0x15, 0x75, 0x07, 0x67, 0x1a, 0x9d, 0x95, 0x5a, 0x97, 0x0b, 0x74, 0xf7, 0xc5, 0x66, 0x4e, 1103 + 0xb0, 0x5a, 0x9a, 0x37, 0xf7, 0x78, 0x1d, 0x0e, 0x8e, 0xc2, 0x56, 0x39, 0xbc, 0xfb, 0x37, 0x9f, 1104 + 0xc0, 0x9f, 0xe6, 0xd9, 0x60, 0x35, 0x3a, 0x05, 0xa7, 0x01, 0xaf, 0x81, 0x47, 0xab, 0x39, 0xdf, 1105 + 0x8b, 0xde, 0x83, 0xc1, 0x64, 0xaa, 0x2b, 0xe8, 0xfd, 0x70, 0x74, 0xec, 0xf5, 0x89, 0x75, 0x24, 1106 + 0xfb, 0x2f, 0x0f, 0x0d, 0x4a, 0xb1, 0xd6, 0xa0, 0xd0, 0x90, 0xfa, 0x96, 0x94, 0xa8, 0x48, 0xef, 1107 + 0xa2, 0xee, 0xfd, 0x5c, 0xd3, 0x8f, 0xe0, 0x20, 0xcb, 0xf2, 0x38, 0xfc, 0x0c, 0xc6, 0x99, 0x2b, 1108 + 0xcf, 0xda, 0xf2, 0x1c, 0x62, 0x5b, 0xee, 0xfb, 0x20, 0xa5, 0x5f, 0x3e, 0xc3, 0xdb, 0x0c, 0xcf, 1109 + 0xb9, 0xcd, 0x70, 0x9f, 0xe1, 0x29, 0xfd, 0x0e, 0x2e, 0x7b, 0x33, 0xfc, 0x29, 0x89, 0x62, 0x34, 1110 + 0x62, 0x26, 0x8c, 0xf8, 0x09, 0x2e, 0x5c, 0x9e, 0xb1, 0x16, 0x60, 0x2c, 0x67, 0xcc, 0x22, 0x8c, 1111 + 0x79, 0x86, 0xb1, 0x94, 0x16, 0x87, 0xbb, 0xad, 0xdd, 0xfc, 0x06, 0x00, 0x00, 0xff, 0xff, 0x13, 1112 + 0xe5, 0xc2, 0xd1, 0x08, 0x02, 0x00, 0x00, 1105 1113 }
+3 -2
pb/external/protofeed.proto proto/external/protofeed/v1/protofeed.proto
··· 1 1 syntax = "proto3"; 2 2 package protofeed; 3 - option go_package = "xeiaso.net/v4/pb/external/protofeed"; 4 3 5 4 import "google/protobuf/timestamp.proto"; 5 + 6 + option go_package = "xeiaso.net/v4/pb/external/protofeed"; 6 7 7 8 // Feed is the root of a Proto Feed document. A feed must at least contain a 8 9 // title and items. ··· 157 158 // (optional, number) specifies how long it takes to listen to or watch, when 158 159 // played at normal speed. 159 160 int32 duration_in_seconds = 5; 160 - } 161 + }
+39 -38
pb/external/protofeed/protofeed.pb.go gen/external/protofeed/v1/protofeed.pb.go
··· 1 1 // Code generated by protoc-gen-go. DO NOT EDIT. 2 2 // versions: 3 3 // protoc-gen-go v1.36.11 4 - // protoc v6.33.4 5 - // source: protofeed.proto 4 + // protoc (unknown) 5 + // source: external/protofeed/v1/protofeed.proto 6 6 7 - package protofeed 7 + package v1 8 8 9 9 import ( 10 10 protoreflect "google.golang.org/protobuf/reflect/protoreflect" ··· 79 79 80 80 func (x *Feed) Reset() { 81 81 *x = Feed{} 82 - mi := &file_protofeed_proto_msgTypes[0] 82 + mi := &file_external_protofeed_v1_protofeed_proto_msgTypes[0] 83 83 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 84 84 ms.StoreMessageInfo(mi) 85 85 } ··· 91 91 func (*Feed) ProtoMessage() {} 92 92 93 93 func (x *Feed) ProtoReflect() protoreflect.Message { 94 - mi := &file_protofeed_proto_msgTypes[0] 94 + mi := &file_external_protofeed_v1_protofeed_proto_msgTypes[0] 95 95 if x != nil { 96 96 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 97 97 if ms.LoadMessageInfo() == nil { ··· 104 104 105 105 // Deprecated: Use Feed.ProtoReflect.Descriptor instead. 106 106 func (*Feed) Descriptor() ([]byte, []int) { 107 - return file_protofeed_proto_rawDescGZIP(), []int{0} 107 + return file_external_protofeed_v1_protofeed_proto_rawDescGZIP(), []int{0} 108 108 } 109 109 110 110 func (x *Feed) GetTitle() string { ··· 205 205 206 206 func (x *Author) Reset() { 207 207 *x = Author{} 208 - mi := &file_protofeed_proto_msgTypes[1] 208 + mi := &file_external_protofeed_v1_protofeed_proto_msgTypes[1] 209 209 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 210 210 ms.StoreMessageInfo(mi) 211 211 } ··· 217 217 func (*Author) ProtoMessage() {} 218 218 219 219 func (x *Author) ProtoReflect() protoreflect.Message { 220 - mi := &file_protofeed_proto_msgTypes[1] 220 + mi := &file_external_protofeed_v1_protofeed_proto_msgTypes[1] 221 221 if x != nil { 222 222 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 223 223 if ms.LoadMessageInfo() == nil { ··· 230 230 231 231 // Deprecated: Use Author.ProtoReflect.Descriptor instead. 232 232 func (*Author) Descriptor() ([]byte, []int) { 233 - return file_protofeed_proto_rawDescGZIP(), []int{1} 233 + return file_external_protofeed_v1_protofeed_proto_rawDescGZIP(), []int{1} 234 234 } 235 235 236 236 func (x *Author) GetName() string { ··· 330 330 331 331 func (x *Item) Reset() { 332 332 *x = Item{} 333 - mi := &file_protofeed_proto_msgTypes[2] 333 + mi := &file_external_protofeed_v1_protofeed_proto_msgTypes[2] 334 334 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 335 335 ms.StoreMessageInfo(mi) 336 336 } ··· 342 342 func (*Item) ProtoMessage() {} 343 343 344 344 func (x *Item) ProtoReflect() protoreflect.Message { 345 - mi := &file_protofeed_proto_msgTypes[2] 345 + mi := &file_external_protofeed_v1_protofeed_proto_msgTypes[2] 346 346 if x != nil { 347 347 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 348 348 if ms.LoadMessageInfo() == nil { ··· 355 355 356 356 // Deprecated: Use Item.ProtoReflect.Descriptor instead. 357 357 func (*Item) Descriptor() ([]byte, []int) { 358 - return file_protofeed_proto_rawDescGZIP(), []int{2} 358 + return file_external_protofeed_v1_protofeed_proto_rawDescGZIP(), []int{2} 359 359 } 360 360 361 361 func (x *Item) GetId() string { ··· 484 484 485 485 func (x *Attachment) Reset() { 486 486 *x = Attachment{} 487 - mi := &file_protofeed_proto_msgTypes[3] 487 + mi := &file_external_protofeed_v1_protofeed_proto_msgTypes[3] 488 488 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 489 489 ms.StoreMessageInfo(mi) 490 490 } ··· 496 496 func (*Attachment) ProtoMessage() {} 497 497 498 498 func (x *Attachment) ProtoReflect() protoreflect.Message { 499 - mi := &file_protofeed_proto_msgTypes[3] 499 + mi := &file_external_protofeed_v1_protofeed_proto_msgTypes[3] 500 500 if x != nil { 501 501 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 502 502 if ms.LoadMessageInfo() == nil { ··· 509 509 510 510 // Deprecated: Use Attachment.ProtoReflect.Descriptor instead. 511 511 func (*Attachment) Descriptor() ([]byte, []int) { 512 - return file_protofeed_proto_rawDescGZIP(), []int{3} 512 + return file_external_protofeed_v1_protofeed_proto_rawDescGZIP(), []int{3} 513 513 } 514 514 515 515 func (x *Attachment) GetUrl() string { ··· 547 547 return 0 548 548 } 549 549 550 - var File_protofeed_proto protoreflect.FileDescriptor 550 + var File_external_protofeed_v1_protofeed_proto protoreflect.FileDescriptor 551 551 552 - const file_protofeed_proto_rawDesc = "" + 552 + const file_external_protofeed_v1_protofeed_proto_rawDesc = "" + 553 553 "\n" + 554 - "\x0fprotofeed.proto\x12\tprotofeed\x1a\x1fgoogle/protobuf/timestamp.proto\"\xd8\x02\n" + 554 + "%external/protofeed/v1/protofeed.proto\x12\tprotofeed\x1a\x1fgoogle/protobuf/timestamp.proto\"\xd8\x02\n" + 555 555 "\x04Feed\x12\x14\n" + 556 556 "\x05title\x18\x02 \x01(\tR\x05title\x12\"\n" + 557 557 "\rhome_page_url\x18\x03 \x01(\tR\vhomePageUrl\x12\x19\n" + ··· 592 592 "\tmime_type\x18\x02 \x01(\tR\bmimeType\x12\x14\n" + 593 593 "\x05title\x18\x03 \x01(\tR\x05title\x12\"\n" + 594 594 "\rsize_in_bytes\x18\x04 \x01(\x05R\vsizeInBytes\x12.\n" + 595 - "\x13duration_in_seconds\x18\x05 \x01(\x05R\x11durationInSecondsB%Z#xeiaso.net/v4/pb/external/protofeedb\x06proto3" 595 + "\x13duration_in_seconds\x18\x05 \x01(\x05R\x11durationInSecondsB\x8c\x01\n" + 596 + "\rcom.protofeedB\x0eProtofeedProtoP\x01Z'xeiaso.net/v4/gen/external/protofeed/v1\xa2\x02\x03PXX\xaa\x02\tProtofeed\xca\x02\tProtofeed\xe2\x02\x15Protofeed\\GPBMetadata\xea\x02\tProtofeedb\x06proto3" 596 597 597 598 var ( 598 - file_protofeed_proto_rawDescOnce sync.Once 599 - file_protofeed_proto_rawDescData []byte 599 + file_external_protofeed_v1_protofeed_proto_rawDescOnce sync.Once 600 + file_external_protofeed_v1_protofeed_proto_rawDescData []byte 600 601 ) 601 602 602 - func file_protofeed_proto_rawDescGZIP() []byte { 603 - file_protofeed_proto_rawDescOnce.Do(func() { 604 - file_protofeed_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_protofeed_proto_rawDesc), len(file_protofeed_proto_rawDesc))) 603 + func file_external_protofeed_v1_protofeed_proto_rawDescGZIP() []byte { 604 + file_external_protofeed_v1_protofeed_proto_rawDescOnce.Do(func() { 605 + file_external_protofeed_v1_protofeed_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_external_protofeed_v1_protofeed_proto_rawDesc), len(file_external_protofeed_v1_protofeed_proto_rawDesc))) 605 606 }) 606 - return file_protofeed_proto_rawDescData 607 + return file_external_protofeed_v1_protofeed_proto_rawDescData 607 608 } 608 609 609 - var file_protofeed_proto_msgTypes = make([]protoimpl.MessageInfo, 4) 610 - var file_protofeed_proto_goTypes = []any{ 610 + var file_external_protofeed_v1_protofeed_proto_msgTypes = make([]protoimpl.MessageInfo, 4) 611 + var file_external_protofeed_v1_protofeed_proto_goTypes = []any{ 611 612 (*Feed)(nil), // 0: protofeed.Feed 612 613 (*Author)(nil), // 1: protofeed.Author 613 614 (*Item)(nil), // 2: protofeed.Item 614 615 (*Attachment)(nil), // 3: protofeed.Attachment 615 616 (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp 616 617 } 617 - var file_protofeed_proto_depIdxs = []int32{ 618 + var file_external_protofeed_v1_protofeed_proto_depIdxs = []int32{ 618 619 1, // 0: protofeed.Feed.authors:type_name -> protofeed.Author 619 620 2, // 1: protofeed.Feed.items:type_name -> protofeed.Item 620 621 4, // 2: protofeed.Item.date_published:type_name -> google.protobuf.Timestamp ··· 628 629 0, // [0:6] is the sub-list for field type_name 629 630 } 630 631 631 - func init() { file_protofeed_proto_init() } 632 - func file_protofeed_proto_init() { 633 - if File_protofeed_proto != nil { 632 + func init() { file_external_protofeed_v1_protofeed_proto_init() } 633 + func file_external_protofeed_v1_protofeed_proto_init() { 634 + if File_external_protofeed_v1_protofeed_proto != nil { 634 635 return 635 636 } 636 637 type x struct{} 637 638 out := protoimpl.TypeBuilder{ 638 639 File: protoimpl.DescBuilder{ 639 640 GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 640 - RawDescriptor: unsafe.Slice(unsafe.StringData(file_protofeed_proto_rawDesc), len(file_protofeed_proto_rawDesc)), 641 + RawDescriptor: unsafe.Slice(unsafe.StringData(file_external_protofeed_v1_protofeed_proto_rawDesc), len(file_external_protofeed_v1_protofeed_proto_rawDesc)), 641 642 NumEnums: 0, 642 643 NumMessages: 4, 643 644 NumExtensions: 0, 644 645 NumServices: 0, 645 646 }, 646 - GoTypes: file_protofeed_proto_goTypes, 647 - DependencyIndexes: file_protofeed_proto_depIdxs, 648 - MessageInfos: file_protofeed_proto_msgTypes, 647 + GoTypes: file_external_protofeed_v1_protofeed_proto_goTypes, 648 + DependencyIndexes: file_external_protofeed_v1_protofeed_proto_depIdxs, 649 + MessageInfos: file_external_protofeed_v1_protofeed_proto_msgTypes, 649 650 }.Build() 650 - File_protofeed_proto = out.File 651 - file_protofeed_proto_goTypes = nil 652 - file_protofeed_proto_depIdxs = nil 651 + File_external_protofeed_v1_protofeed_proto = out.File 652 + file_external_protofeed_v1_protofeed_proto_goTypes = nil 653 + file_external_protofeed_v1_protofeed_proto_depIdxs = nil 653 654 }
-12
pb/generate.go
··· 1 - package pb 2 - 3 - import ( 4 - "embed" 5 - ) 6 - 7 - func init() {} 8 - 9 - //go:generate protoc --proto_path=. --go_out=. --go_opt=paths=source_relative --twirp_out=. --twirp_opt=paths=source_relative xesite.proto 10 - 11 - //go:embed xesite.proto openapi.json external/*.proto 12 - var Proto embed.FS
-360
pb/openapi.json
··· 1 - { 2 - "components": { 3 - "schemas": { 4 - "google.protobuf.Empty": { 5 - "description": "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:", 6 - "type": "object" 7 - }, 8 - "protofeed.Attachment": { 9 - "description": "Attachment is an object representing a file associated with an item.", 10 - "properties": { 11 - "duration_in_seconds": { 12 - "description": "(optional, number) specifies how long it takes to listen to or watch, when\nplayed at normal speed.", 13 - "format": "int32", 14 - "type": "integer" 15 - }, 16 - "mime_type": { 17 - "description": "(required, string) specifies the type of the attachment, such as\n“audio/mpeg.”", 18 - "type": "string" 19 - }, 20 - "size_in_bytes": { 21 - "description": "(optional, number) specifies how large the file is.", 22 - "format": "int32", 23 - "type": "integer" 24 - }, 25 - "title": { 26 - "description": "(optional, string) specifies the title of the attachment.", 27 - "type": "string" 28 - }, 29 - "url": { 30 - "description": "(required, string) specifies the location of the attachment.", 31 - "type": "string" 32 - } 33 - }, 34 - "type": "object" 35 - }, 36 - "protofeed.Author": { 37 - "description": "Author is an object representing the author of the feed or item.", 38 - "properties": { 39 - "avatar": { 40 - "description": "(optional, string) is the URL for an image for the author. As with icon, it\nshould be square and relatively large — such as 512 x 512 pixels — and\nshould use transparency where appropriate, since it may be rendered on a\nnon-white background.", 41 - "type": "string" 42 - }, 43 - "name": { 44 - "description": "(optional, string) is the author’s name.", 45 - "type": "string" 46 - }, 47 - "url": { 48 - "description": "(optional, string) is the URL of a site owned by the author. It could be a\nblog, micro-blog, Twitter account, and so on. Ideally the linked-to page\nprovides a way to contact the author, but that’s not required. The URL\ncould be a mailto: link, though we suspect that will be rare.", 49 - "type": "string" 50 - } 51 - }, 52 - "type": "object" 53 - }, 54 - "protofeed.Feed": { 55 - "description": "Feed is the root of a Proto Feed document. A feed must at least contain a\ntitle and items.", 56 - "properties": { 57 - "authors": { 58 - "description": "(optional, array of objects) specifies the feed authors.", 59 - "items": { 60 - "$ref": "#/components/schemas/protofeed.Author" 61 - }, 62 - "type": "array" 63 - }, 64 - "description": { 65 - "description": "(optional, string) provides more detail, beyond the title, on what the feed\nis about. A feed reader may display this text.", 66 - "type": "string" 67 - }, 68 - "expired": { 69 - "description": "(optional, boolean) says whether or not the feed is finished — that is,\nwhether or not it will ever update again. A feed for a temporary event,\nsuch as an instance of the Olympics, could expire. If the value is true,\nthen it’s expired. Any other value, or the absence of expired, means the\nfeed may continue to update.", 70 - "type": "boolean" 71 - }, 72 - "favicon": { 73 - "description": "(optional, string) is the URL of an image for the feed suitable to be used\nin a source list. It should be square and relatively small, but not smaller\nthan 64 x 64.", 74 - "type": "string" 75 - }, 76 - "feed_url": { 77 - "description": "(optional but strongly recommended, string) is the URL of the feed, and\nserves as the unique identifier for the feed. As with home_page_url, this\nshould be considered required for feeds on the public web.", 78 - "type": "string" 79 - }, 80 - "home_page_url": { 81 - "description": "(optional but strongly recommended, string) is the URL of the resource that\nthe feed describes. This resource may or may not actually be a “home” page,\nbut it should be an HTML page. If a feed is published on the public web,\nthis should be considered as required. But it may not make sense in the\ncase of a file created on a desktop computer, when that file is not shared\nor is shared only privately.", 82 - "type": "string" 83 - }, 84 - "icon": { 85 - "description": "(optional, string) is the URL of an image for the feed suitable to be used\nin a source list. It should be square and relatively large — such as 512 x\n512 — so that it can be scaled down and so that it can look good on retina\ndisplays. It should use transparency where appropriate, since it may be\nrendered on a non-white background.", 86 - "type": "string" 87 - }, 88 - "items": { 89 - "description": "(required, array of objects) contains the items in the feed. This is the\nmost important element of the feed after the version field. Each item is a\nstory, blog post, article, photograph, video, or other thing. For example,\nif a feed contains a long article, a podcast episode, and a photo, those\nthree items would be included in items.", 90 - "items": { 91 - "$ref": "#/components/schemas/protofeed.Item" 92 - }, 93 - "type": "array" 94 - }, 95 - "language": { 96 - "description": "(optional, string) is the primary language for the feed.", 97 - "type": "string" 98 - }, 99 - "title": { 100 - "description": "(required, string) is the name of the feed, which will often correspond to\nthe name of the website (blog, for instance), though not necessarily.", 101 - "type": "string" 102 - }, 103 - "user_comment": { 104 - "description": "(optional, string) is a description of the purpose of the feed. This is for\nthe use of people looking at the raw Protobuf, and should be ignored by\nfeed readers.", 105 - "type": "string" 106 - } 107 - }, 108 - "type": "object" 109 - }, 110 - "protofeed.Item": { 111 - "description": "Item is an object representing a single story, blog post, article,\nphotograph, video, or other thing within a feed.", 112 - "properties": { 113 - "attachments": { 114 - "description": "(optional, array of objects) specifies the attachments associated with the\nitem. Attachments are files that are associated with an item. The value of\nthe attachments field is an array of objects, each of which has a url\nfield, and other fields as specified in the attachment object definition.", 115 - "items": { 116 - "$ref": "#/components/schemas/protofeed.Attachment" 117 - }, 118 - "type": "array" 119 - }, 120 - "authors": { 121 - "description": "(optional, array of objects) has the same structure as the top-level\nauthors. If not specified in an item, then the top-level authors, if\npresent, are the authors of the item.", 122 - "items": { 123 - "$ref": "#/components/schemas/protofeed.Author" 124 - }, 125 - "type": "array" 126 - }, 127 - "banner_image": { 128 - "description": "(optional, string) is the URL of an image to use as a banner. Some blogging\nsystems (such as Medium) display a different banner image in the list view\nfrom the detail view. In those systems, this image should be used in the\nlist view, and image in the detail view.", 129 - "type": "string" 130 - }, 131 - "content_html": { 132 - "description": "(optional, string) is the body of the item. It can be plain text, HTML, or\na snippet of Markdown. (It should not be the entire Markdown document; just\na snippet.) This is complete enough that it can be displayed alone in a\nreader.", 133 - "type": "string" 134 - }, 135 - "content_text": { 136 - "description": "(optional, string) is the body of the item. It can be plain text, HTML, or\na snippet of Markdown. (It should not be the entire Markdown document; just\na snippet.) This is complete enough that it can be displayed alone in a\nreader.", 137 - "type": "string" 138 - }, 139 - "date_modified": { 140 - "description": "(optional, string) specifies the modification date in RFC 3339 format.", 141 - "format": "date-time", 142 - "type": "string" 143 - }, 144 - "date_published": { 145 - "description": "(optional, string) specifies the date in RFC 3339 format.", 146 - "format": "date-time", 147 - "type": "string" 148 - }, 149 - "external_url": { 150 - "description": "(optional, string) is the URL of a page elsewhere. This is especially\nuseful for linkblogs. If url links to where you’re talking about a thing,\nthen external_url links to the thing you’re talking about.", 151 - "type": "string" 152 - }, 153 - "id": { 154 - "description": "(required, string) is unique for that item for that feed over time. If an\nitem is ever updated, the id should be unchanged. New items should never\nuse a previously-used id. If an id is presented as a number or other type,\na JSON Feed reader must coerce it to a string. Ideally, the id is the full\nURL of the resource described by the item, since URLs make great unique\nidentifiers.", 155 - "type": "string" 156 - }, 157 - "image": { 158 - "description": "(optional, string) is the URL of the main image for the item. This image\nmay also appear in the content_html — if so, it’s a hint to the feed reader\nthat this is the main, featured image. Even if it’s not, it will appear in\nthe detail view. Images should be square, with a 4:3 aspect ratio. (We will\nbe flexible on this in the future.)", 159 - "type": "string" 160 - }, 161 - "language": { 162 - "description": "(optional, string) is the language for this item, using the same format as\nthe top-level language field. The value can be different than the primary\nlanguage for the feed when a specific item is written in a different\nlanguage than other items in the feed.", 163 - "type": "string" 164 - }, 165 - "summary": { 166 - "description": "(optional, string) is a plain text sentence or two describing the item.\nThis might be presented in a timeline, for instance, where a detail view\nwould display all of content_html or content_text.", 167 - "type": "string" 168 - }, 169 - "tags": { 170 - "description": "(optional, array of strings) can have any plain text values you want. Tags\ntend to be just one word, but they may be anything. Note: they are not the\nequivalent of Twitter hashtags. Some blogging systems and other feed\nformats call these categories.", 171 - "items": { 172 - "description": "(optional, array of strings) can have any plain text values you want. Tags\ntend to be just one word, but they may be anything. Note: they are not the\nequivalent of Twitter hashtags. Some blogging systems and other feed\nformats call these categories.", 173 - "type": "string" 174 - }, 175 - "type": "array" 176 - }, 177 - "title": { 178 - "description": "(optional, string) is plain text. Microblog items in particular may omit\ntitles.", 179 - "type": "string" 180 - }, 181 - "url": { 182 - "description": "(optional, string) is the URL of the resource described by the item. It’s\nthe permalink. This may be the same as the id — but should be present\nregardless.", 183 - "type": "string" 184 - } 185 - }, 186 - "type": "object" 187 - }, 188 - "within.website.x.mi.Event": { 189 - "description": "Event is a single event that Xe will be attending.", 190 - "properties": { 191 - "description": { 192 - "description": "The description of the event", 193 - "type": "string" 194 - }, 195 - "end_date": { 196 - "description": "The day the event ends", 197 - "format": "date-time", 198 - "type": "string" 199 - }, 200 - "id": { 201 - "description": "The ID of the event", 202 - "format": "int32", 203 - "type": "integer" 204 - }, 205 - "location": { 206 - "description": "The location of the event (human-readable)", 207 - "type": "string" 208 - }, 209 - "name": { 210 - "description": "The name of the event", 211 - "type": "string" 212 - }, 213 - "start_date": { 214 - "description": "The day the event starts", 215 - "format": "date-time", 216 - "type": "string" 217 - }, 218 - "url": { 219 - "description": "The URL for the event", 220 - "type": "string" 221 - } 222 - }, 223 - "type": "object" 224 - }, 225 - "within.website.x.mi.EventFeed": { 226 - "description": "A feed of events, result from mi query.", 227 - "properties": { 228 - "events": { 229 - "description": "The events in the feed", 230 - "items": { 231 - "$ref": "#/components/schemas/within.website.x.mi.Event" 232 - }, 233 - "type": "array" 234 - } 235 - }, 236 - "type": "object" 237 - }, 238 - "xeiaso.net.BuildInfo": { 239 - "description": "BuildInfo contains metadata about a build of the site.", 240 - "properties": { 241 - "build_time": { 242 - "description": "When the site was last rebuilt", 243 - "format": "date-time", 244 - "type": "string" 245 - }, 246 - "commit": { 247 - "description": "The commit of Xe/site that was built", 248 - "type": "string" 249 - }, 250 - "deno_version": { 251 - "description": "The version of Deno used to build the site", 252 - "type": "string" 253 - }, 254 - "go_version": { 255 - "description": "The version of Go running on the server", 256 - "type": "string" 257 - }, 258 - "xesite_version": { 259 - "description": "The version of the xesite binary", 260 - "type": "string" 261 - } 262 - }, 263 - "type": "object" 264 - } 265 - } 266 - }, 267 - "info": { 268 - "title": "xeiaso.net", 269 - "version": "0.1" 270 - }, 271 - "openapi": "3.0.0", 272 - "paths": { 273 - "/api/within.website.x.mi.Events/Get": { 274 - "post": { 275 - "description": "\nGet fetches the current feed of upcoming events.", 276 - "requestBody": { 277 - "content": { 278 - "application/json": { 279 - "schema": { 280 - "$ref": "#/components/schemas/google.protobuf.Empty" 281 - } 282 - } 283 - } 284 - }, 285 - "responses": { 286 - "200": { 287 - "content": { 288 - "application/json": { 289 - "schema": { 290 - "$ref": "#/components/schemas/within.website.x.mi.EventFeed" 291 - } 292 - } 293 - }, 294 - "description": "Success" 295 - } 296 - }, 297 - "summary": "Get" 298 - } 299 - }, 300 - "/api/xeiaso.net.Feed/Get": { 301 - "post": { 302 - "description": "\nGet fetches the current feed of posts.", 303 - "requestBody": { 304 - "content": { 305 - "application/json": { 306 - "schema": { 307 - "$ref": "#/components/schemas/google.protobuf.Empty" 308 - } 309 - } 310 - } 311 - }, 312 - "responses": { 313 - "200": { 314 - "content": { 315 - "application/json": { 316 - "schema": { 317 - "$ref": "#/components/schemas/protofeed.Feed" 318 - } 319 - } 320 - }, 321 - "description": "Success" 322 - } 323 - }, 324 - "summary": "Get" 325 - } 326 - }, 327 - "/api/xeiaso.net.Meta/Metadata": { 328 - "post": { 329 - "description": "\nMetadata fetches the build metadata of the version of xesite that is\ncurrently running.", 330 - "requestBody": { 331 - "content": { 332 - "application/json": { 333 - "schema": { 334 - "$ref": "#/components/schemas/google.protobuf.Empty" 335 - } 336 - } 337 - } 338 - }, 339 - "responses": { 340 - "200": { 341 - "content": { 342 - "application/json": { 343 - "schema": { 344 - "$ref": "#/components/schemas/xeiaso.net.BuildInfo" 345 - } 346 - } 347 - }, 348 - "description": "Success" 349 - } 350 - }, 351 - "summary": "Metadata" 352 - } 353 - } 354 - }, 355 - "servers": [ 356 - { 357 - "url": "https://xeiaso.net" 358 - } 359 - ] 360 - }
-183
pb/xesite.pb.go
··· 1 - // Code generated by protoc-gen-go. DO NOT EDIT. 2 - // versions: 3 - // protoc-gen-go v1.36.11 4 - // protoc v6.33.4 5 - // source: xesite.proto 6 - 7 - package pb 8 - 9 - import ( 10 - protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 - protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 - emptypb "google.golang.org/protobuf/types/known/emptypb" 13 - timestamppb "google.golang.org/protobuf/types/known/timestamppb" 14 - reflect "reflect" 15 - sync "sync" 16 - unsafe "unsafe" 17 - _ "xeiaso.net/v4/pb/external/mi" 18 - protofeed "xeiaso.net/v4/pb/external/protofeed" 19 - ) 20 - 21 - const ( 22 - // Verify that this generated code is sufficiently up-to-date. 23 - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 24 - // Verify that runtime/protoimpl is sufficiently up-to-date. 25 - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 26 - ) 27 - 28 - // BuildInfo contains metadata about a build of the site. 29 - type BuildInfo struct { 30 - state protoimpl.MessageState `protogen:"open.v1"` 31 - // The commit of Xe/site that was built 32 - Commit string `protobuf:"bytes,1,opt,name=commit,proto3" json:"commit,omitempty"` 33 - // When the site was last rebuilt 34 - BuildTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=build_time,json=buildTime,proto3" json:"build_time,omitempty"` 35 - // The version of Go running on the server 36 - GoVersion string `protobuf:"bytes,3,opt,name=go_version,json=goVersion,proto3" json:"go_version,omitempty"` 37 - // The version of Deno used to build the site 38 - DenoVersion string `protobuf:"bytes,4,opt,name=deno_version,json=denoVersion,proto3" json:"deno_version,omitempty"` 39 - // The version of the xesite binary 40 - XesiteVersion string `protobuf:"bytes,5,opt,name=xesite_version,json=xesiteVersion,proto3" json:"xesite_version,omitempty"` 41 - unknownFields protoimpl.UnknownFields 42 - sizeCache protoimpl.SizeCache 43 - } 44 - 45 - func (x *BuildInfo) Reset() { 46 - *x = BuildInfo{} 47 - mi := &file_xesite_proto_msgTypes[0] 48 - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 49 - ms.StoreMessageInfo(mi) 50 - } 51 - 52 - func (x *BuildInfo) String() string { 53 - return protoimpl.X.MessageStringOf(x) 54 - } 55 - 56 - func (*BuildInfo) ProtoMessage() {} 57 - 58 - func (x *BuildInfo) ProtoReflect() protoreflect.Message { 59 - mi := &file_xesite_proto_msgTypes[0] 60 - if x != nil { 61 - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 62 - if ms.LoadMessageInfo() == nil { 63 - ms.StoreMessageInfo(mi) 64 - } 65 - return ms 66 - } 67 - return mi.MessageOf(x) 68 - } 69 - 70 - // Deprecated: Use BuildInfo.ProtoReflect.Descriptor instead. 71 - func (*BuildInfo) Descriptor() ([]byte, []int) { 72 - return file_xesite_proto_rawDescGZIP(), []int{0} 73 - } 74 - 75 - func (x *BuildInfo) GetCommit() string { 76 - if x != nil { 77 - return x.Commit 78 - } 79 - return "" 80 - } 81 - 82 - func (x *BuildInfo) GetBuildTime() *timestamppb.Timestamp { 83 - if x != nil { 84 - return x.BuildTime 85 - } 86 - return nil 87 - } 88 - 89 - func (x *BuildInfo) GetGoVersion() string { 90 - if x != nil { 91 - return x.GoVersion 92 - } 93 - return "" 94 - } 95 - 96 - func (x *BuildInfo) GetDenoVersion() string { 97 - if x != nil { 98 - return x.DenoVersion 99 - } 100 - return "" 101 - } 102 - 103 - func (x *BuildInfo) GetXesiteVersion() string { 104 - if x != nil { 105 - return x.XesiteVersion 106 - } 107 - return "" 108 - } 109 - 110 - var File_xesite_proto protoreflect.FileDescriptor 111 - 112 - const file_xesite_proto_rawDesc = "" + 113 - "\n" + 114 - "\fxesite.proto\x12\n" + 115 - "xeiaso.net\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x11external/mi.proto\x1a\x18external/protofeed.proto\"\xc7\x01\n" + 116 - "\tBuildInfo\x12\x16\n" + 117 - "\x06commit\x18\x01 \x01(\tR\x06commit\x129\n" + 118 - "\n" + 119 - "build_time\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\tbuildTime\x12\x1d\n" + 120 - "\n" + 121 - "go_version\x18\x03 \x01(\tR\tgoVersion\x12!\n" + 122 - "\fdeno_version\x18\x04 \x01(\tR\vdenoVersion\x12%\n" + 123 - "\x0exesite_version\x18\x05 \x01(\tR\rxesiteVersion2A\n" + 124 - "\x04Meta\x129\n" + 125 - "\bMetadata\x12\x16.google.protobuf.Empty\x1a\x15.xeiaso.net.BuildInfo26\n" + 126 - "\x04Feed\x12.\n" + 127 - "\x03Get\x12\x16.google.protobuf.Empty\x1a\x0f.protofeed.FeedB\x12Z\x10xeiaso.net/v4/pbb\x06proto3" 128 - 129 - var ( 130 - file_xesite_proto_rawDescOnce sync.Once 131 - file_xesite_proto_rawDescData []byte 132 - ) 133 - 134 - func file_xesite_proto_rawDescGZIP() []byte { 135 - file_xesite_proto_rawDescOnce.Do(func() { 136 - file_xesite_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_xesite_proto_rawDesc), len(file_xesite_proto_rawDesc))) 137 - }) 138 - return file_xesite_proto_rawDescData 139 - } 140 - 141 - var file_xesite_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 142 - var file_xesite_proto_goTypes = []any{ 143 - (*BuildInfo)(nil), // 0: xeiaso.net.BuildInfo 144 - (*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp 145 - (*emptypb.Empty)(nil), // 2: google.protobuf.Empty 146 - (*protofeed.Feed)(nil), // 3: protofeed.Feed 147 - } 148 - var file_xesite_proto_depIdxs = []int32{ 149 - 1, // 0: xeiaso.net.BuildInfo.build_time:type_name -> google.protobuf.Timestamp 150 - 2, // 1: xeiaso.net.Meta.Metadata:input_type -> google.protobuf.Empty 151 - 2, // 2: xeiaso.net.Feed.Get:input_type -> google.protobuf.Empty 152 - 0, // 3: xeiaso.net.Meta.Metadata:output_type -> xeiaso.net.BuildInfo 153 - 3, // 4: xeiaso.net.Feed.Get:output_type -> protofeed.Feed 154 - 3, // [3:5] is the sub-list for method output_type 155 - 1, // [1:3] is the sub-list for method input_type 156 - 1, // [1:1] is the sub-list for extension type_name 157 - 1, // [1:1] is the sub-list for extension extendee 158 - 0, // [0:1] is the sub-list for field type_name 159 - } 160 - 161 - func init() { file_xesite_proto_init() } 162 - func file_xesite_proto_init() { 163 - if File_xesite_proto != nil { 164 - return 165 - } 166 - type x struct{} 167 - out := protoimpl.TypeBuilder{ 168 - File: protoimpl.DescBuilder{ 169 - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 170 - RawDescriptor: unsafe.Slice(unsafe.StringData(file_xesite_proto_rawDesc), len(file_xesite_proto_rawDesc)), 171 - NumEnums: 0, 172 - NumMessages: 1, 173 - NumExtensions: 0, 174 - NumServices: 2, 175 - }, 176 - GoTypes: file_xesite_proto_goTypes, 177 - DependencyIndexes: file_xesite_proto_depIdxs, 178 - MessageInfos: file_xesite_proto_msgTypes, 179 - }.Build() 180 - File_xesite_proto = out.File 181 - file_xesite_proto_goTypes = nil 182 - file_xesite_proto_depIdxs = nil 183 - }
-36
pb/xesite.proto
··· 1 - syntax = "proto3"; 2 - package xeiaso.net; 3 - option go_package = "xeiaso.net/v4/pb"; 4 - 5 - import "google/protobuf/empty.proto"; 6 - import "google/protobuf/timestamp.proto"; 7 - 8 - import "external/mi.proto"; // unused in this file 9 - import "external/protofeed.proto"; 10 - 11 - // Meta lets users fetch site metadata. 12 - service Meta { 13 - // Metadata fetches the build metadata of the version of xesite that is 14 - // currently running. 15 - rpc Metadata(google.protobuf.Empty) returns (BuildInfo); 16 - } 17 - 18 - // BuildInfo contains metadata about a build of the site. 19 - message BuildInfo { 20 - // The commit of Xe/site that was built 21 - string commit = 1; 22 - // When the site was last rebuilt 23 - google.protobuf.Timestamp build_time = 2; 24 - // The version of Go running on the server 25 - string go_version = 3; 26 - // The version of Deno used to build the site 27 - string deno_version = 4; 28 - // The version of the xesite binary 29 - string xesite_version = 5; 30 - } 31 - 32 - // Feed lets users fetch the current feed of posts. 33 - service Feed { 34 - // Get fetches the current feed of posts. 35 - rpc Get(google.protobuf.Empty) returns (protofeed.Feed); 36 - }
+204 -197
pb/xesite.twirp.go gen/xeiaso/net/v1/xesite.twirp.go
··· 1 1 // Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT. 2 - // source: xesite.proto 2 + // source: xeiaso/net/v1/xesite.proto 3 3 4 - package pb 4 + package netv1 5 5 6 6 import context "context" 7 7 import fmt "fmt" ··· 15 15 import proto "google.golang.org/protobuf/proto" 16 16 import twirp "github.com/twitchtv/twirp" 17 17 import ctxsetters "github.com/twitchtv/twirp/ctxsetters" 18 - 19 - import google_protobuf "google.golang.org/protobuf/types/known/emptypb" 20 - import protofeed "xeiaso.net/v4/pb/external/protofeed" 21 18 22 19 import bytes "bytes" 23 20 import errors "errors" ··· 30 27 // See https://twitchtv.github.io/twirp/docs/version_matrix.html 31 28 const _ = twirp.TwirpPackageMinVersion_8_1_0 32 29 33 - // ============== 34 - // Meta Interface 35 - // ============== 30 + // ===================== 31 + // MetaService Interface 32 + // ===================== 36 33 37 - // Meta lets users fetch site metadata. 38 - type Meta interface { 34 + // MetaService lets users fetch site metadata. 35 + type MetaService interface { 39 36 // Metadata fetches the build metadata of the version of xesite that is 40 37 // currently running. 41 - Metadata(context.Context, *google_protobuf.Empty) (*BuildInfo, error) 38 + Metadata(context.Context, *MetadataRequest) (*MetadataResponse, error) 42 39 } 43 40 44 - // ==================== 45 - // Meta Protobuf Client 46 - // ==================== 41 + // =========================== 42 + // MetaService Protobuf Client 43 + // =========================== 47 44 48 - type metaProtobufClient struct { 45 + type metaServiceProtobufClient struct { 49 46 client HTTPClient 50 47 urls [1]string 51 48 interceptor twirp.Interceptor 52 49 opts twirp.ClientOptions 53 50 } 54 51 55 - // NewMetaProtobufClient creates a Protobuf client that implements the Meta interface. 52 + // NewMetaServiceProtobufClient creates a Protobuf client that implements the MetaService interface. 56 53 // It communicates using Protobuf and can be configured with a custom HTTPClient. 57 - func NewMetaProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Meta { 54 + func NewMetaServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) MetaService { 58 55 if c, ok := client.(*http.Client); ok { 59 56 client = withoutRedirects(c) 60 57 } ··· 74 71 75 72 // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 76 73 serviceURL := sanitizeBaseURL(baseURL) 77 - serviceURL += baseServicePath(pathPrefix, "xeiaso.net", "Meta") 74 + serviceURL += baseServicePath(pathPrefix, "xeiaso.net.v1", "MetaService") 78 75 urls := [1]string{ 79 76 serviceURL + "Metadata", 80 77 } 81 78 82 - return &metaProtobufClient{ 79 + return &metaServiceProtobufClient{ 83 80 client: client, 84 81 urls: urls, 85 82 interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), ··· 87 84 } 88 85 } 89 86 90 - func (c *metaProtobufClient) Metadata(ctx context.Context, in *google_protobuf.Empty) (*BuildInfo, error) { 91 - ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net") 92 - ctx = ctxsetters.WithServiceName(ctx, "Meta") 87 + func (c *metaServiceProtobufClient) Metadata(ctx context.Context, in *MetadataRequest) (*MetadataResponse, error) { 88 + ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.v1") 89 + ctx = ctxsetters.WithServiceName(ctx, "MetaService") 93 90 ctx = ctxsetters.WithMethodName(ctx, "Metadata") 94 91 caller := c.callMetadata 95 92 if c.interceptor != nil { 96 - caller = func(ctx context.Context, req *google_protobuf.Empty) (*BuildInfo, error) { 93 + caller = func(ctx context.Context, req *MetadataRequest) (*MetadataResponse, error) { 97 94 resp, err := c.interceptor( 98 95 func(ctx context.Context, req interface{}) (interface{}, error) { 99 - typedReq, ok := req.(*google_protobuf.Empty) 96 + typedReq, ok := req.(*MetadataRequest) 100 97 if !ok { 101 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 98 + return nil, twirp.InternalError("failed type assertion req.(*MetadataRequest) when calling interceptor") 102 99 } 103 100 return c.callMetadata(ctx, typedReq) 104 101 }, 105 102 )(ctx, req) 106 103 if resp != nil { 107 - typedResp, ok := resp.(*BuildInfo) 104 + typedResp, ok := resp.(*MetadataResponse) 108 105 if !ok { 109 - return nil, twirp.InternalError("failed type assertion resp.(*BuildInfo) when calling interceptor") 106 + return nil, twirp.InternalError("failed type assertion resp.(*MetadataResponse) when calling interceptor") 110 107 } 111 108 return typedResp, err 112 109 } ··· 116 113 return caller(ctx, in) 117 114 } 118 115 119 - func (c *metaProtobufClient) callMetadata(ctx context.Context, in *google_protobuf.Empty) (*BuildInfo, error) { 120 - out := new(BuildInfo) 116 + func (c *metaServiceProtobufClient) callMetadata(ctx context.Context, in *MetadataRequest) (*MetadataResponse, error) { 117 + out := new(MetadataResponse) 121 118 ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 122 119 if err != nil { 123 120 twerr, ok := err.(twirp.Error) ··· 133 130 return out, nil 134 131 } 135 132 136 - // ================ 137 - // Meta JSON Client 138 - // ================ 133 + // ======================= 134 + // MetaService JSON Client 135 + // ======================= 139 136 140 - type metaJSONClient struct { 137 + type metaServiceJSONClient struct { 141 138 client HTTPClient 142 139 urls [1]string 143 140 interceptor twirp.Interceptor 144 141 opts twirp.ClientOptions 145 142 } 146 143 147 - // NewMetaJSONClient creates a JSON client that implements the Meta interface. 144 + // NewMetaServiceJSONClient creates a JSON client that implements the MetaService interface. 148 145 // It communicates using JSON and can be configured with a custom HTTPClient. 149 - func NewMetaJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Meta { 146 + func NewMetaServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) MetaService { 150 147 if c, ok := client.(*http.Client); ok { 151 148 client = withoutRedirects(c) 152 149 } ··· 166 163 167 164 // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 168 165 serviceURL := sanitizeBaseURL(baseURL) 169 - serviceURL += baseServicePath(pathPrefix, "xeiaso.net", "Meta") 166 + serviceURL += baseServicePath(pathPrefix, "xeiaso.net.v1", "MetaService") 170 167 urls := [1]string{ 171 168 serviceURL + "Metadata", 172 169 } 173 170 174 - return &metaJSONClient{ 171 + return &metaServiceJSONClient{ 175 172 client: client, 176 173 urls: urls, 177 174 interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), ··· 179 176 } 180 177 } 181 178 182 - func (c *metaJSONClient) Metadata(ctx context.Context, in *google_protobuf.Empty) (*BuildInfo, error) { 183 - ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net") 184 - ctx = ctxsetters.WithServiceName(ctx, "Meta") 179 + func (c *metaServiceJSONClient) Metadata(ctx context.Context, in *MetadataRequest) (*MetadataResponse, error) { 180 + ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.v1") 181 + ctx = ctxsetters.WithServiceName(ctx, "MetaService") 185 182 ctx = ctxsetters.WithMethodName(ctx, "Metadata") 186 183 caller := c.callMetadata 187 184 if c.interceptor != nil { 188 - caller = func(ctx context.Context, req *google_protobuf.Empty) (*BuildInfo, error) { 185 + caller = func(ctx context.Context, req *MetadataRequest) (*MetadataResponse, error) { 189 186 resp, err := c.interceptor( 190 187 func(ctx context.Context, req interface{}) (interface{}, error) { 191 - typedReq, ok := req.(*google_protobuf.Empty) 188 + typedReq, ok := req.(*MetadataRequest) 192 189 if !ok { 193 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 190 + return nil, twirp.InternalError("failed type assertion req.(*MetadataRequest) when calling interceptor") 194 191 } 195 192 return c.callMetadata(ctx, typedReq) 196 193 }, 197 194 )(ctx, req) 198 195 if resp != nil { 199 - typedResp, ok := resp.(*BuildInfo) 196 + typedResp, ok := resp.(*MetadataResponse) 200 197 if !ok { 201 - return nil, twirp.InternalError("failed type assertion resp.(*BuildInfo) when calling interceptor") 198 + return nil, twirp.InternalError("failed type assertion resp.(*MetadataResponse) when calling interceptor") 202 199 } 203 200 return typedResp, err 204 201 } ··· 208 205 return caller(ctx, in) 209 206 } 210 207 211 - func (c *metaJSONClient) callMetadata(ctx context.Context, in *google_protobuf.Empty) (*BuildInfo, error) { 212 - out := new(BuildInfo) 208 + func (c *metaServiceJSONClient) callMetadata(ctx context.Context, in *MetadataRequest) (*MetadataResponse, error) { 209 + out := new(MetadataResponse) 213 210 ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 214 211 if err != nil { 215 212 twerr, ok := err.(twirp.Error) ··· 225 222 return out, nil 226 223 } 227 224 228 - // =================== 229 - // Meta Server Handler 230 - // =================== 225 + // ========================== 226 + // MetaService Server Handler 227 + // ========================== 231 228 232 - type metaServer struct { 233 - Meta 229 + type metaServiceServer struct { 230 + MetaService 234 231 interceptor twirp.Interceptor 235 232 hooks *twirp.ServerHooks 236 233 pathPrefix string // prefix for routing ··· 238 235 jsonCamelCase bool // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names 239 236 } 240 237 241 - // NewMetaServer builds a TwirpServer that can be used as an http.Handler to handle 238 + // NewMetaServiceServer builds a TwirpServer that can be used as an http.Handler to handle 242 239 // HTTP requests that are routed to the right method in the provided svc implementation. 243 240 // The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks). 244 - func NewMetaServer(svc Meta, opts ...interface{}) TwirpServer { 241 + func NewMetaServiceServer(svc MetaService, opts ...interface{}) TwirpServer { 245 242 serverOpts := newServerOpts(opts) 246 243 247 244 // Using ReadOpt allows backwards and forwards compatibility with new options in the future ··· 254 251 pathPrefix = "/twirp" // default prefix 255 252 } 256 253 257 - return &metaServer{ 258 - Meta: svc, 254 + return &metaServiceServer{ 255 + MetaService: svc, 259 256 hooks: serverOpts.Hooks, 260 257 interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...), 261 258 pathPrefix: pathPrefix, ··· 266 263 267 264 // writeError writes an HTTP response with a valid Twirp error format, and triggers hooks. 268 265 // If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) 269 - func (s *metaServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { 266 + func (s *metaServiceServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { 270 267 writeError(ctx, resp, err, s.hooks) 271 268 } 272 269 273 270 // handleRequestBodyError is used to handle error when the twirp server cannot read request 274 - func (s *metaServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { 271 + func (s *metaServiceServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { 275 272 if context.Canceled == ctx.Err() { 276 273 s.writeError(ctx, resp, twirp.NewError(twirp.Canceled, "failed to read request: context canceled")) 277 274 return ··· 283 280 s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err)) 284 281 } 285 282 286 - // MetaPathPrefix is a convenience constant that may identify URL paths. 283 + // MetaServicePathPrefix is a convenience constant that may identify URL paths. 287 284 // Should be used with caution, it only matches routes generated by Twirp Go clients, 288 285 // with the default "/twirp" prefix and default CamelCase service and method names. 289 286 // More info: https://twitchtv.github.io/twirp/docs/routing.html 290 - const MetaPathPrefix = "/twirp/xeiaso.net.Meta/" 287 + const MetaServicePathPrefix = "/twirp/xeiaso.net.v1.MetaService/" 291 288 292 - func (s *metaServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { 289 + func (s *metaServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { 293 290 ctx := req.Context() 294 - ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net") 295 - ctx = ctxsetters.WithServiceName(ctx, "Meta") 291 + ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.v1") 292 + ctx = ctxsetters.WithServiceName(ctx, "MetaService") 296 293 ctx = ctxsetters.WithResponseWriter(ctx, resp) 297 294 298 295 var err error ··· 310 307 311 308 // Verify path format: [<prefix>]/<package>.<Service>/<Method> 312 309 prefix, pkgService, method := parseTwirpPath(req.URL.Path) 313 - if pkgService != "xeiaso.net.Meta" { 310 + if pkgService != "xeiaso.net.v1.MetaService" { 314 311 msg := fmt.Sprintf("no handler for path %q", req.URL.Path) 315 312 s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) 316 313 return ··· 332 329 } 333 330 } 334 331 335 - func (s *metaServer) serveMetadata(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 332 + func (s *metaServiceServer) serveMetadata(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 336 333 header := req.Header.Get("Content-Type") 337 334 i := strings.Index(header, ";") 338 335 if i == -1 { ··· 350 347 } 351 348 } 352 349 353 - func (s *metaServer) serveMetadataJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 350 + func (s *metaServiceServer) serveMetadataJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 354 351 var err error 355 352 ctx = ctxsetters.WithMethodName(ctx, "Metadata") 356 353 ctx, err = callRequestRouted(ctx, s.hooks) ··· 365 362 s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 366 363 return 367 364 } 368 - reqContent := new(google_protobuf.Empty) 365 + reqContent := new(MetadataRequest) 369 366 unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} 370 367 if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { 371 368 s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 372 369 return 373 370 } 374 371 375 - handler := s.Meta.Metadata 372 + handler := s.MetaService.Metadata 376 373 if s.interceptor != nil { 377 - handler = func(ctx context.Context, req *google_protobuf.Empty) (*BuildInfo, error) { 374 + handler = func(ctx context.Context, req *MetadataRequest) (*MetadataResponse, error) { 378 375 resp, err := s.interceptor( 379 376 func(ctx context.Context, req interface{}) (interface{}, error) { 380 - typedReq, ok := req.(*google_protobuf.Empty) 377 + typedReq, ok := req.(*MetadataRequest) 381 378 if !ok { 382 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 379 + return nil, twirp.InternalError("failed type assertion req.(*MetadataRequest) when calling interceptor") 383 380 } 384 - return s.Meta.Metadata(ctx, typedReq) 381 + return s.MetaService.Metadata(ctx, typedReq) 385 382 }, 386 383 )(ctx, req) 387 384 if resp != nil { 388 - typedResp, ok := resp.(*BuildInfo) 385 + typedResp, ok := resp.(*MetadataResponse) 389 386 if !ok { 390 - return nil, twirp.InternalError("failed type assertion resp.(*BuildInfo) when calling interceptor") 387 + return nil, twirp.InternalError("failed type assertion resp.(*MetadataResponse) when calling interceptor") 391 388 } 392 389 return typedResp, err 393 390 } ··· 396 393 } 397 394 398 395 // Call service method 399 - var respContent *BuildInfo 396 + var respContent *MetadataResponse 400 397 func() { 401 398 defer ensurePanicResponses(ctx, resp, s.hooks) 402 399 respContent, err = handler(ctx, reqContent) ··· 407 404 return 408 405 } 409 406 if respContent == nil { 410 - s.writeError(ctx, resp, twirp.InternalError("received a nil *BuildInfo and nil error while calling Metadata. nil responses are not supported")) 407 + s.writeError(ctx, resp, twirp.InternalError("received a nil *MetadataResponse and nil error while calling Metadata. nil responses are not supported")) 411 408 return 412 409 } 413 410 ··· 433 430 callResponseSent(ctx, s.hooks) 434 431 } 435 432 436 - func (s *metaServer) serveMetadataProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 433 + func (s *metaServiceServer) serveMetadataProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 437 434 var err error 438 435 ctx = ctxsetters.WithMethodName(ctx, "Metadata") 439 436 ctx, err = callRequestRouted(ctx, s.hooks) ··· 447 444 s.handleRequestBodyError(ctx, resp, "failed to read request body", err) 448 445 return 449 446 } 450 - reqContent := new(google_protobuf.Empty) 447 + reqContent := new(MetadataRequest) 451 448 if err = proto.Unmarshal(buf, reqContent); err != nil { 452 449 s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) 453 450 return 454 451 } 455 452 456 - handler := s.Meta.Metadata 453 + handler := s.MetaService.Metadata 457 454 if s.interceptor != nil { 458 - handler = func(ctx context.Context, req *google_protobuf.Empty) (*BuildInfo, error) { 455 + handler = func(ctx context.Context, req *MetadataRequest) (*MetadataResponse, error) { 459 456 resp, err := s.interceptor( 460 457 func(ctx context.Context, req interface{}) (interface{}, error) { 461 - typedReq, ok := req.(*google_protobuf.Empty) 458 + typedReq, ok := req.(*MetadataRequest) 462 459 if !ok { 463 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 460 + return nil, twirp.InternalError("failed type assertion req.(*MetadataRequest) when calling interceptor") 464 461 } 465 - return s.Meta.Metadata(ctx, typedReq) 462 + return s.MetaService.Metadata(ctx, typedReq) 466 463 }, 467 464 )(ctx, req) 468 465 if resp != nil { 469 - typedResp, ok := resp.(*BuildInfo) 466 + typedResp, ok := resp.(*MetadataResponse) 470 467 if !ok { 471 - return nil, twirp.InternalError("failed type assertion resp.(*BuildInfo) when calling interceptor") 468 + return nil, twirp.InternalError("failed type assertion resp.(*MetadataResponse) when calling interceptor") 472 469 } 473 470 return typedResp, err 474 471 } ··· 477 474 } 478 475 479 476 // Call service method 480 - var respContent *BuildInfo 477 + var respContent *MetadataResponse 481 478 func() { 482 479 defer ensurePanicResponses(ctx, resp, s.hooks) 483 480 respContent, err = handler(ctx, reqContent) ··· 488 485 return 489 486 } 490 487 if respContent == nil { 491 - s.writeError(ctx, resp, twirp.InternalError("received a nil *BuildInfo and nil error while calling Metadata. nil responses are not supported")) 488 + s.writeError(ctx, resp, twirp.InternalError("received a nil *MetadataResponse and nil error while calling Metadata. nil responses are not supported")) 492 489 return 493 490 } 494 491 ··· 512 509 callResponseSent(ctx, s.hooks) 513 510 } 514 511 515 - func (s *metaServer) ServiceDescriptor() ([]byte, int) { 512 + func (s *metaServiceServer) ServiceDescriptor() ([]byte, int) { 516 513 return twirpFileDescriptor0, 0 517 514 } 518 515 519 - func (s *metaServer) ProtocGenTwirpVersion() string { 516 + func (s *metaServiceServer) ProtocGenTwirpVersion() string { 520 517 return "v8.1.3" 521 518 } 522 519 523 520 // PathPrefix returns the base service path, in the form: "/<prefix>/<package>.<Service>/" 524 521 // that is everything in a Twirp route except for the <Method>. This can be used for routing, 525 522 // for example to identify the requests that are targeted to this service in a mux. 526 - func (s *metaServer) PathPrefix() string { 527 - return baseServicePath(s.pathPrefix, "xeiaso.net", "Meta") 523 + func (s *metaServiceServer) PathPrefix() string { 524 + return baseServicePath(s.pathPrefix, "xeiaso.net.v1", "MetaService") 528 525 } 529 526 530 - // ============== 531 - // Feed Interface 532 - // ============== 527 + // ===================== 528 + // FeedService Interface 529 + // ===================== 533 530 534 - // Feed lets users fetch the current feed of posts. 535 - type Feed interface { 531 + // FeedService lets users fetch the current feed of posts. 532 + type FeedService interface { 536 533 // Get fetches the current feed of posts. 537 - Get(context.Context, *google_protobuf.Empty) (*protofeed.Feed, error) 534 + Get(context.Context, *FeedServiceGetRequest) (*FeedServiceGetResponse, error) 538 535 } 539 536 540 - // ==================== 541 - // Feed Protobuf Client 542 - // ==================== 537 + // =========================== 538 + // FeedService Protobuf Client 539 + // =========================== 543 540 544 - type feedProtobufClient struct { 541 + type feedServiceProtobufClient struct { 545 542 client HTTPClient 546 543 urls [1]string 547 544 interceptor twirp.Interceptor 548 545 opts twirp.ClientOptions 549 546 } 550 547 551 - // NewFeedProtobufClient creates a Protobuf client that implements the Feed interface. 548 + // NewFeedServiceProtobufClient creates a Protobuf client that implements the FeedService interface. 552 549 // It communicates using Protobuf and can be configured with a custom HTTPClient. 553 - func NewFeedProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Feed { 550 + func NewFeedServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) FeedService { 554 551 if c, ok := client.(*http.Client); ok { 555 552 client = withoutRedirects(c) 556 553 } ··· 570 567 571 568 // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 572 569 serviceURL := sanitizeBaseURL(baseURL) 573 - serviceURL += baseServicePath(pathPrefix, "xeiaso.net", "Feed") 570 + serviceURL += baseServicePath(pathPrefix, "xeiaso.net.v1", "FeedService") 574 571 urls := [1]string{ 575 572 serviceURL + "Get", 576 573 } 577 574 578 - return &feedProtobufClient{ 575 + return &feedServiceProtobufClient{ 579 576 client: client, 580 577 urls: urls, 581 578 interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), ··· 583 580 } 584 581 } 585 582 586 - func (c *feedProtobufClient) Get(ctx context.Context, in *google_protobuf.Empty) (*protofeed.Feed, error) { 587 - ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net") 588 - ctx = ctxsetters.WithServiceName(ctx, "Feed") 583 + func (c *feedServiceProtobufClient) Get(ctx context.Context, in *FeedServiceGetRequest) (*FeedServiceGetResponse, error) { 584 + ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.v1") 585 + ctx = ctxsetters.WithServiceName(ctx, "FeedService") 589 586 ctx = ctxsetters.WithMethodName(ctx, "Get") 590 587 caller := c.callGet 591 588 if c.interceptor != nil { 592 - caller = func(ctx context.Context, req *google_protobuf.Empty) (*protofeed.Feed, error) { 589 + caller = func(ctx context.Context, req *FeedServiceGetRequest) (*FeedServiceGetResponse, error) { 593 590 resp, err := c.interceptor( 594 591 func(ctx context.Context, req interface{}) (interface{}, error) { 595 - typedReq, ok := req.(*google_protobuf.Empty) 592 + typedReq, ok := req.(*FeedServiceGetRequest) 596 593 if !ok { 597 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 594 + return nil, twirp.InternalError("failed type assertion req.(*FeedServiceGetRequest) when calling interceptor") 598 595 } 599 596 return c.callGet(ctx, typedReq) 600 597 }, 601 598 )(ctx, req) 602 599 if resp != nil { 603 - typedResp, ok := resp.(*protofeed.Feed) 600 + typedResp, ok := resp.(*FeedServiceGetResponse) 604 601 if !ok { 605 - return nil, twirp.InternalError("failed type assertion resp.(*protofeed.Feed) when calling interceptor") 602 + return nil, twirp.InternalError("failed type assertion resp.(*FeedServiceGetResponse) when calling interceptor") 606 603 } 607 604 return typedResp, err 608 605 } ··· 612 609 return caller(ctx, in) 613 610 } 614 611 615 - func (c *feedProtobufClient) callGet(ctx context.Context, in *google_protobuf.Empty) (*protofeed.Feed, error) { 616 - out := new(protofeed.Feed) 612 + func (c *feedServiceProtobufClient) callGet(ctx context.Context, in *FeedServiceGetRequest) (*FeedServiceGetResponse, error) { 613 + out := new(FeedServiceGetResponse) 617 614 ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 618 615 if err != nil { 619 616 twerr, ok := err.(twirp.Error) ··· 629 626 return out, nil 630 627 } 631 628 632 - // ================ 633 - // Feed JSON Client 634 - // ================ 629 + // ======================= 630 + // FeedService JSON Client 631 + // ======================= 635 632 636 - type feedJSONClient struct { 633 + type feedServiceJSONClient struct { 637 634 client HTTPClient 638 635 urls [1]string 639 636 interceptor twirp.Interceptor 640 637 opts twirp.ClientOptions 641 638 } 642 639 643 - // NewFeedJSONClient creates a JSON client that implements the Feed interface. 640 + // NewFeedServiceJSONClient creates a JSON client that implements the FeedService interface. 644 641 // It communicates using JSON and can be configured with a custom HTTPClient. 645 - func NewFeedJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Feed { 642 + func NewFeedServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) FeedService { 646 643 if c, ok := client.(*http.Client); ok { 647 644 client = withoutRedirects(c) 648 645 } ··· 662 659 663 660 // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> 664 661 serviceURL := sanitizeBaseURL(baseURL) 665 - serviceURL += baseServicePath(pathPrefix, "xeiaso.net", "Feed") 662 + serviceURL += baseServicePath(pathPrefix, "xeiaso.net.v1", "FeedService") 666 663 urls := [1]string{ 667 664 serviceURL + "Get", 668 665 } 669 666 670 - return &feedJSONClient{ 667 + return &feedServiceJSONClient{ 671 668 client: client, 672 669 urls: urls, 673 670 interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), ··· 675 672 } 676 673 } 677 674 678 - func (c *feedJSONClient) Get(ctx context.Context, in *google_protobuf.Empty) (*protofeed.Feed, error) { 679 - ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net") 680 - ctx = ctxsetters.WithServiceName(ctx, "Feed") 675 + func (c *feedServiceJSONClient) Get(ctx context.Context, in *FeedServiceGetRequest) (*FeedServiceGetResponse, error) { 676 + ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.v1") 677 + ctx = ctxsetters.WithServiceName(ctx, "FeedService") 681 678 ctx = ctxsetters.WithMethodName(ctx, "Get") 682 679 caller := c.callGet 683 680 if c.interceptor != nil { 684 - caller = func(ctx context.Context, req *google_protobuf.Empty) (*protofeed.Feed, error) { 681 + caller = func(ctx context.Context, req *FeedServiceGetRequest) (*FeedServiceGetResponse, error) { 685 682 resp, err := c.interceptor( 686 683 func(ctx context.Context, req interface{}) (interface{}, error) { 687 - typedReq, ok := req.(*google_protobuf.Empty) 684 + typedReq, ok := req.(*FeedServiceGetRequest) 688 685 if !ok { 689 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 686 + return nil, twirp.InternalError("failed type assertion req.(*FeedServiceGetRequest) when calling interceptor") 690 687 } 691 688 return c.callGet(ctx, typedReq) 692 689 }, 693 690 )(ctx, req) 694 691 if resp != nil { 695 - typedResp, ok := resp.(*protofeed.Feed) 692 + typedResp, ok := resp.(*FeedServiceGetResponse) 696 693 if !ok { 697 - return nil, twirp.InternalError("failed type assertion resp.(*protofeed.Feed) when calling interceptor") 694 + return nil, twirp.InternalError("failed type assertion resp.(*FeedServiceGetResponse) when calling interceptor") 698 695 } 699 696 return typedResp, err 700 697 } ··· 704 701 return caller(ctx, in) 705 702 } 706 703 707 - func (c *feedJSONClient) callGet(ctx context.Context, in *google_protobuf.Empty) (*protofeed.Feed, error) { 708 - out := new(protofeed.Feed) 704 + func (c *feedServiceJSONClient) callGet(ctx context.Context, in *FeedServiceGetRequest) (*FeedServiceGetResponse, error) { 705 + out := new(FeedServiceGetResponse) 709 706 ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) 710 707 if err != nil { 711 708 twerr, ok := err.(twirp.Error) ··· 721 718 return out, nil 722 719 } 723 720 724 - // =================== 725 - // Feed Server Handler 726 - // =================== 721 + // ========================== 722 + // FeedService Server Handler 723 + // ========================== 727 724 728 - type feedServer struct { 729 - Feed 725 + type feedServiceServer struct { 726 + FeedService 730 727 interceptor twirp.Interceptor 731 728 hooks *twirp.ServerHooks 732 729 pathPrefix string // prefix for routing ··· 734 731 jsonCamelCase bool // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names 735 732 } 736 733 737 - // NewFeedServer builds a TwirpServer that can be used as an http.Handler to handle 734 + // NewFeedServiceServer builds a TwirpServer that can be used as an http.Handler to handle 738 735 // HTTP requests that are routed to the right method in the provided svc implementation. 739 736 // The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks). 740 - func NewFeedServer(svc Feed, opts ...interface{}) TwirpServer { 737 + func NewFeedServiceServer(svc FeedService, opts ...interface{}) TwirpServer { 741 738 serverOpts := newServerOpts(opts) 742 739 743 740 // Using ReadOpt allows backwards and forwards compatibility with new options in the future ··· 750 747 pathPrefix = "/twirp" // default prefix 751 748 } 752 749 753 - return &feedServer{ 754 - Feed: svc, 750 + return &feedServiceServer{ 751 + FeedService: svc, 755 752 hooks: serverOpts.Hooks, 756 753 interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...), 757 754 pathPrefix: pathPrefix, ··· 762 759 763 760 // writeError writes an HTTP response with a valid Twirp error format, and triggers hooks. 764 761 // If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) 765 - func (s *feedServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { 762 + func (s *feedServiceServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { 766 763 writeError(ctx, resp, err, s.hooks) 767 764 } 768 765 769 766 // handleRequestBodyError is used to handle error when the twirp server cannot read request 770 - func (s *feedServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { 767 + func (s *feedServiceServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { 771 768 if context.Canceled == ctx.Err() { 772 769 s.writeError(ctx, resp, twirp.NewError(twirp.Canceled, "failed to read request: context canceled")) 773 770 return ··· 779 776 s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err)) 780 777 } 781 778 782 - // FeedPathPrefix is a convenience constant that may identify URL paths. 779 + // FeedServicePathPrefix is a convenience constant that may identify URL paths. 783 780 // Should be used with caution, it only matches routes generated by Twirp Go clients, 784 781 // with the default "/twirp" prefix and default CamelCase service and method names. 785 782 // More info: https://twitchtv.github.io/twirp/docs/routing.html 786 - const FeedPathPrefix = "/twirp/xeiaso.net.Feed/" 783 + const FeedServicePathPrefix = "/twirp/xeiaso.net.v1.FeedService/" 787 784 788 - func (s *feedServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { 785 + func (s *feedServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { 789 786 ctx := req.Context() 790 - ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net") 791 - ctx = ctxsetters.WithServiceName(ctx, "Feed") 787 + ctx = ctxsetters.WithPackageName(ctx, "xeiaso.net.v1") 788 + ctx = ctxsetters.WithServiceName(ctx, "FeedService") 792 789 ctx = ctxsetters.WithResponseWriter(ctx, resp) 793 790 794 791 var err error ··· 806 803 807 804 // Verify path format: [<prefix>]/<package>.<Service>/<Method> 808 805 prefix, pkgService, method := parseTwirpPath(req.URL.Path) 809 - if pkgService != "xeiaso.net.Feed" { 806 + if pkgService != "xeiaso.net.v1.FeedService" { 810 807 msg := fmt.Sprintf("no handler for path %q", req.URL.Path) 811 808 s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) 812 809 return ··· 828 825 } 829 826 } 830 827 831 - func (s *feedServer) serveGet(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 828 + func (s *feedServiceServer) serveGet(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 832 829 header := req.Header.Get("Content-Type") 833 830 i := strings.Index(header, ";") 834 831 if i == -1 { ··· 846 843 } 847 844 } 848 845 849 - func (s *feedServer) serveGetJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 846 + func (s *feedServiceServer) serveGetJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 850 847 var err error 851 848 ctx = ctxsetters.WithMethodName(ctx, "Get") 852 849 ctx, err = callRequestRouted(ctx, s.hooks) ··· 861 858 s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 862 859 return 863 860 } 864 - reqContent := new(google_protobuf.Empty) 861 + reqContent := new(FeedServiceGetRequest) 865 862 unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} 866 863 if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { 867 864 s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) 868 865 return 869 866 } 870 867 871 - handler := s.Feed.Get 868 + handler := s.FeedService.Get 872 869 if s.interceptor != nil { 873 - handler = func(ctx context.Context, req *google_protobuf.Empty) (*protofeed.Feed, error) { 870 + handler = func(ctx context.Context, req *FeedServiceGetRequest) (*FeedServiceGetResponse, error) { 874 871 resp, err := s.interceptor( 875 872 func(ctx context.Context, req interface{}) (interface{}, error) { 876 - typedReq, ok := req.(*google_protobuf.Empty) 873 + typedReq, ok := req.(*FeedServiceGetRequest) 877 874 if !ok { 878 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 875 + return nil, twirp.InternalError("failed type assertion req.(*FeedServiceGetRequest) when calling interceptor") 879 876 } 880 - return s.Feed.Get(ctx, typedReq) 877 + return s.FeedService.Get(ctx, typedReq) 881 878 }, 882 879 )(ctx, req) 883 880 if resp != nil { 884 - typedResp, ok := resp.(*protofeed.Feed) 881 + typedResp, ok := resp.(*FeedServiceGetResponse) 885 882 if !ok { 886 - return nil, twirp.InternalError("failed type assertion resp.(*protofeed.Feed) when calling interceptor") 883 + return nil, twirp.InternalError("failed type assertion resp.(*FeedServiceGetResponse) when calling interceptor") 887 884 } 888 885 return typedResp, err 889 886 } ··· 892 889 } 893 890 894 891 // Call service method 895 - var respContent *protofeed.Feed 892 + var respContent *FeedServiceGetResponse 896 893 func() { 897 894 defer ensurePanicResponses(ctx, resp, s.hooks) 898 895 respContent, err = handler(ctx, reqContent) ··· 903 900 return 904 901 } 905 902 if respContent == nil { 906 - s.writeError(ctx, resp, twirp.InternalError("received a nil *protofeed.Feed and nil error while calling Get. nil responses are not supported")) 903 + s.writeError(ctx, resp, twirp.InternalError("received a nil *FeedServiceGetResponse and nil error while calling Get. nil responses are not supported")) 907 904 return 908 905 } 909 906 ··· 929 926 callResponseSent(ctx, s.hooks) 930 927 } 931 928 932 - func (s *feedServer) serveGetProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 929 + func (s *feedServiceServer) serveGetProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { 933 930 var err error 934 931 ctx = ctxsetters.WithMethodName(ctx, "Get") 935 932 ctx, err = callRequestRouted(ctx, s.hooks) ··· 943 940 s.handleRequestBodyError(ctx, resp, "failed to read request body", err) 944 941 return 945 942 } 946 - reqContent := new(google_protobuf.Empty) 943 + reqContent := new(FeedServiceGetRequest) 947 944 if err = proto.Unmarshal(buf, reqContent); err != nil { 948 945 s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) 949 946 return 950 947 } 951 948 952 - handler := s.Feed.Get 949 + handler := s.FeedService.Get 953 950 if s.interceptor != nil { 954 - handler = func(ctx context.Context, req *google_protobuf.Empty) (*protofeed.Feed, error) { 951 + handler = func(ctx context.Context, req *FeedServiceGetRequest) (*FeedServiceGetResponse, error) { 955 952 resp, err := s.interceptor( 956 953 func(ctx context.Context, req interface{}) (interface{}, error) { 957 - typedReq, ok := req.(*google_protobuf.Empty) 954 + typedReq, ok := req.(*FeedServiceGetRequest) 958 955 if !ok { 959 - return nil, twirp.InternalError("failed type assertion req.(*google_protobuf.Empty) when calling interceptor") 956 + return nil, twirp.InternalError("failed type assertion req.(*FeedServiceGetRequest) when calling interceptor") 960 957 } 961 - return s.Feed.Get(ctx, typedReq) 958 + return s.FeedService.Get(ctx, typedReq) 962 959 }, 963 960 )(ctx, req) 964 961 if resp != nil { 965 - typedResp, ok := resp.(*protofeed.Feed) 962 + typedResp, ok := resp.(*FeedServiceGetResponse) 966 963 if !ok { 967 - return nil, twirp.InternalError("failed type assertion resp.(*protofeed.Feed) when calling interceptor") 964 + return nil, twirp.InternalError("failed type assertion resp.(*FeedServiceGetResponse) when calling interceptor") 968 965 } 969 966 return typedResp, err 970 967 } ··· 973 970 } 974 971 975 972 // Call service method 976 - var respContent *protofeed.Feed 973 + var respContent *FeedServiceGetResponse 977 974 func() { 978 975 defer ensurePanicResponses(ctx, resp, s.hooks) 979 976 respContent, err = handler(ctx, reqContent) ··· 984 981 return 985 982 } 986 983 if respContent == nil { 987 - s.writeError(ctx, resp, twirp.InternalError("received a nil *protofeed.Feed and nil error while calling Get. nil responses are not supported")) 984 + s.writeError(ctx, resp, twirp.InternalError("received a nil *FeedServiceGetResponse and nil error while calling Get. nil responses are not supported")) 988 985 return 989 986 } 990 987 ··· 1008 1005 callResponseSent(ctx, s.hooks) 1009 1006 } 1010 1007 1011 - func (s *feedServer) ServiceDescriptor() ([]byte, int) { 1008 + func (s *feedServiceServer) ServiceDescriptor() ([]byte, int) { 1012 1009 return twirpFileDescriptor0, 1 1013 1010 } 1014 1011 1015 - func (s *feedServer) ProtocGenTwirpVersion() string { 1012 + func (s *feedServiceServer) ProtocGenTwirpVersion() string { 1016 1013 return "v8.1.3" 1017 1014 } 1018 1015 1019 1016 // PathPrefix returns the base service path, in the form: "/<prefix>/<package>.<Service>/" 1020 1017 // that is everything in a Twirp route except for the <Method>. This can be used for routing, 1021 1018 // for example to identify the requests that are targeted to this service in a mux. 1022 - func (s *feedServer) PathPrefix() string { 1023 - return baseServicePath(s.pathPrefix, "xeiaso.net", "Feed") 1019 + func (s *feedServiceServer) PathPrefix() string { 1020 + return baseServicePath(s.pathPrefix, "xeiaso.net.v1", "FeedService") 1024 1021 } 1025 1022 1026 1023 // ===== ··· 1589 1586 } 1590 1587 1591 1588 var twirpFileDescriptor0 = []byte{ 1592 - // 296 bytes of a gzipped FileDescriptorProto 1593 - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0x5f, 0x4b, 0xc3, 0x30, 1594 - 0x14, 0xc5, 0xa9, 0xab, 0xc3, 0xde, 0xcd, 0x7f, 0x01, 0x47, 0xa9, 0x88, 0x53, 0x10, 0xf6, 0x94, 1595 - 0x42, 0x15, 0x61, 0x8f, 0x0e, 0x54, 0x7c, 0xf0, 0x65, 0x88, 0x0f, 0xbe, 0x8c, 0xd4, 0xde, 0x96, 1596 - 0x40, 0xd3, 0x94, 0x36, 0x1b, 0xf5, 0x13, 0xfa, 0xb5, 0x24, 0x49, 0xff, 0x80, 0xe2, 0x53, 0xb8, 1597 - 0xe7, 0xfc, 0x72, 0x73, 0x72, 0x60, 0xda, 0x60, 0xcd, 0x15, 0xd2, 0xb2, 0x92, 0x4a, 0x12, 0x68, 1598 - 0x90, 0xb3, 0x5a, 0xd2, 0x02, 0x55, 0x70, 0x9e, 0x49, 0x99, 0xe5, 0x18, 0x1a, 0x27, 0xde, 0xa6, 1599 - 0x21, 0x8a, 0x52, 0x7d, 0x59, 0x30, 0xb8, 0xfc, 0x6d, 0x2a, 0x2e, 0xb0, 0x56, 0x4c, 0x94, 0x2d, 1600 - 0x70, 0x8a, 0x8d, 0xc2, 0xaa, 0x60, 0x79, 0x28, 0x78, 0x2b, 0xf9, 0xbd, 0x64, 0xe6, 0x14, 0x31, 1601 - 0xb1, 0xce, 0xf5, 0xb7, 0x03, 0xde, 0x6a, 0xcb, 0xf3, 0xe4, 0xa5, 0x48, 0x25, 0x99, 0xc1, 0xf8, 1602 - 0x53, 0x0a, 0xc1, 0x95, 0xef, 0xcc, 0x9d, 0x85, 0xb7, 0x6e, 0x27, 0xb2, 0x04, 0x88, 0x35, 0xb4, 1603 - 0xd1, 0x6f, 0xf9, 0x7b, 0x73, 0x67, 0x31, 0x89, 0x02, 0x6a, 0x83, 0xd0, 0x2e, 0x08, 0x7d, 0xeb, 1604 - 0x82, 0xac, 0x3d, 0x43, 0xeb, 0x99, 0x5c, 0x00, 0x64, 0x72, 0xb3, 0xc3, 0xaa, 0xe6, 0xb2, 0xf0, 1605 - 0x47, 0x66, 0xad, 0x97, 0xc9, 0x77, 0x2b, 0x90, 0x2b, 0x98, 0x26, 0x58, 0x0c, 0x80, 0x6b, 0x80, 1606 - 0x89, 0xd6, 0x3a, 0xe4, 0x06, 0x8e, 0x6c, 0x53, 0x3d, 0xb4, 0x6f, 0xa0, 0x43, 0xab, 0xb6, 0x58, 1607 - 0xf4, 0x00, 0xee, 0x2b, 0x2a, 0x46, 0x96, 0x70, 0xa0, 0xcf, 0x84, 0x29, 0x46, 0x66, 0x7f, 0x32, 1608 - 0x3e, 0xea, 0x26, 0x83, 0x33, 0x3a, 0xb4, 0x4d, 0xfb, 0xef, 0x47, 0xf7, 0xe0, 0x3e, 0x21, 0x26, 1609 - 0x84, 0xc2, 0xe8, 0x19, 0xd5, 0xbf, 0xb7, 0x8f, 0xe9, 0xd0, 0xa2, 0xe6, 0x57, 0xe4, 0xe3, 0x64, 1610 - 0xd8, 0x17, 0xee, 0xee, 0xc2, 0x32, 0x8e, 0xc7, 0x86, 0xb9, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 1611 - 0x23, 0x62, 0xd8, 0x88, 0xe6, 0x01, 0x00, 0x00, 1589 + // 459 bytes of a gzipped FileDescriptorProto 1590 + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xd1, 0x8a, 0xd3, 0x40, 1591 + 0x14, 0x86, 0x49, 0xba, 0x2e, 0xf6, 0xc4, 0x5a, 0x77, 0xc0, 0xb5, 0x06, 0x74, 0xb5, 0x5a, 0xf0, 1592 + 0x6a, 0x42, 0xaa, 0x20, 0x56, 0xbc, 0xe9, 0x85, 0x45, 0x16, 0x4b, 0x89, 0x52, 0xca, 0x52, 0x58, 1593 + 0xd2, 0xe6, 0x34, 0x04, 0x9a, 0x99, 0xda, 0x9c, 0x86, 0xbe, 0x8c, 0x37, 0x5e, 0xfa, 0x22, 0x82, 1594 + 0x8f, 0xe1, 0xa5, 0x4f, 0x21, 0x33, 0x93, 0x69, 0x6d, 0x51, 0xf6, 0x2e, 0xe7, 0xfc, 0xdf, 0x39, 1595 + 0xf3, 0xcf, 0x3f, 0x01, 0x7f, 0x8b, 0x59, 0x5c, 0xc8, 0x40, 0x20, 0x05, 0x65, 0x18, 0x6c, 0xb1, 1596 + 0xc8, 0x08, 0xf9, 0x6a, 0x2d, 0x49, 0xb2, 0x86, 0xd1, 0xb8, 0x40, 0xe2, 0x65, 0xe8, 0x77, 0x70, 1597 + 0x4b, 0xb8, 0x16, 0xf1, 0x32, 0xd0, 0xf2, 0x02, 0x31, 0x51, 0x23, 0xbb, 0xc2, 0x4c, 0xf9, 0x17, 1598 + 0xa9, 0x94, 0xe9, 0x12, 0x4d, 0x7f, 0xb6, 0x59, 0x04, 0x94, 0xe5, 0x58, 0x50, 0x9c, 0xaf, 0x0c, 1599 + 0xd0, 0x3e, 0x83, 0xe6, 0x47, 0xa4, 0x38, 0x89, 0x29, 0x8e, 0xf0, 0xcb, 0x06, 0x0b, 0x6a, 0x5f, 1600 + 0xc2, 0xbd, 0x7d, 0xab, 0x58, 0x49, 0x51, 0x20, 0x7b, 0x0d, 0x30, 0xdb, 0x64, 0xcb, 0xe4, 0x3a, 1601 + 0x13, 0x0b, 0xd9, 0x72, 0x9e, 0x38, 0x2f, 0xbc, 0x6e, 0x8b, 0x1f, 0x58, 0xe2, 0x7d, 0x05, 0x7c, 1602 + 0x10, 0x0b, 0x19, 0xd5, 0x67, 0xf6, 0xb3, 0xfd, 0xc3, 0x81, 0xfa, 0x4e, 0x60, 0xe7, 0x70, 0x3a, 1603 + 0x97, 0x79, 0x9e, 0x91, 0x5e, 0x51, 0x8f, 0xaa, 0x8a, 0xbd, 0xb1, 0xeb, 0x95, 0xbd, 0x96, 0xab, 1604 + 0xd7, 0xfb, 0xdc, 0x78, 0xe7, 0xd6, 0x3b, 0xff, 0x6c, 0xbd, 0x57, 0x07, 0xa8, 0x9a, 0x3d, 0x02, 1605 + 0x48, 0xe5, 0x75, 0x89, 0xeb, 0x22, 0x93, 0xa2, 0x55, 0xd3, 0x6b, 0xeb, 0xa9, 0x1c, 0x9b, 0x06, 1606 + 0x7b, 0x0a, 0x77, 0x12, 0x14, 0x7b, 0xe0, 0x44, 0x03, 0x9e, 0xea, 0x59, 0xa4, 0x03, 0x77, 0x4d, 1607 + 0xd2, 0x3b, 0xe8, 0x96, 0x86, 0x1a, 0xa6, 0x5b, 0x61, 0xed, 0x07, 0x70, 0xff, 0x3d, 0x62, 0xf2, 1608 + 0x09, 0xd7, 0x65, 0x36, 0xc7, 0x01, 0x92, 0xcd, 0xeb, 0x1d, 0x9c, 0x1f, 0x0b, 0x55, 0x6a, 0xcf, 1609 + 0xe0, 0x44, 0xbd, 0x45, 0x95, 0x57, 0x93, 0xef, 0x5f, 0x47, 0x0d, 0x44, 0x5a, 0xec, 0x5e, 0x81, 1610 + 0xa7, 0xe2, 0xae, 0xc6, 0xd9, 0x25, 0xdc, 0xb6, 0xe9, 0xb3, 0xc7, 0x47, 0x09, 0x1f, 0xbd, 0x94, 1611 + 0x7f, 0xf1, 0x5f, 0xdd, 0x18, 0xe8, 0xc6, 0xe0, 0xfd, 0x65, 0x8d, 0x45, 0x50, 0x1b, 0x20, 0xb1, 1612 + 0xe7, 0x47, 0x63, 0xff, 0xbc, 0x96, 0xdf, 0xb9, 0x81, 0x32, 0x47, 0xf4, 0xbf, 0x3a, 0x70, 0x36, 1613 + 0x97, 0xf9, 0x21, 0xdc, 0xf7, 0x26, 0x3a, 0xbb, 0x91, 0xba, 0xf0, 0xc8, 0xb9, 0xea, 0xec, 0xd5, 1614 + 0xa0, 0x7c, 0x15, 0xa4, 0x28, 0x82, 0x83, 0x5f, 0xfd, 0xad, 0x40, 0x2a, 0xc3, 0x6f, 0x6e, 0x6d, 1615 + 0x32, 0x9c, 0x7c, 0x77, 0x1b, 0x13, 0x43, 0x0f, 0x91, 0xf8, 0x38, 0xfc, 0x69, 0xeb, 0xe9, 0x10, 1616 + 0x69, 0x3a, 0x0e, 0x7f, 0xb9, 0x0f, 0x0f, 0xea, 0xe9, 0x60, 0xd4, 0xb7, 0x17, 0xff, 0xed, 0x36, 1617 + 0x8d, 0xd6, 0xeb, 0x0d, 0x91, 0x7a, 0xbd, 0x71, 0x38, 0x3b, 0xd5, 0xa1, 0xbf, 0xfc, 0x13, 0x00, 1618 + 0x00, 0xff, 0xff, 0x85, 0x89, 0xc0, 0x9e, 0x5c, 0x03, 0x00, 0x00, 1612 1619 }
+72
proto/techaro/thoth/auth/admin/v1/admin.proto
··· 1 + syntax = "proto3"; 2 + package techaro.thoth.auth.admin.v1; 3 + 4 + import "buf/validate/validate.proto"; 5 + import "google/protobuf/timestamp.proto"; 6 + import "techaro/thoth/auth/v1/auth.proto"; 7 + 8 + message User { 9 + string id = 1 [(buf.validate.field).required = true]; 10 + string email_address = 2 [ 11 + (buf.validate.field).required = true, 12 + (buf.validate.field).cel = { 13 + id: "email_address.is_email_address" 14 + message: "email_address must be an email address" 15 + expression: "this.isEmail()" 16 + } 17 + ]; 18 + string name = 3 [(buf.validate.field).required = true]; 19 + google.protobuf.Timestamp created_at = 4; 20 + google.protobuf.Timestamp deleted_at = 5; 21 + google.protobuf.Timestamp updated_at = 6; 22 + bool is_admin = 7; 23 + string customer_id = 8 [(buf.validate.field).required = true]; 24 + } 25 + 26 + service UsersService { 27 + rpc Create(UsersServiceCreateRequest) returns (UsersServiceCreateResponse); 28 + rpc Disable(UsersServiceDisableRequest) returns (UsersServiceDisableResponse); 29 + rpc List(UsersServiceListRequest) returns (UsersServiceListResponse); 30 + rpc MakeJWT(UsersServiceMakeJWTRequest) returns (UsersServiceMakeJWTResponse); 31 + } 32 + 33 + message UsersServiceCreateRequest { 34 + string email_address = 1 [ 35 + (buf.validate.field).required = true, 36 + (buf.validate.field).cel = { 37 + id: "email_address.is_email_address" 38 + message: "email_address must be an email address" 39 + expression: "this.isEmail()" 40 + } 41 + ]; 42 + string name = 2 [(buf.validate.field).required = true]; 43 + string customer_id = 3 [(buf.validate.field).required = true]; 44 + } 45 + 46 + message UsersServiceCreateResponse { 47 + User user = 1; 48 + } 49 + 50 + message UsersServiceDisableRequest { 51 + string id = 1 [(buf.validate.field).required = true]; 52 + } 53 + 54 + message UsersServiceDisableResponse {} 55 + 56 + message UsersServiceListRequest { 57 + int32 count = 1; 58 + int32 page = 2; 59 + } 60 + 61 + message UsersServiceListResponse { 62 + repeated User users = 1; 63 + } 64 + 65 + message UsersServiceMakeJWTRequest { 66 + string user_id = 1 [(buf.validate.field).required = true]; 67 + string comment = 2 [(buf.validate.field).required = true]; 68 + } 69 + 70 + message UsersServiceMakeJWTResponse { 71 + techaro.thoth.auth.v1.JWTServiceCreateResponse token_info = 1; 72 + }
+43
proto/techaro/thoth/auth/v1/auth.proto
··· 1 + syntax = "proto3"; 2 + package techaro.thoth.auth.v1; 3 + 4 + import "buf/validate/validate.proto"; 5 + import "google/protobuf/timestamp.proto"; 6 + 7 + message JWT { 8 + string id = 1; 9 + google.protobuf.Timestamp created_at = 2; 10 + google.protobuf.Timestamp expires_at = 3; 11 + string comment = 4; 12 + } 13 + 14 + service JWTService { 15 + rpc Create(JWTServiceCreateRequest) returns (JWTServiceCreateResponse); 16 + rpc Delete(JWTServiceDeleteRequest) returns (JWTServiceDeleteResponse); 17 + rpc List(JWTServiceListRequest) returns (JWTServiceListResponse); 18 + } 19 + 20 + message JWTServiceListRequest { 21 + int32 count = 1; 22 + int32 page = 2; 23 + } 24 + 25 + message JWTServiceListResponse { 26 + repeated JWT tokens = 1; 27 + } 28 + 29 + message JWTServiceCreateRequest { 30 + string comment = 1 [(buf.validate.field).required = true]; 31 + } 32 + 33 + message JWTServiceCreateResponse { 34 + string jwt = 1; 35 + google.protobuf.Timestamp expires = 2; 36 + string jti = 3; 37 + } 38 + 39 + message JWTServiceDeleteRequest { 40 + string jti = 1 [(buf.validate.field).required = true]; 41 + } 42 + 43 + message JWTServiceDeleteResponse {}
+45
proto/xeiaso/net/admin/v1/admin.proto
··· 1 + syntax = "proto3"; 2 + package xeiaso.net.admin.v1; 3 + 4 + import "google/protobuf/timestamp.proto"; 5 + import "xeiaso/net/v1/xesite.proto"; 6 + 7 + option go_package = "adminv1"; 8 + 9 + // PatreonService provides access to Patreon OAuth tokens. 10 + service PatreonService { 11 + // GetToken returns the current Patreon OAuth token. 12 + rpc GetToken(GetTokenRequest) returns (GetTokenResponse); 13 + } 14 + 15 + // GetTokenRequest is the request for PatreonService.GetToken. 16 + message GetTokenRequest {} 17 + 18 + // GetTokenResponse is the response for PatreonService.GetToken. 19 + message GetTokenResponse { 20 + // The Patreon OAuth token. 21 + PatreonToken token = 1; 22 + } 23 + 24 + // PatreonToken contains a Patreon OAuth token. 25 + message PatreonToken { 26 + string access_token = 1; 27 + string token_type = 2; 28 + string refresh_token = 3; 29 + google.protobuf.Timestamp expiry = 4; 30 + } 31 + 32 + // AdminService provides administrative operations. 33 + service AdminService { 34 + // Rebuild triggers a site rebuild. 35 + rpc Rebuild(RebuildRequest) returns (RebuildResponse); 36 + } 37 + 38 + // RebuildRequest is the request for AdminService.Rebuild. 39 + message RebuildRequest {} 40 + 41 + // RebuildResponse is the response for AdminService.Rebuild. 42 + message RebuildResponse { 43 + // The build info of the rebuilt site. 44 + xeiaso.net.v1.BuildInfo build_info = 1; 45 + }
+52
proto/xeiaso/net/v1/xesite.proto
··· 1 + syntax = "proto3"; 2 + package xeiaso.net.v1; 3 + 4 + import "external/protofeed/v1/protofeed.proto"; 5 + import "google/protobuf/timestamp.proto"; 6 + 7 + option go_package = "xesitev1"; 8 + 9 + // MetaService lets users fetch site metadata. 10 + service MetaService { 11 + // Metadata fetches the build metadata of the version of xesite that is 12 + // currently running. 13 + rpc Metadata(MetadataRequest) returns (MetadataResponse); 14 + } 15 + 16 + // MetadataRequest is the request for MetaService.Metadata. 17 + message MetadataRequest {} 18 + 19 + // MetadataResponse is the response for MetaService.Metadata. 20 + message MetadataResponse { 21 + // The build info of the currently running xesite instance. 22 + BuildInfo build_info = 1; 23 + } 24 + 25 + // BuildInfo contains metadata about a build of the site. 26 + message BuildInfo { 27 + // The commit of Xe/site that was built 28 + string commit = 1; 29 + // When the site was last rebuilt 30 + google.protobuf.Timestamp build_time = 2; 31 + // The version of Go running on the server 32 + string go_version = 3; 33 + // The version of Deno used to build the site 34 + string deno_version = 4; 35 + // The version of the xesite binary 36 + string xesite_version = 5; 37 + } 38 + 39 + // FeedService lets users fetch the current feed of posts. 40 + service FeedService { 41 + // Get fetches the current feed of posts. 42 + rpc Get(FeedServiceGetRequest) returns (FeedServiceGetResponse); 43 + } 44 + 45 + // FeedServiceGetRequest is the request for FeedService.Get. 46 + message FeedServiceGetRequest {} 47 + 48 + // FeedServiceGetResponse is the response for FeedService.Get. 49 + message FeedServiceGetResponse { 50 + // The feed of posts. 51 + protofeed.Feed feed = 1; 52 + }