venmo / venmo-ios-sdk

Make and accept payments in your iOS app via Venmo
MIT License
178 stars 57 forks source link

added support for getting all friends of the user #54

Closed recurse-id closed 8 years ago

magni- commented 9 years ago

Just a heads up: this doesn't necessarily return all friends, you may have to paginate. See https://developer.venmo.com/docs/endpoints/users

recurse-id commented 9 years ago

without providing the before, after or limit parameters how many friends does the GET request respond with?

magni- commented 9 years ago

The default limit is 20 users.

eliperkins commented 9 years ago

Thanks for submitting this, @urvishparikh ! :octocat:

What @magni- mentioned is correct, the API does not return all users at once. Would you mind refactoring the method to be +- (void)getFriendsWithLimit:(NSNumber *)limit beforeUserID:(NSString *)beforeUserID afterUserID:(NSString *)afterUserID completionHandler:(VENGenericRequestCompletionHandler)handler;? You can find more documentation of the request scheme and API at the link @magni- mentioned (https://developer.venmo.com/docs/endpoints/users). Keep in mind that limit and both user IDs are allowed to be nil. By creating the API this way, we can allow different clients to implement pagination how they see necessary, rather than forcing a style of pagination from within the SDK.

If you'd like help in implementing this, let me know! Cheers.

recurse-id commented 9 years ago

Thanks for the info eliperkins, magni-, I'll have this modification in soon.

recurse-id commented 9 years ago

Is there a test account I can use that has more than 20 friends?

eliperkins commented 9 years ago

Unfortunately, Venmo does not have test accounts. I can help you verify though, as my account has more than 20!

I left a couple of pieces of feedback. Let me know if you'd like help testing after you make those changes.

recurse-id commented 9 years ago

Give it a test drive!

recurse-id commented 9 years ago

Eventually we would want to create a completion handler

typedef void (^VENGetFriendsCompletionHandler)(VENFriends response, BOOL success, NSError *error);

VENFriends should have some methods to make a call for the next or previous getFriends request based on pagination.

recurse-id commented 9 years ago

@eliperkins Did it work?

TaterSalad commented 9 years ago

@eliperkins where can I access the method mentioned above to get a user's friends list?

+- (void)getFriendsWithLimit:(NSNumber )limit beforeUserID:(NSString )beforeUserID afterUserID:(NSString *)afterUserID completionHandler:(VENGenericRequestCompletionHandler)handler;

I can't seem to do that without using the HTTP handler and a GET request

ayanonagon commented 8 years ago

Hi @urvishparikh thanks for this pull-request, and sorry for the delayed response. We’re working on a way better API client for Venmo right now, so we’re no longer actively adding features to this existing SDK. Of course you are more than welcome to add more features in your fork of the project.

Thanks again for your PR and let us know if you have any questions. Thanks! :octocat: