sprintly

package
v0.0.0-...-6cd9d74 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2015 License: BSD-3-Clause, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LibraryVersion = "0.0.1"

	DefaultBaseURL   = "https://sprint.ly/api/"
	DefaultUserAgent = "go-sprintly/" + LibraryVersion
)
View Source
const (
	ItemOrderingOldest    ItemOrdering = "oldest"
	ItemOrderingNewest                 = "newest"
	ItemOrderingPriority               = "priority"
	ItemOrderingRecent                 = "recent"
	ItemOrderingStale                  = "stale"
	ItemOrderingActive                 = "active"
	ItemOrderingAbandoned              = "abandoned"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// The People service.
	People *PeopleService

	// The Items service.
	Items *ItemsService

	// The Deploys service.
	Deploys *DeploysService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(username, token string) *Client

NewClient returns a new API client instance that uses the given username and token to authenticate the API calls.

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)

Do carries out the given API request.

In case the interface passed into Do is not nil, it is filled from the response body.

func (*Client) NewDeleteRequest

func (c *Client) NewDeleteRequest(urlPath string) (*http.Request, error)

NewDeleteRequest return a new DELETE API request for the given relative URL.

func (*Client) NewGetRequest

func (c *Client) NewGetRequest(urlPath string, args interface{}) (*http.Request, error)

NewGetRequest returns a new GET API request for the given relative URL.

In case the args object is not nil, it is encoded using github.com/google/go-querystring/query and the resulting string is appended to the URL.

func (*Client) NewPostRequest

func (c *Client) NewPostRequest(urlPath string, args interface{}) (*http.Request, error)

NewPostRequest returns a new POST API request for the given relative URL and arguments.

In case the args object is not nil, it is encoded using github.com/google/go-querystring/query and the resulting string is inserted into the request body. The content type is then set to application/x-www-form-urlencoded.

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(baseURL string) error

SetBaseURL can be used to overwrite the default API base URL, which is the Sprintly API - https://sprint.ly/api/.

func (*Client) SetHttpClient

func (c *Client) SetHttpClient(client *http.Client)

SetHttpClient can be used to really customize the API client behaviour by replacing the underlying HTTP client that is being used to carry out all the API calls.

func (*Client) SetUserAgent

func (c *Client) SetUserAgent(agent string)

SetUserAgent can be used to overwrite the default user agent string.

type Deploy

type Deploy struct {
	Environment string `json:"environment,omitempty"`
	Items       []Item `json:"items,omitempty"`
}

Deploy represents the Sprintly Deploy resource.

type DeployCreateArgs

type DeployCreateArgs struct {
	Environment string `url:"environment"   schema:"environment"`
	ItemNumbers []int  `url:"numbers,comma" schema:"numbers"`
}

type DeployListArgs

type DeployListArgs struct {
	Environment string `url:"environment,omitempty"`
}

type DeploysService

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

DeploysService holds all the methods for manipulating Sprintly items.

func (DeploysService) Create

func (srv DeploysService) Create(productId int, args *DeployCreateArgs) (*Deploy, *http.Response, error)

Create can be used to create a new deployment for the given product.

See https://sprintly.uservoice.com/knowledgebase/articles/138392-deploys

func (DeploysService) List

func (srv DeploysService) List(productId int, args *DeployListArgs) ([]Deploy, *http.Response, error)

List can be used to list deploys for the given product.

See https://sprintly.uservoice.com/knowledgebase/articles/138392-deploys

type Email

type Email struct {
	Tests   string `json:"tests,omitempty"`
	Tasks   string `json:"tasks,omitempty"`
	Stories string `json:"stories,omitempty"`
	Defects string `json:"defects,omitempty"`
	Backlog string `json:"backlog,omitempty"`
}

Email represents the email section of a Product.

type ErrAPI

type ErrAPI struct {
	Response *http.Response
}

func (*ErrAPI) Error

func (err *ErrAPI) Error() string

type ErrDeploys400

type ErrDeploys400 struct {
	Err *ErrAPI
}

func (*ErrDeploys400) Error

func (err *ErrDeploys400) Error() string

type ErrDeploys403

type ErrDeploys403 struct {
	Err *ErrAPI
}

func (*ErrDeploys403) Error

func (err *ErrDeploys403) Error() string

type ErrDeploys404

type ErrDeploys404 struct {
	Err *ErrAPI
}

func (*ErrDeploys404) Error

func (err *ErrDeploys404) Error() string

type ErrItems400

type ErrItems400 struct {
	Err *ErrAPI
}

func (*ErrItems400) Error

func (err *ErrItems400) Error() string

type ErrItems404

type ErrItems404 struct {
	Err *ErrAPI
}

func (*ErrItems404) Error

func (err *ErrItems404) Error() string

type Invitation

