Metadata-Version: 2.5
Name: terrakio-admin-api
Version: 0.8.0
Summary: Admin version of the terrakio-python-api
Requires-Python: >=3.11
Requires-Dist: terrakio-core==0.8.0
Description-Content-Type: text/markdown

# Terrakio Admin API Client

Administrative API client for Terrakio services. This package extends the regular Terrakio API client with additional administrative capabilities.

## Features

- All features from the regular API client
- User management (create, view, edit, delete users)
- Dataset management (create, edit, update, delete datasets)
- Mass stats functionality (create pyramid)

## Installation

```bash
pip install terrakio-admin-api
```

## Usage Example

```python
from terrakio_admin_api import Client

# Initialize the admin client
admin_client = Client()  # defaults to https://dev-omni.terrak.io (fronts all regions)

# Login to your admin account
admin_client.auth.login(email = "XXX", password = "XXX")
print("✓ Login successful")

# The login account will automatically be used for the requests

# View API key
api_key = admin_client.auth.view_api_key()
print(f"✓ Current API key: {api_key[:10]}...")

# Create an extra API key (the full key is returned only here, so store it now)
new_key = admin_client.keys.create_key(label="my laptop")
print(f"✓ New API key: {new_key['key']}")

# List keys (metadata only) and revoke one; pass uid=... to manage another account
for key in admin_client.keys.list_keys():
    print(key["id"], key["prefix"], key["label"])
admin_client.keys.revoke_key(key_id=new_key["id"])

# To rotate a key: create a new one, switch your code over to it, then revoke the old one.

# List number of datasets
datasets = admin_client.datasets.list_datasets()
print(f"✓ Listed {len(datasets)} datasets")

# List number of users
users = admin_client.users.list_users()
print(f"✓ Listed {len(users)} users")
```

For more documentation, see the [main repository](https://github.com/HaizeaAnalytics/terrakio-python-api). 