Giter Site home page Giter Site logo

flickr-net's Introduction

Flickr-Net

The Flickr.Net API Library is a .Net Library for accessing the Flickr API. It is written entirely in C#.

The library provides a simple one-to-one mapping to the methods of the Flickr REST API, hopefully hiding all of the complexity of calling the API, especially when it comes to authentication. Check the Flickr API web site for the full list of commands, and then use the corresponding method in the Flickr library, e.g. to call flickr.photos.search use the Flickr.PhotosSearch method.

The library is not an attempt to provide an ORM layer over the Flickr API, e.g. if you retrieve a list of photosets for a user (i.e. by calling Flickr.PhotosetsGetList) there is no direct property on each photoset to get the photos for that set, you must go back to the Flickr object and call Flickr.PhotosetsGetPhotos passing in the photoset id.

Getting Started

The FlickrNet API library is available via NuGet.org. SImply run the following command:

Install-Package FlickrNet

Examples

You can create a new instance of the Flickr class, and set its properties, or you can use one of the parameterised constructors:

Flickr flickr = new Flickr();
flickr.ApiKey = myApiKey;

or

Flickr flickr = new Flickr(myApiKey);

The simplest method (although it has the most parameters) is probably the PhotosSearch method, which is best used by passing in a PhotoSearchOptions instance:

var options = new PhotoSearchOptions { Tags = "colorful", PerPage = 20, Page = 1 };
PhotoCollection photos = flickr.PhotosSearch(options);

foreach(Photo photo in photos) 
{
  Console.WriteLine("Photo {0} has title {1}", photo.PhotoID, photo.Title);
}

Photo Extras

One of the hardest things to understand initially is that not all properties are returned by Flickr, you have to explicity request them.
For example the following code would be used to return the Tags and the LargeUrl for a selection of photos:

var options = new PhotoSearchOptions { 
  Tags = "colorful", 
  PerPage = 20, 
  Page = 1, 
  Extras = PhotoSearchExtras.LargeUrl | PhotoSearchExtras.Tags 
};

PhotoCollection photos = flickr.PhotosSearch(options);
// Each photos Tags and LargeUrl properties should now be set, 
// assuming that the photo has any tags, and is large enough to have a LargeUrl image available.

Sample Applications

I've started a separate CodePlex project to host sample applications:

https://github.com/samjudson/flickrnet-samples

View the sample app live on the web here:

http://wackylabs.azurewebsites.net/

License

The project is licensed under both the LGPL 2.1 license, and the Apache 2.0 license. This gives you the flexibility to do pretty much anything you want with the code. Enjoy!

Contact

You can contact me at via the People tab or post a discussion here on codeplex if you require further help.

See my Flickr homepage at http://www.flickr.com/photos/samjudson

flickr-net's People

Contributors

andrew-keil avatar samjudson avatar timheuer avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.