diff --git a/githubtasksapi.go b/githubtasksapi.go index ddf58b8a..eb7564a1 100644 --- a/githubtasksapi.go +++ b/githubtasksapi.go @@ -33,3 +33,17 @@ func (s *Server) AddTask(ctx context.Context, req *pb.AddTaskRequest) (*pb.AddTa return nil, fmt.Errorf("Could not locate milestone %v/%v", req.GetMilestoneName(), req.GetMilestoneNumber()) } + +// GetMilestones for the system +func (s *Server) GetMilestones(ctx context.Context, req *pb.GetMilestonesRequest) (*pb.GetMilestonesResponse, error) { + resp := &pb.GetMilestonesResponse{Milestones: []*pb.Milestone{}} + for _, p := range s.config.GetProjects() { + for _, m := range p.GetMilestones() { + if m.GetGithubProject() == req.GetGithubProject() { + resp.Milestones = append(resp.Milestones, m) + } + } + } + + return resp, nil +} diff --git a/githubtasksapi_test.go b/githubtasksapi_test.go index 646b80dd..4a1c5b10 100644 --- a/githubtasksapi_test.go +++ b/githubtasksapi_test.go @@ -11,13 +11,21 @@ func TestAddProject(t *testing.T) { s := InitTestServer() s.AddProject(context.Background(), - &pb.AddProjectRequest{Add: &pb.Project{Name: "test project", Milestones: []*pb.Milestone{&pb.Milestone{Name: "Testing", Number: 1}}}}) + &pb.AddProjectRequest{Add: &pb.Project{Name: "test project", Milestones: []*pb.Milestone{&pb.Milestone{Name: "Testing", Number: 1, GithubProject: "madeup"}}}}) if len(s.config.GetProjects()) != 1 { t.Errorf("Project was not added") } - _, err := s.AddTask(context.Background(), + resp, err := s.GetMilestones(context.Background(), &pb.GetMilestonesRequest{GithubProject: "madeup"}) + if err != nil { + t.Fatalf("Error getting milestones: %v", err) + } + if len(resp.GetMilestones()) != 1 { + t.Fatalf("Milestone not created correctly: %v", resp) + } + + _, err = s.AddTask(context.Background(), &pb.AddTaskRequest{MilestoneName: "Testing", MilestoneNumber: 1, Title: "Add stuff", Body: "Do Stuff"}) if err != nil { diff --git a/proto/githubtasks.pb.go b/proto/githubtasks.pb.go index 836ad8ac..82934d7c 100644 --- a/proto/githubtasks.pb.go +++ b/proto/githubtasks.pb.go @@ -570,6 +570,84 @@ func (m *AddTaskResponse) GetTask() *Task { return nil } +type GetMilestonesRequest struct { + GithubProject string `protobuf:"bytes,1,opt,name=github_project,json=githubProject,proto3" json:"github_project,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetMilestonesRequest) Reset() { *m = GetMilestonesRequest{} } +func (m *GetMilestonesRequest) String() string { return proto.CompactTextString(m) } +func (*GetMilestonesRequest) ProtoMessage() {} +func (*GetMilestonesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0d888ecb083325cf, []int{10} +} + +func (m *GetMilestonesRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetMilestonesRequest.Unmarshal(m, b) +} +func (m *GetMilestonesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetMilestonesRequest.Marshal(b, m, deterministic) +} +func (m *GetMilestonesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetMilestonesRequest.Merge(m, src) +} +func (m *GetMilestonesRequest) XXX_Size() int { + return xxx_messageInfo_GetMilestonesRequest.Size(m) +} +func (m *GetMilestonesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetMilestonesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetMilestonesRequest proto.InternalMessageInfo + +func (m *GetMilestonesRequest) GetGithubProject() string { + if m != nil { + return m.GithubProject + } + return "" +} + +type GetMilestonesResponse struct { + Milestones []*Milestone `protobuf:"bytes,1,rep,name=milestones,proto3" json:"milestones,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetMilestonesResponse) Reset() { *m = GetMilestonesResponse{} } +func (m *GetMilestonesResponse) String() string { return proto.CompactTextString(m) } +func (*GetMilestonesResponse) ProtoMessage() {} +func (*GetMilestonesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0d888ecb083325cf, []int{11} +} + +func (m *GetMilestonesResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetMilestonesResponse.Unmarshal(m, b) +} +func (m *GetMilestonesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetMilestonesResponse.Marshal(b, m, deterministic) +} +func (m *GetMilestonesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetMilestonesResponse.Merge(m, src) +} +func (m *GetMilestonesResponse) XXX_Size() int { + return xxx_messageInfo_GetMilestonesResponse.Size(m) +} +func (m *GetMilestonesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetMilestonesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetMilestonesResponse proto.InternalMessageInfo + +func (m *GetMilestonesResponse) GetMilestones() []*Milestone { + if m != nil { + return m.Milestones + } + return nil +} + func init() { proto.RegisterEnum("githubtasks.Milestone_MilestoneState", Milestone_MilestoneState_name, Milestone_MilestoneState_value) proto.RegisterEnum("githubtasks.Task_TaskState", Task_TaskState_name, Task_TaskState_value) @@ -583,46 +661,52 @@ func init() { proto.RegisterType((*UpdateProjectResponse)(nil), "githubtasks.UpdateProjectResponse") proto.RegisterType((*AddTaskRequest)(nil), "githubtasks.AddTaskRequest") proto.RegisterType((*AddTaskResponse)(nil), "githubtasks.AddTaskResponse") + proto.RegisterType((*GetMilestonesRequest)(nil), "githubtasks.GetMilestonesRequest") + proto.RegisterType((*GetMilestonesResponse)(nil), "githubtasks.GetMilestonesResponse") } func init() { proto.RegisterFile("githubtasks.proto", fileDescriptor_0d888ecb083325cf) } var fileDescriptor_0d888ecb083325cf = []byte{ - // 532 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4f, 0x6f, 0xd3, 0x4e, - 0x10, 0xad, 0x63, 0x3b, 0x89, 0x27, 0xad, 0xeb, 0x8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0x94, 0x7c, 0x82, 0x9e, 0x4c, 0xde, 0xbd, 0xaf, 0xd6, 0x45, 0xe4, 0x15, 0x18, - 0x79, 0xa4, 0x84, 0x41, 0xbb, 0xb3, 0x57, 0x00, 0xc9, 0x3b, 0xf8, 0xef, 0x1e, 0x83, 0xa4, 0xc6, - 0x11, 0xb4, 0xe4, 0xbf, 0xc1, 0xdf, 0xc5, 0x67, 0x20, 0xf2, 0x4b, 0x01, 0xd3, 0x09, 0x02, 0x11, - 0x9b, 0x54, 0xe5, 0x00, 0xcc, 0x9c, 0x68, 0x56, 0xd2, 0x7b, 0x90, 0x57, 0xdf, 0x27, 0xc2, 0x9f, - 0x81, 0x55, 0x82, 0x95, 0x53, 0x7e, 0x58, 0x00, 0x65, 0xdc, 0xf3, 0x54, 0xa8, 0x75, 0xa9, 0xd0, - 0x8a, 0x54, 0x90, 0x37, 0x70, 0x98, 0xab, 0x49, 0x37, 0x1a, 0x80, 0x96, 0x68, 0x4f, 0xd7, 0xa9, - 0x49, 0xbb, 0x68, 0x8f, 0x67, 0xb0, 0x9f, 0xdc, 0xd8, 0x35, 0xdd, 0x7c, 0x0f, 0x17, 0x14, 0x2f, - 0x01, 0x8a, 0x97, 0xc1, 0xc7, 0x95, 0xb1, 0x07, 0xef, 0xfd, 0xff, 0xf1, 0xce, 0x7e, 0xfa, 0xa4, - 0x7b, 0xf3, 0xa6, 0xf8, 0xd5, 0x7a, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0xf3, 0xf1, 0xb5, 0x22, - 0xca, 0x04, 0x00, 0x00, + // 598 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x5f, 0x6f, 0x12, 0x4f, + 0x14, 0xed, 0xb2, 0xbb, 0xfc, 0xb9, 0x14, 0x0a, 0x37, 0xb4, 0xd9, 0xd0, 0x5f, 0x7e, 0xc5, 0x49, + 0x50, 0x7c, 0x21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x7f, 0xf6, 0x27, 0x00, 0x00, 0xff, 0xff, 0xa9, 0xff, + 0xc5, 0x8b, 0xfd, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -638,6 +722,9 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type TasksServiceClient interface { AddProject(ctx context.Context, in *AddProjectRequest, opts ...grpc.CallOption) (*AddProjectResponse, error) + //rpc UpdateProject(UpdateProjectRequest) returns (UpdateProjectResponse) {}; + AddTask(ctx context.Context, in *AddTaskRequest, opts ...grpc.CallOption) (*AddTaskResponse, error) + GetMilestones(ctx context.Context, in *GetMilestonesRequest, opts ...grpc.CallOption) (*GetMilestonesResponse, error) } type tasksServiceClient struct { @@ -657,9 +744,30 @@ func (c *tasksServiceClient) AddProject(ctx context.Context, in *AddProjectReque return out, nil } +func (c *tasksServiceClient) AddTask(ctx context.Context, in *AddTaskRequest, opts ...grpc.CallOption) (*AddTaskResponse, error) { + out := new(AddTaskResponse) + err := c.cc.Invoke(ctx, "/githubtasks.TasksService/AddTask", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tasksServiceClient) GetMilestones(ctx context.Context, in *GetMilestonesRequest, opts ...grpc.CallOption) (*GetMilestonesResponse, error) { + out := new(GetMilestonesResponse) + err := c.cc.Invoke(ctx, "/githubtasks.TasksService/GetMilestones", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // TasksServiceServer is the server API for TasksService service. type TasksServiceServer interface { AddProject(context.Context, *AddProjectRequest) (*AddProjectResponse, error) + //rpc UpdateProject(UpdateProjectRequest) returns (UpdateProjectResponse) {}; + AddTask(context.Context, *AddTaskRequest) (*AddTaskResponse, error) + GetMilestones(context.Context, *GetMilestonesRequest) (*GetMilestonesResponse, error) } func RegisterTasksServiceServer(s *grpc.Server, srv TasksServiceServer) { @@ -684,6 +792,42 @@ func _TasksService_AddProject_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _TasksService_AddTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddTaskRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TasksServiceServer).AddTask(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/githubtasks.TasksService/AddTask", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TasksServiceServer).AddTask(ctx, req.(*AddTaskRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TasksService_GetMilestones_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMilestonesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TasksServiceServer).GetMilestones(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/githubtasks.TasksService/GetMilestones", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TasksServiceServer).GetMilestones(ctx, req.(*GetMilestonesRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _TasksService_serviceDesc = grpc.ServiceDesc{ ServiceName: "githubtasks.TasksService", HandlerType: (*TasksServiceServer)(nil), @@ -692,6 +836,14 @@ var _TasksService_serviceDesc = grpc.ServiceDesc{ MethodName: "AddProject", Handler: _TasksService_AddProject_Handler, }, + { + MethodName: "AddTask", + Handler: _TasksService_AddTask_Handler, + }, + { + MethodName: "GetMilestones", + Handler: _TasksService_GetMilestones_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "githubtasks.proto", diff --git a/proto/githubtasks.proto b/proto/githubtasks.proto index fa50b97a..329d33de 100644 --- a/proto/githubtasks.proto +++ b/proto/githubtasks.proto @@ -68,8 +68,17 @@ message AddTaskResponse { Task task = 1; } +message GetMilestonesRequest{ + string github_project = 1; +} + +message GetMilestonesResponse { + repeated Milestone milestones = 1; +} + service TasksService { rpc AddProject(AddProjectRequest) returns (AddProjectResponse) {}; //rpc UpdateProject(UpdateProjectRequest) returns (UpdateProjectResponse) {}; rpc AddTask(AddTaskRequest) returns (AddTaskResponse) {}; + rpc GetMilestones(GetMilestonesRequest) returns (GetMilestonesResponse) {}; } \ No newline at end of file