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 username
string The user to add.
cb
function - 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 username
string The username of the user to add back.
cb
function - Source:
-
addFriends(toAdd, toUnfriend, cb)
-
Adds the users in toAdd as friends, and unfriends the users in toUnfriend.
Parameters:
Name Type Description toAdd
Array.<string> An array of username strings of users to add. Doesn't matter if they're already in your friends.
toUnfriend
Array.<string> An array of username strings of users to un-friend. Doesn't matter if they're not already in your friends.
cb
function - Source:
-
blockUser(username, cb)
-
Blocks username.
Parameters:
Name Type Description username
string The username of the user to block.
cb
function - 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 friends
Object a dictionary with phone number strings as the keys and name strings as the values.
cb
function - Source:
-
findFriendsNear(location, accuracy, milliseconds, cb)
-
Finds nearby snapchatters who are also looking for nearby snapchatters.
Parameters:
Name Type Description location
Object The location to search from { lat, lng }.
accuracy
number The radius in meters to find nearby snapchatters at location. Defaults to 10.
milliseconds
number 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.
cb
function - 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> seen
boolean Whether to mark as seen.
cb
function - Source:
-
unblockUser(username, cb)
-
Unblocks username.
Parameters:
Name Type Description username
string The username of the user to block.
cb
function - Source:
-
unfriend(username, cb)
-
Unfriends username.
Parameters:
Name Type Description username
string The username of the user to unfriend.
cb
function - Source:
-
updateDisplayNameForUser(friend, displayName, cb)
-
Updates the display name for one of your friends.
Parameters:
Name Type Description friend
string The username to give the new display name to.
displayName
string The new display name.
cb
function - Source:
-
userExists(username, cb)
-
Checks to see whether username is a registered username.
Parameters:
Name Type Description username
string cb
function - Source: