grim/youtrack-import
Clone
Summary
Browse
Changes
Graph
move the trac tickets code to it's own file
draft
2020-07-03, Gary Kramlich
a515c4b3d465
move the trac tickets code to it's own file
package
bitbucket
import
(
"archive/zip"
"time"
"keep.imfreedom.org/grim/youtrack-import/youtrack"
)
type
Author
struct
{
DisplayName
string
`json:"display_name"`
AccountID
string
`json:"account_id"`
}
func
(
a
Author
)
String
()
string
{
return
a
.
DisplayName
}
func
flattenAuthors
(
userMap
map
[
string
]
*
youtrack
.
User
,
authors
[]
Author
)
[]
string
{
flat
:=
make
([]
string
,
len
(
authors
))
for
idx
,
account
:=
range
authors
{
if
user
,
found
:=
userMap
[
account
.
AccountID
];
found
{
flat
[
idx
]
=
user
.
Login
}
}
return
flat
}
type
Issue
struct
{
Assignee
Author
`json:"assignee"`
Component
string
`json:"component"`
Content
string
`json:"content"`
ContentUpdatedOn
time
.
Time
`json:"content_updated_on"`
CreatedOn
time
.
Time
`json:"created_on"`
EditedOn
time
.
Time
`json:"edited_on"`
ID
int
`json:"id"`
Kind
string
`json:"kind"`
Milestone
string
`json:"milestone"`
Priority
string
`json:"priority"`
Reporter
Author
`json:"reporter"`
Status
string
`json:"status"`
Title
string
`json:"title"`
UpdatedOn
time
.
Time
`json:"updated_on"`
Version
string
`json:"version"`
Watchers
[]
Author
`json:"watchers"`
Voters
[]
Author
`json:"voters"`
}
type
Comment
struct
{
Content
string
`json:"content"`
CreatedOn
time
.
Time
`json:"created_on"`
ID
int
`json:"id"`
Issue
int
`json:"issue"`
UpdatedOn
time
.
Time
`json:"updated_on"`
User
Author
`json:"user"`
}
type
Attachment
struct
{
Filename
string
`json:"filename"`
Issue
int
`json:"issue"`
Path
string
`json:"path"`
User
Author
`json:"user"`
}
type
Log
struct
{
ChangedFrom
string
`json:"changed_from"`
ChangedTo
string
`json:"changed_to"`
Comment
int
`json:"comment"`
CreatedOn
time
.
Time
`json:"created_on"`
Field
string
`json:"field"`
Issue
int
`json:"issue"`
User
Author
`json:"user"`
}
type
Meta
struct
{
DefaultAssignee
Author
`json:"default_assignee"`
DefaultComponent
string
`json:"default_component"`
DefaultKind
string
`json:"default_kind"`
DefaultMilestone
string
`json:"default_milestone"`
DefaultVersion
string
`json:"default_version"`
}
type
Component
struct
{
Name
string
`json:"name"`
}
type
Milestone
struct
{
Name
string
`json:"name"`
}
type
Version
struct
{
Name
string
`json:"name"`
}
type
Archive
struct
{
Issues
[]
Issue
`json:"issues"`
Comments
[]
Comment
`json:"comments"`
Attachments
[]
Attachment
`json:"attachments"`
Logs
[]
Log
`json:"logs"`
Meta
Meta
`json:"meta"`
Components
[]
Component
`json:"components"`
Milestones
[]
Milestone
`json:"milestones"`
Versions
[]
Version
`json:"versions"`
zip
*
zip
.
ReadCloser
}