Files
proto_go_dart_demo/proto/notes/v1/notes.proto
2026-02-23 13:02:22 +03:00

64 lines
1.9 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "proto3";
package notes.v1;
option go_package = "backend/gen/notes/v1;notesv1";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
// ─── Модели ───────────────────────────────────────────────
message Note {
string id = 1;
string title = 2;
string content = 3;
google.protobuf.Timestamp created_at = 4;
google.protobuf.Timestamp updated_at = 5;
}
// ─── Запросы и ответы ─────────────────────────────────────
message CreateNoteRequest {
string title = 1;
string content = 2;
}
message GetNoteRequest {
string id = 1;
}
message UpdateNoteRequest {
string id = 1;
string title = 2;
string content = 3;
}
message DeleteNoteRequest {
string id = 1;
}
message ListNotesRequest {
int32 page = 1;
int32 page_size = 2;
}
message ListNotesResponse {
repeated Note notes = 1;
int32 total_count = 2;
}
// ─── Сервис ───────────────────────────────────────────────
// Один этот файл определяет ВСЕ типы и ВСЕ эндпоинты.
// Из него генерируется типизированный код для Go и Dart.
// Изменил proto → перегенерировал → ошибки компиляции
// на обеих сторонах, если контракт нарушен.
service NoteService {
rpc CreateNote(CreateNoteRequest) returns (Note);
rpc GetNote(GetNoteRequest) returns (Note);
rpc UpdateNote(UpdateNoteRequest) returns (Note);
rpc DeleteNote(DeleteNoteRequest) returns (google.protobuf.Empty);
rpc ListNotes(ListNotesRequest) returns (ListNotesResponse);
}