package com.bigcommerce.api;

import com.bigcommerce.api.resources.Orders;
import com.bigcommerce.api.resources.Products;

/**
 * Facade for accessing a Bigcommerce store via the REST API.
 */
public class Store {
	private Connection connection;

	/**
	 * A constructor that accepts any object implementing
	 * {@link com.bigcommerce.api.auth.Credentials Credentials}.
	 * @param storeUrl
	 * @param credentials
	 */
	public Store(String storeUrl, Credentials credentials) {
		this.connection = new Connection(storeUrl, credentials.getUsername(), credentials.getApiKey());
	}
	
	/**
	 * A simple constructor that accepts a username and API key as credentials.
	 * 
	 * @param storeUrl
	 * @param username
	 * @param apiKey
	 */
	public Store(String storeUrl, String username, String apiKey) {
		this(storeUrl, new SimpleCredentials(username, apiKey));
	}

	/**
	 * Gets Orders resource to manage.
	 * 
	 * 
	 * @return
	 */
	public Orders getOrders(){
		return new Orders(this.connection);
	}
	
	/**
	 *  Gets Products resource to manage.
	 * 
	 * @return
	 */
	public Products getProducts(){
		return new Products(this.connection);
	}

}

@@ -64,61 +64,20 @@
 ces.
-Orders;%0Aimport com.bigcommerce.api.resources.Products
+BaseResource
 ;%0A%0A/
@@ -141,16 +141,38 @@
 ST API.%0A
+ * %0A * @author Jenith%0A
  */%0Apubl
@@ -343,16 +343,21 @@
 tials%7D.%0A
+%09 * %0A
 %09 * @par
@@ -525,17 +525,21 @@
 rname(),
- 
+%0A%09%09%09%09
 credenti
@@ -555,25 +555,24 @@
 iKey());%0A%09%7D%0A
-%09
 %0A%09/**%0A%09 * A 
@@ -852,22 +852,27 @@
  * Gets 
-Orders
+new generic
  resourc
@@ -885,24 +885,39 @@
 anage.%0A%09 * %0A
+%09 * @param %3CT%3E%0A
 %09 * %0A%09 * @re
@@ -938,70 +938,239 @@
 lic 
-Orders getOrders()
+%3CT extends Response%3E BaseResource%3CT%3E newResource(Class%3CT%3E className,%0A%09%09%09String path, String rootItemTag) 
 %7B%0A
+%0A
 %09%09
-return new Orders(this.connection)
+BaseResource%3CT%3E br = new BaseResource%3CT%3E(className, this.connection,%0A%09%09%09%09path.toString(), rootItemTag);%0A%0A%09%09return br
 ;%0A%09%7D%0A
-%09
 %0A%09/*
@@ -1179,119 +1179,60 @@
 %09 * 
- Gets Products resource to manage.%0A%09 * %0A%09 * @return%0A%09 */%0A%09public Products getProducts
+Closes api connection%0A%09 */%0A%09public void close
 ()
+ 
 %7B%0A%09%09
-return new Products(
 this
@@ -1242,16 +1242,23 @@
 nnection
+.close(
 );%0A%09%7D%0A%0A%7D

Update Store.java