glo

package module
v0.0.0-...-66faa62 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2019 License: MIT Imports: 9 Imported by: 0

README

go-glo

GoDoc Build Status Go Report Card

A library to help interact with GitKraken Glo Boards API

Supported Endpoints & Features

API Endpoints:

This package supports the following v1 Glo Boards API endpoints

Boards

  • Create Board
  • Edit Board
  • Delete Board
  • Get Boards
  • Get Boards by ID

Columns

  • Create column
  • Edit column
  • Delete column

Cards

  • Create Card
  • Edit Card
  • Delete Card
  • Get Cards
  • Get Card By ID
  • Get Cards By Column ID

Attachments

  • Create Attachment
  • Get Attachments

Comments

  • Create Comment
  • Edit Comment
  • Delete Comment
  • Get Comments By Card ID

User

  • Get User

Installing

go get github.com/jackmcguire1/go-glo

Example

package main

import (
	"log"
	"os"

	"github.com/jackmcguire1/go-glo"
)

var token string

func init() {
	token = os.Getenv("TOKEN")
}

func main() {
	client := glo.NewClient(token)
	user, err := client.GetUser()
	if err != nil {
		log.Fatal(err)
	}

	log.Println(user.ID, user.Name, user.Username, user.Email)
}

Development

To develop go-glo or interact with its source code in any meaningful way, be sure you have the following installed:

Prerequisites

You will need to activate Modules for your version of Go, generally by invoking go with the support GO111MODULE=on environment variable set.

FAQ

Please refer to Git Kraken Documentation for any further reading.

License

The source code for go-glo is released under the MIT License.

Donations

All donations are appreciated!

Donate

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	BaseAttachment
	CreatedDate string       `json:"created_date"`
	CreatedBy   *PartialUser `json:"created_by"`
}

Attachment contains the information related to an attachment.

type AttachmentsResp

type AttachmentsResp struct {
	HasMore     bool          `json:"has_more"`
	Attachments []*Attachment `json:"attachments"`
}

AttachmentsResp contains a list of attachments and if further pagination calls are available.

type BaseAttachment

type BaseAttachment struct {
	ID       string `json:"id"`
	Filename string `json:"filename"`
	MimeType string `json:"mime_type"`
}

BaseAttachment contains generic attachment details

type Board

type Board struct {
	ID              string         `json:"id"`
	Name            string         `json:"name"`
	Columns         []*Column      `json:"columns"`
	ArchivedColumns []*Column      `json:"archived_columns"`
	InvitedMembers  []*BoardMember `json:"invited_members"`
	Members         []*BoardMember `json:"members"`
	ArchivedDate    string         `json:"archived_date"`
	CreatedDate     string         `json:"created_date"`
	CreatedBy       *PartialUser   `json:"created_by"`
	Labels          []*Label       `json:"labels"`
}

Board contains the information related to a board

type BoardInput

type BoardInput struct {
	Name string `json:"name"`
}

BoardInput contains information used to create or edit a Board

type BoardMember

type BoardMember struct {
	ID       string `json:"id"`
	Role     string `json:"role"`
	Username string `json:"username,omitempty"`
}

BoardMember contains information related to a Board Member

type BoardsResp

type BoardsResp struct {
	HasMore bool     `json:"has_more"`
	Boards  []*Board `json:"boards"`
}

BoardsResp contains a list of boards and if further pagination calls are available

type Card

type Card struct {
	ID                 string          `json:"id"`
	Name               string          `json:"name"`
	Position           int             `json:"position"`
	Description        *Description    `json:"Description"`
	BoardID            string          `json:"board_id"`
	ColumnID           string          `json:"column_id"`
	CreatedDate        string          `json:"created_date"`
	UpdatedDate        string          `json:"updated_date"`
	ArchivedDate       string          `json:"archived_date"`
	Assignees          []*PartialUser  `json:"assignees"`
	Labels             []*PartialLabel `json:"labels"`
	DueDate            string          `json:"due_date"`
	CommentCount       int             `json:"comment_count"`
	AttachmentCount    int             `json:"attachment_count"`
	CompletedTaskCount int             `json:"completed_task_count"`
	TotalTaskCount     int             `json:"total_task_count"`
	CreatedBy          *PartialUser    `json:"created_by"`
}

Card contains information related to a card

type CardsInput

type CardsInput struct {
	Name        string                `json:"name"`
	Position    int                   `json:"position"`
	Description *MinimizedDescription `json:"description"`
	ColumnID    string                `json:"column_id"`
	Assignees   []*PartialUser        `json:"assignees"`
	Labels      []*PartialLabel       `json:"labels"`
	DueDate     string                `json:"due_date"`
}

CardsInput contains information used to create or edit a card

type CardsResp

type CardsResp struct {
	Cards   []*Card `json:"cards"`
	HasMore bool    `json:"has_more"`
}

