From 382266dac5c81dd448e4d20084347ec5927d057c Mon Sep 17 00:00:00 2001 From: KoCoder Date: Tue, 2 Jun 2026 19:14:22 +0200 Subject: [PATCH] Protobufdefinition: proto.shorten.v1 --- shorten/v1/shorten.proto | 53 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 shorten/v1/shorten.proto diff --git a/shorten/v1/shorten.proto b/shorten/v1/shorten.proto new file mode 100644 index 0000000..e974242 --- /dev/null +++ b/shorten/v1/shorten.proto @@ -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) {} +}