package model import ( "code.gitea.io/sdk/gitea" "gitea-issue/giteaClient" "time" ) type GetCreateIssueProxy struct { Title string `json:"title"` Body string `json:"body"` Labels []*gitea.Label `json:"labels"` Closed *time.Time `json:"closed"` } type PostCreateIssueProxy struct { Title string `json:"title"` Body string `json:"body"` Labels []*gitea.Label `json:"labels"` } func (c PostCreateIssueProxy) TransformToGiteaCreateIssueOption() (gitea.CreateIssueOption, error){ giteaUser, err := giteaClient.GetUserInfo() if( err != nil){ return gitea.CreateIssueOption{}, err; } labels := []int64{} for _, label := range c.Labels{ labels = append(labels, label.ID) } giteaObject := gitea.CreateIssueOption{ Title: c.Title, Body: c.Body, Assignee: giteaUser.UserName, Labels: labels, Closed: false, } return giteaObject, nil } func IssueTransformFromGitea(issue *gitea.Issue) (GetCreateIssueProxy) { giteaIssue := GetCreateIssueProxy{ Title: issue.Title, Body: issue.Body, Labels: issue.Labels, Closed: issue.Closed, } return giteaIssue }