redmine

package module
v0.0.0-...-9b8d72d Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 9 Imported by: 0

README

go-redmine

Intefaces to redmine.

Module Install

go get github.com/mattn/go-redmine 

APIs

Provide Interfaces to redmine APIs.

API Implements
Issues 100%
Projects 100%
Project Memberships 100%
Users 0%
Time Entries 100%
News 100%
Issue Relations 100%
Versions 100%
Wiki Pages 100%
Queries 0%
Attachments 0%
Issue Statuses 100%
Trackers 100%
Enumerations 100%
Issue Categories 100%
Roles 100%
Groups 0%

Godmine

Provide command line tool for redmine.

Install

go install github.com/mattn/go-redmine/cmd/godmine@latest
Usage
godmine <command> <subcommand> [arguments]

Project Commands:
  add      a create project with text editor.
             $ godmine p a

  create   c create project from given arguments.
             $ godmine p c name identifier description

  update   u update given project.
             $ godmine p u 1

  show     s show given project.
             $ godmine p s 1

  delete   d delete given project.
             $ godmine p d 1

  list     l listing projects.
             $ godmine p l

Issue Commands:
  add      a create issue with text editor.
             $ godmine i a

  create   c create issue from given arguments.
             $ godmine i c subject description

  update   u update given issue.
             $ godmine i u 1

  show     s show given issue.
             $ godmine i s 1

  delete   d delete given issue.
             $ godmine i d 1

  close    x close given issue.
             $ godmine i x 1

  notes    n add notes to given issue.
             $ godmine i n 1

  list     l listing issues.
             $ godmine i l

Settings

To use this, you should create settings.json in:

UNIX:

~/.config/godmine/settings.json

WINDOWS:

%APPDATA%\godmine/settings.json

Write following:

{
	"endpoint": "http://redmine.example.com",
	"apikey": "YOUR-API-KEY",
	"project": 1 // default project id
}

If you want switching configuration file, you should use GODMINE_ENV environment variable. If you set GODMINE_ENV to mine, godmine use settings.mine.json to configuration file.

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)

Documentation

Index

Constants

View Source
const (
	UserStatusAll        string = ""
	UserStatusActive     string = "1"
	UserStatusRegistered string = "2"
	UserStatusLocked     string = "3"
)
View Source
const (
	UserIncludeMemberships string = "memberships"
	UserIncludeGroups      string = "groups"
)

Variables

View Source
var DefaultLimit int = -1 // "-1" means "No setting"
View Source
var DefaultOffset int = -1 //"-1" means "No setting"

Functions

This section is empty.

Types

type Client

type Client struct {
	*http.Client
	Limit  int
	Offset int
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint, apikey string) *Client

func (*Client) CreateIssue

func (c *Client) CreateIssue(issue Issue) (*Issue, error)

func (*Client) CreateIssueCategory

func (c *Client) CreateIssueCategory(issueCategory IssueCategory) (*IssueCategory, error)

func (*Client) CreateIssueRelation

func (c *Client) CreateIssueRelation(issueRelation IssueRelation) (*IssueRelation, error)

func (*Client) CreateMembership

func (c *Client) CreateMembership(membership Membership) (*Membership, error)

func (*Client) CreateProject

func (c *Client) CreateProject(project Project) (*Project, error)

func (*Client) CreateTimeEntry

func (c *Client) CreateTimeEntry(timeEntry TimeEntry) (*TimeEntry, error)

func (*Client) CreateVersion

func (c *Client) CreateVersion(version Version) (*Version, error)

func (*Client) CreateWikiPage

func (c *Client) CreateWikiPage(projectId int, wikiPage WikiPage) (*WikiPage, error)

CreateWikiPage creates wiki page.

func (*Client) CustomFields

func (c *Client) CustomFields() ([]CustomField, error)

CustomFields consulta los campos personalizados

func (*Client) DeleteIssue

func (c *Client) DeleteIssue(id int) error

func (*Client) DeleteIssueCategory

func (c *Client) DeleteIssueCategory(id int) error

func (*Client) DeleteIssueRelation

func (c *Client) DeleteIssueRelation(id int) error

func (*Client) DeleteMembership

func (c *Client) DeleteMembership(id int) error

func (*Client) DeleteProject

func (c *Client) DeleteProject(id int) error

func (*Client) DeleteTimeEntry