type Invitation struct {
	Email     string `url:"email,omitempty"      schema:"email,omitempty"`
	FirstName string `url:"first_name,omitempty" schema:"first_name,omitempty"`
	LastName  string `url:"last_name,omitempty"  schema:"last_name,omitempty"`
	Admin     bool   `url:"admin,omitempty"      schema:"admin,omitempty"`
}

Invitation represents the arguments that can be supplied when inviting a user to join a product.

type Item

type Item struct {
	// Common fields.
	Number       int           `json:"number,omitempty"`
	Type         string        `json:"type,omitempty"`
	Title        string        `json:"title,omitempty"`
	Description  string        `json:"description,omitempty"`
	Score        ItemScore     `json:"score,omitempty"`
	Status       ItemStatus    `json:"status,omitempty"`
	Tags         []string      `json:"tags,omitempty"`
	Parent       interface{}   `json:"parent,omitempty"`
	ShortURL     string        `json:"short_url,omitempty"`
	Product      *Product      `json:"product,omitempty"`
	Progress     *ItemProgress `json:"progress,omitempty"`
	CreatedAt    *time.Time    `json:"created_at,omitempty"`
	CreatedBy    *User         `json:"created_by,omitempty"`
	AssignedTo   *User         `json:"assigned_to,omitempty"`
	Counts       *ItemCounts   `json:"counts,omitempty"`
	Email        *ItemEmail    `json:"email,omitempty"`
	LastModified *time.Time    `json:"last_modified,omitempty"`
	Archived     bool          `json:"archived,omitempty"`

	// Stories only.
	Who  string `json:"who,omitempty"`
	What string `json:"what,omitempty"`
	Why  string `json:"why,omitempty"`
}

Item represents a Sprintly item.

func (*Item) ParentNumber

func (item *Item) ParentNumber() (int, error)

type ItemCounts

type ItemCounts struct {
	Blockers  int `json:"blockers,omitempty"`
	Blocking  int `json:"blocking,omitempty"`
	Comments  int `json:"comments,omitempty"`
	Favorites int `json:"favorites,omitempty"`
}

type ItemCreateArgs

type ItemCreateArgs struct {
	Type        string     `url:"type,omitempty"        schema:"type,omitempty"`
	Title       string     `url:"title,omitempty"       schema:"title,omitempty"`
	Who         string     `url:"who,omitempty"         schema:"who,omitempty"`
	What        string     `url:"what,omitempty"        schema:"what,omitempty"`
	Why         string     `url:"why,omitempty"         schema:"why,omitempty"`
	Description string     `url:"description,omitempty" schema:"description,omitempty"`
	Score       ItemScore  `url:"score,omitempty"       schema:"score,omitempty"`
	Status      ItemStatus `url:"status,omitempty"      schema:"status,omitempty"`
	AssignedTo  int        `url:"assigned_to,omitempty" schema:"assigned_to,omitempty"`
	Tags        []string   `url:"tags,comma,omitempty"  schema:"tags,omitempty"`
}

ItemCreateArgs represent the arguments that can be passed into Items.Create.

type ItemEmail

type ItemEmail struct {
	Discussion string `json:"discussion,omitempty"`
	Files      string `json:"files,omitempty"`
}

type ItemListArgs

type ItemListArgs struct {
	Type       []ItemType   `url:"type,comma,omitempty"   schema:"type,omitempty"`
	Status     []ItemStatus `url:"status,comma,omitempty" schema:"status,omitempty"`
	Offset     int          `url:"offset,omitempty"       schema:"offset,omitempty"`
	Limit      int          `url:"limit,omitempty"        schema:"limit,omitempty"`
	OrderBy    ItemOrdering `url:"order_by,omitempty"     schema:"order_by,omitempty"`
	AssignedTo int          `url:"assigned_to,omitempty"  schema:"assigned_to,omitempty"`
	CreatedBy  int          `url:"created_by,omitempty"   schema:"created_by,omitempty"`
	Tags       []string     `url:"tags,comma,omitempty"   schema:"tags,omitempty"`
	Children   bool         `url:"children,omitempty"     schema:"children,omitempty"`
}

ItemListArgs represents the arguments for the List method.

type ItemOrdering

type ItemOrdering string

type ItemProgress

type ItemProgress struct {
	TriagedAt  *time.Time `json:"triaged_at,omitempty"`
	StartedAt  *time.Time `json:"started_at,omitempty"`
	AcceptedAt *time.Time `json:"accepted_at,omitempty"`
	ClosedAt   *time.Time `json:"closed_at,omitempty"`
}

Progress represents a Sprintly item progress.

type ItemScore

type ItemScore string
const (
	ItemScoreUnset     ItemScore = "~"
	ItemScoreSmall     ItemScore = "S"
	ItemScoreMedium    ItemScore = "M"
	ItemScoreLarge     ItemScore = "L"
	ItemScoreVeryLarge ItemScore = "XL"
)

type ItemStatus

