自动生成 protobuf 代码 (tag: v1.9.0)

This commit is contained in:
sky
2025-09-07 20:38:57 +08:00
parent 07182b7a81
commit 9a503df460
15 changed files with 607 additions and 606 deletions

View File

@@ -0,0 +1,138 @@
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: corestack/anonymous/v1/service.proto
package anonymousv1connect
import (
connect "connectrpc.com/connect"
context "context"
errors "errors"
v1 "git.shenxianhe.cn/shenxianhe/sdk/corestack/anonymous/v1"
http "net/http"
strings "strings"
)
// This is a compile-time assertion to ensure that this generated file and the connect package are
// compatible. If you get a compiler error that this constant is not defined, this code was
// generated with a version of connect newer than the one compiled into your binary. You can fix the
// problem by either regenerating this code with an older version of connect or updating the connect
// version compiled into your binary.
const _ = connect.IsAtLeastVersion1_13_0
const (
// AnonymousServiceName is the fully-qualified name of the AnonymousService service.
AnonymousServiceName = "corestack.anonymous.v1.AnonymousService"
)
// These constants are the fully-qualified names of the RPCs defined in this package. They're
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
//
// Note that these are different from the fully-qualified method names used by
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
// period.
const (
// AnonymousServiceAuthProcedure is the fully-qualified name of the AnonymousService's Auth RPC.
AnonymousServiceAuthProcedure = "/corestack.anonymous.v1.AnonymousService/Auth"
// AnonymousServiceSendCredentialProcedure is the fully-qualified name of the AnonymousService's
// SendCredential RPC.
AnonymousServiceSendCredentialProcedure = "/corestack.anonymous.v1.AnonymousService/SendCredential"
)
// AnonymousServiceClient is a client for the corestack.anonymous.v1.AnonymousService service.
type AnonymousServiceClient interface {
Auth(context.Context, *connect.Request[v1.AuthRequest]) (*connect.Response[v1.AuthResponse], error)
SendCredential(context.Context, *connect.Request[v1.SendCredentialRequest]) (*connect.Response[v1.SendCredentialResponse], error)
}
// NewAnonymousServiceClient constructs a client for the corestack.anonymous.v1.AnonymousService
// service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for
// gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply
// the connect.WithGRPC() or connect.WithGRPCWeb() options.
//
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
// http://api.acme.com or https://acme.com/grpc).
func NewAnonymousServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) AnonymousServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
anonymousServiceMethods := v1.File_corestack_anonymous_v1_service_proto.Services().ByName("AnonymousService").Methods()
return &anonymousServiceClient{
auth: connect.NewClient[v1.AuthRequest, v1.AuthResponse](
httpClient,
baseURL+AnonymousServiceAuthProcedure,
connect.WithSchema(anonymousServiceMethods.ByName("Auth")),
connect.WithClientOptions(opts...),
),
sendCredential: connect.NewClient[v1.SendCredentialRequest, v1.SendCredentialResponse](
httpClient,
baseURL+AnonymousServiceSendCredentialProcedure,
connect.WithSchema(anonymousServiceMethods.ByName("SendCredential")),
connect.WithClientOptions(opts...),
),
}
}
// anonymousServiceClient implements AnonymousServiceClient.
type anonymousServiceClient struct {
auth *connect.Client[v1.AuthRequest, v1.AuthResponse]
sendCredential *connect.Client[v1.SendCredentialRequest, v1.SendCredentialResponse]
}
// Auth calls corestack.anonymous.v1.AnonymousService.Auth.
func (c *anonymousServiceClient) Auth(ctx context.Context, req *connect.Request[v1.AuthRequest]) (*connect.Response[v1.AuthResponse], error) {
return c.auth.CallUnary(ctx, req)
}
// SendCredential calls corestack.anonymous.v1.AnonymousService.SendCredential.
func (c *anonymousServiceClient) SendCredential(ctx context.Context, req *connect.Request[v1.SendCredentialRequest]) (*connect.Response[v1.SendCredentialResponse], error) {
return c.sendCredential.CallUnary(ctx, req)
}
// AnonymousServiceHandler is an implementation of the corestack.anonymous.v1.AnonymousService
// service.
type AnonymousServiceHandler interface {
Auth(context.Context, *connect.Request[v1.AuthRequest]) (*connect.Response[v1.AuthResponse], error)
SendCredential(context.Context, *connect.Request[v1.SendCredentialRequest]) (*connect.Response[v1.SendCredentialResponse], error)
}
// NewAnonymousServiceHandler builds an HTTP handler from the service implementation. It returns the
// path on which to mount the handler and the handler itself.
//
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
// and JSON codecs. They also support gzip compression.
func NewAnonymousServiceHandler(svc AnonymousServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
anonymousServiceMethods := v1.File_corestack_anonymous_v1_service_proto.Services().ByName("AnonymousService").Methods()
anonymousServiceAuthHandler := connect.NewUnaryHandler(
AnonymousServiceAuthProcedure,
svc.Auth,
connect.WithSchema(anonymousServiceMethods.ByName("Auth")),
connect.WithHandlerOptions(opts...),
)
anonymousServiceSendCredentialHandler := connect.NewUnaryHandler(
AnonymousServiceSendCredentialProcedure,
svc.SendCredential,
connect.WithSchema(anonymousServiceMethods.ByName("SendCredential")),
connect.WithHandlerOptions(opts...),
)
return "/corestack.anonymous.v1.AnonymousService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case AnonymousServiceAuthProcedure:
anonymousServiceAuthHandler.ServeHTTP(w, r)
case AnonymousServiceSendCredentialProcedure:
anonymousServiceSendCredentialHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedAnonymousServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedAnonymousServiceHandler struct{}
func (UnimplementedAnonymousServiceHandler) Auth(context.Context, *connect.Request[v1.AuthRequest]) (*connect.Response[v1.AuthResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("corestack.anonymous.v1.AnonymousService.Auth is not implemented"))
}
func (UnimplementedAnonymousServiceHandler) SendCredential(context.Context, *connect.Request[v1.SendCredentialRequest]) (*connect.Response[v1.SendCredentialResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("corestack.anonymous.v1.AnonymousService.SendCredential is not implemented"))
}

View File

@@ -0,0 +1,72 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.7
// protoc (unknown)
// source: corestack/anonymous/v1/service.proto
package anonymousv1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
var File_corestack_anonymous_v1_service_proto protoreflect.FileDescriptor
const file_corestack_anonymous_v1_service_proto_rawDesc = "" +
"\n" +
"$corestack/anonymous/v1/service.proto\x12\x16corestack.anonymous.v1\x1a!corestack/anonymous/v1/user.proto2\xd6\x01\n" +
"\x10AnonymousService\x12Q\n" +
"\x04Auth\x12#.corestack.anonymous.v1.AuthRequest\x1a$.corestack.anonymous.v1.AuthResponse\x12o\n" +
"\x0eSendCredential\x12-.corestack.anonymous.v1.SendCredentialRequest\x1a..corestack.anonymous.v1.SendCredentialResponseBEZCgit.shenxianhe.cn/shenxianhe/sdk/corestack/anonymous/v1;anonymousv1b\x06proto3"
var file_corestack_anonymous_v1_service_proto_goTypes = []any{
(*AuthRequest)(nil), // 0: corestack.anonymous.v1.AuthRequest
(*SendCredentialRequest)(nil), // 1: corestack.anonymous.v1.SendCredentialRequest
(*AuthResponse)(nil), // 2: corestack.anonymous.v1.AuthResponse
(*SendCredentialResponse)(nil), // 3: corestack.anonymous.v1.SendCredentialResponse
}
var file_corestack_anonymous_v1_service_proto_depIdxs = []int32{
0, // 0: corestack.anonymous.v1.AnonymousService.Auth:input_type -> corestack.anonymous.v1.AuthRequest
1, // 1: corestack.anonymous.v1.AnonymousService.SendCredential:input_type -> corestack.anonymous.v1.SendCredentialRequest
2, // 2: corestack.anonymous.v1.AnonymousService.Auth:output_type -> corestack.anonymous.v1.AuthResponse
3, // 3: corestack.anonymous.v1.AnonymousService.SendCredential:output_type -> corestack.anonymous.v1.SendCredentialResponse
2, // [2:4] is the sub-list for method output_type
0, // [0:2] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_corestack_anonymous_v1_service_proto_init() }
func file_corestack_anonymous_v1_service_proto_init() {
if File_corestack_anonymous_v1_service_proto != nil {
return
}
file_corestack_anonymous_v1_user_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_corestack_anonymous_v1_service_proto_rawDesc), len(file_corestack_anonymous_v1_service_proto_rawDesc)),
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_corestack_anonymous_v1_service_proto_goTypes,
DependencyIndexes: file_corestack_anonymous_v1_service_proto_depIdxs,
}.Build()
File_corestack_anonymous_v1_service_proto = out.File
file_corestack_anonymous_v1_service_proto_goTypes = nil
file_corestack_anonymous_v1_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,296 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.7
// protoc (unknown)
// source: corestack/anonymous/v1/user.proto
package anonymousv1
import (
v1 "git.shenxianhe.cn/shenxianhe/sdk/corestack/enums/v1"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type AuthRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
AuthType v1.AuthenticationType `protobuf:"varint,1,opt,name=auth_type,json=authType,proto3,enum=corestack.enums.v1.AuthenticationType" json:"auth_type,omitempty"` // 认证类型
AuthId string `protobuf:"bytes,2,opt,name=auth_id,json=authId,proto3" json:"auth_id,omitempty"` // 认证ID根据auth_type存储不同的账号信息
Credential string `protobuf:"bytes,3,opt,name=credential,proto3" json:"credential,omitempty"` // 凭证,可以是验证码或密码
InvitationCode string `protobuf:"bytes,4,opt,name=invitation_code,json=invitationCode,proto3" json:"invitation_code,omitempty"` // 邀请码
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AuthRequest) Reset() {
*x = AuthRequest{}
mi := &file_corestack_anonymous_v1_user_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AuthRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AuthRequest) ProtoMessage() {}
func (x *AuthRequest) ProtoReflect() protoreflect.Message {
mi := &file_corestack_anonymous_v1_user_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AuthRequest.ProtoReflect.Descriptor instead.
func (*AuthRequest) Descriptor() ([]byte, []int) {
return file_corestack_anonymous_v1_user_proto_rawDescGZIP(), []int{0}
}
func (x *AuthRequest) GetAuthType() v1.AuthenticationType {
if x != nil {
return x.AuthType
}
return v1.AuthenticationType(0)
}
func (x *AuthRequest) GetAuthId() string {
if x != nil {
return x.AuthId
}
return ""
}
func (x *AuthRequest) GetCredential() string {
if x != nil {
return x.Credential
}
return ""
}
func (x *AuthRequest) GetInvitationCode() string {
if x != nil {
return x.InvitationCode
}
return ""
}
type AuthResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AuthResponse) Reset() {
*x = AuthResponse{}
mi := &file_corestack_anonymous_v1_user_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AuthResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AuthResponse) ProtoMessage() {}
func (x *AuthResponse) ProtoReflect() protoreflect.Message {
mi := &file_corestack_anonymous_v1_user_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AuthResponse.ProtoReflect.Descriptor instead.
func (*AuthResponse) Descriptor() ([]byte, []int) {
return file_corestack_anonymous_v1_user_proto_rawDescGZIP(), []int{1}
}
func (x *AuthResponse) GetToken() string {
if x != nil {
return x.Token
}
return ""
}
type SendCredentialRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
AuthType v1.AuthenticationType `protobuf:"varint,1,opt,name=auth_type,json=authType,proto3,enum=corestack.enums.v1.AuthenticationType" json:"auth_type,omitempty"` // 认证类型
AuthId string `protobuf:"bytes,2,opt,name=auth_id,json=authId,proto3" json:"auth_id,omitempty"` // 认证ID根据auth_type存储不同的账号信息
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SendCredentialRequest) Reset() {
*x = SendCredentialRequest{}
mi := &file_corestack_anonymous_v1_user_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SendCredentialRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SendCredentialRequest) ProtoMessage() {}
func (x *SendCredentialRequest) ProtoReflect() protoreflect.Message {
mi := &file_corestack_anonymous_v1_user_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SendCredentialRequest.ProtoReflect.Descriptor instead.
func (*SendCredentialRequest) Descriptor() ([]byte, []int) {
return file_corestack_anonymous_v1_user_proto_rawDescGZIP(), []int{2}
}
func (x *SendCredentialRequest) GetAuthType() v1.AuthenticationType {
if x != nil {
return x.AuthType
}
return v1.AuthenticationType(0)
}
func (x *SendCredentialRequest) GetAuthId() string {
if x != nil {
return x.AuthId
}
return ""
}
type SendCredentialResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SendCredentialResponse) Reset() {
*x = SendCredentialResponse{}
mi := &file_corestack_anonymous_v1_user_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SendCredentialResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SendCredentialResponse) ProtoMessage() {}
func (x *SendCredentialResponse) ProtoReflect() protoreflect.Message {
mi := &file_corestack_anonymous_v1_user_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SendCredentialResponse.ProtoReflect.Descriptor instead.
func (*SendCredentialResponse) Descriptor() ([]byte, []int) {
return file_corestack_anonymous_v1_user_proto_rawDescGZIP(), []int{3}
}
var File_corestack_anonymous_v1_user_proto protoreflect.FileDescriptor
const file_corestack_anonymous_v1_user_proto_rawDesc = "" +
"\n" +
"!corestack/anonymous/v1/user.proto\x12\x16corestack.anonymous.v1\x1a\x1dcorestack/enums/v1/user.proto\"\xb4\x01\n" +
"\vAuthRequest\x12C\n" +
"\tauth_type\x18\x01 \x01(\x0e2&.corestack.enums.v1.AuthenticationTypeR\bauthType\x12\x17\n" +
"\aauth_id\x18\x02 \x01(\tR\x06authId\x12\x1e\n" +
"\n" +
"credential\x18\x03 \x01(\tR\n" +
"credential\x12'\n" +
"\x0finvitation_code\x18\x04 \x01(\tR\x0einvitationCode\"$\n" +
"\fAuthResponse\x12\x14\n" +
"\x05token\x18\x01 \x01(\tR\x05token\"u\n" +
"\x15SendCredentialRequest\x12C\n" +
"\tauth_type\x18\x01 \x01(\x0e2&.corestack.enums.v1.AuthenticationTypeR\bauthType\x12\x17\n" +
"\aauth_id\x18\x02 \x01(\tR\x06authId\"\x18\n" +
"\x16SendCredentialResponseBEZCgit.shenxianhe.cn/shenxianhe/sdk/corestack/anonymous/v1;anonymousv1b\x06proto3"
var (
file_corestack_anonymous_v1_user_proto_rawDescOnce sync.Once
file_corestack_anonymous_v1_user_proto_rawDescData []byte
)
func file_corestack_anonymous_v1_user_proto_rawDescGZIP() []byte {
file_corestack_anonymous_v1_user_proto_rawDescOnce.Do(func() {
file_corestack_anonymous_v1_user_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_corestack_anonymous_v1_user_proto_rawDesc), len(file_corestack_anonymous_v1_user_proto_rawDesc)))
})
return file_corestack_anonymous_v1_user_proto_rawDescData
}
var file_corestack_anonymous_v1_user_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_corestack_anonymous_v1_user_proto_goTypes = []any{
(*AuthRequest)(nil), // 0: corestack.anonymous.v1.AuthRequest
(*AuthResponse)(nil), // 1: corestack.anonymous.v1.AuthResponse
(*SendCredentialRequest)(nil), // 2: corestack.anonymous.v1.SendCredentialRequest
(*SendCredentialResponse)(nil), // 3: corestack.anonymous.v1.SendCredentialResponse
(v1.AuthenticationType)(0), // 4: corestack.enums.v1.AuthenticationType
}
var file_corestack_anonymous_v1_user_proto_depIdxs = []int32{
4, // 0: corestack.anonymous.v1.AuthRequest.auth_type:type_name -> corestack.enums.v1.AuthenticationType
4, // 1: corestack.anonymous.v1.SendCredentialRequest.auth_type:type_name -> corestack.enums.v1.AuthenticationType
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_corestack_anonymous_v1_user_proto_init() }
func file_corestack_anonymous_v1_user_proto_init() {
if File_corestack_anonymous_v1_user_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_corestack_anonymous_v1_user_proto_rawDesc), len(file_corestack_anonymous_v1_user_proto_rawDesc)),
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_corestack_anonymous_v1_user_proto_goTypes,
DependencyIndexes: file_corestack_anonymous_v1_user_proto_depIdxs,
MessageInfos: file_corestack_anonymous_v1_user_proto_msgTypes,
}.Build()
File_corestack_anonymous_v1_user_proto = out.File
file_corestack_anonymous_v1_user_proto_goTypes = nil
file_corestack_anonymous_v1_user_proto_depIdxs = nil
}