redmine

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: MIT Imports: 12 Imported by: 2

README

go-redmine

Intefaces to Redmine.

Using go-redmine

You can find more information about using this software in

Developing go-redmine

You can find more information about building and testing in

Original author

This is a fork of Yasuhiro Matsumoto's project go-redmine

License

This runs under the MIT license.


What is the Cloudogu EcoSystem?

The Cloudogu EcoSystem is an open platform, which lets you choose how and where your team creates great software. Each service or tool is delivered as a Dogu, a Docker container. Each Dogu can easily be integrated in your environment just by pulling it from our registry. We have a growing number of ready-to-use Dogus, e.g. SCM-Manager, Jenkins, Nexus, SonarQube, Redmine and many more. Every Dogu can be tailored to your specific needs. Take advantage of a central authentication service, a dynamic navigation, that lets you easily switch between the web UIs and a smart configuration magic, which automatically detects and responds to dependencies between Dogus. The Cloudogu EcoSystem is open source and it runs either on-premises or in the cloud. The Cloudogu EcoSystem is developed by Cloudogu GmbH under MIT License.

How to get in touch?

Want to talk to the Cloudogu team? Need help or support? There are several ways to get in touch with us:


© 2021 Cloudogu GmbH - MADE WITH ❤ FOR DEV ADDICTS. Legal notice / Impressum

APIs

Provide interfaces to Redmine JSON API (Redmine version 4.1).

Documentation

Index

Constants

View Source
const (
	AuthTypeBasicAuth = iota
	AuthTypeTokenQueryParam
	AuthTypeBasicAuthWithTokenPassword
	AuthTypeNoAuth
)
View Source
const (
	UserStatusAll        string = ""
	UserStatusActive     string = "1"
	UserStatusRegistered string = "2"
	UserStatusLocked     string = "3"
)
View Source
const (
	UserIncludeMemberships string = "memberships"
	UserIncludeGroups      string = "groups"
)
View Source
const NoSetting = -1

Variables

View Source
var DefaultLimit int = NoSetting
View Source
var DefaultOffset int = NoSetting

Functions

This section is empty.

Types

type APIAuth

type APIAuth struct {
	AuthType AuthType
	Token    string
	User     string
	Password string
}

type AuthType

type AuthType int

type Client

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

func NewClient deprecated

func NewClient(endpoint string, auth APIAuth) (*Client, error)

NewClient creates a new Redmine client.

Deprecated: Use redmine.ClientBuilder to create a redmine client that supports more options and detects configuration mistakes.

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)

Project returns a single project without additional fields.

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 endpoint 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 ClientBuilder

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

ClientBuilder takes configurations and safely builds a Redmine client instance.

Minimal example:

client, err := NewClientBuilder().
  Endpoint("https://localhost:3000").
  AuthBasicAuth("adminUser", "passwort1"). // or AuthAPIToken(apiToken)
  Build()

Example for Basic Authentication, skipping self-signed SSL certificates:

client, err := NewClientBuilder().
  Endpoint("https://localhost:3000").
  AuthBasicAuth("adminUser", "passwort1").
  SkipSSLVerify(true).
  Build()

func NewClientBuilder

func NewClientBuilder() *ClientBuilder

NewClientBuilder creates a new ClientBuilder which in turn .

func (*ClientBuilder) AuthAPIToken

func (cb *ClientBuilder) AuthAPIToken(apiKey string) *ClientBuilder

AuthBasicAuth configures an APIAuth instance to use API query tokens. At least one way of authentication must be configured.

func (*ClientBuilder) AuthBasicAuth

func (cb *ClientBuilder) AuthBasicAuth(user, password string) *ClientBuilder

AuthBasicAuth configures an APIAuth instance to use basic authentication credentials. At least one way of authentication must be configured.

func (*ClientBuilder) Build

func (cb *ClientBuilder) Build() (*Client, error)

Build validates the given client configuration and returns a client unless there are configuration errors.

func (*ClientBuilder) Endpoint

func (cb *ClientBuilder) Endpoint(endpoint string) *ClientBuilder

Endpoint configures the URL under which the Redmine is available.

func (*ClientBuilder) ResultLimit

func (cb *ClientBuilder) ResultLimit(limit int) *ClientBuilder

ResultLimit sets the limit of elements in a paged result.

func (*ClientBuilder) ResultOffset

func (cb *ClientBuilder) ResultOffset(offset int) *ClientBuilder

ResultOffset sets the offset for result paging.

func (*ClientBuilder) SkipSSLVerify

func (cb *ClientBuilder) SkipSSLVerify(skip bool) *ClientBuilder

SkipSSLVerify (if set to true) configures the HTTP client to skip SSL certificate verification.

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"`
	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"`
	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 uniquely identifies an issue category system wide (even though it can only be used inside a single project).
	// The Id is computed on creation; after that it is a required field.
	Id int `json:"id"`
	// Project associates this issue category with a project.
	// It is a required field (even though only the project's ID will be accounted for during modification requests).
	Project IdName `json:"project"`
	// Name contains the human readable value of the issue category. Required field.
	Name string `json:"name"`
	// AssignedTo associates this issue category to a user identified by the ID. This user will be automatically assigned
	// on issue creation with this category. Optional field.
	AssignedTo IdName `json:"assigned_to"`
}

IssueCategory is a project specific entity.

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 uniquely identifies a project on technical level. This value will be generated on project creation and cannot
	// be changed. Id is mandatory for all project API calls except CreateProject()
	Id int `json:"id"`
	// ParentID may contain the Id of a parent project. If set, this project is then a child project of the parent project.
	// Projects can be unlimitedly nested.
	ParentID Id `json:"parent_id"`
	// Name contains a human readable project name.
	Name string `json:"name"`
	// Identifier used by the application for various things (eg. in URLs). It must be unique and cannot be composed of
	// only numbers. It must contain 1 to 100 characters of which only consist of lowercase latin characters, numbers,
	// hyphen (-) and underscore (_). Once the project is created, this identifier cannot be modified
	Identifier string `json:"identifier"`
	// Description contains a human readable project multiline description that appears on the project overview.
	Description string `json:"description"`
	// Homepage contains a URL to a project's website that appears on the project overview.
	Homepage string `json:"homepage"`
	// IsPublic controls who can view the project. If set to true the project can be viewed by all the users, including
	// those who are not members of the project. If set to false, only the project members have access to it, according to
	// their role.
	//
	// since Redmine 2.6.0
	IsPublic bool `json:"is_public"`
	// InheritMembers determines whether this project inherits members from a parent project. If set to true (and being a
	// nested project) all members from the parent project will apply also to this project.
	InheritMembers bool `json:"inherit_members"`
	// CreatedOn contains a timestamp of when the project was created.
	CreatedOn string `json:"created_on"`
	// UpdatedOn contains the timestamp of when the project was last updated.
	UpdatedOn string `json:"updated_on"`
}

Project contains a Redmine API project object according Redmine 4.1 REST API.

See also: https://www.redmine.org/projects/redmine/wiki/Rest_api

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