mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-03 20:21:40 +00:00
refactor: update api version
This commit is contained in:
111
proto/api/v1/collection_service.proto
Normal file
111
proto/api/v1/collection_service.proto
Normal file
@ -0,0 +1,111 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package slash.api.v1;
|
||||
|
||||
import "api/v1/common.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service CollectionService {
|
||||
// ListCollections returns a list of collections.
|
||||
rpc ListCollections(ListCollectionsRequest) returns (ListCollectionsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/collections"};
|
||||
}
|
||||
// GetCollection returns a collection by id.
|
||||
rpc GetCollection(GetCollectionRequest) returns (GetCollectionResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/collections/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// GetCollectionByName returns a collection by name.
|
||||
rpc GetCollectionByName(GetCollectionByNameRequest) returns (GetCollectionByNameResponse) {}
|
||||
// CreateCollection creates a collection.
|
||||
rpc CreateCollection(CreateCollectionRequest) returns (CreateCollectionResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/collections"
|
||||
body: "collection"
|
||||
};
|
||||
}
|
||||
// UpdateCollection updates a collection.
|
||||
rpc UpdateCollection(UpdateCollectionRequest) returns (UpdateCollectionResponse) {
|
||||
option (google.api.http) = {
|
||||
put: "/api/v1/collections/{collection.id}"
|
||||
body: "collection"
|
||||
};
|
||||
option (google.api.method_signature) = "collection,update_mask";
|
||||
}
|
||||
// DeleteCollection deletes a collection by id.
|
||||
rpc DeleteCollection(DeleteCollectionRequest) returns (DeleteCollectionResponse) {
|
||||
option (google.api.http) = {delete: "/api/v1/collections/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
}
|
||||
|
||||
message Collection {
|
||||
int32 id = 1;
|
||||
|
||||
int32 creator_id = 2;
|
||||
|
||||
google.protobuf.Timestamp created_time = 3;
|
||||
|
||||
google.protobuf.Timestamp updated_time = 4;
|
||||
|
||||
string name = 6;
|
||||
|
||||
string title = 7;
|
||||
|
||||
string description = 8;
|
||||
|
||||
repeated int32 shortcut_ids = 9;
|
||||
|
||||
Visibility visibility = 10;
|
||||
}
|
||||
|
||||
message ListCollectionsRequest {}
|
||||
|
||||
message ListCollectionsResponse {
|
||||
repeated Collection collections = 1;
|
||||
}
|
||||
|
||||
message GetCollectionRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message GetCollectionResponse {
|
||||
Collection collection = 1;
|
||||
}
|
||||
|
||||
message GetCollectionByNameRequest {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message GetCollectionByNameResponse {
|
||||
Collection collection = 1;
|
||||
}
|
||||
|
||||
message CreateCollectionRequest {
|
||||
Collection collection = 1;
|
||||
}
|
||||
|
||||
message CreateCollectionResponse {
|
||||
Collection collection = 1;
|
||||
}
|
||||
|
||||
message UpdateCollectionRequest {
|
||||
Collection collection = 1;
|
||||
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message UpdateCollectionResponse {
|
||||
Collection collection = 1;
|
||||
}
|
||||
|
||||
message DeleteCollectionRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message DeleteCollectionResponse {}
|
Reference in New Issue
Block a user