trello

package module
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 16 Imported by: 74

README

Go Trello API

Trello Logo

GoDoc Build Status Coverage Status

A #golang package to access the Trello API. Nearly 100% of the read-only surface area of the API is covered, as is creation and modification of Cards. Low-level infrastructure for features to modify Lists and Boards are easy to add... just not done yet.

Pull requests are welcome for missing features.

My current development focus is documentation, especially enhancing this README.md with more example use cases.

Installation

The Go Trello API has been Tested compatible with Go 1.7 on up. Its only dependency is the github.com/pkg/errors package. It otherwise relies only on the Go standard library.

go get github.com/adlio/trello

Basic Usage

All interaction starts with a trello.Client. Create one with your appKey and token:

client := trello.NewClient(appKey, token)

All API requests accept a trello.Arguments object. This object is a simple map[string]string, converted to query string arguments in the API call. Trello has sane defaults on API calls. We have a trello.Defaults() utility function which can be used when you desire the default Trello arguments. Internally, trello.Defaults() is an empty map, which translates to an empty query string.

board, err := client.GetBoard("bOaRdID", trello.Defaults())
if err != nil {
  // Handle error
}

Client Longevity

When getting Lists from Boards or Cards from Lists, the original trello.Client pointer is carried along in returned child objects. It's important to realize that this enables you to make additional API calls via functions invoked on the objects you receive:

client := trello.NewClient(appKey, token)
board, err := client.GetBoard("ID", trello.Defaults())

// GetLists makes an API call to /boards/:id/lists using credentials from `client`
lists, err := board.GetLists(trello.Defaults())

for _, list := range lists {
  // GetCards makes an API call to /lists/:id/cards using credentials from `client`
  cards, err := list.GetCards(trello.Defaults())
}

Get Trello Boards for a User

Boards can be retrieved directly by their ID (see example above), or by asking for all boards for a member:

member, err := client.GetMember("usernameOrId", trello.Defaults())
if err != nil {
  // Handle error
}

boards, err := member.GetBoards(trello.Defaults())
if err != nil {
  // Handle error
}

Get Trello Lists on a Board

board, err := client.GetBoard("bOaRdID", trello.Defaults())
if err != nil {
  // Handle error
}

lists, err := board.GetLists(trello.Defaults())
if err != nil {
  // Handle error
}

Get Trello Cards on a Board

board, err := client.GetBoard("bOaRdID", trello.Defaults())
if err != nil {
  // Handle error
}

cards, err := board.GetCards(trello.Defaults())
if err != nil {
  // Handle error
}

Get Trello Cards on a List

list, err := client.GetList("lIsTID", trello.Defaults())
if err != nil {
  // Handle error
}

cards, err := list.GetCards(trello.Defaults())
if err != nil {
  // Handle error
}

Creating and deleting a Board

A board can be created or deleted on the Board struct for the user whose credentials are being used.

  board := trello.NewBoard("My bucket list")

  // POST
  err := client.CreateBoard(&board, trello.Defaults())

  // DELETE
  err := board.Delete(trello.Defaults())
  if err != nil {
    fmt.Println(err)
  }
}

Adding a new Member to the Board

  board, err := client.GetBoard("bOaRdID", trello.Defaults())
  if err != nil {
    // Handle error
  }

  member := Member{Email: "user@example.com"}
  _, err := board.AddMember(&member, trello.Defaults()) 

  if err != nil {
    // Handle error
  }

Archiving, Unarchiving & Deleting a Card

// archive
err := card.Archive()

// unarchive
err := card.Unarchive()

// delete
err := card.Delete()

Creating a Card

The API provides several mechanisms for creating new cards.

Creating Cards from Scratch on the Client

This approach requires the most input data on the card:

card := trello.Card{
  Name: "Card Name",
  Desc: "Card description",
  Pos: 12345.678,
  IDList: "iDOfaLiSt",
  IDLabels: []string{"labelID1", "labelID2"},
}
err := client.CreateCard(card, trello.Defaults())
Creating Cards On a List
list, err := client.GetList("lIsTID", trello.Defaults())
list.AddCard(&trello.Card{ Name: "Card Name", Desc: "Card description" }, trello.Defaults())
Creating a Card by Copying Another Card
err := card.CopyToList("listIdNUmber", trello.Defaults())

Get Actions on a Board

board, err := client.GetBoard("bOaRdID", trello.Defaults())
if err != nil {
  // Handle error
}

actions, err := board.GetActions(trello.Defaults())
if err != nil {
  // Handle error
}

Get Actions on a Card

card, err := client.GetCard("cArDID", trello.Defaults())
if err != nil {
  // Handle error
}

actions, err := card.GetActions(trello.Defaults())
if err != nil {
  // Handle error
}

Rearrange Cards Within a List

err := card.MoveToTopOfList()
err = card.MoveToBottomOfList()
err = card.SetPos(12345.6789)

Moving a Card to Another List

err := card.MoveToList("listIdNUmber", trello.Defaults())

Card Ancestry

Trello provides ancestry tracking when cards are created as copies of other cards. This package provides functions for working with this data:


// ancestors will hold a slice of *trello.Cards, with the first
// being the card's parent, and the last being parent's parent's parent...
ancestors, err := card.GetAncestorCards(trello.Defaults())

// GetOriginatingCard() is an alias for the last element in the slice
// of ancestor cards.
ultimateParentCard, err := card.GetOriginatingCard(trello.Defaults())

Debug Logging

If you'd like to see all API calls logged, you can attach a .Logger (implementing Debugf(string, ...interface{})) to your client. The interface for the logger mimics logrus. Example usage:

logger := logrus.New()
logger.SetLevel(logrus.DebugLevel)
client := trello.NewClient(appKey, token)
client.Logger = logger

Documentation

Index

Constants

View Source
const DefaultBaseURL = "https://api.trello.com/1"

DefaultBaseURL is the default API base url used by Client to send requests to Trello.

Variables

This section is empty.

Functions

func IDToTime

func IDToTime(id string) (t time.Time, err error)

IDToTime is a convenience function. It takes a Trello ID string and extracts the encoded create time as time.Time or an error.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound takes an error and returns true exactly if the error is a not-found error.

func IsPermissionDenied

func IsPermissionDenied(err error) bool

IsPermissionDenied takes an error and returns true exactly if the error is a permission-denied error.

func IsRateLimit

func IsRateLimit(err error) bool

IsRateLimit takes an error and returns true exactly if the error is a rate-limit error.

Types

type Action