func (c *Client) DeleteTimeEntry(id int) error

func (*Client) DeleteVersion

func (c *Client) DeleteVersion(id int) error

func (*Client) DeleteWikiPage

func (c *Client) DeleteWikiPage(projectId int, title string) error

DeleteWikiPage deletes the wiki page given by its title irreversibly.

func (*Client) Issue

func (c *Client) Issue(id int) (*Issue, error)

func (*Client) IssueCategories

func (c *Client) IssueCategories(projectId int) ([]IssueCategory, error)

func (*Client) IssueCategory

func (c *Client) IssueCategory(id int) (*IssueCategory, error)

func (*Client) IssuePriorities

func (c *Client) IssuePriorities() ([]IssuePriority, error)

func (*Client) IssueRelation

func (c *Client) IssueRelation(id int) (*IssueRelation, error)

func (*Client) IssueRelations

func (c *Client) IssueRelations(issueId int) ([]IssueRelation, error)

func (*Client) IssueStatuses

func (c *Client) IssueStatuses() ([]IssueStatus, error)

func (*Client) IssueWithArgs

func (c *Client) IssueWithArgs(id int, args map[string]string) (*Issue, error)

func (*Client) Issues

func (c *Client) Issues() ([]Issue, error)

func (*Client) IssuesByFilter

func (c *Client) IssuesByFilter(f *IssueFilter) ([]Issue, error)

IssuesByFilter filters issues applying the f criteria

func (*Client) IssuesByQuery

func (c *Client) IssuesByQuery(queryId int) ([]Issue, error)

func (*Client) IssuesOf

func (c *Client) IssuesOf(projectId int) ([]Issue, error)

func (*Client) Membership

func (c *Client) Membership(id int) (*Membership, error)

func (*Client) Memberships

func (c *Client) Memberships(projectId int) ([]Membership, error)

func (*Client) News

func (c *Client) News(projectId int) ([]News, error)

func (*Client) Project

func (c *Client) Project(id int) (*Project, error)

func (*Client) Projects

func (c *Client) Projects() ([]Project, error)

func (*Client) Roles

func (c *Client) Roles() ([]IdName, error)

func (*Client) TimeEntries

func (c *Client) TimeEntries(projectId int) ([]TimeEntry, error)

func (*Client) TimeEntriesWithFilter

func (c *Client) TimeEntriesWithFilter(filter Filter) ([]TimeEntry, error)

TimeEntriesWithFilter send query and return parsed result

func (*Client) TimeEntry

func (c *Client) TimeEntry(id int) (*TimeEntry, error)

func (*Client) TimeEntryActivities

func (c *Client) TimeEntryActivities() ([]TimeEntryActivity, error)

func (*Client) Trackers

func (c *Client) Trackers() ([]IdName, error)

func (*Client) URLWithFilter

func (c *Client) URLWithFilter(path string, f Filter) (string, error)

URLWithFilter return string url by concat endpoint, path and filter err != nil when endpoin can not parse

func (*Client) UpdateIssue

func (c *Client) UpdateIssue(issue Issue) error

func (*Client) UpdateIssueCategory

func (c *Client) UpdateIssueCategory(issueCategory IssueCategory) error

func (*Client) UpdateIssueRelation

func (c *Client) UpdateIssueRelation(issueRelation IssueRelation) error

func (*Client) UpdateMembership

func (c *Client) UpdateMembership(membership Membership) error

func (*Client) UpdateProject

func (c *Client) UpdateProject(project Project) error

func (*Client) UpdateTimeEntry

func (c *Client) UpdateTimeEntry(timeEntry TimeEntry) error

func (*Client) UpdateVersion

func (c *Client) UpdateVersion(version Version) error

func (*Client) UpdateWikiPage

func (c *Client) UpdateWikiPage(projectId int, wikiPage WikiPage) error

UpdateWikiPage updates the wiki page given by the Title field of wikiPage.

func (*Client) Upload

func (c *Client) Upload(filename string) (*Upload, error)

func (*Client) User

func (c *Client) User(id int) (*User, error)

func (*Client) UserByIdAndFilter

func (c *Client) UserByIdAndFilter(id int, filter *UserByIdFilter) (*User, error)

func (*Client) Users

func (c *Client) Users() ([]User, error)

func (*Client) UsersWithFilter

