添加项目文件。
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Protos\group.proto" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Grpc.AspNetCore" Version="2.76.0" />
|
||||
<PackageReference Include="Grpc.Net.Client" Version="2.76.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.80.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<Protobuf Include="Protos\conversation.proto" GrpcServices="Both" />
|
||||
<Protobuf Include="Protos\user.proto" GrpcServices="Both" />
|
||||
<Protobuf Include="Protos\contact.proto" GrpcServices="Both" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,23 @@
|
||||
syntax = "proto3";
|
||||
|
||||
// 指定生成的 C# 命名空间
|
||||
option csharp_namespace = "IM.Protocols.Grpc.Contact";
|
||||
|
||||
package contact;
|
||||
|
||||
// 定义服务
|
||||
service ContactInternal {
|
||||
//检查好友关系
|
||||
rpc CheckFriendship (CheckFriendshipRequest) returns (CheckFriendshipResponse);
|
||||
}
|
||||
|
||||
// 请求参数
|
||||
message CheckFriendshipRequest {
|
||||
string owner_id = 1;
|
||||
string target_id = 2;
|
||||
}
|
||||
|
||||
// 响应参数
|
||||
message CheckFriendshipResponse {
|
||||
bool checked = 1;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
syntax = "proto3";
|
||||
|
||||
// 指定生成的 C# 命名空间
|
||||
option csharp_namespace = "IM.Protocols.Grpc.Conversation";
|
||||
|
||||
package conversation;
|
||||
|
||||
// 定义服务
|
||||
service ConversationInternal {
|
||||
// 获取用户的流密钥列表
|
||||
rpc GetUserStreamKeys (GetUserStreamKeysRequest) returns (UserStreamKeysResponse);
|
||||
}
|
||||
|
||||
// 请求参数
|
||||
message GetUserStreamKeysRequest {
|
||||
string user_id = 1;
|
||||
}
|
||||
|
||||
// 响应数据
|
||||
message UserStreamKeysResponse {
|
||||
repeated string stream_keys = 1;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IM.Protocols.Protos
|
||||
{
|
||||
internal class group
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
syntax = "proto3";
|
||||
|
||||
// 导入时间戳支持
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
// 指定生成的 C# 代码命名空间
|
||||
option csharp_namespace = "IM.Protocols.Grpc.User";
|
||||
|
||||
package User;
|
||||
|
||||
service UserInternal {
|
||||
// 获取用户信息
|
||||
rpc GetUserInfoAsync (GetUserInfoRequest) returns (UserResponse);
|
||||
}
|
||||
|
||||
// 请求参数:Guid 在 proto 中通常传 string 格式
|
||||
message GetUserInfoRequest {
|
||||
string userId = 1;
|
||||
}
|
||||
|
||||
message UserResponse {
|
||||
string id = 1; // Guid 映射为 string
|
||||
string userName = 2;
|
||||
string nickName = 3;
|
||||
optional string email = 4; // 使用 optional 对应 string?
|
||||
optional string phone = 5;
|
||||
string region = 6;
|
||||
string description = 7;
|
||||
optional string avatar = 8;
|
||||
|
||||
// 使用官方时间戳类型
|
||||
google.protobuf.Timestamp creationTime = 9;
|
||||
optional google.protobuf.Timestamp deletion = 10;
|
||||
}
|
||||
Reference in New Issue
Block a user