# franck-gaspoz/gtradrestapi architecture

> Architecture diagram of the GitHub repository franck-gaspoz/gtradrestapi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/franck-gaspoz/gtradrestapi
- Repository: https://github.com/franck-gaspoz/gtradrestapi

## Overview

##### Project type and purpose
- This is an open-source .NET Framework 4.6.2 library plus a small CLI wrapper that lets C# programs (or end-users via command line) call Google Translate’s undocumented REST API for free translations.
- Key artifacts:
- GTradRestAPIClient (and its interface) – the core client library
- CLI.cs – a console‐app entrypoint that uses the client
- Domain types (Translation, Languages, TranslateException)
- Utility layers (NetUtil, LanguagesUtil)
- Configuration (app.config / GTradRestAPISettings, Properties/Settings)

##### File structure
- Top-level .cs files define the library and CLI.
- GTradRestAPIClient.cs + IGTradRestAPIClient.cs implement an interface-driven HTTP client.
- Utilities (NetUtil) encapsulate HTTP/URL formation and calls.
- Domain objects (Translation.cs, Languages.cs) model input/output.
- Exceptions (TranslateException.cs) handle errors.
- CLI.cs wires up user input → client → output.
- app.config / Settings.settings hold default REST endpoint and keys.
- Third-party libs (packages/Newtonsoft.Json for JSON parsing, Microsoft.Bcl for async support).

##### README for additional insights
- Usage snippet shows asynchronous TranslateAsync call returning a Task<string>.
- No built-in UI beyond the console app.
- Development has stopped; focus is solely on core translation functionality.

##### Elements
- Green for third-party dependencies
- Orange for external systems (Google Translate API)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        CLI["CLI"]:::internal
    end

    %% Client Library Layer
    subgraph "Client Library"
        IClient["IGTradRestAPIClient"]:::internal
        Client["GTradRestAPIClient"]:::internal
    end

    %% Utilities Layer
    subgraph "Utilities"
        NetUtil["NetUtil"]:::internal
        LangUtil["LanguagesUtil"]:::internal
    end

    %% Domain Layer
    subgraph "Domain"
        TransObj["Translation"]:::internal
        LangEnum["Languages"]:::internal
        TransEx["TranslateException"]:::internal
    end

    %% Configuration
    subgraph "Configuration"
        AppConfig["app.config"]:::config
        SettingsClass["GTradRestAPISettings"]:::config
        SettingsDesigner["Properties/Settings.settings\n& Settings.Designer.cs"]:::config
    end

    %% Third-Party Dependencies
    subgraph "Third-Party Dependencies"
        Newtonsoft["Newtonsoft.Json"]:::thirdparty
        Bcl["Microsoft.Bcl.Async"]:::thirdparty
    end

    %% External Service
    External["Google Translate REST API"]:::external

    %% Relationships
    CLI -->|calls TranslateAsync| IClient
    IClient -->|implemented by| Client
    Client -->|uses| NetUtil
    Client -->|uses| LangUtil
    Client -->|reads config from| AppConfig
    Client -->|reads settings from| SettingsClass
    Client -->|handles errors via| TransEx
    Client -->|returns| TransObj
    NetUtil -->|sends HTTP to| External
    External -->|returns JSON| NetUtil
    NetUtil -->|serializes/deserializes via| Newtonsoft
    Client -->|async support via| Bcl

    %% Click Events
    click CLI "https://github.com/franck-gaspoz/gtradrestapi/blob/master/CLI.cs"
    click IClient "https://github.com/franck-gaspoz/gtradrestapi/blob/master/IGTradRestAPIClient.cs"
    click Client "https://github.com/franck-gaspoz/gtradrestapi/blob/master/GTradRestAPIClient.cs"
    click NetUtil "https://github.com/franck-gaspoz/gtradrestapi/blob/master/NetUtil.cs"
    click LangUtil "https://github.com/franck-gaspoz/gtradrestapi/blob/master/LanguagesUtil.cs"
    click TransObj "https://github.com/franck-gaspoz/gtradrestapi/blob/master/Translation.cs"
    click LangEnum "https://github.com/franck-gaspoz/gtradrestapi/blob/master/Languages.cs"
    click TransEx "https://github.com/franck-gaspoz/gtradrestapi/blob/master/TranslateException.cs"
    click AppConfig "https://github.com/franck-gaspoz/gtradrestapi/blob/master/app.config"
    click SettingsClass "https://github.com/franck-gaspoz/gtradrestapi/blob/master/GTradRestAPISettings.cs"
    click SettingsDesigner "https://github.com/franck-gaspoz/gtradrestapi/blob/master/Properties/Settings.settings"
    click SettingsDesigner "https://github.com/franck-gaspoz/gtradrestapi/blob/master/Properties/Settings.Designer.cs"
    click Newtonsoft "https://github.com/franck-gaspoz/gtradrestapi/blob/master/packages/Newtonsoft.Json.11.0.2/lib/net40/Newtonsoft.Json.xml"
    click Bcl "https://github.com/franck-gaspoz/gtradrestapi/blob/master/packages/Microsoft.Bcl.1.1.10"

    %% Styles
    classDef internal fill:#d0e1f9,stroke:#2b6cb0,color:#2b6cb0
    classDef thirdparty fill:#c6f6d5,stroke:#38a169,color:#2f855a
    classDef external fill:#fed7d7,stroke:#e53e3e,color:#c53030
    classDef config fill:#f7fafc,stroke:#a0aec0,color:#4a5568,stroke-dasharray: 5 5
```
