diff --git a/controller/workflow.go b/controller/workflow.go new file mode 100644 index 0000000..045b344 --- /dev/null +++ b/controller/workflow.go @@ -0,0 +1,21 @@ +package workflow + +import ( + "os" + "ticket-creator/domain" +) + +func ProduceTicket(name string) (string, error) { + yt := domain.NewYT(os.Getenv("YT_URL"), os.Getenv("YT_TOKEN")) + + projects, err := yt.GetProjects() + if err != nil { + return "", err + } + + issue, err := yt.CreateIssue(projects[1].ID, name) + if err != nil { + return "", err + } + +} diff --git a/domain/yt.go b/domain/yt.go index 4c34f72..1f9119a 100644 --- a/domain/yt.go +++ b/domain/yt.go @@ -8,6 +8,12 @@ import ( "github.com/imroc/req/v3" ) +type IYouTrack interface { + GetProjects() ([]Project, error) + CreateIssue(projectID, name string) (*IssueCreateRequest, error) + UpdateIssue(issue *IssueCreateRequest, folder, git, gitBuild string) (*IssueUpdateRequest, error) +} + type youtrack struct { *req.Client }