CardsResp contains a list of cards and if further pagination calls are available

type Color

type Color struct {
	R int     `json:"r"`
	G int     `json:"g"`
	B int     `json:"b"`
	A float64 `json:"a"`
}

Color information related to a Label's colour

type Column

type Column struct {
	ID           string       `json:"id"`
	Name         string       `json:"name"`
	Position     int          `json:"position"`
	ArchivedDate string       `json:"archived_date"`
	CreatedDate  string       `json:"created_date"`
	CreatedBy    *PartialUser `json:"created_by"`
}

Column contains inforamtion related to a Column

type ColumnInput

type ColumnInput struct {
	Name     string `json:"name"`
	Position int    `json:"position"`
}

ColumnInput contains information used to create or edit a column

type Comment

type Comment struct {
	ID          string       `json:"id"`
	CardID      string       `json:"card_id"`
	BoardID     string       `json:"board_id"`
	CreatedDate string       `json:"created_date"`
	UpdatedDate string       `json:"updated_date"`
	CreatedBy   *PartialUser `json:"created_by"`
	UpdatedBy   *PartialUser `json:"updated_by"`
	Text        string       `json:"text"`
}

Comment contains information related to a Comment.

type CommentInput

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

CommentInput contains information used to create a comment

type CommentsResp

type CommentsResp struct {
	HasMore  bool
	Comments []*Comment
}

CommentsResp contains a list of comments and if further pagination calls are available .

type Description

type Description struct {
	Text        string       `json:"text"`
	CreatedDate string       `json:"created_date"`
	UpdatedDate string       `json:"updated_date"`
	CreatedBy   *PartialUser `json:"created_by"`
	UpdatedBy   *PartialUser `json:"updated_by"`
}

Description contains information related to a card

type GeneratedAttachment

type GeneratedAttachment struct {
	Comment    *Comment       `json:"comment"`
	Attachment *NewAttachment `json:"attachment"`
}

GeneratedAttachment contains the information related to a new attachment and the comment generated to prevent the new attachment from having a TTL

type Glo

type Glo struct {
	BaseURI string
	// contains filtered or unexported fields
}

Glo API object

func NewClient

func NewClient(token string) *Glo

NewClient Glo API Client

func (*Glo) CardsByColumn

func (a *Glo) CardsByColumn(
	boardID string,
	columnID string,
	page int,
	limit int,
	sortDesc bool,
	archived bool,
) (
	cardsResp *CardsResp,
	err error,
)

CardsByColumn Get a list of Cards by Column https://gloapi.gitkraken.com/v1/docs/#/Cards/get_boards__board_id__columns__column_id__cards

func (*Glo) CreateAttachment

func (a *Glo) CreateAttachment(
	boardID string,
	cardID string,
	description string,
	r io.Reader,
) (
	generated *GeneratedAttachment,
	err error,
)

CreateAttachment Will create an attachment and create a new comment on the provided card so that the attachment does not have a Time To Live.

https://gloapi.gitkraken.com/v1/docs/#/Attachments/post_boards__board_id__cards__card_id__attachments

func (*Glo) CreateBoard

func (a *Glo) CreateBoard(
	input *BoardInput,
) (
	board *Board,
	err error,
)

CreateBoard Creates a Board https://gloapi.gitkraken.com/v1/docs/#/Boards/post_boards

func (*Glo) CreateCard

func (a *Glo) CreateCard(
	boardID string,
	cardInput *CardsInput,
) (
	card *Card,
	err error,
)

CreateCard Creates a Card https://gloapi.gitkraken.com/v1/docs/#/Cards/post_boards__board_id__cards

func (*Glo) CreateColumn

func (a *Glo) CreateColumn(
	boardID string,
	columnInput *ColumnInput,
) (
	col *Column,
	err error,
)

CreateColumn Creates a Column https://gloapi.gitkraken.com/v1/docs/#/Columns/post_boards__board_id__columns

func (*Glo) CreateComment

func (a *Glo) CreateComment(
	boardID string,
	cardID string,
	commentInput *CommentInput,
) (
	comment *Comment,
	err error,
)

CreateComment Creates Comment https://gloapi.gitkraken.com/v1/docs/#/Comments/post_boards__board_id__cards__card_id__comments

func (*Glo) DeleteBoard

func (a *Glo) DeleteBoard(
	boardID string,
) (
	err error,
)

DeleteBoard Deletes a Board https://gloapi.gitkraken.com/v1/docs/#/Boards/delete_boards__board_id_

func (*Glo) DeleteCard

func (a *Glo) DeleteCard(
	boardID string,
	cardID string,
) (
	err error,
)

DeleteCard Deletes a card https://gloapi.gitkraken.com/v1/docs/#/Cards/delete_boards__board_id__cards__card_id_

func (*Glo) DeleteComment

