adaptsapi 0.1.4__tar.gz → 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.
@@ -0,0 +1,816 @@
1
+ Metadata-Version: 2.4
2
+ Name: adaptsapi
3
+ Version: 0.1.5
4
+ Summary: CLI to enqueue triggers via internal API Gateway → SNS
5
+ Home-page: https://github.com/adaptsai/adaptsapi
6
+ Author: adapts
7
+ Author-email: "VerifyAI Inc." <dev@adapts.ai>
8
+ License-Expression: LicenseRef-Proprietary
9
+ Project-URL: Homepage, https://github.com/adaptsai/adaptsapi
10
+ Project-URL: Source, https://github.com/adaptsai/adaptsapi
11
+ Keywords: adapts,api,cli,sns
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: requests
18
+ Dynamic: author
19
+ Dynamic: home-page
20
+ Dynamic: license-file
21
+ Dynamic: requires-python
22
+
23
+ # AdaptsAPI Client
24
+
25
+ A Python client library and CLI for the Adapts API, designed for triggering documentation generation via API Gateway → SNS.
26
+
27
+ [![PyPI version](https://badge.fury.io/py/adaptsapi.svg)](https://badge.fury.io/py/adaptsapi)
28
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
29
+ [![License: Proprietary](https://img.shields.io/badge/License-Proprietary-red.svg)](LICENSE)
30
+ [![Test Coverage](https://img.shields.io/badge/coverage-98%25-green.svg)](https://github.com/adaptsai/adaptsapi)
31
+
32
+ ## Features
33
+
34
+ - 🚀 **Simple Python Client** for making API calls to Adapts services
35
+ - 🔑 **Secure token management** with environment variables or local config
36
+ - 📄 **Flexible payload support** via JSON files or inline data
37
+ - 🔧 **Configurable endpoints** with default endpoint support
38
+ - ✅ **Built-in payload validation** for documentation generation requests
39
+ - 🧪 **Comprehensive test suite** with 98% code coverage
40
+ - 🤖 **GitHub Actions integration** for automated wiki documentation
41
+ - 📦 **CLI tool** for command-line usage
42
+
43
+ ## Installation
44
+
45
+ ### From PyPI
46
+
47
+ ```bash
48
+ pip install adaptsapi
49
+ ```
50
+
51
+ ### From Source
52
+
53
+ ```bash
54
+ git clone https://github.com/adaptsai/adaptsapi.git
55
+ cd adaptsapi
56
+ pip install -e .
57
+ ```
58
+
59
+ ## Quick Start
60
+
61
+ ### 1. Set up your API token
62
+
63
+ You can provide your API token in three ways (in order of precedence):
64
+
65
+ 1. **Environment variable** (recommended for CI/CD):
66
+ ```bash
67
+ export ADAPTS_API_KEY="your-api-token-here"
68
+ ```
69
+
70
+ 2. **Local config file** (`config.json` in current directory):
71
+ ```json
72
+ {
73
+ "token": "your-api-token-here",
74
+ "endpoint": "https://your-api-endpoint.com/prod/generate_wiki_docs"
75
+ }
76
+ ```
77
+
78
+ 3. **Interactive prompt** (first-time setup):
79
+ ```bash
80
+ adaptsapi --data '{"test": "payload"}'
81
+ # CLI will prompt for token and save to config.json
82
+ ```
83
+
84
+ ### 2. Using the Python Client
85
+
86
+ ```python
87
+ from adaptsapi.generate_docs import post, PayloadValidationError
88
+
89
+ # Create your payload
90
+ payload = {
91
+ "email_address": "user@example.com",
92
+ "user_name": "john_doe",
93
+ "repo_object": {
94
+ "repository_name": "my-repo",
95
+ "source": "github",
96
+ "repository_url": "https://github.com/user/my-repo",
97
+ "branch": "main",
98
+ "size": "12345",
99
+ "language": "python",
100
+ "is_private": False,
101
+ "git_provider_type": "github",
102
+ "refresh_token": "github_token_here"
103
+ }
104
+ }
105
+
106
+ # Make the API call
107
+ try:
108
+ response = post(
109
+ "https://api.adapts.ai/prod/generate_wiki_docs",
110
+ "your-api-token",
111
+ payload
112
+ )
113
+ response.raise_for_status()
114
+ result = response.json()
115
+ print("✅ Success:", result)
116
+ except PayloadValidationError as e:
117
+ print(f"❌ Validation error: {e}")
118
+ except Exception as e:
119
+ print(f"❌ API error: {e}")
120
+ ```
121
+
122
+ ### 3. Using the CLI
123
+
124
+ **Using inline JSON data:**
125
+ ```bash
126
+ adaptsapi \
127
+ --endpoint "https://api.adapts.ai/prod/generate_wiki_docs" \
128
+ --data '{"email_address": "user@example.com", "user_name": "john_doe", "repo_object": {...}}'
129
+ ```
130
+
131
+ **Using a JSON payload file:**
132
+ ```bash
133
+ adaptsapi \
134
+ --endpoint "https://api.adapts.ai/prod/generate_wiki_docs" \
135
+ --payload-file payload.json
136
+ ```
137
+
138
+ ## Testing
139
+
140
+ The library includes a comprehensive test suite with 98% code coverage.
141
+
142
+ ### Running Tests
143
+
144
+ #### Quick Test Run
145
+ ```bash
146
+ # Run all tests
147
+ python -m pytest
148
+
149
+ # Run with verbose output
150
+ python -m pytest -v
151
+
152
+ # Run specific test file
153
+ python -m pytest tests/test_generate_docs.py
154
+
155
+ # Run with coverage report
156
+ python -m pytest --cov=src/adaptsapi --cov-report=html
157
+ ```
158
+
159
+ #### Using the Test Runner
160
+ ```bash
161
+ # Run unit tests only (fast, no external dependencies)
162
+ python run_tests.py --type unit
163
+
164
+ # Run integration tests (requires API key)
165
+ python run_tests.py --type integration
166
+
167
+ # Run all tests with coverage
168
+ python run_tests.py --type coverage
169
+
170
+ # Run with custom API key
171
+ python run_tests.py --type integration --api-key "your-api-key"
172
+ ```
173
+
174
+ #### Test Categories
175
+
176
+ - **Unit Tests**: Fast tests that mock external dependencies
177
+ - **Integration Tests**: Tests that make real API calls (marked with `@pytest.mark.integration`)
178
+ - **CLI Tests**: Tests for command-line interface functionality
179
+ - **Config Tests**: Tests for configuration management
180
+
181
+ ### Test Coverage
182
+
183
+ The test suite covers:
184
+
185
+ - ✅ **Payload Validation**: All validation logic and error cases
186
+ - ✅ **Metadata Population**: Automatic metadata generation
187
+ - ✅ **API Calls**: HTTP request handling and error management
188
+ - ✅ **CLI Functionality**: Command-line argument parsing and file handling
189
+ - ✅ **Configuration**: Token loading and config file management
190
+
191
+ ### Demo Script
192
+
193
+ Run the demonstration script to see the library in action:
194
+
195
+ ```bash
196
+ python test_generate_docs_demo.py
197
+ ```
198
+
199
+ This script shows:
200
+ - Payload validation examples
201
+ - Metadata population demonstration
202
+ - API call structure
203
+ - Real API testing (if API key is available)
204
+
205
+ ## Usage
206
+
207
+ ### Command Line Options
208
+
209
+ ```bash
210
+ adaptsapi [OPTIONS]
211
+ ```
212
+
213
+ | Option | Description | Required |
214
+ |--------|-------------|----------|
215
+ | `--endpoint URL` | Full URL of the API endpoint | Yes (unless set in config.json) |
216
+ | `--data JSON` | Inline JSON payload string | Yes (or --payload-file) |
217
+ | `--payload-file FILE` | Path to JSON payload file | Yes (or --data) |
218
+ | `--timeout SECONDS` | Request timeout in seconds (default: 30) | No |
219
+
220
+ ### Payload Structure
221
+
222
+ For documentation generation, your payload should follow this structure:
223
+
224
+ ```json
225
+ {
226
+ "email_address": "user@example.com",
227
+ "user_name": "github_username",
228
+ "repo_object": {
229
+ "repository_name": "my-repo",
230
+ "source": "github",
231
+ "repository_url": "https://github.com/user/my-repo",
232
+ "branch": "main",
233
+ "size": "12345",
234
+ "language": "python",
235
+ "is_private": false,
236
+ "git_provider_type": "github",
237
+ "refresh_token": "github_token_here"
238
+ }
239
+ }
240
+ ```
241
+
242
+ #### Required Fields
243
+
244
+ - `email_address`: Valid email address
245
+ - `user_name`: Username string
246
+ - `repo_object.repository_name`: Repository name
247
+ - `repo_object.repository_url`: Full repository URL
248
+ - `repo_object.branch`: Branch name
249
+ - `repo_object.size`: Repository size as string
250
+ - `repo_object.language`: Primary programming language
251
+ - `repo_object.source`: Source platform (e.g., "github")
252
+
253
+ #### Optional Fields
254
+
255
+ - `repo_object.is_private`: Boolean indicating if repo is private
256
+ - `repo_object.git_provider_type`: Git provider type
257
+ - `repo_object.installation_id`: Installation ID (for GitHub Apps)
258
+ - `repo_object.refresh_token`: Refresh token for authentication
259
+ - `repo_object.commit_hash`: Specific commit hash
260
+ - `repo_object.commit_message`: Commit message
261
+ - `repo_object.commit_author`: Commit author
262
+ - `repo_object.directory_name`: Specific directory to process
263
+
264
+ ## GitHub Actions Integration
265
+
266
+ This package is designed to work seamlessly with GitHub Actions for automated documentation generation. Here's an example workflow:
267
+
268
+ ```yaml
269
+ name: Generate Wiki Docs
270
+
271
+ on:
272
+ pull_request:
273
+ branches: [ main ]
274
+ types: [ closed ]
275
+
276
+ jobs:
277
+ call-adapts-api:
278
+ if: github.event.pull_request.merged == true
279
+ runs-on: ubuntu-latest
280
+
281
+ steps:
282
+ - uses: actions/checkout@v4
283
+
284
+ - name: Set up Python
285
+ uses: actions/setup-python@v5
286
+ with:
287
+ python-version: "3.11"
288
+
289
+ - name: Install adaptsapi
290
+ run: pip install adaptsapi
291
+
292
+ - name: Generate documentation
293
+ env:
294
+ ADAPTS_API_KEY: ${{ secrets.ADAPTS_API_KEY }}
295
+ run: |
296
+ python -c "
297
+ import os
298
+ from adaptsapi.generate_docs import post
299
+
300
+ payload = {
301
+ 'email_address': '${{ github.actor }}@users.noreply.github.com',
302
+ 'user_name': '${{ github.actor }}',
303
+ 'repo_object': {
304
+ 'repository_name': '${{ github.event.repository.name }}',
305
+ 'source': 'github',
306
+ 'repository_url': '${{ github.event.repository.html_url }}',
307
+ 'branch': 'main',
308
+ 'size': '0',
309
+ 'language': 'python',
310
+ 'is_private': False,
311
+ 'git_provider_type': 'github',
312
+ 'refresh_token': '${{ secrets.GITHUB_TOKEN }}'
313
+ }
314
+ }
315
+
316
+ resp = post(
317
+ 'https://your-api-endpoint.com/prod/generate_wiki_docs',
318
+ os.environ['ADAPTS_API_KEY'],
319
+ payload
320
+ )
321
+ resp.raise_for_status()
322
+ print('✅ Documentation generated successfully')
323
+ "
324
+ ```
325
+
326
+ ### Setting up GitHub Secrets
327
+
328
+ 1. Go to your repository on GitHub
329
+ 2. Click **Settings** → **Secrets and variables** → **Actions**
330
+ 3. Click **New repository secret**
331
+ 4. Add `ADAPTS_API_KEY` with your API token value
332
+
333
+ ## Configuration
334
+
335
+ ### Config File Format
336
+
337
+ The `config.json` file in your current working directory can contain:
338
+
339
+ ```json
340
+ {
341
+ "token": "your-api-token-here",
342
+ "endpoint": "https://your-default-endpoint.com/prod/generate_wiki_docs"
343
+ }
344
+ ```
345
+
346
+ ### Environment Variables
347
+
348
+ - `ADAPTS_API_KEY`: Your API authentication token (used by the library)
349
+ - `ADAPTS_API_TOKEN`: Alternative token variable (used by CLI)
350
+
351
+ ## Error Handling
352
+
353
+ The library provides comprehensive error handling:
354
+
355
+ - **PayloadValidationError**: Raised when payload validation fails
356
+ - **ConfigError**: Raised when no token can be found or loaded
357
+ - **requests.RequestException**: Raised on network failures
358
+ - **JSONDecodeError**: Raised for invalid JSON in config files
359
+
360
+ ### Common Error Scenarios
361
+
362
+ - **Missing token**: CLI prompts for interactive token input
363
+ - **Invalid JSON**: Shows JSON parsing errors
364
+ - **API errors**: Displays HTTP status codes and error messages
365
+ - **Payload validation**: Shows specific validation failures with field names
366
+
367
+ ## Development
368
+
369
+ ### Prerequisites
370
+
371
+ - Python 3.10+
372
+ - pip
373
+
374
+ ### Setup Development Environment
375
+
376
+ ```bash
377
+ git clone https://github.com/adaptsai/adaptsapi.git
378
+ cd adaptsapi
379
+ python -m venv .venv
380
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
381
+ pip install -r requirements-dev.txt
382
+ pip install -e .
383
+ ```
384
+
385
+ ### Development Dependencies
386
+
387
+ Install development dependencies for testing and code quality:
388
+
389
+ ```bash
390
+ pip install -r requirements-dev.txt
391
+ ```
392
+
393
+ This includes:
394
+ - `pytest` - Testing framework
395
+ - `pytest-cov` - Coverage reporting
396
+ - `pytest-mock` - Mocking utilities
397
+ - `flake8` - Code linting
398
+ - `mypy` - Type checking
399
+ - `black` - Code formatting
400
+ - `isort` - Import sorting
401
+
402
+ ### Running Tests
403
+
404
+ ```bash
405
+ # Run all tests
406
+ python -m pytest
407
+
408
+ # Run with coverage
409
+ python -m pytest --cov=src/adaptsapi --cov-report=html
410
+
411
+ # Run specific test categories
412
+ python -m pytest -m "not integration" # Unit tests only
413
+ python -m pytest -m "integration" # Integration tests only
414
+
415
+ # Run the test runner
416
+ python run_tests.py --type all
417
+ ```
418
+
419
+ ### Code Quality
420
+
421
+ ```bash
422
+ # Lint code
423
+ flake8 src/adaptsapi tests/
424
+
425
+ # Type checking
426
+ mypy src/adaptsapi/
427
+
428
+ # Format code
429
+ black src/adaptsapi tests/
430
+ isort src/adaptsapi tests/
431
+ ```
432
+
433
+ ## Publishing to PyPI
434
+
435
+ ### Prerequisites
436
+
437
+ Before publishing to PyPI, ensure you have:
438
+
439
+ 1. **PyPI Account**: Create an account at [pypi.org](https://pypi.org/account/register/)
440
+ 2. **TestPyPI Account**: Create an account at [test.pypi.org](https://test.pypi.org/account/register/)
441
+ 3. **API Tokens**: Generate API tokens for both PyPI and TestPyPI
442
+ 4. **Build Tools**: Install required build tools
443
+
444
+ ```bash
445
+ pip install build twine
446
+ ```
447
+
448
+ ### Build Configuration
449
+
450
+ The project uses `pyproject.toml` for build configuration. Key settings:
451
+
452
+ ```toml
453
+ [project]
454
+ name = "adaptsapi"
455
+ version = "0.1.4"
456
+ description = "CLI to enqueue triggers via internal API Gateway → SNS"
457
+ readme = { file = "README.md", content-type = "text/markdown" }
458
+ requires-python = ">=3.10"
459
+ authors = [
460
+ { name = "VerifyAI Inc.", email = "dev@adapts.ai" }
461
+ ]
462
+ dependencies = [
463
+ "requests",
464
+ ]
465
+ ```
466
+
467
+ ### Publishing Steps
468
+
469
+ #### 1. Prepare for Release
470
+
471
+ ```bash
472
+ # Clean previous builds
473
+ rm -rf build/ dist/ *.egg-info src/*.egg-info
474
+
475
+ # Update version in pyproject.toml and setup.py
476
+ # Edit version numbers in both files
477
+
478
+ # Run all tests to ensure everything works
479
+ python run_tests.py --type all
480
+
481
+ # Check code quality
482
+ flake8 src/adaptsapi tests/
483
+ mypy src/adaptsapi/
484
+ ```
485
+
486
+ #### 2. Build Distribution Packages
487
+
488
+ ```bash
489
+ # Build source distribution and wheel
490
+ python -m build
491
+
492
+ # Verify the built packages
493
+ ls -la dist/
494
+ # Should show: adaptsapi-0.1.4.tar.gz and adaptsapi-0.1.4-py3-none-any.whl
495
+ ```
496
+
497
+ #### 3. Test on TestPyPI (Recommended)
498
+
499
+ ```bash
500
+ # Upload to TestPyPI first
501
+ python -m twine upload --repository testpypi dist/*
502
+
503
+ # Test installation from TestPyPI
504
+ pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ adaptsapi
505
+
506
+ # Test the installed package
507
+ python -c "from adaptsapi.generate_docs import post; print('✅ Package works!')"
508
+ ```
509
+
510
+ #### 4. Publish to PyPI
511
+
512
+ ```bash
513
+ # Upload to PyPI
514
+ python -m twine upload dist/*
515
+
516
+ # Verify installation from PyPI
517
+ pip install adaptsapi
518
+
519
+ # Test the installed package
520
+ python -c "from adaptsapi.generate_docs import post; print('✅ Package published successfully!')"
521
+ ```
522
+
523
+ ### Automated Publishing with GitHub Actions
524
+
525
+ Create `.github/workflows/publish.yml`:
526
+
527
+ ```yaml
528
+ name: Publish to PyPI
529
+
530
+ on:
531
+ release:
532
+ types: [published]
533
+
534
+ jobs:
535
+ publish:
536
+ runs-on: ubuntu-latest
537
+ steps:
538
+ - uses: actions/checkout@v4
539
+
540
+ - name: Set up Python
541
+ uses: actions/setup-python@v5
542
+ with:
543
+ python-version: "3.10"
544
+
545
+ - name: Install dependencies
546
+ run: |
547
+ pip install build twine
548
+ pip install -r requirements-dev.txt
549
+
550
+ - name: Run tests
551
+ run: |
552
+ python run_tests.py --type unit
553
+
554
+ - name: Build package
555
+ run: python -m build
556
+
557
+ - name: Publish to TestPyPI
558
+ env:
559
+ TWINE_USERNAME: __token__
560
+ TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
561
+ run: |
562
+ python -m twine upload --repository testpypi dist/*
563
+
564
+ - name: Publish to PyPI
565
+ env:
566
+ TWINE_USERNAME: __token__
567
+ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
568
+ run: |
569
+ python -m twine upload dist/*
570
+ ```
571
+
572
+ ### Environment Variables for CI/CD
573
+
574
+ Set these secrets in your GitHub repository:
575
+
576
+ - `PYPI_API_TOKEN`: Your PyPI API token
577
+ - `TEST_PYPI_API_TOKEN`: Your TestPyPI API token
578
+
579
+ ### Version Management
580
+
581
+ #### Semantic Versioning
582
+
583
+ Follow [semantic versioning](https://semver.org/):
584
+
585
+ - **MAJOR.MINOR.PATCH** (e.g., 0.1.4)
586
+ - **MAJOR**: Breaking changes
587
+ - **MINOR**: New features, backward compatible
588
+ - **PATCH**: Bug fixes, backward compatible
589
+
590
+ #### Update Version Numbers
591
+
592
+ Update version in these files:
593
+
594
+ 1. **pyproject.toml**:
595
+ ```toml
596
+ [project]
597
+ version = "0.1.5" # Update this
598
+ ```
599
+
600
+ 2. **setup.py**:
601
+ ```python
602
+ setup(
603
+ name="adaptsapi",
604
+ version="0.1.5", # Update this
605
+ # ...
606
+ )
607
+ ```
608
+
609
+ ### Pre-release Checklist
610
+
611
+ Before publishing, ensure:
612
+
613
+ - [ ] All tests pass: `python run_tests.py --type all`
614
+ - [ ] Code is linted: `flake8 src/adaptsapi tests/`
615
+ - [ ] Type checking passes: `mypy src/adaptsapi/`
616
+ - [ ] Documentation is updated
617
+ - [ ] Version numbers are updated in both `pyproject.toml` and `setup.py`
618
+ - [ ] CHANGELOG is updated
619
+ - [ ] Package builds successfully: `python -m build`
620
+ - [ ] Package installs correctly: `pip install dist/*.whl`
621
+
622
+ ### Troubleshooting
623
+
624
+ #### Common Issues
625
+
626
+ 1. **"File already exists" error**:
627
+ ```bash
628
+ # Clean previous builds
629
+ rm -rf build/ dist/ *.egg-info src/*.egg-info
630
+ python -m build
631
+ ```
632
+
633
+ 2. **Authentication errors**:
634
+ ```bash
635
+ # Check your API token
636
+ python -m twine check dist/*
637
+ ```
638
+
639
+ 3. **Package not found after upload**:
640
+ - Wait a few minutes for PyPI to process
641
+ - Check the package page: https://pypi.org/project/adaptsapi/
642
+
643
+ 4. **Import errors after installation**:
644
+ ```bash
645
+ # Verify package structure
646
+ pip show adaptsapi
647
+ python -c "import adaptsapi; print(adaptsapi.__file__)"
648
+ ```
649
+
650
+ #### Rollback Strategy
651
+
652
+ If you need to rollback a release:
653
+
654
+ 1. **Delete the release** (if within 24 hours):
655
+ ```bash
656
+ # Use PyPI web interface to delete the release
657
+ # Go to: https://pypi.org/manage/project/adaptsapi/releases/
658
+ ```
659
+
660
+ 2. **Yank the release** (recommended):
661
+ ```bash
662
+ python -m twine delete --username __token__ --password $PYPI_API_TOKEN adaptsapi 0.1.4
663
+ ```
664
+
665
+ 3. **Publish a new patch version** with fixes
666
+
667
+ ### Security Best Practices
668
+
669
+ 1. **Use API tokens** instead of username/password
670
+ 2. **Store tokens securely** in environment variables or secrets
671
+ 3. **Use TestPyPI** for testing before production
672
+ 4. **Verify package contents** before uploading
673
+ 5. **Keep dependencies updated** and secure
674
+
675
+ ### Package Verification
676
+
677
+ After publishing, verify the package:
678
+
679
+ ```bash
680
+ # Install from PyPI
681
+ pip install adaptsapi
682
+
683
+ # Test imports
684
+ python -c "
685
+ from adaptsapi.generate_docs import post, PayloadValidationError
686
+ from adaptsapi.cli import main
687
+ from adaptsapi.config import load_token
688
+ print('✅ All imports successful!')
689
+ "
690
+
691
+ # Test CLI
692
+ adaptsapi --help
693
+
694
+ # Run tests
695
+ python -m pytest tests/test_generate_docs.py -v
696
+ ```
697
+
698
+ ## API Reference
699
+
700
+ ### Core Functions
701
+
702
+ #### `post(endpoint, auth_token, payload, timeout=30)`
703
+
704
+ Make a POST request to the Adapts API with automatic payload validation and metadata population.
705
+
706
+ **Parameters:**
707
+ - `endpoint` (str): The API endpoint URL
708
+ - `auth_token` (str): Authentication token
709
+ - `payload` (dict): JSON payload to send
710
+ - `timeout` (int): Request timeout in seconds (default: 30)
711
+
712
+ **Returns:**
713
+ - `requests.Response`: The HTTP response object
714
+
715
+ **Raises:**
716
+ - `PayloadValidationError`: If payload validation fails
717
+ - `requests.RequestException`: If the HTTP request fails
718
+
719
+ #### `_validate_payload(payload)`
720
+
721
+ Validate the payload structure and data types.
722
+
723
+ **Parameters:**
724
+ - `payload` (dict): The payload to validate
725
+
726
+ **Raises:**
727
+ - `PayloadValidationError`: If validation fails
728
+
729
+ #### `_populate_metadata(payload)`
730
+
731
+ Automatically populate metadata fields in the payload.
732
+
733
+ **Parameters:**
734
+ - `payload` (dict): The payload to populate with metadata
735
+
736
+ ### CLI Functions
737
+
738
+ #### `main()`
739
+
740
+ Main CLI entry point that handles argument parsing and API calls.
741
+
742
+ ### Configuration Functions
743
+
744
+ #### `load_token()`
745
+
746
+ Load authentication token from environment variables or config file.
747
+
748
+ **Returns:**
749
+ - `str`: The authentication token
750
+
751
+ **Raises:**
752
+ - `ConfigError`: If no token can be found
753
+
754
+ #### `load_default_endpoint()`
755
+
756
+ Load default endpoint from config file.
757
+
758
+ **Returns:**
759
+ - `str | None`: The default endpoint URL or None
760
+
761
+ ## Project Structure
762
+
763
+ ```
764
+ adaptsapi/
765
+ ├── src/adaptsapi/
766
+ │ ├── __init__.py
767
+ │ ├── generate_docs.py # Main API client functionality
768
+ │ ├── cli.py # Command-line interface
769
+ │ └── config.py # Configuration management
770
+ ├── tests/
771
+ │ ├── conftest.py # Test fixtures and configuration
772
+ │ ├── test_generate_docs.py # Tests for generate_docs module
773
+ │ ├── test_cli.py # Tests for CLI functionality
774
+ │ └── test_config.py # Tests for configuration management
775
+ ├── run_tests.py # Test runner script
776
+ ├── test_generate_docs_demo.py # Demonstration script
777
+ ├── requirements.txt # Runtime dependencies
778
+ ├── requirements-dev.txt # Development dependencies
779
+ ├── pytest.ini # Pytest configuration
780
+ └── TESTING.md # Detailed testing guide
781
+ ```
782
+
783
+ ## License
784
+
785
+ This software is licensed under the Adapts API Use-Only License v1.0. See [LICENSE](LICENSE) for details.
786
+
787
+ **Key restrictions:**
788
+ - ✅ Use the software as-is
789
+ - ❌ No modifications allowed
790
+ - ❌ No redistribution allowed
791
+ - ❌ Commercial use restrictions apply
792
+
793
+ ## Support
794
+
795
+ - 📧 Email: dev@adapts.ai
796
+ - 🐛 Issues: [GitHub Issues](https://github.com/adaptsai/adaptsapi/issues)
797
+ - 📖 Documentation: This README and [TESTING.md](TESTING.md)
798
+
799
+ ## Changelog
800
+
801
+ ### v0.1.4 (Latest)
802
+ - ✅ Comprehensive test suite with 98% coverage
803
+ - ✅ Improved error handling and validation
804
+ - ✅ Enhanced CLI functionality
805
+ - ✅ Better configuration management
806
+ - ✅ Development tools and documentation
807
+
808
+ ### v0.1.3
809
+ - Patch updates
810
+
811
+ ### v0.1.2
812
+ - Initial stable release
813
+
814
+ ---
815
+
816
+ © 2025 AdaptsAI All rights reserved.