From ce25762e6735bdb0ffcc02f0ac286f7af046c2e0 Mon Sep 17 00:00:00 2001 From: "Gavin M. Roy" Date: Thu, 21 Jan 2016 23:21:39 -0500 Subject: [PATCH] Abbreviated API documentation --- README.md | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4999e1b..68b7292 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,42 @@ urilib ====== [RFC-3986](https://tools.ietf.org/html/rfc3986) URI Library for Erlang. +Parse and build URIs with automatic percent encoding and plus encoding of query arguments. + [![Build Status](https://travis-ci.org/gmr/urilib.svg?branch=master)](https://travis-ci.org/gmr/urilib) [![codecov.io](https://codecov.io/github/gmr/urilib/coverage.svg?branch=master)](https://codecov.io/github/gmr/urilib?branch=master) -Example Usage -------------- +## API + +### Functions + +Function | Description +------------------ | ------------------ +`build/1` | Build a URI from a `uri()` or `url`. +`parse/1` | Parse a URI from a string, returning a `uri()`. +`parse/2` | Parse a URI, returning the result as either a `uri()` or `url()`. +`percent_decode/1` | Decode a percent encoded string value. +`percent_encode/1` | Percent encode a string value. +`plus_decode/1` | Decode a percent encoded string value that uses pluses for spaces. +`plus_encode/1` | Percent encode a string value similar to encode/1, but encodes spaces with a plus (`+`) instead of `%20`. + +### Types + +Type | Definition +------------- | ---------------------- +`scheme()` | `http | https | atom()` +`username()` | `string() | undefined` +`password()` | `string() | undefined` +`userinfo()` | `{username(), password()} | undefined` +`host()` | `string()` +`tcp_port()` | `integer()` +`authority()` | `{userinfo(), host(), tcp_port()}` +`path()` | `string()` +`query()` | `[tuple() | string()] | undefined` +`fragment()` | `string() | undefined` +`uri()` | `{scheme(), authority(), path(), query(), fragment()}` +`url()` | `{scheme(), username(), password(), host(), tcp_port(), path(), query(), fragment()}` + +## Example Usage ```erlang Eshell V7.2.1 (abort with ^G)