Protobufdefinition: proto.shorten.v1
This commit is contained in:
53
shorten/v1/shorten.proto
Normal file
53
shorten/v1/shorten.proto
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package proto.shorten.v1;
|
||||||
|
|
||||||
|
import "buf/validate/validate.proto";
|
||||||
|
import "google/protobuf/timestamp.proto";
|
||||||
|
|
||||||
|
message CreateURLRedirectionRequest {
|
||||||
|
string short_code = 1 [(buf.validate.field).string = {len: 10}];
|
||||||
|
string url = 2 [(buf.validate.field).string = {uri: true}];
|
||||||
|
}
|
||||||
|
message CreateURLRedirectionResponse {
|
||||||
|
bool ok = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message URLRedirection {
|
||||||
|
int32 url_id = 1;
|
||||||
|
string short_code = 3;
|
||||||
|
string url = 2;
|
||||||
|
google.protobuf.Timestamp created_at = 4;
|
||||||
|
google.protobuf.Timestamp expires_at = 5;
|
||||||
|
bool is_active = 6;
|
||||||
|
repeated int32 click_count_by_day = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListURLRedirectionsRequest {}
|
||||||
|
message ListURLRedirectionsResponse {
|
||||||
|
repeated URLRedirection url_redirections = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DeactivateURLRedirectionRequest {
|
||||||
|
int32 url_id = 1;
|
||||||
|
bool is_active = 2;
|
||||||
|
}
|
||||||
|
message DeactivateURLRedirectionResponse {
|
||||||
|
bool ok = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DeleteURLRedirectionRequest {
|
||||||
|
int32 url_id = 1;
|
||||||
|
}
|
||||||
|
message DeleteURLRedirectionResponse {
|
||||||
|
bool ok = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
service ShortenService {
|
||||||
|
rpc CreateURLRedirection(CreateURLRedirectionRequest) returns (CreateURLRedirectionResponse) {}
|
||||||
|
rpc ListURLRedirections(ListURLRedirectionsRequest) returns (ListURLRedirectionsResponse) {}
|
||||||
|
// rpc GetURLRedirection(GetURLRedirectionRequest) returns
|
||||||
|
// (GetURLRedirectionResponse) {}
|
||||||
|
rpc DeactivateURLRedirection(DeactivateURLRedirectionRequest) returns (DeactivateURLRedirectionResponse) {}
|
||||||
|
rpc DeleteURLRedirection(DeleteURLRedirectionRequest) returns (DeleteURLRedirectionResponse) {}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user