// templates/service.proto.template // This is a Jinja2 template for generating .proto files. // Use this template to define your gRPC service and messages. syntax = "proto3"; package {{ package_name }}; // Replace with your package name // Option to specify the go package. Replace with your desired path. option go_package = "{{ go_package_path }}"; // Define your service here. Replace "YourService" with your service name. // Consider adding authentication and authorization interceptors. service {{ service_name }} { // Unary RPC example: A simple request-response. rpc {{ unary_method_name }} ({{ unary_request_type }}) returns ({{ unary_response_type }}); // Server-side streaming RPC example: The server sends a stream of responses // after receiving the request. Useful for pushing updates. rpc {{ server_streaming_method_name }} ({{ streaming_request_type }}) returns (stream {{ streaming_response_type }}); // Client-side streaming RPC example: The client sends a stream of requests // to the server, which responds with a single response. Useful for batch processing. rpc {{ client_streaming_method_name }} (stream {{ streaming_request_type }}) returns ({{ streaming_response_type }}); // Bidirectional streaming RPC example: Both the client and the server send // a stream of messages using a read-write stream. Useful for real-time communication. rpc {{ bidirectional_streaming_method_name }} (stream {{ streaming_request_type }}) returns (stream {{ streaming_response_type }}); } // Define your message types here. Make sure the fields are well-defined and documented. // Consider using well-known types from google/protobuf/timestamp.proto for timestamps. // Example request message for unary RPC message {{ unary_request_type }} { string id = 1; // A unique identifier. Consider adding validation. string name = 2; // A name. Consider adding validation (e.g., max length). } // Example response message for unary RPC message {{ unary_response_type }} { string message = 1; // A confirmation message. int32 status_code = 2; // HTTP-like status code for finer-grained error handling. } // Example request message for streaming RPC message {{ streaming_request_type }} { string data = 1; // Data to be processed. Consider adding rate limiting on the server. int64 timestamp = 2; // Timestamp of the data. } // Example response message for streaming RPC message {{ streaming_response_type }} { string result = 1; // Result of the processing. bool success = 2; // Indicate if the processing was successful. }