tallyfy 1.0.16__py3-none-any.whl

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.
Files changed (52) hide show
  1. tallyfy/__init__.py +27 -0
  2. tallyfy/__pycache__/__init__.cpython-310.pyc +0 -0
  3. tallyfy/__pycache__/core.cpython-310.pyc +0 -0
  4. tallyfy/__pycache__/form_fields_management.cpython-310.pyc +0 -0
  5. tallyfy/__pycache__/models.cpython-310.pyc +0 -0
  6. tallyfy/__pycache__/task_management.cpython-310.pyc +0 -0
  7. tallyfy/__pycache__/template_management.cpython-310.pyc +0 -0
  8. tallyfy/__pycache__/user_management.cpython-310.pyc +0 -0
  9. tallyfy/core.py +361 -0
  10. tallyfy/form_fields_management/__init__.py +70 -0
  11. tallyfy/form_fields_management/__pycache__/__init__.cpython-310.pyc +0 -0
  12. tallyfy/form_fields_management/__pycache__/base.cpython-310.pyc +0 -0
  13. tallyfy/form_fields_management/__pycache__/crud_operations.cpython-310.pyc +0 -0
  14. tallyfy/form_fields_management/__pycache__/options_management.cpython-310.pyc +0 -0
  15. tallyfy/form_fields_management/__pycache__/suggestions.cpython-310.pyc +0 -0
  16. tallyfy/form_fields_management/base.py +109 -0
  17. tallyfy/form_fields_management/crud_operations.py +234 -0
  18. tallyfy/form_fields_management/options_management.py +222 -0
  19. tallyfy/form_fields_management/suggestions.py +411 -0
  20. tallyfy/models.py +1464 -0
  21. tallyfy/organization_management/__init__.py +26 -0
  22. tallyfy/organization_management/base.py +76 -0
  23. tallyfy/organization_management/retrieval.py +39 -0
  24. tallyfy/task_management/__init__.py +81 -0
  25. tallyfy/task_management/__pycache__/__init__.cpython-310.pyc +0 -0
  26. tallyfy/task_management/__pycache__/base.cpython-310.pyc +0 -0
  27. tallyfy/task_management/__pycache__/creation.cpython-310.pyc +0 -0
  28. tallyfy/task_management/__pycache__/retrieval.cpython-310.pyc +0 -0
  29. tallyfy/task_management/__pycache__/search.cpython-310.pyc +0 -0
  30. tallyfy/task_management/base.py +125 -0
  31. tallyfy/task_management/creation.py +221 -0
  32. tallyfy/task_management/retrieval.py +252 -0
  33. tallyfy/task_management/search.py +198 -0
  34. tallyfy/template_management/__init__.py +85 -0
  35. tallyfy/template_management/analysis.py +1099 -0
  36. tallyfy/template_management/automation.py +469 -0
  37. tallyfy/template_management/base.py +56 -0
  38. tallyfy/template_management/basic_operations.py +479 -0
  39. tallyfy/template_management/health_assessment.py +793 -0
  40. tallyfy/user_management/__init__.py +70 -0
  41. tallyfy/user_management/__pycache__/__init__.cpython-310.pyc +0 -0
  42. tallyfy/user_management/__pycache__/base.cpython-310.pyc +0 -0
  43. tallyfy/user_management/__pycache__/invitation.cpython-310.pyc +0 -0
  44. tallyfy/user_management/__pycache__/retrieval.cpython-310.pyc +0 -0
  45. tallyfy/user_management/base.py +146 -0
  46. tallyfy/user_management/invitation.py +286 -0
  47. tallyfy/user_management/retrieval.py +381 -0
  48. tallyfy-1.0.16.dist-info/METADATA +742 -0
  49. tallyfy-1.0.16.dist-info/RECORD +52 -0
  50. tallyfy-1.0.16.dist-info/WHEEL +5 -0
  51. tallyfy-1.0.16.dist-info/licenses/LICENSE +21 -0
  52. tallyfy-1.0.16.dist-info/top_level.txt +1 -0