type Action struct {
	ID              string      `json:"id"`
	IDMemberCreator string      `json:"idMemberCreator"`
	Type            string      `json:"type"`
	Date            time.Time   `json:"date"`
	Data            *ActionData `json:"data,omitempty"`
	MemberCreator   *Member     `json:"memberCreator,omitempty"`
	Member          *Member     `json:"member,omitempty"`
	// contains filtered or unexported fields
}

Action represents Trello API actions Actions are immutable event traces generated whenever an action occurs in Trello. See https://developers.trello.com/reference/#actions.

func (*Action) DidArchiveCard

func (a *Action) DidArchiveCard() bool

DidArchiveCard returns true if the card was updated

func (*Action) DidChangeCardMembership

func (a *Action) DidChangeCardMembership() bool

DidChangeCardMembership returns true if card's membership was changed

func (*Action) DidChangeListForCard

func (a *Action) DidChangeListForCard() bool

DidChangeListForCard returns true if this action created the card (in which case it caused it to enter its first list), archived the card (in which case it caused it to leave its last List), or was an updateCard action involving a change to the list. This is supporting functionality for ListDuration.

func (*Action) DidCommentCard added in v1.8.0

func (a *Action) DidCommentCard() bool

DidCommentCard returns true if card was commented

func (*Action) DidCreateCard

func (a *Action) DidCreateCard() bool

DidCreateCard returns true if this action created a card, false otherwise.

func (*Action) DidUnarchiveCard

func (a *Action) DidUnarchiveCard() bool

DidUnarchiveCard returns true if the card was unarchived

func (*Action) SetClient added in v1.10.0

func (a *Action) SetClient(newClient *Client)

SetClient can be used to override this Action's internal connection to the Trello API. Normally, this is set automatically after API calls.

type ActionCollection

type ActionCollection []*Action

ActionCollection is an alias of []*Action, which sorts by the Action's ID. Which is the same as sorting by the Action's time of occurrence

func (ActionCollection) ContainsCardCreation

func (c ActionCollection) ContainsCardCreation() bool

ContainsCardCreation returns true if collection contains a card-create action

func (ActionCollection) FilterToCardCreationActions

func (c ActionCollection) FilterToCardCreationActions() ActionCollection

FilterToCardCreationActions returns this collection's card-create actions

func (ActionCollection) FilterToCardMembershipChangeActions

func (c ActionCollection) FilterToCardMembershipChangeActions() ActionCollection

FilterToCardMembershipChangeActions returns the collection's card-change, archive and unarchive actions

func (ActionCollection) FilterToListChangeActions

func (c ActionCollection) FilterToListChangeActions() ActionCollection

FilterToListChangeActions returns card-change-list actions

func (ActionCollection) FirstCardCreateAction

func (c ActionCollection) FirstCardCreateAction() *Action

FirstCardCreateAction returns first card-create action

func (ActionCollection) GetListDurations

func (actions ActionCollection) GetListDurations() (durations []*ListDuration, err error)

GetListDurations returns a slice of ListDurations based on the receiver Actions.

func (ActionCollection) GetMemberDurations

func (actions ActionCollection) GetMemberDurations() (durations []*MemberDuration, err error)

GetMemberDurations is similar to GetListDurations. It returns a slice of MemberDuration objects, which describes the length of time each member was attached to this card. Durations are calculated such that being added to a card starts a timer for that member, and being removed starts it again (so that if a person is added and removed multiple times, the duration captures only the times which they were attached). Archiving the card also stops the timer.

func (ActionCollection) LastCommentAction added in v1.8.0

func (c ActionCollection) LastCommentAction() *Action

LastCommentAction returns last comment action

func (ActionCollection) Len

func (c ActionCollection) Len() int

func (ActionCollection) Less

func (c ActionCollection) Less(i, j int) bool

func (ActionCollection) Swap

func (c ActionCollection) Swap(i, j int)

type ActionData

type ActionData struct {
	Text           string          `json:"text,omitempty"`
	List           *List           `json:"list,omitempty"`
	Card           *ActionDataCard `json:"card,omitempty"`
	CardSource     *ActionDataCard `json:"cardSource,omitempty"`
	Board          *Board          `json:"board,omitempty"`
	Old            *ActionDataCard `json:"old,omitempty"`
	ListBefore     *List           `json:"listBefore,omitempty"`
	ListAfter      *List           `json:"listAfter,omitempty"`
	DateLastEdited time.Time       `json:"dateLastEdited"`

	CheckItem *CheckItem `json:"checkItem"`
	Checklist *Checklist `json:"checklist"`
}

ActionData represent the nested data of actions

type ActionDataCard

type ActionDataCard struct {
	ID        string  `json:"id"`
	Name      string  `json:"name"`
	IDShort   int     `json:"idShort"`
	ShortLink string  `json:"shortLink"`
	Pos       float64 `json:"pos"`
	Closed    bool    `json:"closed"`
}

ActionDataCard represent the nested 'card' data attribute of actions

type AddedMembersResponse added in v1.7.0

type AddedMembersResponse struct {
	ID          string        `json:"id"`
	Members     []*Member     `json:"members"`
	Memberships []*Membership `json:"memberships"`
}

AddedMembersResponse represents a response after adding a new member.

type Arguments

type Arguments map[string]string

Arguments are used for passing URL parameters to the client for making API calls.

func Defaults

func Defaults() Arguments

Defaults is a constructor for default Arguments.

func (Arguments) ToURLValues

func (args Arguments) ToURLValues() url.Values

ToURLValues returns the argument's URL value representation.

type Attachment

type Attachment struct {
	ID        string              `json:"id"`
	Card      *Card               `json:"-"`
	Name      string              `json:"name"`
	Pos       float32             `json:"pos"`
	Bytes     int                 `json:"int"`
	Date      string              `json:"date"`
	EdgeColor string              `json:"edgeColor"`
	IDMember  string              `json:"idMember"`
	IsUpload  bool                `json:"isUpload"`
	MimeType  string              `json:"mimeType"`
	Previews  []AttachmentPreview `json:"previews"`
	URL       string              `json:"url"`
	// contains filtered or unexported fields
}

Attachment represent the attachments of cards. This is a nested resource of Card. https://developers.trello.com/reference/#attachments

func (*Attachment) SetClient added in v1.10.0

func (a *Attachment) SetClient(newClient *Client)

SetClient can be used to override this Attachment's internal connection to the Trello API. Normally, this is set automatically after API calls.

type AttachmentPreview

