Skip to content

Commit cd79d32

Browse files
committed
Update documentation
1 parent 9f0d7f9 commit cd79d32

File tree

9 files changed

+1222
-327
lines changed

9 files changed

+1222
-327
lines changed

README.md

Lines changed: 71 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,107 @@
55
## ✨ Why Use This Client?
66

77
- **Easy Integration:** Each endpoint is ready to use—no manual HTTP calls needed.
8+
- **Seamless Authentication:** Built-in OAuth2/OIDC authentication with automatic token management.
89
- **Auto-Generated & Up-to-Date:** Always in sync with the latest Field Manager API updates.
910
- **Full Coverage:** Access every endpoint and model the Field Manager platform provides.
1011

1112
## ⚙️ Installation & Setup
1213

13-
1. **Install** the package:
14+
1. **Install** the package with authentication support:
1415

1516
```bash
16-
pip install field-manager-python-client
17+
pip install field-manager-python-client python-keycloak
1718
```
1819

19-
2. **Authenticate**: - Use the `authenticate` function to handle token retrieval automatically. This function will fetch a new token if the current one is expired or missing.
20+
2. **Authenticate**: Use the built-in authentication functions for seamless access:
2021

2122
```python
22-
from field_manager_python_client.api.projects import get_project_projects_project_id_get
23-
from examples.setup_auto_fetch_token import authenticate
23+
from field_manager_python_client import get_prod_client
2424

25-
client = authenticate() # Handles token retrieval
25+
# Authenticate with your Field Manager account
26+
client = get_prod_client(email="[email protected]")
2627
```
2728

2829
## 🚀 Quick Example
2930

30-
1. Here's a [quick example](./examples/examples/ex_get_project_details.py) of how to fetch project information using the client:
31+
Here's how to fetch project information using the authenticated client:
32+
33+
```python
34+
from field_manager_python_client import get_prod_client
35+
from field_manager_python_client.api.projects import get_project_projects_project_id_get
36+
37+
# Authenticate and get client
38+
client = get_prod_client(email="[email protected]")
39+
40+
# Use the client to fetch project data
41+
project_id = "your-project-id"
42+
project_info = get_project_projects_project_id_get.sync(client=client, project_id=project_id)
43+
44+
print(f"Project Name: {project_info.name}")
45+
```
46+
47+
## 🔐 Authentication Options
48+
49+
The client supports multiple authentication methods:
50+
51+
1. **Integrated Authentication** (Recommended):
3152

3253
```python
33-
from field_manager_python_client.api.projects import get_project_projects_project_id_get
34-
from examples.setup_auto_fetch_token import authenticate
54+
from field_manager_python_client import authenticate, get_prod_client
55+
56+
client = authenticate(environment="prod", email="[email protected]")
57+
# or
58+
client = get_prod_client(email="[email protected]")
59+
```
3560

36-
client = authenticate()
37-
project_id = "your-project-id"
38-
project_info = get_project_projects_project_id_get.sync(client=client, project_id=project_id)
61+
2. **Manual Token Setup**:
3962

40-
print(f"Project Name: {project_info.name}")
63+
```python
64+
from field_manager_python_client import AuthenticatedClient
65+
66+
client = AuthenticatedClient(
67+
base_url="https://app.fieldmanager.io/api/location",
68+
token="your-access-token"
69+
)
4170
```
4271

72+
3. **Service Account Authentication** (for automated workflows):
73+
- See the [Authentication Guide](./doc/AUTHENTICATION_GUIDE.md) for details
74+
- Also covered in the [Advanced User Guide](./doc/ADVANCED_USER_GUIDE.md)
75+
4376
## 📂 Explore More Examples
4477

45-
- Check out the [examples folder](./examples/examples/) for scripts demonstrating how to:
78+
Check out the [examples folder](./examples/examples/) for scripts demonstrating how to:
79+
80+
- **Authentication**: Multiple ways to authenticate with the API
81+
- **Organizations**: Fetch and manage organization data
82+
- **Projects**: Retrieve project details and metadata
83+
- **Locations**: Manage field locations and associated data
84+
- **Data Export**: Export project data in various formats
85+
- **Advanced Usage**: Async operations, bulk operations, and more
86+
87+
## 📚 Documentation
88+
89+
For comprehensive documentation, see the [`./doc/`](./doc/) directory:
90+
91+
- **[Authentication Guide](./doc/AUTHENTICATION_GUIDE.md)**: Complete guide to all authentication methods
92+
- **[Advanced User Guide](./doc/ADVANCED_USER_GUIDE.md)**: In-depth coverage of sync/async operations and customizations
93+
- **[Examples Overview](./examples/EXAMPLES_OVERVIEW.md)**: Detailed overview of all available examples
94+
95+
## 🏗️ For Developers
4696

47-
- Fetch organization(s)
97+
If you want to learn more about this library, contribute, or understand the internals, visit the main repository: [https://github.com/norwegian-geotechnical-institute/field-manager-python-client](https://github.com/norwegian-geotechnical-institute/field-manager-python-client)
4898

49-
- Manage locations
99+
The actual client package is auto-generated from the Field Manager API specification and includes:
50100

51-
- Compare data sets and more
101+
- Full type hints and IDE support
102+
- Comprehensive error handling
103+
- Both synchronous and asynchronous operations
104+
- Advanced customization options
52105

53106
## 🤝 Contributing
54107

55-
We welcome issues, bug reports, and feature requests!
108+
We welcome issues, bug reports, and feature requests! Please check our [contributing guidelines](./doc/MAINTAINERS_GUIDE.md) and feel free to open an issue or submit a pull request.
56109

57110
---
58111

0 commit comments

Comments
 (0)