func (c *Client) UsersWithFilter(filter *UsersFilter) ([]User, error)

func (*Client) Version

func (c *Client) Version(id int) (*Version, error)

func (*Client) Versions

func (c *Client) Versions(projectId int) ([]Version, error)

func (*Client) WikiPage

func (c *Client) WikiPage(projectId int, title string) (*WikiPage, error)

WikiPage fetches the wiki page with the given title.

func (*Client) WikiPageAtVersion

func (c *Client) WikiPageAtVersion(projectId int, title string, version string) (*WikiPage, error)

WikiPageAtVersion fetches the wiki page with the given title at the given version.

func (*Client) WikiPages

func (c *Client) WikiPages(projectId int) ([]WikiPage, error)

WikiPages fetches a list of all wiki pages of the given project. The Text field of the listed pages is not fetch by this command and is thus empty.

type CustomField

type CustomField struct {
	Id          int         `json:"id"`
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Multiple    bool        `json:"multiple"`
	Value       interface{} `json:"value"`
}

type Filter

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

func NewFilter

func NewFilter(args ...string) *Filter

func (*Filter) AddPair

func (f *Filter) AddPair(key, value string)

func (*Filter) ToURLParams

func (f *Filter) ToURLParams() string

type Id

type Id struct {
	Id int `json:"id"`
}

type IdName

type IdName struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

type Issue

type Issue struct {
	Id             int            `json:"id"`
	Subject        string         `json:"subject"`
	Description    string         `json:"description"`
	ProjectId      int            `json:"project_id"`
	Project        *IdName        `json:"project"`
	TrackerId      int            `json:"tracker_id"`
	Tracker        *IdName        `json:"tracker"`
	ParentId       int            `json:"parent_issue_id,omitempty"`
	Parent         *Id            `json:"parent"`
	StatusId       int            `json:"status_id"`
	Status         *IdName        `json:"status"`
	PriorityId     int            `json:"priority_id,omitempty"`
	Priority       *IdName        `json:"priority"`
	Author         *IdName        `json:"author"`
	FixedVersion   *IdName        `json:"fixed_version"`
	AssignedTo     *IdName        `json:"assigned_to"`
	AssignedToId   int            `json:"assigned_to_id"`
	Category       *IdName        `json:"category"`
	CategoryId     int            `json:"category_id"`
	Notes          string         `json:"notes"`
	StatusDate     string         `json:"status_date"`
	CreatedOn      string         `json:"created_on"`
	UpdatedOn      string         `json:"updated_on"`
	StartDate      string         `json:"start_date"`
	DueDate        string         `json:"due_date"`
	ClosedOn       string         `json:"closed_on"`
	CustomFields   []*CustomField `json:"custom_fields,omitempty"`
	Uploads        []*Upload      `json:"uploads"`
	DoneRatio      float32        `json:"done_ratio"`
	EstimatedHours float32        `json:"estimated_hours"`
	Journals       []*Journal     `json:"journals"`
}

func (*Issue) GetTitle

func (issue *Issue) GetTitle() string

func (Issue) MarshalJSON

func (issue Issue) MarshalJSON() ([]byte, error)

MarshalJSON marshals issue to JSON. This overrides the default MarshalJSON() to reset parent issue.

type IssueCategory

type IssueCategory struct {
	Id         int    `json:"id"`
	Project    IdName `json:"project"`
	Name       string `json:"name"`
	AssignedTo IdName `json:"assigned_to"`
}

type IssueFilter

type IssueFilter struct {
	ProjectId    string
	SubprojectId string
	TrackerId    string
	StatusId     string
	AssignedToId string
	UpdatedOn    string
	ExtraFilters map[string]string
}

type IssuePriority

type IssuePriority struct {
	Id        int    `json:"id"`
	Name      string `json:"name"`
	IsDefault bool   `json:"is_default"`
}

type IssueRelation

type IssueRelation struct {
	Id           int    `json:"id"`
	IssueId      string `json:"issue_id"`
	IssueToId    string `json:"issue_to_id"`
	RelationType string `json:"relation_type"`
	Delay        string `json:"delay"`
}

type IssueStatus

type IssueStatus struct {
	Id        int    `json:"id"`
	Name      string `json:"name"`
	IsDefault bool   `json:"is_default"`
	IsClosed  bool   `json:"is_closed"`
}

type Journal

