// Path: src/com/eleybourn/bookcatalogue/SearchThread.java
// public static class BookSearchResults {
// 	public DataSource source;
// 	public Bundle data;
// 	public BookSearchResults(DataSource source, Bundle data) {
// 		this.source = source;
// 		this.data = data;
// 	}
// }
// 
// Path: src/com/eleybourn/bookcatalogue/SearchThread.java
// public enum DataSource {
// 	Amazon(0),
// 	Google(SearchManager.SEARCH_GOOGLE),
// 	OpenLibrary(0),
// 	LibraryThing(SearchManager.SEARCH_LIBRARY_THING),
// 	Goodreads(SearchManager.SEARCH_GOODREADS),
// 	BCDB(SearchManager.SEARCH_BC),
// 	Other(0),
// 	;
// 	private int mValue;
// 
// 	private DataSource(int value) {
// 		mValue = value;
// 	}
// 
// 	public int getValue() {
// 		return mValue;
// 	}
// }
// 
// Path: src/com/eleybourn/bookcatalogue/bcservices/BcService.java
// public enum Methods {
// 	Get,
// 	Post
// }


import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import android.net.Uri;
import android.os.Bundle;
import com.eleybourn.bookcatalogue.BuildConfig;
import com.eleybourn.bookcatalogue.SearchThread.BookSearchResults;
import com.eleybourn.bookcatalogue.SearchThread.DataSource;
import com.eleybourn.bookcatalogue.bcservices.BcService.Methods;
import com.eleybourn.bookcatalogue.utils.Logger;
import org.json.JSONArray;

		if (author.length() == 0) {
			author = Uri.encode(" ");
		}
		if (title.length() == 0) {
			title = Uri.encode(" ");
		}

		// Base path for an ISBN search
		String path = String.format(SEARCH_AUTHOR_TITLE_URL, author, title);

		if (author.equals("") && title.equals(""))
			throw new IllegalArgumentException();

		search(path, fetchThumbnail, results);
	}

	/**
	 * Use the passed complete search URL to gather results.
	 *
	 * @param url				URL for search.
	 * @param fetchThumbnail	True if thumbnails are wanted.
	 * @param resultList		List of {@link BookSearchResults} objects
	 */
	private void search(String url, boolean fetchThumbnail, ArrayList<BookSearchResults> resultList) {
		JSONObject apiResult;
		try {
			// Make sure we limit requests (no more than 1 request/second/client).
			BcService.waitUntilRequestAllowed();
			// Get the JSON result
// Path: src/com/eleybourn/bookcatalogue/SearchThread.java
// public static class BookSearchResults {
// 	public DataSource source;
// 	public Bundle data;
// 	public BookSearchResults(DataSource source, Bundle data) {
// 		this.source = source;
// 		this.data = data;
// 	}
// }
// 
// Path: src/com/eleybourn/bookcatalogue/SearchThread.java
// public enum DataSource {
// 	Amazon(0),
// 	Google(SearchManager.SEARCH_GOOGLE),
// 	OpenLibrary(0),
// 	LibraryThing(SearchManager.SEARCH_LIBRARY_THING),
// 	Goodreads(SearchManager.SEARCH_GOODREADS),
// 	BCDB(SearchManager.SEARCH_BC),
// 	Other(0),
// 	;
// 	private int mValue;
// 
// 	private DataSource(int value) {
// 		mValue = value;
// 	}
// 
// 	public int getValue() {
// 		return mValue;
// 	}
// }
// 
// Path: src/com/eleybourn/bookcatalogue/bcservices/BcService.java
// public enum Methods {
// 	Get,
// 	Post
// }


// Path: src/com/eleybourn/bookcatalogue/bcservices/BcSearchManager.java
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import android.net.Uri;
import android.os.Bundle;
import com.eleybourn.bookcatalogue.BuildConfig;
import com.eleybourn.bookcatalogue.SearchThread.BookSearchResults;
import com.eleybourn.bookcatalogue.SearchThread.DataSource;
import com.eleybourn.bookcatalogue.bcservices.BcService.Methods;
import com.eleybourn.bookcatalogue.utils.Logger;
import org.json.JSONArray;


		if (author.length() == 0) {
			author = Uri.encode(" ");
		}
		if (title.length() == 0) {
			title = Uri.encode(" ");
		}

		// Base path for an ISBN search
		String path = String.format(SEARCH_AUTHOR_TITLE_URL, author, title);

		if (author.equals("") && title.equals(""))
			throw new IllegalArgumentException();

		search(path, fetchThumbnail, results);
	}

	/**
	 * Use the passed complete search URL to gather results.
	 *
	 * @param url				URL for search.
	 * @param fetchThumbnail	True if thumbnails are wanted.
	 * @param resultList		List of {@link BookSearchResults} objects
	 */
	private void search(String url, boolean fetchThumbnail, ArrayList<BookSearchResults> resultList) {
		JSONObject apiResult;
		try {
			// Make sure we limit requests (no more than 1 request/second/client).
			BcService.waitUntilRequestAllowed();
			// Get the JSON result
			apiResult = BcService.makeServiceCall(url, Methods.Get, new HashMap<>());