type AttachmentPreview struct {
	ID     string `json:"_id"`
	URL    string `json:"url"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
	Bytes  int    `json:"bytes"`
	Scaled bool   `json:"scaled"`
}

AttachmentPreview is a nested attribute of Attachment.

type BackgroundImage

type BackgroundImage struct {
	Width  int    `json:"width"`
	Height int    `json:"height"`
	URL    string `json:"url"`
}

BackgroundImage is a nested resource of Board.

type Board

type Board struct {
	ID             string          `json:"id"`
	Name           string          `json:"name"`
	Desc           string          `json:"desc"`
	Closed         bool            `json:"closed"`
	IDOrganization string          `json:"idOrganization"`
	Pinned         bool            `json:"pinned"`
	Starred        bool            `json:"starred"`
	URL            string          `json:"url"`
	ShortURL       string          `json:"shortUrl"`
	Prefs          BoardPrefs      `json:"prefs"`
	Subscribed     bool            `json:"subscribed"`
	LabelNames     BoardLabelNames `json:"labelNames"`
	Lists          []*List         `json:"lists"`
	Actions        []*Action       `json:"actions"`
	Organization   Organization    `json:"organization"`
	// contains filtered or unexported fields
}

Board represents a Trello Board. https://developers.trello.com/reference/#boardsid

func NewBoard

func NewBoard(name string) Board

NewBoard is a constructor that sets the default values for Prefs.SelfJoin and Prefs.CardCovers also set by the API.

func (*Board) AddMember added in v1.7.0

func (b *Board) AddMember(member *Member, extraArgs ...Arguments) (response *AddedMembersResponse, err error)

AddMember adds a new member to the board. https://developers.trello.com/reference#boardsidlabelnamesmembers

func (*Board) ContainsCopyOfCard

func (b *Board) ContainsCopyOfCard(cardID string, extraArgs ...Arguments) (bool, error)

ContainsCopyOfCard accepts a card id and Arguments and returns true if the receiver Board contains a Card with the id.

func (*Board) CreateLabel added in v1.10.0

func (b *Board) CreateLabel(label *Label, extraArgs ...Arguments) error

CreateLabel takes a Label and Arguments and POSTs the label to the Board API. Returns an error if the operation fails.

func (*Board) CreateList

func (b *Board) CreateList(name string, extraArgs ...Arguments) (list *List, err error)

CreateList creates a list. Attribute currently supported as extra argument: pos. Attributes currently known to be unsupported: idListSource.

API Docs: https://developers.trello.com/reference/#lists-1

func (*Board) CreatedAt

func (b *Board) CreatedAt() time.Time

CreatedAt returns a board's created-at attribute as time.Time.

func (*Board) Delete

func (b *Board) Delete(extraArgs ...Arguments) error

Delete makes a DELETE call for the receiver Board.

func (*Board) GetActions

func (b *Board) GetActions(extraArgs ...Arguments) (actions ActionCollection, err error)

GetActions make a GET call for a board's actions

func (*Board) GetCards

func (b *Board) GetCards(extraArgs ...Arguments) (cards []*Card, err error)

GetCards takes Arguments and retrieves all Cards on a Board as slice or returns error.

func (*Board) GetCustomFields

func (b *Board) GetCustomFields(extraArgs ...Arguments) (customFields []*CustomField, err error)

GetCustomFields returns a slice of all receiver board's custom fields.

func (*Board) GetLabels

func (b *Board) GetLabels(extraArgs ...Arguments) (labels []*Label, err error)

GetLabels takes Arguments and returns a slice containing all labels of the receiver board or an error.

func (*Board) GetLists

func (b *Board) GetLists(extraArgs ...Arguments) (lists []*List, err error)

GetLists takes Arguments and returns the lists of the receiver Board.

func (*Board) GetMembers

func (b *Board) GetMembers(extraArgs ...Arguments) (members []*Member, err error)

GetMembers takes Arguments and returns a slice of all members of the Board or an error.

func (*Board) SetClient added in v1.9.0

func (b *Board) SetClient(newClient *Client)

SetClient can be used to override this Board's internal connection to the Trello API. Normally, this is set automatically after calls to GetBoard() from the Client. This method exists for special cases where functions which need a Client need to be called on Board structs which weren't created from a Client in the first place.

func (*Board) Update added in v1.1.0

func (b *Board) Update(extraArgs ...Arguments) error

Update PUTs the supported board attributes remote and updates the struct from the returned values.

type BoardLabelNames added in v1.10.0

type BoardLabelNames struct {
	Black  string `json:"black,omitempty"`
	Blue   string `json:"blue,omitempty"`
	Green  string `json:"green,omitempty"`
	Lime   string `json:"lime,omitempty"`
	Orange string `json:"orange,omitempty"`
	Pink   string `json:"pink,omitempty"`
	Purple string `json:"purple,omitempty"`
	Red    string `json:"red,omitempty"`
	Sky    string `json:"sky,omitempty"`
	Yellow string `json:"yellow,omitempty"`
}

type BoardPrefs added in v1.10.0

type BoardPrefs 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 []BackgroundImage `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"`
}

type BoardWebhookRequest

type BoardWebhookRequest struct {
	Model  *Board
	Action *Action
}

BoardWebhookRequest is the object sent by Trello to a Webhook for Board-triggered webhooks.

func GetBoardWebhookRequest

func GetBoardWebhookRequest(r *http.Request) (whr *BoardWebhookRequest, err error)

GetBoardWebhookRequest takes a http.Request and returns the decoded body as BoardWebhookRequest or an error.

type ByFirstEntered

type ByFirstEntered []*ListDuration

ByFirstEntered is a slice of ListDurations

func (ByFirstEntered) Len

func (durs ByFirstEntered) Len() int

ByFirstEntered returns the length of the receiver.

func (ByFirstEntered) Less

func (durs ByFirstEntered) Less(i, j int) bool

Less takes two indexes i and j and returns true exactly if the ListDuration at i was entered before j.

func (ByFirstEntered) Swap

func (durs ByFirstEntered) Swap(i, j int)

Swap takes two indexes i and j and swaps the ListDurations at the indexes.

type ByLongestDuration

type ByLongestDuration []*MemberDuration

ByLongestDuration is a slice of *MemberDuration

func (ByLongestDuration) Len

func (d ByLongestDuration) Len() int

Len returns the length of the ByLongestDuration slice.

func (ByLongestDuration) Less

func (d ByLongestDuration) Less(i, j int) bool

Less takes two indexes i and j and returns true exactly if the Duration at i is larger than the Duration at j.

func (ByLongestDuration) Swap

func (d ByLongestDuration) Swap(i, j int)

type Card

