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

Methods for Checks API #182

Merged
merged 4 commits into from Apr 16, 2020
Merged

Methods for Checks API #182

merged 4 commits into from Apr 16, 2020

Conversation

axel-op
Copy link
Contributor

@axel-op axel-op commented Oct 17, 2019

This is a non-breaking PR.

I have implemented some methods to interact with the Checks API (https://developer.github.com/v3/checks) for my personal use, I thought I could make this draft PR to merge them later.

@axel-op axel-op changed the title Methods for checks API Methods for Checks API Oct 17, 2019
@robrbecker
Copy link
Member

Thanks! Checks API would be fantastic to have!

@axel-op
Copy link
Contributor Author

axel-op commented Oct 23, 2019

@robrbecker I don't think I'll progress on this anytime soon.
I have implemented some methods in https://developer.github.com/v3/checks/runs.
Remain the methods in https://developer.github.com/v3/checks/suites.

Also, I have not implemented listCheckRunsForRef and listCheckRunsInSuite as their response format is not a list as it is usually the case with multi-pages responses, and I don't think that current internal methods can handle this format to return a stream.

@robrbecker
Copy link
Member

Thanks for your work. I'm not in a hurry if you want to take your time. Or maybe you're saying you're not planning on finishing it and you'd like someone to take it over?

@axel-op
Copy link
Contributor Author

axel-op commented Nov 3, 2019

Or maybe you're saying you're not planning on finishing it and you'd like someone to take it over?

This is what I meant. I don't need the unimplemented methods and I have other priorities for now.

@axel-op
Copy link
Contributor Author

axel-op commented Nov 11, 2019

@robrbecker While merging your recent changes into my branch, I had to make the requestJson method public. Tell me if this is OK for you.

@robrbecker
Copy link
Member

everything else is public, so I think that'll be fine.

@axel-op
Copy link
Contributor Author

axel-op commented Mar 9, 2020

I've finally implemented the methods for every endpoint of the Checks API.

This PR is ready for review.

@axel-op axel-op force-pushed the checks branch 5 times, most recently from 342c94a to 2afd6b7 Compare March 9, 2020 17:33
@@ -15,7 +17,8 @@ String buildQueryString(Map<String, dynamic> params) {
if (params[key] == null) {
continue;
}
queryString.write('$key=${Uri.encodeComponent(params[key].toString())}');
// TODO: change to library-specific json encoding
queryString.write('$key=${Uri.encodeComponent(jsonEncode(params[key]))}');
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain why we're jsonEncodeing all objects that are values? This makes me a little nervous that we might break other things so I'd like to understand it better? 🤷

change to library-specific json encoding
Also, I'm not sure I know what you mean by that. Could you give me more information so when I or another person wants to address this TODO we know what we're doing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. I made this change following the edit of the type of accepted values in this params map (String to dynamic), but on second thought it's a little risky.

This TODO was related to my other PR, I'll remove it.

My idea was to call an encoding function to serialize values that wouldn't be strings.

return _urlShortener ??= UrlShortenerService(this);
}
UrlShortenerService get urlShortener =>
_urlShortener ??= UrlShortenerService(this);
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for shortening up this code and above.

@robrbecker
Copy link
Member

@axel-op This looks really good. Just 2 questions really and you'll need to resolve conflicts with master (a method was added in master)

Add operators to CheckRunAnnotationLevel class
Edit API link for updatePreferencesForCheckSuites and send the request with a body
other.endLine == this.endLine &&
other.title == this.title &&
other.message == this.message &&
other.rawDetails == this.rawDetails;
Copy link
Member

Choose a reason for hiding this comment

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

I'm getting some lints that all these this. are redundant and can be removed

Copy link
Member

@robrbecker robrbecker left a comment

Choose a reason for hiding this comment

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

Looks good! One nit about unnecessary_this lints .. but I can address that afterwards

@robrbecker robrbecker merged commit dc502e2 into SpinlockLabs:master Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants