Skip to content

Commit 143f355

Browse files
committed
move docs to ./docs folder
this makes it so gh-pages is published from that folder and makes a whole lot of makefile logic obsolete that deals with generating a gh-pages branch from master. In addition to that it also removes the need for an encrypted GH_TOKEN.
1 parent f47acbb commit 143f355

174 files changed

Lines changed: 10481 additions & 18 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,4 @@ coverage.info
4242
usr
4343

4444
# generated files
45-
docs
4645
include/restclient-cpp/version.h

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "docs/_layouts"]
2+
path = docs/_layouts
3+
url = https://github.com/mrtazz/jekyll-layouts.git

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ after_success:
1919
- export PATH=$PATH:`pwd`/lcov-1.11/bin
2020
- make coverage.info
2121
- coveralls-lcov coverage.info
22-
- test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && make
23-
deploy-docs
2422
sudo: false
2523
addons:
2624
apt:
@@ -38,5 +36,4 @@ deploy:
3836
condition: $CXX = g++
3937
env:
4038
global:
41-
- secure: i+h0SxjrHCfvoaXCJ1b+tK0vvNgoLq7Xl/eh34tb3QokacWO+piyLcbSxvz0IcE50ye0x8CyMn2hyyGCgzwHDgaUCmkILS+3y+9E7FC4nYwLvi2mJ2Q9DI1Q5aXhcMXiEYb9b1LjrorUdgs6DcfJVq7ZSU3CawKU/uBtKfC39iQ=
4239
- secure: IdA0aOUuazgCVT3X8bmOjC2mJpHIk+eakCUgiPGhsMsg6Nhe+OgYUF9uGLgz3py5qZq3ns+9WV1IVZVhwd1CFz+2wFKHM6WRnvlfFJ/aV+rb10I2tiX8BrepNcZzCvwuTxIgqb3m97DHRmf/s8DnnmF6v5pvUaKb9SjxFQ1d/XY=

Makefile.docs.mk

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# Make tasks to create and deploy documentation
2-
.PHONY: docs clean-docs deploy-docs doxygen jekyll
2+
.PHONY: docs clean-docs deploy-docs doxygen update-docs-from-readme jekyll-layouts
33

44
GAUGES_CODE="539c6c8de32bb442640005f3"
55

6+
jekyll-layouts:
7+
git submodule update --init
8+
69
doxygen:
710
doxygen doxygen.config
811

9-
jekyll:
12+
update-docs-from-readme: jekyll-layouts
1013
install -d docs
1114
echo "gaugesid: $(GAUGES_CODE)" > docs/_config.yml
1215
echo "projecturl: $(PROJECT_URL)" >> docs/_config.yml
@@ -18,18 +21,7 @@ jekyll:
1821
echo "---" >> docs/index.md
1922
cat README.md >> docs/index.md
2023

21-
docs: doxygen jekyll
24+
docs: doxygen update-docs-from-readme
2225

2326
clean-docs:
2427
rm -rf ./docs
25-
26-
deploy-docs: docs
27-
@cd docs && git init && git remote add upstream "https://${GH_TOKEN}@github.com/mrtazz/$(NAME).git" && \
28-
git submodule add https://github.com/mrtazz/jekyll-layouts.git ./_layouts && \
29-
git submodule update --init && \
30-
git fetch upstream && git reset upstream/gh-pages && \
31-
git config user.name 'Daniel Schauenberg' && git config user.email [email protected] && \
32-
touch . && git add -A . && \
33-
git commit -m "rebuild pages at $(VERSION)" && \
34-
git push -q upstream HEAD:gh-pages
35-

docs/_config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
gaugesid: 539c6c8de32bb442640005f3
2+
projecturl: https://github.com/mrtazz/restclient-cpp
3+
basesite: http://www.unwiredcouch.com
4+
markdown: kramdown

docs/_layouts

Submodule _layouts added at 45dd7d4