type Card struct {

	// Key metadata
	ID               string     `json:"id"`
	IDShort          int        `json:"idShort"`
	Name             string     `json:"name"`
	Pos              float64    `json:"pos"`
	Email            string     `json:"email"`
	ShortLink        string     `json:"shortLink"`
	ShortURL         string     `json:"shortUrl"`
	URL              string     `json:"url"`
	Desc             string     `json:"desc"`
	Start            *time.Time `json:"start"`
	Due              *time.Time `json:"due"`
	DueComplete      bool       `json:"dueComplete"`
	Closed           bool       `json:"closed"`
	Subscribed       bool       `json:"subscribed"`
	DateLastActivity *time.Time `json:"dateLastActivity"`

	// Board
	Board   *Board
	IDBoard string `json:"idBoard"`

	// List
	List   *List
	IDList string `json:"idList"`

	// Badges
	Badges CardBadges `json:"badges"`

	// Actions
	Actions ActionCollection `json:"actions,omitempty"`

	// Checklists
	IDCheckLists    []string          `json:"idCheckLists"`
	Checklists      []*Checklist      `json:"checklists,omitempty"`
	CheckItemStates []*CheckItemState `json:"checkItemStates,omitempty"`

	// Members
	IDMembers      []string  `json:"idMembers,omitempty"`
	IDMembersVoted []string  `json:"idMembersVoted,omitempty"`
	Members        []*Member `json:"members,omitempty"`

	// Attachments
	IDAttachmentCover     string        `json:"idAttachmentCover"`
	ManualCoverAttachment bool          `json:"manualCoverAttachment"`
	Attachments           []*Attachment `json:"attachments,omitempty"`

	Cover *CardCover `json:"cover"`

	// Labels
	IDLabels []string `json:"idLabels,omitempty"`
	Labels   []*Label `json:"labels,omitempty"`

	// Custom Fields
	CustomFieldItems []*CustomFieldItem `json:"customFieldItems,omitempty"`
	// contains filtered or unexported fields
}

Card represents the card resource. https://developers.trello.com/reference/#card-object

func (*Card) AddComment

func (c *Card) AddComment(comment string, extraArgs ...Arguments) (*Action, error)

AddComment takes a comment string and Arguments and adds the comment to the card.

func (*Card) AddFileAttachment added in v1.10.0

func (c *Card) AddFileAttachment(attachment *Attachment, filename string, file io.Reader, extraArgs ...Arguments) error

AddFileAttachment takes an Attachment, filename with io.Reader and adds it to the card.

func (*Card) AddIDLabel

func (c *Card) AddIDLabel(labelID string) error

AddIDLabel receives a label id and adds the corresponding label or returns an error.

func (*Card) AddMemberID

func (c *Card) AddMemberID(memberID string) (member []*Member, err error)

AddMemberID receives a member id and adds the corresponding member to the card. Returns a list of the card's members or an error.

func (*Card) AddURLAttachment

func (c *Card) AddURLAttachment(attachment *Attachment, extraArgs ...Arguments) error

AddURLAttachment takes an Attachment and adds it to the card.

func (*Card) Archive added in v1.8.0

func (c *Card) Archive() error

Archive archives the card.

func (*Card) CopyToList

func (c *Card) CopyToList(listID string, extraArgs ...Arguments) (*Card, error)

CopyToList takes a list id and Arguments and returns the matching Card. The following Arguments are supported.

Arguments["keepFromSource"] = "all" Arguments["keepFromSource"] = "none" Arguments["keepFromSource"] = "attachments,checklists,comments"

func (*Card) CreatedAt

func (c *Card) CreatedAt() time.Time

CreatedAt returns the receiver card's created-at attribute as time.Time.

func (*Card) CreatorMember

func (c *Card) CreatorMember() (*Member, error)

CreatorMember returns the member of the card who created it or and error. The creator is the member who is associated with the card's first action.

func (*Card) CreatorMemberID

func (c *Card) CreatorMemberID() (string, error)

CreatorMemberID returns as string the id of the member who created the card or an error. The creator is the member who is associated with the card's first action.

func (*Card) CustomFields

func (c *Card) CustomFields(boardCustomFields []*CustomField) map[string]interface{}

CustomFields returns the card's custom fields.

func (*Card) Delete added in v1.8.0

func (c *Card) Delete() error

Delete deletes the card.

func (*Card) GetActions

func (c *Card) GetActions(extraArgs ...Arguments) (actions ActionCollection, err error)

GetActions makes a GET for a card's actions

func (*Card) GetAncestorCards

func (c *Card) GetAncestorCards(extraArgs ...Arguments) (ancestors []*Card, err error)

GetAncestorCards takes Arguments, GETs the card's ancestors and returns them as a slice.

func (*Card) GetAttachments added in v1.10.0

func (c *Card) GetAttachments(args Arguments) (attachments []*Attachment, err error)

GetAttachments returns all attachments for a card

func (*Card) GetCommentActions added in v1.8.0

func (c *Card) GetCommentActions() (actions ActionCollection, err error)

GetCommentActions return only comment actions

func (*Card) GetLastCommentAction added in v1.8.0

func (c *Card) GetLastCommentAction() (*Action, error)

GetLastCommentAction return only last comment action

func (*Card) GetListChangeActions

func (c *Card) GetListChangeActions() (actions ActionCollection, err error)

GetListChangeActions retrieves a slice of Actions which resulted in changes to the card's active List. This includes the createCard and copyCard action (which place the card in its first list), and the updateCard:closed action (which remove it from its last list).

This function is just an alias for:

card.GetActions(Arguments{"filter": "createCard,copyCard,updateCard:idList,updateCard:closed", "limit": "1000"})

func (*Card) GetListDurations

func (c *Card) GetListDurations() (durations []*ListDuration, err error)

GetListDurations analyses a Card's actions to figure out how long it was in each List. It returns a slice of the ListDurations, one Duration per list, or an error.

func (*Card) GetMemberDurations

func (c *Card) GetMemberDurations() (durations []*MemberDuration, err error)

GetMemberDurations returns a slice containing all durations of a card.

func (*Card) GetMembers

func (c *Card) GetMembers(extraArgs ...Arguments) (members []*Member, err error)

GetMembers takes Arguments and returns a slice of all members of the Card or an error.

func (*Card) GetMembershipChangeActions

func (c *Card) GetMembershipChangeActions() (actions ActionCollection, err error)

GetMembershipChangeActions makes a GET call for a card's membership-change actions

func (*Card) GetOriginatingCard

func (c *Card) GetOriginatingCard(extraArgs ...Arguments) (*Card, error)

GetOriginatingCard takes Arguments, GETs ancestors and returns most recent ancestor card of the Card.

func (*Card) GetParentCard

func (c *Card) GetParentCard(extraArgs ...Arguments) (*Card, error)

