Coverage for fingerprint_server_sdk / api_response.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-11 18:41 +0000

1"""API response object.""" 

2 

3from __future__ import annotations 

4 

5from collections.abc import Mapping 

6from typing import Generic, Optional, TypeVar 

7 

8from pydantic import BaseModel, Field, StrictBytes, StrictInt 

9 

10T = TypeVar('T') 

11 

12 

13class ApiResponse(BaseModel, Generic[T]): 

14 """ 

15 API response object 

16 """ 

17 

18 status_code: StrictInt = Field(description='HTTP status code') 

19 headers: Optional[Mapping[str, str]] = Field(None, description='HTTP headers') 

20 data: T = Field(description='Deserialized data given the data type') 

21 raw_data: StrictBytes = Field(description='Raw data (HTTP response body)') 

22 

23 model_config = {'arbitrary_types_allowed': True}