chore: tweak user api definition

This commit is contained in:
Steven
2024-03-18 12:56:52 +08:00
parent f3fb5e0c60
commit 86db6d0254
27 changed files with 1342 additions and 960 deletions

View File

@@ -131,30 +131,28 @@ message Memo {
RowStatus row_status = 3;
// The name of the creator.
// Format: users/{username}
// Format: users/{uid}
string creator = 4;
int32 creator_id = 5;
google.protobuf.Timestamp create_time = 5;
google.protobuf.Timestamp create_time = 6;
google.protobuf.Timestamp update_time = 6;
google.protobuf.Timestamp update_time = 7;
google.protobuf.Timestamp display_time = 78;
google.protobuf.Timestamp display_time = 8;
string content = 8;
string content = 9;
Visibility visibility = 9;
Visibility visibility = 10;
bool pinned = 10;
bool pinned = 11;
optional int32 parent_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
optional int32 parent_id = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
repeated Resource resources = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
repeated Resource resources = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
repeated MemoRelation relations = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
repeated MemoRelation relations = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
repeated Reaction reactions = 15 [(google.api.field_behavior) = OUTPUT_ONLY];
repeated Reaction reactions = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
}
message CreateMemoRequest {
@@ -176,7 +174,7 @@ message ListMemosRequest {
string page_token = 2;
// Filter is used to filter memos returned in the list.
// Format: "creator == users/{username} && visibilities == ['PUBLIC', 'PROTECTED']"
// Format: "creator == users/{uid} && visibilities == ['PUBLIC', 'PROTECTED']"
string filter = 3;
}

View File

@@ -7,6 +7,8 @@ option go_package = "gen/api/v2";
message Reaction {
int32 id = 1;
// The name of the creator.
// Format: users/{uid}
string creator = 2;
string content_id = 3;

View File

@@ -37,7 +37,7 @@ service TagService {
message Tag {
string name = 1;
// The creator of tags.
// Format: users/{username}
// Format: users/{uid}
string creator = 2;
}
@@ -57,7 +57,7 @@ message BatchUpsertTagResponse {}
message ListTagsRequest {
// The creator of tags.
// Format: users/{username}
// Format: users/{uid}
string user = 1;
}
@@ -67,7 +67,7 @@ message ListTagsResponse {
message RenameTagRequest {
// The creator of tags.
// Format: users/{username}
// Format: users/{uid}
string user = 1;
string old_name = 2;
string new_name = 3;
@@ -85,7 +85,7 @@ message DeleteTagResponse {}
message GetTagSuggestionsRequest {
// The creator of tags.
// Format: users/{username}
// Format: users/{uid}
string user = 1;
}

View File

@@ -17,6 +17,11 @@ service UserService {
option (google.api.http) = {get: "/api/v2/users"};
}
// SearchUsers searches users by filter.
rpc SearchUsers(SearchUsersRequest) returns (SearchUsersResponse) {
option (google.api.http) = {get: "/api/v2/users/search"};
}
// GetUser gets a user by name.
rpc GetUser(GetUserRequest) returns (GetUserResponse) {
option (google.api.http) = {get: "/api/v2/{name=users/*}"};
@@ -86,9 +91,10 @@ service UserService {
message User {
// The name of the user.
// Format: users/{username}
// Format: users/{uid}
string name = 1;
// The system generated uid of the user.
int32 id = 2;
enum Role {
@@ -124,9 +130,17 @@ message ListUsersResponse {
repeated User users = 1;
}
message SearchUsersRequest {
string filter = 1;
}
message SearchUsersResponse {
repeated User users = 1;
}
message GetUserRequest {
// The name of the user.
// Format: users/{username}
// Format: users/{uid}
string name = 1;
}
@@ -154,7 +168,7 @@ message UpdateUserResponse {
message DeleteUserRequest {
// The name of the user.
// Format: users/{username}
// Format: users/{uid}
string name = 1;
}
@@ -162,7 +176,7 @@ message DeleteUserResponse {}
message UserSetting {
// The name of the user.
// Format: users/{username}
// Format: users/{uid}
string name = 1;
// The preferred locale of the user.
string locale = 2;
@@ -176,7 +190,7 @@ message UserSetting {
message GetUserSettingRequest {
// The name of the user.
// Format: users/{username}
// Format: users/{uid}
string name = 1;
}
@@ -203,7 +217,7 @@ message UserAccessToken {
message ListUserAccessTokensRequest {
// The name of the user.
// Format: users/{username}
// Format: users/{uid}
string name = 1;
}
@@ -213,7 +227,7 @@ message ListUserAccessTokensResponse {
message CreateUserAccessTokenRequest {
// The name of the user.
// Format: users/{username}
// Format: users/{uid}
string name = 1;
string description = 2;
@@ -227,7 +241,7 @@ message CreateUserAccessTokenResponse {
message DeleteUserAccessTokenRequest {
// The name of the user.
// Format: users/{username}
// Format: users/{uid}
string name = 1;
// access_token is the access token to delete.
string access_token = 2;