Skip to content

Commit

Permalink
Merge pull request #277 from AliceO2Group/O2B-373
Browse files Browse the repository at this point in the history
O2 b 373
  • Loading branch information
ekertt authored Jan 5, 2021
2 parents 396a5bf + 1c7995a commit 33e24be
Show file tree
Hide file tree
Showing 158 changed files with 9,556 additions and 729 deletions.
37 changes: 10 additions & 27 deletions cpp-api-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,6 @@
[![LICENSE](https://img.shields.io/github/license/rummens1337/bookkeeping-cpprest-client.svg)](https://github.com/rummens1337/bookkeeping-cpprest-client/blob/main/LICENSE)
[![GitHub contributors](https://img.shields.io/github/contributors/rummens1337/bookkeeping-cpprest-client)](https://github.com/rummens1337/bookkeeping-cpprest-client/graphs/contributors)


The client currently only supports adding and ending a run. More endpoints will be supported soon.

### runStart
Signature
```cpp
void BookkeepingApi::runStart(int64_t runNumber, boost::posix_time::ptime o2Start,
boost::posix_time::ptime triggerStart, utility::string_t activityId,
RunType runType, int64_t nDetectors, int64_t nFlps, int64_t nEpns)
```
Description:
Stores start information of a run in the Bookkeeping system
### runStop
Signature
```cpp
void BookkeepingApi::runEnd(int64_t runNumber, boost::posix_time::ptime o2End, boost::posix_time::ptime triggerEnd,
RunQuality runQuality)
```
Description:
Stores stop information of a run in the Bookkeeping system

### Example
There's also an example of the usage in `src/Example.cpp`


## Manual setup
### Fedora
Install dependencies and build the C++ client.
Expand Down Expand Up @@ -59,7 +33,16 @@ Alternatively, you can speed up the build by adding the amount of cores it may r
make -j $(expr $(nproc) - 1)
```

# Example code

# Usage
This library serves as an C++ API client to the O2 bookkeeping system.
API endpoints are documented in docblocks in BookkeepingInterface.h, or in the documentation directory -> index.html -> Bookkeeping -> BookkeepingApi.
There's also an example of the usage in `Example.cpp`

### API token
API token is loaded into the Bookkeeping request upon page load, and can be extracted by looking with the chrome inspector -> network -> reload page and fetch token from request. TODO: create fetchToken method.

### Example code
If your api is at `http://localhost:4000/api`:
```console
export BOOKKEEPING_URL=http://localhost:4000/api
Expand Down
170 changes: 170 additions & 0 deletions cpp-api-client/documentation/html/BookkeepingInterface_8h.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Bookkeeping C++ API client: src/BookkeepingInterface.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Bookkeeping C++ API client
</div>
<div id="projectbrief">Bookkeeping C++ API client that can be used to access the rest API of O2&#39;s bookkeeping system.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#namespaces">Namespaces</a> </div>
<div class="headertitle">
<div class="title">BookkeepingInterface.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;vector&gt;</code><br />
<code>#include &quot;CreateLogParameters.h&quot;</code><br />
<code>#include &quot;CreateRunParameters.h&quot;</code><br />
<code>#include &quot;GetLogsParameters.h&quot;</code><br />
<code>#include &quot;GetRunsParameters.h&quot;</code><br />
<code>#include &quot;Log.h&quot;</code><br />
<code>#include &quot;LogOrigin.h&quot;</code><br />
<code>#include &quot;LogSubtype.h&quot;</code><br />
<code>#include &quot;OrderDirection.h&quot;</code><br />
<code>#include &quot;cpprest-client/model/Run.h&quot;</code><br />
<code>#include &quot;cpprest-client/model/Log.h&quot;</code><br />
<code>#include &quot;RunType.h&quot;</code><br />
<code>#include &quot;RunQuality.h&quot;</code><br />
<code>#include &quot;ApiClient.h&quot;</code><br />
<code>#include &quot;MultipartFormData.h&quot;</code><br />
<code>#include &quot;ModelBase.h&quot;</code><br />
<code>#include &lt;sstream&gt;</code><br />
<code>#include &lt;limits&gt;</code><br />
<code>#include &lt;iomanip&gt;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for BookkeepingInterface.h:</div>
<div class="dyncontent">
<div class="center"><img src="BookkeepingInterface_8h__incl.png" border="0" usemap="#src_2BookkeepingInterface_8h" alt=""/></div>
<map name="src_2BookkeepingInterface_8h" id="src_2BookkeepingInterface_8h">
<area shape="rect" title=" " alt="" coords="3816,5,4015,32"/>
<area shape="rect" title=" " alt="" coords="5,109,68,136"/>
<area shape="rect" title=" " alt="" coords="92,109,267,136"/>
<area shape="rect" title=" " alt="" coords="291,109,350,136"/>
<area shape="rect" title=" " alt="" coords="374,109,441,136"/>
<area shape="rect" title=" " alt="" coords="465,87,672,158"/>
<area shape="rect" title=" " alt="" coords="696,87,903,158"/>
<area shape="rect" title=" " alt="" coords="927,109,1103,136"/>
<area shape="rect" title=" " alt="" coords="1128,102,1295,143"/>
<area shape="rect" title=" " alt="" coords="1319,109,1480,136"/>
<area shape="rect" title=" " alt="" coords="1504,109,1647,136"/>
<area shape="rect" title=" " alt="" coords="1671,87,1877,158"/>
<area shape="rect" title=" " alt="" coords="1902,109,2065,136"/>
<area shape="rect" title=" " alt="" coords="2089,87,2296,158"/>
<area shape="rect" title=" " alt="" coords="2320,87,2527,158"/>
<area shape="rect" title=" " alt="" coords="2551,109,2608,136"/>
<area shape="rect" title=" " alt="" coords="2633,109,2729,136"/>
<area shape="rect" title=" " alt="" coords="2753,109,2864,136"/>
<area shape="rect" title=" " alt="" coords="2888,109,3017,136"/>
<area shape="rect" title=" " alt="" coords="3041,102,3197,143"/>
<area shape="rect" title=" " alt="" coords="3222,87,3449,158"/>
<area shape="rect" title=" " alt="" coords="3473,109,3523,136"/>
<area shape="rect" title=" " alt="" coords="3548,87,3781,158"/>
<area shape="rect" title=" " alt="" coords="3806,109,3883,136"/>
<area shape="rect" title=" " alt="" coords="3908,102,4064,143"/>
<area shape="rect" title=" " alt="" coords="4089,87,4366,158"/>
<area shape="rect" title=" " alt="" coords="4391,87,4608,158"/>
<area shape="rect" title=" " alt="" coords="4633,109,4713,136"/>
<area shape="rect" title=" " alt="" coords="4737,109,4851,136"/>
<area shape="rect" title=" " alt="" coords="4875,80,5081,165"/>
<area shape="rect" title=" " alt="" coords="5105,80,5312,165"/>
<area shape="rect" title=" " alt="" coords="5336,102,5492,143"/>
<area shape="rect" title=" " alt="" coords="5516,80,5723,165"/>
<area shape="rect" title=" " alt="" coords="5747,87,5969,158"/>
<area shape="rect" title=" " alt="" coords="5993,80,6200,165"/>
<area shape="rect" title=" " alt="" coords="6224,80,6431,165"/>
<area shape="rect" title=" " alt="" coords="6455,80,6661,165"/>
<area shape="rect" title=" " alt="" coords="6685,80,6892,165"/>
<area shape="rect" title=" " alt="" coords="6916,87,7144,158"/>
<area shape="rect" title=" " alt="" coords="7168,109,7257,136"/>
<area shape="rect" title=" " alt="" coords="7282,109,7386,136"/>
<area shape="rect" title=" " alt="" coords="7410,109,7503,136"/>
<area shape="rect" title=" " alt="" coords="7527,109,7685,136"/>
<area shape="rect" title=" " alt="" coords="7709,109,7815,136"/>
<area shape="rect" title=" " alt="" coords="7839,109,7914,136"/>
<area shape="rect" title=" " alt="" coords="7938,109,7997,136"/>
<area shape="rect" title=" " alt="" coords="8021,109,8095,136"/>
</map>
</div>
</div>
<p><a href="BookkeepingInterface_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbookkeeping_1_1BookkeepingInterface.html">bookkeeping::BookkeepingInterface</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:namespacebookkeeping"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacebookkeeping.html">bookkeeping</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<map id="src/BookkeepingInterface.h" name="src/BookkeepingInterface.h">
<area shape="rect" id="node1" title=" " alt="" coords="3816,5,4015,32"/>
<area shape="rect" id="node2" title=" " alt="" coords="5,109,68,136"/>
<area shape="rect" id="node3" title=" " alt="" coords="92,109,267,136"/>
<area shape="rect" id="node4" title=" " alt="" coords="291,109,350,136"/>
<area shape="rect" id="node5" title=" " alt="" coords="374,109,441,136"/>
<area shape="rect" id="node6" title=" " alt="" coords="465,87,672,158"/>
<area shape="rect" id="node7" title=" " alt="" coords="696,87,903,158"/>
<area shape="rect" id="node8" title=" " alt="" coords="927,109,1103,136"/>
<area shape="rect" id="node9" title=" " alt="" coords="1128,102,1295,143"/>
<area shape="rect" id="node10" title=" " alt="" coords="1319,109,1480,136"/>
<area shape="rect" id="node11" title=" " alt="" coords="1504,109,1647,136"/>
<area shape="rect" id="node12" title=" " alt="" coords="1671,87,1877,158"/>
<area shape="rect" id="node13" title=" " alt="" coords="1902,109,2065,136"/>
<area shape="rect" id="node14" title=" " alt="" coords="2089,87,2296,158"/>
<area shape="rect" id="node15" title=" " alt="" coords="2320,87,2527,158"/>
<area shape="rect" id="node16" title=" " alt="" coords="2551,109,2608,136"/>
<area shape="rect" id="node17" title=" " alt="" coords="2633,109,2729,136"/>
<area shape="rect" id="node18" title=" " alt="" coords="2753,109,2864,136"/>
<area shape="rect" id="node19" title=" " alt="" coords="2888,109,3017,136"/>
<area shape="rect" id="node20" title=" " alt="" coords="3041,102,3197,143"/>
<area shape="rect" id="node21" title=" " alt="" coords="3222,87,3449,158"/>
<area shape="rect" id="node22" title=" " alt="" coords="3473,109,3523,136"/>
<area shape="rect" id="node23" title=" " alt="" coords="3548,87,3781,158"/>
<area shape="rect" id="node24" title=" " alt="" coords="3806,109,3883,136"/>
<area shape="rect" id="node25" title=" " alt="" coords="3908,102,4064,143"/>
<area shape="rect" id="node26" title=" " alt="" coords="4089,87,4366,158"/>
<area shape="rect" id="node27" title=" " alt="" coords="4391,87,4608,158"/>
<area shape="rect" id="node28" title=" " alt="" coords="4633,109,4713,136"/>
<area shape="rect" id="node29" title=" " alt="" coords="4737,109,4851,136"/>
<area shape="rect" id="node30" title=" " alt="" coords="4875,80,5081,165"/>
<area shape="rect" id="node31" title=" " alt="" coords="5105,80,5312,165"/>
<area shape="rect" id="node32" title=" " alt="" coords="5336,102,5492,143"/>
<area shape="rect" id="node33" title=" " alt="" coords="5516,80,5723,165"/>
<area shape="rect" id="node34" title=" " alt="" coords="5747,87,5969,158"/>
<area shape="rect" id="node35" title=" " alt="" coords="5993,80,6200,165"/>
<area shape="rect" id="node36" title=" " alt="" coords="6224,80,6431,165"/>
<area shape="rect" id="node37" title=" " alt="" coords="6455,80,6661,165"/>
<area shape="rect" id="node38" title=" " alt="" coords="6685,80,6892,165"/>
<area shape="rect" id="node39" title=" " alt="" coords="6916,87,7144,158"/>
<area shape="rect" id="node40" title=" " alt="" coords="7168,109,7257,136"/>
<area shape="rect" id="node41" title=" " alt="" coords="7282,109,7386,136"/>
<area shape="rect" id="node42" title=" " alt="" coords="7410,109,7503,136"/>
<area shape="rect" id="node43" title=" " alt="" coords="7527,109,7685,136"/>
<area shape="rect" id="node44" title=" " alt="" coords="7709,109,7815,136"/>
<area shape="rect" id="node45" title=" " alt="" coords="7839,109,7914,136"/>
<area shape="rect" id="node46" title=" " alt="" coords="7938,109,7997,136"/>
<area shape="rect" id="node47" title=" " alt="" coords="8021,109,8095,136"/>
</map>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
663969c8517666f5c9b79bf7ff4f18c1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 33e24be

Please sign in to comment.