Initial release — APIClient - Agent v2.0.0
AI-first API testing desktop client built with Python + PyQt6. Features: - Multi-tab HTTP request editor with params/headers/body/auth/tests - KeyValueTable with per-row enable/disable checkboxes and 36px rows - Format JSON button, syntax highlighting, pre-request & test scripts - Collections, environments, history, import/export (Postman v2.1, cURL) - OpenAPI 3.x / Swagger 2.0 local parser (no AI tokens) - EKIKA Odoo API Framework generator — JSON-API, REST JSON, GraphQL, Custom REST JSON with all auth types (instant, no AI tokens) - Persistent AI chat sidebar (Claude-powered co-pilot) with streaming, context-aware suggestions, and one-click Apply to request editor - AI collection generator from any docs URL or pasted spec - WebSocket client, Mock server, Collection runner, Code generator - Dark/light theme engine (global QSS, object-name selectors) - SSL error detection with actionable hints - MIT License Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
72
app/models.py
Normal file
72
app/models.py
Normal file
@@ -0,0 +1,72 @@
|
||||
"""APIClient - Agent — Core data models."""
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class HttpRequest:
|
||||
method: str = "GET"
|
||||
url: str = ""
|
||||
headers: dict = field(default_factory=dict)
|
||||
params: dict = field(default_factory=dict)
|
||||
body: str = ""
|
||||
body_type: str = "raw" # raw | form-data | urlencoded
|
||||
content_type: str = "" # explicit Content-Type override
|
||||
auth_type: str = "none" # none | bearer | basic | apikey
|
||||
auth_data: dict = field(default_factory=dict)
|
||||
pre_request_script: str = ""
|
||||
test_script: str = ""
|
||||
name: str = ""
|
||||
collection_id: Optional[int] = None
|
||||
folder_id: Optional[int] = None
|
||||
id: Optional[int] = None # set when loaded from DB
|
||||
timeout: int = 30 # seconds
|
||||
ssl_verify: bool = True
|
||||
|
||||
|
||||
@dataclass
|
||||
class HttpResponse:
|
||||
status: int = 0
|
||||
reason: str = ""
|
||||
headers: dict = field(default_factory=dict)
|
||||
body: str = ""
|
||||
elapsed_ms: float = 0.0
|
||||
size_bytes: int = 0
|
||||
error: str = ""
|
||||
|
||||
|
||||
@dataclass
|
||||
class Environment:
|
||||
id: Optional[int] = None
|
||||
name: str = ""
|
||||
variables: dict = field(default_factory=dict)
|
||||
is_active: bool = False
|
||||
|
||||
|
||||
@dataclass
|
||||
class MockEndpoint:
|
||||
id: Optional[int] = None
|
||||
method: str = "GET"
|
||||
path: str = "/mock"
|
||||
status_code: int = 200
|
||||
response_headers: dict = field(default_factory=dict)
|
||||
response_body: str = ""
|
||||
name: str = ""
|
||||
|
||||
|
||||
@dataclass
|
||||
class TestResult:
|
||||
name: str
|
||||
passed: bool
|
||||
message: str = ""
|
||||
|
||||
|
||||
@dataclass
|
||||
class CollectionRunResult:
|
||||
request_name: str
|
||||
method: str
|
||||
url: str
|
||||
status: int = 0
|
||||
elapsed_ms: float = 0.0
|
||||
test_results: list = field(default_factory=list)
|
||||
error: str = ""
|
||||
Reference in New Issue
Block a user