docs: update api document

This commit is contained in:
zhuyasen 2025-06-21 16:52:07 +08:00
parent e08b23718f
commit 8152be79c0
2 changed files with 41 additions and 41 deletions

View File

@ -38,26 +38,26 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
}
};
service UserExample {
// create a new userExample
service userExample {
// Create a new userExample
rpc Create(CreateUserExampleRequest) returns (CreateUserExampleReply) {
option (google.api.http) = {
post: "/api/v1/userExample"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "create a new userExample";
summary: "Create a new userExample";
description: "Creates a new userExample entity using the provided data in the request body.";
};
}
// delete a userExample by id
// Delete a userExample by id
rpc DeleteByID(DeleteUserExampleByIDRequest) returns (DeleteUserExampleByIDReply) {
option (google.api.http) = {
delete: "/api/v1/userExample/{id}"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "delete a userExample by id";
summary: "Delete a userExample by id";
description: "Deletes a existing userExample identified by the given id in the path.";
//security: {
// security_requirement: {
@ -68,14 +68,14 @@ service UserExample {
};
}
// update a userExample by id
// Update a userExample by id
rpc UpdateByID(UpdateUserExampleByIDRequest) returns (UpdateUserExampleByIDReply) {
option (google.api.http) = {
put: "/api/v1/userExample/{id}"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "update a userExample by id";
summary: "Update a userExample by id";
description: "Updates the specified userExample with new data provided in the request body. The target is identified by id in the path.";
//security: {
// security_requirement: {
@ -86,13 +86,13 @@ service UserExample {
};
}
// get userExample details by id
// Get a userExample by id
rpc GetByID(GetUserExampleByIDRequest) returns (GetUserExampleByIDReply) {
option (google.api.http) = {
get: "/api/v1/userExample/{id}"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "get userExample details by id";
summary: "Get a userExample by id";
description: "Gets detailed information of a userExample specified by the given id in the path.";
//security: {
// security_requirement: {

View File

@ -104,32 +104,32 @@ import "validate/validate.proto";
option go_package = "github.com/go-dev-frame/sponge/api/serverNameExample/v1;v1";
service {{.TableName}} {
// create a new {{.TName}}
service {{.TName}} {
// Create a new {{.TName}}
rpc Create(Create{{.TableName}}Request) returns (Create{{.TableName}}Reply) {}
// delete a {{.TName}} by id
// Delete a {{.TName}} by id
rpc DeleteByID(Delete{{.TableName}}ByIDRequest) returns (Delete{{.TableName}}ByIDReply) {}
// update a {{.TName}} by id
// Update a {{.TName}} by id
rpc UpdateByID(Update{{.TableName}}ByIDRequest) returns (Update{{.TableName}}ByIDReply) {}
// get {{.TName}} details by id
// Get a {{.TName}} by id
rpc GetByID(Get{{.TableName}}ByIDRequest) returns (Get{{.TableName}}ByIDReply) {}
// get a list of {{.TName}} by custom conditions
// Get a paginated list of {{.TName}} by custom conditions
rpc List(List{{.TableName}}Request) returns (List{{.TableName}}Reply) {}
// delete {{.TName}} by batch id
// Batch delete {{.TName}} by ids
rpc DeleteByIDs(Delete{{.TableName}}ByIDsRequest) returns (Delete{{.TableName}}ByIDsReply) {}
// get {{.TName}} details by custom condition
// Get a {{.TName}} by custom condition
rpc GetByCondition(Get{{.TableName}}ByConditionRequest) returns (Get{{.TableName}}ByConditionReply) {}
// get a list of {{.TName}} by batch id
// Batch get {{.TName}} by ids
rpc ListByIDs(List{{.TableName}}ByIDsRequest) returns (List{{.TableName}}ByIDsReply) {}
// get a list of {{.TName}} by last id
// Get a paginated list of {{.TName}} by last id
rpc ListByLastID(List{{.TableName}}ByLastIDRequest) returns (List{{.TableName}}ByLastIDReply) {}
}
@ -227,20 +227,20 @@ import "validate/validate.proto";
option go_package = "github.com/go-dev-frame/sponge/api/serverNameExample/v1;v1";
service {{.TableName}} {
// create a new {{.TName}}
service {{.TName}} {
// Create a new {{.TName}}
rpc Create(Create{{.TableName}}Request) returns (Create{{.TableName}}Reply) {}
// delete a {{.TName}} by id
// Delete a {{.TName}} by id
rpc DeleteByID(Delete{{.TableName}}ByIDRequest) returns (Delete{{.TableName}}ByIDReply) {}
// update a {{.TName}} by id
// Update a {{.TName}} by id
rpc UpdateByID(Update{{.TableName}}ByIDRequest) returns (Update{{.TableName}}ByIDReply) {}
// get {{.TName}} details by id
// Get a {{.TName}} by id
rpc GetByID(Get{{.TableName}}ByIDRequest) returns (Get{{.TableName}}ByIDReply) {}
// get a list of {{.TName}} by custom conditions
// Get a paginated list of {{.TName}} by custom conditions
rpc List(List{{.TableName}}Request) returns (List{{.TableName}}Reply) {}
}
@ -345,8 +345,8 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
}
};
service {{.TableName}} {
// create a new {{.TName}}
service {{.TName}} {
// Create a new {{.TName}}
rpc Create(Create{{.TableName}}Request) returns (Create{{.TableName}}Reply) {
option (google.api.http) = {
post: "/api/v1/{{.TName}}"
@ -354,14 +354,14 @@ service {{.TableName}} {
};
}
// delete a {{.TName}} by id
// Delete a {{.TName}} by id
rpc DeleteByID(Delete{{.TableName}}ByIDRequest) returns (Delete{{.TableName}}ByIDReply) {
option (google.api.http) = {
delete: "/api/v1/{{.TName}}/{id}"
};
}
// update a {{.TName}} by id
// Update a {{.TName}} by id
rpc UpdateByID(Update{{.TableName}}ByIDRequest) returns (Update{{.TableName}}ByIDReply) {
option (google.api.http) = {
put: "/api/v1/{{.TName}}/{id}"
@ -369,14 +369,14 @@ service {{.TableName}} {
};
}
// get {{.TName}} details by id
// Get a {{.TName}} by id
rpc GetByID(Get{{.TableName}}ByIDRequest) returns (Get{{.TableName}}ByIDReply) {
option (google.api.http) = {
get: "/api/v1/{{.TName}}/{id}"
};
}
// get a list of {{.TName}} by custom conditions
// Get a paginated list of {{.TName}} by custom conditions
rpc List(List{{.TableName}}Request) returns (List{{.TableName}}Reply) {
option (google.api.http) = {
post: "/api/v1/{{.TName}}/list"
@ -384,7 +384,7 @@ service {{.TableName}} {
};
}
// delete {{.TName}} by batch id
// Batch delete {{.TName}} by ids
rpc DeleteByIDs(Delete{{.TableName}}ByIDsRequest) returns (Delete{{.TableName}}ByIDsReply) {
option (google.api.http) = {
post: "/api/v1/{{.TName}}/delete/ids"
@ -392,7 +392,7 @@ service {{.TableName}} {
};
}
// get {{.TName}} details by custom condition
// Get a {{.TName}} by custom condition
rpc GetByCondition(Get{{.TableName}}ByConditionRequest) returns (Get{{.TableName}}ByConditionReply) {
option (google.api.http) = {
post: "/api/v1/{{.TName}}/condition"
@ -400,7 +400,7 @@ service {{.TableName}} {
};
}
// get a list of {{.TName}} by batch id
// Batch get {{.TName}} by ids
rpc ListByIDs(List{{.TableName}}ByIDsRequest) returns (List{{.TableName}}ByIDsReply) {
option (google.api.http) = {
post: "/api/v1/{{.TName}}/list/ids"
@ -408,7 +408,7 @@ service {{.TableName}} {
};
}
// get a list of {{.TName}} by last id
// Get a paginated list of {{.TName}} by last id
rpc ListByLastID(List{{.TableName}}ByLastIDRequest) returns (List{{.TableName}}ByLastIDReply) {
option (google.api.http) = {
get: "/api/v1/{{.TName}}/list"
@ -567,8 +567,8 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
}
};
service {{.TableName}} {
// create a new {{.TName}}
service {{.TName}} {
// Create a new {{.TName}}
rpc Create(Create{{.TableName}}Request) returns (Create{{.TableName}}Reply) {
option (google.api.http) = {
post: "/api/v1/{{.TName}}"
@ -576,14 +576,14 @@ service {{.TableName}} {
};
}
// delete a {{.TName}} by id
// Delete a {{.TName}} by id
rpc DeleteByID(Delete{{.TableName}}ByIDRequest) returns (Delete{{.TableName}}ByIDReply) {
option (google.api.http) = {
delete: "/api/v1/{{.TName}}/{id}"
};
}
// update a {{.TName}} by id
// Update a {{.TName}} by id
rpc UpdateByID(Update{{.TableName}}ByIDRequest) returns (Update{{.TableName}}ByIDReply) {
option (google.api.http) = {
put: "/api/v1/{{.TName}}/{id}"
@ -591,14 +591,14 @@ service {{.TableName}} {
};
}
// get {{.TName}} details by id
// Get a {{.TName}} by id
rpc GetByID(Get{{.TableName}}ByIDRequest) returns (Get{{.TableName}}ByIDReply) {
option (google.api.http) = {
get: "/api/v1/{{.TName}}/{id}"
};
}
// get a list of {{.TName}} by custom conditions
// Get a paginated list of {{.TName}} by custom conditions
rpc List(List{{.TableName}}Request) returns (List{{.TableName}}Reply) {
option (google.api.http) = {
post: "/api/v1/{{.TName}}/list"