Skip to content

jbbrown/gnip-dotnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

= Gnip .Net API Client

This library provides a .Net API for accessing
{Gnip}[http://gnipcentral.com] web services.  There are two basic
roles for using Gnip: subscribers and publishers.  This library
provides a single API for both roles.

== Consumer

=== Example 1: Retrieve all recent activities at a publisher

As a consumer one thing you might be interested in immediately is to
grab recent activity at a particular publisher.  To do this you must
create a connection to Gnip using your user name and password.  Once
that connection is established you can get the publisher and request
it's activities stream.

	using Gnip;
	...

	Connection gnip = new Connection("me@mydomain.com", "my-password");

	Publisher digg = gnip.GetPublisher("digg");
	Activities activities = gnip.GetActivities(digg);

=== Example 2: Retrieve all activities at a publisher around a specific time

Some times you will want to get activity information from before now.
Doing this look much like getting the recent activity, except that you
past a time when getting the activity stream.  This will return the
activity stream as it existed around that time.  The results will be
include some activities before and after the time you specify.

	using Gnip;
	...

	Connection gnip = new Connection("me@mydomain.com", "my-password");

	Publisher digg = gnip.GetPublisher("digg");
	Activities activities = gnip.GetActivities(digg, DateTime.Now);

=== Example 3: Create an activity stream that includes only activities
    done by users you care about.

If you would like to filter a set of publishers by the user that
performed the activity you may create a collection to do so.  Once
created a collection's activity stream is retrieved much like a
publishers.  Activity that has already occured will not be included in
a collection.  Therefore any new collection will be empty until some
new matching activity has occured.

Note: Collection names must be unique across the system so you might
want to attach your username to the logical name of any collections
you create.

	using Gnip;
	...

	Connection gnip = new Connection("me@mydomain.com", "my-password");

	Publisher digg = new Publisher("digg");

	Collection myCollection = new Collection("myCollection");
	myCollection.Uids.Add(new Uid(digg), "Burento");

	gnip.Create(myCollection);
	Activities activities = gnip.GetActivities(myCollection);

=== Example 4: Delete a collection

If you decide you no longer need a collection you have created in the
past you can remove it.

	using Gnip;
	...

	Connection gnip = new Connection("me@mydomain.com", "my-password");

	Collection myCollection = gnip.GetCollection("myCollection");
	gnip.Delete(myCollection);

== Publisher

=== Example 1: Create a publisher and publish some activities

If you are interested in publishing activity you will need to create a
publisher.  Once the publisher resource is created, activities can be
published in it's activity stream.

	using Gnip;
	...

	Connection gnip = new Connection("me@mydomain.com", "my-password");

	Publisher publisher = new Publisher("myservice");
	gnip.Create(publisher);
	
	Activities activities = new Activities();
	activities.Add(new Activity("joe", "post", DateTime.now, "http://mydomain.com/joe/my-new-blog-post"));
	gnip.Publish(publisher, activities);

About

.Net library for utilizing Gnip services.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages