basecamp3

package module
v0.0.0-...-63aaf6f Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: Apache-2.0 Imports: 14 Imported by: 1

README

basecamp3

Golang API implementation for Basecamp3

Documentation

Index

Constants

View Source
const (
	BasecampApiRootURL = "https://3.basecampapi.com"
)
View Source
const TokenCookie = "BC3-API-Token"

Variables

View Source
var Endpoint = oauth2.Endpoint{
	AuthURL:  "https://launchpad.37signals.com/authorization/new",
	TokenURL: "https://launchpad.37signals.com/authorization/token",
}

Functions

func FileBasedTokenPersistence

func FileBasedTokenPersistence(filename string) func(w http.ResponseWriter, r *http.Request) ContextWithTokenPersistence

func ServeLocalhost

func ServeLocalhost(port int, clientID string, clientSecret string)

ServeLocalhost configures and starts a HTTP server on localhost which can be used to authenticate and query BC. Capable of handling a single BC session, and assumes the redirect URL to be set as http://localhost:<port>/verify

Types

type Basecamp

type Basecamp struct {
	TokenPersitence func(w http.ResponseWriter, r *http.Request) ContextWithTokenPersistence
	// contains filtered or unexported fields
}

func New

func New(clientID string, clientSecret string, redirectURL string) *Basecamp

func NewByOauth

func NewByOauth(oauth *oauth2.Config) *Basecamp

func (*Basecamp) ApiReverseProxy

func (bc *Basecamp) ApiReverseProxy(w http.ResponseWriter, r *http.Request)

func (*Basecamp) Authenticate

func (bc *Basecamp) Authenticate(w http.ResponseWriter, r *http.Request)

func (*Basecamp) Project

func (bc *Basecamp) Project(ctx ContextWithTokenPersistence, account int, project int) (Project, error)

func (*Basecamp) Projects

func (bc *Basecamp) Projects(ctx ContextWithTokenPersistence, account int) ([]Project, error)

func (*Basecamp) Todo

func (bc *Basecamp) Todo(ctx ContextWithTokenPersistence, account int, project int, todo int) (Todo, error)

func (*Basecamp) TodoList

func (bc *Basecamp) TodoList(ctx ContextWithTokenPersistence, account int, project int, todolist int) (Todo, error)

func (*Basecamp) TodoList_Groups

func (bc *Basecamp) TodoList_Groups(ctx ContextWithTokenPersistence, account int, project int, todolist int) ([]Todo, error)

func (*Basecamp) TodoSet

func (bc *Basecamp) TodoSet(ctx ContextWithTokenPersistence, account int, project int, todoset int64) (TodoSet, error)

func (*Basecamp) TodoSet_Lists

func (bc *Basecamp) TodoSet_Lists(ctx ContextWithTokenPersistence, account int, project int, todoset int64) ([]Todo, error)

func (*Basecamp) Todos

func (bc *Basecamp) Todos(ctx ContextWithTokenPersistence, account int, project int, todolist int) ([]Todo, error)

func (*Basecamp) VerifyRequest

func (bc *Basecamp) VerifyRequest(w http.ResponseWriter, r *http.Request)

type ContextWithTokenPersistence

type ContextWithTokenPersistence interface {
	context.Context
	oauth2.TokenSource
	SetToken(*oauth2.Token)
}

func TokenFile

func TokenFile(ctx context.Context, filename string) ContextWithTokenPersistence

type Dock

type Dock struct {
	ID       int64  `json:"id"`
	Title    string `json:"title"`
	Name     string `json:"name"`
	Enabled  bool   `json:"enabled"`
	Position int    `json:"position"`
	URL      string `json:"url"`
	AppURL   string `json:"app_url"`
}

type Project

