-
Notifications
You must be signed in to change notification settings - Fork 160
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 files and trees client #77
add files and trees client #77
Conversation
5ac7dd8
to
dd735a0
Compare
link to see current commit author: https://github.com/nmklotas/GitLabApiClient/pull/77/commits/dd735a058f6546f32b2e93e588ebce8a449b393c.patch @rrampen Or look into fixing your git user.email config 😅 to get proper credit for your commits 🏆 |
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.
Overall looks really good, would be good if you could add XML comments to each public method.
Codecov Report
@@ Coverage Diff @@
## master #77 +/- ##
==========================================
+ Coverage 71.86% 72.61% +0.75%
==========================================
Files 133 139 +6
Lines 1930 1983 +53
==========================================
+ Hits 1387 1440 +53
Misses 543 543
|
src/GitLabApiClient/FileClient.cs
Outdated
_httpFacade = httpFacade; | ||
_fileQueryBuilder = fileQueryBuilder; | ||
} | ||
public async Task<File> GetAsync(ProjectId projectId, string filePath, Action<FileQueryOptions> options = null) |
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.
Just tested the file
api, as ref
option is mandatory I believe it is best to have it as a parameter and not as an option, that is somewhat hidden.
The Files API only have a ref
query option, doc even says it is required
https://docs.gitlab.com/ee/api/repository_files.html#get-file-from-repository
sadly enough this is not true for the tree
api: https://docs.gitlab.com/ee/api/repositories.html it will assume default branch
if ref
is not provided. Gotta love GitLab's inconsistent API 😆
So I suggest for now we remove the FileQueryOptions
and just switch to projects/{projectId}/repository/files/{filePath.UrlEncode()}?ref={reference}
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 think it would be nice to provide an option to convert File
to Content
by handling the decoding of base64.
public string Path { get; set; } | ||
public bool Recursive { get; set; } | ||
|
||
internal TreeQueryOptions(string reference = null, string path = null, bool recursive = true) |
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.
Recursive should not default to true
internal TreeQueryOptions(string reference = null, string path = null, bool recursive = true) | |
internal TreeQueryOptions(string reference = null, string path = null, bool recursive = false) |
@rrampen thanks for your first open source contribution 👏 Hope you don't mind that I finished the feature 🧙♂️ |
Co-authored-by: Joseph Petersen <josephp90@gmail.com>
Came across this very helpful tool. Missed the possibility to read the content from files. Added this in this PR.