GetParentCard retrieves the originating Card if the Card was created from a copy of another Card. Returns an error only when a low-level failure occurred. If this Card has no parent, a nil card and nil error are returned. In other words, the non-existence of a parent is not treated as an error.

func (*Card) MoveToBottomOfList

func (c *Card) MoveToBottomOfList() error

MoveToBottomOfList moves the card to the bottom of its list.

func (*Card) MoveToList

func (c *Card) MoveToList(listID string, extraArgs ...Arguments) error

MoveToList moves a card to a list given by listID.

func (*Card) MoveToTopOfList

func (c *Card) MoveToTopOfList() error

MoveToTopOfList moves the card to the top of it's list.

func (*Card) RemoveIDLabel

func (c *Card) RemoveIDLabel(labelID string, label *Label) error

RemoveIDLabel removes a label id from the card.

func (*Card) RemoveMember

func (c *Card) RemoveMember(memberID string) error

RemoveMember receives the id of a member and removes the corresponding member from the card.

func (*Card) SetClient added in v1.9.0

func (c *Card) SetClient(newClient *Client)

SetClient can be used to override this Card's internal connection to the Trello API. Normally, this is set automatically after calls to GetCard() from the Client or a List. This method is public to allow for situations where a Card which wasn't created from an API call to be used as the basis for other API calls. All nested structs (Actions, Attachments, Checklists, etc) also have their client properties updated.

func (*Card) SetPos

func (c *Card) SetPos(newPos float64) error

SetPos sets a card's new position.

func (*Card) Unarchive added in v1.8.0

func (c *Card) Unarchive() error

Unarchive unarchives the card.

func (*Card) Update

func (c *Card) Update(extraArgs ...Arguments) error

Update UPDATEs the card's attributes.

type CardBadges added in v1.10.0

type CardBadges struct {
	Votes              int        `json:"votes"`
	ViewingMemberVoted bool       `json:"viewingMemberVoted"`
	Subscribed         bool       `json:"subscribed"`
	Fogbugz            string     `json:"fogbugz,omitempty"`
	CheckItems         int        `json:"checkItems"`
	CheckItemsChecked  int        `json:"checkItemsChecked"`
	Comments           int        `json:"comments"`
	Attachments        int        `json:"attachments"`
	Description        bool       `json:"description"`
	Due                *time.Time `json:"due,omitempty"`
}

type CardCover added in v1.11.0

type CardCover struct {
	IDAttachment         string                    `json:"idAttachment"`
	Color                string                    `json:"color"`
	IDUploadedBackground string                    `json:"idUploadedBackground"`
	Size                 string                    `json:"size"`
	Brightness           string                    `json:"brightness"`
	Scaled               []*CardCoverScaledVariant `json:"scaled"`
	EdgeColor            string                    `json:"edgeColor"`
	SharedSourceURL      string                    `json:"sharedSourceUrl"`
}

type CardCoverScaledVariant added in v1.11.0

type CardCoverScaledVariant struct {
	ID     string `json:"id"`
	Scaled bool   `json:"scaled"`
	URL    string `json:"url"`
	Bytes  int    `json:"bytes"`
	Height int    `json:"height"`
	Width  int    `json:"width"`
}

type CardWebhookRequest

type CardWebhookRequest struct {
	Model  *Card
	Action *Action
}

CardWebhookRequest is the object sent by Trello to a Webhook for Card-triggered webhooks.

func GetCardWebhookRequest

func GetCardWebhookRequest(r *http.Request) (whr *CardWebhookRequest, err error)

GetCardWebhookRequest takes a http.Request and returns the decoded Body as CardWebhookRequest or an error.

type CheckItem

type CheckItem struct {
	ID          string     `json:"id"`
	Name        string     `json:"name"`
	State       string     `json:"state"`
	IDChecklist string     `json:"idChecklist,omitempty"`
	Checklist   *Checklist `json:"-"`
	Pos         float64    `json:"pos,omitempty"`
	// contains filtered or unexported fields
}

CheckItem is a nested resource representing an item in Checklist.

func (*CheckItem) SetClient added in v1.10.0

func (ci *CheckItem) SetClient(newClient *Client)

SetClient can be used to override this CheckItem's internal connection to the Trello API. Normally, this is set automatically after API calls.

type CheckItemState

type CheckItemState struct {
	IDCheckItem string `json:"idCheckItem"`
	State       string `json:"state"`
}

CheckItemState represents a CheckItem when it appears in CheckItemStates on a Card.

type Checklist

type Checklist struct {
	ID         string      `json:"id"`
	Name       string      `json:"name"`
	IDBoard    string      `json:"idBoard,omitempty"`
	IDCard     string      `json:"idCard,omitempty"`
	Card       *Card       `json:"-"`
	Pos        float64     `json:"pos,omitempty"`
	CheckItems []CheckItem `json:"checkItems,omitempty"`
	// contains filtered or unexported fields
}

Checklist represents Trello card's checklists. A card can have one zero or more checklists. https://developers.trello.com/reference/#checklist-object

func (*Checklist) CreateCheckItem

func (cl *Checklist) CreateCheckItem(name string, extraArgs ...Arguments) (item *CheckItem, err error)

CreateCheckItem creates a checkitem inside the checklist. Attribute currently supported as extra argument: pos. Attributes currently known to be unsupported: checked.

API Docs: https://developers.trello.com/reference#checklistsidcheckitems

func (*Checklist) SetClient added in v1.10.0

func (cl *Checklist) SetClient(newClient *Client)

SetClient can be used to override this Checklist's internal connection to the Trello API. Normally, this is set automatically after API calls.

type Client

type Client struct {
	Client  *http.Client
	Logger  logger
	BaseURL string
	Key     string
	Token   string
	// contains filtered or unexported fields
}

Client is the central object for making API calls. It wraps a http client, context, logger and identity configuration (Key and Token) of the Trello member.

func NewClient

func NewClient(key, token string) *Client

NewClient is a constructor for the Client. It takes the key and token credentials of a Trello member to authenticate and authorise requests with.

func (*Client) CreateBoard

func (c *Client) CreateBoard(board *Board, extraArgs ...Arguments) error

CreateBoard creates a board remote. Attribute currently supported as extra argument: defaultLists, powerUps. Attributes currently known to be unsupported: idBoardSource, keepFromSource.

API Docs: https://developers.trello.com/reference/#boardsid

func (*Client) CreateCard

func (c *Client) CreateCard(card *Card, extraArgs ...Arguments) error

CreateCard takes a Card and Arguments and POSTs the card.

func (*Client) CreateCheckItem

func (c *Client) CreateCheckItem(checklist *Checklist, name string, extraArgs ...Arguments) (item *CheckItem, err error)

CreateCheckItem creates a checkitem inside the given checklist. Attribute currently supported as extra argument: pos. Attributes currently known to be unsupported: checked.

API Docs: https://developers.trello.com/reference#checklistsidcheckitems

func (*Client) CreateChecklist

func (c *Client) CreateChecklist(card *Card, name string, extraArgs ...Arguments) (checklist *Checklist, err error)

CreateChecklist creates a checklist. Attribute currently supported as extra argument: pos. Attributes currently known to be unsupported: idChecklistSource.

API Docs: https://developers.trello.com/reference#cardsidchecklists-1

func (*Client) CreateList

func (c *Client) CreateList(onBoard *Board, name string, extraArgs ...Arguments) (list *List, err error)

CreateList creates a list. Attribute currently supported as extra argument: pos. Attributes currently known to be unsupported: idListSource.

API Docs: https://developers.trello.com/reference/#lists-1

func (*Client) CreateWebhook

func (c *Client) CreateWebhook(webhook *Webhook) error

CreateWebhook takes a Webhook, POSTs it and returns an error object.

func (*Client) Delete

func (c *Client) Delete(path string, args Arguments, target interface{}) error

Delete takes a path, Arguments, and a target interface (e.g. Board or Card). It runs a DELETE request on the Trello API endpoint with the path and uses the Arguments as URL parameters. Then it returns either the target interface updated from the response or an error.

func (*Client) Get

func (c *Client) Get(path string, args Arguments, target interface{}) error

Get takes a path, Arguments, and a target interface (e.g. Board or Card). It runs a GET request on the Trello API endpoint and the path and uses the Arguments as URL parameters. Then it returns either the target interface updated from the response or an error.

func (*Client) GetBoard

func (c *Client) GetBoard(boardID string, extraArgs ...Arguments) (board *Board, err error)

GetBoard retrieves a Trello board by its ID.

func (*Client) GetBoardsInOrganization added in v1.10.0

func (c *Client) GetBoardsInOrganization(orgID string, extraArgs ...Arguments) (boards []*Board, err error)

GetBoardsInOrganization takes an organization id and Arguments and either GET returns a slice of boards within that organization, or an error.

func (*Client) GetCard

func (c *Client) GetCard(cardID string, extraArgs ...Arguments) (card *Card, err error)

GetCard receives a card id and Arguments and returns the card if found with the credentials given for the receiver Client. Returns an error otherwise.

func (*Client) GetChecklist added in v1.9.0

func (c *Client) GetChecklist(checklistID string, args Arguments) (checklist *Checklist, err error)

GetChecklist receives a checklist id and Arguments and returns the checklist if found with the credentials given for the receiver Client. Returns an error otherwise.

func (*Client) GetCustomField

func (c *Client) GetCustomField(fieldID string, extraArgs ...Arguments) (customField *CustomField, err error)

GetCustomField takes a field id string and Arguments and returns the matching custom Field.

func (*Client) GetLabel

func (c *Client) GetLabel(labelID string, extraArgs ...Arguments) (label *Label, err error)

GetLabel takes a label id and Arguments and returns the matching label (per Trello member) or an error.

func (*Client) GetList

func (c *Client) GetList(listID string, extraArgs ...Arguments) (list *List, err error)

GetList takes a list's id and Arguments and returns the matching list.

func (*Client) GetMember

func (c *Client) GetMember(memberID string, extraArgs ...Arguments) (member *Member, err error)

GetMember takes a member id and Arguments and returns a Member or an error.

func (*Client) GetMyBoards

func (c *Client) GetMyBoards(extraArgs ...Arguments) (boards []*Board, err error)

GetMyBoards returns a slice of all boards associated with the credentials set on the client.

func (*Client) GetMyMember added in v1.9.0

func (c *Client) GetMyMember(args Arguments) (member *Member, err error)

GetMyMember returns Member for the user authenticating the API call

func (*Client) GetMyNotifications

func (c *Client) GetMyNotifications(extraArgs ...Arguments) (notifications []*Notification, err error)

GetMyNotifications returns the notifications of the authenticated user

func (*Client) GetOrganization

func (c *Client) GetOrganization(orgID string, extraArgs ...Arguments) (organization *Organization, err error)

GetOrganization takes an organization id and Arguments and either GETs returns an Organization, or an error.

func (*Client) GetToken

func (c *Client) GetToken(tokenID string, extraArgs ...Arguments) (token *Token, err error)

GetToken takes a token id and Arguments and GETs and returns the Token or an error.

func (*Client) GetWebhook

func (c *Client) GetWebhook(webhookID string, extraArgs ...Arguments) (webhook *Webhook, err error)

GetWebhook takes a webhook id and Arguments, GETs the matching Webhook and returns it or an error.

func (*Client) Post

func (c *Client) Post(path string, args Arguments, target interface{}) error

Post takes a path, Arguments, and a target interface (e.g. Board or Card). It runs a POST request on the Trello API endpoint with the path and uses the Arguments as URL parameters. Then it returns either the target interface updated from the response or an error.

func (*Client) PostWithBody added in v1.10.0

func (c *Client) PostWithBody(path string, args Arguments, target interface{}, filename string, file io.Reader) error

PostWithBody takes a path, Arguments, and a target interface (e.g. Board or Card). It runs a POST request on the Trello API endpoint with the path and uses the Arguments as URL parameters, takes file io.Reader and put to multipart body. Then it returns either the target interface updated from the response or an error.

func (*Client) Put

func (c *Client) Put(path string, args Arguments, target interface{}) error

Put takes a path, Arguments, and a target interface (e.g. Board or Card). It runs a PUT request on the Trello API endpoint with the path and uses the Arguments as URL parameters. Then it returns either the target interface updated from the response or an error.

func (*Client) PutBoard added in v1.1.0

func (c *Client) PutBoard(board *Board, extraArgs ...Arguments) error

PutBoard PUTs a board remote. Extra arguments are currently unsupported.

API Docs: https://developers.trello.com/reference#idnext

func (*Client) SearchBoards

func (c *Client) SearchBoards(query string, extraArgs ...Arguments) (boards []*Board, err error)

SearchBoards takes a query string and Arguments and returns a slice of Boards or an error.

func (*Client) SearchCards

func (c *Client) SearchCards(query string, extraArgs ...Arguments) (cards []*Card, err error)

SearchCards takes a query string and Arguments and returns a slice of Cards or an error.

func (*Client) SearchMembers

