Documentation ¶
Overview ¶
Package youtrack implements REST API client that can be used with YouTrack as described in https://www.jetbrains.com/help/youtrack/incloud/Resources-for-Developers.html
Index ¶
- Variables
- func IssueURL(baseURL *url.URL, shortProjectName string, issueNumberInProject int) *url.URL
- type Api
- func (api *Api) CreateIssue(ctx context.Context, project, summary, description string) (*IssueResult, error)
- func (api *Api) CreateIssueAttachment(ctx context.Context, issueID string, attachment io.Reader, ...) (string, error)
- func (api *Api) DoRequest(ctx context.Context, resource *url.URL, method string, ...) error
- func (api *Api) Get(ctx context.Context, resource *url.URL, jsonResult interface{}) error
- func (api *Api) IssueURL(shortProjectName string, issueNumberInProject int) *url.URL
- func (api *Api) ListProjects(ctx context.Context) ([]Project, error)
- func (api *Api) Post(ctx context.Context, resource *url.URL, jsonRequest, jsonResult interface{}) error
- func (api *Api) ProjectIDForShortName(ctx context.Context, shortName string) (string, error)
- type IDResult
- type Issue
- type IssueAttachment
- type IssueResult
- type Project
- type ProjectID
Constants ¶
This section is empty.
Variables ¶
var NotFoundError = errors.New("Not Found")
Functions ¶
Types ¶
type Api ¶
type Api struct { // BaseURL is the URL to the REST API endpoint for a YouTrack Project. It should // end is a slash. For example: https://goyt.myjetbrains.com/youtrack/api/ BaseURL *url.URL // Token is the permanent token used to make authenticated requests. // For more information, see: // https://www.jetbrains.com/help/youtrack/incloud/authentication-with-permanent-token.html Token string // EnableTracing turns on extra logging, including HTTP request/response logging. // NOTE that the authorization token will be logged when this is enabled. EnableTracing bool }
Api is the YouTrack API context. BaseURL and Token must be set.
func NewDefaultApi ¶
NewDefaultApi returns a new API using a baseURL and permanent authorization token from either flags or environment.
func (*Api) CreateIssue ¶
func (api *Api) CreateIssue(ctx context.Context, project, summary, description string) (*IssueResult, error)
CreateIssue returns the issue ID on success.
func (*Api) CreateIssueAttachment ¶
func (api *Api) CreateIssueAttachment(ctx context.Context, issueID string, attachment io.Reader, name, mediaType string) (string, error)
CreateIssueAttachment attached a file to the given issue ID. On success, the attachment ID is returned.
func (*Api) DoRequest ¶
func (api *Api) DoRequest(ctx context.Context, resource *url.URL, method string, jsonRequest, jsonResult interface{}) error
DoRequest makes an authenticated HTTP request to the YouTrack API. jsonRequest and jsonResult are both optional, and depend on the request being made. A GET request, for example, should probably set jsonRequestBody to nil.
func (*Api) ListProjects ¶
ListProjects returns a list of Projects the user has access to. For more information, see https://www.jetbrains.com/help/youtrack/incloud/2019.3/resource-api-admin-projects.html