..
   Netfiles API documentation master file, created by
   sphinx-quickstart on Fri Mar  6 11:42:21 2020.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

#################
 Data Structures
#################

Netfiles uses Hyperwave as the back-end and thus the data structures
represent an Hyperwave Object.

You will notice that in many *classic* Netfiles documentations the talk
was of ``HW_Object``. That stands for any *Hyperwave Object*.

******************************
 Hyperwave Object (HW_Object)
******************************

A *Hyperwave Object* (``HW_Object``) is something stored in Hyperwave.
It can represent any one type of:

-  A User
-  A Document
-  A Dataroom
-  A Collection of any type
-  ...

An example is given below. This is a ``person`` record after the user
has been logged-in:

.. code:: json

   {
       "response": {
           "id": "uid-imdat",
           "type": "person",
           "name": "imdat",
           "firstname": "Imdat",
           "lastname": "Solak",
           "realname": "Imdat Solak",
           "email": "imdat@solak.de",
           "href": "/users/imdat",
           "usercoll": {
               "type": "collection",
               "id": "ID-29855.6441339085936-1",
               "path": "/users/imdat",
               "documentClass": "user",
               "version": "",
               "downloadProhibited": false,
               "title": "Solak, Imdat",
               "name": "imdat",
               "creationDate": "2019/11/24 17:00:53 +0000",
               "modificationDate": "2020/03/05 14:45:26 +0000",
               "author": "System User",
               "writeAccess": true,
               "subDocs": "7"
           },
           "logintype": "sms",
           "lastSelectedProject": "",
           "projects": [
               {
                   "type": "collection",
                   "id": "ID-29855.6131195075243-1",
                   "path": "/entwicklung",
                   "documentClass": "project",
                   "version": "",
                   "downloadProhibited": true,
                   "lastLogin": "2020/03/05 10:42:52 +0000",
                   "AccountType": "standard",
                   "loginVerification": false,
                   "showPrivateFiles": false,
                   "showPublicFiles": false,
                   "showAdmins": true,
                   "showAuthor": false,
                   "showBack": true,
                   "showBin": true,
                   "showCommentNumber": true,
                   "showComments": true,
                   "showCommentsScope": false,
                   "showContacts": false,
                   "showDateWithTime": false,
                   "showDates": true,
                   "showDeviceAccess": true,
                   "showDisabled": false,
                   "showDocuments": true,
                   "showFavourites": true,
                   "showForum": false,
                   "showGoto": false,
                   "showHome": false,
                   "showLocked": true,
                   "showLoginVerification": false,
                   "showNewFiles": true,
                   "showNewNavigation": true,
                   "showNews": false,
                   "showPDFInViewer": true,
                   "showPasswordDirective": false,
                   "showPrefered": true,
                   "showPrintButton": false,
                   "showQandA": false,
                   "showQandANumber": false,
                   "showReload": true,
                   "showRightsIcons": true,
                   "showSearch": true,
                   "showStartpage": false,
                   "showTasks": true,
                   "showTeamFunctions": true,
                   "showTimeCreated": false,
                   "showTitlePath": true,
                   "showToBeApproved": false,
                   "showUserAdministration": false,
                   "showViewer": true,
                   "showWelcome": true,
                   "showWiki": true,
                   "useWatermark": false,
                    "disclaimer": {
                       "creationDate": "2021/02/16 14:04:06 +0000",
                       "acceptionDate": "2021/02/16 14:01:35 +0000",
                       "content": "<p>Bitte akzeptieren Sie diesen Disclaimer.</p>"
                   },
                   "AccessAllowed": true,
                   "title": "4 - Entwicklung",
                   "name": "entwicklung",
                   "creationDate": "2017/07/03 11:28:07 +0000",
                   "modificationDate": "2020/03/05 10:15:21 +0000",
                   "author": "System User",
                   "writeAccess": false,
                   "subDocs": "6265"
               }
           ]
       }
   }

