Golem.de API

Golem  alpha

Golem.de API > Golem > Golem.Api.Article.Top

Class Golem.Api.Article.Top - extends Golem.Api

Get a list of the current top articles via Golem web interface


Golem.Api.Article.Top ( maxArticles )
maxArticles <Integer> the number of top articles


ERROR_LIMIT - {Integer}

Indicates, that the article limit is out of the valid range

maxArticles - protected {Integer}

Count of top articles to fetch

TYPE - protected {String}

The type of access method for the web service

URL - protected {String}

The URL of the used web service



void each ( fnCallback , params )
Traverses through the article list.

After a succesful request you can traverse through the article list. You pass a callback function to the method, and the method is called for each article

The first argument to this callback function is an article object with the properties:

  • articleid - {Integer} - The article identifier
  • headline - {String(60)} - The article headline
  • abstracttext - {String} - The article abstract
  • url - {String} - The article URL
  • date - {Integer} - publishing date as unix timestamp
  • images - {Integer} - the number of associated images
  • leadimg - {Object} - The article headline image
    • url - {String} - the image URL
    • width - {Integer} - the image width
    • height - {Integer} - the image height
The second argument will be the data provided by params.

fnCallback <Function> - the callback function to call for each article
params <Mixed> - additional data passed to the callback function
Returns: void


void fetch ( obj )
Fetches the list of top articles via web service

In case of a successful request, the obj.fnSuccess-callback function will be called. The first argument for the callback method is the result data of the request. The second argument will be the data provided by obj.params.

In case of a failed request, the obj.fnError callback function will be called. The first argument to the callback is the error code, the second ist the error message.

obj <Object> - Object literal specifing the callback methods
Returns: void


void fetchEach ( fnCallback , params )
Shortcut method for traversing the article data

Fetches the articles via fetch() first and then calls fnCallback for every article record like each() does.

There is no way to handle errors with this method!

fnCallback <Function> - Function to call for every article record
params <Mixed> - additional data to pass to the callback function
Returns: void

Copyright © 2010 Golem.de.