Files
superfaktura-client/superfaktura.superfaktura_api.html

222 lines
15 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!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>superfaktura.superfaktura_api module &mdash; SuperFaktura API client documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b86133f3" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
<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=5929fcd5"></script>
<script src="_static/doctools.js?v=9bcbadda"></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" />
</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">
SuperFaktura API client
</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">
<ul>
<li class="toctree-l1"><a class="reference internal" href="superfaktura.html">SuperFaktura API client</a></li>
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples of SuperFaktura API client usage</a></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">SuperFaktura API client</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 active">superfaktura.superfaktura_api module</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/superfaktura.superfaktura_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="module-superfaktura.superfaktura_api">
<span id="superfaktura-superfaktura-api-module"></span><h1>superfaktura.superfaktura_api module<a class="headerlink" href="#module-superfaktura.superfaktura_api" title="Link to this heading"></a></h1>
<p>SuperFaktura API Client.</p>
<p>This module provides classes and functions for working with the SuperFaktura API.
It allows for reading, creating, updating, and deleting data in SuperFaktura.</p>
<dl>
<dt>Classes:</dt><dd><ul class="simple">
<li><p>SuperFakturaAPI: The base class for working with the SuperFaktura API.</p></li>
<li><p>SuperFakturaAPIException: An exception for errors when working with the SuperFaktura API.</p></li>
<li><p>SuperFakturaAPIMissingCredentialsException: An exception for missing login credentials.</p></li>
</ul>
</dd>
<dt>Functions:</dt><dd><ul class="simple">
<li><p>get: Retrieves data from the SuperFaktura API.</p></li>
<li><p>post: Creates or updates data in the SuperFaktura API.</p></li>
</ul>
</dd>
<dt>Usage:</dt><dd><div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span><span class="w"> </span><span class="nn">superfaktura.superfaktura_api</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># Create an instance of SuperFakturaAPI</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">api</span> <span class="o">=</span> <span class="n">superfaktura</span><span class="o">.</span><span class="n">superfaktura_api</span><span class="o">.</span><span class="n">SuperFakturaAPI</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># Retrieve data from the SuperFaktura API</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">incoming_data</span> <span class="o">=</span> <span class="n">api</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;endpoint&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c1"># Create or update data in the SuperFaktura API</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">api</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s1">&#39;endpoint&#39;</span><span class="p">,</span> <span class="n">outgoing_data</span><span class="p">)</span>
</pre></div>
</div>
</dd>
</dl>
<dl class="py class">
<dt class="sig sig-object py" id="superfaktura.superfaktura_api.SuperFakturaAPI">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">superfaktura.superfaktura_api.</span></span><span class="sig-name descname"><span class="pre">SuperFakturaAPI</span></span><a class="headerlink" href="#superfaktura.superfaktura_api.SuperFakturaAPI" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Base class for working with the SuperFaktura API.</p>
<dl class="py method">
<dt class="sig sig-object py" id="superfaktura.superfaktura_api.SuperFakturaAPI.get">
<span class="sig-name descname"><span class="pre">get</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">endpoint</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">5</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bytes</span></span></span><a class="headerlink" href="#superfaktura.superfaktura_api.SuperFakturaAPI.get" title="Link to this definition"></a></dt>
<dd><p>Retrieves data from the SuperFaktura API.</p>
<p>Retrieves data from the specified endpoint in the SuperFaktura API.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>endpoint</strong> (<em>str</em>) The API endpoint to retrieve data from (e.g. invoices, clients,
etc.).</p></li>
<li><p><strong>timeout</strong> (<em>int</em><em>, </em><em>optional</em>) The timeout for the API request in seconds. Defaults to 5.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>The retrieved data in bytes.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>bytes</p>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#superfaktura.superfaktura_api.SuperFakturaAPIException" title="superfaktura.superfaktura_api.SuperFakturaAPIException"><strong>SuperFakturaAPIException</strong></a> If the API request fails or returns an error.</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">api</span> <span class="o">=</span> <span class="n">SuperFakturaAPI</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span> <span class="o">=</span> <span class="n">api</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;invoices&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>The available endpoints can be found in the SuperFaktura API documentation.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="superfaktura.superfaktura_api.SuperFakturaAPI.post">
<span class="sig-name descname"><span class="pre">post</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">endpoint</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">5</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Dict</span></span></span><a class="headerlink" href="#superfaktura.superfaktura_api.SuperFakturaAPI.post" title="Link to this definition"></a></dt>
<dd><p>Creates or updates data in the SuperFaktura API.</p>
<p>Creates or updates data in the specified endpoint in the SuperFaktura API.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>endpoint</strong> (<em>str</em>) The API endpoint to create or update data in (e.g. invoices,
clients, etc.).</p></li>
<li><p><strong>data</strong> (<em>str</em>) The data to be created or updated in JSON format.</p></li>
<li><p><strong>timeout</strong> (<em>int</em><em>, </em><em>optional</em>) The timeout for the API request in seconds. Defaults
to 5.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>The created or updated data in JSON format.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>Dict</p>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#superfaktura.superfaktura_api.SuperFakturaAPIException" title="superfaktura.superfaktura_api.SuperFakturaAPIException"><strong>SuperFakturaAPIException</strong></a> If the API request fails or returns an error.</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">api</span> <span class="o">=</span> <span class="n">SuperFakturaAPI</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span> <span class="o">=</span> <span class="s1">&#39;{&quot;name&quot;: &quot;Example Invoice&quot;, &quot;amount&quot;: 100.0}&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">response</span> <span class="o">=</span> <span class="n">api</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s1">&#39;invoices&#39;</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">response</span><span class="p">)</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>The available endpoints can be found in the SuperFaktura API documentation.
The data should be a valid JSON string.</p>
</dd></dl>
</dd></dl>
<dl class="py exception">
<dt class="sig sig-object py" id="superfaktura.superfaktura_api.SuperFakturaAPIException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">superfaktura.superfaktura_api.</span></span><span class="sig-name descname"><span class="pre">SuperFakturaAPIException</span></span><a class="headerlink" href="#superfaktura.superfaktura_api.SuperFakturaAPIException" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>Exception for errors when working with the SuperFaktura API.</p>
</dd></dl>
<dl class="py exception">
<dt class="sig sig-object py" id="superfaktura.superfaktura_api.SuperFakturaAPIMissingCredentialsException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">superfaktura.superfaktura_api.</span></span><span class="sig-name descname"><span class="pre">SuperFakturaAPIMissingCredentialsException</span></span><a class="headerlink" href="#superfaktura.superfaktura_api.SuperFakturaAPIMissingCredentialsException" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>Exception for missing login credentials.</p>
</dd></dl>
</section>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2025, Richard Kubíček, Eledio s.r.o..</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>