new Friends(opts)
Friends wrapper for friends-related API calls.
Parameters:
| Name | Type | Description |
|---|---|---|
opts |
Object |
- Source:
Methods
-
addFriend(username, cb)
-
Adds username as a friend.
Parameters:
Name Type Description usernamestring The user to add.
cbfunction - Source:
-
addFriendBack(username, cb)
-
Use this to add back a user who has added you as a friend. Sort of like accepting a friend request.
This only affects the "added by" string the other user will see.
Parameters:
Name Type Description usernamestring The username of the user to add back.
cbfunction - Source:
-
addFriends(toAdd, toUnfriend, cb)
-
Adds the users in toAdd as friends, and unfriends the users in toUnfriend.
Parameters:
Name Type Description toAddArray.<string> An array of username strings of users to add. Doesn't matter if they're already in your friends.
toUnfriendArray.<string> An array of username strings of users to un-friend. Doesn't matter if they're not already in your friends.
cbfunction - Source:
-
blockUser(username, cb)
-
Blocks username.
Parameters:
Name Type Description usernamestring The username of the user to block.
cbfunction - Source:
-
findFriends(friends, cb)
-
Finds friends given phone numbers and names.
friends is a number->name map, where "name" is the desired screen name of that friend and "number" is their phone number. The names given will be used as display names for any usernames found.
Parameters:
Name Type Description friendsObject a dictionary with phone number strings as the keys and name strings as the values.
cbfunction - Source:
-
findFriendsNear(location, accuracy, milliseconds, cb)
-
Finds nearby snapchatters who are also looking for nearby snapchatters.
Parameters:
Name Type Description locationObject The location to search from { lat, lng }.
accuracynumber The radius in meters to find nearby snapchatters at location. Defaults to 10.
millisecondsnumber The total poll duration so far. If you're polling in a for-loop for example, pass the time in milliseconds since you started polling. This has been guess-work, but I think it's right.
cbfunction - Source:
-
searchFriend()
-
Not sure what this is for.
- Source:
-
seenSuggestedFriends(seen, cb)
-
This appears to be for an upcoming feature: suggested friends?
Parameters:
Name Type Description usernames.Array.<string> seenboolean Whether to mark as seen.
cbfunction - Source:
-
unblockUser(username, cb)
-
Unblocks username.
Parameters:
Name Type Description usernamestring The username of the user to block.
cbfunction - Source:
-
unfriend(username, cb)
-
Unfriends username.
Parameters:
Name Type Description usernamestring The username of the user to unfriend.
cbfunction - Source:
-
updateDisplayNameForUser(friend, displayName, cb)
-
Updates the display name for one of your friends.
Parameters:
Name Type Description friendstring The username to give the new display name to.
displayNamestring The new display name.
cbfunction - Source:
-
userExists(username, cb)
-
Checks to see whether username is a registered username.
Parameters:
Name Type Description usernamestring cbfunction - Source: