Skip to content

Commit

Permalink
Add example for delete method
Browse files Browse the repository at this point in the history
  • Loading branch information
blackdahila committed Apr 25, 2018
1 parent 5432d30 commit 90e1c41
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 5 deletions.
46 changes: 41 additions & 5 deletions examples/proto/examplepb/echo_service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions examples/proto/examplepb/echo_service.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions examples/proto/examplepb/echo_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,11 @@ service EchoService {
body: "*"
};
}

// EchoDelete method receives a simple message and returns it.
rpc EchoDelete(SimpleMessage) returns (SimpleMessage) {
option (google.api.http) = {
delete: "/v1/example/echo_delete"
};
}
}
33 changes: 33 additions & 0 deletions examples/proto/examplepb/echo_service.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,39 @@
"EchoService"
]
}
},
"/v1/example/echo_delete": {
"delete": {
"summary": "EchoDelete method receives a simple message and returns it.",
"operationId": "EchoDelete",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/examplepbSimpleMessage"
}
}
},
"parameters": [
{
"name": "id",
"description": "Id represents the message identifier.",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "num",
"in": "query",
"required": false,
"type": "string",
"format": "int64"
}
],
"tags": [
"EchoService"
]
}
}
},
"definitions": {
Expand Down
5 changes: 5 additions & 0 deletions examples/server/echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ func (s *echoServer) EchoBody(ctx context.Context, msg *examples.SimpleMessage)
}))
return msg, nil
}

func (s *echoServer) EchoDelete(ctx context.Context, msg *examples.SimpleMessage) (*examples.SimpleMessage, error) {
glog.Info(msg)
return msg, nil
}

0 comments on commit 90e1c41

Please sign in to comment.