Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Implement DirectAssetPath for Release Assets Links #1918

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions releaselinks.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ func (s *ReleaseLinksService) GetReleaseLink(pid interface{}, tagName string, li
//
// GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#create-a-release-link
type CreateReleaseLinkOptions struct {
Name *string `url:"name,omitempty" json:"name,omitempty"`
URL *string `url:"url,omitempty" json:"url,omitempty"`
FilePath *string `url:"filepath,omitempty" json:"filepath,omitempty"`
LinkType *LinkTypeValue `url:"link_type,omitempty" json:"link_type,omitempty"`
Name *string `url:"name,omitempty" json:"name,omitempty"`
URL *string `url:"url,omitempty" json:"url,omitempty"`
FilePath *string `url:"filepath,omitempty" json:"filepath,omitempty"`
DirectAssetPath *string `url:"direct_asset_path,omitempty" json:"direct_asset_path,omitempty"`
LinkType *LinkTypeValue `url:"link_type,omitempty" json:"link_type,omitempty"`
}

// CreateReleaseLink creates a link.
Expand Down Expand Up @@ -137,10 +138,11 @@ func (s *ReleaseLinksService) CreateReleaseLink(pid interface{}, tagName string,
//
// GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#update-a-release-link
type UpdateReleaseLinkOptions struct {
Name *string `url:"name,omitempty" json:"name,omitempty"`
URL *string `url:"url,omitempty" json:"url,omitempty"`
FilePath *string `url:"filepath,omitempty" json:"filepath,omitempty"`
LinkType *LinkTypeValue `url:"link_type,omitempty" json:"link_type,omitempty"`
Name *string `url:"name,omitempty" json:"name,omitempty"`
URL *string `url:"url,omitempty" json:"url,omitempty"`
FilePath *string `url:"filepath,omitempty" json:"filepath,omitempty"`
DirectAssetPath *string `url:"direct_asset_path,omitempty" json:"direct_asset_path,omitempty"`
LinkType *LinkTypeValue `url:"link_type,omitempty" json:"link_type,omitempty"`
}

// UpdateReleaseLink updates an asset link.
Expand Down
14 changes: 7 additions & 7 deletions releaselinks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ func TestReleaseLinksService_CreateReleaseLink(t *testing.T) {
{
description: "Optional Attributes",
options: &CreateReleaseLinkOptions{
Name: Ptr("release-notes.md"),
URL: Ptr("http://192.168.10.15:3000"),
FilePath: Ptr("docs/release-notes.md"),
LinkType: Ptr(OtherLinkType),
Name: Ptr("release-notes.md"),
URL: Ptr("http://192.168.10.15:3000"),
DirectAssetPath: Ptr("docs/release-notes.md"),
LinkType: Ptr(OtherLinkType),
},
response: `{
"id":1,
Expand Down Expand Up @@ -159,9 +159,9 @@ func TestReleaseLinksService_UpdateReleaseLink(t *testing.T) {
releaseLink, _, err := client.ReleaseLinks.UpdateReleaseLink(
1, exampleTagName, 1,
&UpdateReleaseLinkOptions{
Name: Ptr(exampleReleaseName),
FilePath: Ptr("http://192.168.10.15:3000/namespace/example/-/releases/v0.1/downloads/awesome-v0.2.dmg"),
LinkType: Ptr(OtherLinkType),
Name: Ptr(exampleReleaseName),
DirectAssetPath: Ptr("http://192.168.10.15:3000/namespace/example/-/releases/v0.1/downloads/awesome-v0.2.dmg"),
LinkType: Ptr(OtherLinkType),
})

require.NoError(t, err)
Expand Down
9 changes: 5 additions & 4 deletions releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,11 @@ type ReleaseAssetsOptions struct {
// GitLab API docs:
// https://docs.gitlab.com/ee/api/releases/index.html#create-a-release
type ReleaseAssetLinkOptions struct {
Name *string `url:"name,omitempty" json:"name,omitempty"`
URL *string `url:"url,omitempty" json:"url,omitempty"`
FilePath *string `url:"filepath,omitempty" json:"filepath,omitempty"`
LinkType *LinkTypeValue `url:"link_type,omitempty" json:"link_type,omitempty"`
Name *string `url:"name,omitempty" json:"name,omitempty"`
URL *string `url:"url,omitempty" json:"url,omitempty"`
FilePath *string `url:"filepath,omitempty" json:"filepath,omitempty"`
DirectAssetPath *string `url:"direct_asset_path,omitempty" json:"direct_asset_path,omitempty"`
LinkType *LinkTypeValue `url:"link_type,omitempty" json:"link_type,omitempty"`
}

// CreateRelease creates a release.
Expand Down
4 changes: 2 additions & 2 deletions releases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func TestReleasesService_CreateReleaseWithAsset(t *testing.T) {
Description: Ptr("Description"),
Assets: &ReleaseAssetsOptions{
Links: []*ReleaseAssetLinkOptions{
{Ptr("sldkf"), Ptr("sldkfj"), Ptr("sldkfh"), Ptr(OtherLinkType)},
{Ptr("sldkf"), Ptr("sldkfj"), Ptr("sldkfh"), Ptr("direct-asset-path"), Ptr(OtherLinkType)},
},
},
}
Expand Down Expand Up @@ -190,7 +190,7 @@ func TestReleasesService_CreateReleaseWithAssetAndNameMetadata(t *testing.T) {
Description: Ptr("Description"),
Assets: &ReleaseAssetsOptions{
Links: []*ReleaseAssetLinkOptions{
{Ptr("sldkf"), Ptr("sldkfj"), Ptr("sldkfh"), Ptr(OtherLinkType)},
{Ptr("sldkf"), Ptr("sldkfj"), Ptr("sldkfh"), Ptr("direct-asset-path"), Ptr(OtherLinkType)},
},
},
}
Expand Down
Loading