Getting all twitter followers using twitterizer - twitter

I am using Twitterizer 2. in general it does the job very well, but I have one thing missing.
I need to get all the followers of my user. and the method brings Twitterizer.TwitterFriendship.Followers(Token) only brings 100 of them.
in the twitter API I saw that you can use a cursor for "paging" you request, but I couldn't find this functionality in twitterizer.
Any Idea anyone?

The TwitterUserCollection class (that is returned by the Followers method) have NextPage() and PreviousPage() methods that will perform the paging for you.
For example, to get all of your followers, you can perform this:
TwitterUserCollection myFollowers = TwitterFriendship.Followers(token);
while (myFollowers != null)
{
// Do something with the users here
// Get the next page
myFollowers = myFollowers.NextPage();
}
If you have additional questions, please post them in our forums: http://forums.twitterizer.net/

Related

Slack API - Detecting user in a call?

Is there an endpoint in Slack API to detect a user (AKA me) is in a call? getPresence just returns 'active' and 'away' which is not helpful - I can be active but not in a call. I tried getting user status, that is of no help either
There's no API that will return that information at this time. The calls.info method would return a list of users in a specific call but you'd need to know the call id for that. Something as simple as knowing if any given user is on a call would be a great feature request for the users.getPresence method. Happy to pass that along!

Parse & Swift - How to Reduce Server Load/Requests?

I've been developing an application that has a home page, similar to that of Instagram's where the number of comments is displayed below a post as the user scrolls. Once the user taps on the label with the number of comments, the actuals comments will then load onto the screen. I've been trying to achieve something similar to that with my application, but I feel as if the method that I am doing this with is sending to many requests (queries) to the server in order to get the number of comments to display below each post. I was wondering if there was a more efficient/concise way to do this that would reduce the server load, but still have the same effect.
To add more context (Note: I'm using Parse):
I have a class named Posts which contains the posts
I have a class named Comments which contains all of the submitted comments. In order to obtain the comments for a particular post, I query for comments (which have a column named: "parentObjectID") whose column ("parentObjectID") matches with the parent post's object ID.
Example code is below:
let query = PFQuery(className: "Comments")
query.whereKey("parentObjectID", equalTo: objectIDs[indexPathNums])
query.order(byDescending: "createdAt")
query.findObjectsInBackground { (objects, error) in
if error != nil {
print("An error occured (USQVC Comments Query)")
}else {
if let tempArray = objects {
for comment in tempArray {
if let x = comment {
myArray.append(x)
}
}
commentsCount = myArray.count
myArray.removeAll()
}
}
}
Even though they've updated their UI, I just wanted to include a picture in case what I was describing was unclear:
I'd appreciate it if anybody could help me out with this. Thanks!
As you pointed out in your comment above, you certainly can use the function incrementKey to increment the numberOfComments.
The best part is, this method is atomic, that means no matter how many people like the same post at the same time, say 5 people like a photo at exact same time, numberOfComments will increment by 5 instead of 1.
So this function will be executed one by one instead of concurrently. You absolutely can use it.

What does hydrate mean on Twitter?

In the Twitter API there is a status_lookup method that "hydrates" a tweet. The docs are unclear about what this means. So when do I need to hydrate a tweet?
If I have tweets from /statuses/user_timeline why would I need to hydrate them?
Please provide an example before and after of normal tweet and hydrated tweet and explain the difference.
From the docs:
"This method is especially useful to get the details (hydrate) a collection of Tweet IDs."
HYDRATE = get complete details (i.e. fields) of a tweet.
Many Twitter API calls that return tweets do not return all the fields. So, statuses/lookup may be used as a secondary call to get these fields.
For example, search/tweets may return tweets that have embedded video, but it will not return the URL of the embedded video. So, a second call to statuses/lookup is required to get the video.

What is available for limiting the use of extend when using Breezejs, such users cant get access to sensitive data

Basically this comes up as one of the related posts:
Isn't it dangerous to have query information in javascript using breezejs?
It was someone what my first question was about, but accepting the asnwers there, i really would appreciate if someone had examples or tutorials on how to limit the scope of whats visible to the client.
I started out with the Knockout/Breeze template and changed it for what i am doing. Sitting with a almost finished project with one concern. Security.
I have authentication fixed and is working on authorization and trying to figure out how make sure people cant get something that was not intended for them to see.
I got the first layer fixed on the root model that a member can only see stuff he created or that is public. But a user may hax together a query using extend to fetch Object.Member.Identities. Meaning he get all the identities for public objects.
Are there any tutorials out there that could help me out limiting what the user may query.?
Should i wrap the returned objects with a ObjectDto and when creating that i can verify that it do not include sensitive information?
Its nice that its up to me how i do it, but some tutorials would be nice with some pointers.
Code
controller
public IQueryable<Project> Projects()
{
//var q = Request.GetQueryNameValuePairs().FirstOrDefault(k=>k.Key.ToLower()=="$expand").Value;
// if (!ClaimsAuthorization.CheckAccess("Projects", q))
// throw new WebException("HET");// UnauthorizedAccessException("You requested something you do not have permission too");// HttpResponseException(HttpStatusCode.MethodNotAllowed);
return _repository.Projects;
}
_repository
public DbQuery<Project> Projects
{
get
{
var memberid = User.FindFirst("MemberId");
if (memberid == null)
return (DbQuery<Project>)(Context.Projects.Where(p=>p.IsPublic));
var id = int.Parse(memberid.Value);
return ((DbQuery<Project>)Context.Projects.Where(p => p.CreatedByMemberId == id || p.IsPublic));
}
}
Look at applying the Web API's [Queryable(AllowedQueryOptions=...)] attribute to the method or doing some equivalent restrictive operation. If you do this a lot, you can subclass QueryableAttribute to suit your needs. See the Web API documentation covering these scenarios.
It's pretty easy to close down the options available on one or all of your controller's query methods.
Remember also that you have access to the request query string from inside your action method. You can check quickly for "$expand" and "$select" and throw your own exception. It's not that much more difficult to block an expand for known navigation paths (you can create white and black lists). Finally, as a last line of defense, you can filter for types, properties, and values with a Web API action filter or by customizing the JSON formatter.
The larger question of using authorization in data hiding/filtering is something we'll be talking about soon. The short of it is: "Where you're really worried, use DTOs".

How to get the 'id' for accessing user details in instagram

How do i get the id for accessing user info by (Hashie::Mash)user(id) method of the instagram API or accessing his/her location by (Hashie::Mash)location(id)?
I am using rails for my project.
You can search for a user to get his/her id, e.g:
shaynesids = Instagram.user_search("Shayne Sweeney")
That will give you all the ids on an array of user matching Shayne Sweeny (hopefully just one), then you can use it with user(id), like this:
myuser = Instagram.user(shaynesids.first)
Note: In here I'm assuming that the search it's gonna return at least one result, you will need to be careful in your code to account for errors, because it could return an empty array.

Resources