Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added attachments to releases API #3075

Closed
wants to merge 7 commits into from

Conversation

stefan-lacatus
Copy link

See #2084 for details. This is exactly the same PR, just on top of master.

Needs go-gitea/go-sdk#83 to work.

@lunny
Copy link
Member

lunny commented Dec 3, 2017

CI failed

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 3, 2017
@stefan-lacatus
Copy link
Author

Yes, but i don't understand why... I've already run go fmt and the result was the last commit added c788b3d

@@ -461,6 +461,16 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Combo("/:id").Get(repo.GetRelease).
Patch(reqToken(), reqRepoWriter(), bind(api.EditReleaseOption{}), repo.EditRelease).
Delete(reqToken(), reqRepoWriter(), repo.DeleteRelease)
m.Combo("/latest").Get(repo.GetLatestRelease)
m.Group("/:id", func() {
m.Combo("").Get(repo.GetRelease).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 466-468 duplicate lines 461-463; please remove one or the other.

@@ -94,6 +144,29 @@ func ListReleases(ctx *context.APIContext) {
ctx.JSON(200, rels)
}

// GetLatestRelease Gets the latest release in a repository. Draft releases and prereleases are not returned
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Gets -> gets

@@ -94,6 +102,10 @@ func (r *Release) TarURL() string {

// APIFormat convert a Release to api.Release
func (r *Release) APIFormat() *api.Release {
apiAttachments := make([]*api.Attachment, len(r.Attachments))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will only work if r.Attachments has been populated before calling APIFormat(). This means we will need to update each endpoint that uses Release.APIFormat() accordingly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am populating the list in loadAttributes on line 71->78. Is that ok?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I missed that. Never mind then

Copy link
Member

@ethantkoenig ethantkoenig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more

Delete(repo.DeleteRelease)
m.Group("/assets", func() {
m.Combo("").Get(repo.ListReleaseAttachments)
m.Combo("/:assetId").Get(repo.GetReleaseAttachment)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefan-lacatus
Copy link
Author

Quick question: I see you are declaring some swagger definitions as code comments. Is there any documentation on the syntax? Should I do it as well?

@ethantkoenig
Copy link
Member

@stefan-lacatus Yes, please do. Here are the relevant docs; let me know if you have any questions.

Attachments are in misc because they could be reused for issues and comments
@stefan-lacatus
Copy link
Author

Swagger definitions are also included.

I think we should decide if we keep the endpoint which gets a single asset of a single repository. See the discussion on go-gitea/go-sdk#83 (comment)

@lunny lunny added this to the 1.x.x milestone Jan 2, 2018
@lunny lunny added the modifies/api This PR adds API routes or modifies them label Jan 2, 2018
@SnowMB
Copy link
Contributor

SnowMB commented Jan 11, 2018

@stefan-lacatus any progress? It would be awesome to see this feature soon 😄

@jonasfranz
Copy link
Member

This feature got implemented in #3478 in the meantime. So I think that this PR should be closed.

@lunny
Copy link
Member

lunny commented Mar 17, 2018

Closed by #3478

@lunny lunny closed this Mar 17, 2018
@lunny lunny removed this from the 1.x.x milestone Mar 17, 2018
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/api This PR adds API routes or modifies them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants