trello

package
v0.0.0-...-30f42cf Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package trello provides a client to interact with the Trello API

Index

Constants

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

APIBaseURL is the base URL for the Trello API

View Source
const BoardBaseURL = "https://trello.com/b/"

BoardBaseURL is the base URL for Trello boards

Variables

This section is empty.

Functions

func BoardPath

func BoardPath(boardID string) string

BoardPath returns the path on the Trello API server where a board can be queried

func CardsOnListPath

func CardsOnListPath(listID string) string

CardsOnListPath returns the path on the Trello API server where cards on a list can be queried

func ListsOnBoardPath

func ListsOnBoardPath(boardID string) string

ListsOnBoardPath returns the path on the Trello API server where lists on a board can be queried

func OwnedCardsPath

func OwnedCardsPath() string

OwnedCardsPath returns the path on the Trello API server where a list of owned cards can be queried

func TeardownMockServer

func TeardownMockServer()

TeardownMockServer will remove the mock server so HTTP responses will behave normally

Types

type BackgroundImage

type BackgroundImage struct {
	URL url.URL `json:"-"`
}

BackgroundImage represents the background image of a Trello board returned via the API

func (*BackgroundImage) UnmarshalJSON

func (b *BackgroundImage) UnmarshalJSON(data []byte) error

UnmarshalJSON converts JSON data into a BackgroundImage

type Board

type Board struct {
	ID          string      `json:"id"`
	Name        string      `json:"name"`
	Preferences Preferences `json:"prefs"`
}

Board represents a Trello board returned via the API

type Card

type Card struct {
	ID      string     `json:"id"`
	Name    string     `json:"name"`
	DueBy   *time.Time `json:"due"`
	URL     url.URL    `json:"-"`
	BoardID string     `json:"idBoard"`
}

Card represents a Trello card returned via the API

func (*Card) UnmarshalJSON

func (c *Card) UnmarshalJSON(data []byte) error

UnmarshalJSON converts JSON data into a Card

type Client

type Client struct {
	Key   string
	Token string
}

Client is used to interact with the Trello API

func (*Client) CardsOnList

func (c *Client) CardsOnList(listID string) ([]Card, error)

CardsOnList will return the cards on the specified list

func (*Client) GetBoard

func (c *Client) GetBoard(boardID string) (*Board, error)

GetBoard will return the board with the specified ID

func (*Client) ListsOnBoard

func (c *Client) ListsOnBoard(boardID string) ([]List, error)

ListsOnBoard will return the lists on the specified board

func (*Client) OwnedCards

func (c *Client) OwnedCards() ([]Card, error)

OwnedCards will return the cards this user is a member of

type List

type List struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

List represents a Trello list returned via the API

type MockServer

type MockServer struct {
	Key   string
	Token string
}

MockServer allows configuring mock responses from a Trello server

func CreateMockServer

func CreateMockServer(key, token string) *MockServer

CreateMockServer will create and activate a mock server

func (*MockServer) AddFileResponse

func (m *MockServer) AddFileResponse(urlPath, filePath string)

AddFileResponse will return the contents of the specified file when the specified path on the mock server is requested

type Preferences

type Preferences struct {
	BackgroundImages []BackgroundImage `json:"backgroundImageScaled"`
}

Preferences represents the preferences for a Trello board returned via the API

Jump to

Keyboard shortcuts

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