type Project struct {
	ID             int       `json:"id"`
	Status         string    `json:"status"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	Name           string    `json:"name"`
	Description    string    `json:"description"`
	Purpose        string    `json:"purpose"`
	ClientsEnabled bool      `json:"clients_enabled"`
	BookmarkURL    string    `json:"bookmark_url"`
	URL            string    `json:"url"`
	AppURL         string    `json:"app_url"`
	Dock           []*Dock   `json:"dock"`
}

func (*Project) GetDock

func (p *Project) GetDock(dockname string) *Dock

func (*Project) GetTodoSet

func (p *Project) GetTodoSet() int64

type Todo

type Todo struct {
	ID               int64     `json:"id"`
	Status           string    `json:"status"`
	VisibleToClients bool      `json:"visible_to_clients"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
	Title            string    `json:"title"`
	InheritsStatus   bool      `json:"inherits_status"`
	Type             string    `json:"type"`
	URL              string    `json:"url"`
	AppURL           string    `json:"app_url"`
	BookmarkURL      string    `json:"bookmark_url"`
	SubscriptionURL  string    `json:"subscription_url"`
	CommentsCount    int       `json:"comments_count"`
	CommentsURL      string    `json:"comments_url"`
	Position         int       `json:"position"`
	Parent           struct {
		ID     int64  `json:"id"`
		Title  string `json:"title"`
		Type   string `json:"type"`
		URL    string `json:"url"`
		AppURL string `json:"app_url"`
	} `json:"parent"`
	Bucket struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
		Type string `json:"type"`
	} `json:"bucket"`
	Creator struct {
		ID             int         `json:"id"`
		AttachableSgid string      `json:"attachable_sgid"`
		Name           string      `json:"name"`
		EmailAddress   string      `json:"email_address"`
		PersonableType string      `json:"personable_type"`
		Title          string      `json:"title"`
		Bio            string      `json:"bio"`
		Location       interface{} `json:"location"`
		CreatedAt      time.Time   `json:"created_at"`
		UpdatedAt      time.Time   `json:"updated_at"`
		Admin          bool        `json:"admin"`
		Owner          bool        `json:"owner"`
		Client         bool        `json:"clietime"`
		Employee       bool        `json:"employee"`
		TimeZone       string      `json:"time_zone"`
		AvatarURL      string      `json:"avatar_url"`
		Company        struct {
			ID   int    `json:"id"`
			Name string `json:"name"`
		} `json:"company"`
	} `json:"creator"`
	Description    string `json:"description"`
	Completed      bool   `json:"completed"`
	CompletedRatio string `json:"completed_ratio"`
	Name           string `json:"name"`
	TodosURL       string `json:"todos_url"`
	GroupsURL      string `json:"groups_url"`
	AppTodosURL    string `json:"app_todos_url"`
}

type TodoSet

type TodoSet struct {
	ID               int64     `json:"id"`
	Status           string    `json:"status"`
	VisibleToClients bool      `json:"visible_to_clients"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
	Title            string    `json:"title"`
	InheritsStatus   bool      `json:"inherits_status"`
	Type             string    `json:"type"`
	URL              string    `json:"url"`
	AppURL           string    `json:"app_url"`
	BookmarkURL      string    `json:"bookmark_url"`
	Position         int       `json:"position"`
	Bucket           struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
		Type string `json:"type"`
	} `json:"bucket"`
	Creator struct {
		ID             int         `json:"id"`
		AttachableSgid string      `json:"attachable_sgid"`
		Name           string      `json:"name"`
		EmailAddress   string      `json:"email_address"`
		PersonableType string      `json:"personable_type"`
		Title          string      `json:"title"`
		Bio            string      `json:"bio"`
		Location       interface{} `json:"location"`
		CreatedAt      time.Time   `json:"created_at"`
		UpdatedAt      time.Time   `json:"updated_at"`
		Admin          bool        `json:"admin"`
		Owner          bool        `json:"owntime"`
		Client         bool        `json:"client"`
		Employee       bool        `json:"employee"`
		TimeZone       string      `json:"time_zone"`
		AvatarURL      string      `json:"avatar_url"`
		Company        struct {
			ID   int    `json:"id"`
			Name string `json:"name"`
		} `json:"company"`
	} `json:"creator"`
	Completed        bool   `json:"completed"`
	CompletedRatio   string `json:"completed_ratio"`
	Name             string `json:"name"`
	TodolistsCount   int    `json:"todolists_count"`
	TodolistsURL     string `json:"todolists_url"`
	AppTodoslistsURL string `json:"app_todoslists_url"`
}

Jump to

Keyboard shortcuts

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