# pennprov
Habitat API

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

- API version: V0.0.1
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.PythonClientCodegen
For more information, please visit [https://bitbucket.org/penndb/hab-repo](https://bitbucket.org/penndb/hab-repo)

## Requirements.

Python 2.7 and 3.4+

## Installation & Usage
### pip install

You can install with pip

```sh
pip install pennprov
```
(you may need to run `pip` with root permission: `sudo pip install pennprov`)

Then import the package:
```python
import pennprov 
```

## Getting Started

The following illustrates a simple use of the API to obtain a authentication token and then store and retrieve a node.

```python
"""Example usage of pennprov client"""

from __future__ import print_function
from pprint import pprint

import pennprov
from pennprov.rest import ApiException


def main():
    """Get a token and store a node"""
    # create instances of the API classes
    configuration = pennprov.configuration.Configuration()
    default_api = pennprov.DefaultApi()
    prov_api = pennprov.ProvenanceApi()
    username = "YOUR_USERNAME"
    credentials = pennprov.UserCredentials(
        "YOUR_PASSWORD")

    try:
        # One-time initialization of client with a JWT token for
        # authentication.
        web_token = default_api.get_token_route(username, credentials)
        token = web_token.token
        print("Setting token %s\n" % token)
        configuration.api_key["api_key"] = token

        # Once api_key is set we can call services. For example,
        # store_prov_node
        prov_token_value = "my_prov_token"
        stream = pennprov.IDModel("my_stream.0")
        prov_location = pennprov.ProvLocationModel(
            stream=stream,
            field="my_source",
            position=[1, 2])
        data = [pennprov.FieldModel(
            name="my_boolean_field", type="BOOLEAN", value="true")]
        tuple_with_schema = pennprov.TupleWithSchemaModel(
            schema_name="my_schema", tuple=data, lookup_keys=[])
        body = pennprov.StoreNodeModel(
            prov_specifier=prov_location, tuple_with_schema=tuple_with_schema)
        prov_api.store_provenance_node(prov_token_value, body)

        # Retrieve the data from the node
        response = prov_api.get_provenance_data(prov_token_value)
        pprint(response)
    except ApiException as api_exception:
        print("Exception when calling server: %s\n" % api_exception)

if __name__ == '__main__':
    main()

```

## Documentation for API Endpoints

All URIs are relative to *http://localhost:8088*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**add_credential**](docs/DefaultApi.md#add_credential) | **POST** /auth/services/{service}/user/{username} | Adds a service credential for the user
*DefaultApi* | [**add_group**](docs/DefaultApi.md#add_group) | **POST** /auth/organizations/{organization}/group/{group} | Adds a permissions group to an organization
*DefaultApi* | [**add_organization**](docs/DefaultApi.md#add_organization) | **POST** /auth/organizations/{orgname} | Adds an organization
*DefaultApi* | [**add_permission**](docs/DefaultApi.md#add_permission) | **POST** /perms/types/{permname} | Adds a new labeled permission type
*DefaultApi* | [**add_subgroup_to_group**](docs/DefaultApi.md#add_subgroup_to_group) | **POST** /auth/groups/{groupname}/group/{subgroup} | Adds a subgroup to a group
*DefaultApi* | [**add_user_to_group**](docs/DefaultApi.md#add_user_to_group) | **POST** /auth/groups/{groupname}/user/{username} | Adds a user to a group
*DefaultApi* | [**add_user_to_organization**](docs/DefaultApi.md#add_user_to_organization) | **POST** /auth/organizations/{orgId}/user/{username} | Adds a user to an organization
*DefaultApi* | [**create_new_user**](docs/DefaultApi.md#create_new_user) | **POST** /auth/credentials/{username} | Creates a new user
*DefaultApi* | [**get_group_from_id**](docs/DefaultApi.md#get_group_from_id) | **GET** /auth/groups/id/{groupId} | Gets a group name from its integer ID
*DefaultApi* | [**get_group_id**](docs/DefaultApi.md#get_group_id) | **GET** /auth/groups/name/{groupName} | Gets a group&#39;s ID from its name
*DefaultApi* | [**get_group_ids_for_user**](docs/DefaultApi.md#get_group_ids_for_user) | **GET** /auth/credentials/{username}/groups/id | Gets the IDs of groups in which a user is directly a member
*DefaultApi* | [**get_group_permissions_on**](docs/DefaultApi.md#get_group_permissions_on) | **GET** /perms/objects/{object}/group/{groupName} | Gets the group&#39;s permissions on an object
*DefaultApi* | [**get_groups_for_user**](docs/DefaultApi.md#get_groups_for_user) | **GET** /auth/credentials/{username}/groups | Gets the groups in which a user is directly a member
*DefaultApi* | [**get_organization_from_id**](docs/DefaultApi.md#get_organization_from_id) | **GET** /auth/organizations/id/{orgId} | Gets an organization name from its integer ID
*DefaultApi* | [**get_organization_id**](docs/DefaultApi.md#get_organization_id) | **GET** /auth/organizations/name/{orgName} | Gets an organization ID from its name
*DefaultApi* | [**get_parent_group_ids**](docs/DefaultApi.md#get_parent_group_ids) | **GET** /auth/groups/id/{groupId}/parents/id | Gets the IDs of parent groups
*DefaultApi* | [**get_parent_groups**](docs/DefaultApi.md#get_parent_groups) | **GET** /auth/groups/name/{groupName}/parents/name | Gets the groups in which a user is directly a member
*DefaultApi* | [**get_permission_from_id**](docs/DefaultApi.md#get_permission_from_id) | **GET** /perms/id/{id}/name | Gets a permission&#39;s name from its integer ID
*DefaultApi* | [**get_permission_id**](docs/DefaultApi.md#get_permission_id) | **GET** /perms/name/{name}/id | Gets a permission&#39;s ID from its name
*DefaultApi* | [**get_token_route**](docs/DefaultApi.md#get_token_route) | **POST** /auth/tokens/{username} | Requests a new token
*DefaultApi* | [**get_user_info**](docs/DefaultApi.md#get_user_info) | **GET** /auth/credentials/{username}/info | Gets a user&#39;s info
*DefaultApi* | [**get_user_permissions_on**](docs/DefaultApi.md#get_user_permissions_on) | **GET** /perms/objects/{object}/user/{username} | Gets the user&#39;s permissions on an object
*DefaultApi* | [**grant_group_permission_on**](docs/DefaultApi.md#grant_group_permission_on) | **POST** /perms/objects/{object}/group/{groupName}/{permname} | Grants a group a permission on an object
*DefaultApi* | [**grant_user_permission_on**](docs/DefaultApi.md#grant_user_permission_on) | **POST** /perms/objects/{object}/user/{username}/{permname} | Grants a user a permission on an object
*DefaultApi* | [**is_registered**](docs/DefaultApi.md#is_registered) | **GET** /auth/services/{service}/user/{username} | Returns whether a user credential is valid for a service
*DefaultApi* | [**is_valid_credential**](docs/DefaultApi.md#is_valid_credential) | **POST** /auth/services/local/user/{username}/credential | Returns whether a local user credential is valid
*DefaultApi* | [**revoke_group_permission_on**](docs/DefaultApi.md#revoke_group_permission_on) | **DELETE** /perms/objects/{object}/group/{groupName}/{permname} | Revokes a group a permission on an object
*DefaultApi* | [**revoke_user_permission_on**](docs/DefaultApi.md#revoke_user_permission_on) | **DELETE** /perms/objects/{object}/user/{username}/{permname} | Revokes a user a permission on an object
*DefaultApi* | [**update_user**](docs/DefaultApi.md#update_user) | **PUT** /auth/credentials/{username} | Updates user properties
*ProvenanceApi* | [**get_connected_from**](docs/ProvenanceApi.md#get_connected_from) | **GET** /provenance/nodes/{token}/neighbors/out | Get the outgoing neighbors of the given prov token
*ProvenanceApi* | [**get_connected_to**](docs/ProvenanceApi.md#get_connected_to) | **GET** /provenance/nodes/{token}/neighbors/in | Get the incoming neighbors of the given prov token
*ProvenanceApi* | [**get_edges_from**](docs/ProvenanceApi.md#get_edges_from) | **GET** /provenance/nodes/{token}/links/out | Get the outgoing edges of the given prov token
*ProvenanceApi* | [**get_edges_to**](docs/ProvenanceApi.md#get_edges_to) | **GET** /provenance/nodes/{token}/links/in | Get the incoming edges of the given prov token
*ProvenanceApi* | [**get_provenance_data**](docs/ProvenanceApi.md#get_provenance_data) | **GET** /provenance/nodes/{token} | Get the tuple associated with a provenance token
*ProvenanceApi* | [**get_provenance_location**](docs/ProvenanceApi.md#get_provenance_location) | **GET** /provenance/nodes/{token}/location | Get the location of a provenance token
*ProvenanceApi* | [**get_provenance_nodes**](docs/ProvenanceApi.md#get_provenance_nodes) | **GET** /provenance/nodes | Get the provenance graph&#39;s nodes
*ProvenanceApi* | [**store_provenance_link**](docs/ProvenanceApi.md#store_provenance_link) | **POST** /provenance/links | Store a provenance link between tokens
*ProvenanceApi* | [**store_provenance_node**](docs/ProvenanceApi.md#store_provenance_node) | **PUT** /provenance/nodes/{token} | Store a provenance token with its location


## Documentation For Models

 - [FieldModel](docs/FieldModel.md)
 - [GroupDetails](docs/GroupDetails.md)
 - [IDModel](docs/IDModel.md)
 - [OrgDetails](docs/OrgDetails.md)
 - [ProvEdgeModel](docs/ProvEdgeModel.md)
 - [ProvEdgeSetModel](docs/ProvEdgeSetModel.md)
 - [ProvNodeMapModel](docs/ProvNodeMapModel.md)
 - [ProvSpecifierModel](docs/ProvSpecifierModel.md)
 - [ProvTokenSetModel](docs/ProvTokenSetModel.md)
 - [ResponseError](docs/ResponseError.md)
 - [StoreLinkModel](docs/StoreLinkModel.md)
 - [StoreNodeModel](docs/StoreNodeModel.md)
 - [TupleWithSchemaModel](docs/TupleWithSchemaModel.md)
 - [UserCredentials](docs/UserCredentials.md)
 - [UserInfo](docs/UserInfo.md)
 - [WebToken](docs/WebToken.md)
 - [BooleanFieldModel](docs/BooleanFieldModel.md)
 - [DoubleFieldModel](docs/DoubleFieldModel.md)
 - [IntegerFieldModel](docs/IntegerFieldModel.md)
 - [LongFieldModel](docs/LongFieldModel.md)
 - [ProvExpressionModel](docs/ProvExpressionModel.md)
 - [ProvLocationModel](docs/ProvLocationModel.md)
 - [ProvSpecifierFieldModel](docs/ProvSpecifierFieldModel.md)
 - [ProvTokenFieldModel](docs/ProvTokenFieldModel.md)
 - [ProvTokenModel](docs/ProvTokenModel.md)
 - [StringFieldModel](docs/StringFieldModel.md)


## Documentation For Authorization


## jwt

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

