-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 GetAll method to OrganizationsClient #1469
Add GetAll method to OrganizationsClient #1469
Conversation
Renamed the existing organizations uri to userOrganizations and created a new organizations uri.
Hi @malamour-work thanks heaps for your contribution! 😀 A couple of things for you: Breaking changes to public interfaces/methodsBeing a public API we do need to be careful about not breaking existing users and the renamed methods in It makes sense to rename the existing Maintaining naming consistencyWe try to follow a naming convention where Process for breaking changes:Create the new method/implementation/classes and mark any old ones as We wait at least 2 releases before removing the obsolete items from the code base. This gives users some notice (in the form of compiler warnings) before things change on them 👍 Let me know if you need any help with this and thanks for stepping up to correct this missing functionality! |
@@ -20,6 +20,7 @@ public static partial class ApiUrls | |||
static readonly Uri _currentUserOwnedAndMemberIssues = new Uri("user/issues", UriKind.Relative); | |||
static readonly Uri _oauthAuthorize = new Uri("login/oauth/authorize", UriKind.Relative); | |||
static readonly Uri _oauthAccessToken = new Uri("login/oauth/access_token", UriKind.Relative); | |||
static readonly Uri _organizationUrl = new Uri("organizations", UriKind.Relative); |
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.
Id like to steer away from these class level variables (that are only used in one place anyway) in favour of just returning the Urls in the helper method below
{ | ||
return "users/{0}/orgs".FormatUri(login); | ||
} | ||
|
||
/// <summary> | ||
/// Returns the <see cref="Uri"/> that returns all of the organizations for the currently logged in user. |
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.
Extra text here from cut+paste 😀
Returns the that returns all of the organizations for the currently logged in user
Another thing I just realized is that the API docs mentions this "List organizations" API method is not paginated like normal methods (pagesize, count etc), and instead just uses the |
…ible. Created new client method and marked the old one [Obsolete] to be removed in a futur release. Created a new request class to support the since attribute. Updated the Unit Tests Updated all the csproj to have the proper references.
Applied the modification from the review
Hi @ryangribble Thanks for your time and for the review. I did the modification you have requested. |
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.
Hey @malamour-work thanks for making those changes, I think we are almost done!
- Given the "old"
GetAll
method has been obsoleted/renamed toGetAllForUser()
I think it makes sense to also obsolete/rename theApiUrls.Organizations()
toApiUrls.UserOrganizations()
while we're going through the obsoleting process. This will aid in future consistency and remove confusion over the previous naming of these methods - Could you please add integration tests for your new methods so we can ensure they do work in the real world? At a minimum you'd want to make the new call and assert a non null/empty list is returned. Bonus points for a 2nd test which makes 2 calls using different "since" parameters and asserting that the lists returned are different! This is similar to the integration tests we have for methods that paginate using
ApiOptions
where we call the method with differing page counts and assert the returned lists are different
} | ||
|
||
[Fact] | ||
public async Task RequestsTheCorrectUrlWithApiOptions() |
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.
Since this isn't actually using ApiOptions
it should be named something else, perhaps RequestsTheCorrectUrlWithRequestParameter
…anizations method.
Renamed the existing one to make it clear they test the user organization.
Hi @ryangribble I have obsoleted the old If anything else let me know. Thanks |
Thanks @malamour-work sorry I hadnt had a chance over the weekend to look at this. I will try and do it tonight. Have you actually run the integration tests? I notice they are flagged as GitHubEnterprise (because they create organizations to then run the tests against, and create organizations is not avaialble on github.com only github enterprise). For something like a GET call, we could potentially run the test against github.com but I guess that becomes hard since we dont know what organization ID to use as the I wll pull this down and run the tests etc and get back to you |
GetAll
method to OrganizationsClient
GetAll
method to OrganizationsClient
Hi,
I noticed that the list all organizations
GET /organizations
listed here https://developer.github.com/v3/orgs/ was missing from the OrganizationClient. I did not find any issue related to this in the backlog.I added the implementation in the two client that i found (Base and Observable) with the documentation and added some unit tests.
Let me know if i forgot something or if something need to be changed.