func (c *Client) SearchMembers(query string, extraArgs ...Arguments) (members []*Member, err error)

SearchMembers takes a query string and Arguments and returns a slice of Members or an error.

func (*Client) Throttle

func (c *Client) Throttle()

Throttle starts receiving throttles from throttle channel each ticker period.

func (*Client) WithContext

func (c *Client) WithContext(ctx context.Context) *Client

WithContext takes a context.Context, sets it as context on the client and returns a Client pointer.

type CustomField

type CustomField struct {
	ID          string `json:"id"`
	IDModel     string `json:"idModel"`
	IDModelType string `json:"modelType,omitempty"`
	FieldGroup  string `json:"fieldGroup"`
	Name        string `json:"name"`
	Pos         int    `json:"pos"`
	Display     struct {
		CardFront bool `json:"cardfront"`
	} `json:"display"`
	Type    string               `json:"type"`
	Options []*CustomFieldOption `json:"options"`
}

CustomField represents Trello's custom fields: "extra bits of structured data attached to cards when our users need a bit more than what Trello provides." https://developers.trello.com/reference/#custom-fields

type CustomFieldItem

type CustomFieldItem struct {
	ID            string           `json:"id,omitempty"`
	Value         CustomFieldValue `json:"value,omitempty"`
	IDValue       string           `json:"idValue,omitempty"`
	IDCustomField string           `json:"idCustomField,omitempty"`
	IDModel       string           `json:"idModel,omitempty"`
	IDModelType   string           `json:"modelType,omitempty"`
}

CustomFieldItem represents the custom field items of Trello a trello card.

type CustomFieldOption

type CustomFieldOption struct {
	ID            string `json:"id"`
	IDCustomField string `json:"idCustomField"`
	Value         struct {
		Text string `json:"text"`
	} `json:"value"`
	Color string `json:"color,omitempty"`
	Pos   int    `json:"pos"`
}

CustomFieldOption are nested resources of CustomFields

type CustomFieldValue added in v1.6.0

type CustomFieldValue struct {
	// contains filtered or unexported fields
}

CustomFieldValue represents the custom field value struct

func NewCustomFieldValue added in v1.6.0

func NewCustomFieldValue(val interface{}) CustomFieldValue

NewCustomFieldValue the custom field constructor

func (CustomFieldValue) Get added in v1.6.0

func (v CustomFieldValue) Get() interface{}

Get the custom field value getter

func (CustomFieldValue) MarshalJSON added in v1.6.0

func (v CustomFieldValue) MarshalJSON() ([]byte, error)

MarshalJSON the custom field marchaller

func (CustomFieldValue) String added in v1.6.0

func (v CustomFieldValue) String() string

String the custom field String method

func (*CustomFieldValue) UnmarshalJSON added in v1.6.0

func (v *CustomFieldValue) UnmarshalJSON(b []byte) error

UnmarshalJSON the custom field umarshaller

type Label

type Label struct {
	ID      string `json:"id"`
	IDBoard string `json:"idBoard"`
	Name    string `json:"name"`
	Color   string `json:"color"`
	Uses    int    `json:"uses"`
	// contains filtered or unexported fields
}

Label represents a Trello label. Labels are defined per board, and can be applied to the cards on that board. https://developers.trello.com/reference/#label-object

func (*Label) SetClient added in v1.10.0

func (l *Label) SetClient(newClient *Client)

SetClient can be used to override this Label's internal connection to the Trello API. Normally, this is set automatically after API calls.

type List

type List struct {
	ID         string  `json:"id"`
	Name       string  `json:"name"`
	IDBoard    string  `json:"idBoard,omitempty"`
	Closed     bool    `json:"closed"`
	Pos        float32 `json:"pos,omitempty"`
	Subscribed bool    `json:"subscribed"`
	Board      *Board  `json:"board,omitempty"`
	Cards      []*Card `json:"cards,omitempty"`
	// contains filtered or unexported fields
}

List represents Trello lists. https://developers.trello.com/reference/#list-object

func ListAfterAction

func ListAfterAction(a *Action) *List

ListAfterAction calculates which List the card ended up in after this action completed. Returns nil when the action resulted in the card being archived (in which case we consider it to not be in a list anymore), or when the action isn't related to a list at all (in which case this is a nonsensical question to ask).

func (*List) AddCard

func (l *List) AddCard(card *Card, extraArgs ...Arguments) error

AddCard takes a Card and Arguments and adds the card to the receiver list.

func (*List) Archive added in v1.10.0

func (l *List) Archive() error

Archive archives the list.

func (*List) CreatedAt

func (l *List) CreatedAt() time.Time

CreatedAt returns the time.Time from the list's id.

func (*List) GetActions

func (l *List) GetActions(extraArgs ...Arguments) (actions ActionCollection, err error)

GetActions makes a GET call for a list's actions

func (*List) GetCards

func (l *List) GetCards(extraArgs ...Arguments) (cards []*Card, err error)

GetCards retrieves all Cards in a List or an error if something goes wrong.

func (*List) SetClient added in v1.9.0

func (l *List) SetClient(newClient *Client)

SetClient can be used to override this List's internal connection to the Trello API. Normally, this is set automatically after calls to GetList() from the Client. This method exists for special cases where functions which need a Client need to be called on List structs which weren't created from a Client in the first place.

func (*List) Unarchive added in v1.10.0

func (l *List) Unarchive() error

Unarchive unarchives the list.

func (*List) Update added in v1.1.0

func (l *List) Update(extraArgs ...Arguments) error

Update UPDATEs the list's attributes. API Docs: https://developers.trello.com/reference/#listsid-1

type ListDuration

type ListDuration struct {
	ListID       string
	ListName     string
	Duration     time.Duration
	FirstEntered time.Time
	TimesInList  int
}

ListDuration represents the time a Card has been or was in list.

func (*ListDuration) AddDuration

func (l *ListDuration) AddDuration(d time.Duration)

AddDuration takes a duration and adds it to the ListDuration's Duration. Also increments TimesInList.

type ListWebhookRequest

type ListWebhookRequest struct {
	Model  *List
	Action *Action
}

ListWebhookRequest is the object sent by Trello to a Webhook for List-triggered webhooks.

func GetListWebhookRequest

func GetListWebhookRequest(r *http.Request) (whr *ListWebhookRequest, err error)

GetListWebhookRequest takes a http.Request and returns the decoded Body as ListWebhookRequest or an error.

type Member