type Journal struct {
	Id        int              `json:"id"`
	User      *IdName          `json:"user"`
	Notes     string           `json:"notes"`
	CreatedOn string           `json:"created_on"`
	Details   []JournalDetails `json:"details"`
}

type JournalDetails

type JournalDetails struct {
	Property string `json:"property"`
	Name     string `json:"name"`
	OldValue string `json:"old_value"`
	NewValue string `json:"new_value"`
}

type Membership

type Membership struct {
	Id      int      `json:"id"`
	Project IdName   `json:"project"`
	User    IdName   `json:"user"`
	Roles   []IdName `json:"roles"`
	Groups  []IdName `json:"groups"`
}

type News

type News struct {
	Id          int    `json:"id"`
	Project     IdName `json:"project"`
	Title       string `json:"title"`
	Summary     string `json:"summary"`
	Description string `json:"description"`
	CreatedOn   string `json:"created_on"`
}

type Parent

type Parent struct {
	Title string `json:"title"`
}

type Project

type Project struct {
	Id           int            `json:"id"`
	Parent       IdName         `json:"parent"`
	Name         string         `json:"name"`
	Identifier   string         `json:"identifier"`
	Description  string         `json:"description"`
	CreatedOn    string         `json:"created_on"`
	UpdatedOn    string         `json:"updated_on"`
	CustomFields []*CustomField `json:"custom_fields,omitempty"`
}

type TimeEntry

type TimeEntry struct {
	Id           int            `json:"id"`
	Project      IdName         `json:"project"`
	Issue        Id             `json:"issue"`
	User         IdName         `json:"user"`
	Activity     IdName         `json:"activity"`
	Hours        float32        `json:"hours"`
	Comments     string         `json:"comments"`
	SpentOn      string         `json:"spent_on"`
	CreatedOn    string         `json:"created_on"`
	UpdatedOn    string         `json:"updated_on"`
	CustomFields []*CustomField `json:"custom_fields,omitempty"`
}

type TimeEntryActivity

type TimeEntryActivity struct {
	Id        int    `json:"id"`
	Name      string `json:"name"`
	IsDefault bool   `json:"is_default"`
}

type Upload

type Upload struct {
	Token       string `json:"token"`
	Filename    string `json:"filename"`
	ContentType string `json:"content_type"`
}

type User

type User struct {
	Id           int            `json:"id"`
	Login        string         `json:"login"`
	Firstname    string         `json:"firstname"`
	Lastname     string         `json:"lastname"`
	Mail         string         `json:"mail"`
	CreatedOn    string         `json:"created_on"`
	LatLoginOn   string         `json:"last_login_on"`
	Memberships  []Membership   `json:"memberships"`
	CustomFields []*CustomField `json:"custom_fields,omitempty"`
}

type UserByIdFilter

type UserByIdFilter struct {
	Filter
}

func NewUserByIdFilter

func NewUserByIdFilter() *UserByIdFilter

func (*UserByIdFilter) Include

func (uif *UserByIdFilter) Include(include string)

type UsersFilter

type UsersFilter struct {
	Filter
}

func NewUsersFilter

func NewUsersFilter() *UsersFilter

func (*UsersFilter) GroupId

func (usf *UsersFilter) GroupId(groupId int)

func (*UsersFilter) Name

func (usf *UsersFilter) Name(name string)

func (*UsersFilter) Status

func (usf *UsersFilter) Status(status string)

type Version

type Version struct {
	Id           int            `json:"id"`
	Project      IdName         `json:"project"`
	Name         string         `json:"name"`
	Description  string         `json:"description"`
	Status       string         `json:"status"`
	DueDate      string         `json:"due_date"`
	CreatedOn    string         `json:"created_on"`
	UpdatedOn    string         `json:"updated_on"`
	CustomFields []*CustomField `json:"custom_fields,omitempty"`
}

type WikiPage

type WikiPage struct {
	Title     string      `json:"title"`
	Parent    *Parent     `json:"parent,omitempty"`
	Text      string      `json:"text"`
	Version   interface{} `json:"version,omitempty"`
	Author    *IdName     `json:"author,omitempty"`
	Comments  string      `json:"comments"`
	CreatedOn string      `json:"created_on,omitempty"`
	UpdatedOn string      `json:"updated_on,omitempty"`
	ParentID  int         `json:"parent_id"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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