github.com/grpc-ecosystem/grpc-gateway/v2@v2.19.1/examples/internal/proto/examplepb/use_go_template.proto (about) 1 syntax = "proto3"; 2 3 package grpc.gateway.examples.internal.proto.examplepb; 4 5 import "google/api/annotations.proto"; 6 7 option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb"; 8 9 service LoginService { 10 // Login 11 // 12 // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. 13 // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". 14 // 15 // ## {{.RequestType.Name}} 16 // | Field ID | Name | Type | Description | 17 // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} 18 // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} 19 // 20 // ## {{.ResponseType.Name}} 21 // | Field ID | Name | Type | Description | 22 // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} 23 // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} 24 rpc Login(LoginRequest) returns (LoginReply) { 25 option (google.api.http) = { 26 post: "/v1/example/login" 27 body: "*" 28 }; 29 } 30 31 // Logout 32 // 33 // {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service. 34 // It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}". 35 // 36 // ## {{.RequestType.Name}} 37 // | Field ID | Name | Type | Description | 38 // | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}} 39 // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} 40 // 41 // ## {{.ResponseType.Name}} 42 // | Field ID | Name | Type | Description | 43 // | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}} 44 // | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}} 45 rpc Logout(LogoutRequest) returns (LogoutReply) { 46 option (google.api.http) = { 47 post: "/v1/example/logout" 48 body: "*" 49 }; 50 } 51 } 52 53 message LoginRequest { 54 // The entered username 55 string username = 1; 56 // The entered password 57 string password = 2; 58 } 59 60 message LoginReply { 61 string message = 1; 62 // Whether you have access or not 63 bool access = 2; 64 } 65 66 message LogoutRequest { 67 // The time the logout was registered 68 string timeoflogout = 1; 69 // This is the title 70 // 71 // This is the "Description" of field test 72 // you can use as many newlines as you want 73 // 74 // 75 // it will still format the same in the table 76 int32 test = 2; 77 // This is an array 78 // 79 // It displays that using [] infront of the type 80 repeated string stringarray = 3; 81 } 82 83 message LogoutReply { 84 // Message that tells you whether your 85 // logout was successful or not 86 string message = 1; 87 }