func (a *Glo) DeleteComment(
	boardID string,
	cardID string,
	commentID string,
) (
	err error,
)

DeleteComment Deletes a Comment https://gloapi.gitkraken.com/v1/docs/#/Comments/delete_boards__board_id__cards__card_id__comments__comment_id_

func (*Glo) DeteleColumn

func (a *Glo) DeteleColumn(boardID, columnID string) (err error)

DeteleColumn Deletes a Column https://gloapi.gitkraken.com/v1/docs/#/Columns/delete_boards__board_id__columns__column_id_

func (*Glo) EditBoard

func (a *Glo) EditBoard(
	boardID string,
	input *BoardInput,
) (
	board *Board,
	err error,
)

EditBoard Edits a Board https://gloapi.gitkraken.com/v1/docs/#/Boards/post_boards__board_id_

func (*Glo) EditCard

func (a *Glo) EditCard(
	boardID string,
	cardID string,
	cardInput *CardsInput,
) (
	card *Card,
	err error,
)

EditCard Edits a Card https://gloapi.gitkraken.com/v1/docs/#/Cards/post_boards__board_id__cards__card_id_

func (*Glo) EditColumn

func (a *Glo) EditColumn(
	boardID,
	columnID string,
	columnInput *ColumnInput,
) (
	col *Column,
	err error,
)

EditColumn Edits a Column https://gloapi.gitkraken.com/v1/docs/#/Columns/post_boards__board_id__columns__column_id_

func (*Glo) EditComment

func (a *Glo) EditComment(
	boardID string,
	cardID string,
	commentID string,
	input *CommentInput,
) (
	comment *Comment,
	err error,
)

EditComment Edits Comment https://gloapi.gitkraken.com/v1/docs/#/Comments/post_boards__board_id__cards__card_id__comments__comment_id_

func (*Glo) GetAttachments

func (a *Glo) GetAttachments(
	boardID string,
	cardID string,
	page int,
	limit int,
	sortDesc bool,
) (
	attachmentsResp *AttachmentsResp,
	err error,
)

GetAttachments get attachments related to a card https://gloapi.gitkraken.com/v1/docs/#/Attachments/get_boards__board_id__cards__card_id__attachments

func (*Glo) GetBoard

func (a *Glo) GetBoard(
	boardID string,
) (
	board *Board,
	err error,
)

GetBoard Get a Board by ID https://gloapi.gitkraken.com/v1/docs/#/Boards/get_boards__board_id_

func (*Glo) GetBoards

func (a *Glo) GetBoards(
	page int,
	limit int,
	sortDesc bool,
	archived bool,
) (
	boardsResp *BoardsResp,
	err error,
)

GetBoards Get a list of Boards https://gloapi.gitkraken.com/v1/docs/#/Boards/get_boards

func (*Glo) GetCard

func (a *Glo) GetCard(
	boardID string,
	cardID string,
) (
	card *Card,
	err error,
)

GetCard Get a Card by ID https://gloapi.gitkraken.com/v1/docs/#/Cards/get_boards__board_id__cards__card_id_

func (*Glo) GetCards

func (a *Glo) GetCards(
	boardID string,
	page int,
	limit int,
	sortDesc bool,
	archived bool,
) (
	cardsResp *CardsResp,
	err error,
)

GetCards Get a list of Cards https://gloapi.gitkraken.com/v1/docs/#/Cards/get_boards__board_id__cards

func (*Glo) GetComments

func (a *Glo) GetComments(
	boardID string,
	cardID string,
	page int,
	limit int,
	sortDesc bool,
) (
	commentsResp *CommentsResp,
	err error,
)

GetComments Get Comments for a Card https://gloapi.gitkraken.com/v1/docs/#/Comments/get_boards__board_id__cards__card_id__comments

func (*Glo) GetUser

func (a *Glo) GetUser() (user *User, err error)

GetUser get authenticated user https://gloapi.gitkraken.com/v1/docs/#/Users/get_user

type Label

type Label struct {
	ID          string       `json:"id"`
	Name        string       `json:"name"`
	Color       Color        `json:"color"`
	CreatedDate string       `json:"created_date"`
	CreatedBy   *PartialUser `json:"created_by"`
}

Label contains information related ot a label

type MinimizedDescription

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

MinimizedDescription minimized description data for input purposes

type NewAttachment

type NewAttachment struct {
	BaseAttachment
	URL string `json:"url"`
}

NewAttachment contains the information related to a new attachment.

type PartialLabel

type PartialLabel struct {
	ID   string `json:"id"`
	Name string `json:"name,omitempty"`
}

PartialLabel minimized Label data

type PartialUser

type PartialUser struct {
	ID string `json:"id"`
}

PartialUser minimized User information

type User

type User struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Username string `json:"username"`
	Email    string `json:"email"`
}

User contains information related to a User

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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