90 lines
2.0 KiB
Go
90 lines
2.0 KiB
Go
package domain
|
|
|
|
import "fmt"
|
|
|
|
type Folder struct {
|
|
Title string // k
|
|
PathTo string // /temp/k
|
|
PrivateURL string // http://domain/apps/files/?dir=/temp/k OR http://domain/f/3333
|
|
}
|
|
|
|
type CodaIssue struct {
|
|
ID string `json:"id"`
|
|
Summary string `json:"summary"`
|
|
URL string `json:"url"`
|
|
Git string `json:"git"`
|
|
GitBuild string `json:"git-build"`
|
|
Folder string `json:"folder"`
|
|
}
|
|
|
|
type ConversionLog struct {
|
|
Advertiser []string
|
|
}
|
|
|
|
type Git struct {
|
|
Name string `json:"name"` // "poop"
|
|
FullName string `json:"full_name"` // "developer/poop"
|
|
Private bool `json:"private"`
|
|
Url string `json:"url"` // "http://localhost:8081/api/v3/repos/developer/poop"
|
|
CloneUrl string `json:"clone_url"` // "http://localhost:8081/git/developer/poop.git"
|
|
HtmlUrl string `json:"Html_url"` // "http://localhost:8081/developer/poop"
|
|
SshUrl string `json:"ssh_url"` // ?!
|
|
}
|
|
|
|
type Task struct {
|
|
Description string
|
|
URL string
|
|
}
|
|
|
|
type Project struct {
|
|
ID string `json:"id"`
|
|
ShortName string `json:"shortName"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type ProjectID struct {
|
|
ID string `json:"id"`
|
|
}
|
|
|
|
type IssueCreateRequest struct {
|
|
ProjectID ProjectID `json:"project"`
|
|
Key string `json:"idReadable"`
|
|
ID string `json:"id"`
|
|
Summary string `json:"summary"`
|
|
Description string `json:"description"`
|
|
}
|
|
|
|
// [ ] try `,omitempty` to remove extra struct;
|
|
|
|
type IssueUpdateRequest struct {
|
|
IssueCreateRequest
|
|
CustomFields []CustomField `json:"customFields"`
|
|
}
|
|
|
|
type CustomField struct {
|
|
Name string `json:"name"`
|
|
Type string `json:"$type"`
|
|
Value string `json:"value"`
|
|
}
|
|
|
|
type ProjectsList struct {
|
|
Projects []Project
|
|
}
|
|
|
|
// Find needed project.ID in the project's list
|
|
func (plist *ProjectsList) FindProjectByName(searchName string) (string, error) {
|
|
|
|
projectID := ""
|
|
|
|
for _, elem := range plist.Projects {
|
|
if elem.ShortName == searchName {
|
|
projectID = elem.ID
|
|
}
|
|
}
|
|
|
|
if projectID == "" {
|
|
return "", fmt.Errorf("project %s doesn't exist", searchName)
|
|
}
|
|
return projectID, nil
|
|
}
|