-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(app): set up app in protobuf repo (#447)
Because we are going to develop app backend. This commit sets up need initial file and change for app backend --------- Co-authored-by: droplet-bot <[email protected]>
- Loading branch information
1 parent
165fed7
commit 49b9539
Showing
7 changed files
with
1,269 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
syntax = "proto3"; | ||
|
||
package app.app.v1alpha; | ||
|
||
import "common/healthcheck/v1beta/healthcheck.proto"; | ||
// Google API | ||
import "google/api/field_behavior.proto"; | ||
// Protocol Buffers Well-Known Types | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
// LivenessRequest represents a request to check a service liveness status | ||
message LivenessRequest { | ||
// HealthCheckRequest message | ||
optional common.healthcheck.v1beta.HealthCheckRequest health_check_request = 1 [(google.api.field_behavior) = OPTIONAL]; | ||
} | ||
|
||
// LivenessResponse represents a response for a service liveness status | ||
message LivenessResponse { | ||
// HealthCheckResponse message | ||
common.healthcheck.v1beta.HealthCheckResponse health_check_response = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; | ||
} | ||
|
||
// ReadinessRequest represents a request to check a service readiness status | ||
message ReadinessRequest { | ||
// HealthCheckRequest message | ||
optional common.healthcheck.v1beta.HealthCheckRequest health_check_request = 1 [(google.api.field_behavior) = OPTIONAL]; | ||
} | ||
|
||
// ReadinessResponse represents a response for a service readiness status | ||
message ReadinessResponse { | ||
// HealthCheckResponse message | ||
common.healthcheck.v1beta.HealthCheckResponse health_check_response = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; | ||
} | ||
|
||
/* | ||
This API is under development and, therefore, some of its entities and | ||
endpoints are not implemented yet. This section aims to give context about the | ||
current interface and how it fits in the App vision. | ||
# App | ||
The App domain is responsible of ready-to-use AI applications. | ||
*/ | ||
|
||
// App represents a app. | ||
message App { | ||
// The app id. | ||
string app_id = 1 [(google.api.field_behavior) = REQUIRED]; | ||
// The app name. | ||
string name = 2 [(google.api.field_behavior) = REQUIRED]; | ||
// The app description. | ||
string description = 3 [(google.api.field_behavior) = OPTIONAL]; | ||
// The creation time of the app. | ||
google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; | ||
// The last update time of the app. | ||
google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; | ||
// The owner/namespace of the app. | ||
string owner_name = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; | ||
// The app tags. | ||
repeated string tags = 8 [(google.api.field_behavior) = OPTIONAL]; | ||
} | ||
|
||
// CreateAppRequest represents a request to create a app. | ||
message CreateAppRequest { | ||
// The app's owner(namespaces). | ||
string namespace_id = 1 [(google.api.field_behavior) = REQUIRED]; | ||
// The app name. | ||
string name = 2 [(google.api.field_behavior) = REQUIRED]; | ||
// The app description. | ||
string description = 3 [(google.api.field_behavior) = OPTIONAL]; | ||
// The app tags. | ||
repeated string tags = 4 [(google.api.field_behavior) = OPTIONAL]; | ||
} | ||
|
||
// CreateAppResponse represents a response for creating a app. | ||
message CreateAppResponse { | ||
// The created app. | ||
App app = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; | ||
} | ||
|
||
// Request message for ListApps | ||
message ListAppsRequest { | ||
// User ID for which to list the apps | ||
string namespace_id = 1 [(google.api.field_behavior) = REQUIRED]; | ||
} | ||
|
||
// GetAppsResponse represents a response for getting all apps from users. | ||
message ListAppsResponse { | ||
// The apps container. | ||
repeated App apps = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; | ||
} | ||
|
||
// UpdateAppRequest represents a request to update a app. | ||
message UpdateAppRequest { | ||
// The app id. | ||
string app_id = 1 [(google.api.field_behavior) = REQUIRED]; | ||
// The app description. | ||
string description = 2 [(google.api.field_behavior) = OPTIONAL]; | ||
// The app tags. | ||
repeated string tags = 3 [(google.api.field_behavior) = OPTIONAL]; | ||
// The app owner(namespace). | ||
string namespace_id = 4 [(google.api.field_behavior) = REQUIRED]; | ||
} | ||
|
||
// UpdateAppResponse represents a response for updating a app. | ||
message UpdateAppResponse { | ||
// The updated app. | ||
App app = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; | ||
} | ||
|
||
// DeleteAppRequest represents a request to delete a app. | ||
message DeleteAppRequest { | ||
// The owner's id. i.e. namespace. | ||
string namespace_id = 1 [(google.api.field_behavior) = REQUIRED]; | ||
// The app id. | ||
string app_id = 2 [(google.api.field_behavior) = REQUIRED]; | ||
} | ||
|
||
// DeleteAppResponse represents a response for deleting a app. | ||
message DeleteAppResponse {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
syntax = "proto3"; | ||
|
||
package app.app.v1alpha; | ||
|
||
// App definitions | ||
import "app/app/v1alpha/app.proto"; | ||
import "app/app/v1alpha/conversation.proto"; | ||
// Google API | ||
import "google/api/annotations.proto"; | ||
import "google/api/visibility.proto"; | ||
// OpenAPI definition | ||
import "protoc-gen-openapiv2/options/annotations.proto"; | ||
|
||
// AppPublicService exposes the public endpoints that allow clients to | ||
// manage apps. | ||
service AppPublicService { | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Public App endpoints"}; | ||
|
||
// Check if the app server is alive | ||
// | ||
// See https://github.com/grpc/grpc/blob/master/doc/health-checking.md. | ||
rpc Liveness(LivenessRequest) returns (LivenessResponse) { | ||
option (google.api.http) = { | ||
get: "/v1alpha/__liveness" | ||
additional_bindings: [ | ||
{get: "/v1alpha/health/app"}] | ||
}; | ||
option (google.api.method_visibility).restriction = "INTERNAL"; | ||
} | ||
|
||
// Check if the app server is ready | ||
// | ||
// See https://github.com/grpc/grpc/blob/master/doc/health-checking.md | ||
rpc Readiness(ReadinessRequest) returns (ReadinessResponse) { | ||
option (google.api.http) = { | ||
get: "/v1alpha/__readiness" | ||
additional_bindings: [ | ||
{get: "/v1alpha/ready/app"}] | ||
}; | ||
option (google.api.method_visibility).restriction = "INTERNAL"; | ||
} | ||
|
||
// Create a App | ||
rpc CreateApp(CreateAppRequest) returns (CreateAppResponse) { | ||
option (google.api.http) = { | ||
post: "/v1alpha/namespaces/{namespace_id}/apps" | ||
body: "*" | ||
}; | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "App"}; | ||
} | ||
|
||
// Get all apps info | ||
rpc ListApps(ListAppsRequest) returns (ListAppsResponse) { | ||
option (google.api.http) = {get: "/v1alpha/namespaces/{namespace_id}/apps"}; | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "App"}; | ||
} | ||
|
||
// Update a app info | ||
rpc UpdateApp(UpdateAppRequest) returns (UpdateAppResponse) { | ||
option (google.api.http) = { | ||
put: "/v1alpha/namespaces/{namespace_id}/apps/{app_id}" | ||
body: "*" | ||
}; | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "App"}; | ||
} | ||
|
||
// Delete a app | ||
rpc DeleteApp(DeleteAppRequest) returns (DeleteAppResponse) { | ||
option (google.api.http) = {delete: "/v1alpha/namespaces/{namespace_id}/apps/{app_id}"}; | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "App"}; | ||
} | ||
|
||
// Create a Conversation | ||
rpc CreateConversation(CreateConversationRequest) returns (CreateConversationResponse) { | ||
option (google.api.http) = { | ||
post: "/v1alpha/namespaces/{namespace_id}/apps/{app_id}/conversations" | ||
body: "*" | ||
}; | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "app"}; | ||
} | ||
// List conversations | ||
rpc ListConversations(ListConversationsRequest) returns (ListConversationsResponse) { | ||
option (google.api.http) = {get: "/v1alpha/namespaces/{namespace_id}/apps/{app_id}/conversations"}; | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "app"}; | ||
} | ||
// Update a conversation | ||
rpc UpdateConversation(UpdateConversationRequest) returns (UpdateConversationResponse) { | ||
option (google.api.http) = { | ||
put: "/v1alpha/namespaces/{namespace_id}/apps/{app_id}/conversations/{conversation_id}" | ||
body: "*" | ||
}; | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "app"}; | ||
} | ||
// Delete a conversation | ||
rpc DeleteConversation(DeleteConversationRequest) returns (DeleteConversationResponse) { | ||
option (google.api.http) = {delete: "/v1alpha/namespaces/{namespace_id}/apps/{app_id}/conversations/{conversation_id}"}; | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "app"}; | ||
} | ||
// Create a message | ||
rpc CreateMessage(CreateMessageRequest) returns (CreateMessageResponse) { | ||
option (google.api.http) = { | ||
post: "/v1alpha/namespaces/{namespace_id}/apps/{app_id}/conversations/{conversation_id}/messages" | ||
body: "*" | ||
}; | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "app"}; | ||
} | ||
// List messages | ||
rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse) { | ||
option (google.api.http) = {get: "/v1alpha/namespaces/{namespace_id}/apps/{app_id}/conversations/{conversation_id}/messages"}; | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "app"}; | ||
} | ||
// Update a message | ||
rpc UpdateMessage(UpdateMessageRequest) returns (UpdateMessageResponse) { | ||
option (google.api.http) = { | ||
put: "/v1alpha/namespaces/{namespace_id}/apps/{app_id}/conversations/{conversation_id}/messages/{message_uid}" | ||
body: "*" | ||
}; | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "app"}; | ||
} | ||
// Delete a message | ||
rpc DeleteMessage(DeleteMessageRequest) returns (DeleteMessageResponse) { | ||
option (google.api.http) = {delete: "/v1alpha/namespaces/{namespace_id}/apps/{app_id}/conversations/{conversation_id}/messages/{message_uid}"}; | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "app"}; | ||
} | ||
} |
Oops, something went wrong.