***************************
 Standard Hyperwave Object
***************************

A 'standard' Hyperwave Object has, as a minimum, what is called a
*global object id*, represented by ``id`` attribute in any ``HW_Object``
you may find.

So, a minimal *Hyperwave Obejct* looks like this:

+-----------------------+-----------------------+---------------------------------------------------------------+
| Attribute Name        | Attribute Type        | Comments                                                      |
+=======================+=======================+===============================================================+
| id                    | String                | The globally Unique ID of the object                          |
+-----------------------+-----------------------+---------------------------------------------------------------+
| documentClass         | String                | One of ("project", "user", "...")                             |
+-----------------------+-----------------------+---------------------------------------------------------------+
| type                  | String                | One of ("collection", "document")                             |
+-----------------------+-----------------------+---------------------------------------------------------------+
| version               | String                | Current version of the object                                 |
+-----------------------+-----------------------+---------------------------------------------------------------+
| author                | String                | Name of the user who created this object                      |
+-----------------------+-----------------------+---------------------------------------------------------------+
| creationDate          | DateTime              | Date & Time of Creation (Format??)                            |
+-----------------------+-----------------------+---------------------------------------------------------------+
| modificationDate      | DateTime              | Date & Time of last modification                              |
+-----------------------+-----------------------+---------------------------------------------------------------+
| name                  | String                | The name of the object                                        |
+-----------------------+-----------------------+---------------------------------------------------------------+
| owner                 | String                | Owner of the object                                           |
+-----------------------+-----------------------+---------------------------------------------------------------+
| title                 | String                | Title of the object usually shown to the users                |
+-----------------------+-----------------------+---------------------------------------------------------------+
| path                  | String                | Path relative to the server                                   |
+-----------------------+-----------------------+---------------------------------------------------------------+
| searchable            | Boolean               | Is the object searchable?                                     |
+-----------------------+-----------------------+---------------------------------------------------------------+
| downloadProhibited    | Boolean               | Whether the download is prohibited or not                     |
+-----------------------+-----------------------+---------------------------------------------------------------+
| AccessAllowed [#]_    | Boolean               | Whether Access for this API-Key-user is allowed               |
+-----------------------+-----------------------+---------------------------------------------------------------+
| writeAccess           | Boolean               | Whether writing is allowed for the current user               |
+-----------------------+-----------------------+---------------------------------------------------------------+
| subDocs               | String [#]_           | As a string the number of documents below this level          |
+-----------------------+-----------------------+---------------------------------------------------------------+

A document of ``type`` ``collection`` has children which you can
retrieve using the :doc:`Get Children <calls/getchildren>` call. A
document of ``type`` ``document`` is a eaf object and can not have
children. But it has content which can be retrieved using the :doc:`Get
Content <calls/getcontent>` call.

*******************
 Date/Time Formats
*******************

Date/Time is stored in the format ``YYYY/MM/DD HH:MM:SS +0000``, whereas
``HH`` is in 24-hours.

*****************************
 Hyperwave Object *Dataroom*
*****************************

A ``HW_Object`` of ``documentClass`` *project* is represented in
Netfiles as a dataroom. A user can have access to numerous datarooms.
When you log-in using the :doc:`Check Identity <calls/checkidentity>`
call, you will receive in the response information about all of the
user's datarooms in the ``projects`` array.

Just to be absolutely sure, here is what you will get:

+-----------------------+-----------------------+---------------------------------------------------------------+
| Attribute Name        | Attribute Type        | Value                                                         |
+=======================+=======================+===============================================================+
| id                    | String                | "ID-xxxxxxxxxxxxxxxxxxxxx"                                    |
+-----------------------+-----------------------+---------------------------------------------------------------+
| documentClass         | String                | "project"                                                     |
+-----------------------+-----------------------+---------------------------------------------------------------+
| type                  | String                | "collection"                                                  |
+-----------------------+-----------------------+---------------------------------------------------------------+
| version               | String                | ""                                                            |
+-----------------------+-----------------------+---------------------------------------------------------------+
| author                | String                | "System User" (probably)                                      |
+-----------------------+-----------------------+---------------------------------------------------------------+
| AccountType           | String                | 19. below                                                     |
+-----------------------+-----------------------+---------------------------------------------------------------+
| ...                   | ...                   | ...                                                           |
+-----------------------+-----------------------+---------------------------------------------------------------+

The remaining attributes are shown in the JSON-example above.

Following ``AccountType`` are known so far:

+---------------+-----------------------------------------------------------------------------------------------+
| Type          | Description                                                                                   |
+===============+===============================================================================================+
| standard      | A standard dataroom containing document and folders.                                          |
+---------------+-----------------------------------------------------------------------------------------------+
| business      | Dataroom of type "Business Plus"                                                              |
+---------------+-----------------------------------------------------------------------------------------------+
| dealroom      | Dataroom of type "Dealroom" - meant to be used for M&A-Projects                               |
+---------------+-----------------------------------------------------------------------------------------------+
| dataroom      | Standard dataroom                                                                             |
+---------------+-----------------------------------------------------------------------------------------------+
| boardroom     | Dataroom of type "boardroom"                                                                  |
+---------------+-----------------------------------------------------------------------------------------------+

*************************
 Hyperwave Object *User*
*************************

After login, you will receive the data structure as shown above in the
`Json-Example`.

The data consists of the following attributes:

+-----------------------+-----------------------+---------------------------------------------------------------+
| Attribute Name        | Attribute Type        | Value                                                         |
+=======================+=======================+===============================================================+
| id                    | String                | "uid-xxxxxxxxxx"                                              |
+-----------------------+-----------------------+---------------------------------------------------------------+
| type                  | String                | "person"                                                      |
+-----------------------+-----------------------+---------------------------------------------------------------+
| name                  | String                | The username of the user in question                          |
+-----------------------+-----------------------+---------------------------------------------------------------+
| firstname             | String                | The "first name" (given name) of the user                     |
+-----------------------+-----------------------+---------------------------------------------------------------+
| lastname              | String                | The last name (family name) of the user                       |
+-----------------------+-----------------------+---------------------------------------------------------------+
| realname              | String                | This seems to be "firstname + lastname"                       |
+-----------------------+-----------------------+---------------------------------------------------------------+
| email                 | String                | The registered user email-address                             |
+-----------------------+-----------------------+---------------------------------------------------------------+
| href                  | String                | The URL of the user object for this user                      |
+-----------------------+-----------------------+---------------------------------------------------------------+
| usercoll              | HWObject              | The `user`-collection                                         |
+-----------------------+-----------------------+---------------------------------------------------------------+
| logintype             | String                | Don't know either                                             |
+-----------------------+-----------------------+---------------------------------------------------------------+
| lastSelectedProject   | String                | The last project (dataroom) the user had selected on the web  |
+-----------------------+-----------------------+---------------------------------------------------------------+
| projects              | List<HWObject>        | List of user's projects (datarooms) => ``HW_Object[]``        |
+-----------------------+-----------------------+---------------------------------------------------------------+

************************************
 Hyperwave Object *User Collection*
************************************

A ``HW_Object`` of ``type`` *collection* and ``documentClass`` *user*
represents a single user after login. The data contains the following:

+-----------------------+-----------------------+---------------------------------------------------------------+
| Attribute Name        | Attribute Type        | Value                                                         |
+=======================+=======================+===============================================================+
| id                    | String                | Global Object ID (Format: "ID-xxxxxxxxxxxxxxxxxxxxx")         |
+-----------------------+-----------------------+---------------------------------------------------------------+
| documentClass         | String                | "user"                                                        |
+-----------------------+-----------------------+---------------------------------------------------------------+
| type                  | String                | "collection"                                                  |
+-----------------------+-----------------------+---------------------------------------------------------------+
| version               | String                | ""                                                            |
+-----------------------+-----------------------+---------------------------------------------------------------+
| downloadProhibited    | Boolean               | "false"                                                       |
+-----------------------+-----------------------+---------------------------------------------------------------+
| path                  | String                | URL of this user's information                                |
+-----------------------+-----------------------+---------------------------------------------------------------+
| title                 | String                | Title of this object ("lastname, firstname")                  |
+-----------------------+-----------------------+---------------------------------------------------------------+
| name                  | String                | Name of this object ("username")                              |
+-----------------------+-----------------------+---------------------------------------------------------------+
| creationDate          | DateTime              | Date + Time of creation of this object                        |
+-----------------------+-----------------------+---------------------------------------------------------------+
| modificationDate      | DateTime              | Date + Time of last modification of this object               |
+-----------------------+-----------------------+---------------------------------------------------------------+
| author                | String                | "System User" (probably)                                      |
+-----------------------+-----------------------+---------------------------------------------------------------+
| writeAccess           | Boolean               | This should be always 'true'                                  |
+-----------------------+-----------------------+---------------------------------------------------------------+
| subDocs               | String                | Number of sub-items as string                                 |
+-----------------------+-----------------------+---------------------------------------------------------------+

*****************************
 Hyperwave Object *Document*
*****************************

A ``HW_Object`` of ``type`` *document* represents a single file.

+-----------------------+-----------------------+---------------------------------------------------------------+
| Attribute Name        | Attribute Type        | Value                                                         |
+=======================+=======================+===============================================================+
| id                    | String                | Global Object ID (Format: "ID-xxxxxxxxxxxxxxxxxxxxx")         |
+-----------------------+-----------------------+---------------------------------------------------------------+
| documentClass         | String                | ""                                                            |
+-----------------------+-----------------------+---------------------------------------------------------------+
| type                  | String                | "document"                                                    |
+-----------------------+-----------------------+---------------------------------------------------------------+
| version               | String                | Current version of the document                               |
+-----------------------+-----------------------+---------------------------------------------------------------+
| downloadProhibited    | Boolean               | 'false' or 'true'                                             |
+-----------------------+-----------------------+---------------------------------------------------------------+
| path                  | String                | The full path of this document                                |
+-----------------------+-----------------------+---------------------------------------------------------------+
| title                 | String                | Title of this document (shown)                                |
+-----------------------+-----------------------+---------------------------------------------------------------+
| name                  | String                | Name of this document (not shown)                             |
+-----------------------+-----------------------+---------------------------------------------------------------+
| creationDate          | DateTime              | Date + Time of creation of this object                        |
+-----------------------+-----------------------+---------------------------------------------------------------+
| modificationDate      | DateTime              | Date + Time of last modification of this object               |
+-----------------------+-----------------------+---------------------------------------------------------------+
| author                | String                | Author of this document                                       |
+-----------------------+-----------------------+---------------------------------------------------------------+
| writeAccess           | Boolean               | 'true' or 'false'                                             |
+-----------------------+-----------------------+---------------------------------------------------------------+
| documentType          | String                | mime-type of the document                                     |
+-----------------------+-----------------------+---------------------------------------------------------------+
| md5Checksum           | String                | MD5 Checksum of the document                                  |
+-----------------------+-----------------------+---------------------------------------------------------------+
| documentSize          | Integer               | Size of document in bytes (octets)                            |
+-----------------------+-----------------------+---------------------------------------------------------------+
| icon                  | String                | Icon name of the icon of this document type                   |
+-----------------------+-----------------------+---------------------------------------------------------------+

***********
 Footnotes
***********

.. [#]

   Yes, this attribute starts with an uppercase letter.

.. [#]

   Why this is represented as a string, I don't know.
