Skip to content

Commit

Permalink
Models have been improved for better accuracy
Browse files Browse the repository at this point in the history
  • Loading branch information
theriverman committed Sep 23, 2020
1 parent 9ad45a7 commit 27ae755
Show file tree
Hide file tree
Showing 7 changed files with 626 additions and 579 deletions.
16 changes: 12 additions & 4 deletions common.models.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ type Attachment struct {
filePath string // For package-internal use only
}

// GenericObjectAttachment represents an array of minimal attachment details
// This array is filled when the `IncludeAttachments` query parameter is true
type GenericObjectAttachment struct {
AttachedFile string `json:"attached_file,omitempty"`
ID int `json:"id,omitempty"`
ThumbnailCardURL string `json:"thumbnail_card_url,omitempty"`
}

// SetFilePath takes the path to the file be uploaded
func (a *Attachment) SetFilePath(FilePath string) {
a.filePath = FilePath
Expand Down Expand Up @@ -137,10 +145,10 @@ type ProjectExtraInfo struct {

// UserStoryExtraInfo is a read-only field
type UserStoryExtraInfo struct {
Epics EpicMinimal `json:"epics"`
ID int `json:"id"`
Ref int `json:"ref"`
Subject string `json:"subject"`
Epics []EpicMinimal `json:"epics"`
ID int `json:"id"`
Ref int `json:"ref"`
Subject string `json:"subject"`
}

// Pagination represents the information returned via headers
Expand Down
203 changes: 102 additions & 101 deletions epics.models.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,35 +73,35 @@ func (e *Epic) ListRelatedUserStories(client *Client) ([]EpicRelatedUserStoryDet
// EpicDetailLIST -> Epic detail (LIST)
// https://taigaio.github.io/taiga-doc/dist/api.html#object-epic-detail-list
type EpicDetailLIST []struct {
AssignedTo int `json:"assigned_to,omitempty"`
AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info,omitempty"`
Attachments []interface{} `json:"attachments,omitempty"`
BlockedNote string `json:"blocked_note,omitempty"`
ClientRequirement bool `json:"client_requirement,omitempty"`
Color string `json:"color,omitempty"`
CreatedDate time.Time `json:"created_date,omitempty"`
EpicsOrder int64 `json:"epics_order,omitempty"`
ID int `json:"id,omitempty"`
IsBlocked bool `json:"is_blocked,omitempty"`
IsClosed bool `json:"is_closed,omitempty"`
IsVoter bool `json:"is_voter,omitempty"`
IsWatcher bool `json:"is_watcher,omitempty"`
ModifiedDate time.Time `json:"modified_date,omitempty"`
Owner int `json:"owner,omitempty"`
OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info,omitempty"`
Project int `json:"project,omitempty"`
ProjectExtraInfo Project `json:"project_extra_info,omitempty"`
Ref int `json:"ref,omitempty"`
Status int `json:"status,omitempty"`
StatusExtraInfo StatusExtraInfo `json:"status_extra_info,omitempty"`
Subject string `json:"subject,omitempty"`
Tags Tags `json:"tags,omitempty"`
TeamRequirement bool `json:"team_requirement,omitempty"`
TotalVoters int `json:"total_voters,omitempty"`
TotalWatchers int `json:"total_watchers,omitempty"`
UserStoriesCounts UserStoriesCounts `json:"user_stories_counts,omitempty"`
Version int `json:"version,omitempty"`
Watchers []int `json:"watchers,omitempty"`
AssignedTo int `json:"assigned_to,omitempty"`
AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info,omitempty"`
Attachments []GenericObjectAttachment `json:"attachments,omitempty"`
BlockedNote string `json:"blocked_note,omitempty"`
ClientRequirement bool `json:"client_requirement,omitempty"`
Color string `json:"color,omitempty"`
CreatedDate time.Time `json:"created_date,omitempty"`
EpicsOrder int64 `json:"epics_order,omitempty"`
ID int `json:"id,omitempty"`
IsBlocked bool `json:"is_blocked,omitempty"`
IsClosed bool `json:"is_closed,omitempty"`
IsVoter bool `json:"is_voter,omitempty"`
IsWatcher bool `json:"is_watcher,omitempty"`
ModifiedDate time.Time `json:"modified_date,omitempty"`
Owner int `json:"owner,omitempty"`
OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info,omitempty"`
Project int `json:"project,omitempty"`
ProjectExtraInfo Project `json:"project_extra_info,omitempty"`
Ref int `json:"ref,omitempty"`
Status int `json:"status,omitempty"`
StatusExtraInfo StatusExtraInfo `json:"status_extra_info,omitempty"`
Subject string `json:"subject,omitempty"`
Tags Tags `json:"tags,omitempty"`
TeamRequirement bool `json:"team_requirement,omitempty"`
TotalVoters int `json:"total_voters,omitempty"`
TotalWatchers int `json:"total_watchers,omitempty"`
UserStoriesCounts UserStoriesCounts `json:"user_stories_counts,omitempty"`
Version int `json:"version,omitempty"`
Watchers []int `json:"watchers,omitempty"`
}

// AsEpics packs the returned EpicDetailLIST into a generic Epic struct
Expand All @@ -115,40 +115,40 @@ func (e *EpicDetailLIST) AsEpics() ([]Epic, error) {

// EpicDetailGET => Epic detail (GET) https://taigaio.github.io/taiga-doc/dist/api.html#object-epic-detail-get
type EpicDetailGET struct {
AssignedTo int `json:"assigned_to,omitempty"`
AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info,omitempty"`
Attachments []interface{} `json:"attachments,omitempty"`
BlockedNote string `json:"blocked_note,omitempty"`
BlockedNoteHTML string `json:"blocked_note_html,omitempty"`
ClientRequirement bool `json:"client_requirement,omitempty"`
Color string `json:"color,omitempty"`
Comment string `json:"comment,omitempty"`
CreatedDate time.Time `json:"created_date,omitempty"`
Description string `json:"description,omitempty"`
DescriptionHTML string `json:"description_html,omitempty"`
EpicsOrder int64 `json:"epics_order,omitempty"`
ID int `json:"id,omitempty"`
IsBlocked bool `json:"is_blocked,omitempty"`
IsClosed bool `json:"is_closed,omitempty"`
IsVoter bool `json:"is_voter,omitempty"`
IsWatcher bool `json:"is_watcher,omitempty"`
ModifiedDate time.Time `json:"modified_date,omitempty"`
Neighbors Neighbors `json:"neighbors,omitempty"`
Owner int `json:"owner,omitempty"`
OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info,omitempty"`
Project int `json:"project,omitempty"`
ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info,omitempty"`
Ref int `json:"ref,omitempty"`
Status int `json:"status,omitempty"`
StatusExtraInfo StatusExtraInfo `json:"status_extra_info,omitempty"`
Subject string `json:"subject,omitempty"`
Tags Tags `json:"tags,omitempty"`
TeamRequirement bool `json:"team_requirement,omitempty"`
TotalVoters int `json:"total_voters,omitempty"`
TotalWatchers int `json:"total_watchers,omitempty"`
UserStoriesCounts UserStoriesCounts `json:"user_stories_counts,omitempty"`
Version int `json:"version,omitempty"`
Watchers []int `json:"watchers,omitempty"`
AssignedTo int `json:"assigned_to,omitempty"`
AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info,omitempty"`
Attachments []GenericObjectAttachment `json:"attachments,omitempty"`
BlockedNote string `json:"blocked_note,omitempty"`
BlockedNoteHTML string `json:"blocked_note_html,omitempty"`
ClientRequirement bool `json:"client_requirement,omitempty"`
Color string `json:"color,omitempty"`
Comment string `json:"comment,omitempty"`
CreatedDate time.Time `json:"created_date,omitempty"`
Description string `json:"description,omitempty"`
DescriptionHTML string `json:"description_html,omitempty"`
EpicsOrder int64 `json:"epics_order,omitempty"`
ID int `json:"id,omitempty"`
IsBlocked bool `json:"is_blocked,omitempty"`
IsClosed bool `json:"is_closed,omitempty"`
IsVoter bool `json:"is_voter,omitempty"`
IsWatcher bool `json:"is_watcher,omitempty"`
ModifiedDate time.Time `json:"modified_date,omitempty"`
Neighbors Neighbors `json:"neighbors,omitempty"`
Owner int `json:"owner,omitempty"`
OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info,omitempty"`
Project int `json:"project,omitempty"`
ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info,omitempty"`
Ref int `json:"ref,omitempty"`
Status int `json:"status,omitempty"`
StatusExtraInfo StatusExtraInfo `json:"status_extra_info,omitempty"`
Subject string `json:"subject,omitempty"`
Tags Tags `json:"tags,omitempty"`
TeamRequirement bool `json:"team_requirement,omitempty"`
TotalVoters int `json:"total_voters,omitempty"`
TotalWatchers int `json:"total_watchers,omitempty"`
UserStoriesCounts UserStoriesCounts `json:"user_stories_counts,omitempty"`
Version int `json:"version,omitempty"`
Watchers []int `json:"watchers,omitempty"`
}

// AsEpic packs the returned EpicDetailGET into a generic Epic struct
Expand All @@ -160,40 +160,40 @@ func (e *EpicDetailGET) AsEpic() (*Epic, error) {

// EpicDetail => Epic detail https://taigaio.github.io/taiga-doc/dist/api.html#object-epic-detail
type EpicDetail struct {
AssignedTo int `json:"assigned_to,omitempty"`
AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info,omitempty"`
Attachments []interface{} `json:"attachments,omitempty"`
BlockedNote string `json:"blocked_note,omitempty"`
BlockedNoteHTML string `json:"blocked_note_html,omitempty"`
ClientRequirement bool `json:"client_requirement,omitempty"`
Color string `json:"color,omitempty"`
Comment string `json:"comment,omitempty"`
CreatedDate time.Time `json:"created_date,omitempty"`
Description string `json:"description,omitempty"`
DescriptionHTML string `json:"description_html,omitempty"`
EpicsOrder int64 `json:"epics_order,omitempty"`
ID int `json:"id,omitempty"`
IsBlocked bool `json:"is_blocked,omitempty"`
IsClosed bool `json:"is_closed,omitempty"`
IsVoter bool `json:"is_voter,omitempty"`
IsWatcher bool `json:"is_watcher,omitempty"`
ModifiedDate time.Time `json:"modified_date,omitempty"`
Neighbors Neighbors `json:"neighbors,omitempty"`
Owner int `json:"owner,omitempty"`
OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info,omitempty"`
Project int `json:"project"` // Mandatory
ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info,omitempty"`
Ref int `json:"ref,omitempty"`
Status int `json:"status,omitempty"`
StatusExtraInfo StatusExtraInfo `json:"status_extra_info,omitempty"`
Subject string `json:"subject"` // Mandatory
Tags [][]string `json:"tags,omitempty"`
TeamRequirement bool `json:"team_requirement,omitempty"`
TotalVoters int `json:"total_voters,omitempty"`
TotalWatchers int `json:"total_watchers,omitempty"`
UserStoriesCounts UserStoriesCounts `json:"user_stories_counts,omitempty"`
Version int `json:"version,omitempty"`
Watchers []int `json:"watchers,omitempty"`
AssignedTo int `json:"assigned_to,omitempty"`
AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info,omitempty"`
Attachments []GenericObjectAttachment `json:"attachments,omitempty"`
BlockedNote string `json:"blocked_note,omitempty"`
BlockedNoteHTML string `json:"blocked_note_html,omitempty"`
ClientRequirement bool `json:"client_requirement,omitempty"`
Color string `json:"color,omitempty"`
Comment string `json:"comment,omitempty"`
CreatedDate time.Time `json:"created_date,omitempty"`
Description string `json:"description,omitempty"`
DescriptionHTML string `json:"description_html,omitempty"`
EpicsOrder int64 `json:"epics_order,omitempty"`
ID int `json:"id,omitempty"`
IsBlocked bool `json:"is_blocked,omitempty"`
IsClosed bool `json:"is_closed,omitempty"`
IsVoter bool `json:"is_voter,omitempty"`
IsWatcher bool `json:"is_watcher,omitempty"`
ModifiedDate time.Time `json:"modified_date,omitempty"`
Neighbors Neighbors `json:"neighbors,omitempty"`
Owner int `json:"owner,omitempty"`
OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info,omitempty"`
Project int `json:"project"` // Mandatory
ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info,omitempty"`
Ref int `json:"ref,omitempty"`
Status int `json:"status,omitempty"`
StatusExtraInfo StatusExtraInfo `json:"status_extra_info,omitempty"`
Subject string `json:"subject"` // Mandatory
Tags [][]string `json:"tags,omitempty"`
TeamRequirement bool `json:"team_requirement,omitempty"`
TotalVoters int `json:"total_voters,omitempty"`
TotalWatchers int `json:"total_watchers,omitempty"`
UserStoriesCounts UserStoriesCounts `json:"user_stories_counts,omitempty"`
Version int `json:"version,omitempty"`
Watchers []int `json:"watchers,omitempty"`
}

// AsEpic packs the returned EpicDetail into a generic Epic struct
Expand Down Expand Up @@ -255,10 +255,11 @@ type EpicWatcherDetail struct {

// EpicsQueryParams holds fields to be used as URL query parameters to filter the queried objects
type EpicsQueryParams struct {
Project int `url:"project,omitempty"`
ProjectSlug string `url:"project__slug,omitempty"`
AssignedTo int `url:"assigned_to,omitempty"`
StatusIsClosed bool `url:"status__is_closed,omitempty"`
IncludeAttachments bool `url:"include_attachments,omitempty"`
Project int `url:"project,omitempty"`
ProjectSlug string `url:"project__slug,omitempty"`
AssignedTo int `url:"assigned_to,omitempty"`
StatusIsClosed bool `url:"status__is_closed,omitempty"`
}

// EpicMinimal represent a small subset of a full Epic object
Expand Down
Loading

0 comments on commit 27ae755

Please sign in to comment.