@@ -0,0 +1,742 @@
1
+ Metadata-Version: 2.4
2
+ Name: tallyfy
3
+ Version: 1.0.16
4
+ Summary: A comprehensive Python SDK for interacting with the Tallyfy API
5
+ Home-page: https://github.com/tallyfy/sdk
6
+ Author: Tallyfy
7
+ Author-email: Tallyfy <support@tallyfy.com>
8
+ Maintainer-email: Tallyfy <support@tallyfy.com>
9
+ License: MIT
10
+ Project-URL: Documentation, https://tallyfy.com/products/
11
+ Project-URL: Repository, https://github.com/tallyfy/sdk
12
+ Project-URL: Bug Tracker, https://github.com/tallyfy/sdk/issues
13
+ Project-URL: Changelog, https://github.com/tallyfy/sdk/blob/main/CHANGELOG.md
14
+ Keywords: tallyfy,api,sdk,workflow,automation,task,management
15
+ Classifier: Development Status :: 5 - Production/Stable
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.7
21
+ Classifier: Programming Language :: Python :: 3.8
22
+ Classifier: Programming Language :: Python :: 3.9
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
+ Classifier: Topic :: Office/Business :: Scheduling
28
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
29
+ Requires-Python: >=3.7
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: requests>=2.25.0
33
+ Requires-Dist: typing-extensions>=4.0.0; python_version < "3.8"
34
+ Requires-Dist: email-validator==2.2.0
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=6.0.0; extra == "dev"
37
+ Requires-Dist: pytest-cov>=2.10.0; extra == "dev"
38
+ Requires-Dist: black>=21.0.1; extra == "dev"
39
+ Requires-Dist: flake8>=3.8.0; extra == "dev"
40
+ Requires-Dist: mypy>=0.800; extra == "dev"
41
+ Dynamic: author
42
+ Dynamic: home-page
43
+ Dynamic: license-file
44
+ Dynamic: requires-python
45
+
46
+ # Tallyfy SDK
47
+
48
+ A comprehensive Python SDK for interacting with the Tallyfy API. This SDK provides a clean, modular interface for managing users, tasks, templates, and form fields in your Tallyfy organization.
49
+
50
+ ## Table of Contents
51
+
52
+ - [Installation](#installation)
53
+ - [Quick Start](#quick-start)
54
+ - [Architecture](#architecture)
55
+ - [Core Features](#core-features)
56
+ - [API Reference](#api-reference)
57
+ - [Data Models](#data-models)
58
+ - [Error Handling](#error-handling)
59
+ - [Examples](#examples)
60
+ - [Advanced Usage](#advanced-usage)
61
+ - [Contributing](#contributing)
62
+
63
+ ## Installation
64
+
65
+ ```bash
66
+ pip install tallyfy
67
+ ```
68
+
69
+ **Dependencies:**
70
+ - `requests` - HTTP client library
71
+ - `typing` - Type hints support (Python 3.5+)
72
+
73
+ ## Quick Start
74
+
75
+ ```python
76
+ from tallyfy import TallyfySDK
77
+
78
+ # Initialize the SDK
79
+ sdk = TallyfySDK(
80
+ api_key="your_api_key_here"
81
+ )
82
+
83
+ # Get organization users
84
+ users = sdk.users.get_organization_users(org_id="your_org_id")
85
+
86
+ # Get current user's tasks
87
+ my_tasks = sdk.tasks.get_my_tasks(org_id="your_org_id")
88
+
89
+ # Search for templates
90
+ templates = sdk.search(org_id="your_org_id", search_query="onboarding", search_type="blueprint")
91
+
92
+ # Get a specific template
93
+ template = sdk.templates.get_template(org_id="your_org_id", template_name="Employee Onboarding")
94
+ ```
95
+
96
+ ## Architecture
97
+
98
+ The Tallyfy SDK follows a modular architecture with specialized management classes and comprehensive data models:
99
+
100
+ ### Core Components
101
+
102
+ - **`TallyfySDK`** - Main SDK class that orchestrates all operations with backward compatibility methods
103
+ - **`BaseSDK`** - Base class with HTTP request handling, retry logic, and connection pooling
104
+ - **Management Modules:**
105
+ - `UserManager` - User and guest operations with modular retrieval and invitation components
106
+ - `TaskManager` - Task and process operations with search and creation capabilities
107
+ - `TemplateManager` - Template/checklist operations with automation analysis and health assessment
108
+ - `FormFieldManager` - Form field operations with AI-powered suggestions and dropdown management
109
+ - **Error Handling:**
110
+ - `TallyfyError` - Custom exception handling with status codes and response data
111
+
112
+ ### File Structure
113
+
114
+ ```
115
+ tallyfy/
116
+ ├── __init__.py # SDK exports and version
117
+ ├── core.py # BaseSDK and TallyfySDK classes
118
+ ├── models.py # Data models and types
119
+ ├── user_management/ # User and guest management (modular)
120
+ │ ├── __init__.py # UserManager with unified interface
121
+ │ ├── base.py # Common validation and error handling
122
+ │ ├── retrieval.py # User and guest retrieval operations
123
+ │ └── invitation.py # User invitation operations
124
+ ├── task_management/ # Task and process management (modular)
125
+ │ ├── __init__.py # TaskManager with unified interface
126
+ │ ├── base.py # Common task operations base
127
+ │ ├── retrieval.py # Task and process retrieval
128
+ │ ├── search.py # Search functionality
129
+ │ └── creation.py # Task creation operations
130
+ ├── template_management/ # Template management (modular)
131
+ │ ├── __init__.py # TemplateManager with unified interface
132
+ │ ├── base.py # Common template operations
133
+ │ ├── basic_operations.py # Template retrieval and CRUD operations
134
+ │ ├── automation.py # Automation rule management
135
+ │ ├── analysis.py # Template analysis and health checks
136
+ │ └── health_assessment.py # Template health assessment functionality
137
+ ├── form_fields_management/ # Form field management (modular)
138
+ │ ├── __init__.py # FormFieldManager with unified interface
139
+ │ ├── base.py # Common form field operations
140
+ │ ├── crud_operations.py # CRUD operations for form fields
141
+ │ ├── options_management.py # Dropdown options management
142
+ │ └── suggestions.py # AI-powered field suggestions
143
+ └── README.md # This documentation
144
+ ```
145
+
146
+ ## Core Features
147
+
148
+ ### 🔐 Authentication & Security
149
+ - Bearer token authentication with session management
150
+ - Configurable request timeouts and connection pooling
151
+ - Automatic retry logic for transient failures (5xx errors)
152
+ - No retry for client errors (4xx) to prevent API abuse
153
+ - Comprehensive error handling with detailed error information
154
+
155
+ ### 👥 User Management
156
+ - **Modular architecture** with specialized retrieval and invitation components
157
+ - Get organization members with full profile data (country, timezone, job details)
158
+ - Get minimal user lists for performance-critical operations
159
+ - Manage guests and external users with guest-specific features
160
+ - **Enhanced search capabilities** - Find users by email or name with fuzzy matching
161
+ - **Batch invitation support** - Invite multiple users with default roles and messages
162
+ - **Advanced invitation features** - Custom messages, role validation, and resend functionality
163
+ - Support for user groups and permissions with flexible query parameters
164
+ - **Convenience methods** - Get all members (users + guests) in a single call
165
+
166
+ ### ✅ Task Management
167
+ - Get tasks for specific users or processes with filtering
168
+ - Create standalone tasks with rich assignment options
169
+ - Search processes by name with fuzzy matching
170
+ - Advanced filtering for organization runs (status, owners, tags, etc.)
171
+ - Universal search across processes, templates, and tasks
172
+
173
+ ### 📋 Template Management
174
+ - Get templates with full metadata and step details
175
+ - Search templates by name with exact and fuzzy matching
176
+ - Update template properties and metadata
177
+ - Duplicate templates with permission copying options
178
+ - **Automation management** - Create, update, and analyze conditional rules
179
+ - **Step dependency analysis** - Understand step visibility conditions
180
+ - **AI-powered deadline suggestions** for individual steps
181
+ - **Template health assessment** - Comprehensive analysis of template quality
182
+ - **Automation consolidation** - Optimize and merge redundant rules
183
+ - Add assignees and edit step descriptions
184
+ - Kickoff field management for template launch forms
185
+
186
+ ### 📝 Form Field Management
187
+ - Add form fields to template steps with comprehensive validation
188
+ - Support for text, dropdown, date, file upload, WYSIWYG editor fields
189
+ - Update field properties, validation rules, and positioning
190
+ - Move fields between steps with automatic reordering
191
+ - **AI-powered field suggestions** based on step analysis
192
+ - Manage dropdown options with bulk updates
193
+ - **Smart field recommendations** with confidence scoring
194
+ - Field dependency management and conditional logic
195
+
196
+ ### 🔍 Search & Discovery
197
+ - Universal search across processes, templates, and tasks
198
+ - Exact and fuzzy matching with relevance scoring
199
+ - Pagination support with configurable page sizes
200
+ - Rich search results with metadata and context
201
+ - Process and template name-based search with suggestions
202
+
203
+ ## API Reference
204
+
205
+ ### SDK Initialization
206
+
207
+ ```python
208
+ TallyfySDK(
209
+ api_key: str,
210
+ timeout: int = 30,
211
+ max_retries: int = 3,
212
+ retry_delay: float = 1.0
213
+ )
214
+ ```
215
+
216
+ ### User Management
217
+
218
+ ```python
219
+ # Get all organization users with optional group data
220
+ users = sdk.users.get_organization_users(org_id, with_groups=False)
221
+
222
+ # Get minimal user list for performance
223
+ users_list = sdk.users.get_organization_users_list(org_id)
224
+
225
+ # Get organization guests with optional statistics
226
+ guests = sdk.users.get_organization_guests(org_id, with_stats=False)
227
+
228
+ # Get current user info
229
+ current_user = sdk.users.get_current_user_info(org_id)
230
+
231
+ # Enhanced search capabilities
232
+ user = sdk.users.get_user_by_email(org_id, "john@company.com")
233
+ guest = sdk.users.get_guest_by_email(org_id, "contractor@company.com")
234
+
235
+ # Search members by name (fuzzy matching)
236
+ search_results = sdk.users.search_members_by_name(org_id, "John Smith", include_guests=True)
237
+ matching_users = search_results['users']
238
+ matching_guests = search_results['guests']
239
+
240
+ # Get all members in one call
241
+ all_members = sdk.users.get_all_organization_members(
242
+ org_id, include_guests=True, with_groups=True, with_stats=True
243
+ )
244
+
245
+ # Invite single user to organization
246
+ user = sdk.users.invite_user_to_organization(
247
+ org_id, email="new.hire@company.com",
248
+ first_name="John", last_name="Doe",
249
+ role="standard",
250
+ message="Welcome! Please complete your onboarding process."
251
+ )
252
+
253
+ # Batch invite multiple users
254
+ invitations = [
255
+ {
256
+ "email": "user1@company.com",
257
+ "first_name": "Jane",
258
+ "last_name": "Smith",
259
+ "role": "standard"
260
+ },
261
+ {
262
+ "email": "user2@company.com",
263
+ "first_name": "Bob",
264
+ "last_name": "Johnson",
265
+ "message": "Welcome to the engineering team!"
266
+ }
267
+ ]
268
+ results = sdk.users.invite_multiple_users(
269
+ org_id, invitations,
270
+ default_role="light",
271
+ default_message="Welcome to our organization!"
272
+ )
273
+
274
+ # Resend invitation
275
+ success = sdk.users.resend_invitation(
276
+ org_id, email="pending@company.com",
277
+ message="Reminder: Please accept your invitation to join our organization."
278
+ )
279
+
280
+ # Generate custom invitation message
281
+ message = sdk.users.get_invitation_template_message(
282
+ org_name="ACME Corp",
283
+ custom_text="We're excited to have you join our innovative team!"
284
+ )
285
+
286
+ # Validate invitation data before sending
287
+ invitation_data = {
288
+ "email": "new@company.com",
289
+ "first_name": "Alice",
290
+ "last_name": "Wilson",
291
+ "role": "admin"
292
+ }
293
+ validated_data = sdk.users.validate_invitation_data(invitation_data)
294
+
295
+ # Access modular components directly (advanced usage)
296
+ # Retrieval operations
297
+ users_with_groups = sdk.users.retrieval.get_organization_users(org_id, with_groups=True)
298
+
299
+ # Invitation operations
300
+ batch_results = sdk.users.invitation.invite_multiple_users(org_id, invitations)
301
+ ```
302
+
303
+ ### Task Management
304
+
305
+ ```python
306
+ # Get current user's tasks
307
+ my_tasks = sdk.tasks.get_my_tasks(org_id)
308
+
309
+ # Get specific user's tasks
310
+ user_tasks = sdk.tasks.get_user_tasks(org_id, user_id)
311
+
312
+ # Get tasks for a process
313
+ process_tasks = sdk.tasks.get_tasks_for_process(org_id, process_id=None, process_name="My Process")
314
+
315
+ # Get organization processes with filtering
316
+ runs = sdk.tasks.get_organization_runs(
317
+ org_id,
318
+ status="active",
319
+ owners="123,456",
320
+ checklist_id="template_id"
321
+ )
322
+
323
+ # Create standalone task
324
+ task = sdk.tasks.create_task(
325
+ org_id, title="Review Document",
326
+ deadline="2024-12-31T23:59:59Z",
327
+ description="Please review the attached document"
328
+ )
329
+
330
+ # Search processes, templates, or tasks
331
+ results = sdk.tasks.search(org_id, "onboarding", search_type="process")
332
+
333
+ # Search for specific entity types
334
+ templates = sdk.tasks.search(org_id, "employee onboarding", search_type="blueprint")
335
+ tasks = sdk.tasks.search(org_id, "review", search_type="task")
336
+ ```
337
+
338
+ ### Template Management
339
+
340
+ ```python
341
+ # Get template by ID or name
342
+ template = sdk.templates.get_template(org_id, template_id=None, template_name="Onboarding")
343
+
344
+ # Get template with full step details
345
+ template_data = sdk.templates.get_template_with_steps(org_id, template_id)
346
+
347
+ # Update template metadata
348
+ updated = sdk.templates.update_template_metadata(
349
+ org_id, template_id,
350
+ title="New Title",
351
+ summary="Updated summary",
352
+ guidance="New guidance text"
353
+ )
354
+
355
+ # Get template steps
356
+ steps = sdk.templates.get_template_steps(org_id, template_id)
357
+
358
+ # Analyze step dependencies
359
+ dependencies = sdk.templates.get_step_dependencies(org_id, template_id, step_id)
360
+
361
+ # Get deadline suggestions
362
+ deadline_suggestion = sdk.templates.suggest_step_deadline(org_id, template_id, step_id)
363
+
364
+ # Advanced template operations
365
+ duplicated = sdk.templates.duplicate_template(org_id, template_id, "New Template Name", copy_permissions=True)
366
+
367
+ # Automation management
368
+ automation_data = {
369
+ "automated_alias": "Auto-assign reviewer",
370
+ "conditions": [{"field_id": "department", "operator": "equals", "value": "Engineering"}],
371
+ "actions": [{"type": "assign_step", "step_id": "review_step", "assignee_type": "user", "assignee_id": "123"}]
372
+ }
373
+ automation = sdk.templates.create_automation_rule(org_id, template_id, automation_data)
374
+
375
+ # Analyze automation conflicts and redundancies
376
+ analysis = sdk.templates.analyze_template_automations(org_id, template_id)
377
+
378
+ # Get consolidation suggestions
379
+ suggestions = sdk.templates.suggest_automation_consolidation(org_id, template_id)
380
+
381
+ # Assess overall template health
382
+ health_report = sdk.templates.assess_template_health(org_id, template_id)
383
+
384
+ # Template metadata management
385
+ updated = sdk.templates.update_template_metadata(
386
+ org_id, template_id,
387
+ title="Updated Template Title",
388
+ guidance="New guidance text",
389
+ is_featured=True
390
+ )
391
+
392
+ # Add assignees to step
393
+ assignees = {"users": [123, 456], "groups": ["managers"], "guests": ["contractor@company.com"]}
394
+ sdk.templates.add_assignees_to_step(org_id, template_id, step_id, assignees)
395
+
396
+ # Edit step description
397
+ sdk.templates.edit_description_on_step(org_id, template_id, step_id, "Updated step description with detailed instructions")
398
+
399
+ # Add new step to template
400
+ step_data = {
401
+ "title": "Quality Review",
402
+ "description": "Perform final quality check",
403
+ "position": 5,
404
+ "assignees": {"users": [789]}
405
+ }
406
+ new_step = sdk.templates.add_step_to_template(org_id, template_id, step_data)
407
+ ```
408
+
409
+ ### Form Field Management
410
+
411
+ ```python
412
+ # Add form field to step
413
+ field_data = {
414
+ "field_type": "text",
415
+ "label": "Customer Name",
416
+ "required": True,
417
+ "position": 1
418
+ }
419
+ field = sdk.form_fields.add_form_field_to_step(org_id, template_id, step_id, field_data)
420
+
421
+ # Update form field
422
+ updated_field = sdk.form_fields.update_form_field(
423
+ org_id, template_id, step_id, field_id,
424
+ label="Updated Label",
425
+ required=False
426
+ )
427
+
428
+ # Move field between steps
429
+ success = sdk.form_fields.move_form_field(
430
+ org_id, template_id, from_step, field_id, to_step, position=2
431
+ )
432
+
433
+ # Delete form field
434
+ success = sdk.form_fields.delete_form_field(org_id, template_id, step_id, field_id)
435
+
436
+ # Get dropdown options
437
+ options = sdk.form_fields.get_dropdown_options(org_id, template_id, step_id, field_id)
438
+
439
+ # Update dropdown options
440
+ success = sdk.form_fields.update_dropdown_options(
441
+ org_id, template_id, step_id, field_id,
442
+ ["Option 1", "Option 2", "Option 3"]
443
+ )
444
+
445
+ # Get AI-powered field suggestions
446
+ suggestions = sdk.form_fields.suggest_form_fields_for_step(org_id, template_id, step_id)
447
+ ```
448
+
449
+ ## Data Models
450
+
451
+ The SDK provides comprehensive dataclasses for type safety and easy data access:
452
+
453
+ ### Core Models
454
+
455
+ - **`User`** - Organization member with full profile data (country, timezone, job details)
456
+ - **`Guest`** - External user with limited access and guest-specific details
457
+ - **`GuestDetails`** - Extended guest information and statistics
458
+ - **`Task`** - Individual work item with owners, deadlines, and process linkage
459
+ - **`Run`** - Process instance (workflow execution) with progress tracking
460
+ - **`Template`** - Complete template/checklist definition with automation rules
461
+ - **`Step`** - Individual step within a template with conditions and assignments
462
+
463
+ ### Assignment and Ownership Models
464
+
465
+ - **`TaskOwners`** - Task assignment information supporting users, guests, and groups
466
+ - **`RunProgress`** - Process completion tracking with step-level progress
467
+ - **`Country`** - Geographic data for user profiles
468
+ - **`Folder`** - Organizational folder structure for templates and processes
469
+
470
+ ### Template and Automation Models
471
+
472
+ - **`Tag`** - Industry and topic classification tags
473
+ - **`PrerunField`** - Form fields for template kickoff with validation rules
474
+ - **`AutomationCondition`** - Conditional logic for workflow automation
475
+ - **`AutomationAction`** - Actions triggered by automation rules
476
+ - **`AutomatedAction`** - Complete automation rule with conditions and actions
477
+ - **`AutomationDeadline`** - Deadline configuration for automated actions
478
+ - **`AutomationAssignees`** - Assignee configuration for automated actions
479
+
480
+ ### Step and Form Models
481
+
482
+ - **`Capture`** - Form fields within steps with validation and positioning
483
+ - **`StepStartDate`** - Start date configuration for steps
484
+ - **`StepDeadline`** - Deadline configuration for individual steps
485
+ - **`StepBpToLaunch`** - Sub-process launch configuration
486
+
487
+ ### Search and Utility Models
488
+
489
+ - **`SearchResult`** - Unified search results for templates, processes, and tasks
490
+ - **`TallyfyError`** - Custom exception with status codes and response data
491
+
492
+ ### Model Features
493
+
494
+ - **Automatic parsing** from API responses via `from_dict()` class methods
495
+ - **Type safety** with comprehensive type hints
496
+ - **Nested object support** for complex data structures
497
+ - **Default value handling** for optional fields
498
+
499
+ Example model usage:
500
+
501
+ ```python
502
+ # Models automatically parse API responses
503
+ users = sdk.users.get_organization_users(org_id)
504
+ for user in users:
505
+ print(f"{user.full_name} ({user.email})")
506
+ if user.country:
507
+ print(f"Country: {user.country.name}")
508
+
509
+ # Access nested data safely
510
+ template = sdk.templates.get_template(org_id, template_name="Onboarding")
511
+ if template.automated_actions:
512
+ for automation in template.automated_actions:
513
+ print(f"Automation: {automation.automated_alias}")
514
+ for condition in automation.conditions:
515
+ print(f" Condition: {condition.statement}")
516
+ ```
517
+
518
+ ## Error Handling
519
+
520
+ The SDK provides comprehensive error handling through the `TallyfyError` class:
521
+
522
+ ```python
523
+ from tallyfy import TallyfyError
524
+
525
+ try:
526
+ users = sdk.users.get_organization_users("invalid_org_id")
527
+ except TallyfyError as e:
528
+ print(f"API Error: {e}")
529
+ print(f"Status Code: {e.status_code}")
530
+ print(f"Response Data: {e.response_data}")
531
+ except ValueError as e:
532
+ print(f"Validation Error: {e}")
533
+ ```
534
+
535
+ ### Error Types
536
+
537
+ - **`TallyfyError`** - API-specific errors with status codes and response data
538
+ - **`ValueError`** - Input validation errors for required parameters
539
+ - **`RequestException`** - Network and connection errors (automatically retried)
540
+
541
+ ### Retry Logic
542
+
543
+ The SDK automatically retries failed requests with configurable settings:
544
+
545
+ - **Server errors (5xx)** - Automatically retried up to `max_retries` times
546
+ - **Client errors (4xx)** - Not retried (indicates user/input error)
547
+ - **Network errors** - Retried with exponential backoff
548
+ - **Timeout errors** - Retried with configurable delay
549
+
550
+ ## Examples
551
+
552
+ ### Complete User Onboarding Workflow
553
+
554
+ ```python
555
+ from tallyfy import TallyfySDK, TaskOwners
556
+
557
+ sdk = TallyfySDK(api_key="your_api_key")
558
+ org_id = "your_org_id"
559
+
560
+ # 1. Invite new user
561
+ new_user = sdk.users.invite_user_to_organization(
562
+ org_id,
563
+ email="new.hire@company.com",
564
+ first_name="John",
565
+ last_name="Doe",
566
+ role="standard",
567
+ message="Welcome to the team! Please complete your onboarding."
568
+ )
569
+
570
+ # 2. Create onboarding task
571
+ if new_user:
572
+ owners = TaskOwners(users=[new_user.id])
573
+ onboarding_task = sdk.tasks.create_task(
574
+ org_id,
575
+ title="Complete Employee Onboarding",
576
+ deadline="2025-12-31 17:00:00",
577
+ description="Please complete all onboarding steps including HR paperwork and IT setup.",
578
+ owners=owners
579
+ )
580
+ print(f"Created onboarding task: {onboarding_task.id}")
581
+ ```
582
+
583
+ ### Template Analysis and Enhancement
584
+
585
+ ```python
586
+ # Get template with full details
587
+ template_data = sdk.templates.get_template_with_steps(org_id, template_name="Project Kickoff")
588
+
589
+ if template_data:
590
+ template = template_data['template']
591
+ print(f"Template: {template.title}")
592
+ print(f"Steps: {template_data['step_count']}")
593
+ print(f"Automations: {template_data['automation_count']}")
594
+
595
+ # Analyze each step for improvements
596
+ for step_data in template_data['steps']:
597
+ step_id = step_data['id']
598
+
599
+ # Get dependency analysis
600
+ dependencies = sdk.templates.get_step_dependencies(org_id, template.id, step_id)
601
+ if dependencies['has_conditional_visibility']:
602
+ print(f"Step '{step_data['title']}' has conditional logic")
603
+
604
+ # Get deadline suggestions
605
+ deadline_suggestion = sdk.templates.suggest_step_deadline(org_id, template.id, step_id)
606
+ print(f"Suggested deadline: {deadline_suggestion['suggested_deadline']}")
607
+
608
+ # Get form field suggestions
609
+ field_suggestions = sdk.form_fields.suggest_form_fields_for_step(org_id, template.id, step_id)
610
+ for suggestion in field_suggestions[:2]: # Top 2 suggestions
611
+ if suggestion['confidence'] > 0.7:
612
+ print(f"High-confidence field suggestion: {suggestion['field_config']['label']}")
613
+ ```
614
+
615
+ ### Advanced Process Management
616
+
617
+ ```python
618
+ # Get all active processes with comprehensive filtering
619
+ active_runs = sdk.tasks.get_organization_runs(
620
+ org_id,
621
+ status="active",
622
+ with_data="checklist,tasks,assets,tags",
623
+ form_fields_values=True,
624
+ starred=True
625
+ )
626
+
627
+ # Group by template
628
+ template_usage = {}
629
+ for run in active_runs:
630
+ template_id = run.checklist_id
631
+ if template_id not in template_usage:
632
+ template_usage[template_id] = {
633
+ 'template_name': run.checklist_title,
634
+ 'active_count': 0,
635
+ 'runs': []
636
+ }
637
+ template_usage[template_id]['active_count'] += 1
638
+ template_usage[template_id]['runs'].append(run)
639
+
640
+ # Show most used templates
641
+ sorted_templates = sorted(template_usage.items(), key=lambda x: x[1]['active_count'], reverse=True)
642
+ for template_id, data in sorted_templates[:5]:
643
+ print(f"{data['template_name']}: {data['active_count']} active processes")
644
+ ```
645
+
646
+ ## Advanced Usage
647
+
648
+ ### Custom Request Configuration
649
+
650
+ ```python
651
+ # SDK with custom configuration
652
+ sdk = TallyfySDK(
653
+ api_key="your_api_key",
654
+ base_url="https://api.tallyfy.com",
655
+ timeout=60, # 60 second timeout
656
+ max_retries=5, # Retry up to 5 times
657
+ retry_delay=2.0 # 2 second delay between retries
658
+ )
659
+ ```
660
+
661
+ ### Accessing Raw API Responses
662
+
663
+ ```python
664
+ # For advanced users who need raw API data
665
+ template_data = sdk.templates.get_template_with_steps(org_id, template_id)
666
+ raw_api_response = template_data['raw_data']
667
+
668
+ # Access nested API data not exposed in models
669
+ custom_fields = raw_api_response.get('custom_metadata', {})
670
+ ```
671
+
672
+ ### Batch Operations
673
+
674
+ ```python
675
+ # Efficiently process multiple operations
676
+ org_users = sdk.users.get_organization_users(org_id)
677
+ user_tasks = {}
678
+
679
+ for user in org_users[:10]: # Process first 10 users
680
+ try:
681
+ tasks = sdk.tasks.get_user_tasks(org_id, user.id)
682
+ user_tasks[user.id] = tasks
683
+ print(f"{user.full_name}: {len(tasks)} tasks")
684
+ except TallyfyError as e:
685
+ print(f"Failed to get tasks for {user.full_name}: {e}")
686
+ ```
687
+
688
+ ### Form Field Automation
689
+
690
+ ```python
691
+ # Automatically enhance templates with smart form fields
692
+ def enhance_template_with_smart_fields(org_id, template_id):
693
+ steps = sdk.templates.get_template_steps(org_id, template_id)
694
+
695
+ for step in steps:
696
+ # Get AI suggestions for each step
697
+ suggestions = sdk.form_fields.suggest_form_fields_for_step(org_id, template_id, step.id)
698
+
699
+ # Implement high-confidence suggestions
700
+ for suggestion in suggestions:
701
+ if suggestion['confidence'] > 0.8 and suggestion['priority'] == 'high':
702
+ field_data = suggestion['field_config']
703
+ try:
704
+ new_field = sdk.form_fields.add_form_field_to_step(
705
+ org_id, template_id, step.id, field_data
706
+ )
707
+ print(f"Added field '{field_data['label']}' to step '{step.title}'")
708
+ except TallyfyError as e:
709
+ print(f"Failed to add field: {e}")
710
+
711
+ # Use the enhancement function
712
+ enhance_template_with_smart_fields(org_id, "your_template_id")
713
+ ```
714
+
715
+ ## Contributing
716
+
717
+ ### Code Style
718
+
719
+ - Follow PEP 8 style guidelines
720
+ - Use type hints for all functions and methods
721
+ - Add comprehensive docstrings for public APIs
722
+ - Include error handling for all external API calls
723
+
724
+ ### Adding New Features
725
+
726
+ 1. Add methods to appropriate management class
727
+ 2. Create or update data models in `models.py`
728
+ 3. Add comprehensive docstrings and type hints
729
+ 4. Include error handling and logging
730
+ 5. Update this README with usage examples
731
+
732
+
733
+ ## Support
734
+
735
+ For bugs, feature requests, or questions:
736
+
737
+ 1. Check existing issues in the project repository
738
+ 2. Contact us at: support@tallyfy.com
739
+ ---
740
+
741
+ **Version:** 1.0.14
742
+ **Last Updated:** 2025