Skip to content

Commit

Permalink
create issue impl
Browse files Browse the repository at this point in the history
  • Loading branch information
fwechselberger committed Feb 26, 2021
1 parent aec886f commit 24082bb
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,24 @@ func (s *IssueService) Edit(issue *Issue) (*Issue, error) {
}
return responseIssue.AsIssue()
}

// Create creates a new Issue | https://taigaio.github.io/taiga-doc/dist/api.html#issues-create
//
// Available Meta: *IssueDetail
func (s *IssueService) Create(issue *Issue) (*Issue, error) {
url := s.client.MakeURL(s.Endpoint)
var issueDetail IssueDetail

// Check for required fields
// project, subject
if isEmpty(issue.Project) || isEmpty(issue.Subject) {
return nil, errors.New("A mandatory field is missing. See API documentataion")
}

_, err := s.client.Request.Post(url, &issue, &issueDetail)
if err != nil {
return nil, err
}

return issueDetail.AsIssue()
}

0 comments on commit 24082bb

Please sign in to comment.