clappia-api-tools 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- clappia_api_tools-0.1.5/LICENSE +0 -0
- clappia_api_tools-0.1.5/PKG-INFO +217 -0
- clappia_api_tools-0.1.5/README.md +176 -0
- clappia_api_tools-0.1.5/clappia_api_tools.egg-info/PKG-INFO +217 -0
- clappia_api_tools-0.1.5/clappia_api_tools.egg-info/SOURCES.txt +30 -0
- clappia_api_tools-0.1.5/clappia_api_tools.egg-info/dependency_links.txt +1 -0
- clappia_api_tools-0.1.5/clappia_api_tools.egg-info/requires.txt +20 -0
- clappia_api_tools-0.1.5/clappia_api_tools.egg-info/top_level.txt +1 -0
- clappia_api_tools-0.1.5/clappia_tools/__init__.py +17 -0
- clappia_api_tools-0.1.5/clappia_tools/_enums/__init__.py +0 -0
- clappia_api_tools-0.1.5/clappia_tools/_enums/enums.py +0 -0
- clappia_api_tools-0.1.5/clappia_tools/_models/__init__.py +0 -0
- clappia_api_tools-0.1.5/clappia_tools/_models/model.py +40 -0
- clappia_api_tools-0.1.5/clappia_tools/_utils/__init__.py +5 -0
- clappia_api_tools-0.1.5/clappia_tools/_utils/api_utils.py +141 -0
- clappia_api_tools-0.1.5/clappia_tools/_utils/logging_utils.py +132 -0
- clappia_api_tools-0.1.5/clappia_tools/_utils/validators.py +129 -0
- clappia_api_tools-0.1.5/clappia_tools/client/__init__.py +7 -0
- clappia_api_tools-0.1.5/clappia_tools/client/app_definition_client.py +82 -0
- clappia_api_tools-0.1.5/clappia_tools/client/app_management_client.py +508 -0
- clappia_api_tools-0.1.5/clappia_tools/client/base_client.py +27 -0
- clappia_api_tools-0.1.5/clappia_tools/client/clappia_client.py +204 -0
- clappia_api_tools-0.1.5/clappia_tools/client/submission_client.py +301 -0
- clappia_api_tools-0.1.5/clappia_tools/tests/__init__.py +0 -0
- clappia_api_tools-0.1.5/clappia_tools/tests/integration/__init__.py +0 -0
- clappia_api_tools-0.1.5/clappia_tools/tests/integration/definition/test_tools_definition.py +425 -0
- clappia_api_tools-0.1.5/clappia_tools/tests/integration/submission/test_tools_submission.py +263 -0
- clappia_api_tools-0.1.5/clappia_tools/tests/unit/__init__.py +0 -0
- clappia_api_tools-0.1.5/clappia_tools/tests/unit/definition/test_validators.py +177 -0
- clappia_api_tools-0.1.5/clappia_tools/tests/unit/submission/test_client.py +262 -0
- clappia_api_tools-0.1.5/pyproject.toml +107 -0
- clappia_api_tools-0.1.5/setup.cfg +4 -0
|
File without changes
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: clappia-api-tools
|
|
3
|
+
Version: 0.1.5
|
|
4
|
+
Summary: Python client for Clappia API integration
|
|
5
|
+
Author-email: Rishabh Verma <rishabh.v@clappia.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/clappia-dev/clappia-tools
|
|
8
|
+
Project-URL: Documentation, https://github.com/clappia-dev/clappia-tools#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/clappia-dev/clappia-tools.git
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/clappia-dev/clappia-tools/issues
|
|
11
|
+
Keywords: clappia,client,mcp,rest-apis,tools,workchat,agents
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: requests>=2.31.0
|
|
24
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
25
|
+
Requires-Dist: pydantic>=2.0.0
|
|
26
|
+
Requires-Dist: typing-extensions>=4.8.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
|
|
33
|
+
Provides-Extra: test
|
|
34
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
35
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
|
|
36
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "test"
|
|
37
|
+
Provides-Extra: docs
|
|
38
|
+
Requires-Dist: mkdocs>=1.4.0; extra == "docs"
|
|
39
|
+
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# Clappia Tools
|
|
43
|
+
|
|
44
|
+
**LangChain integration for Clappia API**
|
|
45
|
+
|
|
46
|
+
[](https://pypi.org/project/clappia-tools/)
|
|
47
|
+
[](LICENSE)
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Overview
|
|
52
|
+
|
|
53
|
+
Clappia Tools is a Python package that provides a unified client and a set of tools for seamless integration with the [Clappia API](https://www.clappia.com/). It enables developers to automate workflows, manage submissions, and interact with Clappia apps programmatically. The package is designed for use in automation, data integration, and agent-based systems (e.g., LangChain agents).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Features
|
|
58
|
+
|
|
59
|
+
- **Unified API Client**: One client for all Clappia API operations.
|
|
60
|
+
- **Submission Management**: Create, edit, update owners, and change status of submissions.
|
|
61
|
+
- **App Definition Retrieval**: Fetch complete app structure and metadata.
|
|
62
|
+
- **Input Validation**: Built-in validation for IDs, emails, and status objects.
|
|
63
|
+
- **Extensible Tools**: Modular functions for each operation, easily integrated into agents or scripts.
|
|
64
|
+
- **Comprehensive Testing**: Includes unit and integration tests.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install clappia-tools
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Or, for development:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/clappia-dev/clappia-tools.git
|
|
78
|
+
cd clappia-tools
|
|
79
|
+
pip install -e .[dev]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Configuration
|
|
85
|
+
|
|
86
|
+
You must provide your Clappia API credentials and workspace information directly when initializing the `ClappiaClient`:
|
|
87
|
+
|
|
88
|
+
- `api_key`: Your Clappia API key
|
|
89
|
+
- `base_url`: The base URL for the Clappia API (e.g., `https://api.clappia.com`)
|
|
90
|
+
- `workplace_id`: Your Clappia workplace ID
|
|
91
|
+
|
|
92
|
+
**Example:**
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from clappia_tools import ClappiaClient
|
|
96
|
+
|
|
97
|
+
client = ClappiaClient(
|
|
98
|
+
api_key="your-api-key",
|
|
99
|
+
base_url="https://api.clappia.com",
|
|
100
|
+
workplace_id="your-workplace-id"
|
|
101
|
+
)
|
|
102
|
+
```
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Usage
|
|
106
|
+
|
|
107
|
+
### Basic Client Usage
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from clappia_tools import ClappiaClient
|
|
111
|
+
|
|
112
|
+
client = ClappiaClient(
|
|
113
|
+
api_key="your-api-key",
|
|
114
|
+
base_url="https://api.clappia.com",
|
|
115
|
+
workplace_id="your-workplace-id"
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
# Create a submission
|
|
119
|
+
result = client.create_submission(
|
|
120
|
+
app_id="MFX093412",
|
|
121
|
+
data={"employee_name": "John Doe", "department": "Engineering"},
|
|
122
|
+
email="user@example.com"
|
|
123
|
+
)
|
|
124
|
+
print(result)
|
|
125
|
+
|
|
126
|
+
# Edit a submission
|
|
127
|
+
result = client.edit_submission(
|
|
128
|
+
app_id="MFX093412",
|
|
129
|
+
submission_id="HGO51464561",
|
|
130
|
+
data={"department": "Marketing"},
|
|
131
|
+
email="user@example.com"
|
|
132
|
+
)
|
|
133
|
+
print(result)
|
|
134
|
+
|
|
135
|
+
# Get app definition
|
|
136
|
+
result = client.get_app_definition(app_id="MFX093412")
|
|
137
|
+
print(result)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Tool Functions
|
|
141
|
+
|
|
142
|
+
You can also use the modular tool functions directly:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from clappia_tools._tools import (
|
|
146
|
+
create_clappia_submission,
|
|
147
|
+
edit_clappia_submission,
|
|
148
|
+
get_app_definition,
|
|
149
|
+
update_clappia_submission_owners,
|
|
150
|
+
update_clappia_submission_status,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
# Create a submission
|
|
154
|
+
data = {"employee_name": "Jane Doe", "department": "HR"}
|
|
155
|
+
response = create_clappia_submission("MFX093412", data, "user@example.com")
|
|
156
|
+
print(response)
|
|
157
|
+
|
|
158
|
+
# Update submission owners
|
|
159
|
+
response = update_clappia_submission_owners(
|
|
160
|
+
"MFX093412", "HGO51464561", "admin@example.com", ["user1@company.com", "user2@company.com"]
|
|
161
|
+
)
|
|
162
|
+
print(response)
|
|
163
|
+
|
|
164
|
+
# Update submission status
|
|
165
|
+
response = update_clappia_submission_status(
|
|
166
|
+
"MFX093412", "HGO51464561", "admin@example.com", {"statusName": "Approved", "comments": "Reviewed."}
|
|
167
|
+
)
|
|
168
|
+
print(response)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Available Tools
|
|
174
|
+
|
|
175
|
+
- `create_clappia_submission(app_id, data, email)`
|
|
176
|
+
- `edit_clappia_submission(app_id, submission_id, data, email)`
|
|
177
|
+
- `get_app_definition(app_id, language="en", strip_html=True, include_tags=True)`
|
|
178
|
+
- `update_clappia_submission_owners(app_id, submission_id, requesting_user_email_address, email_ids)`
|
|
179
|
+
- `update_clappia_submission_status(app_id, submission_id, requesting_user_email_address, status)`
|
|
180
|
+
|
|
181
|
+
See docstrings in each tool for detailed argument and return value descriptions.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Input Validation
|
|
186
|
+
|
|
187
|
+
- **App ID**: Must be uppercase letters and numbers (e.g., `MFX093412`).
|
|
188
|
+
- **Submission ID**: Must be uppercase letters and numbers (e.g., `HGO51464561`).
|
|
189
|
+
- **Email**: Must be a valid email address.
|
|
190
|
+
- **Status**: Must be a dictionary with a non-empty `statusName` or `name` field.
|
|
191
|
+
|
|
192
|
+
Invalid inputs will return descriptive error messages.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Testing
|
|
197
|
+
|
|
198
|
+
Run all tests (unit and integration):
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
pytest
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Contributing
|
|
207
|
+
|
|
208
|
+
1. Fork the repository and create your branch.
|
|
209
|
+
2. Write clear, well-documented code and tests.
|
|
210
|
+
3. Run `pytest` and ensure all tests pass.
|
|
211
|
+
4. Submit a pull request with a clear description of your changes.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## License
|
|
216
|
+
|
|
217
|
+
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Clappia Tools
|
|
2
|
+
|
|
3
|
+
**LangChain integration for Clappia API**
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/clappia-tools/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Clappia Tools is a Python package that provides a unified client and a set of tools for seamless integration with the [Clappia API](https://www.clappia.com/). It enables developers to automate workflows, manage submissions, and interact with Clappia apps programmatically. The package is designed for use in automation, data integration, and agent-based systems (e.g., LangChain agents).
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **Unified API Client**: One client for all Clappia API operations.
|
|
19
|
+
- **Submission Management**: Create, edit, update owners, and change status of submissions.
|
|
20
|
+
- **App Definition Retrieval**: Fetch complete app structure and metadata.
|
|
21
|
+
- **Input Validation**: Built-in validation for IDs, emails, and status objects.
|
|
22
|
+
- **Extensible Tools**: Modular functions for each operation, easily integrated into agents or scripts.
|
|
23
|
+
- **Comprehensive Testing**: Includes unit and integration tests.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install clappia-tools
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or, for development:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
git clone https://github.com/clappia-dev/clappia-tools.git
|
|
37
|
+
cd clappia-tools
|
|
38
|
+
pip install -e .[dev]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
You must provide your Clappia API credentials and workspace information directly when initializing the `ClappiaClient`:
|
|
46
|
+
|
|
47
|
+
- `api_key`: Your Clappia API key
|
|
48
|
+
- `base_url`: The base URL for the Clappia API (e.g., `https://api.clappia.com`)
|
|
49
|
+
- `workplace_id`: Your Clappia workplace ID
|
|
50
|
+
|
|
51
|
+
**Example:**
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from clappia_tools import ClappiaClient
|
|
55
|
+
|
|
56
|
+
client = ClappiaClient(
|
|
57
|
+
api_key="your-api-key",
|
|
58
|
+
base_url="https://api.clappia.com",
|
|
59
|
+
workplace_id="your-workplace-id"
|
|
60
|
+
)
|
|
61
|
+
```
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
### Basic Client Usage
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from clappia_tools import ClappiaClient
|
|
70
|
+
|
|
71
|
+
client = ClappiaClient(
|
|
72
|
+
api_key="your-api-key",
|
|
73
|
+
base_url="https://api.clappia.com",
|
|
74
|
+
workplace_id="your-workplace-id"
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Create a submission
|
|
78
|
+
result = client.create_submission(
|
|
79
|
+
app_id="MFX093412",
|
|
80
|
+
data={"employee_name": "John Doe", "department": "Engineering"},
|
|
81
|
+
email="user@example.com"
|
|
82
|
+
)
|
|
83
|
+
print(result)
|
|
84
|
+
|
|
85
|
+
# Edit a submission
|
|
86
|
+
result = client.edit_submission(
|
|
87
|
+
app_id="MFX093412",
|
|
88
|
+
submission_id="HGO51464561",
|
|
89
|
+
data={"department": "Marketing"},
|
|
90
|
+
email="user@example.com"
|
|
91
|
+
)
|
|
92
|
+
print(result)
|
|
93
|
+
|
|
94
|
+
# Get app definition
|
|
95
|
+
result = client.get_app_definition(app_id="MFX093412")
|
|
96
|
+
print(result)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Tool Functions
|
|
100
|
+
|
|
101
|
+
You can also use the modular tool functions directly:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from clappia_tools._tools import (
|
|
105
|
+
create_clappia_submission,
|
|
106
|
+
edit_clappia_submission,
|
|
107
|
+
get_app_definition,
|
|
108
|
+
update_clappia_submission_owners,
|
|
109
|
+
update_clappia_submission_status,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# Create a submission
|
|
113
|
+
data = {"employee_name": "Jane Doe", "department": "HR"}
|
|
114
|
+
response = create_clappia_submission("MFX093412", data, "user@example.com")
|
|
115
|
+
print(response)
|
|
116
|
+
|
|
117
|
+
# Update submission owners
|
|
118
|
+
response = update_clappia_submission_owners(
|
|
119
|
+
"MFX093412", "HGO51464561", "admin@example.com", ["user1@company.com", "user2@company.com"]
|
|
120
|
+
)
|
|
121
|
+
print(response)
|
|
122
|
+
|
|
123
|
+
# Update submission status
|
|
124
|
+
response = update_clappia_submission_status(
|
|
125
|
+
"MFX093412", "HGO51464561", "admin@example.com", {"statusName": "Approved", "comments": "Reviewed."}
|
|
126
|
+
)
|
|
127
|
+
print(response)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Available Tools
|
|
133
|
+
|
|
134
|
+
- `create_clappia_submission(app_id, data, email)`
|
|
135
|
+
- `edit_clappia_submission(app_id, submission_id, data, email)`
|
|
136
|
+
- `get_app_definition(app_id, language="en", strip_html=True, include_tags=True)`
|
|
137
|
+
- `update_clappia_submission_owners(app_id, submission_id, requesting_user_email_address, email_ids)`
|
|
138
|
+
- `update_clappia_submission_status(app_id, submission_id, requesting_user_email_address, status)`
|
|
139
|
+
|
|
140
|
+
See docstrings in each tool for detailed argument and return value descriptions.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Input Validation
|
|
145
|
+
|
|
146
|
+
- **App ID**: Must be uppercase letters and numbers (e.g., `MFX093412`).
|
|
147
|
+
- **Submission ID**: Must be uppercase letters and numbers (e.g., `HGO51464561`).
|
|
148
|
+
- **Email**: Must be a valid email address.
|
|
149
|
+
- **Status**: Must be a dictionary with a non-empty `statusName` or `name` field.
|
|
150
|
+
|
|
151
|
+
Invalid inputs will return descriptive error messages.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Testing
|
|
156
|
+
|
|
157
|
+
Run all tests (unit and integration):
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
pytest
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Contributing
|
|
166
|
+
|
|
167
|
+
1. Fork the repository and create your branch.
|
|
168
|
+
2. Write clear, well-documented code and tests.
|
|
169
|
+
3. Run `pytest` and ensure all tests pass.
|
|
170
|
+
4. Submit a pull request with a clear description of your changes.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: clappia-api-tools
|
|
3
|
+
Version: 0.1.5
|
|
4
|
+
Summary: Python client for Clappia API integration
|
|
5
|
+
Author-email: Rishabh Verma <rishabh.v@clappia.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/clappia-dev/clappia-tools
|
|
8
|
+
Project-URL: Documentation, https://github.com/clappia-dev/clappia-tools#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/clappia-dev/clappia-tools.git
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/clappia-dev/clappia-tools/issues
|
|
11
|
+
Keywords: clappia,client,mcp,rest-apis,tools,workchat,agents
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: requests>=2.31.0
|
|
24
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
25
|
+
Requires-Dist: pydantic>=2.0.0
|
|
26
|
+
Requires-Dist: typing-extensions>=4.8.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
|
|
33
|
+
Provides-Extra: test
|
|
34
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
35
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
|
|
36
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "test"
|
|
37
|
+
Provides-Extra: docs
|
|
38
|
+
Requires-Dist: mkdocs>=1.4.0; extra == "docs"
|
|
39
|
+
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# Clappia Tools
|
|
43
|
+
|
|
44
|
+
**LangChain integration for Clappia API**
|
|
45
|
+
|
|
46
|
+
[](https://pypi.org/project/clappia-tools/)
|
|
47
|
+
[](LICENSE)
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Overview
|
|
52
|
+
|
|
53
|
+
Clappia Tools is a Python package that provides a unified client and a set of tools for seamless integration with the [Clappia API](https://www.clappia.com/). It enables developers to automate workflows, manage submissions, and interact with Clappia apps programmatically. The package is designed for use in automation, data integration, and agent-based systems (e.g., LangChain agents).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Features
|
|
58
|
+
|
|
59
|
+
- **Unified API Client**: One client for all Clappia API operations.
|
|
60
|
+
- **Submission Management**: Create, edit, update owners, and change status of submissions.
|
|
61
|
+
- **App Definition Retrieval**: Fetch complete app structure and metadata.
|
|
62
|
+
- **Input Validation**: Built-in validation for IDs, emails, and status objects.
|
|
63
|
+
- **Extensible Tools**: Modular functions for each operation, easily integrated into agents or scripts.
|
|
64
|
+
- **Comprehensive Testing**: Includes unit and integration tests.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install clappia-tools
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Or, for development:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/clappia-dev/clappia-tools.git
|
|
78
|
+
cd clappia-tools
|
|
79
|
+
pip install -e .[dev]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Configuration
|
|
85
|
+
|
|
86
|
+
You must provide your Clappia API credentials and workspace information directly when initializing the `ClappiaClient`:
|
|
87
|
+
|
|
88
|
+
- `api_key`: Your Clappia API key
|
|
89
|
+
- `base_url`: The base URL for the Clappia API (e.g., `https://api.clappia.com`)
|
|
90
|
+
- `workplace_id`: Your Clappia workplace ID
|
|
91
|
+
|
|
92
|
+
**Example:**
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from clappia_tools import ClappiaClient
|
|
96
|
+
|
|
97
|
+
client = ClappiaClient(
|
|
98
|
+
api_key="your-api-key",
|
|
99
|
+
base_url="https://api.clappia.com",
|
|
100
|
+
workplace_id="your-workplace-id"
|
|
101
|
+
)
|
|
102
|
+
```
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Usage
|
|
106
|
+
|
|
107
|
+
### Basic Client Usage
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from clappia_tools import ClappiaClient
|
|
111
|
+
|
|
112
|
+
client = ClappiaClient(
|
|
113
|
+
api_key="your-api-key",
|
|
114
|
+
base_url="https://api.clappia.com",
|
|
115
|
+
workplace_id="your-workplace-id"
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
# Create a submission
|
|
119
|
+
result = client.create_submission(
|
|
120
|
+
app_id="MFX093412",
|
|
121
|
+
data={"employee_name": "John Doe", "department": "Engineering"},
|
|
122
|
+
email="user@example.com"
|
|
123
|
+
)
|
|
124
|
+
print(result)
|
|
125
|
+
|
|
126
|
+
# Edit a submission
|
|
127
|
+
result = client.edit_submission(
|
|
128
|
+
app_id="MFX093412",
|
|
129
|
+
submission_id="HGO51464561",
|
|
130
|
+
data={"department": "Marketing"},
|
|
131
|
+
email="user@example.com"
|
|
132
|
+
)
|
|
133
|
+
print(result)
|
|
134
|
+
|
|
135
|
+
# Get app definition
|
|
136
|
+
result = client.get_app_definition(app_id="MFX093412")
|
|
137
|
+
print(result)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Tool Functions
|
|
141
|
+
|
|
142
|
+
You can also use the modular tool functions directly:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from clappia_tools._tools import (
|
|
146
|
+
create_clappia_submission,
|
|
147
|
+
edit_clappia_submission,
|
|
148
|
+
get_app_definition,
|
|
149
|
+
update_clappia_submission_owners,
|
|
150
|
+
update_clappia_submission_status,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
# Create a submission
|
|
154
|
+
data = {"employee_name": "Jane Doe", "department": "HR"}
|
|
155
|
+
response = create_clappia_submission("MFX093412", data, "user@example.com")
|
|
156
|
+
print(response)
|
|
157
|
+
|
|
158
|
+
# Update submission owners
|
|
159
|
+
response = update_clappia_submission_owners(
|
|
160
|
+
"MFX093412", "HGO51464561", "admin@example.com", ["user1@company.com", "user2@company.com"]
|
|
161
|
+
)
|
|
162
|
+
print(response)
|
|
163
|
+
|
|
164
|
+
# Update submission status
|
|
165
|
+
response = update_clappia_submission_status(
|
|
166
|
+
"MFX093412", "HGO51464561", "admin@example.com", {"statusName": "Approved", "comments": "Reviewed."}
|
|
167
|
+
)
|
|
168
|
+
print(response)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Available Tools
|
|
174
|
+
|
|
175
|
+
- `create_clappia_submission(app_id, data, email)`
|
|
176
|
+
- `edit_clappia_submission(app_id, submission_id, data, email)`
|
|
177
|
+
- `get_app_definition(app_id, language="en", strip_html=True, include_tags=True)`
|
|
178
|
+
- `update_clappia_submission_owners(app_id, submission_id, requesting_user_email_address, email_ids)`
|
|
179
|
+
- `update_clappia_submission_status(app_id, submission_id, requesting_user_email_address, status)`
|
|
180
|
+
|
|
181
|
+
See docstrings in each tool for detailed argument and return value descriptions.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Input Validation
|
|
186
|
+
|
|
187
|
+
- **App ID**: Must be uppercase letters and numbers (e.g., `MFX093412`).
|
|
188
|
+
- **Submission ID**: Must be uppercase letters and numbers (e.g., `HGO51464561`).
|
|
189
|
+
- **Email**: Must be a valid email address.
|
|
190
|
+
- **Status**: Must be a dictionary with a non-empty `statusName` or `name` field.
|
|
191
|
+
|
|
192
|
+
Invalid inputs will return descriptive error messages.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Testing
|
|
197
|
+
|
|
198
|
+
Run all tests (unit and integration):
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
pytest
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Contributing
|
|
207
|
+
|
|
208
|
+
1. Fork the repository and create your branch.
|
|
209
|
+
2. Write clear, well-documented code and tests.
|
|
210
|
+
3. Run `pytest` and ensure all tests pass.
|
|
211
|
+
4. Submit a pull request with a clear description of your changes.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## License
|
|
216
|
+
|
|
217
|
+
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
clappia_api_tools.egg-info/PKG-INFO
|
|
5
|
+
clappia_api_tools.egg-info/SOURCES.txt
|
|
6
|
+
clappia_api_tools.egg-info/dependency_links.txt
|
|
7
|
+
clappia_api_tools.egg-info/requires.txt
|
|
8
|
+
clappia_api_tools.egg-info/top_level.txt
|
|
9
|
+
clappia_tools/__init__.py
|
|
10
|
+
clappia_tools/_enums/__init__.py
|
|
11
|
+
clappia_tools/_enums/enums.py
|
|
12
|
+
clappia_tools/_models/__init__.py
|
|
13
|
+
clappia_tools/_models/model.py
|
|
14
|
+
clappia_tools/_utils/__init__.py
|
|
15
|
+
clappia_tools/_utils/api_utils.py
|
|
16
|
+
clappia_tools/_utils/logging_utils.py
|
|
17
|
+
clappia_tools/_utils/validators.py
|
|
18
|
+
clappia_tools/client/__init__.py
|
|
19
|
+
clappia_tools/client/app_definition_client.py
|
|
20
|
+
clappia_tools/client/app_management_client.py
|
|
21
|
+
clappia_tools/client/base_client.py
|
|
22
|
+
clappia_tools/client/clappia_client.py
|
|
23
|
+
clappia_tools/client/submission_client.py
|
|
24
|
+
clappia_tools/tests/__init__.py
|
|
25
|
+
clappia_tools/tests/integration/__init__.py
|
|
26
|
+
clappia_tools/tests/integration/definition/test_tools_definition.py
|
|
27
|
+
clappia_tools/tests/integration/submission/test_tools_submission.py
|
|
28
|
+
clappia_tools/tests/unit/__init__.py
|
|
29
|
+
clappia_tools/tests/unit/definition/test_validators.py
|
|
30
|
+
clappia_tools/tests/unit/submission/test_client.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
requests>=2.31.0
|
|
2
|
+
python-dotenv>=1.0.0
|
|
3
|
+
pydantic>=2.0.0
|
|
4
|
+
typing-extensions>=4.8.0
|
|
5
|
+
|
|
6
|
+
[dev]
|
|
7
|
+
pytest>=7.0.0
|
|
8
|
+
black>=23.0.0
|
|
9
|
+
flake8>=6.0.0
|
|
10
|
+
mypy>=1.0.0
|
|
11
|
+
pre-commit>=3.0.0
|
|
12
|
+
|
|
13
|
+
[docs]
|
|
14
|
+
mkdocs>=1.4.0
|
|
15
|
+
mkdocs-material>=9.0.0
|
|
16
|
+
|
|
17
|
+
[test]
|
|
18
|
+
pytest>=7.0.0
|
|
19
|
+
pytest-cov>=4.0.0
|
|
20
|
+
pytest-mock>=3.10.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
clappia_tools
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Clappia Tools - LangChain integration for Clappia API
|
|
3
|
+
|
|
4
|
+
This package provides a unified client for interacting with Clappia APIs.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .client.clappia_client import ClappiaClient
|
|
8
|
+
from .client.app_definition_client import AppDefinitionClient
|
|
9
|
+
from .client.app_management_client import AppManagementClient
|
|
10
|
+
from .client.submission_client import SubmissionClient
|
|
11
|
+
|
|
12
|
+
__version__ = "0.1.5"
|
|
13
|
+
__all__ = ["ClappiaClient", "AppDefinitionClient", "AppManagementClient", "SubmissionClient"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def __dir__():
|
|
17
|
+
return __all__
|
|
File without changes
|
|
File without changes
|
|
File without changes
|