type Member struct {
	ID              string   `json:"id"`
	Username        string   `json:"username"`
	FullName        string   `json:"fullName"`
	Initials        string   `json:"initials"`
	AvatarHash      string   `json:"avatarHash"`
	Email           string   `json:"email"`
	IDBoards        []string `json:"idBoards"`
	IDOrganizations []string `json:"idOrganizations"`
	// contains filtered or unexported fields
}

Member represents a Trello member. https://developers.trello.com/reference/#member-object

func (*Member) GetBoards

func (m *Member) GetBoards(extraArgs ...Arguments) (boards []*Board, err error)

GetBoards returns a slice of all public boards of the receiver Member.

func (*Member) SetClient added in v1.10.0

func (m *Member) SetClient(newClient *Client)

SetClient can be used to override this Member's internal connection to the Trello API. Normally, this is set automatically after API calls.

type MemberDuration

type MemberDuration struct {
	MemberID   string
	MemberName string
	FirstAdded time.Time
	Duration   time.Duration
	// contains filtered or unexported fields
}

MemberDuration is used to track the periods of time which a user (member) is attached to a card.

type Membership added in v1.7.0

type Membership struct {
	ID          string `json:"id"`
	MemberID    string `json:"idMember"`
	Type        string `json:"memberType"`
	Unconfirmed bool   `json:"unconfirmed"`
	Deactivated bool   `json:"deactivated"`
}

Membership represents a Trello membership. https://developers.trello.com/reference#memberships-nested-resource

type Notification

type Notification struct {
	ID              string           `json:"id"`
	IDAction        string           `json:"idAction"`
	Unread          bool             `json:"unread"`
	Type            string           `json:"type"`
	IDMemberCreator string           `json:"idMemberCreator"`
	Date            time.Time        `json:"date"`
	DateRead        time.Time        `json:"dataRead"`
	Data            NotificationData `json:"data,omitempty"`
	MemberCreator   *Member          `json:"memberCreator,omitempty"`
	// contains filtered or unexported fields
}

Notification represents a Trello Notification. https://developers.trello.com/reference/#notifications

func (*Notification) SetClient added in v1.10.0

func (n *Notification) SetClient(newClient *Client)

SetClient can be used to override this Notification's internal connection to the Trello API. Normally, this is set automatically after API calls.

type NotificationData

type NotificationData struct {
	Text  string                 `json:"text"`
	Card  *NotificationDataCard  `json:"card,omitempty"`
	Board *NotificationDataBoard `json:"board,omitempty"`
}

NotificationData represents the 'notificaiton.data'

type NotificationDataBoard

type NotificationDataBoard struct {
	ID        string `json:"id"`
	ShortLink string `json:"shortLink"`
	Name      string `json:"name"`
}

NotificationDataBoard represents the 'notification.data.board'

type NotificationDataCard

type NotificationDataCard struct {
	ID        string `json:"id"`
	IDShort   int    `json:"idShort"`
	Name      string `json:"name"`
	ShortLink string `json:"shortLink"`
}

NotificationDataCard represents the 'notification.data.card'

type Organization

type Organization struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
	Desc        string `json:"desc"`
	URL         string `json:"url"`
	Website     string `json:"website"`
	Products    []int  `json:"products"`
	PowerUps    []int  `json:"powerUps"`
	// contains filtered or unexported fields
}

Organization represents a Trello organization or team, i.e. a collection of members and boards. https://developers.trello.com/reference/#organizations

func (*Organization) GetMembers

func (o *Organization) GetMembers(extraArgs ...Arguments) (members []*Member, err error)

GetMembers takes Arguments and returns a slice of all members of the organization or an error.

func (*Organization) SetClient added in v1.10.0

func (o *Organization) SetClient(newClient *Client)

SetClient can be used to override this Organization's internal connection to the Trello API. Normally, this is set automatically after API calls.

type Permission

type Permission struct {
	IDModel   string `json:"idModel"`
	ModelType string `json:"modelType"`
	Read      bool   `json:"read"`
	Write     bool   `json:"write"`
}

Permission represent a Token's permissions.

type SearchModifier

type SearchModifier struct {
	Text string `json:"text"`
}

SearchModifier is wrapper for a search string.

type SearchOptions

type SearchOptions struct {
	Terms      []SearchTerm     `json:"terms"`
	Modifiers  []SearchModifier `json:"modifiers,omitempty"`
	ModelTypes []string         `json:"modelTypes,omitempty"`
	Partial    bool             `json:"partial"`
}

SearchOptions contains options for search requests.

type SearchResult

type SearchResult struct {
	Options SearchOptions `json:"options"`
	Actions []*Action     `json:"actions,omitempty"`
	Cards   []*Card       `json:"cards,omitempty"`
	Boards  []*Board      `json:"boards,omitempty"`
	Members []*Member     `json:"members,omitempty"`
}

SearchResult represents a search result as collections of various types returned by a search, e.g. Cards or Boards.

type SearchTerm

type SearchTerm struct {
	Text    string `json:"text"`
	Negated bool   `json:"negated,omitempty"`
}

SearchTerm is a string that may be negated in a search query.

type Token

type Token struct {
	ID          string       `json:"id"`
	DateCreated time.Time    `json:"dateCreated"`
	DateExpires *time.Time   `json:"dateExpires"`
	IDMember    string       `json:"idMember"`
	Identifier  string       `json:"identifier"`
	Permissions []Permission `json:"permissions"`
	// contains filtered or unexported fields
}

Token represents Trello tokens. Tokens can be used for setting up Webhooks among other things. https://developers.trello.com/reference/#tokens

func (*Token) GetWebhooks

func (t *Token) GetWebhooks(extraArgs ...Arguments) (webhooks []*Webhook, err error)

GetWebhooks takes Arguments and returns a list of all Webhooks for the receiver Token or an error.

func (*Token) SetClient added in v1.10.0

func (t *Token) SetClient(newClient *Client)

SetClient can be used to override this Token's internal connection to the Trello API. Normally, this is set automatically after API calls.

type Webhook

type Webhook struct {
	ID          string `json:"id,omitempty"`
	IDModel     string `json:"idModel"`
	Description string `json:"description"`
	CallbackURL string `json:"callbackURL"`
	Active      bool   `json:"active"`
	// contains filtered or unexported fields
}

Webhook is the Go representation of a webhook registered in Trello's systems. Used when creating, modifying or deleting webhooks. https://developers.trello.com/reference/#webhook-object

func (*Webhook) Delete

func (w *Webhook) Delete(extraArgs ...Arguments) error

Delete takes a webhook and deletes it

func (*Webhook) SetClient added in v1.10.0

func (w *Webhook) SetClient(newClient *Client)

SetClient can be used to override this Webhook's internal connection to the Trello API. Normally, this is set automatically after API calls.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL