mirror of
https://github.com/correl/urilib.git
synced 2025-03-17 17:00:13 -09:00
Updated docs/example
This commit is contained in:
parent
ffa64b680c
commit
cbf298a1ef
1 changed files with 47 additions and 0 deletions
47
README.md
47
README.md
|
@ -4,6 +4,53 @@ urilib
|
|||
|
||||
[](https://travis-ci.org/gmr/urilib) [](https://codecov.io/github/gmr/urilib?branch=master)
|
||||
|
||||
Example Usage
|
||||
-------------
|
||||
```erlang
|
||||
-include_lib("urilib.h").
|
||||
|
||||
URI = urilib:parse_uri("http://foo:bar@www.google.com/search?baz=qux#corgie"),
|
||||
io:format("Parsed URI: ~p~n", [URI]).
|
||||
|
||||
URL = urllib:build(#url{scheme=http, host="www.google.com", path="/search", query=[{"foo", "bar"}], fragment="baz"}),
|
||||
io:format("Built URL: ~s~n", [URL]).
|
||||
```
|
||||
|
||||
Records
|
||||
-------
|
||||
|
||||
#### authority ####
|
||||
```erlang
|
||||
#{host :: string(), port :: integer()}).
|
||||
```
|
||||
|
||||
#### userinfo ####
|
||||
```erlang
|
||||
#{username :: string(), password :: string()}).
|
||||
```
|
||||
|
||||
#### uri ####
|
||||
```erlang
|
||||
#{scheme :: atom(),
|
||||
userinfo :: #userinfo{},
|
||||
authority :: #authority{},
|
||||
path :: string(),
|
||||
query :: list(),
|
||||
fragment :: string()}).
|
||||
```
|
||||
|
||||
#### url ####
|
||||
```erlang
|
||||
#{scheme :: atom(),
|
||||
username :: string(),
|
||||
password :: string(),
|
||||
host :: string(),
|
||||
port :: integer(),
|
||||
path :: string(),
|
||||
query :: list(),
|
||||
fragment :: string()}).
|
||||
```
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue