Type Definitions

Response Types

class hfortix_core.APIResponse[source]

Bases: TypedDict

Base API response structure from FortiOS

Not all fields are present in every response. Use total=False to make all fields optional.

http_status: int
results: Any
revision: str
revision_changed: bool
old_revision: str
vdom: str
path: str
name: str
status: str
http_method: str
serial: str
version: str
build: int
mkey: str
class hfortix_core.types.RawAPIResponse[source]

Bases: TypedDict

Raw FortiOS API response envelope returned when raw_json=True.

This is the complete response from the FortiOS API before any unwrapping. Use this for type checking raw_json=True calls.

All fields are marked as required to provide autocomplete without warnings. The primary purpose is to catch typos - accessing undefined fields will show an error.

Note: Not all fields are present in every response. GET responses include results, serial, version, build. Mutation responses include mkey, revision. Use .get() for fields that may not be present.

Example GET response:
{

“http_method”: “GET”, “results”: […], “status”: “success”, “http_status”: 200, “vdom”: “root”, “path”: “firewall”, “serial”: “FGT…”, “version”: “v7.4.8”, “build”: 3636

}

Example POST/PUT/DELETE response:
{

“http_method”: “POST”, “revision”: “1234567890”, “mkey”: “object_name”, “status”: “success”, “http_status”: 200, “vdom”: “root”

}

http_method: str
http_status: int
status: str
vdom: str
results: Any
path: str
name: str
serial: str
version: str
build: int
mkey: str
revision: str
revision_changed: bool
old_revision: str
class hfortix_core.types.MutationResponse[source]

Bases: TypedDict

Response structure from POST/PUT/DELETE operations.

This TypedDict validates that only known API response fields are accessed. These fields are always present in FortiOS API mutation responses.

http_status: int
status: str
class hfortix_core.types.MutationResponseFull[source]

Bases: TypedDict

Extended response structure from POST/PUT/DELETE operations.

Includes optional fields that may be present in some responses.

http_status: int
status: str
vdom: str
mkey: str
revision: str
serial: str
version: str
build: int
class hfortix_core.ListResponse[source]

Bases: TypedDict

Response from list/get operations that return multiple items

http_status: int
results: list[dict[str, Any]]
vdom: str
path: str
name: str
status: str
serial: str
version: str
build: int
class hfortix_core.ObjectResponse[source]

Bases: TypedDict

Response from get operations that return a single item

http_status: int
results: dict[str, Any]
vdom: str
path: str
name: str
status: str
serial: str
version: str
build: int
class hfortix_core.ErrorResponse[source]

Bases: TypedDict

Error response structure from FortiOS API

http_status: int
error: int
errorcode: int
message: str
vdom: str

Connection & Request Types

class hfortix_core.ConnectionStats[source]

Bases: TypedDict

Connection pool statistics

Returned by HTTPClient.get_connection_stats()

http2_enabled: bool
max_connections: int
max_keepalive_connections: int
active_requests: int
total_requests: int
pool_exhaustion_count: int
circuit_breaker_state: Literal['closed', 'open', 'half-open']
consecutive_failures: int
last_failure_time: float | None
class hfortix_core.RequestInfo[source]

Bases: TypedDict

Information about a request (for debugging)

Returned by HTTPClient.inspect_last_request()

method: str
endpoint: str
params: dict[str, Any] | None
data: dict[str, Any] | None
response_time_ms: float | None
status_code: int | None
timestamp: float
error: str

Circuit Breaker Types

hfortix_core.CircuitBreakerState

alias of Literal[‘closed’, ‘open’, ‘half-open’]