Code Monkey home page Code Monkey logo

flickr's Introduction

Flickr

A simple wrapper around the Flickr JSONP API. No scripts from Flickr are required in advance since they provide a raw JSONP service; it is up to clients how they want to consume it.

Usage

Instantiate a client using your Flickr API key:

client = new Flickr.Client('63bb4efae64c3c04510c484dcdaef263');

The client provides convenience methods for calling various feeds, for example:

client.getGroupPhotos('52240328087@N01', function(feed) {
    for (var i = 0, n = feed.length; i < n; i++)
        alert(feed[i].getTitle());
});

See the Flickr.Client and Flickr.Photo classes for more information.

API

Flickr.Client class

Instances of the Flickr.Client class have the following methods available. They all have two required arguments: an id value and a callback. They also accept a scope parameter, which allows you to set the value of the this keyword inside the callback.

Wrapped methods

These methods wrap photo objects in Flickr.Photo objects, which have a more convenient API (detailed below).

  • getGroupPhotos calls the callback function with the group's photos.
  • getFavourites calls the callback with the group's favourite photos.
  • getPublicPhotos calls the callback with a user's public photos.
  • getPhotosOf calls the callback with a photos of a user.
  • getUserId takes a Flickr username in place of an ID, and calls the callback with the user's ID value.

Unwrapped methods

  • groupBrowse calls the callback with a list of photos from the group.
  • groupInfo calls the callback with information about the group.
  • groupDiscuss calls the callback with recent discussion from that group.
  • groupPool is the unwrapped version of getGroupPhotos.
  • photoFavourites is the unwrapped version of getFavourites.
  • publicPhotos is the unwrapped version of getPublicPhotos.
  • photosOf is the unwrapped version of getPhotosOf.
  • findByUsername is the unwrapped version of getUserId.

Search methods

The search methods deviate slightly from the interface described above. Instead of an id value, they accept a text string which is the search query to be run. The search method also takes a params object before the callback parameter, which allows further search options to be set.

  • search calls the callback with a list of photos from the search.
  • getSearch is the wrapped version of search, and does not accept a params object, just a search string, callback and optional scope argument.

Flickr.Photo class

Instances of the Flickr.Photo class have the following methods available. They have no parameters and return strings, except where noted.

  • getId returns the ID of the photo.
  • getTags returns the tags for that photo as an array.
  • getThumbnail returns the location of the photo's thumbnail.
  • getAuthor returns the name of the photo's author.
  • getAuthorId returns the ID of the photo's author.
  • getDateTaken returns the date the photo was taken.
  • getDescription returns a description of the photo.
  • getLink returns the link to the photo page.
  • getPublished returns the date the photo was published.
  • getTitle returns the title of the photo.
  • constructImageURI accepts an image size, as detailed in the Flickr URI documentation.

flickr's People

Contributors

beastaugh avatar jcoglan avatar

Watchers

James Cloos avatar Yonas Berhe 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.