type ItemStatus string
const (
	ItemStatusSomeday    ItemStatus = "someday"
	ItemStatusBacklog    ItemStatus = "backlog"
	ItemStatusInProgress ItemStatus = "in-progress"
	ItemStatusCompleted  ItemStatus = "completed"
	ItemStatusAccepted   ItemStatus = "accepted"
)

type ItemType

type ItemType string
const (
	ItemTypeStory  ItemType = "story"
	ItemTypeTask   ItemType = "task"
	ItemTypeDefect ItemType = "defect"
	ItemTypeTest   ItemType = "test"
)

type ItemUpdateArgs

type ItemUpdateArgs struct {
	Type        string     `url:"type,omitempty"        schema:"type,omitempty"`
	Title       string     `url:"title,omitempty"       schema:"title,omitempty"`
	Who         string     `url:"who,omitempty"         schema:"who,omitempty"`
	What        string     `url:"what,omitempty"        schema:"what,omitempty"`
	Why         string     `url:"why,omitempty"         schema:"why,omitempty"`
	Description string     `url:"description,omitempty" schema:"description,omitempty"`
	Score       ItemScore  `url:"score,omitempty"       schema:"score,omitempty"`
	Status      ItemStatus `url:"status,omitempty"      schema:"status,omitempty"`
	AssignedTo  int        `url:"assigned_to,omitempty" schema:"assigned_to,omitempty"`
	Tags        []string   `url:"tags,comma,omitempty"  schema:"tags,omitempty"`
	Parent      int        `url:"parent,omitempty"      schema:"parent,omitempty"`
}

ItemUpdateArgs represent the arguments that can be passed into Items.Update.

This struct is the same as ItemCreateArgs, just the Parent field is extra.

type ItemsService

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

ItemsService holds all the methods for manipulating Sprintly items.

func (ItemsService) Create

func (srv ItemsService) Create(productId int, args *ItemCreateArgs) (*Item, *http.Response, error)

Create can be used to create new items.

See https://sprintly.uservoice.com/knowledgebase/articles/98412-items

func (ItemsService) Get

func (srv ItemsService) Get(productId, itemNumber int) (*Item, *http.Response, error)

Get can be used to get the item identified by the given item number.

See https://sprintly.uservoice.com/knowledgebase/articles/98412-items

func (ItemsService) List

func (srv ItemsService) List(productId int, args *ItemListArgs) ([]Item, *http.Response, error)

List can be used to list items for the given product according to the given arguments.

See https://sprintly.uservoice.com/knowledgebase/articles/98412-items

func (ItemsService) ListChildren

func (srv ItemsService) ListChildren(productId, itemNumber int) ([]Item, *http.Response, error)

ListChildren can be used to list children of the given item.

See https://sprintly.uservoice.com/knowledgebase/articles/98412-items

func (ItemsService) Update

func (srv ItemsService) Update(
	productId int,
	itemNumber int,
	args *ItemUpdateArgs,
) (*Item, *http.Response, error)

Update can be used to update the item identified by the given item number.

See https://sprintly.uservoice.com/knowledgebase/articles/98412-items

type PeopleService

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

PeopleService holds all the methods for manipulating Sprintly product members.

func (PeopleService) Get

func (srv PeopleService) Get(productId, userId int) (*User, *http.Response, error)

Get can be used to get the user associated with the given user ID.

https://sprintly.uservoice.com/knowledgebase/articles/98410-people

func (PeopleService) Invite

func (srv PeopleService) Invite(productId int, invitation *Invitation) (*http.Response, error)

Invite will invite the specified user to the specified product.

https://sprintly.uservoice.com/knowledgebase/articles/98410-people

func (PeopleService) List

func (srv PeopleService) List(productId int) ([]User, *http.Response, error)

List can be used to get all the users associated with the given product.

https://sprintly.uservoice.com/knowledgebase/articles/98410-people

func (PeopleService) Remove

func (srv PeopleService) Remove(productId, userId int) (*http.Response, error)

Remove will remote the user from the specified product.

https://sprintly.uservoice.com/knowledgebase/articles/98410-people

type Product

type Product struct {
	Id        int        `json:"id,omitempty"`
	Name      string     `json:"name,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
	Webhook   string     `json:"webhook,omitempty"`
	Archived  bool       `json:"archived,omitempty"`
	Admin     bool       `json:"admin,omitempty"`
	Email     *Email     `json:"email,omitempty"`
}

Product represents a Sprintly product.

type User

type User struct {
	Id        int    `json:"id,omitempty"`
	Email     string `json:"email,omitempty"`
	FirstName string `json:"first_name,omitempty"`
	LastName  string `json:"last_name,omitempty"`
	Admin     bool   `json:"admin,omitempty"`
	Revoked   bool   `json:"revoked,omitempty"`
}

User represents the Sprintly user resource.

Jump to

Keyboard shortcuts

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