<commit_before>![alt text](pbs_dev_logo.jpg "PBS Developers") 
# API client/SDK for Paperbackswap.com

* Built as a standalone Java 1.5+ library, usable in Android.
* Builds with Gradle.
* Uses fluent syntax wherever possible (perhaps at a slight loss of efficiency as mikaelhg's UrlBuilder is final)

**Table of Contents**  *generated with [DocToc](http://doctoc.herokuapp.com/)*

- [Common Usage](#user-content-common-usage)
	- [Build URLs](#user-content-build-urls)
		- [Do the OAuth 1.0a dance](#user-content-do-the-oauth-10a-dance)
		- [Sign the request with saved token/secret](#user-content-sign-the-request-with-saved-tokensecret)
		- [Build a URL from the know list](#user-content-build-a-url-from-the-know-list)
		- [Build a URL from a string](#user-content-build-a-url-from-a-string)
		- [Explicitly set a page](#user-content-explicitly-set-a-page)
		- [Set an isbn in the URL](#user-content-set-an-isbn-in-the-url)
	- [Deserialize responses](#user-content-deserialize-responses)
		- [Turn response text/json into a list of books](#user-content-turn-response-textjson-into-a-list-of-books)
		- [Get next page of results](#user-content-get-next-page-of-results)
		- [Deserialize one book](#user-content-deserialize-one-book)
	- [Acknowledgements](#user-content-acknowledgements)
	

# Common Usage

## Build URLs

### Do the OAuth 1.0a dance
```java
PbsOauth oauth = PbsOauth("key", "secret");
String requestTokenUrl = oauth.getRequestTokenUrl("http://localhost:8080/capture_verifier")
System.out.println(oauth.isAuthorizing()); // "true"

// Go do things in the browser with requestTokenUrl, capture verifier from callback

oauth.retrieveAccessToken(verifier)
System.out.println(oauth.isAuthorizing()); // "false"

String signedUrl = oauth.signRequest(
    PbsUrlInfo.MEMBER_WISH_LIST.toString();
);
```

### Sign the request with saved token/secret
```java
PbsOauth oauth = PbsOauth("key", "secret", "token", "tokensecret");
String signedUrl = oauth.signRequest(
    PbsUrlInfo.MEMBER_WISH_LIST.toString()
);
```

### Build a URL from the know list
```java
PbsUrlInfo.MEMBER_WISH_LIST.toString();
PbsUrlInfo.MEMBER_WISH_LIST.toUri();
PbsUrlInfo.MEMBER_WISH_LIST.toBuilder();

PbsUrlBuilder builder = PbsUrlBuilder
    .fromPath(PbsUrlInfo.MEMBER_WISH_LIST)
    .toString();<commit_msg>Updated docs<commit_after>![alt text](pbs_dev_logo.jpg "PBS Developers") 
# API client/SDK for Paperbackswap.com

- Built as a standalone Java 1.5+ library, usable in Android.
- Builds with Gradle.
- Uses fluent syntax wherever possible (perhaps at a slight loss of efficiency as mikaelhg's UrlBuilder is final)

**Table of Contents**  *generated with [DocToc](http://doctoc.herokuapp.com/)*

- [Common Usage](#user-content-common-usage)
    - [OAuth 1.0a](#oauth-10a)
        - [Do the OAuth 1.0a dance](#user-content-do-the-oauth-10a-dance)
        - [Sign the request with saved token/secret](#user-content-sign-the-request-with-saved-tokensecret)
	- [Build URLs](#user-content-build-urls)
		- [Build a URL from the know list](#user-content-build-a-url-from-the-know-list)
		- [Build a URL from a string](#user-content-build-a-url-from-a-string)
		- [Explicitly set a page](#user-content-explicitly-set-a-page)
		- [Set an isbn in the URL](#user-content-set-an-isbn-in-the-url)
	- [Deserialize responses](#user-content-deserialize-responses)
		- [Turn response text/json into a list of books](#user-content-turn-response-textjson-into-a-list-of-books)
		- [Get next page of results](#user-content-get-next-page-of-results)
		- [Deserialize one book](#user-content-deserialize-one-book)
	- [Acknowledgements](#user-content-acknowledgements)
	

# Common Usage

## OAuth 1.0a

### Do the OAuth 1.0a dance
```java
PbsOauth oauth = PbsOauth("key", "secret");
String requestTokenUrl = oauth.getRequestTokenUrl("http://localhost:8080/capture_verifier")
System.out.println(oauth.isAuthorizing()); // "true"

// Go do things in the browser with requestTokenUrl, capture verifier from callback

oauth.retrieveAccessToken(verifier)
System.out.println(oauth.isAuthorizing()); // "false"

String signedUrl = oauth.signRequest(
    PbsUrlInfo.MEMBER_WISH_LIST.toString();
);
```

### Sign the request with saved token/secret
```java
PbsOauth oauth = PbsOauth("key", "secret", "token", "tokensecret");
String signedUrl = oauth.signRequest(
    PbsUrlInfo.MEMBER_WISH_LIST.toString()
);
```

## Build URLs


### Build a URL from the know list
```java
PbsUrlInfo.MEMBER_WISH_LIST.toString();
PbsUrlInfo.MEMBER_WISH_LIST.toUri();
PbsUrlInfo.MEMBER_WISH_LIST.toBuilder();

PbsUrlBuilder builder = PbsUrlBuilder
    .fromPath(PbsUrlInfo.MEMBER_WISH_LIST)
    .toString();
{'fraction_non_alphanumeric': 0.14387096774193547, 'fraction_numerical': 0.0064516129032258064, 'mean_word_length': 4.720787207872078, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1283350', 'n_tokens_mistral': 1690, 'n_tokens_neox': 1581, 'n_words': 348}