Heiko
=====

Heiko is a frontend for [MaaS](https://github.com/k4cg/matomat-service)
and a MVP client to be run in K4CG

Install
=======

Heiko is a pypi package that you can install via pip

    pip install heiko

For install from local git repository via git

    pip install .

For development, we need some extra packages, maintined in the target
\"dev\"

    pip install .[dev]

Run
===

    heiko

Development:
============

swagger-client
--------------

MaaS (Matomat as a Service) API definition

This Python package is automatically generated by the [Swagger
Codegen](https://github.com/swagger-api/swagger-codegen) project:

-   API version: 0.5.2
-   Package version: 1.0.0
-   Build package: io.swagger.codegen.languages.PythonClientCodegen

Requirements.
-------------

Python 3.4+

Installation & Usage
--------------------

### pip install

If the python package is hosted on Github, you can install directly from
Github

``` {.sh}
pip install git+https://github.com/k4cg/heiko.git
```

(you may need to run `pip` with root permission:
`sudo pip install git+https://github.com/k4cg/heiko.git`)

Then import the package:

``` {.python}
import swagger_client
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

``` {.sh}
python setup.py install --user
```

(or `sudo python setup.py install` to install the package for all users)

Then import the package:

``` {.python}
import swagger_client
```

Getting Started
---------------

Please follow the [installation procedure](#installation--usage) and
then run the following:

``` {.python}
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.AuthApi()
username = 'username_example' # str |
password = 'password_example' # str |
validityseconds = 56 # int |  (optional)

try:
    # Logs a user in and returns an JWT token for authentication
    api_response = api_instance.auth_login_post(username, password, validityseconds=validityseconds)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling AuthApi->auth_login_post: %s\n" % e)
```

Documentation for API Endpoints
-------------------------------

All URIs are relative to *https://localhost:8443/v0*

  --------------------------------------------------------------------------------------
  Class           Method                             HTTP request      Description
  --------------- ---------------------------------- ----------------- -----------------
  *AuthApi*       [auth\_login\_pos t \<docs/AuthApi **POST**          Logs a user in
                  .md\#auth\_login\_                 /auth/login       and returns an
                  post\>]{.title-ref}\_\_                              JWT token for
                                                                       authentication

  *ItemsApi*      [items\_get \<doc s/ItemsApi.md\#i **GET** /items    List all
                  tems\_get\>]{.title-ref}\_\_                         available items

  *ItemsApi*      [items\_item\_id\_ consume\_patch  **PATCH**         Consumes a Item
                  \< docs/ItemsApi.m                 /items/{itemId}   
                  d\#items\_item\_id                 /consume          
                  \_consume\_patch\>                                   
                  ]{.title-ref}\_\_                                    

  *ItemsApi*      [items\_item\_id\_ delete          **DELETE**        Delete Item
                  \<docs/It emsApi.md\#items         /items/{itemId}   
                  \_item\_id\_delete                                   
                  \>]{.title-ref}\_\_                                  

  *ItemsApi*      [items\_item\_id\_ get             **GET**           Get a certain
                  \<docs/Items Api.md\#items\_it     /items/{itemId}   Item
                  em\_id\_get\>]{.title-ref}\_\_                       

  *ItemsApi*      [items\_item\_id\_ patch           **PATCH**         Update Item
                  \<docs/Ite msApi.md\#items\_       /items/{itemId}   
                  item\_id\_patch\>]{.title-ref}                       
                  \_\_                                                 

  *ItemsApi*      [items\_item\_id\_ stats\_get      **GET**           Get consumption
                  \<docs /ItemsApi.md\#it            /items/{itemId}   stats
                  ems\_item\_id\_sta                 /stats            
                  ts\_get\>]{.title-ref}\_\_                           

  *ItemsApi*      [items\_post \<do cs/ItemsApi.md\# **POST** /items   Add a new item
                  items\_post\>]{.title-ref}\_\_                       

  *ItemsApi*      [items\_stats\_ge t \<docs/ItemsAp **GET**           Get consumption
                  i.md\#items\_stat                  /items/stats      stats of all
                  s\_get\>]{.title-ref}\_\_                            items

  *ServiceApi*    [service\_stats\_ get \<docs/Servi **GET**           Total service
                  ceApi.md\#servic                   /service/stats    stats
                  e\_stats\_get\>]{.title-ref}\_\_                     

  *UsersApi*      [users\_get \<doc s/UsersApi.md\#u **GET** /users    List all users
                  sers\_get\>]{.title-ref}\_\_                         

  *UsersApi*      [users\_post \<do cs/UsersApi.md\# **POST** /users   Add a new user
                  users\_post\>]{.title-ref}\_\_                       

  *UsersApi*      [users\_user\_id\_                 **PATCH**         Add users credits
                  credits\_add\_pat ch \<docs/UsersA /users/{userId}   
                  pi.md\#users\_use                  /credits/add      
                  r\_id\_credits\_ad                                   
                  d\_patch\>]{.title-ref}\_\_                          

  *UsersApi*      [users\_user\_id\_                 **PATCH**         Transfer credits
                  credits\_transfe r\_patch \<docs/U /users/{userId}   
                  sersApi.md\#user                   /credits/transf   
                  s\_user\_id\_credi                 er                
                  ts\_transfer\_pat                                    
                  ch\>]{.title-ref}\_\_                                

  *UsersApi*      [users\_user\_id\_                 **PATCH**         Widthdraw users
                  credits\_withdra w\_patch \<docs/U /users/{userId}   credits
                  sersApi.md\#user                   /credits/withdr   
                  s\_user\_id\_credi                 aw                
                  ts\_withdraw\_pat                                    
                  ch\>]{.title-ref}\_\_                                

  *UsersApi*      [users\_user\_id\_ delete          **DELETE**        Delete user
                  \<docs/Us ersApi.md\#users         /users/{userId}   
                  \_user\_id\_delete                                   
                  \>]{.title-ref}\_\_                                  

  *UsersApi*      [users\_user\_id\_ get             **GET**           Get user by user
                  \<docs/Users Api.md\#users\_us     /users/{userId}   ID
                  er\_id\_get\>]{.title-ref}\_\_                       

  *UsersApi*      [users\_user\_id\_ password\_patch **PATCH**         Change password
                  \<docs/UsersApi.                   /users/{userId}   for currently
                  md\#users\_user\_i                 /password         logged in user.
                  d\_password\_patc                                    
                  h\>]{.title-ref}\_\_                                 

  *UsersApi*      [users\_user\_id\_                 **PATCH**         Set password for
                  resetpassword\_p atch \<docs/User  /users/{userId}   user ID
                  sApi.md\#users\_u                  /resetpassword    
                  ser\_id\_resetpas                                    
                  sword\_patch\>]{.title-ref}\_\_                      

  *UsersApi*      [users\_user\_id\_ stats\_get      **GET**           Get matomat stats
                  \<docs /UsersApi.md\#us            /users/{userId}   for user
                  ers\_user\_id\_sta                 /stats            
                  ts\_get\>]{.title-ref}\_\_                           
  --------------------------------------------------------------------------------------

Documentation For Models
------------------------

-   [AuthSuccess](docs/AuthSuccess.md)
-   [Error](docs/Error.md)
-   [Item](docs/Item.md)
-   [ItemStats](docs/ItemStats.md)
-   [ServiceStats](docs/ServiceStats.md)
-   [ServiceStatsItems](docs/ServiceStatsItems.md)
-   [ServiceStatsItemsCost](docs/ServiceStatsItemsCost.md)
-   [ServiceStatsUsers](docs/ServiceStatsUsers.md)
-   [ServiceStatsUsersCredits](docs/ServiceStatsUsersCredits.md)
-   [TransferredCredits](docs/TransferredCredits.md)
-   [User](docs/User.md)
-   [UserStats](docs/UserStats.md)

Documentation For Authorization
-------------------------------

jwtTokenAuth
------------

-   **Type**: API key
-   **API key parameter name**: Authorization
-   **Location**: HTTP header

Author
------

\@noqqe
