TradeMe.Api.Client.SearchMethods.SearchStores C# (CSharp) Method

SearchStores() public method

Performs the method:

Search for Stores.

As specified in the API Documentation.

Creates a query string using the paramaters provided - parameters can be null if they are not required for the request.

DOES NOT REQURE AUTHENTICATION.

public SearchStores ( string searchString = "", int page = 1, string category = "", StoreType storeType = StoreType.Normal ) : Stores
searchString string The string to search for.
page int The number of the page to retrieve.
category string The category to search in.
storeType StoreType The type of the store.
return Stores
        public Stores SearchStores(string searchString = "", int page = 1, string category = "", StoreType storeType = StoreType.Normal)
        {
            var url = String.Format(Constants.Culture, "{0}/Stores{1}", Constants.SEARCH, Constants.XML);
            var conditions = "?";
            _addAnd = false;
            conditions += category != ""
                              ? SearchMethods.ConstructQueryHelper(Constants.CATEGORY, category, _addAnd)
                              : "";
            conditions += SearchMethods.ConstructQueryHelper("store_type", storeType.ToString(), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PAGE, page.ToString(), _addAnd);
            conditions += searchString != ""
                              ? SearchMethods.ConstructQueryHelper(Constants.SEARCH_STRING, searchString, _addAnd)
                              : "";

            if (!conditions.Equals("?"))
            {
                url += conditions;
            }

            var finalUrl = _connection.BaseUrl + url;

            var getRequest = _connection.UnauthenticatedConnection(finalUrl);
            var xml = getRequest.ToString();

            return Deserializer<Stores>.Deserialize(new Stores(), xml);
        }