Documentation
¶
Index ¶
- Variables
- func ParseDateTime(dateTime string) (time.Time, error)
- type Assets
- type Author
- type Client
- func (gc *Client) CreateRelease(ctx context.Context, createReleaseReq *CreateReleaseRequest) (*ReleaseResponse, error)
- func (gc *Client) GetRelease(ctx context.Context, tagName string, includeHTML bool) (*ReleaseResponse, error)
- func (gc *Client) UpdateRelease(ctx context.Context, updateReleaseRequest *UpdateReleaseRequest) (*ReleaseResponse, error)
- type Commit
- type CreateReleaseRequest
- type Date
- type ErrorResponse
- type Evidence
- type HTTPClient
- type Link
- type Milestone
- type MockHTTPClient
- type ReleaseResponse
- type UpdateReleaseRequest
Constants ¶
This section is empty.
Variables ¶
var ConflictDirectAssetPathError = fmt.Errorf("asset link can either specify `direct_asset_path` or `filepath` (`filepath` is deprecated).")
ConflictDirectAssetPathError is returned when both direct_asset_path and the deprecated filepath as specified for an asset link.
Functions ¶
Types ¶
type Assets ¶ added in v0.3.0
type Assets struct {
Count int `json:"count,omitempty"`
Sources []struct {
Format string `json:"format"`
URL string `json:"url"`
} `json:"sources,omitempty"`
Links []*Link `json:"links"`
}
Assets describes the assets as Links associated to a release.
func AssetMarshaller ¶ added in v0.11.0
AssetMarshaller parses asset links, either single instance of them or as an array.
func ParseAssets ¶ added in v0.3.0
ParseAssets generates an instance of Asset from names and urls
type Author ¶ added in v0.9.0
type Author struct {
ID int `json:"id"`
Name string `json:"name"`
Username string `json:"username"`
State string `json:"state"`
AvatarURL string `json:"avatar_url"`
WebURL string `json:"web_url"`
}
Author body
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used to send requests to the GitLab API. Normally created with the `New` function
func New ¶
func New(serverURL, jobToken, privateToken, projectID string, httpClient HTTPClient, logger log.FieldLogger) (*Client, error)
New creates a new GitLab Client
func (*Client) CreateRelease ¶
func (gc *Client) CreateRelease(ctx context.Context, createReleaseReq *CreateReleaseRequest) (*ReleaseResponse, error)
CreateRelease will try to create a release via GitLab's Releases API
func (*Client) GetRelease ¶ added in v0.9.0
func (gc *Client) GetRelease(ctx context.Context, tagName string, includeHTML bool) (*ReleaseResponse, error)
GetRelease by tagName
func (*Client) UpdateRelease ¶ added in v0.14.0
func (gc *Client) UpdateRelease(ctx context.Context, updateReleaseRequest *UpdateReleaseRequest) (*ReleaseResponse, error)
UpdateRelease will try to update a release via GitLab's Releases API
type Commit ¶ added in v0.9.0
type Commit struct {
ID string `json:"id"`
ShortID string `json:"short_id"`
Title string `json:"title"`
CreatedAt time.Time `json:"created_at"`
ParentIds []string `json:"parent_ids"`
Message string `json:"message"`
AuthorName string `json:"author_name"`
AuthorEmail string `json:"author_email"`
AuthoredDate time.Time `json:"authored_date"`
CommitterName string `json:"committer_name"`
CommitterEmail string `json:"committer_email"`
CommittedDate time.Time `json:"committed_date"`
}
Commit body
type CreateReleaseRequest ¶
type CreateReleaseRequest struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
TagName string `json:"tag_name"`
TagMessage string `json:"tag_message"`
Ref string `json:"ref,omitempty"`
Assets *Assets `json:"assets,omitempty"`
Milestones []string `json:"milestones,omitempty"`
ReleasedAt *time.Time `json:"released_at,omitempty"`
LegacyCatalogPublish *bool `json:"legacy_catalog_publish,omitempty"`
}
CreateReleaseRequest body. The full documentation can be found at https://docs.gitlab.com/ee/api/releases/index.html#create-a-release
type Date ¶ added in v0.10.0
Date is a custom time.Time wrapper that can parse a date without a timestamp See https://gitlab.com/gitlab-org/release-cli/-/issues/121.
func (Date) MarshalJSON ¶ added in v0.10.0
MarshalJSON implements the json.Marshaler interface
func (*Date) UnmarshalJSON ¶ added in v0.10.0
UnmarshalJSON implements the json.Unmarshaler interface
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message,omitempty"`
// Err will only be populated if the Releases API returns an unexpected error and is not contained in Message
Err string `json:"error,omitempty"`
// contains filtered or unexported fields
}
ErrorResponse expected from the API
func (*ErrorResponse) Error ¶
func (er *ErrorResponse) Error() string
Error implements the error interface. Wraps an error message from the API into an error type
type Evidence ¶ added in v0.9.0
type Evidence struct {
Sha string `json:"sha"`
Filepath string `json:"filepath"`
CollectedAt time.Time `json:"collected_at"`
}
Evidence body
type HTTPClient ¶
HTTPClient is an interface that describes the available actions of the client. Use http.Client during runtime. See mock_httpClient_test.go for a testing implementation
type Link ¶ added in v0.3.0
type Link struct {
ID int64 `json:"id,omitempty"`
Name string `json:"name"`
URL string `json:"url"`
LinkType string `json:"link_type,omitempty"`
DirectAssetPath string `json:"direct_asset_path,omitempty"`
// Deprecated Filepath redirects to `direct_asset_path` and will be removed in %18.0.
Filepath string `json:"filepath,omitempty"`
}
Link describes the Link request/response body.
type Milestone ¶ added in v0.3.0
type Milestone struct {
ID int `json:"id"`
Iid int `json:"iid"`
ProjectID int `json:"project_id"`
Title string `json:"title"`
Description string `json:"description"`
State string `json:"state"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DueDate *Date `json:"due_date"`
StartDate *Date `json:"start_date"`
WebURL string `json:"web_url"`
IssueStats struct {
Total int `json:"total"`
Closed int `json:"closed"`
} `json:"issue_stats"`
}
Milestone response body when creating a release. Only uses a subset of all the fields. The full documentation can be found at https://docs.gitlab.com/ee/api/releases/index.html#create-a-release
type MockHTTPClient ¶ added in v0.2.0
MockHTTPClient is an autogenerated mock type for the HTTPClient type
func NewMockHTTPClient ¶ added in v0.16.0
func NewMockHTTPClient(t interface {
mock.TestingT
Cleanup(func())
}) *MockHTTPClient
NewMockHTTPClient creates a new instance of MockHTTPClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
type ReleaseResponse ¶ added in v0.14.0
type ReleaseResponse struct {
Name string `json:"name"`
Description string `json:"description"`
DescriptionHTML string `json:"description_html"`
TagName string `json:"tag_name"`
CreatedAt time.Time `json:"created_at"`
ReleasedAt time.Time `json:"released_at"`
Assets *Assets `json:"assets"`
Milestones []*Milestone `json:"milestones"`
Author *Author `json:"author"`
Commit *Commit `json:"commit"`
CommitPath string `json:"commit_path"`
TagPath string `json:"tag_path"`
Evidences []*Evidence `json:"evidences"`
}
ReleaseResponse body. The full documentation can be found at https://docs.gitlab.com/ee/api/releases/index.html
type UpdateReleaseRequest ¶ added in v0.14.0
type UpdateReleaseRequest struct {
ID string `json:"id"`
TagName string `json:"tag_name"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Milestones []string `json:"milestones,omitempty"`
ReleasedAt *time.Time `json:"released_at,omitempty"`
}
UpdateReleaseRequest body. The full documentation can be found at https://docs.gitlab.com/ee/api/releases/index.html#update-a-release