1 var Util = require('util');
  2 var Client = require('./Client');
  3 var Constants = require('./Constants');
  4 
  5 /**
  6  * Creates an instance of SearchClient.
  7  *
  8  * @constructor
  9  * @this {SearchClient}
 10  * @param {String} consumerKey OAuth consumer key.
 11  * @param {String} consumerSecret OAuth consumer secret.
 12  * @param {String} token OAuth token.
 13  * @param {String} tokenSecret OAuth token secret.
 14  */
 15 var SearchClient = function(consumerKey, consumerSecret, token, tokenSecret)
 16 {
 17     Client.call(this, consumerKey, consumerSecret, token, tokenSecret);
 18 
 19     this._apiBaseUrlString = Constants.SearchApiBaseURLString;
 20 };
 21 
 22 Util.inherits(SearchClient, Client);
 23 
 24 /**
 25  * Returns tweets that match the specified parameters.
 26  *
 27  * For information on acceptable parameters see the official <a href="https://dev.twitter.com/docs/api/1/get/search">Twitter documenation</a>.
 28  *
 29  * @this {RestClient}
 30  * @param {Dictionary} parameters
 31  * @param {Function} callback The callback function.
 32  */
 33 SearchClient.prototype.search = function(parameters, callback)
 34 {
 35     var q = parameters['q'];
 36     if (q === undefined)
 37     {
 38         throw new Error('Missing required parameter: q.');
 39     }
 40 
 41     this._createGetRequest('search', 'json', parameters, callback);
 42 };
 43 
 44 module.exports = SearchClient;
 45