From 27ae755f84b19180f9dd942a34cd0f0053d42828 Mon Sep 17 00:00:00 2001 From: Kristof Daja Date: Wed, 23 Sep 2020 02:04:39 +0200 Subject: [PATCH] Models have been improved for better accuracy --- common.models.go | 16 +- epics.models.go | 203 +++++++++++------------ issues.models.go | 324 +++++++++++++++++++----------------- milestones.models.go | 33 ++-- projects.models.go | 21 ++- tasks.models.go | 241 ++++++++++++++------------- user_stories.models.go | 367 +++++++++++++++++++++-------------------- 7 files changed, 626 insertions(+), 579 deletions(-) diff --git a/common.models.go b/common.models.go index 18b3e31..a5ee29a 100644 --- a/common.models.go +++ b/common.models.go @@ -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 @@ -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 diff --git a/epics.models.go b/epics.models.go index 0a6e707..acd0aa4 100644 --- a/epics.models.go +++ b/epics.models.go @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/issues.models.go b/issues.models.go index dc3b242..b8152ab 100644 --- a/issues.models.go +++ b/issues.models.go @@ -1,6 +1,9 @@ package taigo -import "time" +import ( + "log" + "time" +) func genericToIssue(anyIssueObject interface{}) *Issue { payloadIssue := Issue{} @@ -10,30 +13,40 @@ func genericToIssue(anyIssueObject interface{}) *Issue { func genericToIssues(anyIssueObjectSlice interface{}) []Issue { payloadIssuesSlice := []Issue{} - convertStructViaJSON(&anyIssueObjectSlice, &payloadIssuesSlice) + err := convertStructViaJSON(&anyIssueObjectSlice, &payloadIssuesSlice) + if err != nil { + log.Println(err) + } return payloadIssuesSlice } // Issue represents the mandatory fields of an Issue only type Issue struct { TaigaBaseObject - ID int `json:"id,omitempty"` - Ref int `json:"ref,omitempty"` - Version int `json:"version,omitempty"` - AssignedTo int `json:"assigned_to"` - BlockedNote string `json:"blocked_note"` - Description string `json:"description"` - IsBlocked bool `json:"is_blocked"` - IsClosed bool `json:"is_closed"` - Milestone int `json:"milestone"` - Priority int `json:"priority"` - Project int `json:"project"` - Severity int `json:"severity"` - Status int `json:"status"` - Subject string `json:"subject"` - Tags []string `json:"tags"` - Type int `json:"type"` - Watchers []int `json:"watchers"` + ID int `json:"id"` + Ref int `json:"ref"` + Version int `json:"version"` + AssignedTo int `json:"assigned_to"` + BlockedNote string `json:"blocked_note"` + Description string `json:"description"` + IsBlocked bool `json:"is_blocked"` + IsClosed bool `json:"is_closed"` + Milestone int `json:"milestone"` + Owner int `json:"owner"` + Priority int `json:"priority"` + Project int `json:"project"` + Severity int `json:"severity"` + Status int `json:"status"` + Subject string `json:"subject"` + Tags Tags `json:"tags"` + Type int `json:"type"` + Watchers []int `json:"watchers"` + CreatedDate time.Time `json:"created_date"` + ModifiedDate time.Time `json:"modified_date"` + FinishedDate time.Time `json:"finished_date"` + DueDate string `json:"due_date"` + DueDateReason string `json:"due_date_reason"` + DueDateStatus string `json:"due_date_status"` IssueDetail *IssueDetail IssueDetailGET *IssueDetailGET IssueDetailLIST *IssueDetailLIST @@ -67,40 +80,40 @@ func (i *Issue) GetProject() int { // IssueDetailLIST -> Issue detail (LIST) // // https://taigaio.github.io/taiga-doc/dist/api.html#object-issue-detail-list -type IssueDetailLIST struct { - AssignedTo int `json:"assigned_to"` - AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info"` - Attachments []interface{} `json:"attachments"` - BlockedNote string `json:"blocked_note"` - CreatedDate time.Time `json:"created_date"` - DueDate string `json:"due_date"` - DueDateReason string `json:"due_date_reason"` - DueDateStatus string `json:"due_date_status"` - ExternalReference int `json:"external_reference"` - FinishedDate time.Time `json:"finished_date"` - ID int `json:"id"` - IsBlocked bool `json:"is_blocked"` - IsClosed bool `json:"is_closed"` - IsVoter bool `json:"is_voter"` - IsWatcher bool `json:"is_watcher"` - Milestone int `json:"milestone"` - ModifiedDate time.Time `json:"modified_date"` - Owner int `json:"owner"` - OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info"` - Priority int `json:"priority"` - Project int `json:"project"` - ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info"` - Ref int `json:"ref"` - Severity int `json:"severity"` - Status int `json:"status"` - StatusExtraInfo StatusExtraInfo `json:"status_extra_info"` - Subject string `json:"subject"` - Tags Tags `json:"tags"` - TotalVoters int `json:"total_voters"` - TotalWatchers int `json:"total_watchers"` - Type int `json:"type"` - Version int `json:"version"` - Watchers []int `json:"watchers"` +type IssueDetailLIST []struct { + AssignedTo int `json:"assigned_to"` + AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info"` + Attachments []GenericObjectAttachment `json:"attachments"` + BlockedNote string `json:"blocked_note"` + CreatedDate time.Time `json:"created_date"` + ModifiedDate time.Time `json:"modified_date"` + FinishedDate time.Time `json:"finished_date"` + DueDate string `json:"due_date"` + DueDateReason string `json:"due_date_reason"` + DueDateStatus string `json:"due_date_status"` + ExternalReference []int `json:"external_reference"` + ID int `json:"id"` + IsBlocked bool `json:"is_blocked"` + IsClosed bool `json:"is_closed"` + IsVoter bool `json:"is_voter"` + IsWatcher bool `json:"is_watcher"` + Milestone int `json:"milestone"` + Owner int `json:"owner"` + OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info"` + Priority int `json:"priority"` + Project int `json:"project"` + ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info"` + Ref int `json:"ref"` + Severity int `json:"severity"` + Status int `json:"status"` + StatusExtraInfo StatusExtraInfo `json:"status_extra_info"` + Subject string `json:"subject"` + Tags Tags `json:"tags"` + TotalVoters int `json:"total_voters"` + TotalWatchers int `json:"total_watchers"` + Type int `json:"type"` + Version int `json:"version"` + Watchers []int `json:"watchers"` } // AsIssues packs the returned IssueDetailLIST into a generic Issue struct @@ -115,45 +128,45 @@ func (issueL *IssueDetailLIST) AsIssues() ([]Issue, error) { // IssueDetailGET -> Issue detail (GET) // https://taigaio.github.io/taiga-doc/dist/api.html#object-issue-detail-get type IssueDetailGET struct { - AssignedTo int `json:"assigned_to"` - AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info"` - Attachments []interface{} `json:"attachments"` - BlockedNote string `json:"blocked_note"` - BlockedNoteHTML string `json:"blocked_note_html"` - Comment string `json:"comment"` - CreatedDate time.Time `json:"created_date"` - Description string `json:"description"` - DescriptionHTML string `json:"description_html"` - DueDate string `json:"due_date"` - DueDateReason string `json:"due_date_reason"` - DueDateStatus string `json:"due_date_status"` - ExternalReference int `json:"external_reference"` - FinishedDate time.Time `json:"finished_date"` - GeneratedUserStories []int `json:"generated_user_stories"` - ID int `json:"id"` - IsBlocked bool `json:"is_blocked"` - IsClosed bool `json:"is_closed"` - IsVoter bool `json:"is_voter"` - IsWatcher bool `json:"is_watcher"` - Milestone int `json:"milestone"` - ModifiedDate time.Time `json:"modified_date"` - Neighbors Neighbors `json:"neighbors"` - Owner int `json:"owner"` - OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info"` - Priority int `json:"priority"` - Project int `json:"project"` - ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info"` - Ref int `json:"ref"` - Severity int `json:"severity"` - Status int `json:"status"` - StatusExtraInfo StatusExtraInfo `json:"status_extra_info"` - Subject string `json:"subject"` - Tags Tags `json:"tags"` - TotalVoters int `json:"total_voters"` - TotalWatchers int `json:"total_watchers"` - Type int `json:"type"` - Version int `json:"version"` - Watchers []int `json:"watchers"` + AssignedTo int `json:"assigned_to"` + AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info"` + Attachments []GenericObjectAttachment `json:"attachments"` + BlockedNote string `json:"blocked_note"` + BlockedNoteHTML string `json:"blocked_note_html"` + Comment string `json:"comment"` + CreatedDate time.Time `json:"created_date"` + Description string `json:"description"` + DescriptionHTML string `json:"description_html"` + DueDate string `json:"due_date"` + DueDateReason string `json:"due_date_reason"` + DueDateStatus string `json:"due_date_status"` + ExternalReference []int `json:"external_reference"` + FinishedDate time.Time `json:"finished_date"` + GeneratedUserStories []int `json:"generated_user_stories"` + ID int `json:"id"` + IsBlocked bool `json:"is_blocked"` + IsClosed bool `json:"is_closed"` + IsVoter bool `json:"is_voter"` + IsWatcher bool `json:"is_watcher"` + Milestone int `json:"milestone"` + ModifiedDate time.Time `json:"modified_date"` + Neighbors Neighbors `json:"neighbors"` + Owner int `json:"owner"` + OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info"` + Priority int `json:"priority"` + Project int `json:"project"` + ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info"` + Ref int `json:"ref"` + Severity int `json:"severity"` + Status int `json:"status"` + StatusExtraInfo StatusExtraInfo `json:"status_extra_info"` + Subject string `json:"subject"` + Tags Tags `json:"tags"` + TotalVoters int `json:"total_voters"` + TotalWatchers int `json:"total_watchers"` + Type int `json:"type"` + Version int `json:"version"` + Watchers []int `json:"watchers"` } // AsIssue packs the returned IssueDetailGET into a generic Issue struct @@ -166,45 +179,45 @@ func (issueD *IssueDetailGET) AsIssue() (*Issue, error) { // IssueDetail -> Issue detail // https://taigaio.github.io/taiga-doc/dist/api.html#object-issue-detail type IssueDetail struct { - AssignedTo int `json:"assigned_to"` - AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info"` - Attachments []interface{} `json:"attachments"` - BlockedNote string `json:"blocked_note"` - BlockedNoteHTML string `json:"blocked_note_html"` - Comment string `json:"comment"` - CreatedDate time.Time `json:"created_date"` - Description string `json:"description"` - DescriptionHTML string `json:"description_html"` - DueDate string `json:"due_date"` - DueDateReason string `json:"due_date_reason"` - DueDateStatus string `json:"due_date_status"` - ExternalReference int `json:"external_reference"` - FinishedDate time.Time `json:"finished_date"` - GeneratedUserStories []int `json:"generated_user_stories"` - ID int `json:"id"` - IsBlocked bool `json:"is_blocked"` - IsClosed bool `json:"is_closed"` - IsVoter bool `json:"is_voter"` - IsWatcher bool `json:"is_watcher"` - Milestone int `json:"milestone"` - ModifiedDate time.Time `json:"modified_date"` - Neighbors Neighbors `json:"neighbors"` - Owner int `json:"owner"` - OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info"` - Priority int `json:"priority"` - Project int `json:"project"` - ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info"` - Ref int `json:"ref"` - Severity int `json:"severity"` - Status int `json:"status"` - StatusExtraInfo StatusExtraInfo `json:"status_extra_info"` - Subject string `json:"subject"` - Tags Tags `json:"tags"` - TotalVoters int `json:"total_voters"` - TotalWatchers int `json:"total_watchers"` - Type int `json:"type"` - Version int `json:"version"` - Watchers []int `json:"watchers"` + AssignedTo int `json:"assigned_to"` + AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info"` + Attachments []GenericObjectAttachment `json:"attachments"` + BlockedNote string `json:"blocked_note"` + BlockedNoteHTML string `json:"blocked_note_html"` + Comment string `json:"comment"` + CreatedDate time.Time `json:"created_date"` + Description string `json:"description"` + DescriptionHTML string `json:"description_html"` + DueDate string `json:"due_date"` + DueDateReason string `json:"due_date_reason"` + DueDateStatus string `json:"due_date_status"` + ExternalReference []int `json:"external_reference"` + FinishedDate time.Time `json:"finished_date"` + GeneratedUserStories []int `json:"generated_user_stories"` + ID int `json:"id"` + IsBlocked bool `json:"is_blocked"` + IsClosed bool `json:"is_closed"` + IsVoter bool `json:"is_voter"` + IsWatcher bool `json:"is_watcher"` + Milestone int `json:"milestone"` + ModifiedDate time.Time `json:"modified_date"` + Neighbors Neighbors `json:"neighbors"` + Owner int `json:"owner"` + OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info"` + Priority int `json:"priority"` + Project int `json:"project"` + ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info"` + Ref int `json:"ref"` + Severity int `json:"severity"` + Status int `json:"status"` + StatusExtraInfo StatusExtraInfo `json:"status_extra_info"` + Subject string `json:"subject"` + Tags Tags `json:"tags"` + TotalVoters int `json:"total_voters"` + TotalWatchers int `json:"total_watchers"` + Type int `json:"type"` + Version int `json:"version"` + Watchers []int `json:"watchers"` } // AsIssue packs the returned IssueDetailGET into a generic Issue struct @@ -216,28 +229,29 @@ func (issueD *IssueDetail) AsIssue() (*Issue, error) { // IssueQueryParams holds fields to be used as URL query parameters to filter the queried objects type IssueQueryParams struct { - Project int `url:"project,omitempty"` - Milestone int `url:"milestone,omitempty"` - MilestoneIsNull bool `url:"milestone__isnull,omitempty"` - Status int `url:"status,omitempty"` - StatusIsArchived bool `url:"status__is_archived,omitempty"` - Tags string `url:"tags,omitempty"` // Strings separated by comma `,` - Watchers int `url:"watchers,omitempty"` - AssignedTo int `url:"assigned_to,omitempty"` - Epic int `url:"epic,omitempty"` - Role int `url:"role,omitempty"` - StatusIsClosed bool `url:"status__is_closed,omitempty"` - Type int `url:"type,omitempty"` - Severity int `url:"severity,omitempty"` - Priority int `url:"priority,omitempty"` - Owner int `url:"owner,omitempty"` - ExcludeStatus int `url:"exclude_status,omitempty"` - ExcludeTags int `url:"exclude_tags,omitempty"` // Strings separated by comma `,` - ExcludeAssignedTo int `url:"exclude_assigned_to,omitempty"` - ExcludeRole int `url:"exclude_role,omitempty"` - ExcludeEpic int `url:"exclude_epic,omitempty"` - ExcludeSeverity int `url:"exclude_severity,omitempty"` - ExcludePriority int `url:"exclude_priority,omitempty"` - ExcludeOwner int `url:"exclude_owner,omitempty"` - ExcludeType int `url:"exclude_type,omitempty"` + Project int `url:"project,omitempty"` + Milestone int `url:"milestone,omitempty"` + MilestoneIsNull bool `url:"milestone__isnull,omitempty"` + Status int `url:"status,omitempty"` + StatusIsArchived bool `url:"status__is_archived,omitempty"` + Tags string `url:"tags,omitempty"` // Strings separated by comma `,` + Watchers int `url:"watchers,omitempty"` + AssignedTo int `url:"assigned_to,omitempty"` + Epic int `url:"epic,omitempty"` + Role int `url:"role,omitempty"` + StatusIsClosed bool `url:"status__is_closed,omitempty"` + Type int `url:"type,omitempty"` + Severity int `url:"severity,omitempty"` + Priority int `url:"priority,omitempty"` + Owner int `url:"owner,omitempty"` + ExcludeStatus int `url:"exclude_status,omitempty"` + ExcludeTags int `url:"exclude_tags,omitempty"` // Strings separated by comma `,` + ExcludeAssignedTo int `url:"exclude_assigned_to,omitempty"` + ExcludeRole int `url:"exclude_role,omitempty"` + ExcludeEpic int `url:"exclude_epic,omitempty"` + ExcludeSeverity int `url:"exclude_severity,omitempty"` + ExcludePriority int `url:"exclude_priority,omitempty"` + ExcludeOwner int `url:"exclude_owner,omitempty"` + ExcludeType int `url:"exclude_type,omitempty"` + IncludeAttachments bool `url:"include_attachments,omitempty"` } diff --git a/milestones.models.go b/milestones.models.go index aa3bff4..dba240e 100644 --- a/milestones.models.go +++ b/milestones.models.go @@ -19,22 +19,23 @@ import ( // // https://taigaio.github.io/taiga-doc/dist/api.html#object-milestone-detail type Milestone struct { - ID int `json:"id,omitempty"` - Slug string `json:"slug,omitempty"` - Name string `json:"name"` - EstimatedFinish string `json:"estimated_finish"` - EstimatedStart string `json:"estimated_start"` - Closed bool `json:"closed,omitempty"` - ClosedPoints int `json:"closed_points,omitempty"` - CreatedDate time.Time `json:"created_date,omitempty"` - Disponibility float64 `json:"disponibility,omitempty"` - ModifiedDate time.Time `json:"modified_date,omitempty"` - Order int `json:"order,omitempty"` - Owner int `json:"owner,omitempty"` - Project int `json:"project"` - ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info,omitempty"` - TotalPoints float64 `json:"total_points,omitempty"` - UserStories []UserStory `json:"user_stories,omitempty"` + ID int `json:"id,omitempty"` + Slug string `json:"slug,omitempty"` + Name string `json:"name"` + EstimatedFinish string `json:"estimated_finish"` + EstimatedStart string `json:"estimated_start"` + Closed bool `json:"closed,omitempty"` + ClosedPoints int `json:"closed_points,omitempty"` + CreatedDate time.Time `json:"created_date,omitempty"` + Disponibility float64 `json:"disponibility,omitempty"` + ModifiedDate time.Time `json:"modified_date,omitempty"` + Order int `json:"order,omitempty"` + Owner int `json:"owner,omitempty"` + Project int `json:"project"` + ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info,omitempty"` + TotalPoints float64 `json:"total_points,omitempty"` + UserStories []UserStory `json:"user_stories,omitempty"` + IncludeAttachments bool `url:"include_attachments,omitempty"` } // MilestonesQueryParams holds fields to be used as URL query parameters to filter the queried objects diff --git a/projects.models.go b/projects.models.go index 5f17534..149cd47 100644 --- a/projects.models.go +++ b/projects.models.go @@ -16,6 +16,23 @@ func genericToProjects(anyProjectObjectSlice interface{}) []Project { return payloadProjectsSlice } +// ProjectPoints represeints the registered Agile Points to a project +type ProjectPoints struct { + Order int `json:"order"` + Name string `json:"name"` + ID int `json:"id"` + ProjectID int `json:"project_id"` + Value *float32 `json:"value"` +} + +// IsValueNil returns true if ProjectPoints.Value is nil +func (pp ProjectPoints) IsValueNil() bool { + if pp.Value == nil { + return true + } + return false +} + // Project is a subset of all possible Project type variants // // https://taigaio.github.io/taiga-doc/dist/api.html#projects-create @@ -92,12 +109,12 @@ type ProjectDetail struct { Members []members `json:"members"` Milestones []milestone `json:"milestones"` ModifiedDate time.Time `json:"modified_date"` - MyHomepage bool `json:"my_homepage"` + MyHomepage int `json:"my_homepage"` MyPermissions []string `json:"my_permissions"` Name string `json:"name"` NotifyLevel int `json:"notify_level"` Owner Owner `json:"owner"` - Points Points `json:"points"` + Points []ProjectPoints `json:"points"` Priorities []priority `json:"priorities"` PublicPermissions []string `json:"public_permissions"` Roles []roles `json:"roles"` diff --git a/tasks.models.go b/tasks.models.go index 8229dc3..d6899cb 100644 --- a/tasks.models.go +++ b/tasks.models.go @@ -68,43 +68,43 @@ func (t *Task) GetProject() int { // TaskDetailLIST => https://taigaio.github.io/taiga-doc/dist/api.html#object-task-detail-list type TaskDetailLIST []struct { - AssignedTo int `json:"assigned_to,omitempty"` - AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info,omitempty"` - Attachments []Attachment `json:"attachments,omitempty"` - BlockedNote string `json:"blocked_note,omitempty"` - CreatedDate time.Time `json:"created_date,omitempty"` - DueDate string `json:"due_date,omitempty"` - DueDateReason string `json:"due_date_reason,omitempty"` - DueDateStatus string `json:"due_date_status,omitempty"` - ExternalReference interface{} `json:"external_reference,omitempty"` - FinishedDate time.Time `json:"finished_date,omitempty"` - ID int `json:"id,omitempty"` - IsBlocked bool `json:"is_blocked,omitempty"` - IsClosed bool `json:"is_closed,omitempty"` - IsIocaine bool `json:"is_iocaine,omitempty"` - IsVoter bool `json:"is_voter,omitempty"` - IsWatcher bool `json:"is_watcher,omitempty"` - Milestone int `json:"milestone,omitempty"` - MilestoneSlug string `json:"milestone_slug,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 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"` - TaskboardOrder int64 `json:"taskboard_order,omitempty"` - TotalComments int `json:"total_comments,omitempty"` - TotalVoters int `json:"total_voters,omitempty"` - TotalWatchers int `json:"total_watchers,omitempty"` - UsOrder int64 `json:"us_order,omitempty"` - UserStory int `json:"user_story,omitempty"` - UserStoryExtraInfo UserStoryExtraInfo `json:"user_story_extra_info,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"` + CreatedDate time.Time `json:"created_date,omitempty"` + DueDate string `json:"due_date,omitempty"` + DueDateReason string `json:"due_date_reason,omitempty"` + DueDateStatus string `json:"due_date_status,omitempty"` + ExternalReference interface{} `json:"external_reference,omitempty"` + FinishedDate time.Time `json:"finished_date,omitempty"` + ID int `json:"id,omitempty"` + IsBlocked bool `json:"is_blocked,omitempty"` + IsClosed bool `json:"is_closed,omitempty"` + IsIocaine bool `json:"is_iocaine,omitempty"` + IsVoter bool `json:"is_voter,omitempty"` + IsWatcher bool `json:"is_watcher,omitempty"` + Milestone int `json:"milestone,omitempty"` + MilestoneSlug string `json:"milestone_slug,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 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"` + TaskboardOrder int64 `json:"taskboard_order,omitempty"` + TotalComments int `json:"total_comments,omitempty"` + TotalVoters int `json:"total_voters,omitempty"` + TotalWatchers int `json:"total_watchers,omitempty"` + UsOrder int64 `json:"us_order,omitempty"` + UserStory int `json:"user_story,omitempty"` + UserStoryExtraInfo UserStoryExtraInfo `json:"user_story_extra_info,omitempty"` + Version int `json:"version,omitempty"` + Watchers []int `json:"watchers,omitempty"` } // AsTasks packs the returned TaskDetailLIST into a generic Task struct @@ -118,49 +118,49 @@ func (t *TaskDetailLIST) AsTasks() ([]Task, error) { // TaskDetailGET => https://taigaio.github.io/taiga-doc/dist/api.html#object-task-detail-get type TaskDetailGET 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"` - Comment string `json:"comment,omitempty"` - CreatedDate time.Time `json:"created_date,omitempty"` - Description string `json:"description,omitempty"` - DescriptionHTML string `json:"description_html,omitempty"` - DueDate string `json:"due_date,omitempty"` - DueDateReason string `json:"due_date_reason,omitempty"` - DueDateStatus string `json:"due_date_status,omitempty"` - ExternalReference interface{} `json:"external_reference,omitempty"` - FinishedDate time.Time `json:"finished_date,omitempty"` - GeneratedUserStories interface{} `json:"generated_user_stories,omitempty"` - ID int `json:"id,omitempty"` - IsBlocked bool `json:"is_blocked,omitempty"` - IsClosed bool `json:"is_closed,omitempty"` - IsIocaine bool `json:"is_iocaine,omitempty"` - IsVoter bool `json:"is_voter,omitempty"` - IsWatcher bool `json:"is_watcher,omitempty"` - Milestone int `json:"milestone,omitempty"` - MilestoneSlug string `json:"milestone_slug,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"` - TaskboardOrder int64 `json:"taskboard_order,omitempty"` - TotalComments int `json:"total_comments,omitempty"` - TotalVoters int `json:"total_voters,omitempty"` - TotalWatchers int `json:"total_watchers,omitempty"` - UsOrder int64 `json:"us_order,omitempty"` - UserStory int `json:"user_story,omitempty"` - UserStoryExtraInfo UserStoryExtraInfo `json:"user_story_extra_info,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"` + Comment string `json:"comment,omitempty"` + CreatedDate time.Time `json:"created_date,omitempty"` + Description string `json:"description,omitempty"` + DescriptionHTML string `json:"description_html,omitempty"` + DueDate string `json:"due_date,omitempty"` + DueDateReason string `json:"due_date_reason,omitempty"` + DueDateStatus string `json:"due_date_status,omitempty"` + ExternalReference interface{} `json:"external_reference,omitempty"` + FinishedDate time.Time `json:"finished_date,omitempty"` + GeneratedUserStories interface{} `json:"generated_user_stories,omitempty"` + ID int `json:"id,omitempty"` + IsBlocked bool `json:"is_blocked,omitempty"` + IsClosed bool `json:"is_closed,omitempty"` + IsIocaine bool `json:"is_iocaine,omitempty"` + IsVoter bool `json:"is_voter,omitempty"` + IsWatcher bool `json:"is_watcher,omitempty"` + Milestone int `json:"milestone,omitempty"` + MilestoneSlug string `json:"milestone_slug,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"` + TaskboardOrder int64 `json:"taskboard_order,omitempty"` + TotalComments int `json:"total_comments,omitempty"` + TotalVoters int `json:"total_voters,omitempty"` + TotalWatchers int `json:"total_watchers,omitempty"` + UsOrder int64 `json:"us_order,omitempty"` + UserStory int `json:"user_story,omitempty"` + UserStoryExtraInfo UserStoryExtraInfo `json:"user_story_extra_info,omitempty"` + Version int `json:"version,omitempty"` + Watchers []int `json:"watchers,omitempty"` } // AsTask packs the returned TaskDetailGET into a generic Task struct @@ -173,30 +173,30 @@ func (t *TaskDetailGET) AsTask() (*Task, error) { // TaskDetail => https://taigaio.github.io/taiga-doc/dist/api.html#object-task-detail type TaskDetail 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"` - Comment string `json:"comment,omitempty"` - CreatedDate time.Time `json:"created_date,omitempty"` - Description string `json:"description,omitempty"` - DescriptionHTML string `json:"description_html,omitempty"` - DueDate string `json:"due_date,omitempty"` - DueDateReason string `json:"due_date_reason,omitempty"` - DueDateStatus string `json:"due_date_status,omitempty"` - ExternalReference interface{} `json:"external_reference,omitempty"` - FinishedDate time.Time `json:"finished_date,omitempty"` - GeneratedUserStories interface{} `json:"generated_user_stories,omitempty"` - ID int `json:"id,omitempty"` - IsBlocked bool `json:"is_blocked,omitempty"` - IsClosed bool `json:"is_closed,omitempty"` - IsIocaine bool `json:"is_iocaine,omitempty"` - IsVoter bool `json:"is_voter,omitempty"` - IsWatcher bool `json:"is_watcher,omitempty"` - Milestone int `json:"milestone,omitempty"` - MilestoneSlug string `json:"milestone_slug,omitempty"` - ModifiedDate time.Time `json:"modified_date,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"` + Comment string `json:"comment,omitempty"` + CreatedDate time.Time `json:"created_date,omitempty"` + Description string `json:"description,omitempty"` + DescriptionHTML string `json:"description_html,omitempty"` + DueDate string `json:"due_date,omitempty"` + DueDateReason string `json:"due_date_reason,omitempty"` + DueDateStatus string `json:"due_date_status,omitempty"` + ExternalReference interface{} `json:"external_reference,omitempty"` + FinishedDate time.Time `json:"finished_date,omitempty"` + GeneratedUserStories interface{} `json:"generated_user_stories,omitempty"` + ID int `json:"id,omitempty"` + IsBlocked bool `json:"is_blocked,omitempty"` + IsClosed bool `json:"is_closed,omitempty"` + IsIocaine bool `json:"is_iocaine,omitempty"` + IsVoter bool `json:"is_voter,omitempty"` + IsWatcher bool `json:"is_watcher,omitempty"` + Milestone int `json:"milestone,omitempty"` + MilestoneSlug string `json:"milestone_slug,omitempty"` + ModifiedDate time.Time `json:"modified_date,omitempty"` Neighbors struct { Next struct { ID int `json:"id,omitempty"` @@ -245,23 +245,25 @@ type TaskVoterDetail struct { // // To set `OrderBy`, use the methods attached to this struct type TasksQueryParams struct { - Project int `url:"project,omitempty"` - Status int `url:"status,omitempty"` - Tags []string `url:"tags,omitempty"` - UserStory int `url:"user_story,omitempty"` - Role int `url:"role,omitempty"` - Owner int `url:"owner,omitempty"` - Milestone int `url:"milestone,omitempty"` - Watchers int `url:"watchers,omitempty"` - AssignedTo int `url:"assigned_to,omitempty"` - StatusIsClosed bool `url:"status__is_closed,omitempty"` - ExcludeStatus int `url:"exclude_status,omitempty"` - ExcludeTags int `url:"exclude_tags,omitempty"` - ExcludeRole int `url:"exclude_role,omitempty"` - ExcludeOwner int `url:"exclude_owner,omitempty"` - ExcludeAssignedTo int `url:"exclude_assigned_to,omitempty"` + Project int `url:"project,omitempty"` + Status int `url:"status,omitempty"` + Tags []string `url:"tags,omitempty"` + UserStory int `url:"user_story,omitempty"` + Role int `url:"role,omitempty"` + Owner int `url:"owner,omitempty"` + Milestone int `url:"milestone,omitempty"` + Watchers int `url:"watchers,omitempty"` + AssignedTo int `url:"assigned_to,omitempty"` + StatusIsClosed bool `url:"status__is_closed,omitempty"` + ExcludeStatus int `url:"exclude_status,omitempty"` + ExcludeTags int `url:"exclude_tags,omitempty"` + ExcludeRole int `url:"exclude_role,omitempty"` + ExcludeOwner int `url:"exclude_owner,omitempty"` + ExcludeAssignedTo int `url:"exclude_assigned_to,omitempty"` + IncludeAttachments bool `url:"include_attachments,omitempty"` } +/* // TaskMinimal represent a small subset of a full Task object type TaskMinimal struct { Color string `json:"color"` @@ -270,3 +272,4 @@ type TaskMinimal struct { Ref int `json:"ref"` Subject string `json:"subject"` } +*/ diff --git a/user_stories.models.go b/user_stories.models.go index 30a357f..2d41dab 100644 --- a/user_stories.models.go +++ b/user_stories.models.go @@ -69,57 +69,57 @@ func (us *UserStory) GetProject() int { // UserStoryDetailLIST => https://taigaio.github.io/taiga-doc/dist/api.html#object-userstory-detail-list type UserStoryDetailLIST []struct { - AssignedTo int `json:"assigned_to,omitempty"` - AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info,omitempty"` - AssignedUsers []int `json:"assigned_users,omitempty"` - Attachments Attachment `json:"attachments,omitempty"` - BacklogOrder int `json:"backlog_order,omitempty"` - BlockedNote string `json:"blocked_note,omitempty"` - ClientRequirement bool `json:"client_requirement,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedDate time.Time `json:"created_date,omitempty"` - DueDate string `json:"due_date"` - DueDateReason string `json:"due_date_reason"` - DueDateStatus string `json:"due_date_status"` - EpicOrder int `json:"epic_order,omitempty"` - Epics interface{} `json:"epics,omitempty"` - ExternalReference interface{} `json:"external_reference,omitempty"` - FinishDate time.Time `json:"finish_date,omitempty"` - GeneratedFromIssue int `json:"generated_from_issue,omitempty"` - GeneratedFromTask int `json:"generated_from_task,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"` - KanbanOrder int `json:"kanban_order,omitempty"` - Milestone int `json:"milestone,omitempty"` - MilestoneName string `json:"milestone_name,omitempty"` - MilestoneSlug string `json:"milestone_slug,omitempty"` - ModifiedDate time.Time `json:"modified_date,omitempty"` - OriginIssue int `json:"origin_issue,omitempty"` - OriginTask int `json:"origin_task,omitempty"` - Owner int `json:"owner,omitempty"` - OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info,omitempty"` - Points AgilePoints `json:"points,omitempty"` - Project int `json:"project,omitempty"` - ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info,omitempty"` - Ref int `json:"ref,omitempty"` - SprintOrder int `json:"sprint_order,omitempty"` - Status int `json:"status,omitempty"` - StatusExtraInfo StatusExtraInfo `json:"status_extra_info,omitempty"` - Subject string `json:"subject,omitempty"` - Tags Tags `json:"tags,omitempty"` - Tasks []TaskMinimal `json:"tasks"` - TeamRequirement bool `json:"team_requirement,omitempty"` - TotalAttachments int `json:"total_attachments,omitempty"` - TotalComments int `json:"total_comments,omitempty"` - TotalPoints float64 `json:"total_points,omitempty"` - TotalVoters int `json:"total_voters,omitempty"` - TotalWatchers int `json:"total_watchers,omitempty"` - TribeGig interface{} `json:"tribe_gig,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"` + AssignedUsers []int `json:"assigned_users,omitempty"` + Attachments []GenericObjectAttachment `json:"attachments,omitempty"` + BacklogOrder int `json:"backlog_order,omitempty"` + BlockedNote string `json:"blocked_note,omitempty"` + ClientRequirement bool `json:"client_requirement,omitempty"` + Comment string `json:"comment,omitempty"` + CreatedDate time.Time `json:"created_date,omitempty"` + DueDate string `json:"due_date"` + DueDateReason string `json:"due_date_reason"` + DueDateStatus string `json:"due_date_status"` + EpicOrder int `json:"epic_order,omitempty"` + Epics []EpicMinimal `json:"epics,omitempty"` + ExternalReference interface{} `json:"external_reference,omitempty"` + FinishDate time.Time `json:"finish_date,omitempty"` + GeneratedFromIssue int `json:"generated_from_issue,omitempty"` + GeneratedFromTask int `json:"generated_from_task,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"` + KanbanOrder int `json:"kanban_order,omitempty"` + Milestone int `json:"milestone,omitempty"` + MilestoneName string `json:"milestone_name,omitempty"` + MilestoneSlug string `json:"milestone_slug,omitempty"` + ModifiedDate time.Time `json:"modified_date,omitempty"` + OriginIssue int `json:"origin_issue,omitempty"` + OriginTask int `json:"origin_task,omitempty"` + Owner int `json:"owner,omitempty"` + OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info,omitempty"` + Points AgilePoints `json:"points,omitempty"` + Project int `json:"project,omitempty"` + ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info,omitempty"` + Ref int `json:"ref,omitempty"` + SprintOrder int `json:"sprint_order,omitempty"` + Status int `json:"status,omitempty"` + StatusExtraInfo StatusExtraInfo `json:"status_extra_info,omitempty"` + Subject string `json:"subject,omitempty"` + Tags Tags `json:"tags,omitempty"` + Tasks []UserStoryNestedTask `json:"tasks"` + TeamRequirement bool `json:"team_requirement,omitempty"` + TotalAttachments int `json:"total_attachments,omitempty"` + TotalComments int `json:"total_comments,omitempty"` + TotalPoints float64 `json:"total_points,omitempty"` + TotalVoters int `json:"total_voters,omitempty"` + TotalWatchers int `json:"total_watchers,omitempty"` + TribeGig interface{} `json:"tribe_gig,omitempty"` + Version int `json:"version,omitempty"` + Watchers []int `json:"watchers,omitempty"` } // AsUserStory packs the returned UserStoryDetailLIST into a generic UserStory struct @@ -133,48 +133,38 @@ func (u *UserStoryDetailLIST) AsUserStory() ([]UserStory, error) { // UserStoryDetail => https://taigaio.github.io/taiga-doc/dist/api.html#object-userstory-detail type UserStoryDetail struct { - AssignedTo int `json:"assigned_to,omitempty"` - AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info,omitempty"` - AssignedUsers []int `json:"assigned_users,omitempty"` - Attachments []interface{} `json:"attachments,omitempty"` - BacklogOrder int64 `json:"backlog_order,omitempty"` - BlockedNote string `json:"blocked_note,omitempty"` - BlockedNoteHTML string `json:"blocked_note_html,omitempty"` - ClientRequirement bool `json:"client_requirement,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedDate time.Time `json:"created_date,omitempty"` - Description string `json:"description,omitempty"` - DescriptionHTML string `json:"description_html,omitempty"` - DueDate string `json:"due_date,omitempty"` - DueDateReason string `json:"due_date_reason,omitempty"` - DueDateStatus string `json:"due_date_status,omitempty"` - EpicOrder int `json:"epic_order,omitempty"` - Epics []struct { - Color string `json:"color,omitempty"` - ID int `json:"id,omitempty"` - Project struct { - ID int `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Slug string `json:"slug,omitempty"` - } `json:"project,omitempty"` - Ref int `json:"ref,omitempty"` - Subject string `json:"subject,omitempty"` - } `json:"epics,omitempty"` - ExternalReference interface{} `json:"external_reference,omitempty"` - FinishDate string `json:"finish_date,omitempty"` - GeneratedFromIssue int `json:"generated_from_issue,omitempty"` - GeneratedFromTask int `json:"generated_from_task,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"` - KanbanOrder int64 `json:"kanban_order,omitempty"` - Milestone int `json:"milestone,omitempty"` - MilestoneName string `json:"milestone_name,omitempty"` - MilestoneSlug string `json:"milestone_slug,omitempty"` - ModifiedDate time.Time `json:"modified_date,omitempty"` - Neighbors struct { + AssignedTo int `json:"assigned_to,omitempty"` + AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info,omitempty"` + AssignedUsers []int `json:"assigned_users,omitempty"` + Attachments []GenericObjectAttachment `json:"attachments,omitempty"` + BacklogOrder int64 `json:"backlog_order,omitempty"` + BlockedNote string `json:"blocked_note,omitempty"` + BlockedNoteHTML string `json:"blocked_note_html,omitempty"` + ClientRequirement bool `json:"client_requirement,omitempty"` + Comment string `json:"comment,omitempty"` + CreatedDate time.Time `json:"created_date,omitempty"` + Description string `json:"description,omitempty"` + DescriptionHTML string `json:"description_html,omitempty"` + DueDate string `json:"due_date,omitempty"` + DueDateReason string `json:"due_date_reason,omitempty"` + DueDateStatus string `json:"due_date_status,omitempty"` + EpicOrder int `json:"epic_order,omitempty"` + Epics []EpicMinimal `json:"epics,omitempty"` + ExternalReference interface{} `json:"external_reference,omitempty"` + FinishDate string `json:"finish_date,omitempty"` + GeneratedFromIssue int `json:"generated_from_issue,omitempty"` + GeneratedFromTask int `json:"generated_from_task,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"` + KanbanOrder int64 `json:"kanban_order,omitempty"` + Milestone int `json:"milestone,omitempty"` + MilestoneName string `json:"milestone_name,omitempty"` + MilestoneSlug string `json:"milestone_slug,omitempty"` + ModifiedDate time.Time `json:"modified_date,omitempty"` + Neighbors struct { Next struct { ID int `json:"id,omitempty"` Ref int `json:"ref,omitempty"` @@ -186,29 +176,29 @@ type UserStoryDetail struct { Subject string `json:"subject,omitempty"` } `json:"previous,omitempty"` } `json:"neighbors,omitempty"` - OriginIssue interface{} `json:"origin_issue,omitempty"` - OriginTask interface{} `json:"origin_task,omitempty"` - Owner int `json:"owner,omitempty"` - OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info,omitempty"` - Points AgilePoints `json:"points,omitempty"` - Project int `json:"project"` - ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info,omitempty"` - Ref int `json:"ref,omitempty"` - SprintOrder int `json:"sprint_order,omitempty"` - Status int `json:"status,omitempty"` - StatusExtraInfo StatusExtraInfo `json:"status_extra_info,omitempty"` - Subject string `json:"subject"` - Tags Tags `json:"tags,omitempty"` - Tasks []TaskMinimal `json:"tasks"` - TeamRequirement bool `json:"team_requirement,omitempty"` - TotalAttachments int `json:"total_attachments,omitempty"` - TotalComments int `json:"total_comments,omitempty"` - TotalPoints float64 `json:"total_points,omitempty"` - TotalVoters int `json:"total_voters,omitempty"` - TotalWatchers int `json:"total_watchers,omitempty"` - TribeGig interface{} `json:"tribe_gig,omitempty"` - Version int `json:"version,omitempty"` - Watchers []int `json:"watchers,omitempty"` + OriginIssue interface{} `json:"origin_issue,omitempty"` + OriginTask interface{} `json:"origin_task,omitempty"` + Owner int `json:"owner,omitempty"` + OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info,omitempty"` + Points AgilePoints `json:"points,omitempty"` + Project int `json:"project"` + ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info,omitempty"` + Ref int `json:"ref,omitempty"` + SprintOrder int `json:"sprint_order,omitempty"` + Status int `json:"status,omitempty"` + StatusExtraInfo StatusExtraInfo `json:"status_extra_info,omitempty"` + Subject string `json:"subject"` + Tags Tags `json:"tags,omitempty"` + Tasks []UserStoryNestedTask `json:"tasks"` + TeamRequirement bool `json:"team_requirement,omitempty"` + TotalAttachments int `json:"total_attachments,omitempty"` + TotalComments int `json:"total_comments,omitempty"` + TotalPoints float64 `json:"total_points,omitempty"` + TotalVoters int `json:"total_voters,omitempty"` + TotalWatchers int `json:"total_watchers,omitempty"` + TribeGig interface{} `json:"tribe_gig,omitempty"` + Version int `json:"version,omitempty"` + Watchers []int `json:"watchers,omitempty"` } // AsUserStory packs the returned UserStoryDetail into a generic UserStory struct @@ -220,61 +210,61 @@ func (u *UserStoryDetail) AsUserStory() (*UserStory, error) { // UserStoryDetailGET => https://taigaio.github.io/taiga-doc/dist/api.html#object-userstory-detail-get type UserStoryDetailGET struct { - AssignedTo int `json:"assigned_to"` - AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info"` - AssignedUsers []int `json:"assigned_users"` - Attachments []interface{} `json:"attachments"` - BacklogOrder int64 `json:"backlog_order"` - BlockedNote string `json:"blocked_note"` - BlockedNoteHTML string `json:"blocked_note_html"` - ClientRequirement bool `json:"client_requirement"` - Comment string `json:"comment"` - CreatedDate time.Time `json:"created_date"` - Description string `json:"description"` - DescriptionHTML string `json:"description_html"` - DueDate string `json:"due_date"` - DueDateReason string `json:"due_date_reason"` - DueDateStatus string `json:"due_date_status"` - EpicOrder int `json:"epic_order"` - Epics []EpicMinimal `json:"epics"` - ExternalReference []string `json:"external_reference"` - FinishDate time.Time `json:"finish_date"` - GeneratedFromIssue interface{} `json:"generated_from_issue"` - GeneratedFromTask interface{} `json:"generated_from_task"` - ID int `json:"id"` - IsBlocked bool `json:"is_blocked"` - IsClosed bool `json:"is_closed"` - IsVoter bool `json:"is_voter"` - IsWatcher bool `json:"is_watcher"` - KanbanOrder int64 `json:"kanban_order"` - Milestone int `json:"milestone"` - MilestoneName string `json:"milestone_name"` - MilestoneSlug string `json:"milestone_slug"` - ModifiedDate time.Time `json:"modified_date"` - Neighbors Neighbors `json:"neighbors"` - OriginIssue int `json:"origin_issue"` - OriginTask int `json:"origin_task"` - Owner int `json:"owner"` - OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info"` - Points Points `json:"points"` - Project int `json:"project"` - ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info"` - Ref int `json:"ref"` - SprintOrder int `json:"sprint_order"` - Status int `json:"status"` - StatusExtraInfo StatusExtraInfo `json:"status_extra_info"` - Subject string `json:"subject"` - Tags Tags `json:"tags"` - Tasks []TaskMinimal `json:"tasks"` - TeamRequirement bool `json:"team_requirement"` - TotalAttachments int `json:"total_attachments"` - TotalComments int `json:"total_comments"` - TotalPoints float64 `json:"total_points"` - TotalVoters int `json:"total_voters"` - TotalWatchers int `json:"total_watchers"` - TribeGig interface{} `json:"tribe_gig"` - Version int `json:"version"` - Watchers []int `json:"watchers"` + AssignedTo int `json:"assigned_to"` + AssignedToExtraInfo AssignedToExtraInfo `json:"assigned_to_extra_info"` + AssignedUsers []int `json:"assigned_users"` + Attachments []GenericObjectAttachment `json:"attachments"` + BacklogOrder int64 `json:"backlog_order"` + BlockedNote string `json:"blocked_note"` + BlockedNoteHTML string `json:"blocked_note_html"` + ClientRequirement bool `json:"client_requirement"` + Comment string `json:"comment"` + CreatedDate time.Time `json:"created_date"` + Description string `json:"description"` + DescriptionHTML string `json:"description_html"` + DueDate string `json:"due_date"` + DueDateReason string `json:"due_date_reason"` + DueDateStatus string `json:"due_date_status"` + EpicOrder int `json:"epic_order"` + Epics []EpicMinimal `json:"epics"` + ExternalReference []string `json:"external_reference"` + FinishDate time.Time `json:"finish_date"` + GeneratedFromIssue interface{} `json:"generated_from_issue"` + GeneratedFromTask interface{} `json:"generated_from_task"` + ID int `json:"id"` + IsBlocked bool `json:"is_blocked"` + IsClosed bool `json:"is_closed"` + IsVoter bool `json:"is_voter"` + IsWatcher bool `json:"is_watcher"` + KanbanOrder int64 `json:"kanban_order"` + Milestone int `json:"milestone"` + MilestoneName string `json:"milestone_name"` + MilestoneSlug string `json:"milestone_slug"` + ModifiedDate time.Time `json:"modified_date"` + Neighbors Neighbors `json:"neighbors"` + OriginIssue interface{} `json:"origin_issue"` + OriginTask interface{} `json:"origin_task"` + Owner int `json:"owner"` + OwnerExtraInfo OwnerExtraInfo `json:"owner_extra_info"` + Points Points `json:"points"` + Project int `json:"project"` + ProjectExtraInfo ProjectExtraInfo `json:"project_extra_info"` + Ref int `json:"ref"` + SprintOrder int `json:"sprint_order"` + Status int `json:"status"` + StatusExtraInfo StatusExtraInfo `json:"status_extra_info"` + Subject string `json:"subject"` + Tags Tags `json:"tags"` + Tasks []UserStoryNestedTask `json:"tasks"` + TeamRequirement bool `json:"team_requirement"` + TotalAttachments int `json:"total_attachments"` + TotalComments int `json:"total_comments"` + TotalPoints float64 `json:"total_points"` + TotalVoters int `json:"total_voters"` + TotalWatchers int `json:"total_watchers"` + TribeGig interface{} `json:"tribe_gig"` + Version int `json:"version"` + Watchers []int `json:"watchers"` } // AsUserStory packs the returned UserStoryDetailGET into a generic UserStory struct @@ -329,17 +319,19 @@ type IssueFiltersDataDetail struct { // // To set `OrderBy`, use the methods attached to this struct type UserStoryQueryParams struct { - Project int `url:"project,omitempty"` - Milestone int `url:"milestone,omitempty"` - MilestoneIsNull bool `url:"milestone__isnull,omitempty"` - Status int `url:"status,omitempty"` - StatusIsArchived bool `url:"status__is_archived,omitempty"` - Tags string `url:"tags,omitempty"` // Comma separated strings (no whitespace) - Watchers int `url:"watchers,omitempty"` - AssignedTo int `url:"assigned_to,omitempty"` - Epic int `url:"epic,omitempty"` - Role int `url:"role,omitempty"` - StatusIsClosed bool `url:"status__is_closed,omitempty"` + Project int `url:"project,omitempty"` + Milestone int `url:"milestone,omitempty"` + MilestoneIsNull bool `url:"milestone__isnull,omitempty"` + Status int `url:"status,omitempty"` + StatusIsArchived bool `url:"status__is_archived,omitempty"` + Tags string `url:"tags,omitempty"` // Comma separated strings (no whitespace) + Watchers int `url:"watchers,omitempty"` + AssignedTo int `url:"assigned_to,omitempty"` + Epic int `url:"epic,omitempty"` + Role int `url:"role,omitempty"` + StatusIsClosed bool `url:"status__is_closed,omitempty"` + IncludeAttachments bool `url:"include_attachments,omitempty"` + IncludeTasks bool `url:"include_tasks,omitempty"` ExcludeStatus int `url:"exclude_status,omitempty"` ExcludeTags int `url:"exclude_tags,omitempty"` // Comma separated strings (no whitespace) @@ -347,3 +339,14 @@ type UserStoryQueryParams struct { ExcludeRole int `url:"exclude_role,omitempty"` ExcludeEpic int `url:"exclude_epic,omitempty"` } + +// UserStoryNestedTask is returned only when IncludeTasks is set to true in UserStoryQueryParams +type UserStoryNestedTask struct { + Subject string `json:"subject"` + ID int `json:"id"` + Ref int `json:"ref"` + IsBlocked bool `json:"is_blocked"` + IsIocaine bool `json:"is_iocaine"` + StatusID int `json:"status_id"` + IsClosed bool `json:"is_closed"` +}