This repository contains the necessary files to host restful API's using Protocol Buffers (a.k.a protobuf) under golang to run a database. Information on protocol buffers can be found on protobufs Google Developers site. All of the endpoints are hosted using Heroku. The database was implemented using MongoDB with the help of the public MongoDB driver mgo and is being hosted using mLab. This repository handles requests from the project dashboard and all of its components.
Make sure mgo, glog, grpc-gateway, cors, and grpc are installed in your golang environment. To execute the program run the server.go file as follows,
go run server.go
This will execute the server file.
Each endpoint expects to receive specific fields to process a request. The following are the expectations for each endpoint and the response. The API link is https://tea-project-management-api.herokuapp.com/. Note that each endpoint only accepts POST requests, so the link will only display a "Not Found" message since GET requests aren't supported.
| Endpoint | Request | Response |
|---|---|---|
| addmilestone | string xid = 1; string title = 2; string description = 3; repeated string users = 4; int32 weight = 5; |
bool success = 1; |
| editmilestone | string milestoneid = 1; string title = 2; string description = 3; repeated string users = 4; int32 weight = 5 |
bool success = 1; |
| deletemilestone | string xid = 1; string milestoneid = 2; |
bool success = 1; |
| milestonecompletion | string milestoneid = 1; | bool success = 1; |
| getallmilestones | repeated string milestoneid = 1; | bool success = 1; repeated MilestoneModel milestones = 2; |
| getprojectmembers | string xid = 1; repeated string memberslist = 2; |
bool success = 1; repeated UserTuple users = 2; |
| inviteuser | string xid = 1; string recipientemail = 2; string senderemail = 3; |
bool success = 1; |
| acceptinvitation | string email = 1; string xid = 2; |
bool success = 1; |
| rejectinvitation | string email = 1; string xid = 2; |
bool success = 1; |
| adduser | string xid = 1; string email = 2; |
bool success = 1; |
| removeuser | string xid = 1; string email = 2; |
bool success = 1; |
| rejectuser | string xid = 1; string email = 2; |
bool success = 1; |
| transferleader | string xid = 1; string newleader = 2; |
bool success = 1; |
| announcement | string xid = 1; string poster = 2; string message = 3; bool pin = 4; |
bool success = 1; |
| removenotification | string notification = 1; string user = 2; |
bool success = 1; |
| toggledone | string xid = 1; bool prevdone = 2; |
bool success = 1; |
| updatepercentage | string xid = 1; string percent = 2; |
bool success = 1; |
These are the outlines of some of the custom types which are returned.
| Type | Fields |
|---|---|
| MilestoneModel | string milestoneid = 1; string title = 2; string description = 3; repeated string users = 4; int32 weight = 5; bool done = 6; |
| UserTuple | string email = 1; string firstname = 2; |