transport-accessibility/docs/build/html/api.html
2024-06-21 12:02:35 +02:00

252 lines
14 KiB
HTML

<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>api package &mdash; Transport Accessibility 0.2 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=10f1778b"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="transport_accessibility package" href="transport_accessibility.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
Transport Accessibility
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="modules.html">transport_accessibility</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="manage.html">manage module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pt_map.html">pt_map package</a></li>
<li class="toctree-l2"><a class="reference internal" href="transport_accessibility.html">transport_accessibility package</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">api package</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#subpackages">Subpackages</a><ul class="simple">
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#submodules">Submodules</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-api.admin">api.admin module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-api.apps">api.apps module</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#api.apps.ApiConfig"><code class="docutils literal notranslate"><span class="pre">ApiConfig</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#module-api.models">api.models module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-api.tests">api.tests module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-api.urls">api.urls module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-api.views">api.views module</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#views">Views</a></li>
<li class="toctree-l4"><a class="reference internal" href="#api.views.data"><code class="docutils literal notranslate"><span class="pre">data()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#api.views.timetable"><code class="docutils literal notranslate"><span class="pre">timetable()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#module-api">Module contents</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Transport Accessibility</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="modules.html">transport_accessibility</a></li>
<li class="breadcrumb-item active">api package</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/api.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="api-package">
<h1>api package<a class="headerlink" href="#api-package" title="Link to this heading"></a></h1>
<section id="subpackages">
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Link to this heading"></a></h2>
<div class="toctree-wrapper compound">
</div>
</section>
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Link to this heading"></a></h2>
</section>
<section id="module-api.admin">
<span id="api-admin-module"></span><h2>api.admin module<a class="headerlink" href="#module-api.admin" title="Link to this heading"></a></h2>
</section>
<section id="module-api.apps">
<span id="api-apps-module"></span><h2>api.apps module<a class="headerlink" href="#module-api.apps" title="Link to this heading"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="api.apps.ApiConfig">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">api.apps.</span></span><span class="sig-name descname"><span class="pre">ApiConfig</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">app_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">app_module</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#api.apps.ApiConfig" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">AppConfig</span></code></p>
<dl class="py attribute">
<dt class="sig sig-object py" id="api.apps.ApiConfig.default_auto_field">
<span class="sig-name descname"><span class="pre">default_auto_field</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'django.db.models.BigAutoField'</span></em><a class="headerlink" href="#api.apps.ApiConfig.default_auto_field" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="api.apps.ApiConfig.name">
<span class="sig-name descname"><span class="pre">name</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'api'</span></em><a class="headerlink" href="#api.apps.ApiConfig.name" title="Link to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</section>
<section id="module-api.models">
<span id="api-models-module"></span><h2>api.models module<a class="headerlink" href="#module-api.models" title="Link to this heading"></a></h2>
</section>
<section id="module-api.tests">
<span id="api-tests-module"></span><h2>api.tests module<a class="headerlink" href="#module-api.tests" title="Link to this heading"></a></h2>
</section>
<section id="module-api.urls">
<span id="api-urls-module"></span><h2>api.urls module<a class="headerlink" href="#module-api.urls" title="Link to this heading"></a></h2>
</section>
<section id="module-api.views">
<span id="api-views-module"></span><h2>api.views module<a class="headerlink" href="#module-api.views" title="Link to this heading"></a></h2>
<section id="views">
<h3>Views<a class="headerlink" href="#views" title="Link to this heading"></a></h3>
<p>Views serving (mostly JSON) data via HTTP, no actual web pages.</p>
<section id="functions">
<h4>Functions<a class="headerlink" href="#functions" title="Link to this heading"></a></h4>
<dl class="simple">
<dt>timetable</dt><dd><p>Fetches timetables for given routes on api/timetable/</p>
</dd>
<dt>data</dt><dd><p>Serves api/models/
GET:
Fetches models given their primary keys
PUT:
Creates new model objects or updates them with complete representations. If object with the given primary keys exist, they will be deleted and replaced.
PATCH:
Updates models, identified by their primary keys without deleting them. Can be incomplete representations.
DELETE:
Deletes models, identified by their primary keys.</p>
</dd>
</dl>
</section>
</section>
<dl class="py function">
<dt class="sig sig-object py" id="api.views.data">
<span class="sig-prename descclassname"><span class="pre">api.views.</span></span><span class="sig-name descname"><span class="pre">data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">request</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#api.views.data" title="Link to this definition"></a></dt>
<dd><p>Handle database requests from the frontend. Using Http semantics to specify what to do with the data.</p>
<section id="request">
<h3>Request<a class="headerlink" href="#request" title="Link to this heading"></a></h3>
<dl class="simple">
<dt>PUT</dt><dd><p>Create a new object if no object with the given primary key exists in the database or delete and replace an existing object.
Body must be a json dict of lists of fully specified, valid models. Primary keys can be omitted and will be ignored if the element does not exist in the database.
If primary keys are given, the elements are deleted and replaced. Note that if there is an error in creating the new object, the object to replace will still probably already have been deleted.
Successful response is 200 with a list of primary keys of the created and replaced objects.</p>
</dd>
<dt>PATCH</dt><dd><p>Modify an existing objects given the instructions in the body.
Body must be a json dict of lists of fields to change and their valid values existing objects in the database, identified by their valid primary keys.
Responds 400 if any of the primary keys given does not exist.
Successful response is 200 with a list of the primary keys of the modified objects.</p>
</dd>
<dt>GET</dt><dd><p>Return json of models identified by primary keys.
Responds 400 if any of the requested pks does not exist.</p>
</dd>
<dt>DELETE</dt><dd><p>Delete models with given primary keys if they exist.
Responds 400 if any of the primary keys given does not exist in the database.
Successful response is 200 and the number of deleted models.</p>
</dd>
</dl>
</section>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="api.views.timetable">
<span class="sig-prename descclassname"><span class="pre">api.views.</span></span><span class="sig-name descname"><span class="pre">timetable</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">request</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#api.views.timetable" title="Link to this definition"></a></dt>
<dd><p>Lookup timetable data for given routes.</p>
<section id="id1">
<h3>Request<a class="headerlink" href="#id1" title="Link to this heading"></a></h3>
<p>GET:
Find timetables for all routes passed via GET.
Successful response is a Json representation of a dict of timetables in the following form:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="n">route_id</span> <span class="p">(</span><span class="kn">from</span> <span class="nn">GET</span><span class="p">):</span> <span class="p">{</span>
<span class="s1">&#39;stop_sequence&#39;</span><span class="p">:</span> <span class="p">[</span><span class="n">stop_ids</span> <span class="k">for</span> <span class="nb">all</span> <span class="n">stops</span> <span class="n">the</span> <span class="n">route</span> <span class="n">server</span><span class="p">,</span> <span class="ow">in</span> <span class="n">order</span><span class="p">],</span>
<span class="s1">&#39;stop_times&#39;</span><span class="p">:</span> <span class="p">{</span>
<span class="n">stop_id</span> <span class="p">(</span><span class="kn">from</span> <span class="nn">stop_sequence</span><span class="p">):</span> <span class="p">[</span><span class="nb">str</span> <span class="ow">in</span> <span class="n">the</span> <span class="nb">format</span> <span class="n">HH</span><span class="p">:</span><span class="n">MM</span> <span class="n">representing</span> <span class="n">stop</span> <span class="n">times</span><span class="p">]</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</section>
</dd></dl>
</section>
<section id="module-api">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-api" title="Link to this heading"></a></h2>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="transport_accessibility.html" class="btn btn-neutral float-left" title="transport_accessibility package" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2024, Jan Kiljanski and Johannes Randerath.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>