1// Copyright © 2016 Aaron Longwell 2// 3// Use of this source code is governed by an MIT licese. 4// Details in the LICENSE file. 5 6package trello 7 8import "fmt" 9 10// Label represents a Trello label. 11// Labels are defined per board, and can be applied to the cards on that board. 12// https://developers.trello.com/reference/#label-object 13type Label struct { 14 ID string `json:"id"` 15 IDBoard string `json:"idBoard"` 16 Name string `json:"name"` 17 Color string `json:"color"` 18 Uses int `json:"uses"` 19} 20 21// GetLabel takes a label id and Arguments and returns the matching label (per Trello member) 22// or an error. 23func (c *Client) GetLabel(labelID string, args Arguments) (label *Label, err error) { 24 path := fmt.Sprintf("labels/%s", labelID) 25 err = c.Get(path, args, &label) 26 return 27} 28 29// GetLabels takes Arguments and returns a slice containing all labels of the receiver board or an error. 30func (b *Board) GetLabels(args Arguments) (labels []*Label, err error) { 31 path := fmt.Sprintf("boards/%s/labels", b.ID) 32 err = b.client.Get(path, args, &labels) 33 return 34} 35