# Python API client for asguard

Complete Asguard platform SDK - Fraud Detection + Face Verification.
Two independent microservices, one unified client.

## Overview

This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 1.0.0
- Package version: 1.0.0

## Installation

You can install the package directly from your local repository or via `pip`:

```sh
pip install asguard
# Or when working locally:
python setup.py install
```

## Getting Started

Please follow the installation and then run the following:

```python
import time
import asguard
from asguard.api import fraud_detection_api
from asguard.models.fraud_check_request import FraudCheckRequest
from asguard.models.fraud_check_response import FraudCheckResponse
from pprint import pprint

# Configure API key authorization: ApiKeyAuth
configuration = asguard.Configuration(
    host="http://localhost:8081"
)
configuration.api_key['ApiKeyAuth'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'ApiKey'

# Configure Face Service manually via headers or base URL if needed
# Face API is typically hosted on port 8082 with Bearer token

# Enter a context with an instance of the API client
with asguard.ApiClient(configuration) as api_client:
    # Set default header for Fraud Service API Key
    api_client.set_default_header("X-API-Key", "YOUR_API_KEY")

    # Create an instance of the API class
    api_instance = fraud_detection_api.FraudDetectionApi(api_client)
    fraud_check_request = FraudCheckRequest(
        user_id="user_123",
        transaction_id="txn_456",
        amount=250000.0,
        currency="USD",
        ip_address="192.168.1.5",
        device_id="device_789"
    )

    try:
        # Check transaction for fraud risk
        api_response = api_instance.check_fraud(fraud_check_request)
        pprint(api_response)
    except asguard.ApiException as e:
        print("Exception when calling FraudDetectionApi->check_fraud: %s\n" % e)
```

## Documentation for API Endpoints

All URIs are relative to _http://localhost:8081_

| Class                 | Method                                                         | HTTP request          | Description                                           |
| --------------------- | -------------------------------------------------------------- | --------------------- | ----------------------------------------------------- |
| _FaceVerificationApi_ | [**analyze_face**](docs/FaceVerificationApi.md#analyze_face)   | **POST** /v1/analyze  | Analyze face image quality and extract embedding      |
| _FaceVerificationApi_ | [**compare_faces**](docs/FaceVerificationApi.md#compare_faces) | **POST** /v1/compare  | Compare a probe face image with a reference embedding |
| _FraudDetectionApi_   | [**check_fraud**](docs/FraudDetectionApi.md#check_fraud)       | **POST** /analyze     | Check transaction for fraud risk                      |
| _SystemApi_           | [**health_check_face**](docs/SystemApi.md#health_check_face)   | **GET** /face/health  | Face service health check                             |
| _SystemApi_           | [**health_check_fraud**](docs/SystemApi.md#health_check_fraud) | **GET** /fraud/health | Fraud service health check                            |

## Documentation For Models

- [AnalyzeFaceRequest](docs/AnalyzeFaceRequest.md)
- [AnalyzeResponse](docs/AnalyzeResponse.md)
- [CompareFacesRequest](docs/CompareFacesRequest.md)
- [CompareResponse](docs/CompareResponse.md)
- [ErrorResponse](docs/ErrorResponse.md)
- [FraudCheckRequest](docs/FraudCheckRequest.md)
- [FraudCheckResponse](docs/FraudCheckResponse.md)
- [HealthResponse](docs/HealthResponse.md)

## Documentation For Authorization

Authentication schemes defined for the API:

### ApiKeyAuth

- **Type**: API key
- **API key parameter name**: X-API-Key
- **Location**: HTTP header

### BearerAuth

- **Type**: HTTP Bearer token authentication
