-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add API endpoint for accessing repo topics #7963
Merged
Merged
Changes from 10 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
ded028c
Create API endpoints for repo topics.
davidsvantesson 6965aa8
Generate swagger
davidsvantesson 5a87bab
Add documentation to functions
davidsvantesson 0839b96
Grammar fix
davidsvantesson 244cbd3
Fix function comment
davidsvantesson 7c721f9
Merge branch 'master' into api-repo-topics
davidsvantesson f0f49bd
Can't use FindTopics when looking for a single repo topic, as it does…
davidsvantesson 6ec5a0c
Add PUT /repos/{owner}/{repo}/topics and remove GET /repos/{own…
davidsvantesson 8daf641
Ignore if topic is sent twice in same request, refactoring.
davidsvantesson 9fdab25
Fix topic dropdown with api changes.
davidsvantesson 1cb206c
Style fix
davidsvantesson c13a297
Update API documentation
davidsvantesson 4a53681
Better way to handle duplicate topics in slice
davidsvantesson 3705219
Make response element TopicName an array of strings, instead of using…
davidsvantesson ac93677
Add test cases for API Repo Topics.
davidsvantesson 8bc836c
Fix format of tests
davidsvantesson 3af43e2
Fix comments
davidsvantesson 0e671f0
Merge branch 'master' into api-repo-topics
davidsvantesson 5cdbbbc
Fix unit tests after adding some more topics to the test fixture.
davidsvantesson db3f6f3
Update models/topic.go
davidsvantesson 2ef6904
Engine as first parameter in function
davidsvantesson 99eb479
Replace magic numbers with http status code constants.
davidsvantesson ed7604a
Fix variable scope
davidsvantesson 1088eac
Test one read with login and one with token
davidsvantesson 098af67
Add some more tests
davidsvantesson 41b6276
Apply suggestions from code review
davidsvantesson b654ebf
Add test case to check access for user with write access
davidsvantesson 48989c3
Fix access, repo admin required to change topics
davidsvantesson db48d14
Correct first test to be without token
davidsvantesson fa8aa5d
Any repo reader should be able to access topics.
davidsvantesson 1a6a8fc
Merge branch 'master' into api-repo-topics
davidsvantesson 9d9f8dc
No need for string pointer
davidsvantesson 6d9152f
Merge branch 'master' into api-repo-topics
davidsvantesson 189d900
Merge branch 'master' into api-repo-topics
lafriks 0b8409a
Merge branch 'master' into api-repo-topics
sapk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2019 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package structs | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
// TopicResponse for returning topics | ||
type TopicResponse struct { | ||
ID int64 `json:"id"` | ||
Name string `json:"topic_name"` | ||
RepoCount int `json:"repo_count"` | ||
Created time.Time `json:"created"` | ||
Updated time.Time `json:"updated"` | ||
} | ||
|
||
// RepoTopicOptions a collection of repo topic names | ||
type RepoTopicOptions struct { | ||
// list of topic names | ||
Topics []string `json:"topics"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To not have use go-to labels first create map with cleaned up topics and then loop thorough keys to validate them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment still stands ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I felt it was bad code but hit my limits of go knowledge 😄. Did you mean something like this?