1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-20 05:39:42 +02:00
documize/core/section/trello/model.go

296 lines
9.8 KiB
Go
Raw Normal View History

2016-07-07 18:54:16 -07:00
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package trello
import (
"strings"
"time"
)
2016-07-07 18:54:16 -07:00
type secrets struct {
Token string `json:"token"`
}
2016-07-07 18:54:16 -07:00
type trelloConfig struct {
AppKey string `json:"appKey"`
Token string `json:"token"`
Board trelloBoard `json:"board"`
Lists []trelloList `json:"lists"`
Boards []trelloBoard `json:"boards"`
Since string `json:"since,omitempty"`
SincePtr *time.Time `json:"-"`
2016-09-12 13:08:09 +01:00
OrgByID map[string]trelloOrganization `json:"-"`
2016-07-07 18:54:16 -07:00
}
func (c *trelloConfig) Clean() {
c.AppKey = strings.TrimSpace(c.AppKey)
c.Token = strings.TrimSpace(c.Token)
}
// Trello objects based upon https://github.com/VojtechVitek/go-trello
2016-09-08 15:08:20 +01:00
2016-09-12 13:08:09 +01:00
type trelloOrganization struct {
ID string `json:"id"`
Name string `json:"name"`
DisplayName string `json:"displayName"`
Desc string `json:"desc"`
DescData string `json:"descData"`
URL string `json:"url"`
Website string `json:"website"`
LogoHash string `json:"logoHash"`
Products []string `json:"products"`
PowerUps []string `json:"powerUps"`
}
2016-09-08 15:08:20 +01:00
type trelloAction struct {
2016-09-12 13:08:09 +01:00
ID string `json:"id"`
IDMemberCreator string `json:"idMemberCreator"`
2016-09-08 15:08:20 +01:00
Data struct {
DateLastEdited string `json:"dateLastEdited"`
ListBefore struct {
2016-09-12 13:08:09 +01:00
ID string `json:"id"`
2016-09-08 15:08:20 +01:00
Name string `json:"name"`
} `json:"listBefore"`
ListAfter struct {
2016-09-12 13:08:09 +01:00
ID string `json:"id"`
2016-09-08 15:08:20 +01:00
Name string `json:"name"`
} `json:"listAfter"`
CheckItem struct {
2016-09-12 13:08:09 +01:00
ID string `json:"id"`
2016-09-08 15:08:20 +01:00
State string `json:"state"`
Name string `json:"name"`
} `json:"checkItem"`
CheckList struct {
2016-09-12 13:08:09 +01:00
ID string `json:"id"`
2016-09-08 15:08:20 +01:00
Name string `json:"name"`
} `json:"checklist"`
List struct {
2016-09-12 13:08:09 +01:00
ID string `json:"id"`
2016-09-08 15:08:20 +01:00
Name string `json:"name"`
} `json:"list"`
TextData struct {
Emoji struct{} `json:"emoji"`
} `json:"textData"`
Board struct {
2016-09-12 13:08:09 +01:00
ID string `json:"id"`
2016-09-08 15:08:20 +01:00
Name string `json:"name"`
ShortLink string `json:"shortLink"`
} `json:"board"`
Card struct {
2016-09-12 13:08:09 +01:00
ID string `json:"id"`
2016-09-08 15:08:20 +01:00
Name string `json:"name"`
ShortLink string `json:"shortLink"`
2016-09-12 13:08:09 +01:00
IDShort int `json:"idShort"`
2016-09-08 15:08:20 +01:00
} `json:"card"`
Text string `json:"text"`
} `json:"data"`
Type string `json:"type"`
Date string `json:"date"`
MemberCreator struct {
2016-09-12 13:08:09 +01:00
ID string `json:"id"`
2016-09-08 15:08:20 +01:00
AvatarHash string `json:"avatarHash"`
FullName string `json:"fullName"`
Initials string `json:"initials"`
Username string `json:"username"`
} `json:"memberCreator"`
}
2016-07-07 18:54:16 -07:00
type trelloMember struct {
ID string `json:"id"`
AvatarHash string `json:"avatarHash"`
Bio string `json:"bio"`
BioData struct {
Emoji interface{} `json:"emoji,omitempty"`
} `json:"bioData"`
Confirmed bool `json:"confirmed"`
FullName string `json:"fullName"`
PremOrgsAdminID []string `json:"idPremOrgsAdmin"`
Initials string `json:"initials"`
MemberType string `json:"memberType"`
Products []int `json:"products"`
Status string `json:"status"`
URL string `json:"url"`
Username string `json:"username"`
AvatarSource string `json:"avatarSource"`
Email string `json:"email"`
GravatarHash string `json:"gravatarHash"`
BoardsID []string `json:"idBoards"`
BoardsPinnedID []string `json:"idBoardsPinned"`
OrganizationsID []string `json:"idOrganizations"`
LoginTypes []string `json:"loginTypes"`
NewEmail string `json:"newEmail"`
OneTimeMessagesDismissed []string `json:"oneTimeMessagesDismissed"`
Prefs struct {
SendSummaries bool `json:"sendSummaries"`
MinutesBetweenSummaries int `json:"minutesBetweenSummaries"`
MinutesBeforeDeadlineToNotify int `json:"minutesBeforeDeadlineToNotify"`
ColorBlind bool `json:"colorBlind"`
Locale string `json:"locale"`
} `json:"prefs"`
Trophies []string `json:"trophies"`
UploadedAvatarHash string `json:"uploadedAvatarHash"`
PremiumFeatures []string `json:"premiumFeatures"`
}
type trelloBoard struct {
ID string `json:"id"`
Name string `json:"name"`
Closed bool `json:"closed"`
OrganizationID string `json:"idOrganization"`
2016-09-12 13:08:09 +01:00
OrgName string `json:"orgName"`
2016-07-07 18:54:16 -07:00
Pinned bool `json:"pinned"`
URL string `json:"url"`
ShortURL string `json:"shortUrl"`
Desc string `json:"desc"`
DescData struct {
Emoji struct{} `json:"emoji"`
} `json:"descData"`
Prefs struct {
PermissionLevel string `json:"permissionLevel"`
Voting string `json:"voting"`
Comments string `json:"comments"`
Invitations string `json:"invitations"`
SelfJoin bool `json:"selfjoin"`
CardCovers bool `json:"cardCovers"`
CardAging string `json:"cardAging"`
CalendarFeedEnabled bool `json:"calendarFeedEnabled"`
Background string `json:"background"`
BackgroundColor string `json:"backgroundColor"`
BackgroundImage string `json:"backgroundImage"`
BackgroundImageScaled []trelloBoardBackground `json:"backgroundImageScaled"`
BackgroundTile bool `json:"backgroundTile"`
BackgroundBrightness string `json:"backgroundBrightness"`
CanBePublic bool `json:"canBePublic"`
CanBeOrg bool `json:"canBeOrg"`
CanBePrivate bool `json:"canBePrivate"`
CanInvite bool `json:"canInvite"`
} `json:"prefs"`
LabelNames struct {
Red string `json:"red"`
Orange string `json:"orange"`
Yellow string `json:"yellow"`
Green string `json:"green"`
Blue string `json:"blue"`
Purple string `json:"purple"`
} `json:"labelNames"`
Included bool `json:"included"` // indicates whether we display this board
NamePath string `json:"namePath"` // the "team / board" form
2016-07-07 18:54:16 -07:00
}
type trelloBoardBackground struct {
Width int `json:"width"`
Height int `json:"height"`
URL string `json:"url"`
}
type trelloList struct {
ID string `json:"id"`
Name string `json:"name"`
Closed bool `json:"closed"`
BoardID string `json:"idBoard"`
Pos float32 `json:"pos"`
Included bool `json:"included"` // indicates whether we display cards from this list
}
type trelloCard struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
ShortID int `json:"idShort"`
AttachmentCoverID string `json:"idAttachmentCover"`
CheckListsID []string `json:"idCheckLists"`
BoardID string `json:"idBoard"`
ListID string `json:"idList"`
MembersID []string `json:"idMembers"`
MembersVotedID []string `json:"idMembersVoted"`
ManualCoverAttachment bool `json:"manualCoverAttachment"`
Closed bool `json:"closed"`
Pos float32 `json:"pos"`
ShortLink string `json:"shortLink"`
DateLastActivity string `json:"dateLastActivity"`
ShortURL string `json:"shortUrl"`
Subscribed bool `json:"subscribed"`
URL string `json:"url"`
Due string `json:"due"`
Desc string `json:"desc"`
DescData struct {
Emoji struct{} `json:"emoji"`
} `json:"descData"`
CheckItemStates []struct {
CheckItemID string `json:"idCheckItem"`
State string `json:"state"`
} `json:"checkItemStates"`
Badges struct {
Votes int `json:"votes"`
ViewingMemberVoted bool `json:"viewingMemberVoted"`
Subscribed bool `json:"subscribed"`
Fogbugz string `json:"fogbugz"`
CheckItems int `json:"checkItems"`
CheckItemsChecked int `json:"checkItemsChecked"`
Comments int `json:"comments"`
Attachments int `json:"attachments"`
Description bool `json:"description"`
Due string `json:"due"`
} `json:"badges"`
Labels []struct {
Color string `json:"color"`
Name string `json:"name"`
} `json:"labels"`
}
type trelloListCards struct {
List trelloList
Cards []trelloCard
}
type trelloRenderBoard struct {
2016-09-08 17:17:45 +01:00
Board trelloBoard
Data []trelloListCards
CardCount int
ListCount int
Actions []trelloAction
ActionSummary map[string]int
Archived []trelloCard
2016-07-07 18:54:16 -07:00
}
type trelloSharedLabel struct {
Name string
Color string
2016-09-12 13:08:09 +01:00
Boards []trelloBoard
}
type trelloBoardAssignCount struct {
BoardName string
Count int
}
type trelloBoardAssign struct {
2016-09-08 15:08:20 +01:00
AvatarHash string
MemberName string
AssignCounts []trelloBoardAssignCount
}
type trelloRender struct {
Boards []trelloRenderBoard
Since string
Detail trelloRenderBoard
// items below are generated during the render phase
SharedLabels []trelloSharedLabel
MembersByID map[string]trelloMember
MemberBoardAssign []trelloBoardAssign
2016-09-08 15:28:25 +01:00
CardAssignTotal int
CardTotal int
ListTotal int
}