Complete the develop service

This commit is contained in:
2025-08-07 20:30:34 +08:00
parent 00cdd1bc5d
commit ee8e9df12e
12 changed files with 313 additions and 143 deletions

View File

@@ -14,20 +14,20 @@ public class VerificationMark
[MaxLength(8192)] public string? Description { get; set; }
[MaxLength(1024)] public string? VerifiedBy { get; set; }
public Shared.Proto.VerificationMark ToProtoValue()
public Proto.VerificationMark ToProtoValue()
{
var proto = new Shared.Proto.VerificationMark
var proto = new Proto.VerificationMark
{
Type = Type switch
{
VerificationMarkType.Official => Shared.Proto.VerificationMarkType.Official,
VerificationMarkType.Individual => Shared.Proto.VerificationMarkType.Individual,
VerificationMarkType.Organization => Shared.Proto.VerificationMarkType.Organization,
VerificationMarkType.Government => Shared.Proto.VerificationMarkType.Government,
VerificationMarkType.Creator => Shared.Proto.VerificationMarkType.Creator,
VerificationMarkType.Developer => Shared.Proto.VerificationMarkType.Developer,
VerificationMarkType.Parody => Shared.Proto.VerificationMarkType.Parody,
_ => Shared.Proto.VerificationMarkType.Unspecified
VerificationMarkType.Official => Proto.VerificationMarkType.Official,
VerificationMarkType.Individual => Proto.VerificationMarkType.Individual,
VerificationMarkType.Organization => Proto.VerificationMarkType.Organization,
VerificationMarkType.Government => Proto.VerificationMarkType.Government,
VerificationMarkType.Creator => Proto.VerificationMarkType.Creator,
VerificationMarkType.Developer => Proto.VerificationMarkType.Developer,
VerificationMarkType.Parody => Proto.VerificationMarkType.Parody,
_ => Proto.VerificationMarkType.Unspecified
},
Title = Title ?? string.Empty,
Description = Description ?? string.Empty,

View File

@@ -7,11 +7,12 @@ option csharp_namespace = "DysonNetwork.Shared.Proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "file.proto";
import "account.proto";
enum PublisherType {
PUBLISHER_TYPE_UNSPECIFIED = 0;
INDIVIDUAL = 1;
ORGANIZATIONAL = 2;
PUB_INDIVIDUAL = 1;
PUB_ORGANIZATIONAL = 2;
}
enum PublisherMemberRole {
@@ -48,33 +49,35 @@ message Publisher {
google.protobuf.StringValue bio = 5;
CloudFile picture = 8;
CloudFile background = 9;
optional bytes verification_mark = 10;
optional VerificationMark verification_mark = 10;
string account_id = 11;
string realm_id = 12;
optional string realm_id = 12;
google.protobuf.Timestamp created_at = 13;
google.protobuf.Timestamp updated_at = 14;
}
message GetPublisherRequest {
string name = 1;
oneof query {
string name = 1;
string id = 2;
}
}
message GetPublisherResponse {
Publisher publisher = 1;
}
message GetPublisherBatchRequest {
repeated string ids = 1;
}
message ListPublishersRequest {
string account_id = 1; // filter by owner/member account
string realm_id = 2; // filter by realm
int32 page_size = 3;
string page_token = 4;
string order_by = 5;
}
message ListPublishersResponse {
repeated Publisher publishers = 1;
string next_page_token = 2;
int32 total_size = 3;
}
message ListPublisherMembersRequest {
@@ -99,10 +102,22 @@ message HasPublisherFeatureResponse {
bool enabled = 1;
}
message IsPublisherMemberRequest {
string publisher_id = 1;
string account_id = 2;
PublisherMemberRole role = 3;
}
message IsPublisherMemberResponse {
bool valid = 1;
}
service PublisherService {
rpc GetPublisher(GetPublisherRequest) returns (GetPublisherResponse);
rpc GetPublisherBatch(GetPublisherBatchRequest) returns (ListPublishersResponse);
rpc ListPublishers(ListPublishersRequest) returns (ListPublishersResponse);
rpc ListPublisherMembers(ListPublisherMembersRequest) returns (ListPublisherMembersResponse);
rpc SetPublisherFeatureFlag(SetPublisherFeatureFlagRequest) returns (google.protobuf.StringValue); // returns optional message
rpc HasPublisherFeature(HasPublisherFeatureRequest) returns (HasPublisherFeatureResponse);
rpc IsPublisherMember(IsPublisherMemberRequest) returns (IsPublisherMemberResponse);
}