From a9fd863544fe098e07d4a4847525af783d8784bc Mon Sep 17 00:00:00 2001 From: Yvan <8574526@qq,com> Date: Wed, 7 Jan 2026 17:37:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E4=B8=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/kratos/admin/v1/admin.pb.go | 708 --------------------------- api/kratos/admin/v1/admin.proto | 161 ------ api/kratos/admin/v1/admin_grpc.pb.go | 408 --------------- api/kratos/admin/v1/admin_http.pb.go | 370 -------------- 4 files changed, 1647 deletions(-) delete mode 100644 api/kratos/admin/v1/admin.pb.go delete mode 100644 api/kratos/admin/v1/admin.proto delete mode 100644 api/kratos/admin/v1/admin_grpc.pb.go delete mode 100644 api/kratos/admin/v1/admin_http.pb.go diff --git a/api/kratos/admin/v1/admin.pb.go b/api/kratos/admin/v1/admin.pb.go deleted file mode 100644 index 876c6da..0000000 --- a/api/kratos/admin/v1/admin.pb.go +++ /dev/null @@ -1,708 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v4.23.2 -// source: kratos/admin/v1/admin.proto - -package v1 - -import ( - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" - fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Admin is the admin message. -type Admin struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The unique ID of the user. - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - // The name of the user. - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - // The email of the user. - Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` - // The phone number of the user. - Phone string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"` - // The avatar URL of the user. - Avatar string `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"` - // The access level of the user. - // Possible values are: "admin", "user", etc. - Access string `protobuf:"bytes,6,opt,name=access,proto3" json:"access,omitempty"` - // The password of the user. - Password string `protobuf:"bytes,7,opt,name=password,proto3" json:"password,omitempty"` - // The timestamp at which the user was created. - CreateTime *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` - // The latest timestamp at which the user was updated. - UpdateTime *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Admin) Reset() { - *x = Admin{} - mi := &file_kratos_admin_v1_admin_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Admin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Admin) ProtoMessage() {} - -func (x *Admin) ProtoReflect() protoreflect.Message { - mi := &file_kratos_admin_v1_admin_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 Admin.ProtoReflect.Descriptor instead. -func (*Admin) Descriptor() ([]byte, []int) { - return file_kratos_admin_v1_admin_proto_rawDescGZIP(), []int{0} -} - -func (x *Admin) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Admin) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Admin) GetEmail() string { - if x != nil { - return x.Email - } - return "" -} - -func (x *Admin) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *Admin) GetAvatar() string { - if x != nil { - return x.Avatar - } - return "" -} - -func (x *Admin) GetAccess() string { - if x != nil { - return x.Access - } - return "" -} - -func (x *Admin) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -func (x *Admin) GetCreateTime() *timestamppb.Timestamp { - if x != nil { - return x.CreateTime - } - return nil -} - -func (x *Admin) GetUpdateTime() *timestamppb.Timestamp { - if x != nil { - return x.UpdateTime - } - return nil -} - -// AdminSet is the set of admins. -type AdminSet struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The set of admins. - Admins []*Admin `protobuf:"bytes,1,rep,name=admins,proto3" json:"admins,omitempty"` - // The next page token. - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminSet) Reset() { - *x = AdminSet{} - mi := &file_kratos_admin_v1_admin_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminSet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminSet) ProtoMessage() {} - -func (x *AdminSet) ProtoReflect() protoreflect.Message { - mi := &file_kratos_admin_v1_admin_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 AdminSet.ProtoReflect.Descriptor instead. -func (*AdminSet) Descriptor() ([]byte, []int) { - return file_kratos_admin_v1_admin_proto_rawDescGZIP(), []int{1} -} - -func (x *AdminSet) GetAdmins() []*Admin { - if x != nil { - return x.Admins - } - return nil -} - -func (x *AdminSet) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - -// LoginRequest is the request message for the Login method. -type LoginRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. Password of the user. - Password string `protobuf:"bytes,1,opt,name=password,proto3" json:"password,omitempty"` - // Required. Exactly one identity must be set. - // - // Types that are valid to be assigned to Identity: - // - // *LoginRequest_Username - // *LoginRequest_Email - Identity isLoginRequest_Identity `protobuf_oneof:"identity"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *LoginRequest) Reset() { - *x = LoginRequest{} - mi := &file_kratos_admin_v1_admin_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *LoginRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LoginRequest) ProtoMessage() {} - -func (x *LoginRequest) ProtoReflect() protoreflect.Message { - mi := &file_kratos_admin_v1_admin_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 LoginRequest.ProtoReflect.Descriptor instead. -func (*LoginRequest) Descriptor() ([]byte, []int) { - return file_kratos_admin_v1_admin_proto_rawDescGZIP(), []int{2} -} - -func (x *LoginRequest) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -func (x *LoginRequest) GetIdentity() isLoginRequest_Identity { - if x != nil { - return x.Identity - } - return nil -} - -func (x *LoginRequest) GetUsername() string { - if x != nil { - if x, ok := x.Identity.(*LoginRequest_Username); ok { - return x.Username - } - } - return "" -} - -func (x *LoginRequest) GetEmail() string { - if x != nil { - if x, ok := x.Identity.(*LoginRequest_Email); ok { - return x.Email - } - } - return "" -} - -type isLoginRequest_Identity interface { - isLoginRequest_Identity() -} - -type LoginRequest_Username struct { - Username string `protobuf:"bytes,2,opt,name=username,proto3,oneof"` -} - -type LoginRequest_Email struct { - Email string `protobuf:"bytes,3,opt,name=email,proto3,oneof"` -} - -func (*LoginRequest_Username) isLoginRequest_Identity() {} - -func (*LoginRequest_Email) isLoginRequest_Identity() {} - -// GetAdminRequest is the request message for the GetAdmin method. -type GetAdminRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The ID of the admin to retrieve. - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetAdminRequest) Reset() { - *x = GetAdminRequest{} - mi := &file_kratos_admin_v1_admin_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetAdminRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetAdminRequest) ProtoMessage() {} - -func (x *GetAdminRequest) ProtoReflect() protoreflect.Message { - mi := &file_kratos_admin_v1_admin_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 GetAdminRequest.ProtoReflect.Descriptor instead. -func (*GetAdminRequest) Descriptor() ([]byte, []int) { - return file_kratos_admin_v1_admin_proto_rawDescGZIP(), []int{3} -} - -func (x *GetAdminRequest) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -// ListAdminsResponse is the response message for the ListAdmins method. -type ListAdminsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Optional. The number of admins per page. - PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. The page token. - PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` - // Optional. The standard list filter. - // Supported fields: - // - `name` (i.e. `name="John Doe"`) - // - `create_time` range (i.e. `timestamp>="2025-01-31T11:30:00-04:00"` where - // the timestamp is in RFC 3339 format) - // - // More detail in [AIP-160](https://google.aip.dev/160). - Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` - // Optional. A comma-separated list of fields to order by, sorted in ascending - // order. Use "desc" after a field name for descending. Supported fields: - // - `create_time` - // - // Example: `create_time desc`. - OrderBy string `protobuf:"bytes,4,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListAdminsRequest) Reset() { - *x = ListAdminsRequest{} - mi := &file_kratos_admin_v1_admin_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListAdminsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListAdminsRequest) ProtoMessage() {} - -func (x *ListAdminsRequest) ProtoReflect() protoreflect.Message { - mi := &file_kratos_admin_v1_admin_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListAdminsRequest.ProtoReflect.Descriptor instead. -func (*ListAdminsRequest) Descriptor() ([]byte, []int) { - return file_kratos_admin_v1_admin_proto_rawDescGZIP(), []int{4} -} - -func (x *ListAdminsRequest) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListAdminsRequest) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - -func (x *ListAdminsRequest) GetFilter() string { - if x != nil { - return x.Filter - } - return "" -} - -func (x *ListAdminsRequest) GetOrderBy() string { - if x != nil { - return x.OrderBy - } - return "" -} - -// CreateAdminRequest is the request message for the CreateAdmin method. -type CreateAdminRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The admin to create. - Admin *Admin `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateAdminRequest) Reset() { - *x = CreateAdminRequest{} - mi := &file_kratos_admin_v1_admin_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateAdminRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateAdminRequest) ProtoMessage() {} - -func (x *CreateAdminRequest) ProtoReflect() protoreflect.Message { - mi := &file_kratos_admin_v1_admin_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateAdminRequest.ProtoReflect.Descriptor instead. -func (*CreateAdminRequest) Descriptor() ([]byte, []int) { - return file_kratos_admin_v1_admin_proto_rawDescGZIP(), []int{5} -} - -func (x *CreateAdminRequest) GetAdmin() *Admin { - if x != nil { - return x.Admin - } - return nil -} - -// UpdateAdminRequest is the request message for the UpdateAdmin method. -type UpdateAdminRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The admin to update. - Admin *Admin `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty"` - // Required. Mask of fields to update. - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateAdminRequest) Reset() { - *x = UpdateAdminRequest{} - mi := &file_kratos_admin_v1_admin_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateAdminRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateAdminRequest) ProtoMessage() {} - -func (x *UpdateAdminRequest) ProtoReflect() protoreflect.Message { - mi := &file_kratos_admin_v1_admin_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateAdminRequest.ProtoReflect.Descriptor instead. -func (*UpdateAdminRequest) Descriptor() ([]byte, []int) { - return file_kratos_admin_v1_admin_proto_rawDescGZIP(), []int{6} -} - -func (x *UpdateAdminRequest) GetAdmin() *Admin { - if x != nil { - return x.Admin - } - return nil -} - -func (x *UpdateAdminRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -// DeleteAdminRequest is the request message for the DeleteAdmin method. -type DeleteAdminRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The ID of the admin to delete. - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteAdminRequest) Reset() { - *x = DeleteAdminRequest{} - mi := &file_kratos_admin_v1_admin_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteAdminRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteAdminRequest) ProtoMessage() {} - -func (x *DeleteAdminRequest) ProtoReflect() protoreflect.Message { - mi := &file_kratos_admin_v1_admin_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteAdminRequest.ProtoReflect.Descriptor instead. -func (*DeleteAdminRequest) Descriptor() ([]byte, []int) { - return file_kratos_admin_v1_admin_proto_rawDescGZIP(), []int{7} -} - -func (x *DeleteAdminRequest) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -var File_kratos_admin_v1_admin_proto protoreflect.FileDescriptor - -const file_kratos_admin_v1_admin_proto_rawDesc = "" + - "\n" + - "\x1bkratos/admin/v1/admin.proto\x12\x0fkratos.admin.v1\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a google/protobuf/field_mask.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\"\x9d\x02\n" + - "\x05Admin\x12\x0e\n" + - "\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x14\n" + - "\x05email\x18\x03 \x01(\tR\x05email\x12\x14\n" + - "\x05phone\x18\x04 \x01(\tR\x05phone\x12\x16\n" + - "\x06avatar\x18\x05 \x01(\tR\x06avatar\x12\x16\n" + - "\x06access\x18\x06 \x01(\tR\x06access\x12\x1a\n" + - "\bpassword\x18\a \x01(\tR\bpassword\x12;\n" + - "\vcreate_time\x18\b \x01(\v2\x1a.google.protobuf.TimestampR\n" + - "createTime\x12;\n" + - "\vupdate_time\x18\t \x01(\v2\x1a.google.protobuf.TimestampR\n" + - "updateTime\"b\n" + - "\bAdminSet\x12.\n" + - "\x06admins\x18\x01 \x03(\v2\x16.kratos.admin.v1.AdminR\x06admins\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"r\n" + - "\fLoginRequest\x12 \n" + - "\bpassword\x18\x01 \x01(\tB\x04\xe2A\x01\x02R\bpassword\x12\x1c\n" + - "\busername\x18\x02 \x01(\tH\x00R\busername\x12\x16\n" + - "\x05email\x18\x03 \x01(\tH\x00R\x05emailB\n" + - "\n" + - "\bidentity\"'\n" + - "\x0fGetAdminRequest\x12\x14\n" + - "\x02id\x18\x01 \x01(\x03B\x04\xe2A\x01\x02R\x02id\"\x82\x01\n" + - "\x11ListAdminsRequest\x12\x1b\n" + - "\tpage_size\x18\x01 \x01(\x05R\bpageSize\x12\x1d\n" + - "\n" + - "page_token\x18\x02 \x01(\tR\tpageToken\x12\x16\n" + - "\x06filter\x18\x03 \x01(\tR\x06filter\x12\x19\n" + - "\border_by\x18\x04 \x01(\tR\aorderBy\"H\n" + - "\x12CreateAdminRequest\x122\n" + - "\x05admin\x18\x01 \x01(\v2\x16.kratos.admin.v1.AdminB\x04\xe2A\x01\x02R\x05admin\"\x8b\x01\n" + - "\x12UpdateAdminRequest\x122\n" + - "\x05admin\x18\x01 \x01(\v2\x16.kratos.admin.v1.AdminB\x04\xe2A\x01\x02R\x05admin\x12A\n" + - "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x04\xe2A\x01\x02R\n" + - "updateMask\"*\n" + - "\x12DeleteAdminRequest\x12\x14\n" + - "\x02id\x18\x01 \x01(\x03B\x04\xe2A\x01\x02R\x02id2\xa0\x06\n" + - "\fAdminService\x12[\n" + - "\x05Login\x12\x1d.kratos.admin.v1.LoginRequest\x1a\x16.kratos.admin.v1.Admin\"\x1b\x82\xd3\xe4\x93\x02\x15:\x01*\"\x10/v1/admins/login\x12V\n" + - "\x06Logout\x12\x16.google.protobuf.Empty\x1a\x16.google.protobuf.Empty\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/v1/admins/logout\x12U\n" + - "\aCurrent\x12\x16.google.protobuf.Empty\x1a\x16.kratos.admin.v1.Admin\"\x1a\x82\xd3\xe4\x93\x02\x14\x12\x12/v1/admins/current\x12d\n" + - "\n" + - "ListAdmins\x12\".kratos.admin.v1.ListAdminsRequest\x1a\x19.kratos.admin.v1.AdminSet\"\x17\x82\xd3\xe4\x93\x02\x11\x12\x0f/v1/admins/list\x12l\n" + - "\vCreateAdmin\x12#.kratos.admin.v1.CreateAdminRequest\x1a\x16.kratos.admin.v1.Admin\" \x82\xd3\xe4\x93\x02\x1a:\x05admin\"\x11/v1/admins/create\x12l\n" + - "\vUpdateAdmin\x12#.kratos.admin.v1.UpdateAdminRequest\x1a\x16.kratos.admin.v1.Admin\" \x82\xd3\xe4\x93\x02\x1a:\x05admin\x1a\x11/v1/admins/update\x12c\n" + - "\vDeleteAdmin\x12#.kratos.admin.v1.DeleteAdminRequest\x1a\x16.google.protobuf.Empty\"\x17\x82\xd3\xe4\x93\x02\x11*\x0f/v1/admins/{id}\x12]\n" + - "\bGetAdmin\x12 .kratos.admin.v1.GetAdminRequest\x1a\x16.kratos.admin.v1.Admin\"\x17\x82\xd3\xe4\x93\x02\x11\x12\x0f/v1/admins/{id}BQ\n" + - "\x13api.kratos.admin.v1P\x01Z8kra/api/kratos/admin/v1;v1b\x06proto3" - -var ( - file_kratos_admin_v1_admin_proto_rawDescOnce sync.Once - file_kratos_admin_v1_admin_proto_rawDescData []byte -) - -func file_kratos_admin_v1_admin_proto_rawDescGZIP() []byte { - file_kratos_admin_v1_admin_proto_rawDescOnce.Do(func() { - file_kratos_admin_v1_admin_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_kratos_admin_v1_admin_proto_rawDesc), len(file_kratos_admin_v1_admin_proto_rawDesc))) - }) - return file_kratos_admin_v1_admin_proto_rawDescData -} - -var file_kratos_admin_v1_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_kratos_admin_v1_admin_proto_goTypes = []any{ - (*Admin)(nil), // 0: kratos.admin.v1.Admin - (*AdminSet)(nil), // 1: kratos.admin.v1.AdminSet - (*LoginRequest)(nil), // 2: kratos.admin.v1.LoginRequest - (*GetAdminRequest)(nil), // 3: kratos.admin.v1.GetAdminRequest - (*ListAdminsRequest)(nil), // 4: kratos.admin.v1.ListAdminsRequest - (*CreateAdminRequest)(nil), // 5: kratos.admin.v1.CreateAdminRequest - (*UpdateAdminRequest)(nil), // 6: kratos.admin.v1.UpdateAdminRequest - (*DeleteAdminRequest)(nil), // 7: kratos.admin.v1.DeleteAdminRequest - (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp - (*fieldmaskpb.FieldMask)(nil), // 9: google.protobuf.FieldMask - (*emptypb.Empty)(nil), // 10: google.protobuf.Empty -} -var file_kratos_admin_v1_admin_proto_depIdxs = []int32{ - 8, // 0: kratos.admin.v1.Admin.create_time:type_name -> google.protobuf.Timestamp - 8, // 1: kratos.admin.v1.Admin.update_time:type_name -> google.protobuf.Timestamp - 0, // 2: kratos.admin.v1.AdminSet.admins:type_name -> kratos.admin.v1.Admin - 0, // 3: kratos.admin.v1.CreateAdminRequest.admin:type_name -> kratos.admin.v1.Admin - 0, // 4: kratos.admin.v1.UpdateAdminRequest.admin:type_name -> kratos.admin.v1.Admin - 9, // 5: kratos.admin.v1.UpdateAdminRequest.update_mask:type_name -> google.protobuf.FieldMask - 2, // 6: kratos.admin.v1.AdminService.Login:input_type -> kratos.admin.v1.LoginRequest - 10, // 7: kratos.admin.v1.AdminService.Logout:input_type -> google.protobuf.Empty - 10, // 8: kratos.admin.v1.AdminService.Current:input_type -> google.protobuf.Empty - 4, // 9: kratos.admin.v1.AdminService.ListAdmins:input_type -> kratos.admin.v1.ListAdminsRequest - 5, // 10: kratos.admin.v1.AdminService.CreateAdmin:input_type -> kratos.admin.v1.CreateAdminRequest - 6, // 11: kratos.admin.v1.AdminService.UpdateAdmin:input_type -> kratos.admin.v1.UpdateAdminRequest - 7, // 12: kratos.admin.v1.AdminService.DeleteAdmin:input_type -> kratos.admin.v1.DeleteAdminRequest - 3, // 13: kratos.admin.v1.AdminService.GetAdmin:input_type -> kratos.admin.v1.GetAdminRequest - 0, // 14: kratos.admin.v1.AdminService.Login:output_type -> kratos.admin.v1.Admin - 10, // 15: kratos.admin.v1.AdminService.Logout:output_type -> google.protobuf.Empty - 0, // 16: kratos.admin.v1.AdminService.Current:output_type -> kratos.admin.v1.Admin - 1, // 17: kratos.admin.v1.AdminService.ListAdmins:output_type -> kratos.admin.v1.AdminSet - 0, // 18: kratos.admin.v1.AdminService.CreateAdmin:output_type -> kratos.admin.v1.Admin - 0, // 19: kratos.admin.v1.AdminService.UpdateAdmin:output_type -> kratos.admin.v1.Admin - 10, // 20: kratos.admin.v1.AdminService.DeleteAdmin:output_type -> google.protobuf.Empty - 0, // 21: kratos.admin.v1.AdminService.GetAdmin:output_type -> kratos.admin.v1.Admin - 14, // [14:22] is the sub-list for method output_type - 6, // [6:14] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_kratos_admin_v1_admin_proto_init() } -func file_kratos_admin_v1_admin_proto_init() { - if File_kratos_admin_v1_admin_proto != nil { - return - } - file_kratos_admin_v1_admin_proto_msgTypes[2].OneofWrappers = []any{ - (*LoginRequest_Username)(nil), - (*LoginRequest_Email)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_kratos_admin_v1_admin_proto_rawDesc), len(file_kratos_admin_v1_admin_proto_rawDesc)), - NumEnums: 0, - NumMessages: 8, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_kratos_admin_v1_admin_proto_goTypes, - DependencyIndexes: file_kratos_admin_v1_admin_proto_depIdxs, - MessageInfos: file_kratos_admin_v1_admin_proto_msgTypes, - }.Build() - File_kratos_admin_v1_admin_proto = out.File - file_kratos_admin_v1_admin_proto_goTypes = nil - file_kratos_admin_v1_admin_proto_depIdxs = nil -} diff --git a/api/kratos/admin/v1/admin.proto b/api/kratos/admin/v1/admin.proto deleted file mode 100644 index 3685257..0000000 --- a/api/kratos/admin/v1/admin.proto +++ /dev/null @@ -1,161 +0,0 @@ -syntax = "proto3"; - -package kratos.admin.v1; - -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/field_mask.proto"; -import "google/api/annotations.proto"; -import "google/api/field_behavior.proto"; - -option go_package = "kra/api/kratos/admin/v1;v1"; -option java_multiple_files = true; -option java_package = "api.kratos.admin.v1"; - -// Admin is the admin message. -message Admin { - // The unique ID of the user. - int64 id = 1; - // The name of the user. - string name = 2; - // The email of the user. - string email = 3; - // The phone number of the user. - string phone = 4; - // The avatar URL of the user. - string avatar = 5; - // The access level of the user. - // Possible values are: "admin", "user", etc. - string access = 6; - // The password of the user. - string password = 7; - // The timestamp at which the user was created. - google.protobuf.Timestamp create_time = 8; - // The latest timestamp at which the user was updated. - google.protobuf.Timestamp update_time = 9; -} - -// AdminSet is the set of admins. -message AdminSet { - // The set of admins. - repeated Admin admins = 1; - // The next page token. - string next_page_token = 2; -} - -// AdminService is the admin service definition. -service AdminService { - // Login a user and return the username. - rpc Login (LoginRequest) returns (Admin) { - option (google.api.http) = { - post: "/v1/admins/login" - body: "*" - }; - } - // Logout the currently logged-in user. - rpc Logout (google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/admins/logout" - body: "*" - }; - } - // Current returns the currently logged-in user. - rpc Current (google.protobuf.Empty) returns (Admin) { - option (google.api.http) = { - get: "/v1/admins/current" - }; - } - // ListAdmins returns a list of admins. - rpc ListAdmins(ListAdminsRequest) returns (AdminSet) { - option (google.api.http) = { - get: "/v1/admins/list" - }; - } - // CreateAdmin creates a new admin. - rpc CreateAdmin(CreateAdminRequest) returns (Admin) { - option (google.api.http) = { - post: "/v1/admins/create" - body: "admin" - }; - } - // UpdateAdmin updates an existing admin. - rpc UpdateAdmin(UpdateAdminRequest) returns (Admin) { - option (google.api.http) = { - put: "/v1/admins/update" - body: "admin" - }; - } - // DeleteAdmin deletes an admin by ID. - rpc DeleteAdmin(DeleteAdminRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/admins/{id}" - }; - } - // GetAdmin retrieves an admin by ID. - rpc GetAdmin(GetAdminRequest) returns (Admin) { - option (google.api.http) = { - get: "/v1/admins/{id}" - }; - } -} - -// LoginRequest is the request message for the Login method. -message LoginRequest { - // Required. Password of the user. - string password = 1 [(google.api.field_behavior) = REQUIRED]; - // Required. Exactly one identity must be set. - oneof identity { - string username = 2; - string email = 3; - } -} - -// GetAdminRequest is the request message for the GetAdmin method. -message GetAdminRequest { - // The ID of the admin to retrieve. - int64 id = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// ListAdminsResponse is the response message for the ListAdmins method. -message ListAdminsRequest { - // Optional. The number of admins per page. - int32 page_size = 1; - // Optional. The page token. - string page_token = 2; - // Optional. The standard list filter. - // Supported fields: - // * `name` (i.e. `name="John Doe"`) - // * `email` (i.e. `email="admin@go-kratos.dev"`) - // * `phone` (i.e. `phone="+1234567890"`) - // * `create_time` range (i.e. `timestamp>="2025-01-31T11:30:00-04:00"` where - // the timestamp is in RFC 3339 format) - // - // More detail in [AIP-160](https://google.aip.dev/160). - string filter = 3; - // Optional. A comma-separated list of fields to order by, sorted in ascending - // order. Use "desc" after a field name for descending. Supported fields: - // - `create_time` - // - // Example: `create_time desc`. - string order_by = 4; -} - -// CreateAdminRequest is the request message for the CreateAdmin method. -message CreateAdminRequest { - // Required. The admin to create. - Admin admin = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// UpdateAdminRequest is the request message for the UpdateAdmin method. -message UpdateAdminRequest { - // Required. The admin to update. - Admin admin = 1 [(google.api.field_behavior) = REQUIRED]; - // Required. Mask of fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// DeleteAdminRequest is the request message for the DeleteAdmin method. -message DeleteAdminRequest { - // Required. The ID of the admin to delete. - int64 id = 1 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/api/kratos/admin/v1/admin_grpc.pb.go b/api/kratos/admin/v1/admin_grpc.pb.go deleted file mode 100644 index db70f31..0000000 --- a/api/kratos/admin/v1/admin_grpc.pb.go +++ /dev/null @@ -1,408 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.6.0 -// - protoc v4.23.2 -// source: kratos/admin/v1/admin.proto - -package v1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - AdminService_Login_FullMethodName = "/kratos.admin.v1.AdminService/Login" - AdminService_Logout_FullMethodName = "/kratos.admin.v1.AdminService/Logout" - AdminService_Current_FullMethodName = "/kratos.admin.v1.AdminService/Current" - AdminService_ListAdmins_FullMethodName = "/kratos.admin.v1.AdminService/ListAdmins" - AdminService_CreateAdmin_FullMethodName = "/kratos.admin.v1.AdminService/CreateAdmin" - AdminService_UpdateAdmin_FullMethodName = "/kratos.admin.v1.AdminService/UpdateAdmin" - AdminService_DeleteAdmin_FullMethodName = "/kratos.admin.v1.AdminService/DeleteAdmin" - AdminService_GetAdmin_FullMethodName = "/kratos.admin.v1.AdminService/GetAdmin" -) - -// AdminServiceClient is the client API for AdminService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// AdminService is the admin service definition. -type AdminServiceClient interface { - // Login a user and return the username. - Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*Admin, error) - // Logout the currently logged-in user. - Logout(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) - // Current returns the currently logged-in user. - Current(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Admin, error) - // ListAdmins returns a list of admins. - ListAdmins(ctx context.Context, in *ListAdminsRequest, opts ...grpc.CallOption) (*AdminSet, error) - // CreateAdmin creates a new admin. - CreateAdmin(ctx context.Context, in *CreateAdminRequest, opts ...grpc.CallOption) (*Admin, error) - // UpdateAdmin updates an existing admin. - UpdateAdmin(ctx context.Context, in *UpdateAdminRequest, opts ...grpc.CallOption) (*Admin, error) - // DeleteAdmin deletes an admin by ID. - DeleteAdmin(ctx context.Context, in *DeleteAdminRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // GetAdmin retrieves an admin by ID. - GetAdmin(ctx context.Context, in *GetAdminRequest, opts ...grpc.CallOption) (*Admin, error) -} - -type adminServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewAdminServiceClient(cc grpc.ClientConnInterface) AdminServiceClient { - return &adminServiceClient{cc} -} - -func (c *adminServiceClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*Admin, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Admin) - err := c.cc.Invoke(ctx, AdminService_Login_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *adminServiceClient) Logout(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, AdminService_Logout_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *adminServiceClient) Current(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Admin, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Admin) - err := c.cc.Invoke(ctx, AdminService_Current_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *adminServiceClient) ListAdmins(ctx context.Context, in *ListAdminsRequest, opts ...grpc.CallOption) (*AdminSet, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(AdminSet) - err := c.cc.Invoke(ctx, AdminService_ListAdmins_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *adminServiceClient) CreateAdmin(ctx context.Context, in *CreateAdminRequest, opts ...grpc.CallOption) (*Admin, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Admin) - err := c.cc.Invoke(ctx, AdminService_CreateAdmin_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *adminServiceClient) UpdateAdmin(ctx context.Context, in *UpdateAdminRequest, opts ...grpc.CallOption) (*Admin, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Admin) - err := c.cc.Invoke(ctx, AdminService_UpdateAdmin_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *adminServiceClient) DeleteAdmin(ctx context.Context, in *DeleteAdminRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, AdminService_DeleteAdmin_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *adminServiceClient) GetAdmin(ctx context.Context, in *GetAdminRequest, opts ...grpc.CallOption) (*Admin, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Admin) - err := c.cc.Invoke(ctx, AdminService_GetAdmin_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// AdminServiceServer is the server API for AdminService service. -// All implementations must embed UnimplementedAdminServiceServer -// for forward compatibility. -// -// AdminService is the admin service definition. -type AdminServiceServer interface { - // Login a user and return the username. - Login(context.Context, *LoginRequest) (*Admin, error) - // Logout the currently logged-in user. - Logout(context.Context, *emptypb.Empty) (*emptypb.Empty, error) - // Current returns the currently logged-in user. - Current(context.Context, *emptypb.Empty) (*Admin, error) - // ListAdmins returns a list of admins. - ListAdmins(context.Context, *ListAdminsRequest) (*AdminSet, error) - // CreateAdmin creates a new admin. - CreateAdmin(context.Context, *CreateAdminRequest) (*Admin, error) - // UpdateAdmin updates an existing admin. - UpdateAdmin(context.Context, *UpdateAdminRequest) (*Admin, error) - // DeleteAdmin deletes an admin by ID. - DeleteAdmin(context.Context, *DeleteAdminRequest) (*emptypb.Empty, error) - // GetAdmin retrieves an admin by ID. - GetAdmin(context.Context, *GetAdminRequest) (*Admin, error) - mustEmbedUnimplementedAdminServiceServer() -} - -// UnimplementedAdminServiceServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedAdminServiceServer struct{} - -func (UnimplementedAdminServiceServer) Login(context.Context, *LoginRequest) (*Admin, error) { - return nil, status.Error(codes.Unimplemented, "method Login not implemented") -} -func (UnimplementedAdminServiceServer) Logout(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { - return nil, status.Error(codes.Unimplemented, "method Logout not implemented") -} -func (UnimplementedAdminServiceServer) Current(context.Context, *emptypb.Empty) (*Admin, error) { - return nil, status.Error(codes.Unimplemented, "method Current not implemented") -} -func (UnimplementedAdminServiceServer) ListAdmins(context.Context, *ListAdminsRequest) (*AdminSet, error) { - return nil, status.Error(codes.Unimplemented, "method ListAdmins not implemented") -} -func (UnimplementedAdminServiceServer) CreateAdmin(context.Context, *CreateAdminRequest) (*Admin, error) { - return nil, status.Error(codes.Unimplemented, "method CreateAdmin not implemented") -} -func (UnimplementedAdminServiceServer) UpdateAdmin(context.Context, *UpdateAdminRequest) (*Admin, error) { - return nil, status.Error(codes.Unimplemented, "method UpdateAdmin not implemented") -} -func (UnimplementedAdminServiceServer) DeleteAdmin(context.Context, *DeleteAdminRequest) (*emptypb.Empty, error) { - return nil, status.Error(codes.Unimplemented, "method DeleteAdmin not implemented") -} -func (UnimplementedAdminServiceServer) GetAdmin(context.Context, *GetAdminRequest) (*Admin, error) { - return nil, status.Error(codes.Unimplemented, "method GetAdmin not implemented") -} -func (UnimplementedAdminServiceServer) mustEmbedUnimplementedAdminServiceServer() {} -func (UnimplementedAdminServiceServer) testEmbeddedByValue() {} - -// UnsafeAdminServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to AdminServiceServer will -// result in compilation errors. -type UnsafeAdminServiceServer interface { - mustEmbedUnimplementedAdminServiceServer() -} - -func RegisterAdminServiceServer(s grpc.ServiceRegistrar, srv AdminServiceServer) { - // If the following call panics, it indicates UnimplementedAdminServiceServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&AdminService_ServiceDesc, srv) -} - -func _AdminService_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LoginRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AdminServiceServer).Login(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AdminService_Login_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AdminServiceServer).Login(ctx, req.(*LoginRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _AdminService_Logout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AdminServiceServer).Logout(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AdminService_Logout_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AdminServiceServer).Logout(ctx, req.(*emptypb.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _AdminService_Current_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AdminServiceServer).Current(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AdminService_Current_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AdminServiceServer).Current(ctx, req.(*emptypb.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _AdminService_ListAdmins_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListAdminsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AdminServiceServer).ListAdmins(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AdminService_ListAdmins_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AdminServiceServer).ListAdmins(ctx, req.(*ListAdminsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _AdminService_CreateAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateAdminRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AdminServiceServer).CreateAdmin(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AdminService_CreateAdmin_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AdminServiceServer).CreateAdmin(ctx, req.(*CreateAdminRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _AdminService_UpdateAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateAdminRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AdminServiceServer).UpdateAdmin(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AdminService_UpdateAdmin_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AdminServiceServer).UpdateAdmin(ctx, req.(*UpdateAdminRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _AdminService_DeleteAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteAdminRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AdminServiceServer).DeleteAdmin(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AdminService_DeleteAdmin_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AdminServiceServer).DeleteAdmin(ctx, req.(*DeleteAdminRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _AdminService_GetAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAdminRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AdminServiceServer).GetAdmin(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AdminService_GetAdmin_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AdminServiceServer).GetAdmin(ctx, req.(*GetAdminRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// AdminService_ServiceDesc is the grpc.ServiceDesc for AdminService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var AdminService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "kratos.admin.v1.AdminService", - HandlerType: (*AdminServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Login", - Handler: _AdminService_Login_Handler, - }, - { - MethodName: "Logout", - Handler: _AdminService_Logout_Handler, - }, - { - MethodName: "Current", - Handler: _AdminService_Current_Handler, - }, - { - MethodName: "ListAdmins", - Handler: _AdminService_ListAdmins_Handler, - }, - { - MethodName: "CreateAdmin", - Handler: _AdminService_CreateAdmin_Handler, - }, - { - MethodName: "UpdateAdmin", - Handler: _AdminService_UpdateAdmin_Handler, - }, - { - MethodName: "DeleteAdmin", - Handler: _AdminService_DeleteAdmin_Handler, - }, - { - MethodName: "GetAdmin", - Handler: _AdminService_GetAdmin_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "kratos/admin/v1/admin.proto", -} diff --git a/api/kratos/admin/v1/admin_http.pb.go b/api/kratos/admin/v1/admin_http.pb.go deleted file mode 100644 index cf39ecb..0000000 --- a/api/kratos/admin/v1/admin_http.pb.go +++ /dev/null @@ -1,370 +0,0 @@ -// Code generated by protoc-gen-go-http. DO NOT EDIT. -// versions: -// - protoc-gen-go-http v2.9.2 -// - protoc v4.23.2 -// source: kratos/admin/v1/admin.proto - -package v1 - -import ( - context "context" - http "github.com/go-kratos/kratos/v2/transport/http" - binding "github.com/go-kratos/kratos/v2/transport/http/binding" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the kratos package it is being compiled against. -var _ = new(context.Context) -var _ = binding.EncodeURL - -const _ = http.SupportPackageIsVersion1 - -const OperationAdminServiceCreateAdmin = "/kratos.admin.v1.AdminService/CreateAdmin" -const OperationAdminServiceCurrent = "/kratos.admin.v1.AdminService/Current" -const OperationAdminServiceDeleteAdmin = "/kratos.admin.v1.AdminService/DeleteAdmin" -const OperationAdminServiceGetAdmin = "/kratos.admin.v1.AdminService/GetAdmin" -const OperationAdminServiceListAdmins = "/kratos.admin.v1.AdminService/ListAdmins" -const OperationAdminServiceLogin = "/kratos.admin.v1.AdminService/Login" -const OperationAdminServiceLogout = "/kratos.admin.v1.AdminService/Logout" -const OperationAdminServiceUpdateAdmin = "/kratos.admin.v1.AdminService/UpdateAdmin" - -type AdminServiceHTTPServer interface { - // CreateAdmin CreateAdmin creates a new admin. - CreateAdmin(context.Context, *CreateAdminRequest) (*Admin, error) - // Current Current returns the currently logged-in user. - Current(context.Context, *emptypb.Empty) (*Admin, error) - // DeleteAdmin DeleteAdmin deletes an admin by ID. - DeleteAdmin(context.Context, *DeleteAdminRequest) (*emptypb.Empty, error) - // GetAdmin GetAdmin retrieves an admin by ID. - GetAdmin(context.Context, *GetAdminRequest) (*Admin, error) - // ListAdmins ListAdmins returns a list of admins. - ListAdmins(context.Context, *ListAdminsRequest) (*AdminSet, error) - // Login Login a user and return the username. - Login(context.Context, *LoginRequest) (*Admin, error) - // Logout Logout the currently logged-in user. - Logout(context.Context, *emptypb.Empty) (*emptypb.Empty, error) - // UpdateAdmin UpdateAdmin updates an existing admin. - UpdateAdmin(context.Context, *UpdateAdminRequest) (*Admin, error) -} - -func RegisterAdminServiceHTTPServer(s *http.Server, srv AdminServiceHTTPServer) { - r := s.Route("/") - r.POST("/v1/admins/login", _AdminService_Login0_HTTP_Handler(srv)) - r.POST("/v1/admins/logout", _AdminService_Logout0_HTTP_Handler(srv)) - r.GET("/v1/admins/current", _AdminService_Current0_HTTP_Handler(srv)) - r.GET("/v1/admins/list", _AdminService_ListAdmins0_HTTP_Handler(srv)) - r.POST("/v1/admins/create", _AdminService_CreateAdmin0_HTTP_Handler(srv)) - r.PUT("/v1/admins/update", _AdminService_UpdateAdmin0_HTTP_Handler(srv)) - r.DELETE("/v1/admins/{id}", _AdminService_DeleteAdmin0_HTTP_Handler(srv)) - r.GET("/v1/admins/{id}", _AdminService_GetAdmin0_HTTP_Handler(srv)) -} - -func _AdminService_Login0_HTTP_Handler(srv AdminServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in LoginRequest - if err := ctx.Bind(&in); err != nil { - return err - } - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationAdminServiceLogin) - h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.Login(ctx, req.(*LoginRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*Admin) - return ctx.Result(200, reply) - } -} - -func _AdminService_Logout0_HTTP_Handler(srv AdminServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in emptypb.Empty - if err := ctx.Bind(&in); err != nil { - return err - } - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationAdminServiceLogout) - h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.Logout(ctx, req.(*emptypb.Empty)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*emptypb.Empty) - return ctx.Result(200, reply) - } -} - -func _AdminService_Current0_HTTP_Handler(srv AdminServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in emptypb.Empty - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationAdminServiceCurrent) - h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.Current(ctx, req.(*emptypb.Empty)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*Admin) - return ctx.Result(200, reply) - } -} - -func _AdminService_ListAdmins0_HTTP_Handler(srv AdminServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in ListAdminsRequest - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationAdminServiceListAdmins) - h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.ListAdmins(ctx, req.(*ListAdminsRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*AdminSet) - return ctx.Result(200, reply) - } -} - -func _AdminService_CreateAdmin0_HTTP_Handler(srv AdminServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in CreateAdminRequest - if err := ctx.Bind(&in.Admin); err != nil { - return err - } - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationAdminServiceCreateAdmin) - h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.CreateAdmin(ctx, req.(*CreateAdminRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*Admin) - return ctx.Result(200, reply) - } -} - -func _AdminService_UpdateAdmin0_HTTP_Handler(srv AdminServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in UpdateAdminRequest - if err := ctx.Bind(&in.Admin); err != nil { - return err - } - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationAdminServiceUpdateAdmin) - h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.UpdateAdmin(ctx, req.(*UpdateAdminRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*Admin) - return ctx.Result(200, reply) - } -} - -func _AdminService_DeleteAdmin0_HTTP_Handler(srv AdminServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in DeleteAdminRequest - if err := ctx.BindQuery(&in); err != nil { - return err - } - if err := ctx.BindVars(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationAdminServiceDeleteAdmin) - h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.DeleteAdmin(ctx, req.(*DeleteAdminRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*emptypb.Empty) - return ctx.Result(200, reply) - } -} - -func _AdminService_GetAdmin0_HTTP_Handler(srv AdminServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in GetAdminRequest - if err := ctx.BindQuery(&in); err != nil { - return err - } - if err := ctx.BindVars(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationAdminServiceGetAdmin) - h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.GetAdmin(ctx, req.(*GetAdminRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*Admin) - return ctx.Result(200, reply) - } -} - -type AdminServiceHTTPClient interface { - // CreateAdmin CreateAdmin creates a new admin. - CreateAdmin(ctx context.Context, req *CreateAdminRequest, opts ...http.CallOption) (rsp *Admin, err error) - // Current Current returns the currently logged-in user. - Current(ctx context.Context, req *emptypb.Empty, opts ...http.CallOption) (rsp *Admin, err error) - // DeleteAdmin DeleteAdmin deletes an admin by ID. - DeleteAdmin(ctx context.Context, req *DeleteAdminRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error) - // GetAdmin GetAdmin retrieves an admin by ID. - GetAdmin(ctx context.Context, req *GetAdminRequest, opts ...http.CallOption) (rsp *Admin, err error) - // ListAdmins ListAdmins returns a list of admins. - ListAdmins(ctx context.Context, req *ListAdminsRequest, opts ...http.CallOption) (rsp *AdminSet, err error) - // Login Login a user and return the username. - Login(ctx context.Context, req *LoginRequest, opts ...http.CallOption) (rsp *Admin, err error) - // Logout Logout the currently logged-in user. - Logout(ctx context.Context, req *emptypb.Empty, opts ...http.CallOption) (rsp *emptypb.Empty, err error) - // UpdateAdmin UpdateAdmin updates an existing admin. - UpdateAdmin(ctx context.Context, req *UpdateAdminRequest, opts ...http.CallOption) (rsp *Admin, err error) -} - -type AdminServiceHTTPClientImpl struct { - cc *http.Client -} - -func NewAdminServiceHTTPClient(client *http.Client) AdminServiceHTTPClient { - return &AdminServiceHTTPClientImpl{client} -} - -// CreateAdmin CreateAdmin creates a new admin. -func (c *AdminServiceHTTPClientImpl) CreateAdmin(ctx context.Context, in *CreateAdminRequest, opts ...http.CallOption) (*Admin, error) { - var out Admin - pattern := "/v1/admins/create" - path := binding.EncodeURL(pattern, in, false) - opts = append(opts, http.Operation(OperationAdminServiceCreateAdmin)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "POST", path, in.Admin, &out, opts...) - if err != nil { - return nil, err - } - return &out, nil -} - -// Current Current returns the currently logged-in user. -func (c *AdminServiceHTTPClientImpl) Current(ctx context.Context, in *emptypb.Empty, opts ...http.CallOption) (*Admin, error) { - var out Admin - pattern := "/v1/admins/current" - path := binding.EncodeURL(pattern, in, true) - opts = append(opts, http.Operation(OperationAdminServiceCurrent)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) - if err != nil { - return nil, err - } - return &out, nil -} - -// DeleteAdmin DeleteAdmin deletes an admin by ID. -func (c *AdminServiceHTTPClientImpl) DeleteAdmin(ctx context.Context, in *DeleteAdminRequest, opts ...http.CallOption) (*emptypb.Empty, error) { - var out emptypb.Empty - pattern := "/v1/admins/{id}" - path := binding.EncodeURL(pattern, in, true) - opts = append(opts, http.Operation(OperationAdminServiceDeleteAdmin)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "DELETE", path, nil, &out, opts...) - if err != nil { - return nil, err - } - return &out, nil -} - -// GetAdmin GetAdmin retrieves an admin by ID. -func (c *AdminServiceHTTPClientImpl) GetAdmin(ctx context.Context, in *GetAdminRequest, opts ...http.CallOption) (*Admin, error) { - var out Admin - pattern := "/v1/admins/{id}" - path := binding.EncodeURL(pattern, in, true) - opts = append(opts, http.Operation(OperationAdminServiceGetAdmin)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) - if err != nil { - return nil, err - } - return &out, nil -} - -// ListAdmins ListAdmins returns a list of admins. -func (c *AdminServiceHTTPClientImpl) ListAdmins(ctx context.Context, in *ListAdminsRequest, opts ...http.CallOption) (*AdminSet, error) { - var out AdminSet - pattern := "/v1/admins/list" - path := binding.EncodeURL(pattern, in, true) - opts = append(opts, http.Operation(OperationAdminServiceListAdmins)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) - if err != nil { - return nil, err - } - return &out, nil -} - -// Login Login a user and return the username. -func (c *AdminServiceHTTPClientImpl) Login(ctx context.Context, in *LoginRequest, opts ...http.CallOption) (*Admin, error) { - var out Admin - pattern := "/v1/admins/login" - path := binding.EncodeURL(pattern, in, false) - opts = append(opts, http.Operation(OperationAdminServiceLogin)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) - if err != nil { - return nil, err - } - return &out, nil -} - -// Logout Logout the currently logged-in user. -func (c *AdminServiceHTTPClientImpl) Logout(ctx context.Context, in *emptypb.Empty, opts ...http.CallOption) (*emptypb.Empty, error) { - var out emptypb.Empty - pattern := "/v1/admins/logout" - path := binding.EncodeURL(pattern, in, false) - opts = append(opts, http.Operation(OperationAdminServiceLogout)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) - if err != nil { - return nil, err - } - return &out, nil -} - -// UpdateAdmin UpdateAdmin updates an existing admin. -func (c *AdminServiceHTTPClientImpl) UpdateAdmin(ctx context.Context, in *UpdateAdminRequest, opts ...http.CallOption) (*Admin, error) { - var out Admin - pattern := "/v1/admins/update" - path := binding.EncodeURL(pattern, in, false) - opts = append(opts, http.Operation(OperationAdminServiceUpdateAdmin)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "PUT", path, in.Admin, &out, opts...) - if err != nil { - return nil, err - } - return &out, nil -}