...

Text file src/github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb/use_go_template.proto

Documentation: github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb

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

View as plain text