docs/index.md

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
---
2+
layout: project
3+
title: restclient-cpp
4+
---
5+
# REST client for C++
6+
[![Build Status](https://travis-ci.org/mrtazz/restclient-cpp.svg?branch=master)](https://travis-ci.org/mrtazz/restclient-cpp)
7+
[![Coverage Status](https://coveralls.io/repos/mrtazz/restclient-cpp/badge.svg?branch=master&service=github)](https://coveralls.io/github/mrtazz/restclient-cpp?branch=master)
8+
[![Packagecloud](https://img.shields.io/badge/packagecloud-available-brightgreen.svg)](https://packagecloud.io/mrtazz/restclient-cpp)
9+
[![doxygen](https://img.shields.io/badge/doxygen-reference-blue.svg)](http://code.mrtazz.com/restclient-cpp/ref/)
10+
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)
11+
12+
13+
## About
14+
This is a simple REST client for C++. It wraps [libcurl][] for HTTP requests.
15+
16+
## Usage
17+
restclient-cpp provides two ways of interacting with REST endpoints. There is
18+
a simple one, which doesn't need you to configure an object to interact with
19+
an API. However the simple way doesn't provide a lot of configuration options
20+
either. So if you need more than just a simple HTTP call, you will probably
21+
want to check out the advanced usage.
22+
23+
### Simple Usage
24+
The simple API is just some static methods modeled after the most common HTTP
25+
verbs:
26+
27+
```cpp
28+
#include "restclient-cpp/restclient.h"
29+
30+
RestClient::Response r = RestClient::get("http://url.com")
31+
RestClient::Response r = RestClient::post("http://url.com/post", "text/json", "{\"foo\": \"bla\"}")
32+
RestClient::Response r = RestClient::put("http://url.com/put", "text/json", "{\"foo\": \"bla\"}")
33+
RestClient::Response r = RestClient::del("http://url.com/delete")
34+
RestClient::Response r = RestClient::head("http://url.com")
35+
```
36+
37+
The response is of type [RestClient::Response][restclient_response] and has
38+
three attributes:
39+
40+
```cpp
41+
RestClient::Response.code // HTTP response code
42+
RestClient::Response.body // HTTP response body
43+
RestClient::Response.headers // HTTP response headers
44+
```
45+
46+
### Advanced Usage
47+
However if you want more sophisticated features like connection reuse,
48+
timeouts or authentication, there is also a different, more configurable way.
49+
50+
```cpp
51+
#include "restclient-cpp/connection.h"
52+
#include "restclient-cpp/restclient.h"
53+
54+
// initialize RestClient
55+
RestClient::init();
56+
57+
// get a connection object
58+
RestClient::Connection* conn = new RestClient::Connection("http://url.com");
59+
60+
// configure basic auth
61+
conn->SetBasicAuth("WarMachine68", "WARMACHINEROX");
62+
63+
// set connection timeout to 5s
64+
conn->SetTimeout(5);
65+
66+
// set custom user agent
67+
// (this will result in the UA "foo/cool restclient-cpp/VERSION")
68+
conn->SetUserAgent("foo/cool");
69+
70+
// enable following of redirects (default is off)
71+
conn->FollowRedirects(true);
72+
73+
// set headers
74+
RestClient::HeaderFields headers;
75+
headers["Accept"] = "application/json";
76+
conn->SetHeaders(headers)
77+
78+
// append additional headers
79+
conn->AppendHeader("X-MY-HEADER", "foo")
80+
81+
// if using a non-standard Certificate Authority (CA) trust file
82+
conn->SetCAInfoFilePath("/etc/custom-ca.crt")
83+
84+
RestClient::Response r = conn->get("/get")
85+
RestClient::Response r = conn->head("/get")
86+
RestClient::Response r = conn->del("/delete")
87+
88+
// set different content header for POST and PUT
89+
conn->AppendHeader("Content-Type", "text/json")
90+
RestClient::Response r = conn->post("/post", "{\"foo\": \"bla\"}")
91+
RestClient::Response r = conn->put("/put", "text/json", "{\"foo\": \"bla\"}")
92+
93+
// deinit RestClient. After calling this you have to call RestClient::init()
94+
// again before you can use it
95+
RestClient::disable();
96+
```
97+
98+
The responses are again of type [RestClient::Response][restclient_response]
99+
and have three attributes:
100+
101+
```cpp
102+
RestClient::Response.code // HTTP response code
103+
RestClient::Response.body // HTTP response body
104+
RestClient::Response.headers // HTTP response headers
105+
```
106+
107+
The connection object also provides a simple way to get some diagnostics and
108+
metrics information via `conn->GetInfo()`. The result is a
109+
`RestClient::Connection::Info` struct and looks like this:
110+
111+
```cpp
112+
typedef struct {
113+
std::string base_url;
114+
RestClients::HeaderFields headers;
115+
int timeout;
116+
struct {
117+
std::string username;
118+
std::string password;
119+
} basicAuth;
120+
std::string customUserAgent;
121+
struct {
122+
// total time of the last request in seconds Total time of previous
123+
// transfer. See CURLINFO_TOTAL_TIME
124+
int totalTime;
125+
// time spent in DNS lookup in seconds Time from start until name
126+
// resolving completed. See CURLINFO_NAMELOOKUP_TIME
127+
int nameLookupTime;
128+
// time it took until Time from start until remote host or proxy
129+
// completed. See CURLINFO_CONNECT_TIME
130+
int connectTime;
131+
// Time from start until SSL/SSH handshake completed. See
132+
// CURLINFO_APPCONNECT_TIME
133+
int appConnectTime;
134+
// Time from start until just before the transfer begins. See
135+
// CURLINFO_PRETRANSFER_TIME
136+
int preTransferTime;
137+
// Time from start until just when the first byte is received. See
138+
// CURLINFO_STARTTRANSFER_TIME
139+
int startTransferTime;
140+
// Time taken for all redirect steps before the final transfer. See
141+
// CURLINFO_REDIRECT_TIME
142+
int redirectTime;
143+
// number of redirects followed. See CURLINFO_REDIRECT_COUNT
144+
int redirectCount;
145+
} lastRequest;
146+
} Info;
147+
```
148+
149+
#### Persistent connections/Keep-Alive
150+
The connection object stores the curl easy handle in an instance variable and
151+
uses that for the lifetime of the object. This means curl will [automatically
152+
reuse connections][curl_keepalive] made with that handle.
153+
154+
155+
## Thread Safety
156+
restclient-cpp leans heavily on libcurl as it aims to provide a thin wrapper
157+
around it. This means it adheres to the basic level of thread safety [provided
158+
by libcurl][curl_threadsafety]. The `RestClient::init()` and
159+
`RestClient::disable()` methods basically correspond to `curl_global_init` and
160+
`curl_global_cleanup` and thus need to be called right at the beginning of
161+
your program and before shutdown respectively. These set up the environment
162+
and are **not thread-safe**. After that you can create connection objects in
163+
your threads. Do not share connection objects across threads as this would
164+
mean accessing curl handles from multiple threads at the same time which is
165+
not allowed.
166+
167+
In order to provide an easy to use API, the simple usage via the static
168+
methods implicitly calls the curl global functions and is therefore also **not
169+
thread-safe**.
170+
171+
172+
## Dependencies
173+
- [libcurl][]
174+
175+
## Installation
176+
There are some packages available for Linux on [packagecloud][packagecloud].
177+
And for OSX you can get it from the mrtazz/oss homebrew tap:
178+
179+
```bash
180+
brew tap mrtazz/oss
181+
brew install restclient-cpp
182+
```
183+
184+
Otherwise you can do the regular autotools dance:
185+
186+
```bash
187+
./autogen.sh
188+
./configure
189+
make install
190+
```
191+
192+
## Contribute
193+
All contributions are highly appreciated. This includes filing issues,
194+
updating documentation and writing code. Please take a look at the
195+
[contributing guidelines][contributing] before so your contribution can be
196+
merged as fast as possible.
197+
198+
199+
[libcurl]: http://curl.haxx.se/libcurl/
200+
[gtest]: http://code.google.com/p/googletest/
201+
[packagecloud]: https://packagecloud.io/mrtazz/restclient-cpp
202+
[contributing]: https://github.com/mrtazz/restclient-cpp/blob/master/CONTRIBUTING.md
203+
[curl_keepalive]: http://curl.haxx.se/docs/faq.html#What_about_Keep_Alive_or_persist
204+
[curl_threadsafety]: http://curl.haxx.se/libcurl/c/threadsafe.html
205+
[restclient_response]: http://code.mrtazz.com/restclient-cpp/ref/struct_rest_client_1_1_response.html

docs/ref/annotated.html

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5+
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
6+
<meta name="generator" content="Doxygen 1.8.9.1"/>
7+
<title>restclient-cpp: Class List</title>
8+
<link href="tabs.css" rel="stylesheet" type="text/css"/>
9+
<script type="text/javascript" src="jquery.js"></script>
10+
<script type="text/javascript" src="dynsections.js"></script>
11+
<link href="search/search.css" rel="stylesheet" type="text/css"/>
12+
<script type="text/javascript" src="search/searchdata.js"></script>
13+
<script type="text/javascript" src="search/search.js"></script>
14+
<script type="text/javascript">
15+
$(document).ready(function() { init_search(); });
16+
</script>
17+
<link href="doxygen.css" rel="stylesheet" type="text/css" />
18+
</head>
19+
<body>
20+
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
21+
<div id="titlearea">
22+
<table cellspacing="0" cellpadding="0">
23+
<tbody>
24+
<tr style="height: 56px;">
25+
<td style="padding-left: 0.5em;">
26+
<div id="projectname">restclient-cpp
27+
</div>
28+
<div id="projectbrief">C++ client for making HTTP/REST requests</div>
29+
</td>
30+
</tr>
31+
</tbody>
32+
</table>
33+
</div>
34+
<!-- end header part -->
35+
<!-- Generated by Doxygen 1.8.9.1 -->
36+
<script type="text/javascript">
37+
var searchBox = new SearchBox("searchBox", "search",false,'Search');
38+
</script>
39+
<div id="navrow1" class="tabs">
40+
<ul class="tablist">
41+
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
42+
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
43+
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
44+
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
45+
<li><a href="files.html"><span>Files</span></a></li>
46+
<li>
47+
<div id="MSearchBox" class="MSearchBoxInactive">
48+
<span class="left">
49+
<img id="MSearchSelect" src="search/mag_sel.png"
50+
onmouseover="return searchBox.OnSearchSelectShow()"
51+
onmouseout="return searchBox.OnSearchSelectHide()"
52+
alt=""/>
53+
<input type="text" id="MSearchField" value="Search" accesskey="S"
54+
onfocus="searchBox.OnSearchFieldFocus(true)"
55+
onblur="searchBox.OnSearchFieldFocus(false)"
56+
onkeyup="searchBox.OnSearchFieldChange(event)"/>
57+
</span><span class="right">
58+
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
59+
</span>
60+
</div>
61+
</li>
62+
</ul>
63+
</div>
64+
<div id="navrow2" class="tabs2">
65+
<ul class="tablist">
66+
<li class="current"><a href="annotated.html"><span>Class&#160;List</span></a></li>
67+
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
68+
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
69+
</ul>
70+
</div>
71+
</div><!-- top -->
72+
<!-- window showing the filter options -->
73+
<div id="MSearchSelectWindow"
74+
onmouseover="return searchBox.OnSearchSelectShow()"
75+
onmouseout="return searchBox.OnSearchSelectHide()"
76+
onkeydown="return searchBox.OnSearchSelectKey(event)">
77+
</div>
78+
79+
<!-- iframe showing the search results (closed by default) -->
80+
<div id="MSearchResultsWindow">
81+
<iframe src="javascript:void(0)" frameborder="0"
82+
name="MSearchResults" id="MSearchResults">
83+
</iframe>
84+
</div>
85+
86+
<div class="header">
87+
<div class="headertitle">
88+
<div class="title">Class List</div> </div>
89+
</div><!--header-->
90+
<div class="contents">
91+
<div class="textblock">Here are the classes, structs, unions and interfaces with brief descriptions:</div><div class="directory">
92+
<div class="levels">[detail level <span onclick="javascript:toggleLevel(1);">1</span><span onclick="javascript:toggleLevel(2);">2</span><span onclick="javascript:toggleLevel(3);">3</span>]</div><table class="directory">
93+
<tr id="row_0_" class="even"><td class="entry"><span style="width:0px;display:inline-block;">&#160;</span><span id="arr_0_" class="arrow" onclick="toggleFolder('0_')">&#9660;</span><span class="icona"><span class="icon">N</span></span><a class="el" href="namespace_rest_client.html" target="_self">RestClient</a></td><td class="desc">Namespace for all <a class="el" href="namespace_rest_client.html" title="namespace for all RestClient definitions ">RestClient</a> definitions </td></tr>
94+
<tr id="row_0_0_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span id="arr_0_0_" class="arrow" onclick="toggleFolder('0_0_')">&#9660;</span><span class="icona"><span class="icon">N</span></span><a class="el" href="namespace_rest_client_1_1_helpers.html" target="_self">Helpers</a></td><td class="desc">: namespace for all helper functions </td></tr>
95+
<tr id="row_0_0_0_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_rest_client_1_1_helpers_1_1_upload_object.html" target="_self">UploadObject</a></td><td class="desc">This structure represents the payload to upload on POST requests </td></tr>
96+
<tr id="row_0_1_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span id="arr_0_1_" class="arrow" onclick="toggleFolder('0_1_')">&#9660;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="class_rest_client_1_1_connection.html" target="_self">Connection</a></td><td class="desc"><a class="el" href="class_rest_client_1_1_connection.html" title="Connection object for advanced usage. ">Connection</a> object for advanced usage </td></tr>
97+
<tr id="row_0_1_0_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_rest_client_1_1_connection_1_1_info.html" target="_self">Info</a></td><td class="desc">Holds some diagnostics information about the connection object it came from </td></tr>
98+
<tr id="row_0_1_1_"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_rest_client_1_1_connection_1_1_request_info.html" target="_self">RequestInfo</a></td><td class="desc">Holds some diagnostics information about a request </td></tr>
99+
<tr id="row_0_2_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_rest_client_1_1_response.html" target="_self">Response</a></td><td class="desc">This structure represents the HTTP response data </td></tr>
100+
</table>
101+
</div><!-- directory -->
102+
</div><!-- contents -->
103+
<!-- start footer part -->
104+
<hr class="footer"/><address class="footer"><small>
105+
Generated on Sun Nov 27 2016 21:27:11 for restclient-cpp by &#160;<a href="http://www.doxygen.org/index.html">
106+
<img class="footer" src="doxygen.png" alt="doxygen"/>
107+
</a> 1.8.9.1
108+
</small></address>
109+
</body>
110+
</html>

docs/ref/arrowdown.png

246 Bytes
Loading

docs/ref/arrowright.png

229 Bytes
Loading

0 commit comments

Comments
 (0)